Skip to content
Advertisement

Tag: swt

Eclispe API – How to get parent project location

How to get the parent module of project. Here is my code works fine in Eclipse PDE. But when I test the plugin(installing in eclipse) using test application by selecting the child module this condition (if (projectRoot == selectedResource)) is coming true and it return src and target as child modules which is incorrect. Any suggestion on how to get

Eclipse API Read all submodules/child modules

I am trying to read all submodules of project. Below is the code which I wrote it is working as expected but I am not sure if this is an efficient way of reading all submodules of project. Please advice. Answer children[i].FOLDER == IResource.FOLDER doesn’t do anything – FOLDER is a constant so it is always true. You should never

How to make SWT button Text BOLD

I am creating a checkbox button with text in SWT. In messages.properties, I have the value How can i show the text(ie. Answer) of this button in BOLD? Answer You can convert the currently assigned font for the button to be bold using something like: Note: You must call boldFont.dispose() when you are done with the font (such as when

Change the font size of the y-axis and x-axis values

In the following code, I want to reduce the font size of the y-axis and x-axis values. I searched and found these code: suppose you want to reduce the font size of number axis use the following code: suppose you want to reduce the font size of CategoryAxis use the following code: but unfortunately, the size of the axes did

Make status trimbar contribution grow when its content changes

I’m trying to add an Eclipse status trimbar contribution where the contents of the contribution (i.e., child elements’ text) dynamically change. Note that I’m not trying to add “line, column” information into the status bar. Ideally, the contribution’s width should adapt to the width of its contents, a bit like what happens in VSCode: However, if that isn’t easily feasible,

How do I write a JUnit test for a custom SWT-Column-Ratio-Layout?

I found a custom SWT-Column-Ratio Layout on the internet which puts the children of a composite/control into a user-defined ratio. Unfortunately I cannot find the source of the implementation of the Column-Ratio Layout, but here’s how the code looks like: I want to test this layout. I am writing a JUnit test to test if the ratio is true when

SWT Labels not displaying after disposal and recreation

In the following code, clicking on one of the three display list buttons will first dispose of any labels in a composite and then create labels for each row in a list of Strings. The problem is that if you click on the same button a second time the text all dispersal. When you switch to one of the other

How can I create a checkbox in a TableViewer of JFace?

I have created a tableViewer with two columns and I want to make one of them a checkbox. To do that I have created a CheckBoxCellEditor, but I don´t know why it isn´t working. The column called tableName displays it´s values OK. The column specification is the following. And the EditingSupport is the following: The TableMetaData object decides if the

SWT DateTime – read date and time from two widgets

Imagine two widgets: and Would would be the most efficient way to read date and time from the two widgets into a single Date variable? Edit: The following solution that I have in mind is far from being elegant. I hope that there is a better way to do this. Answer For Java 8 and later you can use LocalDateTime:

Java SWT make a Label Scrollable

I have a Label in a Group in SWT and if it contains many lines of text, I would like to make it scrollable vertically. Setting the style parameter with SWT.V_SCROLL doesn’t seem to do it. How can I do this? Answer Label does not support scrolling. You could use a read only Text control which will scroll:

Advertisement