Search in sources :

Example 56 with FormAttachment

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

the class LoginProjectPage method addListeners.

@Override
protected void addListeners() {
    super.addListeners();
    connectionsViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            try {
                resetProjectOperationSelectionWithBusyCursor(false);
                final ConnectionBean connection = getConnection();
                if (connection == null) {
                    checkErrors();
                    return;
                }
                // }
                if (connection == loginHelper.getCurrentSelectedConnBean()) {
                    return;
                } else {
                    loginHelper.setCurrentSelectedConnBean(connection);
                }
                cancelAndClearFetchJobs();
                errorManager.clearAllMessages();
                // beforeConnBean = connection;
                updateServerFields();
                // Validate data
                if (validateFields()) {
                    fillUIProjectListWithBusyCursor();
                    validateProject();
                }
                checkErrors();
                validateUpdate();
            } catch (PersistenceException e) {
                CommonExceptionHandler.process(e);
            } catch (JSONException e) {
                CommonExceptionHandler.process(e);
            }
        }
    });
    selectExistingProject.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (selectExistingProject.getSelection()) {
                // refreshProjectListAreaEnable(true);
                finishButtonAction = FINISH_ACTION_OPEN_PROJECT;
                // changeFinishButtonAction(finishButtonAction);
                try {
                    checkErrors();
                } catch (PersistenceException e1) {
                    CommonExceptionHandler.process(e1);
                }
            } else {
                refreshProjectListAreaEnable(false);
            }
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        // nothing need to do
        }
    });
    createSandBoxProject.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (createSandBoxProject.getSelection()) {
                finishButtonAction = FINISH_ACTION_CREATE_SANDBOX;
                // changeFinishButtonAction(finishButtonAction);
                refreshUIFinishButtonEnable(false);
                executeCreateSandBoxProject.setVisible(true);
                executeCreateSandBoxProject.forceFocus();
            } else {
                executeCreateSandBoxProject.setVisible(false);
            }
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        // nothing need to do
        }
    });
    importDemoProject.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (importDemoProject.getSelection()) {
                finishButtonAction = FINISH_ACTION_IMPORT_DEMO_PROJECT;
                // changeFinishButtonAction(finishButtonAction);
                refreshUIFinishButtonEnable(false);
                executeImportDemoProject.setVisible(true);
                executeImportDemoProject.forceFocus();
            } else {
                executeImportDemoProject.setVisible(false);
            }
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        // nothing need to do
        }
    });
    importLocalProject.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (importLocalProject.getSelection()) {
                finishButtonAction = FINISH_ACTION_IMPORT_LOCAL_PROJECT;
                // changeFinishButtonAction(finishButtonAction);
                refreshUIFinishButtonEnable(false);
                executeImportLocalProject.setVisible(true);
                executeImportLocalProject.forceFocus();
            } else {
                executeImportLocalProject.setVisible(false);
            }
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        // nothing need to do
        }
    });
    createNewProject.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (createNewProject.getSelection()) {
                //$NON-NLS-1$
                createNewProject.setText(Messages.getString("LoginProjectPage.createNewProject.beginCreate"));
                createNewProject.pack();
                FormData formData = (FormData) newProjectName.getLayoutData();
                formData.left = new FormAttachment(createNewProject, createNewProject.getSize().x + TAB_HORIZONTAL_PADDING_LEVEL_2, SWT.LEFT);
                newProjectName.setVisible(true);
                newProjectName.forceFocus();
                executeCreateNewProject.setVisible(true);
                finishButtonAction = FINISH_ACTION_CREATE_NEW_PROJECT;
                // changeFinishButtonAction(finishButtonAction);
                refreshUIFinishButtonEnable(false);
                validateNewProjectName();
            } else {
                //$NON-NLS-1$
                createNewProject.setText(Messages.getString("LoginProjectPage.createNewProject"));
                newProjectName.setVisible(false);
                executeCreateNewProject.setVisible(false);
                getErrorManager().clearCreateNewProjectError();
            // refreshUIFinishButtonEnable();
            }
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        // nothing need to do
        }
    });
    projectViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            finishButton.setEnabled(false);
            Project project = getProject();
            if (project != null) {
                // last used project will be saved when click finish
                // loginHelper.getPrefManipulator().setLastProject(project.getLabel());
                fetchLicenseIfNeeded(project);
                try {
                    fillUIBranches(project, false);
                } catch (JSONException e) {
                    // TODO Auto-generated catch block
                    ExceptionHandler.process(e);
                }
                setRepositoryContextInContext();
            }
            finishButton.setEnabled(true);
        }
    });
    branchesViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
        // last used branch of project will be saved when click finish
        // String branch = getBranch();
        // if (branch == null) {
        // branch = SVNConstant.EMPTY;
        // }
        // Project project = getProject();
        // try {
        // loginHelper.getPrefManipulator().setLastSVNBranch(
        // new JSONObject(project.getEmfProject().getUrl()).getString("location"), project.getTechnicalLabel(),
        // branch);
        // } catch (JSONException e) {
        // // TODO Auto-generated catch block
        // ExceptionHandler.process(e);
        // }
        }
    });
    manageButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            try {
                ConnectionsDialog connectionsDialog = new ConnectionsDialog(getShell());
                int open = connectionsDialog.open();
                if (open == Window.OK) {
                    List<ConnectionBean> storedConnections = connectionsDialog.getConnections();
                    loginHelper.setStoredConnections(storedConnections);
                    loginHelper.saveConnections();
                    fillUIContentsWithBusyCursor();
                    final ConnectionBean connection = getConnection();
                    if (connection == null) {
                        checkErrors();
                        return;
                    }
                    // beforeConnBean = connection;
                    updateServerFields();
                    // Validate data
                    if (validateFields()) {
                        fillUIProjectListWithBusyCursor();
                        validateProject();
                    }
                    checkErrors();
                    validateUpdate();
                } else if (!LoginHelper.isRemoteConnection(getConnection())) {
                    fillUIProjectListWithBusyCursor();
                    validateProject();
                    checkErrors();
                }
            // setStatusArea();
            } catch (PersistenceException e1) {
                CommonExceptionHandler.process(e1);
            } catch (JSONException e2) {
                CommonExceptionHandler.process(e2);
            }
        }
    });
    refreshProjectButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            cancelAndClearFetchJobs();
            LoginProjectPage.this.selectedProjectBeforeRefresh = getProject() == null ? null : getProject().getLabel();
            // Validate data
            if (validateFields()) {
                fillUIProjectListWithBusyCursor();
                validateProject();
            }
            try {
                checkErrors();
                validateUpdate();
            } catch (PersistenceException e1) {
                CommonExceptionHandler.process(e1);
            } catch (JSONException e1) {
                CommonExceptionHandler.process(e1);
            }
            setRepositoryContextInContext();
            LoginProjectPage.this.selectedProjectBeforeRefresh = null;
        }
    });
    newProjectName.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            validateNewProjectName();
        }
    });
    executeCreateNewProject.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            createNewProjectWithBusyCursor();
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        // nothing need to do
        }
    });
    executeCreateSandBoxProject.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            createSandboxProject();
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        // nothing need to do
        }
    });
    executeImportDemoProject.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            importDemoProject();
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        // nothing need to do
        }
    });
    executeImportLocalProject.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            importProjects();
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        // nothing need to do
        }
    });
    finishButton.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (FINISH_ACTION_OPEN_PROJECT.equals(finishButtonAction)) {
                setRepositoryContextInContext();
                finishPressed();
            } else if (FINISH_ACTION_RESTART.equals(finishButtonAction)) {
                restartStudio();
            } else if (FINISH_ACTION_UPDATE.equals(finishButtonAction) || FINISH_ACTION_UPDATE_DETAILS.equals(finishButtonAction)) {
                updateStudio();
            } else if (FINISH_ACTION_CREATE_SANDBOX.equals(finishButtonAction)) {
                createSandboxProject();
            } else if (FINISH_ACTION_IMPORT_DEMO_PROJECT.equals(finishButtonAction)) {
                importDemoProject();
            } else if (FINISH_ACTION_IMPORT_LOCAL_PROJECT.equals(finishButtonAction)) {
                importProjects();
            } else if (FINISH_ACTION_CREATE_NEW_PROJECT.equals(finishButtonAction)) {
                createNewProjectWithBusyCursor();
            }
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        // nothing need to do
        }
    });
}
Also used : FormData(org.eclipse.swt.layout.FormData) ModifyListener(org.eclipse.swt.events.ModifyListener) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) JSONException(org.talend.utils.json.JSONException) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) Project(org.talend.core.model.general.Project) ModifyEvent(org.eclipse.swt.events.ModifyEvent) PersistenceException(org.talend.commons.exception.PersistenceException) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ConnectionBean(org.talend.core.model.general.ConnectionBean) ArrayList(java.util.ArrayList) List(java.util.List) ConnectionsDialog(org.talend.repository.ui.login.connections.ConnectionsDialog) FormAttachment(org.eclipse.swt.layout.FormAttachment) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 57 with FormAttachment

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

