Search in sources :

Example 31 with SelectionListener

use of org.eclipse.swt.events.SelectionListener in project GT by Tencent.

the class DevicesView method createSubTitle.

/**
	 * 
	 * @param parent
	 */
private void createSubTitle(Composite parent) {
    FormData pkgNameLabelFromData = new FormData();
    pkgNameLabelFromData.top = new FormAttachment(0, 5);
    pkgNameLabelFromData.left = new FormAttachment(0, 5);
    pkgNameLabelFromData.right = new FormAttachment(100, -50);
    // 绝对位置
    pkgNameLabelFromData.bottom = new FormAttachment(parent, 30);
    pkgNameText = new Text(parent, SWT.BORDER);
    pkgNameText.setToolTipText("在这里可以手动输入要进行测试的进程名");
    pkgNameText.setBackground(new Color(Display.getCurrent(), 192, 192, 192));
    pkgNameText.setLayoutData(pkgNameLabelFromData);
    FormData addBtnFromData = new FormData();
    addBtnFromData.top = new FormAttachment(0, 5);
    addBtnFromData.left = new FormAttachment(pkgNameText, 5);
    addBtnFromData.right = new FormAttachment(100, -5);
    // 绝对位置
    addBtnFromData.bottom = new FormAttachment(parent, 30);
    addBtn = new Button(parent, SWT.NONE);
    addBtn.setText("添加");
    addBtn.setLayoutData(addBtnFromData);
    addBtn.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (isSupportAddOrDeleteOper) {
                APTState.getInstance().DealWithEventBefore(APTEventEnum.CONFIGRURE_OPER);
                String text = pkgNameText.getText().trim();
                if (text.equals("")) {
                    APTConsoleFactory.getInstance().APTPrint("请输入合法的包名");
                    return;
                }
                PkgInfo dataItem = new PkgInfo();
                dataItem.contents[PkgInfo.NAME_INDEX] = text;
                dataItem.contents[PkgInfo.PID_INDEX] = Constant.PID_NOT_EXSIT;
                addDataItem(targetPkgTableViewer, dataItem);
                APTState.getInstance().DealWithEventAfter(APTEventEnum.CONFIGRURE_OPER);
            } else {
                APTConsoleFactory.getInstance().APTPrint("Operation forbid");
            }
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
}
Also used : FormData(org.eclipse.swt.layout.FormData) Button(org.eclipse.swt.widgets.Button) Color(org.eclipse.swt.graphics.Color) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Text(org.eclipse.swt.widgets.Text) PkgInfo(com.tencent.wstt.apt.data.PkgInfo) FormAttachment(org.eclipse.swt.layout.FormAttachment) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 32 with SelectionListener

use of org.eclipse.swt.events.SelectionListener in project GT by Tencent.

the class SettingView method createSettingTabItem.

