Search in sources :

Example 36 with FormAttachment

use of org.eclipse.swt.layout.FormAttachment in project tdi-studio-se by Talend.

the class TraceDebugProcessComposite method createLineLimitedControl.

private void createLineLimitedControl(Composite container) {
    Composite composite = new Composite(container, SWT.NONE);
    composite.setLayoutData(new GridData());
    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = 7;
    formLayout.marginHeight = 4;
    formLayout.spacing = 7;
    composite.setLayout(formLayout);
    enableLineLimitButton = new Button(composite, SWT.CHECK);
    //$NON-NLS-1$
    enableLineLimitButton.setText(Messages.getString("ProcessComposite.lineLimited"));
    FormData formData = new FormData();
    enableLineLimitButton.setLayoutData(formData);
    enableLineLimitButton.setEnabled(false);
    enableLineLimitButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            lineLimitText.setEditable(enableLineLimitButton.getSelection());
            RunProcessPlugin.getDefault().getPluginPreferences().setValue(RunprocessConstants.ENABLE_CONSOLE_LINE_LIMIT, enableLineLimitButton.getSelection());
        }
    });
    lineLimitText = new Text(composite, SWT.BORDER);
    formData = new FormData();
    formData.width = 120;
    formData.left = new FormAttachment(enableLineLimitButton, 0, SWT.RIGHT);
    lineLimitText.setLayoutData(formData);
    lineLimitText.setEnabled(false);
    lineLimitText.addListener(SWT.Verify, new Listener() {

        // this text only receive number here.
        @Override
        public void handleEvent(Event e) {
            String s = e.text;
            if (!s.equals("")) {
                //$NON-NLS-1$
                try {
                    Integer.parseInt(s);
                    RunProcessPlugin.getDefault().getPluginPreferences().setValue(RunprocessConstants.CONSOLE_LINE_LIMIT_COUNT, lineLimitText.getText() + s);
                } catch (Exception ex) {
                    e.doit = false;
                }
            }
        }
    });
    lineLimitText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            RunProcessPlugin.getDefault().getPluginPreferences().setValue(RunprocessConstants.CONSOLE_LINE_LIMIT_COUNT, lineLimitText.getText());
        }
    });
    boolean enable = RunProcessPlugin.getDefault().getPluginPreferences().getBoolean(RunprocessConstants.ENABLE_CONSOLE_LINE_LIMIT);
    enableLineLimitButton.setSelection(enable);
    lineLimitText.setEditable(enable);
    String count = RunProcessPlugin.getDefault().getPluginPreferences().getString(RunprocessConstants.CONSOLE_LINE_LIMIT_COUNT);
    if (count.equals("")) {
        //$NON-NLS-1$
        //$NON-NLS-1$
        count = "100";
    }
    lineLimitText.setText(count);
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) IStreamListener(org.eclipse.debug.core.IStreamListener) PropertyChangeListener(java.beans.PropertyChangeListener) Listener(org.eclipse.swt.widgets.Listener) ModifyListener(org.eclipse.swt.events.ModifyListener) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) ModifyListener(org.eclipse.swt.events.ModifyListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) StyledText(org.eclipse.swt.custom.StyledText) Text(org.eclipse.swt.widgets.Text) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Event(org.eclipse.swt.widgets.Event) PropertyChangeEvent(java.beans.PropertyChangeEvent) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 37 with FormAttachment

use of org.eclipse.swt.layout.FormAttachment in project tdi-studio-se by Talend.

the class TOSLoginComposite method createTosWorkspaceArea.

