/**
 * Copyright (c) 2016 EclipseSource Services GmbH and others.
 * 
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Martin Fleck (EclipseSource) - Initial API and implementation
 * Benoit Maggi (CEA LIST) - Change for training library example
 */
package org.eclipse.papyrus.training.library.newchild.internal;

import org.eclipse.papyrus.infra.newchild.CreationMenuRegistry;
import org.eclipse.papyrus.infra.newchild.elementcreationmenumodel.Folder;

/**
 * Cleans the creation edge menu.
 */
public final class HideNewChildEdgeUtil {
	
	private static final String UML_NEW_RELATIONSHIP_MENU = "/resource/UMLEdges.creationmenumodel"; //$NON-NLS-1$

	private static final String[] DEACTIVATED_CHILD_MENUS = new String[] {
		UML_NEW_RELATIONSHIP_MENU
	};
	
	private HideNewChildEdgeUtil() {
		// hidden constructor.
	}

	/**
	 * Cleans the creation menu.
	 */
	public static void clean() {
		CreationMenuRegistry instance = org.eclipse.papyrus.infra.newchild.CreationMenuRegistry.getInstance();
		for (Folder folder : instance.getRootFolder()) {
			for (String childMenuPath : DEACTIVATED_CHILD_MENUS) {
				if (folder.eResource().getURI().toString().endsWith(childMenuPath)) {
					instance.setCreationMenuVisibility(folder, false);
				}
			}
		}
	}
}

@@ -690,20 +690,334 @@
 e menu.%0A
+ * %0A * The code in HideNewChildEdgeUtil is a _trick_ to hide the UML menu when%0A * creating an Enterprise Product. You may also hide the menus using the%0A * preferences, some people also used home made code to switch these preferences%0A * when changing viewpoints but nothing is currently integrated in Papyrus core.%0A
  */%0A
-
 public f
@@ -1050,18 +1050,17 @@
 eUtil %7B%0A
-%09
 %0A
+
 %09private
@@ -1234,19 +1234,17 @@
 ring%5B%5D %7B
-%0A%09%09
+ 
 UML_NEW_
@@ -1264,14 +1264,12 @@
 MENU
-%0A%09
+ 
 %7D;%0A
-%09
 %0A%09pr

Fix #29: Add some documentation on HideNewChildEdgeUtil