Java Code Examples for org.eclipse.swt.widgets.Button#setText()

The following examples show how to use org.eclipse.swt.widgets.Button#setText() . 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: HybridProjectImportPage.java    From thym with Eclipse Public License 1.0 6 votes vote down vote up
private void createOptionsGroup(Composite workArea) {
	final Group optionsGroup = new Group(workArea, SWT.NULL);
	optionsGroup.setText("Options:");
	GridLayoutFactory.fillDefaults().margins(10,10).applyTo(optionsGroup);
	GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.FILL).applyTo(optionsGroup);
	
	
	copyCheckbox = new Button(optionsGroup, SWT.CHECK);
	copyCheckbox.setText("Copy into workspace");
	GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL);
	copyCheckbox.addListener(SWT.Selection, new Listener() {
		@Override
		public void handleEvent(Event event) {
			copyFiles = copyCheckbox.getSelection();
			setPageComplete(validatePage());
		}
	});
}
 
Example 2
Source File: INSDComponentPage.java    From uima-uimaj with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a new Radio button.
 *
 * @param parent          the parent composite
 * @param label          the label from the button
 * @param initialSelection          <code>true</code> if the button is to be the default button, and <code>false</code>
 *          otherwise
 * @return the button
 */
protected Button addRadioButton(Composite parent, String label, boolean initialSelection) {

  Button button = new Button(parent, SWT.RADIO);
  button.setText(label);
  button.setFont(parent.getFont());
  button.setSelection(initialSelection);

  SelectionListener listener = new SelectionAdapter() {
    @Override
    public void widgetSelected(SelectionEvent e) {
      dialogChanged();
    }
  };
  button.addSelectionListener(listener);
  return button;
}
 
Example 3
Source File: ManageOrganizationWizardPage.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void createAddButton(final Composite buttonComposite) {
    final Button addButton = new Button(buttonComposite, SWT.FLAT) ;
    addButton.setText(Messages.add) ;
    addButton.setLayoutData(GridDataFactory.fillDefaults().grab(true,false).create()) ;
    addButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent e) {
            final Organization organization = OrganizationFactory.eINSTANCE.createOrganization() ;
            organization.setName(generateOrganizationName()) ;
            organization.setGroups(OrganizationFactory.eINSTANCE.createGroups()) ;
            organization.setUsers(OrganizationFactory.eINSTANCE.createUsers()) ;
            organization.setRoles(OrganizationFactory.eINSTANCE.createRoles()) ;
            organization.setMemberships(OrganizationFactory.eINSTANCE.createMemberships()) ;
            organizations.add(organization) ;
            viewer.setInput(organizations) ;
            viewer.setSelection(new StructuredSelection(organization));
        }
    }) ;
}
 
Example 4
Source File: JarImportWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates the rename group.
 *
 * @param parent
 *            the parent control
 */
protected void createRenameGroup(final Composite parent) {
	Assert.isNotNull(parent);
	final JarImportData data= fWizard.getImportData();
	final Button button= new Button(parent, SWT.CHECK);
	button.setText(JarImportMessages.JarImportWizardPage_replace_jar_file);
	button.setSelection(!data.isRenameJarFile());
	button.addSelectionListener(new SelectionAdapter() {

		@Override
		public void widgetSelected(final SelectionEvent event) {
			data.setRenameJarFile(!button.getSelection());
		}
	});
	if (fImportWizard && !fTreeViewer.getControl().isEnabled())
		button.setEnabled(false);
	if (!fImportWizard) {
		final GridData gd= new GridData();
		gd.horizontalIndent= IDialogConstants.HORIZONTAL_MARGIN;
		button.setLayoutData(gd);
	}
}
 
Example 5
Source File: DumbUser.java    From http4e with Apache License 2.0 6 votes vote down vote up
/**
 * Creates the main window's contents
 * 
 * @param parent the main window
 * @return Control
 */
protected Control createContents(Composite parent) {
  Composite composite = new Composite(parent, SWT.NONE);
  composite.setLayout(new GridLayout(1, true));

  // Create the button
  Button show = new Button(composite, SWT.NONE);
  show.setText("Show");

  final Shell shell = parent.getShell();

  // Display the dialog
  show.addSelectionListener(new SelectionAdapter() {
    public void widgetSelected(SelectionEvent event) {
      // Create and show the dialog
      DumbMessageDialog dlg = new DumbMessageDialog(shell);
      dlg.open();
    }
  });

  parent.pack();
  return composite;
}
 
