Example usage for org.eclipse.jface.databinding.swt WidgetProperties selection

List of usage examples for org.eclipse.jface.databinding.swt WidgetProperties selection

Introduction

In this page you can find the example usage for org.eclipse.jface.databinding.swt WidgetProperties selection.

Prototype

public static IWidgetValueProperty selection() 

Source Link

Document

Returns a value property for observing the selection state of a Button , CCombo , Combo , DateTime , List , MenuItem (since 1.5), Scale , Slider (since 1.5) or Spinner .

Usage

From source file:org.eclipse.e4.tools.emf.ui.internal.common.component.TrimBarEditor.java

License:Open Source License

private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master,
        boolean isImport) {
    CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM);

    CTabItem item = new CTabItem(folder, SWT.NONE);
    item.setText(Messages.ModelTooling_Common_TabDefault);

    parent = createScrollableContainer(folder);
    item.setControl(parent.getParent());

    if (getEditor().isShowXMIId() || getEditor().isLiveModel()) {
        ControlFactory.createXMIId(parent, this);
    }//from w  ww  .  j  a v  a2 s  .c  o  m

    IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify);

    if (isImport) {
        ControlFactory.createFindImport(parent, Messages, this, context);
        folder.setSelection(0);
        return folder;
    }

    ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp,
            EMFEditProperties.value(getEditingDomain(),
                    ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID));
    ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(),
            context, textProp, EMFEditProperties.value(getEditingDomain(),
                    UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE));

    // ------------------------------------------------------------
    {
        Label l = new Label(parent, SWT.NONE);
        l.setText(Messages.TrimBarEditor_Side);
        l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));

        ComboViewer viewer = new ComboViewer(parent);
        viewer.setContentProvider(new ArrayContentProvider());
        viewer.setInput(SideValue.values());
        GridData gd = new GridData();
        gd.horizontalSpan = 2;
        viewer.getControl().setLayoutData(gd);
        IObservableValue sideValueObs = EMFEditProperties
                .value(getEditingDomain(), UiPackageImpl.Literals.GENERIC_TRIM_CONTAINER__SIDE)
                .observeDetail(master);
        context.bindValue(ViewerProperties.singleSelection().observe(viewer), sideValueObs);
    }

    // ------------------------------------------------------------
    {
        Label l = new Label(parent, SWT.NONE);
        l.setText(Messages.TrimBarEditor_Controls);
        l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false));

        Composite buttonCompTop = new Composite(parent, SWT.NONE);
        buttonCompTop.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false, 2, 1));
        GridLayout gl = new GridLayout(2, false);
        gl.marginLeft = 0;
        gl.marginRight = 0;
        gl.marginWidth = 0;
        gl.marginHeight = 0;
        buttonCompTop.setLayout(gl);

        final ComboViewer typeViewer = new ComboViewer(buttonCompTop, SWT.READ_ONLY);
        typeViewer.setContentProvider(new ArrayContentProvider());
        typeViewer.setLabelProvider(new LabelProvider() {
            @Override
            public String getText(Object element) {
                return ((EClass) element).getName();
            }
        });
        typeViewer.setInput(
                new Object[] { MenuPackageImpl.Literals.TOOL_BAR, MenuPackageImpl.Literals.TOOL_CONTROL });
        typeViewer.setSelection(new StructuredSelection(MenuPackageImpl.Literals.TOOL_BAR));
        typeViewer.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));

        Button b = new Button(buttonCompTop, SWT.PUSH | SWT.FLAT);
        b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add));
        b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false));
        b.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                EClass eClass = (EClass) ((IStructuredSelection) typeViewer.getSelection()).getFirstElement();
                handleAddChild(eClass);
            }
        });

        new Label(parent, SWT.NONE);

        final TableViewer viewer = new TableViewer(parent);
        viewer.setLabelProvider(new ComponentLabelProvider(editor, Messages));
        viewer.setContentProvider(new ObservableListContentProvider());
        GridData gd = new GridData(GridData.FILL, GridData.FILL, true, true, 2, 1);
        viewer.getControl().setLayoutData(gd);

        IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN);
        viewer.setInput(prop.observeDetail(getMaster()));

        new Label(parent, SWT.NONE);

        Composite buttonCompBot = new Composite(parent, SWT.NONE);
        buttonCompBot.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false, 2, 1));
        buttonCompBot.setLayout(new FillLayout());

        b = new Button(buttonCompBot, SWT.PUSH | SWT.FLAT);
        b.setText(Messages.ModelTooling_Common_Up);
        b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_up));
        b.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                if (!viewer.getSelection().isEmpty()) {
                    IStructuredSelection s = (IStructuredSelection) viewer.getSelection();
                    if (s.size() == 1) {
                        Object obj = s.getFirstElement();
                        MElementContainer<?> container = (MElementContainer<?>) getMaster().getValue();
                        int idx = container.getChildren().indexOf(obj) - 1;
                        if (idx >= 0) {
                            if (Util.moveElementByIndex(getEditingDomain(), (MUIElement) obj,
                                    getEditor().isLiveModel(), idx)) {
                                viewer.setSelection(new StructuredSelection(obj));
                            }
                        }

                    }
                }
            }
        });

        b = new Button(buttonCompBot, SWT.PUSH | SWT.FLAT);
        b.setText(Messages.ModelTooling_Common_Down);
        b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_down));
        b.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                if (!viewer.getSelection().isEmpty()) {
                    IStructuredSelection s = (IStructuredSelection) viewer.getSelection();
                    if (s.size() == 1) {
                        Object obj = s.getFirstElement();
                        MElementContainer<?> container = (MElementContainer<?>) getMaster().getValue();
                        int idx = container.getChildren().indexOf(obj) + 1;
                        if (idx < container.getChildren().size()) {
                            if (Util.moveElementByIndex(getEditingDomain(), (MUIElement) obj,
                                    getEditor().isLiveModel(), idx)) {
                                viewer.setSelection(new StructuredSelection(obj));
                            }
                        }

                    }
                }
            }
        });

        b = new Button(buttonCompBot, SWT.PUSH | SWT.FLAT);
        b.setText(Messages.ModelTooling_Common_Remove);
        b.setImage(createImage(ResourceProvider.IMG_Obj16_table_delete));
        b.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                if (!viewer.getSelection().isEmpty()) {
                    List<?> elements = ((IStructuredSelection) viewer.getSelection()).toList();

                    Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(),
                            UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, elements);
                    if (cmd.canExecute()) {
                        getEditingDomain().getCommandStack().execute(cmd);
                    }
                }
            }
        });
    }

    ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context,
            WidgetProperties.selection(),
            EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED));
    ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context,
            WidgetProperties.selection(),
            EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE));

    item = new CTabItem(folder, SWT.NONE);
    item.setText(Messages.ModelTooling_Common_TabSupplementary);

    parent = createScrollableContainer(folder);
    item.setControl(parent.getParent());

    ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags,
            ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT);
    ControlFactory.createMapProperties(parent, Messages, this,
            Messages.ModelTooling_Contribution_PersistedState,
            ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT);

    if (project == null) {
        createUITreeInspection(folder);
    }

    createContributedEditorTabs(folder, context, getMaster(), MTrimBar.class);

    folder.setSelection(0);

    return folder;
}

From source file:org.eclipse.e4.tools.emf.ui.internal.common.component.TrimContributionEditor.java

License:Open Source License

