swt

How to detect ctrl-f in my SWT application

孤街醉人 提交于 2020-01-19 07:27:05
问题 I have written an SWT UI which has a primary function of displaying text in a StyledText control. I want to add a handler for Ctrl + F so that when that shortcut is pressed the focus is set to a search box. I have tried using the following code to detect the keypress. sWindow = new Shell(); ... sWindow.getDisplay().addFilter(SWT.KeyDown, new Listener() { @Override public void handleEvent(Event e) { System.out.println("Filter-ctrl: " + SWT.CTRL); System.out.println("Filter-mask: " + e

Creating Usable Toolbar for High Resolution Screen

眉间皱痕 提交于 2020-01-17 08:55:07
问题 High resolution screens are old news, but for some reason we (and the Eclipse guys) ignored them until now. Well, we can't any longer. What we want to do is create Eclipse applications that work for "normal" displays, but for high resolution ones, too. Right now the icons are way to small to see or click. This bug links to this (rather sparse) documentation states we only need to use a new constructor for Image . Okay, so we need to create our own implementation of ImageDataProvider . While

Components won't resize in SWT with a GridLayout

谁都会走 提交于 2020-01-17 06:06:56
问题 I discovered SWT a few days ago and decided to switch my plugin interface from Swing to SWT. I can place the components as I want, but when I resize the window, the components are not resized at all. Furthermore, when I fill a little Text (text area) with a large string, I can't find a way to resize it... The following code is the one defining the layout and the components, I guess someone will find where my mistake(s) is(are). P.S : I see some tutorials online declaring a Display object

how to fix the order of the buttons in SWT?

拥有回忆 提交于 2020-01-17 06:01:08
问题 I have scroller with 2 buttons How i can set that the order of the buttons will be in the same raw and not each control : button scroller and button will be in different row fComposite= new Composite(composite, SWT.RIGHT_TO_LEFT); GridData layoutData= new GridData(SWT.FILL, SWT.RIGHT_TO_LEFT, true, false); fComposite.setLayoutData(layoutData); layout= new GridLayout(1, false); layout.marginHeight= 0; layout.marginWidth= 0; layout.horizontalSpacing= 0; layout.verticalSpacing= 0; fComposite

Only changing the logo of special plugin

落爺英雄遲暮 提交于 2020-01-16 17:01:04
问题 When I set the logo of my plugin in a below way, the logo of eclipse in all other windows are also changed. I would like to change only the logo of my tool, not other windows of eclipse . dialog = new WizardDialog(Display.getDefault().getActiveShell(), wizard); Bundle bundle = Platform.getBundle("MyPlugin"); URL url = FileLocator.find(bundle, new Path("icon/MyLogo.png"), null); ImageDescriptor desc = ImageDescriptor.createFromURL(url); Image image = desc.createImage(); dialog.setDefaultImage

Eclipse RCP: How and when to correctly unsubscribe a Composite from EventBroker?

蹲街弑〆低调 提交于 2020-01-15 15:28:54
问题 In the constructor of my custom composite (inherited from SWT Composite ), I register myself as an EventHandler to the Eclipse IEventBroker . To unsubscribe upon disposal, I had overridden the dispose method where I unsubscribe myself. But I now noticed that this unsubscription is not happening, indeed the dispose method is never getting called. What is the correct way to unsubscribe myself, or to avoid that a closed Composite/ViewPart leaves "leaking" event handlers behind? I use Eclipse RCP

Eclipse RCP: How and when to correctly unsubscribe a Composite from EventBroker?

不羁的心 提交于 2020-01-15 15:27:07
问题 In the constructor of my custom composite (inherited from SWT Composite ), I register myself as an EventHandler to the Eclipse IEventBroker . To unsubscribe upon disposal, I had overridden the dispose method where I unsubscribe myself. But I now noticed that this unsubscription is not happening, indeed the dispose method is never getting called. What is the correct way to unsubscribe myself, or to avoid that a closed Composite/ViewPart leaves "leaking" event handlers behind? I use Eclipse RCP

How to get exactly Eclipse Editor kind of Tool Tip in RCP/SWT Table cell

99封情书 提交于 2020-01-15 07:37:13
问题 I want to get Exactly eclipse editor kind highly customized tooltip like below- I used eclipse provided snippets of customized Tooltips but none of them were so highly improvised performance and easy to use. How to reuse these Tooltips , any example would help. 回答1: you just need to extend org.eclipse.jface.window.ToolTip and override protected abstract Composite createToolTipContentArea(Event event, Composite parent); you can add org.eclipse.swt.browser.Browser and set formatted content and

Custom widget shapes in SWT

强颜欢笑 提交于 2020-01-13 20:41:15
问题 I'm trying to work out how to make SWT widgets (e.g. Label, Frame) be some shape other than rectangular. I've made a custom shaped main window using the setRegion() method. Now I would like the widgets in the window to follow the same shape. I've tried using the setRegion() method on the widgets themselves (they inherit it) but nothing happens. How do I make an SWT widget have a custom shape? 回答1: I've managed to work it out. It seems my difficulty was arising from a misunderstanding of how

Using WebKit for SWT Browser inside Eclipse plugin

让人想犯罪 __ 提交于 2020-01-13 20:39:13
问题 I tried today to use the WebKit as the Browser's underlying renderer for my eclipse plugin but no luck. I followed the recommended instructions and my current environment is as follows: OS: Windows 7 (x64) Safari installed (in the PATH too) 32 bit SWT (eclipse RCP indigo SR1 32) added the following line to eclipse.ini -Dorg.eclipse.swt.browser.DefaultType=webkit Now when I try to instantiate the browser: Browser b = new Browser(parent, SWT.WEBKIT); b.setUrl("http://whatismybrowser.com"); I