Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 89999 Details for
Bug 181515
Provide more structure, safety, and convenience for ID-based references between extension points (id hell)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
org.eclipse.pde.patch
pde.patch (text/plain), 46.96 KB, created by
Chris Aniszczyk
on 2008-02-18 16:25:19 EST
(
hide
)
Description:
org.eclipse.pde.patch
Filename:
MIME Type:
Creator:
Chris Aniszczyk
Created:
2008-02-18 16:25:19 EST
Size:
46.96 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.pde.core >Index: src/org/eclipse/pde/internal/core/ischema/ISchemaAttribute.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/ischema/ISchemaAttribute.java,v >retrieving revision 1.14 >diff -u -r1.14 ISchemaAttribute.java >--- src/org/eclipse/pde/internal/core/ischema/ISchemaAttribute.java 2 Jan 2008 15:56:19 -0000 1.14 >+++ src/org/eclipse/pde/internal/core/ischema/ISchemaAttribute.java 18 Feb 2008 21:22:38 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2006 IBM Corporation and others. >+ * Copyright (c) 2000, 2008 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 >@@ -43,7 +43,8 @@ > public static final String[] TYPES = {"boolean", //$NON-NLS-1$ > "string", //$NON-NLS-1$ > "java", //$NON-NLS-1$ >- "resource" //$NON-NLS-1$ >+ "resource", //$NON-NLS-1$ >+ "identifier" //$NON-NLS-1$ > }; > > /** >Index: src/org/eclipse/pde/internal/core/ischema/IMetaAttribute.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/ischema/IMetaAttribute.java,v >retrieving revision 1.9 >diff -u -r1.9 IMetaAttribute.java >--- src/org/eclipse/pde/internal/core/ischema/IMetaAttribute.java 2 Jan 2008 15:56:19 -0000 1.9 >+++ src/org/eclipse/pde/internal/core/ischema/IMetaAttribute.java 18 Feb 2008 21:22:38 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2006 IBM Corporation and others. >+ * Copyright (c) 2000, 2008 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 >@@ -33,6 +33,14 @@ > public static final int RESOURCE = 2; > > /** >+ * Indicates that the value of the associated attribute is defined >+ * in another extension element attribute. >+ * >+ * @since 3.4 >+ */ >+ public static final int IDENTIFIER = 3; >+ >+ /** > * Property that indicates if an attribute is translatable > */ > public static final String P_TRANSLATABLE = "translatable"; //$NON-NLS-1$ >@@ -42,14 +50,9 @@ > */ > public static final String P_DEPRECATED = "deprecated"; //$NON-NLS-1$ > >- /* >- * non-Javadoc >- */ >- public static final String[] kindTable = {"string", "java", "resource"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ >- > /** > * Returns optional name of the Java type this type must be based on (only >- * for JAVA kind). >+ * for JAVA kind), or the path expression for IDENTIFIER kind. > */ > public String getBasedOn(); > >Index: src/org/eclipse/pde/internal/core/builders/ExtensionsErrorReporter.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/builders/ExtensionsErrorReporter.java,v >retrieving revision 1.22 >diff -u -r1.22 ExtensionsErrorReporter.java >--- src/org/eclipse/pde/internal/core/builders/ExtensionsErrorReporter.java 4 Jan 2008 21:50:31 -0000 1.22 >+++ src/org/eclipse/pde/internal/core/builders/ExtensionsErrorReporter.java 18 Feb 2008 21:22:38 -0000 >@@ -320,6 +320,8 @@ > validateJavaAttribute(element, attr); > } else if (kind == IMetaAttribute.RESOURCE) { > validateResourceAttribute(element, attr); >+ } else if (kind == IMetaAttribute.IDENTIFIER) { >+ validateIdentifierAttribute(element, attr, attInfo); > } else if (type.getName().equals("boolean")) { //$NON-NLS-1$ > validateBoolean(element, attr); > } >@@ -531,6 +533,20 @@ > reportIllegalAttributeValue(element, attr); > } > >+ private void validateIdentifierAttribute(Element element, Attr attr, ISchemaAttribute attInfo) { >+ int severity = CompilerFlags.getFlag(fProject, CompilerFlags.P_UNKNOWN_IDENTIFIER); >+ if (severity != CompilerFlags.IGNORE) { >+ String value = attr.getValue(); >+ String basedOn = attInfo.getBasedOn(); >+ if (value != null && basedOn != null) { >+ Map attributes = PDERegistryHelper.getValidAttributes(basedOn); >+ if (!attributes.containsKey(value)) { // report error if we are missing something >+ report(NLS.bind(PDECoreMessages.ExtensionsErrorReporter_unknownIdentifier, (new String[] {attr.getValue(), attr.getName()})), getLine(element, attr.getName()), severity, PDEMarkerFactory.CAT_OTHER); >+ } >+ } >+ } >+ } >+ > protected void reportUnusedAttribute(Element element, String attName, int severity) { > String message = NLS.bind(PDECoreMessages.Builders_Manifest_unused_attribute, attName); > report(message, getLine(element, attName), severity, PDEMarkerFactory.CAT_OTHER); >Index: src/org/eclipse/pde/internal/core/builders/CompilerFlags.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/builders/CompilerFlags.java,v >retrieving revision 1.6 >diff -u -r1.6 CompilerFlags.java >--- src/org/eclipse/pde/internal/core/builders/CompilerFlags.java 2 Jan 2008 15:56:21 -0000 1.6 >+++ src/org/eclipse/pde/internal/core/builders/CompilerFlags.java 18 Feb 2008 21:22:38 -0000 >@@ -13,10 +13,7 @@ > import org.eclipse.core.resources.IProject; > import org.eclipse.core.resources.ProjectScope; > import org.eclipse.core.runtime.Platform; >-import org.eclipse.core.runtime.preferences.DefaultScope; >-import org.eclipse.core.runtime.preferences.IPreferencesService; >-import org.eclipse.core.runtime.preferences.IScopeContext; >-import org.eclipse.core.runtime.preferences.InstanceScope; >+import org.eclipse.core.runtime.preferences.*; > import org.eclipse.pde.internal.core.natures.PDE; > import org.osgi.service.prefs.BackingStoreException; > import org.osgi.service.prefs.Preferences; >@@ -58,6 +55,8 @@ > > public static final String P_UNKNOWN_RESOURCE = "compilers.p.unknown-resource"; //$NON-NLS-1$ > >+ public static final String P_UNKNOWN_IDENTIFIER = "compilers.p.unknown-identifier"; //$NON-NLS-1$ >+ > public static final String P_NO_REQUIRED_ATT = "compilers.p.no-required-att"; //$NON-NLS-1$ > > public static final String P_NOT_EXTERNALIZED = "compilers.p.not-externalized-att"; //$NON-NLS-1$ >@@ -205,6 +204,7 @@ > node.putInt(P_DEPRECATED, WARNING); > node.putInt(P_UNKNOWN_CLASS, WARNING); > node.putInt(P_UNKNOWN_RESOURCE, WARNING); >+ node.putInt(P_UNKNOWN_IDENTIFIER, WARNING); > node.putInt(P_NOT_EXTERNALIZED, IGNORE); > node.putInt(P_BUILD, WARNING); > node.putInt(P_INCOMPATIBLE_ENV, WARNING); >Index: src/org/eclipse/pde/internal/core/schema/SchemaAttribute.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/schema/SchemaAttribute.java,v >retrieving revision 1.31 >diff -u -r1.31 SchemaAttribute.java >--- src/org/eclipse/pde/internal/core/schema/SchemaAttribute.java 9 Jan 2008 22:58:17 -0000 1.31 >+++ src/org/eclipse/pde/internal/core/schema/SchemaAttribute.java 18 Feb 2008 21:22:38 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2006 IBM Corporation and others. >+ * Copyright (c) 2000, 2008 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 >@@ -12,12 +12,7 @@ > package org.eclipse.pde.internal.core.schema; > > import java.io.PrintWriter; >- >-import org.eclipse.pde.internal.core.ischema.ISchema; >-import org.eclipse.pde.internal.core.ischema.ISchemaAttribute; >-import org.eclipse.pde.internal.core.ischema.ISchemaElement; >-import org.eclipse.pde.internal.core.ischema.ISchemaObject; >-import org.eclipse.pde.internal.core.ischema.ISchemaSimpleType; >+import org.eclipse.pde.internal.core.ischema.*; > import org.eclipse.pde.internal.core.util.SchemaUtil; > import org.eclipse.pde.internal.core.util.XMLComponentRegistry; > >@@ -67,7 +62,9 @@ > } > > public String getBasedOn() { >- return getKind() == JAVA ? basedOn : null; >+ if (getKind() == JAVA || getKind() == IDENTIFIER) >+ return basedOn; >+ return null; > } > > public int getKind() { >@@ -190,13 +187,15 @@ > writer.println(indent2 + "<appinfo>"); //$NON-NLS-1$ > writer.print(indent3 + "<meta.attribute"); //$NON-NLS-1$ > String kindValue = null; >- switch (getKind()) { >+ switch (getKind()) { // TODO let's use some constants ;D > case JAVA : > kindValue = "java"; //$NON-NLS-1$ > break; > case RESOURCE : > kindValue = "resource"; //$NON-NLS-1$ > break; >+ case IDENTIFIER : >+ kindValue = "identifier"; //$NON-NLS-1$ > } > if (kindValue != null) > writer.print(" kind=\"" + kindValue + "\""); //$NON-NLS-1$ //$NON-NLS-2$ >Index: src/org/eclipse/pde/internal/core/schema/Schema.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/schema/Schema.java,v >retrieving revision 1.72 >diff -u -r1.72 Schema.java >--- src/org/eclipse/pde/internal/core/schema/Schema.java 9 Jan 2008 22:58:17 -0000 1.72 >+++ src/org/eclipse/pde/internal/core/schema/Schema.java 18 Feb 2008 21:22:38 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2007 IBM Corporation and others. >+ * Copyright (c) 2000, 2008 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 >@@ -11,43 +11,16 @@ > *******************************************************************************/ > package org.eclipse.pde.internal.core.schema; > >-import java.io.FileNotFoundException; >-import java.io.IOException; >-import java.io.InputStream; >-import java.io.PrintWriter; >+import java.io.*; > import java.net.URL; >-import java.util.Collections; >-import java.util.Iterator; >-import java.util.Locale; >-import java.util.Vector; >- >+import java.util.*; > import org.eclipse.core.runtime.PlatformObject; >-import org.eclipse.pde.core.IModelChangedEvent; >-import org.eclipse.pde.core.IModelChangedListener; >-import org.eclipse.pde.core.ModelChangedEvent; >+import org.eclipse.pde.core.*; > import org.eclipse.pde.internal.core.PDECore; > import org.eclipse.pde.internal.core.XMLDefaultHandler; >-import org.eclipse.pde.internal.core.ischema.IDocumentSection; >-import org.eclipse.pde.internal.core.ischema.IMetaAttribute; >-import org.eclipse.pde.internal.core.ischema.ISchema; >-import org.eclipse.pde.internal.core.ischema.ISchemaAttribute; >-import org.eclipse.pde.internal.core.ischema.ISchemaComplexType; >-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.ISchemaEnumeration; >-import org.eclipse.pde.internal.core.ischema.ISchemaInclude; >-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.util.PDEXMLHelper; >-import org.eclipse.pde.internal.core.util.SAXParserWrapper; >-import org.eclipse.pde.internal.core.util.SchemaUtil; >-import org.w3c.dom.NamedNodeMap; >-import org.w3c.dom.Node; >-import org.w3c.dom.NodeList; >+import org.eclipse.pde.internal.core.ischema.*; >+import org.eclipse.pde.internal.core.util.*; >+import org.w3c.dom.*; > import org.xml.sax.SAXException; > > public class Schema extends PlatformObject implements ISchema { >@@ -716,6 +689,8 @@ > return IMetaAttribute.JAVA; > if (name.equals("resource")) //$NON-NLS-1$ > return IMetaAttribute.RESOURCE; >+ if (name.equals("identifier")) //$NON-NLS-1$ >+ return IMetaAttribute.IDENTIFIER; > } > return IMetaAttribute.STRING; > } >Index: src/org/eclipse/pde/internal/core/PDECoreMessages.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PDECoreMessages.java,v >retrieving revision 1.49 >diff -u -r1.49 PDECoreMessages.java >--- src/org/eclipse/pde/internal/core/PDECoreMessages.java 4 Feb 2008 22:02:18 -0000 1.49 >+++ src/org/eclipse/pde/internal/core/PDECoreMessages.java 18 Feb 2008 21:22:37 -0000 >@@ -52,8 +52,8 @@ > public static String BundleTextChangeListener_editNames_remove; > > public static String ExtensionsErrorReporter_maxOccurrence; >- > public static String ExtensionsErrorReporter_minOccurrence; >+ public static String ExtensionsErrorReporter_unknownIdentifier; > > // Status text ##################################### > public static String BinaryRepositoryProvider_veto; >Index: src/org/eclipse/pde/internal/core/pderesources.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/pderesources.properties,v >retrieving revision 1.87 >diff -u -r1.87 pderesources.properties >--- src/org/eclipse/pde/internal/core/pderesources.properties 4 Feb 2008 22:02:19 -0000 1.87 >+++ src/org/eclipse/pde/internal/core/pderesources.properties 18 Feb 2008 21:22:37 -0000 >@@ -192,6 +192,7 @@ > ExtensionsErrorReporter_InvalidSchema="{0}" does not reference a schema file. > ExtensionsErrorReporter_maxOccurrence=A maximum of {0} ''{1}'' elements can be specified. > ExtensionsErrorReporter_minOccurrence=A minimum of {0} ''{1}'' elements must be specified. >+ExtensionsErrorReporter_unknownIdentifier=Referenced identifier ''{0}'' in attribute ''{1}'' cannot be found > PluginConverter_BundleLocationIsNull=Bundle manifest location cannot be null > PluginConverter_EclipseConverterFileNotFound=Could not find a META-INF/MANIFEST.MF, plugin.xml or a fragment.xml in {0}. > PluginConverter_EclipseConverterErrorCreatingBundleManifest=Error creating bundle manifest file for {0} at {1}. >Index: src/org/eclipse/pde/internal/core/util/PDERegistryHelper.java >=================================================================== >RCS file: src/org/eclipse/pde/internal/core/util/PDERegistryHelper.java >diff -N src/org/eclipse/pde/internal/core/util/PDERegistryHelper.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/internal/core/util/PDERegistryHelper.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,71 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.pde.internal.core.util; >+ >+import java.util.*; >+import org.eclipse.core.runtime.IConfigurationElement; >+import org.eclipse.core.runtime.IExtension; >+import org.eclipse.pde.internal.core.PDECore; >+ >+public class PDERegistryHelper { >+ >+ /** >+ * Returns valid attributes given a proper reference id >+ * >+ * @param basedOn A valid reference id (e.g., org.eclipse.ui.perspectives/perspective/@id) >+ * @return A map with the ids as keys and respective {@link IConfigurationElement} as pairs >+ */ >+ public static Map getValidAttributes(String basedOn) { >+ Map attributeMap = new HashMap(); >+ gatherInfo(attributeMap, basedOn); >+ return attributeMap; >+ } >+ >+ private static void gatherInfo(Map attributesInfo, String basedOn) { >+ String[] path = basedOn.split("/"); //$NON-NLS-1$ >+ IExtension[] extensions = PDECore.getDefault().getExtensionsRegistry().findExtensions(path[0], true); >+ List members = new ArrayList(); >+ for (int i = 0; i < extensions.length; i++) { >+ IConfigurationElement[] elements = extensions[i].getConfigurationElements(); >+ for (int j = 0; j < elements.length; j++) { >+ if (elements[j].getName().equals(path[1])) { >+ members.add(elements[j]); >+ } >+ } >+ } >+ List parents = members; >+ for (int i = 2; i < path.length; i++) { >+ if (path[i].startsWith("@")) { //$NON-NLS-1$ >+ String attName = path[i].substring(1); >+ for (Iterator iterator = parents.iterator(); iterator.hasNext();) { >+ IConfigurationElement element = (IConfigurationElement) iterator.next(); >+ String value = element.getAttribute(attName); >+ if (value != null) { >+ attributesInfo.put(value, element); >+ } >+ } >+ return; >+ } >+ members = new ArrayList(); >+ for (Iterator iterator = parents.iterator(); iterator.hasNext();) { >+ IConfigurationElement element = (IConfigurationElement) iterator.next(); >+ members.addAll(keepGoing(element, path[i])); >+ } >+ parents = members; >+ } >+ } >+ >+ private static List keepGoing(IConfigurationElement element, String tag) { >+ return Arrays.asList(element.getChildren(tag)); >+ } >+ >+} >#P org.eclipse.pde.ui >Index: src/org/eclipse/pde/internal/ui/search/ManifestEditorOpener.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/search/ManifestEditorOpener.java,v >retrieving revision 1.10 >diff -u -r1.10 ManifestEditorOpener.java >--- src/org/eclipse/pde/internal/ui/search/ManifestEditorOpener.java 15 Feb 2008 21:13:04 -0000 1.10 >+++ src/org/eclipse/pde/internal/ui/search/ManifestEditorOpener.java 18 Feb 2008 21:22:40 -0000 >@@ -22,6 +22,7 @@ > import org.eclipse.ui.PartInitException; > import org.osgi.framework.Constants; > >+// TODO this needs a rewrite > public class ManifestEditorOpener { > > public static IEditorPart open(Match match, boolean activate) throws PartInitException { >@@ -113,6 +114,10 @@ > return getAttributeRegion(document, value, header.getOffset()); > } > >+ public static IRegion getAttributeMatch(ManifestEditor editor, String value, IDocument document) { >+ return getAttributeRegion(document, value, 0); >+ } >+ > // Try to find a match for an Extension or Extension point by looking through the extensions/extension points in UI model for match. > private static IRegion getAttributeMatch(ManifestEditor editor, IPluginObject object, IDocument document) { > IPluginObject[] elements = null; >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.358 >diff -u -r1.358 PDEUIMessages.java >--- src/org/eclipse/pde/internal/ui/PDEUIMessages.java 15 Feb 2008 21:13:05 -0000 1.358 >+++ src/org/eclipse/pde/internal/ui/PDEUIMessages.java 18 Feb 2008 21:22:39 -0000 >@@ -1081,6 +1081,10 @@ > public static String ResourceAttributeCellEditor_title; > public static String ResourceAttributeCellEditor_message; > >+ public static String IdAttributeRow_title; >+ public static String IdAttributeRow_message; >+ public static String IdAttributeRow_emptyMessage; >+ > public static String ManifestEditor_RuntimeForm_title; > public static String ManifestSourcePage_extensionPoints; > >@@ -2607,27 +2611,19 @@ > public static String SchemaDetails_deprecated; > > public static String SchemaAttributeDetails_use; >- > public static String SchemaAttributeDetails_type; >- > public static String SchemaAttributeDetails_restrictions; >- > public static String SchemaAttributeDetails_addRestButton; >- > public static String SchemaAttributeDetails_removeRestButton; >- > public static String SchemaAttributeDetails_extends; >- > public static String SchemaAttributeDetails_browseButton; >- > public static String SchemaAttributeDetails_implements; >- > public static String SchemaAttributeDetails_title; >- > public static String SchemaAttributeDetails_description; >- > public static String SchemaAttributeDetails_defaultDefaultValue; > >+ public static String SchemaStringAttributeDetails_reference; >+ > public static String SchemaDetails_name; > > public static String SchemaRootElementDetails_replacement; >@@ -3195,4 +3191,8 @@ > public static String FilteredPluginArtifactsSelectionDialog_showExtensionPoints; > public static String FilteredPluginArtifactsSelectionDialog_showExportedPackages; > >+ public static String FilteredSchemaAttributeSelectionDialog_title; >+ public static String FilteredSchemaAttributeSelectionDialog_message; >+ public static String FilteredSchemaAttributeSelectionDialog_searching; >+ > } >\ No newline at end of file >Index: src/org/eclipse/pde/internal/ui/PDEPluginImages.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEPluginImages.java,v >retrieving revision 1.106 >diff -u -r1.106 PDEPluginImages.java >--- src/org/eclipse/pde/internal/ui/PDEPluginImages.java 21 Jan 2008 17:38:12 -0000 1.106 >+++ src/org/eclipse/pde/internal/ui/PDEPluginImages.java 18 Feb 2008 21:22:39 -0000 >@@ -49,6 +49,7 @@ > public static final String IMG_ATT_FILE_OBJ = NAME_PREFIX + "IMG_ATT_FILE_OBJ"; //$NON-NLS-1$ > public static final String IMG_ATT_IMPL_OBJ = NAME_PREFIX + "IMG_ATT_IMPL_OBJ"; //$NON-NLS-1$ > public static final String IMG_ATT_REQ_OBJ = NAME_PREFIX + "IMG_ATT_REQ_OBJ"; //$NON-NLS-1$ >+ public static final String IMG_ATT_ID_OBJ = NAME_PREFIX + "IMG_ATT_ID_OBJ"; //$NON-NLS-1$ > public static final String IMG_GENERIC_XML_OBJ = NAME_PREFIX + "IMG_GENERIC_XML_OBJ"; //$NON-NLS-1$ > public static final String OBJ_DESC_GENERATE_CLASS = NAME_PREFIX + "OBJ_DESC_GENERATE_CLASS"; //$NON-NLS-1$ > public static final String OBJ_DESC_GENERATE_INTERFACE = NAME_PREFIX + "OBJ_DESC_GENERATE_INTERFACE"; //$NON-NLS-1$ >@@ -65,6 +66,7 @@ > public static final ImageDescriptor DESC_ATT_IMPL_OBJ = create(PATH_OBJ, "att_impl_obj.gif"); //$NON-NLS-1$ > public static final ImageDescriptor DESC_ATT_REQ_OBJ = create(PATH_OBJ, "att_req_obj.gif"); //$NON-NLS-1$ > public static final ImageDescriptor DESC_ATT_URI_OBJ = create(PATH_OBJ, "att_URI_obj.gif"); //$NON-NLS-1$ >+ public static final ImageDescriptor DESC_ATT_ID_OBJ = create(PATH_OBJ, "att_id_obj.gif"); //$NON-NLS-1$ > public static final ImageDescriptor DESC_BUNDLE_OBJ = create(PATH_OBJ, "bundle_obj.gif"); //$NON-NLS-1$ > public static final ImageDescriptor DESC_CHOICE_SC_OBJ = create(PATH_OBJ, "choice_sc_obj.gif"); //$NON-NLS-1$ > public static final ImageDescriptor DESC_FEATURE_JAR_OBJ = create(PATH_OBJ, "ftr_jar_obj.gif"); //$NON-NLS-1$ >@@ -306,6 +308,7 @@ > manage(IMG_ATT_FILE_OBJ, DESC_ATT_FILE_OBJ); > manage(IMG_ATT_IMPL_OBJ, DESC_ATT_IMPL_OBJ); > manage(IMG_ATT_REQ_OBJ, DESC_ATT_REQ_OBJ); >+ manage(IMG_ATT_ID_OBJ, DESC_ATT_ID_OBJ); > manage(IMG_GENERIC_XML_OBJ, DESC_GENERIC_XML_OBJ); > manage(OBJ_DESC_GENERATE_CLASS, DESC_GENERATE_CLASS); > manage(OBJ_DESC_GENERATE_INTERFACE, DESC_GENERATE_INTERFACE); >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.967 >diff -u -r1.967 pderesources.properties >--- src/org/eclipse/pde/internal/ui/pderesources.properties 15 Feb 2008 21:13:04 -0000 1.967 >+++ src/org/eclipse/pde/internal/ui/pderesources.properties 18 Feb 2008 21:22:39 -0000 >@@ -2474,4 +2474,11 @@ > FilteredPluginArtifactsSelectionDialog_searching=Searching... > FilteredPluginArtifactsSelectionDialog_showExtensions=Show Extensions > FilteredPluginArtifactsSelectionDialog_showExtensionPoints=Show Extension Points >-FilteredPluginArtifactsSelectionDialog_showExportedPackages=Show Exported Packages >\ No newline at end of file >+FilteredPluginArtifactsSelectionDialog_showExportedPackages=Show Exported Packages >+SchemaStringAttributeDetails_reference=References: >+IdAttributeRow_title=Select Identifier >+IdAttributeRow_message=Select an identifier: >+IdAttributeRow_emptyMessage=No identifiers found >+FilteredSchemaAttributeSelectionDialog_title=Select Attribute >+FilteredSchemaAttributeSelectionDialog_message=&Select an attribute (? = any character, * = any string): >+FilteredSchemaAttributeSelectionDialog_searching=Searching... >\ No newline at end of file >Index: src/org/eclipse/pde/internal/ui/PDELabelProvider.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDELabelProvider.java,v >retrieving revision 1.91 >diff -u -r1.91 PDELabelProvider.java >--- src/org/eclipse/pde/internal/ui/PDELabelProvider.java 12 Feb 2008 15:33:53 -0000 1.91 >+++ src/org/eclipse/pde/internal/ui/PDELabelProvider.java 18 Feb 2008 21:22:39 -0000 >@@ -771,6 +771,8 @@ > return get(PDEPluginImages.DESC_ATT_CLASS_OBJ); > if (att.getKind() == IMetaAttribute.RESOURCE) > return get(PDEPluginImages.DESC_ATT_FILE_OBJ); >+ if (att.getKind() == IMetaAttribute.IDENTIFIER) >+ return get(PDEPluginImages.DESC_ATT_ID_OBJ); > if (att.getUse() == ISchemaAttribute.REQUIRED) > return get(PDEPluginImages.DESC_ATT_REQ_OBJ); > return get(PDEPluginImages.DESC_ATT_IMPL_OBJ); >Index: src/org/eclipse/pde/internal/ui/editor/PDEFormEditor.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/PDEFormEditor.java,v >retrieving revision 1.62 >diff -u -r1.62 PDEFormEditor.java >--- src/org/eclipse/pde/internal/ui/editor/PDEFormEditor.java 16 Jan 2008 17:07:52 -0000 1.62 >+++ src/org/eclipse/pde/internal/ui/editor/PDEFormEditor.java 18 Feb 2008 21:22:39 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2007 IBM Corporation and others. >+ * Copyright (c) 2000, 2008 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 >@@ -692,7 +692,12 @@ > } > > public void openToSourcePage(Object object, int offset, int length) { >- InputContext context = getInputContext(object); >+ InputContext context = null; >+ if (object instanceof InputContext) { >+ context = (InputContext) object; >+ } else { >+ context = getInputContext(object); >+ } > if (context != null) { > PDESourcePage page = (PDESourcePage) setActivePage(context.getId()); > if (page != null) >Index: src/org/eclipse/pde/internal/ui/editor/plugin/ExtensionElementDetails.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/ExtensionElementDetails.java,v >retrieving revision 1.28 >diff -u -r1.28 ExtensionElementDetails.java >--- src/org/eclipse/pde/internal/ui/editor/plugin/ExtensionElementDetails.java 16 Jan 2008 17:07:46 -0000 1.28 >+++ src/org/eclipse/pde/internal/ui/editor/plugin/ExtensionElementDetails.java 18 Feb 2008 21:22:40 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2003, 2007 IBM Corporation and others. >+ * Copyright (c) 2003, 2008 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 >+ * Remy Chi Jian Suen <remy.suen@gmail.com> - Provide more structure, safety, and convenience for ID-based references between extension points (id hell) > *******************************************************************************/ > package org.eclipse.pde.internal.ui.editor.plugin; > >@@ -86,11 +87,13 @@ > > if (schemaElement != null) { > ISchemaAttribute atts[] = schemaElement.getAttributes(); >- // Compute horizontal span >- for (int i = 0; i < atts.length; i++) { >- if (isEditable() && (atts[i].getKind() == IMetaAttribute.JAVA || atts[i].getKind() == IMetaAttribute.RESOURCE)) { >- span = 3; >- break; >+ if (isEditable()) { >+ // Compute horizontal span >+ for (int i = 0; i < atts.length; i++) { >+ if (atts[i].getKind() == IMetaAttribute.JAVA || atts[i].getKind() == IMetaAttribute.RESOURCE || atts[i].getKind() == IMetaAttribute.IDENTIFIER) { >+ span = 3; >+ break; >+ } > } > } > glayout.numColumns = span; >@@ -125,6 +128,8 @@ > row = new ClassAttributeRow(this, att); > else if (att.getKind() == IMetaAttribute.RESOURCE) > row = new ResourceAttributeRow(this, att); >+ else if (att.getKind() == IMetaAttribute.IDENTIFIER) >+ row = new IdAttributeRow(this, att); > else if (att.isTranslatable()) > row = new TranslatableAttributeRow(this, att); > else { >Index: src/org/eclipse/pde/internal/ui/editor/schema/SchemaFormPage.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/schema/SchemaFormPage.java,v >retrieving revision 1.24 >diff -u -r1.24 SchemaFormPage.java >--- src/org/eclipse/pde/internal/ui/editor/schema/SchemaFormPage.java 16 Jan 2008 17:08:11 -0000 1.24 >+++ src/org/eclipse/pde/internal/ui/editor/schema/SchemaFormPage.java 18 Feb 2008 21:22:40 -0000 >@@ -56,6 +56,7 @@ > detailsPart.registerPage(SchemaStringAttributeDetails.class, new SchemaStringAttributeDetails(fSection)); > detailsPart.registerPage(SchemaJavaAttributeDetails.class, new SchemaJavaAttributeDetails(fSection)); > detailsPart.registerPage(SchemaOtherAttributeDetails.class, new SchemaOtherAttributeDetails(fSection)); >+ detailsPart.registerPage(SchemaIdentifierAttributeDetails.class, new SchemaIdentifierAttributeDetails(fSection)); > detailsPart.setPageProvider(this); > } > >@@ -77,6 +78,8 @@ > case IMetaAttribute.STRING : > if (att.getType().getName().equals(ISchemaAttribute.TYPES[ISchemaAttribute.STR_IND])) > return SchemaStringAttributeDetails.class; >+ case IMetaAttribute.IDENTIFIER : >+ return SchemaIdentifierAttributeDetails.class; > } > return SchemaOtherAttributeDetails.class; > } else >Index: src/org/eclipse/pde/internal/ui/editor/schema/SchemaIdentifierAttributeDetails.java >=================================================================== >RCS file: src/org/eclipse/pde/internal/ui/editor/schema/SchemaIdentifierAttributeDetails.java >diff -N src/org/eclipse/pde/internal/ui/editor/schema/SchemaIdentifierAttributeDetails.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/internal/ui/editor/schema/SchemaIdentifierAttributeDetails.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,95 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.pde.internal.ui.editor.schema; >+ >+import org.eclipse.jface.window.Window; >+import org.eclipse.pde.internal.core.ischema.*; >+import org.eclipse.pde.internal.core.schema.SchemaAttribute; >+import org.eclipse.pde.internal.ui.PDEPlugin; >+import org.eclipse.pde.internal.ui.PDEUIMessages; >+import org.eclipse.pde.internal.ui.editor.FormEntryAdapter; >+import org.eclipse.pde.internal.ui.parts.FormEntry; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.ui.IActionBars; >+import org.eclipse.ui.forms.widgets.FormToolkit; >+ >+public class SchemaIdentifierAttributeDetails extends SchemaAttributeDetails { >+ >+ private FormEntry fReferenceEntry; >+ >+ public SchemaIdentifierAttributeDetails(ElementSection section) { >+ super(section); >+ } >+ >+ protected void createTypeDetails(Composite parent, FormToolkit toolkit) { >+ fReferenceEntry = new FormEntry(parent, toolkit, PDEUIMessages.SchemaStringAttributeDetails_reference, PDEUIMessages.SchemaAttributeDetails_browseButton, false, 11); >+ } >+ >+ public void updateFields(ISchemaObject object) { >+ if (!(object instanceof SchemaAttribute)) >+ return; >+ super.updateFields(object); >+ >+ String basedOn = getAttribute().getBasedOn(); >+ if ((basedOn != null) && (basedOn.length() > 0)) { >+ fReferenceEntry.setValue(basedOn, true); >+ } >+ >+ boolean editable = isEditableElement(); >+ fReferenceEntry.setEditable(editable); >+ } >+ >+ public void hookListeners() { >+ super.hookListeners(); >+ IActionBars actionBars = getPage().getPDEEditor().getEditorSite().getActionBars(); >+ fReferenceEntry.setFormEntryListener(new FormEntryAdapter(this, actionBars) { >+ public void textValueChanged(FormEntry entry) { >+ if (blockListeners()) >+ return; >+ getAttribute().setBasedOn(entry.getValue()); >+ } >+ >+ public void browseButtonSelected(FormEntry entry) { >+ if (blockListeners()) >+ return; >+ doOpenSelectionDialog(fReferenceEntry); >+ } >+ }); >+ } >+ >+ private void doOpenSelectionDialog(FormEntry entry) { >+ FilteredSchemaAttributeSelectionDialog dialog = new FilteredSchemaAttributeSelectionDialog(PDEPlugin.getActiveWorkbenchShell()); >+ int status = dialog.open(); >+ if (status == Window.OK) { >+ Object[] result = dialog.getResult(); >+ Object object = result[0]; >+ if (object instanceof ISchemaAttribute) { >+ ISchemaAttribute attribute = (ISchemaAttribute) object; >+ String schemaId = attribute.getSchema().getQualifiedPointId(); >+ String refId = buildBasedOnValue(attribute); >+ String id = schemaId + '/' + refId; >+ entry.setValue(id); >+ } >+ } >+ } >+ >+ // TODO faulty recursion... this doesn't work in all cases probably... >+ private String buildBasedOnValue(ISchemaObject object) { >+ if (object instanceof ISchemaElement) >+ return object.getName() + '/' + buildBasedOnValue(object.getParent()); >+ return ""; //$NON-NLS-1$ >+ } >+ >+ private String buildBasedOnValue(ISchemaAttribute attribute) { >+ return buildBasedOnValue(attribute.getParent()) + "@" + attribute.getName(); //$NON-NLS-1$ >+ } >+ >+} >Index: src/org/eclipse/pde/internal/ui/editor/plugin/rows/IdAttributeRow.java >=================================================================== >RCS file: src/org/eclipse/pde/internal/ui/editor/plugin/rows/IdAttributeRow.java >diff -N src/org/eclipse/pde/internal/ui/editor/plugin/rows/IdAttributeRow.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/internal/ui/editor/plugin/rows/IdAttributeRow.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,88 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ * Remy Chi Jian Suen <remy.suen@gmail.com> - Provide more structure, safety, and convenience for ID-based references between extension points (id hell) >+ *******************************************************************************/ >+package org.eclipse.pde.internal.ui.editor.plugin.rows; >+ >+import java.util.Map; >+import org.eclipse.core.runtime.IConfigurationElement; >+import org.eclipse.jface.text.IDocument; >+import org.eclipse.jface.text.IRegion; >+import org.eclipse.jface.viewers.LabelProvider; >+import org.eclipse.jface.window.Window; >+import org.eclipse.pde.core.plugin.IPluginModelBase; >+import org.eclipse.pde.core.plugin.PluginRegistry; >+import org.eclipse.pde.internal.core.ischema.ISchemaAttribute; >+import org.eclipse.pde.internal.core.util.PDERegistryHelper; >+import org.eclipse.pde.internal.ui.*; >+import org.eclipse.pde.internal.ui.editor.IContextPart; >+import org.eclipse.pde.internal.ui.editor.context.InputContext; >+import org.eclipse.pde.internal.ui.editor.plugin.ManifestEditor; >+import org.eclipse.pde.internal.ui.editor.plugin.PluginInputContext; >+import org.eclipse.pde.internal.ui.search.ManifestEditorOpener; >+import org.eclipse.swt.graphics.Image; >+import org.eclipse.ui.IEditorPart; >+import org.eclipse.ui.dialogs.ElementListSelectionDialog; >+ >+public class IdAttributeRow extends ButtonAttributeRow { >+ >+ private class IdAttributeLabelProvider extends LabelProvider { >+ >+ public Image getImage(Object element) { >+ return PDEPlugin.getDefault().getLabelProvider().get(PDEPluginImages.DESC_GENERIC_XML_OBJ); >+ } >+ >+ } >+ >+ public IdAttributeRow(IContextPart part, ISchemaAttribute att) { >+ super(part, att); >+ } >+ >+ protected boolean isReferenceModel() { >+ return !part.getPage().getModel().isEditable(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.pde.internal.ui.editor.plugin.rows.ButtonAttributeRow#browse() >+ */ >+ protected void browse() { >+ ElementListSelectionDialog dialog = new ElementListSelectionDialog(PDEPlugin.getActiveWorkbenchShell(), new IdAttributeLabelProvider()); >+ dialog.setTitle(PDEUIMessages.IdAttributeRow_title); >+ dialog.setMessage(PDEUIMessages.IdAttributeRow_message); >+ dialog.setEmptyListMessage(PDEUIMessages.IdAttributeRow_emptyMessage); >+ Map attributeMap = PDERegistryHelper.getValidAttributes(getAttribute().getBasedOn()); >+ dialog.setElements(attributeMap.keySet().toArray()); >+ if (dialog.open() == Window.OK) { >+ text.setText(dialog.getFirstResult().toString()); >+ } >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.pde.internal.ui.editor.plugin.rows.ReferenceAttributeRow#openReference() >+ */ >+ protected void openReference() { >+ Map attributeMap = PDERegistryHelper.getValidAttributes(getAttribute().getBasedOn()); >+ String id = text.getText(); >+ // TODO why is this hard? >+ IConfigurationElement element = (IConfigurationElement) attributeMap.get(id); >+ if (element != null) { >+ String pluginId = element.getContributor().getName(); >+ IPluginModelBase model = PluginRegistry.findModel(pluginId); >+ IEditorPart editorPart = ManifestEditor.open(model.getPluginBase(), true); >+ ManifestEditor editor = (ManifestEditor) editorPart; >+ if (editor != null) { >+ InputContext context = editor.getContextManager().findContext(PluginInputContext.CONTEXT_ID); >+ IDocument document = context.getDocumentProvider().getDocument(context.getInput()); >+ IRegion region = ManifestEditorOpener.getAttributeMatch(editor, id, document); >+ editor.openToSourcePage(context, region.getOffset(), region.getLength()); >+ } >+ } >+ } >+} >Index: src/org/eclipse/pde/internal/ui/editor/schema/FilteredSchemaAttributeSelectionDialog.java >=================================================================== >RCS file: src/org/eclipse/pde/internal/ui/editor/schema/FilteredSchemaAttributeSelectionDialog.java >diff -N src/org/eclipse/pde/internal/ui/editor/schema/FilteredSchemaAttributeSelectionDialog.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/internal/ui/editor/schema/FilteredSchemaAttributeSelectionDialog.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,198 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.pde.internal.ui.editor.schema; >+ >+import java.util.Comparator; >+import org.eclipse.core.runtime.*; >+import org.eclipse.jface.dialogs.IDialogSettings; >+import org.eclipse.jface.viewers.ILabelDecorator; >+import org.eclipse.jface.viewers.LabelProvider; >+import org.eclipse.pde.core.plugin.*; >+import org.eclipse.pde.internal.core.PDECore; >+import org.eclipse.pde.internal.core.ischema.*; >+import org.eclipse.pde.internal.core.schema.SchemaRegistry; >+import org.eclipse.pde.internal.core.util.IdUtil; >+import org.eclipse.pde.internal.ui.*; >+import org.eclipse.swt.graphics.Image; >+import org.eclipse.swt.widgets.*; >+import org.eclipse.ui.dialogs.FilteredItemsSelectionDialog; >+ >+public class FilteredSchemaAttributeSelectionDialog extends FilteredItemsSelectionDialog { >+ >+ private static final String DIALOG_SETTINGS = "org.eclipse.pde.ui.dialogs.SchemaAttributeFilteredItemsSelectionDialog"; //$NON-NLS-1$ >+ private final SchemaListLabelProvider listLabelProvider = new SchemaListLabelProvider(); >+ private final SchemaDetailsLabelProvider detailsLabelProvider = new SchemaDetailsLabelProvider(); >+ >+ public FilteredSchemaAttributeSelectionDialog(Shell shell) { >+ super(shell, false); >+ >+ setTitle(PDEUIMessages.FilteredSchemaAttributeSelectionDialog_title); >+ setMessage(PDEUIMessages.FilteredSchemaAttributeSelectionDialog_message); >+ >+ PDEPlugin.getDefault().getLabelProvider().connect(this); >+ setListLabelProvider(listLabelProvider); >+ setListSelectionLabelDecorator(listLabelProvider); >+ setDetailsLabelProvider(detailsLabelProvider); >+ } >+ >+ private class SchemaListLabelProvider extends LabelProvider implements ILabelDecorator { >+ public Image getImage(Object element) { >+ return PDEPlugin.getDefault().getLabelProvider().getImage(element); >+ } >+ >+ public String getText(Object element) { >+ if (element instanceof ISchemaAttribute) { >+ ISchemaAttribute attribute = (ISchemaAttribute) element; >+ if (isDuplicateElement(element)) { >+ ISchemaObject object = attribute.getParent(); >+ if (object != null) >+ return getQualifiedName(attribute); >+ } >+ } >+ return PDEPlugin.getDefault().getLabelProvider().getText(element); >+ } >+ >+ public Image decorateImage(Image image, Object element) { >+ return image; // nothing to decorate >+ } >+ >+ public String decorateText(String text, Object element) { >+ if (element instanceof ISchemaAttribute) { >+ ISchemaAttribute attribute = (ISchemaAttribute) element; >+ ISchemaObject object = attribute.getParent(); >+ if (object != null && !isDuplicateElement(element)) >+ return getQualifiedName(attribute); >+ } >+ return text; >+ } >+ >+ } >+ >+ private class SchemaDetailsLabelProvider extends LabelProvider { >+ >+ public Image getImage(Object element) { >+ return PDEPlugin.getDefault().getLabelProvider().get(PDEPluginImages.DESC_EXT_POINT_OBJ); >+ } >+ >+ public String getText(Object element) { >+ if (element instanceof ISchemaAttribute) { >+ ISchemaAttribute attribute = (ISchemaAttribute) element; >+ ISchema schema = attribute.getSchema(); >+ return schema.getPointId() + ' ' + '(' + schema.getPluginId() + ')'; >+ } >+ return super.getText(element); >+ } >+ } >+ >+ private class SchemaItemsFilter extends ItemsFilter { >+ >+ public boolean isConsistentItem(Object item) { >+ return true; >+ } >+ >+ public boolean matchItem(Object item) { >+ if (item instanceof ISchemaAttribute) { >+ ISchemaAttribute attribute = (ISchemaAttribute) item; >+ String id = getQualifiedName(attribute); >+ return matches(id); >+ } >+ return false; >+ } >+ } >+ >+ private class SchemaComparator implements Comparator { >+ >+ public int compare(Object arg0, Object arg1) { >+ return 0; >+ } >+ >+ } >+ >+ protected ItemsFilter createFilter() { >+ return new SchemaItemsFilter(); >+ } >+ >+ protected void fillContentProvider(AbstractContentProvider contentProvider, ItemsFilter itemsFilter, IProgressMonitor progressMonitor) throws CoreException { >+ >+ IPluginModelBase[] models = PluginRegistry.getActiveModels(); >+ SchemaRegistry registry = PDECore.getDefault().getSchemaRegistry(); >+ >+ // cycle through all active plug-ins and their extension points >+ progressMonitor.beginTask(PDEUIMessages.FilteredSchemaAttributeSelectionDialog_searching, models.length); >+ for (int i = 0; i < models.length; i++) { >+ IPluginExtensionPoint[] points = models[i].getPluginBase().getExtensionPoints(); >+ >+ for (int j = 0; j < points.length; j++) { >+ String pointID = IdUtil.getFullId(points[j], models[i]); >+ >+ ISchema schema = registry.getSchema(pointID); >+ if (schema == null) // if we don't find a schema >+ continue; >+ ISchemaElement[] elements = schema.getElements(); >+ >+ for (int k = 0; k < elements.length; k++) { >+ ISchemaElement element = elements[k]; >+ ISchemaAttribute[] attributes = element.getAttributes(); >+ >+ for (int l = 0; l < attributes.length; l++) { >+ ISchemaAttribute attribute = attributes[l]; >+ // only add attributes of the string kind, isn't translatable and is required >+ if (attribute.getKind() == IMetaAttribute.STRING && !attribute.isTranslatable() && attribute.getUse() == ISchemaAttribute.REQUIRED) >+ contentProvider.add(attribute, itemsFilter); >+ } >+ } >+ } >+ progressMonitor.worked(1); >+ } >+ >+ progressMonitor.done(); >+ >+ } >+ >+ protected IDialogSettings getDialogSettings() { >+ IDialogSettings settings = PDEPlugin.getDefault().getDialogSettings().getSection(DIALOG_SETTINGS); >+ if (settings == null) { >+ settings = PDEPlugin.getDefault().getDialogSettings().addNewSection(DIALOG_SETTINGS); >+ } >+ return settings; >+ } >+ >+ public String getElementName(Object item) { >+ if (item instanceof ISchemaAttribute) { >+ ISchemaAttribute attribute = (ISchemaAttribute) item; >+ return attribute.getName(); >+ } >+ return null; >+ } >+ >+ protected Comparator getItemsComparator() { >+ return new SchemaComparator(); >+ } >+ >+ protected IStatus validateItem(Object item) { >+ return new Status(IStatus.OK, "org.eclipse.pde.ui", 0, "", null); //$NON-NLS-1$ //$NON-NLS-2$ >+ } >+ >+ public boolean close() { >+ PDEPlugin.getDefault().getLabelProvider().disconnect(this); >+ return super.close(); >+ } >+ >+ protected Control createExtendedContentArea(Composite parent) { >+ return null; >+ } >+ >+ private String getQualifiedName(ISchemaAttribute attribute) { >+ ISchemaObject object = attribute.getParent(); >+ ISchema schema = attribute.getSchema(); >+ return attribute.getName() + " - " + object.getName() + " [" + schema.getName() + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ >+ } >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 181515
:
63844
|
64350
|
89585
|
89861
|
89892
|
89945
|
89946
|
89948
| 89999 |
90000
|
90001
|
90002
|
90010
|
90011
|
90013