Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 290303 | Differences between
and this patch

Collapse All | Expand All

(-)Eclipse UI/org/eclipse/ui/internal/layout/TrimCommonUIHandle.java (-22 / +22 lines)
Lines 20-28 Link Here
20
import org.eclipse.swt.events.SelectionListener;
20
import org.eclipse.swt.events.SelectionListener;
21
import org.eclipse.swt.graphics.Point;
21
import org.eclipse.swt.graphics.Point;
22
import org.eclipse.swt.widgets.Composite;
22
import org.eclipse.swt.widgets.Composite;
23
import org.eclipse.swt.widgets.Control;
23
import org.eclipse.swt.widgets.CoolBar;
24
import org.eclipse.swt.widgets.CoolBar;
24
import org.eclipse.swt.widgets.CoolItem;
25
import org.eclipse.swt.widgets.CoolItem;
26
import org.eclipse.swt.widgets.Event;
25
import org.eclipse.swt.widgets.Label;
27
import org.eclipse.swt.widgets.Label;
28
import org.eclipse.swt.widgets.Listener;
26
import org.eclipse.swt.widgets.Menu;
29
import org.eclipse.swt.widgets.Menu;
27
import org.eclipse.swt.widgets.MenuItem;
30
import org.eclipse.swt.widgets.MenuItem;
28
import org.eclipse.ui.internal.IChangeListener;
31
import org.eclipse.ui.internal.IChangeListener;
Lines 63-70 Link Here
63
	 */
66
	 */
64
	private TrimLayout  layout;
67
	private TrimLayout  layout;
65
    private IWindowTrim trim;
68
    private IWindowTrim trim;
66
    // RAP [bm]:
69
	private Control     toDrag;
67
//	private Control     toDrag;
68
	private int orientation;
70
	private int orientation;
69
71
70
	// CoolBar handling
72
	// CoolBar handling
Lines 82-89 Link Here
82
	private MenuItem dockCascade;
84
	private MenuItem dockCascade;
83
    private RadioMenu radioButtons;
85
    private RadioMenu radioButtons;
84
    private IntModel radioVal = new IntModel(0);
86
    private IntModel radioVal = new IntModel(0);
85
//	private Menu showMenu;
87
	private Menu showMenu;
86
//	private MenuItem showCascade;
88
	private MenuItem showCascade;
87
89
88
	/*
90
	/*
89
	 * Listeners...
91
	 * Listeners...
Lines 107-121 Link Here
107
    /**
109
    /**
108
     * This listener brings up the context menu
110
     * This listener brings up the context menu
109
     */
111
     */
110
    // RAP [bm]:
112
    private Listener menuListener = new Listener() {
111
//    private Listener menuListener = new Listener() {
113
        public void handleEvent(Event event) {
112
//        public void handleEvent(Event event) {
114
            Point loc = new Point(event.x, event.y);
113
//            Point loc = new Point(event.x, event.y);
115
            if (event.type == SWT.MenuDetect) {
114
//            if (event.type == SWT.MenuDetect) {
116
                showDockTrimPopup(loc);
115
//                showDockTrimPopup(loc);
117
            }
116
//            }
118
        }
117
//        }
119
    };
118
//    };
119
120
120
    /**
121
    /**
121
     * Listen to size changes in the control so we can adjust the
122
     * Listen to size changes in the control so we can adjust the
Lines 499-511 Link Here
499
//        DragUtil.performDrag(trim, fakeBounds, position, true);
500
//        DragUtil.performDrag(trim, fakeBounds, position, true);
500
//    }
501
//    }
501
502
502
    // RAP [bm]:
503
    /**
503
//    /**
504
     * Shows the popup menu for an item in the fast view bar.
504
//     * Shows the popup menu for an item in the fast view bar.
505
     */
505
//     */
506
    private void showDockTrimPopup(Point pt) {
506
//    private void showDockTrimPopup(Point pt) {
507
        Menu menu = dockMenuManager.createContextMenu(toDrag);
507
//        Menu menu = dockMenuManager.createContextMenu(toDrag);
508
        menu.setLocation(pt.x, pt.y);
508
//        menu.setLocation(pt.x, pt.y);
509
        menu.setVisible(true);
509
//        menu.setVisible(true);
510
    }
510
//    }
511
}
511
}
(-)Eclipse UI/org/eclipse/ui/internal/presentations/util/AbstractTabFolder.java (-24 / +21 lines)
Lines 51-66 Link Here
51
    public abstract void enablePaneMenu(boolean enabled);
51
    public abstract void enablePaneMenu(boolean enabled);
52
    private int activeState = IStackPresentationSite.STATE_RESTORED;
52
    private int activeState = IStackPresentationSite.STATE_RESTORED;
53
    
53
    
54
    // RAP [bm]: 
54
	private Listener menuListener = new Listener() {
55
//	private Listener menuListener = new Listener() {
55
		/* (non-Javadoc)
56
//		/* (non-Javadoc)
56
		 * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
57
//		 * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
57
		 */
58
//		 */
58
		public void handleEvent(Event event) {
59
//		public void handleEvent(Event event) {
59
			Point globalPos = new Point(event.x, event.y);
60
//			Point globalPos = new Point(event.x, event.y);
60
		    handleContextMenu(globalPos, event);			
61
//		    handleContextMenu(globalPos, event);			
61
		}
62
//		}
62
	};
63
//	};
64
63
65
    // RAP [bm]: DnD not supported
64
    // RAP [bm]: DnD not supported
66
//    private Listener dragListener = new Listener() {
65
//    private Listener dragListener = new Listener() {
Lines 300-307 Link Here
300
    }
299
    }
301
    
300
    
302
    protected void attachListeners(Control theControl, boolean recursive) {
301
    protected void attachListeners(Control theControl, boolean recursive) {
303
    	// RAP [bm]: 
302
        theControl.addListener(SWT.MenuDetect, menuListener);
304
//        theControl.addListener(SWT.MenuDetect, menuListener);
305
// RAP [rh] part activation via mouse listeners does not work reliably (see also DefaultTabFolder ctor)    	
303
// RAP [rh] part activation via mouse listeners does not work reliably (see also DefaultTabFolder ctor)    	
306
//        theControl.addMouseListener(mouseListener);
304
//        theControl.addMouseListener(mouseListener);
307
// RAP [rh] replace 'manual' double-click detection with default-selected    	
305
// RAP [rh] replace 'manual' double-click detection with default-selected    	
Lines 322-329 Link Here
322
    }
320
    }
323
    
321
    
324
    protected void detachListeners(Control theControl, boolean recursive) {
322
    protected void detachListeners(Control theControl, boolean recursive) {
325
    	// RAP [bm]: 
323
        theControl.removeListener(SWT.MenuDetect, menuListener);
326
//        theControl.removeListener(SWT.MenuDetect, menuListener);
327
// RAP [rh] part activation via mouse listeners does not work reliably (see also DefaultTabFolder ctor)    	
324
// RAP [rh] part activation via mouse listeners does not work reliably (see also DefaultTabFolder ctor)    	
328
//        theControl.removeMouseListener(mouseListener);
325
//        theControl.removeMouseListener(mouseListener);
329
// RAP [rh] replace 'manual' double-click detection with default-selected    	
326
// RAP [rh] replace 'manual' double-click detection with default-selected    	
Lines 343-359 Link Here
343
        }
340
        }
344
    }
341
    }
345
    
342
    
343
    protected void handleContextMenu(Point displayPos, Event e) {
344
        if (isOnBorder(displayPos)) {
345
            return;
346
        }
347
348
        AbstractTabItem tab = getItem(displayPos); 
349
        
350
        fireEvent(TabFolderEvent.EVENT_SYSTEM_MENU, tab, displayPos);
351
    }
352
    
