Search in sources :

Example 11 with Section

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

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

the class JAREntryPart method createContent.

private void createContent(Composite parent, FormToolkit toolkit) {
    Section textSection = toolkit.createSection(parent, Section.TITLE_BAR | Section.EXPANDED);
    textSection.setText("Entry Content");
    Composite textComposite = toolkit.createComposite(textSection);
    text = toolkit.createText(textComposite, "", SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.READ_ONLY);
    text.setFont(JFaceResources.getTextFont());
    textSection.setClient(textComposite);
    Section encodingSection = toolkit.createSection(parent, Section.TITLE_BAR | Section.EXPANDED);
    encodingSection.setText("Display Options");
    Composite encodingPanel = toolkit.createComposite(encodingSection);
    encodingSection.setClient(encodingPanel);
    toolkit.createLabel(encodingPanel, "Show As:");
    final Button btnText = toolkit.createButton(encodingPanel, "Text", SWT.RADIO);
    btnText.setSelection(showAsText);
    Button btnBinary = toolkit.createButton(encodingPanel, "Binary (hex)", SWT.RADIO);
    btnBinary.setSelection(!showAsText);
    toolkit.createLabel(encodingPanel, "Text Encoding:");
    final Combo encodingCombo = new Combo(encodingPanel, SWT.READ_ONLY);
    encodingCombo.setEnabled(showAsText);
    // INITIALISE
    encodingCombo.setItems(charsets);
    encodingCombo.select(selectedCharset);
    // LISTENERS
    encodingSection.addExpansionListener(new ExpansionAdapter() {

        @Override
        public void expansionStateChanged(ExpansionEvent e) {
            getManagedForm().reflow(true);
        }
    });
    SelectionListener radioListener = new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            showAsText = btnText.getSelection();
            encodingCombo.setEnabled(showAsText);
            loadContent();
        }
    };
    btnText.addSelectionListener(radioListener);
    btnBinary.addSelectionListener(radioListener);
    encodingCombo.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            selectedCharset = encodingCombo.getSelectionIndex();
            loadContent();
        }
    });
    // LAYOUT
    GridLayout layout;
    GridData gd;
    layout = new GridLayout(1, false);
    parent.setLayout(layout);
    gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    textSection.setLayoutData(gd);
    layout = new GridLayout(1, false);
    textComposite.setLayout(layout);
    gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    text.setLayoutData(gd);
    gd = new GridData(SWT.FILL, SWT.FILL, true, false);
    encodingSection.setLayoutData(gd);
    encodingSection.setLayout(new FillLayout());
    encodingPanel.setLayout(new GridLayout(3, false));
    encodingCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1));
}
Also used : Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Combo(org.eclipse.swt.widgets.Combo) ExpansionAdapter(org.eclipse.ui.forms.events.ExpansionAdapter) FillLayout(org.eclipse.swt.layout.FillLayout) Section(org.eclipse.ui.forms.widgets.Section) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) GridData(org.eclipse.swt.layout.GridData) ExpansionEvent(org.eclipse.ui.forms.events.ExpansionEvent) IPartSelectionListener(org.eclipse.ui.forms.IPartSelectionListener) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 13 with Section

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

the class ImportRPMsPage method createFormContent.

