Search in sources :

Example 1 with ScrolledForm

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

the class BundleContentPage method createFormContent.

@Override
protected void createFormContent(IManagedForm managedForm) {
    FormToolkit toolkit = managedForm.getToolkit();
    managedForm.setInput(model);
    ScrolledForm scrolledForm = managedForm.getForm();
    scrolledForm.setText("Bundle Content");
    Form form = scrolledForm.getForm();
    toolkit.decorateFormHeading(form);
    form.addMessageHyperlinkListener(new MessageHyperlinkAdapter(getEditor()));
    Composite body = form.getBody();
    // Create controls
    MDSashForm sashForm = new MDSashForm(body, SWT.HORIZONTAL, managedForm);
    sashForm.setSashWidth(6);
    toolkit.adapt(sashForm, false, false);
    Composite leftPanel = toolkit.createComposite(sashForm);
    createLeftPanel(managedForm, leftPanel);
    Composite rightPanel = toolkit.createComposite(sashForm);
    createRightPanel(managedForm, rightPanel);
    sashForm.setWeights(new int[] { 1, 1 });
    sashForm.hookResizeListener();
    // Layout
    body.setLayout(new FillLayout());
}
Also used : MessageHyperlinkAdapter(bndtools.utils.MessageHyperlinkAdapter) FormToolkit(org.eclipse.ui.forms.widgets.FormToolkit) Composite(org.eclipse.swt.widgets.Composite) MDSashForm(bndtools.editor.common.MDSashForm) 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) ScrolledForm(org.eclipse.ui.forms.widgets.ScrolledForm) FillLayout(org.eclipse.swt.layout.FillLayout)

Example 2 with ScrolledForm

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

the class TestSuitesPage method createFormContent.

@Override
protected void createFormContent(IManagedForm managedForm) {
    managedForm.setInput(model);
    FormToolkit toolkit = managedForm.getToolkit();
    ScrolledForm form = managedForm.getForm();
    form.setText("Tests");
    form.setImage(junitImg);
    toolkit.decorateFormHeading(form.getForm());
    form.getForm().addMessageHyperlinkListener(new MessageHyperlinkAdapter(getEditor()));
    Composite body = form.getBody();
    MDSashForm sashForm = new MDSashForm(body, SWT.HORIZONTAL, managedForm);
    sashForm.setSashWidth(6);
    toolkit.adapt(sashForm, false, false);
    Composite leftPanel = toolkit.createComposite(sashForm);
    Composite rightPanel = toolkit.createComposite(sashForm);
    TestSuitesPart suitesPart = new TestSuitesPart(leftPanel, toolkit, Section.TITLE_BAR | Section.EXPANDED);
    managedForm.addPart(suitesPart);
    SaneDetailsPart detailsPart = new SaneDetailsPart();
    managedForm.addPart(detailsPart);
    // TODO: add details pages here
    detailsPart.createContents(toolkit, rightPanel);
    sashForm.hookResizeListener();
    // LAYOUT
    body.setLayout(new FillLayout());
    GridLayout layout;
    GridData gd;
    layout = new GridLayout();
    leftPanel.setLayout(layout);
    gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    suitesPart.getSection().setLayoutData(gd);
    layout = new GridLayout();
    rightPanel.setLayout(layout);
}
Also used : SaneDetailsPart(bndtools.editor.common.SaneDetailsPart) GridLayout(org.eclipse.swt.layout.GridLayout) MessageHyperlinkAdapter(bndtools.utils.MessageHyperlinkAdapter) FormToolkit(org.eclipse.ui.forms.widgets.FormToolkit) Composite(org.eclipse.swt.widgets.Composite) MDSashForm(bndtools.editor.common.MDSashForm) ScrolledForm(org.eclipse.ui.forms.widgets.ScrolledForm) GridData(org.eclipse.swt.layout.GridData) FillLayout(org.eclipse.swt.layout.FillLayout) TestSuitesPart(bndtools.editor.contents.TestSuitesPart)

Example 3 with ScrolledForm

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

the class ProjectBuildPage method createFormContent.