346
// RAP [rh] unused code: MouseListener deactivated    
353
// RAP [rh] unused code: MouseListener deactivated    
347
//    protected void handleContextMenu(Point displayPos, Event e) {
348
//        if (isOnBorder(displayPos)) {
349
//            return;
350
//        }
351
//
352
//        AbstractTabItem tab = getItem(displayPos); 
353
//        
354
//        fireEvent(TabFolderEvent.EVENT_SYSTEM_MENU, tab, displayPos);
355
//    }
356
//    
357
//    protected void handleMouseDown(Point displayPos, MouseEvent e) {
354
//    protected void handleMouseDown(Point displayPos, MouseEvent e) {
358
//        fireEvent(TabFolderEvent.EVENT_GIVE_FOCUS_TO_PART);
355
//        fireEvent(TabFolderEvent.EVENT_GIVE_FOCUS_TO_PART);
359
//    }
356
//    }
(-)Eclipse UI/org/eclipse/ui/internal/PerspectiveSwitcher.java (-354 / +341 lines)
Lines 12-19 Link Here
12
 *******************************************************************************/
12
 *******************************************************************************/
13
package org.eclipse.ui.internal;
13
package org.eclipse.ui.internal;
14
14
15
import java.util.Arrays;
16
import java.util.HashMap;
15
import java.util.StringTokenizer;
17
import java.util.StringTokenizer;
16
18
19
import org.eclipse.core.commands.Command;
20
import org.eclipse.core.commands.ExecutionException;
21
import org.eclipse.core.commands.NotEnabledException;
22
import org.eclipse.core.commands.NotHandledException;
23
import org.eclipse.core.commands.ParameterizedCommand;
24
import org.eclipse.core.commands.common.NotDefinedException;
17
import org.eclipse.core.runtime.Assert;
25
import org.eclipse.core.runtime.Assert;
18
import org.eclipse.jface.action.IContributionItem;
26
import org.eclipse.jface.action.IContributionItem;
19
import org.eclipse.jface.preference.IPreferenceStore;
27
import org.eclipse.jface.preference.IPreferenceStore;
Lines 27-32 Link Here
27
import org.eclipse.swt.events.DisposeListener;
35
import org.eclipse.swt.events.DisposeListener;
28
import org.eclipse.swt.events.SelectionAdapter;
36
import org.eclipse.swt.events.SelectionAdapter;
29
import org.eclipse.swt.events.SelectionEvent;
37
import org.eclipse.swt.events.SelectionEvent;
38
import org.eclipse.swt.events.SelectionListener;
30
import org.eclipse.swt.graphics.Point;
39
import org.eclipse.swt.graphics.Point;
31
import org.eclipse.swt.graphics.Rectangle;
40
import org.eclipse.swt.graphics.Rectangle;
32
import org.eclipse.swt.layout.GridData;
41
import org.eclipse.swt.layout.GridData;
Lines 34-41 Link Here
34
import org.eclipse.swt.widgets.Control;
43
import org.eclipse.swt.widgets.Control;
35
import org.eclipse.swt.widgets.CoolBar;
44
import org.eclipse.swt.widgets.CoolBar;
36
import org.eclipse.swt.widgets.CoolItem;
45
import org.eclipse.swt.widgets.CoolItem;
46
import org.eclipse.swt.widgets.Event;
37
import org.eclipse.swt.widgets.Label;
47
import org.eclipse.swt.widgets.Label;
38
import org.eclipse.swt.widgets.Listener;
48
import org.eclipse.swt.widgets.Listener;
49
import org.eclipse.swt.widgets.Menu;
50
import org.eclipse.swt.widgets.MenuItem;
39
import org.eclipse.swt.widgets.ToolBar;
51
import org.eclipse.swt.widgets.ToolBar;
40
import org.eclipse.swt.widgets.ToolItem;
52
import org.eclipse.swt.widgets.ToolItem;
41
import org.eclipse.ui.IMemento;
53
import org.eclipse.ui.IMemento;
Lines 45-50 Link Here
45
import org.eclipse.ui.IWorkbenchPreferenceConstants;
57
import org.eclipse.ui.IWorkbenchPreferenceConstants;
46
import org.eclipse.ui.IWorkbenchWindow;
58
import org.eclipse.ui.IWorkbenchWindow;
47
import org.eclipse.ui.PerspectiveAdapter;
59
import org.eclipse.ui.PerspectiveAdapter;
60
import org.eclipse.ui.commands.ICommandService;
61
import org.eclipse.ui.handlers.IHandlerService;
48
import org.eclipse.ui.internal.StartupThreading.StartupRunnable;
62
import org.eclipse.ui.internal.StartupThreading.StartupRunnable;
49
import org.eclipse.ui.internal.layout.CacheWrapper;
63
import org.eclipse.ui.internal.layout.CacheWrapper;
50
import org.eclipse.ui.internal.layout.CellLayout;
64
import org.eclipse.ui.internal.layout.CellLayout;
Lines 105-115 Link Here
105
119
106
    // The menus are cached, so the radio buttons should not be disposed until
120
    // The menus are cached, so the radio buttons should not be disposed until
107
    // the switcher is disposed.
121
    // the switcher is disposed.
108
    // RAP [bm]: 
122
    private Menu popupMenu;
109
//    private Menu popupMenu;
123
110
//
124
    private Menu genericMenu;
111
//    private Menu genericMenu;
112
    // RAPEND: [bm] 
113
125
114
    private static final int INITIAL = -1;
126
    private static final int INITIAL = -1;
115
127
Lines 126-140 Link Here
126
138
127
    private IPropertyChangeListener propertyChangeListener;
139
    private IPropertyChangeListener propertyChangeListener;
128
140
129
    // RAP [bm]: 
141
    private Listener popupListener = new Listener() {
130
//    private Listener popupListener = new Listener() {
142
        public void handleEvent(Event event) {
131
//        public void handleEvent(Event event) {
143
            if (event.type == SWT.MenuDetect) {
132
//            if (event.type == SWT.MenuDetect) {
144
                showPerspectiveBarPopup(new Point(event.x, event.y));
133
//        	if (event.button == 2) {
145
            }
134
//                showPerspectiveBarPopup(new Point(event.x, event.y));
146
        }
135
//            }
147
    };
136
//        }
137
//    };
138
148
139
    class ChangeListener extends PerspectiveAdapter implements IPageListener {
149
    class ChangeListener extends PerspectiveAdapter implements IPageListener {
140
        public void perspectiveOpened(IWorkbenchPage page,
150
        public void perspectiveOpened(IWorkbenchPage page,
Lines 727-736 Link Here
727
        perspectiveBar = createBarManager(SWT.VERTICAL);
737
        perspectiveBar = createBarManager(SWT.VERTICAL);
728
738
729
        perspectiveBar.createControl(trimControl);
739
        perspectiveBar.createControl(trimControl);
730
        // RAP [bm]: 
740
        perspectiveBar.getControl().addListener(SWT.MenuDetect, popupListener);
731
//        perspectiveBar.getControl().addListener(SWT.MenuDetect, popupListener);
732
//        perspectiveBar.getControl().addListener(SWT.MouseUp, popupListener);
733
        // RAPEND: [bm]
734
        // the following code is commented out by Platform itself, not RAP
741
        // the following code is commented out by Platform itself, not RAP
735
742
736
//        trimSeparator = new Label(trimControl, SWT.SEPARATOR | SWT.HORIZONTAL);
743
//        trimSeparator = new Label(trimControl, SWT.SEPARATOR | SWT.HORIZONTAL);
Lines 776-785 Link Here
776
            }
783
            }
777
        });
784
        });
778
        coolItem.setMinimumSize(0, 0);
785
        coolItem.setMinimumSize(0, 0);
779
        // RAP [bm]: 
786
        perspectiveBar.getControl().addListener(SWT.MenuDetect, popupListener);
780
//        perspectiveBar.getControl().addListener(SWT.MenuDetect, popupListener);
781
//        perspectiveBar.getControl().addListener(SWT.MouseUp, popupListener);
782
        // RAPEND: [bm] 
783
787
784
    }
788
    }
785
789
Lines 820-975 Link Here
820
        coolItem.setSize(coolItem.computeSize(w, h));
824
        coolItem.setSize(coolItem.computeSize(w, h));
821
    }
825
    }
822
826
823
    // RAP [bm]: 