@Override
protected void createFormContent(IManagedForm managedForm) {
    // setting up the form page
    super.createFormContent(managedForm);
    GridLayout layout = new GridLayout();
    FormToolkit toolkit = managedForm.getToolkit();
    ScrolledForm form = managedForm.getForm();
    form.setText(Messages.ImportRPMsPage_formHeaderText);
    form.setImage(Activator.getImageDescriptor(HEADER_ICON).createImage());
    ToolBarManager toolbarManager = (ToolBarManager) form.getToolBarManager();
    toolkit.decorateFormHeading(form.getForm());
    // add the menuContribution from MANIFEST.MF to the form
    IMenuService menuService = getSite().getService(IMenuService.class);
    menuService.populateContributionManager(toolbarManager, MENU_URI);
    toolbarManager.update(true);
    layout = new GridLayout(2, true);
    layout.marginWidth = 6;
    layout.marginHeight = 12;
    form.getBody().setLayout(layout);
    // Section and its client area to manage importing the RPMs
    Section rpmSection = toolkit.createSection(form.getBody(), Section.DESCRIPTION | ExpandableComposite.TITLE_BAR);
    layout = new GridLayout();
    rpmSection.setText(Messages.ImportRPMsPage_sectionTitle);
    rpmSection.setDescription(Messages.ImportRPMsPage_sectionInstruction);
    rpmSection.setLayoutData(expandComposite());
    // the client area containing the tree + buttons
    Composite sectionClient = toolkit.createComposite(rpmSection);
    layout = new GridLayout(2, false);
    layout.marginWidth = 1;
    layout.marginHeight = 7;
    sectionClient.setLayout(layout);
    TreeViewer viewer = new TreeViewer(sectionClient, SWT.BORDER | SWT.MULTI | SWT.HORIZONTAL | SWT.VERTICAL | SWT.LEFT_TO_RIGHT | SWT.SMOOTH);
    viewer.addDropSupport(DND.DROP_COPY, new Transfer[] { FileTransfer.getInstance() }, new ImportRPMDropListener(viewer, project));
    tree = viewer.getTree();
    tree.setLayoutData(expandComposite());
    Composite buttonList = toolkit.createComposite(sectionClient);
    layout = new GridLayout();
    GridData data = new GridData(SWT.BEGINNING, SWT.FILL, false, true);
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    buttonList.setLayout(layout);
    buttonList.setLayoutData(data);
    createPushButton(buttonList, Messages.ImportRPMsPage_buttonImportRPMs, toolkit).addSelectionListener(new ImportButtonListener());
    createPushButton(buttonList, Messages.ImportRPMsPage_buttonRemoveRPMs, toolkit).addSelectionListener(new RemoveButtonListener());
    new Label(buttonList, SWT.NONE).setLayoutData(new GridData(0, 0));
    createPushButton(buttonList, Messages.ImportRPMsPage_buttonCreateRepo, toolkit).addSelectionListener(new CreaterepoButtonListener());
    refreshTree();
    rpmSection.setClient(sectionClient);
    managedForm.refresh();
}
Also used : FormToolkit(org.eclipse.ui.forms.widgets.FormToolkit) Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) TreeViewer(org.eclipse.jface.viewers.TreeViewer) Label(org.eclipse.swt.widgets.Label) Section(org.eclipse.ui.forms.widgets.Section) ToolBarManager(org.eclipse.jface.action.ToolBarManager) GridLayout(org.eclipse.swt.layout.GridLayout) IMenuService(org.eclipse.ui.menus.IMenuService) ScrolledForm(org.eclipse.ui.forms.widgets.ScrolledForm) GridData(org.eclipse.swt.layout.GridData) ImportRPMDropListener(org.eclipse.linuxtools.internal.rpm.createrepo.dnd.ImportRPMDropListener)

Example 14 with Section

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

the class MetadataPage method createFormContent.

