Search in sources :

Example 31 with RowLayout

use of org.eclipse.swt.layout.RowLayout in project sling by apache.

the class DebugEditorSection method createSection.

@Override
public void createSection(Composite parent) {
    super.createSection(parent);
    FormToolkit toolkit = getFormToolkit(parent.getDisplay());
    Section section = toolkit.createSection(parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED | ExpandableComposite.TITLE_BAR | Section.DESCRIPTION | ExpandableComposite.FOCUS_TITLE);
    section.setText("Debug");
    section.setDescription("Resolving sources when connecting in debug mode ensure that you have up-to-date source attachments which reflect the " + "bundles running in the remote instance. However, initial resolve can be slow.");
    section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
    // ports
    Composite composite = toolkit.createComposite(section);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginHeight = 8;
    layout.marginWidth = 8;
    composite.setLayout(layout);
    GridData gridData = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.FILL_HORIZONTAL);
    composite.setLayoutData(gridData);
    toolkit.paintBordersFor(composite);
    section.setClient(composite);
    resolveSourcesButton = toolkit.createButton(composite, "Resolve sources when connecting", SWT.CHECK);
    GridData data = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1);
    resolveSourcesButton.setLayoutData(data);
    actionArea = toolkit.createComposite(composite);
    RowLayout actionAreaLayout = new RowLayout();
    actionAreaLayout.center = true;
    actionArea.setLayout(actionAreaLayout);
    initialize();
}
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) RowLayout(org.eclipse.swt.layout.RowLayout) GridData(org.eclipse.swt.layout.GridData) ServerEditorSection(org.eclipse.wst.server.ui.editor.ServerEditorSection) Section(org.eclipse.ui.forms.widgets.Section)

Example 32 with RowLayout

use of org.eclipse.swt.layout.RowLayout in project sling by apache.

the class InstallEditorSection method createSection.

@Override
public void createSection(Composite parent) {
    super.createSection(parent);
    FormToolkit toolkit = getFormToolkit(parent.getDisplay());
    Section section = toolkit.createSection(parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED | ExpandableComposite.TITLE_BAR | Section.DESCRIPTION | ExpandableComposite.FOCUS_TITLE);
    section.setText("Install");
    section.setDescription("Specify how to install bundles on the server");
    section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
    // ports
    Composite composite = toolkit.createComposite(section);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginHeight = 8;
    layout.marginWidth = 8;
    composite.setLayout(layout);
    GridData gridData = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.FILL_HORIZONTAL);
    composite.setLayoutData(gridData);
    toolkit.paintBordersFor(composite);
    section.setClient(composite);
    bundleLocalInstallButton = toolkit.createButton(composite, "Install bundles via bundle upload", SWT.RADIO);
    GridData data = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1);
    bundleLocalInstallButton.setLayoutData(data);
    quickLocalInstallButton = toolkit.createButton(composite, "Install bundles directly from the filesystem", SWT.RADIO);
    data = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1);
    quickLocalInstallButton.setLayoutData(data);
    actionArea = toolkit.createComposite(composite);
    RowLayout actionAreaLayout = new RowLayout();
    actionAreaLayout.center = true;
    actionArea.setLayout(actionAreaLayout);
    initialize();
}
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) RowLayout(org.eclipse.swt.layout.RowLayout) GridData(org.eclipse.swt.layout.GridData) ServerEditorSection(org.eclipse.wst.server.ui.editor.ServerEditorSection) Section(org.eclipse.ui.forms.widgets.Section)

Example 33 with RowLayout

use of org.eclipse.swt.layout.RowLayout in project eclipse.platform.text by eclipse.

the class MarkerInformationControl method setInput.

