|
Lines 76-96
Link Here
|
| 76 |
|
76 |
|
| 77 |
private WorkbenchWindow window; |
77 |
private WorkbenchWindow window; |
| 78 |
private IViewReference selection; |
78 |
private IViewReference selection; |
|
|
79 |
private List viewRefs = new ArrayList(); |
| 79 |
|
80 |
|
| 80 |
// "New Fast View" 'Button' fields |
81 |
// "New Fast View" 'Button' fields |
| 81 |
private MenuManager newFastViewMenuMgr; |
82 |
private MenuManager newFastViewMenuMgr; |
| 82 |
private Composite fvbComposite; |
83 |
private Composite fvbComposite; |
| 83 |
private ToolBar menuTB; |
84 |
private ToolBar menuTB; |
| 84 |
private ToolItem menuItem; |
85 |
private ToolItem showItem = null; |
|
|
86 |
private ToolItem groupItem = null; |
| 87 |
private FastGroupTrimButton groupBtn = null; |
| 85 |
private CellData toolBarData; |
88 |
private CellData toolBarData; |
| 86 |
|
89 |
|
|
|
90 |
/** Causes the FVB to remove the ref for any view restored to the workbench */ |
| 91 |
public static final int REMOVE_UNFAST_REFS = 0x0001; |
| 92 |
/** Causes the FVB to show the 'group mode' button set */ |
| 93 |
public static final int SHOW_GROUP_BUTTON = 0x0002; |
| 94 |
/** Causes the FVB to show the 'Add View' popup button */ |
| 95 |
public static final int SHOW_ADD_BUTTON = 0x0004; |
| 96 |
|
| 97 |
public static final int LEGACY_FVB = REMOVE_UNFAST_REFS | SHOW_ADD_BUTTON; |
| 98 |
public static final int GROUP_FVB = SHOW_GROUP_BUTTON; |
| 99 |
|
| 100 |
private boolean testStyleBit(int toTest) { return (style & toTest) != 0; } |
| 101 |
private int style = LEGACY_FVB; |
| 102 |
|
| 87 |
private static final int HIDDEN_WIDTH = 5; |
103 |
private static final int HIDDEN_WIDTH = 5; |
| 88 |
|
104 |
|
| 89 |
|
|
|
| 90 |
private int oldLength = 0; |
105 |
private int oldLength = 0; |
| 91 |
|
106 |
|
|
|
107 |
// Dnd |
| 92 |
private ViewDropTarget dropTarget; |
108 |
private ViewDropTarget dropTarget; |
| 93 |
|
|
|
| 94 |
private Listener dragListener = new Listener() { |
109 |
private Listener dragListener = new Listener() { |
| 95 |
public void handleEvent(Event event) { |
110 |
public void handleEvent(Event event) { |
| 96 |
Point position = DragUtil.getEventLoc(event); |
111 |
Point position = DragUtil.getEventLoc(event); |
|
Lines 126-131
Link Here
|
| 126 |
} |
141 |
} |
| 127 |
}; |
142 |
}; |
| 128 |
private int fCurrentSide = SWT.DEFAULT; |
143 |
private int fCurrentSide = SWT.DEFAULT; |
|
|
144 |
|
| 145 |
private static final String GLOBAL_FVB_ID ="org.eclise.ui.internal.FastViewBar"; //$NON-NLS-1$ |
| 146 |
private String id = GLOBAL_FVB_ID; |
| 129 |
|
147 |
|
| 130 |
class ViewDropTarget extends AbstractDropTarget { |
148 |
class ViewDropTarget extends AbstractDropTarget { |
| 131 |
List panes; |
149 |
List panes; |
|
Lines 148-161
Link Here
|
| 148 |
* @see org.eclipse.ui.internal.dnd.IDropTarget#drop() |
166 |
* @see org.eclipse.ui.internal.dnd.IDropTarget#drop() |
| 149 |
*/ |
167 |
*/ |
| 150 |
public void drop() { |
168 |
public void drop() { |
| 151 |
IViewReference view = getViewFor(position); |
169 |
IViewReference beforeRef = getViewFor(position); |
| 152 |
|
170 |
|
| 153 |
Iterator iter = panes.iterator(); |
171 |
Iterator iter = panes.iterator(); |
| 154 |
while (iter.hasNext()) { |
172 |
while (iter.hasNext()) { |
| 155 |
ViewPane pane = (ViewPane) iter.next(); |
173 |
ViewPane pane = (ViewPane) iter.next(); |
| 156 |
getPage().addFastView(pane.getViewReference()); |
174 |
IViewReference ref = pane.getViewReference(); |
| 157 |
getPage().getActivePerspective().moveFastView( |
175 |
|
| 158 |
pane.getViewReference(), view); |
176 |
// Only allow one reference in an FVB per perspective |
|
|
177 |
FastViewBar curFVB = getPage().getActivePerspective().getFVBForRef(ref); |
| 178 |
if (curFVB == null && window.getFastViewBar().hasViewRef(ref)) |
| 179 |
curFVB = window.getFastViewBar(); |
| 180 |
|
| 181 |
if (curFVB != null) { |
| 182 |
curFVB.removeViewRef(ref); |
| 183 |
} |
| 184 |
|
| 185 |
int insertIdx = viewRefs.indexOf(beforeRef); |
| 186 |
adoptView(ref, insertIdx, true, false, !iter.hasNext()); |
| 159 |
} |
187 |
} |
| 160 |
update(true); |
188 |
update(true); |
| 161 |
} |
189 |
} |
|
Lines 199-265
Link Here
|
| 199 |
|
227 |
|
| 200 |
public void perspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective, IWorkbenchPartReference partRef, String changeId) { |
228 |
public void perspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective, IWorkbenchPartReference partRef, String changeId) { |
| 201 |
if (page != null && page == window.getActivePage() && page.getPerspective() == perspective) { |
229 |
if (page != null && page == window.getActivePage() && page.getPerspective() == perspective) { |
| 202 |
|
|
|
| 203 |
ToolBar bar = fastViewBar.getControl(); |
| 204 |
|
| 205 |
// Handle removals immediately just in case the part (and its image) is about to be disposed |
230 |
// Handle removals immediately just in case the part (and its image) is about to be disposed |
| 206 |
if (changeId.equals(IWorkbenchPage.CHANGE_VIEW_HIDE) |
231 |
if (changeId.equals(IWorkbenchPage.CHANGE_VIEW_HIDE)) { |
| 207 |
|| changeId.equals(IWorkbenchPage.CHANGE_FAST_VIEW_REMOVE)) { |
232 |
removeViewRef((IViewReference) partRef); |
| 208 |
|
233 |
return; |
| 209 |
ToolItem item = null; |
|
|
| 210 |
|
| 211 |
if (bar != null) { |
| 212 |
item = ShowFastViewContribution.getItem(bar, partRef); |
| 213 |
} |
| 214 |
|
| 215 |
if (item != null) { |
| 216 |
item.dispose(); |
| 217 |
updateLayoutData(); |
| 218 |
return; |
| 219 |
} |
| 220 |
} |
| 221 |
|
| 222 |
// Ignore changes to non-fastviews |
| 223 |
if (page instanceof WorkbenchPage && partRef instanceof IViewReference) { |
| 224 |
if (!((WorkbenchPage)page).isFastView((IViewReference)partRef)) { |
| 225 |
return; |
| 226 |
} |
| 227 |
} |
234 |
} |
| 228 |
|
235 |
|
| 229 |
if (changeId.equals(IWorkbenchPage.CHANGE_VIEW_SHOW) |
236 |
// If a view becomes 'unfast' we might want to remove it |
| 230 |
|| changeId.equals(IWorkbenchPage.CHANGE_FAST_VIEW_ADD)) { |
237 |
if (changeId.equals(IWorkbenchPage.CHANGE_FAST_VIEW_REMOVE)) { |
| 231 |
|
238 |
if ((style & REMOVE_UNFAST_REFS) != 0) |
| 232 |
ToolItem item = null; |
239 |
removeViewRef((IViewReference) partRef); |
| 233 |
|
240 |
return; |
| 234 |
if (bar != null) { |
|
|
| 235 |
item = ShowFastViewContribution.getItem(bar, partRef); |
| 236 |
} |
| 237 |
|
| 238 |
if (item != null) { |
| 239 |
// If this part is already in the fast view bar, there is nothing to do |
| 240 |
return; |
| 241 |
} |
| 242 |
fastViewBar.markDirty(); |
| 243 |
} |
241 |
} |
| 244 |
} |
242 |
} |
| 245 |
} |
243 |
} |
| 246 |
|
244 |
|
| 247 |
public void perspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective, String changeId) { |
245 |
public void perspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective, String changeId) { |
| 248 |
if (changeId.equals(IWorkbenchPage.CHANGE_VIEW_HIDE) |
|
|
| 249 |
|| changeId.equals(IWorkbenchPage.CHANGE_FAST_VIEW_REMOVE)) { |
| 250 |
|
| 251 |
// In these cases, we've aleady updated the fast view bar in the pre-change |
| 252 |
// listener |
| 253 |
return; |
| 254 |
} |
| 255 |
|
| 256 |
// Ignore changes to anything but the active perspective |
| 257 |
if (page != null && page == window.getActivePage() && page.getPerspective() == perspective) { |
| 258 |
if (changeId.equals(IWorkbenchPage.CHANGE_VIEW_SHOW) |
| 259 |
|| changeId.equals(IWorkbenchPage.CHANGE_FAST_VIEW_ADD)) { |
| 260 |
update(false); |
| 261 |
} |
| 262 |
} |
| 263 |
} |
246 |
} |
| 264 |
}); |
247 |
}); |
| 265 |
|
248 |
|
|
Lines 280-285
Link Here
|
| 280 |
} |
263 |
} |
| 281 |
|
264 |
|
| 282 |
/** |
265 |
/** |
|
|
266 |
* Special constructor that sets the ID |
| 267 |
* |
| 268 |
* @param wbw The Workbench window |
| 269 |
* @param style The style of FVB desired |
| 270 |
* @param id The trim id |
| 271 |
*/ |
| 272 |
public FastViewBar(WorkbenchWindow wbw, int style, String id) { |
| 273 |
this(wbw); |
| 274 |
this.style = style; |
| 275 |
this.id = id; |
| 276 |
} |
| 277 |
|
| 278 |
/** |
| 283 |
* Returns the platform's idea of where the fast view bar should be docked in a fresh |
279 |
* Returns the platform's idea of where the fast view bar should be docked in a fresh |
| 284 |
* workspace. This value is meaningless after a workspace has been setup, since the |
280 |
* workspace. This value is meaningless after a workspace has been setup, since the |
| 285 |
* fast view bar state is then persisted in the workbench. This preference is just |
281 |
* fast view bar state is then persisted in the workbench. This preference is just |
|
Lines 417-453
Link Here
|
| 417 |
// Create a toolbar to show an 'Add FastView' menu 'button' |
413 |
// Create a toolbar to show an 'Add FastView' menu 'button' |
| 418 |
menuTB = new ToolBar(fvbComposite, SWT.FLAT | orientation); |
414 |
menuTB = new ToolBar(fvbComposite, SWT.FLAT | orientation); |
| 419 |
|
415 |
|
| 420 |
// Construct an item to act as a 'menu button' (a la the PerspectiveSwitcher) |
416 |
if (testStyleBit(SHOW_ADD_BUTTON)) { |
| 421 |
menuItem = new ToolItem(menuTB, SWT.PUSH, 0); |
417 |
// Construct an item to act as a 'menu button' (a la the PerspectiveSwitcher) |
|
|
418 |
showItem = new ToolItem(menuTB, SWT.PUSH, 0); |
| 419 |
|
| 420 |
Image tbImage = WorkbenchImages.getImage(IWorkbenchGraphicConstants.IMG_ETOOL_NEW_FASTVIEW); |
| 421 |
showItem.setImage(tbImage); |
| 422 |
|
| 423 |
String menuTip = WorkbenchMessages.FastViewBar_0; |
| 424 |
showItem.setToolTipText(menuTip); |
| 425 |
|
| 426 |
// Bring up the 'Add Fast View' menu on a left -or- right button click |
| 427 |
// Right click (context menu) |
| 428 |
showItem.addListener(SWT.MenuDetect, addMenuListener); |
| 429 |
|
| 430 |
// Left Click... |
| 431 |
showItem.addSelectionListener(new SelectionListener() { |
| 432 |
public void widgetSelected(SelectionEvent e) { |
| 433 |
Rectangle bb = DragUtil.getDisplayBounds(menuTB); |
| 434 |
showAddFastViewPopup(new Point(bb.x,bb.y+bb.height)); |
| 435 |
} |
| 436 |
|
| 437 |
public void widgetDefaultSelected(SelectionEvent e) { |
| 438 |
} |
| 439 |
|
| 440 |
}); |
| 441 |
} |
| 422 |
|
442 |
|
| 423 |
Image tbImage = WorkbenchImages.getImage(IWorkbenchGraphicConstants.IMG_ETOOL_NEW_FASTVIEW); |
443 |
if (testStyleBit(SHOW_GROUP_BUTTON)) { |
| 424 |
menuItem.setImage(tbImage); |
444 |
groupBtn = new FastGroupTrimButton(menuTB, this); |
|
|
445 |
groupBtn.setSize(20); |
| 446 |
groupItem = new ToolItem(menuTB, SWT.SEPARATOR, 0); |
| 447 |
groupItem.setControl(groupBtn.getControl()); |
| 448 |
groupItem.setWidth(20); |
| 449 |
|
| 450 |
} |
| 425 |
|
451 |
|
| 426 |
String menuTip = WorkbenchMessages.FastViewBar_0; |
|
|
| 427 |
menuItem.setToolTipText(menuTip); |
| 428 |
//new ToolItem(menuTB, SWT.SEPARATOR, 1); |
452 |
//new ToolItem(menuTB, SWT.SEPARATOR, 1); |
| 429 |
|
453 |
|
| 430 |
// Now that the ToolBar is populated calculate its size... |
454 |
// Now that the ToolBar is populated calculate its size... |
| 431 |
Point size = menuTB.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); |
455 |
Point size = menuTB.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); |
| 432 |
menuTB.setBounds(0, 0, size.x, size.y); |
456 |
menuTB.setBounds(0, 0, size.x, size.y); |
| 433 |
|
457 |
|
| 434 |
// Bring up the 'Add Fast View' menu on a left -or- right button click |
458 |
// Bring up the 'Add Fast View' menu on a left -or- right button click |
| 435 |
// Right click (context menu) |
459 |
// Right click (context menu) |
| 436 |
menuItem.addListener(SWT.MenuDetect, addMenuListener); |
|
|
| 437 |
menuTB.addListener(SWT.MenuDetect, addMenuListener); |
460 |
menuTB.addListener(SWT.MenuDetect, addMenuListener); |
| 438 |
|
461 |
|
| 439 |
// Left Click... |
|
|
| 440 |
menuItem.addSelectionListener(new SelectionListener() { |
| 441 |
public void widgetSelected(SelectionEvent e) { |
| 442 |
Rectangle bb = DragUtil.getDisplayBounds(menuTB); |
| 443 |
showAddFastViewPopup(new Point(bb.x,bb.y+bb.height)); |
| 444 |
} |
| 445 |
|
| 446 |
public void widgetDefaultSelected(SelectionEvent e) { |
| 447 |
} |
| 448 |
|
| 449 |
}); |
| 450 |
|
| 451 |
// try to get the layout correct... |
462 |
// try to get the layout correct... |
| 452 |
toolBarData = new CellData(); |
463 |
toolBarData = new CellData(); |
| 453 |
toolBarData.align(SWT.FILL, SWT.FILL); |
464 |
toolBarData.align(SWT.FILL, SWT.FILL); |
|
Lines 455-461
Link Here
|
| 455 |
|
466 |
|
| 456 |
// Construct the ToolBar containing the 'Fast' views |
467 |
// Construct the ToolBar containing the 'Fast' views |
| 457 |
fastViewBar = new ToolBarManager(SWT.FLAT | SWT.WRAP | orientation); |
468 |
fastViewBar = new ToolBarManager(SWT.FLAT | SWT.WRAP | orientation); |
| 458 |
fastViewBar.add(new ShowFastViewContribution(window)); |
469 |
fastViewBar.add(new ShowFastViewContribution(this, window)); |
| 459 |
|
470 |
|
| 460 |
fastViewBar.createControl(fvbComposite); |
471 |
fastViewBar.createControl(fvbComposite); |
| 461 |
|
472 |
|
|
Lines 678-684
Link Here
|
| 678 |
fastViewBar.dispose(); |
689 |
fastViewBar.dispose(); |
| 679 |
fastViewBar = null; |
690 |
fastViewBar = null; |
| 680 |
|
691 |
|
| 681 |
menuItem.dispose(); |
692 |
if (showItem != null) { |
|
|
693 |
showItem.dispose(); |
| 694 |
showItem = null; |
| 695 |
} |
| 696 |
|
| 697 |
if (groupItem != null) { |
| 698 |
groupItem.dispose(); |
| 699 |
groupItem = null; |
| 700 |
} |
| 701 |
|
| 682 |
menuTB.dispose(); |
702 |
menuTB.dispose(); |
| 683 |
|
703 |
|
| 684 |
oldLength = 0; |
704 |
oldLength = 0; |
|
Lines 859-865
Link Here
|
| 859 |
orientation.putInteger(IWorkbenchConstants.TAG_POSITION, |
879 |
orientation.putInteger(IWorkbenchConstants.TAG_POSITION, |
| 860 |
((Integer) viewOrientation.get(next)).intValue()); |
880 |
((Integer) viewOrientation.get(next)).intValue()); |
| 861 |
} |
881 |
} |
| 862 |
|
|
|
| 863 |
} |
882 |
} |
| 864 |
|
883 |
|
| 865 |
/** |
884 |
/** |
|
Lines 908-914
Link Here
|
| 908 |
return window; |
927 |
return window; |
| 909 |
} |
928 |
} |
| 910 |
|
929 |
|
| 911 |
public void restoreView(IViewReference selectedView) { |
930 |
public void adoptView(IViewReference ref, int insertIndex, boolean makeFast, boolean activate, boolean animate) { |
|
|
931 |
if (ref != null) { |
| 932 |
WorkbenchPage page = window.getActiveWorkbenchPage(); |
| 933 |
if (page != null) { |
| 934 |
// Remember the pane -before- we adopt the view for animations |
| 935 |
ViewPane pane = (ViewPane) ((WorkbenchPartReference) ref) |
| 936 |
.getPane(); |
| 937 |
|
| 938 |
if (makeFast) |
| 939 |
page.addFastView(ref); |
| 940 |
|
| 941 |
// we -must- have a ref since we're adopting the view |
| 942 |
if (!viewRefs.contains(ref)) |
| 943 |
addViewRef(ref, insertIndex, true); |
| 944 |
|
| 945 |
if (activate) { |
| 946 |
IWorkbenchPart toActivate = ref.getPart(true); |
| 947 |
if (toActivate != null) { |
| 948 |
page.activate(toActivate); |
| 949 |
} |
| 950 |
} |
| 951 |
|
| 952 |
if (animate && pane != null) { |
| 953 |
int idx = getIndex(ref); |
| 954 |
ToolItem item = getItem(idx); |
| 955 |
Rectangle bounds = item.getBounds(); |
| 956 |
Rectangle endBounds = Geometry.toDisplay(item |
| 957 |
.getParent(), bounds); |
| 958 |
|
| 959 |
RectangleAnimation animation = new RectangleAnimation( |
| 960 |
window.getShell(), pane.getParentBounds(), endBounds); |
| 961 |
|
| 962 |
animation.schedule(); |
| 963 |
} |
| 964 |
} |
| 965 |
} |
| 966 |
} |
| 967 |
|
| 968 |
public void restoreView(IViewReference selectedView, boolean activate, boolean animate) { |
| 912 |
if (selectedView != null) { |
969 |
if (selectedView != null) { |
| 913 |
WorkbenchPage page = window.getActiveWorkbenchPage(); |
970 |
WorkbenchPage page = window.getActiveWorkbenchPage(); |
| 914 |
if (page != null) { |
971 |
if (page != null) { |
|
Lines 919-939
Link Here
|
| 919 |
.getParent(), bounds); |
976 |
.getParent(), bounds); |
| 920 |
|
977 |
|
| 921 |
page.removeFastView(selectedView); |
978 |
page.removeFastView(selectedView); |
| 922 |
|
979 |
|
| 923 |
IWorkbenchPart toActivate = selectedView |
980 |
if (activate) { |
| 924 |
.getPart(true); |
981 |
IWorkbenchPart toActivate = selectedView |
| 925 |
if (toActivate != null) { |
982 |
.getPart(true); |
| 926 |
page.activate(toActivate); |
983 |
if (toActivate != null) { |
|
|
984 |
page.activate(toActivate); |
| 985 |
} |
| 927 |
} |
986 |
} |
| 928 |
|
987 |
|
| 929 |
ViewPane pane = (ViewPane) ((WorkbenchPartReference) selectedView) |
988 |
ViewPane pane = (ViewPane) ((WorkbenchPartReference) selectedView) |
| 930 |
.getPane(); |
989 |
.getPane(); |
| 931 |
|
990 |
|
| 932 |
RectangleAnimation animation = new RectangleAnimation( |
991 |
if (animate) { |
| 933 |
window.getShell(), startBounds, pane |
992 |
RectangleAnimation animation = new RectangleAnimation( |
| 934 |
.getParentBounds()); |
993 |
window.getShell(), startBounds, pane |
| 935 |
|
994 |
.getParentBounds()); |
| 936 |
animation.schedule(); |
995 |
|
|
|
996 |
animation.schedule(); |
| 997 |
} |
| 937 |
} |
998 |
} |
| 938 |
} |
999 |
} |
| 939 |
} |
1000 |
} |
|
Lines 956-962
Link Here
|
| 956 |
* @see org.eclipse.ui.internal.IWindowTrim#getId() |
1017 |
* @see org.eclipse.ui.internal.IWindowTrim#getId() |
| 957 |
*/ |
1018 |
*/ |
| 958 |
public String getId() { |
1019 |
public String getId() { |
| 959 |
return "org.eclise.ui.internal.FastViewBar"; //$NON-NLS-1$ |
1020 |
return id; |
| 960 |
} |
1021 |
} |
| 961 |
|
1022 |
|
| 962 |
/* (non-Javadoc) |
1023 |
/* (non-Javadoc) |
|
Lines 997-1000
Link Here
|
| 997 |
public boolean isResizeable() { |
1058 |
public boolean isResizeable() { |
| 998 |
return false; |
1059 |
return false; |
| 999 |
} |
1060 |
} |
|
|
1061 |
|
| 1062 |
/** |
| 1063 |
* @return Returns the viewRefs. |
| 1064 |
*/ |
| 1065 |
public List getViewRefs() { |
| 1066 |
return viewRefs; |
| 1067 |
} |
| 1068 |
|
| 1069 |
/** |
| 1070 |
* @param viewRefs The viewRefs to set. |
| 1071 |
*/ |
| 1072 |
public void setViewRefs(List viewRefs) { |
| 1073 |
this.viewRefs = new ArrayList(viewRefs); |
| 1074 |
fastViewBar.markDirty(); |
| 1075 |
update(true); |
| 1076 |
} |
| 1077 |
|
| 1078 |
/** |
| 1079 |
* Add a new view reference into the list |
| 1080 |
* @param ref The reference to add |
| 1081 |
* @param insertIndex The index to insert it at |
| 1082 |
* @param update |
| 1083 |
*/ |
| 1084 |
public void addViewRef(IViewReference ref, int insertIndex, boolean update) { |
| 1085 |
if (ref == null) |
| 1086 |
return; |
| 1087 |
|
| 1088 |
viewRefs.remove(ref); |
| 1089 |
if (insertIndex < 0 || insertIndex >= viewRefs.size()) |
| 1090 |
viewRefs.add(ref); |
| 1091 |
else |
| 1092 |
viewRefs.add(insertIndex, ref); |
| 1093 |
|
| 1094 |
if (update) { |
| 1095 |
fastViewBar.markDirty(); |
| 1096 |
update(true); |
| 1097 |
} |
| 1098 |
} |
| 1099 |
|
| 1100 |
/** |
| 1101 |
* Remove a reference from the list |
| 1102 |
* @param ref The view reference to remove |
| 1103 |
*/ |
| 1104 |
public void removeViewRef(IViewReference ref) { |
| 1105 |
if (ref == null) |
| 1106 |
return; |
| 1107 |
|
| 1108 |
viewRefs.remove(ref); |
| 1109 |
|
| 1110 |
// Remove the ToolItem associated with the reference |
| 1111 |
ToolItem item = ShowFastViewContribution.getItem(fastViewBar.getControl(), ref); |
| 1112 |
if (item != null) { |
| 1113 |
item.dispose(); |
| 1114 |
updateLayoutData(); |
| 1115 |
update(true); |
| 1116 |
} |
| 1117 |
} |
| 1118 |
|
| 1119 |
/** |
| 1120 |
* Deteremine if this fast view contains the given reference |
| 1121 |
* @param ref The reference to check |
| 1122 |
* @return <code>true</code> iff this FVB contains the reference |
| 1123 |
*/ |
| 1124 |
public boolean hasViewRef(IViewReference ref) { |
| 1125 |
return viewRefs.contains(ref); |
| 1126 |
} |
| 1127 |
|
| 1128 |
/** |
| 1129 |
* Restore all refs and close the group |
| 1130 |
*/ |
| 1131 |
public void closeGroup() { |
| 1132 |
Perspective persp = window.getActiveWorkbenchPage().getActivePerspective(); |
| 1133 |
persp.closeTrimGroup(this); |
| 1134 |
} |
| 1135 |
|
| 1136 |
/** |
| 1137 |
* Move all referenced views to the trim (ie. make |
| 1138 |
* them fast views...) |
| 1139 |
*/ |
| 1140 |
public void collapseGroup() { |
| 1141 |
for (Iterator refIter = viewRefs.iterator(); refIter.hasNext();) { |
| 1142 |
IViewReference ref = (IViewReference) refIter.next(); |
| 1143 |
adoptView(ref, -1, true, false, !refIter.hasNext()); |
| 1144 |
} |
| 1145 |
|
| 1146 |
update(false); |
| 1147 |
} |
| 1148 |
|
| 1149 |
/** |
| 1150 |
* Restore all referenced views to the layout |
| 1151 |
*/ |
| 1152 |
public void restoreGroup() { |
| 1153 |
for (Iterator refIter = viewRefs.iterator(); refIter.hasNext();) { |
| 1154 |
IViewReference ref = (IViewReference) refIter.next(); |
| 1155 |
restoreView(ref, false, !refIter.hasNext()); |
| 1156 |
} |
| 1157 |
|
| 1158 |
update(false); |
| 1159 |
} |
| 1000 |
} |
1160 |
} |
|
|
1161 |
|