Java Code Examples for org.eclipse.swt.widgets.Button

The following are top voted examples for showing how to use org.eclipse.swt.widgets.Button. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: n4js   File: PreviewableWizardPage.java   Source Code and License 7 votes vote down vote up
/**
 * Creates the bottom controls.
 */
private void createBottomControls(Composite parent) {
	Composite bottomControls = new Composite(parent, SWT.NONE);

	bottomControls
			.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).align(SWT.RIGHT, SWT.CENTER).create());
	bottomControls.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).extendedMargins(0, 5, 0, 0).create());

	previewToggleButton = new Button(bottomControls, SWT.PUSH);
	previewToggleButton.setText(HIDE_PREVIEW_TEXT);
	previewToggleButton.setSelection(true);
	previewToggleButton.setLayoutData(GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.BOTTOM).create());
	previewToggleButton.setToolTipText(PREVIEW_BUTTON_TOOLTIP);

	previewToggleButton.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			if (!previewVisible) {
				showContentPreview();
			} else {
				hideContentPreview();
			}
		}
	});
}
 
Example 2
Project: Hydrograph   File: FilterHelper.java   Source Code and License 7 votes vote down vote up
/**
 * Gets the text box value 1 listener.
 * 
 * @param conditionsList
 *            the conditions list
 * @param fieldsAndTypes
 *            the fields and types
 * @param fieldNames
 *            the field names
 * @param saveButton
 *            the save button
 * @param displayButton
 *            the display button
 * @return the text box value 1 listener
 */
public  Listener getTextBoxValue1Listener(final List<Condition> conditionsList, 
		final Map<String, String> fieldsAndTypes, final String[] fieldNames, final Button saveButton, final Button displayButton) {
	Listener listener = new Listener() {
		
		@Override
		public void handleEvent(Event event) {
			Text text = (Text)event.widget;
			int index = (int) text.getData(FilterConstants.ROW_INDEX);
			Condition filterConditions = conditionsList.get(index);
			filterConditions.setValue1(text.getText());
			validateText(text, filterConditions.getFieldName(), fieldsAndTypes, filterConditions.getConditionalOperator());
			toggleSaveDisplayButton(conditionsList, fieldsAndTypes, fieldNames, saveButton, displayButton);
		}
	};
	return listener;
}
 
Example 3
Project: Open_Source_ECOA_Toolset_AS5   File: EnumTypesPage.java   Source Code and License 6 votes vote down vote up
@Override
public void mouseUp(MouseEvent e) {
	if (((Button) e.getSource()).getText().equalsIgnoreCase("Add")) {
		EnumValue val = new EnumValue();
		val.setName("");
		val.setComment("");
		val.setValnum("");
		getEnumArr().add(val);
		tabValues.refresh();
	} else if (((Button) e.getSource()).getText().equalsIgnoreCase("Remove")) {
		int[] items = tabValues.getTable().getSelectionIndices();
		ArrayList<EnumValue> rem = new ArrayList<EnumValue>();
		for (int item : items) {
			rem.add(getEnumArr().get(item));
		}
		getEnumArr().removeAll(rem);
		tabValues.refresh();
	} else if (((Button) e.getSource()).getText().equalsIgnoreCase("Clear")) {
		getEnumArr().clear();
		tabValues.refresh();
	}
}
 
Example 4
Project: Hydrograph   File: FilterHelper.java   Source Code and License 6 votes vote down vote up
/**
 * Gets the text box value 2 listener.
 * 
 * @param conditionsList
 *            the conditions list
 * @param fieldsAndTypes
 *            the fields and types
 * @param fieldNames
 *            the field names
 * @param saveButton
 *            the save button
 * @param displayButton
 *            the display button
 * @return the text box value 2 listener
 */
public  Listener getTextBoxValue2Listener(final List<Condition> conditionsList, 
		final Map<String, String> fieldsAndTypes, final String[] fieldNames, final Button saveButton, final Button displayButton) {
	Listener listener = new Listener() {
		
		@Override
		public void handleEvent(Event event) {
			Text text = (Text)event.widget;
			int index = (int) text.getData(FilterConstants.ROW_INDEX);
			Condition filterConditions = conditionsList.get(index);
			filterConditions.setValue2(text.getText());
			validateText(text, filterConditions.getFieldName(), fieldsAndTypes,filterConditions.getConditionalOperator());
			toggleSaveDisplayButton(conditionsList, fieldsAndTypes, fieldNames, saveButton, displayButton);
		}
	};
	return listener;
}
 
Example 5
Project: Open_Source_ECOA_Toolset_AS5   File: EventServicePage.java   Source Code and License 6 votes vote down vote up
@Override
public void mouseUp(MouseEvent e) {
	if (((Button) e.getSource()).getText().equalsIgnoreCase("Add")) {
		Parameter val = new Parameter();
		val.setName("");
		val.setType("");
		getParamArr().add(val);
		tabValues.refresh();
	} else if (((Button) e.getSource()).getText().equalsIgnoreCase("Remove")) {
		int[] items = tabValues.getTable().getSelectionIndices();
		ArrayList<Parameter> rem = new ArrayList<Parameter>();
		for (int item : items) {
			rem.add(getParamArr().get(item));
		}
		getParamArr().removeAll(rem);
		tabValues.refresh();
	} else if (((Button) e.getSource()).getText().equalsIgnoreCase("Clear")) {
		getParamArr().clear();
		tabValues.refresh();
	}
}
 
Example 6
Project: convertigo-eclipse   File: NewProjectWizardComposite6.java   Source Code and License 6 votes vote down vote up
/**
 * This method initializes group	
 *
 */
private void createGroup() {
	GridData gridData1 = new GridData();
	gridData1.horizontalAlignment = GridData.BEGINNING;
	gridData1.grabExcessHorizontalSpace = true;
	gridData1.verticalAlignment = GridData.CENTER;
	GridData gridData = new GridData();
	gridData.horizontalAlignment = GridData.FILL;
	gridData.verticalAlignment = GridData.CENTER;
	GridLayout gridLayout1 = new GridLayout();
	gridLayout1.numColumns = 2;
	GridData gridData3 = new GridData();
	gridData3.horizontalAlignment = GridData.FILL;
	gridData3.horizontalSpan = 2;
	gridData3.grabExcessHorizontalSpace = true;
	gridData3.grabExcessVerticalSpace = false;
	gridData3.verticalAlignment = GridData.FILL;
	group = new Group(this, SWT.NONE);
	group.setText("Target Server");
	group.setLayoutData(gridData3);
	group.setLayout(gridLayout1);
	label = new Label(group, SWT.NONE);
	label.setText("HTTP Server");
	httpServer = new Text(group, SWT.BORDER);
	httpServer.setLayoutData(gridData);
	
	label2 = new Label(group, SWT.NONE);
	label2.setText("HTTP Port");
	httpPort = new Text(group, SWT.BORDER);
	httpPort.setLayoutData(gridData1);
	label3 = new Label(group, SWT.NONE);
	label3.setText("SSL");
	ssl = new Button(group, SWT.CHECK);
	
	httpServer.addModifyListener(modifyListener);
       httpPort.addModifyListener(modifyListener);
       ssl.addSelectionListener(selectionListener);
}
 