the class LoginProjectPage method layoutProjectListArea.

protected void layoutProjectListArea() {
    projectListArea.setLayout(new FormLayout());
    FormData formData = null;
    /**
         * BranchArea layout
         */
    formData = new FormData();
    formData.left = new FormAttachment(0, TAB_HORIZONTAL_PADDING_LEVEL_3);
    formData.right = new FormAttachment(100, 0);
    formData.bottom = new FormAttachment(100, 0);
    branchArea.setLayoutData(formData);
    branchArea.setLayout(new FormLayout());
    int svnBranchLabelWidth = branchLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT).x;
    int refreshButtonWidth = refreshProjectButton.computeSize(SWT.DEFAULT, SWT.DEFAULT).x;
    formData = new FormData();
    formData.bottom = new FormAttachment(100, 0);
    formData.right = new FormAttachment(100, -1 * refreshButtonWidth - TAB_HORIZONTAL_PADDING_LEVEL_2);
    formData.left = new FormAttachment(0, svnBranchLabelWidth + TAB_HORIZONTAL_PADDING_LEVEL_2);
    Control svnBranchComboControl = branchesViewer.getControl();
    svnBranchComboControl.setLayoutData(formData);
    formData = new FormData();
    formData.top = new FormAttachment(svnBranchComboControl, 0, SWT.CENTER);
    formData.bottom = new FormAttachment(svnBranchComboControl, 0, SWT.CENTER);
    formData.left = new FormAttachment(0, 0);
    branchLabel.setLayoutData(formData);
    formData = new FormData();
    formData.right = new FormAttachment(100, 0);
    if (EnvironmentUtils.isWindowsSystem()) {
        formData.top = new FormAttachment(svnBranchComboControl, -1, SWT.TOP);
        formData.bottom = new FormAttachment(svnBranchComboControl, 1, SWT.BOTTOM);
    } else {
        formData.top = new FormAttachment(svnBranchComboControl, 0, SWT.CENTER);
        formData.bottom = new FormAttachment(svnBranchComboControl, 0, SWT.CENTER);
    }
    refreshProjectButton.setLayoutData(formData);
    formData = new FormData();
    formData.top = new FormAttachment(0, 0);
    formData.left = new FormAttachment(0, 0);
    formData.right = new FormAttachment(100, 0);
    formData.bottom = new FormAttachment(branchArea, -1 * TAB_VERTICAL_PADDING_LEVEL_2, SWT.TOP);
    projectViewer.getControl().setLayoutData(formData);
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) Control(org.eclipse.swt.widgets.Control) FormAttachment(org.eclipse.swt.layout.FormAttachment) Point(org.eclipse.swt.graphics.Point)

