Search in sources :

Example 66 with RowLayout

use of org.eclipse.swt.layout.RowLayout in project azure-tools-for-java by Microsoft.

the class WebAppDeployDialog method createDialogArea.

/**
     * Create contents of the dialog.
     * @param parent
     */
@Override
protected Control createDialogArea(Composite parent) {
    setMessage("Select App Service to deploy to:");
    setTitle("Deploy Web App");
    Composite area = (Composite) super.createDialogArea(parent);
    Composite container = new Composite(area, SWT.NONE);
    container.setLayout(new GridLayout(2, false));
    GridData gd_container = new GridData(GridData.FILL_BOTH);
    gd_container.widthHint = 750;
    container.setLayoutData(gd_container);
    table = new Table(container, SWT.BORDER | SWT.FULL_SELECTION);
    GridData gd_table = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1);
    gd_table.heightHint = 300;
    table.setLayoutData(gd_table);
    table.setHeaderVisible(true);
    table.setLinesVisible(true);
    TableColumn tblclmnName = new TableColumn(table, SWT.LEFT);
    tblclmnName.setWidth(230);
    tblclmnName.setText("Name");
    TableColumn tblclmnJdk = new TableColumn(table, SWT.LEFT);
    tblclmnJdk.setWidth(60);
    tblclmnJdk.setText("JDK");
    TableColumn tblclmnWebContainer = new TableColumn(table, SWT.LEFT);
    tblclmnWebContainer.setWidth(110);
    tblclmnWebContainer.setText("Web container");
    TableColumn tblclmnResourceGroup = new TableColumn(table, SWT.LEFT);
    tblclmnResourceGroup.setWidth(190);
    tblclmnResourceGroup.setText("Resource group");
    Composite composite = new Composite(container, SWT.NONE);
    composite.setLayout(new RowLayout(SWT.VERTICAL));
    composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
    Button btnCreate = new Button(composite, SWT.NONE);
    btnCreate.setLayoutData(new RowData(90, SWT.DEFAULT));
    btnCreate.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            sendTelemetry("CREATE");
            createAppService();
        //cleanError();
        }
    });
    btnCreate.setText("Create...");
    btnDelete = new Button(composite, SWT.NONE);
    btnDelete.setEnabled(false);
    btnDelete.setLayoutData(new RowData(90, SWT.DEFAULT));
    btnDelete.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            sendTelemetry("DELETE");
            deleteAppService();
        //cleanError();
        }
    });
    btnDelete.setText("Delete...");
    Button btnRefresh = new Button(composite, SWT.NONE);
    btnRefresh.setLayoutData(new RowData(90, SWT.DEFAULT));
    btnRefresh.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            sendTelemetry("REFRESH");
            //cleanError();
            table.removeAll();
            //browserAppServiceDetailes.setText("");
            fillAppServiceDetails();
            AzureModel.getInstance().setResourceGroupToWebAppMap(null);
            fillTable();
        }
    });
    btnRefresh.setText("Refresh");
    Group grpAppServiceDetails = new Group(container, SWT.NONE);
    grpAppServiceDetails.setLayout(new FillLayout(SWT.HORIZONTAL));
    GridData gd_grpAppServiceDetails = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
    gd_grpAppServiceDetails.heightHint = 150;
    grpAppServiceDetails.setLayoutData(gd_grpAppServiceDetails);
    grpAppServiceDetails.setText("App service details");
    browserAppServiceDetailes = new Browser(grpAppServiceDetails, SWT.NONE);
    FontData browserFontData = btnRefresh.getFont().getFontData()[0];
    //browserFontStyle = String.format("font-family: '%s';", browserFontData.getHeight(), browserFontData.getName());
    browserFontStyle = String.format("font-family: '%s'; font-size: 9pt;", browserFontData.getName());
    browserAppServiceDetailes.addLocationListener(new LocationListener() {

        public void changing(LocationEvent event) {
            try {
                //System.out.println("LocationEvent.location: " + event.location);
                if (event.location.contains(ftpLinkString)) {
                    event.doit = false;
                    showFtpCreadentialsWindow();
                }
                if (event.location.contains("http")) {
                    event.doit = false;
                    PlatformUI.getWorkbench().getBrowserSupport().getExternalBrowser().openURL(new URL(event.location));
                }
            } catch (Exception ex) {
                ex.printStackTrace();
                LOG.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "changing@LocationListener@browserAppServiceDetailes@AppServiceCreateDialog", ex));
            }
        }

        public void changed(LocationEvent event) {
        }
    });
    new Label(container, SWT.NONE);
    btnDeployToRoot = new Button(container, SWT.CHECK);
    btnDeployToRoot.setText("Deploy to root");
    new Label(container, SWT.NONE);
    table.addListener(SWT.Selection, new Listener() {

        @Override
        public void handleEvent(Event e) {
            fillAppServiceDetails();
        }
    });
    return area;
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.core.runtime.Status) ResourceGroup(com.microsoft.azure.management.resources.ResourceGroup) Group(org.eclipse.swt.widgets.Group) Table(org.eclipse.swt.widgets.Table) Listener(org.eclipse.swt.widgets.Listener) LocationListener(org.eclipse.swt.browser.LocationListener) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) FontData(org.eclipse.swt.graphics.FontData) Label(org.eclipse.swt.widgets.Label) FillLayout(org.eclipse.swt.layout.FillLayout) TableColumn(org.eclipse.swt.widgets.TableColumn) URL(java.net.URL) InvocationTargetException(java.lang.reflect.InvocationTargetException) CanceledByUserException(com.microsoft.azuretools.utils.CanceledByUserException) IOException(java.io.IOException) GridLayout(org.eclipse.swt.layout.GridLayout) RowData(org.eclipse.swt.layout.RowData) Button(org.eclipse.swt.widgets.Button) RowLayout(org.eclipse.swt.layout.RowLayout) LocationListener(org.eclipse.swt.browser.LocationListener) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Event(org.eclipse.swt.widgets.Event) LocationEvent(org.eclipse.swt.browser.LocationEvent) SelectionEvent(org.eclipse.swt.events.SelectionEvent) LocationEvent(org.eclipse.swt.browser.LocationEvent) Browser(org.eclipse.swt.browser.Browser)

