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 47949 Details for
Bug 153957
[FastViews] Create Multiple FVB's
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]
Multi FVB patch (work in progress)
patch(MFVB).txt (text/plain), 55.25 KB, created by
Eric Moffatt
on 2006-08-15 14:29:40 EDT
(
hide
)
Description:
Multi FVB patch (work in progress)
Filename:
MIME Type:
Creator:
Eric Moffatt
Created:
2006-08-15 14:29:40 EDT
Size:
55.25 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ui.workbench >Index: Eclipse UI/org/eclipse/ui/internal/messages.properties >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/messages.properties,v >retrieving revision 1.316 >diff -u -r1.316 messages.properties >--- Eclipse UI/org/eclipse/ui/internal/messages.properties 9 Jun 2006 13:58:04 -0000 1.316 >+++ Eclipse UI/org/eclipse/ui/internal/messages.properties 15 Aug 2006 17:28:09 -0000 >@@ -564,6 +564,7 @@ > StandardSystemToolbar_Maximize = Maximize > StandardSystemToolbar_Restore = Restore > >+ViewPane_moveToTrim = &Move to Trim > ViewPane_fastView = &Fast View > ViewPane_minimizeView= Mi&nimize > ViewPane_moveView=&View >Index: Eclipse UI/org/eclipse/ui/internal/WorkbenchMessages.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchMessages.java,v >retrieving revision 1.63 >diff -u -r1.63 WorkbenchMessages.java >--- Eclipse UI/org/eclipse/ui/internal/WorkbenchMessages.java 8 Jun 2006 21:08:55 -0000 1.63 >+++ Eclipse UI/org/eclipse/ui/internal/WorkbenchMessages.java 15 Aug 2006 17:28:09 -0000 >@@ -568,6 +568,7 @@ > public static String StandardSystemToolbar_Maximize; > public static String StandardSystemToolbar_Restore; > >+ public static String ViewPane_moveToTrim; > public static String ViewPane_fastView; > public static String ViewPane_minimizeView; > public static String ViewPane_moveView; >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.18 >diff -u -r1.18 ViewStack.java >--- Eclipse UI/org/eclipse/ui/internal/ViewStack.java 8 May 2006 20:55:37 -0000 1.18 >+++ Eclipse UI/org/eclipse/ui/internal/ViewStack.java 15 Aug 2006 17:28:09 -0000 >@@ -17,6 +17,7 @@ > 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.SystemMenuMoveToTrim; > import org.eclipse.ui.internal.presentations.SystemMenuSize; > import org.eclipse.ui.internal.presentations.UpdatingActionContributionItem; > import org.eclipse.ui.presentations.AbstractPresentationFactory; >@@ -45,11 +46,14 @@ > private SystemMenuSize sizeItem = new SystemMenuSize(null); > > private SystemMenuFastView fastViewAction; >+ private SystemMenuMoveToTrim moveToTrimAction; > > private SystemMenuDetach detachViewAction; > > public void addSystemActions(IMenuManager menuManager) { > appendToGroupIfPossible(menuManager, >+ "misc", new UpdatingActionContributionItem(moveToTrimAction)); //$NON-NLS-1$ >+ appendToGroupIfPossible(menuManager, > "misc", new UpdatingActionContributionItem(fastViewAction)); //$NON-NLS-1$ > appendToGroupIfPossible(menuManager, > "misc", new UpdatingActionContributionItem(detachViewAction)); //$NON-NLS-1$ >@@ -75,6 +79,7 @@ > > this.allowStateChanges = allowsStateChanges; > fastViewAction = new SystemMenuFastView(getPresentationSite()); >+ moveToTrimAction = new SystemMenuMoveToTrim(getPresentationSite()); > detachViewAction = new SystemMenuDetach(getPresentationSite()); > } > >@@ -102,6 +107,7 @@ > } > > fastViewAction.setPane(current); >+ moveToTrimAction.setPane(current); > detachViewAction.setPane(pane); > sizeItem.setPane(pane); > } >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.71 >diff -u -r1.71 IWorkbenchConstants.java >--- Eclipse UI/org/eclipse/ui/internal/IWorkbenchConstants.java 8 May 2006 20:55:37 -0000 1.71 >+++ Eclipse UI/org/eclipse/ui/internal/IWorkbenchConstants.java 15 Aug 2006 17:28:09 -0000 >@@ -210,6 +210,10 @@ > > public static final String TAG_FAST_VIEWS = "fastViews"; //$NON-NLS-1$ > >+ public static final String TAG_GLOBAL_FAST_VIEWS = "globalFastViews"; //$NON-NLS-1$ >+ >+ public static final String TAG_FAST_GROUPS = "fastGroups"; //$NON-NLS-1$ >+ > public static final String TAG_FIXED = "fixed";//$NON-NLS-1$ > > public static final String TAG_CLOSEABLE = "closeable";//$NON-NLS-1$ >Index: Eclipse UI/org/eclipse/ui/internal/FastViewPane.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/FastViewPane.java,v >retrieving revision 1.53 >diff -u -r1.53 FastViewPane.java >--- Eclipse UI/org/eclipse/ui/internal/FastViewPane.java 8 May 2006 20:55:35 -0000 1.53 >+++ Eclipse UI/org/eclipse/ui/internal/FastViewPane.java 15 Aug 2006 17:28:09 -0000 >@@ -37,6 +37,7 @@ > import org.eclipse.ui.internal.presentations.PresentablePart; > import org.eclipse.ui.internal.presentations.SystemMenuFastView; > import org.eclipse.ui.internal.presentations.SystemMenuFastViewOrientation; >+import org.eclipse.ui.internal.presentations.SystemMenuMoveToTrim; > import org.eclipse.ui.internal.presentations.SystemMenuSizeFastView; > import org.eclipse.ui.internal.presentations.UpdatingActionContributionItem; > import org.eclipse.ui.presentations.AbstractPresentationFactory; >@@ -169,6 +170,8 @@ > appendToGroupIfPossible(menuManager, > "misc", new UpdatingActionContributionItem(fastViewAction)); //$NON-NLS-1$ > appendToGroupIfPossible(menuManager, >+ "misc", new UpdatingActionContributionItem(moveToTrimViewAction)); //$NON-NLS-1$ >+ appendToGroupIfPossible(menuManager, > "size", new SystemMenuSizeFastView(FastViewPane.this)); //$NON-NLS-1$ > } > >@@ -218,6 +221,7 @@ > }; > > private SystemMenuFastView fastViewAction = new SystemMenuFastView(site); >+ private SystemMenuMoveToTrim moveToTrimViewAction = new SystemMenuMoveToTrim(site); > > private static void appendToGroupIfPossible(IMenuManager m, String groupId, > ContributionItem item) { >@@ -392,6 +396,7 @@ > currentPane = new PresentablePart(pane, newClientComposite); > > fastViewAction.setPane(currentPane); >+ moveToTrimViewAction.setPane(currentPane); > clientComposite = newClientComposite; > > clientComposite.addListener(SWT.Resize, resizeListener); >@@ -507,6 +512,8 @@ > } > > fastViewAction.setPane(null); >+ moveToTrimViewAction.setPane(null); >+ > //unzoom before hiding > currentPane.getPane().setZoomed(false); > >Index: Eclipse UI/org/eclipse/ui/internal/TrimUtil.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/TrimUtil.java,v >retrieving revision 1.1 >diff -u -r1.1 TrimUtil.java >--- Eclipse UI/org/eclipse/ui/internal/TrimUtil.java 10 Apr 2006 20:29:43 -0000 1.1 >+++ Eclipse UI/org/eclipse/ui/internal/TrimUtil.java 15 Aug 2006 17:28:09 -0000 >@@ -41,7 +41,7 @@ > ToolBar t = new ToolBar(s, SWT.NONE); > t.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); > ToolItem ti = new ToolItem(t, SWT.PUSH); >- ti.setImage(JFaceResources.getImageRegistry().get(Dialog.DLG_IMG_HELP)); >+ ti.setImage(JFaceResources.getImageRegistry().get(Dialog.DLG_IMG_MESSAGE_INFO)); > s.layout(); > int toolItemHeight = t.computeSize(SWT.DEFAULT, SWT.DEFAULT).y; > GC gc = new GC(s); >Index: Eclipse UI/org/eclipse/ui/internal/ShowViewAction.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowViewAction.java,v >retrieving revision 1.19 >diff -u -r1.19 ShowViewAction.java >--- Eclipse UI/org/eclipse/ui/internal/ShowViewAction.java 6 Jun 2006 19:52:08 -0000 1.19 >+++ Eclipse UI/org/eclipse/ui/internal/ShowViewAction.java 15 Aug 2006 17:28:09 -0000 >@@ -68,10 +68,8 @@ > ref = (IViewReference)wp.getReference(part); > } > >- if (!wp.isFastView(ref)) { >- wp.addFastView(ref); >- } >- wp.activate(ref.getPart(true)); >+ FastViewBar bar = ((WorkbenchWindow)page.getWorkbenchWindow()).getFastViewBar(); >+ bar.adoptView(ref, -1, true, true, false); > } else { > page.showView(desc.getId()); > } >Index: Eclipse UI/org/eclipse/ui/internal/ShowFastViewContribution.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowFastViewContribution.java,v >retrieving revision 1.14 >diff -u -r1.14 ShowFastViewContribution.java >--- Eclipse UI/org/eclipse/ui/internal/ShowFastViewContribution.java 8 May 2006 20:55:36 -0000 1.14 >+++ Eclipse UI/org/eclipse/ui/internal/ShowFastViewContribution.java 15 Aug 2006 17:28:09 -0000 >@@ -10,6 +10,9 @@ > *******************************************************************************/ > package org.eclipse.ui.internal; > >+import java.util.Iterator; >+import java.util.List; >+ > import org.eclipse.jface.action.ContributionItem; > import org.eclipse.swt.SWT; > import org.eclipse.swt.events.DisposeEvent; >@@ -31,13 +34,15 @@ > public class ShowFastViewContribution extends ContributionItem { > public static final String FAST_VIEW = "FastView"; //$NON-NLS-1$ > >+ private FastViewBar fvb; > private IWorkbenchWindow window; > > /** > * Create a new menu item. > */ >- public ShowFastViewContribution(IWorkbenchWindow window) { >+ public ShowFastViewContribution(FastViewBar fvb, IWorkbenchWindow window) { > super("showFastViewContr"); //$NON-NLS-1$ >+ this.fvb = fvb; > this.window = window; > } > >@@ -49,8 +54,15 @@ > if (!Util.equals(item.getToolTipText(), ref.getTitle())) { > item.setToolTipText(ref.getTitle()); > } >+ >+ // TODO: This gets called during shutdown; hide/remove the items? >+ if (fvb.getWindow().getActiveWorkbenchPage() == null) >+ return; >+ >+ Perspective persp = fvb.getWindow().getActiveWorkbenchPage().getActivePerspective(); >+ item.setEnabled(persp.isFastView(ref)); > } >- >+ > public static ToolItem getItem(ToolBar toSearch, IWorkbenchPartReference ref) { > ToolItem[] items = toSearch.getItems(); > >@@ -77,12 +89,11 @@ > } > > // Get views. >- IViewReference[] refs = page.getFastViews(); >+ List refs = fvb.getViewRefs(); > > // Create tool item for each view. >- int size = refs.length; >- for (int nX = 0; nX < size; nX++) { >- final IViewReference ref = refs[nX]; >+ for (Iterator iterator = refs.iterator(); iterator.hasNext();) { >+ final IViewReference ref = (IViewReference) iterator.next(); > final ToolItem item = new ToolItem(parent, SWT.CHECK, index); > updateItem(item, ref); > item.setData(FAST_VIEW, ref); >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.119 >diff -u -r1.119 Perspective.java >--- Eclipse UI/org/eclipse/ui/internal/Perspective.java 21 Jun 2006 17:42:30 -0000 1.119 >+++ Eclipse UI/org/eclipse/ui/internal/Perspective.java 15 Aug 2006 17:28:09 -0000 >@@ -27,6 +27,7 @@ > import org.eclipse.jface.dialogs.MessageDialog; > import org.eclipse.jface.preference.IPreferenceStore; > import org.eclipse.osgi.util.NLS; >+import org.eclipse.swt.SWT; > import org.eclipse.swt.graphics.Rectangle; > import org.eclipse.swt.widgets.Composite; > import org.eclipse.swt.widgets.Control; >@@ -47,7 +48,10 @@ > import org.eclipse.ui.WorkbenchException; > import org.eclipse.ui.XMLMemento; > import org.eclipse.ui.internal.intro.IIntroConstants; >+import org.eclipse.ui.internal.layout.ITrimManager; >+import org.eclipse.ui.internal.layout.LayoutUtil; > import org.eclipse.ui.internal.misc.StatusUtil; >+import org.eclipse.ui.internal.presentations.PresentablePart; > import org.eclipse.ui.internal.registry.ActionSetRegistry; > import org.eclipse.ui.internal.registry.IActionSetDescriptor; > import org.eclipse.ui.internal.registry.IWorkbenchRegistryConstants; >@@ -84,6 +88,8 @@ > private ArrayList perspectiveShortcuts; > > private ArrayList fastViews; >+ private List globalFastViews; >+ private ArrayList fastViewBars; > > private Map mapIDtoViewLayoutRec; > >@@ -136,6 +142,8 @@ > alwaysOnActionSets = new ArrayList(2); > alwaysOffActionSets = new ArrayList(2); > fastViews = new ArrayList(2); >+ globalFastViews = new ArrayList(2); >+ fastViewBars = new ArrayList(2); > mapIDtoViewLayoutRec = new HashMap(); > } > >@@ -310,6 +318,71 @@ > return array; > } > >+ public void closeTrimGroup(FastViewBar groupBar) { >+ groupBar.restoreGroup(); >+ >+ WorkbenchWindow wbw = (WorkbenchWindow)page.getWorkbenchWindow(); >+ ITrimManager tbm = wbw.getTrimManager(); >+ tbm.removeTrim(groupBar); >+ >+ groupBar.dispose(); >+ } >+ >+ private String getUniqueGroupId() { >+ // Get a unique id >+ boolean found = false; >+ int count = 0; >+ String id = ""; //$NON-NLS-1$ >+ while (!found) { >+ id = getDesc().getId() + " (" + count + ")"; //$NON-NLS-1$//$NON-NLS-2$ >+ boolean matchFound = false; >+ for (Iterator fvbIter = fastViewBars.iterator(); fvbIter.hasNext();) { >+ FastViewBar fvb = (FastViewBar) fvbIter.next(); >+ if (fvb.getId().equals(id)) { >+ matchFound = true; >+ break; >+ } >+ } >+ >+ if (matchFound) >+ count++; >+ else >+ found = true; >+ } >+ >+ return id; >+ } >+ >+ public void moveToTrim(ViewStack stack) { >+ FastViewBar fvb = createFastViewBar(getUniqueGroupId(), FastViewBar.GROUP_FVB , SWT.BOTTOM); >+ >+ ArrayList refs = new ArrayList(); >+ List parts = stack.getPresentableParts(); >+ for (Iterator partIter = parts.iterator(); partIter.hasNext();) { >+ PresentablePart part = (PresentablePart) partIter.next(); >+ if (part.getPane().getPartReference() instanceof ViewReference) { >+ refs.add(part.getPane().getPartReference()); >+ } >+ } >+ fvb.setViewRefs(refs); >+ fvb.collapseGroup(); >+ } >+ >+ private FastViewBar createFastViewBar(String id, int style, int side) { >+ // Create the FVB on the given side >+ WorkbenchWindow wbw = (WorkbenchWindow)page.getWorkbenchWindow(); >+ FastViewBar newFVB = new FastViewBar(wbw, style, id); >+ newFVB.createControl(wbw.getShell()); >+ newFVB.getControl().setVisible(true); >+ ITrimManager tbm = wbw.getTrimManager(); >+ tbm.addTrim(side, newFVB); >+ >+ fastViewBars.add(newFVB); >+ LayoutUtil.resize(newFVB.getControl()); >+ >+ return newFVB; >+ } >+ > /** > * Returns the new wizard shortcuts associated with this perspective. > * >@@ -802,7 +875,23 @@ > ctrl.setEnabled(false); // Remove focus support. > } > } >- >+ >+ // update the 'global' FVB >+ FastViewBar fvb = ((WorkbenchWindow)page.getWorkbenchWindow()).getFastViewBar(); >+ fvb.setViewRefs(globalFastViews); >+ >+ // Show the trim groups >+ WorkbenchWindow wbw = (WorkbenchWindow)page.getWorkbenchWindow(); >+ ITrimManager tbm = wbw.getTrimManager(); >+ for (Iterator fvbIter = fastViewBars.iterator(); fvbIter.hasNext();) { >+ fvb = (FastViewBar) fvbIter.next(); >+ fvb.update(false); >+ tbm.setTrimVisible(fvb, true); >+ } >+ >+ // if we're done then force an update...optimize out if possible >+ LayoutUtil.resize(fvb.getControl()); >+ > setAllPinsVisible(true); > presentation.activate(getClientComposite()); > >@@ -822,6 +911,10 @@ > setActiveFastView(null); > setAllPinsVisible(false); > >+ // remember the list of 'global' fast views >+ WorkbenchWindow wbw = (WorkbenchWindow)page.getWorkbenchWindow(); >+ globalFastViews = new ArrayList(wbw.getFastViewBar().getViewRefs()); >+ > // Update fast views. > for (int i = 0; i < fastViews.size(); i++) { > ViewPane pane = getPane((IViewReference) fastViews.get(i)); >@@ -832,6 +925,13 @@ > } > } > } >+ >+ // Hide the trim groups >+ ITrimManager tbm = wbw.getTrimManager(); >+ for (Iterator fvbIter = fastViewBars.iterator(); fvbIter.hasNext();) { >+ FastViewBar fvb = (FastViewBar) fvbIter.next(); >+ tbm.setTrimVisible(fvb, false); >+ } > } > > /** >@@ -902,11 +1002,13 @@ > IMemento views[] = memento.getChildren(IWorkbenchConstants.TAG_VIEW); > result.merge(createReferences(views)); > >+ // Restore the list of fast views > memento = memento.getChild(IWorkbenchConstants.TAG_FAST_VIEWS); > if (memento != null) { > views = memento.getChildren(IWorkbenchConstants.TAG_VIEW); > result.merge(createReferences(views)); > } >+ > return result; > } > >@@ -1106,6 +1208,54 @@ > } > } > >+ // Restore the list of 'global' fast views >+ globalFastViews = new ArrayList(); >+ IMemento globalFastViewsMem = memento.getChild(IWorkbenchConstants.TAG_GLOBAL_FAST_VIEWS); >+ if (globalFastViewsMem != null) { >+ IMemento[] globalRefs = globalFastViewsMem.getChildren(IWorkbenchConstants.TAG_VIEW); >+ for (int i = 0; i < globalRefs.length; i++) { >+ String viewId = globalRefs[i].getID(); >+ String secondaryId = ViewFactory.extractSecondaryId(viewId); >+ if (secondaryId != null) { >+ viewId = ViewFactory.extractPrimaryId(viewId); >+ } >+ >+ // Resolve the ref >+ IViewReference ref = viewFactory.getView(viewId, secondaryId); >+ globalFastViews.add(ref); >+ } >+ } >+ else { >+ // Old format, all fast views are 'global' >+ globalFastViews = new ArrayList(fastViews); >+ } >+ >+ // Restore the trim groups >+ IMemento groupsMem = memento.getChild(IWorkbenchConstants.TAG_FAST_GROUPS); >+ IMemento[] group = groupsMem.getChildren(IWorkbenchConstants.TAG_FAST_VIEW_DATA); >+ for (int i = 0; i < group.length; i++) { >+ String id = group[i].getString(IWorkbenchConstants.TAG_ID); >+ FastViewBar fvb = createFastViewBar(id, FastViewBar.GROUP_FVB, SWT.BOTTOM); >+ fvb.restoreState(group[i]); >+ >+ IMemento viewsMem = group[i].getChild(IWorkbenchConstants.TAG_VIEWS); >+ IMemento[] fvMems = viewsMem.getChildren(IWorkbenchConstants.TAG_VIEW); >+ ArrayList viewRefs = new ArrayList(fvMems.length); >+ for (int j = 0; j < fvMems.length; j++) { >+ String viewId = fvMems[j].getID(); >+ String secondaryId = ViewFactory.extractSecondaryId(viewId); >+ if (secondaryId != null) { >+ viewId = ViewFactory.extractPrimaryId(viewId); >+ } >+ >+ // Resolve the ref >+ IViewReference ref = viewFactory.getView(viewId, secondaryId); >+ viewRefs.add(ref); >+ } >+ >+ fvb.setViewRefs(viewRefs); >+ } >+ > HashSet knownActionSetIds = new HashSet(); > > // Load the always on action sets. >@@ -1403,6 +1553,7 @@ > .getKey(ref)); > } > >+ // Save the set of all fast Views > if (fastViews.size() > 0) { > IMemento childMem = memento > .createChild(IWorkbenchConstants.TAG_FAST_VIEWS); >@@ -1418,6 +1569,20 @@ > } > } > >+ // Save the set of all 'global' fast Views for this perspective >+ // update the list of 'global' fast views >+ WorkbenchWindow wbw = (WorkbenchWindow)page.getWorkbenchWindow(); >+ globalFastViews = new ArrayList(wbw.getFastViewBar().getViewRefs()); >+ >+ IMemento globalFVBMem = memento >+ .createChild(IWorkbenchConstants.TAG_GLOBAL_FAST_VIEWS); >+ itr = globalFastViews.iterator(); >+ while (itr.hasNext()) { >+ IViewReference ref = (IViewReference) itr.next(); >+ String id = ViewFactory.getKey(ref); >+ globalFVBMem.createChild(IWorkbenchConstants.TAG_VIEW, id); >+ } >+ > // Save the view layout recs. > for (Iterator i = mapIDtoViewLayoutRec.keySet().iterator(); i.hasNext();) { > String compoundId = (String) i.next(); >@@ -1445,6 +1610,24 @@ > } > } > >+ // Save the list of group FVB's >+ IMemento fvbMem = memento.createChild(IWorkbenchConstants.TAG_FAST_GROUPS); >+ for (Iterator fvbIter = fastViewBars.iterator(); fvbIter.hasNext();) { >+ FastViewBar fvb = (FastViewBar) fvbIter.next(); >+ IMemento fastViewBarMem = fvbMem.createChild(IWorkbenchConstants.TAG_FAST_VIEW_DATA); >+ fastViewBarMem.putString(IWorkbenchConstants.TAG_ID, fvb.getId()); >+ fvb.saveState(fastViewBarMem); >+ >+ // Store the view references for this FVB >+ List viewRefs = fvb.getViewRefs(); >+ IMemento viewsMem = fastViewBarMem.createChild(IWorkbenchConstants.TAG_VIEWS); >+ for (Iterator fvIter = viewRefs.iterator(); fvIter.hasNext();) { >+ IViewReference ref = (IViewReference) fvIter.next(); >+ String id = ViewFactory.getKey(ref); >+ viewsMem.createChild(IWorkbenchConstants.TAG_VIEW, id); >+ } >+ } >+ > if (errors > 0) { > String message = WorkbenchMessages.Perspective_multipleErrors; > if (errors == 1) { >@@ -1676,8 +1859,8 @@ > int openViewMode = store.getInt(IPreferenceConstants.OPEN_VIEW_MODE); > > if (openViewMode == IPreferenceConstants.OVM_FAST) { >- showFastView(ref); >- addFastView(ref); >+ FastViewBar fvb = ((WorkbenchWindow)pane.getWorkbenchWindow()).getFastViewBar(); >+ fvb.adoptView(ref, -1, true, true, false); > } else if (openViewMode == IPreferenceConstants.OVM_FLOAT > && presentation.canDetach()) { > presentation.addDetachedPart(pane); >Index: Eclipse UI/org/eclipse/ui/internal/FastViewBarContextMenuContribution.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/FastViewBarContextMenuContribution.java,v >retrieving revision 1.6 >diff -u -r1.6 FastViewBarContextMenuContribution.java >--- Eclipse UI/org/eclipse/ui/internal/FastViewBarContextMenuContribution.java 8 May 2006 20:55:37 -0000 1.6 >+++ Eclipse UI/org/eclipse/ui/internal/FastViewBarContextMenuContribution.java 15 Aug 2006 17:28:09 -0000 >@@ -66,7 +66,7 @@ > restoreItem.setText(WorkbenchMessages.ViewPane_fastView); > restoreItem.addSelectionListener(new SelectionAdapter() { > public void widgetSelected(SelectionEvent e) { >- bar.restoreView(selectedView); >+ bar.restoreView(selectedView, true, true); > } > }); > >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.49 >diff -u -r1.49 FastViewBar.java >--- Eclipse UI/org/eclipse/ui/internal/FastViewBar.java 8 May 2006 20:55:34 -0000 1.49 >+++ Eclipse UI/org/eclipse/ui/internal/FastViewBar.java 15 Aug 2006 17:28:09 -0000 >@@ -76,21 +76,36 @@ > > private WorkbenchWindow window; > private IViewReference selection; >+ private List viewRefs = new ArrayList(); > > // "New Fast View" 'Button' fields > private MenuManager newFastViewMenuMgr; > private Composite fvbComposite; > private ToolBar menuTB; >- private ToolItem menuItem; >+ private ToolItem showItem = null; >+ private ToolItem groupItem = null; >+ private FastGroupTrimButton groupBtn = null; > private CellData toolBarData; > >+ /** Causes the FVB to remove the ref for any view restored to the workbench */ >+ public static final int REMOVE_UNFAST_REFS = 0x0001; >+ /** Causes the FVB to show the 'group mode' button set */ >+ public static final int SHOW_GROUP_BUTTON = 0x0002; >+ /** Causes the FVB to show the 'Add View' popup button */ >+ public static final int SHOW_ADD_BUTTON = 0x0004; >+ >+ public static final int LEGACY_FVB = REMOVE_UNFAST_REFS | SHOW_ADD_BUTTON; >+ public static final int GROUP_FVB = SHOW_GROUP_BUTTON; >+ >+ private boolean testStyleBit(int toTest) { return (style & toTest) != 0; } >+ private int style = LEGACY_FVB; >+ > private static final int HIDDEN_WIDTH = 5; > >- > private int oldLength = 0; > >+ // Dnd > private ViewDropTarget dropTarget; >- > private Listener dragListener = new Listener() { > public void handleEvent(Event event) { > Point position = DragUtil.getEventLoc(event); >@@ -126,6 +141,9 @@ > } > }; > private int fCurrentSide = SWT.DEFAULT; >+ >+ private static final String GLOBAL_FVB_ID ="org.eclise.ui.internal.FastViewBar"; //$NON-NLS-1$ >+ private String id = GLOBAL_FVB_ID; > > class ViewDropTarget extends AbstractDropTarget { > List panes; >@@ -148,14 +166,15 @@ > * @see org.eclipse.ui.internal.dnd.IDropTarget#drop() > */ > public void drop() { >- IViewReference view = getViewFor(position); >+ IViewReference beforeRef = getViewFor(position); > > Iterator iter = panes.iterator(); > while (iter.hasNext()) { > ViewPane pane = (ViewPane) iter.next(); >- getPage().addFastView(pane.getViewReference()); >- getPage().getActivePerspective().moveFastView( >- pane.getViewReference(), view); >+ IViewReference ref = pane.getViewReference(); >+ int insertIdx = viewRefs.indexOf(beforeRef); >+ System.out.println("Drop: ref = " + ref.getId() + "insert Index = " + insertIdx); //$NON-NLS-1$ //$NON-NLS-2$ >+ adoptView(ref, insertIdx, true, false, !iter.hasNext()); > } > update(true); > } >@@ -199,67 +218,22 @@ > > public void perspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective, IWorkbenchPartReference partRef, String changeId) { > if (page != null && page == window.getActivePage() && page.getPerspective() == perspective) { >- >- ToolBar bar = fastViewBar.getControl(); >- > // Handle removals immediately just in case the part (and its image) is about to be disposed >- if (changeId.equals(IWorkbenchPage.CHANGE_VIEW_HIDE) >- || changeId.equals(IWorkbenchPage.CHANGE_FAST_VIEW_REMOVE)) { >- >- ToolItem item = null; >- >- if (bar != null) { >- item = ShowFastViewContribution.getItem(bar, partRef); >- } >- >- if (item != null) { >- item.dispose(); >- updateLayoutData(); >- return; >- } >- } >- >- // Ignore changes to non-fastviews >- if (page instanceof WorkbenchPage && partRef instanceof IViewReference) { >- if (!((WorkbenchPage)page).isFastView((IViewReference)partRef)) { >- return; >- } >+ if (changeId.equals(IWorkbenchPage.CHANGE_VIEW_HIDE)) { >+ removeViewRef((IViewReference) partRef); >+ return; > } > >- if (changeId.equals(IWorkbenchPage.CHANGE_VIEW_SHOW) >- || changeId.equals(IWorkbenchPage.CHANGE_FAST_VIEW_ADD)) { >- >- ToolItem item = null; >- >- if (bar != null) { >- item = ShowFastViewContribution.getItem(bar, partRef); >- } >- >- if (item != null) { >- // If this part is already in the fast view bar, there is nothing to do >- return; >- } >- fastViewBar.markDirty(); >+ // If a view becomes 'unfast' we might want to remove it >+ if (changeId.equals(IWorkbenchPage.CHANGE_FAST_VIEW_REMOVE)) { >+ if ((style & REMOVE_UNFAST_REFS) != 0) >+ removeViewRef((IViewReference) partRef); >+ return; > } > } > } > > public void perspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective, String changeId) { >- if (changeId.equals(IWorkbenchPage.CHANGE_VIEW_HIDE) >- || changeId.equals(IWorkbenchPage.CHANGE_FAST_VIEW_REMOVE)) { >- >- // In these cases, we've aleady updated the fast view bar in the pre-change >- // listener >- return; >- } >- >- // Ignore changes to anything but the active perspective >- if (page != null && page == window.getActivePage() && page.getPerspective() == perspective) { >- if (changeId.equals(IWorkbenchPage.CHANGE_VIEW_SHOW) >- || changeId.equals(IWorkbenchPage.CHANGE_FAST_VIEW_ADD)) { >- update(false); >- } >- } > } > }); > >@@ -280,6 +254,19 @@ > } > > /** >+ * Special constructor that sets the ID >+ * >+ * @param wbw The Workbench window >+ * @param style The style of FVB desired >+ * @param id The trim id >+ */ >+ public FastViewBar(WorkbenchWindow wbw, int style, String id) { >+ this(wbw); >+ this.style = style; >+ this.id = id; >+ } >+ >+ /** > * Returns the platform's idea of where the fast view bar should be docked in a fresh > * workspace. This value is meaningless after a workspace has been setup, since the > * fast view bar state is then persisted in the workbench. This preference is just >@@ -417,37 +404,52 @@ > // Create a toolbar to show an 'Add FastView' menu 'button' > menuTB = new ToolBar(fvbComposite, SWT.FLAT | orientation); > >- // Construct an item to act as a 'menu button' (a la the PerspectiveSwitcher) >- menuItem = new ToolItem(menuTB, SWT.PUSH, 0); >+ if (testStyleBit(SHOW_ADD_BUTTON)) { >+ // Construct an item to act as a 'menu button' (a la the PerspectiveSwitcher) >+ showItem = new ToolItem(menuTB, SWT.PUSH, 0); >+ >+ Image tbImage = WorkbenchImages.getImage(IWorkbenchGraphicConstants.IMG_ETOOL_NEW_FASTVIEW); >+ showItem.setImage(tbImage); >+ >+ String menuTip = WorkbenchMessages.FastViewBar_0; >+ showItem.setToolTipText(menuTip); >+ >+ // Bring up the 'Add Fast View' menu on a left -or- right button click >+ // Right click (context menu) >+ showItem.addListener(SWT.MenuDetect, addMenuListener); >+ >+ // Left Click... >+ showItem.addSelectionListener(new SelectionListener() { >+ public void widgetSelected(SelectionEvent e) { >+ Rectangle bb = DragUtil.getDisplayBounds(menuTB); >+ showAddFastViewPopup(new Point(bb.x,bb.y+bb.height)); >+ } >+ >+ public void widgetDefaultSelected(SelectionEvent e) { >+ } >+ >+ }); >+ } > >- Image tbImage = WorkbenchImages.getImage(IWorkbenchGraphicConstants.IMG_ETOOL_NEW_FASTVIEW); >- menuItem.setImage(tbImage); >+ if (testStyleBit(SHOW_GROUP_BUTTON)) { >+ groupBtn = new FastGroupTrimButton(menuTB, this); >+ groupBtn.setSize(20); >+ groupItem = new ToolItem(menuTB, SWT.SEPARATOR, 0); >+ groupItem.setControl(groupBtn.getControl()); >+ groupItem.setWidth(20); >+ >+ } > >- String menuTip = WorkbenchMessages.FastViewBar_0; >- menuItem.setToolTipText(menuTip); > //new ToolItem(menuTB, SWT.SEPARATOR, 1); >- >+ > // Now that the ToolBar is populated calculate its size... > Point size = menuTB.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); > menuTB.setBounds(0, 0, size.x, size.y); > > // Bring up the 'Add Fast View' menu on a left -or- right button click > // Right click (context menu) >- menuItem.addListener(SWT.MenuDetect, addMenuListener); > menuTB.addListener(SWT.MenuDetect, addMenuListener); > >- // Left Click... >- menuItem.addSelectionListener(new SelectionListener() { >- public void widgetSelected(SelectionEvent e) { >- Rectangle bb = DragUtil.getDisplayBounds(menuTB); >- showAddFastViewPopup(new Point(bb.x,bb.y+bb.height)); >- } >- >- public void widgetDefaultSelected(SelectionEvent e) { >- } >- >- }); >- > // try to get the layout correct... > toolBarData = new CellData(); > toolBarData.align(SWT.FILL, SWT.FILL); >@@ -455,7 +457,7 @@ > > // Construct the ToolBar containing the 'Fast' views > fastViewBar = new ToolBarManager(SWT.FLAT | SWT.WRAP | orientation); >- fastViewBar.add(new ShowFastViewContribution(window)); >+ fastViewBar.add(new ShowFastViewContribution(this, window)); > > fastViewBar.createControl(fvbComposite); > >@@ -678,7 +680,16 @@ > fastViewBar.dispose(); > fastViewBar = null; > >- menuItem.dispose(); >+ if (showItem != null) { >+ showItem.dispose(); >+ showItem = null; >+ } >+ >+ if (groupItem != null) { >+ groupItem.dispose(); >+ groupItem = null; >+ } >+ > menuTB.dispose(); > > oldLength = 0; >@@ -859,7 +870,6 @@ > orientation.putInteger(IWorkbenchConstants.TAG_POSITION, > ((Integer) viewOrientation.get(next)).intValue()); > } >- > } > > /** >@@ -908,7 +918,45 @@ > return window; > } > >- public void restoreView(IViewReference selectedView) { >+ public void adoptView(IViewReference ref, int insertIndex, boolean makeFast, boolean activate, boolean animate) { >+ if (ref != null) { >+ WorkbenchPage page = window.getActiveWorkbenchPage(); >+ if (page != null) { >+ // Remember the pane -before- we adopt the view for animations >+ ViewPane pane = (ViewPane) ((WorkbenchPartReference) ref) >+ .getPane(); >+ >+ if (makeFast) >+ page.addFastView(ref); >+ >+ // we -must- have a ref since we're adopting the view >+ if (!viewRefs.contains(ref)) >+ addViewRef(ref, insertIndex, true); >+ >+ if (activate) { >+ IWorkbenchPart toActivate = ref.getPart(true); >+ if (toActivate != null) { >+ page.activate(toActivate); >+ } >+ } >+ >+ if (animate && pane != null) { >+ int idx = getIndex(ref); >+ ToolItem item = getItem(idx); >+ Rectangle bounds = item.getBounds(); >+ Rectangle endBounds = Geometry.toDisplay(item >+ .getParent(), bounds); >+ >+ RectangleAnimation animation = new RectangleAnimation( >+ window.getShell(), pane.getParentBounds(), endBounds); >+ >+ animation.schedule(); >+ } >+ } >+ } >+ } >+ >+ public void restoreView(IViewReference selectedView, boolean activate, boolean animate) { > if (selectedView != null) { > WorkbenchPage page = window.getActiveWorkbenchPage(); > if (page != null) { >@@ -919,21 +967,25 @@ > .getParent(), bounds); > > page.removeFastView(selectedView); >- >- IWorkbenchPart toActivate = selectedView >- .getPart(true); >- if (toActivate != null) { >- page.activate(toActivate); >+ >+ if (activate) { >+ IWorkbenchPart toActivate = selectedView >+ .getPart(true); >+ if (toActivate != null) { >+ page.activate(toActivate); >+ } > } > > ViewPane pane = (ViewPane) ((WorkbenchPartReference) selectedView) > .getPane(); > >- RectangleAnimation animation = new RectangleAnimation( >- window.getShell(), startBounds, pane >- .getParentBounds()); >- >- animation.schedule(); >+ if (animate) { >+ RectangleAnimation animation = new RectangleAnimation( >+ window.getShell(), startBounds, pane >+ .getParentBounds()); >+ >+ animation.schedule(); >+ } > } > } > } >@@ -956,7 +1008,7 @@ > * @see org.eclipse.ui.internal.IWindowTrim#getId() > */ > public String getId() { >- return "org.eclise.ui.internal.FastViewBar"; //$NON-NLS-1$ >+ return id; > } > > /* (non-Javadoc) >@@ -997,4 +1049,128 @@ > public boolean isResizeable() { > return false; > } >+ >+ /** >+ * @return Returns the viewRefs. >+ */ >+ public List getViewRefs() { >+ return viewRefs; >+ } >+ >+ /** >+ * @param viewRefs The viewRefs to set. >+ */ >+ public void setViewRefs(List viewRefs) { >+ this.viewRefs = new ArrayList(viewRefs); >+ fastViewBar.markDirty(); >+ update(true); >+ } >+ >+ /** >+ * Add a new view reference into the list >+ * @param ref The reference to add >+ * @param insertIndex The index to insert it at >+ * @param update >+ */ >+ public void addViewRef(IViewReference ref, int insertIndex, boolean update) { >+ if (ref == null) >+ return; >+ >+ viewRefs.remove(ref); >+ if (insertIndex < 0 || insertIndex >= viewRefs.size()) >+ viewRefs.add(ref); >+ else >+ viewRefs.add(insertIndex, ref); >+ >+ if (update) { >+ fastViewBar.markDirty(); >+ update(true); >+ } >+ } >+ >+ /** >+ * Remove a reference from the list >+ * @param ref The view reference to remove >+ */ >+ public void removeViewRef(IViewReference ref) { >+ if (ref == null) >+ return; >+ >+ viewRefs.remove(ref); >+ >+ // Remove the ToolItem associated with the reference >+ ToolItem item = ShowFastViewContribution.getItem(fastViewBar.getControl(), ref); >+ if (item != null) { >+ item.dispose(); >+ updateLayoutData(); >+ update(true); >+ } >+ } >+ >+ /** >+ * Restore all refs and close the group >+ */ >+ public void closeGroup() { >+ Perspective persp = window.getActiveWorkbenchPage().getActivePerspective(); >+ persp.closeTrimGroup(this); >+ } >+ >+ /** >+ * Move all referenced views to the trim (ie. make >+ * them fast views...) >+ */ >+ public void collapseGroup() { >+ for (Iterator refIter = viewRefs.iterator(); refIter.hasNext();) { >+ IViewReference ref = (IViewReference) refIter.next(); >+ adoptView(ref, -1, true, false, !refIter.hasNext()); >+ } >+ >+ update(false); >+ } >+ >+ /** >+ * Restore all referenced views to the layout >+ */ >+ public void restoreGroup() { >+ for (Iterator refIter = viewRefs.iterator(); refIter.hasNext();) { >+ IViewReference ref = (IViewReference) refIter.next(); >+ restoreView(ref, false, !refIter.hasNext()); >+ } >+ >+ update(false); >+ } >+ >+ /** >+ * @param fvbMem >+ */ >+ public void saveViewRefs(IMemento memento) { >+ IMemento viewsMem = memento.createChild(IWorkbenchConstants.TAG_VIEWS); >+ for (Iterator fvIter = viewRefs.iterator(); fvIter.hasNext();) { >+ IViewReference ref = (IViewReference) fvIter.next(); >+ String id = ViewFactory.getKey(ref); >+ viewsMem.createChild(IWorkbenchConstants.TAG_VIEW, id); >+ } >+ } >+ >+ /** >+ * Restore the list of view references for this FVB >+ * >+ * @param fvbMem he IMemento to store the info in >+ */ >+ public void restoreViewRefs(IMemento memento) { >+ IMemento viewsMem = memento.getChild(IWorkbenchConstants.TAG_VIEWS); >+ IMemento[] fvMems = viewsMem.getChildren(IWorkbenchConstants.TAG_VIEW); >+ for (int i = 0; i < fvMems.length; i++) { >+ String viewId = fvMems[i].getID(); >+ String secondaryId = ViewFactory.extractSecondaryId(viewId); >+ if (secondaryId != null) { >+ viewId = ViewFactory.extractPrimaryId(viewId); >+ } >+ >+ // Resolve the ref >+ IViewReference ref = window.getActiveWorkbenchPage().getViewFactory().getView(viewId, secondaryId); >+ viewRefs.add(ref); >+ } >+ } > } >+ >Index: Eclipse UI/org/eclipse/ui/internal/presentations/SystemMenuFastView.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/presentations/SystemMenuFastView.java,v >retrieving revision 1.8 >diff -u -r1.8 SystemMenuFastView.java >--- Eclipse UI/org/eclipse/ui/internal/presentations/SystemMenuFastView.java 11 Jul 2005 23:14:35 -0000 1.8 >+++ Eclipse UI/org/eclipse/ui/internal/presentations/SystemMenuFastView.java 15 Aug 2006 17:28:09 -0000 >@@ -62,31 +62,30 @@ > return viewRef; > } > >+ private WorkbenchWindow getWorkbenchWindow() { >+ return (WorkbenchWindow) viewPane.getPane().getPage().getWorkbenchWindow(); >+ } >+ > public boolean shouldBeVisible() { > if (viewPane == null || viewPane.getPane().getPage() == null) { > return false; > } > >- WorkbenchWindow workbenchWindow = (WorkbenchWindow) viewPane.getPane().getPage() >- .getWorkbenchWindow(); >- >- return workbenchWindow.getShowFastViewBars() && viewPane != null >+ return getWorkbenchWindow().getShowFastViewBars() && viewPane != null > && site.isPartMoveable(viewPane); > } >- >+ > public void dispose() { > viewPane = null; > } > > public void run() { > if (viewPane.getPane() instanceof ViewPane) { >- ViewPane pane = (ViewPane) viewPane.getPane(); >- > if (!isChecked()) { >- pane.doMakeFast(); >+ getWorkbenchWindow().getFastViewBar().adoptView(getReference(), -1, true, false, true); > } else { >- pane.doRemoveFast(); >- } >+ getWorkbenchWindow().getFastViewBar().restoreView(getReference(), true, true); >+ } > } > } > } >Index: Eclipse UI/org/eclipse/ui/internal/presentations/SystemMenuMoveToTrim.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/ui/internal/presentations/SystemMenuMoveToTrim.java >diff -N Eclipse UI/org/eclipse/ui/internal/presentations/SystemMenuMoveToTrim.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI/org/eclipse/ui/internal/presentations/SystemMenuMoveToTrim.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,93 @@ >+/******************************************************************************* >+ * Copyright (c) 2006 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ui.internal.presentations; >+ >+import org.eclipse.jface.action.Action; >+import org.eclipse.ui.IViewReference; >+import org.eclipse.ui.IWorkbenchPartReference; >+import org.eclipse.ui.internal.Perspective; >+import org.eclipse.ui.internal.ViewStack; >+import org.eclipse.ui.internal.WorkbenchMessages; >+import org.eclipse.ui.internal.WorkbenchWindow; >+import org.eclipse.ui.presentations.IStackPresentationSite; >+ >+/** >+ * mplements the 'Move to Trim' action >+ * >+ * @since 3.2 >+ * >+ */ >+public class SystemMenuMoveToTrim extends Action implements ISelfUpdatingAction { >+ >+ private PresentablePart viewPane; >+ >+ private IStackPresentationSite site; >+ >+ public SystemMenuMoveToTrim(IStackPresentationSite site) { >+ this.site = site; >+ setText(WorkbenchMessages.ViewPane_moveToTrim); >+ update(); >+ } >+ >+ public void setPane(PresentablePart newPane) { >+ viewPane = newPane; >+ update(); >+ } >+ >+ public void update() { >+ IViewReference viewRef = getReference(); >+ >+ if (viewRef == null >+ || !site.isPartMoveable(viewPane)) { >+ setEnabled(false); >+ } else { >+ setEnabled(true); >+ >+ setChecked(viewPane.getPane().getPage().getActivePerspective().isFastView( >+ viewRef)); >+ } >+ } >+ >+ private IViewReference getReference() { >+ IViewReference viewRef = null; >+ >+ if (viewPane != null) { >+ IWorkbenchPartReference ref = viewPane.getPane().getPartReference(); >+ >+ if (ref instanceof IViewReference) { >+ viewRef = (IViewReference) ref; >+ } >+ } >+ return viewRef; >+ } >+ >+ private WorkbenchWindow getWorkbenchWindow() { >+ return (WorkbenchWindow) viewPane.getPane().getPage().getWorkbenchWindow(); >+ } >+ >+ public boolean shouldBeVisible() { >+ if (viewPane == null || viewPane.getPane().getPage() == null) { >+ return false; >+ } >+ >+ return getWorkbenchWindow().getShowFastViewBars() && viewPane != null >+ && site.isPartMoveable(viewPane); >+ } >+ >+ public void dispose() { >+ viewPane = null; >+ } >+ >+ public void run() { >+ Perspective psp = viewPane.getPane().getPage().getActivePerspective(); >+ psp.moveToTrim((ViewStack) viewPane.getPane().getStack()); >+ } >+} >Index: Eclipse UI/org/eclipse/ui/internal/FastGroupTrimButton.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/ui/internal/FastGroupTrimButton.java >diff -N Eclipse UI/org/eclipse/ui/internal/FastGroupTrimButton.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI/org/eclipse/ui/internal/FastGroupTrimButton.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,263 @@ >+/******************************************************************************* >+ * Copyright (c) 2004, 2006 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ui.internal; >+ >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.events.MouseEvent; >+import org.eclipse.swt.events.MouseListener; >+import org.eclipse.swt.events.MouseMoveListener; >+import org.eclipse.swt.events.MouseTrackListener; >+import org.eclipse.swt.events.PaintEvent; >+import org.eclipse.swt.events.PaintListener; >+import org.eclipse.swt.graphics.Color; >+import org.eclipse.swt.graphics.GC; >+import org.eclipse.swt.graphics.Rectangle; >+import org.eclipse.swt.widgets.Canvas; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Control; >+ >+public class FastGroupTrimButton { >+ private Canvas button; >+ private FastViewBar fvb; >+ private int side; >+ private Color btnColor; >+ >+ private Rectangle closeRect; >+ private Rectangle restoreRect; >+ private Rectangle collapseRect; >+ >+ private static final int CTRL_AREA_NONE = 0; >+ private static final int CTRL_AREA_CLOSE = 1; >+ private static final int CTRL_AREA_RESTORE = 2; >+ private static final int CTRL_AREA_COLLAPSE = 3; >+ >+ private int curCtrlArea = CTRL_AREA_NONE; >+ private boolean inControl = false; >+ private String toolTip; >+ >+ public FastGroupTrimButton(Composite parent, FastViewBar fvb) { >+ this.fvb = fvb; >+ >+ if (fvb != null) >+ side = fvb.getSide(); >+ else >+ side = SWT.BOTTOM; >+ >+ btnColor = parent.getDisplay().getSystemColor(SWT.COLOR_BLACK); >+ >+ button = new Canvas(parent, SWT.NONE); >+ button.addPaintListener(new PaintListener() { >+ public void paintControl(PaintEvent e) { >+ e.gc.setForeground(btnColor); >+ paintButtons(e); >+ } >+ }); >+ >+ button.addMouseTrackListener(new MouseTrackListener() { >+ public void mouseEnter(MouseEvent e) { >+ inControl = true; >+ // Provide 'track' feedback? >+ } >+ public void mouseExit(MouseEvent e) { >+ inControl = false; >+ // remove 'track' feedback? >+ } >+ public void mouseHover(MouseEvent e) { >+ button.setToolTipText(toolTip); >+ } >+ }); >+ >+ button.addMouseMoveListener(new MouseMoveListener() { >+ public void mouseMove(MouseEvent e) { >+ if (closeRect.contains(e.x,e.y)) { >+ curCtrlArea = CTRL_AREA_CLOSE; >+ toolTip = "Close Group"; //$NON-NLS-1$ >+ } >+ else if (restoreRect.contains(e.x,e.y)) { >+ curCtrlArea = CTRL_AREA_RESTORE; >+ toolTip = "Restore Group"; //$NON-NLS-1$ >+ } >+ else if (collapseRect.contains(e.x,e.y)) { >+ curCtrlArea = CTRL_AREA_COLLAPSE; >+ toolTip = "Collapse Group"; //$NON-NLS-1$ >+ } >+ else >+ curCtrlArea = CTRL_AREA_NONE; >+ } >+ }); >+ button.addMouseListener(new MouseListener() { >+ public void mouseDoubleClick(MouseEvent e) {} >+ public void mouseUp(MouseEvent e) {} >+ public void mouseDown(MouseEvent e) { >+ if (inControl && curCtrlArea != CTRL_AREA_NONE) { >+ switch (curCtrlArea) { >+ case CTRL_AREA_CLOSE: >+ FastGroupTrimButton.this.fvb.closeGroup(); >+ break; >+ case CTRL_AREA_COLLAPSE: >+ FastGroupTrimButton.this.fvb.collapseGroup(); >+ break; >+ case CTRL_AREA_RESTORE: >+ FastGroupTrimButton.this.fvb.restoreGroup(); >+ break; >+ } >+ } >+ } >+ }); >+ } >+ >+ public void setSize(int size) { >+ button.setSize(size, size); >+ } >+ >+ protected void paintButtons(PaintEvent e) { >+ Rectangle bb = button.getBounds(); >+ setButtonRects(bb); >+ >+ paintClose(e.gc); >+ paintRestore(e.gc); >+ paintCollapse(e.gc); >+ } >+ >+ private void paintCollapse(GC gc) { >+ switch(side) { >+ case SWT.BOTTOM: >+ drawDownArrow(gc, collapseRect); >+ break; >+ case SWT.TOP: >+ drawUpArrow(gc, collapseRect); >+ break; >+ case SWT.LEFT: >+ drawLeftArrow(gc, collapseRect); >+ break; >+ case SWT.RIGHT: >+ drawRightArrow(gc, collapseRect); >+ break; >+ } >+ } >+ >+ private void paintRestore(GC gc) { >+ switch(side) { >+ case SWT.BOTTOM: >+ drawUpArrow(gc, restoreRect); >+ break; >+ case SWT.TOP: >+ drawDownArrow(gc, restoreRect); >+ break; >+ case SWT.LEFT: >+ drawRightArrow(gc, restoreRect); >+ break; >+ case SWT.RIGHT: >+ drawLeftArrow(gc, restoreRect); >+ break; >+ } >+ } >+ >+ private void paintClose(GC gc) { >+ int border = 2; >+ gc.drawLine(closeRect.x+border, closeRect.y+border, (closeRect.x+closeRect.width)-border, (closeRect.y+closeRect.height)-border); >+ gc.drawLine((closeRect.x+closeRect.width)-border, closeRect.y+border, closeRect.x+border, (closeRect.y+closeRect.height)-border); >+// int minX = closeRect.x + 2; >+// int maxX = (closeRect.x+closeRect.width) - 2; >+// int stopMax = maxX; >+// int y = (closeRect.y + (closeRect.height)/2) - ((maxX-minX)/2); >+// >+// while (minX <= stopMax) { >+// gc.drawLine(minX, y, minX, y); >+// gc.drawLine(maxX, y, maxX, y); >+// minX++; maxX--; y++; >+// } >+ } >+ >+ private void drawDownArrow(GC gc, Rectangle rect) { >+ int y = rect.y + 1; >+ int minX = rect.x + 2; >+ int maxX = (rect.x+rect.width) - 2; >+ >+ while (minX <= maxX) { >+ gc.drawLine(minX, y, maxX, y); >+ y++; >+ gc.drawLine(minX, y, maxX, y); >+ minX++; maxX--; y++; >+ } >+ } >+ >+ private void drawRightArrow(GC gc, Rectangle rect) { >+ int x = rect.x + 1; >+ int minY = rect.y + 2; >+ int maxY = (rect.y+rect.height) - 2; >+ >+ while (minY <= maxY) { >+ gc.drawLine(x, minY, x, maxY); >+ x++; >+ gc.drawLine(x, minY, x, maxY); >+ minY++; maxY--; x++; >+ } >+ } >+ >+ private void drawUpArrow(GC gc, Rectangle rect) { >+ int y = (rect.y+rect.height) - 1; >+ int minX = rect.x + 2; >+ int maxX = (rect.x+rect.width) - 2; >+ >+ while (minX <= maxX) { >+ gc.drawLine(minX, y, maxX, y); >+ y--; >+ gc.drawLine(minX, y, maxX, y); >+ minX++; maxX--; y--; >+ } >+ } >+ >+ private void drawLeftArrow(GC gc, Rectangle rect) { >+ int x = (rect.x+rect.width) - 1; >+ int minY = rect.y + 2; >+ int maxY = (rect.y+rect.height) - 2; >+ >+ while (minY <= maxY) { >+ gc.drawLine(x, minY, x, maxY); >+ x--; >+ gc.drawLine(x, minY, x, maxY); >+ minY++; maxY--; x--; >+ } >+ } >+ >+ private void setButtonRects(Rectangle bb) { >+ int hw = bb.width/2; >+ int hh = bb.height/2; >+ >+ switch (side) { >+ case SWT.BOTTOM: >+ closeRect = new Rectangle(bb.x, bb.y+(bb.height/4), hw, hh); >+ restoreRect = new Rectangle(bb.x+hw, bb.y, hw, hh); >+ collapseRect = new Rectangle(bb.x+hw, bb.y+hh, hw, hh); >+ break; >+ case SWT.TOP: >+ closeRect = new Rectangle(bb.x, bb.y+(bb.height/4), hw, hh); >+ collapseRect = new Rectangle(bb.x+hw, bb.y, hw, hh); >+ restoreRect = new Rectangle(bb.x+hw, bb.y+hh, hw, hh); >+ break; >+ case SWT.LEFT: >+ closeRect = new Rectangle(bb.x+(bb.width/4), bb.y, hw, hh); >+ collapseRect = new Rectangle(bb.x, bb.y+hh, hw, hh); >+ restoreRect = new Rectangle(bb.x+hw, bb.y+hh, hw, hh); >+ break; >+ case SWT.RIGHT: >+ closeRect = new Rectangle(bb.x+(bb.width/4), bb.y, hw, hh); >+ restoreRect = new Rectangle(bb.x, bb.y+hh, hw, hh); >+ collapseRect = new Rectangle(bb.x+hw, bb.y+hh, hw, hh); >+ break; >+ } >+ } >+ >+ public Control getControl() { >+ return button; >+ } >+}
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 153957
:
47949
|
47960
|
48255
|
52703
|
72416