Example 58 with FormAttachment

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

the class TableByRowController method createControl.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.designer.core.ui.editor.properties2.editors.AbstractElementPropertySectionController#
     * createControl(org.eclipse.swt.widgets.Composite, org.talend.core.model.process.IElementParameter, int, int, int,
     * org.eclipse.swt.widgets.Control)
     */
@Override
public Control createControl(final Composite parentComposite, final IElementParameter param, final int numInRow, final int nbInRow, int top, final Control lastControlPrm) {
    this.curParameter = param;
    this.paramFieldType = param.getFieldType();
    final Composite container = parentComposite;
    PropertiesTableEditorModel<Map<String, Object>> tableEditorModel = new PropertiesTableEditorModel<Map<String, Object>>();
    if (param.getValue() == null || param.getValue().equals("")) {
        param.setValue(new ArrayList<Map<String, Object>>());
    }
    init(elem, param);
    tableEditorModel.setData(elem, param, getProcess(elem, part));
    PropertiesTableByRowEditorView<Map<String, Object>> tableEditorView = new PropertiesTableByRowEditorView<Map<String, Object>>(parentComposite, SWT.NONE, tableEditorModel, true, false);
    tableEditorView.getExtendedTableViewer().setCommandStack(getCommandStack());
    tableEditorView.setReadOnly(param.isReadOnly() || param.isRepositoryValueUsed());
    tableEditorModel.setModifiedBeanListenable(tableEditorView.getTableViewerCreator());
    tableEditorModel.addModifiedBeanListenerForAggregateComponent();
    final Table table = tableEditorView.getTable();
    table.setToolTipText(VARIABLE_TOOLTIP + param.getVariableName());
    // add listener to tableMetadata (listen the event of the toolbars)
    tableEditorView.getExtendedTableModel().addAfterOperationListListener(new IListenableListListener() {

        @Override
        public void handleEvent(ListenableListEvent event) {
            if (elem instanceof Node) {
                Node node = (Node) elem;
                node.checkAndRefreshNode();
            }
        }
    });
    final Composite mainComposite = tableEditorView.getMainComposite();
    CLabel labelLabel2 = getWidgetFactory().createCLabel(container, param.getDisplayName());
    FormData formData = new FormData();
    if (lastControlPrm != null) {
        formData.left = new FormAttachment(lastControlPrm, 0);
    } else {
        formData.left = new FormAttachment((((numInRow - 1) * MAX_PERCENT) / nbInRow), 0);
    }
    formData.top = new FormAttachment(0, top);
    labelLabel2.setLayoutData(formData);
    if (numInRow != 1) {
        labelLabel2.setAlignment(SWT.RIGHT);
    }
    // *********************
    formData = new FormData();
    int currentLabelWidth2 = STANDARD_LABEL_WIDTH;
    GC gc2 = new GC(labelLabel2);
    Point labelSize2 = gc2.stringExtent(param.getDisplayName());
    gc2.dispose();
    boolean needOffset = true;
    if ((labelSize2.x + ITabbedPropertyConstants.HSPACE) > currentLabelWidth2) {
        currentLabelWidth2 = labelSize2.x + ITabbedPropertyConstants.HSPACE;
        needOffset = false;
    }
    int tableHorizontalOffset = -5;
    if (numInRow == 1) {
        if (lastControlPrm != null) {
            if (needOffset) {
                formData.left = new FormAttachment(lastControlPrm, currentLabelWidth2 + tableHorizontalOffset);
            } else {
                formData.left = new FormAttachment(lastControlPrm, currentLabelWidth2);
            }
        } else {
            if (needOffset) {
                formData.left = new FormAttachment(0, currentLabelWidth2 + tableHorizontalOffset);
            } else {
                formData.left = new FormAttachment(0, currentLabelWidth2);
            }
        }
    } else {
        formData.left = new FormAttachment(labelLabel2, 0 + tableHorizontalOffset, SWT.RIGHT);
    }
    formData.right = new FormAttachment((numInRow * MAX_PERCENT) / nbInRow, 0);
    formData.top = new FormAttachment(0, top);
    int toolbarSize = 0;
    if (!param.isBasedOnSchema()) {
        Point size = tableEditorView.getExtendedToolbar().getToolbar().computeSize(SWT.DEFAULT, SWT.DEFAULT);
        toolbarSize = size.y + 5;
    }
    int currentHeightEditor = table.getHeaderHeight() + 1 * table.getItemHeight() + table.getItemHeight() + toolbarSize;
    int minHeightEditor = table.getHeaderHeight() + getNumberLines(param) * table.getItemHeight() + table.getItemHeight() + toolbarSize;
    int ySize2 = Math.max(currentHeightEditor, minHeightEditor);
    ySize2 = Math.min(ySize2, 500);
    formData.bottom = new FormAttachment(0, top + ySize2);
    mainComposite.setLayoutData(formData);
    hashCurControls.put(param.getName(), tableEditorView.getExtendedTableViewer().getTableViewerCreator());
    hashCurControls.put(TOOLBAR_NAME, tableEditorView.getToolBar());
    updateTableValues(param);
    this.dynamicProperty.setCurRowSize(ySize2 + ITabbedPropertyConstants.VSPACE);
    top += this.dynamicProperty.getCurRowSize();
    return null;
}
Also used : CLabel(org.eclipse.swt.custom.CLabel) FormData(org.eclipse.swt.layout.FormData) PropertiesTableEditorModel(org.talend.designer.core.ui.editor.properties.macrowidgets.tableeditor.PropertiesTableEditorModel) ListenableListEvent(org.talend.commons.utils.data.list.ListenableListEvent) Table(org.eclipse.swt.widgets.Table) Composite(org.eclipse.swt.widgets.Composite) Node(org.talend.designer.core.ui.editor.nodes.Node) Point(org.eclipse.swt.graphics.Point) IListenableListListener(org.talend.commons.utils.data.list.IListenableListListener) Point(org.eclipse.swt.graphics.Point) PropertiesTableByRowEditorView(org.talend.designer.core.ui.editor.properties.macrowidgets.tableeditor.PropertiesTableByRowEditorView) GC(org.eclipse.swt.graphics.GC) Map(java.util.Map) HashMap(java.util.HashMap) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 59 with FormAttachment

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