Example 7
Project: Open_Source_ECOA_Toolset_AS5   File: TypesEditor.java   Source Code and License 6 votes vote down vote up
@Override
public void mouseUp(MouseEvent e) {
	if (e.getSource() instanceof Button) {
		Button sel = (Button) e.getSource();
		if (sel.getText().equalsIgnoreCase("Save")) {
			try {
				String tempText = util.processAdd(isEdit, editName, comp, type, editor.getDocumentProvider().getDocument(getEditorInput()).get());
				editor.getDocumentProvider().getDocument(getEditorInput()).set(tempText);
				createPage1();
				setActivePage(1);
			} catch (JAXBException ex) {
				ErrorDialog.openError(getSite().getShell(), "Error removing item", null, new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, 0, "Error removing item", null));
			}
		}
	}
}
 
Example 8
Project: BiglyBT   File: BuddyPluginView.java   Source Code and License 6 votes vote down vote up
private void
setupButtonGroup(
	final List<Button>		buttons )
{
	for ( final Button b: buttons ){

		b.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				if ( !b.getSelection()){

					b.setSelection( true );
				}
				for ( Button b2: buttons ){

					if ( b2 != b ){
						b2.setSelection( false );
					}
				}
			}});
	}

	Utils.makeButtonsEqualWidth( buttons );
}
 
Example 9
Project: Hydrograph   File: ELTSchemaGridWidget.java   Source Code and License 6 votes vote down vote up
private void addImportSchemaButton(ELTSchemaSubgroupComposite buttonSubGroup) {

		importSchemaButton = new ELTDefaultButton("");
		SchemaButtonsSyncUtility.INSTANCE.buttonSize(importSchemaButton, macButtonWidth, macButtonHeight,
				windowButtonWidth, windowButtonHeight);
		buttonSubGroup.attachWidget(importSchemaButton);
		importSchemaButton.setImage(ImagePathConstant.IMPORT_SCHEMA_BUTTON);
		importSchemaButton.setToolTipText(Messages.IMPORT_SCHEMA_KEY_SHORTCUT_TOOLTIP);
		Button importButton = (Button) importSchemaButton.getSWTWidgetControl();
		importButton.addMouseListener(new MouseAdapter() {

			@Override
			public void mouseDown(MouseEvent e) {
				importSchema(importButton);
			}
		});
	}
 
Example 10
Project: EclipseMinifyBuilder   File: MinifyJsPropertyPage.java   Source Code and License 6 votes vote down vote up
private Button createCheckbox(
		String label, String property, boolean defaultValue, Preferences prefs) {
	Button checkbox = new Button(yuiOptGroup, SWT.CHECK);
	checkbox.setText(label);
	checkbox.setSelection(prefs.getBoolean(preferenceKey(property), defaultValue));
	checkbox.requestLayout();
	return checkbox;
}
 
Example 11
Project: Hydrograph   File: ELTSchemaDialogSelectionListener.java   Source Code and License 6 votes vote down vote up
@Override
public Listener getListener(final PropertyDialogButtonBar propertyDialogButtonBar,
		ListenerHelper helpers, final Widget... widgets) {
	final Button button = ((Button)widgets[0]);
	button.getShell();
	if(helpers != null){
		txtDecorator = (ControlDecoration) helpers.get(HelperType.CONTROL_DECORATION);
		file_extension=(String)helpers.get(HelperType.FILE_EXTENSION);
	}
	
	Listener listener=new Listener() {
		@Override
		public void handleEvent(Event event) {
			if(event.type==SWT.Selection){
				FilterOperationClassUtility.INSTANCE.browseFile(file_extension,((Text) widgets[0]));
					propertyDialogButtonBar.enableApplyButton(true);
					txtDecorator.hide();
			}
		}
	};
	return listener;
}
 
Example 12
Project: Hydrograph   File: HeaderAndDataFormattingDialog.java   Source Code and License 6 votes vote down vote up
private void addSelectionListeneronButton(Button button, TableEditor editor) {
	button.addSelectionListener(new SelectionAdapter() {

		@Override
		public void widgetSelected(SelectionEvent e) {
			ColorDialog dlg = new ColorDialog(Display.getCurrent().getActiveShell());
			dlg.setRGB(new RGB(0, 0, 0));
			RGB rgb = dlg.open();
			if (rgb != null) {
				Color color = new Color(shell.getDisplay(), rgb);
				String colorValue = convertRGBToHEX(rgb);
				editor.getItem().setText(1, colorValue);
				color.dispose();
			}
		}
	});
}
 
Example 13
Project: Hydrograph   File: SourceSelectionPage.java   Source Code and License 6 votes vote down vote up
protected void addRadioButton(Composite container) {
	Composite composite_1 = new Composite(container, SWT.NONE);
	composite_1.setLayout(new GridLayout(1, false));
	composite_1.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	
	xmlRadioButton = new Button(composite_1, SWT.RADIO);
	xmlRadioButton.setText("XML File");
	xmlRadioButton.setEnabled(true);
	xmlRadioButton.setSelection(true);
	
	xsdRadioButton = new Button(composite_1, SWT.RADIO);
	xsdRadioButton.setText("XSD File");
	
	addSelectionListenerOnXMLRadioBtn();
	addSelectionListenerOnXSDRadioBtn();
	
	
}
 
Example 14
Project: Hydrograph   File: OutputRecordCountWidget.java   Source Code and License 6 votes vote down vote up
private void attachRadioButtonToComposite(Composite radioButtonsComposite) 
{
     expressionRadioButton=new Button(radioButtonsComposite, SWT.RADIO);
     if(OSValidator.isMac())
     {
	expressionRadioButton.setText(Messages.MAC_EXPRESSION_EDITIOR_LABEL);
  }
     else 
     {
    expressionRadioButton.setText(Messages.WINDOWS_EXPRESSION_EDITIOR_LABEL);
  }
     
     operationRadioButton = new Button(radioButtonsComposite, SWT.RADIO);
  operationRadioButton.setText(Messages.OPERATION_CALSS_LABEL);
  
  addSelectionListenerToExpressionRadioButton(expressionRadioButton);
  addSelectionListenerToOperationRadioButton(operationRadioButton);
  if(transformMapping.isExpression())
  {	  
  expressionRadioButton.setSelection(true);
  }
  else
  {	  
  operationRadioButton.setSelection(true);	  
  }
}
 
Example 15
Project: Hydrograph   File: FilterHelper.java   Source Code and License 6 votes vote down vote up
/**
 * Gets the field name modify listener.
 * 
 * @param tableViewer
 *            the table viewer
 * @param conditionsList
 *            the conditions list
 * @param fieldsAndTypes
 *            the fields and types
 * @param fieldNames
 *            the field names
 * @param saveButton
 *            the save button
 * @param displayButton
 *            the display button
 * @return the field name modify listener
 */
public ModifyListener getFieldNameModifyListener(final TableViewer tableViewer, final List<Condition> conditionsList,
		final Map<String, String> fieldsAndTypes, final String[] fieldNames, final Button saveButton, final Button displayButton) {
	ModifyListener listener = new ModifyListener() {
		
		@Override
		public void modifyText(ModifyEvent e) {
			CCombo source = (CCombo) e.getSource();
			int index = (int) source.getData(FilterConstants.ROW_INDEX);
			Condition filterConditions = conditionsList.get(index);
			String fieldName = source.getText();
			filterConditions.setFieldName(fieldName);
			
			if(StringUtils.isNotBlank(fieldName)){
				String fieldType = fieldsAndTypes.get(fieldName);
				TableItem item = tableViewer.getTable().getItem(index);
				CCombo conditionalCombo = (CCombo) item.getData(FilterConditionsDialog.CONDITIONAL_OPERATORS);
				if(conditionalCombo != null && StringUtils.isNotBlank(fieldType)){
					conditionalCombo.setText(filterConditions.getConditionalOperator());
					conditionalCombo.setItems(FilterHelper.INSTANCE.getTypeBasedOperatorMap().get(fieldType));
					new AutoCompleteField(conditionalCombo, new CComboContentAdapter(), conditionalCombo.getItems());
				}
			}
			validateCombo(source);
			toggleSaveDisplayButton(conditionsList, fieldsAndTypes, fieldNames, saveButton, displayButton);
		}
	};
	return listener;
}
 
