jface

How to reduce composite size within the ScrolledComposite in swt?

六眼飞鱼酱① 提交于 2019-12-25 03:24:57
问题 I am struggling to reduce the size of components within the scrolled composite. The problem is , always components(Tableviewer) getting bigger size.Unable to reduce the size.i tried setSize method of components .But no effect public void createForm(final Form form, final FormToolkit toolkit) { parent = toolkit.createComposite(form.getBody()); GridLayout singleCol = new GridLayout(1, true); canvas.setLayout(singleCol); GridData fillData = new GridData(SWT.FILL, SWT.FILL, true, true); //

Add a Key Listener to TitleAreaDialog

余生长醉 提交于 2019-12-25 02:58:51
问题 I need to add a key listener to my TitelAreaDialog is there any solution to do this ? 回答1: You can add a Listener to the Display by using: Listener listener = new Listener() { public void handleEvent(Event event) { System.out.println(event.character); } } getShell().getDisplay().addFilter(SWT.KeyDown, listener); This will output all pressed keys without consuming the events, i.e. the underlying widgets will still register the events. Remember to remove it again in the close() method of the

TreeViewer color row alternatively

末鹿安然 提交于 2019-12-24 23:11:38
问题 I am new to eclipse SWT. I am trying to override the getBackground method of ITableColorProvider to color rows alternatively of a treeViewer. I was trying coloring with row index (index%2 == 0) . It colors all the rows instead. TreeViewer colors one cell at a time, instead of rows. Any pointers on how to achieve it (alternate row color for treeviewer) or code snippet will be very helpful. List<TreeItem> treeItems = Arrays.asList( m_viewer.getTree().getItems() ); int index = treeItems.indexOf(

Set the checkbox of a CheckboxTableViewer when the row is clicked

百般思念 提交于 2019-12-24 22:17:46
问题 I am very new to SWT. Started working on it today actually. I have a table of type CheckboxTableViewer. What i want to be able to do is whenever the user selects the row (i.e clicks anywhere on the row) I want the check box to be checked (ticked). Currently I have a listener on the CheckboxTableViewer as follows: diagnosesTableViewer.addCheckStateListener(new ICheckStateListener() { @Override public void checkStateChanged(CheckStateChangedEvent event) { Nomenclature changedStateNomenclature =

How to enable scroll when CheckboxTableViewer inside a ScrolledComposite is disabled?

喜欢而已 提交于 2019-12-24 19:14:09
问题 I have got a CheckboxTableViewer inside a ScrolledComposite. I have to enable or disable all the tableItems based upon the another checkBox button. To do this, I am using CheckboxTableViewer.getTable().setEnabled(false). In the above case, the ScrolledComposite is also disabling along with the table. But I want the scroll behaviour to work as-usual even when CheckboxTableViewer is disabled (all the items in the able are disabled). 回答1: It's not possible to make the table control show

Any workarounds to lack of PreSelection events in SWT/JFace?

為{幸葍}努か 提交于 2019-12-24 12:18:38
问题 In my application I want the user to save any changes before he leaves a tab (implemented as CTabFolder ). I tried to handle SelectionEvent , but it fires after the tab has been changed (so why does it even have a doit field? Does it fire before change for some other controls?) Looking on Bugzilla, I've found https://bugs.eclipse.org/bugs/show_bug.cgi?id=193453 and https://bugs.eclipse.org/bugs/show_bug.cgi?id=193064, neither of which is fixed. Since this requirement is probably common, does

Can't use JFace and SWT in eclipse without creating plugin

落爺英雄遲暮 提交于 2019-12-23 12:26:39
问题 DISCLAIMER : this is the classic case of .NET GUI trying to work his way around JAVA stuff. PROBLEM DESCRIPTION: I am trying to build a very simple GUI with JFace and SWT - the code is straightforward (there's plenty tutorials), what it's not so straightforward is that I can't seem to get JFace and SWT to work outside a plugin project. I would expect to be able to use JFace and SWT in my project no hassle, since I put "C:/eclipse 3.5/plugins" in my CLASSPATH (from my computer --> properties -

How do I make part of a TreeViewer cell bold?

回眸只為那壹抹淺笑 提交于 2019-12-23 09:42:58
问题 I currently want to write an Eclipse editor based on a JFace TreeViewer . I added a CellLabelProvider to the TreeViewer . If I set the font of a cell with directly in the update method of the CellLabelProvider to a bold font the label is shown bold. But I want only part of the label to be shown as bold. So I apply StyleRange s to the cell. Selected colors in the 'StyleRange's work perfectly, but setting the font of a StyleRange to a bold one, does not seem to work. Why is that and how do I

JFace/SWT: Change the labels for buttons in InputDialog

一世执手 提交于 2019-12-23 07:47:43
问题 I want to create an InputDialog with custom labels for the OK/Cancel buttons. I'm using org.eclipse.jface.dialogs.InputDialog. I tried to override the button creation method: @Override protected void createButtonsForButtonBar(Composite parent) { super.createButtonsForButtonBar(parent); getButton(IDialogConstants.OK_ID).setText(myOkText); getButton(IDialogConstants.CANCEL_ID).setText(myCancelText); } and it works, but the buttons are not resized (and the custom text results cropped). I guess

SWT error on OSX with Maven

纵饮孤独 提交于 2019-12-23 04:43:55
问题 I made a sample application where I want to test swt under osx using maven. I've read hundreds of articles and create the display on main thread, but the app throws the same exception. Could you check my pom file and my sample application? pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId