Search in sources :

Example 6 with ScrolledForm

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

the class JARContentPage method createFormContent.

@Override
protected void createFormContent(IManagedForm managedForm) {
    managedForm.setInput(getEditorInput());
    FormToolkit toolkit = managedForm.getToolkit();
    ScrolledForm form = managedForm.getForm();
    form.setText("JAR File Viewer");
    toolkit.decorateFormHeading(form.getForm());
    titleImg = AbstractUIPlugin.imageDescriptorFromPlugin(PluginConstants.PLUGIN_ID, "/icons/jar_obj.gif").createImage(form.getDisplay());
    form.setImage(titleImg);
    // CREATE CONTROLS
    Composite body = form.getBody();
    SashForm sashForm = new SashForm(body, SWT.HORIZONTAL);
    Composite treePanel = toolkit.createComposite(sashForm);
    contentTreePart = new JARContentTreePart(treePanel, managedForm);
    managedForm.addPart(contentTreePart);
    Composite detailsPanel = toolkit.createComposite(sashForm);
    entryPart = new JAREntryPart(getEditor(), detailsPanel, toolkit);
    managedForm.addPart(entryPart);
    if (selectedPath != null)
        contentTreePart.setSelectedPath(selectedPath);
    // LAYOUT
    GridLayout layout;
    layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    body.setLayout(layout);
    sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
// treeSection.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
// detailsPanel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
}
Also used : SashForm(org.eclipse.swt.custom.SashForm) GridLayout(org.eclipse.swt.layout.GridLayout) FormToolkit(org.eclipse.ui.forms.widgets.FormToolkit) Composite(org.eclipse.swt.widgets.Composite) ScrolledForm(org.eclipse.ui.forms.widgets.ScrolledForm) GridData(org.eclipse.swt.layout.GridData)

Example 7 with ScrolledForm

use of org.eclipse.ui.forms.widgets.ScrolledForm in project tdi-studio-se by Talend.

the class InfoPage method createControls.

/**
     * Creates the controls.
     * 
     * @param parent The parent composite
     * @param toolkit The toolkit
     */
private void createControls(Composite parent, FormToolkit toolkit) {
    parent.setLayout(new FillLayout());
    ScrolledForm form = toolkit.createScrolledForm(parent);
    form.getBody().setLayout(new GridLayout(1, false));
    createRuntimeSection(form.getBody(), toolkit);
    createSnapshotSection(form.getBody(), toolkit);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) ScrolledForm(org.eclipse.ui.forms.widgets.ScrolledForm) FillLayout(org.eclipse.swt.layout.FillLayout)

Example 8 with ScrolledForm

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

the class BndEditor method addPages.

@Override
protected void addPages() {
    updateIncludedPages();
    showHighestPriorityPage();
    if (!Central.isWorkspaceInited()) {
        IFormPage activePage = getActivePageInstance();
        if (activePage != null && activePage.getManagedForm() != null) {
            ScrolledForm form = activePage.getManagedForm().getForm();
            if (form.getMessage() == null) {
                form.setMessage(SYNC_MESSAGE, IMessageProvider.WARNING);
            }
        }
    }
}
Also used : ScrolledForm(org.eclipse.ui.forms.widgets.ScrolledForm) IFormPage(org.eclipse.ui.forms.editor.IFormPage)

Example 9 with ScrolledForm

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

the class BundleDescriptionPage method createFormContent.