Example 6
Source File: CommandPage.java    From EasyShell with Eclipse Public License 2.0 5 votes vote down vote up
private void createNewButton(Font font, GridData gridData, Composite groupComponent) {
    addNewButton = new Button(groupComponent, SWT.PUSH);
    addNewButton.setText(Activator.getResourceString("easyshell.command.page.button.text.new"));
    addNewButton.setToolTipText(Activator.getResourceString("easyshell.command.page.button.tooltip.new"));
    addNewButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent event) {
            addNewDialog();
        }
    });
    addNewButton.setLayoutData(gridData);
    addNewButton.setFont(font);
    setButtonLayoutData(addNewButton);
}
 
Example 7
Source File: NewTxtUMLModelWizardPage.java    From txtUML with Eclipse Public License 1.0 5 votes vote down vote up
private void createFileTypeChoice(Composite composite, int cols2) {
	Group group1 = new Group(composite, SWT.SHADOW_IN);
	group1.setText("Model syntax");
	group1.setLayout(new RowLayout(SWT.VERTICAL));
	group1.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 3, 1));
	xtxt = new Button(group1, SWT.RADIO);
	xtxt.setText("XtxtUML (custom syntax)");
	xtxt.setSelection(true);
	txt = new Button(group1, SWT.RADIO);
	txt.setText("JtxtUML (Java syntax)");
}
 
Example 8
Source File: Sorter.java    From Rel with Apache License 2.0 5 votes vote down vote up
private void createPopup() {
	popup = new PopupComposite(getShell());
	popup.setLayout(new GridLayout(1, false));
	
	SorterPanel orderer = new SorterPanel(popup, SWT.NONE);
	orderer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true, 1, 1));
	orderer.setAvailableAttributeNames(filterSorter.getAttributeNames());
	
	Composite buttonPanel = new Composite(popup, SWT.NONE);
	buttonPanel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1));
	buttonPanel.setLayout(new GridLayout(2, false));
	
	Button okButton = new Button(buttonPanel, SWT.PUSH);
	okButton.setText("Ok");
	okButton.addListener(SWT.Selection, e -> {
		String spec = orderer.getText().trim();
		if (spec.length() == 0)
			sortSpec.setText(emptySortPrompt);
		else
			sortSpec.setText(spec);
		popup.hide();
		filterSorter.refresh();
	});
	
	Button cancelButton = new Button(buttonPanel, SWT.PUSH);
	cancelButton.setText("Cancel");
	cancelButton.addListener(SWT.Selection, e -> {
		popup.hide();
	});
	
	String sortSpecText = sortSpec.getText();
	if (!sortSpecText.equals(emptySortPrompt))
		orderer.setText(sortSpecText);
	
	popup.pack();		
}
 