Example 16
Project: Hydrograph   File: ELTCheckFileExtensionListener.java   Source Code and License 6 votes vote down vote up
@Override
public Listener getListener(PropertyDialogButtonBar propertyDialogButtonBar,ListenerHelper helpers, Widget... widgets) {
	final Widget[] widgetList = widgets;
			
	Listener listener=new Listener() { 
		@Override
		public void handleEvent(Event event) {
			if(!((Button)widgetList[1]).getSelection()){
			ControlDecoration	fieldNameMustJava = WidgetUtility.addDecorator((Text)widgetList[0],Messages.INVALID_FILE);
			if(!WidgetUtility.isFileExtention((((Text)widgetList[0]).getText()).trim(), ".java") && !(((Text)widgetList[0]).getText().trim().isEmpty())){
				fieldNameMustJava.show();
			((Text)widgetList[0]).setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 255,
					255, 204));
			}
				else  
				{   
					((Text)widgetList[0]).setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 255,
						255, 255));
				fieldNameMustJava.hide(); 
				}
			}
		} 
	};
	return listener;
}
 
Example 17
Project: eZooKeeper   File: ZnodeNewWizardComposite1.java   Source Code and License 6 votes vote down vote up
public Znode getZnode() throws Exception {

        byte[] data = getZnodeData();

        ZnodeModel parentZnodeModel = getParentZnodeModel();

        Text pathText = (Text) getControl(CONTROL_NAME_PATH_TEXT);
        String relativePath = pathText.getText();
        Znode parentZnode = parentZnodeModel.getData();
        String parentPath = parentZnode.getPath();
        String absolutePath = Znode.getAbsolutePath(parentPath, relativePath);

        Button sequentialCheckbox = (Button) getControl(CONTROL_NAME_CREATE_MODE_SEQUENTIAL_BUTTON);
        boolean isSequential = sequentialCheckbox.getSelection();

        Button ephemeralRadioButton = (Button) getControl(CONTROL_NAME_CREATE_MODE_EPHEMERAL_BUTTON);
        boolean isEphemeral = ephemeralRadioButton.getSelection();

        Znode znode = new Znode(absolutePath);
        znode.setSequential(isSequential);
        znode.setEphemeral(isEphemeral);
        znode.setData(data);

        return znode;
    }
 
Example 18
Project: Hydrograph   File: FTPAuthenticEditorUtility.java   Source Code and License 6 votes vote down vote up
/**
 * @param container
 * @return
 */
public Control addIdKeyComposite(Composite container, FTPAuthOperationDetails authOperationDetails) {
	Composite keyFileComposite = new Composite(container, SWT.BORDER);
	keyFileComposite.setLayout(new GridLayout(3, false));
	keyFileComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
	
	FTPWidgetUtility ftpWidgetUtility = new FTPWidgetUtility();
	ftpWidgetUtility.createLabel(keyFileComposite, "User ID");
	ftpWidgetUtility.createText(keyFileComposite, "", SWT.BORDER);
	Button keyFileBrwsBtn1 = new Button(keyFileComposite, SWT.NONE);
	keyFileBrwsBtn1.setVisible(false);
	
	ftpWidgetUtility.createLabel(keyFileComposite, "Public/Private Key");
	Text privateKeyTxt = (Text) ftpWidgetUtility.createText(keyFileComposite, "", SWT.BORDER);
	Button keyFileBrwsBtn = new Button(keyFileComposite, SWT.NONE);
	keyFileBrwsBtn.setText("...");
	
	selectionListener(keyFileBrwsBtn, privateKeyTxt);

	return keyFileComposite;
}
 
Example 19
Project: gw4e.project   File: GW4ELaunchConfigurationTab.java   Source Code and License 6 votes vote down vote up
private void createRemoveBlockedElementGroup (Composite parent) {
Label lfiller = new Label(parent, SWT.NONE);
lfiller.setText("");

Label lblRemoveBlockedElement = new Label(parent, SWT.NONE);
lblRemoveBlockedElement.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
lblRemoveBlockedElement.setText(MessageUtil.getString("removeBlockedElement"));

removeBockedElementButton = new Button(parent, SWT.CHECK);
removeBockedElementButton.setText("");
removeBockedElementButton.setSelection(true);
 
removeBockedElementButton.addSelectionListener(new SelectionAdapter() {
	@Override
	public void widgetSelected(SelectionEvent evt) {
		validatePage();
	}
});

	
}
 
Example 20
Project: neoscada   File: DefaultPage.java   Source Code and License 6 votes vote down vote up
@Override
protected Control createContents ( final Composite parent )
{
    final Composite wrapper = new Composite ( parent, SWT.NONE );
    wrapper.setLayout ( new GridLayout ( 1, false ) );

    final Label label = new Label ( wrapper, SWT.NONE );
    label.setText ( "Preferences for Eclipse SCADA Security" );

    final Button testButton = new Button ( wrapper, SWT.NONE );
    testButton.setText ( "Test key selection…" );
    testButton.addSelectionListener ( new SelectionAdapter () {
        @Override
        public void widgetSelected ( final SelectionEvent e )
        {
            openDialog ();
        }
    } );

    return wrapper;
}
 
Example 21
Project: Hydrograph   File: FilterConditionsDialog.java   Source Code and License 6 votes vote down vote up
private void addButtonInTable(TableViewer tableViewer, TableItem tableItem, String columnName, 
		String buttonPaneName, String editorName, int columnIndex, SelectionListener buttonSelectionListener,
		ImagePathConstant imagePath) {
	final Composite buttonPane = new Composite(tableViewer.getTable(), SWT.NONE);
	buttonPane.setLayout(new FillLayout());
	final Button button = new Button(buttonPane, SWT.NONE);
	//button.setText(columnName);
	button.setData(FilterConstants.ROW_INDEX, tableViewer.getTable().indexOf(tableItem));
	tableItem.setData(columnName, button);
	tableItem.setData(buttonPaneName, buttonPane);
	button.addSelectionListener(buttonSelectionListener);
	button.setImage(imagePath.getImageFromRegistry());
	
	final TableEditor editor = new TableEditor(tableViewer.getTable());
	editor.grabHorizontal = true;
	editor.grabVertical = true;
	editor.setEditor(buttonPane, tableItem, columnIndex);
	editor.layout();
	button.setData(editorName, editor);
}
 
Example 22
Project: Hydrograph   File: JobRunPreferenceComposite.java   Source Code and License 6 votes vote down vote up
/**
 * @param selection
 */
