diff options
author | Brian de Alwis | 2014-04-02 16:44:47 +0000 |
---|---|---|
committer | Curtis Windatt | 2014-04-16 18:34:49 +0000 |
commit | 4601464e73e5b534bd6482db8afb62a850c7ec37 (patch) | |
tree | 22dd52b5ea8713ef20d3e00fe7183332fa3ffadf | |
parent | 1c6fe2c59ce4b6a609a1b8fd7b59df473639e2e5 (diff) | |
download | eclipse.pde.ui-4601464e73e5b534bd6482db8afb62a850c7ec37.tar.gz eclipse.pde.ui-4601464e73e5b534bd6482db8afb62a850c7ec37.tar.xz eclipse.pde.ui-4601464e73e5b534bd6482db8afb62a850c7ec37.zip |
Bug 429420 - Manifest Extensions editor should indicate deprecated extension elements
List deprecated elements after non-deprecated elements in the New
Element context menu.
Signed-off-by: Brian de Alwis <bsd@mt.ca>
Change-Id: I124125a70eed3b7f51eefb7b12ad08ed6745b32f
5 files changed, 39 insertions, 21 deletions
diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/schema/SchemaElementReference.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/schema/SchemaElementReference.java index cf6b0330fe..e45c466140 100644 --- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/schema/SchemaElementReference.java +++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/schema/SchemaElementReference.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2014 IBM Corporation 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 @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Brian de Alwis (MTI) - bug 429420 *******************************************************************************/ package org.eclipse.pde.internal.core.schema; @@ -14,19 +15,10 @@ import java.io.PrintWriter; import java.io.Serializable; import java.util.Hashtable; import java.util.Vector; - import org.eclipse.core.runtime.PlatformObject; import org.eclipse.pde.core.ISourceObject; import org.eclipse.pde.internal.core.PDECoreMessages; -import org.eclipse.pde.internal.core.ischema.IMetaElement; -import org.eclipse.pde.internal.core.ischema.ISchema; -import org.eclipse.pde.internal.core.ischema.ISchemaAttribute; -import org.eclipse.pde.internal.core.ischema.ISchemaCompositor; -import org.eclipse.pde.internal.core.ischema.ISchemaDescriptor; -import org.eclipse.pde.internal.core.ischema.ISchemaElement; -import org.eclipse.pde.internal.core.ischema.ISchemaObject; -import org.eclipse.pde.internal.core.ischema.ISchemaObjectReference; -import org.eclipse.pde.internal.core.ischema.ISchemaType; +import org.eclipse.pde.internal.core.ischema.*; import org.w3c.dom.Comment; import org.w3c.dom.Node; @@ -277,14 +269,18 @@ public class SchemaElementReference extends PlatformObject implements ISchemaEle * @see org.eclipse.pde.internal.core.ischema.IMetaElement#isTranslatable() */ public boolean hasTranslatableContent() { - return false; + if (element == null) + return false; + return element.hasTranslatableContent(); } /* (non-Javadoc) * @see org.eclipse.pde.internal.core.ischema.IMetaElement#isDeprecated() */ public boolean isDeprecated() { - return false; + if (element == null) + return false; + return element.isDeprecated(); } public int compareTo(Object arg0) { diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java index 59add5483b..50a645ebf7 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java @@ -8,6 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation * Code 9 Corporation - on going enhancements and maintenance + * Brian de Alwis (MTI) - bug 429420 *******************************************************************************/ package org.eclipse.pde.internal.ui; @@ -3040,4 +3041,5 @@ public class PDEUIMessages extends NLS { public static String OSGiConsole_name; public static String OSGiConsoleFactory_title; + public static String NewElement_deprecated; } diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/ExtensionsSection.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/ExtensionsSection.java index 13114859b5..33ebc99654 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/ExtensionsSection.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/ExtensionsSection.java @@ -10,6 +10,7 @@ * Peter Friese <peter.friese@gentleware.com> - bug 194529, bug 196867 * Sascha Becher <s.becher@qualitype.com> - bug 360894 * Alexander Kurtakov <akurtako@redhat.com> - bug 415649 + * Brian de Alwis (MTI) - bug 429420 *******************************************************************************/ package org.eclipse.pde.internal.ui.editor.plugin; @@ -182,13 +183,22 @@ public class ExtensionsSection extends TreeSection implements IPropertyChangeLis // We have a schema complex type. Either the element has attributes // or the element has children. // Generate the list of element proposals - TreeSet<?> elementSet = XMLElementProposalComputer.computeElementProposal(elementInfo, (IDocumentElementNode) parent); - - // Create a corresponding menu entry for each element proposal - Iterator<?> iterator = elementSet.iterator(); - while (iterator.hasNext()) { - Action action = new NewElementAction((ISchemaElement) iterator.next(), parent); - menu.add(action); + TreeSet<ISchemaElement> elementSet = XMLElementProposalComputer.computeElementProposal(elementInfo, (IDocumentElementNode) parent); + + // Create a corresponding menu entry for each element proposal; + // first add non-deprecated elements, then add deprecated elements + for (ISchemaElement element : elementSet) { + if (!element.isDeprecated()) { + Action action = new NewElementAction(element, parent); + menu.add(action); + } + } + menu.add(new Separator()); + for (ISchemaElement element : elementSet) { + if (element.isDeprecated()) { + Action action = new NewElementAction(element, parent); + menu.add(action); + } } } } diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/NewElementAction.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/NewElementAction.java index 776e284d2c..49a1be3bd9 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/NewElementAction.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/NewElementAction.java @@ -7,11 +7,13 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Brian de Alwis (MTI) - bug 429420 *******************************************************************************/ package org.eclipse.pde.internal.ui.editor.plugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.jface.action.Action; +import org.eclipse.osgi.util.NLS; import org.eclipse.pde.core.plugin.IPluginElement; import org.eclipse.pde.core.plugin.IPluginParent; import org.eclipse.pde.internal.core.ischema.ISchemaElement; @@ -31,7 +33,11 @@ public class NewElementAction extends Action { this.elementInfo = elementInfo; // this.project = project; this.parent = parent; - setText(getElementName()); + if (elementInfo.isDeprecated()) { + setText(NLS.bind(PDEUIMessages.NewElement_deprecated, getElementName())); + } else { + setText(getElementName()); + } setImageDescriptor(PDEPluginImages.DESC_GENERIC_XML_OBJ); setEnabled(parent.getModel().isEditable()); } diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties index be3a1d7332..b2f3dacc0e 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties @@ -8,6 +8,7 @@ # Contributors: # IBM Corporation - initial API and implementation # Code 9 Corporation - on going enhancements and maintenance +# Brian de Alwis (MTI) - bug 429420 ############################################################################### ##################################### # PDE resource strings @@ -2410,3 +2411,6 @@ SearchRepositoriesForIUProposal_description=Opens the artifact search dialog to OSGiConsole_name=Host OSGi Console [{0}] OSGiConsoleFactory_title=WARNING: This console is connected to the current running instance of Eclipse! + +NewElement_deprecated={0} (deprecated) + |