@Override
protected void createFormContent(IManagedForm managedForm) {
    // setting up the form page
    super.createFormContent(managedForm);
    GridLayout layout = new GridLayout();
    toolkit = managedForm.getToolkit();
    ScrolledForm form = managedForm.getForm();
    form.setText(Messages.MetadataPage_formHeaderText);
    form.setImage(Activator.getImageDescriptor(HEADER_ICON).createImage());
    ToolBarManager toolbarManager = (ToolBarManager) form.getToolBarManager();
    toolkit.decorateFormHeading(form.getForm());
    // add the menuContribution from MANIFEST.MF to the form
    IMenuService menuService = getSite().getService(IMenuService.class);
    menuService.populateContributionManager(toolbarManager, MENU_URI);
    toolbarManager.update(true);
    layout = new GridLayout();
    layout.marginWidth = 6;
    layout.marginHeight = 12;
    form.getBody().setLayout(layout);
    // --------------------------------- REVISION SECTION START ----------
    // Section and its client area to manage updating revision info
    Section revSection = toolkit.createSection(form.getBody(), Section.DESCRIPTION | ExpandableComposite.TITLE_BAR);
    layout = new GridLayout();
    GridData data = new GridData();
    data.verticalAlignment = GridData.FILL;
    data.horizontalAlignment = GridData.FILL;
    data.grabExcessHorizontalSpace = true;
    revSection.setText(Messages.MetadataPage_sectionTitleRevision);
    revSection.setDescription(Messages.MetadataPage_sectionInstructionRevision);
    revSection.setLayoutData(data);
    // the client area containing the editing fields
    Composite sectionClient = toolkit.createComposite(revSection);
    layout = new GridLayout(2, false);
    layout.marginWidth = 1;
    layout.marginHeight = 7;
    sectionClient.setLayout(layout);
    Text revisionTxt = createTextFieldWithLabel(sectionClient, Messages.MetadataPage_labelRevision);
    String prefRevisionTxt = eclipsePreferences.get(CreaterepoPreferenceConstants.PREF_REVISION, ICreaterepoConstants.EMPTY_STRING);
    if (!prefRevisionTxt.isEmpty()) {
        revisionTxt.setText(prefRevisionTxt);
    }
    revisionTxt.addSelectionListener(SelectionListener.widgetDefaultSelectedAdapter(e -> {
        String revisionText = revisionTxt.getText().trim();
        savePreferences(CreaterepoPreferenceConstants.PREF_REVISION, revisionText);
    }));
    revSection.setClient(sectionClient);
    // ---------- REVISION SECTION END
    // --------------------------------- TAGS SECTION START ----------
    // Section and its client area to manage tags
    Section tagSection = toolkit.createSection(form.getBody(), Section.DESCRIPTION | ExpandableComposite.TITLE_BAR);
    layout = new GridLayout();
    tagSection.setText(Messages.MetadataPage_sectionTitleTags);
    tagSection.setDescription(Messages.MetadataPage_sectionInstructionTags);
    tagSection.setLayoutData(expandComposite());
    // the client area containing the tags
    Composite sectionClientTags = toolkit.createComposite(tagSection);
    layout = new GridLayout(2, false);
    layout.marginWidth = 1;
    layout.marginHeight = 7;
    sectionClientTags.setLayout(layout);
    tagTxt = createTextFieldWithLabel(sectionClientTags, Messages.MetadataPage_labelTags);
    tagTxt.addSelectionListener(new AddTagButtonListener());
    tagsTreeViewer = new TreeViewer(sectionClientTags, SWT.BORDER | SWT.SINGLE | SWT.HORIZONTAL | SWT.VERTICAL | SWT.LEFT_TO_RIGHT | SWT.SMOOTH);
    tagsTreeViewer.setContentProvider(new CreaterepoTreeContentProvider());
    tagsTreeViewer.setLabelProvider(new CreaterepoTreeLabelProvider());
    CreaterepoCategoryModel model = new CreaterepoCategoryModel(project);
    tagsTreeViewer.setInput(model);
    // change the tag text field on change (make editing tag easier)
    tagsTreeViewer.addSelectionChangedListener(event -> {
        if (tagsTree.getSelectionCount() == 1) {
            TreeItem treeItem = tagsTree.getSelection()[0];
            if (!(treeItem.getData() instanceof CreaterepoTreeCategory)) {
                String tag = (String) treeItem.getData();
                tagTxt.setText(tag);
            } else {
                tagTxt.setText(ICreaterepoConstants.EMPTY_STRING);
            }
        }
    });
    // expand or shrink a category
    tagsTreeViewer.addDoubleClickListener(event -> {
        IStructuredSelection selection = (IStructuredSelection) tagsTreeViewer.getSelection();
        if (selection.getFirstElement() instanceof CreaterepoTreeCategory) {
            CreaterepoTreeCategory category = (CreaterepoTreeCategory) selection.getFirstElement();
            tagsTreeViewer.setExpandedState(category, !tagsTreeViewer.getExpandedState(category));
        }
    });
    tagsTree = tagsTreeViewer.getTree();
    tagsTree.setLayoutData(expandComposite());
    // everything to do with the buttons
    Composite buttonList = toolkit.createComposite(sectionClientTags);
    layout = new GridLayout();
    data = new GridData(SWT.BEGINNING, SWT.FILL, false, true);
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    buttonList.setLayout(layout);
    buttonList.setLayoutData(data);
    createPushButton(buttonList, Messages.MetadataPage_buttonAddTag, toolkit).addSelectionListener(new AddTagButtonListener());
    createPushButton(buttonList, Messages.MetadataPage_buttonEditTag, toolkit).addSelectionListener(new EditTagButtonListener());
    createPushButton(buttonList, Messages.MetadataPage_buttonRemoveTag, toolkit).addSelectionListener(new RemoveTagButtonListener());
    tagSection.setClient(sectionClientTags);
    // ---------- TAGS SECTION END
    refreshTree();
    managedForm.refresh();
}
Also used : IMenuService(org.eclipse.ui.menus.IMenuService) CreaterepoProject(org.eclipse.linuxtools.internal.rpm.createrepo.CreaterepoProject) ICreaterepoConstants(org.eclipse.linuxtools.internal.rpm.createrepo.ICreaterepoConstants) BackingStoreException(org.osgi.service.prefs.BackingStoreException) CreaterepoPreferenceConstants(org.eclipse.linuxtools.internal.rpm.createrepo.CreaterepoPreferenceConstants) Composite(org.eclipse.swt.widgets.Composite) IEclipsePreferences(org.eclipse.core.runtime.preferences.IEclipsePreferences) CreaterepoTreeContentProvider(org.eclipse.linuxtools.internal.rpm.createrepo.tree.CreaterepoTreeContentProvider) GridData(org.eclipse.swt.layout.GridData) Activator(org.eclipse.linuxtools.internal.rpm.createrepo.Activator) Section(org.eclipse.ui.forms.widgets.Section) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Text(org.eclipse.swt.widgets.Text) CreaterepoTreeLabelProvider(org.eclipse.linuxtools.internal.rpm.createrepo.tree.CreaterepoTreeLabelProvider) Button(org.eclipse.swt.widgets.Button) CreaterepoCategoryModel(org.eclipse.linuxtools.internal.rpm.createrepo.tree.CreaterepoCategoryModel) FormEditor(org.eclipse.ui.forms.editor.FormEditor) FormToolkit(org.eclipse.ui.forms.widgets.FormToolkit) IManagedForm(org.eclipse.ui.forms.IManagedForm) TreeItem(org.eclipse.swt.widgets.TreeItem) Messages(org.eclipse.linuxtools.internal.rpm.createrepo.Messages) ScrolledForm(org.eclipse.ui.forms.widgets.ScrolledForm) Tree(org.eclipse.swt.widgets.Tree) SWT(org.eclipse.swt.SWT) ToolBarManager(org.eclipse.jface.action.ToolBarManager) TreeViewer(org.eclipse.jface.viewers.TreeViewer) CreaterepoTreeCategory(org.eclipse.linuxtools.internal.rpm.createrepo.tree.CreaterepoTreeCategory) SelectionEvent(org.eclipse.swt.events.SelectionEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) Label(org.eclipse.swt.widgets.Label) FormPage(org.eclipse.ui.forms.editor.FormPage) SelectionListener(org.eclipse.swt.events.SelectionListener) GridLayout(org.eclipse.swt.layout.GridLayout) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) CreaterepoTreeContentProvider(org.eclipse.linuxtools.internal.rpm.createrepo.tree.CreaterepoTreeContentProvider) Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) TreeItem(org.eclipse.swt.widgets.TreeItem) TreeViewer(org.eclipse.jface.viewers.TreeViewer) CreaterepoTreeLabelProvider(org.eclipse.linuxtools.internal.rpm.createrepo.tree.CreaterepoTreeLabelProvider) Text(org.eclipse.swt.widgets.Text) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) Section(org.eclipse.ui.forms.widgets.Section) ToolBarManager(org.eclipse.jface.action.ToolBarManager) CreaterepoTreeCategory(org.eclipse.linuxtools.internal.rpm.createrepo.tree.CreaterepoTreeCategory) GridLayout(org.eclipse.swt.layout.GridLayout) IMenuService(org.eclipse.ui.menus.IMenuService) ScrolledForm(org.eclipse.ui.forms.widgets.ScrolledForm) GridData(org.eclipse.swt.layout.GridData) CreaterepoCategoryModel(org.eclipse.linuxtools.internal.rpm.createrepo.tree.CreaterepoCategoryModel)