private void createSaveJobPromtGroup(String selection) {
	HydroGroup hydroGroup = new HydroGroup(this, SWT.NONE);
	hydroGroup.setHydroGroupText(Messages.SAVE_JOBS_BEFORE_LAUNCHING_MESSAGE);
	hydroGroup.setLayout(new GridLayout(1, false));
	hydroGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
	hydroGroup.getHydroGroupClientArea().setLayout(new GridLayout(2, false));
	hydroGroup.getHydroGroupClientArea().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

	btnRadioButtonAlways = new Button(hydroGroup.getHydroGroupClientArea(), SWT.RADIO);
	btnRadioButtonAlways.setText(StringUtils.capitalize((MessageDialogWithToggle.ALWAYS)));

	btnRadioButtonPrompt = new Button(hydroGroup.getHydroGroupClientArea(), SWT.RADIO);
	btnRadioButtonPrompt.setText(StringUtils.capitalize(MessageDialogWithToggle.PROMPT));

	if (StringUtils.equals(selection, MessageDialogWithToggle.ALWAYS)) {
		btnRadioButtonAlways.setSelection(true);
	} else {
		btnRadioButtonPrompt.setSelection(true);
	}
}
 
Example 23
Project: neoscada   File: ResetControllerImpl.java   Source Code and License 6 votes vote down vote up
public ResetControllerImpl ( final ControllerManager controllerManager, final ChartContext chartContext, final ResetController controller )
{
    final Composite space = chartContext.getExtensionSpaceProvider ().getExtensionSpace ();
    this.resetHandler = chartContext.getResetHandler ();
    if ( space != null && this.resetHandler != null )
    {
        this.button = new Button ( space, SWT.PUSH );
        this.button.setText ( Messages.ResetControllerImpl_Label );
        this.button.addSelectionListener ( new SelectionAdapter () {
            @Override
            public void widgetSelected ( final SelectionEvent e )
            {
                action ();
            }
        } );
        space.layout ();
    }
    else
    {
        this.button = null;
    }
}
 
Example 24
Project: OCCI-Studio   File: LoadExtensionDialog.java   Source Code and License 6 votes vote down vote up
protected void prepareBrowseRegisteredPackagesButton(
		Button browseRegisteredPackagesButton) {
	browseRegisteredPackagesButton
			.addSelectionListener(new SelectionAdapter() {
				@Override
				public void widgetSelected(SelectionEvent event) {
					RegisteredExtensionsDialog registeredExtensionsDialog = new RegisteredExtensionsDialog(
							getShell());
					registeredExtensionsDialog.open();
					Object[] result = registeredExtensionsDialog
							.getResult();
					if (result != null) {
						StringBuffer schemes = new StringBuffer();
						for (int i = 0, length = result.length; i < length; i++) {
							schemes.append(OcciRegistry.getInstance()
									.getExtensionURI(
											String.valueOf(result[i])));
							schemes.append("  "); //$NON-NLS-1$
						}
						uriField.setText((uriField.getText() + "  " + schemes //$NON-NLS-1$
								.toString()).trim());
					}
				}
			});
}
 
Example 25
Project: neoscada   File: TrendControlImage.java   Source Code and License 6 votes vote down vote up
public TrendControlImage ( final Composite parent, final int style, final String connectionId, final String itemId, final String queryString )
{
    super ( parent, style );

    this.connectionId = connectionId;
    this.itemId = itemId;
    this.queryString = queryString;

    setLayout ( new FillLayout () );

    final Button button = new Button ( parent, SWT.PUSH | SWT.FLAT );
    button.setImage ( org.eclipse.scada.vi.details.swt.Activator.getDefault ().getImageRegistry ().get ( org.eclipse.scada.vi.details.swt.Activator.IMG_TREND ) );
    button.addSelectionListener ( new SelectionAdapter () {
        @Override
        public void widgetSelected ( final SelectionEvent e )
        {
            startHdView ();
        }
    } );
}
 
Example 26
Project: Open_Source_ECOA_Toolset_AS5   File: EventServiceComposite.java   Source Code and License 6 votes vote down vote up
@Override
public void mouseUp(MouseEvent e) {
	if (((Button) e.getSource()).getText().equalsIgnoreCase("Add")) {
		Parameter val = new Parameter();
		val.setName("");
		val.setType("");
		getParamArr().add(val);
		tabValues.refresh();
	} else if (((Button) e.getSource()).getText().equalsIgnoreCase("Remove")) {
		int[] items = tabValues.getTable().getSelectionIndices();
		ArrayList<Parameter> rem = new ArrayList<Parameter>();
		for (int item : items) {
			rem.add(getParamArr().get(item));
		}
		getParamArr().removeAll(rem);
		tabValues.refresh();
	} else if (((Button) e.getSource()).getText().equalsIgnoreCase("Clear")) {
		getParamArr().clear();
		tabValues.refresh();
	}
}
 
Example 27
Project: Hydrograph   File: ParameterGridDialog.java   Source Code and License 6 votes vote down vote up
public void addGridRowSelectionListener(){
	for(Composite row: textGrid.getGrid()){

		//((Button)row.getChildren()[0]).

		((Button)row.getChildren()[0]).addSelectionListener(new SelectionAdapter() {

			@Override
			public void widgetSelected(SelectionEvent e) {
				// TODO Auto-generated method stub
				super.widgetSelected(e);
				changeHeaderCheckboxSelection();
			}
		});
	}
}
 
Example 28
Project: gw4e.project   File: LabelizedCheckBoxes.java   Source Code and License 6 votes vote down vote up
/**
 * Create the composite.
 * @param parent
 * @param style
 */
public LabelizedCheckBoxes(Composite parent,
		int style, 
		String [] labels,
		boolean [] enabled,
		boolean [] checked,
		SelectionAdapter [] checkBoxSelectionAdapters) {
	super(parent, style);
	setLayout(new GridLayout(10, false));
	buttons = new Button [labels.length]; 
	for (int i = 0; i < labels.length; i++) {
		buttons [i] = new Button(parent, SWT.CHECK);
		buttons [i].setEnabled(enabled [i]);
		buttons [i].setSelection(checked [i]);
		buttons [i].setText(labels [i]);
		if (checkBoxSelectionAdapters[i]!=null) {
			buttons [i].addSelectionListener(checkBoxSelectionAdapters[i]);
		}
		buttons [i].setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 6, 1));
		buttons [i].setData(PROJECT_PROPERTY_PAGE_WIDGET_ID, BUTTON+"."+i);

		}
}
 
Example 29
Project: applecommander   File: DiskImageFormatPane.java   Source Code and License 5 votes vote down vote up
/**
 * Create a radio button for the disk image format list.
 */
protected void createRadioButton(Composite composite, String label, 
	final int format, String helpText) {
		
	Button button = new Button(composite, SWT.RADIO);
	button.setText(label);
	button.setSelection(wizard.getFormat() == format);
	button.setToolTipText(helpText);
	button.addSelectionListener(new SelectionAdapter() {
		public void widgetSelected(SelectionEvent e) {
			getWizard().setFormat(format);
		}
	});
}
 
