swt

Blinking background rows of TableViewer or TreeViewer in SWT

◇◆丶佛笑我妖孽 提交于 2019-12-05 03:44:31
I need the ability to have a blinking (red, maybe more colors) background for rows in a TableViewer/TreeViewer. What are the best options? There may be more than one row blinking, the blinking MUST be synchron and I need two blinking modes, fast and slow. Kire Haglin I would do something similar to this. Update the elements that you need to change the colors for at a regular interval. At each update toggle the colors depending on how you want them to flash. void scheduleColorChange(final Color colors[], final int startIndex, final int changeInterval) { getDisplay().timerExec(changeInterval,

Eclipse插件开发初遇

安稳与你 提交于 2019-12-05 03:03:02
一、涨姿势 在介绍 Eclipse 插件开发之前先介绍一点有趣的小知识,刚刚开始的时候知道 Eclipse 是 Java 写的我很惊讶,我比较奇怪为什么 Eclipse 使用 Java 写出来的界面那么精致,而我自己写的 Java 窗体程序简直没有办法见人。 说来真的非常惭愧,知道今天我才知道 Eclipse 不是使用的 Sun 的 AWT 和 Swing 技术,而是自己弄了一个底层图形技术 SWT ( Standard Widgit Toolkit ,标准图形工具箱),这里先说一说这 3 中技术。 首先是 AWT ,这个是 Java 中最早弄的一个底层图形技术,因为 Java 要跨平台,所以 AWT 是对所用图形系统的支持的图形的一个交集,从名字就可以看出来 AWT ( Abstract Widgit Toolkit ,抽象图形工具箱),它是对支持的图形系统的一个抽象,就是提取公有的做成抽象图形工具箱。这样做的缺点也是很明显的嘛 ? 交集嘛,支持的图形组件当然少了,做出来的东西简陋也就理所当然了。 Swing 的思想是,基本图形系统都支持手绘(自己写函数画)图形界面。 Swing 的组件就都是手绘出来的。这样用户需要什么就完全可以自己手绘就可以了,它的缺点是要自己实现消息处理,性能不是很好。 Eclipse 的 SWT 技术的思想就是结合了 AWT 和 Swing 的技术

Auto resize columns when items expand

情到浓时终转凉″ 提交于 2019-12-05 02:59:15
问题 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

SWT: How to recreate a default context menu for text fields

淺唱寂寞╮ 提交于 2019-12-05 02:30:47
问题 I need to add some items to the default context menu of a text control in SWT, but already found out I cannot modify this menu and have to create a new one from scratch. But how do I emulate the default functions Undo, Cut, Copy, Paste, Delete? Do I really have to re-implement all this Clipboard stuff for myself? And I don't even know how to access the Undo history of the control. Is there some maybe dirty hack to emulate the key codes that achieve the functionality? 回答1: The StyledText has

How to correctly style borders of a CTabItem

こ雲淡風輕ζ 提交于 2019-12-05 02:28:22
问题 I have written an Eclipse plugin which provides some UI which uses the CTabFolder component. The CTabItems provided by Eclipse have a blue border when active and a white border when inactive (grey if the CTabItem is an Eclipse View). The CTabItems which I have created are always bordered in white and the text on the active tab is underlined. How can I control the style of my CTabItems to more closely match the Eclipse tabs? EDIT: I have come up with the following code which extracts the

org.eclipse.swt.widgets.Button click from code

依然范特西╮ 提交于 2019-12-05 02:11:45
I am trying to click Button from code. I am tying to do the following: class MyMouseAdapter extends MouseAdapter { public void mouseDown(MouseEvent evt) { System.out.println("Working!!!!"); } } Button button = new Button(); button.addMouseListener(new MyMouseAdapter()); now I want to run the mouseDown method from code could you tell me how to do it? Thank you. You can do this: button.notifyListeners( SWT.MouseDown, null ); Where null is an Event . Remember that this is the Event received by your listener. If you need all the listeners to be notified then you can try the below code, yourbutton

SWT: Getting notified of a system device change (USB device connection / disconnection)

别等时光非礼了梦想. 提交于 2019-12-05 01:31:29
问题 I'm writing an SWT application which needs to sit in the system tray and pop up automatically whenever the user connects some USB device (the application serves as its control panel). The way to do this in the native environment (win32 in this case, but I should be platform-independent ultimately) is to listen to the WM_DEVICECHANGE event, then checking if my device has been disconnected. Googling the subject, it seems like SWT does not in fact handle this type of event. Does anyone have any

SWT/JFace: remove widgets

前提是你 提交于 2019-12-05 01:25:23
Group group = new Group(parent, SWT.NONE); StyledText comment = new StyledText(group, SWT.BORDER_DASH); This creates a group with a text area inside. How can I later delete the text (remove it from the screen so that I can replace it with something else)? Use Widget.dispose. public class DisposeDemo { private static void addControls(final Shell shell) { shell.setLayout(new GridLayout()); Button button = new Button(shell, SWT.PUSH); button.setText("Click to remove all controls from shell"); button.addSelectionListener(new SelectionListener() { @Override public void widgetDefaultSelected

Debugging an SWT application causes all GTK application to freeze

无人久伴 提交于 2019-12-05 01:00:37
问题 I have an SWT application which I debug via remote debugging in eclipse. If I set a breakpoint inside an event handler of the SWT app my hole desktop freezes. I can still switch to a text console via Strg + Alt + Fx . If I kill the SWT app from the console everything continues to work. Since this only happens when the breakpoint is inside an event handler I highly suspect SWT to block in the event loop causing everything to freeze. My guess is, that there is some magic parameter for SWT to

How to get JavaDoc for SWT and JFace in Eclipse?

大兔子大兔子 提交于 2019-12-05 00:25:09
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! I assume you've dowloaded the jars yourself and referenced them in your project. If so, you can right click the jar in the project explorer (in the 'Referenced Libraries' node) and click 'Properties'. The window that appears you can define the location of the jar's JavaDoc and source, if you have those available. You can also reach this by clicking Project > Properties > Java Build Path > Libraries and expanding the node for the jar to which you want to