Search in sources :

Example 21 with FormToolkit

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

the class RpmSectionPage method createFormContent.

@Override
protected void createFormContent(IManagedForm managedForm) {
    super.createFormContent(managedForm);
    FormToolkit toolkit = managedForm.getToolkit();
    ScrolledForm form = managedForm.getForm();
    form.setText(rpmSection);
    GridLayout layout = new GridLayout();
    form.getBody().setLayout(layout);
    layout.numColumns = 2;
    toolkit.createLabel(form.getBody(), rpmSection);
    final Text text = toolkit.createText(form.getBody(), section.getContents(), SWT.MULTI | SWT.BORDER | SWT.V_SCROLL);
    GridData gd = new GridData();
    gd.grabExcessHorizontalSpace = true;
    gd.grabExcessVerticalSpace = true;
    gd.horizontalAlignment = SWT.FILL;
    gd.verticalAlignment = SWT.FILL;
    text.setLayoutData(gd);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) FormToolkit(org.eclipse.ui.forms.widgets.FormToolkit) ScrolledForm(org.eclipse.ui.forms.widgets.ScrolledForm) GridData(org.eclipse.swt.layout.GridData) Text(org.eclipse.swt.widgets.Text)

Example 22 with FormToolkit

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

the class DockerExplorerView method createPartControl.

@Override
public void createPartControl(final Composite parent) {
    final FormToolkit toolkit = new FormToolkit(parent.getDisplay());
    this.pageBook = new PageBook(parent, SWT.NONE);
    this.connectionsPane = createConnectionsPane(pageBook, toolkit);
    this.explanationsPane = createExplanationPane(pageBook, toolkit);
    showConnectionsOrExplanations();
    this.containersAndImagesSearchFilter = getContainersAndImagesSearchFilter();
    getCommonViewer().addFilter(containersAndImagesSearchFilter);
    DockerConnectionManager.getInstance().addConnectionManagerListener(this);
    if (DockerConnectionManager.getInstance().getConnections().length > 0) {
        IDockerConnection conn = DockerConnectionManager.getInstance().getConnections()[0];
        getCommonViewer().setSelection(new StructuredSelection(conn));
    }
}
Also used : FormToolkit(org.eclipse.ui.forms.widgets.FormToolkit) PageBook(org.eclipse.ui.part.PageBook) IDockerConnection(org.eclipse.linuxtools.docker.core.IDockerConnection) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection)

Example 23 with FormToolkit

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

the class DockerImageHierarchyView method createPartControl.

@Override
public void createPartControl(final Composite parent) {
    final FormToolkit toolkit = new FormToolkit(parent.getDisplay());
    this.pageBook = new PageBook(parent, SWT.NONE);
    this.hierarchyPane = createHierarchyPane(pageBook, toolkit);
    this.explanationsPane = createExplanationPane(pageBook, toolkit);
    showHierarchyOrExplanations();
}
Also used : FormToolkit(org.eclipse.ui.forms.widgets.FormToolkit) PageBook(org.eclipse.ui.part.PageBook)

Example 24 with FormToolkit

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

the class DockerImagesView method createPartControl.

@Override
public void createPartControl(final Composite parent) {
    final FormToolkit toolkit = new FormToolkit(parent.getDisplay());
    form = toolkit.createForm(parent);
    form.setText(DVMessages.getString(NoConnectionSelected));
    final Composite container = form.getBody();
    GridLayoutFactory.fillDefaults().numColumns(1).margins(0, 0).applyTo(container);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(container);
    createTableViewer(container);
    // track selection changes in the Docker Explorer view (only)
    getSite().getWorkbenchWindow().getSelectionService().addSelectionListener(DockerExplorerView.VIEW_ID, this);
    hookContextMenu();
    // Look at stored preference to determine if all images should be
    // shown or just top-level images. By default, only show
    // top-level images.
    IEclipsePreferences preferences = InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID);
    boolean showAll = preferences.getBoolean(SHOW_ALL_IMAGES_PREFERENCE, false);
    showAllImages(showAll);
    final ICommandService service = getViewSite().getWorkbenchWindow().getService(ICommandService.class);
    service.getCommand(SHOW_ALL_IMAGES_COMMAND_ID).getState(TOGGLE_STATE).setValue(showAll);
    service.refreshElements(SHOW_ALL_IMAGES_COMMAND_ID, null);
    DockerConnectionManager.getInstance().addConnectionManagerListener(this);
    // On startup, this view might get set up after the Docker Explorer View
    // and so we won't get the notification when it chooses the connection.
    // Find out if it has a selection and set our connection appropriately.
    ISelection selection = getSite().getWorkbenchWindow().getSelectionService().getSelection(DockerExplorerView.VIEW_ID);
    if (selection != null) {
        selectionChanged(null, selection);
        // also notify DockerConnectionWatcher
        DockerConnectionWatcher.getInstance().selectionChanged(null, selection);
    }
}
Also used : FormToolkit(org.eclipse.ui.forms.widgets.FormToolkit) Composite(org.eclipse.swt.widgets.Composite) IEclipsePreferences(org.eclipse.core.runtime.preferences.IEclipsePreferences) ISelection(org.eclipse.jface.viewers.ISelection) ICommandService(org.eclipse.ui.commands.ICommandService)

Example 25 with FormToolkit

use of org.eclipse.ui.forms.widgets.FormToolkit in project knime-core by knime.

the class WorkflowSetMetaInfoEditor method createPartControl.

/**
 * {@inheritDoc}
 */
@Override
public void createPartControl(final Composite parent) {
    m_toolkit = new FormToolkit(parent.getDisplay());
    m_form = m_toolkit.createScrolledForm(parent);
    m_form.setText(getPartName());
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    layout.makeColumnsEqualWidth = true;
    m_form.getBody().setLayout(layout);
    // content composite
    Composite content = m_toolkit.createComposite(m_form.getBody());
    layout = new GridLayout();
    layout.numColumns = 2;
    layout.horizontalSpacing = 20;
    layout.makeColumnsEqualWidth = false;
    content.setLayout(layout);
    // placeholder composite
    m_toolkit.createComposite(m_form.getBody());
    GridData layoutData = new GridData();
    layoutData.minimumWidth = 100;
    layoutData.widthHint = 100;
    layoutData.verticalAlignment = SWT.TOP;
    for (MetaGUIElement element : m_elements) {
        LOGGER.debug("element " + element.getLabel());
        Label label = m_toolkit.createLabel(content, element.getLabel() + ": ");
        label.setLayoutData(layoutData);
        element.createGUIElement(m_toolkit, content);
        element.addListener(new ModifyListener() {

            @Override
            public void modifyText(final ModifyEvent e) {
                setDirty(true);
            }
        });
    }
    m_form.reflow(true);
}
Also used : MetaGUIElement(org.knime.workbench.ui.metainfo.model.MetaGUIElement) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) FormToolkit(org.eclipse.ui.forms.widgets.FormToolkit) Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label)

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