827
    private void showPerspectiveBarPopup(Point pt) {
824
//    private void showPerspectiveBarPopup(Point pt) {
828
        if (perspectiveBar == null) {
825
//        if (perspectiveBar == null) {
829
			return;
826
//			return;
830
		}
827
//		}
831
828
//
832
        // Get the tool item under the mouse.
829
//        // Get the tool item under the mouse.
833
        ToolBar toolBar = perspectiveBar.getControl();
830
//        ToolBar toolBar = perspectiveBar.getControl();
834
        ToolItem toolItem = toolBar.getItem(toolBar.toControl(pt));
831
//        ToolItem toolItem = toolBar.getItem(toolBar.toControl(pt));
835
832
//        ToolItem toolItem = null;
836
        // Get the action for the tool item.
833
//
837
        Object data = null;
834
//        // Get the action for the tool item.
838
        if (toolItem != null){
835
//        Object data = null;
839
            data = toolItem.getData();
836
//        if (toolItem != null){
840
        }
837
//            data = toolItem.getData();
841
        if (toolItem == null
838
//        }
842
                || !(data instanceof PerspectiveBarContributionItem)) {
839
//        if (toolItem == null
843
            if (genericMenu == null) {
840
//                || !(data instanceof PerspectiveBarContributionItem)) {
844
                Menu menu = new Menu(toolBar);
841
//            if (genericMenu == null) {
845
                addDockOnSubMenu(menu);
842
//                Menu menu = new Menu(toolBar);
846
                addShowTextItem(menu);
843
//                addDockOnSubMenu(menu);
847
                genericMenu = menu;
844
//                addShowTextItem(menu);
848
            }
845
//                genericMenu = menu;
849
846
//            }
850
            // set the state of the menu items to match the preferences
847
//
851
            genericMenu
848
//            // set the state of the menu items to match the preferences
852
                    .getItem(1)
849
//            genericMenu
853
                    .setSelection(
850
//                    .getItem(1)
854
                            PrefUtil
851
//                    .setSelection(
855
                                    .getAPIPreferenceStore()
852
//                            PrefUtil
856
                                    .getBoolean(
853
//                                    .getAPIPreferenceStore()
857
                                            IWorkbenchPreferenceConstants.SHOW_TEXT_ON_PERSPECTIVE_BAR));
854
//                                    .getBoolean(
858
            updateLocationItems(genericMenu.getItem(0).getMenu(),
855
//                                            IWorkbenchPreferenceConstants.SHOW_TEXT_ON_PERSPECTIVE_BAR));
859
                    currentLocation);
856
//            updateLocationItems(genericMenu.getItem(0).getMenu(),
860
857
//                    currentLocation);
861
            // Show popup menu.
858
//
862
            genericMenu.setLocation(pt.x, pt.y);
859
//            // Show popup menu.
863
            genericMenu.setVisible(true);
860
//            genericMenu.setLocation(pt.x, pt.y);
864
            return;
861
//            genericMenu.setVisible(true);
865
        }
862
//            return;
866
863
//        }
867
        if (data == null || !(data instanceof PerspectiveBarContributionItem)) {
864
//
868
			return;
865
//        if (data == null || !(data instanceof PerspectiveBarContributionItem)) {
869
		}
866
//			return;
870
867
//		}
871
        PerspectiveBarContributionItem pbci = (PerspectiveBarContributionItem) data;
868
//
872
        IPerspectiveDescriptor selectedPerspective = pbci.getPerspective();
869
//        PerspectiveBarContributionItem pbci = (PerspectiveBarContributionItem) data;
873
870
//        IPerspectiveDescriptor selectedPerspective = pbci.getPerspective();
874
        // The perspective bar menu is created lazily here.
871
//
875
        // Its data is set (each time) to the tool item, which refers to the SetPagePerspectiveAction
872
//        // The perspective bar menu is created lazily here.
876
        // which in turn refers to the page and perspective.
873
//        // Its data is set (each time) to the tool item, which refers to the SetPagePerspectiveAction
877
        // It is important not to refer to the action, the page or the perspective directly
874
//        // which in turn refers to the page and perspective.
878
        // since otherwise the menu hangs on to them after they are closed.
875
//        // It is important not to refer to the action, the page or the perspective directly
879
        // By hanging onto the tool item instead, these references are cleared when the
876
//        // since otherwise the menu hangs on to them after they are closed.
880
        // corresponding page or perspective is closed.
877
//        // By hanging onto the tool item instead, these references are cleared when the
881
        // See bug 11282 for more details on why it is done this way.
878
//        // corresponding page or perspective is closed.
882
        if (popupMenu != null) {
879
//        // See bug 11282 for more details on why it is done this way.
883
        	popupMenu.dispose();
880
//        if (popupMenu != null) {
884
        	popupMenu = null;
881
//        	popupMenu.dispose();
885
        }
882
//        	popupMenu = null;
886
        popupMenu = createPopup(toolBar, selectedPerspective);
883
//        }
887
        popupMenu.setData(toolItem);
884
//        popupMenu = createPopup(toolBar, selectedPerspective);
888
        
885
//        popupMenu.setData(toolItem);
889
        // Show popup menu.
886
//        
890
        popupMenu.setLocation(pt.x, pt.y);
887
//        // Show popup menu.
891
        popupMenu.setVisible(true);
888
//        popupMenu.setLocation(pt.x, pt.y);
892
    }
889
//        popupMenu.setVisible(true);
893
890
//    }
894
    /**
891
895
     * @param persp the perspective
892
    // RAP [bm]: 
896
     * @return <code>true</code> if the perspective is active in the active page 
893
//    /**
897
     */
894
//     * @param persp the perspective
898
    private boolean perspectiveIsActive(IPerspectiveDescriptor persp) {
895
//     * @return <code>true</code> if the perspective is active in the active page 
899
    	IWorkbenchPage page = window.getActivePage();
896
//     */
900
        return page != null && persp.equals(page.getPerspective());
897
//    private boolean perspectiveIsActive(IPerspectiveDescriptor persp) {
901
    }
898
//    	IWorkbenchPage page = window.getActivePage();
902
899
//        return page != null && persp.equals(page.getPerspective());
903
    /**
900
//    }
904
     * @param persp the perspective
901
905
     * @return <code>true</code> if the perspective is open in the active page 
902
    // RAP [bm]: 
906
     */
903
//    /**
907
    private boolean perspectiveIsOpen(IPerspectiveDescriptor persp) {
904
//     * @param persp the perspective
908
    	IWorkbenchPage page = window.getActivePage();
905
//     * @return <code>true</code> if the perspective is open in the active page 
909
    	return page != null && Arrays.asList(page.getOpenPerspectives()).contains(persp);
906
//     */
910
    }
907
//    private boolean perspectiveIsOpen(IPerspectiveDescriptor persp) {
911
908
//    	IWorkbenchPage page = window.getActivePage();
912
	private Menu createPopup(ToolBar toolBar, IPerspectiveDescriptor persp){
909
//    	return page != null && Arrays.asList(page.getOpenPerspectives()).contains(persp);
913
		Menu menu = new Menu(toolBar);
910
//    }
914
		if (perspectiveIsActive(persp)) {
911
915
			addCustomizeItem(menu);
912
    // RAP [bm]: 
916
			addSaveAsItem(menu);
913
//	private Menu createPopup(ToolBar toolBar, IPerspectiveDescriptor persp){
917
			addResetItem(menu);
914
//		Menu menu = new Menu(toolBar);
918
		}
915
//		if (perspectiveIsActive(persp)) {
919
		if (perspectiveIsOpen(persp)) {
916
//			addCustomizeItem(menu);
920
			addCloseItem(menu);
917
//			addSaveAsItem(menu);
921
		}
918
//			addResetItem(menu);
922
919
//		}
923
		new MenuItem(menu, SWT.SEPARATOR);
920
//		if (perspectiveIsOpen(persp)) {
924
		addDockOnSubMenu(menu);
921
//			addCloseItem(menu);
925
		addShowTextItem(menu);
922
//		}
926
		return menu;
923
//
927
	}
