1 12 package org.eclipse.ui.internal; 13 14 import java.util.ArrayList ; 15 import java.util.HashMap ; 16 import java.util.Iterator ; 17 import java.util.List ; 18 import java.util.Map ; 19 20 import org.eclipse.core.runtime.IStatus; 21 import org.eclipse.core.runtime.Platform; 22 import org.eclipse.core.runtime.Status; 23 import org.eclipse.jface.action.IContributionItem; 24 import org.eclipse.jface.action.MenuManager; 25 import org.eclipse.jface.action.ToolBarManager; 26 import org.eclipse.jface.util.Geometry; 27 import org.eclipse.swt.SWT; 28 import org.eclipse.swt.events.SelectionEvent; 29 import org.eclipse.swt.events.SelectionListener; 30 import org.eclipse.swt.graphics.Cursor; 31 import org.eclipse.swt.graphics.Image; 32 import org.eclipse.swt.graphics.Point; 33 import org.eclipse.swt.graphics.Rectangle; 34 import org.eclipse.swt.widgets.Composite; 35 import org.eclipse.swt.widgets.Control; 36 import org.eclipse.swt.widgets.Event; 37 import org.eclipse.swt.widgets.Listener; 38 import org.eclipse.swt.widgets.Menu; 39 import org.eclipse.swt.widgets.ToolBar; 40 import org.eclipse.swt.widgets.ToolItem; 41 import org.eclipse.ui.IMemento; 42 import org.eclipse.ui.IViewReference; 43 import org.eclipse.ui.IWorkbenchPart; 44 import org.eclipse.ui.IWorkbenchPreferenceConstants; 45 import org.eclipse.ui.PlatformUI; 46 import org.eclipse.ui.internal.dnd.AbstractDropTarget; 47 import org.eclipse.ui.internal.dnd.DragUtil; 48 import org.eclipse.ui.internal.dnd.IDragOverListener; 49 import org.eclipse.ui.internal.dnd.IDropTarget; 50 import org.eclipse.ui.internal.layout.CellData; 51 import org.eclipse.ui.internal.layout.CellLayout; 52 import org.eclipse.ui.internal.layout.IWindowTrim; 53 import org.eclipse.ui.internal.layout.LayoutUtil; 54 import org.eclipse.ui.internal.layout.Row; 55 import org.eclipse.ui.internal.util.PrefUtil; 56 import org.eclipse.ui.presentations.PresentationUtil; 57 import org.osgi.framework.Bundle; 58 59 68 public class FastViewBar implements IWindowTrim { 69 public static String FASTVIEWBAR_ID = "org.eclise.ui.internal.FastViewBar"; 71 private ToolBarManager fastViewBar; 72 private MenuManager fastViewBarMenuManager; 73 private MenuManager showViewMenuMgr; 74 private FastViewBarContextMenuContribution contextContributionItem; 75 76 private WorkbenchWindow window; 77 private IViewReference selection; 78 79 private MenuManager newFastViewMenuMgr; 81 private Composite fvbComposite; 82 private ToolBar menuTB; 83 private ToolItem menuItem; 84 private CellData toolBarData; 85 86 private static final int HIDDEN_WIDTH = 5; 87 88 89 private int oldLength = 0; 90 91 private ViewDropTarget dropTarget; 92 93 private Listener dragListener = new Listener() { 94 public void handleEvent(Event event) { 95 Point position = DragUtil.getEventLoc(event); 96 97 IViewReference ref = getViewAt(position); 98 99 if (ref == null) { 100 startDraggingFastViewBar(position, false); 101 } else { 102 startDraggingFastView(ref, position, false); 103 } 104 } 105 }; 106 107 private Map viewOrientation = new HashMap (); 109 110 private Listener addMenuListener = new Listener() { 111 public void handleEvent(Event event) { 112 Point loc = new Point(event.x, event.y); 113 if (event.type == SWT.MenuDetect) { 114 showAddFastViewPopup(loc); 115 } 116 } 117 }; 118 119 private Listener menuListener = new Listener() { 120 public void handleEvent(Event event) { 121 Point loc = new Point(event.x, event.y); 122 if (event.type == SWT.MenuDetect) { 123 showFastViewBarPopup(loc); 124 } 125 } 126 }; 127 private int fCurrentSide = SWT.DEFAULT; 128 129 private boolean hasNewFastViewDisabled = false; 130 131 class ViewDropTarget extends AbstractDropTarget { 132 List panes; 133 134 ToolItem position; 135 136 139 public ViewDropTarget(List panesToDrop, ToolItem position) { 140 setTarget(panesToDrop, position); 141 } 142 143 public void setTarget(List panesToDrop, ToolItem position) { 144 panes = panesToDrop; 145 this.position = position; 146 } 147 148 151 public void drop() { 152 IViewReference view = getViewFor(position); 153 154 Iterator iter = panes.iterator(); 155 while (iter.hasNext()) { 156 ViewPane pane = (ViewPane) iter.next(); 157 IViewReference ref = pane.getViewReference(); 158 getPerspective().getFastViewManager().addViewReference(FASTVIEWBAR_ID, getIndex(view), ref, true); 159 } 163 update(true); 164 } 165 166 169 public Cursor getCursor() { 170 return DragCursors.getCursor(DragCursors.FASTVIEW); 171 } 172 173 public Rectangle getSnapRectangle() { 174 if (position == null) { 175 if (getToolBar().getItemCount() > 0) { 180 return getLocationOfNextIcon(); 181 } 182 return DragUtil.getDisplayBounds(getControl()); 184 } 185 186 return Geometry.toDisplay(getToolBar(), position.getBounds()); 187 } 188 } 189 190 195 public FastViewBar(WorkbenchWindow theWindow) { 196 window = theWindow; 197 198 hasNewFastViewDisabled = PrefUtil.getAPIPreferenceStore().getBoolean( 199 IWorkbenchPreferenceConstants.DISABLE_NEW_FAST_VIEW); 200 201 fastViewBarMenuManager = new MenuManager(); 203 contextContributionItem = new FastViewBarContextMenuContribution(this); 204 fastViewBarMenuManager.add(contextContributionItem); 205 206 if (!hasNewFastViewDisabled) { 207 showViewMenuMgr = new MenuManager(WorkbenchMessages.FastViewBar_show_view, "showView"); IContributionItem showViewMenu = new ShowViewMenu(window, ShowViewMenu.class.getName(), true); 210 showViewMenuMgr.add(showViewMenu); 211 fastViewBarMenuManager.add(showViewMenuMgr); 212 213 newFastViewMenuMgr = new MenuManager(WorkbenchMessages.FastViewBar_show_view, "showView"); showViewMenu = new ShowViewMenu(window, ShowViewMenu.class.getName(), true); 216 newFastViewMenuMgr.add(showViewMenu); 217 } 218 } 219 220 228 public static int getInitialSide() { 229 String loc = PrefUtil.getAPIPreferenceStore().getString( 230 IWorkbenchPreferenceConstants.INITIAL_FAST_VIEW_BAR_LOCATION); 231 232 if (IWorkbenchPreferenceConstants.BOTTOM.equals(loc)) { 233 return SWT.BOTTOM; 234 } 235 if (IWorkbenchPreferenceConstants.LEFT.equals(loc)) { 236 return SWT.LEFT; 237 } 238 if (IWorkbenchPreferenceConstants.RIGHT.equals(loc)) { 239 return SWT.RIGHT; 240 } 241 242 Bundle bundle = Platform.getBundle(PlatformUI.PLUGIN_ID); 243 if (bundle != null) { 244 IStatus status = new Status( 245 IStatus.WARNING, 246 PlatformUI.PLUGIN_ID, 247 IStatus.WARNING, 248 "Invalid value for " + PlatformUI.PLUGIN_ID 250 + "/" + IWorkbenchPreferenceConstants.INITIAL_FAST_VIEW_BAR_LOCATION 252 + " preference. Value \"" + loc + "\" should be one of \"" + IWorkbenchPreferenceConstants.LEFT + "\", \"" + IWorkbenchPreferenceConstants.BOTTOM 256 + "\", or \"" + IWorkbenchPreferenceConstants.RIGHT + "\".", null); Platform.getLog(bundle).log(status); 259 } 260 261 return SWT.BOTTOM; 263 } 264 265 public void setOrientation(IViewReference refToSet, int newState) { 266 if (newState == getOrientation(refToSet)) { 267 return; 268 } 269 270 viewOrientation.put(refToSet.getId(), new Integer (newState)); 271 Perspective persp = getPerspective(); 272 273 if (persp != null) { 274 IViewReference ref = persp.getActiveFastView(); 275 if (ref != null) { 276 persp.setActiveFastView(null); 277 } 278 persp.setActiveFastView(refToSet); 279 } 280 } 281 282 285 private WorkbenchPage getPage() { 286 if (window == null) { 287 return null; 288 } 289 290 return window.getActiveWorkbenchPage(); 291 } 292 293 296 private Perspective getPerspective() { 297 298 WorkbenchPage page = getPage(); 299 300 if (page == null) { 301 return null; 302 } 303 304 return page.getActivePerspective(); 305 } 306 307 314 public void createControl(Composite parent) { 315 fvbComposite = new Composite(parent, SWT.NONE) { 316 public Point computeSize(int wHint, int hHint, boolean changed) { 317 Point size = super.computeSize(wHint, hHint, changed); 318 if (Geometry.isHorizontal(getSide())) { 319 if (size.y < TrimUtil.TRIM_DEFAULT_HEIGHT) { 320 size.y = TrimUtil.TRIM_DEFAULT_HEIGHT; 321 } 322 } else { 323 if (size.x < TrimUtil.TRIM_DEFAULT_HEIGHT) { 324 size.x = TrimUtil.TRIM_DEFAULT_HEIGHT; 325 } 326 } 327 return size; 328 }}; 329 String tip = WorkbenchMessages.FastViewBar_0; 330 fvbComposite.setToolTipText(tip); 331 332 fvbComposite.addListener(SWT.MenuDetect, menuListener); 333 PresentationUtil.addDragListener(fvbComposite, dragListener); 334 335 createChildControls(); 336 } 337 338 344 protected void createChildControls() { 345 int newSide = getSide(); 346 int orientation = Geometry.isHorizontal(newSide) ? SWT.HORIZONTAL 347 : SWT.VERTICAL; 348 349 CellLayout controlLayout; 351 if (Geometry.isHorizontal(newSide)) { 352 controlLayout = new CellLayout(0) 353 .setMargins(0, 0) 354 .setDefaultRow(Row.growing()) 355 .setDefaultColumn(Row.fixed()) 356 .setColumn(1, Row.growing()); 357 } else { 358 controlLayout = new CellLayout(1) 359 .setMargins(0, 3) 360 .setDefaultColumn(Row.growing()) 361 .setDefaultRow(Row.fixed()) 362 .setRow(1, Row.growing()); 363 } 364 365 fvbComposite.setLayout(controlLayout); 367 368 if (!hasNewFastViewDisabled) { 369 menuTB = new ToolBar(fvbComposite, SWT.FLAT | orientation); 371 372 menuItem = new ToolItem(menuTB, SWT.PUSH, 0); 374 375 Image tbImage = WorkbenchImages.getImage(IWorkbenchGraphicConstants.IMG_ETOOL_NEW_FASTVIEW); 376 menuItem.setImage(tbImage); 377 378 String menuTip = WorkbenchMessages.FastViewBar_0; 379 menuItem.setToolTipText(menuTip); 380 382 Point size = menuTB.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); 384 menuTB.setBounds(0, 0, size.x, size.y); 385 386 menuItem.addListener(SWT.MenuDetect, addMenuListener); 389 menuTB.addListener(SWT.MenuDetect, addMenuListener); 390 391 menuItem.addSelectionListener(new SelectionListener() { 393 public void widgetSelected(SelectionEvent e) { 394 Rectangle bb = DragUtil.getDisplayBounds(menuTB); 395 showAddFastViewPopup(new Point(bb.x,bb.y+bb.height)); 396 } 397 398 public void widgetDefaultSelected(SelectionEvent e) { 399 } 400 401 }); 402 403 toolBarData = new CellData(); 405 toolBarData.align(SWT.FILL, SWT.FILL); 406 menuTB.setLayoutData(toolBarData); 407 } 408 409 fastViewBar = new ToolBarManager(SWT.FLAT | SWT.WRAP | orientation); 411 fastViewBar.add(new ShowFastViewContribution(window)); 412 413 fastViewBar.createControl(fvbComposite); 414 415 getToolBar().addListener(SWT.MenuDetect, menuListener); 416 417 IDragOverListener fastViewDragTarget = new IDragOverListener() { 418 419 public IDropTarget drag(Control currentControl, 420 Object draggedObject, Point position, 421 Rectangle dragRectangle) { 422 ToolItem targetItem = getToolItem(position); 423 if (draggedObject instanceof ViewPane) { 424 ViewPane pane = (ViewPane) draggedObject; 425 426 if (pane.getWorkbenchWindow() != window) { 428 return null; 429 } 430 431 List newList = new ArrayList (1); 432 newList.add(draggedObject); 433 434 return createDropTarget(newList, targetItem); 435 } 436 if (draggedObject instanceof ViewStack) { 437 ViewStack folder = (ViewStack) draggedObject; 438 439 if (folder.getWorkbenchWindow() != window) { 440 return null; 441 } 442 443 List viewList = new ArrayList (folder.getItemCount()); 444 LayoutPart[] children = folder.getChildren(); 445 446 for (int idx = 0; idx < children.length; idx++) { 447 if (!(children[idx] instanceof PartPlaceholder)) { 448 viewList.add(children[idx]); 449 } 450 } 451 452 return createDropTarget(viewList, targetItem); 453 } 454 455 return null; 456 } 457 458 }; 459 460 toolBarData = new CellData(); 461 toolBarData.align(SWT.FILL, SWT.FILL); 462 463 getToolBar().setLayoutData(toolBarData); 464 PresentationUtil.addDragListener(getToolBar(), dragListener); 465 DragUtil.addDragTarget(getControl(), fastViewDragTarget); 466 467 update(true); 468 } 469 470 478 private IDropTarget createDropTarget(List viewList, ToolItem targetItem) { 479 if (dropTarget == null) { 480 dropTarget = new ViewDropTarget(viewList, targetItem); 481 } else { 482 dropTarget.setTarget(viewList, targetItem); 483 } 484 return dropTarget; 485 } 486 487 493 protected void startDraggingFastView(IViewReference ref, Point position, 494 boolean usingKeyboard) { 495 ViewPane pane = (ViewPane) ((WorkbenchPartReference) ref).getPane(); 496 497 ToolItem item = itemFor(pane.getViewReference()); 498 499 Rectangle dragRect = Geometry.toDisplay(getToolBar(), item.getBounds()); 500 501 startDrag(((WorkbenchPartReference) ref).getPane(), dragRect, position, 502 usingKeyboard); 503 } 504 505 private void startDrag(Object toDrag, Rectangle dragRect, Point position, 506 boolean usingKeyboard) { 507 508 Perspective persp = getPerspective(); 509 510 WorkbenchPage page = getPage(); 511 512 IViewReference oldFastView = null; 513 if (persp != null) { 514 oldFastView = persp.getActiveFastView(); 515 516 if (page != null) { 517 page.hideFastView(); 518 } 519 } 520 521 if (page.isZoomed()) { 522 page.zoomOut(); 523 } 524 525 boolean success = DragUtil.performDrag(toDrag, dragRect, position, 526 !usingKeyboard); 527 528 if (!success && oldFastView != null && page != null) { 530 page.toggleFastView(oldFastView); 531 } 532 } 533 534 540 protected void startDraggingFastViewBar(Point position, 541 boolean usingKeyboard) { 542 Rectangle dragRect = DragUtil.getDisplayBounds(fvbComposite); 543 544 startDrag(this, dragRect, position, usingKeyboard); 545 } 546 547 550 private ToolBar getToolBar() { 551 return fastViewBar.getControl(); 552 } 553 554 private IViewReference getViewFor(ToolItem item) { 555 if (item == null) { 556 return null; 557 } 558 559 return (IViewReference) item 560 .getData(ShowFastViewContribution.FAST_VIEW); 561 } 562 563 569 private IViewReference getViewAt(Point position) { 570 return getViewFor(getToolItem(position)); 571 } 572 573 577 private ToolItem getToolItem(Point position) { 578 ToolBar toolbar = getToolBar(); 579 Point local = toolbar.toControl(position); 580 return toolbar.getItem(local); 581 } 582 583 586 private void showFastViewBarPopup(Point pt) { 587 589 ToolBar toolBar = getToolBar(); 590 591 Menu menu = fastViewBarMenuManager.createContextMenu(toolBar); 592 593 IViewReference selectedView = getViewAt(pt); 594 contextContributionItem.setTarget(selectedView); 595 596 menu.setLocation(pt.x, pt.y); 597 menu.setVisible(true); 598 } 599 600 603 private void showAddFastViewPopup(Point pt) { 604 Menu menu = newFastViewMenuMgr.createContextMenu(menuTB); 605 menu.setLocation(pt.x, pt.y); 606 menu.setVisible(true); 607 } 608 609 public int getOrientation(IViewReference ref) { 610 return isHorizontal(ref) ? SWT.HORIZONTAL : SWT.VERTICAL; 611 } 612 613 620 public Control getControl() { 621 return fvbComposite; 622 } 623 624 public void dispose() { 625 fastViewBarMenuManager.dispose(); 626 627 disposeChildControls(); 628 } 629 630 protected void disposeChildControls() { 631 fastViewBar.dispose(); 632 fastViewBar = null; 633 634 if (menuItem != null) { 635 menuItem.dispose(); 636 menuTB.dispose(); 637 } 638 639 oldLength = 0; 640 } 641 642 643 649 public void update(boolean force) { 650 fastViewBar.update(force); 651 ToolItem[] items = fastViewBar.getControl().getItems(); 652 653 updateLayoutData(); 654 655 for (int idx = 0; idx < items.length; idx++) { 656 IViewReference view = getViewFor(items[idx]); 657 658 viewOrientation.put(view.getId(), new Integer ( 659 isHorizontal(view) ? SWT.HORIZONTAL : SWT.VERTICAL)); 660 } 661 } 662 663 private void updateLayoutData() { 664 ToolItem[] items = fastViewBar.getControl().getItems(); 665 boolean isHorizontal = Geometry.isHorizontal(getSide()); 666 boolean shouldExpand = items.length > 0; 667 668 Point hint = new Point(32, shouldExpand ? SWT.DEFAULT : HIDDEN_WIDTH); 669 670 if (!isHorizontal) { 671 Geometry.flipXY(hint); 672 } 673 674 if (shouldExpand) { 675 toolBarData.setHint(CellData.MINIMUM, hint); 676 } else { 677 toolBarData.setHint(CellData.OVERRIDE, hint); 678 } 679 680 if (items.length != oldLength) { 681 LayoutUtil.resize(fvbComposite); 682 oldLength = items.length; 683 } 684 } 685 686 691 public IViewReference getSelection() { 692 return selection; 693 } 694 695 700 public void setSelection(IViewReference selected) { 701 702 ToolItem[] items = fastViewBar.getControl().getItems(); 703 for (int i = 0; i < items.length; i++) { 704 ToolItem item = items[i]; 705 item.setSelection(getView(item) == selected); 706 } 707 708 selection = selected; 709 } 710 711 716 private IViewReference getView(ToolItem item) { 717 return (IViewReference) item 718 .getData(ShowFastViewContribution.FAST_VIEW); 719 } 720 721 private int getIndex(IViewReference toFind) { 722 ToolItem[] items = fastViewBar.getControl().getItems(); 723 for (int i = 0; i < items.length; i++) { 724 if (items[i].getData(ShowFastViewContribution.FAST_VIEW) == toFind) { 725 return i; 726 } 727 } 728 729 return items.length; 730 } 731 732 private ToolItem getItem(int idx) { 733 ToolItem[] items = fastViewBar.getControl().getItems(); 734 if (idx >= items.length) { 735 return null; 736 } 737 738 return items[idx]; 739 } 740 741 746 private ToolItem itemFor(IViewReference toFind) { 747 return getItem(getIndex(toFind)); 748 } 749 750 753 public int getValidSides() { 754 return SWT.TOP | SWT.LEFT | SWT.RIGHT | SWT.BOTTOM; 755 } 756 757 760 public void dock(int side) { 761 fCurrentSide = side; 762 disposeChildControls(); 763 createChildControls(); 764 } 765 766 770 public int getSide() { 771 if (fCurrentSide==SWT.DEFAULT) { 772 fCurrentSide = getInitialSide(); 773 } 774 return fCurrentSide; 775 } 776 777 778 private boolean isHorizontal(IViewReference ref) { 779 Integer orientation = (Integer ) viewOrientation.get(ref.getId()); 780 boolean horizontalBar = Geometry.isHorizontal(getSide()); 781 boolean horizontal = horizontalBar; 782 if (orientation != null) { 783 horizontal = orientation.intValue() == SWT.HORIZONTAL; 784 } else { 785 horizontal = false; 786 } 787 788 return horizontal; 789 } 790 791 794 public int getViewSide(IViewReference ref) { 795 boolean horizontal = isHorizontal(ref); 796 797 if (horizontal) { 798 return (getSide() == SWT.BOTTOM) ? SWT.BOTTOM : SWT.TOP; 799 } 800 801 return (getSide() == SWT.RIGHT) ? SWT.RIGHT : SWT.LEFT; 802 } 803 804 public void saveState(IMemento memento) { 805 memento.putInteger(IWorkbenchConstants.TAG_FAST_VIEW_SIDE, getSide()); 806 807 Iterator iter = viewOrientation.keySet().iterator(); 808 while (iter.hasNext()) { 809 String next = (String ) iter.next(); 810 IMemento orientation = memento 811 .createChild(IWorkbenchConstants.TAG_FAST_VIEW_ORIENTATION); 812 813 orientation.putString(IWorkbenchConstants.TAG_VIEW, next); 814 orientation.putInteger(IWorkbenchConstants.TAG_POSITION, 815 ((Integer ) viewOrientation.get(next)).intValue()); 816 } 817 818 } 819 820 824 public Rectangle getLocationOfNextIcon() { 825 ToolBar control = getToolBar(); 826 827 Rectangle result = control.getBounds(); 828 Point size = control.computeSize(SWT.DEFAULT, SWT.DEFAULT, false); 829 result.height = size.y; 830 result.width = size.x; 831 832 boolean horizontal = Geometry.isHorizontal(getSide()); 833 if (control.getItemCount() == 0) { 834 Geometry.setDimension(result, horizontal, 0); 835 } 836 837 int hoverSide = horizontal ? SWT.RIGHT : SWT.BOTTOM; 838 839 result = Geometry.getExtrudedEdge(result, -Geometry.getDimension( 840 result, !horizontal), hoverSide); 841 842 return Geometry.toDisplay(control.getParent(), result); 843 } 844 845 public void restoreState(IMemento memento) { 846 Integer bigInt; 847 bigInt = memento.getInteger(IWorkbenchConstants.TAG_FAST_VIEW_SIDE); 848 if (bigInt != null) { 849 dock(bigInt.intValue()); 850 } 851 852 IMemento[] orientations = memento 853 .getChildren(IWorkbenchConstants.TAG_FAST_VIEW_ORIENTATION); 854 for (int i = 0; i < orientations.length; i++) { 855 IMemento next = orientations[i]; 856 857 viewOrientation.put(next.getString(IWorkbenchConstants.TAG_VIEW), 858 next.getInteger(IWorkbenchConstants.TAG_POSITION)); 859 } 860 } 861 862 public WorkbenchWindow getWindow() { 863 return window; 864 } 865 866 public void restoreView(IViewReference selectedView) { 867 if (selectedView != null) { 868 WorkbenchPage page = window.getActiveWorkbenchPage(); 869 if (page != null) { 870 int idx = getIndex(selectedView); 871 ToolItem item = getItem(idx); 872 Rectangle bounds = item.getBounds(); 873 Rectangle startBounds = Geometry.toDisplay(item 874 .getParent(), bounds); 875 876 Perspective persp = getPerspective(); 877 if (persp != null) { 878 persp.getFastViewManager().removeViewReference(selectedView, true, true); 879 } 880 881 IWorkbenchPart toActivate = selectedView 882 .getPart(true); 883 if (toActivate != null) { 884 page.activate(toActivate); 885 } 886 887 ViewPane pane = (ViewPane) ((WorkbenchPartReference) selectedView) 888 .getPane(); 889 890 RectangleAnimation animation = new RectangleAnimation( 891 window.getShell(), startBounds, pane 892 .getParentBounds()); 893 894 animation.schedule(); 895 } 896 } 897 } 898 899 902 public List getViewRefs() { 903 List refs = new ArrayList (fastViewBar.getControl().getItemCount()); 904 ToolItem[] items = fastViewBar.getControl().getItems(); 905 for (int i = 0; i < items.length; i++) { 906 Object data = items[i].getData(ShowFastViewContribution.FAST_VIEW); 907 if (data != null) 908 refs.add(data); 909 } 910 911 return refs; 912 } 913 914 917 public boolean isCloseable() { 918 return false; 919 } 920 921 924 public void handleClose() { 925 } 927 928 931 public String getId() { 932 return "org.eclise.ui.internal.FastViewBar"; } 934 935 938 public String getDisplayName() { 939 return WorkbenchMessages.TrimCommon_FastView_TrimName; 940 } 941 942 949 public FastViewBarContextMenuContribution testContextMenu() { 950 return contextContributionItem; 951 } 952 953 956 public int getWidthHint() { 957 return SWT.DEFAULT; 958 } 959 960 963 public int getHeightHint() { 964 return SWT.DEFAULT; 965 } 966 967 970 public boolean isResizeable() { 971 return false; 972 } 973 } 974 | Popular Tags |