swt

Get the item in the SWT list on Mouse Up

旧巷老猫 提交于 2019-12-01 20:16:28
I wanted to know if its possible to get the item in the list on mouse up? I searched online and found many examples for SWT table using the X and the Y coordinate but none using a list. What I am basically doing is implementing a list in which the order of the items can be changed by drag and drop. For this I need to be able to get the item under the drop location so that I can swap that item with the dragged item. List#getItemHeight() returns the height of the area one item occupies. With that information and getTopIndex() you should be able to compute the item at a given x and y coordinate.

SWT Browser not working?

一世执手 提交于 2019-12-01 19:37:58
I'm having a little trouble with the SWT Browser component. I am running Ubuntu 11.04 AMD64 and Eclipse 3.7, with Java SE 1.6 from Sun My problem is that my browser won't initialize. When I make it with the SWT.NONE flag, I get errors Exception in thread "main" org.eclipse.swt.SWTError: No more handles (java.lang.UnsatisfiedLinkError: no swt-mozilla-gtk-3346 or swt-mozilla-gtk in swt.library.path, java.library.path or the jar file) at org.eclipse.swt.SWT.error(SWT.java:3589) at org.eclipse.swt.SWT.error(SWT.java:3481) at org.eclipse.swt.browser.Mozilla.create(Mozilla.java:324) at org.eclipse

Does SWT distribute a JAR that works on any supported operating system?

Deadly 提交于 2019-12-01 18:54:36
The SWT project currently maintains one distributable for each supported operating system. For example: swt-3.4.2-win32-win32-x86.zip swt-3.4.2-gtk-linux-x86.zip swt-3.4.2-carbon-macosx.zip Is there a distributable that just Does the Right Thing™, regardless of which operating system the application is running on? No, there isn't, and you can't make one either out of the standalone SWT distributions. That's because each os/windowing system/architecture combination has its own implementation of each of the SWT classes. For example, if your code refers to org.eclipse.swt.widgets.Button, the JVM

Creating multiple identical text verify listeners in eclipse-rcp/swt

烂漫一生 提交于 2019-12-01 18:52:43
问题 I'm trying to validate the input of multiple text boxes (i.e. they should be a number), and found the useful code snippet below here. However, if I have three text boxes ( text , moreText and evenMoreText ), how can I apply a verify listener with the same functionality to each, without having to repeat the ( .addVerifyListener(new VerifyListener() {... ) code three times? I don't want to implement a switch statement or similar (to decide which text box to apply it to), I want something more

Passing parameters to the view

陌路散爱 提交于 2019-12-01 18:47:52
In my RCP application, I have a View with a TreeViewer for Navigation on the left side and a Folder for my views on the right side. The Perspective looks like this: public void createInitialLayout(IPageLayout layout) { layout.setEditorAreaVisible(false); layout.setFixed(false); layout.addStandaloneView(NavigationView.ID, false, IPageLayout.LEFT, 0.7f, layout.getEditorArea()); right = layout.createFolder("right", IPageLayout.RIGHT, 0.3f, "com.my.app.views.browser.navigation"); layout.getViewLayout(WallpaperView.Id).setCloseable(false);//dummy view to keep the folder from closing layout

Layout issue: autogrow label (SWT)

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-01 18:40:05
问题 I'm using a GridLayout trying to make a label autogrow without hiding anything of its content. Here's a simple code to test: Everytime I press the button the label text grows larger, but only after I resize the window horizontally I get the correct layout. Is there any way to fix this without having to resize the window? I think I've tried every property and I still can't get this working, it's driving me nuts! This is what I got This is how it should be import org.eclipse.swt.SWT; import org

Automatically generate IDs on SWT-Widgets

偶尔善良 提交于 2019-12-01 18:08:29
Is there a way to automatically generate IDs on SWT-Widgets so UI-Tests can reference them? I know i can manually set an id using seData but I want to implement this feature for an existing application in a somewhat generic fashion. You can recursively assign IDs for all your shells in your application using Display.getCurrent().getShells(); and Widget.setData(); . Setting the IDs Shell []shells = Display.getCurrent().getShells(); for(Shell obj : shells) { setIds(obj); } You have access to all the active (not disposed) Shells in your application with the method Display.getCurrent().getShells()

Windows 7 SWT Table selected row highlight color

对着背影说爱祢 提交于 2019-12-01 17:39:56
Is there a way to set the background color of a highlighted row of a SWT Table (FULL_SELECTION style) in Windows 7's Aero theme? It appears that it's a derived, lighter color from the background color of the Table. But other than that, I don't seem to have much control over what color to use. This is a problem to us because some of our table items' texts (foreground) are grayish whites, so they are very harder to read if the row is selected on a light-colored background. I've already set the background color of the table to Black, but the text is still pretty hard to see. Are there any

How can I put a “(de)select all” check box in an SWT Table header?

巧了我就是萌 提交于 2019-12-01 16:58:22
I have an SWT Table that I'm instantiating with the SWT.CHECK style in order to display a check box next to every row. My users have requested another check box in the header row of the table in order to allow them to select/deselect all the rows with one click. I can't see any obvious way to do it, and I've only found Swing/JTable examples through Google. Does anyone know how to do this? I'm hoping it's possible without re-implementing Table or falling back on a header context menu. Suraj.c.s Just create two images of check box. First one without a tick and second one having a tick.Now add

Adding right click menu to to treeitem in SWT tree

a 夏天 提交于 2019-12-01 15:36:32
How can I add a right click popup menu to a treeitem in a SWT Tree. Each treeitem should have a right click enabled on it Just use tree.setMenu(Menu) . There you go: public static void main(String[] args) { Display display = Display.getDefault(); final Shell shell = new Shell(display); shell.setText("StackOverflow"); shell.setLayout(new FillLayout()); final Tree tree = new Tree(shell, SWT.NONE); for(int i = 0; i < 10; i++) { TreeItem item = new TreeItem(tree, SWT.NONE); item.setText("Parent " + i); for(int j = 0; j < 3; j++) { TreeItem child = new TreeItem(item, SWT.NONE); child.setText("Child