Search in sources :

Example 36 with FormToolkit

use of org.eclipse.ui.forms.widgets.FormToolkit in project bndtools by bndtools.

the class WorkspacePage method createFormContent.

@Override
protected void createFormContent(IManagedForm managedForm) {
    managedForm.setInput(model);
    FormToolkit tk = managedForm.getToolkit();
    ScrolledForm form = managedForm.getForm();
    form.setText("Workspace Config");
    tk.decorateFormHeading(form.getForm());
    form.getForm().addMessageHyperlinkListener(new MessageHyperlinkAdapter(getEditor()));
    // Create controls
    Composite body = form.getBody();
    WorkspaceMainPart linksPart = new WorkspaceMainPart(mainBuildFile, body, tk, Section.TITLE_BAR | Section.EXPANDED | Section.DESCRIPTION);
    managedForm.addPart(linksPart);
    PluginPathPart pluginPathPart = new PluginPathPart(body, tk, Section.TITLE_BAR | Section.EXPANDED | Section.DESCRIPTION | Section.TWISTIE);
    managedForm.addPart(pluginPathPart);
    pluginsPart = new PluginsPart(body, tk, Section.TITLE_BAR | Section.EXPANDED | Section.DESCRIPTION | Section.TWISTIE);
    managedForm.addPart(pluginsPart);
    // Layout
    GridLayout layout = new GridLayout(1, false);
    body.setLayout(layout);
    linksPart.getSection().setLayoutData(PageLayoutUtils.createCollapsed());
    pluginPathPart.getSection().setLayoutData(PageLayoutUtils.createExpanded());
    pluginPathPart.getSection().addExpansionListener(new ResizeExpansionAdapter(pluginPathPart.getSection()));
    pluginsPart.getSection().setLayoutData(PageLayoutUtils.createExpanded());
    pluginsPart.getSection().addExpansionListener(new ResizeExpansionAdapter(pluginsPart.getSection()));
}
Also used : PluginsPart(bndtools.editor.workspace.PluginsPart) GridLayout(org.eclipse.swt.layout.GridLayout) MessageHyperlinkAdapter(bndtools.utils.MessageHyperlinkAdapter) FormToolkit(org.eclipse.ui.forms.widgets.FormToolkit) Composite(org.eclipse.swt.widgets.Composite) ScrolledForm(org.eclipse.ui.forms.widgets.ScrolledForm) PluginPathPart(bndtools.editor.workspace.PluginPathPart) WorkspaceMainPart(bndtools.editor.workspace.WorkspaceMainPart)

Example 37 with FormToolkit

use of org.eclipse.ui.forms.widgets.FormToolkit in project bndtools by bndtools.

the class BundleContentPage method createRightPanel.

void createRightPanel(IManagedForm mform, final Composite parent) {
    FormToolkit toolkit = mform.getToolkit();
    BundleCalculatedImportsPart importsPart = new BundleCalculatedImportsPart(parent, toolkit, Section.TITLE_BAR | Section.EXPANDED);
    mform.addPart(importsPart);
    importPatternListPart = new ImportPatternsListPart(parent, toolkit, Section.TITLE_BAR | Section.TWISTIE);
    mform.addPart(importPatternListPart);
    GridLayout layout;
    GridData gd;
    layout = new GridLayout();
    parent.setLayout(layout);
    gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    gd.widthHint = 100;
    gd.heightHint = 200;
    importsPart.getSection().setLayoutData(gd);
    gd = new GridData(SWT.FILL, SWT.FILL, true, false);
    importPatternListPart.getSection().setLayoutData(gd);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) BundleCalculatedImportsPart(bndtools.editor.contents.BundleCalculatedImportsPart) FormToolkit(org.eclipse.ui.forms.widgets.FormToolkit) ImportPatternsListPart(bndtools.editor.imports.ImportPatternsListPart) GridData(org.eclipse.swt.layout.GridData)