Example 9
Source File: VfsFileChooserControls.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
protected void addFileWidgets() {
  Label wlLocation = new Label( this, SWT.RIGHT );
  wlLocation.setText( BaseMessages.getString( PKG, "VfsFileChooserControls.Location.Label" ) );
  wlLocation.setLayoutData( new FormDataBuilder( ).left( 0, 0 ).top( 0, 0 ).result() );
  wLocation = new CCombo( this, SWT.BORDER | SWT.READ_ONLY );
  List<VFSScheme> availableVFSSchemes = getAvailableVFSSchemes();
  availableVFSSchemes.forEach( scheme -> wLocation.add( scheme.schemeName ) );
  wLocation.addListener( SWT.Selection, event -> {
    this.selectedVFSScheme = availableVFSSchemes.get( wLocation.getSelectionIndex() );
    this.wPath.setText( "" );
  } );
  if ( !availableVFSSchemes.isEmpty() ) {
    wLocation.select( 0 );
    this.selectedVFSScheme = availableVFSSchemes.get( wLocation.getSelectionIndex() );
  }
  wLocation.addModifyListener( lsMod );
  wLocation.setLayoutData(
    new FormDataBuilder().left( 0, 0 ).top( wlLocation, FIELD_LABEL_SEP ).width( FIELD_SMALL ).result() );

  Label wlPath = new Label( this, SWT.RIGHT );
  wlPath.setText( BaseMessages.getString( PKG, "VfsFileChooserControls.Filename.Label" ) );
  wlPath.setLayoutData( new FormDataBuilder().left( 0, 0 ).top( wLocation, FIELDS_SEP ).result() );
  wPath = new TextVar( space, this, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
  wPath.addModifyListener( lsMod );
  wPath.setLayoutData( new FormDataBuilder().left( 0, 0 ).top( wlPath, FIELD_LABEL_SEP ).width( FIELD_LARGE + VAR_EXTRA_WIDTH ).result() );

  wbBrowse = new Button( this, SWT.PUSH );
  wbBrowse.setText( BaseMessages.getString( PKG, "System.Button.Browse" ) );
  wbBrowse.addListener( SWT.Selection, event -> browseForFileInputPath() );
  int bOffset = ( wbBrowse.computeSize( SWT.DEFAULT, SWT.DEFAULT, false ).y
    - wPath.computeSize( SWT.DEFAULT, SWT.DEFAULT, false ).y ) / 2;
  wbBrowse.setLayoutData( new FormDataBuilder().left( wPath, FIELD_LABEL_SEP ).top( wlPath, FIELD_LABEL_SEP - bOffset ).result() );
}
 
Example 10
Source File: SWTFactory.java    From tlaplus with MIT License 5 votes vote down vote up
/**
 * Creates and returns a new push button with the given
 * label and/or image.
 * 
 * @param parent parent control
 * @param label button label or <code>null</code>
 * @param image image of <code>null</code>
 * @param fill the alignment for the new button
 * @return a new push button
 */
public static Button createPushButton(Composite parent, String label, Image image, int fill) {
	Button button = new Button(parent, SWT.PUSH);
	button.setFont(parent.getFont());
	if (image != null) {
		button.setImage(image);
	}
	if (label != null) {
		button.setText(label);
	}
	GridData gd = new GridData(fill);
	button.setLayoutData(gd);
	SWTFactory.setButtonDimensionHint(button);
	return button;	
}
 
Example 11
Source File: MenuPage.java    From EasyShell with Eclipse Public License 2.0 5 votes vote down vote up
private void createDownButton(Font font, GridData gridData, Composite groupComponent) {
    downButton = new Button(groupComponent, SWT.PUSH);
    downButton.setText(Activator.getResourceString("easyshell.menu.page.button.text.down"));
    downButton.setToolTipText(Activator.getResourceString("easyshell.menu.page.button.tooltip.down"));
    downButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent event) {
            down();
        }
    });
    downButton.setLayoutData(gridData);
    downButton.setFont(font);
    setButtonLayoutData(downButton);
}
 
Example 12
Source File: PWRadio.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * @see org.eclipse.nebula.widgets.opal.preferencewindow.widgets.PWWidget#build(org.eclipse.swt.widgets.Composite)
 */
@Override
public Control build(final Composite parent) {
	buildLabel(parent, GridData.BEGINNING);

	final Composite composite = new Composite(parent, SWT.NONE);
	final GridLayout gridLayout = new GridLayout();
	gridLayout.marginHeight = gridLayout.marginWidth = 0;
	composite.setLayout(gridLayout);

	for (final Object datum : data) {
		final Button button = new Button(composite, SWT.RADIO);
		addControl(button);
		button.setText(datum.toString());
		button.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, false));
		button.setSelection(datum.equals(PreferenceWindow.getInstance().getValueFor(getPropertyKey())));
		button.setData(datum);
		button.addListener(SWT.Selection, event -> {
			if (button.getSelection()) {
				PreferenceWindow.getInstance().setValue(getPropertyKey(), button.getData());
			}
		});

		buttons.add(button);
	}
	return composite;
}
 
Example 13
Source File: FolderSelectionGroup.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Create group
 * 
 * @param parent
 */
public void create( Composite parent )
{
	// get font
	Font font = parent.getFont( );

	// label control
	Label label = new Label( parent, SWT.LEFT );
	label.setFont( font );
	label.setText( this.labelText );

	Composite composite = new Composite( parent, SWT.NULL );
	GridLayout layout = new GridLayout( );
	layout.marginWidth = 0;
	layout.marginHeight = 0;
	layout.numColumns = 2;
	composite.setLayout( layout );

	GridData data = new GridData( GridData.FILL_HORIZONTAL );
	composite.setLayoutData( data );

	// text control
	text = new Text( composite, SWT.BORDER );
	text.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	text.setFont( font );
	text.setText( this.textValue );
	text.addVerifyListener( new VerifyListener( ) {

		public void verifyText( VerifyEvent e )
		{
			e.doit = e.text.indexOf( DELIMITER ) < 0;
		}
	} );

	// directory selection button
	button = new Button( composite, SWT.PUSH );
	button.setFont( font );
	button.setText( this.buttonText );
	button.addSelectionListener( new SelectionAdapter( ) {

		public void widgetSelected( SelectionEvent event )
		{
			dialog = new DirectoryDialog( PlatformUI.getWorkbench( )
					.getDisplay( ).getActiveShell( ) );

			dialog.setText( dialogTitle );
			dialog.setMessage( dialogMessage );
			dialog.setFilterPath( dialogFilterPath );
			String folderName = dialog.open( );
			if ( folderName == null )
			{
				return;
			}
			text.setText( folderName );
		}
	} );
}
 
