Search in sources :

Example 16 with FormToolkit

use of org.eclipse.ui.forms.widgets.FormToolkit 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 17 with FormToolkit

use of org.eclipse.ui.forms.widgets.FormToolkit 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 18 with FormToolkit

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

the class ResolutionFailurePanel method createControl.

public void createControl(final Composite parent) {
    FormToolkit toolkit = new FormToolkit(parent.getDisplay());
    composite = toolkit.createComposite(parent);
    composite.setLayout(new GridLayout(1, false));
    GridData gd;
    sectProcessingErrors = toolkit.createSection(composite, Section.TITLE_BAR | Section.EXPANDED);
    sectProcessingErrors.setText("Processing Errors:");
    processingErrorsText = toolkit.createText(sectProcessingErrors, "", SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.READ_ONLY | SWT.V_SCROLL);
    sectProcessingErrors.setClient(processingErrorsText);
    ControlDecoration controlDecoration = new ControlDecoration(processingErrorsText, SWT.RIGHT | SWT.TOP);
    controlDecoration.setMarginWidth(2);
    controlDecoration.setDescriptionText("Double-click to view details");
    controlDecoration.setImage(FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL).getImage());
    gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    gd.widthHint = 600;
    gd.heightHint = 300;
    sectProcessingErrors.setLayoutData(gd);
    sectUnresolved = toolkit.createSection(composite, Section.TITLE_BAR | Section.TWISTIE);
    sectUnresolved.setText("Unresolved Requirements:");
    createUnresolvedViewToolBar(sectUnresolved);
    Tree treeUnresolved = toolkit.createTree(sectUnresolved, SWT.BORDER | SWT.FULL_SELECTION | SWT.H_SCROLL);
    sectUnresolved.setClient(treeUnresolved);
    gd = new GridData(SWT.FILL, SWT.FILL, true, false);
    gd.widthHint = 600;
    gd.heightHint = 300;
    sectUnresolved.setLayoutData(gd);
    unresolvedViewer = new TreeViewer(treeUnresolved);
    unresolvedViewer.setContentProvider(new UnresolvedRequirementsContentProvider());
    unresolvedViewer.setLabelProvider(new RequirementWithResourceLabelProvider());
    setFailureViewMode();
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) FormToolkit(org.eclipse.ui.forms.widgets.FormToolkit) TreeViewer(org.eclipse.jface.viewers.TreeViewer) RequirementWithResourceLabelProvider(org.bndtools.core.ui.resource.RequirementWithResourceLabelProvider) GridData(org.eclipse.swt.layout.GridData) ControlDecoration(org.eclipse.jface.fieldassist.ControlDecoration) Tree(org.eclipse.swt.widgets.Tree)

Example 19 with FormToolkit

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

the class RepositoryQuerySchemaPage method createPageContent.