Example 15 with Section

use of org.eclipse.ui.forms.widgets.Section in project yamcs-studio by yamcs.

the class StyleEditor method createPartControl.

@Override
public void createPartControl(Composite parent) {
    tk = new FormToolkit(parent.getDisplay());
    Composite formWrapper = tk.createComposite(parent);
    GridLayout gl = new GridLayout();
    formWrapper.setLayout(gl);
    form = tk.createScrolledForm(formWrapper);
    form.setText("Style Editor");
    form.setLayoutData(new GridData(GridData.FILL_BOTH));
    gl = new GridLayout();
    form.getBody().setLayout(gl);
    Section section = tk.createSection(form.getBody(), Section.TITLE_BAR);
    section.setText("Colors");
    section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    StyleDefinition def = loadData(parent.getDisplay());
    ManagedForm managedForm = new ManagedForm(tk, form);
    resourceManager = new LocalResourceManager(JFaceResources.getResources());
    new ThemeColorBlock(def, parent.getDisplay(), resourceManager).createContent(managedForm);
    ManagedForm fontsMForm = new ManagedForm(tk, form);
    section = tk.createSection(form.getBody(), Section.TITLE_BAR);
    section.setText("Fonts");
    section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    new ThemeColorBlock(def, parent.getDisplay(), resourceManager).createContent(fontsMForm);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) FormToolkit(org.eclipse.ui.forms.widgets.FormToolkit) Composite(org.eclipse.swt.widgets.Composite) LocalResourceManager(org.eclipse.jface.resource.LocalResourceManager) ManagedForm(org.eclipse.ui.forms.ManagedForm) GridData(org.eclipse.swt.layout.GridData) Section(org.eclipse.ui.forms.widgets.Section)

