簡體   English   中英

為什么在我的eclipse插件中看不到SWT / JFace TitleAreaDialog中的更改?

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

我正在開發一個eclipse插件(不是RCP),並且正在使用Jface和SWT創建它的用戶界面。 事實是,我已經下載了WindowBuilder插件以使其更易於開發用戶界面,並且創建了自定義的TitleAreaDialog。

到目前為止,一切正常,我可以在WindowBuilder中看到以下TitleAreaDialog(上圖),並且當我嘗試運行eclipse插件時出現了問題。 該樹及其左側的元素消失了:

WindowBuilder(頂部)和已執行插件(底部)

有人知道發生了什么嗎? 我是否必須在plugin.xml或MANIFEST.MF中添加一些內容?

謝謝。

編輯:在zip中,您將找到plugin.xml,MANIFEST.XML,build.properties,Handler和名為PlugiGUI的gui。 如果您有任何問題,請問我。

謝謝。

您可以在此處下載代碼。

編輯2:MANIFEST.MF代碼的一部分如下

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

TitleAreaDialog代碼的一部分如下:

/**
* 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;
}

為什么WindowBuilder會像我想要的那樣顯示TitleDialog而我的插件卻不顯示?

您已將左右組的布局設置為StackLayout 此布局要求您告訴它哪個控件當前是要顯示的頂級控件。 所以你會做:

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

... create Tree

layout.topControl = tree;

但是,就目前情況而言,沒有必要使用StackLayout因為您僅在每一側都創建了一個頂級控件。 因此,您可以使用FillLayout

rightGroup.setLayout(new FillLayout());

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM