org.eclipse.swt.events.ModifyListener Java Examples

The following examples show how to use org.eclipse.swt.events.ModifyListener. 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: INSDComponentPage.java    From uima-uimaj with Apache License 2.0 6 votes vote down vote up
/**
 * Adds the text field.
 *
 * @param parent the parent
 * @param strLabel the str label
 * @param strText the str text
 * @param editable the editable
 * @return the text
 */
public Text addTextField(Composite parent, String strLabel, String strText, boolean editable) {
  Label label = new Label(parent, SWT.NULL);
  label.setText(strLabel);

  Text text = new Text(parent, SWT.BORDER | SWT.SINGLE);
  text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  text.setText(strText);
  text.addModifyListener(new ModifyListener() {
    @Override
    public void modifyText(ModifyEvent e) {
      dialogChanged();
    }
  });
  text.setEditable(editable);
  return text;
}
 
Example #2
Source File: CellEditorGlobalActionHanlder.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Add a <code>Text</code> control to the handler so that the Cut, Copy, Paste, Delete, Undo, Redo and Select All
 * actions are redirected to it when active.
 * @param viewer
 *            the inline <code>Text</code> control
 */
public void addTextViewer(CellEditorTextViewer viewer) {
	if (viewer == null) {
		return;
	}
	this.viewer = viewer;
	StyledText textControl = viewer.getTextWidget();

	viewer.addSelectionChangedListener(new ISelectionChangedListener() {
		public void selectionChanged(SelectionChangedEvent event) {
			updateActionsEnableState();
		}
	});

	textControl.addModifyListener(new ModifyListener() {
		public void modifyText(ModifyEvent e) {
			updateActionsEnableState();
		}
	});

	updateActionsEnableState();
}
 
Example #3
Source File: DataSetComputedColumnsPage.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * 
 * @param parent
 * @param index
 */
private void createTextCell( Composite parent, final int index )
{
	firstLabel = ControlProvider.createLabel( parent,
			dialogLabels[index] );
	this.maxWidth = computeMaxWidth( firstLabel );

	txtColumnName = ControlProvider.createText( parent,
			(String) getProperty( getStructureOrHandle( ),
					cellProperties[index] ) );
	txtColumnName.setLayoutData( ControlProvider.getGridDataWithHSpan( 2 ) );
	columnName = txtColumnName.getText( );
	txtColumnName.addModifyListener( new ModifyListener( ) {

		public void modifyText( ModifyEvent e )
		{
			validateSyntax( );
		}
	} );
}
 
Example #4
Source File: AuthComposite.java    From hop with Apache License 2.0 6 votes vote down vote up
public AuthComposite( Composite composite, int style, PropsUi props, ModifyListener lsMod, PipelineMeta pipelineMeta,
                      String credentialGroupName, String usernameLabel, String passwordLabel ) {
  super( composite, style );
  checkNotNull( props );
  checkNotNull( lsMod );
  checkNotNull( pipelineMeta );

  this.props = props;
  this.lsMod = lsMod;
  this.pipelineMeta = pipelineMeta;

  this.authGroupLabel = credentialGroupName;
  this.usernameLabel = usernameLabel;
  this.passwordLabel = passwordLabel;

  layoutComposite();
}
 
Example #5
Source File: SdkToolsControlAddDialog.java    From xds-ide with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void createControl(Composite parent) {
    initializeDialogUnits(parent);
    Composite container = new Composite(parent, SWT.NULL);
    setControl(container);

    container.setLayout(new GridLayout(2, false));

    SWTFactory.createVerticalSpacer(container, 2.0);
    SWTFactory.createLabel(container, Messages.SdkToolsControlAddDialog_GroupName + ':', 1);
    text = SWTFactory.createSingleText(container,  1);
    text.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
            validatePage();
        }
    });
    
    text.setText(groupName);
    text.setFocus();
    validatePage();
}
 