the class FooterComposite method createComponents.

/**
     * DOC amaumont Comment method "createComponents".
     */
private void createComponents() {
    FormLayout formLayout = new FormLayout();
    formLayout.spacing = 15;
    this.setLayout(formLayout);
    Button applyButton = new Button(this, SWT.NONE);
    applyButton.setEnabled(!mapperUi.getMapperComponent().isReadOnly());
    //$NON-NLS-1$
    applyButton.setText("Apply");
    FormData applyFormData = new FormData();
    applyFormData.width = 100;
    applyButton.setLayoutData(applyFormData);
    applyButton.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent e) {
        }

        public void widgetSelected(SelectionEvent e) {
            mapperUi.closeMapperDialog(SWT.APPLICATION_MODAL);
        }
    });
    statusBar = new StatusBar(this, SWT.NONE);
    final ProblemsAnalyser problemsAnalyser = mapperUi.getMapperManager().getProblemsAnalyser();
    if (!problemsAnalyser.getProblems().isEmpty()) {
        statusBar.setValues(STATUS.ERROR, problemsAnalyser.getErrorMessage());
    }
    Button okButton = new Button(this, SWT.NONE);
    okButton.setEnabled(!mapperUi.getMapperComponent().isReadOnly());
    //$NON-NLS-1$
    okButton.setText("OK");
    FormData okFormData = new FormData();
    okFormData.width = 100;
    okButton.setLayoutData(okFormData);
    okButton.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent e) {
        }

        public void widgetSelected(SelectionEvent e) {
            mapperUi.closeMapperDialog(SWT.OK);
        }
    });
    Button cancelButton = new Button(this, SWT.NONE);
    //$NON-NLS-1$
    cancelButton.setText("Cancel");
    cancelButton.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent e) {
        }

        public void widgetSelected(SelectionEvent e) {
            mapperUi.closeMapperDialog(SWT.CANCEL);
        }
    });
    FormData cancelFormData = new FormData();
    cancelFormData.width = 100;
    cancelButton.setLayoutData(cancelFormData);
    cancelFormData.right = new FormAttachment(100, -5);
    okFormData.right = new FormAttachment(cancelButton, -5);
    applyFormData.right = new FormAttachment(okButton, -5);
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) ProblemsAnalyser(org.talend.designer.xmlmap.util.problem.ProblemsAnalyser) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FormAttachment(org.eclipse.swt.layout.FormAttachment) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 60 with FormAttachment

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

