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 93976 Details for
Bug 224568
[Preferences] Preferences dialog fails to create hierarchy if category referenced before declared
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]
Patch against org.eclipse.ui.workbench
224568.txt (text/plain), 4.23 KB, created by
Kim Horne
on 2008-03-28 11:04:26 EDT
(
hide
)
Description:
Patch against org.eclipse.ui.workbench
Filename:
MIME Type:
Creator:
Kim Horne
Created:
2008-03-28 11:04:26 EDT
Size:
4.23 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ui.workbench >Index: Eclipse UI/org/eclipse/ui/internal/registry/CategorizedPageRegistryReader.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/CategorizedPageRegistryReader.java,v >retrieving revision 1.10 >diff -u -r1.10 CategorizedPageRegistryReader.java >--- Eclipse UI/org/eclipse/ui/internal/registry/CategorizedPageRegistryReader.java 25 Mar 2008 01:38:44 -0000 1.10 >+++ Eclipse UI/org/eclipse/ui/internal/registry/CategorizedPageRegistryReader.java 28 Mar 2008 15:02:53 -0000 >@@ -135,45 +135,63 @@ > StringTokenizer tokenizer; > String currentToken; > >- // Sort nodes based on flattened display path composed of >- // actual labels of nodes referenced in category attribute. >- Object[] sortedNodes = sortByCategories(getNodes()); >- for (int i = 0; i < sortedNodes.length; i++) { >- //Iterate through all the nodes >- CategoryNode categoryNode = (CategoryNode) sortedNodes[i]; >- Object node = categoryNode.getNode(); >- >- String category = getCategory(node); >- if (category == null) { >- topLevelNodes.add(node); >- continue; >- } >- // has category >- tokenizer = new StringTokenizer(category, PREFERENCE_SEPARATOR); >- Object parent = null; >- while (tokenizer.hasMoreElements()) { >- currentToken = tokenizer.nextToken(); >- Object child = null; >- if (parent == null) { >- child = findNode(currentToken); >- } else { >- child = findNode(parent, currentToken); >+ >+ CategoryNode[] nodes = createCategoryNodes(getNodes()); >+ // flag to indicate that some work was done in the inner loop over the nodes >+ boolean workDone; >+ do { >+ //reset the flag >+ workDone = false; >+ List deferred = new ArrayList(); >+ for (int i = 0; i < nodes.length; i++) { >+ // Iterate through all the nodes >+ CategoryNode categoryNode = nodes[i]; >+ Object node = categoryNode.getNode(); >+ >+ String category = getCategory(node); >+ if (category == null) { >+ topLevelNodes.add(node); >+ continue; > } >- if (child == null) { >- parent = null; >- break; >- } else { >+ // has category >+ tokenizer = new StringTokenizer(category, PREFERENCE_SEPARATOR); >+ Object parent = null; >+ while (tokenizer.hasMoreElements()) { >+ currentToken = tokenizer.nextToken(); >+ Object child = null; >+ if (parent == null) { >+ child = findNode(currentToken); >+ } else { >+ child = findNode(parent, currentToken); >+ } >+ >+ if (child == null) { >+ parent = null; >+ break; >+ } > parent = child; > } >+ if (parent != null) { >+ //we've done some work - the number of nodes to process has decreased >+ workDone = true; >+ add(parent, node); >+ } else { >+ // we haven't done any work - the parent for this node has not been found. >+ deferred.add(categoryNode); >+ } > } >- if (parent != null) { >- add(parent, node); >- } else { >- //Could not find the parent - log >- WorkbenchPlugin >- .log("Invalid preference page path: " + categoryNode.getFlatCategory()); //$NON-NLS-1$ >- topLevelNodes.add(node); >- } >+ // reset the nodes to all that have yet to find their proper parent >+ nodes = (CategoryNode[]) deferred.toArray(new CategoryNode[deferred >+ .size()]); >+ } while (nodes.length > 0 && workDone); // loop while we still have nodes to work on and the list is shrinking >+ >+ // log anything left over. >+ for (int i = 0; i < nodes.length; i++) { >+ CategoryNode categoryNode = nodes[i]; >+ // Could not find the parent - log >+ WorkbenchPlugin >+ .log("Invalid preference page path: " + categoryNode.getFlatCategory()); //$NON-NLS-1$ >+ topLevelNodes.add(categoryNode.getNode()); > } > } > >@@ -204,7 +222,7 @@ > * nodes. workbench node is excluded from sorting because it always > * appears first in the dialog. > */ >- Object[] sortByCategories(Collection nodesToCategorize) { >+ CategoryNode[] createCategoryNodes(Collection nodesToCategorize) { > //sort by categories > List nodes = new ArrayList(); > >@@ -213,7 +231,7 @@ > nodes.add(createCategoryNode(this, nodesIterator.next())); > } > >- return nodes.toArray(); >+ return (CategoryNode[]) nodes.toArray(new CategoryNode[nodes.size()]); > } > > /**
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 224568
: 93976