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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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: Hydrograph   File: ELTSchemaDialogSelectionListener.java   View source code 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 11
Project: Hydrograph   File: HeaderAndDataFormattingDialog.java   View source code 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 12
Project: Hydrograph   File: SourceSelectionPage.java   View source code 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 13
Project: Hydrograph   File: OutputRecordCountWidget.java   View source code 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 14
Project: Hydrograph   File: FilterHelper.java   View source code 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 15
Project: Hydrograph   File: ELTCheckFileExtensionListener.java   View source code 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 16
Project: eZooKeeper   File: ZnodeNewWizardComposite1.java   View source code 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 17
Project: Hydrograph   File: FTPAuthenticEditorUtility.java   View source code 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 18
Project: gw4e.project   File: GW4ELaunchConfigurationTab.java   View source code 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 19
Project: neoscada   File: DefaultPage.java   View source code 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 20
Project: Hydrograph   File: FilterConditionsDialog.java   View source code 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 21
Project: Hydrograph   File: JobRunPreferenceComposite.java   View source code 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 22
Project: neoscada   File: ResetControllerImpl.java   View source code 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 23
Project: OCCI-Studio   File: LoadExtensionDialog.java   View source code 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 24
Project: neoscada   File: TrendControlImage.java   View source code 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 25
Project: Open_Source_ECOA_Toolset_AS5   File: EventServiceComposite.java   View source code 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 26
Project: Hydrograph   File: ParameterGridDialog.java   View source code 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 27
Project: gw4e.project   File: LabelizedCheckBoxes.java   View source code 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 28
Project: applecommander   File: DiskImageFormatPane.java   View source code 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 29
Project: time4sys   File: GeneralPropertiesEditionPartImpl.java   View source code 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 30
Project: BiglyBT   File: BuddyPluginView.java   View source code 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 31
Project: n4js   File: InterfacesComponentProvider.java   View source code 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 32
Project: codelens-eclipse   File: ViewZoneDemo.java   View source code 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 33
Project: Hydrograph   File: ExpressionComposite.java   View source code 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 34
Project: Hydrograph   File: OperationComposite.java   View source code 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 35
Project: n4js   File: N4MFWizardNewProjectCreationPage.java   View source code 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 36
Project: Hydrograph   File: TransformDialog.java   View source code 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 37
Project: Hydrograph   File: MultiParameterFileDialog.java   View source code 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 38
Project: Hydrograph   File: FTPOperationConfigUtility.java   View source code 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 39
Project: n4js   File: N4MFWizardNewProjectCreationPage.java   View source code 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 40
Project: SimQRI   File: StoragePropertiesEditionPartImpl.java   View source code 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;
}