|
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 |
int insertIdx = viewRefs.indexOf(beforeRef); |
| 158 |
pane.getViewReference(), view); |
176 |
System.out.println("Drop: ref = " + ref.getId() + "insert Index = " + insertIdx); //$NON-NLS-1$ //$NON-NLS-2$ |
|
|
177 |
adoptView(ref, insertIdx, true, false, !iter.hasNext()); |
| 159 |
} |
178 |
} |
| 160 |
update(true); |
179 |
update(true); |
| 161 |
} |
180 |
} |
|
Lines 199-265
Link Here
|
| 199 |
|
218 |
|
| 200 |
public void perspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective, IWorkbenchPartReference partRef, String changeId) { |
219 |
public void perspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective, IWorkbenchPartReference partRef, String changeId) { |
| 201 |
if (page != null && page == window.getActivePage() && page.getPerspective() == perspective) { |
220 |
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 |
221 |
// Handle removals immediately just in case the part (and its image) is about to be disposed |
| 206 |
if (changeId.equals(IWorkbenchPage.CHANGE_VIEW_HIDE) |
222 |
if (changeId.equals(IWorkbenchPage.CHANGE_VIEW_HIDE)) { |
| 207 |
|| changeId.equals(IWorkbenchPage.CHANGE_FAST_VIEW_REMOVE)) { |
223 |
removeViewRef((IViewReference) partRef); |
| 208 |
|
224 |
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 |
} |
225 |
} |
| 228 |
|
226 |
|
| 229 |
if (changeId.equals(IWorkbenchPage.CHANGE_VIEW_SHOW) |
227 |
// If a view becomes 'unfast' we might want to remove it |
| 230 |
|| changeId.equals(IWorkbenchPage.CHANGE_FAST_VIEW_ADD)) { |
228 |
if (changeId.equals(IWorkbenchPage.CHANGE_FAST_VIEW_REMOVE)) { |
| 231 |
|
229 |
if ((style & REMOVE_UNFAST_REFS) != 0) |
| 232 |
ToolItem item = null; |
230 |
removeViewRef((IViewReference) partRef); |
| 233 |
|
231 |
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 |
} |
232 |
} |
| 244 |
} |
233 |
} |
| 245 |
} |
234 |
} |
| 246 |
|
235 |
|
| 247 |
public void perspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective, String changeId) { |
236 |
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 |
} |
237 |
} |
| 264 |
}); |
238 |
}); |
| 265 |
|
239 |
|
|
Lines 280-285
Link Here
|
| 280 |
} |
254 |
} |
| 281 |
|
255 |
|
| 282 |
/** |
256 |
/** |
|
|
257 |
* Special constructor that sets the ID |
| 258 |
* |
| 259 |
* @param wbw The Workbench window |
| 260 |
* @param style The style of FVB desired |
| 261 |
* @param id The trim id |
| 262 |
*/ |
| 263 |
public FastViewBar(WorkbenchWindow wbw, int style, String id) { |
| 264 |
this(wbw); |
| 265 |
this.style = style; |
| 266 |
this.id = id; |
| 267 |
} |
| 268 |
|
| 269 |
/** |
| 283 |
* Returns the platform's idea of where the fast view bar should be docked in a fresh |
270 |
* 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 |
271 |
* 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 |
272 |
* 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' |
404 |
// Create a toolbar to show an 'Add FastView' menu 'button' |
| 418 |
menuTB = new ToolBar(fvbComposite, SWT.FLAT | orientation); |
405 |
menuTB = new ToolBar(fvbComposite, SWT.FLAT | orientation); |
| 419 |
|
406 |
|
| 420 |
// Construct an item to act as a 'menu button' (a la the PerspectiveSwitcher) |
407 |
if (testStyleBit(SHOW_ADD_BUTTON)) { |
| 421 |
menuItem = new ToolItem(menuTB, SWT.PUSH, 0); |
408 |
// Construct an item to act as a 'menu button' (a la the PerspectiveSwitcher) |
|
|
409 |
showItem = new ToolItem(menuTB, SWT.PUSH, 0); |
| 410 |
|
| 411 |
Image tbImage = WorkbenchImages.getImage(IWorkbenchGraphicConstants.IMG_ETOOL_NEW_FASTVIEW); |
| 412 |
showItem.setImage(tbImage); |
| 413 |
|
| 414 |
String menuTip = WorkbenchMessages.FastViewBar_0; |
| 415 |
showItem.setToolTipText(menuTip); |
| 416 |
|
| 417 |
// Bring up the 'Add Fast View' menu on a left -or- right button click |
| 418 |
// Right click (context menu) |
| 419 |
showItem.addListener(SWT.MenuDetect, addMenuListener); |
| 420 |
|
| 421 |
// Left Click... |
| 422 |
showItem.addSelectionListener(new SelectionListener() { |
| 423 |
public void widgetSelected(SelectionEvent e) { |
| 424 |
Rectangle bb = DragUtil.getDisplayBounds(menuTB); |
| 425 |
showAddFastViewPopup(new Point(bb.x,bb.y+bb.height)); |
| 426 |
} |
| 427 |
|
| 428 |
public void widgetDefaultSelected(SelectionEvent e) { |
| 429 |
} |
| 430 |
|
| 431 |
}); |
| 432 |
} |
| 422 |
|
433 |
|
| 423 |
Image tbImage = WorkbenchImages.getImage(IWorkbenchGraphicConstants.IMG_ETOOL_NEW_FASTVIEW); |
434 |
if (testStyleBit(SHOW_GROUP_BUTTON)) { |
| 424 |
menuItem.setImage(tbImage); |
435 |
groupBtn = new FastGroupTrimButton(menuTB, this); |
|
|
436 |
groupBtn.setSize(20); |
| 437 |
groupItem = new ToolItem(menuTB, SWT.SEPARATOR, 0); |
| 438 |
groupItem.setControl(groupBtn.getControl()); |
| 439 |
groupItem.setWidth(20); |
| 440 |
|
| 441 |
} |
| 425 |
|
442 |
|
| 426 |
String menuTip = WorkbenchMessages.FastViewBar_0; |
|
|
| 427 |
menuItem.setToolTipText(menuTip); |
| 428 |
//new ToolItem(menuTB, SWT.SEPARATOR, 1); |
443 |
//new ToolItem(menuTB, SWT.SEPARATOR, 1); |
| 429 |
|
444 |
|
| 430 |
// Now that the ToolBar is populated calculate its size... |
445 |
// Now that the ToolBar is populated calculate its size... |
| 431 |
Point size = menuTB.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); |
446 |
Point size = menuTB.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); |
| 432 |
menuTB.setBounds(0, 0, size.x, size.y); |
447 |
menuTB.setBounds(0, 0, size.x, size.y); |
| 433 |
|
448 |
|
| 434 |
// Bring up the 'Add Fast View' menu on a left -or- right button click |
449 |
// Bring up the 'Add Fast View' menu on a left -or- right button click |
| 435 |
// Right click (context menu) |
450 |
// Right click (context menu) |
| 436 |
menuItem.addListener(SWT.MenuDetect, addMenuListener); |
|
|
| 437 |
menuTB.addListener(SWT.MenuDetect, addMenuListener); |
451 |
menuTB.addListener(SWT.MenuDetect, addMenuListener); |
| 438 |
|
452 |
|
| 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... |
453 |
// try to get the layout correct... |
| 452 |
toolBarData = new CellData(); |
454 |
toolBarData = new CellData(); |
| 453 |
toolBarData.align(SWT.FILL, SWT.FILL); |
455 |
toolBarData.align(SWT.FILL, SWT.FILL); |
|
Lines 455-461
Link Here
|
| 455 |
|
457 |
|
| 456 |
// Construct the ToolBar containing the 'Fast' views |
458 |
// Construct the ToolBar containing the 'Fast' views |
| 457 |
fastViewBar = new ToolBarManager(SWT.FLAT | SWT.WRAP | orientation); |
459 |
fastViewBar = new ToolBarManager(SWT.FLAT | SWT.WRAP | orientation); |
| 458 |
fastViewBar.add(new ShowFastViewContribution(window)); |
460 |
fastViewBar.add(new ShowFastViewContribution(this, window)); |
| 459 |
|
461 |
|
| 460 |
fastViewBar.createControl(fvbComposite); |
462 |
fastViewBar.createControl(fvbComposite); |
| 461 |
|
463 |
|
|
Lines 678-684
Link Here
|
| 678 |
fastViewBar.dispose(); |
680 |
fastViewBar.dispose(); |
| 679 |
fastViewBar = null; |
681 |
fastViewBar = null; |
| 680 |
|
682 |
|
| 681 |
menuItem.dispose(); |
683 |
if (showItem != null) { |
|
|
684 |
showItem.dispose(); |
| 685 |
showItem = null; |
| 686 |
} |
| 687 |
|
| 688 |
if (groupItem != null) { |
| 689 |
groupItem.dispose(); |
| 690 |
groupItem = null; |
| 691 |
} |
| 692 |
|
| 682 |
menuTB.dispose(); |
693 |
menuTB.dispose(); |
| 683 |
|
694 |
|
| 684 |
oldLength = 0; |
695 |
oldLength = 0; |
|
Lines 859-865
Link Here
|
| 859 |
orientation.putInteger(IWorkbenchConstants.TAG_POSITION, |
870 |
orientation.putInteger(IWorkbenchConstants.TAG_POSITION, |
| 860 |
((Integer) viewOrientation.get(next)).intValue()); |
871 |
((Integer) viewOrientation.get(next)).intValue()); |
| 861 |
} |
872 |
} |
| 862 |
|
|
|
| 863 |
} |
873 |
} |
| 864 |
|
874 |
|
| 865 |
/** |
875 |
/** |
|
Lines 908-914
Link Here
|
| 908 |
return window; |
918 |
return window; |
| 909 |
} |
919 |
} |
| 910 |
|
920 |
|
| 911 |
public void restoreView(IViewReference selectedView) { |
921 |
public void adoptView(IViewReference ref, int insertIndex, boolean makeFast, boolean activate, boolean animate) { |
|
|
922 |
if (ref != null) { |
| 923 |
WorkbenchPage page = window.getActiveWorkbenchPage(); |
| 924 |
if (page != null) { |
| 925 |
// Remember the pane -before- we adopt the view for animations |
| 926 |
ViewPane pane = (ViewPane) ((WorkbenchPartReference) ref) |
| 927 |
.getPane(); |
| 928 |
|
| 929 |
if (makeFast) |
| 930 |
page.addFastView(ref); |
| 931 |
|
| 932 |
// we -must- have a ref since we're adopting the view |
| 933 |
if (!viewRefs.contains(ref)) |
| 934 |
addViewRef(ref, insertIndex, true); |
| 935 |
|
| 936 |
if (activate) { |
| 937 |
IWorkbenchPart toActivate = ref.getPart(true); |
| 938 |
if (toActivate != null) { |
| 939 |
page.activate(toActivate); |
| 940 |
} |
| 941 |
} |
| 942 |
|
| 943 |
if (animate && pane != null) { |
| 944 |
int idx = getIndex(ref); |
| 945 |
ToolItem item = getItem(idx); |
| 946 |
Rectangle bounds = item.getBounds(); |
| 947 |
Rectangle endBounds = Geometry.toDisplay(item |
| 948 |
.getParent(), bounds); |
| 949 |
|
| 950 |
RectangleAnimation animation = new RectangleAnimation( |
| 951 |
window.getShell(), pane.getParentBounds(), endBounds); |
| 952 |
|
| 953 |
animation.schedule(); |
| 954 |
} |
| 955 |
} |
| 956 |
} |
| 957 |
} |
| 958 |
|
| 959 |
public void restoreView(IViewReference selectedView, boolean activate, boolean animate) { |
| 912 |
if (selectedView != null) { |
960 |
if (selectedView != null) { |
| 913 |
WorkbenchPage page = window.getActiveWorkbenchPage(); |
961 |
WorkbenchPage page = window.getActiveWorkbenchPage(); |
| 914 |
if (page != null) { |
962 |
if (page != null) { |
|
Lines 919-939
Link Here
|
| 919 |
.getParent(), bounds); |
967 |
.getParent(), bounds); |
| 920 |
|
968 |
|
| 921 |
page.removeFastView(selectedView); |
969 |
page.removeFastView(selectedView); |
| 922 |
|
970 |
|
| 923 |
IWorkbenchPart toActivate = selectedView |
971 |
if (activate) { |
| 924 |
.getPart(true); |
972 |
IWorkbenchPart toActivate = selectedView |
| 925 |
if (toActivate != null) { |
973 |
.getPart(true); |
| 926 |
page.activate(toActivate); |
974 |
if (toActivate != null) { |
|
|
975 |
page.activate(toActivate); |
| 976 |
} |
| 927 |
} |
977 |
} |
| 928 |
|
978 |
|
| 929 |
ViewPane pane = (ViewPane) ((WorkbenchPartReference) selectedView) |
979 |
ViewPane pane = (ViewPane) ((WorkbenchPartReference) selectedView) |
| 930 |
.getPane(); |
980 |
.getPane(); |
| 931 |
|
981 |
|
| 932 |
RectangleAnimation animation = new RectangleAnimation( |
982 |
if (animate) { |
| 933 |
window.getShell(), startBounds, pane |
983 |
RectangleAnimation animation = new RectangleAnimation( |
| 934 |
.getParentBounds()); |
984 |
window.getShell(), startBounds, pane |
| 935 |
|
985 |
.getParentBounds()); |
| 936 |
animation.schedule(); |
986 |
|
|
|
987 |
animation.schedule(); |
| 988 |
} |
| 937 |
} |
989 |
} |
| 938 |
} |
990 |
} |
| 939 |
} |
991 |
} |
|
Lines 956-962
Link Here
|
| 956 |
* @see org.eclipse.ui.internal.IWindowTrim#getId() |
1008 |
* @see org.eclipse.ui.internal.IWindowTrim#getId() |
| 957 |
*/ |
1009 |
*/ |
| 958 |
public String getId() { |
1010 |
public String getId() { |
| 959 |
return "org.eclise.ui.internal.FastViewBar"; //$NON-NLS-1$ |
1011 |
return id; |
| 960 |
} |
1012 |
} |
| 961 |
|
1013 |
|
| 962 |
/* (non-Javadoc) |
1014 |
/* (non-Javadoc) |
|
Lines 997-1000
Link Here
|
| 997 |
public boolean isResizeable() { |
1049 |
public boolean isResizeable() { |
| 998 |
return false; |
1050 |
return false; |
| 999 |
} |
1051 |
} |
|
|
1052 |
|
| 1053 |
/** |
| 1054 |
* @return Returns the viewRefs. |
| 1055 |
*/ |
| 1056 |
public List getViewRefs() { |
| 1057 |
return viewRefs; |
| 1058 |
} |
| 1059 |
|
| 1060 |
/** |
| 1061 |
* @param viewRefs The viewRefs to set. |
| 1062 |
*/ |
| 1063 |
public void setViewRefs(List viewRefs) { |
| 1064 |
this.viewRefs = new ArrayList(viewRefs); |
| 1065 |
fastViewBar.markDirty(); |
| 1066 |
update(true); |
| 1067 |
} |
| 1068 |
|
| 1069 |
/** |
| 1070 |
* Add a new view reference into the list |
| 1071 |
* @param ref The reference to add |
| 1072 |
* @param insertIndex The index to insert it at |
| 1073 |
* @param update |
| 1074 |
*/ |
| 1075 |
public void addViewRef(IViewReference ref, int insertIndex, boolean update) { |
| 1076 |
if (ref == null) |
| 1077 |
return; |
| 1078 |
|
| 1079 |
viewRefs.remove(ref); |
| 1080 |
if (insertIndex < 0 || insertIndex >= viewRefs.size()) |
| 1081 |
viewRefs.add(ref); |
| 1082 |
else |
| 1083 |
viewRefs.add(insertIndex, ref); |
| 1084 |
|
| 1085 |
if (update) { |
| 1086 |
fastViewBar.markDirty(); |
| 1087 |
update(true); |
| 1088 |
} |
| 1089 |
} |
| 1090 |
|
| 1091 |
/** |
| 1092 |
* Remove a reference from the list |
| 1093 |
* @param ref The view reference to remove |
| 1094 |
*/ |
| 1095 |
public void removeViewRef(IViewReference ref) { |
| 1096 |
if (ref == null) |
| 1097 |
return; |
| 1098 |
|
| 1099 |
viewRefs.remove(ref); |
| 1100 |
|
| 1101 |
// Remove the ToolItem associated with the reference |
| 1102 |
ToolItem item = ShowFastViewContribution.getItem(fastViewBar.getControl(), ref); |
| 1103 |
if (item != null) { |
| 1104 |
item.dispose(); |
| 1105 |
updateLayoutData(); |
| 1106 |
update(true); |
| 1107 |
} |
| 1108 |
} |
| 1109 |
|
| 1110 |
/** |
| 1111 |
* Restore all refs and close the group |
| 1112 |
*/ |
| 1113 |
public void closeGroup() { |
| 1114 |
Perspective persp = window.getActiveWorkbenchPage().getActivePerspective(); |
| 1115 |
persp.closeTrimGroup(this); |
| 1116 |
} |
| 1117 |
|
| 1118 |
/** |
| 1119 |
* Move all referenced views to the trim (ie. make |
| 1120 |
* them fast views...) |
| 1121 |
*/ |
| 1122 |
public void collapseGroup() { |
| 1123 |
for (Iterator refIter = viewRefs.iterator(); refIter.hasNext();) { |
| 1124 |
IViewReference ref = (IViewReference) refIter.next(); |
| 1125 |
adoptView(ref, -1, true, false, !refIter.hasNext()); |
| 1126 |
} |
| 1127 |
|
| 1128 |
update(false); |
| 1129 |
} |
| 1130 |
|
| 1131 |
/** |
| 1132 |
* Restore all referenced views to the layout |
| 1133 |
*/ |
| 1134 |
public void restoreGroup() { |
| 1135 |
for (Iterator refIter = viewRefs.iterator(); refIter.hasNext();) { |
| 1136 |
IViewReference ref = (IViewReference) refIter.next(); |
| 1137 |
restoreView(ref, false, !refIter.hasNext()); |
| 1138 |
} |
| 1139 |
|
| 1140 |
update(false); |
| 1141 |
} |
| 1142 |
|
| 1143 |
/** |
| 1144 |
* @param fvbMem |
| 1145 |
*/ |
| 1146 |
public void saveViewRefs(IMemento memento) { |
| 1147 |
IMemento viewsMem = memento.createChild(IWorkbenchConstants.TAG_VIEWS); |
| 1148 |
for (Iterator fvIter = viewRefs.iterator(); fvIter.hasNext();) { |
| 1149 |
IViewReference ref = (IViewReference) fvIter.next(); |
| 1150 |
String id = ViewFactory.getKey(ref); |
| 1151 |
viewsMem.createChild(IWorkbenchConstants.TAG_VIEW, id); |
| 1152 |
} |
| 1153 |
} |
| 1154 |
|
| 1155 |
/** |
| 1156 |
* Restore the list of view references for this FVB |
| 1157 |
* |
| 1158 |
* @param fvbMem he IMemento to store the info in |
| 1159 |
*/ |
| 1160 |
public void restoreViewRefs(IMemento memento) { |
| 1161 |
IMemento viewsMem = memento.getChild(IWorkbenchConstants.TAG_VIEWS); |
| 1162 |
IMemento[] fvMems = viewsMem.getChildren(IWorkbenchConstants.TAG_VIEW); |
| 1163 |
for (int i = 0; i < fvMems.length; i++) { |
| 1164 |
String viewId = fvMems[i].getID(); |
| 1165 |
String secondaryId = ViewFactory.extractSecondaryId(viewId); |
| 1166 |
if (secondaryId != null) { |
| 1167 |
viewId = ViewFactory.extractPrimaryId(viewId); |
| 1168 |
} |
| 1169 |
|
| 1170 |
// Resolve the ref |
| 1171 |
IViewReference ref = window.getActiveWorkbenchPage().getViewFactory().getView(viewId, secondaryId); |
| 1172 |
viewRefs.add(ref); |
| 1173 |
} |
| 1174 |
} |
| 1000 |
} |
1175 |
} |
|
|
1176 |
|