Search in sources :

Example 11 with FocusEvent

use of org.eclipse.swt.events.FocusEvent in project translationstudio8 by heartsome.

the class EquivalentPage method validEquiTxt.

/**
	 * 验证用户输入的加权系数的正确性
	 * @param equiTxt
	 */
private void validEquiTxt(final Text equiTxt) {
    final String defaultStr = "0.50";
    equiTxt.setText(defaultStr);
    equiTxt.addFocusListener(new FocusAdapter() {

        @Override
        public void focusLost(FocusEvent e) {
            String textStr = equiTxt.getText().trim();
            if (textStr == null || textStr.trim().length() == 0) {
                equiTxt.setText(defaultStr);
            } else {
                String regular = "1\\.(0){0,2}|0\\.\\d{0,2}";
                if (!textStr.matches(regular)) {
                    MessageDialog.openInformation(getShell(), Messages.getString("preference.EquivalentPage.msgTitle"), Messages.getString("preference.EquivalentPage.msg5"));
                    equiTxt.setText(defaultStr);
                }
            }
        }
    });
}
Also used : FocusAdapter(org.eclipse.swt.events.FocusAdapter) FocusEvent(org.eclipse.swt.events.FocusEvent)

Example 12 with FocusEvent

use of org.eclipse.swt.events.FocusEvent in project translationstudio8 by heartsome.

the class ConcordanceSearchDialog method initListener.

/**
	 * 初始化各控件的监听 ;
	 */
private void initListener() {
    btnSearch.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            initGroupIdAndSearch();
        }

        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
    cmbSearch.addKeyListener(new KeyListener() {

        public void keyPressed(KeyEvent e) {
            if (e.character == SWT.CR) {
                initGroupIdAndSearch();
            }
        }

        public void keyReleased(KeyEvent e) {
        }
    });
    btnFirst.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            if (curPageNum > 0 && amountPage > 0) {
                curPageNum = 1;
                if (search()) {
                    refreshPageNumText();
                }
            }
        }

        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
    btnPre.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent e) {
        }

        public void widgetSelected(SelectionEvent e) {
            if (curPageNum > 0) {
                curPageNum--;
                if (search()) {
                    refreshPageNumText();
                }
            }
        }
    });
    btnNext.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent e) {
        }

        public void widgetSelected(SelectionEvent e) {
            if (curPageNum < amountPage) {
                curPageNum++;
                if (search()) {
                    refreshPageNumText();
                }
            }
        }
    });
    btnLast.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent e) {
        }

        public void widgetSelected(SelectionEvent e) {
            if (curPageNum > 0 && amountPage > 0) {
                curPageNum = amountPage;
                if (search()) {
                    refreshPageNumText();
                }
            }
        }
    });
    txtPage.addKeyListener(new KeyListener() {

        public void keyReleased(KeyEvent e) {
        }

        public void keyPressed(KeyEvent e) {
            if (e.character == SWT.CR) {
                String pageNum = txtPage.getText();
                try {
                    curPageNum = Integer.parseInt(pageNum);
                } catch (NumberFormatException e1) {
                    // LOGGER.error("NumberFormatException", e1);
                    txtPage.setText(String.valueOf(curPageNum) + splitPageSeparator + amountPage);
                    return;
                }
                if (curPageNum > amountPage) {
                    curPageNum = amountPage;
                }
                if (curPageNum < 1) {
                    curPageNum = 1;
                }
                search();
                txtPage.setText(String.valueOf(curPageNum));
            }
        }
    });
    txtPage.addFocusListener(new FocusAdapter() {

        @Override
        public void focusLost(FocusEvent e) {
            refreshPageNumText();
        }

        @Override
        public void focusGained(FocusEvent e) {
            txtPage.setText("");
        }
    });
}
Also used : KeyEvent(org.eclipse.swt.events.KeyEvent) FocusAdapter(org.eclipse.swt.events.FocusAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) KeyListener(org.eclipse.swt.events.KeyListener) FocusEvent(org.eclipse.swt.events.FocusEvent) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 13 with FocusEvent

use of org.eclipse.swt.events.FocusEvent in project translationstudio8 by heartsome.