Example 14
Source File: EditboxPreferencePage.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
protected Control createCategoryControl(final Composite parent) {
	final Composite c = new Composite(parent, SWT.NONE);
	c.setLayout(new GridLayout(2, true));

	final Label categoryLabel = new Label(c, SWT.NONE);
	categoryLabel.setText("Themes");

	final Label namesLabel = new Label(c, SWT.NONE);
	namesLabel.setText("Associated file names");
	namesLabel.setAlignment(SWT.RIGHT);

	categoryList = new List(c, SWT.V_SCROLL | SWT.BORDER);
	categoryList.setLayoutData(new GridData(GridData.FILL_BOTH));
	categoryList.addSelectionListener(new SelectCategory());
	namesList = new List(c, SWT.V_SCROLL | SWT.BORDER);
	namesList.setLayoutData(new GridData(GridData.FILL_BOTH));

	final Composite cLeft = new Composite(c, SWT.NONE);
	cLeft.setLayout(new GridLayout(2, true));
	final Button bAddCategory = new Button(cLeft, SWT.NONE);
	bAddCategory.setText("Add");
	bAddCategory.addSelectionListener(new AddCategory());
	bAddCategory.setLayoutData(new GridData(GridData.FILL_BOTH));
	final Button bRemoveCategory = new Button(cLeft, SWT.NONE);
	bRemoveCategory.setText("Remove");
	bRemoveCategory.setLayoutData(new GridData(GridData.FILL_BOTH));
	bRemoveCategory.addSelectionListener(new RemoveCategory());

	final Composite cRight = new Composite(c, SWT.NONE);
	cRight.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
	cRight.setLayout(new GridLayout(2, true));
	bAddFile = new Button(cRight, SWT.NONE);
	bAddFile.setText("Add");
	bAddFile.setLayoutData(new GridData(GridData.FILL_BOTH));
	bAddFile.addSelectionListener(new AddFile());
	bAddFile.setEnabled(false);
	final Button bRemoveFile = new Button(cRight, SWT.NONE);
	bRemoveFile.setText("Remove");
	bRemoveFile.setLayoutData(new GridData(GridData.FILL_BOTH));
	bRemoveFile.addSelectionListener(new RemoveFile());

	loadData();

	return c;
}
 