Example #6
Source File: AddCmakeUndefineDialog.java    From cmake4eclipse with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Create contents of the dialog.
 *
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
  Composite comp = (Composite) super.createDialogArea(parent);
  ((GridLayout) comp.getLayout()).numColumns = 2;

  Label nameLabel = new Label(comp, SWT.NONE);
  nameLabel.setText("Variable &name:");
  GridData gd_nameLabel = new GridData();
  gd_nameLabel.horizontalAlignment = SWT.LEFT;
  nameLabel.setLayoutData(gd_nameLabel);

  variableName = new Text(comp, SWT.BORDER);
  // disable OK button if variable name is empty..
  variableName.addModifyListener(new ModifyListener() {
    public void modifyText(ModifyEvent e) {
      final boolean enable = ((Text) e.widget).getText().trim().length() > 0;
      final Button button = getButton(IDialogConstants.OK_ID);
      button.setEnabled(enable);
    }
  });
  variableName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

  return comp;
}
 
Example #7
Source File: IngresVectorwiseLoaderDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
/**
 * @param parent
 * @param in
 * @param tr
 * @param sname
 */
public IngresVectorwiseLoaderDialog( Shell parent, Object in, TransMeta tr, String sname ) {
  super( parent, (BaseStepMeta) in, tr, sname );
  input = (IngresVectorwiseLoaderMeta) in;

  lsMod = new ModifyListener() {
    public void modifyText( ModifyEvent e ) {
      input.setChanged();
    }
  };

  lsSelMod = new SelectionAdapter() {
    public void widgetSelected( SelectionEvent arg0 ) {
      input.setChanged();
    }
  };
}
 
Example #8
Source File: MeasureDialog.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
private void createFilterPart( Composite composite )
{
    new Label( composite, SWT.NONE ).setText( Messages.getString( "MeasureDialog.Label.Filter" ) ); //$NON-NLS-1$
    txtFilter = new Text( composite, SWT.BORDER | SWT.MULTI );
    GridData gd = new GridData( GridData.FILL_HORIZONTAL );
    gd.heightHint = txtFilter.computeSize( SWT.DEFAULT, SWT.DEFAULT ).y - txtFilter.getBorderWidth( ) * 2;
    gd.horizontalSpan = 1;
    txtFilter.setLayoutData( gd );

    txtFilter.addModifyListener( new ModifyListener( ) {

        public void modifyText( ModifyEvent arg0 )
        {
            checkOkButtonStatus( );
        }
    } );
    ExpressionButtonUtil.createExpressionButton( composite,
            txtFilter,
            provider,
            input );        
}
 
Example #9
Source File: StringDialogField.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates or returns the created text control.
 * @param parent The parent composite or <code>null</code> when the widget has
 * already been created.
 * @return the text control
 */
public Text getTextControl(Composite parent) {
	if (fTextControl == null) {
		assertCompositeNotNull(parent);
		fModifyListener= new ModifyListener() {
			public void modifyText(ModifyEvent e) {
				doModifyText();
			}
		};

		fTextControl= createTextControl(parent);
		// moved up due to 1GEUNW2
		fTextControl.setText(fText);
		fTextControl.setFont(parent.getFont());
		fTextControl.addModifyListener(fModifyListener);

		fTextControl.setEnabled(isEnabled());
		if (fContentAssistProcessor != null) {
		    ControlContentAssistHelper.createTextContentAssistant(fTextControl, fContentAssistProcessor);
		}
	}
	return fTextControl;
}
 
Example #10
Source File: InstallNpmDependencyDialog.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
private void createNameArea(Composite parent, String areaName, Consumer<String> textHandler) {
	final Group area = new Group(parent, SHADOW_ETCHED_IN);
	area.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).create());
	area.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
	area.setText(areaName);

	final Text txtPackageName = getSimpleTextArea(area);
	txtPackageName.addModifyListener(new ModifyListener() {

		@Override
		public void modifyText(ModifyEvent e) {
			Text textWidget = (Text) e.getSource();
			textHandler.accept(textWidget.getText());
		}
	});
}
 
