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 9713 Details for
Bug 56431
[ViewMgmt] Placeholder is lost when a multi-view instanced view is opened
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]
Fixes recursive issues Nick mentioned
pattern_matching_placeholders_patch_0420.txt (text/plain), 6.98 KB, created by
Matthew Hatem
on 2004-04-20 12:05:40 EDT
(
hide
)
Description:
Fixes recursive issues Nick mentioned
Filename:
MIME Type:
Creator:
Matthew Hatem
Created:
2004-04-20 12:05:40 EDT
Size:
6.98 KB
patch
obsolete
>Index: Eclipse UI/org/eclipse/ui/internal/PerspectivePresentation.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectivePresentation.java,v >retrieving revision 1.32 >diff -u -r1.32 PerspectivePresentation.java >--- Eclipse UI/org/eclipse/ui/internal/PerspectivePresentation.java 17 Apr 2004 03:40:06 -0000 1.32 >+++ Eclipse UI/org/eclipse/ui/internal/PerspectivePresentation.java 20 Apr 2004 15:55:56 -0000 >@@ -12,6 +12,7 @@ > package org.eclipse.ui.internal; > > import java.util.ArrayList; >+import java.util.Collections; > import java.util.Enumeration; > import java.util.List; > import java.util.StringTokenizer; >@@ -754,9 +755,10 @@ > */ > private LayoutPart findPart(String primaryId, String secondaryId) { > // check main window. >+ ArrayList matchingParts = new ArrayList(); > LayoutPart part = (secondaryId != null) ? >- findPart(primaryId, secondaryId, mainLayout.getChildren()) : >- findPart(primaryId, mainLayout.getChildren()); >+ findPart(primaryId, secondaryId, mainLayout.getChildren(), matchingParts) : >+ findPart(primaryId, mainLayout.getChildren(), matchingParts); > if (part != null) > return part; > >@@ -764,8 +766,8 @@ > for (int i = 0, length = detachedWindowList.size(); i < length; i++) { > DetachedWindow window = (DetachedWindow) detachedWindowList.get(i); > part = (secondaryId != null) ? >- findPart(primaryId, secondaryId, window.getChildren()) : >- findPart(primaryId, window.getChildren()); >+ findPart(primaryId, secondaryId, window.getChildren(), matchingParts) : >+ findPart(primaryId, window.getChildren(), matchingParts); > if (part != null) > return part; > } >@@ -773,28 +775,46 @@ > DetachedPlaceHolder holder = > (DetachedPlaceHolder) detachedPlaceHolderList.get(i); > part = (secondaryId != null) ? >- findPart(primaryId, secondaryId, holder.getChildren()) : >- findPart(primaryId, holder.getChildren()) ; >+ findPart(primaryId, secondaryId, holder.getChildren(), matchingParts) : >+ findPart(primaryId, holder.getChildren(), matchingParts) ; > if (part != null) > return part; > } > >+ // sort the matching parts >+ if (matchingParts.size() > 0) { >+ Collections.sort(matchingParts); >+ MatchingPart mostSignificantPart = (MatchingPart)matchingParts.get(0); >+ if (mostSignificantPart != null) >+ return mostSignificantPart.part; >+ } >+ > // Not found. > return null; > } >- private class MatchingPart { >+ private class MatchingPart implements Comparable { > String pid; > String sid; > LayoutPart part; > MatchingPart (String pid, String sid, LayoutPart part) { >- this.pid = pid; this.sid = sid; this.part = part; >+ this.pid = pid; >+ this.sid = sid; >+ this.part = part; >+ } >+ public int compareTo(Object a) { >+ int difference = 0; >+ MatchingPart ma = ((MatchingPart)a); >+ difference += new String(ma.pid+ma.sid).length() - >+ new String(this.pid+this.sid).length(); >+ if (difference < 0) return -1; >+ if (difference > 0) return 1; >+ return 0; > } > } > /** > * Find the first part with a given ID in the presentation. > */ >- private LayoutPart findPart(String id, LayoutPart[] parts) { >- MatchingPart currentMatchingPart = null; >+ private LayoutPart findPart(String id, LayoutPart[] parts, ArrayList matchingParts) { > for (int i = 0, length = parts.length; i < length; i++) { > LayoutPart part = parts[i]; > // check for part equality, parts with secondary ids fail >@@ -810,26 +830,18 @@ > // check pattern matching placeholders > else if (part instanceof PartPlaceholder && ((PartPlaceholder) part).hasWildCard()) { > StringMatcher sm = new StringMatcher(part.getID(), true, false); >- MatchingPart matchingPart; >- if (sm.match(id)) { >- matchingPart = new MatchingPart(part.getID(), null, part); >- if (currentMatchingPart == null) >- currentMatchingPart = matchingPart; >- else if (matchingPart.pid.length() > currentMatchingPart.pid.length()) >- currentMatchingPart = matchingPart; >- } >+ if (sm.match(id)) >+ matchingParts.add(new MatchingPart(part.getID(), null, part)); > } > else if (part instanceof EditorArea) { > // Skip. > } > else if (part instanceof ILayoutContainer) { >- part = findPart(id, ((ILayoutContainer) part).getChildren()); >+ part = findPart(id, ((ILayoutContainer) part).getChildren(), matchingParts); > if (part != null) > return part; > } > } >- if (currentMatchingPart != null) >- return currentMatchingPart.part; > return null; > } > /** >@@ -837,15 +849,13 @@ > * primary and secondary id pair. Wild cards > * are supported. > */ >- private LayoutPart findPart(String primaryId, String secondaryId, LayoutPart[] parts) { >- MatchingPart currentMatchingPart = null; >- LayoutPart wildCard = null; >+ private LayoutPart findPart(String primaryId, String secondaryId, LayoutPart[] parts, ArrayList matchingParts) { > for (int i = 0, length = parts.length; i < length; i++) { > LayoutPart part = parts[i]; > // check containers first > if (part instanceof ILayoutContainer) { > LayoutPart testPart = findPart(primaryId, secondaryId, >- ((ILayoutContainer) part).getChildren()); >+ ((ILayoutContainer) part).getChildren(), matchingParts); > if (testPart != null) > return testPart; > } >@@ -863,10 +873,10 @@ > String id = part.getID(); > > // optimization: don't bother parsing id if it has no separator -- it can't match >- if (id.indexOf(ViewFactory.ID_SEP) == -1) { //$NON-NLS-1$ >+ if (id.indexOf(ViewFactory.ID_SEP) == -1) { > // but still need to check for wildcard case > if (id.equals(PartPlaceholder.WILD_CARD)) >- wildCard = part; >+ matchingParts.add(new MatchingPart(id, null, part)); > continue; > } > >@@ -884,29 +894,15 @@ > if (sm.match(primaryId)) { > sm = new StringMatcher(phSecondaryId, true, false); > if (sm.match(secondaryId)) { >- matchingPart = new MatchingPart(phPrimaryId, phSecondaryId, part); >- // check for most specific >- if (currentMatchingPart != null) { >- if (matchingPart.pid.length() > currentMatchingPart.pid.length()) >- currentMatchingPart = matchingPart; >- else if (matchingPart.pid.length() == currentMatchingPart.pid.length()) { >- if (matchingPart.sid.length() > currentMatchingPart.sid.length()) >- currentMatchingPart = matchingPart; >- } >- } >- else >- currentMatchingPart = matchingPart; >+ matchingParts.add(new MatchingPart(phPrimaryId, phSecondaryId, part)); > } >- } >- >+ } > } > else if (part instanceof EditorArea) { > // Skip. > } > } >- if (currentMatchingPart != null) >- return currentMatchingPart.part; >- return wildCard; >+ return null; > } > /** > * Returns true if a placeholder exists for a given ID.
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 56431
:
9271
|
9272
|
9339
|
9340
|
9355
|
9446
| 9713