private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master,
        boolean isImport) {
    CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM);

    CTabItem item = new CTabItem(folder, SWT.NONE);
    item.setText(Messages.ModelTooling_Common_TabDefault);

    parent = createScrollableContainer(folder);
    item.setControl(parent.getParent());

    if (getEditor().isShowXMIId() || getEditor().isLiveModel()) {
        ControlFactory.createXMIId(parent, this);
    }// ww  w  .j  av  a2  s .co  m

    IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify);

    if (isImport) {
        ControlFactory.createFindImport(parent, Messages, this, context);
        folder.setSelection(0);
        return folder;
    }

    ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp,
            EMFEditProperties.value(getEditingDomain(),
                    ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID));
    ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(),
            context, textProp, EMFEditProperties.value(getEditingDomain(),
                    UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE));
    {
        Label l = new Label(parent, SWT.NONE);
        l.setText(Messages.MenuContributionEditor_ParentId);
        l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));

        final Text t = new Text(parent, SWT.BORDER);
        TextPasteHandler.createFor(t);
        GridData gd = new GridData(GridData.FILL_HORIZONTAL);
        t.setLayoutData(gd);
        context.bindValue(textProp.observeDelayed(200, t),
                EMFEditProperties
                        .value(getEditingDomain(), MenuPackageImpl.Literals.MENU_CONTRIBUTION__PARENT_ID)
                        .observeDetail(getMaster()));

        Button b = new Button(parent, SWT.PUSH | SWT.FLAT);
        b.setText(Messages.ModelTooling_Common_FindEllipsis);
        b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom));
        b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false));
        b.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                TrimIdDialog dialog = new TrimIdDialog(t.getShell(), resource,
                        (MTrimContribution) getMaster().getValue(), getEditingDomain(), modelService, Messages);
                dialog.open();
            }
        });

    }

    ControlFactory.createTextField(parent, Messages.TrimContributionEditor_Position, master, context, textProp,
            EMFEditProperties.value(getEditingDomain(),
                    MenuPackageImpl.Literals.TRIM_CONTRIBUTION__POSITION_IN_PARENT));

    // ------------------------------------------------------------
    {
        Label l = new Label(parent, SWT.NONE);
        l.setText(Messages.TrimContributionEditor_Controls);
        l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false));

        final TableViewer viewer = new TableViewer(parent);
        viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages));
        viewer.setContentProvider(new ObservableListContentProvider());
        GridData gd = new GridData(GridData.FILL_BOTH);
        viewer.getControl().setLayoutData(gd);

        IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN);
        viewer.setInput(prop.observeDetail(getMaster()));

        Composite buttonComp = new Composite(parent, SWT.NONE);
        buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false));
        GridLayout gl = new GridLayout(2, false);
        gl.marginLeft = 0;
        gl.marginRight = 0;
        gl.marginWidth = 0;
        gl.marginHeight = 0;
        buttonComp.setLayout(gl);

        Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT);
        b.setText(Messages.ModelTooling_Common_Up);
        b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_up));
        b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1));
        b.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                if (!viewer.getSelection().isEmpty()) {
                    IStructuredSelection s = (IStructuredSelection) viewer.getSelection();
                    if (s.size() == 1) {
                        Object obj = s.getFirstElement();
                        MElementContainer<?> container = (MElementContainer<?>) getMaster().getValue();
                        int idx = container.getChildren().indexOf(obj) - 1;
                        if (idx >= 0) {
                            if (Util.moveElementByIndex(getEditingDomain(), (MUIElement) obj,
                                    getEditor().isLiveModel(), idx)) {
                                viewer.setSelection(new StructuredSelection(obj));
                            }
                        }

                    }
                }
            }
        });

        b = new Button(buttonComp, SWT.PUSH | SWT.FLAT);
        b.setText(Messages.ModelTooling_Common_Down);
        b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_down));
        b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1));
        b.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                if (!viewer.getSelection().isEmpty()) {
                    IStructuredSelection s = (IStructuredSelection) viewer.getSelection();
                    if (s.size() == 1) {
                        Object obj = s.getFirstElement();
                        MElementContainer<?> container = (MElementContainer<?>) getMaster().getValue();
                        int idx = container.getChildren().indexOf(obj) + 1;
                        if (idx < container.getChildren().size()) {
                            if (Util.moveElementByIndex(getEditingDomain(), (MUIElement) obj,
                                    getEditor().isLiveModel(), idx)) {
                                viewer.setSelection(new StructuredSelection(obj));
                            }
                        }

                    }
                }
            }
        });

        final ComboViewer typeViewer = new ComboViewer(buttonComp, SWT.READ_ONLY);
        typeViewer.setContentProvider(new ArrayContentProvider());
        typeViewer.setLabelProvider(new LabelProvider() {
            @Override
            public String getText(Object element) {
                return ((EClass) element).getName();
            }
        });
        typeViewer.setInput(
                new Object[] { MenuPackageImpl.Literals.TOOL_BAR, MenuPackageImpl.Literals.TOOL_CONTROL });
        typeViewer.setSelection(new StructuredSelection(MenuPackageImpl.Literals.TOOL_BAR));

        b = new Button(buttonComp, SWT.PUSH | SWT.FLAT);
        b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add));
        b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
        b.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                EObject toolbar = EcoreUtil
                        .create((EClass) ((IStructuredSelection) typeViewer.getSelection()).getFirstElement());
                setElementId(toolbar);

                Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(),
                        UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, toolbar);

                if (cmd.canExecute()) {
                    getEditingDomain().getCommandStack().execute(cmd);
                    getEditor().setSelection(toolbar);
                }
            }
        });

        b = new Button(buttonComp, SWT.PUSH | SWT.FLAT);
        b.setText(Messages.ModelTooling_Common_Remove);
        b.setImage(createImage(ResourceProvider.IMG_Obj16_table_delete));
        b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1));
        b.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                if (!viewer.getSelection().isEmpty()) {
                    List<?> elements = ((IStructuredSelection) viewer.getSelection()).toList();

                    Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(),
                            UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, elements);
                    if (cmd.canExecute()) {
                        getEditingDomain().getCommandStack().execute(cmd);
                    }
                }
            }
        });
    }

    ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context,
            WidgetProperties.selection(),
            EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED));
    ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context,
            WidgetProperties.selection(),
            EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE));

    item = new CTabItem(folder, SWT.NONE);
    item.setText(Messages.ModelTooling_Common_TabSupplementary);

    parent = createScrollableContainer(folder);
    item.setControl(parent.getParent());

    ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags,
            ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT);
    ControlFactory.createMapProperties(parent, Messages, this,
            Messages.ModelTooling_Contribution_PersistedState,
            ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT);

    if (project == null) {
        createUITreeInspection(folder);
    }

    createContributedEditorTabs(folder, context, getMaster(), MTrimContribution.class);

    folder.setSelection(0);

    return folder;
}

From source file:org.eclipse.e4.tools.emf.ui.internal.common.component.WindowEditor.java

License:Open Source License

