Search in sources :

Example 1 with Layout

use of org.eclipse.swt.widgets.Layout in project tdi-studio-se by Talend.

the class UIManager method minimizeAllTables.

public void minimizeAllTables(Zone zone, boolean minimize, ToolItem minimizeButton) {
    List<DataMapTableView> tablesView = null;
    TablesZoneView tablesZoneView = null;
    if (zone == Zone.INPUTS) {
        tablesView = mapperManager.getUiManager().getInputsTablesView();
        tablesZoneView = getTablesZoneViewInputs();
    } else if (zone == Zone.OUTPUTS) {
        tablesZoneView = getTablesZoneViewOutputs();
        tablesView = mapperManager.getUiManager().getOutputsTablesView();
    } else {
        //$NON-NLS-1$
        throw new RuntimeException("Case not found:" + zone);
    }
    Layout layout = tablesZoneView.getLayout();
    try {
        tablesZoneView.setLayout(null);
        for (DataMapTableView view : tablesView) {
            view.minimizeTable(minimize);
        }
    } catch (RuntimeException e) {
        ExceptionHandler.process(e);
    } finally {
        tablesZoneView.setLayout(layout);
    }
    tablesZoneView.layout();
    for (DataMapTableView view : tablesView) {
        view.layout();
    }
    resizeTablesZoneViewAtComputedSize(zone);
    moveScrollBarZoneAtSelectedTable(zone);
}
Also used : Layout(org.eclipse.swt.widgets.Layout) InputDataMapTableView(org.talend.designer.mapper.ui.visualmap.table.InputDataMapTableView) OutputDataMapTableView(org.talend.designer.mapper.ui.visualmap.table.OutputDataMapTableView) VarsDataMapTableView(org.talend.designer.mapper.ui.visualmap.table.VarsDataMapTableView) DataMapTableView(org.talend.designer.mapper.ui.visualmap.table.DataMapTableView) TablesZoneView(org.talend.designer.mapper.ui.visualmap.zone.scrollable.TablesZoneView)

Example 2 with Layout

use of org.eclipse.swt.widgets.Layout in project tdi-studio-se by Talend.

the class UIManager method minimizeAllTables.

public void minimizeAllTables(Zone zone, boolean minimize, ToolItem minimizeButton) {
    List<DataMapTableView> tablesView = null;
    TablesZoneView tablesZoneView = null;
    if (zone == Zone.INPUTS) {
        tablesView = getInputsTablesView();
        tablesZoneView = getTablesZoneViewInputs();
    } else if (zone == Zone.OUTPUTS) {
        tablesZoneView = getTablesZoneViewOutputs();
        tablesView = getOutputsTablesView();
    } else {
        //$NON-NLS-1$
        throw new RuntimeException("Case not found:" + zone);
    }
    Layout layout = tablesZoneView.getLayout();
    try {
        tablesZoneView.setLayout(null);
        for (DataMapTableView view : tablesView) {
            view.minimizeTable(minimize);
        }
    } catch (RuntimeException e) {
        ExceptionHandler.process(e);
    } finally {
        tablesZoneView.setLayout(layout);
    }
    tablesZoneView.layout();
    for (DataMapTableView view : tablesView) {
        view.layout();
    }
    resizeTablesZoneViewAtComputedSize(zone);
    moveScrollBarZoneAtSelectedTable(zone);
}
Also used : Layout(org.eclipse.swt.widgets.Layout) InputDataMapTableView(org.talend.designer.dbmap.ui.visualmap.table.InputDataMapTableView) OutputDataMapTableView(org.talend.designer.dbmap.ui.visualmap.table.OutputDataMapTableView) DataMapTableView(org.talend.designer.dbmap.ui.visualmap.table.DataMapTableView) TablesZoneView(org.talend.designer.dbmap.ui.visualmap.zone.scrollable.TablesZoneView)

Example 3 with Layout

use of org.eclipse.swt.widgets.Layout in project linuxtools by eclipse.

the class OprofiledLogDialog method createCustomArea.