Example 30
Project: time4sys   File: GeneralPropertiesEditionPartImpl.java   Source Code and License 5 votes vote down vote up
protected Composite createIsAtomicCheckbox(Composite parent) {
	isAtomic = new Button(parent, SWT.CHECK);
	isAtomic.setText(getDescription(GqamViewsRepository.General.Properties.isAtomic,
			GqamMessages.GeneralPropertiesEditionPart_IsAtomicLabel));
	isAtomic.addSelectionListener(new SelectionAdapter() {

		/**
		 * {@inheritDoc}
		 *
		 * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
		 * 
		 */
		public void widgetSelected(SelectionEvent e) {
			if (propertiesEditionComponent != null)
				propertiesEditionComponent
						.firePropertiesChanged(new PropertiesEditionEvent(GeneralPropertiesEditionPartImpl.this,
								GqamViewsRepository.General.Properties.isAtomic, PropertiesEditionEvent.COMMIT,
								PropertiesEditionEvent.SET, null, new Boolean(isAtomic.getSelection())));
		}

	});
	GridData isAtomicData = new GridData(GridData.FILL_HORIZONTAL);
	isAtomicData.horizontalSpan = 2;
	isAtomic.setLayoutData(isAtomicData);
	EditingUtils.setID(isAtomic, GqamViewsRepository.General.Properties.isAtomic);
	EditingUtils.setEEFtype(isAtomic, "eef::Checkbox"); //$NON-NLS-1$
	SWTUtils.createHelpButton(parent, propertiesEditionComponent
			.getHelpContent(GqamViewsRepository.General.Properties.isAtomic, GqamViewsRepository.SWT_KIND), null); // $NON-NLS-1$
	// Start of user code for createIsAtomicCheckbox

	// End of user code
	return parent;
}
 
Example 31
Project: BiglyBT   File: BuddyPluginView.java   Source Code and License 5 votes vote down vote up
private void
selectButtonGroup(
	List<Button>		buttons,
	int					data )
{
	for ( Button b: buttons ){

		b.setSelection( (Integer)b.getData() == data );
	}
}
 
Example 32
Project: n4js   File: InterfacesComponentProvider.java   Source Code and License 5 votes vote down vote up
/**
 * Creates a new interfaces component inside the parent composite using the given model.
 *
 * @param interfacesContainingModel
 *            A interface containing model
 * @param container
 *            The component container
 */
public InterfacesComponent(InterfacesContainingModel interfacesContainingModel,
		WizardComponentContainer container) {
	super(container);
	this.model = interfacesContainingModel;

	Composite parent = getParentComposite();

	Label interfacesLabel = new Label(parent, SWT.NONE);

	GridData interfacesLabelGridData = fillLabelDefaults();
	interfacesLabelGridData.verticalAlignment = SWT.TOP;
	interfacesLabel.setLayoutData(interfacesLabelGridData);

	interfacesLabel.setText("Interfaces:");

	interfacesTable = new Table(parent, SWT.BORDER | SWT.FULL_SELECTION | SWT.VIRTUAL);
	interfacesTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

	Composite interfacesButtonsComposite = new Composite(parent, SWT.NONE);
	interfacesButtonsComposite.setLayoutData(GridDataFactory.fillDefaults().create());

	interfacesButtonsComposite.setLayout(GridLayoutFactory.swtDefaults().numColumns(1).margins(0, 0).create());

	interfacesAddButton = new Button(interfacesButtonsComposite, SWT.NONE);
	interfacesAddButton.setText("Add...");
	interfacesAddButton.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());

	interfacesRemoveButton = new Button(interfacesButtonsComposite, SWT.NONE);
	interfacesRemoveButton.setText("Remove");
	interfacesRemoveButton.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());

	setupBindings();
}
 
Example 33
Project: codelens-eclipse   File: ViewZoneDemo.java   Source Code and License 5 votes vote down vote up
public static void main(String[] args) throws Exception {
	// create the widget's shell
	Shell shell = new Shell();
	shell.setLayout(new FillLayout());
	shell.setSize(500, 500);
	Display display = shell.getDisplay();

	Composite parent = new Composite(shell, SWT.NONE);
	parent.setLayout(new GridLayout(2, false));

	ITextViewer textViewer = new TextViewer(parent, SWT.V_SCROLL | SWT.BORDER);
	textViewer.setDocument(new Document(""));
	StyledText styledText = textViewer.getTextWidget();
	styledText.setLayoutData(new GridData(GridData.FILL_BOTH));

	ViewZoneChangeAccessor viewZones = new ViewZoneChangeAccessor(textViewer);

	Button add = new Button(parent, SWT.NONE);
	add.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false, 0, 0));
	add.setText("Add Zone");
	add.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			InputDialog dlg = new InputDialog(Display.getCurrent().getActiveShell(), "", "Enter view zone content",
					"Zone " + viewZones.getSize(), null);
			if (dlg.open() == Window.OK) {
				int line = styledText.getLineAtOffset(styledText.getCaretOffset());
				IViewZone zone = new DefaultViewZone(line, 20, dlg.getValue());
				viewZones.addZone(zone);
				viewZones.layoutZone(zone);
			}
		}
	});

	shell.open();
	while (!shell.isDisposed())
		if (!display.readAndDispatch())
			display.sleep();
}
 
Example 34
Project: Hydrograph   File: ExpressionComposite.java   Source Code and License 5 votes vote down vote up
private void createSwitchToExpressionButton(Composite switchToCompsite) {
		expressionRadioButton = new Button(switchToCompsite, SWT.RADIO);
		expressionRadioButton.setText("Expression");
		expressionRadioButton.setSelection(true);
		expressionRadioButton.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
//				dialog.switchToExpression();
//				dialog.getDataStructure().setOperation(false);
//				dialog.refreshErrorLogs();
			}
		});
	}
 
Example 35
Project: Hydrograph   File: OperationComposite.java   Source Code and License 5 votes vote down vote up
private void createExpressionEditingTextBox(Composite composite_1) {
	Composite composite = new Composite(composite_1, SWT.NONE);
	composite.setLayout(new GridLayout(2, false));
	GridData gd_composite = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
	gd_composite.heightHint = 29;
	composite.setLayoutData(gd_composite);

	logicTextBox = new Text(composite, SWT.BORDER);
	logicTextBox.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	logicTextBox.setEditable(false);
	logicTextBox.setText(operationDataStructure.getQualifiedOperationClassName());

	Button openEditorButton = new Button(composite, SWT.NONE);
	openEditorButton.setText("...");
	openEditorButton.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			ELTOperationClassDialog eltOperationClassDialog = new ELTOperationClassDialog(
					Display.getCurrent().getActiveShell(), dialog.getPropertyDialogButtonBar(),
					createDSForClassWindow(), dialog.getWidgetConfig(), dialog.getComponent().getComponentName());
			eltOperationClassDialog.open();
			updateOperationDS(eltOperationClassDialog);
			if (eltOperationClassDialog.isYesPressed()) {
				dialog.pressOK();
			} else if (eltOperationClassDialog.isNoPressed()) {
				dialog.pressCancel();
			}
			dialog.refreshErrorLogs();
		}

	});

}
 
Example 36
Project: n4js   File: N4MFWizardNewProjectCreationPage.java   Source Code and License 5 votes vote down vote up
private Composite initDefaultOptionsUI(DataBindingContext dbc, Composite parent) {
	// A group for default options
	final Group defaultOptions = new Group(parent, NONE);
	defaultOptions.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).create());

	final Button createGreeterFileButton = new Button(defaultOptions, CHECK);
	createGreeterFileButton.setText("Create a greeter file");

	initDefaultCreateGreeterBindings(dbc, createGreeterFileButton);

	return defaultOptions;
}
 
