简体   繁体   中英

Why can't I see Changes in SWT / JFace TitleAreaDialog in my eclipse plugin?

I am developing an eclipse plugin (not RCP) and I am using Jface and SWT to create it´s user interface. The fact is that I have downloaded the WindowBuilder plugin to make it easier to develop the user interface and I have created a custom TitleAreaDialog.

Up to this point everything goes ok and I can see the following TitleAreaDialog in the WindowBuilder (top image) and the problem comes when I try to run the eclipse plugin. The tree and it´s elements of the left side disappear:

WindowBuilder (top) and Plugin executed (bottom)

Does anybody know what is happening? Do I have to add something to plugin.xml or MANIFEST.MF?

Thank you.

EDIT: In the zip you will find the plugin.xml, MANIFEST.XML, build.properties, Handler and the gui called PlugiGUI. If you have any questions ask me please.

Thank you.

You can download the code here.

EDIT 2: Part of the MANIFEST.MF code is the following

Bundle-SymbolicName: org.eclipse.plugin.arturito;singleton:=true
Require-Bundle: org.eclipse.ui,
 org.eclipse.core.runtime
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .,
 swing2swt.jar

Part of the TitleAreaDialog code is the following:

/**
* Create contents of the dialog.
* @param parent
*/
@Override
protected Control createDialogArea(Composite parent) {
    //TITLE AND IMAGE OF TitleDialog
                ...

    //Composite        
    Composite area = (Composite) super.createDialogArea(parent);
    Composite container = new Composite(area, SWT.NONE);
    container.setLayout(new FillLayout(SWT.HORIZONTAL));
    container.setLayoutData(new GridData(GridData.FILL_BOTH));

    //Creates the division
    SashForm sashForm = new SashForm(container, SWT.NONE);


    //Right division
    Group rightGroup = new Group(sashForm, SWT.NONE);
    rightGroup.setLayout(new StackLayout());

    //Create the tree
    Tree tree = new Tree(rightGroup, SWT.BORDER);
    tree.setLinesVisible(true);
    tree.setToolTipText("");
    tree.setHeaderVisible(true);

    //Create tree elements
    TreeItem pluginProperties = new TreeItem(tree, SWT.NONE);
    pluginProperties.setText("Plugin properties");
    pluginProperties.setImage(ResourceManager.getPluginImage("org.eclipse.plugin.arturito", "icons/arturitoProperties.png"));


    TreeItem createPluginProperties = new TreeItem(pluginProperties, SWT.NONE);
    createPluginProperties.setText("Create");
    createPluginProperties.setImage(ResourceManager.getPluginImage("org.eclipse.plugin.arturito", "icons/arturitoPlus.png"));
    TreeItem editPluginProperties = new TreeItem(pluginProperties, SWT.NONE);
    editPluginProperties.setText("Edit/Delete");
    editPluginProperties.setImage(ResourceManager.getPluginImage("org.eclipse.plugin.arturito", "icons/arturitoRemoveEdit.png"));
    pluginProperties.setExpanded(true);

    //MORE TREE ELEMENTS WITH SAME PATTERN
    ..............

    //Left division
    Group leftGroup = new Group(sashForm, SWT.NONE);
    leftGroup.setLayout(new StackLayout());

    Composite projectConfigDescriptor = new Composite(leftGroup, SWT.NONE);

   //Proportion of sashForm
    sashForm.setWeights(new int[] {220, 469});
    return area;
}

Why does the WindowBuilder show the TitleDialog like I want and my plugin doesn´t?

You have the layout for your left and right groups set as StackLayout . This layout requires that you tell it which control is currently the top control to show. So you would do:

StackLayout layout = new StackLayout();
rightGroup.setLayout(layout);

... create Tree

layout.topControl = tree;

However as it stands there is no reason to use StackLayout as you are only creating one top level control on each side. So you could just use FillLayout :

rightGroup.setLayout(new FillLayout());

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM