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 74937 Details for
Bug 196874
[Manifest][Editors] Selection behaviour is wrong after delete in Extension section tree viewer
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
patch
patch196874.txt (text/plain), 7.25 KB, created by
Adam Archer
on 2007-07-30 11:27:16 EDT
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Adam Archer
Created:
2007-07-30 11:27:16 EDT
Size:
7.25 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.pde.ui >Index: src/org/eclipse/pde/internal/ui/editor/plugin/ExtensionPointsSection.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/ExtensionPointsSection.java,v >retrieving revision 1.29 >diff -u -r1.29 ExtensionPointsSection.java >--- src/org/eclipse/pde/internal/ui/editor/plugin/ExtensionPointsSection.java 22 Jun 2007 17:40:13 -0000 1.29 >+++ src/org/eclipse/pde/internal/ui/editor/plugin/ExtensionPointsSection.java 30 Jul 2007 15:26:15 -0000 >@@ -226,10 +226,14 @@ > for (int i = 0; i < selection.length; i++) { > Object object = selection[i]; > if (object != null && object instanceof IPluginExtensionPoint) { >+ IStructuredSelection newSelection = null; > IPluginExtensionPoint ep = (IPluginExtensionPoint) object; > IPluginBase plugin = ep.getPluginBase(); >+ IPluginExtensionPoint[] points = plugin.getExtensionPoints(); >+ int index = getNewSelectionIndex(getArrayIndex(points, ep), points.length); >+ if (index != -1) >+ newSelection = new StructuredSelection(points[index]); > try { >- plugin.remove(ep); > String schema = ep.getSchema(); > IProject project = ep.getModel().getUnderlyingResource() > .getProject(); >@@ -241,6 +245,9 @@ > + schemaFile.getProjectRelativePath().toString() + "?")) //$NON-NLS-1$ > schemaFile.delete(true, false, > new NullProgressMonitor()); >+ plugin.remove(ep); >+ if (newSelection != null) >+ pointTable.setSelection(newSelection); > > } catch (CoreException e) { > PDEPlugin.logException(e); >Index: src/org/eclipse/pde/internal/ui/editor/plugin/ExtensionsSection.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/ExtensionsSection.java,v >retrieving revision 1.58 >diff -u -r1.58 ExtensionsSection.java >--- src/org/eclipse/pde/internal/ui/editor/plugin/ExtensionsSection.java 26 Jul 2007 20:50:40 -0000 1.58 >+++ src/org/eclipse/pde/internal/ui/editor/plugin/ExtensionsSection.java 30 Jul 2007 15:26:15 -0000 >@@ -471,15 +471,45 @@ > for (Iterator iter = sel.iterator(); iter.hasNext();) { > IPluginObject object = (IPluginObject) iter.next(); > try { >+ IStructuredSelection newSelection = null; >+ boolean sorted = fSortAction != null && fSortAction.isChecked(); > if (object instanceof IPluginElement) { > IPluginElement ee = (IPluginElement) object; > IPluginParent parent = (IPluginParent) ee.getParent(); >+ if (!sorted) { >+ int index = getNewSelectionIndex(parent.getIndexOf(ee),parent.getChildCount()); >+ newSelection = index == -1 ? new StructuredSelection(parent) : new StructuredSelection(parent.getChildren()[index]); >+ } else { >+ IPluginObject original[] = parent.getChildren(); >+ IPluginObject objects[] = new IPluginObject[original.length]; >+ for (int i = 0; i < original.length; i++) >+ objects[i] = original[i]; >+ fExtensionTree.getComparator().sort(fExtensionTree, objects); >+ int index = getNewSelectionIndex(getArrayIndex(objects, ee),objects.length); >+ newSelection = index == -1 ? new StructuredSelection(parent) : new StructuredSelection(objects[index]); >+ } > parent.remove(ee); > } else if (object instanceof IPluginExtension) { > IPluginExtension extension = (IPluginExtension) object; > IPluginBase plugin = extension.getPluginBase(); >+ if (!sorted) { >+ int index = getNewSelectionIndex(plugin.getIndexOf(extension),plugin.getExtensions().length); >+ if (index != -1) >+ newSelection = new StructuredSelection(plugin.getExtensions()[index]); >+ } else { >+ IPluginExtension original[] = plugin.getExtensions(); >+ IPluginExtension extensions[] = new IPluginExtension[original.length]; >+ for (int i = 0; i < original.length; i++) >+ extensions[i] = original[i]; >+ fExtensionTree.getComparator().sort(fExtensionTree, extensions); >+ int index = getNewSelectionIndex(getArrayIndex(extensions, extension),extensions.length); >+ if (index != -1) >+ newSelection = new StructuredSelection(extensions[index]); >+ } > plugin.remove(extension); > } >+ if (newSelection != null) >+ fExtensionTree.setSelection(newSelection); > } catch (CoreException e) { > PDEPlugin.logException(e); > } >Index: src/org/eclipse/pde/internal/ui/editor/StructuredViewerSection.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/StructuredViewerSection.java,v >retrieving revision 1.18 >diff -u -r1.18 StructuredViewerSection.java >--- src/org/eclipse/pde/internal/ui/editor/StructuredViewerSection.java 8 Jun 2007 16:47:59 -0000 1.18 >+++ src/org/eclipse/pde/internal/ui/editor/StructuredViewerSection.java 30 Jul 2007 15:26:15 -0000 >@@ -136,4 +136,32 @@ > public StructuredViewerPart getStructuredViewerPart() { > return this.fViewerPart; > } >+ >+ /** >+ * <p>Given the index of TreeViewer item and the size of the array of its immediate >+ * siblings, gets the index of the desired new selection as follows: >+ * <ul><li>if this is the only item, return -1 (meaning select the parent)</li> >+ * <li>if this is the last item, return the index of the predecessor</li> >+ * <li>otherwise, return the index of the successor</li></p> >+ * >+ * @param thisIndex >+ * the item's index >+ * @param length >+ * the array length >+ * @return >+ * new selection index or -1 for parent >+ */ >+ protected int getNewSelectionIndex(int thisIndex, int length) { >+ if (thisIndex == length-1) >+ return thisIndex-1; >+ return thisIndex+1; >+ } >+ >+ protected int getArrayIndex(Object[] array, Object object) { >+ for (int i = 0; i < array.length; i++) { >+ if (array[i].equals(object)) >+ return i; >+ } >+ return -1; >+ } > } >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.51 >diff -u -r1.51 ElementSection.java >--- src/org/eclipse/pde/internal/ui/editor/schema/ElementSection.java 26 Jul 2007 14:37:52 -0000 1.51 >+++ src/org/eclipse/pde/internal/ui/editor/schema/ElementSection.java 30 Jul 2007 15:26:15 -0000 >@@ -514,24 +514,6 @@ > } > return result; > } >- >- // gets the index of the desired new selection as follows >- // if this is the only item, return -1 (meaning select the parent) >- // if this is the last item, return the index of the predecessor >- // otherwise, return the index of the successor >- private int getNewSelectionIndex(int thisIndex, int length) { >- if (thisIndex == length-1) >- return thisIndex-1; >- return thisIndex+1; >- } >- >- private int getArrayIndex(Object[] array, Object object) { >- for (int i = 0; i < array.length; i++) { >- if (array[i].equals(object)) >- return i; >- } >- return -1; >- } > > private void handleNewAttribute() { > Object object = ((IStructuredSelection) fTreeViewer.getSelection()).getFirstElement();
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 196874
:
74751
|
74937
|
74954