private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master,
        boolean isImport) {
    CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM);

    CTabItem item = new CTabItem(folder, SWT.NONE);
    item.setText(Messages.ModelTooling_Common_TabDefault);

    parent = createScrollableContainer(folder);
    item.setControl(parent.getParent());

    if (getEditor().isShowXMIId() || getEditor().isLiveModel()) {
        ControlFactory.createXMIId(parent, this);
    }/* ww  w  .  j  av a 2 s.co m*/

    IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify);

    if (isImport) {
        ControlFactory.createFindImport(parent, Messages, this, context);
        folder.setSelection(0);
        return folder;
    }

    ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, getMaster(), context, textProp,
            EMFEditProperties.value(getEditingDomain(),
                    ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID));

    // ------------------------------------------------------------
    {
        Label l = new Label(parent, SWT.NONE);
        l.setText(Messages.WindowEditor_Bounds);
        l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));

        Composite comp = new Composite(parent, SWT.NONE);
        GridLayout layout = new GridLayout(4, true);
        layout.marginWidth = 0;
        layout.marginHeight = 0;
        comp.setLayout(layout);
        GridData gd = new GridData(GridData.FILL_HORIZONTAL);
        gd.horizontalSpan = 2;
        comp.setLayoutData(gd);

        Text t = new Text(comp, SWT.BORDER | SWT.TRAIL);
        t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties
                .value(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__X).observeDetail(getMaster()),
                new UnsettableUpdateValueStrategy(), new UnsettableUpdateValueStrategy());

        t = new Text(comp, SWT.BORDER | SWT.TRAIL);
        t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties
                .value(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__Y).observeDetail(getMaster()),
                new UnsettableUpdateValueStrategy(), new UnsettableUpdateValueStrategy());

        t = new Text(comp, SWT.BORDER | SWT.TRAIL);
        t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        context.bindValue(textProp.observeDelayed(200, t),
                EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__WIDTH)
                        .observeDetail(getMaster()),
                new UnsettableUpdateValueStrategy(), new UnsettableUpdateValueStrategy());

        t = new Text(comp, SWT.BORDER | SWT.TRAIL);
        t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        context.bindValue(textProp.observeDelayed(200, t),
                EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__HEIGHT)
                        .observeDetail(getMaster()),
                new UnsettableUpdateValueStrategy(), new UnsettableUpdateValueStrategy());
    }

    ControlFactory.createTranslatedTextField(parent, Messages.WindowEditor_Label, getMaster(), context,
            textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL),
            resourcePool, project);
    ControlFactory.createTranslatedTextField(parent, Messages.WindowEditor_Tooltip, getMaster(), context,
            textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP),
            resourcePool, project);

    // ------------------------------------------------------------
    {
        Label l = new Label(parent, SWT.NONE);
        l.setText(Messages.WindowEditor_IconURI);
        l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));

        Text t = new Text(parent, SWT.BORDER);
        t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties
                .value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master));

        new ImageTooltip(t, Messages) {

            @Override
            protected URI getImageURI() {
                MUILabel part = (MUILabel) getMaster().getValue();
                String uri = part.getIconURI();
                if (uri == null || uri.trim().length() == 0) {
                    return null;
                }
                return URI.createURI(part.getIconURI());
            }
        };

        final Button b = new Button(parent, SWT.PUSH | SWT.FLAT);
        b.setText(Messages.ModelTooling_Common_FindEllipsis);
        b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom));
        b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false));
        b.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                WindowIconDialogEditor dialog = new WindowIconDialogEditor(b.getShell(), eclipseContext,
                        project, getEditingDomain(), (MWindow) getMaster().getValue(), Messages);
                dialog.open();
            }
        });
    }

    {
        Label l = new Label(parent, SWT.NONE);
        l.setText(Messages.WindowEditor_MainMenu);
        l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));

        createRemoveMainMenu = new Button(parent, SWT.CHECK);
        createRemoveMainMenu.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                MWindow window = (MWindow) getMaster().getValue();
                if (window.getMainMenu() == null) {
                    addMenu();
                } else {
                    removeMenu();
                }
            }
        });
        createRemoveMainMenu
                .setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 2, 1));
    }

    ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), //$NON-NLS-1$
            EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED));
    ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), //$NON-NLS-1$
            EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE));

    ControlFactory.createSelectedElement(parent, this, context, Messages.WindowEditor_SelectedElement);
    ControlFactory.createBindingContextWiget(parent, Messages, this, Messages.WindowEditor_BindingContexts);
    ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Context_Properties,
            UiPackageImpl.Literals.CONTEXT__PROPERTIES, VERTICAL_LIST_WIDGET_INDENT);

    item = new CTabItem(folder, SWT.NONE);
    item.setText(Messages.ModelTooling_Common_TabSupplementary);

    parent = createScrollableContainer(folder);
    item.setControl(parent.getParent());

    ControlFactory.createTranslatedTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase,
            getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(),
                    UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE),
            resourcePool, project);
    ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_Context_Variables,
            UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT);
    ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags,
            ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT);
    ControlFactory.createMapProperties(parent, Messages, this,
            Messages.ModelTooling_Contribution_PersistedState,
            ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT);

    if (project == null) {
        createUITreeInspection(folder);
    }

    createContributedEditorTabs(folder, context, getMaster(), MWindow.class);

    folder.setSelection(0);

    return folder;
}

From source file:org.eclipse.eavp.viz.service.geometry.widgets.TransformationView.java

License:Open Source License

/**
 * /*from  ww  w.j  a  va 2s .co m*/
 */
private void createListeners() {

    IWidgetValueProperty property = WidgetProperties.selection();

    // Create anonymous listener

    RealSpinnerListener listener = new RealSpinnerListener() {

        @Override
        public void update(RealSpinner realSpinner) {

            // Handle a null currentShape

            if (currentShape == null) {
                return;
            }
            // Get all the spinner values

            double size = sizeSpinner.getValue();

            double scaleX = scaleSpinners[0].getValue();
            double scaleY = scaleSpinners[1].getValue();
            double scaleZ = scaleSpinners[2].getValue();

            double rotationX = rotationSpinners[0].getValue();
            double rotationY = rotationSpinners[1].getValue();
            double rotationZ = rotationSpinners[2].getValue();

            double translationX = translateSpinners[0].getValue();
            double translationY = translateSpinners[1].getValue();
            double translationZ = translateSpinners[2].getValue();

            // Convert rotation from degrees to radians if needed

            if (degrees) {
                rotationX = Math.toRadians(rotationX);
                rotationY = Math.toRadians(rotationY);
                rotationZ = Math.toRadians(rotationZ);
            }

            // Reset the Transformation to the new parameters

            Transformation transformation = new Transformation();
            transformation.setSize(size);
            transformation.setScale(scaleX, scaleY, scaleZ);
            transformation.setRotation(rotationX, rotationY, rotationZ);
            transformation.setTranslation(translationX, translationY, translationZ);

            // Reset the shape's transformation
            if (!currentShape.getTransformation().equals(transformation)) {
                currentShape.setTransformation(transformation);
            }
        }
    };

    // Add the listener to each spinner

    sizeSpinner.listen(listener);

    for (RealSpinner spinner : scaleSpinners) {
        spinner.listen(listener);
    }

    for (RealSpinner spinner : rotationSpinners) {
        spinner.listen(listener);
    }
    for (RealSpinner spinner : translateSpinners) {
        spinner.listen(listener);
    }
}

From source file:org.eclipse.emf.ecp.emf2web.ui.wizard.SelectLocationPage.java

License:Open Source License

/**
 * Creates and initializes the used data bindings.
 *
 * @return The initialized {@link DataBindingContext}.
 *///from   ww w .  j a v a  2s  .  c  om
protected DataBindingContext initDataBindings() {
    final DataBindingContext bindingContext = new DataBindingContext();

    final IObservableValue observeTextLocationTextObserveWidget = WidgetProperties.text(SWT.Modify)
            .observe(locationText);
    final IObservableValue locationGenerationInfoObserveValue = PojoProperties.value("location") //$NON-NLS-1$
            .observe(generationInfo);
    bindingContext.bindValue(observeTextLocationTextObserveWidget, locationGenerationInfoObserveValue,
            new UpdateValueStrategy().setConverter(new StringToURIConverter())
                    .setAfterConvertValidator(new LocationValidator()),
            new UpdateValueStrategy().setConverter(new URItoStringConverter()));

    final IObservableValue observeTextGeneratedTextObserveWidget = WidgetProperties.text(SWT.Modify)
            .observe(generatedText);
    final IObservableValue generatedStringGenerationInfoObserveValue = PojoProperties.value("generatedString") //$NON-NLS-1$
            .observe(generationInfo);
    bindingContext.bindValue(observeTextGeneratedTextObserveWidget, generatedStringGenerationInfoObserveValue,
            null, null);

    if (generationInfo.getWrapper() != null) {
        final IObservableValue observeSelectionBtnWrapObserveWidget = WidgetProperties.selection()
                .observe(btnWrap);
        final IObservableValue wrapGenerationInfoObserveValue = PojoProperties.value("wrap") //$NON-NLS-1$
                .observe(generationInfo);
        bindingContext.bindValue(observeSelectionBtnWrapObserveWidget, wrapGenerationInfoObserveValue, null,
                null);
    }

    return bindingContext;
}

From source file:org.eclipse.emf.ecp.view.internal.core.swt.renderer.BooleanControlSWTRenderer.java

License:Open Source License

@Override
protected Binding[] createBindings(Control control) throws DatabindingFailedException {
    final Binding binding = getDataBindingContext().bindValue(WidgetProperties.selection().observe(control),
            getModelValue());/*from www.j a  v  a  2  s .  c  o  m*/
    return new Binding[] { binding };
}

From source file:org.eclipse.emf.ecp.view.internal.core.swt.renderer.DateTimeControlSWTRenderer.java

License:Open Source License

@Override
protected Binding[] createBindings(Control control) throws DatabindingFailedException {
    ISWTObservableValue dateObserver = WidgetProperties.selection().observe(dateWidget);
    ISWTObservableValue timeObserver = WidgetProperties.selection().observe(timeWidget);
    final IObservableValue target = new DateAndTimeObservableValue(dateObserver, timeObserver);
    final Binding binding = getDataBindingContext().bindValue(target, getModelValue());

    setBtn.addSelectionListener(/*  w ww .j  a va  2  s  .  c  om*/
            new SetBtnSelectionAdapterExtension(setBtn, getModelValue(), getViewModelContext()));

    domainModelChangeListener = new ModelChangeListener() {
        @Override
        public void notifyChange(ModelChangeNotification notification) {
            EStructuralFeature structuralFeature;
            try {
                structuralFeature = (EStructuralFeature) getModelValue().getValueType();
            } catch (final DatabindingFailedException ex) {
                getReportService().report(new DatabindingFailedReport(ex));
                return;
            }
            if (structuralFeature.equals(notification.getStructuralFeature())) {
                updateChangeListener(notification.getRawNotification().getNewValue());
            }
        }
    };
    getViewModelContext().registerDomainChangeListener(domainModelChangeListener);

    return new Binding[] { binding };
}