Example #11
Source File: CommitSetDialog.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
private void createNameArea(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
layout.marginWidth = 0;
layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
layout.numColumns = 2;
composite.setLayout(layout);
composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
composite.setFont(parent.getFont());

Label label = new Label(composite, SWT.NONE);
label.setText(Policy.bind("CommitSetDialog_0")); 
label.setLayoutData(new GridData(GridData.BEGINNING));

nameText = new Text(composite, SWT.BORDER);
nameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
      nameText.addModifyListener(new ModifyListener() {
          public void modifyText(ModifyEvent e) {
              updateEnablements();
          }
      });
  }
 
Example #12
Source File: ManageJarDialog.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void createSearchText(final Composite composite) {
    searchText = new Text(composite, SWT.SEARCH | SWT.ICON_SEARCH | SWT.BORDER | SWT.CANCEL);
    searchText.setMessage(Messages.search);
    searchText.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());

    searchFilter = new ViewerFilter() {

        @Override
        public boolean select(final Viewer arg0, final Object arg1, final Object element) {
            if (!searchText.getText().isEmpty()) {
                final String searchQuery = searchText.getText().toLowerCase();
                final IRepositoryFileStore file = (IRepositoryFileStore) element;
                return file.getName().toLowerCase().contains(searchQuery);
            }
            return true;
        }
    };

    searchText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(final ModifyEvent e) {
            tableViewer.refresh();
        }
    });
}
 
Example #13
Source File: CodewindPrefsParentPage.java    From codewind-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
private Text createCWTimeoutEntry(Composite comp, String label, String prefKey) {
    Label timeoutLabel = new Label(comp, SWT.NONE);
    timeoutLabel.setText(label);
    timeoutLabel.setLayoutData(new GridData(GridData.BEGINNING, GridData.FILL, false, false));
    
    Text text = new Text(comp, SWT.BORDER);
    text.setText(Integer.toString(prefs.getInt(prefKey)));
    GridData data = new GridData(GridData.BEGINNING, GridData.FILL, false, false);
	data.widthHint = 50;
	text.setLayoutData(data);
	
	text.addModifyListener(new ModifyListener() {
		@Override
		public void modifyText(ModifyEvent arg0) {
			validate();
		}
	});
	
    return text;
}
 
Example #14
Source File: LoginDialog.java    From offspring with MIT License 6 votes vote down vote up
private void setupControls() {
  buttonBrowse.addSelectionListener(new SelectionAdapter() {

    @Override
    public void widgetSelected(SelectionEvent event) {
      FileDialog fd = new FileDialog(getShell(), SWT.SAVE);
      fd.setText(Messages.LoginDialog_FileDialog_title);
      String path = fd.open();
      if (path != null) {
        updateWalletPath(path);
      }
    };
  });

  ModifyListener listener = new ModifyListener() {

    @Override
    public void modifyText(ModifyEvent e) {
      updateDialogButtons();
    }
  };
  textPassword.addModifyListener(listener);
  textPassword2.addModifyListener(listener);
}
 
Example #15
Source File: WSO2UIToolkit.java    From developer-studio with Apache License 2.0 5 votes vote down vote up
public void setOnAction(IOnAction action) {
	super.setOnAction(action);
	getControl().addModifyListener(new ModifyListener() {

		public void modifyText(ModifyEvent arg0) {
			getOnAction().onModifyAction();

		}

	});
}
 
Example #16
Source File: UIUtil.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Create "BIRT_VIEWER_WORKING_FOLDER" configuration group
 * 
 * @param composite
 */
public Text createWorkingFolderGroup( Composite parent )
{
	Text txtWorkingFolder = null;

	// create folder selection group
	FolderSelectionGroup group = new FolderSelectionGroup( );
	group.setLabelText( BirtWTPMessages.BIRTConfiguration_working_label );
	group.setButtonText( BirtWTPMessages.BIRTConfiguration_working_folder_button_text );
	group.setDialogTitle( BirtWTPMessages.BIRTConfiguration_working_dialog_title );
	group.setDialogMessage( BirtWTPMessages.BIRTConfiguration_working_dialog_message );

	// set default value
	group.setTextValue( DataUtil.getString(
			WebArtifactUtil.getContextParamValue( properties,
					BIRT_WORKING_FOLDER_SETTING ), false ) );

	group.create( parent );
	txtWorkingFolder = group.getText( );

	// add modify listener
	txtWorkingFolder.addModifyListener( new ModifyListener( ) {

		public void modifyText( ModifyEvent e )
		{
			WebArtifactUtil.setContextParamValue( properties,
					BIRT_WORKING_FOLDER_SETTING, ( (Text) e.getSource( ) )
							.getText( ) );
		}
	} );

	return txtWorkingFolder;
}
 