@Override
protected Control createCustomArea(Composite parent) {
    Composite area = new Composite(parent, 0);
    Layout layout = new GridLayout(1, true);
    GridData gd = new GridData(GRID_WIDTH, GRID_HEIGHT);
    area.setLayout(layout);
    area.setLayoutData(gd);
    Text txt = new Text(area, SWT.READ_ONLY | SWT.MULTI | SWT.V_SCROLL | SWT.BORDER);
    // Check if the textContent isn't null
    if (textContent != null) {
        txt.setText(textContent);
    }
    txt.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    return area;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Layout(org.eclipse.swt.widgets.Layout) GridLayout(org.eclipse.swt.layout.GridLayout) GridData(org.eclipse.swt.layout.GridData) Text(org.eclipse.swt.widgets.Text)

Example 4 with Layout

use of org.eclipse.swt.widgets.Layout in project xtext-eclipse by eclipse.

the class XbaseInformationControl method createContent.

/**
 * Xbase - modification+ added detailPane
 */
@Override
protected void createContent(Composite parent) {
    fSashForm = new SashForm(parent, parent.getStyle());
    fSashForm.setOrientation(SWT.VERTICAL);
    fBrowser = new Browser(fSashForm, SWT.NONE);
    fBrowser.setJavascriptEnabled(false);
    Display display = getShell().getDisplay();
    ColorRegistry registry = JFaceResources.getColorRegistry();
    // $NON-NLS-1$
    Color foreground = registry.get("org.eclipse.ui.workbench.HOVER_FOREGROUND");
    // $NON-NLS-1$
    Color background = registry.get("org.eclipse.ui.workbench.HOVER_BACKGROUND");
    if (background != null && foreground != null) {
        fBrowser.setForeground(foreground);
        fBrowser.setBackground(background);
    } else {
        fBrowser.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
        fBrowser.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
    }
    fBrowser.addProgressListener(new ProgressAdapter() {

        @Override
        public void completed(ProgressEvent event) {
            fCompleted = true;
        }
    });
    fBrowser.addOpenWindowListener(new OpenWindowListener() {

        @Override
        public void open(WindowEvent event) {
            // Cancel opening of new windows
            event.required = true;
        }
    });
    // Replace browser's built-in context menu with none
    fSashForm.setMenu(new Menu(getShell(), SWT.NONE));
    detailPaneComposite = createComposite(fSashForm, 1, 1, GridData.FILL_BOTH);
    Layout layout = detailPaneComposite.getLayout();
    if (layout instanceof GridLayout) {
        GridLayout gl = (GridLayout) layout;
        gl.marginHeight = 0;
        gl.marginWidth = 0;
        gl.numColumns = 1;
    }
    if (background != null && foreground != null) {
        detailPaneComposite.setForeground(foreground);
        detailPaneComposite.setBackground(background);
    } else {
        detailPaneComposite.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
        detailPaneComposite.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
    }
    resourceProvider = new HoverEditedResourceProvider();
    embeddedEditor = xbaseHoverConfiguration.getEditorFactory().newEditor(resourceProvider).readOnly().processIssuesBy(new IValidationIssueProcessor() {

        @Override
        public void processIssues(List<Issue> issues, IProgressMonitor monitor) {
        }
    }).withParent(detailPaneComposite);
    Control viewerControl = embeddedEditor.getViewer().getControl();
    if (background != null && foreground != null) {
        viewerControl.setForeground(foreground);
        viewerControl.setBackground(background);
    } else {
        viewerControl.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
        viewerControl.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
    }
    embeddedEditor.getDocument().setValidationJob(null);
    createTextLayout();
    parent.addDisposeListener(e -> {
        if (fTextLayout != null && !fTextLayout.isDisposed()) {
            fTextLayout.dispose();
        }
    });
}
Also used : Issue(org.eclipse.xtext.validation.Issue) Color(org.eclipse.swt.graphics.Color) ProgressEvent(org.eclipse.swt.browser.ProgressEvent) IValidationIssueProcessor(org.eclipse.xtext.ui.editor.validation.IValidationIssueProcessor) SashForm(org.eclipse.swt.custom.SashForm) GridLayout(org.eclipse.swt.layout.GridLayout) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) IXtextBrowserInformationControl(org.eclipse.xtext.ui.editor.hover.html.IXtextBrowserInformationControl) AbstractInformationControl(org.eclipse.jface.text.AbstractInformationControl) Control(org.eclipse.swt.widgets.Control) ColorRegistry(org.eclipse.jface.resource.ColorRegistry) TextLayout(org.eclipse.swt.graphics.TextLayout) Layout(org.eclipse.swt.widgets.Layout) GridLayout(org.eclipse.swt.layout.GridLayout) WindowEvent(org.eclipse.swt.browser.WindowEvent) ProgressAdapter(org.eclipse.swt.browser.ProgressAdapter) Menu(org.eclipse.swt.widgets.Menu) OpenWindowListener(org.eclipse.swt.browser.OpenWindowListener) Browser(org.eclipse.swt.browser.Browser) Display(org.eclipse.swt.widgets.Display)

