org.eclipse.swt.events.ModifyEvent Java Examples

The following examples show how to use org.eclipse.swt.events.ModifyEvent. 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: CTextCellEditor.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Processes a modify event that occurred in this text cell editor. This
 * framework method performs validation and sets the error message
 * accordingly, and then reports a change via
 * <code>fireEditorValueChanged</code>. Subclasses should call this method
 * at appropriate times. Subclasses may extend or reimplement.
 * 
 * @param e
 *            the SWT modify event
 */
protected void editOccured( ModifyEvent e )
{
	String value = text.getText( );
	if ( value.equals( "" ) )
	{
		value = null;//$NON-NLS-1$
	}
	Object typedValue = value;
	boolean oldValidState = isValueValid( );
	boolean newValidState = isCorrect( typedValue );

	if ( !newValidState )
	{
		// try to insert the current value into the error message.
		setErrorMessage( MessageFormat.format( getErrorMessage( ),
				new Object[]{
					value
				} ) );
	}
	valueChanged( oldValidState, newValidState );
}
 
Example #2
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 #3
Source File: RenameElementWizard.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public void createControl(Composite parent) {
	Composite composite = new Composite(parent, SWT.NONE);
	composite.setLayout(new GridLayout(2, false));
	composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
	composite.setFont(parent.getFont());
	Label label = new Label(composite, SWT.NONE);
	label.setText("New name:");//$NON-NLS-1$
	label.setLayoutData(new GridData());
	nameField = new Text(composite, SWT.BORDER);

	nameField.setText(currentName);
	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();
	validatePage();
	setControl(composite);
}
 
Example #4
Source File: SamplePart.java    From codeexamples-eclipse with Eclipse Public License 1.0 6 votes vote down vote up
@PostConstruct
public void createComposite(Composite parent) {
	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));
}
 
Example #5
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 #6
Source File: JobEntryBaseDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
@Override
public void modifyText( ModifyEvent modifyEvent ) {
  ExecutorService executorService = ExecutorUtil.getExecutor();
  final String runConfiguration = jobMeta.environmentSubstitute( wRunConfiguration.getText() );
  executorService.submit( () -> {
    List<Object> items = Arrays.asList( runConfiguration, false );
    try {
      ExtensionPointHandler.callExtensionPoint( Spoon.getInstance().getLog(), KettleExtensionPoint
              .RunConfigurationSelection.id, items );
    } catch ( KettleException ignored ) {
      // Ignore errors
    }
    display.asyncExec( () -> {
      if ( (Boolean) items.get( IS_PENTAHO ) ) {
        wWaitingToFinish.setSelection( false );
        wWaitingToFinish.setEnabled( false );
      } else {
        wWaitingToFinish.setEnabled( true );
      }
    } );
  } );
}
 
Example #7
Source File: SamplePart.java    From codeexamples-eclipse with Eclipse Public License 1.0 6 votes vote down vote up
@PostConstruct
public void createComposite(Composite parent) {
	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.setContentProvider(ArrayContentProvider.getInstance());;
	tableViewer.setInput(createInitialDataModel());
	tableViewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
}
 
Example #8
Source File: TexlipseProjectPropertyPage.java    From texlipse with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Create project main file section of the page.
 * @param parent parent component
 */
private void addMainSection(Composite parent) {
    Composite composite = createDefaultComposite(parent, 2);

    //Label for path field
    Label pathLabel = new Label(composite, SWT.NONE);
    pathLabel.setText(TexlipsePlugin.getResourceString("propertiesMainFileLabel"));
    pathLabel.setLayoutData(new GridData());
    pathLabel.setToolTipText(TexlipsePlugin.getResourceString("propertiesMainFileTooltip"));
    
    // Path text field
    sourceFileField = new Text(composite, SWT.SINGLE | SWT.WRAP | SWT.BORDER);
    sourceFileField.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
    sourceFileField.setToolTipText(TexlipsePlugin.getResourceString("propertiesMainFileTooltip"));
    sourceFileField.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            validateSourceFileField();
        }});
}
 
Example #9
Source File: TexlipseProjectPropertyPage.java    From texlipse with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Create the temp dir section of the page.
 * @param parent parent component
 */