From source file:org.eclipse.fx.ide.fxml.wizards.FXMLWizardPage.java

License:Open Source License

@Override
protected void createFields(Composite parent, DataBindingContext dbc) {
    {//from  ww  w .  j  av  a2 s .  com
        Label l = new Label(parent, SWT.NONE);
        l.setText(Messages.FXMLWizardPage_4);

        final ComboViewer viewer = new ComboViewer(parent);
        viewer.setLabelProvider(new LabelProvider() {
            @Override
            public String getText(Object element) {
                IType t = (IType) element;
                return t.getElementName() + " - " + t.getPackageFragment().getElementName(); //$NON-NLS-1$
            }
        });
        viewer.setContentProvider(new ArrayContentProvider());
        List<IType> types = getTypes();
        viewer.setInput(types);
        viewer.getControl().setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

        Button button = new Button(parent, SWT.PUSH);
        button.setText(Messages.FXMLWizardPage_6);
        button.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                IType type = findContainerType();
                if (type != null) {
                    FXMLWizardPage.this.customSelection = type;
                    viewer.setInput(getTypes());
                    viewer.setSelection(new StructuredSelection(type));
                }
            }
        });

        FXMLElement element = getClazz();
        element.addPropertyChangeListener(new PropertyChangeListener() {

            @Override
            public void propertyChange(PropertyChangeEvent evt) {
                if ("fragmentRoot".equals(evt.getPropertyName())) { //$NON-NLS-1$
                    viewer.setInput(getTypes());
                }
            }
        });
        dbc.bindValue(ViewerProperties.singleSelection().observe(viewer),
                BeanProperties.value("rootElement").observe(getClazz())); //$NON-NLS-1$

        if (types.size() > 0) {
            viewer.setSelection(new StructuredSelection(types.get(0)));
        }
    }

    {
        Label l = new Label(parent, SWT.NONE);
        l.setText(Messages.FXMLWizardPage_9);

        Button b = new Button(parent, SWT.CHECK);
        dbc.bindValue(WidgetProperties.selection().observe(b),
                BeanProperties.value("fxRoot").observe(getClazz())); //$NON-NLS-1$
    }
}

From source file:org.eclipse.fx.ide.jdt.ui.internal.editors.JFXBuildConfigurationEditor.java

License:Open Source License

