### Eclipse Workspace Patch 1.0 #P org.eclipse.pde.ui Index: src/org/eclipse/pde/internal/ui/PDEUIMessages.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java,v retrieving revision 1.295 diff -u -r1.295 PDEUIMessages.java --- src/org/eclipse/pde/internal/ui/PDEUIMessages.java 11 Jul 2007 20:16:22 -0000 1.295 +++ src/org/eclipse/pde/internal/ui/PDEUIMessages.java 12 Jul 2007 15:26:40 -0000 @@ -2384,10 +2384,6 @@ public static String AbstractSchemaDetails_unboundedButton; - public static String ElementSection_compositorMenu; - - public static String ElementSection_referenceMenu; - public static String NewRestrictionDialog_title; public static String NewRestrictionDialog_message; Index: src/org/eclipse/pde/internal/ui/pderesources.properties =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties,v retrieving revision 1.885 diff -u -r1.885 pderesources.properties --- src/org/eclipse/pde/internal/ui/pderesources.properties 11 Jul 2007 20:16:21 -0000 1.885 +++ src/org/eclipse/pde/internal/ui/pderesources.properties 12 Jul 2007 15:26:40 -0000 @@ -1707,9 +1707,7 @@ ApplicationSelectionDialog_dtitle=Debug ApplicationSelectionDialog_rtitle=Run -ElementSection_compositorMenu=&Compositor ElementSection_missingRefElement=Referenced element not available -ElementSection_referenceMenu=&Reference TargetPlatformPreferencePage_pluginsTab=&Plug-ins TargetPlatformPreferencePage_sourceCode=S&ource Code Locations TargetPlatformPreferencePage_reset=Rese&t Index: src/org/eclipse/pde/internal/ui/editor/schema/ElementSection.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/schema/ElementSection.java,v retrieving revision 1.49 diff -u -r1.49 ElementSection.java --- src/org/eclipse/pde/internal/ui/editor/schema/ElementSection.java 12 Jul 2007 14:42:55 -0000 1.49 +++ src/org/eclipse/pde/internal/ui/editor/schema/ElementSection.java 12 Jul 2007 15:26:40 -0000 @@ -36,6 +36,7 @@ import org.eclipse.pde.internal.core.ischema.ISchemaObject; import org.eclipse.pde.internal.core.ischema.ISchemaObjectReference; import org.eclipse.pde.internal.core.ischema.ISchemaRootElement; +import org.eclipse.pde.internal.core.ischema.ISchemaSimpleType; import org.eclipse.pde.internal.core.ischema.ISchemaType; import org.eclipse.pde.internal.core.schema.Schema; import org.eclipse.pde.internal.core.schema.SchemaAttribute; @@ -301,7 +302,7 @@ final Object object = ((IStructuredSelection) selection).getFirstElement(); MenuManager submenu = new MenuManager(PDEUIMessages.Menus_new_label); - if (object == null || object instanceof SchemaElement) { + if (object == null) { fNewElementAction.setSchema(fSchema); fNewElementAction.setEnabled(fSchema.isEditable()); submenu.add(fNewElementAction); @@ -331,32 +332,37 @@ schemaObject = schemaObject.getParent(); } if (sourceElement != null) { - ISchema schema = sourceElement.getSchema(); - MenuManager cmenu = new MenuManager(PDEUIMessages.ElementSection_compositorMenu); - cmenu.add(new NewCompositorAction(sourceElement, object, ISchemaCompositor.CHOICE)); - cmenu.add(new NewCompositorAction(sourceElement, object, ISchemaCompositor.SEQUENCE)); - if (submenu.getItems().length > 0) - submenu.add(new Separator()); - submenu.add(cmenu); + if (object instanceof SchemaCompositor || sourceElement.getType() instanceof ISchemaSimpleType || + ((ISchemaComplexType)sourceElement.getType()).getCompositor() == null) { + if (submenu.getItems().length > 0) + submenu.add(new Separator()); + submenu.add(new NewCompositorAction(sourceElement, object, ISchemaCompositor.CHOICE)); + submenu.add(new NewCompositorAction(sourceElement, object, ISchemaCompositor.SEQUENCE)); + } if (object instanceof SchemaCompositor) { - MenuManager refMenu = new MenuManager(PDEUIMessages.ElementSection_referenceMenu); - ISchemaElement[] elements = schema.getResolvedElements(); + boolean seperatorAdded = false; + ISchemaElement[] elements = sourceElement.getSchema().getResolvedElements(); Arrays.sort(elements); for (int i = 0; i < elements.length; i++) { - if (!(elements[i] instanceof SchemaRootElement)) - refMenu.add(new NewReferenceAction(sourceElement,object, elements[i])); + if (!(elements[i] instanceof SchemaRootElement)) { + if (!seperatorAdded) { + submenu.add(new Separator()); + seperatorAdded = true; + } + submenu.add(new NewReferenceAction(sourceElement,object, elements[i])); + } } - if (!refMenu.isEmpty()) - submenu.add(refMenu); } } } manager.add(submenu); if (object != null) { if (!(object instanceof ISchemaRootElement)) { //$NON-NLS-1$ + if (manager.getItems().length > 0) + manager.add(new Separator()); if(!(object instanceof ISchemaAttribute && ((ISchemaAttribute)object).getParent() instanceof ISchemaRootElement)) - { manager.add(new Separator()); + { Action deleteAction = new Action() { public void run() { handleDelete((IStructuredSelection) selection); @@ -574,7 +580,9 @@ getTreePart().setButtonEnabled(1, canAddAttribute); boolean canAddCompositor = false; - if (sobject instanceof ISchemaCompositor || (sobject instanceof ISchemaElement && !(sobject instanceof SchemaElementReference))) + if (sobject instanceof ISchemaCompositor || (sobject instanceof ISchemaElement && + !(sobject instanceof SchemaElementReference) && (((ISchemaElement)sobject).getType() instanceof ISchemaSimpleType || + ((ISchemaComplexType)((ISchemaElement)sobject).getType()).getCompositor() == null))) canAddCompositor = true; getTreePart().setButtonEnabled(2, canAddCompositor); getTreePart().setButtonEnabled(3, canAddCompositor);