private void addTempDirSection(Composite parent) {
    Composite composite = createDefaultComposite(parent, 3);

    //Label for path field
    Label label = new Label(composite, SWT.NONE);
    label.setText(TexlipsePlugin.getResourceString("propertiesTempDirLabel"));
    label.setLayoutData(new GridData());
    label.setToolTipText(TexlipsePlugin.getResourceString("propertiesTempDirTooltip"));

    // Path text field
    tempDirField = new Text(composite, SWT.SINGLE | SWT.WRAP | SWT.BORDER);
    tempDirField.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
    tempDirField.setToolTipText(TexlipsePlugin.getResourceString("propertiesTempDirTooltip"));
    tempDirField.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            validateTempFileField();}});
}
 
Example #10
Source File: TexlipseProjectPropertyPage.java    From texlipse with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Create the bibRef dir section of the page.
 * @param parent parent component
 */
private void addBibRefDirSection(Composite parent) {
    Composite composite = createDefaultComposite(parent, 3);

    //Label for path field
    Label label = new Label(composite, SWT.NONE);
    label.setText(TexlipsePlugin.getResourceString("propertiesBibRefDirLabel"));
    label.setLayoutData(new GridData());
    label.setToolTipText(TexlipsePlugin.getResourceString("propertiesBibRefDirTooltip"));

    // Path text field
    bibRefDirField = new Text(composite, SWT.SINGLE | SWT.WRAP | SWT.BORDER);
    bibRefDirField.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
    bibRefDirField.setToolTipText(TexlipsePlugin.getResourceString("propertiesBibRefDirTooltip"));
    bibRefDirField.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            validateBibRefFileField();}});
}
 
Example #11
Source File: RichTextCellEditor.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Processes a modify event that occurred in this rich text cell editor. This framework method
 * performs validation and sets the error message accordingly, and then reports a change via
 * <code>fireEditorValueChanged</code>. Subclasses should call this method at appropriate times.
 * Subclasses may extend or reimplement.
 *
 * @param e
 *            the SWT modify event
 *
 * @see TextCellEditor
 */
protected void editOccured(ModifyEvent e) {
	String value = this.editor.getText();
	if (value == null) {
		value = "";//$NON-NLS-1$
	}
	Object typedValue = value;
	boolean oldValidState = isValueValid();
	boolean newValidState = isCorrect(typedValue);
	if (!newValidState) {
		// try to insert the current value into the error message.
		setErrorMessage(MessageFormat.format(getErrorMessage(),
				new Object[] { value }));
	}
	valueChanged(oldValidState, newValidState);
}
 
Example #12
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 #13
Source File: IntroduceParameterObjectWizard.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void createParameterNameInput(Group group) {
	Label l= new Label(group, SWT.NONE);
	l.setText(RefactoringMessages.IntroduceParameterObjectWizard_parameterfield_label);
	final Text text= new Text(group, SWT.BORDER);
	text.setText(fProcessor.getParameterName());
	text.addModifyListener(new ModifyListener() {

		public void modifyText(ModifyEvent e) {
			fProcessor.setParameterName(text.getText());
			updateSignaturePreview();
			validateRefactoring();
		}

	});
	text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
}
 
Example #14
Source File: TextVar.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
protected ModifyListener getModifyListenerTooltipText( final Text textField ) {
  return new ModifyListener() {
    public void modifyText( ModifyEvent e ) {
      if ( textField.getEchoChar() == '\0' ) { // Can't show passwords ;-)

        String tip = textField.getText();
        if ( !Utils.isEmpty( tip ) && !Utils.isEmpty( toolTipText ) ) {
          tip += Const.CR + Const.CR + toolTipText;
        }

        if ( Utils.isEmpty( tip ) ) {
          tip = toolTipText;
        }
        textField.setToolTipText( variables.environmentSubstitute( tip ) );
      }
    }
  };
}
 
Example #15
Source File: HadoopLocationWizard.java    From hadoop-gpu with Apache License 2.0 6 votes vote down vote up
public void modifyText(ModifyEvent e) {
  final Text text = (Text) e.widget;
  Object hProp = text.getData("hProp");
  final ConfProp prop = (hProp != null) ? (ConfProp) hProp : null;
  Object hPropName = text.getData("hPropName");
  final String propName =
      (hPropName != null) ? (String) hPropName : null;

  Display.getDefault().syncExec(new Runnable() {
    public void run() {
      if (prop != null)
        mediator.notifyChange(TabAdvanced.this, prop, text.getText());
      else
        mediator
            .notifyChange(TabAdvanced.this, propName, text.getText());
    }
  });
}
 