private void createSettingTabItem(TabFolder parent) {
    // 创建CPU标签页
    TabItem settingTabItem = new TabItem(parent, SWT.NONE);
    settingTabItem.setText("首选项");
    //CPU标签根容器
    Composite settingTabRoot = new Composite(parent, SWT.NONE);
    settingTabRoot.setLayout(new FormLayout());
    FormData monitorItemGroupFormData = new FormData();
    monitorItemGroupFormData.left = new FormAttachment(0, Constant.MARGIN_WIDTH);
    monitorItemGroupFormData.right = new FormAttachment(100, -Constant.MARGIN_WIDTH);
    monitorItemGroupFormData.top = new FormAttachment(settingTabRoot, Constant.MARGIN_WIDTH_NARROW);
    Group monitorGroup = new Group(settingTabRoot, SWT.NONE);
    monitorGroup.setText("监测项");
    monitorGroup.setLayoutData(monitorItemGroupFormData);
    monitorGroup.setLayout(new FormLayout());
    FormData cpuGroupFormData = new FormData();
    cpuGroupFormData.left = new FormAttachment(0, Constant.MARGIN_WIDTH);
    cpuGroupFormData.right = new FormAttachment(100, -Constant.MARGIN_WIDTH);
    cpuGroupFormData.top = new FormAttachment(monitorGroup, Constant.MARGIN_WIDTH_NARROW);
    Group cpuGroup = new Group(monitorGroup, SWT.NONE);
    cpuGroup.setLayoutData(cpuGroupFormData);
    cpuGroup.setLayout(new GridLayout(3, true));
    Label cpuLabel = new Label(cpuGroup, SWT.NONE);
    cpuLabel.setText("CPU");
    itemTestSwitch[Constant.CPU_INDEX] = new Button(cpuGroup, SWT.RADIO);
    itemTestSwitch[Constant.CPU_INDEX].setText("开");
    itemTestSwitch[Constant.CPU_INDEX].setSelection(false);
    itemTestSwitch[Constant.CPU_INDEX].addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            APTState.getInstance().DealWithEventBefore(APTEventEnum.CONFIGRURE_OPER);
            APTState.getInstance().DealWithEventAfter(APTEventEnum.CONFIGRURE_OPER);
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        // TODO Auto-generated method stub
        }
    });
    itemTestSwitchClose[Constant.CPU_INDEX] = new Button(cpuGroup, SWT.RADIO);
    itemTestSwitchClose[Constant.CPU_INDEX].setText("关");
    itemTestSwitchClose[Constant.CPU_INDEX].setSelection(true);
    FormData memGroupFormData = new FormData();
    memGroupFormData.left = new FormAttachment(0, Constant.MARGIN_WIDTH);
    memGroupFormData.right = new FormAttachment(100, -Constant.MARGIN_WIDTH);
    memGroupFormData.top = new FormAttachment(cpuGroup, Constant.MARGIN_WIDTH_NARROW);
    memGroupFormData.bottom = new FormAttachment(100, -Constant.MARGIN_WIDTH);
    Group memGroup = new Group(monitorGroup, SWT.NONE);
    memGroup.setLayoutData(memGroupFormData);
    memGroup.setLayout(new GridLayout(3, true));
    Label memLabel = new Label(memGroup, SWT.NONE);
    memLabel.setText("内存");
    itemTestSwitch[Constant.MEM_INDEX] = new Button(memGroup, SWT.RADIO);
    itemTestSwitch[Constant.MEM_INDEX].setText("开");
    itemTestSwitch[Constant.MEM_INDEX].setSelection(false);
    itemTestSwitch[Constant.MEM_INDEX].addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            APTState.getInstance().DealWithEventBefore(APTEventEnum.CONFIGRURE_OPER);
            APTState.getInstance().DealWithEventAfter(APTEventEnum.CONFIGRURE_OPER);
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        // TODO Auto-generated method stub
        }
    });
    itemTestSwitchClose[Constant.MEM_INDEX] = new Button(memGroup, SWT.RADIO);
    itemTestSwitchClose[Constant.MEM_INDEX].setText("关");
    itemTestSwitchClose[Constant.MEM_INDEX].setSelection(true);
    settingTabItem.setControl(settingTabRoot);
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) TabItem(org.eclipse.swt.widgets.TabItem) Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) Label(org.eclipse.swt.widgets.Label) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FormAttachment(org.eclipse.swt.layout.FormAttachment) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 33 with SelectionListener

use of org.eclipse.swt.events.SelectionListener in project GT by Tencent.

the class SettingView method createMemTabItem.

/**
	 * 为了迎合兰姐的界面,要求改的好丑啊
	 * @param parent
	 */
