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 89585 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.
[patch]
ID Search attribute v01
pde-v01.txt (text/plain), 10.42 KB, created by
Paul Webster
on 2008-02-12 20:44:17 EST
(
hide
)
Description:
ID Search attribute v01
Filename:
MIME Type:
Creator:
Paul Webster
Created:
2008-02-12 20:44:17 EST
Size:
10.42 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.pde.ui >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 13 Feb 2008 01:36:16 -0000 >@@ -125,6 +125,8 @@ > row = new ClassAttributeRow(this, att); > else if (att.getKind() == IMetaAttribute.RESOURCE) > row = new ResourceAttributeRow(this, att); >+ else if (att.getKind() == IMetaAttribute.XML_PATH) >+ row = new IdAttributeRow(this, att); > else if (att.isTranslatable()) > row = new TranslatableAttributeRow(this, att); > else { >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,94 @@ >+/******************************************************************************* >+ * 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.plugin.rows; >+ >+import java.util.*; >+import org.eclipse.core.runtime.IConfigurationElement; >+import org.eclipse.core.runtime.IExtension; >+import org.eclipse.jface.viewers.ILabelProvider; >+import org.eclipse.jface.viewers.LabelProvider; >+import org.eclipse.jface.window.Window; >+import org.eclipse.pde.internal.core.PDECore; >+import org.eclipse.pde.internal.core.ischema.ISchemaAttribute; >+import org.eclipse.pde.internal.ui.PDEPlugin; >+import org.eclipse.pde.internal.ui.PDEUIMessages; >+import org.eclipse.pde.internal.ui.editor.IContextPart; >+import org.eclipse.ui.dialogs.ElementListSelectionDialog; >+ >+public class IdAttributeRow extends ButtonAttributeRow { >+ >+ 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() { >+ ILabelProvider provider = new LabelProvider(); >+ ElementListSelectionDialog dialog = new ElementListSelectionDialog(PDEPlugin.getActiveWorkbenchShell(), provider); >+ dialog.setTitle(PDEUIMessages.ResourceAttributeCellEditor_title); >+ ArrayList attributesInfo = new ArrayList(); >+ gatherInfo(attributesInfo); >+ dialog.setElements(attributesInfo.toArray()); >+ if (dialog.open() == Window.OK) { >+ text.setText(dialog.getFirstResult().toString()); >+ } >+ } >+ >+ private void gatherInfo(ArrayList attributesInfo) { >+ String basedOn = getAttribute().getBasedOn(); >+ 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(); >+ attributesInfo.add(element.getAttribute(attName)); >+ } >+ 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 List keepGoing(IConfigurationElement element, String tag) { >+ return Arrays.asList(element.getChildren(tag)); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.pde.internal.ui.editor.plugin.rows.ReferenceAttributeRow#openReference() >+ */ >+ protected void openReference() { >+ // do nothing for now >+ } >+ >+} >#P org.eclipse.pde.core >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 13 Feb 2008 01:36:17 -0000 >@@ -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("xml_path")) //$NON-NLS-1$ >+ return IMetaAttribute.XML_PATH; > } > return IMetaAttribute.STRING; > } >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 13 Feb 2008 01:36:17 -0000 >@@ -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() == XML_PATH) >+ return basedOn; >+ return null; > } > > public int getKind() { >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 13 Feb 2008 01:36:17 -0000 >@@ -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 XML_PATH = 3; >+ >+ /** > * Property that indicates if an attribute is translatable > */ > public static final String P_TRANSLATABLE = "translatable"; //$NON-NLS-1$ >@@ -49,7 +57,7 @@ > > /** > * Returns optional name of the Java type this type must be based on (only >- * for JAVA kind). >+ * for JAVA kind), or the XML XPath (almost) for XML_PATH kind. > */ > public String getBasedOn(); >
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 Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 181515
:
63844
|
64350
|
89585
|
89861
|
89892
|
89945
|
89946
|
89948
|
89999
|
90000
|
90001
|
90002
|
90010
|
90011
|
90013