Example 37
Project: Hydrograph   File: TransformDialog.java   Source Code and License 5 votes vote down vote up
private void attachListenerOnSwitchToClassButton(
			final ExpandItem expandItem,
			final OperationClassComposite operationClassComposite,
			final AbstractExpressionComposite expressionComposite) {
		expressionComposite.getSwitchToClassButton().addSelectionListener(new SelectionAdapter() {
 			@Override
 			public void widgetSelected(SelectionEvent e) 
 			{
 				Button toggleButton=(Button)e.widget;
 				if(toggleButton.getSelection())
 				{
 					toggleButton.setSelection(false);
 					expandItem.setControl(operationClassComposite);
 					expandItem.setText(operationClassComposite.getOperationIdTextBox().getText());
 					MappingSheetRow mappingSheetRowForExpressionClass=(MappingSheetRow)expressionComposite.getData(Messages.MAPPING_SHEET);
 					MappingSheetRow mappingSheetRowForOperationClass=
 							(MappingSheetRow)operationClassComposite.getBrowseButton().getData(Messages.MAPPING_SHEET);
 					removeExpressionOrOperationOutputFieldFromOutputList(mappingSheetRowForExpressionClass);
 					transformMapping.getOutputFieldList().addAll(mappingSheetRowForOperationClass.getOutputList());
 					mappingSheetRowForExpressionClass.setActive(false);
 					mappingSheetRowForOperationClass.setActive(true);
 					operationClassComposite.getSwitchToClassButton().setSelection(true);
 					expressionComposite.setVisible(false);
 					operationClassComposite.setVisible(true);
 					setDuplicateOperationInputFieldMap(mappingSheetRowForOperationClass);
 					refreshOutputTable();
 					showHideValidationMessage();
 					if(Constants.AGGREGATE.equalsIgnoreCase(component.getComponentName())||
 		    	     	   Constants.TRANSFORM.equalsIgnoreCase(component.getComponentName()) ||
 		    	     	 Constants.GROUP_COMBINE.equalsIgnoreCase(component.getComponentName()))
 		    	     	{
// 		    	     		expandItem.setHeight(220);
// 		    	     		middleSashForm.setWeights(new int[] {54, 59, 25});
 		    	     		scrolledComposite.setMinSize(expandBar.computeSize(SWT.DEFAULT, SWT.DEFAULT));
 		    	     	}
    				}	
 			}
 		});
	}
 
Example 38
Project: Hydrograph   File: MultiParameterFileDialog.java   Source Code and License 5 votes vote down vote up
/**
 * Create contents of the button bar.
 * 
 * @param parent
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
	 Button okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL,true);
	okButton.setFocus();
	applyButton = createButton(parent, IDialogConstants.NO_ID, "Apply", false);
	applyButton.setEnabled(false);
	createButton(parent, IDialogConstants.CANCEL_ID,IDialogConstants.CANCEL_LABEL, false);
}
 
Example 39
Project: Hydrograph   File: FTPOperationConfigUtility.java   Source Code and License 5 votes vote down vote up
/**
 * @param control
 * @return
 */
public Control addLocalRemoteRemoveFiles(Composite control){
	Composite composite = new Composite(control, SWT.BORDER);
	composite.setLayout(new GridLayout(3, false));
	composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
	
	FTPWidgetUtility ftpWidgetUtility = new FTPWidgetUtility();
	ftpWidgetUtility.createLabel(composite, "Local Path");
	Text localPathTxt = (Text) ftpWidgetUtility.createText(composite, "", SWT.BORDER);
	Button localPathBrwsBtn = new Button(composite, SWT.NONE);
	localPathBrwsBtn.setText("...");
	selectionListener(localPathBrwsBtn, localPathTxt);
	
	ftpWidgetUtility.createLabel(composite, "File Name");
	ftpWidgetUtility.createText(composite, "", SWT.BORDER);
	
	
	return composite;
}
 
Example 40
Project: n4js   File: N4MFWizardNewProjectCreationPage.java   Source Code and License 5 votes vote down vote up
@SuppressWarnings("unchecked")
private void initTestProjectBinding(DataBindingContext dbc, Button addNormalSourceFolderButton,
		Button createTestGreeterFileButton) {
	// Bind the "normal source folder"-checkbox
	dbc.bindValue(WidgetProperties.selection().observe(addNormalSourceFolderButton),
			PojoProperties.value(N4MFProjectInfo.class, N4MFProjectInfo.ADDITIONAL_NORMAL_SOURCE_FOLDER_PROP_NAME)
					.observe(projectInfo));

	// Bind the "Create greeter file"-checkbox
	dbc.bindValue(WidgetProperties.selection().observe(createTestGreeterFileButton),
			BeanProperties.value(N4MFProjectInfo.class, N4MFProjectInfo.CREATE_GREETER_FILE_PROP_NAME)
					.observe(projectInfo));
}
 
Example 41
Project: SimQRI   File: StoragePropertiesEditionPartImpl.java   Source Code and License 5 votes vote down vote up
protected Composite createOverflowCheckbox(Composite parent) {
	overflow = new Button(parent, SWT.CHECK);
	overflow.setText(getDescription(MetamodelViewsRepository.Storage.Properties.overflow, MetamodelMessages.StoragePropertiesEditionPart_OverflowLabel));
	overflow.addSelectionListener(new SelectionAdapter() {

		/**
		 * {@inheritDoc}
		 *
		 * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
		 * 	
		 */
		public void widgetSelected(SelectionEvent e) {
			if (propertiesEditionComponent != null)
				propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(StoragePropertiesEditionPartImpl.this, MetamodelViewsRepository.Storage.Properties.overflow, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, new Boolean(overflow.getSelection())));
		}

	});
	GridData overflowData = new GridData(GridData.FILL_HORIZONTAL);
	overflowData.horizontalSpan = 2;
	overflow.setLayoutData(overflowData);
	EditingUtils.setID(overflow, MetamodelViewsRepository.Storage.Properties.overflow);
	EditingUtils.setEEFtype(overflow, "eef::Checkbox"); //$NON-NLS-1$
	SWTUtils.createHelpButton(parent, propertiesEditionComponent.getHelpContent(MetamodelViewsRepository.Storage.Properties.overflow, MetamodelViewsRepository.SWT_KIND), null); //$NON-NLS-1$
	// Start of user code for createOverflowCheckbox

	// End of user code
	return parent;
}
 
Example 42
Project: Hydrograph   File: AggregateCumulateExpressionComposite.java   Source Code and License 5 votes vote down vote up
/**
 * @param isParam
 * @param isWholeOperationParameter
 */
private void disabledWidgetsifWholeExpressionIsParameterForAggregateCumulate(Button isParam,
		boolean isWholeOperationParameter) {
	if (isWholeOperationParameter) {
		Text textAccumulator = (Text) isParam.getData(Messages.TEXT_ACCUMULATOR);
		Button isParamAccumulator = (Button) isParam.getData(Messages.ISPARAM_ACCUMULATOR);
		Combo comboDataTypes = (Combo) isParam.getData(Messages.COMBODATATYPES);
		textAccumulator.setEnabled(false);
		isParamAccumulator.setEnabled(false);
		comboDataTypes.setEnabled(false);
		super.disabledWidgetsifWholeExpressionIsParameter(isParamAccumulator, isWholeOperationParameter);
	}

}
 
Example 43
Project: ide-plugins   File: AccountSWT.java   Source Code and License 5 votes vote down vote up
@Override
protected void createButtonsForButtonBar(Composite parent) {
    super.createButtonsForButtonBar(parent);

    Button ok = getButton(IDialogConstants.OK_ID);
    ok.setText("Sign In");
    ok.setEnabled(false);
    setButtonLayoutData(ok);
    ok.addListener(SWT.Selection, e -> {
        disableDialog();

        futureTask = DialogUtils.supplyAsync(new AccountTask(userText.getText(), passwordText.getText()))
            .exceptionally(ex -> {
                ex.printStackTrace();
                restoreDialog(null); 
                return null;
            })
            .thenAccept(this::restoreDialog);
    });

    Button cancel = getButton(IDialogConstants.CANCEL_ID);
    cancel.setText("Cancel");
    setButtonLayoutData(cancel);
    cancel.addListener(SWT.Selection, e -> {
        if (futureTask != null && ! futureTask.isDone()) {
            futureTask.cancel(true);
        }
        credentials.setUserKey(false, null);
    });
}
 