Example 38 with FormToolkit

use of org.eclipse.ui.forms.widgets.FormToolkit in project bndtools by bndtools.

the class BundleContentPage method createLeftPanel.

void createLeftPanel(IManagedForm mform, Composite parent) {
    FormToolkit toolkit = mform.getToolkit();
    GeneralInfoPart infoPart = new GeneralInfoPart(parent, toolkit, Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED);
    mform.addPart(infoPart);
    privPkgsPart = new PrivatePackagesPart(parent, toolkit, Section.TITLE_BAR | Section.EXPANDED);
    mform.addPart(privPkgsPart);
    exportPatternListPart = new ExportPatternsListPart(parent, toolkit, Section.TITLE_BAR | Section.EXPANDED);
    mform.addPart(exportPatternListPart);
    // LAYOUT
    GridData gd;
    GridLayout layout;
    layout = new GridLayout(1, false);
    parent.setLayout(layout);
    gd = new GridData(SWT.FILL, SWT.FILL, true, false);
    infoPart.getSection().setLayoutData(gd);
    gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    privPkgsPart.getSection().setLayoutData(gd);
    gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    exportPatternListPart.getSection().setLayoutData(gd);
}
Also used : GeneralInfoPart(bndtools.editor.contents.GeneralInfoPart) ExportPatternsListPart(bndtools.editor.exports.ExportPatternsListPart) GridLayout(org.eclipse.swt.layout.GridLayout) FormToolkit(org.eclipse.ui.forms.widgets.FormToolkit) PrivatePackagesPart(bndtools.editor.contents.PrivatePackagesPart) GridData(org.eclipse.swt.layout.GridData)

Example 39 with FormToolkit

use of org.eclipse.ui.forms.widgets.FormToolkit in project bndtools by bndtools.

the class ResolutionSuccessPanel method createControl.