the class XLIFFEditorImplWithNatTable method addFilterComposite.

/**
	 * 添加填充过滤器面板内容的面板
	 * @param parent
	 * @return 过滤器面板;
	 */
private void addFilterComposite(Composite main) {
    Composite top = new Composite(main, SWT.NONE);
    GridLayoutFactory.fillDefaults().numColumns(3).equalWidth(false).margins(0, 0).applyTo(top);
    top.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    // 输入行号进行定位
    final String rowLocationStr = Messages.getString("editor.XLIFFEditorImplWithNatTable.rowLocationStr");
    Text txtRowLocation = new Text(top, SWT.BORDER);
    txtRowLocation.setText(rowLocationStr);
    int width = 40;
    if (Util.isLinux()) {
        width = 35;
    }
    GridDataFactory.swtDefaults().hint(width, SWT.DEFAULT).applyTo(txtRowLocation);
    txtRowLocation.addFocusListener(new FocusAdapter() {

        @Override
        public void focusGained(FocusEvent e) {
            Text text = (Text) e.widget;
            if (rowLocationStr.equals(text.getText())) {
                text.setText("");
            }
        }

        @Override
        public void focusLost(FocusEvent e) {
            Text text = (Text) e.widget;
            if ("".equals(text.getText())) {
                text.setText(rowLocationStr);
            }
        }
    });
    txtRowLocation.addKeyListener(new KeyAdapter() {

        @Override
        public void keyPressed(KeyEvent event) {
            if (event.keyCode == SWT.CR || event.keyCode == SWT.KEYPAD_CR) {
                String rowNumString = ((Text) event.widget).getText().trim();
                if (rowNumString != null && !"".equals(rowNumString)) {
                    int rowPosition;
                    try {
                        rowPosition = Integer.parseInt(rowNumString) - 1;
                        jumpToRow(rowPosition, false);
                        updateStatusLine();
                    } catch (NumberFormatException e) {
                        Text text = (Text) event.widget;
                        text.setText("");
                    }
                }
            }
        }
    });
    txtRowLocation.addVerifyListener(new VerifyListener() {

        public void verifyText(VerifyEvent event) {
            if (event.keyCode == 0 && event.stateMask == 0) {
            // 文本框得到焦点时
            } else if (Character.isDigit(event.character) || event.character == '\b' || event.keyCode == 127) {
                // 输入数字,或者按下Backspace、Delete键
                if ("".equals(((Text) event.widget).getText().trim()) && event.character == '0') {
                    event.doit = false;
                } else {
                    event.doit = true;
                }
            } else {
                event.doit = false;
            }
        }
    });
    cmbFilter = new Combo(top, SWT.BORDER | SWT.READ_ONLY);
    cmbFilter.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    // TODO 完善过滤器初始化数据。
    // cmbFilter.add("所有文本段");
    // cmbFilter.add("未翻译文本段");
    // cmbFilter.add("已翻译文本段");
    // cmbFilter.add("未批准文本段");
    // cmbFilter.add("已批准文本段");
    // cmbFilter.add("有批注文本段");
    // cmbFilter.add("锁定文本段");
    // cmbFilter.add("未锁定文本段");
    // cmbFilter.add("重复文本段");
    // cmbFilter.add("疑问文本段");
    // cmbFilter.add("上下文匹配文本段");
    // cmbFilter.add("完全匹配文本段");
    // cmbFilter.add("模糊匹配文本段");
    // cmbFilter.add("快速翻译文本段");
    // cmbFilter.add("自动繁殖文本段");
    // cmbFilter.add("错误标记文本段");
    // cmbFilter.add("术语不一致文本段");
    // cmbFilter.add("译文不一致文本段");
    // cmbFilter.add("带修订标记文本段");
    final Set<String> filterNames = XLFHandler.getFilterNames();
    for (String filterName : filterNames) {
        cmbFilter.add(filterName);
    }
    // 添加选项改变监听
    cmbFilter.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            // Fixed Bug #2243 by Jason 当鼠标焦点在源文单元框中使用过滤器,对过滤后的译文进行操作会提示该行锁定不能操作
            // ActiveCellEditor.commit();
            HsMultiActiveCellEditor.commit(true);
            Combo cmbFilter = (Combo) e.widget;
            boolean isUpdated = handler.doFilter(cmbFilter.getText(), langFilterCondition);
            if (isUpdated) {
                if (table != null) {
                    bodyLayer.getSelectionLayer().clear();
                    if (bodyLayer.selectionLayer.getRowCount() > 0) {
                        // 默认选中第一行
                        HsMultiActiveCellEditor.commit(true);
                        bodyLayer.selectionLayer.doCommand(new SelectCellCommand(bodyLayer.getSelectionLayer(), getTgtColumnIndex(), isHorizontalLayout ? 0 : 1, false, false));
                        HsMultiCellEditorControl.activeSourceAndTargetCell(XLIFFEditorImplWithNatTable.this);
                    }
                    table.setFocus();
                }
                // 自动调整 NatTable 大小 ;
                autoResize();
                // 更新状态栏
                updateStatusLine();
                NattableUtil.refreshCommand(XLIFFEditorSelectionPropertyTester.PROPERTY_NAMESPACE, XLIFFEditorSelectionPropertyTester.PROPERTY_ENABLED);
            }
        }
    });
    Button btnSaveFilter = new Button(top, SWT.NONE);
    // TODO 考虑换成图片显示。
    btnSaveFilter.setText(Messages.getString("editor.XLIFFEditorImplWithNatTable.btnAddFilter"));
    btnSaveFilter.setToolTipText(Messages.getString("editor.XLIFFEditorImplWithNatTable.btnAddFilterTooltip"));
    btnSaveFilter.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            CustomFilterDialog dialog = new CustomFilterDialog(table.getShell(), cmbFilter);
            dialog.open();
        // int res = dialog.open();
        // if (res == CustomFilterDialog.OK) {
        // cmbFilter.select(cmbFilter.getItemCount() - 1); // 选中最后一行数据
        // cmbFilter.notifyListeners(SWT.Selection, null);
        // }
        }
    });
    // 默认选中第一行数据
    cmbFilter.select(0);
    cmbFilter.notifyListeners(SWT.Selection, null);
    // 更新nattable的列名为语言对
    renameColumn();
    top.pack();
}
Also used : FocusAdapter(org.eclipse.swt.events.FocusAdapter) VerifyListener(org.eclipse.swt.events.VerifyListener) CustomFilterDialog(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog) Composite(org.eclipse.swt.widgets.Composite) SelectCellCommand(net.sourceforge.nattable.selection.command.SelectCellCommand) KeyAdapter(org.eclipse.swt.events.KeyAdapter) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) StyledText(org.eclipse.swt.custom.StyledText) Text(org.eclipse.swt.widgets.Text) Combo(org.eclipse.swt.widgets.Combo) FocusEvent(org.eclipse.swt.events.FocusEvent) Point(org.eclipse.swt.graphics.Point) KeyEvent(org.eclipse.swt.events.KeyEvent) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) VerifyEvent(org.eclipse.swt.events.VerifyEvent)