Example 15
Source File: WorkflowExecutorDialog.java    From hop with Apache License 2.0 4 votes vote down vote up
private void addParametersTab() {
  CTabItem wParametersTab = new CTabItem( wTabFolder, SWT.NONE );
  wParametersTab.setText( BaseMessages.getString( PKG, "JobExecutorDialog.Parameters.Title" ) );
  wParametersTab.setToolTipText( BaseMessages.getString( PKG, "JobExecutorDialog.Parameters.Tooltip" ) );

  Composite wParametersComposite = new Composite( wTabFolder, SWT.NONE );
  props.setLook( wParametersComposite );

  FormLayout parameterTabLayout = new FormLayout();
  parameterTabLayout.marginWidth = 15;
  parameterTabLayout.marginHeight = 15;
  wParametersComposite.setLayout( parameterTabLayout );

  // Add a button: get parameters
  //
  wGetParameters = new Button( wParametersComposite, SWT.PUSH );
  wGetParameters.setText( BaseMessages.getString( PKG, "JobExecutorDialog.Parameters.GetParameters" ) );
  props.setLook( wGetParameters );
  FormData fdGetParameters = new FormData();
  fdGetParameters.bottom = new FormAttachment( 100, 0 );
  fdGetParameters.right = new FormAttachment( 100, 0 );
  wGetParameters.setLayoutData( fdGetParameters );
  wGetParameters.setSelection( workflowExecutorMeta.getParameters().isInheritingAllVariables() );
  wGetParameters.addSelectionListener( new SelectionAdapter() {
    public void widgetSelected( SelectionEvent e ) {
      getParametersFromWorkflow( null ); // null : reload file
    }
  } );

  // Now add a table view with the 3 columns to specify: variable name, input field & optional static input
  //
  parameterColumns =
    new ColumnInfo[] {
      new ColumnInfo(
        BaseMessages.getString( PKG, "JobExecutorDialog.Parameters.column.Variable" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false, false ),
      new ColumnInfo(
        BaseMessages.getString( PKG, "JobExecutorDialog.Parameters.column.Field" ),
        ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] {}, false ),
      new ColumnInfo(
        BaseMessages.getString( PKG, "JobExecutorDialog.Parameters.column.Input" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false, false ), };
  parameterColumns[ 1 ].setUsingVariables( true );

  WorkflowExecutorParameters parameters = workflowExecutorMeta.getParameters();
  wWorkflowExecutorParameters =
    new TableView(
      pipelineMeta, wParametersComposite, SWT.FULL_SELECTION | SWT.SINGLE | SWT.BORDER, parameterColumns,
      parameters.getVariable().length, lsMod, props );
  props.setLook( wWorkflowExecutorParameters );
  FormData fdJobExecutors = new FormData();
  fdJobExecutors.left = new FormAttachment( 0, 0 );
  fdJobExecutors.right = new FormAttachment( 100, 0 );
  fdJobExecutors.top = new FormAttachment( 0, 0 );
  fdJobExecutors.bottom = new FormAttachment( wGetParameters, -10 );
  wWorkflowExecutorParameters.setLayoutData( fdJobExecutors );
  wWorkflowExecutorParameters.getTable().addListener( SWT.Resize, new ColumnsResizer( 0, 33, 33, 33 ) );

  for ( int i = 0; i < parameters.getVariable().length; i++ ) {
    TableItem tableItem = wWorkflowExecutorParameters.table.getItem( i );
    tableItem.setText( 1, Const.NVL( parameters.getVariable()[ i ], "" ) );
    tableItem.setText( 2, Const.NVL( parameters.getField()[ i ], "" ) );
    tableItem.setText( 3, Const.NVL( parameters.getInput()[ i ], "" ) );
  }
  wWorkflowExecutorParameters.setRowNums();
  wWorkflowExecutorParameters.optWidth( true );

  // Add a checkbox: inherit all variables...
  //
  wInheritAll = new Button( wParametersComposite, SWT.CHECK );
  wInheritAll.setText( BaseMessages.getString( PKG, "JobExecutorDialog.Parameters.InheritAll" ) );
  props.setLook( wInheritAll );
  FormData fdInheritAll = new FormData();
  fdInheritAll.left = new FormAttachment( 0, 0 );
  fdInheritAll.top = new FormAttachment( wWorkflowExecutorParameters, 15 );
  wInheritAll.setLayoutData( fdInheritAll );
  wInheritAll.setSelection( workflowExecutorMeta.getParameters().isInheritingAllVariables() );

  FormData fdParametersComposite = new FormData();
  fdParametersComposite.left = new FormAttachment( 0, 0 );
  fdParametersComposite.top = new FormAttachment( 0, 0 );
  fdParametersComposite.right = new FormAttachment( 100, 0 );
  fdParametersComposite.bottom = new FormAttachment( 100, 0 );
  wParametersComposite.setLayoutData( fdParametersComposite );

  wParametersComposite.layout();
  wParametersTab.setControl( wParametersComposite );
}
 
Example 16
Source File: AddOrEditSrxConfigDialog.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 创建映身
 * @param tparent
 *            ;
 */
private void createMapGroup(Composite tparent, GridData groupData, GridLayout groupLayout) {
	Group group = new Group(tparent, SWT.BORDER);
	group.setLayoutData(groupData);
	group.setLayout(groupLayout);
	group.setText(Messages.getString("srx.AddOrEditSrxConfigDialog.group"));

	mapTableViewer = new TableViewer(group, SWT.FULL_SELECTION | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL
			| SWT.MULTI);
	mapTable = mapTableViewer.getTable();
	mapTable.setLinesVisible(true);
	mapTable.setHeaderVisible(true);

	GridDataFactory.fillDefaults().span(4, SWT.DEFAULT).grab(true, true).applyTo(mapTable);
	mapTableViewer.setLabelProvider(new TableViewerLabelProvider());
	mapTableViewer.setContentProvider(new ArrayContentProvider());

	String[] columnNames = new String[] { Messages.getString("srx.AddOrEditSrxConfigDialog.columnNames1"),
			Messages.getString("srx.AddOrEditSrxConfigDialog.columnNames2") };
	int[] columnAlignments = new int[] { SWT.LEFT, SWT.LEFT };
	for (int i = 0; i < columnNames.length; i++) {
		TableColumn tableColumn = new TableColumn(mapTable, columnAlignments[i]);
		tableColumn.setText(columnNames[i]);
		tableColumn.setWidth(50);
	}
	refreshTableWidth(mapTable);

	mapAddBtn = new Button(group, SWT.NONE);
	mapAddBtn.setText(Messages.getString("srx.AddOrEditSrxConfigDialog.mapAddBtn"));
	setButtonLayoutData(mapAddBtn);

	mapEditBtn = new Button(group, SWT.NONE);
	mapEditBtn.setText(Messages.getString("srx.AddOrEditSrxConfigDialog.mapEditBtn"));
	setButtonLayoutData(mapEditBtn);

	mapDeleteBtn = new Button(group, SWT.NONE);
	mapDeleteBtn.setText(Messages.getString("srx.AddOrEditSrxConfigDialog.mapDeleteBtn"));
	setButtonLayoutData(mapDeleteBtn);

	new Label(group, SWT.NONE);

	mapTableViewer.addDoubleClickListener(new IDoubleClickListener() {
		public void doubleClick(DoubleClickEvent event) {
			editMapRules();
		}
	});
}
 
Example 17
Source File: CronEditor.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
protected void createHourlyTab(TabFolder tablFolder) {
    final TabItem item = new TabItem(tablFolder, SWT.NONE);
    item.setText(Messages.hourly);

    final Composite hourlyContent = new Composite(tablFolder, SWT.NONE);
    hourlyContent.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    hourlyContent.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).margins(15, 10).create());

    final Button everyRadio = new Button(hourlyContent, SWT.RADIO);
    everyRadio.setLayoutData(GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.CENTER).create());
    everyRadio.setText(Messages.every);

    context.bindValue(SWTObservables.observeSelection(everyRadio),
            PojoProperties.value("useEveryHour").observe(cronExpression));

    final Composite everyComposite = new Composite(hourlyContent, SWT.NONE);
    everyComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    everyComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).margins(0, 0).create());

    final Text minuteText = new Text(everyComposite, SWT.BORDER | SWT.SINGLE);
    minuteText.setLayoutData(GridDataFactory.fillDefaults().hint(70, SWT.DEFAULT).create());

    UpdateValueStrategy hourFrequencyStrategy = new UpdateValueStrategy();
    hourFrequencyStrategy.setAfterGetValidator(dotValidator);
    hourFrequencyStrategy.setConverter(StringToNumberConverter.toInteger(true));
    hourFrequencyStrategy.setBeforeSetValidator(new FrequencyValidator());

    context.bindValue(SWTObservables.observeText(minuteText, SWT.Modify),
            PojoProperties.value("hourFrequencyForHourly").observe(cronExpression), hourFrequencyStrategy, null);

    final Label minuteLabel = new Label(everyComposite, SWT.NONE);
    minuteLabel.setLayoutData(GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.CENTER).create());
    minuteLabel.setText(Messages.hourLabel);

    final Button atRadio = new Button(hourlyContent, SWT.RADIO);
    atRadio.setLayoutData(GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.CENTER).create());
    atRadio.setText(Messages.at);

    final Composite atComposite = new Composite(hourlyContent, SWT.NONE);
    atComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    atComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(3).margins(0, 0).create());

    final Combo hourCombo = new Combo(atComposite, SWT.READ_ONLY | SWT.BORDER);
    hourCombo.setItems(HOURS_IN_DAY);

    UpdateValueStrategy hourStrategy = new UpdateValueStrategy();
    hourStrategy.setConverter(StringToNumberConverter.toInteger(true));
    UpdateValueStrategy hourStrategy2 = new UpdateValueStrategy();

    NumberFormat formatter = new DecimalFormat("#00");
    hourStrategy2.setConverter(NumberToStringConverter.fromInteger(formatter, true));
    context.bindValue(SWTObservables.observeText(hourCombo),
            PojoProperties.value("atHour").observe(cronExpression), hourStrategy, hourStrategy2);

    final Combo minuteCombo = new Combo(atComposite, SWT.READ_ONLY | SWT.BORDER);
    minuteCombo.setItems(MINUTES_IN_HOURS);

    UpdateValueStrategy minuteStrategy = new UpdateValueStrategy();
    minuteStrategy.setConverter(StringToNumberConverter.toInteger(true));
    UpdateValueStrategy minuteStrategy2 = new UpdateValueStrategy();
    minuteStrategy2.setConverter(NumberToStringConverter.fromInteger(formatter, true));
    context.bindValue(SWTObservables.observeText(minuteCombo),
            PojoProperties.value("atMinute").observe(cronExpression), minuteStrategy, minuteStrategy2);

    final Combo secondCombo = new Combo(atComposite, SWT.READ_ONLY | SWT.BORDER);
    secondCombo.setItems(MINUTES_IN_HOURS);

    final IObservableValue secondObservable = PojoProperties.value("atSecond").observe(cronExpression);
    UpdateValueStrategy secondStrategy = new UpdateValueStrategy();
    secondStrategy.setConverter(StringToNumberConverter.toInteger(true));
    UpdateValueStrategy secondStrategy2 = new UpdateValueStrategy();
    secondStrategy2.setConverter(NumberToStringConverter.fromInteger(formatter, true));
    context.bindValue(SWTObservables.observeText(secondCombo), secondObservable, secondStrategy, secondStrategy2);

    item.setControl(hourlyContent);
}
 