the class AbstractRepositoryController method addRepositoryChoice.

private Control addRepositoryChoice(Composite subComposite, Control lastControl, int numInRow, int nbInRow, int top, IElementParameter param) {
    FormData data;
    IElementParameter repositoryParameter = param.getChildParameters().get(getRepositoryChoiceParamName());
    Text labelText;
    final DecoratedField dField = new DecoratedField(subComposite, SWT.BORDER, new SelectAllTextControlCreator());
    if (param.isRequired()) {
        FieldDecoration decoration = FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_REQUIRED);
        dField.addFieldDecoration(decoration, SWT.RIGHT | SWT.TOP, false);
    }
    Control cLayout = dField.getLayoutControl();
    labelText = (Text) dField.getControl();
    labelText.setData(PARAMETER_NAME, param.getName());
    cLayout.setBackground(subComposite.getBackground());
    labelText.setEditable(false);
    if (elem instanceof Node) {
        labelText.setToolTipText(VARIABLE_TOOLTIP + param.getVariableName());
    }
    // *********************
    data = new FormData();
    data.left = new FormAttachment(lastControl, 0);
    data.right = new FormAttachment(lastControl, STANDARD_REPOSITORY_WIDTH, SWT.RIGHT);
    // data.right = new FormAttachment((numInRow * MAX_PERCENT) / nbInRow, 0);
    data.top = new FormAttachment(0, top);
    cLayout.setLayoutData(data);
    Button btn;
    Point btnSize;
    //$NON-NLS-1$
    btn = getWidgetFactory().createButton(subComposite, "", SWT.PUSH);
    btnSize = btn.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    btn.setImage(ImageProvider.getImage(CoreUIPlugin.getImageDescriptor(DOTS_BUTTON)));
    btn.addSelectionListener(listenerSelection);
    btn.setData(NAME, REPOSITORY_CHOICE);
    btn.setData(PARAMETER_NAME, param.getName());
    btn.setEnabled(!param.isReadOnly());
    data = new FormData();
    data.left = new FormAttachment(cLayout, 0);
    data.right = new FormAttachment(cLayout, STANDARD_BUTTON_WIDTH, SWT.RIGHT);
    data.top = new FormAttachment(0, top);
    data.height = STANDARD_HEIGHT - 2;
    btn.setLayoutData(data);
    // **********************
    //$NON-NLS-1$
    hashCurControls.put(param.getName() + ":" + repositoryParameter.getName(), labelText);
    return btn;
}
Also used : FormData(org.eclipse.swt.layout.FormData) SelectAllTextControlCreator(org.talend.designer.core.ui.editor.properties.controllers.creator.SelectAllTextControlCreator) Control(org.eclipse.swt.widgets.Control) FieldDecoration(org.eclipse.jface.fieldassist.FieldDecoration) Button(org.eclipse.swt.widgets.Button) Node(org.talend.designer.core.ui.editor.nodes.Node) IElementParameter(org.talend.core.model.process.IElementParameter) Text(org.eclipse.swt.widgets.Text) DecoratedField(org.eclipse.jface.fieldassist.DecoratedField) Point(org.eclipse.swt.graphics.Point) 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