Example 44
Project: convertigo-eclipse   File: ProjectVersionUpdateDialog.java   Source Code and License 5 votes vote down vote up
@Override
protected Control createButtonBar(Composite parent) {
	Control buttonBar =  super.createButtonBar(parent);
	getButton(IDialogConstants.OK_ID).setText("Update");
	getButton(IDialogConstants.OK_ID).setEnabled(false);
	Button cancel = getButton(IDialogConstants.CANCEL_ID);
	cancel.setText("Skip");
	cancel.setFocus();
	return buttonBar;
}
 
Example 45
Project: Hydrograph   File: FTPAuthenticEditorDialog.java   Source Code and License 5 votes vote down vote up
private void selectionListener(Button button, Text txt){
	button.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			FileDialog filedialog = new FileDialog(button.getShell(), SWT.None);
			txt.setText(filedialog.open());
		}
	});
}
 
Example 46
Project: eclipse-jenkins-editor   File: JenkinsEditorPreferencePage.java   Source Code and License 5 votes vote down vote up
protected void createDependency(Button master, Control slave) {
	Assert.isNotNull(slave);
	indent(slave);
	MasterButtonSlaveSelectionListener listener = new MasterButtonSlaveSelectionListener(master, slave);
	master.addSelectionListener(listener);
	this.masterSlaveListeners.add(listener);
}
 
Example 47
Project: pgcodekeeper   File: DbStorePrefPage.java   Source Code and License 5 votes vote down vote up
@Override
public void createControl(Composite parent) {
    super.createControl(parent);

    Button btnDef = getDefaultsButton();
    btnDef.setText(Messages.dbStorePrefPage_clear_db_store);
    GridData defGd = (GridData) btnDef.getLayoutData();
    defGd.widthHint = Math.max(defGd.widthHint,
            btnDef.computeSize(SWT.DEFAULT, SWT.DEFAULT).x);
    btnDef.getParent().layout();
}
 
Example 48
Project: gemoc-studio-modeldebugging   File: LaunchConfigurationDataProcessingTab.java   Source Code and License 5 votes vote down vote up
@Override
public void initializeFrom(ILaunchConfiguration configuration) {
	for (EngineAddonSpecificationExtension extension : _components.keySet()) {
		try {
			boolean value = configuration.getAttribute(extension.getName(), false);
			// _componentsActive.put(extension, value);
			Button checkbox = _components.get(extension);
			checkbox.setSelection(value);
		} catch (CoreException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
 
Example 49
Project: gemoc-studio-modeldebugging   File: LaunchConfigurationDataProcessingTab.java   Source Code and License 5 votes vote down vote up
@Override
public boolean isValid(ILaunchConfiguration config) {
	// Validate each addon
	try {
		List<IEngineAddon> addons = new ArrayList<IEngineAddon>();
		for (Entry<EngineAddonSpecificationExtension, Button> entry : _components.entrySet()) {
			if (entry.getValue().getSelection()) {
				addons.add(entry.getKey().instanciateComponent());
			}
		}
		List<String> errors = new ArrayList<String>();
		for (IEngineAddon iEngineAddon : addons) {
			errors.addAll(iEngineAddon.validate(addons));
		}
		if (!errors.isEmpty()) {
			for (String msg : errors) {
				setErrorMessage(msg);
			}
			return false;
		}
	} catch (Exception e) {
		e.printStackTrace();
	}

	setErrorMessage(null);
	return true;
}
 
Example 50
Project: eclipse-batch-editor   File: BatchEditorPreferencePage.java   Source Code and License 5 votes vote down vote up
protected void createDependency(Button master, Control slave) {
	Assert.isNotNull(slave);
	indent(slave);
	MasterButtonSlaveSelectionListener listener = new MasterButtonSlaveSelectionListener(master, slave);
	master.addSelectionListener(listener);
	this.masterSlaveListeners.add(listener);
}
 
Example 51
Project: eclipse-batch-editor   File: BatchEditorPreferencePage.java   Source Code and License 5 votes vote down vote up
private Button addButton(Composite parent, int style, String label, int indentation, SelectionListener listener) {
	Button button = new Button(parent, style);
	button.setText(label);

	GridData gd = new GridData(32);
	gd.horizontalIndent = indentation;
	gd.horizontalSpan = 2;
	button.setLayoutData(gd);
	button.addSelectionListener(listener);

	return button;
}
 
Example 52
Project: eZooKeeper   File: GridDialog.java   Source Code and License 5 votes vote down vote up
private void updateStatus(GridCompositeEvent event) {
    GridCompositeStatus status = event.getStatus();

    boolean isError = status.getType().isError();
    String message = null;
    if (isError) {
        message = status.getMessage();
    }
    setErrorMessage(message);

    Button okButton = getButton(IDialogConstants.OK_ID);
    if (okButton != null) {
        okButton.setEnabled(!isError);
    }
}
 
Example 53
Project: Hydrograph   File: JoinMapGrid.java   Source Code and License 5 votes vote down vote up
public Button buttonWidget(Composite parent, int style, int[] bounds,
		String value, Image image) {
	Button button = new Button(parent, style);
	button.setBounds(bounds[0], bounds[1], bounds[2], bounds[3]);
	button.setText(value);
	button.setImage(image);
	return button;
}
 
Example 54
Project: Hydrograph   File: ExpressionComposite.java   Source Code and License 5 votes vote down vote up
private void createSwitchToOperationButton(Composite switchToCompsite) {
	operationRadioButton = new Button(switchToCompsite, SWT.RADIO);
	operationRadioButton.setText("Operation");
	operationRadioButton.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			dialog.switchToOperation();
			dialog.getDataStructure().setOperation(true);
			dialog.refreshErrorLogs();
		}
	});
}
 
Example 55
Project: time4sys   File: GeneralPropertiesEditionPartImpl.java   Source Code and License 5 votes vote down vote up
protected Composite createMinOpenCheckbox(Composite parent) {
	minOpen = new Button(parent, SWT.CHECK);
	minOpen.setText(getDescription(NfpViewsRepository.General.Properties.minOpen, NfpMessages.GeneralPropertiesEditionPart_MinOpenLabel));
	minOpen.addSelectionListener(new SelectionAdapter() {

		/**
		 * {@inheritDoc}
		 *
		 * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
		 * 	
		 */
		public void widgetSelected(SelectionEvent e) {
			if (propertiesEditionComponent != null)
				propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(GeneralPropertiesEditionPartImpl.this, NfpViewsRepository.General.Properties.minOpen, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, new Boolean(minOpen.getSelection())));
		}

	});
	GridData minOpenData = new GridData(GridData.FILL_HORIZONTAL);
	minOpenData.horizontalSpan = 2;
	minOpen.setLayoutData(minOpenData);
	EditingUtils.setID(minOpen, NfpViewsRepository.General.Properties.minOpen);
	EditingUtils.setEEFtype(minOpen, "eef::Checkbox"); //$NON-NLS-1$
	SWTUtils.createHelpButton(parent, propertiesEditionComponent.getHelpContent(NfpViewsRepository.General.Properties.minOpen, NfpViewsRepository.SWT_KIND), null); //$NON-NLS-1$
	// Start of user code for createMinOpenCheckbox

	// End of user code
	return parent;
}
 
