Java Code Examples for org.eclipse.swt.widgets.Combo#addModifyListener()
The following examples show how to use
org.eclipse.swt.widgets.Combo#addModifyListener() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: INSDEnvironmentPage.java From uima-uimaj with Apache License 2.0 | 6 votes |
/** * Adds the combo. * * @param parent the parent * @param strLabel the str label * @return the combo */ private Combo addCombo(Composite parent, String strLabel) { Label label = new Label(parent, SWT.NULL); label.setText(strLabel); Combo text = new Combo(parent, SWT.BORDER | SWT.SINGLE); GridData gd = new GridData(GridData.FILL_HORIZONTAL); // gd.grabExcessHorizontalSpace = true; gd.widthHint = 100; text.setLayoutData(gd); text.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { dialogChanged(); } }); return text; }
Example 2
Source File: TypeCombo.java From uima-uimaj with Apache License 2.0 | 6 votes |
/** * Instantiates a new type combo. * * @param parent the parent */ public TypeCombo(Composite parent) { super(parent, SWT.NONE); setLayout(new FillLayout()); typeCombo = new Combo(this, SWT.READ_ONLY | SWT.DROP_DOWN | SWT.BORDER); typeCombo.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { Type newType = getType(); for (ITypePaneListener listener : listeners) { listener.typeChanged(newType); } } }); }
Example 3
Source File: CrosstabGrandTotalDialog.java From birt with Eclipse Public License 1.0 | 6 votes |
protected void createGrandTotalContent( Composite parent ) { Composite container = new Composite( parent, SWT.NONE ); container.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); GridLayout glayout = new GridLayout( 2, false ); container.setLayout( glayout ); Label lb = new Label( container, SWT.NONE ); lb.setText( Messages.getString( "CrosstabGrandTotalDialog.Text.DataField" ) ); //$NON-NLS-1$ dataFieldCombo = new Combo( container, SWT.BORDER | SWT.READ_ONLY ); GridData gdata = new GridData( GridData.FILL_HORIZONTAL ); gdata.minimumWidth = 140; dataFieldCombo.setLayoutData( gdata ); dataFieldCombo.setVisibleItemCount( 30 ); dataFieldCombo.addModifyListener( new ModifyListener( ) { public void modifyText( ModifyEvent e ) { updateButtons( ); } } ); }
Example 4
Source File: OptionsConfigurationBlock.java From typescript.java with MIT License | 6 votes |
protected Combo newComboControl(Composite composite, Key key, String[] values, String[] valueLabels, boolean readOnly) { Combo comboBox = new Combo(composite, readOnly ? SWT.READ_ONLY : SWT.NONE); comboBox.setItems(valueLabels); comboBox.setFont(JFaceResources.getDialogFont()); makeScrollableCompositeAware(comboBox); String currValue = getValue(key); if (readOnly) { ControlData data = new ControlData(key, values); comboBox.setData(data); comboBox.addSelectionListener(getSelectionListener()); comboBox.select(data.getSelection(currValue)); } else { comboBox.setData(key); if (currValue != null) { comboBox.setText(currValue); } comboBox.addModifyListener(getTextModifyListener()); } fComboBoxes.add(comboBox); return comboBox; }
Example 5
Source File: AbstractWizardNewTypeScriptProjectCreationPage.java From typescript.java with MIT License | 6 votes |
/** Creates the field for selecting the installed Node.js. */ private void createInstalledNodejsField(Composite parent) { if (hasEmbeddedNodeJs) { Button useInstalledNodejs = new Button(parent, SWT.RADIO); useInstalledNodejs .setText(TypeScriptUIMessages.AbstractWizardNewTypeScriptProjectCreationPage_useInstalledNodeJs_label); } String[] defaultPaths = IDENodejsProcessHelper.getAvailableNodejsPaths(); installedNodeJs = new Combo(parent, SWT.NONE); installedNodeJs.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); installedNodeJs.setItems(defaultPaths); installedNodeJs.addListener(SWT.Modify, nodeJsStatusChanged()); installedNodeJs.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { customNodeJsPath = installedNodeJs.getText(); } }); // Create Browse buttons. createBrowseButtons(parent, installedNodeJs); }
Example 6
Source File: TimeGraphFindDialog.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
/** * Creates the panel where the user specifies the text to search for * * @param parent * the parent composite * @return the input panel */ private Composite createInputPanel(Composite parent) { Composite panel = new Composite(parent, SWT.NULL); GridLayout layout = new GridLayout(); layout.numColumns = 2; panel.setLayout(layout); Label findLabel = new Label(panel, SWT.LEFT); findLabel.setText(Messages.TimeGraphFindDialog_FindLabel); setGridData(findLabel, SWT.LEFT, false, SWT.CENTER, false); // Create the find content assist field ComboContentAdapter contentAdapter = new ComboContentAdapter(); FindReplaceDocumentAdapterContentProposalProvider findProposer = new FindReplaceDocumentAdapterContentProposalProvider(true); fFindField = new Combo(panel, SWT.DROP_DOWN | SWT.BORDER); fContentAssistFindField = new ContentAssistCommandAdapter( fFindField, contentAdapter, findProposer, ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS, new char[0], true); setGridData(fFindField, SWT.FILL, true, SWT.CENTER, false); fFindField.addModifyListener(fFindModifyListener); return panel; }
Example 7
Source File: DialogComboSelection.java From arx with Apache License 2.0 | 5 votes |
@Override protected Control createDialogArea(Composite parent) { // create composite Composite composite = (Composite) super.createDialogArea(parent); // create message if (message != null) { Label label = new Label(composite, SWT.WRAP); label.setText(message); GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER); data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); label.setLayoutData(data); label.setFont(parent.getFont()); } combo = new Combo(composite, SWT.NONE); combo.setItems(choices); combo.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); combo.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { validateInput(); } }); errorMessageText = new Text(composite, SWT.READ_ONLY | SWT.WRAP); errorMessageText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); errorMessageText.setBackground(errorMessageText.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); // Set the error message text // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=66292 setErrorMessage(errorMessage); applyDialogFont(composite); return composite; }
Example 8
Source File: Summarize.java From Rel with Apache License 2.0 | 5 votes |
private void addRow(Composite parent, Aggregate r) { Text as = new Text(parent, SWT.NONE); as.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); as.setText(r.getAs()); as.addModifyListener(e -> r.setAs(as.getText())); new Label(parent, SWT.None); Combo aggOps = new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY); Text expression1 = new Text(parent, SWT.NONE); expression1.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); expression1.setText(r.getExpression1()); expression1.addModifyListener(e -> r.setExpression1(expression1.getText())); Text expression2 = new Text(parent, SWT.NONE); expression2.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); expression2.setText(r.getExpression2()); expression2.addModifyListener(e -> r.setExpression2(expression2.getText())); int index = 0; for (AggOp op : aggregateOperators) { aggOps.add(op.getName()); if (op.getName().equals(r.getAggOpName())) { aggOps.select(index); setRowVisibility(index, expression1, expression2); } index++; } aggOps.addModifyListener(e -> { int selected = aggOps.getSelectionIndex(); r.setAggOpName(aggOps.getText()); setRowVisibility(selected, expression1, expression2); }); }
Example 9
Source File: AbstractDominoWizardPanel.java From XPagesExtensionLibrary with Apache License 2.0 | 5 votes |
protected void createDSNameArea(){ createLabel("Da&ta source name:", createSpanGD(getNumRightColumns() - 2)); // $NLX-AbstractDominoWizardPanel.Datasourcename-1$ _nameText = createDCTextComputed(XSPAttributeNames.XSP_ATTR_VAR, createControlGDBigWidth(getNumRightColumns() - 2)); _nameText.setIsComputable(false); _nameText.setValidator(new UniqueXmlNameValidator(_data.getNode(), XSPAttributeNames.XSP_ATTR_VAR, "Data source name", !isPropsPanel() && !isNewDesignElementDialog())); // $NLX-AbstractDominoWizardPanel.Datasourcename.1-1$ final Combo viewCombo = getDesignElementPicker(); if (viewCombo != null) { _lastViewName = viewCombo.getText(); viewCombo.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { // delay a second before setting input to make sure the user // is done typing. _currentTime = System.currentTimeMillis(); Display.getCurrent().timerExec(1500, new Runnable() { public void run() { if (!isDisposed() && (System.currentTimeMillis() - _currentTime >= 1400)) { // more robust with -100ms from delay if (_lastViewName != null && !_lastViewName.equals(viewCombo.getText())) { _lastViewName = viewCombo.getText(); if (!ComputedValueUtils.isStringComputed(_lastViewName)) { // _responsesViewer.setInput(getViewAttrInput()); } } } } }); } }); } String tip = "Use the data source name when referring to this data source\nprogrammatically. Use caution when changing this name."; // $NLX-AbstractDominoWizardPanel.Usethedatasourcenamewhenreferring-1$ _nameText.setToolTipText(tip); _nameText.getEditorControl().setToolTipText(tip); if(isPropsPanel()) { Label separator = new Label(getCurrentParent(), SWT.SEPARATOR | SWT.HORIZONTAL); GridData sep = SWTLayoutUtils.createGDFillHorizontal(); sep.horizontalSpan = 2; sep.verticalIndent = 7; separator.setLayoutData(sep); } }
Example 10
Source File: AbstractWizardNewTypeScriptProjectCreationPage.java From typescript.java with MIT License | 5 votes |
/** Creates the field for the embedded Node.js. */ private void createEmbeddedNodejsField(Composite parent, IEmbeddedNodejs[] installs) { useEmbeddedNodeJsButton = new Button(parent, SWT.RADIO); useEmbeddedNodeJsButton .setText(TypeScriptUIMessages.AbstractWizardNewTypeScriptProjectCreationPage_useEmbeddedNodeJs_label); useEmbeddedNodeJsButton.addListener(SWT.Selection, nodeJsStatusChanged()); embeddedNodeJs = new Combo(parent, SWT.READ_ONLY); embeddedNodeJs.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); // Create combo of embedded node.js String[] values = new String[installs.length]; String[] valueLabels = new String[installs.length]; int i = 0; for (IEmbeddedNodejs install : installs) { values[i] = install.getId(); valueLabels[i] = install.getName(); i++; } embeddedNodeJs.setItems(valueLabels); embeddedNodeJs.setFont(JFaceResources.getDialogFont()); embeddedNodeJs.addListener(SWT.Modify, nodeJsStatusChanged()); embeddedNodeJs.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { embeddedNodeJsId = embeddedNodeJs.getText(); } }); }
Example 11
Source File: ListenerAppender.java From ermasterr with Apache License 2.0 | 5 votes |
public static void addComboListener(final Combo combo, final AbstractDialog dialog, final boolean imeOn) { addFocusListener(combo, imeOn); if (dialog != null) { combo.addModifyListener(new ModifyListener() { @Override public void modifyText(final ModifyEvent e) { dialog.validate(); } }); } }
Example 12
Source File: NewDiagramWizardPage2.java From ermasterr with Apache License 2.0 | 5 votes |
@Override public void createControl(final Composite parent) { final Composite composite = new Composite(parent, SWT.NULL); final GridLayout layout = new GridLayout(); layout.numColumns = 2; composite.setLayout(layout); final Label label = new Label(composite, SWT.NULL); label.setText(ResourceString.getResourceString("label.database")); databaseCombo = new Combo(composite, SWT.BORDER | SWT.READ_ONLY); final GridData dbData = new GridData(GridData.FILL_HORIZONTAL); dbData.widthHint = 200; databaseCombo.setLayoutData(dbData); databaseCombo.setVisibleItemCount(10); for (final String db : DBManagerFactory.getAllDBList()) { databaseCombo.add(db); } databaseCombo.addModifyListener(new ModifyListener() { @Override public void modifyText(final ModifyEvent e) { validatePage(); } }); databaseCombo.setFocus(); validatePage(); setControl(composite); }
Example 13
Source File: FlutterLaunchConfigTab.java From dartboard with Eclipse Public License 2.0 | 5 votes |
@Override public void createControl(Composite parent) { Composite comp = new Group(parent, SWT.NONE); setControl(comp); GridLayoutFactory.swtDefaults().numColumns(2).applyTo(comp); Label labelProject = new Label(comp, SWT.NONE); labelProject.setText(Messages.Launch_Project); GridDataFactory.swtDefaults().applyTo(labelProject); comboProject = new Combo(comp, SWT.READ_ONLY | SWT.DROP_DOWN); for (IProject project : getProjectsInWorkspace()) { comboProject.add(project.getName()); } GridDataFactory.fillDefaults().grab(true, false).applyTo(comboProject); comboProject.addModifyListener(event -> updateLaunchConfigurationDialog()); Label labelSdkLocation = new Label(comp, SWT.NONE); labelSdkLocation.setText(Messages.Preference_SDKLocation_Dart); GridDataFactory.swtDefaults().applyTo(labelSdkLocation); textSdkLocation = new Text(comp, SWT.BORDER); textSdkLocation.setMessage("SDK Location"); GridDataFactory.fillDefaults().grab(true, false).applyTo(textSdkLocation); textSdkLocation.addModifyListener(event -> updateLaunchConfigurationDialog()); createPageSpecificControls(comp); }
Example 14
Source File: LaunchConfigTab.java From dartboard with Eclipse Public License 2.0 | 5 votes |
@Override public void createControl(Composite parent) { Composite comp = new Group(parent, SWT.NONE); setControl(comp); GridLayoutFactory.swtDefaults().numColumns(2).applyTo(comp); Label labelProject = new Label(comp, SWT.NONE); labelProject.setText(Messages.Launch_Project); GridDataFactory.swtDefaults().applyTo(labelProject); comboProject = new Combo(comp, SWT.READ_ONLY | SWT.DROP_DOWN); for (IProject project : getProjectsInWorkspace()) { comboProject.add(project.getName()); } GridDataFactory.fillDefaults().grab(true, false).applyTo(comboProject); comboProject.addModifyListener(event -> updateLaunchConfigurationDialog()); Label labelSdkLocation = new Label(comp, SWT.NONE); labelSdkLocation.setText(Messages.Preference_SDKLocation_Dart); GridDataFactory.swtDefaults().applyTo(labelSdkLocation); textSdkLocation = new Text(comp, SWT.BORDER); textSdkLocation.setMessage(Messages.Launch_SDKLocation_Message); GridDataFactory.fillDefaults().grab(true, false).applyTo(textSdkLocation); textSdkLocation.addModifyListener(event -> updateLaunchConfigurationDialog()); Label labelMainClass = new Label(comp, SWT.NONE); labelMainClass.setText(Messages.Launch_MainClass); GridDataFactory.swtDefaults().applyTo(labelMainClass); textMainClass = new Text(comp, SWT.BORDER); textMainClass.setMessage(Messages.Launch_MainClass_Message); GridDataFactory.fillDefaults().grab(true, false).applyTo(textMainClass); textMainClass.addModifyListener(event -> updateLaunchConfigurationDialog()); }
Example 15
Source File: LogLevelSelectionDialog.java From codewind-eclipse with Eclipse Public License 2.0 | 4 votes |
protected Control createDialogArea(Composite parent) { setTitleImage(CodewindUIPlugin.getImage(CodewindUIPlugin.CODEWIND_BANNER)); setTitle(Messages.LogLevelDialogTitle); setMessage(Messages.LogLevelDialogMessage); final Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight = 11; layout.marginWidth = 9; layout.horizontalSpacing = 5; layout.verticalSpacing = 7; layout.numColumns = 2; composite.setLayout(layout); GridData data = new GridData(GridData.FILL_BOTH); data.widthHint = 200; composite.setLayoutData(data); composite.setFont(parent.getFont()); Label label = new Label(composite, SWT.NONE); label.setText(Messages.LogLevelDialogLogLabel); initLevels(); Combo logLevelCombo = new Combo(composite, SWT.READ_ONLY); logLevelCombo.setItems(levelLabels.toArray(new String[levelLabels.size()])); logLevelCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); logLevelCombo.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent event) { int index = logLevelCombo.getSelectionIndex(); if (index >= 0) selectedLevel = levelList.get(index); } }); // Add Context Sensitive Help PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, CodewindUIPlugin.MAIN_CONTEXTID); if (currentLevel >= 0) { logLevelCombo.select(currentLevel); } logLevelCombo.setFocus(); return composite; }
Example 16
Source File: AddOrEditElementOfXmlConvertDialog.java From translationstudio8 with GNU General Public License v2.0 | 4 votes |
@Override protected Control createDialogArea(Composite parent) { Composite tparent = (Composite) super.createDialogArea(parent); GridDataFactory.fillDefaults().grab(true, true).applyTo(tparent); Composite composite = new Composite(tparent, SWT.NONE); GridDataFactory.fillDefaults().grab(true, true).applyTo(composite); GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(false).applyTo(composite); // 元素类型下拉框的值, 备注:不能本地化 String[] typeValues = { "segment", "inline", "ignore" }; // 内联类型下拉框的值, 备注:不能本地化 String[] internalValues = { "", "image", "pb", "lb", "x-bold", "x-entry", "x-font", "x-italic", "x-link", "x-underlined", "x-other" }; // 保留空格下拉框的值, 备注:不能本地化 String[] remainSpaceVlaues = { "", "yes", "no" }; GridData textData = new GridData(SWT.FILL, SWT.CENTER, true, false); textData.widthHint = 100; // 元素名称 Label nameLbl = new Label(composite, SWT.NONE); nameLbl.setText(Messages.getString("dialogs.AddOrEditElementOfXmlConvertDialog.nameLbl")); nameLbl.setAlignment(SWT.RIGHT); GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).grab(false, false).applyTo(nameLbl); nameTxt = new Text(composite, SWT.BORDER); nameTxt.setLayoutData(textData); // 元素类型 Label typeLbl = new Label(composite, SWT.NONE); typeLbl.setText(Messages.getString("dialogs.AddOrEditElementOfXmlConvertDialog.typeLbl")); GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).grab(false, false).applyTo(typeLbl); typeCmb = new Combo(composite, SWT.BORDER | SWT.READ_ONLY); typeCmb.setLayoutData(textData); typeCmb.setItems(typeValues); typeCmb.select(0); // 内联类型 Label inlineLbl = new Label(composite, SWT.NONE); inlineLbl.setText(Messages.getString("dialogs.AddOrEditElementOfXmlConvertDialog.inlineLbl")); GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).grab(false, false).applyTo(inlineLbl); inlineCmb = new Combo(composite, SWT.BORDER | SWT.READ_ONLY); inlineCmb.setLayoutData(textData); inlineCmb.setItems(internalValues); inlineCmb.setEnabled(false); // 可翻译属性 Label transAttriLbl = new Label(composite, SWT.NONE); transAttriLbl.setText(Messages.getString("dialogs.AddOrEditElementOfXmlConvertDialog.transAttriLbl")); GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).grab(false, false).applyTo(transAttriLbl); transAtrriTxt = new Text(composite, SWT.BORDER); transAtrriTxt.setLayoutData(textData); // 保留空格 Label remainSpaceLbl = new Label(composite, SWT.NONE); remainSpaceLbl.setText(Messages.getString("dialogs.AddOrEditElementOfXmlConvertDialog.remainSpaceLbl")); GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).grab(false, false).applyTo(remainSpaceLbl); remainSpaceCmb = new Combo(composite, SWT.BORDER | SWT.READ_ONLY); remainSpaceCmb.setLayoutData(textData); remainSpaceCmb.setItems(remainSpaceVlaues); // 当元素类型是segment时,禁用内联内型,当元素类型是inline时,禁用可翻译属性。当元素类型是ignore时,禁用可翻译属性与内联内型 typeCmb.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { String type = typeCmb.getText(); if ("segment".equals(type)) { inlineCmb.setText(""); inlineCmb.setEnabled(false); transAtrriTxt.setEnabled(true); } else if ("inline".equals(type)) { inlineCmb.setEnabled(true); transAtrriTxt.setText(""); transAtrriTxt.setEnabled(false); } else if ("ignore".equals(type)) { inlineCmb.setText(""); inlineCmb.setEnabled(false); transAtrriTxt.setText(""); transAtrriTxt.setEnabled(false); } } }); return tparent; }
Example 17
Source File: AddOrEditElementOfXmlConvertDialog.java From tmxeditor8 with GNU General Public License v2.0 | 4 votes |
@Override protected Control createDialogArea(Composite parent) { Composite tparent = (Composite) super.createDialogArea(parent); GridDataFactory.fillDefaults().grab(true, true).applyTo(tparent); Composite composite = new Composite(tparent, SWT.NONE); GridDataFactory.fillDefaults().grab(true, true).applyTo(composite); GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(false).applyTo(composite); // 元素类型下拉框的值, 备注:不能本地化 String[] typeValues = { "segment", "inline", "ignore" }; // 内联类型下拉框的值, 备注:不能本地化 String[] internalValues = { "", "image", "pb", "lb", "x-bold", "x-entry", "x-font", "x-italic", "x-link", "x-underlined", "x-other" }; // 保留空格下拉框的值, 备注:不能本地化 String[] remainSpaceVlaues = { "", "yes", "no" }; GridData textData = new GridData(SWT.FILL, SWT.CENTER, true, false); textData.widthHint = 100; // 元素名称 Label nameLbl = new Label(composite, SWT.NONE); nameLbl.setText(Messages.getString("dialogs.AddOrEditElementOfXmlConvertDialog.nameLbl")); nameLbl.setAlignment(SWT.RIGHT); GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).grab(false, false).applyTo(nameLbl); nameTxt = new Text(composite, SWT.BORDER); nameTxt.setLayoutData(textData); // 元素类型 Label typeLbl = new Label(composite, SWT.NONE); typeLbl.setText(Messages.getString("dialogs.AddOrEditElementOfXmlConvertDialog.typeLbl")); GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).grab(false, false).applyTo(typeLbl); typeCmb = new Combo(composite, SWT.BORDER | SWT.READ_ONLY); typeCmb.setLayoutData(textData); typeCmb.setItems(typeValues); typeCmb.select(0); // 内联类型 Label inlineLbl = new Label(composite, SWT.NONE); inlineLbl.setText(Messages.getString("dialogs.AddOrEditElementOfXmlConvertDialog.inlineLbl")); GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).grab(false, false).applyTo(inlineLbl); inlineCmb = new Combo(composite, SWT.BORDER | SWT.READ_ONLY); inlineCmb.setLayoutData(textData); inlineCmb.setItems(internalValues); inlineCmb.setEnabled(false); // 可翻译属性 Label transAttriLbl = new Label(composite, SWT.NONE); transAttriLbl.setText(Messages.getString("dialogs.AddOrEditElementOfXmlConvertDialog.transAttriLbl")); GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).grab(false, false).applyTo(transAttriLbl); transAtrriTxt = new Text(composite, SWT.BORDER); transAtrriTxt.setLayoutData(textData); // 保留空格 Label remainSpaceLbl = new Label(composite, SWT.NONE); remainSpaceLbl.setText(Messages.getString("dialogs.AddOrEditElementOfXmlConvertDialog.remainSpaceLbl")); GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).grab(false, false).applyTo(remainSpaceLbl); remainSpaceCmb = new Combo(composite, SWT.BORDER | SWT.READ_ONLY); remainSpaceCmb.setLayoutData(textData); remainSpaceCmb.setItems(remainSpaceVlaues); // 当元素类型是segment时,禁用内联内型,当元素类型是inline时,禁用可翻译属性。当元素类型是ignore时,禁用可翻译属性与内联内型 typeCmb.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { String type = typeCmb.getText(); if ("segment".equals(type)) { inlineCmb.setText(""); inlineCmb.setEnabled(false); transAtrriTxt.setEnabled(true); } else if ("inline".equals(type)) { inlineCmb.setEnabled(true); transAtrriTxt.setText(""); transAtrriTxt.setEnabled(false); } else if ("ignore".equals(type)) { inlineCmb.setText(""); inlineCmb.setEnabled(false); transAtrriTxt.setText(""); transAtrriTxt.setEnabled(false); } } }); return tparent; }
Example 18
Source File: MessageEventTypeSelectionGridPropertySectionContribution.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
/** * @param aTabbedPropertySheetPage * @param parent */ private void createEventSelectionCombo(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) { combo = new Combo(parent, SWT.READ_ONLY); combo.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); combo.add(MESSAGE_EVENT_TYPE__START); combo.add(MESSAGE_EVENT_TYPE__INTERMEDIATE_THROW); combo.add(MESSAGE_EVENT_TYPE__INTERMEDIATE_CATCH); combo.add(MESSAGE_EVENT_TYPE__END); combo.addModifyListener(new ModifyListener() { /** * @return */ private EClass getTargetEClass() { if (combo.getText().equals(MESSAGE_EVENT_TYPE__INTERMEDIATE_CATCH)) { return ProcessPackage.Literals.INTERMEDIATE_CATCH_MESSAGE_EVENT; } else if (combo.getText().equals(MESSAGE_EVENT_TYPE__START)) { return ProcessPackage.Literals.START_MESSAGE_EVENT; } else if (combo.getText().equals(MESSAGE_EVENT_TYPE__INTERMEDIATE_THROW)) { return ProcessPackage.Literals.INTERMEDIATE_THROW_MESSAGE_EVENT; } else if (combo.getText().equals(MESSAGE_EVENT_TYPE__END)) { return ProcessPackage.Literals.END_MESSAGE_EVENT; } return ProcessPackage.Literals.INTERMEDIATE_CATCH_MESSAGE_EVENT; } /** * @return */ private boolean toBeConverted() { return !event.eClass().equals(getTargetEClass()); } public void modifyText(ModifyEvent e) { if (toBeConverted()) { EClass targetEClass = getTargetEClass(); IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() .getActiveEditor(); if (editor instanceof ProcessDiagramEditor) { node = (GraphicalEditPart) ((IStructuredSelection) ((ProcessDiagramEditor) editor) .getDiagramGraphicalViewer().getSelection()).getFirstElement(); GMFTools.convert(targetEClass, node, new BonitaNodesElementTypeResolver(), GMFTools.PROCESS_DIAGRAM); tabbedPropertySheetPage.selectionChanged(editor, ((IStructuredSelection) ((ProcessDiagramEditor) editor).getDiagramGraphicalViewer() .getSelection())); } } } }); }
Example 19
Source File: NewExtensionWizardPage.java From hybris-commerce-eclipse-plugin with Apache License 2.0 | 3 votes |
/** * Creates {@link Combo} element for page container * * @param container * container for which element is set * @param label * label for the GUI element * @param guiElement * {@link Combo} to be prepared * @return {@link Text} */ private Combo prepareComboGUI(Composite container, String labelText, int horizontalSpan) { Label label = new Label(container, SWT.READ_ONLY); label.setText(labelText); Combo guiElement = new Combo(container, SWT.BORDER | SWT.SINGLE); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = horizontalSpan; guiElement.setLayoutData(gd); guiElement.addModifyListener( e -> dialogChanged()); return guiElement; }