Example 67 with RowLayout

use of org.eclipse.swt.layout.RowLayout in project cubrid-manager by CUBRID.

the class UnloadDatabaseDialog method createUnloadTargetInfoGroup.

/**
	 * 
	 * Create unload target information group
	 * 
	 * @param parent the parent composite
	 */
private void createUnloadTargetInfoGroup(Composite parent) {
    Group unloadTargetGroup = new Group(parent, SWT.NONE);
    unloadTargetGroup.setText(Messages.grpUnloadTarget);
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    unloadTargetGroup.setLayoutData(gridData);
    GridLayout layout = new GridLayout();
    layout.numColumns = 4;
    unloadTargetGroup.setLayout(layout);
    Group schemaGroup = new Group(unloadTargetGroup, SWT.NONE);
    schemaGroup.setText(Messages.grpSchema);
    schemaGroup.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 2, 1, -1, -1));
    layout = new GridLayout();
    schemaGroup.setLayout(layout);
    allSchemaButton = new Button(schemaGroup, SWT.RADIO | SWT.LEFT);
    allSchemaButton.setText(Messages.btnAll);
    allSchemaButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            if (allSchemaButton.getSelection()) {
                for (int i = 0, n = schemaTable.getItemCount(); i < n; i++) {
                    schemaTable.getItem(i).setChecked(true);
                }
                includeRefButton.setEnabled(false);
            } else {
                for (int i = 0, n = schemaTable.getItemCount(); i < n; i++) {
                    schemaTable.getItem(i).setChecked(false);
                }
            }
            valid();
        }
    });
    selectedSchemaButton = new Button(schemaGroup, SWT.RADIO | SWT.LEFT);
    selectedSchemaButton.setText(Messages.btnSelectedTables);
    selectedSchemaButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            valid();
            includeRefButton.setEnabled(selectedSchemaButton.getSelection());
        }
    });
    noSchemaButton = new Button(schemaGroup, SWT.RADIO | SWT.LEFT);
    noSchemaButton.setText(Messages.btnNotInclude);
    noSchemaButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            valid();
            includeRefButton.setEnabled(false);
        }
    });
    Group dataGroup = new Group(unloadTargetGroup, SWT.NONE);
    dataGroup.setText(Messages.grpData);
    dataGroup.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 2, 1, -1, -1));
    layout = new GridLayout();
    dataGroup.setLayout(layout);
    selectedDataButton = new Button(dataGroup, SWT.RADIO | SWT.LEFT);
    selectedDataButton.setText(Messages.btnSelectedTables);
    selectedDataButton.setSelection(true);
    selectedDataButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            valid();
        }
    });
    noDataButton = new Button(dataGroup, SWT.RADIO | SWT.LEFT);
    noDataButton.setText(Messages.btnNotInclude);
    noDataButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            valid();
        }
    });
    schemaTable = new Table(unloadTargetGroup, SWT.CHECK | SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.FULL_SELECTION);
    schemaTable.setLinesVisible(false);
    schemaTable.setHeaderVisible(false);
    schemaTable.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 4, 1, -1, 100));
    schemaTable.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            valid();
        }
    });
    if (this.allUserClassList != null) {
        for (int i = 0; i < allUserClassList.size(); i++) {
            TableItem item = new TableItem(schemaTable, SWT.MULTI);
            item.setText(allUserClassList.get(i));
        }
    }
    Composite composite = new Composite(unloadTargetGroup, SWT.NONE);
    RowLayout rowLayout = new RowLayout();
    rowLayout.spacing = 5;
    composite.setLayout(rowLayout);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 4;
    gridData.horizontalAlignment = GridData.END;
    composite.setLayoutData(gridData);
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) Table(org.eclipse.swt.widgets.Table) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) TableItem(org.eclipse.swt.widgets.TableItem) RowLayout(org.eclipse.swt.layout.RowLayout) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent)