Example 18
Source File: CategoryManageDialog.java    From erflute with Apache License 2.0 4 votes vote down vote up
private void createCategoryGroup(Composite composite) {
    final GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 4;

    final Group group = new Group(composite, SWT.NONE);
    group.setText(DisplayMessages.getMessage("label.category.message"));
    group.setLayout(gridLayout);

    CompositeFactory.filler(group, 4);

    final GridData tableGridData = new GridData();
    tableGridData.heightHint = 200;
    tableGridData.horizontalSpan = 3;
    tableGridData.verticalSpan = 2;

    this.categoryTable = new Table(group, SWT.BORDER | SWT.FULL_SELECTION);
    categoryTable.setHeaderVisible(true);
    categoryTable.setLayoutData(tableGridData);
    categoryTable.setLinesVisible(true);

    final GridData upButtonGridData = new GridData();
    upButtonGridData.grabExcessHorizontalSpace = false;
    upButtonGridData.verticalAlignment = GridData.END;
    upButtonGridData.grabExcessVerticalSpace = true;
    upButtonGridData.widthHint = DesignResources.BUTTON_WIDTH;

    final GridData downButtonGridData = new GridData();
    downButtonGridData.grabExcessVerticalSpace = true;
    downButtonGridData.verticalAlignment = GridData.BEGINNING;
    downButtonGridData.widthHint = DesignResources.BUTTON_WIDTH;

    this.upButton = new Button(group, SWT.NONE);
    upButton.setText(DisplayMessages.getMessage("label.up.arrow"));
    upButton.setLayoutData(upButtonGridData);

    this.downButton = new Button(group, SWT.NONE);
    downButton.setText(DisplayMessages.getMessage("label.down.arrow"));
    downButton.setLayoutData(downButtonGridData);

    final GridData textGridData = new GridData();
    textGridData.widthHint = 150;

    this.categoryNameText = new Text(group, SWT.BORDER);
    categoryNameText.setLayoutData(textGridData);

    final GridData buttonGridData = new GridData();
    buttonGridData.widthHint = DesignResources.BUTTON_WIDTH;

    addCategoryButton = new Button(group, SWT.NONE);
    addCategoryButton.setLayoutData(buttonGridData);
    addCategoryButton.setText(DisplayMessages.getMessage("label.button.add"));

    updateCategoryButton = new Button(group, SWT.NONE);
    updateCategoryButton.setLayoutData(buttonGridData);
    updateCategoryButton.setText(DisplayMessages.getMessage("label.button.update"));

    deleteCategoryButton = new Button(group, SWT.NONE);
    deleteCategoryButton.setLayoutData(buttonGridData);
    deleteCategoryButton.setText(DisplayMessages.getMessage("label.button.delete"));

    final TableColumn tableColumn = new TableColumn(categoryTable, SWT.NONE);
    tableColumn.setWidth(30);
    tableColumn.setResizable(false);
    final TableColumn tableColumn1 = new TableColumn(categoryTable, SWT.NONE);
    tableColumn1.setWidth(230);
    tableColumn1.setResizable(false);
    tableColumn1.setText(DisplayMessages.getMessage("label.category.name"));
}
 
