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 14271 Details for
Bug 72060
[Presentations] Improve workbench placeholders
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]
org.eclipse.ui.workbench
org.eclipse.ui.workbench.txt (text/plain), 117.01 KB, created by
Cory Turner
on 2004-08-30 16:34:13 EDT
(
hide
)
Description:
org.eclipse.ui.workbench
Filename:
MIME Type:
Creator:
Cory Turner
Created:
2004-08-30 16:34:13 EDT
Size:
117.01 KB
patch
obsolete
>Index: Eclipse UI/org/eclipse/ui/internal/ContainerPlaceholder.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/ui/internal/ContainerPlaceholder.java >diff -N Eclipse UI/org/eclipse/ui/internal/ContainerPlaceholder.java >--- Eclipse UI/org/eclipse/ui/internal/ContainerPlaceholder.java 8 Jul 2004 20:07:31 -0000 1.7 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,142 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2000, 2004 IBM Corporation and others. >- * All rights reserved. This program and the accompanying materials >- * are made available under the terms of the Common Public License v1.0 >- * which accompanies this distribution, and is available at >- * http://www.eclipse.org/legal/cpl-v10.html >- * >- * Contributors: >- * IBM Corporation - initial API and implementation >- *******************************************************************************/ >-package org.eclipse.ui.internal; >- >-public class ContainerPlaceholder extends PartPlaceholder implements >- ILayoutContainer { >- private static int nextId = 0; >- >- private ILayoutContainer realContainer; >- >- /** >- * ContainerPlaceholder constructor comment. >- * @param id java.lang.String >- * @param label java.lang.String >- */ >- public ContainerPlaceholder(String id) { >- super(((id == null) ? "Container Placeholder " + nextId++ : id)); //$NON-NLS-1$ >- } >- >- /** >- * add method comment. >- */ >- public void add(LayoutPart child) { >- if (!(child instanceof PartPlaceholder)) >- return; >- realContainer.add(child); >- } >- >- /** >- * See ILayoutContainer::allowBorder >- */ >- public boolean allowsBorder() { >- return true; >- } >- >- /** >- * getChildren method comment. >- */ >- public LayoutPart[] getChildren() { >- return realContainer.getChildren(); >- } >- >- /** >- * getFocus method comment. >- */ >- public LayoutPart getFocus() { >- return null; >- } >- >- /** >- * getFocus method comment. >- */ >- public LayoutPart getRealContainer() { >- return (LayoutPart) realContainer; >- } >- >- /** >- * isChildVisible method comment. >- */ >- public boolean isChildVisible(LayoutPart child) { >- return false; >- } >- >- /** >- * remove method comment. >- */ >- public void remove(LayoutPart child) { >- if (!(child instanceof PartPlaceholder)) >- return; >- realContainer.remove(child); >- } >- >- /** >- * replace method comment. >- */ >- public void replace(LayoutPart oldChild, LayoutPart newChild) { >- if (!(oldChild instanceof PartPlaceholder) >- && !(newChild instanceof PartPlaceholder)) >- return; >- realContainer.replace(oldChild, newChild); >- } >- >- /** >- * setChildVisible method comment. >- */ >- public void setChildVisible(LayoutPart child, boolean visible) { >- } >- >- /** >- * setFocus method comment. >- */ >- public void setFocus(LayoutPart child) { >- } >- >- public void setRealContainer(ILayoutContainer container) { >- >- if (container == null) { >- // set the parent container of the children back to the real container >- if (realContainer != null) { >- LayoutPart[] children = realContainer.getChildren(); >- if (children != null) { >- for (int i = 0, length = children.length; i < length; i++) { >- children[i].setContainer(realContainer); >- } >- } >- } >- } else { >- // replace the real container with this place holder >- LayoutPart[] children = container.getChildren(); >- if (children != null) { >- for (int i = 0, length = children.length; i < length; i++) { >- children[i].setContainer(this); >- } >- } >- } >- >- this.realContainer = container; >- } >- >- public void findSashes(LayoutPart part, PartPane.Sashes sashes) { >- ILayoutContainer container = getContainer(); >- >- if (container != null) { >- container.findSashes(this, sashes); >- } >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.ui.internal.ILayoutContainer#allowsAutoFocus() >- */ >- public boolean allowsAutoFocus() { >- return false; >- } >-} >\ No newline at end of file >Index: Eclipse UI/org/eclipse/ui/internal/DetachedPlaceHolder.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/ui/internal/DetachedPlaceHolder.java >diff -N Eclipse UI/org/eclipse/ui/internal/DetachedPlaceHolder.java >--- Eclipse UI/org/eclipse/ui/internal/DetachedPlaceHolder.java 8 Jul 2004 20:07:33 -0000 1.8 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,141 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2000, 2004 IBM Corporation and others. >- * All rights reserved. This program and the accompanying materials >- * are made available under the terms of the Common Public License v1.0 >- * which accompanies this distribution, and is available at >- * http://www.eclipse.org/legal/cpl-v10.html >- * >- * Contributors: >- * IBM Corporation - initial API and implementation >- *******************************************************************************/ >-package org.eclipse.ui.internal; >- >-import java.util.ArrayList; >- >-import org.eclipse.swt.graphics.Rectangle; >-import org.eclipse.ui.IMemento; >- >-public class DetachedPlaceHolder extends PartPlaceholder implements >- ILayoutContainer { >- ArrayList children = new ArrayList(); >- >- Rectangle bounds; >- >- /** >- * DetachedPlaceHolder constructor comment. >- * @param id java.lang.String >- */ >- public DetachedPlaceHolder(String id, Rectangle bounds) { >- super(id); >- this.bounds = bounds; >- } >- >- /** >- * Add a child to the container. >- */ >- public void add(LayoutPart newPart) { >- if (!(newPart instanceof PartPlaceholder)) >- return; >- children.add(newPart); >- } >- >- /** >- * Return true if the container allows its >- * parts to show a border if they choose to, >- * else false if the container does not want >- * its parts to show a border. >- */ >- public boolean allowsBorder() { >- return false; >- } >- >- public Rectangle getBounds() { >- return bounds; >- } >- >- /** >- * Returns a list of layout children. >- */ >- public LayoutPart[] getChildren() { >- LayoutPart result[] = new LayoutPart[children.size()]; >- children.toArray(result); >- return result; >- } >- >- /** >- * Remove a child from the container. >- */ >- public void remove(LayoutPart part) { >- children.remove(part); >- } >- >- /** >- * Replace one child with another >- */ >- public void replace(LayoutPart oldPart, LayoutPart newPart) { >- remove(oldPart); >- add(newPart); >- } >- >- /** >- * @see IPersistablePart >- */ >- public void restoreState(IMemento memento) { >- // Read the bounds. >- Integer bigInt; >- bigInt = memento.getInteger(IWorkbenchConstants.TAG_X); >- int x = bigInt.intValue(); >- bigInt = memento.getInteger(IWorkbenchConstants.TAG_Y); >- int y = bigInt.intValue(); >- bigInt = memento.getInteger(IWorkbenchConstants.TAG_WIDTH); >- int width = bigInt.intValue(); >- bigInt = memento.getInteger(IWorkbenchConstants.TAG_HEIGHT); >- int height = bigInt.intValue(); >- >- bounds = new Rectangle(x, y, width, height); >- >- // Restore the placeholders. >- IMemento childrenMem[] = memento >- .getChildren(IWorkbenchConstants.TAG_VIEW); >- for (int i = 0; i < childrenMem.length; i++) { >- PartPlaceholder holder = new PartPlaceholder(childrenMem[i] >- .getString(IWorkbenchConstants.TAG_ID)); >- holder.setContainer(this); >- children.add(holder); >- } >- } >- >- /** >- * @see IPersistablePart >- */ >- public void saveState(IMemento memento) { >- // Save the bounds. >- memento.putInteger(IWorkbenchConstants.TAG_X, bounds.x); >- memento.putInteger(IWorkbenchConstants.TAG_Y, bounds.y); >- memento.putInteger(IWorkbenchConstants.TAG_WIDTH, bounds.width); >- memento.putInteger(IWorkbenchConstants.TAG_HEIGHT, bounds.height); >- >- // Save the views. >- for (int i = 0; i < children.size(); i++) { >- IMemento childMem = memento >- .createChild(IWorkbenchConstants.TAG_VIEW); >- LayoutPart child = (LayoutPart) children.get(i); >- childMem.putString(IWorkbenchConstants.TAG_ID, child.getID()); >- } >- } >- >- public void findSashes(LayoutPart part, PartPane.Sashes sashes) { >- ILayoutContainer container = getContainer(); >- >- if (container != null) { >- container.findSashes(this, sashes); >- } >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.ui.internal.ILayoutContainer#allowsAutoFocus() >- */ >- public boolean allowsAutoFocus() { >- return false; >- } >-} >\ No newline at end of file >Index: Eclipse UI/org/eclipse/ui/internal/DetachedWindow.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DetachedWindow.java,v >retrieving revision 1.20 >diff -u -r1.20 DetachedWindow.java >--- Eclipse UI/org/eclipse/ui/internal/DetachedWindow.java 20 Jul 2004 20:06:06 -0000 1.20 >+++ Eclipse UI/org/eclipse/ui/internal/DetachedWindow.java 30 Aug 2004 20:11:35 -0000 >@@ -30,11 +30,14 @@ > import org.eclipse.ui.IMemento; > import org.eclipse.ui.IWorkbenchPage; > import org.eclipse.ui.contexts.IWorkbenchContextSupport; >+import org.eclipse.ui.internal.PartPane.Sashes; > import org.eclipse.ui.help.WorkbenchHelp; >+import org.eclipse.ui.internal.presentations.PresentationFactoryUtil; > >-public class DetachedWindow extends Window { >+public class DetachedWindow extends Window implements >+ ILayoutContainer{ > >- private ViewStack folder; >+ private DetachedViewStack folder; > > private WorkbenchPage page; > >@@ -42,7 +45,9 @@ > private String title; > > private Rectangle bounds; >- >+ >+ private boolean shellCreationAllowed = false; >+ > /** > * Create a new FloatingWindow. > */ >@@ -51,19 +56,44 @@ > setShellStyle( //SWT.CLOSE | SWT.MIN | SWT.MAX | > SWT.RESIZE); > this.page = workbenchPage; >- folder = new ViewStack(page, false); >+ folder = new DetachedViewStack(page, false, PresentationFactoryUtil.ROLE_VIEW); >+ folder.setContainer(this); > } >- >+ > /** > * Adds a visual part to this window. > * Supports reparenting. > */ >- public void add(ViewPane part) { >- >+ public void add(LayoutPart newPart) { > Shell shell = getShell(); >- if (shell != null) >- part.reparent(shell); >- folder.add(part); >+ >+ if (shellCreationAllowed){ >+ open(); >+ shell = getShell(); >+ } >+ if(shell != null) >+ newPart.reparent(shell); >+ >+ folder.add(newPart); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.internal.ILayoutContainer#allowsAutoFocus() >+ */ >+ public boolean allowsAutoFocus() { >+ return false; >+ } >+ >+ /** >+ * Allows this window to spawn it's shell as required. This is disabled by >+ * default because creating shells before the Perspective has been activated >+ * causes unpredictable behaviour. This is toggled on perspective activation >+ * and deactivation. >+ * >+ * @param b >+ */ >+ /*package*/ void allowShellCreation(boolean b) { >+ shellCreationAllowed = b; > } > > public boolean belongsToWorkbenchPage(IWorkbenchPage workbenchPage) { >@@ -109,6 +139,7 @@ > protected void configureShell(Shell shell) { > if (title != null) > shell.setText(title); >+ shell.setVisible(false); > shell.addListener(SWT.Resize, new Listener() { > public void handleEvent(Event event) { > Shell shell = (Shell) event.widget; >@@ -144,10 +175,43 @@ > // Return tab folder control. > return folder.getControl(); > } >- >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.internal.ILayoutContainer#findSashes(org.eclipse.ui.internal.LayoutPart, org.eclipse.ui.internal.PartPane.Sashes) >+ */ >+ public void findSashes(LayoutPart toFind, Sashes result) { >+ //do nothing >+ } >+ > public LayoutPart[] getChildren() { > return folder.getChildren(); > } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.window.Window#getConstrainedShellSize(org.eclipse.swt.graphics.Rectangle) >+ */ >+ protected Rectangle getConstrainedShellBounds(Rectangle preferredSize) { >+ // As long as the initial position is somewhere on the display, don't mess with it. >+ if (intersectsAnyMonitor(getShell().getDisplay(), preferredSize)) { >+ return preferredSize; >+ } >+ >+ return super.getConstrainedShellBounds(preferredSize); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.internal.ILayoutContainer#getContainer() >+ */ >+ public ILayoutContainer getContainer() { >+ return null; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.internal.IWorkbenchDragDropPart#getControl() >+ */ >+ public Control getControl() { >+ return folder.getControl(); >+ } > > public WorkbenchPage getWorkbenchPage() { > return this.page; >@@ -175,6 +239,41 @@ > } > > /** >+ * >+ * Returns true iff the given rectangle is located in the client area of any >+ * monitor. >+ * >+ * @param someRectangle a rectangle in display coordinates (not null) >+ * @return true iff the given point can be seen on any monitor >+ */ >+ private static boolean intersectsAnyMonitor(Display display, >+ Rectangle someRectangle) { >+ Monitor[] monitors = display.getMonitors(); >+ >+ for (int idx = 0; idx < monitors.length; idx++) { >+ Monitor mon = monitors[idx]; >+ >+ if (mon.getClientArea().intersects(someRectangle)) { >+ return true; >+ } >+ } >+ >+ return false; >+ } >+ >+ public void remove(LayoutPart part) { >+ folder.remove(part); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.internal.ILayoutContainer#resizeChild(org.eclipse.ui.internal.LayoutPart) >+ */ >+ public void resizeChild(LayoutPart childThatChanged) { >+ //do nothing >+ } >+ >+ >+ /** > * @see IPersistablePart > */ > public void restoreState(IMemento memento) { >@@ -191,6 +290,13 @@ > int width = bigInt.intValue(); > bigInt = memento.getInteger(IWorkbenchConstants.TAG_HEIGHT); > int height = bigInt.intValue(); >+ bigInt = memento.getInteger(IWorkbenchConstants.TAG_FLOAT); >+ //float tag @since 3.1 - old workbench.xmls won't have it >+ int floatint = 0; >+ if(bigInt != null) { >+ floatint = bigInt.intValue(); >+ folder.setFloatingState(floatint == 1); >+ } > > // Set the bounds. > bounds = new Rectangle(x, y, width, height); >@@ -198,7 +304,9 @@ > getShell().setText(title); > getShell().setBounds(bounds); > } >- >+ >+ >+ > // Create the folder. > IMemento childMem = memento.getChild(IWorkbenchConstants.TAG_FOLDER); > if (childMem != null) >@@ -221,51 +329,28 @@ > memento.putInteger(IWorkbenchConstants.TAG_Y, bounds.y); > memento.putInteger(IWorkbenchConstants.TAG_WIDTH, bounds.width); > memento.putInteger(IWorkbenchConstants.TAG_HEIGHT, bounds.height); >+ memento.putInteger(IWorkbenchConstants.TAG_FLOAT, >+ folder.isFloating() ? 1 : 0); > > // Save the views. > IMemento childMem = memento.createChild(IWorkbenchConstants.TAG_FOLDER); > folder.saveState(childMem); > } >- >+ >+ public void setFloatingState(boolean state) { >+ folder.setFloatingState(state); >+ } >+ > /* (non-Javadoc) >- * @see org.eclipse.ui.internal.IWorkbenchDragDropPart#getControl() >+ * @see org.eclipse.ui.internal.ILayoutContainer#setZoomed(boolean) > */ >- public Control getControl() { >- return folder.getControl(); >+ public void setZoomed(boolean isZoomed) { >+ folder.setZoomed(isZoomed); >+ > } > >- /** >- * >- * Returns true iff the given rectangle is located in the client area of any >- * monitor. >- * >- * @param someRectangle a rectangle in display coordinates (not null) >- * @return true iff the given point can be seen on any monitor >- */ >- private static boolean intersectsAnyMonitor(Display display, >- Rectangle someRectangle) { >- Monitor[] monitors = display.getMonitors(); >- >- for (int idx = 0; idx < monitors.length; idx++) { >- Monitor mon = monitors[idx]; >- >- if (mon.getClientArea().intersects(someRectangle)) { >- return true; >- } >- } >- >- return false; >+ public boolean shouldOpenOnActivate() { >+ return !(folder.getHidden()); > } > >- /* (non-Javadoc) >- * @see org.eclipse.jface.window.Window#getConstrainedShellSize(org.eclipse.swt.graphics.Rectangle) >- */ >- protected Rectangle getConstrainedShellBounds(Rectangle preferredSize) { >- // As long as the initial position is somewhere on the display, don't mess with it. >- if (intersectsAnyMonitor(getShell().getDisplay(), preferredSize)) { >- return preferredSize; >- } >- >- return super.getConstrainedShellBounds(preferredSize); >- } > } >Index: Eclipse UI/org/eclipse/ui/internal/EditorStack.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorStack.java,v >retrieving revision 1.12 >diff -u -r1.12 EditorStack.java >--- Eclipse UI/org/eclipse/ui/internal/EditorStack.java 20 Aug 2004 00:28:02 -0000 1.12 >+++ Eclipse UI/org/eclipse/ui/internal/EditorStack.java 30 Aug 2004 20:11:35 -0000 >@@ -46,11 +46,12 @@ > private SystemMenuSize sizeItem = new SystemMenuSize(null); > > private SystemMenuPinEditor pinEditorItem = new SystemMenuPinEditor(null); >- >+ > public EditorStack(EditorSashContainer editorArea, WorkbenchPage page) { > super(PresentationFactoryUtil.ROLE_EDITOR); //$NON-NLS-1$ > this.editorArea = editorArea; > setID(this.toString()); >+ hidden = false; > // Each folder has a unique ID so relative positioning is unambiguous. > // save off a ref to the page > //@issue is it okay to do this?? >Index: Eclipse UI/org/eclipse/ui/internal/FastViewBar.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/FastViewBar.java,v >retrieving revision 1.28 >diff -u -r1.28 FastViewBar.java >--- Eclipse UI/org/eclipse/ui/internal/FastViewBar.java 4 Aug 2004 22:58:38 -0000 1.28 >+++ Eclipse UI/org/eclipse/ui/internal/FastViewBar.java 30 Aug 2004 20:11:35 -0000 >@@ -45,6 +45,7 @@ > import org.eclipse.ui.IWorkbenchPart; > import org.eclipse.ui.IWorkbenchPreferenceConstants; > import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.internal.PartPane.Sashes; > import org.eclipse.ui.internal.dnd.AbstractDropTarget; > import org.eclipse.ui.internal.dnd.DragUtil; > import org.eclipse.ui.internal.dnd.IDragOverListener; >@@ -65,7 +66,7 @@ > * > * @see org.eclipse.ui.internal.FastViewPane > */ >-public class FastViewBar implements IWindowTrim { >+public class FastViewBar implements IWindowTrim, ILayoutContainer{ > private ToolBarManager fastViewBar; > > private Menu fastViewBarMenu; >@@ -405,9 +406,7 @@ > LayoutPart[] children = folder.getChildren(); > > for (int idx = 0; idx < children.length; idx++) { >- if (!(children[idx] instanceof PartPlaceholder)) { >- viewList.add(children[idx]); >- } >+ viewList.add(children[idx]); > } > > return createDropTarget(viewList, targetItem); >@@ -626,7 +625,7 @@ > Rectangle startBounds = Geometry.toDisplay(item > .getParent(), bounds); > >- page.removeFastView(selectedView); >+ page.reattachFastView(selectedView); > > IWorkbenchPart toActivate = selectedView > .getPart(true); >@@ -963,5 +962,74 @@ > next.getInteger(IWorkbenchConstants.TAG_POSITION)); > } > } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.internal.ILayoutContainer#add(org.eclipse.ui.internal.LayoutPart) >+ */ >+ public void add(LayoutPart newPart) { >+ ViewPane pane = (ViewPane)newPart; >+ pane.doMakeFast(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.internal.ILayoutContainer#getChildren() >+ */ >+ public LayoutPart[] getChildren() { >+ IViewReference[] refs = getPage().getFastViews(); >+ >+ LayoutPart[] parts = new LayoutPart[refs.length]; >+ for (int i = 0; i < refs.length; i++) { >+ IViewReference ref = refs[i]; >+ >+ parts[i] = ((WorkbenchPartReference)ref).getPane(); >+ } >+ >+ return parts; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.internal.ILayoutContainer#getContainer() >+ */ >+ public ILayoutContainer getContainer() { >+ return null; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.internal.ILayoutContainer#remove(org.eclipse.ui.internal.LayoutPart) >+ */ >+ public void remove(LayoutPart toRemove) { >+ ViewPane pane = (ViewPane)toRemove; >+ getPage().removeFastView(pane.getViewReference()); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.internal.ILayoutContainer#findSashes(org.eclipse.ui.internal.LayoutPart, org.eclipse.ui.internal.PartPane.Sashes) >+ */ >+ public void findSashes(LayoutPart toFind, Sashes result) { >+ // no-op >+ >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.internal.ILayoutContainer#allowsAutoFocus() >+ */ >+ public boolean allowsAutoFocus() { >+ return false; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.internal.ILayoutContainer#setZoomed(boolean) >+ */ >+ public void setZoomed(boolean isZoomed) { >+ // no-op >+ >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.internal.ILayoutContainer#resizeChild(org.eclipse.ui.internal.LayoutPart) >+ */ >+ public void resizeChild(LayoutPart childThatChanged) { >+ //TODO: trigger a layout in the FastViewPane >+ } > > } >Index: Eclipse UI/org/eclipse/ui/internal/FolderLayout.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/FolderLayout.java,v >retrieving revision 1.22 >diff -u -r1.22 FolderLayout.java >--- Eclipse UI/org/eclipse/ui/internal/FolderLayout.java 23 Aug 2004 19:07:28 -0000 1.22 >+++ Eclipse UI/org/eclipse/ui/internal/FolderLayout.java 30 Aug 2004 20:11:35 -0000 >@@ -50,13 +50,9 @@ > if (!pageLayout.checkValidPlaceholderId(viewId)) { > return; > } >+ >+ pageLayout.addPlaceholder(viewId, folder); > >- // Create the placeholder. >- PartPlaceholder newPart = new PartPlaceholder(viewId); >- linkPartToPageLayout(viewId, newPart); >- >- // Add it to the folder layout. >- folder.add(newPart); > } > > /* (non-Javadoc) >Index: Eclipse UI/org/eclipse/ui/internal/ILayoutContainer.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ILayoutContainer.java,v >retrieving revision 1.11 >diff -u -r1.11 ILayoutContainer.java >--- Eclipse UI/org/eclipse/ui/internal/ILayoutContainer.java 8 Jul 2004 20:07:33 -0000 1.11 >+++ Eclipse UI/org/eclipse/ui/internal/ILayoutContainer.java 30 Aug 2004 20:11:35 -0000 >@@ -22,14 +22,14 @@ > public LayoutPart[] getChildren(); > > /** >- * Remove a child from the container. >+ * Returns the container's container, or null if none. > */ >- public void remove(LayoutPart part); >- >+ public ILayoutContainer getContainer(); >+ > /** >- * Replace one child with another >+ * Remove a child from the container. > */ >- public void replace(LayoutPart oldPart, LayoutPart newPart); >+ public void remove(LayoutPart part); > > public void findSashes(LayoutPart toFind, PartPane.Sashes result); > >Index: Eclipse UI/org/eclipse/ui/internal/IWorkbenchConstants.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IWorkbenchConstants.java,v >retrieving revision 1.52 >diff -u -r1.52 IWorkbenchConstants.java >--- Eclipse UI/org/eclipse/ui/internal/IWorkbenchConstants.java 27 Aug 2004 04:11:33 -0000 1.52 >+++ Eclipse UI/org/eclipse/ui/internal/IWorkbenchConstants.java 30 Aug 2004 20:11:35 -0000 >@@ -152,6 +152,8 @@ > public static final String TAG_MINIMIZED = "minimized"; //$NON-NLS-1$ > > public static final String TAG_MAXIMIZED = "maximized"; //$NON-NLS-1$ >+ >+ public static final String TAG_FASTVIEWBAR = "fastviewbar"; //$NON-NLS-1$ > > public static final String TAG_FOLDER = "folder"; //$NON-NLS-1$ > >@@ -160,6 +162,8 @@ > public static final String TAG_PART = "part"; //$NON-NLS-1$ > > public static final String TAG_PART_NAME = "partName"; //$NON-NLS-1$ >+ >+ public static final String TAG_PLACEHOLDERS = "placeholders"; //$NON-NLS-1$ > > public static final String TAG_RELATIVE = "relative"; //$NON-NLS-1$ > >Index: Eclipse UI/org/eclipse/ui/internal/LayoutTree.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LayoutTree.java,v >retrieving revision 1.13 >diff -u -r1.13 LayoutTree.java >--- Eclipse UI/org/eclipse/ui/internal/LayoutTree.java 9 Aug 2004 20:23:49 -0000 1.13 >+++ Eclipse UI/org/eclipse/ui/internal/LayoutTree.java 30 Aug 2004 20:11:35 -0000 >@@ -467,7 +467,10 @@ > * Returns true if this tree has visible parts otherwise returns false. > */ > public boolean isVisible() { >- return !(part instanceof PartPlaceholder); >+ if(part instanceof PartStack) { >+ return !(((PartStack)part).getHidden()); >+ } >+ return true; > } > > /** >Index: Eclipse UI/org/eclipse/ui/internal/PageLayout.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PageLayout.java,v >retrieving revision 1.32 >diff -u -r1.32 PageLayout.java >--- Eclipse UI/org/eclipse/ui/internal/PageLayout.java 23 Aug 2004 19:07:28 -0000 1.32 >+++ Eclipse UI/org/eclipse/ui/internal/PageLayout.java 30 Aug 2004 20:11:35 -0000 >@@ -79,6 +79,8 @@ > > private Map mapIDtoViewLayoutRec = new HashMap(10); > >+ private Map mapPlaceholderIDToFolder = new HashMap(3); >+ > private ArrayList newWizardActionIds = new ArrayList(3); > > private ArrayList perspectiveActionIds = new ArrayList(3); >@@ -116,20 +118,13 @@ > * Adds the editor to a layout. > */ > private void addEditorArea() { >- try { >- // Create the part. >- LayoutPart newPart = createView(ID_EDITOR_AREA); >- if (newPart == null) >- // this should never happen as long as newID is the editor ID. >- return; >+ // Create the part. >+ LayoutPart newPart = editorFolder; > >- setRefPart(ID_EDITOR_AREA, newPart); >+ setRefPart(ID_EDITOR_AREA, newPart); > >- // Add it to the layout. >- rootLayoutContainer.add(newPart); >- } catch (PartInitException e) { >- WorkbenchPlugin.log(e.getMessage()); >- } >+ // Add it to the layout. >+ rootLayoutContainer.add(newPart); > } > > /** >@@ -198,7 +193,8 @@ > * @since 3.0 > */ > ViewLayoutRec getViewLayoutRec(String id, boolean create) { >- Assert.isTrue(getRefPart(id) != null || isFastViewId(id)); >+ Assert.isTrue(getRefPart(id) != null || isFastViewId(id) >+ || getPlaceholderFolder(id) != null); > > ViewLayoutRec rec = (ViewLayoutRec) mapIDtoViewLayoutRec.get(id); > if (rec == null && create) { >@@ -229,9 +225,10 @@ > /** > * Add the layout part to the page's layout > */ >- private void addPart(LayoutPart newPart, String partId, int relationship, >+ private void addPart(ViewStack newPart, String partId, int relationship, > float ratio, String refId) { > >+ setFolderPart(partId, newPart); > setRefPart(partId, newPart); > > // If the referenced part is inside a folder, >@@ -274,12 +271,32 @@ > return; > } > >- // Create the placeholder. >- PartPlaceholder newPart = new PartPlaceholder(viewId); >- addPart(newPart, viewId, relationship, ratio, refId); >+ // New style placeholder. We add an invisible stack and map the >+ // part to it. >+ int appearance = PresentationFactoryUtil.ROLE_VIEW; >+ ViewStack newFolder = new ViewStack(rootLayoutContainer.page, >+ true, appearance); >+ setFolderPart(viewId, newFolder); >+ addPart(newFolder, viewId, relationship, ratio, refId); >+ >+ mapIDtoFolder.put(viewId, newFolder); >+ mapPlaceholderIDToFolder.put(viewId, newFolder); >+ >+ > // force creation of the view layout rec > getViewLayoutRec(viewId, true); > } >+ >+ /** >+ * Used by FolderLayout to programmatically create a placeholder before >+ * the Perspective has been created. >+ * @param viewId >+ * @param inner >+ */ >+ /* protected */ void addPlaceholder(String viewId, ILayoutContainer inner) { >+ >+ mapPlaceholderIDToFolder.put(viewId, inner); >+ } > > /** > * Checks whether the given id is a valid placeholder id. >@@ -416,18 +433,17 @@ > public IPlaceholderFolderLayout createPlaceholderFolder(String folderId, > int relationship, float ratio, String refId) { > if (checkPartInLayout(folderId)) >- return new PlaceholderFolderLayout(this, >- (ContainerPlaceholder) getRefPart(folderId)); >+ return new FolderLayout(this, >+ (ViewStack) getRefPart(folderId), viewFactory); > > // Create the folder. >- ContainerPlaceholder folder = new ContainerPlaceholder(null); >+ ViewStack folder = new ViewStack(rootLayoutContainer.page); > folder.setContainer(rootLayoutContainer); >- folder.setRealContainer(new ViewStack(rootLayoutContainer.page)); > folder.setID(folderId); > addPart(folder, folderId, relationship, ratio, refId); > > // Create a wrapper. >- return new PlaceholderFolderLayout(this, folder); >+ return new FolderLayout(this, folder, viewFactory); > } > > /** >@@ -438,16 +454,12 @@ > * created because of activity filtering. > * @throws PartInitException thrown if there is a problem creating the part. > */ >- private LayoutPart createView(String partID) throws PartInitException { >- if (partID.equals(ID_EDITOR_AREA)) { >- return editorFolder; >- } else { >- IViewDescriptor viewDescriptor = viewFactory.getViewRegistry() >- .find(partID); >- if (WorkbenchActivityHelper.filterItem(viewDescriptor)) >- return null; >- return LayoutHelper.createView(getViewFactory(), partID); >- } >+ private PartPane createView(String partID) throws PartInitException { >+ IViewDescriptor viewDescriptor = viewFactory.getViewRegistry() >+ .find(partID); >+ if (WorkbenchActivityHelper.filterItem(viewDescriptor)) >+ return null; >+ return LayoutHelper.createView(getViewFactory(), partID); > } > > /** >@@ -521,12 +533,27 @@ > } > > /** >+ * @return the map containing part IDs onto stacks. Used exclusively >+ * by PartSashContainer. >+ */ >+ /* package */ Map getPlaceholderMapInner() { >+ return mapPlaceholderIDToFolder; >+ } >+ >+ /** > * @return the part for a given ID. > */ > /*package*/ > LayoutPart getRefPart(String partID) { > return (LayoutPart) mapIDtoPart.get(partID); > } >+ >+ /** >+ * @return the placeholder folder for a given ID. >+ */ >+ private LayoutPart getPlaceholderFolder(String partID) { >+ return (LayoutPart) mapPlaceholderIDToFolder.get(partID); >+ } > > /** > * @return the top level layout container. >@@ -631,18 +658,6 @@ > * Map the folder part containing the given view ID. > * > * @param viewId the part ID. >- * @param container the <code>ContainerPlaceholder</code>. >- */ >- /*package*/ >- void setFolderPart(String viewId, ContainerPlaceholder container) { >- LayoutPart tabFolder = container.getRealContainer(); >- mapIDtoFolder.put(viewId, tabFolder); >- } >- >- /** >- * Map the folder part containing the given view ID. >- * >- * @param viewId the part ID. > * @param folder the <code>ViewStack</code>. > */ > /*package*/ >@@ -669,7 +684,7 @@ > * @param viewId the view ID. > * @param refId the reference ID. > */ >- private void stackPart(LayoutPart newPart, String viewId, String refId) { >+ private void stackPart(PartPane newPart, String viewId, String refId) { > setRefPart(viewId, newPart); > // force creation of the view layout rec > getViewLayoutRec(viewId, true); >@@ -677,29 +692,16 @@ > // If ref part is in a folder than just add the > // new view to that folder. > ViewStack folder = getFolderPart(refId); >- if (folder != null) { >- folder.add(newPart); >- setFolderPart(viewId, folder); >- return; >- } >- >- // If the ref part is in the page layout then create >- // a new folder and add the new view. >- LayoutPart refPart = getRefPart(refId); >- if (refPart != null) { >- ViewStack newFolder = new ViewStack(rootLayoutContainer.page); >- rootLayoutContainer.replace(refPart, newFolder); >- newFolder.add(refPart); >- newFolder.add(newPart); >- setFolderPart(refId, newFolder); >- setFolderPart(viewId, newFolder); >- return; >+ if (folder == null) { >+ folder = new ViewStack(rootLayoutContainer.page); >+ // If ref part is not found then just do add. >+ WorkbenchPlugin.log(WorkbenchMessages.format( >+ "PageLayout.missingRefPart", new Object[] { refId })); //$NON-NLS-1$ >+ rootLayoutContainer.add(folder); > } > >- // If ref part is not found then just do add. >- WorkbenchPlugin.log(WorkbenchMessages.format( >- "PageLayout.missingRefPart", new Object[] { refId })); //$NON-NLS-1$ >- rootLayoutContainer.add(newPart); >+ folder.add(newPart); >+ setFolderPart(viewId, folder); > } > > // stackPlaceholder(String, String) added by dan_rubel@instantiations.com >@@ -713,15 +715,13 @@ > if (checkPartInLayout(viewId)) > return; > >- // Create the placeholder. >- PartPlaceholder newPart = new PartPlaceholder(viewId); >- >- LayoutPart refPart = getRefPart(refId); >- if (refPart != null) { >- newPart.setContainer(refPart.getContainer()); >- } >- >- stackPart(newPart, viewId, refId); >+ // Try to stack on a visible view. >+ ILayoutContainer folder = getFolderPart(refId); >+ if(folder != null && folder instanceof PartStack) { >+ mapPlaceholderIDToFolder.put(viewId, folder); >+ setFolderPart(viewId, (ViewStack)folder); >+ return; >+ } > } > > // stackView(String, String) modified by dan_rubel@instantiations.com >@@ -737,7 +737,7 @@ > > // Create the new part. > try { >- LayoutPart newPart = createView(viewId); >+ PartPane newPart = createView(viewId); > if (newPart == null) { > stackPlaceholder(viewId, refId); > LayoutHelper.addViewActivator(this, viewId); >Index: Eclipse UI/org/eclipse/ui/internal/PartPane.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartPane.java,v >retrieving revision 1.59 >diff -u -r1.59 PartPane.java >--- Eclipse UI/org/eclipse/ui/internal/PartPane.java 23 Aug 2004 23:17:05 -0000 1.59 >+++ Eclipse UI/org/eclipse/ui/internal/PartPane.java 30 Aug 2004 20:11:35 -0000 >@@ -543,13 +543,6 @@ > } > > /** >- * Pin this part. >- */ >- protected void doDock() { >- // do nothing >- } >- >- /** > * Set the busy state of the pane. > */ > public void setBusy(boolean isBusy) { >Index: Eclipse UI/org/eclipse/ui/internal/PartSashContainer.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartSashContainer.java,v >retrieving revision 1.33 >diff -u -r1.33 PartSashContainer.java >--- Eclipse UI/org/eclipse/ui/internal/PartSashContainer.java 4 Aug 2004 22:58:38 -0000 1.33 >+++ Eclipse UI/org/eclipse/ui/internal/PartSashContainer.java 30 Aug 2004 20:11:35 -0000 >@@ -59,6 +59,8 @@ > > private SashContainerDropTarget dropTarget; > >+ private PlaceholderMap placeholderMap = new PlaceholderMap(); >+ > protected static class RelationshipInfo { > protected LayoutPart part; > >@@ -214,8 +216,25 @@ > public void add(LayoutPart child) { > if (child == null) > return; >- >- addEnhanced(child, SWT.RIGHT, 0.5f, findBottomRight()); >+ >+ //check for a placeholder first >+ ILayoutContainer stack = placeholderMap.get(child.getCompoundId()); >+ if(stack != null){ >+ if (!(stack instanceof ViewStack)) { >+ child.reparent(getParent()); >+ } >+ stack.add(child); >+ return; >+ } >+ >+ >+ LayoutPart relative = findBottomRight(); >+ if (relative != null && relative instanceof PartStack) { >+ ((PartStack)relative).add(child); >+ } else { >+ addEnhanced(child, SWT.RIGHT, 0.5f, findBottomRight()); >+ } >+ > } > > /** >@@ -353,7 +372,7 @@ > || info.relationship == IPageLayout.TOP; > LayoutPartSash sash = new LayoutPartSash(this, vertical); > sash.setSizes(info.left, info.right); >- if ((parent != null) && !(child instanceof PartPlaceholder)) >+ if (parent != null) > sash.createControl(parent); > root = root.insert(child, left, sash, info.relative); > } >@@ -403,6 +422,10 @@ > addChild(newRelationshipInfo); > flushLayout(); > } >+ >+ public void addPlaceholder(String compoundID, ILayoutContainer stack) { >+ placeholderMap.put(compoundID, stack); >+ } > > /** > * See ILayoutContainer#allowBorder >@@ -537,7 +560,15 @@ > return null; > return root.findBottomRight(); > } >- >+ >+ protected String[] getPlaceholdersFor(ILayoutContainer c) { >+ return placeholderMap.getPlaceholdersFor(c); >+ } >+ >+ public boolean hasPlaceholders(ILayoutContainer c){ >+ return placeholderMap.hasPlaceholderFor(c); >+ } >+ > /** > * @see LayoutPart#getBounds > */ >@@ -545,14 +576,6 @@ > return this.parent.getBounds(); > } > >-// // getMinimumHeight() added by cagatayk@acm.org >-// /** >-// * @see LayoutPart#getMinimumHeight() >-// */ >-// public int computeMinimumSize(boolean width, int knownHeight) { >-// return getLayoutTree().computeMinimumSize(width, knownHeight); >-// } >- > /** > * @see ILayoutContainer#getChildren > */ >@@ -631,7 +654,13 @@ > public void remove(LayoutPart child) { > if (isZoomed()) > zoomOut(); >- >+ >+ if(child instanceof PartPane) { >+ addPlaceholder(child.getCompoundId(), child.getContainer()); >+ child.getContainer().remove(child); >+ return; >+ } >+ > if (!isChild(child)) > return; > >@@ -647,6 +676,16 @@ > flushLayout(); > } > } >+ >+ /** >+ * Removes a placeholder from this container's mapping. Note that this >+ * should only be called when the part is being relocated and we don't >+ * want to leave an empty container around that will never be used. >+ * @param compoundId >+ */ >+ public void removePlaceholder(String compoundId) { >+ placeholderMap.remove(compoundId); >+ } > > /* (non-Javadoc) > * @see org.eclipse.ui.internal.LayoutPart#forceLayout() >@@ -655,7 +694,7 @@ > layoutDirty = true; > super.flushLayout(); > >- if (layoutDirty) { >+ if (layoutDirty && parent != null) { > resizeSashes(parent.getClientArea()); > } > } >@@ -1011,16 +1050,7 @@ > return 0; > } > >- LayoutPart[] children = container.getChildren(); >- >- int count = 0; >- for (int idx = 0; idx < children.length; idx++) { >- if (!(children[idx] instanceof PartPlaceholder)) { >- count++; >- } >- } >- >- return count; >+ return container.getChildren().length; > } > > protected float getDockingRatio(LayoutPart dragged, LayoutPart target) { >Index: Eclipse UI/org/eclipse/ui/internal/PartStack.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartStack.java,v >retrieving revision 1.40 >diff -u -r1.40 PartStack.java >--- Eclipse UI/org/eclipse/ui/internal/PartStack.java 27 Aug 2004 17:02:58 -0000 1.40 >+++ Eclipse UI/org/eclipse/ui/internal/PartStack.java 30 Aug 2004 20:11:35 -0000 >@@ -61,10 +61,32 @@ > // inactiveCurrent is only used when restoring the persisted state of > // perspective on startup. > private LayoutPart current; >+ >+ private String currentId; > > private boolean ignoreSelectionChanges = false; >+ >+ /** >+ * Indicates that this stack is hidden (ie: this is the value last passed to setHidden). >+ * A "hidden" stack is one which should not appear in the layout because it contains no >+ * children. This does not necessarily correspond with "visible" -- that is, a non-empty >+ * stack in an inactive perspective may be invisible but non-hidden. >+ * >+ * Currently, this is set explicitly by the owner through a call to setHidden, >+ * but it should probably be updated automatically when the first child is added or the >+ * last child is removed. >+ */ >+ protected boolean hidden = true; > > protected IMemento savedPresentationState = null; >+ >+ /** >+ * If createControl(...) has been called, this points to the parent composite. Set to null >+ * otherwise. Basically, this either points to the composite where this stack is allowed >+ * to create its controls or is null if the stack is not supposed to have any controls (ie: >+ * dispose() has been called) >+ */ >+ protected Composite savedParent = null; > > private DefaultStackPresentationSite presentationSite = new DefaultStackPresentationSite() { > >@@ -232,8 +254,8 @@ > "null children are not allowed in PartStack"); //$NON-NLS-1$ > > // This object can only contain placeholders or PartPanes >- Assert.isTrue(child instanceof PartPlaceholder >- || child instanceof PartPane, >+ Assert.isTrue( //child instanceof PartPlaceholder || >+ child instanceof PartPane, > "PartStack can only contain PartPlaceholders or PartPanes"); //$NON-NLS-1$ > > // Ensure that all the PartPanes have an associated presentable part >@@ -246,36 +268,30 @@ > // Ensure that the child's backpointer points to this stack > ILayoutContainer childContainer = child.getContainer(); > >- // Disable tests for placeholders -- PartPlaceholder backpointers don't >- // obey the usual rules -- they sometimes point to a container placeholder >- // for this stack instead of the real stack. >- if (!(child instanceof PartPlaceholder)) { >- >- if (isDisposed()) { >- >- // Currently, we allow null backpointers if the widgetry is disposed. >- // However, it is never valid for the child to have a parent other than >- // this object >- if (childContainer != null) { >- Assert >- .isTrue(childContainer == this, >- "PartStack has a child that thinks it has a different parent"); //$NON-NLS-1$ >- } >- } else { >- // If the widgetry exists, the child's backpointer must point to us >+ if (isDisposed()) { >+ >+ // Currently, we allow null backpointers if the widgetry is disposed. >+ // However, it is never valid for the child to have a parent other than >+ // this object >+ if (childContainer != null) { > Assert > .isTrue(childContainer == this, > "PartStack has a child that thinks it has a different parent"); //$NON-NLS-1$ >- >- // If this child has focus, then ensure that it is selected and that we have >- // the active appearance. >- >- if (SwtUtil.isChild(child.getControl(), focusControl)) { >- Assert.isTrue(child == current, >- "The part with focus is not the selected part"); //$NON-NLS-1$ >- // focus check commented out since it fails when focus workaround in LayoutPart.setVisible is not present >- // Assert.isTrue(getActive() == StackPresentation.AS_ACTIVE_FOCUS); >- } >+ } >+ } else { >+ // If the widgetry exists, the child's backpointer must point to us >+ Assert >+ .isTrue(childContainer == this, >+ "PartStack has a child that thinks it has a different parent"); //$NON-NLS-1$ >+ >+ // If this child has focus, then ensure that it is selected and that we have >+ // the active appearance. >+ >+ if (SwtUtil.isChild(child.getControl(), focusControl)) { >+ Assert.isTrue(child == current, >+ "The part with focus is not the selected part"); //$NON-NLS-1$ >+ // focus check commented out since it fails when focus workaround in LayoutPart.setVisible is not present >+ // Assert.isTrue(getActive() == StackPresentation.AS_ACTIVE_FOCUS); > } > } > >@@ -326,7 +342,6 @@ > for (int idx = 0; idx < children.length; idx++) { > > LayoutPart next = children[idx]; >- if (!(next instanceof PartPlaceholder)) { > if (idx > 0) { > buf.append(", "); //$NON-NLS-1$ > } >@@ -338,7 +353,6 @@ > next.describeLayout(buf); > > visibleChildren++; >- } > } > > buf.append(")"); //$NON-NLS-1$ >@@ -348,6 +362,8 @@ > * See IVisualContainer#add > */ > public void add(LayoutPart child) { >+ Assert.isTrue(child instanceof PartPane); >+ > children.add(child); > showPart(child, null); > } >@@ -421,20 +437,29 @@ > } > > public void createControl(Composite parent) { >- if (!isDisposed()) { >- return; >- } >- >+ savedParent = parent; >+ >+ createControl(); >+ } >+ >+ /** >+ * Creates the controls if we are not hidden and the parent has previously called >+ * createControl. This is a NOP otherwise. >+ */ >+ private void createControl() { >+ if (!isDisposed() || savedParent == null) { >+ return; >+ } > AbstractPresentationFactory factory = getFactory(); > > PresentationSerializer serializer = new PresentationSerializer( > getPresentableParts()); > > StackPresentation presentation = PresentationFactoryUtil >- .createPresentation(factory, appearance, parent, >+ .createPresentation(factory, appearance, savedParent, > presentationSite, serializer, savedPresentationState); > >- createControl(parent, presentation); >+ createControl(savedParent, presentation); > } > > public void createControl(Composite parent, StackPresentation presentation) { >@@ -509,11 +534,9 @@ > ctrl.setData(this); > > updateActions(); >- >- // We should not have a placeholder selected once we've created the widgetry >- if (current instanceof PartPlaceholder) { >- current = null; >- updateContainerVisibleTab(); >+ >+ if (current == null) { >+ updateContainerVisibleTab(); > } > > refreshPresentationSelection(); >@@ -551,13 +574,26 @@ > /** > * See LayoutPart#dispose > */ >- public void dispose() { >+ public final void dispose() { >+ // Note that the real disposal is done in doDispose. >+ savedParent = null; >+ doDispose(); >+ } >+ >+ /** >+ * Internal disposal method. This disposes the widgets and does the real cleanup. >+ * The public dispose() is called when the parent wants to dispose this stack, but >+ * is never invoked within this object. This method is also used internally to wipe >+ * out the widgets when the stack becomes hidden. Note: in order for the stack to >+ * have widgets, the parent must have called createControl(...) AND the stack must not >+ * be hidden. >+ */ >+ protected void doDispose() { > > if (isDisposed()) > return; > > savePresentationState(); >- > presentationSite.dispose(); > > Iterator iter = children.iterator(); >@@ -691,6 +727,13 @@ > return null; > } > >+ /** >+ * Gets the current visibility of the PartStack. >+ */ >+ public boolean getHidden() { >+ return hidden; >+ } >+ > private void presentationSelectionChanged(IPresentablePart newSelection) { > // Ignore selection changes that occur as a result of removing a part > if (ignoreSelectionChanges) { >@@ -744,6 +787,8 @@ > if (child == current) { > updateContainerVisibleTab(); > } >+ >+ updateVisibility(); > } > > /** >@@ -766,40 +811,7 @@ > } > } > >- /** >- * See IVisualContainer#replace >- */ >- public void replace(LayoutPart oldChild, LayoutPart newChild) { >- // commented out but left for future reference - we're using this >- // as the cookie for the part presentation but this will >- // almost always be null (oldChilds being PartPlaceholders) >- // even if they aren't null, we don't handle >- // IPresentableParts as cookies >- // >- // IPresentablePart oldPart = oldChild.getPresentablePart(); >- IPresentablePart newPart = newChild.getPresentablePart(); >- >- int idx = children.indexOf(oldChild); >- int numPlaceholders = 0; >- //subtract the number of placeholders still existing in the list >- //before this one - they wont have parts. >- for (int i = 0; i < idx; i++) { >- if (children.get(i) instanceof PartPlaceholder) >- numPlaceholders++; >- } >- Integer cookie = new Integer(idx - numPlaceholders); >- children.add(idx, newChild); >- >- showPart(newChild, cookie); >- >- if (oldChild == current && !(newChild instanceof PartPlaceholder)) { >- setSelection(newChild); >- } >- >- remove(oldChild); >- } >- >- /* (non-Javadoc) >+ /* (non-Javadoc) > * @see org.eclipse.ui.internal.LayoutPart#computePreferredSize(boolean, int, int, int) > */ > public int computePreferredSize(boolean width, int availableParallel, >@@ -813,6 +825,11 @@ > * @see org.eclipse.ui.internal.LayoutPart#getSizeFlags(boolean) > */ > public int getSizeFlags(boolean horizontal) { >+ StackPresentation presentation = getPresentation(); >+ if (presentation == null) { >+ return 0; >+ } >+ > return getPresentation().getSizeFlags(horizontal); > } > >@@ -821,32 +838,9 @@ > */ > public IStatus restoreState(IMemento memento) { > // Read the active tab. >- String activeTabID = memento >+ currentId = memento > .getString(IWorkbenchConstants.TAG_ACTIVE_PAGE_ID); > >- // Read the page elements. >- IMemento[] children = memento.getChildren(IWorkbenchConstants.TAG_PAGE); >- if (children != null) { >- // Loop through the page elements. >- for (int i = 0; i < children.length; i++) { >- // Get the info details. >- IMemento childMem = children[i]; >- String partID = childMem >- .getString(IWorkbenchConstants.TAG_CONTENT); >- >- // Create the part. >- LayoutPart part = new PartPlaceholder(partID); >- part.setContainer(this); >- add(part); >- //1FUN70C: ITPUI:WIN - Shouldn't set Container when not active >- //part.setContainer(this); >- if (partID.equals(activeTabID)) { >- // Mark this as the active part. >- current = part; >- } >- } >- } >- > Integer expanded = memento.getInteger(IWorkbenchConstants.TAG_EXPANDED); > setState((expanded == null || expanded.intValue() != IStackPresentationSite.STATE_MINIMIZED) ? IStackPresentationSite.STATE_RESTORED > : IStackPresentationSite.STATE_MINIMIZED); >@@ -886,23 +880,6 @@ > memento.putString(IWorkbenchConstants.TAG_ACTIVE_PAGE_ID, current > .getCompoundId()); > >- Iterator iter = children.iterator(); >- while (iter.hasNext()) { >- LayoutPart next = (LayoutPart) iter.next(); >- >- IMemento childMem = memento >- .createChild(IWorkbenchConstants.TAG_PAGE); >- >- IPresentablePart part = next.getPresentablePart(); >- String tabText = "LabelNotFound"; //$NON-NLS-1$ >- if (part != null) { >- tabText = part.getName(); >- } >- childMem.putString(IWorkbenchConstants.TAG_LABEL, tabText); >- childMem.putString(IWorkbenchConstants.TAG_CONTENT, next >- .getCompoundId()); >- } >- > memento > .putInteger( > IWorkbenchConstants.TAG_EXPANDED, >@@ -1014,23 +991,22 @@ > > int oldState = presentationSite.getState(); > >- if (current != null) { >- if (newState == IStackPresentationSite.STATE_MAXIMIZED) { >- PartPane pane = getVisiblePart(); >- if (pane != null) { >- pane.doZoom(); >- } >- } else { >- presentationSite.setPresentationState(newState); >- >- WorkbenchPage page = getPage(); >- if (page != null) { >- if (page.isZoomed()) { >- page.zoomOut(); >- } >+ >+ if (newState == IStackPresentationSite.STATE_MAXIMIZED) { >+ PartPane pane = getVisiblePart(); >+ if (pane != null) { >+ pane.doZoom(); >+ } >+ } else { >+ presentationSite.setPresentationState(newState); > >- flushLayout(); >+ WorkbenchPage page = getPage(); >+ if (page != null) { >+ if (page.isZoomed()) { >+ page.zoomOut(); > } >+ >+ flushLayout(); > } > } > >@@ -1055,6 +1031,23 @@ > } > } > >+ private void setHidden(boolean isHidden) { >+ if (isHidden == hidden) { >+ return; >+ } >+ >+ hidden = isHidden; >+ >+ if(isHidden) { >+ doDispose(); >+ } >+ else { >+ createControl(); >+ } >+ flushLayout(); >+ } >+ >+ > /** > * Makes the given part visible in the presentation > * >@@ -1062,6 +1055,10 @@ > */ > private void showPart(LayoutPart part, Object cookie) { > >+ if(hidden) { >+ setHidden(false); >+ } >+ > if (isDisposed()) { > return; > } >@@ -1075,9 +1072,13 @@ > } > > presentationSite.getPresentation().addPart(presentablePart, cookie); >- >- if (current == null) { >- setSelection(part); >+ >+ if(current == null) { >+ setSelection(part); >+ } >+ else if(Util.equals(currentId, part.getCompoundId())) { >+ setSelection(part); >+ currentId = null; > } > } > >@@ -1127,6 +1128,16 @@ > } > > setSelection(selPart); >+ } >+ >+ private void updateVisibility() { >+ if(children.size() == 0) { >+ Window window = getWindow(); >+ setHidden(true); >+ if(window instanceof DetachedWindow) { >+ window.close(); >+ } >+ } > } > > /** >Index: Eclipse UI/org/eclipse/ui/internal/Perspective.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Perspective.java,v >retrieving revision 1.90 >diff -u -r1.90 Perspective.java >--- Eclipse UI/org/eclipse/ui/internal/Perspective.java 27 Aug 2004 04:11:33 -0000 1.90 >+++ Eclipse UI/org/eclipse/ui/internal/Perspective.java 30 Aug 2004 20:11:35 -0000 >@@ -18,6 +18,7 @@ > import java.util.Iterator; > import java.util.List; > import java.util.Map; >+import java.util.Set; > > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IStatus; >@@ -65,7 +66,7 @@ > > protected LayoutPart editorArea; > >- private PartPlaceholder editorHolder; >+ private boolean editorVisible = true; > > private ViewFactory viewFactory; > >@@ -87,6 +88,8 @@ > > private boolean fixed; > >+ private PlaceholderMap placeholders = new PlaceholderMap(); >+ > private ArrayList showInPartIds; > > private HashMap showInTimes = new HashMap(); >@@ -140,21 +143,27 @@ > public void addFastView(IViewReference ref) { > ViewPane pane = (ViewPane) ((WorkbenchPartReference) ref).getPane(); > if (!isFastView(ref)) { >- // Only remove the part from the presentation if it >- // is actually in the presentation. >- if (presentation.hasPlaceholder(ref.getId(), ref.getSecondaryId()) >- || pane.getContainer() != null) >- presentation.removePart(pane); >+ if(pane.getContainer() != null) { >+ presentation.removePart(pane); >+ } >+ > // We are drag-enabling the pane because it has been disabled > // when it was removed from the perspective presentation. > fastViews.add(ref); > pane.setFast(true); >+ >+ pane.setContainer(((WorkbenchWindow)page.getWorkbenchWindow()).getFastViewBar()); >+ > Control ctrl = pane.getControl(); > if (ctrl != null) > ctrl.setEnabled(false); // Remove focus support. > } > } > >+ public void addPlaceholder(String compoundID, ILayoutContainer cont) { >+ placeholders.put(compoundID, cont); >+ } >+ > /** > * Moves a part forward in the Z order of a perspective so it is visible. > * >@@ -239,6 +248,10 @@ > mapIDtoViewLayoutRec.clear(); > } > >+ /* package */ ILayoutContainer findContainer(String id){ >+ return placeholders.get(id); >+ } >+ > /** > * Finds the view with the given ID that is open in this page, or <code>null</code> > * if not found. >@@ -288,6 +301,10 @@ > return page.getClientComposite(); > } > >+ /* package */ String[] getAssociatedParts(ILayoutContainer c){ >+ return placeholders.getPlaceholdersFor(c); >+ } >+ > /** > * Returns the perspective. > */ >@@ -456,9 +473,8 @@ > > // Replace the editor area with a placeholder so we > // know where to put it back on show editor area request. >- editorHolder = new PartPlaceholder(editorArea.getID()); >- presentation.getLayout().replace(editorArea, editorHolder); >- >+ presentation.getLayout().removeEditorArea(); >+ > // Disable the entire editor area so if an editor had > // keyboard focus it will let it go. > if (editorArea.getControl() != null) >@@ -496,6 +512,8 @@ > // Remove the view from the current presentation. > if (isFastView(ref)) { > fastViews.remove(ref); >+ addPlaceholder(((LayoutPart)pane).getCompoundId(), >+ ((WorkbenchWindow)page.getWorkbenchWindow()).getFastViewBar()); > if (pane != null) > pane.setFast(false); //force an update of the toolbar > if (activeFastView == ref) >@@ -515,7 +533,7 @@ > * Return whether the editor area is visible or not. > */ > protected boolean isEditorAreaVisible() { >- return editorHolder == null; >+ return editorVisible; > } > > /** >@@ -671,6 +689,7 @@ > IPageLayout.RIGHT, .75f, > IPageLayout.ID_EDITOR_AREA); > stickyFolderRight.addPlaceholder(id); >+ addPlaceholder(id, container); > break; > case IPageLayout.LEFT: > if (stickyFolderLeft == null) >@@ -678,6 +697,7 @@ > IStickyViewDescriptor.STICKY_FOLDER_LEFT, > IPageLayout.LEFT, .25f, IPageLayout.ID_EDITOR_AREA); > stickyFolderLeft.addPlaceholder(id); >+ addPlaceholder(id, container); > break; > case IPageLayout.TOP: > if (stickyFolderTop == null) >@@ -685,6 +705,7 @@ > IStickyViewDescriptor.STICKY_FOLDER_TOP, > IPageLayout.TOP, .25f, IPageLayout.ID_EDITOR_AREA); > stickyFolderTop.addPlaceholder(id); >+ addPlaceholder(id, container); > break; > case IPageLayout.BOTTOM: > if (stickyFolderBottom == null) >@@ -693,6 +714,7 @@ > IPageLayout.BOTTOM, .75f, > IPageLayout.ID_EDITOR_AREA); > stickyFolderBottom.addPlaceholder(id); >+ addPlaceholder(id, container); > break; > } > >@@ -710,6 +732,17 @@ > // Retrieve view layout info stored in the page layout. > mapIDtoViewLayoutRec.putAll(layout.getIDtoViewLayoutRecMap()); > >+ Map innerPlaceholders = layout.getPlaceholderMapInner(); >+ Set keys = innerPlaceholders.keySet(); >+ Iterator iter = keys.iterator(); >+ while (iter.hasNext()) { >+ Object key = iter.next(); >+ placeholders.put((String)key, container); >+ container.addPlaceholder((String)key, >+ (ILayoutContainer)innerPlaceholders.get(key)); >+ } >+ >+ > // Create action sets. > createInitialActionSets(layout.getActionSets()); > alwaysOnActionSets.addAll(visibleActionSets); >@@ -728,7 +761,7 @@ > presentation = new PerspectiveHelper(page, container, this); > > // Hide editor area if requested by factory >- if (!layout.isEditorAreaVisible()) >+ if (!layout.isEditorAreaVisible()) > hideEditorArea(); > > } >@@ -829,11 +862,6 @@ > Control ctrl = pane.getControl(); > if (ctrl != null) > ctrl.setEnabled(true); // Modify focus support. >- // We are disabling the pane because it will be enabled when it >- // is added to the presentation. When a pane is enabled a drop >- // listener is added to it, and we do not want to have multiple >- // listeners for a pane >- presentation.addPart(pane); > } > } > >@@ -942,8 +970,9 @@ > .getChild(IWorkbenchConstants.TAG_LAYOUT))); > > // Add the editor workbook. Do not hide it now. >- pres.replacePlaceholderWithPart(editorArea); >- >+ mainLayout.addEditorArea(editorArea); >+ editorVisible = true; >+ > // Add the visible views. > IMemento[] views = memento.getChildren(IWorkbenchConstants.TAG_VIEW); > >@@ -959,7 +988,7 @@ > // skip the intro as it is restored higher up in workbench. > if (id.equals(IIntroConstants.INTRO_VIEW_ID)) > continue; >- >+ > // Create and open the view. > IViewReference viewRef = viewFactory.getView(id, secondaryId); > WorkbenchPartReference ref = (WorkbenchPartReference) viewRef; >@@ -977,24 +1006,7 @@ > ref.setPane(vp); > } > page.addPart(ref); >- boolean willPartBeVisible = pres.willPartBeVisible(ref.getId(), >- secondaryId); >- if (willPartBeVisible) { >- IStatus restoreStatus = viewFactory.restoreView(viewRef); >- result.add(restoreStatus); >- if (restoreStatus.getSeverity() == IStatus.OK) { >- IViewPart view = (IViewPart) ref.getPart(true); >- if (view != null) { >- ViewSite site = (ViewSite) view.getSite(); >- ViewPane pane = (ViewPane) site.getPane(); >- pres.replacePlaceholderWithPart(pane); >- } >- } else { >- page.removePart(ref); >- } >- } else { >- pres.replacePlaceholderWithPart(ref.getPane()); >- } >+ pres.addPart(ref.getPane()); > } > > // Load the fast views >@@ -1650,8 +1662,8 @@ > setEditorAreaVisible(true); > > // Replace the part holder with the editor area. >- presentation.getLayout().replace(editorHolder, editorArea); >- editorHolder = null; >+ presentation.getLayout().addEditorArea(editorArea); >+ > } > > private void setEditorAreaVisible(boolean visible) { >@@ -1665,6 +1677,7 @@ > pane.setVisible(visible); > } > editorArea.setVisible(visible); >+ editorVisible = visible; > } > > /** >Index: Eclipse UI/org/eclipse/ui/internal/PerspectiveHelper.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveHelper.java,v >retrieving revision 1.10 >diff -u -r1.10 PerspectiveHelper.java >--- Eclipse UI/org/eclipse/ui/internal/PerspectiveHelper.java 4 Aug 2004 22:58:38 -0000 1.10 >+++ Eclipse UI/org/eclipse/ui/internal/PerspectiveHelper.java 30 Aug 2004 20:11:35 -0000 >@@ -51,12 +51,12 @@ > > private ViewSashContainer mainLayout; > >+ private Perspective perspective; >+ > private IWorkbenchPartReference zoomPart; > > private ArrayList detachedWindowList = new ArrayList(1); > >- private ArrayList detachedPlaceHolderList = new ArrayList(1); >- > private boolean detachable = false; > > private boolean active = false; >@@ -75,6 +75,21 @@ > public IDropTarget drag(Control currentControl, Object draggedObject, > Point position, final Rectangle dragRectangle) { > >+ // If we're dragging a floating detached window >+ if (draggedObject instanceof DetachedWindow) { >+ final DetachedWindow window = (DetachedWindow)draggedObject; >+ return new AbstractDropTarget() { >+ public void drop() { >+ window.getShell().setLocation(dragRectangle.x, >+ dragRectangle.y); >+ } >+ >+ public Cursor getCursor() { >+ return DragCursors.getCursor(DragCursors.OFFSCREEN); >+ } >+ }; >+ } >+ > if (!(draggedObject instanceof ViewPane || draggedObject instanceof ViewStack)) { > return null; > } >@@ -190,10 +205,10 @@ > * Constructs a new object. > */ > public PerspectiveHelper(WorkbenchPage workbenchPage, >- ViewSashContainer mainLayout) { >+ ViewSashContainer mainLayout, Perspective perspective) { > this.page = workbenchPage; > this.mainLayout = mainLayout; >- >+ this.perspective = perspective; > // Determine if reparenting is allowed by checking if some arbitrary > // Composite supports reparenting. This is used to determine if > // detached views should be enabled. >@@ -227,13 +242,16 @@ > part.reparent(parent); > } > mainLayout.createControl(parent); >- >+ > // Open the detached windows. > for (int i = 0, length = detachedWindowList.size(); i < length; i++) { > DetachedWindow dwindow = (DetachedWindow) detachedWindowList.get(i); >- dwindow.open(); >+ if(dwindow.shouldOpenOnActivate()) { >+ dwindow.open(); >+ } >+ dwindow.allowShellCreation(true); > } >- >+ > enableAllDrag(); > //enableAllDrop(); > >@@ -251,98 +269,32 @@ > zoomOut(); > > // Look for a placeholder. >- PartPlaceholder placeholder = null; >- LayoutPart testPart = null; >- String primaryId = part.getID(); >- String secondaryId = null; >- >- if (part instanceof ViewPane) { >- ViewPane pane = (ViewPane) part; >- IViewReference ref = (IViewReference) pane.getPartReference(); >- secondaryId = ref.getSecondaryId(); >- } >- if (secondaryId != null) >- testPart = findPart(primaryId, secondaryId); >- else >- testPart = findPart(primaryId); >- >- // validate the testPart >- if (testPart != null && testPart instanceof PartPlaceholder) >- placeholder = (PartPlaceholder) testPart; >- >- // If there is no placeholder do a simple add. Otherwise, replace the >- // placeholder if its not a pattern matching placholder >- if (placeholder == null) { >- part.reparent(mainLayout.getParent()); >- LayoutPart relative = mainLayout.findBottomRight(); >- if (relative != null && relative instanceof PartStack) { >- mainLayout.stack(part, (PartStack) relative); >- } else { >- mainLayout.add(part); >- } >- } else { >- ILayoutContainer container = placeholder.getContainer(); >- if (container != null) { >- >- if (container instanceof DetachedPlaceHolder) { >- //Create a detached window add the part on it. >- DetachedPlaceHolder holder = (DetachedPlaceHolder) container; >- detachedPlaceHolderList.remove(holder); >- container.remove(testPart); >- DetachedWindow window = new DetachedWindow(page); >- detachedWindowList.add(window); >- window.create(); >- part.createControl(window.getShell()); >- // Open window. >- window.getShell().setBounds(holder.getBounds()); >- window.open(); >- // add part to detached window. >- ViewPane pane = (ViewPane) part; >- window.getShell().setText( >- pane.getPartReference().getTitle()); >- window.add(pane); >- LayoutPart otherChildren[] = holder.getChildren(); >- for (int i = 0; i < otherChildren.length; i++) >- part.getContainer().add(otherChildren[i]); >- } else { >- >- // reconsistute parent if necessary >- if (container instanceof ContainerPlaceholder) { >- ContainerPlaceholder containerPlaceholder = (ContainerPlaceholder) container; >- ILayoutContainer parentContainer = containerPlaceholder >- .getContainer(); >- container = (ILayoutContainer) containerPlaceholder >- .getRealContainer(); >- if (container instanceof LayoutPart) { >- parentContainer.replace(containerPlaceholder, >- (LayoutPart) container); >- } >- containerPlaceholder.setRealContainer(null); >- } >- >- // reparent part. >- if (!(container instanceof ViewStack)) { >- // We don't need to reparent children of PartTabFolders since they will automatically >- // reparent their children when they become visible. This if statement used to be >- // part of an else branch. Investigate if it is still necessary. >- part.reparent(mainLayout.getParent()); >- } >- >- // see if we should replace the placeholder >- if (placeholder.hasWildCard()) { >- if (container instanceof PartSashContainer) >- ((PartSashContainer) container) >- .addChildForPlaceholder(part, placeholder); >- else >- container.add(part); >- } else >- container.replace(placeholder, part); >- } >- } >+ ILayoutContainer newPlaceholder = (ILayoutContainer)( >+ perspective.findContainer(part.getCompoundId())); >+ >+ if (newPlaceholder == null) { >+ part.reparent(mainLayout.getParent()); >+ newPlaceholder = mainLayout; > } >- >- // enable direct manipulation >- //enableDrop(part); >+ >+ newPlaceholder.add(part); >+ } >+ >+ >+ /** >+ * Attaches a part that was previously detached to the mainLayout. >+ * >+ * @param ref >+ */ >+ public void attachPart(IViewReference ref) { >+ if(isZoomed()) >+ zoomOut(); >+ ViewPane pane = (ViewPane)((WorkbenchPartReference)ref).getPane(); >+ derefPart(pane); >+ perspective.addPlaceholder(pane.getCompoundId(), mainLayout); >+ addPart(pane); >+ bringPartToTop(pane); >+ pane.setFocus(); > } > > /** >@@ -385,8 +337,6 @@ > return false; > > ILayoutContainer container = part.getContainer(); >- if (container != null && container instanceof ContainerPlaceholder) >- return false; > > if (container != null && container instanceof ViewStack) { > ViewStack folder = (ViewStack) container; >@@ -398,33 +348,6 @@ > } > > /** >- * Returns true is not in a tab folder or if it is the top one in a tab >- * folder. >- */ >- public boolean willPartBeVisible(String partId) { >- return willPartBeVisible(partId, null); >- } >- >- public boolean willPartBeVisible(String partId, String secondaryId) { >- LayoutPart part = findPart(partId, secondaryId); >- if (part == null) >- return false; >- ILayoutContainer container = part.getContainer(); >- if (container != null && container instanceof ContainerPlaceholder) >- container = (ILayoutContainer) ((ContainerPlaceholder) container) >- .getRealContainer(); >- >- if (container != null && container instanceof ViewStack) { >- ViewStack folder = (ViewStack) container; >- if (folder.getVisiblePart() == null) >- return false; >- return part.getCompoundId().equals( >- folder.getVisiblePart().getCompoundId()); >- } >- return true; >- } >- >- /** > * Open the tracker to allow the user to move the specified part using > * keyboard. > */ >@@ -434,62 +357,6 @@ > } > > /** >- * Answer a list of the PartPlaceholder objects. >- */ >- private PartPlaceholder[] collectPlaceholders() { >- // Scan the main window. >- PartPlaceholder[] results = collectPlaceholders(mainLayout >- .getChildren()); >- >- // Scan each detached window. >- if (detachable) { >- for (int i = 0, length = detachedWindowList.size(); i < length; i++) { >- DetachedWindow win = (DetachedWindow) detachedWindowList.get(i); >- PartPlaceholder[] moreResults = collectPlaceholders(win >- .getChildren()); >- if (moreResults.length > 0) { >- int newLength = results.length + moreResults.length; >- PartPlaceholder[] newResults = new PartPlaceholder[newLength]; >- System.arraycopy(results, 0, newResults, 0, results.length); >- System.arraycopy(moreResults, 0, newResults, >- results.length, moreResults.length); >- results = newResults; >- } >- } >- } >- return results; >- } >- >- /** >- * Answer a list of the PartPlaceholder objects. >- */ >- private PartPlaceholder[] collectPlaceholders(LayoutPart[] parts) { >- PartPlaceholder[] result = new PartPlaceholder[0]; >- >- for (int i = 0, length = parts.length; i < length; i++) { >- LayoutPart part = parts[i]; >- if (part instanceof ILayoutContainer) { >- // iterate through sub containers to find sub-parts >- PartPlaceholder[] newParts = collectPlaceholders(((ILayoutContainer) part) >- .getChildren()); >- PartPlaceholder[] newResult = new PartPlaceholder[result.length >- + newParts.length]; >- System.arraycopy(result, 0, newResult, 0, result.length); >- System.arraycopy(newParts, 0, newResult, result.length, >- newParts.length); >- result = newResult; >- } else if (part instanceof PartPlaceholder) { >- PartPlaceholder[] newResult = new PartPlaceholder[result.length + 1]; >- System.arraycopy(result, 0, newResult, 0, result.length); >- newResult[result.length] = (PartPlaceholder) part; >- result = newResult; >- } >- } >- >- return result; >- } >- >- /** > * Answer a list of the view panes. > */ > public void collectViewPanes(List result) { >@@ -552,6 +419,7 @@ > // Dispose the detached windows > for (int i = 0, length = detachedWindowList.size(); i < length; i++) { > DetachedWindow window = (DetachedWindow) detachedWindowList.get(i); >+ window.allowShellCreation(false); > window.close(); > } > >@@ -604,13 +472,17 @@ > */ > /* package */void derefPart(LayoutPart part) { > >- if (part instanceof ViewPane) { >- page.removeFastView(((ViewPane) part).getViewReference()); >- } >- > // Get vital part stats before reparenting. > Window oldWindow = part.getWindow(); > ILayoutContainer oldContainer = part.getContainer(); >+ >+ if (part instanceof ViewPane) { >+ if(page.isFastView(((ViewPane) part).getViewReference())) { >+ page.removeFastView(((ViewPane) part).getViewReference()); >+ oldWindow = part.getWindow(); >+ oldContainer = part.getContainer(); >+ } >+ } > > // Reparent the part back to the main window > part.reparent(mainLayout.getParent()); >@@ -620,80 +492,12 @@ > return; > > oldContainer.remove(part); >- >- LayoutPart[] children = oldContainer.getChildren(); >- if (oldWindow instanceof WorkbenchWindow) { >- boolean hasChildren = (children != null) && (children.length > 0); >- if (hasChildren) { >- // make sure one is at least visible >- int childVisible = 0; >- for (int i = 0; i < children.length; i++) >- if (children[i].getControl() != null) >- childVisible++; >- >- // none visible, then reprarent and remove container >- if (oldContainer instanceof ViewStack) { >- ViewStack folder = (ViewStack) oldContainer; >- if (childVisible == 0) { >- ILayoutContainer parentContainer = folder >- .getContainer(); >- for (int i = 0; i < children.length; i++) { >- folder.remove(children[i]); >- parentContainer.add(children[i]); >- } >- hasChildren = false; >- } else if (childVisible == 1) { >- LayoutTree layout = mainLayout.getLayoutTree(); >- layout = layout.find(folder); >- layout.setBounds(layout.getBounds()); >- } >- } >- } >- >- if (!hasChildren) { >- // There are no more children in this container, so get rid of >- // it >- if (oldContainer instanceof LayoutPart) { >- LayoutPart parent = (LayoutPart) oldContainer; >- ILayoutContainer parentContainer = parent.getContainer(); >- if (parentContainer != null) { >- parentContainer.remove(parent); >- parent.dispose(); >- } >- } >- } >- } else if (oldWindow instanceof DetachedWindow) { >- if (children == null || children.length == 0) { >- // There are no more children in this container, so get rid of >- // it >- // Turn on redraw again just in case it was off. >- oldWindow.getShell().setRedraw(true); >- oldWindow.close(); >- detachedWindowList.remove(oldWindow); >- } else { >- // There are children. If none are visible hide detached >- // window. >- boolean allInvisible = true; >- for (int i = 0, length = children.length; i < length; i++) { >- if (!(children[i] instanceof PartPlaceholder)) { >- allInvisible = false; >- break; >- } >- } >- if (allInvisible) { >- DetachedPlaceHolder placeholder = new DetachedPlaceHolder( >- "", //$NON-NLS-1$ >- oldWindow.getShell().getBounds()); >- for (int i = 0, length = children.length; i < length; i++) { >- oldContainer.remove(children[i]); >- children[i].setContainer(placeholder); >- placeholder.add(children[i]); >- } >- detachedPlaceHolderList.add(placeholder); >- oldWindow.close(); >- detachedWindowList.remove(oldWindow); >- } >- } >+ >+ if (part instanceof ViewPane && oldContainer instanceof ViewStack) { >+ LayoutPart parent = (LayoutPart) oldContainer; >+ if (parent.getContainer() == mainLayout) { >+ mainLayout.removePlaceholder(part.getCompoundId()); >+ } > } > > } >@@ -736,7 +540,7 @@ > for (int i = 0; i < children.length; i++) { > if (children[i] instanceof ViewPane) { > // remove the part from its current container >- derefPart(children[i]); >+ removePart(children[i]); > // add part to detached window. > ViewPane pane = (ViewPane) children[i]; > window.getShell().setText( >@@ -752,33 +556,59 @@ > parentWidget.setRedraw(true); > } else { > // remove the part from its current container >- derefPart(part); >+ removePart(part); > // add part to detached window. > ViewPane pane = (ViewPane) part; > window.getShell().setText(pane.getPartReference().getTitle()); >- window.add(pane); >+ window.add(part); > part.setFocus(); > } > > } >+ >+ /** >+ * Detached a part from the mainLayout. Presently this does not use placeholders >+ * since the current implementation is not robust enough to remember a view's position >+ * in more than one root container. For now the view is simply derefed and will dock >+ * in the default position when attachPart is called. >+ * >+ * By default parts detached this way are set to float on top of the workbench >+ * without docking. It is assumed that people that want to drag a part back onto >+ * the WorkbenchWindow will detach it via drag and drop. >+ * >+ * @param ref >+ */ >+ public void detachPart(IViewReference ref) { >+ ViewPane pane = (ViewPane)((WorkbenchPartReference)ref).getPane(); >+ if (canDetach() && pane != null) { >+ Rectangle bounds = pane.getParentBounds(); >+ detach(pane, bounds.x ,bounds.y); >+ ((DetachedWindow)pane.getWindow()).setFloatingState(true); >+ } >+ } > > /** > * Create a detached window containing a part. > */ > public void addDetachedPart(LayoutPart part) { >+ // Calculate detached window size. >+ Rectangle bounds = parentWidget.getShell().getBounds(); >+ bounds.x = bounds.x + (bounds.width - 300) / 2; >+ bounds.y = bounds.y + (bounds.height - 300) / 2; >+ >+ addDetachedPart(part, bounds); >+ >+ // enable direct manipulation >+ //enableDrop(part); >+ } >+ >+ public void addDetachedPart(LayoutPart part, Rectangle bounds) { > // Detaching is disabled on some platforms .. > if (!detachable) { > addPart(part); > return; > } >- >- // Calculate detached window size. >- int width = 300; >- int height = 300; >- Rectangle bounds = parentWidget.getShell().getBounds(); >- int x = bounds.x + (bounds.width - width) / 2; >- int y = bounds.y + (bounds.height - height) / 2; >- >+ > // Create detached window. > DetachedWindow window = new DetachedWindow(page); > detachedWindowList.add(window); >@@ -791,15 +621,13 @@ > window.add(pane); > > // Open window. >- window.getShell().setBounds(x, y, width, height); >+ window.getShell().setBounds(bounds.x, bounds.y, bounds.width, bounds.height); > window.open(); > > part.setFocus(); >- >- // enable direct manipulation >- //enableDrop(part); >+ > } >- >+ > /** > * disableDragging. > */ >@@ -852,15 +680,6 @@ > if (part != null) > return part; > } >- for (int i = 0; i < detachedPlaceHolderList.size(); i++) { >- DetachedPlaceHolder holder = (DetachedPlaceHolder) detachedPlaceHolderList >- .get(i); >- part = (secondaryId != null) ? findPart(primaryId, secondaryId, >- holder.getChildren(), matchingParts) : findPart(primaryId, >- holder.getChildren(), matchingParts); >- if (part != null) >- return part; >- } > > // sort the matching parts > if (matchingParts.size() > 0) { >@@ -985,12 +804,13 @@ > * @since 3.0 > */ > public boolean hasPlaceholder(String primaryId, String secondaryId) { >- LayoutPart testPart; >- if (secondaryId == null) >- testPart = findPart(primaryId); >+ ILayoutContainer testCont; >+ if (secondaryId == null) >+ testCont = perspective.findContainer(primaryId); > else >- testPart = findPart(primaryId, secondaryId); >- return (testPart != null && testPart instanceof PartPlaceholder); >+ testCont = perspective >+ .findContainer(primaryId + ViewFactory.ID_SEP + secondaryId); >+ return (testCont != null); > } > > /** >@@ -1000,19 +820,6 @@ > return mainLayout; > } > >- ///** >- // * Returns the zoomed part. >- // * <p> >- // * If the zoomed part is an editor, it will be the >- // * editor which caused the workbook it is in to be zoomed. It may not be >- // the >- // * visible editor. The zoomed part will always be an editor in the zoomed >- // * workbench. >- // * </p> >- // */ >- ///*package*/ IWorkbenchPart getZoomPart() { >- // return zoomPart; >- //} > /** > * Gets the active state. > */ >@@ -1082,6 +889,26 @@ > } > > /** >+ * Returns an immediate child of this perspective helper that directly or indirectly >+ * contains the given pane. Returns null if none. >+ * >+ * @param toFind >+ * @return >+ */ >+ protected ILayoutContainer getLocation(PartPane toFind) { >+ ILayoutContainer container; >+ if(toFind == null || toFind.getContainer() == null) { >+ return mainLayout; >+ } >+ for (container = toFind.getContainer(); container.getContainer() != null; >+ container = container.getContainer()) { >+ //do nothing >+ } >+ >+ return container; >+ } >+ >+ /** > * Remove all references to a part. > */ > public void removePart(LayoutPart part) { >@@ -1096,104 +923,32 @@ > // Replace part with a placeholder > ILayoutContainer container = part.getContainer(); > if (container != null) { >- String placeHolderId = part.getPlaceHolderId(); >- container.replace(part, new PartPlaceholder(placeHolderId)); >- >- // If the parent is root we're done. Do not try to replace >- // it with placeholder. >- if (container == mainLayout) >- return; >- >- // If the parent is empty replace it with a placeholder. >- 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 (allInvisible && (container instanceof LayoutPart)) { >- // what type of window are we in? >- LayoutPart cPart = (LayoutPart) container; >- Window oldWindow = cPart.getWindow(); >- if (oldWindow instanceof WorkbenchWindow) { >- // PR 1GDFVBY: ViewStack not disposed when page >- // closed. >- if (container instanceof ViewStack) >- ((ViewStack) container).dispose(); >- >- // replace the real container with a >- // ContainerPlaceholder >- ILayoutContainer parentContainer = cPart.getContainer(); >- ContainerPlaceholder placeholder = new ContainerPlaceholder( >- cPart.getID()); >- placeholder.setRealContainer(container); >- parentContainer.replace(cPart, placeholder); >- } else if (oldWindow instanceof DetachedWindow) { >- DetachedPlaceHolder placeholder = new DetachedPlaceHolder( >- "", oldWindow.getShell().getBounds()); //$NON-NLS-1$ >- for (int i = 0, length = children.length; i < length; i++) { >- children[i].getContainer().remove(children[i]); >- children[i].setContainer(placeholder); >- placeholder.add(children[i]); >- } >- detachedPlaceHolderList.add(placeholder); >- oldWindow.close(); >- detachedWindowList.remove(oldWindow); >- } >- } >- } >+ if(container instanceof PartStack && part instanceof PartPane) { >+ ILayoutContainer rootContainer = getLocation((PartPane)part); >+ if (rootContainer != null) { >+ perspective.addPlaceholder(part.getCompoundId(), rootContainer); >+ rootContainer.remove(part); >+ } >+ } >+ >+ if(container instanceof FastViewBar) { >+ container.remove(part); >+ } > } > } > >- /** >- * Add a part to the presentation. >- * >- * Note: unlike all other LayoutParts, PartPlaceholders will still point to >- * their parent container even when it is inactive. This method relies on this >- * fact to locate the parent. >- */ >- public void replacePlaceholderWithPart(LayoutPart part) { >- // If part added / removed always zoom out. >- if (isZoomed()) >- zoomOut(); > >- // Look for a PartPlaceholder that will tell us how to position this >- // object >- PartPlaceholder[] placeholders = collectPlaceholders(); >- for (int i = 0, length = placeholders.length; i < length; i++) { >- if (placeholders[i].getCompoundId().equals(part.getCompoundId())) { >- // found a matching placeholder which we can replace with the >- // new View >- ILayoutContainer container = placeholders[i].getContainer(); >- if (container != null) { >- if (container instanceof ContainerPlaceholder) { >- // One of the children is now visible so replace the >- // ContainerPlaceholder with the real container >- ContainerPlaceholder containerPlaceholder = (ContainerPlaceholder) container; >- ILayoutContainer parentContainer = containerPlaceholder >- .getContainer(); >- container = (ILayoutContainer) containerPlaceholder >- .getRealContainer(); >- if (container instanceof LayoutPart) { >- parentContainer.replace(containerPlaceholder, >- (LayoutPart) container); >- } >- containerPlaceholder.setRealContainer(null); >- } >- container.replace(placeholders[i], part); >- return; >- } >- } >+ private void restorePlaceholderBranch(IMemento rootMemento, ILayoutContainer container) { >+ IMemento placeholders = rootMemento.getChild(IWorkbenchConstants.TAG_PLACEHOLDERS); >+ if(placeholders != null) { >+ IMemento[] fPlaceholders = placeholders.getChildren(IWorkbenchConstants.TAG_PAGE); >+ for(int i = 0; i < fPlaceholders.length; i++){ >+ perspective.addPlaceholder(fPlaceholders[i].getString >+ (IWorkbenchConstants.TAG_CONTENT), container); >+ } > } >- >- // If there was no placeholder then the editor workbook is not in the >- // workbench. >- // That's OK. Just return. > } >- >+ > /** > * @see IPersistablePart > */ >@@ -1202,7 +957,8 @@ > IMemento childMem = memento > .getChild(IWorkbenchConstants.TAG_MAIN_WINDOW); > IStatus r = mainLayout.restoreState(childMem); >- >+ restorePlaceholderBranch(childMem, mainLayout); >+ > // Restore each floating window. > if (detachable) { > IMemento detachedWindows[] = memento >@@ -1211,19 +967,42 @@ > DetachedWindow win = new DetachedWindow(page); > detachedWindowList.add(win); > win.restoreState(detachedWindows[nX]); >- } >- IMemento childrenMem[] = memento >- .getChildren(IWorkbenchConstants.TAG_HIDDEN_WINDOW); >- for (int i = 0, length = childrenMem.length; i < length; i++) { >- DetachedPlaceHolder holder = new DetachedPlaceHolder( >- "", new Rectangle(0, 0, 0, 0)); //$NON-NLS-1$ >- holder.restoreState(childrenMem[i]); >- detachedPlaceHolderList.add(holder); >+ restorePlaceholderBranch(detachedWindows[nX], win); > } > } >+ >+ // restore the fast view bar placeholders >+ childMem = memento >+ .getChild(IWorkbenchConstants.TAG_FASTVIEWBAR); >+ if(childMem != null) { >+ restorePlaceholderBranch(childMem, ((WorkbenchWindow)page.getWorkbenchWindow()).getFastViewBar()); >+ } > return r; > > } >+ >+ private void savePlaceholderBranch(IMemento rootMemento, ILayoutContainer container) { >+ //make placeholders for all the visible views >+ LayoutPart[] parts = container.getChildren(); >+ for(int n = 0; n < parts.length; n++) { >+ if(parts[n] instanceof ViewStack) { >+ LayoutPart[] folderParts = ((ViewStack)parts[n]).getChildren(); >+ for(int m = 0; m < folderParts.length; m++) { >+ perspective.addPlaceholder(folderParts[m].getCompoundId(), container); >+ } >+ } >+ else if (container instanceof DetachedWindow) { >+ perspective.addPlaceholder(parts[n].getCompoundId(), container); >+ } >+ } >+ >+ String[] placeholders = perspective.getAssociatedParts(container); >+ IMemento placeholderMem = rootMemento.createChild(IWorkbenchConstants.TAG_PLACEHOLDERS); >+ for(int i = 0; i < placeholders.length; i++){ >+ IMemento phChild = placeholderMem.createChild(IWorkbenchConstants.TAG_PAGE); >+ phChild.putString(IWorkbenchConstants.TAG_CONTENT, placeholders[i]); >+ } >+ } > > /** > * @see IPersistablePart >@@ -1233,6 +1012,7 @@ > IMemento childMem = memento > .createChild(IWorkbenchConstants.TAG_MAIN_WINDOW); > IStatus r = mainLayout.saveState(childMem); >+ savePlaceholderBranch(childMem, mainLayout); > > if (detachable) { > // Persist each detached window. >@@ -1242,15 +1022,15 @@ > childMem = memento > .createChild(IWorkbenchConstants.TAG_DETACHED_WINDOW); > window.saveState(childMem); >- } >- for (int i = 0, length = detachedPlaceHolderList.size(); i < length; i++) { >- DetachedPlaceHolder holder = (DetachedPlaceHolder) detachedPlaceHolderList >- .get(i); >- childMem = memento >- .createChild(IWorkbenchConstants.TAG_HIDDEN_WINDOW); >- holder.saveState(childMem); >+ savePlaceholderBranch(childMem, window); > } > } >+ >+ //Save the fastviewbar >+ childMem = memento >+ .createChild(IWorkbenchConstants.TAG_FASTVIEWBAR); >+ savePlaceholderBranch(childMem, ((WorkbenchWindow)page.getWorkbenchWindow()).getFastViewBar()); >+ > return r; > } > >@@ -1275,10 +1055,9 @@ > //TODO: Remove once all views are in ViewStack > //TODO: See Bug 48794 > ViewStack parent = (ViewStack) parentContainer; >- Perspective persp = page.getActivePerspective(); >- if (persp != null && ref instanceof IViewReference >+ if (perspective != null && ref instanceof IViewReference > && page.isFastView((IViewReference) ref)) { >- persp.hideFastViewSash(); >+ perspective.hideFastViewSash(); > } > mainLayout.zoomIn(parent); > pane.setZoomed(true); >@@ -1324,10 +1103,9 @@ > parentWidget.setRedraw(false); > mainLayout.zoomOut(); > pane.setZoomed(false); >- Perspective persp = page.getActivePerspective(); >- if (persp != null && zoomPart instanceof IViewReference >+ if (perspective != null && zoomPart instanceof IViewReference > && page.isFastView((IViewReference) zoomPart)) { >- persp.showFastView((IViewReference) zoomPart); >+ perspective.showFastView((IViewReference) zoomPart); > } > parentWidget.setRedraw(true); > } else if (pane instanceof EditorPane) { >Index: Eclipse UI/org/eclipse/ui/internal/PlaceholderFolderLayout.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/ui/internal/PlaceholderFolderLayout.java >diff -N Eclipse UI/org/eclipse/ui/internal/PlaceholderFolderLayout.java >--- Eclipse UI/org/eclipse/ui/internal/PlaceholderFolderLayout.java 23 Aug 2004 19:07:28 -0000 1.9 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,65 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2000, 2004 IBM Corporation and others. >- * All rights reserved. This program and the accompanying materials >- * are made available under the terms of the Common Public License v1.0 >- * which accompanies this distribution, and is available at >- * http://www.eclipse.org/legal/cpl-v10.html >- * >- * Contributors: >- * IBM Corporation - initial API and implementation >- *******************************************************************************/ >-package org.eclipse.ui.internal; >- >-import org.eclipse.ui.IPlaceholderFolderLayout; >- >-/** >- * This layout is used to define the initial set of placeholders >- * in a placeholder. >- * <p> >- * Views are added to the placeholder by ID. This id is used to identify >- * a view descriptor in the view registry, and this descriptor is used to >- * instantiate the IViewPart. >- * </p> >- */ >-public class PlaceholderFolderLayout implements IPlaceholderFolderLayout { >- private PageLayout pageLayout; >- >- private ContainerPlaceholder placeholder; >- >- public PlaceholderFolderLayout(PageLayout pageLayout, >- ContainerPlaceholder folder) { >- super(); >- this.placeholder = folder; >- this.pageLayout = pageLayout; >- } >- >- /** >- * @see IPlaceholderFolderLayout >- */ >- public void addPlaceholder(String viewId) { >- if (!pageLayout.checkValidPlaceholderId(viewId)) { >- return; >- } >- >- // Create the placeholder. >- LayoutPart newPart = new PartPlaceholder(viewId); >- >- linkPartToPageLayout(viewId, newPart); >- >- // Add it to the placeholder layout. >- placeholder.add(newPart); >- } >- >- /** >- * Inform the page layout of the new part created >- * and the placeholder the part belongs to. >- */ >- private void linkPartToPageLayout(String viewId, LayoutPart newPart) { >- pageLayout.setRefPart(viewId, newPart); >- // force creation of the view layout rec >- pageLayout.getViewLayoutRec(viewId, true); >- >- pageLayout.setFolderPart(viewId, placeholder); >- newPart.setContainer(placeholder); >- } >-} >\ No newline at end of file >Index: Eclipse UI/org/eclipse/ui/internal/ViewSashContainer.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewSashContainer.java,v >retrieving revision 1.4 >diff -u -r1.4 ViewSashContainer.java >--- Eclipse UI/org/eclipse/ui/internal/ViewSashContainer.java 8 Jul 2004 20:07:32 -0000 1.4 >+++ Eclipse UI/org/eclipse/ui/internal/ViewSashContainer.java 30 Aug 2004 20:11:35 -0000 >@@ -18,12 +18,19 @@ > import org.eclipse.swt.widgets.Composite; > import org.eclipse.swt.widgets.Control; > import org.eclipse.ui.IMemento; >+import org.eclipse.ui.IPageLayout; > import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.internal.util.Util; > > /** > * Represents the top level container. > */ > public class ViewSashContainer extends PartSashContainer { >+ >+ private LayoutPart editorHolder; >+ >+ private LayoutPart editorArea; >+ > public ViewSashContainer(WorkbenchPage page) { > super("root layout container", page);//$NON-NLS-1$ > } >@@ -131,17 +138,37 @@ > > // Create the part. > LayoutPart part = null; >- if (strFolder == null) >- part = new PartPlaceholder(partID); >+ if (strFolder == null) { >+ if(partID.equals(IPageLayout.ID_EDITOR_AREA)) { >+ //Old style placeholder only used by editor. Okay. >+ part = new PartPlaceholder(partID); >+ } >+ else { >+ //This branch only gets excercised when running a old style placeholder >+ //workbench. This converts the old placeholder to a new one. >+ ViewStack folder = new ViewStack(page); >+ addPlaceholder(partID, folder); >+ part = folder; >+ >+ } >+ } > else { > ViewStack folder = new ViewStack(page); > folder.setID(partID); >+ IMemento[] placeholders = childMem >+ .getChildren(IWorkbenchConstants.TAG_FOLDER); >+ for(int j = 0; j < placeholders.length; j++){ >+ IMemento[] folderPlaceholders = placeholders[j] >+ .getChildren(IWorkbenchConstants.TAG_PAGE); >+ for(int k = 0; k < folderPlaceholders.length; k++){ >+ addPlaceholder(folderPlaceholders[k].getString >+ (IWorkbenchConstants.TAG_CONTENT), folder); >+ } >+ } >+ > result.add(folder.restoreState(childMem > .getChild(IWorkbenchConstants.TAG_FOLDER))); >- ContainerPlaceholder placeholder = new ContainerPlaceholder( >- partID); >- placeholder.setRealContainer(folder); >- part = placeholder; >+ part = folder; > } > // 1FUN70C: ITPUI:WIN - Shouldn't set Container when not active > part.setContainer(this); >@@ -162,6 +189,9 @@ > } > } > mapIDtoPart.put(partID, part); >+ if(Util.equals(part.getCompoundId(),IPageLayout.ID_EDITOR_AREA)) { >+ editorHolder = part; >+ } > } > return result; > } >@@ -210,11 +240,6 @@ > ViewStack folder = null; > if (info.part instanceof ViewStack) { > folder = (ViewStack) info.part; >- } else if (info.part instanceof ContainerPlaceholder) { >- LayoutPart part = ((ContainerPlaceholder) info.part) >- .getRealContainer(); >- if (part instanceof ViewStack) >- folder = (ViewStack) part; > } > > // If this is a folder save the contents. >@@ -222,6 +247,25 @@ > childMem.putString(IWorkbenchConstants.TAG_FOLDER, "true");//$NON-NLS-1$ > IMemento folderMem = childMem > .createChild(IWorkbenchConstants.TAG_FOLDER); >+ >+ //make placeholders for all the visible views >+ LayoutPart[] parts = folder.getChildren(); >+ for(int n = 0; n < parts.length; n++) { >+ addPlaceholder(parts[n].getCompoundId(), folder); >+ } >+ >+ //Add all the invisible views in the folder >+ if(hasPlaceholders(folder)){ >+ String[] placeholders = getPlaceholdersFor(folder); >+ for (int j = 0; j < placeholders.length; j++) { >+ String id = placeholders[j]; >+ >+ IMemento phChild = folderMem >+ .createChild(IWorkbenchConstants.TAG_PAGE); >+ phChild.putString(IWorkbenchConstants.TAG_CONTENT, id); >+ } >+ } >+ > result.add(folder.saveState(folderMem)); > } > } >@@ -310,6 +354,15 @@ > } > > super.addChild(info); >+ } >+ >+ protected void addEditorArea(LayoutPart editorArea) { >+ this.editorArea = editorArea; >+ replace(editorHolder, editorArea); >+ } >+ >+ protected void removeEditorArea() { >+ replace(editorArea, editorHolder); > } > > /* (non-Javadoc) >Index: Eclipse UI/org/eclipse/ui/internal/ViewStack.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewStack.java,v >retrieving revision 1.7 >diff -u -r1.7 ViewStack.java >--- Eclipse UI/org/eclipse/ui/internal/ViewStack.java 20 Aug 2004 00:28:02 -0000 1.7 >+++ Eclipse UI/org/eclipse/ui/internal/ViewStack.java 30 Aug 2004 20:11:35 -0000 >@@ -14,6 +14,7 @@ > > import org.eclipse.jface.action.IMenuManager; > import org.eclipse.ui.internal.presentations.PresentationFactoryUtil; >+import org.eclipse.ui.internal.presentations.SystemMenuDetach; > import org.eclipse.ui.internal.presentations.SystemMenuFastView; > import org.eclipse.ui.internal.presentations.SystemMenuSize; > import org.eclipse.ui.internal.presentations.UpdatingActionContributionItem; >@@ -41,10 +42,15 @@ > private SystemMenuSize sizeItem = new SystemMenuSize(null); > > private SystemMenuFastView fastViewAction; >+ > >+ private SystemMenuDetach detachViewAction; >+ > public void addSystemActions(IMenuManager menuManager) { > appendToGroupIfPossible(menuManager, > "misc", new UpdatingActionContributionItem(fastViewAction)); //$NON-NLS-1$ >+ appendToGroupIfPossible(menuManager, >+ "misc", new UpdatingActionContributionItem(detachViewAction)); //$NON-NLS-1$ > sizeItem = new SystemMenuSize((PartPane) getVisiblePart()); > appendToGroupIfPossible(menuManager, "size", sizeItem); //$NON-NLS-1$ > } >@@ -67,6 +73,7 @@ > > this.allowStateChanges = allowsStateChanges; > fastViewAction = new SystemMenuFastView(getPresentationSite()); >+ detachViewAction = new SystemMenuDetach(getPresentationSite()); > } > > protected WorkbenchPage getPage() { >@@ -94,6 +101,8 @@ > } > > fastViewAction.setPane(pane); >+ >+ detachViewAction.setPane(pane); > sizeItem.setPane(pane); > } > >Index: Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java,v >retrieving revision 1.160 >diff -u -r1.160 WorkbenchPage.java >--- Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java 27 Aug 2004 04:11:33 -0000 1.160 >+++ Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java 30 Aug 2004 20:11:35 -0000 >@@ -2354,10 +2354,21 @@ > pane); > } > >+ public void reattachFastView(IViewReference ref) { >+ Perspective persp = getActivePerspective(); >+ if (persp == null) >+ return; >+ >+ removeFastView(ref); >+ WorkbenchPartReference viewRef = (WorkbenchPartReference) ref; >+ >+ persp.getPresentation().addPart(viewRef.getPane()); >+ } >+ > /** > * Removes a fast view. > */ >- public void removeFastView(IViewReference ref) { >+ /* package */ void removeFastView(IViewReference ref) { > Perspective persp = getActivePerspective(); > if (persp == null) > return; >@@ -2662,7 +2673,7 @@ > if (persp == null) > return; > IPerspectiveDescriptor oldDesc = persp.getDesc(); >- >+ > // Always unzoom. > if (isZoomed()) > zoomOut(); >Index: Eclipse UI/org/eclipse/ui/internal/PlaceholderMap.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/ui/internal/PlaceholderMap.java >diff -N Eclipse UI/org/eclipse/ui/internal/PlaceholderMap.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI/org/eclipse/ui/internal/PlaceholderMap.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,105 @@ >+/******************************************************************************* >+ * Copyright (c) 2000, 2004 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Common Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/cpl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ui.internal; >+ >+import java.util.ArrayList; >+import java.util.HashMap; >+import java.util.Iterator; >+import java.util.Map; >+import java.util.Set; >+ >+/** >+ * Holds a map of placeholder IDs onto ILayoutContainers. Placeholder IDs may contain >+ * the * wildcard for the primary or secondary ID. >+ * >+ * @since 3.1 >+ */ >+public class PlaceholderMap { >+ private Map map = new HashMap(5); >+ >+ public PlaceholderMap() { >+ >+ } >+ >+ public void put(String compoundId, ILayoutContainer stack) { >+ map.put(compoundId, stack); >+ } >+ >+ public ILayoutContainer get(String id) { >+ ILayoutContainer found = (ILayoutContainer)map.get(id); >+ >+ if(found != null) >+ return found; >+ >+ //there's no exact match, check for wildcard matches in order of >+ //similarity >+ >+ String secondaryId = ViewFactory.extractSecondaryId(id); >+ >+ if(secondaryId != null) { >+ id = ViewFactory.extractPrimaryId(id); >+ } >+ >+ found = (ILayoutContainer)map >+ .get(id + ViewFactory.ID_SEP + PartPlaceholder.WILD_CARD); >+ if(found != null) >+ return found; >+ >+ >+ found = (ILayoutContainer)map >+ .get(PartPlaceholder.WILD_CARD + ViewFactory.ID_SEP + secondaryId); >+ if(found != null) >+ return found; >+ >+ found = (ILayoutContainer)map >+ .get(PartPlaceholder.WILD_CARD); >+ return found; >+ } >+ >+ public String[] getPlaceholdersFor(ILayoutContainer c) { >+ ArrayList found = new ArrayList(); >+ if(map.containsValue(c)){ >+ Set keys = map.keySet(); >+ Iterator iter = keys.iterator(); >+ while (iter.hasNext()) { >+ Object key = iter.next(); >+ if(map.get(key) == c){ >+ found.add(key); >+ } >+ } >+ } >+ >+ return (String[]) found.toArray(new String[found.size()]); >+ } >+ >+ public boolean hasPlaceholderFor(ILayoutContainer c) { >+ return map.containsValue(c); >+ } >+ >+ public void remove(String placeholderId) { >+ map.remove(placeholderId); >+ } >+ >+ public void removePlaceholdersFor(ILayoutContainer c) { >+ String[] placeholders = getPlaceholdersFor(c); >+ >+ for (int i = 0; i < placeholders.length; i++) { >+ String string = placeholders[i]; >+ >+ remove(string); >+ } >+ } >+ >+ public void clear() { >+ map.clear(); >+ } >+ >+}
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 72060
: 14271 |
14272