Example #17
Source File: CalendarCombo.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Removes a modification listener from the combo box.
 * 
 * @param ml ModifyListener
 */
public void removeModifyListener(ModifyListener ml) {
    checkWidget();
    if (isFlat) {
        mFlatCombo.removeModifyListener(ml);
    } else {
        mCombo.removeModifyListener(ml);
    }
}
 
Example #18
Source File: AbstractColumnDialog.java    From ermasterr with Apache License 2.0 5 votes vote down vote up
@Override
protected void addListener() {
    super.addListener();

    wordFilterText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(final ModifyEvent modifyevent) {
            final String filterString = wordFilterText.getText();
            initializeWordCombo(filterString);
        }

    });
}
 
Example #19
Source File: CalculatorComboSnippet.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
public static void main(final String[] args) {
	final Display display = new Display();
	final Shell shell = new Shell(display);
	shell.setLayout(new GridLayout(2, false));

	final Label label = new Label(shell, SWT.NONE);
	label.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));
	label.setText("Calculator combo:");

	final CalculatorCombo combo = new CalculatorCombo(shell, SWT.NONE);
	combo.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, true, false));

	combo.addModifyListener(new ModifyListener() {

		@Override
		public void modifyText(final ModifyEvent e) {
			System.out.println("New value is " + combo.getValue());

		}
	});

	shell.pack();
	shell.open();

	while (!shell.isDisposed()) {
		if (!display.readAndDispatch()) {
			display.sleep();
		}
	}
	display.dispose();
}
 
Example #20
Source File: UIUtil.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Create "BIRT_VIEWER_IMAGE_DIR" configuration group
 * 
 * @param composite
 */
public Text createImageFolderGroup( Composite parent )
{
	Text txtImageFolder = null;

	// create folder selection group
	FolderSelectionGroup group = new FolderSelectionGroup( );
	group.setLabelText( BirtWTPMessages.BIRTConfiguration_image_label );
	group.setButtonText( BirtWTPMessages.BIRTConfiguration_image_folder_button_text );
	group.setDialogTitle( BirtWTPMessages.BIRTConfiguration_image_dialog_title );
	group.setDialogMessage( BirtWTPMessages.BIRTConfiguration_image_dialog_message );

	// set default value
	group.setTextValue( DataUtil.getString( WebArtifactUtil
			.getContextParamValue( properties, BIRT_IMAGE_FOLDER_SETTING ),
			false ) );

	group.create( parent );
	txtImageFolder = group.getText( );

	// add modify listener
	txtImageFolder.addModifyListener( new ModifyListener( ) {

		public void modifyText( ModifyEvent e )
		{
			WebArtifactUtil.setContextParamValue( properties,
					BIRT_IMAGE_FOLDER_SETTING, ( (Text) e.getSource( ) )
							.getText( ) );
		}
	} );

	return txtImageFolder;
}
 
Example #21
Source File: ConversionWizardPage.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 创建分段规则选择组
 * @param contents
 *            ;
 */
