swt

SWT Component for choose file only from workspace

蓝咒 提交于 2019-12-07 14:31:38
问题 I work with SWT and Eclipse's plugin. I need choose file only from workspace. I founded component for choose directory in workspace, component for choose file in file system, but i have not found component for choose file from workspace. Now I'm using org.eclipse.swt.widgets.FileDialog and set filter setFilterPath(Platform.getLocation().toOSString()) . But the user can choose other file not from workspace. They should only be able to set files from within the workspace. 回答1: Thank for answers

SWT System Tray - Linux GTK Gnome Tray icons with “SWT” String on tray

孤街醉人 提交于 2019-12-07 14:24:53
问题 I am configuring the system tray icons with the following code: /** * Configura os ícones da shell principal */ protected void setDiplayIcons(Shell shell){ Display display = shell.getDisplay(); InputStream inputImgTray = getClass().getClassLoader().getResourceAsStream(ImagensNaNOffline.IMG_LOGO_SEBRAE.getPath()); Image image = new Image(display, inputImgTray); shell.setImage(image); Tray tray = display.getSystemTray(); final ToolTip tip = new ToolTip(shell, SWT.BALLOON | SWT.ICON_INFORMATION)

SWT label size is not correctly updated

跟風遠走 提交于 2019-12-07 13:02:55
问题 I'm new in Java/SWT. I'm experiencing some troubles using a SWT label. When I update the text on the label, its size is not correctly updated (the label is cut, respecting the original size). However, if I perform a very small resize in my dialog, the size is updated correctly. Basically, I create the label with a default text and then, when I load data I update the label with the real text, that is bigger than the original one. I tried calling label.update() and label.redraw() without luck.

How to keep SWT menu open after user clicks menu item?

你离开我真会死。 提交于 2019-12-07 12:25:46
问题 I have an Eclipse RCP / SWT application with a Menu of Check Box Menu Items. I would like to be able to check/uncheck multiple items before clicking elsewhere to close the menu. However, the default SWT behavior is to close the menu after a single click. I have implemented the following very hacked solution which works, but is certainly not elegant and probably won't work properly on all platforms or under all circumstances. So I'm very interested in a simpler technique if one exists. The

How to display a popup menu by mouse left click in swt?

故事扮演 提交于 2019-12-07 10:58:53
问题 How to display a popup menu by mouse left click? I know the default is for mouse right click. But I want to expand(display) the menu just by a normal selection of a button. (by normal left click). How to popup a popup menu by normal right click is as follows. final Button btnNewgroup = new Button(compositeTextClient, SWT.NONE); Menu menu = new Menu(btnNewgroup); btnNewgroup.setMenu(menu); MenuItem mntmNewItem = new MenuItem(menu, SWT.NONE); mntmNewItem.setText("New Item"); MenuItem

Fire an event on mouseClick in SWT?

北城以北 提交于 2019-12-07 10:54:46
问题 In SWT, for MouseListener interface, the methods available are mouseUp() , mouseDown() and mouseDoubleClick() How to fire an event based on the user click? We can do this by conjunction of mouseUp() and mouseDown() but isn't there any trivial solution like mouseClick() method in SWT? Thanks. 回答1: How would a mouse-click event be defined? Mouse-down followed by mouse-up without mouse leaving the bounds of the control (otherwise it would be drag-start), right? By that definition, mouse-click

Overcoming Windows User Object Handle Limit

人走茶凉 提交于 2019-12-07 08:32:13
问题 I'm looking for advanced strategies for dealing with User Object Handle limits when building heavy-weight windows interfaces. Please explain how you overcame or bypassed this issue using SWT or direct Windows GUI APIs. The only thing I am not interested in is strategies to optimize widget usage as I have done this extensively and it does not solve the problem, only makes it less likely. My Situation: I have an SWT based GUI that allows for multiple sessions within the same parent shell and

Items decorations in a TreeViewer

拥有回忆 提交于 2019-12-07 08:21:50
问题 I have the following problem: I'm preparing an editor in Eclipse and one of the tab contains TreeViewer to show items in the tree. Each item has a name and a value, which is editable. The problem I need to indicate to user that value is incorrect (e.g. exceeds a given range). My idea is to decorate incorrect cells with a warning or error icon which will be shown also after editing is complete. Does anybody have an idea how to decorate items in the tree? I was experimenting with

Eclipse RCP Toolbar buttons with the Eclipse Look

我怕爱的太早我们不能终老 提交于 2019-12-07 08:18:29
In Eclipse, its easy to specify buttons for your toolbar using the ActionSets extension point. However, when I need to specify some items programmatically, I can't get the same look. I don't believe that the framework is using native buttons for these, but so far, I can't find the right recipe to match the Eclipse look. I wanted to see if anyone has found the right snippet to duplicate this functionality in code. It's difficult to tell from your question, but it sounds like you may be attempting to add a ControlContribution to the toolbar and returning a Button. This would make the button on

How to always show vertical scroll bar in SWT table?

懵懂的女人 提交于 2019-12-07 08:10:37
问题 Is it possible to always show the vertical scroll bar in a SWT table even if the table is empty? By always showing a (possible disabled) vertical scroll bar one can avoid that the last column get partially hidden when the columns use ColumnWeightData for layouting. I tried to initialize the table with SWT.V_SCROLL or to use table.getVerticalBar().setVisible(true) - both without success. There is a method setAlwaysShowScrollBars in ScrollableComposite . What I am looking for is a similar