Example 56
Project: Hydrograph   File: SelectionDatabaseWidget.java   Source Code and License 5 votes vote down vote up
/**
 * Creates the stack layout composite for Table option
 * @param eltSuDefaultSubgroupComposite
 */
private void createTableNameComposite(ELTSubGroupCompositeWithStack eltSuDefaultSubgroupComposite) {

	Utils.INSTANCE.loadProperties();
	cursor = eltSuDefaultSubgroupComposite.getContainerControl().getDisplay().getSystemCursor(SWT.CURSOR_HAND);
	tableComposite = new ELTSubGroupCompositeWithStack(eltSuDefaultSubgroupComposite.getContainerControl());
	tableComposite.createContainerWidget();

	tableComposite.numberOfBasicWidgets(2);
	AbstractELTWidget createWidgetlabel = createWidgetlabel(Messages.LABEL_TABLE_NAME, tableComposite);
	selectLable.getSWTWidgetControl().setData(String.valueOf(key_value++), createWidgetlabel.getSWTWidgetControl());
	
	AbstractELTWidget tableNameWgt = createWidgetTextbox(Messages.LABEL_TABLE_NAME, tableComposite);
	tableNameDecorator = attachDecoratorToTextbox(Messages.LABEL_TABLE_NAME, tableNameWgt, tableNameDecorator);
	textBoxTableName = (Text) tableNameWgt.getSWTWidgetControl();

	attachListeners(tableNameWgt);

	AbstractELTWidget createWidgetlabel2 = createWidgetlabel(Messages.EXTRACT_FROM_METASTORE, tableComposite);
	selectLable.getSWTWidgetControl().setData(String.valueOf(key_value++), createWidgetlabel2.getSWTWidgetControl());
	ELTDefaultButton editButton = new ELTDefaultButton(Messages.EXTRACT);
	tableComposite.attachWidget(editButton);

	Button button = (Button) editButton.getSWTWidgetControl();
	GridData data = new GridData(SWT.LEFT, SWT.CENTER, false, false, 0, 0);
	data.widthHint = 92;
	data.horizontalIndent = 15;
	button.setLayoutData(data);

	button.addSelectionListener(attachExtractButtonSelectionListner());

}
 
Example 57
Project: time4sys   File: GeneralPropertiesEditionPartImpl.java   Source Code and License 5 votes vote down vote up
protected Composite createMemoryProtectionCheckbox(Composite parent) {
	memoryProtection = new Button(parent, SWT.CHECK);
	memoryProtection.setText(getDescription(HrmViewsRepository.General.Properties.memoryProtection,
			HrmMessages.GeneralPropertiesEditionPart_MemoryProtectionLabel));
	memoryProtection.addSelectionListener(new SelectionAdapter() {

		/**
		 * {@inheritDoc}
		 *
		 * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
		 * 
		 */
		public void widgetSelected(SelectionEvent e) {
			if (propertiesEditionComponent != null)
				propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(
						GeneralPropertiesEditionPartImpl.this,
						HrmViewsRepository.General.Properties.memoryProtection, PropertiesEditionEvent.COMMIT,
						PropertiesEditionEvent.SET, null, new Boolean(memoryProtection.getSelection())));
		}

	});
	GridData memoryProtectionData = new GridData(GridData.FILL_HORIZONTAL);
	memoryProtectionData.horizontalSpan = 2;
	memoryProtection.setLayoutData(memoryProtectionData);
	EditingUtils.setID(memoryProtection, HrmViewsRepository.General.Properties.memoryProtection);
	EditingUtils.setEEFtype(memoryProtection, "eef::Checkbox"); //$NON-NLS-1$
	SWTUtils.createHelpButton(parent, propertiesEditionComponent.getHelpContent(
			HrmViewsRepository.General.Properties.memoryProtection, HrmViewsRepository.SWT_KIND), null); // $NON-NLS-1$
	// Start of user code for createMemoryProtectionCheckbox

	// End of user code
	return parent;
}
 
Example 58
Project: Hydrograph   File: TransformDialog.java   Source Code and License 5 votes vote down vote up
private void addSelectionListenerToBrowseButton(
		final OperationClassComposite operationClassComposite) {
	operationClassComposite.getBrowseButton().addSelectionListener(new SelectionAdapter() {
   			
			@Override
			public void widgetSelected(SelectionEvent e) {
				MappingSheetRow orignalMappingSheetRow = (MappingSheetRow) ((Button) e.widget).getData(Messages.MAPPING_SHEET);
				Text operationClassTextBox=(Text)((Button)e.widget).getData(OPERATION_CLASS_TEXT_BOX);
				MappingSheetRow oldMappingSheetRow = (MappingSheetRow) orignalMappingSheetRow.clone();
				OperationClassDialog operationClassDialog = new OperationClassDialog(operationClassComposite.getBrowseButton().getShell(), component
						.getComponentName(), orignalMappingSheetRow, propertyDialogButtonBar, widgetConfig,
						transformDialog);
				operationClassDialog.open();
				orignalMappingSheetRow.setComboBoxValue(operationClassDialog.getMappingSheetRow().getComboBoxValue());
				orignalMappingSheetRow.setOperationClassPath(operationClassDialog.getMappingSheetRow()
						.getOperationClassPath());
				orignalMappingSheetRow.setClassParameter(operationClassDialog.getMappingSheetRow().isClassParameter());
               
				orignalMappingSheetRow.setOperationClassFullPath(operationClassDialog.getMappingSheetRow()
						.getOperationClassFullPath());
				operationClassTextBox.setText(operationClassDialog.getMappingSheetRow().getOperationClassPath());
				
				if (operationClassDialog.isCancelPressed() && (!(operationClassDialog.isApplyPressed()))) {
					orignalMappingSheetRow.setNameValueProperty(oldMappingSheetRow.getNameValueProperty());
				}
				if (operationClassDialog.isNoPressed())
					pressCancel();
				if (operationClassDialog.isYesPressed())
					pressOK();
				super.widgetSelected(e);
			}

		});
}
 
Example 59
Project: AppleCommander   File: DiskImageFormatPane.java   Source Code and License 5 votes vote down vote up
/**
 * Create a radio button for the disk image format list.
 */
protected void createRadioButton(Composite composite, String label, 
	final int format, String helpText) {
		
	Button button = new Button(composite, SWT.RADIO);
	button.setText(label);
	button.setSelection(wizard.getFormat() == format);
	button.setToolTipText(helpText);
	button.addSelectionListener(new SelectionAdapter() {
		public void widgetSelected(SelectionEvent e) {
			getWizard().setFormat(format);
		}
	});
}
 
Example 60
Project: bdf2   File: ColumnDialog.java   Source Code and License 5 votes vote down vote up
private Binding bindWidgetValue(Object obj, String property, Object objWidget, UpdateValueStrategy targetToModel,
		UpdateValueStrategy modelToTarget) {
	IObservableValue model = BeanProperties.value(obj.getClass(), property).observe(obj);
	IObservableValue widget = null;
	if (objWidget instanceof Text) {
		widget = WidgetProperties.text(SWT.Modify).observe(objWidget);
	} else if (objWidget instanceof Button || objWidget instanceof Combo) {
		widget = WidgetProperties.selection().observe(objWidget);
	}
	return dataBindingContext.bindValue(widget, model, targetToModel, modelToTarget);
}