private void createPageOverview(final AntTask task) {
    Composite composite = new Composite(getContainer(), SWT.NONE);
    FillLayout layout = new FillLayout();
    composite.setLayout(layout);/*from   w  w w  .ja  v a  2s  . c o m*/
    PlatformUI.getWorkbench().getHelpSystem().setHelp(composite,
            JavaFXUIPlugin.PLUGIN_ID + ".JFXBuildConfigurationEditor_overview"); //$NON-NLS-1$

    this.bean.setValue(task);

    this.toolkit = new FormToolkit(composite.getDisplay());

    final Form form = this.toolkit.createForm(composite);
    form.setText("FX Build Configuration");
    form.setImage(getTitleImage());
    form.getBody().setLayout(new FillLayout());
    this.toolkit.decorateFormHeading(form);

    initToolbar(form);

    ScrolledForm scrolledForm = this.toolkit.createScrolledForm(form.getBody());
    scrolledForm.getBody().setLayout(new GridLayout(2, false));
    Composite sectionParent = scrolledForm.getBody();

    this.dbc = new DataBindingContext();
    IWidgetValueProperty textModify = WidgetProperties.text(SWT.Modify);
    IWidgetValueProperty selChange = WidgetProperties.selection();

    {
        Section section = this.toolkit.createSection(sectionParent, Section.DESCRIPTION
                | ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
        section.setText("Build && Package Properties");
        section.setDescription("The following properties are needed to build the JavaFX-Application");
        section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

        Composite sectionClient = this.toolkit.createComposite(section);
        sectionClient.setLayout(new GridLayout(4, false));

        {
            this.toolkit.createLabel(sectionClient, "Build Directory*:");
            final Text t = this.toolkit.createText(sectionClient, "", SWT.BORDER); //$NON-NLS-1$
            t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
            this.toolkit.createButton(sectionClient, "Filesystem ...", SWT.PUSH)
                    .addSelectionListener(new SelectionAdapter() {
                        @Override
                        public void widgetSelected(final SelectionEvent e) {
                            String dir = handleBuildFilesystemDirectorySelection(t.getShell());
                            if (dir != null) {
                                t.setText(dir);
                            }
                        }
                    });
            this.toolkit.createButton(sectionClient, "Workspace ...", SWT.PUSH)
                    .addSelectionListener(new SelectionAdapter() {
                        @Override
                        public void widgetSelected(final SelectionEvent e) {
                            String dir = handleBuildWorkbenchDirectorySelection(t.getShell());
                            if (dir != null) {
                                t.setText(dir);
                            }
                        }
                    });
            IEMFValueProperty prop = EMFEditProperties.value(this.editingDomain, ANT_TASK__BUILD_DIRECTORY);
            this.dbc.bindValue(textModify.observeDelayed(DELAY, t), prop.observeDetail(bean));
        }

        {
            this.toolkit.createLabel(sectionClient, "Vendor name*:");
            Text t = this.toolkit.createText(sectionClient, "", SWT.BORDER); //$NON-NLS-1$
            t.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 3, 1));
            IEMFValueProperty prop = EMFEditProperties.value(editingDomain,
                    FeaturePath.fromList(ANT_TASK__DEPLOY, DEPLOY__INFO, INFO__VENDOR));
            this.dbc.bindValue(textModify.observeDelayed(DELAY, t), prop.observeDetail(this.bean));
        }

        {
            this.toolkit.createLabel(sectionClient, "Application title*:");
            Text t = this.toolkit.createText(sectionClient, "", SWT.BORDER); //$NON-NLS-1$
            t.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 3, 1));
            IEMFValueProperty prop = EMFEditProperties.value(this.editingDomain,
                    FeaturePath.fromList(ANT_TASK__DEPLOY, DEPLOY__INFO, INFO__TITLE));
            this.dbc.bindValue(textModify.observeDelayed(DELAY, t), prop.observeDetail(this.bean));
        }

        {
            this.toolkit.createLabel(sectionClient, "Application version*:");
            Text t = this.toolkit.createText(sectionClient, "", SWT.BORDER); //$NON-NLS-1$
            t.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 3, 1));
            IEMFValueProperty prop = EMFEditProperties.value(this.editingDomain,
                    FeaturePath.fromList(ANT_TASK__DEPLOY, DEPLOY__APPLICATION, APPLICATION__VERSION));
            this.dbc.bindValue(textModify.observeDelayed(DELAY, t), prop.observeDetail(this.bean));
        }

        {
            this.toolkit.createLabel(sectionClient, "Application class*:");
            final Text t = this.toolkit.createText(sectionClient, "", SWT.BORDER); //$NON-NLS-1$
            t.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1));
            Button b = this.toolkit.createButton(sectionClient, "Browse ...", SWT.PUSH);
            b.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(SelectionEvent e) {
                    String name = handleRootclassSelection(t.getShell());
                    if (name != null) {
                        t.setText(name);
                    }
                }
            });
            b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false));
            IEMFValueProperty prop = EMFEditProperties.value(this.editingDomain,
                    FeaturePath.fromList(ANT_TASK__DEPLOY, DEPLOY__APPLICATION, APPLICATION__MAINCLASS));
            this.dbc.bindValue(textModify.observeDelayed(DELAY, t), prop.observeDetail(this.bean));
        }

        {
            this.toolkit.createLabel(sectionClient, "Preloader class:");
            final Text t = this.toolkit.createText(sectionClient, "", SWT.BORDER); //$NON-NLS-1$
            t.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1));
            Button b = this.toolkit.createButton(sectionClient, "Browse ...", SWT.PUSH);
            b.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(SelectionEvent e) {
                    String name = handlePreloaderclassSelection(t.getShell());
                    if (name != null) {
                        t.setText(name);
                    }
                }
            });
            b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false));
            IEMFValueProperty prop = EMFEditProperties.value(this.editingDomain,
                    FeaturePath.fromList(ANT_TASK__DEPLOY, DEPLOY__APPLICATION, APPLICATION__PRELOADERCLASS));
            this.dbc.bindValue(textModify.observeDelayed(DELAY, t), prop.observeDetail(this.bean));
        }

        {
            this.toolkit.createLabel(sectionClient, "Splash:");
            final Text t = this.toolkit.createText(sectionClient, "", SWT.BORDER); //$NON-NLS-1$
            t.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1));
            Button b = this.toolkit.createButton(sectionClient, "Browse ...", SWT.PUSH);
            b.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(SelectionEvent e) {
                    String name = handleSplashImage(t.getShell());
                    if (name != null) {
                        t.setText(name);
                    }
                }
            });
            b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false));
            IEMFValueProperty prop = EMFEditProperties.value(this.editingDomain,
                    FeaturePath.fromList(ANT_TASK__DEPLOY, DEPLOY__SPLASH_IMAGE));
            this.dbc.bindValue(textModify.observeDelayed(DELAY, t), prop.observeDetail(this.bean));
        }

        {
            this.toolkit.createLabel(sectionClient, "Manifest-Attributes:")
                    .setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false));
            Composite container = this.toolkit.createComposite(sectionClient);
            GridLayout gl = new GridLayout(2, false);
            gl.marginBottom = gl.marginHeight = gl.marginLeft = gl.marginRight = gl.marginTop = gl.marginWidth = 0;
            container.setLayout(gl);
            GridData gdContainer = new GridData(GridData.FILL_HORIZONTAL);
            gdContainer.horizontalSpan = 2;
            container.setLayoutData(gdContainer);

            Composite tableContainer = this.toolkit.createComposite(container);
            Table t = this.toolkit.createTable(tableContainer,
                    SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
            t.setHeaderVisible(true);
            t.setLinesVisible(true);

            GridData gdTable = new GridData(GridData.FILL_HORIZONTAL);
            gdTable.heightHint = t.getHeaderHeight() + t.getItemHeight() * 5;
            tableContainer.setLayoutData(gdTable);

            TableColumnLayout tablelayout = new TableColumnLayout();
            final TableViewer v = new TableViewer(t);
            GridData gd = new GridData(GridData.FILL_HORIZONTAL);
            gd.heightHint = t.getHeaderHeight() + t.getItemHeight() * 5;
            v.getControl().setLayoutData(gd);
            v.setContentProvider(ArrayContentProvider.getInstance());

            {
                TableViewerColumn c = new TableViewerColumn(v, SWT.NONE);
                c.setLabelProvider(new ColumnLabelProvider() {
                    @Override
                    public String getText(final Object element) {
                        return ((Param) element).getName();
                    }
                });
                tablelayout.setColumnData(c.getColumn(), new ColumnWeightData(33));
                c.getColumn().setText("Name");
            }

            {
                TableViewerColumn c = new TableViewerColumn(v, SWT.NONE);
                c.setLabelProvider(new ColumnLabelProvider() {
                    @Override
                    public String getText(final Object element) {
                        return ((Param) element).getValue();
                    }
                });
                tablelayout.setColumnData(c.getColumn(), new ColumnWeightData(67));
                c.getColumn().setText("Value");
            }
            tableContainer.setLayout(tablelayout);
            v.setInput(task.getManifestEntries());

            Composite buttonComp = this.toolkit.createComposite(sectionClient);
            buttonComp.setLayoutData(new GridData(GridData.BEGINNING, GridData.END, false, false));
            buttonComp.setLayout(new GridLayout());

            {
                Button b = this.toolkit.createButton(buttonComp, "Add ...", SWT.PUSH);
                b.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false));
                b.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(final SelectionEvent e) {
                        if (handleAddManifestAttr(getSite().getShell())) {
                            v.setInput(task.getManifestEntries());
                            v.setSelection(new StructuredSelection(
                                    task.getManifestEntries().get(task.getManifestEntries().size() - 1)));
                        }
                    }
                });
            }

            {
                Button b = toolkit.createButton(buttonComp, "Remove", SWT.PUSH);
                b.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false));
                b.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(final SelectionEvent e) {
                        Param value = (Param) ((IStructuredSelection) v.getSelection()).getFirstElement();
                        if (value != null) {
                            if (handleRemoveManifestAttr(value)) {
                                v.setInput(task.getManifestEntries());
                            }
                        } else {
                            MessageDialog.openWarning(getSite().getShell(), "Warning",
                                    "Please select an entry");
                        }
                    }
                });
            }
            {
                this.toolkit.createLabel(sectionClient, "Toolkit Type:")
                        .setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false));
                ComboViewer c = new ComboViewer(sectionClient);
                c.getCombo().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 3, 1));
                c.setContentProvider(new ArrayContentProvider());
                c.setInput(ApplicationToolkitType.VALUES);
                IEMFValueProperty prop = EMFEditProperties.value(this.editingDomain,
                        FeaturePath.fromList(ANT_TASK__DEPLOY, DEPLOY__APPLICATION, APPLICATION__TOOLKIT));
                this.dbc.bindValue(selChange.observe(c.getCombo()), prop.observeDetail(this.bean));
            }
            {
                this.toolkit.createLabel(sectionClient, "Packaging Format:")
                        .setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false));
                ComboViewer c = new ComboViewer(sectionClient);
                c.getCombo().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 3, 1));
                c.setContentProvider(new ArrayContentProvider());
                c.setInput(PackagingFormat.VALUES);
                IEMFValueProperty prop = EMFEditProperties.value(this.editingDomain,
                        FeaturePath.fromList(ANT_TASK__DEPLOY, DEPLOY__PACKAGING_FORMAT));
                this.dbc.bindValue(selChange.observe(c.getCombo()), prop.observeDetail(this.bean));
            }
            {
                Button b = this.toolkit.createButton(sectionClient, "automatic Proxy Resolution", SWT.CHECK);
                b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 4, 1));
                IEMFValueProperty prop = EMFEditProperties.value(this.editingDomain,
                        FeaturePath.fromList(ANT_TASK__DEPLOY, DEPLOY__PROXY_RESOLUTION));
                this.dbc.bindValue(selChange.observe(b), prop.observeDetail(this.bean));
            }
            {
                Button b = this.toolkit.createButton(sectionClient, "Convert CSS into binary form", SWT.CHECK);
                b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 4, 1));
                IEMFValueProperty prop = EMFEditProperties.value(this.editingDomain,
                        FeaturePath.fromList(ANT_TASK__CSS_TO_BIN));
                this.dbc.bindValue(selChange.observe(b), prop.observeDetail(this.bean));
            }
            {
                Button b = this.toolkit.createButton(sectionClient,
                        "Enable verbose build mode (Not recommended)", SWT.CHECK);
                b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 4, 1));
                IEMFValueProperty prop = EMFEditProperties.value(this.editingDomain,
                        FeaturePath.fromList(ANT_TASK__DEPLOY, DEPLOY__VERBOSE));
                this.dbc.bindValue(selChange.observe(b), prop.observeDetail(this.bean));
            }
        }

        section.setClient(sectionClient);
    }

    {
        Section section = this.toolkit.createSection(sectionParent, Section.DESCRIPTION
                | ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
        section.setText("Building & Exporting");
        section.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, true, 1, 2));

        Composite sectionClient = this.toolkit.createComposite(section);
        sectionClient.setLayout(new GridLayout(1, false));

        {
            FormText text = this.toolkit.createFormText(sectionClient, false);
            text.setText(
                    "<p>To generate build instructions and export the project: <li style=\"bullet\" bindent=\"1\">Generate <a href=\"generateAnt\">ant build.xml</a> only</li><li style=\"bullet\" bindent=\"2\">Generate <a href=\"generateAndRun\">ant build.xml and run</a></li>&#160;</p>",
                    true, false);
            text.addHyperlinkListener(new IHyperlinkListener() {

                @Override
                public void linkExited(final HyperlinkEvent e) {
                    // nothing
                }

                @Override
                public void linkEntered(HyperlinkEvent e) {
                    // nothing
                }

                @Override
                public void linkActivated(HyperlinkEvent e) {
                    try {
                        if ("generateAndRun".equals(e.getHref())) { //$NON-NLS-1$
                            executeExport();
                        } else {
                            executeGenerateAnt();
                        }
                    } catch (Exception e1) {
                        // TODO Auto-generated catch block
                        e1.printStackTrace();
                    }
                }
            });
        }

        section.setClient(sectionClient);
    }

    int index = addPage(composite);
    setPageText(index, "Overview");
}