@Override
protected void createPageContent(@NonNull SectionComposite parent) {
    this.scrolledComposite = parent;
    Composite scrolledBodyComposite = scrolledComposite.getContent();
    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 10;
    layout.horizontalSpacing = 0;
    layout.verticalSpacing = 10;
    scrolledBodyComposite.setLayout(layout);
    Composite attributesComposite = new Composite(scrolledBodyComposite, SWT.NONE);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).span(2, 1).applyTo(attributesComposite);
    layout = new GridLayout(6, false);
    layout.marginHeight = 20;
    layout.marginWidth = 10;
    attributesComposite.setLayout(layout);
    GridData g = new GridData(GridData.FILL, GridData.FILL, true, true);
    g.widthHint = 600;
    attributesComposite.setLayoutData(g);
    attributesComposite.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_LIST_FOREGROUND));
    FormToolkit toolkit = new FormToolkit(parent.getDisplay());
    TaskRepository repository = getTaskRepository();
    ITask nTask = new TaskTask(repository.getConnectorKind(), repository.getRepositoryUrl(), data.getTaskId());
    ITaskDataWorkingCopy workingCopy = TasksUi.getTaskDataManager().createWorkingCopy(nTask, data);
    final TaskDataModel model = new TaskDataModel(repository, nTask, workingCopy);
    factory = new RepositoryQueryAttributeEditorFactory(model, repository);
    model.addModelListener(new TaskDataModelListener() {

        @Override
        public void attributeChanged(TaskDataModelEvent event) {
            getContainer().updateButtons();
        }
    });
    targetTaskData = workingCopy.getLocalData();
    final TaskAttribute target = targetTaskData.getRoot();
    createFieldControls(attributesComposite, toolkit, layout.numColumns, target);
    Point p = scrolledBodyComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
    scrolledComposite.setMinSize(p);
}
Also used : TaskAttribute(org.eclipse.mylyn.tasks.core.data.TaskAttribute) ITask(org.eclipse.mylyn.tasks.core.ITask) SectionComposite(org.eclipse.mylyn.commons.workbench.forms.SectionComposite) Composite(org.eclipse.swt.widgets.Composite) FormToolkit(org.eclipse.ui.forms.widgets.FormToolkit) TaskRepository(org.eclipse.mylyn.tasks.core.TaskRepository) TaskDataModelEvent(org.eclipse.mylyn.tasks.core.data.TaskDataModelEvent) Point(org.eclipse.swt.graphics.Point) TaskTask(org.eclipse.mylyn.internal.tasks.core.TaskTask) GridLayout(org.eclipse.swt.layout.GridLayout) GridData(org.eclipse.swt.layout.GridData) TaskDataModelListener(org.eclipse.mylyn.tasks.core.data.TaskDataModelListener) ITaskDataWorkingCopy(org.eclipse.mylyn.tasks.core.data.ITaskDataWorkingCopy) TaskDataModel(org.eclipse.mylyn.tasks.core.data.TaskDataModel)

Example 20 with FormToolkit

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

the class MainPackagePage method createFormContent.