@Override
protected void createFormContent(IManagedForm managedForm) {
    FormToolkit toolkit = managedForm.getToolkit();
    managedForm.setInput(model);
    ScrolledForm scrolledForm = managedForm.getForm();
    scrolledForm.setText("Bundle Description");
    Form form = scrolledForm.getForm();
    toolkit.decorateFormHeading(form);
    form.addMessageHyperlinkListener(new MessageHyperlinkAdapter(getEditor()));
    Composite body = form.getBody();
    greyTitleBarColour = new Color(body.getDisplay(), 210, 245, 210);
    // Create controls
    MDSashForm sashForm = new MDSashForm(body, SWT.HORIZONTAL, managedForm);
    sashForm.setSashWidth(2);
    toolkit.adapt(sashForm, false, false);
    Composite leftPanel = toolkit.createComposite(sashForm);
    DescriptionBundlePart infoPart = new DescriptionBundlePart(leftPanel, toolkit, Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED);
    managedForm.addPart(infoPart);
    DescriptionRightsPart rightsPart = new DescriptionRightsPart(leftPanel, toolkit, Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED);
    managedForm.addPart(rightsPart);
    DescriptionVendorPart vendorPart = new DescriptionVendorPart(leftPanel, toolkit, Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED);
    managedForm.addPart(vendorPart);
    DescriptionDeveloperPart developerPart = new DescriptionDeveloperPart(leftPanel, toolkit, Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED);
    managedForm.addPart(developerPart);
    // LAYOUT
    GridData gd;
    GridLayout layout;
    layout = new GridLayout(1, false);
    leftPanel.setLayout(layout);
    gd = new GridData(SWT.FILL, SWT.FILL, true, false);
    infoPart.getSection().setLayoutData(gd);
    gd = new GridData(SWT.FILL, SWT.FILL, true, false);
    rightsPart.getSection().setLayoutData(gd);
    gd = new GridData(SWT.FILL, SWT.FILL, true, false);
    vendorPart.getSection().setLayoutData(gd);
    gd = new GridData(SWT.FILL, SWT.FILL, true, false);
    developerPart.getSection().setLayoutData(gd);
    sashForm.hookResizeListener();
    // Layout
    body.setLayout(new FillLayout());
}
Also used : DescriptionDeveloperPart(bndtools.editor.contents.DescriptionDeveloperPart) MessageHyperlinkAdapter(bndtools.utils.MessageHyperlinkAdapter) FormToolkit(org.eclipse.ui.forms.widgets.FormToolkit) Composite(org.eclipse.swt.widgets.Composite) MDSashForm(bndtools.editor.common.MDSashForm) DescriptionBundlePart(bndtools.editor.contents.DescriptionBundlePart) IManagedForm(org.eclipse.ui.forms.IManagedForm) Form(org.eclipse.ui.forms.widgets.Form) ScrolledForm(org.eclipse.ui.forms.widgets.ScrolledForm) MDSashForm(bndtools.editor.common.MDSashForm) Color(org.eclipse.swt.graphics.Color) FillLayout(org.eclipse.swt.layout.FillLayout) DescriptionRightsPart(bndtools.editor.contents.DescriptionRightsPart) GridLayout(org.eclipse.swt.layout.GridLayout) ScrolledForm(org.eclipse.ui.forms.widgets.ScrolledForm) DescriptionVendorPart(bndtools.editor.contents.DescriptionVendorPart) GridData(org.eclipse.swt.layout.GridData)

Example 10 with ScrolledForm

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

the class ProjectRunPage method createFormContent.