@Override
protected void createFormContent(IManagedForm managedForm) {
    managedForm.setInput(model);
    FormToolkit tk = managedForm.getToolkit();
    ScrolledForm form = managedForm.getForm();
    form.setText("Project Build");
    tk.decorateFormHeading(form.getForm());
    form.getForm().addMessageHyperlinkListener(new MessageHyperlinkAdapter(getEditor()));
    GridLayout layout;
    GridData gd;
    // Create Controls
    Composite body = form.getBody();
    body.setLayout(new FillLayout());
    MDSashForm sashForm = new MDSashForm(body, SWT.HORIZONTAL, managedForm);
    sashForm.setSashWidth(6);
    tk.adapt(sashForm, false, false);
    sashForm.hookResizeListener();
    Composite leftPanel = tk.createComposite(sashForm);
    gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    leftPanel.setLayoutData(gd);
    layout = new GridLayout(1, false);
    leftPanel.setLayout(layout);
    SubBundlesPart subBundlesPart = new SubBundlesPart(leftPanel, tk, Section.TITLE_BAR | Section.EXPANDED | Section.DESCRIPTION);
    managedForm.addPart(subBundlesPart);
    gd = new GridData(SWT.FILL, SWT.FILL, true, false);
    subBundlesPart.getSection().setLayoutData(gd);
    BuildPathPart buildPathPart = new BuildPathPart(leftPanel, tk, Section.TITLE_BAR | Section.EXPANDED | Section.DESCRIPTION);
    managedForm.addPart(buildPathPart);
    gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    gd.widthHint = 50;
    gd.heightHint = 50;
    buildPathPart.getSection().setLayoutData(gd);
    Composite rightPanel = tk.createComposite(sashForm);
    gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    rightPanel.setLayoutData(gd);
    BuildOperationsPart buildOpsPart = new BuildOperationsPart(rightPanel, tk, Section.TITLE_BAR | Section.EXPANDED | Section.DESCRIPTION);
    managedForm.addPart(buildOpsPart);
    gd = new GridData(SWT.FILL, SWT.FILL, true, false);
    buildOpsPart.getSection().setLayoutData(gd);
    layout = new GridLayout(1, false);
    rightPanel.setLayout(layout);
    reportProblemsInHeader();
}
Also used : SubBundlesPart(bndtools.editor.project.SubBundlesPart) GridLayout(org.eclipse.swt.layout.GridLayout) MessageHyperlinkAdapter(bndtools.utils.MessageHyperlinkAdapter) FormToolkit(org.eclipse.ui.forms.widgets.FormToolkit) Composite(org.eclipse.swt.widgets.Composite) MDSashForm(bndtools.editor.common.MDSashForm) ScrolledForm(org.eclipse.ui.forms.widgets.ScrolledForm) BuildOperationsPart(bndtools.editor.project.BuildOperationsPart) GridData(org.eclipse.swt.layout.GridData) FillLayout(org.eclipse.swt.layout.FillLayout) BuildPathPart(bndtools.editor.project.BuildPathPart)

Example 4 with ScrolledForm

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

the class BndEditor method loadEditModel.

private void loadEditModel() throws Exception {
    // Create the bnd edit model and workspace
    Workspace ws = Central.getWorkspaceIfPresent();
    Project bndProject = Run.createRun(ws, inputFile);
    model.setWorkspace(bndProject.getWorkspace());
    model.setProject(bndProject);
    // Load content into the edit model
    Display.getDefault().asyncExec(new Runnable() {

        @Override
        public void run() {
            final IDocumentProvider docProvider = sourcePage.getDocumentProvider();
            // #1625: Ensure the IDocumentProvider is not null.
            if (docProvider != null) {
                IDocument document = docProvider.getDocument(getEditorInput());
                try {
                    model.loadFrom(new IDocumentWrapper(document));
                    model.setBndResource(inputFile);
                } catch (IOException e) {
                    logger.logError("Unable to load edit model", e);
                }
                for (int i = 0; i < getPageCount(); i++) {
                    Control control = getControl(i);
                    if (control instanceof ScrolledForm) {
                        ScrolledForm form = (ScrolledForm) control;
                        if (SYNC_MESSAGE.equals(form.getMessage())) {
                            form.setMessage(null, IMessageProvider.NONE);
                        }
                    }
                }
            }
        }
    });
}
Also used : Project(aQute.bnd.build.Project) Control(org.eclipse.swt.widgets.Control) IDocumentProvider(org.eclipse.ui.texteditor.IDocumentProvider) ScrolledForm(org.eclipse.ui.forms.widgets.ScrolledForm) IOException(java.io.IOException) IDocumentWrapper(bndtools.editor.model.IDocumentWrapper) IDocument(org.eclipse.jface.text.IDocument) Workspace(aQute.bnd.build.Workspace)

Example 5 with ScrolledForm

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

the class BndEditorPart method refresh.

@Override
public final void refresh() {
    if (!Central.hasWorkspaceDirectory()) {
        refreshFromModel();
    } else {
        Central.onWorkspaceInit(new Success<Workspace, Void>() {

            @Override
            public Promise<Void> call(Promise<Workspace> resolved) throws Exception {
                try {
                    Display.getDefault().asyncExec(new Runnable() {

                        @Override
                        public void run() {
                            refreshFromModel();
                            ScrolledForm form = getManagedForm().getForm();
                            if (BndEditor.SYNC_MESSAGE.equals(form.getMessage())) {
                                form.setMessage(null, IMessageProvider.NONE);
                            }
                        }
                    });
                } catch (Exception e) {
                }
                return Promises.resolved(null);
            }
        });
    }
    super.refresh();
}
Also used : Promise(org.osgi.util.promise.Promise) ScrolledForm(org.eclipse.ui.forms.widgets.ScrolledForm) Workspace(aQute.bnd.build.Workspace)

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