Example #16
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 #17
Source File: DataSetParametersPage.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
private void createNameCell( Composite parent, String lable )
{
	ControlProvider.createLabel( parent, lable );

	dataSetParamName = ControlProvider.createText( parent,
			structureHandle.getName( ) );
	dataSetParamName.setLayoutData( ControlProvider.getGridDataWithHSpan( 2 ) );
	dataSetParamName.addModifyListener( new ModifyListener( ) {

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

	} );
}
 
Example #18
Source File: StyledTextCellEditor.java    From statecharts with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Processes a modify event that occurred in this text cell editor. This
 * framework method performs validation and sets the error message
 * accordingly, and then reports a change via
 * <code>fireEditorValueChanged</code>. Subclasses should call this method
 * at appropriate times. Subclasses may extend or reimplement.
 * 
 * @param e
 *            the SWT modify event
 */
protected void editOccured(ModifyEvent e) {
	String value = text.getText();
	if (value == null) {
		value = "";//$NON-NLS-1$
	}
	Object typedValue = value;
	boolean oldValidState = isValueValid();
	boolean newValidState = isCorrect(typedValue);
	if (!newValidState) {
		// try to insert the current value into the error message.
		setErrorMessage(MessageFormat.format(getErrorMessage(),
				new Object[] { value }));
	}
	valueChanged(oldValidState, newValidState);
}
 
Example #19
Source File: OptionsConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void createFilterBox() {
	//TODO: Directly use the hint flags once Bug 293230 is fixed
	FilterTextControl filterTextControl= new FilterTextControl(fParentComposite);

	final Text filterBox= filterTextControl.getFilterControl();
	filterBox.setMessage(PreferencesMessages.OptionsConfigurationBlock_TypeFilterText);
	
	filterBox.addModifyListener(new ModifyListener() {
		private String fPrevFilterText;

		public void modifyText(ModifyEvent e) {
			String input= filterBox.getText();
			if (input != null && input.equalsIgnoreCase(fPrevFilterText))
				return;
			fPrevFilterText= input;
			doFilter(input);
		}
	});
}
 