Example 68 with RowLayout

use of org.eclipse.swt.layout.RowLayout in project cubrid-manager by CUBRID.

the class AddHADatabaseDialog method createDialogArea.

/**
	 * Create dialog area content
	 * 
	 * @param parent the parent composite
	 * @return the control
	 */
protected Control createDialogArea(Composite parent) {
    Composite parentComp = (Composite) super.createDialogArea(parent);
    Composite composite = new Composite(parentComp, SWT.NONE);
    {
        GridLayout compLayout = new GridLayout();
        compLayout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
        compLayout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
        compLayout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
        compLayout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
        composite.setLayout(compLayout);
        composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    }
    Group cmServerInfoGroup = new Group(composite, SWT.NONE);
    cmServerInfoGroup.setText(Messages.grpHostInfo);
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    cmServerInfoGroup.setLayoutData(gridData);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    cmServerInfoGroup.setLayout(layout);
    Label ipLabel = new Label(cmServerInfoGroup, SWT.LEFT);
    ipLabel.setText(Messages.lblIPAddress);
    ipLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    ipCombo = new Combo(cmServerInfoGroup, SWT.LEFT | SWT.BORDER | SWT.READ_ONLY);
    ipCombo.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
    Label portNameLabel = new Label(cmServerInfoGroup, SWT.LEFT);
    portNameLabel.setText(Messages.lblPort);
    portNameLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    portText = new Text(cmServerInfoGroup, SWT.LEFT | SWT.BORDER);
    portText.setTextLimit(5);
    portText.setText("8001");
    portText.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
    portText.addFocusListener(new FocusAdapter() {

        public void focusGained(FocusEvent event) {
            portText.selectAll();
            portText.setFocus();
        }
    });
    Label userNameLabel = new Label(cmServerInfoGroup, SWT.LEFT);
    userNameLabel.setText(Messages.lblUserName);
    userNameLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    userNameText = new Text(cmServerInfoGroup, SWT.LEFT | SWT.BORDER);
    userNameText.setText("admin");
    userNameText.setEnabled(false);
    userNameText.setTextLimit(ValidateUtil.MAX_NAME_LENGTH);
    userNameText.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
    Label passwordLabel = new Label(cmServerInfoGroup, SWT.LEFT);
    passwordLabel.setText(Messages.lblPassword);
    passwordLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    passwordText = new Text(cmServerInfoGroup, SWT.LEFT | SWT.PASSWORD | SWT.BORDER);
    passwordText.setTextLimit(ValidateUtil.MAX_NAME_LENGTH);
    passwordText.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
    passwordText.addFocusListener(new FocusAdapter() {

        public void focusGained(FocusEvent event) {
            passwordText.selectAll();
            passwordText.setFocus();
        }
    });
    Label dbNameLabel = new Label(cmServerInfoGroup, SWT.LEFT);
    dbNameLabel.setText(Messages.lblDbName);
    dbNameLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    dbNameText = new Text(cmServerInfoGroup, SWT.LEFT | SWT.BORDER | SWT.READ_ONLY);
    dbNameText.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, 100, -1));
    Label dbaPasswordLabel = new Label(cmServerInfoGroup, SWT.LEFT);
    dbaPasswordLabel.setText(Messages.lblDbaPassword);
    dbaPasswordLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    dbaPasswordText = new Text(cmServerInfoGroup, SWT.LEFT | SWT.BORDER | SWT.PASSWORD);
    dbaPasswordText.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, 100, -1));
    Composite btnComposite = new Composite(composite, SWT.NONE);
    RowLayout rowLayout = new RowLayout();
    rowLayout.spacing = 5;
    btnComposite.setLayout(rowLayout);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalAlignment = GridData.END;
    btnComposite.setLayoutData(gridData);
    addDatabaseButton = new Button(btnComposite, SWT.NONE);
    addDatabaseButton.setText(Messages.btnAddDb);
    addDatabaseButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            //check this database whether already be added
            String dbName = dbNameText.getText();
            if (isDbExist()) {
                setErrorMessage(Messages.bind(Messages.errDbExist, dbName));
                return;
            }
            //connect server
            String address = ipCombo.getText();
            String port = portText.getText();
            String userName = userNameText.getText();
            String password = passwordText.getText();
            ServerInfo serverInfo = ServerManager.getInstance().getServer(address, Integer.parseInt(port), userName);
            if (serverInfo == null) {
                serverInfo = new ServerInfo();
                serverInfo.setServerName(address);
                serverInfo.setHostAddress(address);
                serverInfo.setHostMonPort(Integer.parseInt(port));
                serverInfo.setHostJSPort(Integer.parseInt(port) + 1);
                serverInfo.setUserName(userName);
                serverInfo.setUserPassword(password);
                serverInfo.setJdbcDriverVersion(ServerJdbcVersionMapping.JDBC_SELF_ADAPTING_VERSION);
            }
            String dbaPassword = dbaPasswordText.getText();
            TaskExecutor executor = null;
            VerifyDbUserPasswordTask verifyDbUserPasswordTask = new VerifyDbUserPasswordTask(serverInfo);
            verifyDbUserPasswordTask.setDbName(dbName);
            verifyDbUserPasswordTask.setDbUser("dba");
            verifyDbUserPasswordTask.setDbPassword(dbaPassword);
            if (serverInfo.isConnected()) {
                DatabaseInfo dbInfo = serverInfo.getLoginedUserInfo().getDatabaseInfo(dbName);
                if (dbInfo == null) {
                    setErrorMessage(Messages.errDbNoExist);
                    return;
                }
                executor = new CommonTaskExec(null);
                if (dbInfo.isLogined() && dbInfo.getAuthLoginedDbUserInfo().getName().equalsIgnoreCase("dba")) {
                    String pwd = dbInfo.getAuthLoginedDbUserInfo().getNoEncryptPassword();
                    if (!dbaPassword.equals(pwd)) {
                        CommonUITool.openErrorBox(Messages.errDbaPassowrd);
                        dbaPasswordText.selectAll();
                        dbaPasswordText.setFocus();
                        return;
                    }
                } else {
                    executor.addTask(verifyDbUserPasswordTask);
                }
            } else {
                executor = new ConnectHostExecutor(getShell(), serverInfo, true);
                executor.addTask(verifyDbUserPasswordTask);
            }
            //get this database status
            HAHostStatusInfo haHostStatusInfo = null;
            HADatabaseStatusInfo haDbStatusInfo = null;
            GetDbModeTask getDbModeTask = new GetDbModeTask(serverInfo);
            List<String> dbList = new ArrayList<String>();
            dbList.add(dbNameText.getText());
            getDbModeTask.setDbList(dbList);
            executor.addTask(getDbModeTask);
            new ExecTaskWithProgress(executor).exec(true, true);
            if (!executor.isSuccess()) {
                if (verifyDbUserPasswordTask != null && verifyDbUserPasswordTask.getErrorMsg() != null && verifyDbUserPasswordTask.getErrorMsg().length() > 0) {
                    dbaPasswordText.selectAll();
                    dbaPasswordText.setFocus();
                }
                return;
            }
            if (getDbModeTask.getDbModes() != null && getDbModeTask.getDbModes().size() > 0) {
                List<HADatabaseStatusInfo> dbModeList = getDbModeTask.getDbModes();
                haDbStatusInfo = dbModeList.get(0);
                haHostStatusInfo = getHAHostStatusInfo(serverInfo.getHostAddress());
                if (haHostStatusInfo != null) {
                    haDbStatusInfo.setHaHostStatusInfo(haHostStatusInfo);
                    haHostStatusInfo.addHADatabaseStatus(haDbStatusInfo);
                }
            }
            if (haDbStatusInfo == null) {
                haDbStatusInfo = HAUtil.getHADatabaseStatusInfo(dbNameText.getText(), haHostStatusInfo, serverInfo);
            }
            if (haHostStatusInfo == null) {
                haHostStatusInfo = HAUtil.getHAHostStatusInfo(serverInfo);
                haHostStatusInfo.addHADatabaseStatus(haDbStatusInfo);
                haDbStatusInfo.setHaHostStatusInfo(haHostStatusInfo);
            }
            DatabaseNode dbNode = new DatabaseNode();
            dbNode.setDbName(dbNameText.getText());
            dbNode.setDbUser("dba");
            dbNode.setDbPassword(dbaPassword);
            dbNode.setName(dbNameText.getText());
            dbNode.setConnected(true);
            dbNode.setHaDatabaseStatus(haDbStatusInfo);
            HostNode hostNode = new HostNode();
            hostNode.setName(ipCombo.getText() + ":" + portText.getText());
            hostNode.setIp(ipCombo.getText());
            hostNode.setPort(portText.getText());
            hostNode.setUserName(userNameText.getText());
            hostNode.setPassword(passwordText.getText());
            hostNode.setHostStatusInfo(haHostStatusInfo);
            hostNode.setConnected(true);
            dbNode.setParent(hostNode);
            Map<String, Object> map = new HashMap<String, Object>();
            map.put("0", dbNode.getDbName());
            map.put("1", DBStatusType.getShowText(dbNode.getDbStatusType()));
            map.put("2", dbNode.getParent().getIp());
            map.put("3", dbNode.getParent().getPort());
            map.put("4", HostStatusType.getShowText(haHostStatusInfo.getStatusType()));
            map.put("5", dbNode);
            if (dbNode.getDbStatusType() == DBStatusType.ACTIVE || dbNode.getDbStatusType() == DBStatusType.TO_BE_ACTIVE) {
                dbNodeList.add(0, map);
            } else {
                dbNodeList.add(map);
            }
            dbTableViewer.refresh();
            for (int i = 0; i < dbTable.getColumnCount(); i++) {
                dbTable.getColumn(i).pack();
            }
            verify();
        }
    });
    addDatabaseButton.setEnabled(false);
    createTable(composite);
    setTitle(Messages.titleAddHADbDialog);
    initial();
    return parentComp;
}
Also used : Group(org.eclipse.swt.widgets.Group) FocusAdapter(org.eclipse.swt.events.FocusAdapter) DatabaseInfo(com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) HostNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode) Label(org.eclipse.swt.widgets.Label) Combo(org.eclipse.swt.widgets.Combo) FocusEvent(org.eclipse.swt.events.FocusEvent) GetDbModeTask(com.cubrid.cubridmanager.core.mondashboard.task.GetDbModeTask) HAHostStatusInfo(com.cubrid.cubridmanager.core.mondashboard.model.HAHostStatusInfo) GridLayout(org.eclipse.swt.layout.GridLayout) DatabaseNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.DatabaseNode) Button(org.eclipse.swt.widgets.Button) RowLayout(org.eclipse.swt.layout.RowLayout) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ExecTaskWithProgress(com.cubrid.common.ui.spi.progress.ExecTaskWithProgress) ArrayList(java.util.ArrayList) List(java.util.List) VerifyDbUserPasswordTask(com.cubrid.cubridmanager.core.mondashboard.task.VerifyDbUserPasswordTask) CommonTaskExec(com.cubrid.common.ui.spi.progress.CommonTaskExec) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Text(org.eclipse.swt.widgets.Text) TaskExecutor(com.cubrid.common.ui.spi.progress.TaskExecutor) GridData(org.eclipse.swt.layout.GridData) ConnectHostExecutor(com.cubrid.cubridmanager.ui.host.dialog.ConnectHostExecutor) HADatabaseStatusInfo(com.cubrid.cubridmanager.core.mondashboard.model.HADatabaseStatusInfo) HashMap(java.util.HashMap) Map(java.util.Map)