Example 14 with FocusEvent

use of org.eclipse.swt.events.FocusEvent in project azure-tools-for-java by Microsoft.

the class AppServiceCreateDialog method createDialogArea.

@Override
protected Control createDialogArea(Composite parent) {
    setMessage("Create Azure App Service");
    setTitle("Create App Service");
    Composite area = (Composite) super.createDialogArea(parent);
    Composite composite = new Composite(area, SWT.NONE);
    composite.setLayout(new GridLayout(1, false));
    composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
    Group grpAppService = new Group(composite, SWT.NONE);
    grpAppService.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
    grpAppService.setLayout(new GridLayout(3, false));
    Label lblAppName = new Label(grpAppService, SWT.NONE);
    lblAppName.setText("Enter name");
    textAppName = new Text(grpAppService, SWT.BORDER);
    textAppName.addFocusListener(new FocusAdapter() {

        @Override
        public void focusGained(FocusEvent e) {
            cleanError();
        }
    });
    textAppName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    textAppName.setMessage("<enter name>");
    dec_textAppName = decorateContorolAndRegister(textAppName);
    Label lblazurewebsitescom = new Label(grpAppService, SWT.NONE);
    lblazurewebsitescom.setText(".azurewebsites.net");
    Label lblWebContainer = new Label(grpAppService, SWT.NONE);
    lblWebContainer.setText("Web container");
    comboWebContainer = new Combo(grpAppService, SWT.READ_ONLY);
    comboWebContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
    dec_comboWebContainer = decorateContorolAndRegister(comboWebContainer);
    Label lblSubscription = new Label(grpAppService, SWT.NONE);
    lblSubscription.setText("Subscription");
    comboSubscription = new Combo(grpAppService, SWT.READ_ONLY);
    comboSubscription.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            fillResourceGroups();
            fillAppServicePlans();
            fillAppServicePlansDetails();
            fillAppServicePlanLocations();
        }
    });
    dec_comboSubscription = decorateContorolAndRegister(comboSubscription);
    comboSubscription.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
    // ====
    tabFolder = new TabFolder(composite, SWT.NONE);
    tabFolder.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    tabItemAppServicePlan = new TabItem(tabFolder, SWT.NONE);
    tabItemAppServicePlan.setText("App service plan");
    compositeAppServicePlan = new Composite(tabFolder, SWT.NONE);
    tabItemAppServicePlan.setControl(compositeAppServicePlan);
    compositeAppServicePlan.setLayout(new GridLayout(2, false));
    btnAppServiceCreateNew = new Button(compositeAppServicePlan, SWT.RADIO);
    btnAppServiceCreateNew.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            radioAppServicePlanLogic();
        }
    });
    btnAppServiceCreateNew.setSelection(true);
    btnAppServiceCreateNew.setBounds(0, 0, 90, 16);
    btnAppServiceCreateNew.setText("Create new");
    textAppSevicePlanName = new Text(compositeAppServicePlan, SWT.BORDER);
    textAppSevicePlanName.addFocusListener(new FocusAdapter() {

        @Override
        public void focusGained(FocusEvent e) {
            cleanError();
        }
    });
    textAppSevicePlanName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    textAppSevicePlanName.setMessage("<enter name>");
    dec_textAppSevicePlanName = decorateContorolAndRegister(textAppSevicePlanName);
    lblAppServiceCreateNewLocation = new Label(compositeAppServicePlan, SWT.NONE);
    GridData gd_lblAppServiceCreateNewLocation = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_lblAppServiceCreateNewLocation.horizontalIndent = 15;
    lblAppServiceCreateNewLocation.setLayoutData(gd_lblAppServiceCreateNewLocation);
    lblAppServiceCreateNewLocation.setText("Location");
    comboAppServicePlanLocation = new Combo(compositeAppServicePlan, SWT.READ_ONLY);
    comboAppServicePlanLocation.addFocusListener(new FocusAdapter() {

        @Override
        public void focusGained(FocusEvent e) {
            cleanError();
        }
    });
    comboAppServicePlanLocation.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    dec_comboAppServicePlanLocation = decorateContorolAndRegister(comboAppServicePlanLocation);
    lblAppServiceCreateNewPricingTier = new Label(compositeAppServicePlan, SWT.NONE);
    GridData gd_lblAppServiceCreateNewPricingTier = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_lblAppServiceCreateNewPricingTier.horizontalIndent = 15;
    lblAppServiceCreateNewPricingTier.setLayoutData(gd_lblAppServiceCreateNewPricingTier);
    lblAppServiceCreateNewPricingTier.setText("Pricing tier");
    comboAppServicePlanPricingTier = new Combo(compositeAppServicePlan, SWT.READ_ONLY);
    comboAppServicePlanPricingTier.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    btnAppServiceUseExisting = new Button(compositeAppServicePlan, SWT.RADIO);
    btnAppServiceUseExisting.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            radioAppServicePlanLogic();
        }
    });
    btnAppServiceUseExisting.setText("Use existing");
    comboAppServicePlan = new Combo(compositeAppServicePlan, SWT.READ_ONLY);
    comboAppServicePlan.setEnabled(false);
    comboAppServicePlan.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    comboAppServicePlan.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            fillAppServicePlansDetails();
        }
    });
    comboAppServicePlan.setBounds(0, 0, 26, 22);
    dec_comboAppServicePlan = decorateContorolAndRegister(comboAppServicePlan);
    lblAppServiceUseExictingLocation = new Label(compositeAppServicePlan, SWT.NONE);
    lblAppServiceUseExictingLocation.setEnabled(false);
    GridData gd_lblAppServiceUseExictingLocation = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_lblAppServiceUseExictingLocation.horizontalIndent = 15;
    lblAppServiceUseExictingLocation.setLayoutData(gd_lblAppServiceUseExictingLocation);
    lblAppServiceUseExictingLocation.setText("Location");
    lblAppSevicePlanLocation = new Label(compositeAppServicePlan, SWT.NONE);
    lblAppSevicePlanLocation.setEnabled(false);
    lblAppSevicePlanLocation.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    lblAppSevicePlanLocation.setText("N/A");
    lblAppServiceUseExistiogPrisingTier = new Label(compositeAppServicePlan, SWT.NONE);
    lblAppServiceUseExistiogPrisingTier.setEnabled(false);
    GridData gd_lblAppServiceUseExistiogPrisingTier = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_lblAppServiceUseExistiogPrisingTier.horizontalIndent = 15;
    lblAppServiceUseExistiogPrisingTier.setLayoutData(gd_lblAppServiceUseExistiogPrisingTier);
    lblAppServiceUseExistiogPrisingTier.setText("Pricing tier");
    lblAppServicePlanPricingTier = new Label(compositeAppServicePlan, SWT.NONE);
    lblAppServicePlanPricingTier.setEnabled(false);
    lblAppServicePlanPricingTier.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    lblAppServicePlanPricingTier.setText("N/A");
    new Label(compositeAppServicePlan, SWT.NONE);
    //dec_comboAppServicePlanPricingTier = decorateContorolAndRegister(comboAppServicePlanPricingTier);
    linkAppServicePricing = new Link(compositeAppServicePlan, SWT.NONE);
    linkAppServicePricing.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    linkAppServicePricing.setText("<a>App service pricing details</a>");
    linkAppServicePricing.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent event) {
            try {
                PlatformUI.getWorkbench().getBrowserSupport().getExternalBrowser().openURL(new URL("https://azure.microsoft.com/en-us/pricing/details/app-service/"));
            } catch (PartInitException | MalformedURLException ex) {
                LOG.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "widgetSelected@SelectionAdapter@linkAppServicePricing@AppServiceCreateDialog", ex));
            }
        }
    });
    tabItemResourceGroup = new TabItem(tabFolder, SWT.NONE);
    tabItemResourceGroup.setText("Resource group");
    compositeResourceGroup = new Composite(tabFolder, SWT.NONE);
    tabItemResourceGroup.setControl(compositeResourceGroup);
    compositeResourceGroup.setLayout(new GridLayout(2, false));
    btnResourceGroupCreateNew = new Button(compositeResourceGroup, SWT.RADIO);
    btnResourceGroupCreateNew.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            radioResourceGroupLogic();
        }
    });
    btnResourceGroupCreateNew.setSelection(true);
    btnResourceGroupCreateNew.setText("Create new");
    textResourceGroupName = new Text(compositeResourceGroup, SWT.BORDER);
    textResourceGroupName.addFocusListener(new FocusAdapter() {

        @Override
        public void focusGained(FocusEvent e) {
            cleanError();
        }
    });
    textResourceGroupName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    textResourceGroupName.setBounds(0, 0, 64, 19);
    textResourceGroupName.setMessage("<enter name>");
    dec_textNewResGrName = decorateContorolAndRegister(textResourceGroupName);
    btnResourceGroupUseExisting = new Button(compositeResourceGroup, SWT.RADIO);
    btnResourceGroupUseExisting.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            radioResourceGroupLogic();
        }
    });
    btnResourceGroupUseExisting.setText("Use existing");
    comboResourceGroup = new Combo(compositeResourceGroup, SWT.READ_ONLY);
    comboResourceGroup.setEnabled(false);
    comboResourceGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    comboResourceGroup.setBounds(0, 0, 26, 22);
    dec_comboSelectResGr = decorateContorolAndRegister(comboResourceGroup);
    tabItemJDK = new TabItem(tabFolder, SWT.NONE);
    tabItemJDK.setText("JDK");
    compositeJDK = new Composite(tabFolder, SWT.NONE);
    tabItemJDK.setControl(compositeJDK);
    compositeJDK.setLayout(new GridLayout(3, false));
    btnJdkDefault = new Button(compositeJDK, SWT.RADIO);
    btnJdkDefault.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            radioJdkLogic();
        }
    });
    btnJdkDefault.setSelection(true);
    btnJdkDefault.setText("Default");
    lblJdkDefaultComment = new Label(compositeJDK, SWT.NONE);
    lblJdkDefaultComment.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    lblJdkDefaultComment.setText("Deploy the default JDK (JDK 8)");
    new Label(compositeJDK, SWT.NONE);
    btnJdk3rdParty = new Button(compositeJDK, SWT.RADIO);
    btnJdk3rdParty.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            radioJdkLogic();
        }
    });
    btnJdk3rdParty.setText("3rd party");
    comboJdk3Party = new Combo(compositeJDK, SWT.READ_ONLY);
    comboJdk3Party.setEnabled(false);
    comboJdk3Party.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    dec_comboJdk3Party = decorateContorolAndRegister(comboJdk3Party);
    linkJdkLicense = new Link(compositeJDK, SWT.NONE);
    linkJdkLicense.setEnabled(false);
    linkJdkLicense.setText("<a>License</a>");
    linkJdkLicense.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent event) {
            try {
                PlatformUI.getWorkbench().getBrowserSupport().getExternalBrowser().openURL(new URL(AzulZuluModel.getLicenseUrl()));
            } catch (Exception ex) {
                LOG.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "widgetSelected@SelectionAdapter@AppServiceCreateDialo", ex));
            }
        }
    });
    btnJdkOwnDownloadUrl = new Button(compositeJDK, SWT.RADIO);
    btnJdkOwnDownloadUrl.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            radioJdkLogic();
        }
    });
    btnJdkOwnDownloadUrl.setText("Download URL");
    textJdkOwnUrl = new Text(compositeJDK, SWT.BORDER);
    textJdkOwnUrl.addFocusListener(new FocusAdapter() {

        @Override
        public void focusGained(FocusEvent e) {
            cleanError();
        }
    });
    textJdkOwnUrl.setEnabled(false);
    textJdkOwnUrl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    textJdkOwnUrl.setMessage("<enter url>");
    dec_textJdkOwnUrl = decorateContorolAndRegister(textJdkOwnUrl);
    new Label(compositeJDK, SWT.NONE);
    lblJdkOwnSrorageAccountKey = new Label(compositeJDK, SWT.NONE);
    GridData gd_lblJdkOwnSrorageAccountKey = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_lblJdkOwnSrorageAccountKey.horizontalIndent = 15;
    lblJdkOwnSrorageAccountKey.setLayoutData(gd_lblJdkOwnSrorageAccountKey);
    lblJdkOwnSrorageAccountKey.setText("Storage account key");
    textJdkOwnStorageAccountKey = new Text(compositeJDK, SWT.BORDER);
    textJdkOwnStorageAccountKey.setEnabled(false);
    textJdkOwnStorageAccountKey.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    textJdkOwnStorageAccountKey.setMessage("<enter storage account key>");
    decorateContorolAndRegister(textJdkOwnStorageAccountKey);
    new Label(compositeJDK, SWT.NONE);
    new Label(compositeJDK, SWT.NONE);
    lblJdkOwnComment = new Label(compositeJDK, SWT.NONE);
    lblJdkOwnComment.setEnabled(false);
    lblJdkOwnComment.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    lblJdkOwnComment.setText("(If the URL above is a private blob)");
    new Label(compositeJDK, SWT.NONE);
    DateFormat df = new SimpleDateFormat("yyMMddHHmmss");
    String date = df.format(new Date());
    textAppName.setText("webapp-" + date);
    textAppSevicePlanName.setText("asp-" + date);
    textResourceGroupName.setText("rg-webapp-" + date);
    fillWebContainers();
    fillSubscriptions();
    fillResourceGroups();
    fillAppServicePlans();
    fillAppServicePlansDetails();
    fillAppServicePlanLocations();
    fillAppServicePlanPricingTiers();
    fill3PartyJdk();
    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) FocusAdapter(org.eclipse.swt.events.FocusAdapter) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) TabFolder(org.eclipse.swt.widgets.TabFolder) Text(org.eclipse.swt.widgets.Text) Combo(org.eclipse.swt.widgets.Combo) FocusEvent(org.eclipse.swt.events.FocusEvent) URL(java.net.URL) PartInitException(org.eclipse.ui.PartInitException) InvocationTargetException(java.lang.reflect.InvocationTargetException) MalformedURLException(java.net.MalformedURLException) Date(java.util.Date) TabItem(org.eclipse.swt.widgets.TabItem) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) DateFormat(java.text.DateFormat) SimpleDateFormat(java.text.SimpleDateFormat) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) SimpleDateFormat(java.text.SimpleDateFormat) Link(org.eclipse.swt.widgets.Link)