@Override
protected void createFormContent(IManagedForm managedForm) {
    managedForm.setInput(model);
    FormToolkit tk = managedForm.getToolkit();
    final ScrolledForm form = managedForm.getForm();
    form.setText("Resolve/Run");
    Central.onWorkspaceInit(new Success<Workspace, Void>() {

        @Override
        public Promise<Void> call(Promise<Workspace> resolved) throws Exception {
            final Deferred<Void> completion = new Deferred<>();
            Display.getDefault().asyncExec(new Runnable() {

                @Override
                public void run() {
                    try {
                        updateFormImage(form);
                        completion.resolve(null);
                    } catch (Exception e) {
                        completion.fail(e);
                    }
                }
            });
            return completion.getPromise();
        }
    });
    tk.decorateFormHeading(form.getForm());
    form.getForm().addMessageHyperlinkListener(new MessageHyperlinkAdapter(getEditor()));
    // Toolbar Actions
    RunAction runAction = new RunAction(this, "run");
    runAction.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(Plugin.PLUGIN_ID, "icons/run.gif"));
    runAction.setText("Run OSGi");
    ActionContributionItem runContrib = new ActionContributionItem(runAction);
    runContrib.setMode(ActionContributionItem.MODE_FORCE_TEXT);
    form.getToolBarManager().add(runContrib);
    RunAction debugAction = new RunAction(this, "debug");
    debugAction.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(Plugin.PLUGIN_ID, "icons/debug.gif"));
    debugAction.setText("Debug OSGi");
    ActionContributionItem debugContrib = new ActionContributionItem(debugAction);
    debugContrib.setMode(ActionContributionItem.MODE_FORCE_TEXT);
    form.getToolBarManager().add(debugContrib);
    ExportAction exportAction = new ExportAction(getEditorSite().getShell(), getEditor(), model);
    exportAction.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(Plugin.PLUGIN_ID, "icons/run_export.png"));
    exportAction.setText("Export");
    ActionContributionItem exportContrib = new ActionContributionItem(exportAction);
    exportContrib.setMode(ActionContributionItem.MODE_FORCE_TEXT);
    if (exportAction.shouldEnable())
        form.getToolBarManager().add(exportContrib);
    form.getToolBarManager().update(true);
    GridLayout gl;
    GridData gd;
    // Create Controls
    final Composite body = form.getBody();
    MDSashForm sashForm = new MDSashForm(body, SWT.HORIZONTAL, managedForm);
    sashForm.setSashWidth(6);
    tk.adapt(sashForm);
    final Composite left = tk.createComposite(sashForm);
    gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    left.setLayoutData(gd);
    gl = new GridLayout(1, true);
    left.setLayout(gl);
    final Composite right = tk.createComposite(sashForm);
    gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    right.setLayoutData(gd);
    gl = new GridLayout(1, true);
    right.setLayout(gl);
    // First column
    RepositorySelectionPart reposPart = new RepositorySelectionPart(getEditor(), left, tk, Section.TITLE_BAR | Section.TWISTIE);
    managedForm.addPart(reposPart);
    gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    gd.widthHint = 50;
    gd.heightHint = 50;
    reposPart.getSection().setLayoutData(PageLayoutUtils.createCollapsed());
    AvailableBundlesPart availableBundlesPart = new AvailableBundlesPart(left, tk, Section.TITLE_BAR | Section.EXPANDED);
    managedForm.addPart(availableBundlesPart);
    gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    gd.widthHint = 50;
    gd.heightHint = 50;
    availableBundlesPart.getSection().setLayoutData(PageLayoutUtils.createExpanded());
    RunFrameworkPart runFwkPart = new RunFrameworkPart(left, tk, Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED);
    managedForm.addPart(runFwkPart);
    gd = new GridData(SWT.FILL, SWT.FILL, true, false);
    runFwkPart.getSection().setLayoutData(gd);
    RunPropertiesPart runPropertiesPart = new RunPropertiesPart(left, tk, Section.TITLE_BAR | Section.TWISTIE);
    managedForm.addPart(runPropertiesPart);
    gd = new GridData(SWT.FILL, SWT.FILL, true, false);
    runPropertiesPart.getSection().setLayoutData(gd);
    // SECOND COLUMN
    if (supportsResolve) {
        RunRequirementsPart requirementsPart = new RunRequirementsPart(right, tk, Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED | Section.DESCRIPTION);
        managedForm.addPart(requirementsPart);
        requirementsPart.getSection().setLayoutData(PageLayoutUtils.createExpanded());
        requirementsPart.getSection().addExpansionListener(new ResizeExpansionAdapter(requirementsPart.getSection()));
        RunBlacklistPart blacklistPart = new RunBlacklistPart(right, tk, Section.TITLE_BAR | Section.TWISTIE | Section.COMPACT | Section.DESCRIPTION);
        managedForm.addPart(blacklistPart);
        blacklistPart.getSection().setLayoutData(PageLayoutUtils.createCollapsed());
        blacklistPart.getSection().addExpansionListener(new ResizeExpansionAdapter(blacklistPart.getSection()));
        RunBundlesPart runBundlesPart = new RunBundlesPart(right, tk, Section.TITLE_BAR | Section.TWISTIE);
        managedForm.addPart(runBundlesPart);
        runBundlesPart.getSection().setLayoutData(PageLayoutUtils.createCollapsed());
        runBundlesPart.getSection().addExpansionListener(new ResizeExpansionAdapter(runBundlesPart.getSection()));
    } else {
        RunBundlesPart runBundlesPart = new RunBundlesPart(right, tk, Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED);
        managedForm.addPart(runBundlesPart);
        runBundlesPart.getSection().setLayoutData(PageLayoutUtils.createExpanded());
        runBundlesPart.getSection().addExpansionListener(new ResizeExpansionAdapter(runBundlesPart.getSection()));
    }
    // Listeners
    model.addPropertyChangeListener(BndEditModel.PROP_WORKSPACE, new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            Display.getDefault().asyncExec(new Runnable() {

                @Override
                public void run() {
                    updateFormImage(form);
                }
            });
        }
    });
    sashForm.setWeights(new int[] { 1, 1 });
    sashForm.hookResizeListener();
    body.setLayout(new FillLayout());
}
Also used : RunBundlesPart(bndtools.editor.project.RunBundlesPart) FormToolkit(org.eclipse.ui.forms.widgets.FormToolkit) RunPropertiesPart(bndtools.editor.project.RunPropertiesPart) PropertyChangeListener(java.beans.PropertyChangeListener) AvailableBundlesPart(bndtools.editor.project.AvailableBundlesPart) Deferred(org.osgi.util.promise.Deferred) ActionContributionItem(org.eclipse.jface.action.ActionContributionItem) GridLayout(org.eclipse.swt.layout.GridLayout) RunFrameworkPart(bndtools.editor.project.RunFrameworkPart) PropertyChangeEvent(java.beans.PropertyChangeEvent) MessageHyperlinkAdapter(bndtools.utils.MessageHyperlinkAdapter) Composite(org.eclipse.swt.widgets.Composite) MDSashForm(bndtools.editor.common.MDSashForm) RunBlacklistPart(bndtools.editor.project.RunBlacklistPart) FillLayout(org.eclipse.swt.layout.FillLayout) Promise(org.osgi.util.promise.Promise) ScrolledForm(org.eclipse.ui.forms.widgets.ScrolledForm) GridData(org.eclipse.swt.layout.GridData) RepositorySelectionPart(bndtools.editor.project.RepositorySelectionPart) Workspace(aQute.bnd.build.Workspace) RunRequirementsPart(bndtools.editor.project.RunRequirementsPart)

