swt

Passing parameters to the view

给你一囗甜甜゛ 提交于 2019-12-04 04:00:00
问题 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

Windows 7 SWT Table selected row highlight color

夙愿已清 提交于 2019-12-04 03:19:55
问题 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

Looking for a Combo(Viewer) in SWT/JFace which supports autocomplete

馋奶兔 提交于 2019-12-04 01:56:31
I'm looking for a Combo(Viewer) in SWT/JFace which supports autocomplete / type-ahead, i.e. the user can enter a couple of characters and the drop down list should show all matching elements. You can also check out the org.eclipse.jface.fieldassist.AutoCompleteField class. It's not a combo, just a text field, but it adds auto complete functionality as if it were a combo very easily. You can do something as simple as this: Text textField = new Text(parentComposite, SWT.BORDER); new AutoCompleteField(textField, new TextContentAdapter(), new String[] {"autocomplete option 1", "autocomplete option

Drag & drop not working on Mac

跟風遠走 提交于 2019-12-04 01:38:27
I'm trying to make it possible to drag files from the Finder into my SWT application. On Windows and Ubuntu, the following bit of code works: public class DndTest { public static void main(final String[] args) { final Display display = new Display(); final Shell shell = new Shell(display, SWT.DIALOG_TRIM); shell.setText("Drag & drop test"); shell.setSize(200, 200); final FormLayout layout = new FormLayout(); shell.setLayout(layout); final Label lbl = new Label(shell, SWT.NORMAL); lbl.setAlignment(SWT.CENTER); lbl.setText("Drop files here"); final FormData layoutData = new FormData();

SWT composite - redraw problem

淺唱寂寞╮ 提交于 2019-12-04 01:16:53
I have a composite element, that initially has a Label. Now I call dispose on the it (the label) and create another label in the same container (composite elm), but I don't see the new text. It brings me to question how do I enable redraw on the composite, so that the new label (or any other component I might create) will render in place of the old one. Here is the code I have (separated into a unit test for redraw a composite) private Label createLabel( Composite parent) { Label label = new Label(parent, SWT.NONE); label.setAlignment(SWT.CENTER); label.setLayoutData( new GridData( SWT.CENTER,

File Explorer using Java - how to go about it?

守給你的承諾、 提交于 2019-12-04 01:13:50
问题 I am set to create a file explorer using Java. The aim is to emulate the behavior of the default explorer as closely as possible, whatever may be the underlying OS. I have done NO GUI programming in Java. I have looked-up Swing, SWT and JFace, and I am beginning my project with this tutorial: http://www.ibm.com/developerworks/opensource/library/os-ecgui1/ I would like to know your opinions about the best approach to tackle this problem. If you could comment on complexity of coding,

SWT tree > move the vertical scrollbar to the left of the tree without changing the orientation

梦想与她 提交于 2019-12-03 22:40:33
问题 How to put the vertical scroll bar on the left hand side of the tree? 回答1: If you are on Windows only, you could do this: int exStyle = OS.GetWindowLong(tree.handle, OS.GWL_EXSTYLE); exStyle |= OS.WS_EX_LEFTSCROLLBAR; OS.SetWindowLong(tree.handle, OS.GWL_EXSTYLE, exStyle); Otherwise you might want to look into Snippet296, which shows how to handle scrolling for a Tree using a ScrolledComposite. By adding the style SWT.RIGHT_TO_LEFT to ScrolledComposite, and SWT.LEFT_TO_RIGHT to the Tree in

Auto resize columns when items expand

倖福魔咒の 提交于 2019-12-03 21:34:49
In a tree with multiple columns, how do I resize columns to contents upon expand/collapse and data updates? The solution to the similar question for tables doesn't work. Same as: tree.addListener(SWT.Collapse, new Listener(){ @Override public void handleEvent(Event e) { expandAndResize(false, (TreeItem) e.item); } }); tree.addListener(SWT.Expand, new Listener() { @Override public void handleEvent(Event event) { expandAndResize(false, (TreeItem) event.item); } }); private static void expandAndResize(Boolean expand_, TreeItem item_) { System.out.println( (expand_?"Expanding":"Collapsing") +

Embed SWT Composite into C# application

萝らか妹 提交于 2019-12-03 20:57:00
I've got a Java application that uses SWT as its widget toolkit. I've also got a Windows C# application. I'd like a way to draw an SWT Composite into this C# application. I can think of two ways to do this: Handles: Since SWT is based on the native windowing toolkit, it seems like there should be a way to create a Composite in the C# application, pass the native pointer to the Java application, and then control the Composite from there. OLE: Since SWT can definitely consume OLE components, maybe there's also a way for it to present itself as an OLE component? Anybody have any tips on how I can

Ubuntu16.04下eclipse安装与运行不正常问题解决

こ雲淡風輕ζ 提交于 2019-12-03 18:52:40
下载eclipse http://www.eclipse.org/ 目前是neon版本 解压: tar xzvf eclipse-inst-linux64.tar.gz 运行解压目录下的,eclipse-inst ,这是图形界面向导安装 安装目录设定为 /opt/eclispe 安装完成后,根据下面最优方案,设置启动应用桌面eclispse.desktop,方便在ubuntu系统菜单中运行eclipse 上一个火星版本有如下问题: Ubuntu16.04下eclipse运行不正常,表现在运行缓慢,windows->preferences参数配置窗口不显示。解决办法是,在eclipse.ini文件 --launcher.appendVmargs语句前加: --launcher.GTK_version 2 另外一个方案: shell中先export SWT_GTK3=0 然后启动eclipse,效果还好 http://askubuntu.com/questions/761604/eclipse-not-working-in-16-04 最优方案: sudo ln -s /opt/eclipse/eclipse /usr/bin/eclipse sudo gedit /usr/share/applications/eclipse.desktop 输入如下内容: [Desktop