public void createControl(Composite parent) {
    FormToolkit toolkit = new FormToolkit(parent.getDisplay());
    composite = toolkit.createComposite(parent);
    GridLayout layout = new GridLayout(1, false);
    composite.setLayout(layout);
    SashForm form = new SashForm(composite, SWT.VERTICAL);
    form.setLayout(new GridLayout(1, false));
    form.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    GridData gd;
    Section sectRequired = toolkit.createSection(form, Section.TITLE_BAR | Section.EXPANDED);
    sectRequired.setText("Required Resources");
    gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    gd.widthHint = 200;
    gd.heightHint = 150;
    sectRequired.setLayoutData(gd);
    Table tblRequired = toolkit.createTable(sectRequired, SWT.BORDER | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
    sectRequired.setClient(tblRequired);
    requiredViewer = new TableViewer(tblRequired);
    requiredViewer.setContentProvider(ArrayContentProvider.getInstance());
    requiredViewer.setLabelProvider(new ResourceLabelProvider());
    requiredViewer.setSorter(new BundleSorter());
    requiredViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            IStructuredSelection sel = (IStructuredSelection) event.getSelection();
            Resource resource = (Resource) sel.getFirstElement();
            reasonsContentProvider.setOptional(false);
            if (result != null)
                reasonsContentProvider.setResolution(result.getResourceWirings());
            reasonsViewer.setInput(resource);
            reasonsViewer.expandToLevel(2);
        }
    });
    sectOptional = toolkit.createSection(form, Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED);
    sectOptional.setText("Optional Resources");
    Composite cmpOptional = toolkit.createComposite(sectOptional);
    sectOptional.setClient(cmpOptional);
    cmpOptional.setLayout(new GridLayout(2, false));
    gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    gd.widthHint = 200;
    gd.heightHint = 150;
    sectOptional.setLayoutData(gd);
    Table tblOptional = toolkit.createTable(cmpOptional, SWT.BORDER | SWT.CHECK | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
    gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    tblOptional.setLayoutData(gd);
    optionalViewer = new CheckboxTableViewer(tblOptional);
    optionalViewer.setContentProvider(ArrayContentProvider.getInstance());
    optionalViewer.setLabelProvider(new ResourceLabelProvider());
    optionalViewer.setSorter(new BundleSorter());
    optionalViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            IStructuredSelection sel = (IStructuredSelection) event.getSelection();
            doOptionalReasonUpdate((Resource) sel.getFirstElement());
        }
    });
    optionalViewer.addCheckStateListener(new ICheckStateListener() {

        @Override
        public void checkStateChanged(CheckStateChangedEvent event) {
            Resource resource = (Resource) event.getElement();
            if (!addedOptionals.containsKey(resource)) {
                if (event.getChecked()) {
                    checkedOptional.add(resource);
                } else {
                    checkedOptional.remove(resource);
                }
            }
            presenter.updateButtons();
            updateResolveOptionalButton();
            optionalViewer.setSelection(new ISelection() {

                @Override
                public boolean isEmpty() {
                    return true;
                }
            });
            doOptionalReasonUpdate(resource);
        }
    });
    Composite cmpOptionalButtons = toolkit.createComposite(cmpOptional);
    cmpOptionalButtons.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));
    GridLayout gl_cmpOptionalButtons = new GridLayout(3, false);
    gl_cmpOptionalButtons.marginHeight = 0;
    gl_cmpOptionalButtons.marginWidth = 0;
    cmpOptionalButtons.setLayout(gl_cmpOptionalButtons);
    btnAddResolveOptional = toolkit.createButton(cmpOptionalButtons, "Update and Resolve", SWT.NONE);
    btnAddResolveOptional.setEnabled(false);
    btnAddResolveOptional.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            doAddResolve();
        }
    });
    btnAddResolveOptional.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, true, false));
    Button btnAllOptional = toolkit.createButton(cmpOptionalButtons, "Select All", SWT.NONE);
    btnAllOptional.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            optionalViewer.setAllChecked(true);
            checkedOptional.clear();
            for (Object object : optionalViewer.getCheckedElements()) {
                if (!addedOptionals.containsKey(object)) {
                    checkedOptional.add((Resource) object);
                }
            }
            presenter.updateButtons();
            updateResolveOptionalButton();
        }
    });
    btnAllOptional.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
    Button btnClearOptional = toolkit.createButton(cmpOptionalButtons, "Clear All", SWT.NONE);
    btnClearOptional.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            optionalViewer.setAllChecked(false);
            checkedOptional.clear();
            presenter.updateButtons();
            updateResolveOptionalButton();
        }
    });
    btnClearOptional.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
    Section sectReason = toolkit.createSection(form, Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED);
    sectReason.setText("Reasons");
    Tree tblReasons = new Tree(sectReason, SWT.BORDER | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
    sectReason.setClient(tblReasons);
    gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    gd.widthHint = 200;
    gd.heightHint = 150;
    sectReason.setLayoutData(gd);
    reasonsViewer = new TreeViewer(tblReasons);
    reasonsViewer.setContentProvider(reasonsContentProvider);
    reasonsViewer.setLabelProvider(new ResolutionTreeLabelProvider());
}
Also used : FormToolkit(org.eclipse.ui.forms.widgets.FormToolkit) CheckboxTableViewer(org.eclipse.jface.viewers.CheckboxTableViewer) ICheckStateListener(org.eclipse.jface.viewers.ICheckStateListener) TreeViewer(org.eclipse.jface.viewers.TreeViewer) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) ISelection(org.eclipse.jface.viewers.ISelection) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Tree(org.eclipse.swt.widgets.Tree) Table(org.eclipse.swt.widgets.Table) Composite(org.eclipse.swt.widgets.Composite) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Resource(org.osgi.resource.Resource) Section(org.eclipse.ui.forms.widgets.Section) SashForm(org.eclipse.swt.custom.SashForm) GridData(org.eclipse.swt.layout.GridData) CheckStateChangedEvent(org.eclipse.jface.viewers.CheckStateChangedEvent) TableViewer(org.eclipse.jface.viewers.TableViewer) CheckboxTableViewer(org.eclipse.jface.viewers.CheckboxTableViewer)