@SuppressWarnings("unchecked")
@Override
public void setInput(Object input) {
    this.composites.values().forEach(Composite::dispose);
    this.markers = (List<IMarker>) input;
    for (IMarker marker : this.markers) {
        Composite markerComposite = new Composite(parent, SWT.NONE);
        this.composites.put(marker, markerComposite);
        GridLayout gridLayout = new GridLayout(1, false);
        gridLayout.verticalSpacing = 0;
        gridLayout.horizontalSpacing = 0;
        gridLayout.marginHeight = 0;
        gridLayout.marginWidth = 0;
        markerComposite.setLayout(gridLayout);
        Composite markerLine = new Composite(markerComposite, SWT.NONE);
        RowLayout rowLayout = new RowLayout();
        rowLayout.marginTop = 0;
        rowLayout.marginBottom = 0;
        rowLayout.marginLeft = 0;
        rowLayout.marginRight = 0;
        markerLine.setLayout(rowLayout);
        IMarkerResolution[] resolutions = IDE.getMarkerHelpRegistry().getResolutions(marker);
        if (resolutions.length > 0) {
            Label markerImage = new Label(markerLine, SWT.NONE);
            markerImage.setImage(getImage(marker));
        }
        Label markerLabel = new Label(markerLine, SWT.NONE);
        // $NON-NLS-1$
        markerLabel.setText(marker.getAttribute(IMarker.MESSAGE, "missing message"));
        for (IMarkerResolution resolution : resolutions) {
            Composite resolutionComposite = new Composite(markerComposite, SWT.NONE);
            GridData layoutData = new GridData();
            layoutData.horizontalIndent = 10;
            resolutionComposite.setLayoutData(layoutData);
            RowLayout resolutionRowLayout = new RowLayout();
            resolutionRowLayout.marginBottom = 0;
            resolutionComposite.setLayout(resolutionRowLayout);
            Label resolutionImage = new Label(resolutionComposite, SWT.NONE);
            // TODO: try to retrieve icon from QuickFix command
            Image resolutionPic = null;
            if (resolution instanceof IMarkerResolution2) {
                resolutionPic = ((IMarkerResolution2) resolution).getImage();
            }
            if (resolutionPic == null) {
                resolutionPic = PlatformUI.getWorkbench().getSharedImages().getImage(SharedImages.IMG_OPEN_MARKER);
            }
            resolutionImage.setImage(resolutionPic);
            Link resolutionLink = new Link(resolutionComposite, SWT.NONE);
            // $NON-NLS-1$ //$NON-NLS-2$
            resolutionLink.setText("<A>" + resolution.getLabel() + "</a>");
            resolutionLink.addSelectionListener(new SelectionAdapter() {

                @Override
                public void widgetSelected(SelectionEvent e) {
                    Job resolutionJob = new // $NON-NLS-1$
                    Job(// $NON-NLS-1$
                    "apply resolution - " + resolution.getLabel()) {

                        @Override
                        protected IStatus run(IProgressMonitor monitor) {
                            resolution.run(marker);
                            return Status.OK_STATUS;
                        }
                    };
                    resolutionJob.setUser(true);
                    resolutionJob.setSystem(true);
                    resolutionJob.setPriority(Job.INTERACTIVE);
                    resolutionJob.schedule();
                    getShell().dispose();
                }
            });
        }
    }
    parent.layout(true);
}
Also used : IMarkerResolution2(org.eclipse.ui.IMarkerResolution2) IStatus(org.eclipse.core.runtime.IStatus) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) Image(org.eclipse.swt.graphics.Image) GridLayout(org.eclipse.swt.layout.GridLayout) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) IMarkerResolution(org.eclipse.ui.IMarkerResolution) RowLayout(org.eclipse.swt.layout.RowLayout) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) IMarker(org.eclipse.core.resources.IMarker) Job(org.eclipse.core.runtime.jobs.Job) Link(org.eclipse.swt.widgets.Link)

Example 34 with RowLayout

use of org.eclipse.swt.layout.RowLayout in project linuxtools by eclipse.

the class ChartDialog method createDialogArea.