private void createMemTabItem(TabFolder parent) {
    TabItem memTabItem = new TabItem(parent, SWT.NONE);
    memTabItem.setText("内存");
    Composite memTabRoot = new Composite(parent, SWT.NONE);
    memTabRoot.setLayout(new FormLayout());
    FormData testPeriodGroupFormData = new FormData();
    testPeriodGroupFormData.left = new FormAttachment(0, Constant.MARGIN_WIDTH);
    testPeriodGroupFormData.right = new FormAttachment(100, -Constant.MARGIN_WIDTH);
    testPeriodGroupFormData.top = new FormAttachment(memTabRoot, Constant.MARGIN_WIDTH_NARROW);
    Group periodGroup = new Group(memTabRoot, SWT.NONE);
    periodGroup.setLayoutData(testPeriodGroupFormData);
    periodGroup.setLayout(new FillLayout(SWT.HORIZONTAL));
    Label memLabel = new Label(periodGroup, SWT.NONE);
    memLabel.setText("采样间隔(ms)");
    itemTestPeriod[Constant.MEM_INDEX] = new Text(periodGroup, SWT.BORDER);
    itemTestPeriod[Constant.MEM_INDEX].setText("3000");
    itemTestPeriod[Constant.MEM_INDEX].addVerifyListener(new SWTNumberVerifyListener());
    itemTestPeriod[Constant.MEM_INDEX].addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            APTState.getInstance().DealWithEventBefore(APTEventEnum.CONFIGRURE_OPER);
            APTState.getInstance().DealWithEventAfter(APTEventEnum.CONFIGRURE_OPER);
        }
    });
    FormData hprofDumpSwitchGroupFormData = new FormData();
    hprofDumpSwitchGroupFormData.left = new FormAttachment(0, Constant.MARGIN_WIDTH);
    hprofDumpSwitchGroupFormData.right = new FormAttachment(100, -Constant.MARGIN_WIDTH);
    hprofDumpSwitchGroupFormData.top = new FormAttachment(periodGroup, Constant.MARGIN_WIDTH_NARROW);
    Group hprofDumpSwitchGroup = new Group(memTabRoot, SWT.NONE);
    hprofDumpSwitchGroup.setLayoutData(hprofDumpSwitchGroupFormData);
    hprofDumpSwitchGroup.setLayout(new FillLayout(SWT.HORIZONTAL));
    Label hprofDumpLabel = new Label(hprofDumpSwitchGroup, SWT.NONE);
    hprofDumpLabel.setText("Dump Hprof");
    hprofDumpSwitch = new Combo(hprofDumpSwitchGroup, SWT.DROP_DOWN | SWT.READ_ONLY);
    hprofDumpSwitch.setItems(new String[] { "否", "是" });
    hprofDumpSwitch.select(0);
    hprofDumpSwitch.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
        //				APTState.getInstance().DealWithEventBefore(APTEventEnum.CONFIGRURE_OPER);
        //				APTState.getInstance().DealWithEventAfter(APTEventEnum.CONFIGRURE_OPER);
        }
    });
    FormData hprofDumpThresholdGroupFormData = new FormData();
    hprofDumpThresholdGroupFormData.left = new FormAttachment(0, Constant.MARGIN_WIDTH);
    hprofDumpThresholdGroupFormData.right = new FormAttachment(100, -Constant.MARGIN_WIDTH);
    hprofDumpThresholdGroupFormData.top = new FormAttachment(hprofDumpSwitchGroup, Constant.MARGIN_WIDTH_NARROW);
    Group hrpofDumpThresholdGroup = new Group(memTabRoot, SWT.NONE);
    hrpofDumpThresholdGroup.setLayoutData(hprofDumpThresholdGroupFormData);
    hrpofDumpThresholdGroup.setLayout(new FillLayout(SWT.HORIZONTAL));
    Label hprofDumpThresholdLabel = new Label(hrpofDumpThresholdGroup, SWT.NONE);
    hprofDumpThresholdLabel.setText("Dump阈值(kB)");
    hprofDumpThreshold = new Text(hrpofDumpThresholdGroup, SWT.BORDER);
    hprofDumpThreshold.setText("30000");
    hprofDumpThreshold.addVerifyListener(new SWTNumberVerifyListener());
    hprofDumpThreshold.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            APTState.getInstance().DealWithEventBefore(APTEventEnum.CONFIGRURE_OPER);
            APTState.getInstance().DealWithEventAfter(APTEventEnum.CONFIGRURE_OPER);
        }
    });
    //Priv Dirty Group
    FormData privGroupFormData = new FormData();
    privGroupFormData.left = new FormAttachment(0, Constant.MARGIN_WIDTH);
    privGroupFormData.right = new FormAttachment(100, -Constant.MARGIN_WIDTH);
    privGroupFormData.top = new FormAttachment(hrpofDumpThresholdGroup, Constant.MARGIN_WIDTH_NARROW);
    Group privGroup = new Group(memTabRoot, SWT.NONE);
    privGroup.setText("Priv Dirty");
    privGroup.setLayoutData(privGroupFormData);
    privGroup.setLayout(new GridLayout(3, true));
    //PSS Group
    FormData pssGroupFormData = new FormData();
    pssGroupFormData.left = new FormAttachment(0, Constant.MARGIN_WIDTH);
    pssGroupFormData.right = new FormAttachment(100, -Constant.MARGIN_WIDTH);
    pssGroupFormData.top = new FormAttachment(privGroup, Constant.MARGIN_WIDTH_NARROW);
    Group pssGroup = new Group(memTabRoot, SWT.NONE);
    pssGroup.setText("PSS");
    pssGroup.setLayoutData(pssGroupFormData);
    pssGroup.setLayout(new GridLayout(3, true));
    //Heap Allocated Group
    FormData heapGroupFormData = new FormData();
    heapGroupFormData.left = new FormAttachment(0, Constant.MARGIN_WIDTH);
    heapGroupFormData.right = new FormAttachment(100, -Constant.MARGIN_WIDTH);
    heapGroupFormData.top = new FormAttachment(pssGroup, Constant.MARGIN_WIDTH_NARROW);
    Group heapGroup = new Group(memTabRoot, SWT.NONE);
    heapGroup.setText("Heap Allocated");
    heapGroup.setLayoutData(heapGroupFormData);
    heapGroup.setLayout(new GridLayout(3, true));
    //Heap Size Group
    FormData heapsizeGroupFormData = new FormData();
    heapsizeGroupFormData.left = new FormAttachment(0, Constant.MARGIN_WIDTH);
    heapsizeGroupFormData.right = new FormAttachment(100, -Constant.MARGIN_WIDTH);
    heapsizeGroupFormData.top = new FormAttachment(heapGroup, Constant.MARGIN_WIDTH_NARROW);
    Group heapsizeGroup = new Group(memTabRoot, SWT.NONE);
    heapsizeGroup.setText("Heap Size");
    heapsizeGroup.setLayoutData(heapsizeGroupFormData);
    heapsizeGroup.setLayout(new GridLayout(3, true));
    memStatCheckBtns = new Button[Constant.ALL_MEM_KIND_COUNT];
    for (int i = 0; i < Constant.ALL_MEM_KIND_COUNT; i++) {
        Group group = null;
        if (i < 3) {
            group = privGroup;
        } else if (i < 6) {
            group = pssGroup;
        } else if (i < 9) {
            group = heapGroup;
        } else {
            group = heapsizeGroup;
        }
        //final int index = i;
        memStatCheckBtns[i] = new Button(group, SWT.CHECK);
        memStatCheckBtns[i].setText(memStatCheckBtnTitles[i]);
        memStatCheckBtns[i].addSelectionListener(new SelectionListener() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                if (isSupportCheckChangeOper) {
                    //APTConsoleFactory.getInstance().APTPrint("内存check更新");
                    GetCurCheckedStateUtil.update();
                }
            }

            @Override
            public void widgetDefaultSelected(SelectionEvent e) {
            }
        });
    }
    //memStatCheckBtns[Constant.PRIV_TOTAL_INDEX].setSelection(true);
    memStatCheckBtns[Constant.PSS_TOTAL_INDEX].setSelection(true);
    //memStatCheckBtns[Constant.HEAPALLOC_TOTAL_INDEX].setSelection(true);
    FormData labelFormData = new FormData();
    labelFormData.left = new FormAttachment(0, Constant.MARGIN_WIDTH);
    labelFormData.right = new FormAttachment(100, -Constant.MARGIN_WIDTH);
    labelFormData.bottom = new FormAttachment(100, -Constant.MARGIN_WIDTH);
    Label showLabel = new Label(memTabRoot, SWT.NONE);
    showLabel.setLayoutData(labelFormData);
    showLabel.setText("提示:测试过程中可动态调整曲线显示");
    showLabel.setForeground(new Color(parent.getDisplay(), 0, 64, 64));
    showLabel.setFont(new Font(parent.getDisplay(), "宋体", 10, SWT.BOLD));
    memTabItem.setControl(memTabRoot);
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) Group(org.eclipse.swt.widgets.Group) Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) Color(org.eclipse.swt.graphics.Color) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text) Combo(org.eclipse.swt.widgets.Combo) FillLayout(org.eclipse.swt.layout.FillLayout) Font(org.eclipse.swt.graphics.Font) TabItem(org.eclipse.swt.widgets.TabItem) ModifyEvent(org.eclipse.swt.events.ModifyEvent) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) SWTNumberVerifyListener(com.tencent.wstt.apt.ui.custom.SWTNumberVerifyListener) FormAttachment(org.eclipse.swt.layout.FormAttachment) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 34 with SelectionListener

