swt

How to get JavaDoc for SWT and JFace in Eclipse?

I'm a newbie to Eclipse and can't figure out how to get the JavaDocs for SWT and JFace to show up when I am editing. How do I do this? Thanks! ...

How to keep the bottom of an SWT Browser widget visible when appending to the HTML content?

I'm viewing HTML in an SWT Browser widget. I am appending logging messages to the end of the content and would like to keep the bottom visible all the time. Currently, whenever I append text to the content, I first set the new text: browser.setText(content); And then I scroll down the Browser widget via JavaScript: browser.execute("w...

Why does an SWT Composite sometimes require a call to resize() to layout correctly?

Sometimes we encounter an SWT composite that absolutely refuses to lay itself out correctly. Often we encounter this when we have called dispose on a composite, and then replaced it with another; although it does not seem to be strictly limited to this case. When we run into this problem, about 50% of the time, we can call pack() and l...

NoClassDefFoundError on JFace FontRegistry

When I launch an SWT application (via an Eclipse launch profile), I receive the following stack trace: Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/jface/resource/FontRegistry at org.eclipse.jface.resource.JFaceResources.getFontRegistry(JFaceResources.java:338) at org.eclipse.jface.window.Window.close(W...

Best book for learning SWT

I'm in the beginning of a new project based on SWT (it is an Eclipse RCP project). I've got a previous experience in swing but i don't know if it helps learning SWT. However, i would like to know the best book for learning SWT; i've seen different books but they are quite old (SWT in action was published on 2004). Are they still worth re...

"Fixing" the first few columns in an SWT table to prevent them from scrolling horizontally

We have implemented a table-based editor with an SWT tree table. It pretty much does what we want it to, except that we can't find a way to ensure that the first few columns remain at their position when the user scrolls horizontally (so that one can identify the row being edited). There are a number of third-party table controls in var...

Window ID from Java SWT

I would like to find the window ID of my SWT program. I start up my SWT shell in the standard way. How do I then find the ID of the window that's been created? The program is executing on Fedora 10 using the Compiz-Fusion window manager (if that makes a difference). Code to help explain what I mean: public static void main(String[] ar...

Java SWT: How to indicate a menu item is selected

Using SWT, what is the common way to indicate that a menu item (from a taskbar menu) is the currently active selection? Checkmark? Bold? How is this done with code? ...

How to use the JFace FileDialog from within an Eclipse plugin in a modeless way?

I am writing an Eclipse plugin, and in response to some action I am interesting in starting a series of operations (within a separate job). One of these operations is to request the user to provide a filename, which I'm trying to do with the JFace JDialog. However, I'm not clear how to do this in a modeless way; for example, where do I ...

Running SWT components within a Swing App

I was wondering if anybody had any experience trying to run a complex SWT UI hosted inside a Swing component. I've managed to get a very simple demo going but if anyone else has tried and failed / succeeded to do this it'd be great to learn from their experiences. So to reiterate my application is a Swing app I wish to make use of a co...

dynamic combo-box list in java swt table

I create a Combo-box control in org.eclipse.swt.widgets.Table The code snippet is below ... TableEditor editor = new TableEditor (table_LLSimDataFileInfo); CCombo combo = new CCombo (table_LLSimDataFileInfo, SWT.NONE); combo.setText("CCombo"); combo.add("item 1"); combo.add("item 2"); editor.grabHorizontal = true; ...

How to figure out the preferred size of a JFace TreeViewer or SWT Tree?

I am writing an Eclipse plugin which has a hover control that consists of two controls, one on top of another: An HTML viewer (BrowserInformationControl) for which I Can easily compute the size hint A TreeViewer that contains a Tree. I have set up my tree with actual contents. However, I can't find a way to figure out the size of the ...

How to get the text content on the swt table with arbitrary controls

I have different controls placed on a table using TableEditor. ... TableItem [] items = table.getItems (); for (int i=0; i<items.length; i++) { TableEditor editor = new TableEditor (table); final Text text1 = new Text (table, SWT.NONE); text1.setText(listSimOnlyComponents.get(i).getName()); text1.setEditable(false); editor.grabHor...

SWT DropTargetListener has empty event data under Mac OS X

I'm currently experiencing a weird platform inconsistency between Mac OS X and Windows/Linux. I've implemented an SWT DropTargetListener and tried to analyze the data dropped in the dragEnter method. Unfortunately, the data attribute of the TransferData contained in the DropTargetEvent parameter is always null on OS X (but becomes valid...

Laying out a SWT component hierarchy

What's the best way to cause a component hierarchy to relayout when a SWT control's preferred size changes? My particular situation is a dynamic update of a Label's text. ...

Vertical center a TextFlow in GEF

I'm trying to vertical center a multiline textbox within a RectangleFigure in GEF. It needs to be ajusted on resize. This would be best done with a layout, but I can't figure out how that works. I'm adding a BorderMargin to the parent FlowPage and changing the margin when the RectangleFigure gets resized. Unfortunately, at that particu...

Proper way to bind a radio button group using JFace data binding

Hello, I was wondering if anyone could explain to me how I could properly bind a group of radio buttons to a boolean variable in the model using JFace data binding. Let me explain the situation first: I've created a class that represents a group of SWT buttons (with the style set to 'SWT.RADIO') that consists of three elements: A label...

Can you change the background and/or foreground colors of an SWT TabItem?

I'd like to change the background and/or foreground colors of the text on an SWT TabItem; however, it (and it's class hierarchy) don't seem to have methods for this - and I can't seem to find any other members I can get ahold of to do this. Ideas? ...

eclipse jface filtered items selection dialog with multiple-column table

I'm coding up a dialog box for an Eclipse plug-in much like the built-in FilteredItemsSelectionDialog from jface, except that the items that can be selected are (basically) made up of three strings, so I would like the table to show three columns that are sortable in addition to being filterable. I started pursuing the cleanest solution ...

swt.graphics.ImageLoader.save() not flushed?

I'm using this class swt.graphics.ImageLoader to save a file as a PNG: ImageLoader loader = new ImageLoader(); loader.data = new ImageData[] { m_imgdat }; loader.save(selected, SWT.IMAGE_PNG); Yet sometimes the file I get is incomplete. the last line of pixels is black and some programs (photoshop) refuse to open it altogether. Is the...