924
//		new MenuItem(menu, SWT.SEPARATOR);
928
925
//		addDockOnSubMenu(menu);
929
    private void addCloseItem(Menu menu) {
926
//		addShowTextItem(menu);
930
        MenuItem menuItem = new MenuItem(menu, SWT.NONE);
927
//		return menu;
931
        menuItem.setText(WorkbenchMessages.get().WorkbenchWindow_close);
928
//	}
932
        window.getWorkbench().getHelpSystem().setHelp(menuItem,
929
933
        		IWorkbenchHelpContextIds.CLOSE_PAGE_ACTION);
930
    // RAP [bm]: 
934
        menuItem.addSelectionListener(new SelectionAdapter() {
931
//    private void addCloseItem(Menu menu) {
935
			private static final String COMMAND_CLOSE_PERSP = "org.eclipse.ui.window.closePerspective"; //$NON-NLS-1$
932
//        MenuItem menuItem = new MenuItem(menu, SWT.NONE);
936
			private static final String PARAMETER_CLOSE_PERSP_ID = "org.eclipse.ui.window.closePerspective.perspectiveId"; //$NON-NLS-1$
933
//        menuItem.setText(WorkbenchMessages.get().WorkbenchWindow_close);
937
934
//        // RAP [bm]: HelpSystem
938
			public void widgetSelected(SelectionEvent e) {
935
////        window.getWorkbench().getHelpSystem().setHelp(menuItem,
939
                ToolItem perspectiveToolItem = (ToolItem) popupMenu
936
////        		IWorkbenchHelpContextIds.CLOSE_PAGE_ACTION);
940
                        .getData();
937
//        // RAPEND: [bm] 
941
938
//        menuItem.addSelectionListener(new SelectionAdapter() {
942
                if (perspectiveToolItem != null
939
//			private static final String COMMAND_CLOSE_PERSP = "org.eclipse.ui.window.closePerspective"; //$NON-NLS-1$
943
						&& !perspectiveToolItem.isDisposed()) {
940
//			private static final String PARAMETER_CLOSE_PERSP_ID = "org.eclipse.ui.window.closePerspective.perspectiveId"; //$NON-NLS-1$
944
					PerspectiveBarContributionItem item = (PerspectiveBarContributionItem) perspectiveToolItem
941
//
945
							.getData();
942
//			public void widgetSelected(SelectionEvent e) {
946
					IPerspectiveDescriptor persp = item.getPerspective();
943
//                ToolItem perspectiveToolItem = (ToolItem) popupMenu
947
					
944
//                        .getData();
948
					ICommandService commandService = (ICommandService) window.getService(ICommandService.class);
945
//
949
					Command command = commandService.getCommand(COMMAND_CLOSE_PERSP);
946
//                if (perspectiveToolItem != null
950
					
947
//						&& !perspectiveToolItem.isDisposed()) {
951
					HashMap parameters = new HashMap();
948
//					PerspectiveBarContributionItem item = (PerspectiveBarContributionItem) perspectiveToolItem
952
					parameters.put(PARAMETER_CLOSE_PERSP_ID, persp.getId());
949
//							.getData();
953
					
950
//					IPerspectiveDescriptor persp = item.getPerspective();
954
					ParameterizedCommand pCommand = ParameterizedCommand.generateCommand(command, parameters);
951
//					
955
					
952
//					ICommandService commandService = (ICommandService) window.getService(ICommandService.class);
956
					IHandlerService handlerService = (IHandlerService) window
953
//					Command command = commandService.getCommand(COMMAND_CLOSE_PERSP);
957
							.getService(IHandlerService.class);
954
//					
958
					try {
955
//					HashMap parameters = new HashMap();
959
						handlerService.executeCommand(pCommand, new Event());
956
//					parameters.put(PARAMETER_CLOSE_PERSP_ID, persp.getId());
960
					} catch (ExecutionException e1) {
957
//					
961
					} catch (NotDefinedException e1) {
958
//					ParameterizedCommand pCommand = ParameterizedCommand.generateCommand(command, parameters);
962
					} catch (NotEnabledException e1) {
959
//					
963
					} catch (NotHandledException e1) {
960
//					IHandlerService handlerService = (IHandlerService) window
964
					}
961
//							.getService(IHandlerService.class);
965
                }
962
//					try {
966
            }
963
//						handlerService.executeCommand(pCommand, new Event());
967
        });
964
//					} catch (ExecutionException e1) {
968
    }