@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);
    Composite titleComp = new Composite(composite, SWT.NONE);
    titleComp.setLayout(new RowLayout(SWT.HORIZONTAL));
    Label icon = new Label(titleComp, SWT.NONE);
    // $NON-NLS-1$
    icon.setImage(Activator.getImage("icons/chart_icon.png"));
    Label label = new Label(titleComp, SWT.WRAP);
    label.setText(Messages.ChartConstants_CHART_BUILDER);
    GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
    data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    titleComp.setLayoutData(data);
    Group chartTypeGroup = new Group(composite, SWT.NONE);
    data = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
    chartTypeGroup.setLayoutData(data);
    chartTypeGroup.setLayout(new GridLayout(2, false));
    chartTypeGroup.setText(Messages.ChartConstants_SELECT_YOUR_CHART_TYPE);
    SelectionListener listener = SelectionListener.widgetSelectedAdapter(e -> validateInput());
    barGraphButton = new Button(chartTypeGroup, SWT.RADIO);
    barGraphButton.setText(Messages.ChartConstants_BAR_GRAPH);
    barGraphButton.addSelectionListener(listener);
    barGraphButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> verticalBarsButton.setEnabled(barGraphButton.getSelection())));
    data = new GridData();
    barGraphButton.setLayoutData(data);
    verticalBarsButton = new Button(chartTypeGroup, SWT.CHECK);
    verticalBarsButton.setText(Messages.ChartConstants_VERTICAL_BARS);
    data = new GridData();
    verticalBarsButton.setLayoutData(data);
    pieChartButton = new Button(chartTypeGroup, SWT.RADIO);
    pieChartButton.setText(Messages.ChartConstants_PIE_CHART);
    pieChartButton.addSelectionListener(listener);
    data = new GridData();
    data.horizontalSpan = 2;
    pieChartButton.setLayoutData(data);
    Group chartColumnGroup = new Group(composite, SWT.NONE);
    chartColumnGroup.setLayout(new GridLayout(1, true));
    data = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
    chartColumnGroup.setLayoutData(data);
    chartColumnGroup.setText(Messages.ChartConstants_SELECT_COLUMNS_TO_SHOW);
    addColumnButtons(chartColumnGroup, listener);
    errorMessageText = new Text(composite, SWT.READ_ONLY);
    errorMessageText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    errorMessageText.setBackground(errorMessageText.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
    applyDialogFont(composite);
    setWidgetsValues();
    return composite;
}
Also used : ISTDataViewersField(org.eclipse.linuxtools.dataviewers.abstractviewers.ISTDataViewersField) ChartFactory(org.eclipse.linuxtools.dataviewers.charts.provider.ChartFactory) IDialogConstants(org.eclipse.jface.dialogs.IDialogConstants) IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) ArrayList(java.util.ArrayList) Chart(org.swtchart.Chart) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) LinkedList(java.util.LinkedList) FillLayout(org.eclipse.swt.layout.FillLayout) Text(org.eclipse.swt.widgets.Text) Shell(org.eclipse.swt.widgets.Shell) Button(org.eclipse.swt.widgets.Button) Activator(org.eclipse.linuxtools.internal.dataviewers.charts.Activator) IChartField(org.eclipse.linuxtools.dataviewers.charts.provider.IChartField) Group(org.eclipse.swt.widgets.Group) List(java.util.List) RowLayout(org.eclipse.swt.layout.RowLayout) Dialog(org.eclipse.jface.dialogs.Dialog) Messages(org.eclipse.linuxtools.internal.dataviewers.charts.Messages) SWT(org.eclipse.swt.SWT) AbstractSTViewer(org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTViewer) SelectionEvent(org.eclipse.swt.events.SelectionEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) Label(org.eclipse.swt.widgets.Label) Control(org.eclipse.swt.widgets.Control) SelectionListener(org.eclipse.swt.events.SelectionListener) GridLayout(org.eclipse.swt.layout.GridLayout) Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) RowLayout(org.eclipse.swt.layout.RowLayout) Label(org.eclipse.swt.widgets.Label) GridData(org.eclipse.swt.layout.GridData) Text(org.eclipse.swt.widgets.Text) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 35 with RowLayout

use of org.eclipse.swt.layout.RowLayout 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

RowLayout (org.eclipse.swt.layout.RowLayout)86 Composite (org.eclipse.swt.widgets.Composite)73 GridData (org.eclipse.swt.layout.GridData)55 Button (org.eclipse.swt.widgets.Button)54 GridLayout (org.eclipse.swt.layout.GridLayout)52 Label (org.eclipse.swt.widgets.Label)44 SelectionEvent (org.eclipse.swt.events.SelectionEvent)41 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)34 Group (org.eclipse.swt.widgets.Group)27 Text (org.eclipse.swt.widgets.Text)23 Combo (org.eclipse.swt.widgets.Combo)19 Shell (org.eclipse.swt.widgets.Shell)17 Display (org.eclipse.swt.widgets.Display)16 Point (org.eclipse.swt.graphics.Point)12 ArrayList (java.util.ArrayList)10 StyledText (org.eclipse.swt.custom.StyledText)10 Table (org.eclipse.swt.widgets.Table)10 List (java.util.List)9 SelectionListener (org.eclipse.swt.events.SelectionListener)9 FillLayout (org.eclipse.swt.layout.FillLayout)9