swt

Jface TreeViewer add right click menu, depending on clicked node

烂漫一生 提交于 2019-12-11 22:21:53
问题 There is a good thread on how to correctly hook up a right-click menu to a Jface TreeViewer depending on the selected item. I would like to show the right click menu depending on: if the right-click was on a node or into "empty space". The problem is that TreeViewer does not automatically clear the selection if you click into empty space. Is there any clean way how to achieve this? My current approach would be to simply hook up a MouseListener to the tree with the following mouseDown method:

How do I launch another app from Java on a Mac

▼魔方 西西 提交于 2019-12-11 20:20:02
问题 The code I wrote that works fine on Windows is not working on the Mac. The short form I am calling: Runtime.getRuntime().exec (String ["/Applications/CM Battle for Normandy/CM Battle for Normandy.app" "2vs2 White Manor 072.ema"], null, "/Applications/CM Battle for Normandy/"); There is no file association setup with .ema files by the software I am trying to run (it's a game if you are curious) My code looks like this: private void launchGameProgram (PBEMGame selectedGame) { if (selectedGame =

How can i repaint a composite in Java (SWT)?

为君一笑 提交于 2019-12-11 20:13:19
问题 When i press a button in my swt program, a new composite should be drawn. But the composite only displays if i resize the window. I have a composite ( compLoad ) in my gui which is assigned a new composite compHELP comHelp_ = new compHELP(compLoad, SWT.RESIZE); i have tried redraw() but nothing happens 回答1: The composite needs to be re-layouted when adding/removing controls , see Composite.layout() // uses Composite.layout(true) Composite.layout(boolean changed) Composite.layout(boolean

SWT Section/ExpandableComposite in Eclipse e4 Project

跟風遠走 提交于 2019-12-11 20:09:43
问题 Is is not possible to use Eclipse Forms (org.eclipse.ui.forms) in pure e4 projects? I want to utilize an ExpandableComposite. When I start my application using the run/debug configuration everything works find. But as soon as I try to run it from the product configuration or is as a packaged e4 product, I'm getting a "Missing Constraint: Require Bundle: org.eclipse.ui.forms" error. Also, adding org.eclipse.ui.forms to the list of dependencies and starting the product, seems to alter my plugin

Invalid Thread Access

牧云@^-^@ 提交于 2019-12-11 19:46:15
问题 The create View Control Class public void createPartControl(Composite parent) { //viewer = new TableViewer(parent, SWT.MULTI| SWT.V_SCROLL); //viewer.setContentProvider(new ViewContentProvider()); //viewer.setLabelProvider(new ViewLabelProvider()); // Provide the input to the ContentProvider //viewer.setInput(new String[] {"One", "Two", "Three"}); //Display display=new Display(); parent.getShell().setText("A dialog box with no buttons at all press 'ESC' to close"); final Shell shell = new

Appropriate Listener for SWT Text

会有一股神秘感。 提交于 2019-12-11 19:44:24
问题 I have a JFace dialog which contains SWT Text and a button . Initially when the dialog is opened the button should be disabled, and when I click on the Text and as long as the caret position of the Text is visible button should be enabled. These are the listeners i am using : text.addMouseListener(new MouseListener() { @Override public void mouseDoubleClick(MouseEvent arg0) { } @Override public void mouseDown(MouseEvent arg0) { } @Override public void mouseUp(MouseEvent arg0) { testButton

An SWT FileDialog Selected Directories Only in Swing

人走茶凉 提交于 2019-12-11 19:44:20
问题 I have a swing app that I would like to use Windows7/Vista style FileDialogs and have found a reasonable solution using SWT in conjunction with swing: Does Swing support Windows 7-style file choosers? However, now I'm trying to get this same dialog to accept only directories (the "Select Folder" button instead of the "Open" button). I do not want to use the typical DirectoryDialog: I want to use the Dialog with favorites on the left, address bar on the top, and the ability to select folders:

Highlighting swt table row on focus lost

谁说我不能喝 提交于 2019-12-11 19:21:44
问题 I am facing the same problem mentioned here SWT: Table lost selection . I am using ubuntu 12.04 NOT windows. Is there any way to highlight the selected row of a SWT table even after focus lost. I tried adding focus listener to the table and in focus lost I changed the selected item background colour and on focus gain resets the background colour. See the code. @Override public void focusLost(FocusEvent e) { System.out.println("table focus los"); TableItem item = fileListTable .getItem

How to select a treeview node like a click of mouse to update properties view

白昼怎懂夜的黑 提交于 2019-12-11 19:05:39
问题 I have a custom outline in my Eclipse plug-in, implemented using class TreeViewer and I created this outline using this code: public class MyOutlinePage extends ContentOutlinePage (...) Object[] data = (...) TreeViewer treeViewer = getTreeViewer(); treeViewer.setInput(data); After set input I need to select one specific element in outline. For example, I need to select the element data[2] in the outline. Im trying to use this code to select the emelent of outline: treeViewer.setSelection(new

SWT TableViewer Header-Height

人走茶凉 提交于 2019-12-11 18:27:59
问题 I'm changing the fontsize of a SWT Tableviewer, but the height of the table-headers doesn't change, and thus the label is being cut off. Is there any way to fix this? (This is on Windows) 回答1: Table Comes Under SWT and on the other TableViewer Comes Under JFace . So it is not clear whether you need a solution for TableViewer or Table . Also in absence of any code snippet from your side, I am choosing to demonstrate it for JFace and TableViewer , though the concept will remain same for Table