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 127977 Details for
Bug 213645
[RCP] Requesting programmatic hook to create view folders that remain visible after their last child is closed
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
patch-213645.txt (text/plain), 12.78 KB, created by
Boris Bokowski
on 2009-03-08 22:34:11 EDT
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Boris Bokowski
Created:
2009-03-08 22:34:11 EDT
Size:
12.78 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ui.workbench >Index: Eclipse UI/org/eclipse/ui/internal/FastViewManager.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/FastViewManager.java,v >retrieving revision 1.26 >diff -u -r1.26 FastViewManager.java >--- Eclipse UI/org/eclipse/ui/internal/FastViewManager.java 28 Oct 2008 14:11:39 -0000 1.26 >+++ Eclipse UI/org/eclipse/ui/internal/FastViewManager.java 9 Mar 2009 02:25:02 -0000 >@@ -7,6 +7,7 @@ > * > * Contributors: > * IBM Corporation - initial API and implementation >+ * Carlos Devoto carlos.devoto@compuware.com Bug 213645 > * Markus Alexander Kuppe, Versant Corporation - bug #215797 > *******************************************************************************/ > >@@ -543,11 +544,21 @@ > //long startTick = System.currentTimeMillis(); > // Update the model first > List toMove = getTrueViewOrder(vs); >- for (Iterator viewIter = toMove.iterator(); viewIter.hasNext();) { >- IViewReference ref = (IViewReference) viewIter.next(); >- addViewReference(vs.getID(), -1, ref, false); >+ if (toMove.isEmpty()) { >+ // We are dealing with an empty durable ViewStack; hide it! >+ vs.dispose(); >+ ILayoutContainer parentContainer = vs.getContainer(); >+ ContainerPlaceholder placeholder = new ContainerPlaceholder(vs >+ .getID()); >+ placeholder.setRealContainer(vs); >+ parentContainer.replace(vs, placeholder); >+ >+ } else { >+ for (Iterator viewIter = toMove.iterator(); viewIter.hasNext();) { >+ IViewReference ref = (IViewReference) viewIter.next(); >+ addViewReference(vs.getID(), -1, ref, false); >+ } > } >- > vs.deferUpdates(false); > > // Find (or create) the trim stack to move to >@@ -555,9 +566,29 @@ > .calcStackSide(stackBounds), paneOrientation); > vstb.setRestoreOnUnzoom(restoreOnUnzoom); > vstb.setSelectedTabId(selId); >- updateTrim(vstb.getId()); >- >- //System.out.println("minimize time: " + (System.currentTimeMillis()-startTick)); //$NON-NLS-1$ >+ if (toMove.isEmpty()) { >+ // We are dealing with an empty durable ViewStack; show the trim! >+ IWindowTrim trim = vstb; >+ >+ // Ensure that the trim is displayed >+ if (!trim.getControl().getVisible()) { >+ tbm.setTrimVisible(trim, true); >+ } >+ >+ if (trim instanceof FastViewBar) { >+ FastViewBar fvb = (FastViewBar) trim; >+ fvb.update(true); >+ } else if (trim instanceof ViewStackTrimToolBar) { >+ vstb.update(true); >+ vstb.getControl().pack(); >+ LayoutUtil.resize(trim.getControl()); >+ } >+ tbm.forceLayout(); >+ } else { >+ updateTrim(vstb.getId()); >+ } >+ >+ //System.out.println("minimize time: " + (System.currentTimeMillis()-startTick)); //$NON-NLS-1$ > if (vstb != null) { > animation.addEndRect(vstb.getControl()); > scheduleDeferrableAnimation(); >@@ -591,6 +622,35 @@ > secondaryId = idParts[1]; > > List fvs = getFastViews(id); >+ if (fvs.isEmpty()) { >+ // We are dealing with a durable view stack that is currently empty, so execute special logic to restore it from the minimized state >+ LayoutPart part = perspective.getPresentation().findPart(id, null); >+ if (part instanceof ContainerPlaceholder) { >+ ContainerPlaceholder containerPlaceholder = (ContainerPlaceholder) part; >+ ILayoutContainer parentContainer = containerPlaceholder >+ .getContainer(); >+ ILayoutContainer container = (ILayoutContainer) containerPlaceholder >+ .getRealContainer(); >+ if (container instanceof LayoutPart) { >+ parentContainer.replace(containerPlaceholder, >+ (LayoutPart) container); >+ } >+ containerPlaceholder.setRealContainer(null); >+ IWindowTrim trim = tbm.getTrim(id); >+ >+ // If it's not there there's not much we can do >+ if (trim == null) >+ return; >+ >+ // Hide the trim >+ if (trim.getControl().getVisible()) { >+ tbm.setTrimVisible(trim, false); >+ tbm.forceLayout(); >+ } >+ } >+ return; >+ } >+ > for (Iterator fvIter = fvs.iterator(); fvIter.hasNext();) { > IViewReference ref = (IViewReference) fvIter.next(); > removeViewReference(ref, true, !fvIter.hasNext()); >Index: Eclipse UI/org/eclipse/ui/internal/ViewStack.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewStack.java,v >retrieving revision 1.29 >diff -u -r1.29 ViewStack.java >--- Eclipse UI/org/eclipse/ui/internal/ViewStack.java 13 Sep 2007 12:35:13 -0000 1.29 >+++ Eclipse UI/org/eclipse/ui/internal/ViewStack.java 9 Mar 2009 02:25:03 -0000 >@@ -9,6 +9,7 @@ > * IBM Corporation - initial API and implementation > * Cagatay Kavukcuoglu <cagatayk@acm.org> > * - Fix for bug 10025 - Resizing views should not use height ratios >+ * Carlos Devoto carlos.devoto@compuware.com Bug 213645 > *******************************************************************************/ > package org.eclipse.ui.internal; > >@@ -49,6 +50,8 @@ > > private SystemMenuDetach detachViewAction; > >+ private boolean durable = false; >+ > public void addSystemActions(IMenuManager menuManager) { > appendToGroupIfPossible(menuManager, > "misc", new UpdatingActionContributionItem(fastViewAction)); //$NON-NLS-1$ >@@ -134,7 +137,12 @@ > if (Perspective.useNewMinMax(persp)) { > FastViewManager fvm = persp.getFastViewManager(); > if (minimized) { >+ // Need to temporarily set the durability attribute to false or we won't be able to minimized the folder >+ boolean tempDurable = durable; >+ durable = false; > fvm.moveToTrim(this, false); >+ // Restore the durability attribute to its previous value >+ durable = tempDurable; > } else { > // First, if we're maximized then revert > if (persp.getPresentation().getMaximizedStack() != null) { >@@ -199,4 +207,24 @@ > public StackPresentation getTestPresentation() { > return getPresentation(); > } >+ >+ /** >+ * Set the durability attribute for this stack. The stack's durability determines >+ * whether or not the stack remains visible after its last child is closed. >+ * >+ * @param durable If true, the stack remains visible after its last child is closed >+ */ >+ public void setDurable(boolean durable) { >+ this.durable = durable; >+ } >+ >+ /** >+ * Get the durability attribute for this stack. The stack's durability determines >+ * whether or not the stack remains visible after its last child is closed. >+ * >+ * @return true, if the stack remains visible when its last child is closed; false otherwise >+ */ >+ public boolean getDurable () { >+ return this.durable; >+ } > } >Index: Eclipse UI/org/eclipse/ui/internal/PerspectiveHelper.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveHelper.java,v >retrieving revision 1.48 >diff -u -r1.48 PerspectiveHelper.java >--- Eclipse UI/org/eclipse/ui/internal/PerspectiveHelper.java 17 Feb 2009 08:50:24 -0000 1.48 >+++ Eclipse UI/org/eclipse/ui/internal/PerspectiveHelper.java 9 Mar 2009 02:25:03 -0000 >@@ -7,6 +7,7 @@ > * > * Contributors: > * IBM Corporation - initial API and implementation >+ * Carlos Devoto carlos.devoto@compuware.com Bug 213645 > * Marco Maccaferri, maccasoft.com - patch for defect 222750 > *******************************************************************************/ > >@@ -767,9 +768,9 @@ > } > } > >- if (!hasChildren) { >+ if (!hasChildren && !(oldContainer instanceof ViewStack && ((ViewStack)oldContainer).getDurable())) { > // There are no more children in this container, so get rid of >- // it >+ // it (but only if the container is not a durable ViewStack) > if (oldContainer instanceof LayoutPart) { > LayoutPart parent = (LayoutPart) oldContainer; > ILayoutContainer parentContainer = parent.getContainer(); >@@ -1233,12 +1234,16 @@ > LayoutPart[] children = container.getChildren(); > if (children != null) { > boolean allInvisible = true; >- for (int i = 0, length = children.length; i < length; i++) { >- if (!(children[i] instanceof PartPlaceholder)) { >- allInvisible = false; >- break; >- } >- } >+ if (container instanceof ViewStack && !((ViewStack) container).isMinimized && ((ViewStack) container).getDurable()) { >+ allInvisible = false; >+ } else { >+ for (int i = 0, length = children.length; i < length; i++) { >+ if (!(children[i] instanceof PartPlaceholder)) { >+ allInvisible = false; >+ break; >+ } >+ } >+ } > if (allInvisible && (container instanceof LayoutPart)) { > // what type of window are we in? > LayoutPart cPart = (LayoutPart) container; >Index: Eclipse UI/org/eclipse/ui/internal/PageLayout.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PageLayout.java,v >retrieving revision 1.58 >diff -u -r1.58 PageLayout.java >--- Eclipse UI/org/eclipse/ui/internal/PageLayout.java 20 Jan 2009 20:19:38 -0000 1.58 >+++ Eclipse UI/org/eclipse/ui/internal/PageLayout.java 9 Mar 2009 02:25:02 -0000 >@@ -480,6 +480,13 @@ > // Create the folder. > ViewStack folder = new ViewStack(rootLayoutContainer.page); > folder.setID(folderId); >+ >+ if (getDescriptor() != null >+ && viewFactory.getWorkbenchPage().window.getWindowAdvisor() >+ .isDurableFolder(getDescriptor().getId(), folderId)) { >+ folder.setDurable(true); >+ } >+ > addPart(folder, folderId, relationship, ratio, refId); > > // Create a wrapper. >Index: Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java,v >retrieving revision 1.407 >diff -u -r1.407 WorkbenchWindow.java >--- Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java 2 Dec 2008 12:49:30 -0000 1.407 >+++ Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java 9 Mar 2009 02:25:05 -0000 >@@ -3424,13 +3424,13 @@ > /** > * Returns the window advisor, creating a new one for this window if needed. > * <p> >- * IMPORTANT This method is declared private to prevent regular plug-ins >+ * IMPORTANT This method is declared package private to prevent regular plug-ins > * from downcasting IWorkbenchWindow to WorkbenchWindow and getting hold of > * the window advisor that would allow them to tamper with the window. The > * window advisor is internal to the application. > * </p> > */ >- private/* private - DO NOT CHANGE */ >+ /* package private - DO NOT CHANGE */ > WorkbenchWindowAdvisor getWindowAdvisor() { > if (windowAdvisor == null) { > windowAdvisor = getAdvisor().createWorkbenchWindowAdvisor( >Index: Eclipse UI/org/eclipse/ui/application/WorkbenchWindowAdvisor.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/application/WorkbenchWindowAdvisor.java,v >retrieving revision 1.14 >diff -u -r1.14 WorkbenchWindowAdvisor.java >--- Eclipse UI/org/eclipse/ui/application/WorkbenchWindowAdvisor.java 14 Jan 2009 19:29:42 -0000 1.14 >+++ Eclipse UI/org/eclipse/ui/application/WorkbenchWindowAdvisor.java 9 Mar 2009 02:25:01 -0000 >@@ -282,6 +282,21 @@ > public Control createEmptyWindowContents(Composite parent) { > return null; > } >+ >+ /** >+ * Returns <code>true</code> if the given folder in the given perspective should remain visible even after all >+ * parts in it have been closed by the user. The default is <code>false</code>. The return value for a certain >+ * combination of perspective id and folder id must not change over time. >+ * >+ * @param perspectiveId the perspective id >+ * @param folderId the folder id >+ * @return <code>true</code> if the given folder should be durable >+ * >+ * @since 3.5 >+ */ >+ public boolean isDurableFolder(String perspectiveId, String folderId) { >+ return false; >+ } > > /** > * Disposes any resources allocated by this window advisor.
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 213645
:
85686
|
86030
| 127977