private void createSegmentationGroup(Composite contents) {
	Group segmentation = new Group(contents, SWT.NONE);
	segmentation.setText(Messages.getString("wizard.ConversionWizardPage.segmentation")); //$NON-NLS-1$
	segmentation.setLayout(new GridLayout(3, false));
	GridData data = new GridData(GridData.FILL_HORIZONTAL);
	data.widthHint = 500;
	segmentation.setLayoutData(data);

	Label segLabel = new Label(segmentation, SWT.NONE);
	segLabel.setText(Messages.getString("wizard.ConversionWizardPage.segLabel")); //$NON-NLS-1$

	srxFile = new Text(segmentation, SWT.BORDER | SWT.READ_ONLY);
	srxFile.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	srxFile.addModifyListener(new ModifyListener() {
		public void modifyText(ModifyEvent e) {
			for (ConversionConfigBean conversionConfigBean : conversionConfigBeans) {
				conversionConfigBean.setInitSegmenter(srxFile.getText());
			}

			validate();
		}
	});

	final Button segBrowse = new Button(segmentation, SWT.PUSH);
	segBrowse.setText(Messages.getString("wizard.ConversionWizardPage.segBrowse")); //$NON-NLS-1$
	segBrowse.addSelectionListener(new SelectionAdapter() {
		public void widgetSelected(SelectionEvent arg0) {
			IConversionItemDialog conversionItemDialog = FileDialogFactoryFacade.createFileDialog(getShell(),
					SWT.NONE);
			int result = conversionItemDialog.open();
			if (result == IDialogConstants.OK_ID) {
				IConversionItem conversionItem = conversionItemDialog.getConversionItem();
				srxFile.setText(conversionItem.getLocation().toOSString());
			}
		}
	});
}
 
Example #22
Source File: ExtractVariableWizard.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void createControl(Composite parent) {
	Composite composite= new Composite(parent, SWT.NONE);
	GridLayout layout = new GridLayout(2, false);
	layout.verticalSpacing = 16;
	composite.setLayout(layout);
	composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
	composite.setFont(parent.getFont());

	Label label= new Label(composite, SWT.NONE);
	label.setText("Variable name:");
	label.setFont(composite.getFont());
	label.setLayoutData(new GridData());

	nameField= new Text(composite, SWT.BORDER);
	nameField.setText(refactoring.getVariableName());
	nameField.setFont(composite.getFont());
	nameField.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, false));
	nameField.addModifyListener(new ModifyListener() {
		@Override
		public void modifyText(ModifyEvent e) {
			validatePage();
		}
	});
	nameField.selectAll();
	
	finalButton = new Button(composite, SWT.CHECK);
	finalButton.setText("Declare as final 'val'");
	finalButton.setFont(composite.getFont());
	finalButton.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 2, 1));
	finalButton.setSelection(refactoring.isFinal());
	setControl(composite);
	validatePage();
}
 
Example #23
Source File: HsMultiCellEditorControl.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 当文本处于正在编辑时,实时进行拼写检查,<div style='color:red'>该方法与{@link #tgtTextFirstRealTimeSpellCheck} 类似</div>
 */
private static void tgtTextRealTimeSpellCheck(final String tgtLang, final HsMultiCellEditor targetEditor) {
	final StyledTextCellEditor tgtEditor = targetEditor.getCellEditor();
	final StyledText text = tgtEditor.getSegmentViewer().getTextWidget();
	if (tgtLang == null) {
		return;
	}
	text.addModifyListener(new ModifyListener() {
		public void modifyText(ModifyEvent e) {
			String tgtText = text.getText();

			if (tgtText.isEmpty()) {
				return;
			}

			String endStr = tgtText.substring(tgtText.length() - 1, tgtText.length());
			if (endStr.matches(ENDREGEX)) {
				List<SingleWord> errorWordList = new LinkedList<SingleWord>();
				errorWordList = spellTrigger.getErrorWords(tgtText, tgtLang);
				if (errorWordList != null && errorWordList.size() > 0) {
					targetEditor.highLightedErrorWord(tgtText, errorWordList);
				} else {
					targetEditor.refreshErrorWordsStyle(null);
				}
			}
		}
	});
}
 
Example #24
Source File: ListenerAppender.java    From erflute with Apache License 2.0 5 votes vote down vote up
public static void addModifyListener(final Text text, final AbstractDialog dialog) {
    text.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
            dialog.validate();
        }
    });
}
 
