aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorptessier2013-12-10 12:39:22 -0500
committerptessier2013-12-10 12:39:22 -0500
commit1c2ab3ecf11d18c39e68b616ec352f360ea1cb2d (patch)
tree9e1c539d4d81d69688d8250f390fed576227660e
parente82745f2606c2d5428a54ddd253cf32ad7fbdb63 (diff)
downloadorg.eclipse.papyrus-1c2ab3ecf11d18c39e68b616ec352f360ea1cb2d.zip
org.eclipse.papyrus-1c2ab3ecf11d18c39e68b616ec352f360ea1cb2d.tar.gz
org.eclipse.papyrus-1c2ab3ecf11d18c39e68b616ec352f360ea1cb2d.tar.xz
351803: [New Child] Papyrus shall provide a customizable "New Child"
menu https://bugs.eclipse.org/bugs/show_bug.cgi?id=351803
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.newchild/src/org/eclipse/papyrus/infra/newchild/CreationMenuFactory.java17
1 files changed, 10 insertions, 7 deletions
diff --git a/plugins/infra/org.eclipse.papyrus.infra.newchild/src/org/eclipse/papyrus/infra/newchild/CreationMenuFactory.java b/plugins/infra/org.eclipse.papyrus.infra.newchild/src/org/eclipse/papyrus/infra/newchild/CreationMenuFactory.java
index d899f0c..8ed37a1 100644
--- a/plugins/infra/org.eclipse.papyrus.infra.newchild/src/org/eclipse/papyrus/infra/newchild/CreationMenuFactory.java
+++ b/plugins/infra/org.eclipse.papyrus.infra.newchild/src/org/eclipse/papyrus/infra/newchild/CreationMenuFactory.java
@@ -83,11 +83,10 @@ public class CreationMenuFactory {
topMenuItem.setMenu(topMenu);
boolean oneDisplayedMenu=false;
for(org.eclipse.papyrus.infra.newchild.ElementCreationMenuModel.Menu currentMenu : folder.getMenu()) {
+ boolean result=false;
if( currentMenu instanceof Folder){
- boolean subMenu=populateMenu(topMenu, (Folder) currentMenu, selectedObject);
- if(subMenu){
- oneDisplayedMenu=true;
- }
+ result=populateMenu(topMenu, (Folder) currentMenu, selectedObject);
+
}
@@ -100,20 +99,23 @@ public class CreationMenuFactory {
EStructuralFeature feature= selectedObject.eClass().getEStructuralFeature(role);
if( feature instanceof EReference){
reference=(EReference)feature;
- oneDisplayedMenu = constructMenu(selectedObject, topMenu, currentCreationMenu, reference);
+ result =constructMenu(selectedObject, topMenu, currentCreationMenu, reference);
}
}
else{//no precisison
//test if all roles must be displayed
if(currentCreationMenu.isDisplayAllRoles()){
- oneDisplayedMenu = constructMenu(selectedObject, topMenu, currentCreationMenu);
+ result = constructMenu(selectedObject, topMenu, currentCreationMenu);
}
else{
- oneDisplayedMenu = constructMenu(selectedObject, topMenu, currentCreationMenu, reference);
+ result = constructMenu(selectedObject, topMenu, currentCreationMenu, reference);
}
}
}
+ if(result){
+ oneDisplayedMenu=true;
+ }
}
if(!oneDisplayedMenu){
topMenuItem.dispose();
@@ -125,6 +127,7 @@ public class CreationMenuFactory {
}
+
/**
* create menu by displaying if possible different roles
* @param selectedObject the current object