Search in sources :

Example 41 with FormToolkit

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

the class VagrantBoxView method createPartControl.

@Override
public void createPartControl(final Composite parent) {
    final FormToolkit toolkit = new FormToolkit(parent.getDisplay());
    form = toolkit.createForm(parent);
    form.setText(DVMessages.getString(DaemonMissing));
    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);
    hookContextMenu();
}
Also used : FormToolkit(org.eclipse.ui.forms.widgets.FormToolkit) Composite(org.eclipse.swt.widgets.Composite)

Example 42 with FormToolkit

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

the class VagrantVMView method createPartControl.

@Override
public void createPartControl(final Composite parent) {
    final FormToolkit toolkit = new FormToolkit(parent.getDisplay());
    form = toolkit.createForm(parent);
    form.setText(DVMessages.getString(DaemonMissing));
    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);
    getSite().registerContextMenu(new MenuManager(), null);
    hookContextMenu();
}
Also used : FormToolkit(org.eclipse.ui.forms.widgets.FormToolkit) Composite(org.eclipse.swt.widgets.Composite) MenuManager(org.eclipse.jface.action.MenuManager)

Example 43 with FormToolkit

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

the class DockerContainersView 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);
    getSite().registerContextMenu(new MenuManager(), null);
    // track selection changes in the Docker Explorer view (only)
    getSite().getWorkbenchWindow().getSelectionService().addSelectionListener(DockerExplorerView.VIEW_ID, this);
    hookContextMenu();
    hookToolBarItems();
    // Look at stored preference to determine if all containers should be
    // shown or just running/paused containers. By default, only show
    // running/paused containers
    IEclipsePreferences preferences = InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID);
    boolean showAll = preferences.getBoolean(SHOW_ALL_CONTAINERS_PREFERENCE, true);
    showAllContainers(showAll);
    final ICommandService service = getViewSite().getWorkbenchWindow().getService(ICommandService.class);
    service.getCommand(SHOW_ALL_CONTAINERS_COMMAND_ID).getState(TOGGLE_STATE).setValue(showAll);
    service.refreshElements(SHOW_ALL_CONTAINERS_COMMAND_ID, null);
    boolean filterByLabels = preferences.getBoolean(FILTER_WITH_LABELS_PREFERENCE, false);
    showContainersWithLabels(filterByLabels);
    service.getCommand(FILTER_CONTAINERS_COMMAND_ID).getState(TOGGLE_STATE).setValue(filterByLabels);
    service.refreshElements(FILTER_CONTAINERS_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) MenuManager(org.eclipse.jface.action.MenuManager) ISelection(org.eclipse.jface.viewers.ISelection) ICommandService(org.eclipse.ui.commands.ICommandService)

Example 44 with FormToolkit

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

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

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