To show a custom area for toolbar.
public void postWindowOpen() {
//...
}
//Add to postWindowOpen()
final IWorkbenchWindow window = getWindowConfigurer().getWindow();
Listener listener = new Listener() {
private Shell toolbar;
public void handleEvent(Event event) {
Control control = (Control) event.widget;
Point mouse = control.toDisplay(event.x, event.y);
final Shell shell = window.getShell();
Point location = shell.getLocation();
Point size = shell.getSize();
int xIndent = 2;
int yIndent = 24;
int height = 30;
if (mouse.x > location.x
&& mouse.y > location.y + yIndent
&& location.x + size.x > mouse.x
&& location.y + yIndent + height > mouse.y) {
if (toolbar == null) {
toolbar = new Shell(shell, SWT.NO_TRIM);
toolbar.setSize(size.x - 2 * xIndent, height);
toolbar.setLocation(location.x + xIndent, location.y + yIndent);
GridLayout layout = new GridLayout(24, false);
layout.marginLeft = 0;
layout.marginTop = 0;
toolbar.setLayout(layout);
new Button(toolbar, SWT.PUSH).setText("action 1");
new Button(toolbar, SWT.PUSH).setText("action 2");
new Button(toolbar, SWT.PUSH).setText("action 3");
toolbar.setVisible(true);
}
} else {
if (toolbar != null) {
toolbar.dispose();
toolbar = null;
}
}
}
};
window.getShell().getDisplay().addFilter(SWT.MouseMove, listener);
分享到:
相关推荐
- Update to RTF reader to load landscape flag for sections better - when page mirror was used, after a page break the text indentation was sometimes wrong - hyphenation code was broken - workaround ...
"This technique allows a program to save hierarchical information like the data in a TreeView in a way that is easy to understand."<END><br>11 , OLE.zip Demonstrates the use of OLE.<END><br>12 , ...
1.x/6.0 (Java) <END><br>6 , ocxex.zip "This is a quick example I made to show you how to use Events and properties in a OCX."<END><br>7 , news.exe This control aids as a complete Newsgroup ...
supports drawing of external graphics on the text area...useful for html editors etc<END><br>63,Player.zip A multimedia ocx to replace mediaplayer ocx<END><br>64,Audio.zip This ActiveX Control ...
+ A plot that was copied to the clipboard failed to "clip" data points that were outside of the graphing pane, resulting in points being drawn outside of the intended area. Fixed. + The ...
18.zip Color Dialog with Persistent Custom Colors 对话框继承了上一次的颜色风格(12KB)<END><br>19,19.zip A Base Dialog Class for Modal/Modeless Dialog with Custom Background Color 自定义背景...
- **Note** / **Hyperlink** / **Repeat Formatting** / **Geometric Tolerance** / **Standard Symbol** / **Custom Symbol** / **Move Special** / **Table** / **Update Table** / **Cleanup Balloons** / **...