Example 15 with FocusEvent

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

the class TalendEditorComponentCreationAssist method initListeners.

private void initListeners() {
    assistText.addKeyListener(new KeyListener() {

        @Override
        public void keyReleased(KeyEvent e) {
            if (e.stateMask == SWT.NONE) {
                if (e.keyCode == SWT.ESC) {
                    disposeAssistText();
                } else if (e.keyCode == SWT.CR) {
                    acceptProposal();
                }
            }
        }

        @Override
        public void keyPressed(KeyEvent e) {
        }
    });
    assistText.addFocusListener(new FocusListener() {

        @Override
        public void focusLost(FocusEvent e) {
            if (!(contentProposalAdapter.isProposalPopupOpen())) {
                disposeAssistText();
            }
        }

        @Override
        public void focusGained(FocusEvent e) {
        }
    });
    contentProposalAdapter.addContentProposalListener(new IContentProposalListener2() {

        @Override
        public void proposalPopupOpened(ContentProposalAdapter adapter) {
        }

        @Override
        public void proposalPopupClosed(ContentProposalAdapter adapter) {
            if (assistText != null && !assistText.isFocusControl()) {
                disposeAssistText();
            }
        }
    });
    contentProposalAdapter.addContentProposalListener(new IContentProposalListener() {

        @Override
        public void proposalAccepted(IContentProposal proposal) {
            acceptProposal();
        }
    });
}
Also used : KeyEvent(org.eclipse.swt.events.KeyEvent) IContentProposal(org.eclipse.jface.fieldassist.IContentProposal) KeyListener(org.eclipse.swt.events.KeyListener) IContentProposalListener(org.eclipse.jface.fieldassist.IContentProposalListener) FocusListener(org.eclipse.swt.events.FocusListener) FocusEvent(org.eclipse.swt.events.FocusEvent) IContentProposalListener2(org.eclipse.jface.fieldassist.IContentProposalListener2) ContentProposalAdapter(org.eclipse.jface.fieldassist.ContentProposalAdapter)

Aggregations

FocusEvent (org.eclipse.swt.events.FocusEvent)98 FocusAdapter (org.eclipse.swt.events.FocusAdapter)55 SelectionEvent (org.eclipse.swt.events.SelectionEvent)50 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)42 FocusListener (org.eclipse.swt.events.FocusListener)40 GridData (org.eclipse.swt.layout.GridData)34 Text (org.eclipse.swt.widgets.Text)30 GridLayout (org.eclipse.swt.layout.GridLayout)29 Composite (org.eclipse.swt.widgets.Composite)28 Label (org.eclipse.swt.widgets.Label)23 Menu (org.eclipse.swt.widgets.Menu)21 Button (org.eclipse.swt.widgets.Button)19 MenuManager (org.eclipse.jface.action.MenuManager)18 ModifyEvent (org.eclipse.swt.events.ModifyEvent)17 ModifyListener (org.eclipse.swt.events.ModifyListener)17 Group (org.eclipse.swt.widgets.Group)17 Point (org.eclipse.swt.graphics.Point)16 Combo (org.eclipse.swt.widgets.Combo)15 MenuItem (org.eclipse.swt.widgets.MenuItem)15 KeyEvent (org.eclipse.swt.events.KeyEvent)12