Menu
  • HOME
  • TAGS

I can't find class OwnerDrawLabelProvider in Jface jars and field SWT.PaintItem

java,eclipse,swt,jface

OwnerDrawLabelProvider is in the org.eclipse.jface plugin. The org.eclipse.rap.xxxx plugins you reference are part of Eclipse RAP not the core Eclipse JFace/SWT code....

My Plugin view when called from other plugin throws a NPE

eclipse,eclipse-plugin,eclipse-rcp,jface

Couple of changes solved the problem : When you are updating your view from a Non UI thread use : Display.getDefault().asyncExec(new Runnable() { public void run() { IWorkbenchWindow iw = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); try { view = (BrowserView) iw.getActivePage().showView( "com.he.reportLayer.views.BrowserView"); view.getBrowserInstance().setUrl(url); } catch (PartInitException e) { e.printStackTrace(); } // System.out.println("View >>" +...

How to format the text inside the StyledText widget

java,eclipse,swt,jface

The readLine method of BufferedReader does not include the line endings in the text it returns. So you need to add a new line when you add the text to StyledText: editor.append(str); editor.append('\n'); ...

Minimum size of JFace application window

java,swt,jface

Override the configureShell method and set the minimum size there: @Override protected void configureShell(Shell newShell) { super.configureShell(newShell); newShell.setMinimumSize(100, 100); } ...

Layout setting for a jface Table

java,user-interface,checkbox,swt,jface

The shell.pack() call recomputes the size of the shell to make it fit the contents. To restrict the size of the table you need to specify a height hint on the table: GridData gridData = new GridData(SWT.FILL, SWT.TOP, true, false, 3, 1); gridData.heightHint = 400; // Vertical size you want...

How to reuse context pop up menus from existing view in Eclipse plugin to a newly created view?

java,eclipse-plugin,swt,jface

Some menu items such as Copy and Paste you have to write yourself as Eclipse does not know how you want to copy your view objects. The 'Run As' menu item should appear at the IWorkbenchActionConstants.MB_ADDITIONS position in the menu, but only if the view item enablement is correct. For...

jFace CheckboxTableViewer and content provider

java,checkbox,jface

The CheckboxTableViewer uses a separate ICheckStateProvider to set the check boxes. Set with viewer.setCheckStateProvider(checkStateProvider); The provider has two methods isChecked and isGrayed. The values passed to these methods are the objects from your content provider. Alternatively CheckboxTableViewer has setChecked, setAllChecked, ... methods. ...

Dynamically update TreeViewer from eclipse plugin

java,eclipse-plugin,eclipse-rcp,jface

All the source code for this TreeViewer example is available in the link given in the 'Source Code' section at the start of the article. The link is http://www.eclipse.org/articles/Article-TreeViewer/cbg.article.treeviewer.zip...

ColumnViewerTooltipSupport in SWT

java,swt,jface,tableviewer

ColumnViewerToolTipSupport adds support for individual tooltips to TableViewer and TreeViewer (and other ColumnViewers), you enable this using: ColumnViewerToolTipSupport.enableFor(viewer); The support expects that the label provider(s) for the viewer are based on CellLabelProvider (or one of its subclasses). CellLabelProvider has getToolTipImage, getToolTipText, getToolTipBackgroundColor, getToolTipForegroundColor, getToolTipFont and getToolTipShift methods that you can...

How can we change default label provider of eclipse ide's project explorer view to render file with customized label

eclipse,eclipse-plugin,jface

we can extend eclipse decoration extension point to provide custom label. <extension point="org.eclipse.ui.decorators"> <decorator id="YourDecorator" label="Decorator Label" state="false" class="YourDecorator.class" objectClass="org.eclipse.core.resources.IResource" adaptable="true"> </decorator> </extension> for more info visit the following link : :https://eclipse.org/articles/Article-Decorators/decorators.html ...

Multiple Data Binding Objects in Eclipse Jface MVC

java,model-view-controller,jface

Each row in a table uses a single object provided by your content provider. So if you need values from different objects you will need return a composite class containing those objects from the content provider....

Eclipse RCP: NullPointer on getSite().setSelectionProvider(…)

eclipse,jface,rcp,e4

Eclipse 4 (e4) applications are completely different from traditional Eclipse 3.x style applications. In an e4 application you cannot use a lot of things that are used in a Eclipse 3.x application - so you need to check which style the example you are using is based on. The e4...

Eclipse PDE: Programmatically detect opened dialog and close it

eclipse,swt,eclipse-rcp,jface,eclipse-pde

You could use the Display.addFilter method to listen for all SWT.Activate events which will tell you about all Shells (and other things) being activated. You can then detect the shells you want to close. Something like: Display.getDefault().addFilter(SWT.Activate, new Listener() { @Override public void handleEvent(final Event event) { // Is this...

How to make SWT Table in CheckboxTableViewer scrollable?

java,swt,jface

I've managed to solve this issue by going back to square one and re-implementing in the most generic fashion I could find documented. I.e.: I've added a proper LabelProvider (and got rid of the ColumnLabelProvider), set a simple GridData layout data object to the table (and otherwise haven't messed with...

How can I decorate column images and text in an SWT TableViewer?

java,swt,jface,tableviewer

You can use DecoratingStyledCellLabelProvider which takes an IStyledLabelProvider and an ILabelDecorator as parameters: new DecoratingStyledCellLabelProvider(styledLabelProvider, PlatformUI.getWorkbench().getDecoratorManager() .getLabelDecorator(), null); ...

Save doesn't get enabled on SWT EditorPart when cell is modified in TableViewer

java,swt,jface,rcp,tableviewer

That is how ComboBoxCellEditor is designed to work. The internal method applyEditorValueAndDeactivate is only called on Tab, Enter, and focus lost. None of this behavior looks easy to modify other than by writing your own version of the class (which is not large)....

synchronize modification between SWT table and TextEditor

table,eclipse-plugin,swt,text-editor,jface

The IDocument used by the TextEditor gives you access to the document contents. Get this with something like: IDocumentProvider provider = editor.getDocumentProvider(); IEditorInput input = editor.getEditorInput(); IDocument document = provider.getDocument(input); IDocument has many methods for accessing lines such as: int getLineOffset(int line); int getLineLength(int line); and methods for modify the...

SWT TreeViewer expand and collaps at the same time when SWT.FULL_SELECTION is set

java,treeview,swt,jface

I can observe the issue that you describe on Windows 7. This something that expands/collapses an item is most likely native code. While I think this is a bug in SWT or the Win32 tree control that should be reported and fixed or worked around in SWT, I found a...

How to create tabs in JFace Custom Dialog?

swt,jface

This has nothing to do with dialogs. You simply create your TabFolder control on top of the dialog's dialogArea, and that's pretty much everything to it. See this example on how to create a SWT Tab Control...

How to send a JFace Dialog to the background or minimize it?

java,eclipse,dialog,swt,jface

You can make the dialog 'modeless' so that it does not block the application (like the Find/Replace dialog in Eclipse). Call setShellStyle(getShellStyle() ^ SWT.APPLICATION_MODAL | SWT.MODELESS); setBlockOnOpen(false); in the constructor for the Dialog to do this....

what is difference between ColumnLabelProvider and ITableLabelProvider in Jface tableviewer?

java,eclipse,jface,tableviewer

ITableLabelProvider uses one label provider to provide the labels for all the columns. ColumnLabelProvider uses a separate label provider for each column. It is intended to be used with TableViewerColumn: TableViewer viewer = new TableViewer(.....); TableViewerColumn col1 = new TableViewerColumn(viewer, SWT.LEAD); col1.setLabelProvider(column label provider for col 1); col1.setEditingSupport(editing support for...

extra column in a JFace TreeViewer

java,eclipse,jface,treeviewer

I solved it! was using a CTabItem instead of a TabItem.

Keybinding tooltip on action disappears after changing in with method setToolTip()

java,eclipse,eclipse-plugin,tooltip,jface

You can use the IBindingService to get the text for the key binding for a command: TriggerSequence activeBinding = bindingService.getBestActiveBindingFor("command id"); if (activeBinding != null && !activeBinding.isEmpty()) { String acceleratorText = activeBinding.format(); } In a view or editor this will get the binding service: IBindingService service = (IBindingService)getSite().getService(IBindingService.class); elsewhere you...

Differentiating between a CheckboxTreeViewers CheckStateListener and Selection Listener

java,swt,jface

If you get the current selection from the table rather than the selection change event that does not seem to change when the selection event is for clicking the check box. So it will be empty or the previously selected element and will not match the selection you get from...

SWT Help button in TrayDialog

java,eclipse,dialog,swt,jface

When the help button is pressed TrayDialog looks for a control with a SWT.Help listener. It starts at the currently focused control and moves up through the control's parents until it finds a control with the listener (or runs out of controls). You can set up a help listener that...

Find specific item in SWT Tree

java,eclipse,swt,jface

If you want to expand the tree to a node that may not have been shown yet you can use TreePath to tell the viewer about the full path to the node. Something like: List<Object> path = new ArrayList<>(); path.add(root element); ... path.add(intermediate elements in tree); path.add(node element); TreePath treePath...

JFace - Change font color in ToolBarManager

java,swt,eclipse-rcp,jface

ToolBarManager has a getControl() method which returns you the underlying SWT ToolBar control (note this method is only in ToolBarManager not the IToolBarManager interface). ToolBar has the usual SWT setForeground, setBackground, setFont methods. Note: depending on how the ToolBarManager is constructed the ToolBar may not be created until ToolBarManager.createControl is...

Eclipse Project Explorer filter for XML files

eclipse,jface,emf

You could use the org.eclipse.core.contenttype.contentTypes to define new content types for your file. Use the describer argument of the content type definition to specify a 'content describer' class which can check that the XML file meets your requirements. There is already an XMLContentDescriber class that you can use as a...

Sort SWT Table with ViewerComparator never calls compare

java,swt,jface

To use a comparator you must also use a Content Provider (TableViewer.setContentProvider) and a Label Provider or Column Label Provider. Creating the TableItems yourself means that the TableViewer will not work at all. When using a TableViewer you should not be creating or accessing TableItem objects at all - the...

Setting header of CheckboxTableViewer

java,jface

You need to use TableLayout and TableViewerColumn to define a column so you can set the header text. The minimum code would be: TableLayout layout = new TableLayout(); TableViewerColumn col = new TableViewerColumn(tableViewer, SWT.LEAD); col.getColumn().setText("Text"); layout.addColumnData(new ColumnWeightData(100)); table.setLayout(layout); ...

Programatically trigger DataBinding execution on Slider Selection

java,swt,eclipse-rcp,jface,e4

Notifying the control's listeners of a selection event might be enough: Event event = new Event(); event.widget = penaltyPercent; event.display = penaltyPercent.getDisplay(); event.type = SWT.Selection; penaltyPercent.notifyListeners(SWT.Selection, event); You might need to fill in more fields in the Event....

JFace TableViewer draw a rectangle on cell like Excel

java,eclipse-plugin,swt,eclipse-rcp,jface

By the looks of it, the drawn rectangle is as big as the cell, and therefore, it does not fit inside it. I would try drawing in the following way: gc.drawRectangle(rect.x, rect.y, rect.width-1, rect.height-1);...

File Selection from List in a Wizard page

eclipse,user-interface,eclipse-plugin,swt,jface

There is FilteredResourcesSelectionDialog that is a popup displaying any resource wanted, eventually with pre-loaded regexp, allowing to search for file, and you give him a root directory : You call getResult() to retrieve selection as Object[]. If you want to do just a wizard that does that, then I would...

StackLayout in WizardDialog and varying multiline Text with fixed height and dynamically showed scrollbar

java,layout,swt,jface,wizard

I solved your issue by entirely removing the scrollBarListener and fixing your layout a bit. The showErrorComposite(...) method now looks like this: private void showErrorComposite(String topMessage, String bottomMessage, List<IStatus> statusList) { final Composite errorComposite = new Composite(stackComposite, SWT.BORDER); final GridLayout layout = new GridLayout(); layout.verticalSpacing = 20; errorComposite.setLayout(layout); errorComposite.setLayoutData(new GridData(SWT.FILL,...

SWT: CheckboxCellEditor does not open when clicked

java,swt,jface,tablecelleditor

Looks like you can call setActivationStyle on the ComboBoxCellEditor to set what happens on activation: cellEditor.setActivationStyle(ComboBoxCellEditor.DROP_DOWN_ON_KEY_ACTIVATION | ComboBoxCellEditor.DROP_DOWN_ON_MOUSE_ACTIVATION); ...

how to avoid field disposed in a WizardPage

eclipse,swt,eclipse-rcp,jface

Don't try and wait for the next button to be clicked. Use addModifyListener to add a modify listener to each text control and save the value in a string whenever the text is modified. You can also use JFace 'data binding' for this sort of thing....

Is there a bug in the ProgressMonitorDialog constructor?

java,swt,jface

This is almost certainly platform dependent (Mac, Linux, Windows...). Not all platforms support not having a close button and the best that can be done is to disable it.

How to automatically expand all nodes of a PreferenceManager

java,swt,jface

If you create a subclass of PreferenceDialog you can override the createTreeViewer method and set the auto expand level: @Override protected TreeViewer createTreeViewer(final Composite parent) { TreeViewer viewer = super.createTreeViewer(parent); viewer.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS); return viewer; } ...

Display some part of text in bold and some part in italic in swt label

java,swt,jface

To display styled text in SWT you can use the Browser widget or StyledText widget. In both cases you likely need to change the default appearance and behavior to be label-like (i.e. background color, read-only) Browser Widget Browser browser = new Browser( parent, SWT.NONE ); browser.setText( "If you restore data...

How to set some data object to jFace TableViewer row

java,swt,jface

TableViewer (and other viewers) uses the item.setData(object) method itself to associate your data model object with the item. Setting the data value to something else will break the viewer. Also the viewer does not guarantee to use the same item for a particular row for the life time of the...

How to make JFace PopupDialog blocks on open

eclipse,dialog,jface,rcp

PopupDialog extends the JFace Window class so you can call: setBlockOnOpen(true); to ask for blocking. Do this before calling the open() method....

When is IWizard.canFinish executed

java,jface

canFinish is called by the WizardDialog whenever it needs to update the buttons on the button bar (the Back, Next and Finish button). There will be calls when the wizard is first shown and when you move between pages. Individual wizards can also call IWizardContainer.updateButtons whenever they want the button...

Listener class doesn't has effect on TableViewer?

java,swt,eclipse-rcp,jface

I just changed my eventType to SWT.Resize, instead of SWT.RESIZE, and now the listener is working fine.

How to add buttons to the JFace ErrorDialog

java,eclipse-plugin,jface

You can extend the ErrorDialog class so that you can override the createButtonsForButtonBar method. For example this is from the Eclipse p2 install plugin: public class OkCancelErrorDialog extends ErrorDialog { public OkCancelErrorDialog(Shell parentShell, String dialogTitle, String message, IStatus status, int displayMask) { super(parentShell, dialogTitle, message, status, displayMask); } @Override protected...

Eclipse RCP: How to listen to CheckboxTableViewer selection in other view

java,swt,eclipse-rcp,jface

You could write your own implementation of ISelectionProvider which returns the checked elements instead of using the default provider implemented by TableViewer which returns the selected elements.

WizardPage vs WizardDialog

java,swt,jface,wizard

WizardDialog contains one or more WizardPage s. Wizards are part of JFace API not SWT. Different WizardPages can slide back and forth on the same WizardDialog by clicking Back and Next button. Clicking on Finish button will close the WizardDialog and clicking on Cancel button will abort the operation. Check...

Eclipse RCP - JFace dialog doesn't show buttons

java,swt,eclipse-rcp,jface

Don't call setSize on the Shell you are overriding the size calculated by the layout and causing the buttons to be outside of the dialog. To control the size of the table set height and width hints on the table grid data: GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);...

What is the difference between jface treeviewer setComparer method and setSorter method?

java,eclipse-plugin,eclipse-rcp,jface

setSorter is an obsolete method which has been replaced by setComparator. The ViewerSorter class used by setSorter only supported the use of a Collator for sorting. The ViewerComparator class used by setComparator supports any Comparator class. The IElementComparer class set by the setComparer method is used when the viewer is...

Elapsed time column - how to refresh only one part of StructuredViewer

swt,eclipse-rcp,jface

The TreeViewer public void update(Object element, String[] properties) method is the lightest weight way to update a row. You can use the 'properties' argument to tell the label providers which column is being updated. The label providers should override public boolean isLabelProperty(Object element, String property) to tell the viewer which...

How can we get the item on which i am doing the drop on a treeviewer

drag-and-drop,swt,jface,e4,treeviewer

When using JFace Viewers you can use the JFace ViewDropAdapter class rather than DropTargetListener. This class does more work for you and has a getCurrentTarget() method to return the current target element. More details on this here...

Get rid of the extra line in my SWT ComboBoxCellEditor?

java,eclipse,swt,jface,inline-editing

The ComboBoxCellEditor uses a CCombo widget for editing. With CCombo#setVisibleItemCount() the number of visible items can be controlled. Depending on when you know how many items should be visble you can configure the combo box. For example through overriding createControl ComboBoxCellEditor editor = new ComboBoxCellEditor() { @Override protected Control createControl(...

Always show the file path in FilteredResourcesSelectionDialog

eclipse,eclipse-plugin,swt,eclipse-rcp,jface

The path is shown when there are multiple entries with the same name. This is to allow you to distinguish the entries. If you create a class derived from FilteredResourcesSelectionDialog (or anything based on FilteredItemsSelectionDialog) you can override the isDuplicateElement method to control this, for example: @Override public boolean isDuplicateElement(Object...

How to add html code to the table column header in Eclipse RAP

swt,jface,eclipse-rap

Markup can only be applied to TableItems. Table columns currently don't support markup. If you think you have a valid use case, you may want to open an enhancement request here: https://eclipse.org/rap/bugs/...

OK and Cancel button not visible in MessageDialog in JFace / SWT

java,swt,jface,messagedialog

No matter what I try ,not able to reproduce your issue.Its working perfectly fine for me even for big multi line string.Attached is the screen shot I guess there is some problem with the layout or size of the shell Object that you are passing Shell parentShell try sending null...

Retrieving arbitrary Eclipse preferences programmatically

eclipse,eclipse-plugin,jface

Use IFileEditorMapping[] mapping = PlatformUI.getWorkbench().getEditorRegistry().getFileEditorMappings(); to get the mappings between file types and their supported editors. Look at this javadoc to see everything you could ever want to know about the mappings...

how to create a mouse rightclick menu for a jface treeviewer

java,jface,e4,treeviewer

Try this, don't forget to call: createContextMenu(viewer); /** * Creates the context menu * * @param viewer */ protected void createContextMenu(Viewer viewer) { MenuManager contextMenu = new MenuManager("#ViewerMenu"); //$NON-NLS-1$ contextMenu.setRemoveAllWhenShown(true); contextMenu.addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(IMenuManager mgr) { fillContextMenu(mgr); } }); Menu menu = contextMenu.createContextMenu(viewer.getControl()); viewer.getControl().setMenu(menu); } /** *...

NullPointerException for org.eclipse.ui.internal.WorkbenchPage.showView

java,eclipse-plugin,swt,eclipse-rcp,jface

The perspectiveActivated listener is fired by the WorkbenchPage, the page seems not expect the listener to call the page showView method in the listener and gets confused if it does. Use Display.asyncExec to run the showView call. This will run the code after the WorkbenchPage has finished the work it...