Aggregations

ScrolledForm (org.eclipse.ui.forms.widgets.ScrolledForm)11 GridLayout (org.eclipse.swt.layout.GridLayout)7 Composite (org.eclipse.swt.widgets.Composite)7 FormToolkit (org.eclipse.ui.forms.widgets.FormToolkit)7 MessageHyperlinkAdapter (bndtools.utils.MessageHyperlinkAdapter)6 FillLayout (org.eclipse.swt.layout.FillLayout)6 MDSashForm (bndtools.editor.common.MDSashForm)5 GridData (org.eclipse.swt.layout.GridData)5 Workspace (aQute.bnd.build.Workspace)3 IManagedForm (org.eclipse.ui.forms.IManagedForm)2 Form (org.eclipse.ui.forms.widgets.Form)2 Promise (org.osgi.util.promise.Promise)2 Project (aQute.bnd.build.Project)1 SaneDetailsPart (bndtools.editor.common.SaneDetailsPart)1 DescriptionBundlePart (bndtools.editor.contents.DescriptionBundlePart)1 DescriptionDeveloperPart (bndtools.editor.contents.DescriptionDeveloperPart)1 DescriptionRightsPart (bndtools.editor.contents.DescriptionRightsPart)1 DescriptionVendorPart (bndtools.editor.contents.DescriptionVendorPart)1 TestSuitesPart (bndtools.editor.contents.TestSuitesPart)1 IDocumentWrapper (bndtools.editor.model.IDocumentWrapper)1