use of org.eclipse.swt.events.SelectionListener in project tdi-studio-se by Talend.

the class VarsDataMapTableView method createToolItems.

@Override
protected void createToolItems() {
    // /////////////////////////////////////////////////////////////////
    ToolItem addEntryItem = new ToolItem(toolBarActions, SWT.PUSH);
    addEntryItem.setEnabled(!getMapperManager().componentIsReadOnly());
    //$NON-NLS-1$
    addEntryItem.setToolTipText(Messages.getString("VarsDataMapTableView.entryItemTooltip.addVariable"));
    addEntryItem.setImage(org.talend.commons.ui.runtime.image.ImageProvider.getImage(org.talend.commons.ui.runtime.image.ImageProvider.getImageDesc(EImage.ADD_ICON)));
    addEntryItem.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent e) {
        }

        public void widgetSelected(SelectionEvent e) {
            TableViewerCreator<IColumnEntry> tableViewerCreator = getExtendedTableViewerForColumns().getTableViewerCreator();
            tableViewerCreator.applyActivatedCellEditor();
            Table table = getExtendedTableViewerForColumns().getTable();
            int[] indices = table.getSelectionIndices();
            int indexInsert = table.getItemCount();
            if (indices.length > 0) {
                indexInsert = indices[indices.length - 1] + 1;
            }
            IDataMapTable dataMapTable = VarsDataMapTableView.this.getDataMapTable();
            String varName = null;
            if (dataMapTable instanceof VarsTable) {
                //$NON-NLS-1$
                varName = ((VarsTable) dataMapTable).findUniqueColumnName("var");
            } else {
                throw new UnsupportedOperationException(Messages.getString(//$NON-NLS-1$
                "VarsDataMapTableView.exceptionMessage.caseNotFound"));
            }
            ILanguage currentLanguage = LanguageProvider.getCurrentLanguage();
            String type = null;
            if (currentLanguage.getCodeLanguage() == ECodeLanguage.JAVA) {
                type = JavaTypesManager.STRING.getId();
            } else {
                // fix bug 0018996 ,when add a var row,there is no default type,this bug exsit for long time
                type = PerlTypesManager.STRING;
            }
            mapperManager.addNewVarEntry(VarsDataMapTableView.this, varName, indexInsert, type);
            tableViewerCreatorForColumns.getTableViewer().refresh();
            if (canBeResizedAtPreferedSize()) {
                VarsDataMapTableView.this.changeSize(VarsDataMapTableView.this.getPreferredSize(true, true, false), true, true);
                changeMinimizeState(false);
            }
            mapperManager.getUiManager().refreshBackground(true, false);
            table.setSelection(indexInsert);
            removeEntryItem.setEnabled(true);
            moveUpEntryItem.setEnabled(true);
            moveDownEntryItem.setEnabled(true);
        }
    });
    // /////////////////////////////////////////////////////////////////
    // /////////////////////////////////////////////////////////////////
    removeEntryItem = new ToolItem(toolBarActions, SWT.PUSH);
    removeEntryItem.setEnabled(false);
    removeEntryItem.setImage(org.talend.commons.ui.runtime.image.ImageProvider.getImage(org.talend.commons.ui.runtime.image.ImageProvider.getImageDesc(EImage.MINUS_ICON)));
    //$NON-NLS-1$
    removeEntryItem.setToolTipText(Messages.getString("VarsDataMapTableView.entryItemTooltip.removeVariable"));
    removeEntryItem.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent e) {
        }

        public void widgetSelected(SelectionEvent e) {
            IStructuredSelection selection = (IStructuredSelection) tableViewerCreatorForColumns.getTableViewer().getSelection();
            List<ITableEntry> selectedBeans = selection.toList();
            for (ITableEntry entry : selectedBeans) {
                mapperManager.removeTableEntry(entry);
            }
            if (selectedBeans.size() > 0) {
                tableViewerCreatorForColumns.getTableViewer().refresh();
                mapperManager.getUiManager().refreshBackground(true, false);
                if (canBeResizedAtPreferedSize()) {
                    resizeAtExpandedSize();
                }
            }
            removeEntryItem.setEnabled(false);
        }
    });
    // /////////////////////////////////////////////////////////////////
    // /////////////////////////////////////////////////////////////////
    moveUpEntryItem = new ToolItem(toolBarActions, SWT.PUSH);
    moveUpEntryItem.setEnabled(false);
    moveUpEntryItem.setImage(ImageProvider.getImage(EImage.UP_ICON));
    //$NON-NLS-1$
    moveUpEntryItem.setToolTipText(Messages.getString("VarsDataMapTableView.entryItemTooltip.moveUpVariable"));
    moveUpEntryItem.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent e) {
        }

        public void widgetSelected(SelectionEvent e) {
            AbstractExtendedTableViewer viewer = getExtendedTableViewerForColumns();
            ExtendedTableMoveCommand moveCommand = new ExtendedTableMoveCommand(viewer.getExtendedTableModel(), true, viewer.getTableViewerCreator().getTable().getSelectionIndices());
            viewer.getTableViewerCreator().applyActivatedCellEditor();
            viewer.executeCommand(moveCommand);
        }
    });
    // /////////////////////////////////////////////////////////////////
    // /////////////////////////////////////////////////////////////////
    moveDownEntryItem = new ToolItem(toolBarActions, SWT.PUSH);
    moveDownEntryItem.setEnabled(false);
    moveDownEntryItem.setImage(ImageProvider.getImage(EImage.DOWN_ICON));
    //$NON-NLS-1$
    moveDownEntryItem.setToolTipText(Messages.getString("VarsDataMapTableView.entryItemTooltip.movedownVariable"));
    moveDownEntryItem.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent e) {
        }

        public void widgetSelected(SelectionEvent e) {
            AbstractExtendedTableViewer viewer = getExtendedTableViewerForColumns();
            ExtendedTableMoveCommand moveCommand = new ExtendedTableMoveCommand(viewer.getExtendedTableModel(), false, viewer.getTableViewerCreator().getTable().getSelectionIndices());
            viewer.getTableViewerCreator().applyActivatedCellEditor();
            viewer.executeCommand(moveCommand);
        }
    });
