swt

Copy Image to Clipboard not working on Linux (Java AWT & SWT)

巧了我就是萌 提交于 2019-12-06 06:06:31
I am developing an Eclipse RCP Application which includes JFreeChart. One of its features is to copy graphs to the clipboard in order to paste them into other applications but it does not work on Linux, There is a SWT sample where you can find a snippet that does not work in Linux. On the other hand JFreeChart implemented this on AWT as: Clipboard systemClipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); Insets insets = getInsets(); int w = getWidth() - insets.left - insets.right; int h = getHeight() - insets.top - insets.bottom; ChartTransferable selection = new ChartTransferable

JFace dialog button translation

巧了我就是萌 提交于 2019-12-06 05:20:41
问题 I am creating a standalone SWT/JFace application. I used to use plain old SWT MessageBox: int style = SWT.APPLICATION_MODAL | SWT.YES | SWT.NO; MessageBox messageBox = new MessageBox (getShell(), style); messageBox.setText ("Question"); messageBox.setMessage ("So?"); boolean result = messageBox.open() == SWT.YES; I try to switch to JFace MessageDialog boolean result = MessageDialog.openQuestion(getShell(), "Question", "So?"); The problem I have is that in SWT, the Yes and No button labels are

Sleak SWT tool, Device is not tracking resource allocation

邮差的信 提交于 2019-12-06 05:07:38
I'm having trouble in testing an RCP application with Sleak because it does not display anything, it only shows the message "WARNING: Device is not tracking resource allocation". I've setup Sleak from this tutorial and I don't know what's wrong. Does anyone know a solution for this? Thanks in advance. Do you have the correct version ? Can you see the sleak view in your RCP-application? If not make sure it's in your launch configuration. Also double check that you have set the org.eclipse.ui/debug=true org.eclipse.ui/trace/graphics=true correct in the tracing tab. There are properties with

Draggable toolbar

假装没事ソ 提交于 2019-12-06 04:33:41
how to make draggable/dockable toolbar with JFace/SWT like Eclipse has? Could you post a simple example of ApplicationWindow or link good source of how to make it. Thanks. SWT has a component called CoolBar, You can create CoolBars fairly easily by using CoolBarManager , or you can manually use just them ( API Doc ) In case that someone found this question I have prepared small example. My problem was in incorrect use of add method. You have to use add(IToolBarManager toolBarManager) method from CoolBarManager not one of from base class ContributionManager . import org.eclipse.jface.action

How to get HTML from the browser in SWT after setting the URL

非 Y 不嫁゛ 提交于 2019-12-06 04:15:51
I have tried using String html = browser.getText(); But I am getting this error Exception in thread "main" org.eclipse.swt.SWTException: Failed to change Variant type result = -2147352571 at org.eclipse.swt.ole.win32.OLE.error(Unknown Source) at org.eclipse.swt.ole.win32.Variant.getAutomation(Unknown Source) at org.eclipse.swt.browser.IE.getText(Unknown Source) at org.eclipse.swt.browser.Browser.getText(Unknown Source) I have read this bug report: https://bugs.eclipse.org/bugs/show_bug.cgi?id=433526 Could anyone help me with other way to get HTML out of the browser? You could force SWT to use

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

走远了吗. 提交于 2019-12-06 04:09:00
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.grabHorizontal = true; editor.setEditor(text1, items[i], 0); editor = new TableEditor (table); final CCombo combo1 = new CCombo (table, SWT.NONE); combo1.setText(""); Set<String> comps = mapComponentToPort.keySet(); for(String comp:comps) combo1.add(comp); editor

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

拟墨画扇 提交于 2019-12-06 03:30:25
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); tip.setMessage("Balloon Message Goes Here!"); if(tray != null) { TrayItem trayItem = new TrayItem

Java SWT: widgetSelected vs widgetDefaultSelected

别说谁变了你拦得住时间么 提交于 2019-12-06 02:22:06
问题 For example I want to execute something when user clicks on a button. Which do I use? The documentation didn't appear to make it very clear UPDATE A quick test shows that Widget Selected is triggered but not Default Selected. In TasksView.main() TasksView view = new TasksView(shell, SWT.None); TasksController controller = new TasksController(view); In TasksController public class TasksController extends ControllerAbstract { protected TasksView view; public TasksController(TasksView view) {

NoClassDefFoundError on JFace FontRegistry

孤街浪徒 提交于 2019-12-06 02:13:35
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(Window.java:313) at org.eclipse.jface.dialogs.Dialog.close(Dialog.java:971) at org.eclipse.jface.dialogs.ProgressMonitorDialog.close(ProgressMonitorDialog.java:348) at org.eclipse.jface.dialogs.ProgressMonitorDialog.finishedRun(ProgressMonitorDialog.java:582) at org

SWT Component for choose file only from workspace

孤者浪人 提交于 2019-12-06 02:08:43
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. Thank for answers. I create own component and use it. Also i add filter for choose files. import java.util.ArrayList; import