Example #25
Source File: ExpressionEditor.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected Control createDialogArea( Composite parent )
{
	Composite composite = (Composite) super.createDialogArea( parent );

	Composite container = new Composite( composite, SWT.NONE );
	GridLayout layout = new GridLayout( );
	layout.numColumns = 3;
	layout.verticalSpacing = 10;
	container.setLayout( layout );

	new Label( container, SWT.NONE ).setText( Messages.getString( "ExpressionEditor.Label.Expression" ) ); //$NON-NLS-1$
	exprText = new Text( container, SWT.BORDER | SWT.MULTI );
	GridData gd = new GridData( );
	gd.widthHint = 200;
	gd.heightHint = exprText.computeSize( SWT.DEFAULT, SWT.DEFAULT ).y
			- exprText.getBorderWidth( )
			* 2;
	exprText.setLayoutData( gd );
	exprText.addModifyListener( new ModifyListener( ) {

		public void modifyText( ModifyEvent e )
		{
			checkStatus( );
		}

	} );

	ExpressionButtonUtil.createExpressionButton( container,
			exprText,
			provider,
			contextObject,
			allowConstant,
			SWT.PUSH );

	ExpressionButtonUtil.initExpressionButtonControl( exprText, expression );

	UIUtil.bindHelp( parent, IHelpContextIds.EXPRESSION_EDITOR_ID );

	return composite;
}
 
Example #26
Source File: SamplePart.java    From e4Preferences with Eclipse Public License 1.0 5 votes vote down vote up
@PostConstruct
public void createComposite(Composite parent, @Preference(value = "prefColor") String colorKey)
{
	parent.setLayout(new GridLayout(1, false));

	txtInput = new Text(parent, SWT.BORDER);
	txtInput.setMessage("Enter text to mark part as dirty");
	txtInput.addModifyListener(new ModifyListener() {
		@Override
		public void modifyText(ModifyEvent e)
		{
			dirty.setDirty(true);
		}
	});
	txtInput.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

	tableViewer = new TableViewer(parent);

	tableViewer.add("Sample item 1");
	tableViewer.add("Sample item 2");
	tableViewer.add("Sample item 3");
	tableViewer.add("Sample item 4");
	tableViewer.add("Sample item 5");
	tableViewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
	
	reactOnPrefColorChange(colorKey);
}
 
Example #27
Source File: CancelBuyOrderWizard.java    From offspring with MIT License 5 votes vote down vote up
@Override
public Control createControl(Composite parent) {
  textQuantity = new Text(parent, SWT.BORDER);
  textQuantity.setText("0");
  textQuantity.addModifyListener(new ModifyListener() {

    @Override
    public void modifyText(ModifyEvent e) {
      requestVerification();
    }
  });
  return textQuantity;
}
 
Example #28
Source File: AbstractWizardNewTypeScriptProjectCreationPage.java    From typescript.java with MIT License 5 votes vote down vote up
/** 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 #29
Source File: HorizontalSpinner.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Add the modify listeners
 */
private void addModifyListeners() {
	text.addModifyListener(e -> {
		for (final ModifyListener m : modifyListeners) {
			m.modifyText(e);
		}
	});

}
 
Example #30
Source File: NewEdgeMatcherPage.java    From depan with Apache License 2.0 5 votes vote down vote up
@Override
public Composite createOptionsControl(Composite container) {
  Group result = new Group(container, SWT.NONE);
  result.setText("Edge Matcher Options");

  GridLayout grid = new GridLayout();
  grid.numColumns = 2;
  grid.verticalSpacing = 9;
  result.setLayout(grid);

  GridData fillHorz = new GridData(SWT.FILL, SWT.BEGINNING, true, false);

  // Row 1) Container selection
  Label label = new Label(result, SWT.NULL);
  label.setText("&Name:");

  nameText = new Text(result, SWT.BORDER | SWT.SINGLE);
  nameText.setLayoutData(fillHorz);
  nameText.addModifyListener(new ModifyListener() {

    @Override
    public void modifyText(ModifyEvent e) {
      updatePageStatus();
    }
  });

  return result;
}