Example 40 with FormToolkit

use of org.eclipse.ui.forms.widgets.FormToolkit in project Palladio-Editors-Sirius by PalladioSimulator.

the class DescriptionBox method createControl.

public void createControl(Composite parent) {
    toolkit = new FormToolkit(parent.getDisplay());
    int borderStyle = toolkit.getBorderStyle() == SWT.BORDER ? SWT.NULL : SWT.BORDER;
    container = new Composite(parent, borderStyle);
    FillLayout flayout = new FillLayout();
    flayout.marginWidth = 1;
    flayout.marginHeight = 1;
    container.setLayout(flayout);
    formText = new ScrolledFormText(container, SWT.V_SCROLL | SWT.H_SCROLL, false);
    if (borderStyle == SWT.NULL) {
        formText.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TREE_BORDER);
        toolkit.paintBordersFor(container);
    }
    FormText ftext = toolkit.createFormText(formText, false);
    formText.setFormText(ftext);
    formText.setExpandHorizontal(true);
    formText.setExpandVertical(true);
    formText.setBackground(toolkit.getColors().getBackground());
    formText.setForeground(toolkit.getColors().getForeground());
    ftext.marginWidth = 2;
    ftext.marginHeight = 2;
    ftext.setHyperlinkSettings(toolkit.getHyperlinkGroup());
    formText.addDisposeListener(new DisposeListener() {

        public void widgetDisposed(DisposeEvent e) {
            if (toolkit != null) {
                toolkit.dispose();
                toolkit = null;
            }
        }
    });
    if (text != null)
        formText.setText(text);
}
Also used : DisposeListener(org.eclipse.swt.events.DisposeListener) FormToolkit(org.eclipse.ui.forms.widgets.FormToolkit) Composite(org.eclipse.swt.widgets.Composite) FormText(org.eclipse.ui.forms.widgets.FormText) ScrolledFormText(org.eclipse.ui.forms.widgets.ScrolledFormText) FillLayout(org.eclipse.swt.layout.FillLayout) DisposeEvent(org.eclipse.swt.events.DisposeEvent) ScrolledFormText(org.eclipse.ui.forms.widgets.ScrolledFormText)

Aggregations

FormToolkit (org.eclipse.ui.forms.widgets.FormToolkit)47 Composite (org.eclipse.swt.widgets.Composite)40 GridLayout (org.eclipse.swt.layout.GridLayout)35 GridData (org.eclipse.swt.layout.GridData)31 Label (org.eclipse.swt.widgets.Label)13 Button (org.eclipse.swt.widgets.Button)12 Text (org.eclipse.swt.widgets.Text)10 ScrolledForm (org.eclipse.ui.forms.widgets.ScrolledForm)10 Section (org.eclipse.ui.forms.widgets.Section)9 FillLayout (org.eclipse.swt.layout.FillLayout)8 ManagedForm (org.eclipse.ui.forms.ManagedForm)8 ExpandableComposite (org.eclipse.ui.forms.widgets.ExpandableComposite)8 MessageHyperlinkAdapter (bndtools.utils.MessageHyperlinkAdapter)6 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)6 SelectionEvent (org.eclipse.swt.events.SelectionEvent)6 MDSashForm (bndtools.editor.common.MDSashForm)5 HyperlinkAdapter (org.eclipse.ui.forms.events.HyperlinkAdapter)5 HyperlinkEvent (org.eclipse.ui.forms.events.HyperlinkEvent)5 ISelection (org.eclipse.jface.viewers.ISelection)4 TreeViewer (org.eclipse.jface.viewers.TreeViewer)4