Lines 16-23
Link Here
|
16 |
import org.eclipse.swt.custom.CTabFolder; |
16 |
import org.eclipse.swt.custom.CTabFolder; |
17 |
import org.eclipse.swt.custom.CTabFolderEvent; |
17 |
import org.eclipse.swt.custom.CTabFolderEvent; |
18 |
import org.eclipse.swt.custom.CTabItem; |
18 |
import org.eclipse.swt.custom.CTabItem; |
19 |
import org.eclipse.swt.events.MouseAdapter; |
19 |
import org.eclipse.swt.events.MenuDetectEvent; |
20 |
import org.eclipse.swt.events.MouseEvent; |
20 |
import org.eclipse.swt.events.MenuDetectListener; |
21 |
import org.eclipse.swt.events.SelectionAdapter; |
21 |
import org.eclipse.swt.events.SelectionAdapter; |
22 |
import org.eclipse.swt.events.SelectionEvent; |
22 |
import org.eclipse.swt.events.SelectionEvent; |
23 |
import org.eclipse.swt.graphics.Font; |
23 |
import org.eclipse.swt.graphics.Font; |
Lines 30-35
Link Here
|
30 |
import org.eclipse.swt.widgets.Event; |
30 |
import org.eclipse.swt.widgets.Event; |
31 |
import org.eclipse.swt.widgets.Label; |
31 |
import org.eclipse.swt.widgets.Label; |
32 |
import org.eclipse.swt.widgets.Listener; |
32 |
import org.eclipse.swt.widgets.Listener; |
|
|
33 |
import org.eclipse.swt.widgets.Menu; |
33 |
import org.eclipse.swt.widgets.ToolBar; |
34 |
import org.eclipse.swt.widgets.ToolBar; |
34 |
import org.eclipse.swt.widgets.ToolItem; |
35 |
import org.eclipse.swt.widgets.ToolItem; |
35 |
import org.eclipse.ui.internal.IWorkbenchGraphicConstants; |
36 |
import org.eclipse.ui.internal.IWorkbenchGraphicConstants; |
Lines 38-43
Link Here
|
38 |
import org.eclipse.ui.internal.dnd.DragUtil; |
39 |
import org.eclipse.ui.internal.dnd.DragUtil; |
39 |
import org.eclipse.ui.internal.presentations.PaneFolder; |
40 |
import org.eclipse.ui.internal.presentations.PaneFolder; |
40 |
import org.eclipse.ui.internal.presentations.PaneFolderButtonListener; |
41 |
import org.eclipse.ui.internal.presentations.PaneFolderButtonListener; |
|
|
42 |
import org.eclipse.ui.internal.presentations.PresentablePart; |
41 |
import org.eclipse.ui.internal.presentations.util.AbstractTabFolder; |
43 |
import org.eclipse.ui.internal.presentations.util.AbstractTabFolder; |
42 |
import org.eclipse.ui.internal.presentations.util.AbstractTabItem; |
44 |
import org.eclipse.ui.internal.presentations.util.AbstractTabItem; |
43 |
import org.eclipse.ui.internal.presentations.util.PartInfo; |
45 |
import org.eclipse.ui.internal.presentations.util.PartInfo; |
Lines 113-129
Link Here
|
113 |
ToolBar actualToolBar = new ToolBar(paneFolder.getControl(), SWT.FLAT | SWT.NO_BACKGROUND); |
115 |
ToolBar actualToolBar = new ToolBar(paneFolder.getControl(), SWT.FLAT | SWT.NO_BACKGROUND); |
114 |
viewToolBar = actualToolBar; |
116 |
viewToolBar = actualToolBar; |
115 |
|
117 |
|
116 |
ToolItem pullDownButton = new ToolItem(actualToolBar, SWT.PUSH); |
118 |
final ToolItem pullDownButton = new ToolItem(actualToolBar, SWT.PUSH); |
117 |
Image hoverImage = WorkbenchImages |
119 |
Image hoverImage = WorkbenchImages |
118 |
.getImage(IWorkbenchGraphicConstants.IMG_LCL_RENDERED_VIEW_MENU); |
120 |
.getImage(IWorkbenchGraphicConstants.IMG_LCL_RENDERED_VIEW_MENU); |
119 |
pullDownButton.setDisabledImage(hoverImage); |
121 |
pullDownButton.setDisabledImage(hoverImage); |
120 |
pullDownButton.setImage(hoverImage); |
122 |
pullDownButton.setImage(hoverImage); |
121 |
pullDownButton.setToolTipText(WorkbenchMessages.Menu); |
123 |
pullDownButton.setToolTipText(WorkbenchMessages.Menu); |
122 |
actualToolBar.addMouseListener(new MouseAdapter() { |
124 |
// actualToolBar.addMouseListener(new MouseAdapter() { |
123 |
public void mouseDown(MouseEvent e) { |
125 |
// public void mouseDown(MouseEvent e) { |
124 |
fireEvent(TabFolderEvent.EVENT_PANE_MENU, getSelection(), getPaneMenuLocation()); |
126 |
// fireEvent(TabFolderEvent.EVENT_PANE_MENU, getSelection(), getPaneMenuLocation()); |
125 |
} |
127 |
// } |
126 |
}); |
128 |
// }); |
|
|
129 |
pullDownButton.addMenuDetectListener(new MenuDetectListener() { |
130 |
public void menuDetected(MenuDetectEvent e) { |
131 |
Menu menu = null; |
132 |
Object data = getSelection().getData(); |
133 |
if (data instanceof PresentablePart) { |
134 |
PresentablePart part = (PresentablePart) data; |
135 |
part.setFocus(); |
136 |
if (part.getMenu() != null) { |
137 |
menu = part.getMenu().getMenu(); |
138 |
} |
139 |
} |
140 |
pullDownButton.setMenu(menu); |
141 |
} |
142 |
}); |
127 |
pullDownButton.addSelectionListener(new SelectionAdapter() { |
143 |
pullDownButton.addSelectionListener(new SelectionAdapter() { |
128 |
public void widgetSelected(SelectionEvent e) { |
144 |
public void widgetSelected(SelectionEvent e) { |
129 |
fireEvent(TabFolderEvent.EVENT_PANE_MENU, getSelection(), getPaneMenuLocation()); |
145 |
fireEvent(TabFolderEvent.EVENT_PANE_MENU, getSelection(), getPaneMenuLocation()); |