private void createTosWorkspaceArea(Composite parent) {
    tosWorkspaceComposite = toolkit.createComposite(parent);
    tosWorkspaceComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    tosWorkspaceComposite.setLayout(new FormLayout());
    tosWorkspaceComposite.setBackgroundMode(SWT.INHERIT_DEFAULT);
    FormData data;
    Label workSpaceLabel = toolkit.createLabel(tosWorkspaceComposite, Messages.getString("TOSLoginComposite.workspaceLabel"));
    workSpaceLabel.setFont(font);
    GC gc = new GC(workSpaceLabel);
    Point labelSize = gc.stringExtent(Messages.getString("TOSLoginComposite.workspaceLabel"));
    gc.dispose();
    data = new FormData();
    data.top = new FormAttachment(0, 10);
    data.left = new FormAttachment(0, 10);
    data.right = new FormAttachment(0, 10 + labelSize.x);
    data.bottom = new FormAttachment(0, 30);
    workSpaceLabel.setLayoutData(data);
    changeButton = toolkit.createButton(tosWorkspaceComposite, null, SWT.PUSH);
    data = new FormData();
    data.top = new FormAttachment(workSpaceLabel, 0, SWT.TOP);
    data.left = new FormAttachment(100, -75);
    data.right = new FormAttachment(100, -10);
    if (Platform.getOS().equals(Platform.OS_WIN32)) {
        data.bottom = new FormAttachment(workSpaceLabel, 0, SWT.BOTTOM);
    } else if (Platform.getOS().equals(Platform.OS_LINUX)) {
        data.bottom = new FormAttachment(workSpaceLabel, 5, SWT.BOTTOM);
    } else {
        data.bottom = new FormAttachment(workSpaceLabel, 5, SWT.BOTTOM);
    }
    changeButton.setText(Messages.getString("TOSLoginComposite.changeButton"));
    changeButton.setFont(font);
    changeButton.setLayoutData(data);
    workspaceText = toolkit.createText(tosWorkspaceComposite, null, SWT.READ_ONLY | SWT.BORDER);
    workspaceText.setFont(font);
    workspaceText.setBackground(GREY_COLOR);
    workspaceText.setText(loginComposite.getConnection().getWorkSpace());
    oldPath = loginComposite.getConnection().getWorkSpace();
    data = new FormData();
    data.width = 200;
    data.top = new FormAttachment(workSpaceLabel, 0, SWT.TOP);
    data.left = new FormAttachment(workSpaceLabel, 10, SWT.RIGHT);
    data.right = new FormAttachment(changeButton, -10, SWT.LEFT);
    data.bottom = new FormAttachment(changeButton, 0, SWT.BOTTOM);
    workspaceText.setLayoutData(data);
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) Point(org.eclipse.swt.graphics.Point) GC(org.eclipse.swt.graphics.GC) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 38 with FormAttachment

use of org.eclipse.swt.layout.FormAttachment in project tdi-studio-se by Talend.

the class TOSLoginComposite method createTosRepositoryArea.

private void createTosRepositoryArea(Composite parent) {
    repositoryComposite = toolkit.createComposite(parent);
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.heightHint = 40;
    repositoryComposite.setLayoutData(gd);
    repositoryComposite.setLayout(new FormLayout());
    repositoryComposite.setBackgroundMode(SWT.INHERIT_DEFAULT);
    String productName = brandingService.getProductName();
    Label welcomeLabel = toolkit.createLabel(repositoryComposite, //$NON-NLS-1$
    Messages.getString("TOSLoginComposite.welcomeTitle", productName));
    welcomeLabel.setBackground(repositoryComposite.getBackground());
    welcomeLabel.setFont(font);
    FormData welcomeLabelFormData = new FormData();
    welcomeLabelFormData.top = new FormAttachment(0, 7);
    welcomeLabelFormData.left = new FormAttachment(0, 10);
    if (Platform.getOS().equals(Platform.OS_WIN32)) {
        welcomeLabelFormData.right = new FormAttachment(0, 380);
        welcomeLabelFormData.right = new FormAttachment(0, 420);
    } else if (Platform.getOS().equals(Platform.OS_LINUX)) {
        welcomeLabelFormData.right = new FormAttachment(0, 420);
    } else {
        welcomeLabelFormData.right = new FormAttachment(0, 420);
    }
    welcomeLabelFormData.bottom = new FormAttachment(100, 0);
    welcomeLabel.setLayoutData(welcomeLabelFormData);
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 39 with FormAttachment

use of org.eclipse.swt.layout.FormAttachment in project tdi-studio-se by Talend.

the class DateSection method createControls.

@Override
public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) {
    super.createControls(parent, aTabbedPropertySheetPage);
    Composite composite = getWidgetFactory().createFlatFormComposite(parent);
    FormData data;
    //$NON-NLS-1$
    creationDate = getWidgetFactory().createText(composite, "");
    data = new FormData();
    data.left = new FormAttachment(0, STANDARD_LABEL_WIDTH);
    data.right = new FormAttachment(33, 0);
    data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
    creationDate.setLayoutData(data);
    creationDate.setEnabled(false);
    //$NON-NLS-1$
    CLabel creationLabel = getWidgetFactory().createCLabel(composite, Messages.getString("DateSection.creationLabel"));
    data = new FormData();
    data.left = new FormAttachment(0, 0);
    data.right = new FormAttachment(creationDate, -ITabbedPropertyConstants.HSPACE);
    data.top = new FormAttachment(creationDate, 0, SWT.CENTER);
    creationLabel.setLayoutData(data);
    //$NON-NLS-1$
    modificationDate = getWidgetFactory().createText(composite, "");
    data = new FormData();
    data.left = new FormAttachment(creationDate, STANDARD_LABEL_WIDTH + 15);
    data.right = new FormAttachment(66, 0);
    data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
    modificationDate.setLayoutData(data);
    modificationDate.setEnabled(false);
    CLabel modificationLabel = getWidgetFactory().createCLabel(composite, //$NON-NLS-1$
    Messages.getString("DateSection.ModificationLabel"));
    data = new FormData();
    data.left = new FormAttachment(creationDate, ITabbedPropertyConstants.HSPACE * 3);
    data.right = new FormAttachment(modificationDate, -ITabbedPropertyConstants.HSPACE);
    data.top = new FormAttachment(modificationDate, 0, SWT.CENTER);
    modificationLabel.setLayoutData(data);
    //$NON-NLS-1$
    commitDate = getWidgetFactory().createText(composite, "");
    data = new FormData();
    data.left = new FormAttachment(modificationDate, STANDARD_LABEL_WIDTH + 15);
    data.right = new FormAttachment(100, 0);
    data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
    commitDate.setLayoutData(data);
    commitDate.setEnabled(false);
    //$NON-NLS-1$
    commitLabel = getWidgetFactory().createCLabel(composite, Messages.getString("DateSection.commitLabel"));
    data = new FormData();
    data.left = new FormAttachment(modificationDate, ITabbedPropertyConstants.HSPACE * 3);
    data.right = new FormAttachment(commitDate, -ITabbedPropertyConstants.HSPACE);
    data.top = new FormAttachment(commitDate, 0, SWT.CENTER);
    commitLabel.setLayoutData(data);
    addFocusListenerToChildren(composite);
}
Also used : FormData(org.eclipse.swt.layout.FormData) CLabel(org.eclipse.swt.custom.CLabel) Composite(org.eclipse.swt.widgets.Composite) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 40 with FormAttachment