Example 19
Source File: WebappProjectPropertyPage.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 4 votes vote down vote up
private void createWarDirComponent(Composite parent) {
  int numColumns = ((GridLayout) parent.getLayout()).numColumns;

  hasWarDirButton = new Button(parent, SWT.CHECK);
  hasWarDirButton.setText("This project has a WAR directory");
  GridData hasWarDirButtonGridData = new GridData(GridData.FILL_HORIZONTAL);
  hasWarDirButtonGridData.horizontalSpan = numColumns;
  hasWarDirButton.setLayoutData(hasWarDirButtonGridData);

  warDirComponent = new Composite(parent, SWT.NONE);
  GridData warDirComponentGridData = new GridData(GridData.FILL_HORIZONTAL);
  warDirComponentGridData.horizontalSpan = numColumns;
  warDirComponent.setLayoutData(warDirComponentGridData);
  GridLayout warDirComponentLayout = new GridLayout(3, false);
  warDirComponentLayout.marginLeft = 16;
  warDirComponent.setLayout(warDirComponentLayout);

  Label warDirLabel = new Label(warDirComponent, SWT.NONE);
  warDirLabel.setText("WAR directory:");

  warDirText = new Text(warDirComponent, SWT.BORDER);
  GridData warDirTextGridData = new GridData(GridData.FILL_HORIZONTAL);
  warDirText.setLayoutData(warDirTextGridData);

  warDirBrowseButton = new Button(warDirComponent, SWT.NONE);
  warDirBrowseButton.setText("&Browse...");

  isWarSrcDirOutputButton = new Button(warDirComponent, SWT.CHECK);
  GridData isWarSrcDirOutputButtonGridData = new GridData(GridData.FILL_HORIZONTAL);
  isWarSrcDirOutputButtonGridData.horizontalIndent = 16;
  isWarSrcDirOutputButtonGridData.horizontalSpan = numColumns;
  isWarSrcDirOutputButton.setLayoutData(isWarSrcDirOutputButtonGridData);
  isWarSrcDirOutputButton.setText("Launch and deploy from this directory");

  String enableString = null;
  ExtensionQuery<ManagedWarOptionEnablementFinder> extQuery = new ExtensionQuery<ManagedWarOptionEnablementFinder>(
      CorePlugin.PLUGIN_ID, "managedWarOptionEnablementFinder", "class");
  List<ExtensionQuery.Data<ManagedWarOptionEnablementFinder>> enablementFinders = extQuery.getData();
  for (ExtensionQuery.Data<ManagedWarOptionEnablementFinder> enablementFinder : enablementFinders) {
    enableString = enablementFinder.getExtensionPointData().isManagedWarOptionEnabled(getProject());
    if (enableString != null) {
      break; // take the first "disable" response
    }
  }

  if (enableString != null) {
    isWarSrcDirOutputButton.setEnabled(false);
    isWarSrcDirOutputButton.setText(isWarSrcDirOutputButton.getText() + " (" + enableString + ")");
  }
}
 