965
//					} catch (NotDefinedException e1) {
966
//					} catch (NotEnabledException e1) {
967
//					} catch (NotHandledException e1) {
968
//					}
969
//                }
970
//            }
971
//        });
972
//    }
973
969
974
    /**
970
    /**
975
     * @param direction one of <code>SWT.HORIZONTAL</code> or <code>SWT.VERTICAL</code>
971
     * @param direction one of <code>SWT.HORIZONTAL</code> or <code>SWT.VERTICAL</code>
Lines 996-1183 Link Here
996
        return barManager;
992
        return barManager;
997
    }
993
    }
998
994
999
    // RAP [bm]: 
995
    private void updateLocationItems(Menu parent, int newLocation) {
1000
//    private void updateLocationItems(Menu parent, int newLocation) {
996
        MenuItem left;
1001
//        MenuItem left;
997
        MenuItem topLeft;
1002
//        MenuItem topLeft;
998
        MenuItem topRight;
1003
//        MenuItem topRight;
999
1004
//
1000
        topRight = parent.getItem(0);
1005
//        topRight = parent.getItem(0);
1001
        topLeft = parent.getItem(1);
1006
//        topLeft = parent.getItem(1);
1002
        left = parent.getItem(2);
1007
//        left = parent.getItem(2);
1003
1008
//
1004
        if (newLocation == LEFT) {
1009
//        if (newLocation == LEFT) {
1005
            left.setSelection(true);
1010
//            left.setSelection(true);
1006
            topRight.setSelection(false);
1011
//            topRight.setSelection(false);
1007
            topLeft.setSelection(false);
1012
//            topLeft.setSelection(false);
1008
        } else if (newLocation == TOP_LEFT) {
1013
//        } else if (newLocation == TOP_LEFT) {
1009
            topLeft.setSelection(true);
1014
//            topLeft.setSelection(true);
1010
            left.setSelection(false);
1015
//            left.setSelection(false);
1011
            topRight.setSelection(false);
1016
//            topRight.setSelection(false);
1012
        } else {
1017
//        } else {
1013
            topRight.setSelection(true);
1018
//            topRight.setSelection(true);
1014
            left.setSelection(false);
1019
//            left.setSelection(false);
1015
            topLeft.setSelection(false);
1020
//            topLeft.setSelection(false);
1016
        }
1021
//        }
1017
    }
1022
//    }
1018
1023
1019
    private void addDockOnSubMenu(Menu menu) {
1024
    // RAP [bm]: 
1020
        MenuItem item = new MenuItem(menu, SWT.CASCADE);
1025
//    private void addDockOnSubMenu(Menu menu) {
1021
        item.setText(WorkbenchMessages.get().PerspectiveSwitcher_dockOn);
1026
//        MenuItem item = new MenuItem(menu, SWT.CASCADE);
1022
1027
//        item.setText(WorkbenchMessages.get().PerspectiveSwitcher_dockOn);
1023
        final Menu subMenu = new Menu(item);
1028
//
1024
1029
//        final Menu subMenu = new Menu(item);
1025
        final MenuItem menuItemTopRight = new MenuItem(subMenu, SWT.RADIO);
1030
//
1026
        menuItemTopRight.setText(WorkbenchMessages.get().PerspectiveSwitcher_topRight); 
1031
//        final MenuItem menuItemTopRight = new MenuItem(subMenu, SWT.RADIO);
1027
1032
//        menuItemTopRight.setText(WorkbenchMessages.get().PerspectiveSwitcher_topRight); 
1028
        window.getWorkbench().getHelpSystem().setHelp(menuItemTopRight,
1033
//
1029
        		IWorkbenchHelpContextIds.DOCK_ON_PERSPECTIVE_ACTION);
1034
//        // RAP [bm]: HelpSystem
1030
1035
////        window.getWorkbench().getHelpSystem().setHelp(menuItemTopRight,
1031
        final MenuItem menuItemTopLeft = new MenuItem(subMenu, SWT.RADIO);
1036
////        		IWorkbenchHelpContextIds.DOCK_ON_PERSPECTIVE_ACTION);
1032
        menuItemTopLeft.setText(WorkbenchMessages.get().PerspectiveSwitcher_topLeft); 
1037
//
1033
1038
//        final MenuItem menuItemTopLeft = new MenuItem(subMenu, SWT.RADIO);
1034
        window.getWorkbench().getHelpSystem().setHelp(menuItemTopLeft,
1039
//        menuItemTopLeft.setText(WorkbenchMessages.get().PerspectiveSwitcher_topLeft); 
1035
        		IWorkbenchHelpContextIds.DOCK_ON_PERSPECTIVE_ACTION);
1040
//
1036
1041
//        // RAP [bm]: HelpSystem
1037
        final MenuItem menuItemLeft = new MenuItem(subMenu, SWT.RADIO);
1042
////        window.getWorkbench().getHelpSystem().setHelp(menuItemTopLeft,
1038
        menuItemLeft.setText(WorkbenchMessages.get().PerspectiveSwitcher_left); 
1043
////        		IWorkbenchHelpContextIds.DOCK_ON_PERSPECTIVE_ACTION);
1039
        
1044
//
1040
        window.getWorkbench().getHelpSystem().setHelp(menuItemLeft,
1045
//        final MenuItem menuItemLeft = new MenuItem(subMenu, SWT.RADIO);
1041
        		IWorkbenchHelpContextIds.DOCK_ON_PERSPECTIVE_ACTION);
1046
//        menuItemLeft.setText(WorkbenchMessages.get().PerspectiveSwitcher_left); 
1042
1047
//        
1043
        SelectionListener listener = new SelectionAdapter() {
1048
//        // RAP [bm]: HelpSystem
1044
            public void widgetSelected(SelectionEvent e) {
1049
////        window.getWorkbench().getHelpSystem().setHelp(menuItemLeft,
1045
                MenuItem item = (MenuItem) e.widget;
1050
////        		IWorkbenchHelpContextIds.DOCK_ON_PERSPECTIVE_ACTION);
1046
                String pref = null;
1051
//
1047
                if (item.equals(menuItemLeft)) {
1052
//        SelectionListener listener = new SelectionAdapter() {
1048
                    updateLocationItems(subMenu, LEFT);
1053
//            public void widgetSelected(SelectionEvent e) {
1049
                    pref = IWorkbenchPreferenceConstants.LEFT;
1054
//                MenuItem item = (MenuItem) e.widget;
1050
                } else if (item.equals(menuItemTopLeft)) {
1055
//                String pref = null;
1051
                    updateLocationItems(subMenu, TOP_LEFT);
1056
//                if (item.equals(menuItemLeft)) {
1052
                    pref = IWorkbenchPreferenceConstants.TOP_LEFT;
1057
//                    updateLocationItems(subMenu, LEFT);
1053
                } else {
1058
//                    pref = IWorkbenchPreferenceConstants.LEFT;
1054
                    updateLocationItems(subMenu, TOP_RIGHT);
1059
//                } else if (item.equals(menuItemTopLeft)) {
1055
                    pref = IWorkbenchPreferenceConstants.TOP_RIGHT;
1060
//                    updateLocationItems(subMenu, TOP_LEFT);
1056
                }
1061
//                    pref = IWorkbenchPreferenceConstants.TOP_LEFT;
1057
                IPreferenceStore apiStore = PrefUtil.getAPIPreferenceStore();
1062
//                } else {
1058
                if (!pref
1063
//                    updateLocationItems(subMenu, TOP_RIGHT);
1059
						.equals(apiStore
1064
//                    pref = IWorkbenchPreferenceConstants.TOP_RIGHT;
1060
								.getDefaultString(IWorkbenchPreferenceConstants.DOCK_PERSPECTIVE_BAR))) {
1065
//                }
1061
					PrefUtil.getInternalPreferenceStore().setValue(
1066
//                IPreferenceStore apiStore = PrefUtil.getAPIPreferenceStore();
1062
							IPreferenceConstants.OVERRIDE_PRESENTATION, true);
1067
//                if (!pref
1063
				}
1068
//						.equals(apiStore
1064
                apiStore.setValue(
1069
//								.getDefaultString(IWorkbenchPreferenceConstants.DOCK_PERSPECTIVE_BAR))) {
1065
                        IWorkbenchPreferenceConstants.DOCK_PERSPECTIVE_BAR,
1070
//					PrefUtil.getInternalPreferenceStore().setValue(
1066
                        pref);
1071
//							IPreferenceConstants.OVERRIDE_PRESENTATION, true);
1067
            }
1072
//				}
1068
        };
1073
//                apiStore.setValue(
1069
1074
//                        IWorkbenchPreferenceConstants.DOCK_PERSPECTIVE_BAR,
1070
        menuItemTopRight.addSelectionListener(listener);
1075
//                        pref);
1071
        menuItemTopLeft.addSelectionListener(listener);
1076
//            }
1072
        menuItemLeft.addSelectionListener(listener);
1077
//        };
1073
        item.setMenu(subMenu);
1078
//
1074
        updateLocationItems(subMenu, currentLocation);
1079
//        menuItemTopRight.addSelectionListener(listener);
1075
    }
1080
//        menuItemTopLeft.addSelectionListener(listener);
1076
1081
//        menuItemLeft.addSelectionListener(listener);
1077
    private void addShowTextItem(Menu menu) {
1082
//        item.setMenu(subMenu);
1078
        final MenuItem showtextMenuItem = new MenuItem(menu, SWT.CHECK);
1083
//        updateLocationItems(subMenu, currentLocation);
1079
        showtextMenuItem.setText(WorkbenchMessages.get().PerspectiveBar_showText);
1084
//    }
1080
        window.getWorkbench().getHelpSystem().setHelp(showtextMenuItem,
1085
//
1081
        		IWorkbenchHelpContextIds.SHOW_TEXT_PERSPECTIVE_ACTION);
1086
//    private void addShowTextItem(Menu menu) {
1082
1087
//        final MenuItem showtextMenuItem = new MenuItem(menu, SWT.CHECK);
1083
        showtextMenuItem.addSelectionListener(new SelectionAdapter() {
1088
//        showtextMenuItem.setText(WorkbenchMessages.get().PerspectiveBar_showText);
1084
            public void widgetSelected(SelectionEvent e) {
1089
//        // RAP [bm]: HelpSystem
1085
                if (perspectiveBar == null) {
1090
////        window.getWorkbench().getHelpSystem().setHelp(showtextMenuItem,
1086
					return;
1091
////        		IWorkbenchHelpContextIds.SHOW_TEXT_PERSPECTIVE_ACTION);
1087
				}
1092
//
1088
1093
//        showtextMenuItem.addSelectionListener(new SelectionAdapter() {
1089
                boolean preference = showtextMenuItem.getSelection();
1094
//            public void widgetSelected(SelectionEvent e) {
1090
                if (preference != PrefUtil
1095
//                if (perspectiveBar == null) {
1091
						.getAPIPreferenceStore()
1096
//					return;
1092
						.getDefaultBoolean(
1097
//				}
1093
								IWorkbenchPreferenceConstants.SHOW_TEXT_ON_PERSPECTIVE_BAR)) {
1098
//
1094
                	PrefUtil.getInternalPreferenceStore().setValue(
1099
//                boolean preference = showtextMenuItem.getSelection();
1095
							IPreferenceConstants.OVERRIDE_PRESENTATION, true);
1100
//                if (preference != PrefUtil
1096
				}
1101
//						.getAPIPreferenceStore()
1097
                PrefUtil
1102
//						.getDefaultBoolean(
1098
                        .getAPIPreferenceStore()
1103
//								IWorkbenchPreferenceConstants.SHOW_TEXT_ON_PERSPECTIVE_BAR)) {
1099
                        .setValue(
1104
//                	PrefUtil.getInternalPreferenceStore().setValue(
1100
                                IWorkbenchPreferenceConstants.SHOW_TEXT_ON_PERSPECTIVE_BAR,
1105
//							IPreferenceConstants.OVERRIDE_PRESENTATION, true);
1101
                                preference);
1106
//				}
1102
            }
1107
//                PrefUtil
1103
        });
1108
//                        .getAPIPreferenceStore()
1104
        showtextMenuItem.setSelection(
1109
//                        .setValue(
1105
                PrefUtil
1110
//                                IWorkbenchPreferenceConstants.SHOW_TEXT_ON_PERSPECTIVE_BAR,
1106
                        .getAPIPreferenceStore()
1111
//                                preference);
1107
                        .getBoolean(
1112
//            }
1108
                                IWorkbenchPreferenceConstants.SHOW_TEXT_ON_PERSPECTIVE_BAR));        
1113
//        });
1109
    }
1114
//        showtextMenuItem.setSelection(
1110
1115
//                PrefUtil
1111
    private void addCustomizeItem(Menu menu) {
1116
//                        .getAPIPreferenceStore()
1112
        final MenuItem customizeMenuItem = new MenuItem(menu, SWT.Activate);
1117
//                        .getBoolean(
1113
		customizeMenuItem.setText(WorkbenchMessages.get().PerspectiveBar_customize);
1118
//                                IWorkbenchPreferenceConstants.SHOW_TEXT_ON_PERSPECTIVE_BAR));        
1114
		window.getWorkbench().getHelpSystem().setHelp(customizeMenuItem,
1119
//    }
1115
				IWorkbenchHelpContextIds.EDIT_ACTION_SETS_ACTION);
1120
//
1116
		customizeMenuItem.addSelectionListener(new SelectionAdapter() {
1121
//    private void addCustomizeItem(Menu menu) {
1117
			public void widgetSelected(SelectionEvent e) {
1122
//        final MenuItem customizeMenuItem = new MenuItem(menu, SWT.Activate);
1118
				if (perspectiveBar == null) {
1123
//		customizeMenuItem.setText(WorkbenchMessages.get().PerspectiveBar_customize);
1119
					return;
1124
//		// RAP [bm]: HelpSystem
1120
				}
1125
////		window.getWorkbench().getHelpSystem().setHelp(customizeMenuItem,
1121
				IHandlerService handlerService = (IHandlerService) window
1126
////				IWorkbenchHelpContextIds.EDIT_ACTION_SETS_ACTION);
1122
						.getService(IHandlerService.class);
1127
//		customizeMenuItem.addSelectionListener(new SelectionAdapter() {
1123
				try {
1128
//			public void widgetSelected(SelectionEvent e) {
1124
					handlerService.executeCommand(
1129
//				if (perspectiveBar == null) {
1125
							"org.eclipse.ui.window.customizePerspective", null); //$NON-NLS-1$
1130
//					return;
1126
				} catch (ExecutionException e1) {
1131
//				}
1127
				} catch (NotDefinedException e1) {
1132
//				IHandlerService handlerService = (IHandlerService) window
1128
				} catch (NotEnabledException e1) {
1133
//						.getService(IHandlerService.class);
1129
				} catch (NotHandledException e1) {
1134
//				try {
1130
				}
1135
//					handlerService.executeCommand(
1131
			}
1136
//							"org.eclipse.ui.window.customizePerspective", null); //$NON-NLS-1$
1132
		});
1137
//				} catch (ExecutionException e1) {
1133
    }
1138
//				} catch (NotDefinedException e1) {
1134
    
1139
//				} catch (NotEnabledException e1) {
1135
    private void addSaveAsItem(Menu menu) {
1140
//				} catch (NotHandledException e1) {
1136
        final MenuItem saveasMenuItem = new MenuItem(menu, SWT.Activate);
1141
//				}
1137
        saveasMenuItem.setText(WorkbenchMessages.get().PerspectiveBar_saveAs);
1142
//			}
1138
        window.getWorkbench().getHelpSystem().setHelp(saveasMenuItem,
1143
//		});
1139
        		IWorkbenchHelpContextIds.SAVE_PERSPECTIVE_ACTION);
1144
//    }
1140
        saveasMenuItem.addSelectionListener(new SelectionAdapter() {
1145
//    
1141
            public void widgetSelected(SelectionEvent e) {
1146
//    private void addSaveAsItem(Menu menu) {
1142
                if (perspectiveBar == null) {
1147
//        final MenuItem saveasMenuItem = new MenuItem(menu, SWT.Activate);
1143
					return;
1148
//        saveasMenuItem.setText(WorkbenchMessages.get().PerspectiveBar_saveAs);
1144
				}
1149
//        // RAP [bm]: HelpSystem
1145
                SavePerspectiveAction saveAction=new SavePerspectiveAction(window);
1150
////        window.getWorkbench().getHelpSystem().setHelp(saveasMenuItem,
1146
                saveAction.setEnabled(true);
1151
////        		IWorkbenchHelpContextIds.SAVE_PERSPECTIVE_ACTION);
1147
                saveAction.run();
1152
//        saveasMenuItem.addSelectionListener(new SelectionAdapter() {
1148
            }
1153
//            public void widgetSelected(SelectionEvent e) {
1149
        });
1154
//                if (perspectiveBar == null) {
1150
    }
1155
//					return;
1151
    
1156
//				}
1152
    private void addResetItem(Menu menu) {
1157
//                SavePerspectiveAction saveAction=new SavePerspectiveAction(window);
1153
        final MenuItem resetMenuItem = new MenuItem(menu, SWT.Activate);
1158
//                saveAction.setEnabled(true);
1154
        resetMenuItem.setText(WorkbenchMessages.get().PerspectiveBar_reset);
1159
//                saveAction.run();
1155
        window.getWorkbench().getHelpSystem().setHelp(resetMenuItem,
1160
//            }
1156
        		IWorkbenchHelpContextIds.RESET_PERSPECTIVE_ACTION);
1161
//        });
1157
        resetMenuItem.addSelectionListener(new SelectionAdapter() {
1162
//    }
1158
            public void widgetSelected(SelectionEvent e) {
1163
//    
1159
                if (perspectiveBar == null) {
1164
//    private void addResetItem(Menu menu) {
1160
					return;
1165
//        final MenuItem resetMenuItem = new MenuItem(menu, SWT.Activate);
1161
				}
1166
//        resetMenuItem.setText(WorkbenchMessages.get().PerspectiveBar_reset);
1162
                ResetPerspectiveAction resetAction=new ResetPerspectiveAction(window);
1167
//        // RAP [bm]: 
1163
                resetAction.setEnabled(true);
1168
////        window.getWorkbench().getHelpSystem().setHelp(resetMenuItem,
1164
                resetAction.run(); 
1169
////        		IWorkbenchHelpContextIds.RESET_PERSPECTIVE_ACTION);
1165
             }
1170
//        resetMenuItem.addSelectionListener(new SelectionAdapter() {
1166
        });
1171
//            public void widgetSelected(SelectionEvent e) {
1167
    }
1172
//                if (perspectiveBar == null) {
1173
//					return;
1174
//				}
1175
//                ResetPerspectiveAction resetAction=new ResetPerspectiveAction(window);
1176
//                resetAction.setEnabled(true);
1177
//                resetAction.run(); 
1178
//             }
1179
//        });
1180
//    }
1181
    
1168
    
1182
    /**
1169
    /**
1183
     * Method to save the width of the perspective bar in the 
1170
     * Method to save the width of the perspective bar in the 
(-)Eclipse UI/org/eclipse/ui/internal/ViewStack.java (-5 / +11 lines)
Lines 17-23 Link Here
17
import org.eclipse.ui.internal.presentations.PresentationFactoryUtil;
17
import org.eclipse.ui.internal.presentations.PresentationFactoryUtil;
18
import org.eclipse.ui.internal.presentations.SystemMenuDetach;
18
import org.eclipse.ui.internal.presentations.SystemMenuDetach;
19
import org.eclipse.ui.internal.presentations.SystemMenuFastView;
19
import org.eclipse.ui.internal.presentations.SystemMenuFastView;
20
import org.eclipse.ui.internal.presentations.SystemMenuSize;
20
//import org.eclipse.ui.internal.presentations.SystemMenuSize;
21
import org.eclipse.ui.internal.presentations.UpdatingActionContributionItem;
21
import org.eclipse.ui.internal.presentations.UpdatingActionContributionItem;
22
import org.eclipse.ui.presentations.AbstractPresentationFactory;
22
import org.eclipse.ui.presentations.AbstractPresentationFactory;
23
import org.eclipse.ui.presentations.IPresentablePart;
23
import org.eclipse.ui.presentations.IPresentablePart;
Lines 43-49 Link Here
43
43
44
    private WorkbenchPage page;
44
    private WorkbenchPage page;
45
45
46
    private SystemMenuSize sizeItem = new SystemMenuSize(null);
46
    // RAP [bm]: size menu unusable due to missing keyboard support for Sash
47
//    private SystemMenuSize sizeItem = new SystemMenuSize(null);
48
    // RAPEND: [bm]
47
49
48
    private SystemMenuFastView fastViewAction;
50
    private SystemMenuFastView fastViewAction;
49
51
Lines 54-61 Link Here
54
                "misc", new UpdatingActionContributionItem(fastViewAction)); //$NON-NLS-1$
56
                "misc", new UpdatingActionContributionItem(fastViewAction)); //$NON-NLS-1$
55
        appendToGroupIfPossible(menuManager,
57
        appendToGroupIfPossible(menuManager,
56
        		"misc", new UpdatingActionContributionItem(detachViewAction)); //$NON-NLS-1$
58
        		"misc", new UpdatingActionContributionItem(detachViewAction)); //$NON-NLS-1$
57
        sizeItem = new SystemMenuSize(getSelection());
59
        // RAP [bm]: size menu unusable due to missing keyboard support for Sash
58
        appendToGroupIfPossible(menuManager, "size", sizeItem); //$NON-NLS-1$
60
//        sizeItem = new SystemMenuSize(getSelection());
61
//        appendToGroupIfPossible(menuManager, "size", sizeItem); //$NON-NLS-1$
62
        // RAPEND: [bm]
59
    }
63
    }
60
64
61
    public ViewStack(WorkbenchPage page) {
65
    public ViewStack(WorkbenchPage page) {
Lines 117-123 Link Here
117
121
118
        fastViewAction.setPane(current);
122
        fastViewAction.setPane(current);
119
        detachViewAction.setPane(pane);
123
        detachViewAction.setPane(pane);
120
        sizeItem.setPane(pane);
124
        // RAP [bm]: size menu unusable due to missing keyboard support for Sash
125
//        sizeItem.setPane(pane);
126
        // RAPEND: [bm]
121
    }
127
    }
122
128
123
	/**
129
	/**
(-)Eclipse UI/org/eclipse/ui/internal/EditorStack.java (-5 / +11 lines)
Lines 24-30 Link Here
24
import org.eclipse.ui.internal.presentations.PresentablePart;
24
import org.eclipse.ui.internal.presentations.PresentablePart;
25
import org.eclipse.ui.internal.presentations.PresentationFactoryUtil;
25
import org.eclipse.ui.internal.presentations.PresentationFactoryUtil;
26
import org.eclipse.ui.internal.presentations.SystemMenuPinEditor;
26
import org.eclipse.ui.internal.presentations.SystemMenuPinEditor;
27
import org.eclipse.ui.internal.presentations.SystemMenuSize;
27
//import org.eclipse.ui.internal.presentations.SystemMenuSize;
28
import org.eclipse.ui.internal.presentations.UpdatingActionContributionItem;
28
import org.eclipse.ui.internal.presentations.UpdatingActionContributionItem;
29
import org.eclipse.ui.internal.presentations.util.TabbedStackPresentation;
29
import org.eclipse.ui.internal.presentations.util.TabbedStackPresentation;
30
import org.eclipse.ui.internal.util.Util;
30
import org.eclipse.ui.internal.util.Util;
Lines 45-51 Link Here
45
45
46
    private WorkbenchPage page;
46
    private WorkbenchPage page;
47
47
48
    private SystemMenuSize sizeItem = new SystemMenuSize(null);
48
    // RAP [bm]: size menu unusable due to missing keyboard support for Sash
49
//    private SystemMenuSize sizeItem = new SystemMenuSize(null);
49
50
50
    private SystemMenuPinEditor pinEditorItem = new SystemMenuPinEditor(null);
51
    private SystemMenuPinEditor pinEditorItem = new SystemMenuPinEditor(null);
51
52
Lines 72-79 Link Here
72
        pinEditorItem = new SystemMenuPinEditor((EditorPane) getSelection());
73
        pinEditorItem = new SystemMenuPinEditor((EditorPane) getSelection());
73
        appendToGroupIfPossible(menuManager,
74
        appendToGroupIfPossible(menuManager,
74
                "misc", new UpdatingActionContributionItem(pinEditorItem)); //$NON-NLS-1$
75
                "misc", new UpdatingActionContributionItem(pinEditorItem)); //$NON-NLS-1$
75
        sizeItem = new SystemMenuSize(getSelection());
76
        // RAP [bm]: size menu unusable due to missing keyboard support for Sash
76
        appendToGroupIfPossible(menuManager, "size", sizeItem); //$NON-NLS-1$
77
//        sizeItem = new SystemMenuSize(getSelection());
78
//        appendToGroupIfPossible(menuManager, "size", sizeItem); //$NON-NLS-1$
79
        // RAPEND: [bm]
77
    }
80
    }
78
81
79
    public boolean isMoveable(IPresentablePart part) {
82
    public boolean isMoveable(IPresentablePart part) {
Lines 122-128 Link Here
122
            pane = (EditorPane) current.getPane();
125
            pane = (EditorPane) current.getPane();
123
        }
126
        }
124
127
125
        sizeItem.setPane(pane);
128
        // RAP [bm]: size menu unusable due to missing keyboard support for Sash
129
//        sizeItem.setPane(pane);
130
        // RAPEND: [bm]
131
        
126
        pinEditorItem.setPane(pane);
132
        pinEditorItem.setPane(pane);
127
    }
133
    }
128
134
(-)Eclipse UI/org/eclipse/ui/internal/FastViewBar.java (-19 / +6 lines)
Lines 107-116 Link Here
107
    private Listener addMenuListener = new Listener() {
107
    private Listener addMenuListener = new Listener() {
108
        public void handleEvent(Event event) {
108
        public void handleEvent(Event event) {
109
            Point loc = new Point(event.x, event.y);
109
            Point loc = new Point(event.x, event.y);
110
            // RAP [bm]: SWT.MenuDetect
110
            if (event.type == SWT.MenuDetect) {
111
//            if (event.type == SWT.MenuDetect) {
112
            if (event.button == 2) {
113
            // RAPEND: [bm] 
114
                showAddFastViewPopup(loc);
111
                showAddFastViewPopup(loc);
115
            }
112
            }
116
        }
113
        }
Lines 119-128 Link Here
119
    private Listener menuListener = new Listener() {
116
    private Listener menuListener = new Listener() {
120
        public void handleEvent(Event event) {
117
        public void handleEvent(Event event) {
121
            Point loc = new Point(event.x, event.y);
118
            Point loc = new Point(event.x, event.y);
122
            // RAP [bm]: 
119
            if (event.type == SWT.MenuDetect) {
123
//            if (event.type == SWT.MenuDetect) {
124
            if (event.button == 2) {
125
            // RAPEND: [bm] 
126
                showFastViewBarPopup(loc);
120
                showFastViewBarPopup(loc);
127
            }
121
            }
128
        }
122
        }
Lines 334-343 Link Here
334
        String tip = WorkbenchMessages.get().FastViewBar_0; 
328
        String tip = WorkbenchMessages.get().FastViewBar_0; 
335
        fvbComposite.setToolTipText(tip);
329
        fvbComposite.setToolTipText(tip);
336
330
337
        // RAP [bm]: SWT.MenuDetect
331
        fvbComposite.addListener(SWT.MenuDetect, menuListener);
338
//        fvbComposite.addListener(SWT.MenuDetect, menuListener);
339
        fvbComposite.addListener(SWT.MouseUp, menuListener);
340
        // RAPEND: [bm] 
341
332
342
        // RAP [bm]: DnD
333
        // RAP [bm]: DnD
343
//        PresentationUtil.addDragListener(fvbComposite, dragListener);
334
//        PresentationUtil.addDragListener(fvbComposite, dragListener);
Lines 404-412 Link Here
404
395
405
        	// Bring up the 'Add Fast View' menu on a left -or- right button click
396
        	// Bring up the 'Add Fast View' menu on a left -or- right button click
406
        	// Right click (context menu)
397
        	// Right click (context menu)
407
        	// RAP [bm]: SWT.MenuDetect
398
        	menuItem.addListener(SWT.MenuDetect, addMenuListener);        
408
//        	menuItem.addListener(SWT.MenuDetect, addMenuListener);        
399
        	menuTB.addListener(SWT.MenuDetect, addMenuListener);
409
//        	menuTB.addListener(SWT.MenuDetect, addMenuListener);
410
        	menuItem.addListener(SWT.MouseUp, addMenuListener);        
400
        	menuItem.addListener(SWT.MouseUp, addMenuListener);        
411
        	menuTB.addListener(SWT.MouseUp, addMenuListener);
401
        	menuTB.addListener(SWT.MouseUp, addMenuListener);
412
        	// RAPEND: [bm] 
402
        	// RAPEND: [bm] 
Lines 435-444 Link Here
435
425
436
        fastViewBar.createControl(fvbComposite);
426
        fastViewBar.createControl(fvbComposite);
437
427
438
        // RAP [bm]: 
428
        getToolBar().addListener(SWT.MenuDetect, menuListener);
439
//        getToolBar().addListener(SWT.MenuDetect, menuListener);
440
        getToolBar().addListener(SWT.MouseUp, menuListener);
441
        // RAPEND: [bm] 
442
429
443
        // RAP [bm]: DnD
430
        // RAP [bm]: DnD
444
//        IDragOverListener fastViewDragTarget = new IDragOverListener() {
431
//        IDragOverListener fastViewDragTarget = new IDragOverListener() {
(-)Eclipse UI/org/eclipse/ui/internal/presentations/NativeStackPresentation.java (-18 / +16 lines)
Lines 85-106 Link Here
85
        }
85
        }
86
    };
86
    };
87
87
88
    // RAP [bm]: 
88
    private Listener menuListener = new Listener() {
89
//    private Listener menuListener = new Listener() {
89
        /* (non-Javadoc)
90
//        /* (non-Javadoc)
90
         * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
91
//         * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
91
         */