use of org.eclipse.swt.layout.FormAttachment in project tdi-studio-se by Talend.

the class DescriptionSection method createControls.

@Override
public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) {
    super.createControls(parent, aTabbedPropertySheetPage);
    Composite composite = getWidgetFactory().createFlatFormComposite(parent);
    FormData data;
    //$NON-NLS-1$
    descriptionText = getWidgetFactory().createText(composite, "", SWT.MULTI);
    data = new FormData();
    data.left = new FormAttachment(0, STANDARD_LABEL_WIDTH);
    data.right = new FormAttachment(100, 0);
    data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
    data.height = NB_LINES * descriptionText.getLineHeight();
    descriptionText.setLayoutData(data);
    addFocusListener(descriptionText);
    //$NON-NLS-1$
    CLabel labelLabel = getWidgetFactory().createCLabel(composite, Messages.getString("DescriptionSection.Label"));
    data = new FormData();
    data.left = new FormAttachment(0, 0);
    data.right = new FormAttachment(descriptionText, -ITabbedPropertyConstants.HSPACE);
    data.top = new FormAttachment(descriptionText, 0, SWT.TOP);
    labelLabel.setLayoutData(data);
    addFocusListenerToChildren(composite);
}
Also used : FormData(org.eclipse.swt.layout.FormData) CLabel(org.eclipse.swt.custom.CLabel) Composite(org.eclipse.swt.widgets.Composite) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Aggregations

FormAttachment (org.eclipse.swt.layout.FormAttachment)253 FormData (org.eclipse.swt.layout.FormData)245 Composite (org.eclipse.swt.widgets.Composite)97 Point (org.eclipse.swt.graphics.Point)96 Button (org.eclipse.swt.widgets.Button)95 FormLayout (org.eclipse.swt.layout.FormLayout)93 Control (org.eclipse.swt.widgets.Control)64 Label (org.eclipse.swt.widgets.Label)59 CLabel (org.eclipse.swt.custom.CLabel)56 SelectionEvent (org.eclipse.swt.events.SelectionEvent)55 Node (org.talend.designer.core.ui.editor.nodes.Node)49 Text (org.eclipse.swt.widgets.Text)48 GC (org.eclipse.swt.graphics.GC)46 SelectionListener (org.eclipse.swt.events.SelectionListener)37 DecoratedField (org.eclipse.jface.fieldassist.DecoratedField)36 GridData (org.eclipse.swt.layout.GridData)36 FieldDecoration (org.eclipse.jface.fieldassist.FieldDecoration)34 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)32 GridLayout (org.eclipse.swt.layout.GridLayout)32 Group (org.eclipse.swt.widgets.Group)29