Example #20
Source File: TypeCombo.java    From uima-uimaj with Apache License 2.0 6 votes vote down vote up
/**
 * 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 #21
Source File: WebAppHostPageSelectionDialog.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 6 votes vote down vote up
protected Control createExternalRootContentArea(Composite parent) {

    Composite c = SWTFactory.createComposite(parent, 1, 1,
        GridData.FILL_HORIZONTAL);
    SWTFactory.createLabel(c, "External server root:", 1);
    externalUrlPrefixText = SWTFactory.createSingleText(c, 1);
    externalUrlPrefixTextCache = WebAppProjectProperties.getLaunchConfigExternalUrlPrefix(project);
    externalUrlPrefixText.setText(externalUrlPrefixTextCache);
    externalUrlPrefixText.addModifyListener(new ModifyListener() {
      public void modifyText(ModifyEvent e) {
        externalUrlPrefixTextCache = externalUrlPrefixText.getText();
        updateUrlLabelText();
      }
    });

    return c;
  }
 
Example #22
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 #23
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 #24
Source File: SelectFirstMatchingPrefixListenerTest.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() {
  Event event = new Event();
  event.widget = mock(Widget.class);
  modifyEvent = new ModifyEvent(event);

  listener = new SelectFirstMatchingPrefixListener(combo);
  listener.setContents(elements);
}
 
Example #25
Source File: CreateDatabaseWizardPageODBC.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public void createControl( Composite parent ) {
  int margin = Const.MARGIN;
  int middle = props.getMiddlePct();

  // create the composite to hold the widgets
  Composite composite = new Composite( parent, SWT.NONE );
  props.setLook( composite );

  FormLayout compLayout = new FormLayout();
  compLayout.marginHeight = Const.FORM_MARGIN;
  compLayout.marginWidth = Const.FORM_MARGIN;
  composite.setLayout( compLayout );

  wlDSN = new Label( composite, SWT.RIGHT );
  wlDSN.setText( BaseMessages.getString( PKG, "CreateDatabaseWizardPageODBC.DSN.Label" ) );
  props.setLook( wlDSN );
  fdlDSN = new FormData();
  fdlDSN.left = new FormAttachment( 0, 0 );
  fdlDSN.right = new FormAttachment( middle, 0 );
  wlDSN.setLayoutData( fdlDSN );
  wDSN = new Text( composite, SWT.SINGLE | SWT.BORDER );
  props.setLook( wDSN );
  fdDSN = new FormData();
  fdDSN.left = new FormAttachment( middle, margin );
  fdDSN.right = new FormAttachment( 100, 0 );
  wDSN.setLayoutData( fdDSN );
  wDSN.addModifyListener( new ModifyListener() {
    public void modifyText( ModifyEvent arg0 ) {
      setPageComplete( false );
    }
  } );

  // set the composite as the control for this page
  setControl( composite );
}
 
Example #26
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 #27
Source File: XMLFormatterIndentationPage.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void createOptions(IFormatterControlManager manager, Composite parent)
{
	Group group = SWTFactory.createGroup(parent, Messages.XMLFormatterIndentationPage_generalGroupLabel, 2, 1,
			GridData.FILL_HORIZONTAL);
	final Combo tabOptions = manager.createCombo(group, XMLFormatterConstants.FORMATTER_TAB_CHAR,
			FormatterMessages.IndentationTabPage_general_group_option_tab_policy, tabOptionItems, tabOptionNames);
	final Text indentationSize = manager.createNumber(group, XMLFormatterConstants.FORMATTER_INDENTATION_SIZE,
			FormatterMessages.IndentationTabPage_general_group_option_indent_size, 1);
	final Text tabSize = manager.createNumber(group, XMLFormatterConstants.FORMATTER_TAB_SIZE,
			FormatterMessages.IndentationTabPage_general_group_option_tab_size, 1);
	tabSize.addModifyListener(new ModifyListener()
	{
		public void modifyText(ModifyEvent e)
		{
			int index = tabOptions.getSelectionIndex();
			if (index >= 0)
			{
				final boolean tabMode = CodeFormatterConstants.TAB.equals(tabOptionItems[index]);
				if (tabMode)
				{
					indentationSize.setText(tabSize.getText());
				}
			}
		}
	});
	new TabOptionHandler(manager, tabOptions, indentationSize, tabSize);

	group = SWTFactory.createGroup(parent, Messages.XMLFormatterIndentationPage_exclusionsLabel, 1, 1,
			GridData.FILL_BOTH);
	Label exclutionLabel = new Label(group, SWT.WRAP);
	exclutionLabel.setText(Messages.XMLFormatterIndentationPage_exclusionsMessageLabel);
	manager.createManagedList(group, XMLFormatterConstants.INDENT_EXCLUDED_TAGS);
}
 
Example #28
Source File: ConversionWizardPage.java    From tmxeditor8 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("ConversionWizardPage.10")); //$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("ConversionWizardPage.11")); //$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("ConversionWizardPage.12")); //$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 #29
Source File: RunOptionsDefaultsComponent.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
public void addModifyListener(ModifyListener listener) {
  projectInput.addSelectionChangedListener(new ISelectionChangedListener() {
    @Override
    public void selectionChanged(SelectionChangedEvent event) {
      Event dummy = new Event();
      dummy.widget = projectInput.getControl();
      listener.modifyText(new ModifyEvent(dummy));
    }
  });
  stagingLocationInput.addModifyListener(listener);
  serviceAccountKey.addModifyListener(listener);
}
 
Example #30
Source File: JavadocTreeWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
protected void createJavadocCommandSet(Composite composite) {

		final int numColumns= 2;

		GridLayout layout= createGridLayout(numColumns);
		layout.marginHeight= 0;
		layout.marginWidth= 0;
		Composite group = new Composite(composite, SWT.NONE);
		group.setLayoutData(createGridData(GridData.FILL_HORIZONTAL, 6, 0));
		group.setLayout(layout);

		createLabel(group, SWT.NONE, JavadocExportMessages.JavadocTreeWizardPage_javadoccommand_label, createGridData(GridData.HORIZONTAL_ALIGN_BEGINNING, numColumns, 0));
		fJavadocCommandText= createCombo(group, SWT.NONE, null, createGridData(GridData.FILL_HORIZONTAL, numColumns - 1, 0));

		fJavadocCommandText.addModifyListener(new ModifyListener() {
			public void modifyText(ModifyEvent e) {
				doValidation(JAVADOCSTATUS);
			}
		});

		final Button javadocCommandBrowserButton= createButton(group, SWT.PUSH, JavadocExportMessages.JavadocTreeWizardPage_javadoccommand_button_label, createGridData(GridData.HORIZONTAL_ALIGN_FILL, 1, 0));
		SWTUtil.setButtonDimensionHint(javadocCommandBrowserButton);

		javadocCommandBrowserButton.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent event) {
				browseForJavadocCommand();
			}
		});
	}