// /////////////////////////////////////////////////////////////////
}
Also used : ExtendedTableMoveCommand(org.talend.commons.ui.swt.advanced.dataeditor.commands.ExtendedTableMoveCommand) VarsTable(org.talend.designer.mapper.model.table.VarsTable) TableViewerCreator(org.talend.commons.ui.swt.tableviewer.TableViewerCreator) IDataMapTable(org.talend.designer.abstractmap.model.table.IDataMapTable) Table(org.eclipse.swt.widgets.Table) VarsTable(org.talend.designer.mapper.model.table.VarsTable) ITableEntry(org.talend.designer.abstractmap.model.tableentry.ITableEntry) IDataMapTable(org.talend.designer.abstractmap.model.table.IDataMapTable) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ILanguage(org.talend.designer.mapper.language.ILanguage) SelectionEvent(org.eclipse.swt.events.SelectionEvent) LineSelectionEvent(org.talend.commons.ui.runtime.swt.tableviewer.selection.LineSelectionEvent) AbstractExtendedTableViewer(org.talend.commons.ui.swt.extended.table.AbstractExtendedTableViewer) List(java.util.List) ToolItem(org.eclipse.swt.widgets.ToolItem) ILineSelectionListener(org.talend.commons.ui.runtime.swt.tableviewer.selection.ILineSelectionListener) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 35 with SelectionListener