Example 20
Source File: Translator.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
private void addGrid() {
  Composite composite = new Composite( sashform, SWT.NONE );
  props.setLook( composite );

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

  wReload = new Button( composite, SWT.NONE );
  wReload.setText( "  &Reload  " );
  wLocale = new Button( composite, SWT.NONE );
  wLocale.setText( "  &Select locale  " );
  wClose = new Button( composite, SWT.NONE );
  wClose.setText( "  &Close " );
  wVerify = new Button( composite, SWT.CHECK );
  wVerify.setText( "&Verify usage" );
  wVerify.setSelection( true ); // Check it!
  wUsed = new Button( composite, SWT.CHECK );
  wUsed.setText( "&Remove used keys" );
  wUsed.setSelection( false ); // Check it!
  wAvailable = new Button( composite, SWT.CHECK );
  wAvailable.setText( "&Check key against other locale" );
  wAvailable.setSelection( true ); // Check it!

  BaseStepDialog.positionBottomButtons( composite, new Button[] {
    wReload, wLocale, wClose, wVerify, wUsed, wAvailable }, Const.MARGIN, null );

  ColumnInfo[] colinf =
    new ColumnInfo[] {
      new ColumnInfo( "Locale", ColumnInfo.COLUMN_TYPE_TEXT, true ),
      new ColumnInfo( "Package", ColumnInfo.COLUMN_TYPE_TEXT, true ),
      new ColumnInfo( "Class", ColumnInfo.COLUMN_TYPE_TEXT, true ),
      new ColumnInfo( "Key", ColumnInfo.COLUMN_TYPE_TEXT, true ),
      new ColumnInfo( "Value", ColumnInfo.COLUMN_TYPE_TEXT, true ),
      new ColumnInfo( "Used?", ColumnInfo.COLUMN_TYPE_TEXT, true ),
      new ColumnInfo( "Not available in", ColumnInfo.COLUMN_TYPE_TEXT, true ), };

  wGrid =
    new TableView( Variables.getADefaultVariableSpace(), composite, SWT.BORDER
      | SWT.FULL_SELECTION | SWT.MULTI, colinf, 0, null, PropsUI.getInstance() );

  FormData fdGrid = new FormData();
  fdGrid.left = new FormAttachment( 0, 0 );
  fdGrid.top = new FormAttachment( 0, 0 );
  fdGrid.right = new FormAttachment( 100, 0 );
  fdGrid.bottom = new FormAttachment( wReload, -Const.MARGIN * 3 );
  wGrid.setLayoutData( fdGrid );

}