From source file:org.eclipse.fx.ide.jdt.ui.internal.editors.JFXBuildConfigurationEditor.java

License:Open Source License

private void createPageDeploy(final AntTask task) {
    Composite composite = new Composite(getContainer(), SWT.NONE);
    FillLayout layout = new FillLayout();
    composite.setLayout(layout);//from w ww .  j a v  a2  s .  c  om
    PlatformUI.getWorkbench().getHelpSystem().setHelp(composite,
            JavaFXUIPlugin.PLUGIN_ID + ".JFXBuildConfigurationEditor_deploy");

    // TODO
    final WritableValue bean = new WritableValue();
    bean.setValue(task);

    this.toolkit = new FormToolkit(composite.getDisplay());

    final Form form = this.toolkit.createForm(composite);
    form.setText("FX Build Configuration");
    form.setImage(getTitleImage());
    form.getBody().setLayout(new FillLayout());
    this.toolkit.decorateFormHeading(form);

    initToolbar(form);

    ScrolledForm scrolledForm = this.toolkit.createScrolledForm(form.getBody());
    scrolledForm.getBody().setLayout(new GridLayout(2, false));
    Composite sectionParent = scrolledForm.getBody();

    IWidgetValueProperty textModify = WidgetProperties.text(SWT.Modify);
    IWidgetValueProperty selChange = WidgetProperties.selection();

    {
        Section section = this.toolkit.createSection(sectionParent,
                Section.DESCRIPTION | Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED);
        section.setText("Deploy Properties");
        section.setDescription("The following properties are needed to create a Java Webstart Deployment");
        section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

        Composite sectionClient = this.toolkit.createComposite(section);
        final int COLUMN_COUNT = 3;
        sectionClient.setLayout(new GridLayout(COLUMN_COUNT, false));

        {
            this.toolkit.createLabel(sectionClient, "Applet Width*:");
            Text t = this.toolkit.createText(sectionClient, "", SWT.BORDER);
            GridData gd = new GridData(GridData.FILL_HORIZONTAL);
            gd.horizontalSpan = COLUMN_COUNT - 1;
            t.setLayoutData(gd);
            IEMFValueProperty prop = EMFEditProperties.value(this.editingDomain,
                    FeaturePath.fromList(ANT_TASK__DEPLOY, DEPLOY__WIDTH));
            this.dbc.bindValue(textModify.observeDelayed(DELAY, t), prop.observeDetail(bean));
        }

        {
            this.toolkit.createLabel(sectionClient, "Applet Height*:");
            Text t = this.toolkit.createText(sectionClient, "", SWT.BORDER);
            GridData gd = new GridData(GridData.FILL_HORIZONTAL);
            gd.horizontalSpan = COLUMN_COUNT - 1;
            t.setLayoutData(gd);
            IEMFValueProperty prop = EMFEditProperties.value(this.editingDomain,
                    FeaturePath.fromList(ANT_TASK__DEPLOY, DEPLOY__HEIGHT));
            this.dbc.bindValue(textModify.observeDelayed(DELAY, t), prop.observeDetail(bean));
        }

        {
            Button b = this.toolkit.createButton(sectionClient, "Embed JNLP", SWT.CHECK);
            b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, COLUMN_COUNT, 1));
            IEMFValueProperty prop = EMFEditProperties.value(this.editingDomain,
                    FeaturePath.fromList(ANT_TASK__DEPLOY, DEPLOY__EMBEDJNLP));
            this.dbc.bindValue(selChange.observe(b), prop.observeDetail(bean));
        }

        {
            Button b = this.toolkit.createButton(sectionClient, "Treat files as extensions", SWT.CHECK);
            b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, COLUMN_COUNT, 1));
            IEMFValueProperty prop = EMFEditProperties.value(this.editingDomain,
                    FeaturePath.fromList(ANT_TASK__DEPLOY, DEPLOY__EXTENSION));
            this.dbc.bindValue(selChange.observe(b), prop.observeDetail(bean));
        }

        {
            Button b = this.toolkit.createButton(sectionClient, "Include deployment toolkit", SWT.CHECK);
            b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, COLUMN_COUNT, 1));
            IEMFValueProperty prop = EMFEditProperties.value(this.editingDomain,
                    FeaturePath.fromList(ANT_TASK__DEPLOY, DEPLOY__INCLUDE_DT));
            this.dbc.bindValue(selChange.observe(b), prop.observeDetail(bean));
        }

        {
            Button b = this.toolkit.createButton(sectionClient, "Offline allowed", SWT.CHECK);
            b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, COLUMN_COUNT, 1));
            IEMFValueProperty prop = EMFEditProperties.value(this.editingDomain,
                    FeaturePath.fromList(ANT_TASK__DEPLOY, DEPLOY__OFFLINE_ALLOWED));
            this.dbc.bindValue(selChange.observe(b), prop.observeDetail(bean));
        }

        {
            this.toolkit.createLabel(sectionClient, "Placeholder Ref.*:");
            Text t = this.toolkit.createText(sectionClient, "", SWT.BORDER);
            GridData gd = new GridData(GridData.FILL_HORIZONTAL);
            gd.horizontalSpan = COLUMN_COUNT - 1;
            t.setLayoutData(gd);
            IEMFValueProperty prop = EMFEditProperties.value(this.editingDomain,
                    FeaturePath.fromList(ANT_TASK__DEPLOY, DEPLOY__PLACEHOLDERREF));
            this.dbc.bindValue(textModify.observeDelayed(DELAY, t), prop.observeDetail(bean));
        }

        {
            this.toolkit.createLabel(sectionClient, "Placeholder ID*:");
            Text t = toolkit.createText(sectionClient, "", SWT.BORDER);
            GridData gd = new GridData(GridData.FILL_HORIZONTAL);
            gd.horizontalSpan = COLUMN_COUNT - 1;
            t.setLayoutData(gd);
            IEMFValueProperty prop = EMFEditProperties.value(this.editingDomain,
                    FeaturePath.fromList(ANT_TASK__DEPLOY, DEPLOY__PLACEHOLDERID));
            this.dbc.bindValue(textModify.observeDelayed(DELAY, t), prop.observeDetail(bean));
        }

        {
            this.toolkit.createLabel(sectionClient, "HTML Template:");
            Text t = this.toolkit.createText(sectionClient, "", SWT.BORDER);
            t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
            IEMFValueProperty prop = EMFEditProperties.value(this.editingDomain,
                    FeaturePath.fromList(ANT_TASK__DEPLOY, DEPLOY__TEMPLATE, TEMPLATE__FILE));
            this.dbc.bindValue(textModify.observeDelayed(DELAY, t), prop.observeDetail(bean));
            Button b = this.toolkit.createButton(sectionClient, "Workspace ...", SWT.NONE);
            b.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(final SelectionEvent e) {
                    FilteredResourcesSelectionDialog d = new FilteredResourcesSelectionDialog(
                            getSite().getShell(), false,
                            ((IFileEditorInput) getEditorInput()).getFile().getProject(), IResource.FILE) {
                        @Override
                        protected IStatus validateItem(final Object item) {
                            IFile f = (IFile) item;
                            if (f.getParent() instanceof IProject) {
                                return new Status(IStatus.ERROR, JavaFXUIPlugin.PLUGIN_ID,
                                        "The selected resource has to be part of the source folder");
                            }
                            if (!f.getName().endsWith(JavaFXUIPlugin.FILEEXTENSION_HTML_TEMPLATE)) {
                                return new Status(IStatus.ERROR, JavaFXUIPlugin.PLUGIN_ID,
                                        "The selected resource does not seem to be a html file");
                            }
                            return super.validateItem(item);
                        }
                    };

                    if (d.open() == Window.OK) {
                        Object[] rv = d.getResult();
                        if (rv.length == 1) {
                            IFile f = (IFile) rv[0];
                            IJavaElement j = JavaCore.create(f.getParent());
                            String template = null;
                            if (j instanceof IPackageFragment) {
                                IPackageFragment p = (IPackageFragment) j;
                                template = p.getElementName().replace('.', '/') + "/" + f.getName(); //$NON-NLS-1$
                            } else if (j instanceof IPackageFragmentRoot) {
                                IPackageFragmentRoot p = (IPackageFragmentRoot) j;
                                template = f.getName();
                            } else {
                                MessageDialog.openInformation(getSite().getShell(), "Not valid",
                                        "The selected resource has to be part of the source folder");
                            }
                            if (template != null) {
                                if (getTask().getDeploy().getTemplate() == null) {
                                    Command cmd = new SetCommand(JFXBuildConfigurationEditor.this.editingDomain,
                                            getTask().getDeploy(), DEPLOY__TEMPLATE,
                                            ParametersFactory.eINSTANCE.createTemplate());
                                    if (cmd.canExecute()) {
                                        cmd.execute();
                                    }
                                }
                                Command cmd = new SetCommand(JFXBuildConfigurationEditor.this.editingDomain,
                                        getTask().getDeploy().getTemplate(), TEMPLATE__FILE, template);
                                if (cmd.canExecute()) {
                                    cmd.execute();
                                }
                            }
                        }
                    }
                }
            });
        }

        {
            this.toolkit.createLabel(sectionClient, "Template Output File:");
            Text t = this.toolkit.createText(sectionClient, "", SWT.BORDER);
            GridData gd = new GridData(GridData.FILL_HORIZONTAL);
            gd.horizontalSpan = COLUMN_COUNT - 1;
            t.setLayoutData(gd);
            IEMFValueProperty prop = EMFEditProperties.value(this.editingDomain,
                    FeaturePath.fromList(ANT_TASK__DEPLOY, DEPLOY__TEMPLATE, TEMPLATE__TO_FILE));
            this.dbc.bindValue(textModify.observeDelayed(DELAY, t), prop.observeDetail(bean));
        }

        {
            this.toolkit.createLabel(sectionClient, "Webstart Splash:")
                    .setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false));
            Composite container = this.toolkit.createComposite(sectionClient);
            GridLayout gl = new GridLayout(2, false);
            gl.marginBottom = gl.marginHeight = gl.marginLeft = gl.marginRight = gl.marginTop = gl.marginWidth = 0;
            container.setLayout(gl);
            GridData gdContainer = new GridData(GridData.FILL_HORIZONTAL);
            gdContainer.horizontalSpan = COLUMN_COUNT - 1;
            container.setLayoutData(gdContainer);

            Composite tableContainer = this.toolkit.createComposite(container);
            Table t = this.toolkit.createTable(tableContainer,
                    SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
            t.setHeaderVisible(true);
            t.setLinesVisible(true);

            GridData gdTable = new GridData(GridData.FILL_HORIZONTAL);
            gdTable.heightHint = t.getItemHeight() * 5;
            tableContainer.setLayoutData(gdTable);

            TableColumnLayout tablelayout = new TableColumnLayout();

            final TableViewer v = new TableViewer(t);
            GridData gd = new GridData(GridData.FILL_HORIZONTAL);
            gd.heightHint = t.getItemHeight() * 5;
            v.getControl().setLayoutData(gd);
            v.setContentProvider(ArrayContentProvider.getInstance());

            {
                TableViewerColumn c = new TableViewerColumn(v, SWT.NONE);
                c.setLabelProvider(new ColumnLabelProvider() {
                    @Override
                    public String getText(final Object element) {
                        return ((Splash) element).getMode().getName();
                    }
                });
                tablelayout.setColumnData(c.getColumn(), new ColumnWeightData(10, 100, false));
                c.getColumn().setText("Mode");
            }

            {
                TableViewerColumn c = new TableViewerColumn(v, SWT.NONE);
                c.setLabelProvider(new ColumnLabelProvider() {
                    @Override
                    public String getText(final Object element) {
                        return ((Splash) element).getHref();
                    }
                });
                tablelayout.setColumnData(c.getColumn(), new ColumnWeightData(90));
                c.getColumn().setText("URL");
            }
            tableContainer.setLayout(tablelayout);
            v.setInput(task.getDeploy().getInfo().getSplash());

            Composite buttonComp = this.toolkit.createComposite(container);
            buttonComp.setLayoutData(new GridData(GridData.BEGINNING, GridData.END, false, false));
            buttonComp.setLayout(new GridLayout());

            {
                Button b = this.toolkit.createButton(buttonComp, "Add ...", SWT.PUSH);
                b.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false));
                b.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(final SelectionEvent e) {
                        if (handleAddSplash()) {
                            v.setInput(task.getDeploy().getInfo().getSplash());
                            v.setSelection(new StructuredSelection(task.getDeploy().getInfo().getSplash()
                                    .get(task.getDeploy().getInfo().getSplash().size() - 1)));
                        }
                    }
                });
            }

            {
                Button b = toolkit.createButton(buttonComp, "Remove", SWT.PUSH);
                b.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false));
                b.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(final SelectionEvent e) {
                        Splash value = (Splash) ((IStructuredSelection) v.getSelection()).getFirstElement();
                        if (value != null) {
                            if (handleRemoveSplash(value)) {
                                v.setInput(getTask().getDeploy().getInfo().getSplash());
                            }
                        } else {
                            MessageDialog.openWarning(getSite().getShell(), "Warning",
                                    "Please select an entry");
                        }
                    }
                });
            }
        }

        {
            toolkit.createLabel(sectionClient, "Webstart Icons:")
                    .setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false));
            Composite container = toolkit.createComposite(sectionClient);
            GridLayout gl = new GridLayout(2, false);
            gl.marginBottom = gl.marginHeight = gl.marginLeft = gl.marginRight = gl.marginTop = gl.marginWidth = 0;
            container.setLayout(gl);
            GridData gdContainer = new GridData(GridData.FILL_HORIZONTAL);
            gdContainer.horizontalSpan = COLUMN_COUNT - 1;
            container.setLayoutData(gdContainer);

            Composite tableContainer = toolkit.createComposite(container);
            Table t = toolkit.createTable(tableContainer,
                    SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
            t.setHeaderVisible(true);
            t.setLinesVisible(true);

            GridData gdTable = new GridData(GridData.FILL_HORIZONTAL);
            gdTable.heightHint = t.getItemHeight() * 5;
            tableContainer.setLayoutData(gdTable);

            TableColumnLayout tablelayout = new TableColumnLayout();

            final TableViewer v = new TableViewer(t);
            GridData gd = new GridData(GridData.FILL_HORIZONTAL);
            gd.heightHint = t.getItemHeight() * 5;
            v.getControl().setLayoutData(gd);
            v.setContentProvider(ArrayContentProvider.getInstance());

            {
                TableViewerColumn c = new TableViewerColumn(v, SWT.NONE);
                c.setLabelProvider(new ColumnLabelProvider() {
                    @Override
                    public String getText(Object element) {
                        return ((Icon) element).getDepth();
                    }
                });
                tablelayout.setColumnData(c.getColumn(), new ColumnWeightData(10, 50, false));
                c.getColumn().setText("Depth");
            }

            {
                TableViewerColumn c = new TableViewerColumn(v, SWT.NONE);
                c.setLabelProvider(new ColumnLabelProvider() {
                    @Override
                    public String getText(Object element) {
                        return ((Icon) element).getKind().getName();
                    }
                });
                tablelayout.setColumnData(c.getColumn(), new ColumnWeightData(10, 100, false));
                c.getColumn().setText("Kind");
            }

            {
                TableViewerColumn c = new TableViewerColumn(v, SWT.NONE);
                c.setLabelProvider(new ColumnLabelProvider() {
                    @Override
                    public String getText(Object element) {
                        return ((Icon) element).getWidth();
                    }
                });
                tablelayout.setColumnData(c.getColumn(), new ColumnWeightData(10, 50, false));
                c.getColumn().setText("Width");
            }

            {
                TableViewerColumn c = new TableViewerColumn(v, SWT.NONE);
                c.setLabelProvider(new ColumnLabelProvider() {
                    @Override
                    public String getText(Object element) {
                        return ((Icon) element).getHeight();
                    }
                });
                tablelayout.setColumnData(c.getColumn(), new ColumnWeightData(10, 50, false));
                c.getColumn().setText("Height");
            }

            {
                TableViewerColumn c = new TableViewerColumn(v, SWT.NONE);
                c.setLabelProvider(new ColumnLabelProvider() {
                    @Override
                    public String getText(Object element) {
                        return ((Icon) element).getHref();
                    }
                });
                tablelayout.setColumnData(c.getColumn(), new ColumnWeightData(60));
                c.getColumn().setText("Url");
            }
            tableContainer.setLayout(tablelayout);
            v.setInput(task.getDeploy().getInfo().getIcon());

            Composite buttonComp = this.toolkit.createComposite(container);
            buttonComp.setLayoutData(new GridData(GridData.BEGINNING, GridData.END, false, false));
            buttonComp.setLayout(new GridLayout());

            {
                Button b = this.toolkit.createButton(buttonComp, "Add ...", SWT.PUSH);
                b.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false));
                b.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(final SelectionEvent e) {
                        if (handleAddIcon()) {
                            v.setInput(task.getDeploy().getInfo().getIcon());
                            v.setSelection(new StructuredSelection(task.getDeploy().getInfo().getIcon()
                                    .get(task.getDeploy().getInfo().getIcon().size() - 1)));
                        }
                    }
                });
            }

            {
                Button b = this.toolkit.createButton(buttonComp, "Remove", SWT.PUSH);
                b.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false));
                b.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(final SelectionEvent e) {
                        Icon value = (Icon) ((IStructuredSelection) v.getSelection()).getFirstElement();
                        if (value != null) {
                            if (handleRemoveIcon(value)) {
                                v.setInput(task.getDeploy().getInfo().getIcon());
                            }
                        } else {
                            MessageDialog.openWarning(getSite().getShell(), "Warning",
                                    "Please select an entry");
                        }
                    }
                });
            }
        }

        {
            this.toolkit.createLabel(sectionClient, "Additional META-INF files:")
                    .setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false));
            Composite container = toolkit.createComposite(sectionClient);
            GridLayout gl = new GridLayout(2, false);
            gl.marginBottom = gl.marginHeight = gl.marginLeft = gl.marginRight = gl.marginTop = gl.marginWidth = 0;
            container.setLayout(gl);
            GridData gdContainer = new GridData(GridData.FILL_HORIZONTAL);
            gdContainer.horizontalSpan = COLUMN_COUNT - 1;
            container.setLayoutData(gdContainer);

            Composite tableContainer = toolkit.createComposite(container);
            Table t = toolkit.createTable(tableContainer,
                    SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
            t.setHeaderVisible(true);
            t.setLinesVisible(true);

            GridData gdTable = new GridData(GridData.FILL_HORIZONTAL);
            gdTable.heightHint = t.getItemHeight() * 5;
            tableContainer.setLayoutData(gdTable);

            TableColumnLayout tablelayout = new TableColumnLayout();

            final TableViewer v = new TableViewer(t);
            GridData gd = new GridData(GridData.FILL_HORIZONTAL);
            gd.heightHint = t.getItemHeight() * 5;
            v.getControl().setLayoutData(gd);
            v.setContentProvider(ArrayContentProvider.getInstance());

            {
                TableViewerColumn c = new TableViewerColumn(v, SWT.NONE);
                c.setLabelProvider(new ColumnLabelProvider() {
                    @Override
                    public String getText(Object element) {
                        return ((KeyValuePair) element).getKey();
                    }
                });
                tablelayout.setColumnData(c.getColumn(), new ColumnWeightData(33));
                c.getColumn().setText("Folder");
            }

            {
                TableViewerColumn c = new TableViewerColumn(v, SWT.NONE);
                c.setLabelProvider(new ColumnLabelProvider() {
                    @Override
                    public String getText(Object element) {
                        return ((KeyValuePair) element).getValue();
                    }
                });
                tablelayout.setColumnData(c.getColumn(), new ColumnWeightData(67));
                c.getColumn().setText("File");
            }
            tableContainer.setLayout(tablelayout);
            v.setInput(task.getFiles());

            Composite buttonComp = this.toolkit.createComposite(container);
            buttonComp.setLayoutData(new GridData(GridData.BEGINNING, GridData.END, false, false));
            buttonComp.setLayout(new GridLayout());

            {
                Button b = this.toolkit.createButton(buttonComp, "Add ...", SWT.PUSH);
                b.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false));
                b.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(final SelectionEvent e) {
                        if (handleAddMetaInfFile()) {
                            v.setInput(task.getFiles());
                            v.setSelection(
                                    new StructuredSelection(task.getFiles().get(task.getFiles().size() - 1)));
                        }
                    }
                });
            }

            {
                Button b = toolkit.createButton(buttonComp, "Remove", SWT.PUSH);
                b.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false));
                b.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(final SelectionEvent e) {
                        KeyValuePair value = (KeyValuePair) ((IStructuredSelection) v.getSelection())
                                .getFirstElement();
                        if (value != null) {
                            if (handleRemoveMetaInfFile(value)) {
                                v.setInput(task.getFiles());
                            }
                        } else {
                            MessageDialog.openWarning(getSite().getShell(), "Warning",
                                    "Please select an entry");
                        }
                    }
                });
            }
        }

        {
            this.toolkit.createLabel(sectionClient, "Fonts:")
                    .setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false));
            Composite container = toolkit.createComposite(sectionClient);
            GridLayout gl = new GridLayout(2, false);
            gl.marginBottom = gl.marginHeight = gl.marginLeft = gl.marginRight = gl.marginTop = gl.marginWidth = 0;
            container.setLayout(gl);
            GridData gdContainer = new GridData(GridData.FILL_HORIZONTAL);
            gdContainer.horizontalSpan = COLUMN_COUNT - 1;
            container.setLayoutData(gdContainer);

            Composite tableContainer = toolkit.createComposite(container);
            Table t = toolkit.createTable(tableContainer,
                    SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
            t.setHeaderVisible(true);
            t.setLinesVisible(true);

            GridData gdTable = new GridData(GridData.FILL_HORIZONTAL);
            gdTable.heightHint = t.getItemHeight() * 5;
            tableContainer.setLayoutData(gdTable);

            TableColumnLayout tablelayout = new TableColumnLayout();

            final TableViewer v = new TableViewer(t);
            GridData gd = new GridData(GridData.FILL_HORIZONTAL);
            gd.heightHint = t.getItemHeight() * 5;
            v.getControl().setLayoutData(gd);
            final ArrayContentProvider cp = new ArrayContentProvider();
            v.setContentProvider(cp);

            {
                IEMFValueProperty prop = EMFEditProperties.value(editingDomain,
                        ParametersPackage.Literals.KEY_VALUE_PAIR__KEY);
                TableViewerColumn c = new TableViewerColumn(v, SWT.NONE);
                TableColumn tc = c.getColumn();
                tc.setText("Font name");
                c.setLabelProvider(new ColumnLabelProvider() {
                    @Override
                    public String getText(Object element) {
                        return ((KeyValuePair) element).getKey();
                    }
                });
                tablelayout.setColumnData(c.getColumn(), new ColumnWeightData(33));
            }

            {
                IEMFValueProperty prop = EMFEditProperties.value(editingDomain,
                        ParametersPackage.Literals.KEY_VALUE_PAIR__VALUE);
                TableViewerColumn c = new TableViewerColumn(v, SWT.NONE);
                TableColumn tc = c.getColumn();
                tc.setText("File");
                c.setLabelProvider(new ColumnLabelProvider() {
                    @Override
                    public String getText(Object element) {
                        return ((KeyValuePair) element).getValue();
                    }
                });
                tablelayout.setColumnData(c.getColumn(), new ColumnWeightData(67));
            }
            tableContainer.setLayout(tablelayout);
            v.setInput(task.getFonts());

            Composite buttonComp = toolkit.createComposite(container);
            buttonComp.setLayoutData(new GridData(GridData.BEGINNING, GridData.END, false, false));
            buttonComp.setLayout(new GridLayout());

            {
                Button b = toolkit.createButton(buttonComp, "Add ...", SWT.PUSH);
                b.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false));
                b.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(final SelectionEvent e) {
                        if (handleAddFont()) {
                            final KeyValuePair newFont = task.getFonts().get(task.getFonts().size() - 1);
                            v.refresh();
                            v.setSelection(new StructuredSelection(newFont));
                        }
                    }
                });
            }

            {
                Button b = toolkit.createButton(buttonComp, "Remove", SWT.PUSH);
                b.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false));
                b.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(final SelectionEvent e) {
                        KeyValuePair value = (KeyValuePair) ((IStructuredSelection) v.getSelection())
                                .getFirstElement();
                        if (value != null) {
                            if (handleRemoveFont(value)) {
                                v.setInput(task.getFonts());
                            }
                        } else {
                            MessageDialog.openWarning(getSite().getShell(), "Warning",
                                    "Please select an entry");
                        }
                    }
                });
            }
        }
        section.setClient(sectionClient);
    }
    int index = addPage(composite);
    setPageText(index, "Deploy");
}