Aggregations

Section (org.eclipse.ui.forms.widgets.Section)17 Composite (org.eclipse.swt.widgets.Composite)14 GridData (org.eclipse.swt.layout.GridData)13 GridLayout (org.eclipse.swt.layout.GridLayout)13 FormToolkit (org.eclipse.ui.forms.widgets.FormToolkit)10 ExpandableComposite (org.eclipse.ui.forms.widgets.ExpandableComposite)7 Button (org.eclipse.swt.widgets.Button)4 Label (org.eclipse.swt.widgets.Label)4 TreeViewer (org.eclipse.jface.viewers.TreeViewer)3 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)3 SelectionEvent (org.eclipse.swt.events.SelectionEvent)3 RowLayout (org.eclipse.swt.layout.RowLayout)3 ScrolledForm (org.eclipse.ui.forms.widgets.ScrolledForm)3 ServerEditorSection (org.eclipse.wst.server.ui.editor.ServerEditorSection)3 ToolBarManager (org.eclipse.jface.action.ToolBarManager)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 TableViewer (org.eclipse.jface.viewers.TableViewer)2 SelectionListener (org.eclipse.swt.events.SelectionListener)2 Table (org.eclipse.swt.widgets.Table)2 Tree (org.eclipse.swt.widgets.Tree)2