use of org.eclipse.swt.events.SelectionListener in project tdi-studio-se by Talend.

the class JavaJobScriptsExportWSWizardPage method createExportTypeGroup.

protected void createExportTypeGroup(Composite parent) {
    // options group
    Group optionsGroup = new Group(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    optionsGroup.setLayout(layout);
    optionsGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
    //$NON-NLS-1$
    optionsGroup.setText(Messages.getString("JavaJobScriptsExportWSWizardPage.BuildType"));
    optionsGroup.setFont(parent.getFont());
    optionsGroup.setLayout(new GridLayout(1, true));
    Composite left = new Composite(optionsGroup, SWT.NONE);
    left.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, false));
    left.setLayout(new GridLayout(3, false));
    Label label = new Label(left, SWT.NONE);
    //$NON-NLS-1$
    label.setText(Messages.getString("JavaJobScriptsExportWSWizardPage.BuildLabel"));
    exportTypeCombo = new Combo(left, SWT.PUSH);
    GridData gd = new GridData();
    gd.horizontalSpan = 1;
    exportTypeCombo.setLayoutData(gd);
    for (JobExportType exportType : extractExportJobTypes()) {
        if (!Boolean.getBoolean("talend.export.job.2." + exportType.toString() + ".hide")) {
            //$NON-NLS-1$//$NON-NLS-2$
            exportTypeCombo.add(exportType.label);
        }
    }
    String label2 = getCurrentExportType1().label;
    // if the build type was set, try to select by default
    if (nodes != null && nodes.length == 1) {
        // deal with one node only.
        ProcessItem item = getProcessItem();
        final Object buildType = item.getProperty().getAdditionalProperties().get(TalendProcessArgumentConstant.ARG_BUILD_TYPE);
        if (buildType != null) {
            Map<JobExportType, String> map = BuildJobFactory.oldBuildTypeMap;
            for (JobExportType t : map.keySet()) {
                if (buildType.toString().equals(map.get(t))) {
                    // same build type
                    label2 = t.label;
                    break;
                }
            }
        }
    }
    exportTypeCombo.setText(label2);
    if (exportTypeFixed != null) {
        left.setVisible(false);
        optionsGroup.setVisible(false);
        exportTypeCombo.setText(exportTypeFixed.label);
    }
    chkButton = new Button(left, SWT.CHECK);
    //$NON-NLS-1$
    chkButton.setText(Messages.getString("JavaJobScriptsExportWSWizardPage.extractZipFile"));
    JobExportType comboType = JobExportType.getTypeFromString(exportTypeCombo.getText());
    if (comboType.equals(JobExportType.WSWAR) || comboType.equals(JobExportType.OSGI)) {
        chkButton.setVisible(false);
        zipOption = null;
    } else {
        chkButton.setVisible(true);
        zipOption = String.valueOf(chkButton.getSelection());
    }
    chkButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            chkButton.setSelection(chkButton.getSelection());
            zipOption = String.valueOf(chkButton.getSelection());
        }
    });
    exportTypeCombo.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        }

        @Override
        public void widgetSelected(SelectionEvent e) {
            destinationNameFieldInnerComposite.dispose();
            destinationNameFieldInnerComposite = new Composite(destinationNameFieldComposite, SWT.NONE);
            GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
            destinationNameFieldInnerComposite.setLayoutData(gridData);
            destinationNameFieldInnerComposite.setLayout(new GridLayout());
            createDestinationGroup(destinationNameFieldInnerComposite);
            destinationNameFieldComposite.layout();
            optionsGroupComposite.dispose();
            createOptionsGroupButtons(pageComposite);
            pageComposite.setSize(pageComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
            pageComposite.layout();
            JobExportType comboType = JobExportType.getTypeFromString(exportTypeCombo.getText());
            if (comboType.equals(JobExportType.WSWAR) || comboType.equals(JobExportType.OSGI)) {
                chkButton.setVisible(false);
                zipOption = null;
            } else {
                chkButton.setVisible(true);
                zipOption = String.valueOf(chkButton.getSelection());
            }
            checkExport();
        }
    });
}
Also used : Group(org.eclipse.swt.widgets.Group) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) Combo(org.eclipse.swt.widgets.Combo) GridLayout(org.eclipse.swt.layout.GridLayout) ProcessItem(org.talend.core.model.properties.ProcessItem) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) SelectionListener(org.eclipse.swt.events.SelectionListener)

Aggregations

SelectionListener (org.eclipse.swt.events.SelectionListener)302 SelectionEvent (org.eclipse.swt.events.SelectionEvent)268 GridData (org.eclipse.swt.layout.GridData)149 Button (org.eclipse.swt.widgets.Button)143 GridLayout (org.eclipse.swt.layout.GridLayout)142 Composite (org.eclipse.swt.widgets.Composite)134 Label (org.eclipse.swt.widgets.Label)102 Group (org.eclipse.swt.widgets.Group)69 Text (org.eclipse.swt.widgets.Text)67 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)61 Combo (org.eclipse.swt.widgets.Combo)50 ModifyListener (org.eclipse.swt.events.ModifyListener)44 ModifyEvent (org.eclipse.swt.events.ModifyEvent)43 FormAttachment (org.eclipse.swt.layout.FormAttachment)36 FormData (org.eclipse.swt.layout.FormData)36 Point (org.eclipse.swt.graphics.Point)35 Event (org.eclipse.swt.widgets.Event)33 ArrayList (java.util.ArrayList)30 FillLayout (org.eclipse.swt.layout.FillLayout)26 FormLayout (org.eclipse.swt.layout.FormLayout)26