Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Nebula WindowBuilder

Revision as of 18:05, 25 March 2020 by Unnamed Poltroon (Talk)

< Back to Nebula Main Page

Introduction

This tutorial explains how to integrate a widget into WindowBuilder.

This is work in progress version that will be continued and completed.

Setup

First of all, get the source code on github : [1].

Then create a projet in Eclipse and import all plugins into your workspace (if you use Egit, go to the EGit perspective, expand the node Working Tree, select all projects, right-click then choose Import projects).

Java part

Create the class

Open the plugin org.eclipse.wb.rcp.nebula and go to the directory src, package org.eclipse.wb.internal.rcp.nebula

Create a new package org.eclipse.wb.internal.rcp.nebula.XXX where XXX is you widget name :

Nebulawb1.png

In this package create a Java Class called XXXInfo where XXX is you widget name. This class is very simple, it extends CompositeInfo and contains a constructor.

public class TitledSeparatorInfo extends CompositeInfo {
 public TitledSeparatorInfo(AstEditor editor,
       ComponentDescription description,
       CreationSupport creationSupport) throws Exception {
   super(editor, description, creationSupport);
   // listener for setting property to default
   InstanceObjectPropertyEditor.installListenerForProperty(this);
 }
}

Add a new extension in your plugin.xml file

Open file plugin.xml of this plugin, , go to the Extensions tab and add a new entry under Nebula (category). The type of this entry is Component :

Nebulawb2.png

Just fill the class attribute with the qualified name of your Nebula widget (org.eclipse.nebula.widget.yyy).

Nebulawb3.png

Update Manifest.mf file

Open the manifest.mf file and in the Export-Package part add the package of you XXXXInfo class :

Nebulawb4.png

Icon

Create an icon that will be displayed in the palette. It is a PNG or GIF file, 16x16 pixels.

XML Configuration part

To be continued

Testing

Right-click on a plugin (for example org.eclipse.wb.rcp.nebula), choose Run as then Eclipse Application. In your Eclipse application create a new project.

Very import: do not forget to include the jar files that contain your widget in your project. You can retrieve the latest stable version here: [2]

Right-click on the src folder, choose New > Others..., then choose SWT Designer > SWT > Composite

Nebulawb5.png

You'll find your widget in the "Nebula" part of the palette.

Nebulawb6.png

Documentation

Open the project org.eclipse.wb.rcp.doc.user. Go to the folder html/palettes and edit the file swt_palette.html

Add you widget and a short description.

Back to the top