Example 5 with Layout

use of org.eclipse.swt.widgets.Layout in project jbosstools-hibernate by jbosstools.

the class FormTextEntry method fillIntoGrid.

private void fillIntoGrid(Composite parent, int indent) {
    Layout layout = parent.getLayout();
    if (layout instanceof GridLayout) {
        GridData gd;
        int span = ((GridLayout) layout).numColumns;
        gd = new GridData(GridData.VERTICAL_ALIGN_CENTER);
        gd.horizontalIndent = indent;
        label.setLayoutData(gd);
        int tspan = browse != null ? span - 2 : span - 1;
        gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
        gd.horizontalSpan = tspan;
        gd.grabExcessHorizontalSpace = (tspan == 1);
        gd.widthHint = 10;
        text.setLayoutData(gd);
        if (browse != null) {
            gd = new GridData(GridData.VERTICAL_ALIGN_CENTER);
            browse.setLayoutData(gd);
        }
    } else if (layout instanceof TableWrapLayout) {
        TableWrapData td;
        int span = ((TableWrapLayout) layout).numColumns;
        td = new TableWrapData();
        td.valign = TableWrapData.MIDDLE;
        td.indent = indent;
        label.setLayoutData(td);
        int tspan = browse != null ? span - 2 : span - 1;
        td = new TableWrapData(TableWrapData.FILL);
        td.colspan = tspan;
        td.grabHorizontal = (tspan == 1);
        td.valign = TableWrapData.MIDDLE;
        text.setLayoutData(td);
        if (browse != null) {
            td = new TableWrapData();
            td.valign = TableWrapData.MIDDLE;
            browse.setLayoutData(td);
        }
    }
}
Also used : TableWrapData(org.eclipse.ui.forms.widgets.TableWrapData) GridLayout(org.eclipse.swt.layout.GridLayout) Layout(org.eclipse.swt.widgets.Layout) TableWrapLayout(org.eclipse.ui.forms.widgets.TableWrapLayout) GridLayout(org.eclipse.swt.layout.GridLayout) TableWrapLayout(org.eclipse.ui.forms.widgets.TableWrapLayout) GridData(org.eclipse.swt.layout.GridData) Point(org.eclipse.swt.graphics.Point)

Aggregations

Layout (org.eclipse.swt.widgets.Layout)18 GridLayout (org.eclipse.swt.layout.GridLayout)10 Composite (org.eclipse.swt.widgets.Composite)10 GridData (org.eclipse.swt.layout.GridData)8 Point (org.eclipse.swt.graphics.Point)7 FillLayout (org.eclipse.swt.layout.FillLayout)4 Control (org.eclipse.swt.widgets.Control)4 CTabFolder (org.eclipse.swt.custom.CTabFolder)3 Rectangle (org.eclipse.swt.graphics.Rectangle)3 FormLayout (org.eclipse.swt.layout.FormLayout)3 Button (org.eclipse.swt.widgets.Button)3 Label (org.eclipse.swt.widgets.Label)3 Text (org.eclipse.swt.widgets.Text)3 ArrayList (java.util.ArrayList)2 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)2 StyledText (org.eclipse.swt.custom.StyledText)2 SelectionEvent (org.eclipse.swt.events.SelectionEvent)2 SelectionListener (org.eclipse.swt.events.SelectionListener)2 Color (org.eclipse.swt.graphics.Color)2 Display (org.eclipse.swt.widgets.Display)2