92
//         */
92
        public void handleEvent(Event event) {
93
//        public void handleEvent(Event event) {
93
            Point pos = new Point(event.x, event.y);
94
//            Point pos = new Point(event.x, event.y);
94
            //			TabItem item = tabFolder.getItem(pos);
95
//            //			TabItem item = tabFolder.getItem(pos);
95
            TabItem item = null;
96
//            TabItem item = null;
96
            IPresentablePart part = null;
97
//            IPresentablePart part = null;
97
            if (item != null) {
98
//            if (item != null) {
98
                part = getPartForTab(item);
99
//                part = getPartForTab(item);
99
            }
100
//            }
100
            showPaneMenu(part, pos);
101
//            showPaneMenu(part, pos);
101
        }
102
//        }
102
    };
103
//    };
104
103
105
    private Listener selectionListener = new Listener() {
104
    private Listener selectionListener = new Listener() {
106
        public void handleEvent(Event e) {
105
        public void handleEvent(Event e) {
Lines 157-164 Link Here
157
        // listen for mouse down on tab to set focus.
156
        // listen for mouse down on tab to set focus.
158
        tabFolder.addMouseListener(mouseListener);
157
        tabFolder.addMouseListener(mouseListener);
159
158
160
        // RAP [bm]: 
159
        tabFolder.addListener(SWT.MenuDetect, menuListener);
161
//        tabFolder.addListener(SWT.MenuDetect, menuListener);
162
160
163
        // RAP [bm]: 
161
        // RAP [bm]: 
164
//        dragListener = new Listener() {
162
//        dragListener = new Listener() {
(-)src/org/eclipse/jface/action/ToolBarContributionItem.java (-35 / +35 lines)
Lines 27-32 Link Here
27
import org.eclipse.swt.widgets.Control;
27
import org.eclipse.swt.widgets.Control;
28
import org.eclipse.swt.widgets.CoolBar;
28
import org.eclipse.swt.widgets.CoolBar;
29
import org.eclipse.swt.widgets.CoolItem;
29
import org.eclipse.swt.widgets.CoolItem;
30
import org.eclipse.swt.widgets.Event;
31
import org.eclipse.swt.widgets.Listener;
30
import org.eclipse.swt.widgets.Menu;
32
import org.eclipse.swt.widgets.Menu;
31
import org.eclipse.swt.widgets.ToolBar;
33
import org.eclipse.swt.widgets.ToolBar;
32
import org.eclipse.swt.widgets.ToolItem;
34
import org.eclipse.swt.widgets.ToolItem;
Lines 211-228 Link Here
211
            // ToolBarManager.createControl can actually return a pre-existing control.
213
            // ToolBarManager.createControl can actually return a pre-existing control.
212
            // Only add the listener if the toolbar was newly created (bug 62097).
214
            // Only add the listener if the toolbar was newly created (bug 62097).
213
            if (oldToolBar != toolBar) {
215
            if (oldToolBar != toolBar) {
214
            	// RAP [bm]: MenuDetect
216
	            toolBar.addListener(SWT.MenuDetect, new Listener() {
215
//	            toolBar.addListener(SWT.MenuDetect, new Listener() {
217
	
216
//	
218
	                public void handleEvent(Event event) {
217
//	                public void handleEvent(Event event) {
219
	                    // if the toolbar does not have its own context menu then
218
//	                    // if the toolbar does not have its own context menu then
220
	                    // handle the event
219
//	                    // handle the event
221
	                    if (toolBarManager.getContextMenuManager() == null) {
220
//	                    if (toolBarManager.getContextMenuManager() == null) {
222
	                        handleContextMenu(event);
221
//	                        handleContextMenu(event);
223
	                    }
222
//	                    }
224
	                }
223
//	                }
225
	            });
224
//	            });
225
            	// RAPEND: [bm] 
226
226
227
            }
227
            }
228
228
Lines 400-428 Link Here
400
     * @param event
400
     * @param event
401
     *            the event object
401
     *            the event object
402
     */
402
     */
403
//    private void handleContextMenu(Event event) {
403
    private void handleContextMenu(Event event) {
404
//        ToolBar toolBar = toolBarManager.getControl();
404
        ToolBar toolBar = toolBarManager.getControl();
405
//        // If parent has a menu then use that one
405
        // If parent has a menu then use that one
406
//        Menu parentMenu = toolBar.getParent().getMenu();
406
        Menu parentMenu = toolBar.getParent().getMenu();
407
//        if ((parentMenu != null) && (!parentMenu.isDisposed())) {
407
        if ((parentMenu != null) && (!parentMenu.isDisposed())) {
408
//            toolBar.setMenu(parentMenu);
408
            toolBar.setMenu(parentMenu);
409
//            // Hook listener to remove menu once it has disapeared
409
            // Hook listener to remove menu once it has disapeared
410
//            parentMenu.addListener(SWT.Hide, new Listener() {
410
            parentMenu.addListener(SWT.Hide, new Listener() {
411
//
411
412
//                public void handleEvent(Event innerEvent) {
412
                public void handleEvent(Event innerEvent) {
413
//                    ToolBar innerToolBar = toolBarManager.getControl();
413
                    ToolBar innerToolBar = toolBarManager.getControl();
414
//                    if (innerToolBar != null) {
414
                    if (innerToolBar != null) {
415
//                        innerToolBar.setMenu(null);
415
                        innerToolBar.setMenu(null);
416
//                        Menu innerParentMenu = innerToolBar.getParent()
416
                        Menu innerParentMenu = innerToolBar.getParent()
417
//                                .getMenu();
417
                                .getMenu();
418
//                        if (innerParentMenu != null) {
418
                        if (innerParentMenu != null) {
419
//                            innerParentMenu.removeListener(SWT.Hide, this);
419
                            innerParentMenu.removeListener(SWT.Hide, this);
420
//                        }
420
                        }
421
//                    }
421
                    }
422
//                }
422
                }
423
//            });
423
            });
424
//        }
424
        }
425
//    }
425
    }
426
426
427
    /**
427
    /**
428
     * Handles the disposal of the widget.
428
     * Handles the disposal of the widget.

Return to bug 290303