@Override
protected void createFormContent(IManagedForm managedForm) {
    super.createFormContent(managedForm);
    FormToolkit toolkit = managedForm.getToolkit();
    ScrolledForm form = managedForm.getForm();
    form.setText(Messages.MainPackagePage_2);
    GridLayout layout = new GridLayout();
    layout.marginWidth = layout.marginHeight = 5;
    layout.numColumns = 2;
    RowLayout rowLayout = new RowLayout();
    rowLayout.type = SWT.VERTICAL;
    rowLayout.justify = true;
    rowLayout.fill = true;
    form.getBody().setLayout(rowLayout);
    form.getBody().setLayoutData(rowLayout);
    layout.numColumns = 2;
    GridData gd = new GridData();
    gd.horizontalSpan = 2;
    gd.horizontalAlignment = SWT.FILL;
    final Section mainPackageSection = toolkit.createSection(form.getBody(), ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
    mainPackageSection.setText(Messages.MainPackagePage_3);
    mainPackageSection.setLayout(new GridLayout());
    Composite mainPackageClient = toolkit.createComposite(mainPackageSection);
    GridLayout gridLayout = new GridLayout();
    gridLayout.marginWidth = gridLayout.marginHeight = 5;
    gridLayout.numColumns = 2;
    mainPackageClient.setLayout(gridLayout);
    new RpmTagText(mainPackageClient, RpmTags.NAME, specfile);
    new RpmTagText(mainPackageClient, RpmTags.VERSION, specfile);
    new RpmTagText(mainPackageClient, RpmTags.RELEASE, specfile);
    new RpmTagText(mainPackageClient, RpmTags.URL, specfile);
    new RpmTagText(mainPackageClient, RpmTags.LICENSE, specfile);
    new RpmTagText(mainPackageClient, RpmTags.GROUP, specfile);
    new RpmTagText(mainPackageClient, RpmTags.EPOCH, specfile);
    new RpmTagText(mainPackageClient, RpmTags.BUILD_ROOT, specfile);
    new RpmTagText(mainPackageClient, RpmTags.BUILD_ARCH, specfile);
    new RpmTagText(mainPackageClient, RpmTags.SUMMARY, specfile, SWT.MULTI);
    // BuildRequires
    final Section buildRequiresSection = toolkit.createSection(mainPackageClient, ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
    buildRequiresSection.setText(Messages.MainPackagePage_4);
    buildRequiresSection.setLayout(rowLayout);
    buildRequiresSection.setExpanded(false);
    Composite buildRequiresClient = toolkit.createComposite(buildRequiresSection);
    buildRequiresClient.setLayout(gridLayout);
    for (SpecfileTag buildRequire : specfile.getBuildRequires()) {
        new RpmTagText(buildRequiresClient, buildRequire, specfile);
    }
    buildRequiresSection.setClient(buildRequiresClient);
    toolkit.paintBordersFor(buildRequiresClient);
    toolkit.paintBordersFor(buildRequiresSection);
    // Requires
    final Section requiresSection = toolkit.createSection(mainPackageClient, ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
    requiresSection.setText(Messages.MainPackagePage_5);
    requiresSection.setLayout(rowLayout);
    requiresSection.setExpanded(false);
    Composite requiresClient = toolkit.createComposite(requiresSection);
    requiresClient.setLayout(gridLayout);
    requiresClient.setLayoutData(gd);
    for (SpecfileTag require : specfile.getRequires()) {
        new RpmTagText(requiresClient, require, specfile);
    }
    requiresSection.setClient(requiresClient);
    toolkit.paintBordersFor(requiresClient);
    toolkit.paintBordersFor(requiresSection);
    mainPackageSection.setClient(mainPackageClient);
    toolkit.paintBordersFor(mainPackageClient);
    toolkit.paintBordersFor(mainPackageSection);
    // subpackages
    final Section packagesSection = toolkit.createSection(form.getBody(), ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
    packagesSection.setText(Messages.MainPackagePage_6);
    packagesSection.setLayout(gridLayout);
    Composite packagesClient = toolkit.createComposite(packagesSection);
    packagesClient.setLayout(gridLayout);
    packagesClient.setLayoutData(gd);
    for (SpecfilePackage specfilePackage : specfile.getPackages().getPackages()) {
        if (specfilePackage.isMainPackage()) {
            continue;
        }
        final Section packageSection = toolkit.createSection(packagesClient, ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
        packageSection.setText(specfilePackage.getFullPackageName());
        packageSection.setExpanded(false);
        packageSection.setLayout(rowLayout);
        Composite packageClient = toolkit.createComposite(packageSection);
        packageClient.setLayout(gridLayout);
        packageClient.setLayoutData(gd);
        new RpmTagText(packageClient, RpmTags.SUMMARY, specfile, specfilePackage, SWT.MULTI);
        new RpmTagText(packageClient, RpmTags.GROUP, specfile, specfilePackage, SWT.MULTI);
        final Section packageRequiresSection = toolkit.createSection(packageClient, ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
        packageRequiresSection.setText(Messages.MainPackagePage_7);
        packageRequiresSection.setLayout(rowLayout);
        packageRequiresSection.setLayoutData(gd);
        Composite packageRequiresClient = toolkit.createComposite(packageRequiresSection);
        packageRequiresClient.setLayout(gridLayout);
        packageRequiresClient.setLayoutData(gd);
        for (SpecfileTag require : specfilePackage.getRequires()) {
            new RpmTagText(packageRequiresClient, require, specfile);
        }
        packageRequiresSection.setClient(packageRequiresClient);
        toolkit.paintBordersFor(packageRequiresClient);
        toolkit.paintBordersFor(packageRequiresSection);
        packageSection.setClient(packageClient);
        toolkit.paintBordersFor(packageClient);
        toolkit.paintBordersFor(packageSection);
    }
    packagesSection.setClient(packagesClient);
    toolkit.paintBordersFor(packagesClient);
    toolkit.paintBordersFor(packagesSection);
    managedForm.refresh();
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) FormToolkit(org.eclipse.ui.forms.widgets.FormToolkit) Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) ScrolledForm(org.eclipse.ui.forms.widgets.ScrolledForm) SpecfileTag(org.eclipse.linuxtools.internal.rpm.ui.editor.parser.SpecfileTag) RowLayout(org.eclipse.swt.layout.RowLayout) GridData(org.eclipse.swt.layout.GridData) Section(org.eclipse.ui.forms.widgets.Section) SpecfilePackage(org.eclipse.linuxtools.rpm.ui.editor.parser.SpecfilePackage)

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