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 89892 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 v02
bug181515-patch-v2.txt (text/plain), 9.11 KB, created by
Remy Suen
on 2008-02-15 17:11:02 EST
(
hide
)
Description:
ID Search attribute v02
Filename:
MIME Type:
Creator:
Remy Suen
Created:
2008-02-15 17:11:02 EST
Size:
9.11 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.pde.core >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 15 Feb 2008 22:07:05 -0000 >@@ -67,7 +67,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/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 15 Feb 2008 22:07:05 -0000 >@@ -716,6 +716,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/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 15 Feb 2008 22:07:05 -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(); > >#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 15 Feb 2008 22:07:06 -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.XML_PATH) { >+ 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.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,98 @@ >+/******************************************************************************* >+ * 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.*; >+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(); >+ String value = element.getAttribute(attName); >+ if (value != null) { >+ attributesInfo.add(value); >+ } >+ } >+ 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 >+ } >+ >+}
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