Example 69 with RowLayout

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

the class BlankProjectSettingPage method createContents.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
     */
@Override
protected Control createContents(Composite parent) {
    Composite com = new Composite(parent, 0);
    com.setLayout(new RowLayout());
    return com;
}
Also used : Composite(org.eclipse.swt.widgets.Composite) RowLayout(org.eclipse.swt.layout.RowLayout)

Example 70 with RowLayout

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

the class TabFolderEditors method createComponents.

/**
     * DOC amaumont Comment method "createComponents".
     */
private void createComponents() {
    setSimple(false);
    // TableEditorCompositeBase metaDatasDescriptorView3 = new TableEditorCompositeBase(tabFolder1);
    // item.setControl(metaDatasDescriptorView3);
    CTabItem item = new CTabItem(tabFolderEditors, SWT.BORDER);
    //$NON-NLS-1$
    item.setText(Messages.getString("TabFolderEditors.SchemaEditor.Title"));
    SashForm inOutMetaEditorContainer = new SashForm(tabFolderEditors, SWT.SMOOTH | SWT.HORIZONTAL | SWT.SHADOW_OUT);
    inOutMetaEditorContainer.setLayout(new RowLayout(SWT.HORIZONTAL));
    item.setControl(inOutMetaEditorContainer);
    // input metadata table view
    inputMetaEditor = new XmlMapMetadataTableEditorView(inOutMetaEditorContainer, SWT.BORDER);
    inputMetaEditor.initGraphicComponents();
    // inputMetaEditor.getExtendedTableViewer().setCommandStack(commandStack);
    ILineSelectionListener metadataEditorViewerSelectionChangedListener = new ILineSelectionListener() {

        @Override
        public void handle(LineSelectionEvent e) {
            if (inputMetaEditor.getTableViewerCreator() == e.source && mapperManage.getGraphicalViewer() != null) {
                if (inputMetaEditor.getExtendedTableViewer().isExecuteSelectionEvent()) {
                    mapperManage.selectLinkedInputTableEntries(inputMetaEditor.getTableViewerCreator().getTable().getSelectionIndices(), false);
                }
            }
        }
    };
    inputMetaEditor.getTableViewerCreator().getSelectionHelper().addAfterSelectionListener(metadataEditorViewerSelectionChangedListener);
    addListenersToInputButtons();
    // output metadata table view
    outputMetaEditor = new XmlMapMetadataTableEditorView(inOutMetaEditorContainer, SWT.BORDER);
    outputMetaEditor.initGraphicComponents();
    // outputMetaEditor.getExtendedTableViewer().setCommandStack(commandStack);
    metadataEditorViewerSelectionChangedListener = new ILineSelectionListener() {

        @Override
        public void handle(LineSelectionEvent e) {
            if (outputMetaEditor.getTableViewerCreator() == e.source && mapperManage.getGraphicalViewer() != null) {
                if (outputMetaEditor.getExtendedTableViewer().isExecuteSelectionEvent()) {
                    mapperManage.selectLinkedOutputTableEntries(outputMetaEditor.getTableViewerCreator().getTable().getSelectionIndices(), false);
                }
            }
        }
    };
    outputMetaEditor.getTableViewerCreator().getSelectionHelper().addAfterSelectionListener(metadataEditorViewerSelectionChangedListener);
    addListenersToOutputButtons();
    item = new CTabItem(tabFolderEditors, SWT.BORDER);
    //$NON-NLS-1$
    item.setText(Messages.getString("TabFolderEditors.TreeSchemaEditor.Title"));
    SashForm xmlTreeEditorContainer = new SashForm(tabFolderEditors, SWT.SMOOTH | SWT.HORIZONTAL | SWT.SHADOW_OUT);
    xmlTreeEditorContainer.setLayout(new RowLayout(SWT.HORIZONTAL));
    item.setControl(xmlTreeEditorContainer);
    // input tree schema table view
    inputTreeSchemaEditor = new XmlTreeSchemaTableView(xmlTreeEditorContainer, SWT.BORDER);
    inputTreeSchemaEditor.initGraphicComponents();
    metadataEditorViewerSelectionChangedListener = new ILineSelectionListener() {

        @Override
        public void handle(LineSelectionEvent e) {
            if (inputTreeSchemaEditor.getTableViewerCreator() == e.source && mapperManage.getGraphicalViewer() != null) {
                if (inputTreeSchemaEditor.getExtendedTableViewer().isExecuteSelectionEvent()) {
                    mapperManage.selectLinkedInputTableEntries(inputTreeSchemaEditor.getTableViewerCreator().getTable().getSelectionIndices(), true);
                }
            }
        }
    };
    inputTreeSchemaEditor.getTableViewerCreator().getSelectionHelper().addAfterSelectionListener(metadataEditorViewerSelectionChangedListener);
    // output tree schema table view
    outputTreeSchemaEditor = new OutputXmlTreeSchemaTableView(xmlTreeEditorContainer, SWT.BORDER);
    outputTreeSchemaEditor.initGraphicComponents();
    metadataEditorViewerSelectionChangedListener = new ILineSelectionListener() {

        @Override
        public void handle(LineSelectionEvent e) {
            if (outputTreeSchemaEditor.getTableViewerCreator() == e.source && mapperManage.getGraphicalViewer() != null) {
                if (outputTreeSchemaEditor.getExtendedTableViewer().isExecuteSelectionEvent()) {
                    mapperManage.selectLinkedOutputTableEntries(outputTreeSchemaEditor.getTableViewerCreator().getTable().getSelectionIndices(), true);
                }
            }
        }
    };
    outputTreeSchemaEditor.getTableViewerCreator().getSelectionHelper().addAfterSelectionListener(metadataEditorViewerSelectionChangedListener);
    item = new CTabItem(tabFolderEditors, SWT.BORDER);
    //$NON-NLS-1$
    item.setText(Messages.getString("TabFolderEditors.ExpressionEditor.Title"));
    StyledText styledText = createStyledText(item);
    this.styledTextHandler = new StyledTextHandler(styledText, mapperManage);
    tabFolderEditors.addListener(SWT.Selection, new Listener() {

        @Override
        public void handleEvent(Event event) {
            mapperManage.fireCurrentDirectEditApply();
            // TDI-18185
            if (styledTextHandler.getSelectedNode() != null && XmlMapUtil.DOCUMENT.equals(styledTextHandler.getSelectedNode().getType())) {
                styledTextHandler.setTextWithoutNotifyListeners("");
                styledTextHandler.getStyledText().setEnabled(false);
                styledTextHandler.getStyledText().setEditable(false);
                styledTextHandler.getStyledText().setText("");
            }
            lastSelectedTab = tabFolderEditors.getSelectionIndex();
        }
    });
    tabFolderEditors.setSelection(0);
}
Also used : StyledText(org.eclipse.swt.custom.StyledText) UnnotifiableColorStyledText(org.talend.commons.ui.swt.colorstyledtext.UnnotifiableColorStyledText) DisposeListener(org.eclipse.swt.events.DisposeListener) IExtendedButtonListener(org.talend.commons.ui.swt.extended.table.IExtendedButtonListener) Listener(org.eclipse.swt.widgets.Listener) ILineSelectionListener(org.talend.commons.ui.runtime.swt.tableviewer.selection.ILineSelectionListener) ILineSelectionListener(org.talend.commons.ui.runtime.swt.tableviewer.selection.ILineSelectionListener) CTabItem(org.eclipse.swt.custom.CTabItem) SashForm(org.eclipse.swt.custom.SashForm) LineSelectionEvent(org.talend.commons.ui.runtime.swt.tableviewer.selection.LineSelectionEvent) OutputXmlTreeSchemaTableView(org.talend.designer.xmlmap.ui.tabs.table.OutputXmlTreeSchemaTableView) XmlTreeSchemaTableView(org.talend.designer.xmlmap.ui.tabs.table.XmlTreeSchemaTableView) RowLayout(org.eclipse.swt.layout.RowLayout) DisposeEvent(org.eclipse.swt.events.DisposeEvent) Event(org.eclipse.swt.widgets.Event) ExtendedButtonEvent(org.talend.commons.ui.swt.extended.table.ExtendedButtonEvent) LineSelectionEvent(org.talend.commons.ui.runtime.swt.tableviewer.selection.LineSelectionEvent) XmlMapMetadataTableEditorView(org.talend.designer.xmlmap.ui.tabs.table.XmlMapMetadataTableEditorView) OutputXmlTreeSchemaTableView(org.talend.designer.xmlmap.ui.tabs.table.OutputXmlTreeSchemaTableView)

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