Java Code Examples for org.eclipse.swt.events.SelectionEvent

The following are top voted examples for showing how to use org.eclipse.swt.events.SelectionEvent. 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: Hydrograph   File: SelectionDatabaseWidget.java   Source Code and License 7 votes vote down vote up
/**
 * 
 * @param selectionComposite
 * @param layout
 */
private void attachTableButtonListner(final ELTSubGroupCompositeWithStack selectionComposite,
		final StackLayout layout) {
	final Button tableRadioBtn = (Button) tableNameRadioButton.getSWTWidgetControl();
	tableRadioBtn.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			if (tableRadioBtn.getSelection()) {
				unRegisterTableOrSQLQueryTextListner();
				layout.topControl = tableComposite.getContainerControl();
				selectionComposite.getContainerControl().layout();
				if (databaseSelectionConfig != null) {
					databaseSelectionConfig.setTableNameSelection(true);
					databaseSelectionConfig.setTableName(textBoxTableName.getText());
					populateWidget();
				}
				showHideErrorSymbol(widgets);
				propertyDialogButtonBar.enableApplyButton(true);
			}
		}
	});
}
 
Example 2
Project: com.onpositive.prefeditor   File: ViewerPage.java   Source Code and License 7 votes vote down vote up
protected void createFilterControls(Composite con) {
	Label filterLabel = new Label(con,SWT.NONE);
	filterLabel.setText("Filter:");
	GridDataFactory.swtDefaults().applyTo(filterLabel);
	Text filterText = new Text(con, SWT.BORDER);
	filterText.setMessage("(" + PreferenceFilter.MIN_FILTER_CHARS + " chars at least)");
	filterText.addModifyListener(event -> {
		filterChanged(filterText.getText());
	});
	GridDataFactory.fillDefaults().grab(true,false).applyTo(filterText);
	Button clearBtn = new Button(con, SWT.PUSH);
	clearBtn.setImage(AbstractUIPlugin.imageDescriptorFromPlugin(PrefEditorPlugin.PLUGIN_ID,"icons/clear.gif").createImage());
	GridDataFactory.swtDefaults().applyTo(clearBtn);
	clearBtn.addSelectionListener(new SelectionAdapter() {
		
		@Override
		public void widgetSelected(SelectionEvent e) {
			filterText.setText("");
			filterChanged("");
		}
		
	});
}
 
Example 3
Project: Hydrograph   File: UpdateByKeysWidget.java   Source Code and License 6 votes vote down vote up
private void attachButtonListner(Button selectKeysButton) {
	selectKeysButton.addSelectionListener(new SelectionAdapter() {

		@Override
		public void widgetSelected(SelectionEvent e) {
			
			String buttonText = Messages.UPDATE_KEYS_WINDOW_LABEL;
			FieldDialog fieldDialog = new FieldDialog(new Shell(), propertyDialogButtonBar);
			fieldDialog.setComponentName(buttonText);
			fieldDialog.setSourceFieldsFromPropagatedSchema(getPropagatedSchema());
			if(StringUtils.isNotBlank(updateByKeysTextBox.getText())){
				fieldDialog.setPropertyFromCommaSepratedString(updateByKeysTextBox.getText());
			}
			fieldDialog.open();
			String valueForNewTableTextBox = fieldDialog.getResultAsCommaSeprated();
			if(valueForNewTableTextBox !=null){
				updateByKeysTextBox.setText(valueForNewTableTextBox);
			}
			showHideErrorSymbol(widgets);
		}
	});
	
}
 
Example 4
Project: android-uiautomatorviewer   File: ScreenshotAction.java   Source Code and License 6 votes vote down vote up
@Override
protected Control createDialogArea(Composite parentShell) {
  Composite parent = (Composite) super.createDialogArea(parentShell);
  Composite c = new Composite(parent, SWT.NONE);

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

  Label l = new Label(c, SWT.NONE);
  l.setText("Select device: ");

  final Combo combo = new Combo(c, SWT.BORDER | SWT.READ_ONLY);
  combo.setItems(mDeviceNames);
  int defaultSelection =
      sSelectedDeviceIndex < mDevices.size() ? sSelectedDeviceIndex : 0;
  combo.select(defaultSelection);
  sSelectedDeviceIndex = defaultSelection;

  combo.addSelectionListener(new SelectionAdapter() {
    @Override
    public void widgetSelected(SelectionEvent arg0) {
      sSelectedDeviceIndex = combo.getSelectionIndex();
    }
  });

  return parent;
}
 
Example 5
Project: avro-schema-editor   File: BooleanAttributeControl.java   Source Code and License 6 votes vote down vote up
@Override
public void createControl(Composite parent, FormToolkit toolkit, AvroAttribute<Boolean> element, AvroContext context) {
	
	initialize(element, context);
	
	button = toolkit.createButton(parent, "", SWT.CHECK);	
	
	update();
	
	button.addSelectionListener(new SelectionAdapter() {			
		@Override
		public void widgetSelected(SelectionEvent e) {
			changeAttribute(getAttribute().getValue(), button.getSelection());
		}
	});
	
}
 
Example 6
Project: neoscada   File: ButtonProfileEntry.java   Source Code and License 6 votes vote down vote up
public ButtonProfileEntry ( final DataBindingContext dbc, final Composite parent, final ProfileManager profileManager, final Profile profile, final ChartContext chartContext )
{
    super ( dbc, profileManager, profile, chartContext );

    this.widget = new Button ( parent, SWT.TOGGLE );

    addBinding ( dbc.bindValue ( SWTObservables.observeText ( this.widget ), EMFObservables.observeValue ( profile, ChartPackage.Literals.PROFILE__LABEL ) ) );

    this.widget.addSelectionListener ( new SelectionAdapter () {
        @Override
        public void widgetSelected ( final SelectionEvent e )
        {
            fireSelection ( ButtonProfileEntry.this.widget.getSelection () );
        };
    } );
}
 
Example 7
Project: neoscada   File: TimeNowActionController.java   Source Code and License 6 votes vote down vote up
public TimeNowActionController ( final ControllerManager controllerManager, final ChartContext chartContext, final TimeNowAction controller )
{
    super ( controllerManager.getContext (), chartContext, controller );

    final Composite space = chartContext.getExtensionSpaceProvider ().getExtensionSpace ();
    if ( space != null )
    {
        this.button = new Button ( space, SWT.PUSH );
        this.button.setText ( Messages.TimeNowActionController_Label );
        this.button.setToolTipText ( Messages.TimeNowActionController_Description );
        this.button.addSelectionListener ( new SelectionAdapter () {
            @Override
            public void widgetSelected ( final SelectionEvent e )
            {
                action ();
            };

        } );
        space.layout ();
    }
    else
    {
        this.button = null;
    }
}
 
Example 8
Project: neoscada   File: DetailsPart.java   Source Code and License 6 votes vote down vote up
private void createButton ( final Composite parent )
{
    this.wrapper = new Composite ( parent, SWT.NONE );
    final GridLayout layout = new GridLayout ( 1, true );
    layout.marginHeight = layout.marginWidth = 0;
    this.wrapper.setLayout ( layout );

    this.startButton = new Button ( this.wrapper, SWT.PUSH );
    this.startButton.setLayoutData ( new GridData ( SWT.CENTER, SWT.CENTER, true, true ) );
    this.startButton.setText ( Messages.DetailsPart_startButton_label );
    this.startButton.addSelectionListener ( new SelectionAdapter () {
        @Override
        public void widgetSelected ( final SelectionEvent e )
        {
            try
            {
                start ();
            }
            catch ( final Exception ex )
            {
                logger.error ( "Failed to start chart", ex ); //$NON-NLS-1$
                StatusManager.getManager ().handle ( StatusHelper.convertStatus ( Activator.PLUGIN_ID, ex ), StatusManager.BLOCK );
            }
        }
    } );
}
 
Example 9
Project: Hydrograph   File: SelectionDatabaseWidget.java   Source Code and License 6 votes vote down vote up
private SelectionAdapter buttonWidgetSelectionListener(Text textWidget){
	SelectionAdapter adapter = new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			String text = textWidget.getText();
			SQLQueryStatementDialog sqlQueryStatementDialog = new SQLQueryStatementDialog(
					Display.getCurrent().getActiveShell(), text);
			sqlQueryStatementDialog.open();
			if(sqlQueryStatementDialog.getStyleTextSqlQuery() != null){
				textWidget.setText(sqlQueryStatementDialog.getStyleTextSqlQuery());
			}
			if(sqlQueryStatementDialog.isTextValueChanged()){
				propertyDialogButtonBar.enableApplyButton(true);
			}
		}
	};
	return adapter;
}
 
Example 10
Project: neoscada   File: FilterAdvancedComposite.java   Source Code and License 6 votes vote down vote up
private Combo createAssertionCombo ()
{
    final Combo c = new Combo ( this, SWT.NONE );
    for ( final Assertion assertion : Assertion.values () )
    {
        c.add ( assertion.toString () );
    }
    c.select ( 0 );
    c.addSelectionListener ( new SelectionAdapter () {
        @Override
        public void widgetSelected ( final SelectionEvent e )
        {
            AssertionComposite.this.orCondition.updateFilter ();
        }
    } );
    final RowData rowData = new RowData ();
    rowData.width = 75;
    c.setLayoutData ( rowData );
    return c;
}
 
Example 11
Project: neoscada   File: MonitorsViewTable.java   Source Code and License 6 votes vote down vote up
@Override
public void widgetSelected ( final SelectionEvent e )
{
    final Table table = this.tableViewer.getTable ();
    final TableColumn newColumn = (TableColumn)e.widget;
    final TableColumn currentColumn = table.getSortColumn ();

    final int currentDir = table.getSortDirection ();
    int newDir = SWT.UP;
    if ( newColumn == currentColumn )
    {
        newDir = currentDir == SWT.UP ? SWT.DOWN : SWT.UP;
    }
    else
    {
        table.setSortColumn ( newColumn );
    }
    table.setSortDirection ( newDir );
    this.tableViewer.setSorter ( new Sorter ( (Columns)newColumn.getData ( COLUMN_KEY ), newDir ) );
}
 
Example 12
Project: neoscada   File: EventViewTable.java   Source Code and License 6 votes vote down vote up
@Override
public void widgetSelected ( final SelectionEvent e )
{
    final Table table = this.tableViewer.getTable ();
    final TableColumn newColumn = (TableColumn)e.widget;
    final TableColumn currentColumn = table.getSortColumn ();

    final EventTableColumn column = (EventTableColumn)newColumn.getData ( COLUMN_KEY );
    if ( column == EventTableColumn.reservedColumnSourceTimestamp || column == EventTableColumn.reservedColumnEntryTimestamp )
    {
        final int currentDir = table.getSortDirection ();
        int newDir = SWT.UP;
        if ( newColumn == currentColumn )
        {
            newDir = currentDir == SWT.UP ? SWT.DOWN : SWT.UP;
        }
        else
        {
            table.setSortColumn ( newColumn );
        }
        table.setSortDirection ( newDir );
        this.tableViewer.setSorter ( new EventTableSorter ( column, newDir ) );
    }
}
 
Example 13
Project: applecommander   File: DropDownSelectionListener.java   Source Code and License 6 votes vote down vote up
/**
 * Construct the DropDownSelectionListener with the specific menu to be used.
 */
public DropDownSelectionListener(Menu menu) {
	this.menu = menu;
	
	MenuItem[] menuItems = menu.getItems();
	for (int i=0; i<menuItems.length; i++) {
		/*
		 * Add a menu selection listener so that the menu is hidden
		 * when the user selects an item from the drop down menu.
		 */
		menuItems[i].addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(SelectionEvent e) {
				setMenuVisible(false);
			}
		});
	}
}
 
Example 14
Project: convertigo-eclipse   File: ToggleButton.java   Source Code and License 6 votes vote down vote up
public ToggleButton(Composite parent, int style) {
	super(parent, style);
	
	if (colorOn == null) {
		colorOn = getDisplay().getSystemColor(SWT.COLOR_GREEN);
		colorOff = getDisplay().getSystemColor(SWT.COLOR_RED);
	}
	
	FillLayout layout = new FillLayout();
	layout.marginHeight = layout.marginWidth =  2;
	setLayout(layout);
	button = new Button(this, SWT.TOGGLE);
	button.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			updateColor();
		}
	});
}
 
Example 15
Project: time4sys   File: ShowHideWizardPage.java   Source Code and License 6 votes vote down vote up
private void createDownButtonListener() {
    if (downButton != null && selectedElementsTableViewer != null) {
        downButton.addSelectionListener(new SelectionAdapter() {
            // event is null when featureTableViewer is double clicked
            @Override
            public void widgetSelected(final SelectionEvent event) {
                final IStructuredSelection selection = (IStructuredSelection) selectedElementsTableViewer.getSelection();
                final Iterator<EObject> i = Iterators.filter(selection.iterator(), EObject.class);
                int maxIndex = selectedElements.size() - selection.size();
                while (i.hasNext()) {
                    final EObject value = i.next();
                    final int index = selectedElements.indexOf(value);
                    selectedElements.move(Math.min(index + 1, maxIndex++), value);
                }
                selectedElementsTableViewer.refresh();
            }
        });
    }
}
 
Example 16
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 17
Project: bdf2   File: DbToolCreationWizardPage.java   Source Code and License 6 votes vote down vote up
public void createControl(Composite parent) {
	super.createControl(parent);
	Composite composite = (Composite) getControl();
	Group group = new Group(composite, SWT.NONE);
	GridLayout layout = new GridLayout();
	layout.numColumns = 2;
	group.setLayout(layout);
	group.setText("设置");
	group.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));

	Label label = new Label(group, SWT.NULL);
	label.setText("数据库方言:");
	final Combo combo = new Combo(group, SWT.READ_ONLY);
	GridData gd = new GridData(GridData.FILL_HORIZONTAL);
	combo.setLayoutData(gd);
	DbType[] values = DbType.values();
	for (DbType type : values) {
		combo.add(type.name());
	}
	combo.select(0);
	currentDbType = combo.getText();
	setFileName("NewFile" + DEFAULT_EXTENSION);
	combo.addSelectionListener(new SelectionAdapter() {
		public void widgetSelected(SelectionEvent e) {
			currentDbType = combo.getText();
		}
	});
	setPageComplete(validatePage());
}
 
Example 18
Project: Hydrograph   File: TransformViewDataDialog.java   Source Code and License 6 votes vote down vote up
/**
 * Creates the copy button 
 * @param buttonComposite
 */
private void createCopyButton(Composite buttonComposite){
	Button copyButton = new Button(buttonComposite, SWT.PUSH);
 
    	copyButton.setImage(ImagePathConstant.ENABLE_COPY_ICON.getImageFromRegistry());
    	copyButton.setToolTipText(COPY_BUTTON_TOOL_TIP);
    	copyButton.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
			if (StringUtils.isNotBlank(styledText.getSelectionText())) {
				styledText.copy();
			} else {
				styledText.selectAll();
				styledText.copy();
				styledText.setSelection(0);
			}

		}
	});
		copyButton.pack();
}
 
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: gw4e.project   File: GW4ELaunchConfigurationTab.java   Source Code and License 6 votes vote down vote up
private void createDisplayReportElementGroup (Composite parent) {
Label lfiller = new Label(parent, SWT.NONE);
lfiller.setText("");

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

displayDetailsButton = new Button(parent, SWT.CHECK);
displayDetailsButton.setText("");
displayDetailsButton.setSelection(true);
new Label(parent, SWT.NONE);
displayDetailsButton.addSelectionListener(new SelectionAdapter() {
	@Override
	public void widgetSelected(SelectionEvent evt) {
		validatePage();
	}
});
}
 
Example 21
Project: gemoc-studio   File: TemplateListSelectionPage.java   Source Code and License 6 votes vote down vote up
public void createAbove(Composite container, int span) {
	fUseTemplate = new Button(container, SWT.CHECK);
	fUseTemplate.setText(PDEUIMessages.WizardListSelectionPage_label);
	GridData gd = new GridData();
	gd.horizontalSpan = span;
	fUseTemplate.setLayoutData(gd);
	
	fUseTemplate.addSelectionListener(new SelectionAdapter() {
		public void widgetSelected(SelectionEvent e) {
			wizardSelectionViewer.getControl().setEnabled(fUseTemplate.getSelection());
			if (!fUseTemplate.getSelection())
				setDescription(""); //$NON-NLS-1$
			setDescriptionEnabled(fUseTemplate.getSelection());
			getContainer().updateButtons();
		}
	});
}
 
Example 22
Project: Hydrograph   File: ELTLookupConfigGrid.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 button = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
	button.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {

		}
	});
	createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}
 
Example 23
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 24
Project: time4sys   File: GeneralPropertiesEditionPartForm.java   Source Code and License 5 votes vote down vote up
protected Composite createIsActiveCheckbox(FormToolkit widgetFactory, Composite parent) {
	isActive = widgetFactory.createButton(parent, getDescription(SrmViewsRepository.General.Properties.isActive,
			SrmMessages.GeneralPropertiesEditionPart_IsActiveLabel), SWT.CHECK);
	isActive.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(GeneralPropertiesEditionPartForm.this,
								SrmViewsRepository.General.Properties.isActive, PropertiesEditionEvent.COMMIT,
								PropertiesEditionEvent.SET, null, new Boolean(isActive.getSelection())));
		}

	});
	GridData isActiveData = new GridData(GridData.FILL_HORIZONTAL);
	isActiveData.horizontalSpan = 2;
	isActive.setLayoutData(isActiveData);
	EditingUtils.setID(isActive, SrmViewsRepository.General.Properties.isActive);
	EditingUtils.setEEFtype(isActive, "eef::Checkbox"); //$NON-NLS-1$
	FormUtils.createHelpButton(widgetFactory, parent, propertiesEditionComponent
			.getHelpContent(SrmViewsRepository.General.Properties.isActive, SrmViewsRepository.FORM_KIND), null); // $NON-NLS-1$
	// Start of user code for createIsActiveCheckbox

	// End of user code
	return parent;
}
 
Example 25
Project: n4js   File: ExternalLibraryPreferencePage.java   Source Code and License 5 votes vote down vote up
/**
 * Selection handler for adding a new external library location.
 */
private void handleAddButtonSelectionListener(@SuppressWarnings("unused") final SelectionEvent e) {
	final String directoryPath = new DirectoryDialog(viewer.getControl().getShell(), OPEN).open();
	if (null != directoryPath) {
		final File file = new File(directoryPath);
		if (file.exists() && file.isDirectory()) {
			store.add(file.toURI());
			updateInput(viewer, store.getLocations());
		}
	}
}
 
Example 26
Project: applecommander   File: FileViewerWindow.java   Source Code and License 5 votes vote down vote up
/**
 * Create the copy tool item (button).
 */
protected ToolItem createCopyToolItem() {
	ToolItem toolItem = new ToolItem(toolBar, SWT.PUSH);
	toolItem.setImage(imageManager.get(ImageManager.ICON_COPY));
	toolItem.setText(textBundle.get("FileViewerWindow.CopyButton")); //$NON-NLS-1$
	toolItem.setToolTipText(textBundle.get("FileViewerWindow.CopyTooltip")); //$NON-NLS-1$
	toolItem.setEnabled(true);
	toolItem.addSelectionListener(new SelectionAdapter() {
		public void widgetSelected(SelectionEvent e) {
			getContentTypeAdapter().copy();
		}
	});
	return toolItem;
}
 
Example 27
Project: n4js   File: ExternalLibraryPreferencePage.java   Source Code and License 5 votes vote down vote up
/**
 * Selection handler for moving up an external library location in the list.
 */
private void handleMoveUpButtonSelection(@SuppressWarnings("unused") final SelectionEvent e) {
	final ISelection selection = viewer.getSelection();
	if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
		final Object element = ((IStructuredSelection) selection).getFirstElement();
		if (element instanceof URI) {
			store.moveUp((URI) element);
			updateInput(viewer, store.getLocations());
		}
	}
}
 
Example 28
Project: n4js   File: ExternalLibraryPreferencePage.java   Source Code and License 5 votes vote down vote up
/**
 * Selection handler for moving down an external library location in the list.
 */
private void handleMoveDownButtonSelection(@SuppressWarnings("unused") final SelectionEvent e) {
	final ISelection selection = viewer.getSelection();
	if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
		final Object element = ((IStructuredSelection) selection).getFirstElement();
		if (element instanceof URI) {
			store.moveDown((URI) element);
			updateInput(viewer, store.getLocations());
		}
	}
}
 
Example 29
Project: n4js   File: InstallNpmDependencyButtonListener.java   Source Code and License 5 votes vote down vote up
@Override
public void widgetSelected(final SelectionEvent e) {
	final MultiStatus multistatus = statusHelper.createMultiStatus("Status of installing npm dependencies.");

	InstallNpmDependencyDialog dialog = new InstallNpmDependencyDialog(getShell(),
			packageNameValidator.get(), packageVersionValidator.get());
	dialog.open();
	final String packageName = dialog.getPackageName();
	if (!StringExtensions.isNullOrEmpty(packageName) && dialog.getReturnCode() == Window.OK) {
		try {
			final String packageVersion = dialog.getVersionConstraint();
			new ProgressMonitorDialog(getShell()).run(true, false, monitor -> {
				multistatus
						.merge(installAction.apply(Collections.singletonMap(packageName, packageVersion), monitor));
			});
		} catch (final InvocationTargetException | InterruptedException exc) {
			multistatus.merge(
					statusHelper.createError("Error while installing npm dependency: '" + packageName + "'.",
							exc));
		} finally {
			if (!multistatus.isOK()) {
				N4JSActivator.getInstance().getLog().log(multistatus);
				getDisplay().asyncExec(() -> openError(
						UIUtils.getShell(),
						"npm Install Failed",
						"Error while installing '" + packageName
								+ "' npm package.\nPlease check your Error Log view for the detailed npm log about the failure."));
			}
		}
	}
}
 
Example 30
Project: n4js   File: UninstallNpmDependencyButtonListener.java   Source Code and License 5 votes vote down vote up
@Override
public void widgetSelected(final SelectionEvent e) {
	final MultiStatus multistatus = statusHelper.createMultiStatus("Status of uninstalling npm dependencies.");

	final InputDialog dialog = new InputDialog(UIUtils.getShell(), "npm Uninstall",
			"Specify an npm package name to uninstall:", initalValue.get(), validator.get());

	dialog.open();
	final String packageName = dialog.getValue();
	if (!StringExtensions.isNullOrEmpty(packageName) && dialog.getReturnCode() == Window.OK) {
		try {
			new ProgressMonitorDialog(UIUtils.getShell()).run(true, false, monitor -> {
				multistatus.merge(uninstallAction.apply(Arrays.asList(packageName), monitor));
			});
		} catch (final InvocationTargetException | InterruptedException exc) {
			multistatus.merge(
					statusHelper.createError("Error while uninstalling npm dependency: '" + packageName + "'.",
							exc));
		} finally {
			if (!multistatus.isOK()) {
				N4JSActivator.getInstance().getLog().log(multistatus);
				getDisplay().asyncExec(() -> openError(
						UIUtils.getShell(),
						"npm Uninstall Failed",
						"Error while uninstalling '" + packageName
								+ "' npm package.\nPlease check your Error Log view for the detailed npm log about the failure."));
			}
		}
	}
}
 
Example 31
Project: time4sys   File: EventModelPropertiesEditionPartForm.java   Source Code and License 5 votes vote down vote up
/**
 * @generated
 */

protected Composite createIsSporadicCheckbox(FormToolkit widgetFactory, Composite parent) {
	isSporadic = widgetFactory.createButton(parent, getDescription(AnalysisViewsRepository.EventModel.Properties.isSporadic, AnalysisMessages.EventModelPropertiesEditionPart_IsSporadicLabel), SWT.CHECK);
	isSporadic.addSelectionListener(new SelectionAdapter() {

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

	});
	GridData isSporadicData = new GridData(GridData.FILL_HORIZONTAL);
	isSporadicData.horizontalSpan = 2;
	isSporadic.setLayoutData(isSporadicData);
	EditingUtils.setID(isSporadic, AnalysisViewsRepository.EventModel.Properties.isSporadic);
	EditingUtils.setEEFtype(isSporadic, "eef::Checkbox"); //$NON-NLS-1$
	FormUtils.createHelpButton(widgetFactory, parent, propertiesEditionComponent.getHelpContent(AnalysisViewsRepository.EventModel.Properties.isSporadic, AnalysisViewsRepository.FORM_KIND), null); //$NON-NLS-1$
	// Start of user code for createIsSporadicCheckbox

	// End of user code
	return parent;
}
 
Example 32
Project: time4sys   File: GeneralPropertiesEditionPartForm.java   Source Code and License 5 votes vote down vote up
protected Composite createIsSynchronousCheckbox(FormToolkit widgetFactory, Composite parent) {
	isSynchronous = widgetFactory.createButton(parent, getDescription(LibraryViewsRepository.General.Properties.isSynchronous, LibraryMessages.GeneralPropertiesEditionPart_IsSynchronousLabel), SWT.CHECK);
	isSynchronous.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(GeneralPropertiesEditionPartForm.this, LibraryViewsRepository.General.Properties.isSynchronous, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, new Boolean(isSynchronous.getSelection())));
		}

	});
	GridData isSynchronousData = new GridData(GridData.FILL_HORIZONTAL);
	isSynchronousData.horizontalSpan = 2;
	isSynchronous.setLayoutData(isSynchronousData);
	EditingUtils.setID(isSynchronous, LibraryViewsRepository.General.Properties.isSynchronous);
	EditingUtils.setEEFtype(isSynchronous, "eef::Checkbox"); //$NON-NLS-1$
	FormUtils.createHelpButton(widgetFactory, parent, propertiesEditionComponent.getHelpContent(LibraryViewsRepository.General.Properties.isSynchronous, LibraryViewsRepository.FORM_KIND), null); //$NON-NLS-1$
	// Start of user code for createIsSynchronousCheckbox

	// End of user code
	return parent;
}
 
Example 33
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 34
Project: time4sys   File: GeneralPropertiesEditionPartImpl.java   Source Code and License 5 votes vote down vote up
protected Composite createIsProtectedCheckbox(Composite parent) {
	isProtected = new Button(parent, SWT.CHECK);
	isProtected.setText(getDescription(SrmViewsRepository.General.Properties.isProtected,
			SrmMessages.GeneralPropertiesEditionPart_IsProtectedLabel));
	isProtected.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,
								SrmViewsRepository.General.Properties.isProtected, PropertiesEditionEvent.COMMIT,
								PropertiesEditionEvent.SET, null, new Boolean(isProtected.getSelection())));
		}

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

	// End of user code
	return parent;
}
 
Example 35
Project: Hydrograph   File: ValidateExpressionToolButton.java   Source Code and License 5 votes vote down vote up
private void addSelectionListener() {
	addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			validation(expressionEditor);
		}
	});
}
 
Example 36
Project: gemoc-studio-modeldebugging   File: LaunchConfigurationMainTab.java   Source Code and License 5 votes vote down vote up
/***
 * Create the Field where user enters the language used to execute
 * 
 * @param parent container composite
 * @param font used font
 * @return the created composite containing the fields
 */
public Composite createLanguageLayout(Composite parent, Font font) {
	// Language
	createTextLabelLayout(parent, "Melange languages");
	_languageCombo = new Combo(parent, SWT.NONE);
	_languageCombo.setLayoutData(createStandardLayout());

	List<String> languagesNames = MelangeHelper.getAllLanguages();
	String[] empty = {};
	_languageCombo.setItems(languagesNames.toArray(empty));
	_languageCombo.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			//String selection = _languageCombo.getText();
			//List<String> modelTypeNames = MelangeHelper.getModelTypes(selection);
			updateLaunchConfigurationDialog();
		}
	});
	createTextLabelLayout(parent, "");

	createTextLabelLayout(parent, "Melange resource adapter query");
	_melangeQueryText = new Text(parent, SWT.SINGLE | SWT.BORDER);
	_melangeQueryText.setLayoutData(createStandardLayout());
	_melangeQueryText.setFont(font);
	_melangeQueryText.setEditable(false);
	createTextLabelLayout(parent, "");
	
	return parent;
}
 
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: eZooKeeper   File: ZnodeAclComposite.java   Source Code and License 5 votes vote down vote up
@Override
protected GridComposite createGridComposite(Composite parent) {

    GridComposite gridComposite = new GridComposite(parent) {

        @Override
        protected void createContents() {

            GridTextInput userNameGridTextInput = new GridTextInput(this, GridTextInput.Type.VALUE_REQUIRED,
                    CONTROL_NAME_USER_NAME_TEXT, "&User name: ", null);
            addGridTextInput(userNameGridTextInput);

            GridTextInput passwordGridTextInput = new GridTextInput(this, GridTextInput.Type.VALUE_REQUIRED,
                    CONTROL_NAME_PASSWORD_TEXT, "&Password:     ", null);
            addGridTextInput(passwordGridTextInput);
            passwordGridTextInput.getText().setEchoChar('*');

            final Button showPasswordTextCheckBox = new Button(this, SWT.CHECK);
            showPasswordTextCheckBox.setText("Show password text");
            showPasswordTextCheckBox.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
            showPasswordTextCheckBox.addSelectionListener(new SelectionAdapter() {

                @Override
                public void widgetSelected(SelectionEvent e) {
                    Text passwordText = (Text) getControl(CONTROL_NAME_PASSWORD_TEXT);
                    char echoChar = (showPasswordTextCheckBox.getSelection()) ? '\0' : '*';
                    passwordText.setEchoChar(echoChar);
                }

            });

        }
    };

    return gridComposite;

}
 
Example 39
Project: eZooKeeper   File: ZnodeNewWizardComposite1.java   Source Code and License 5 votes vote down vote up
@Override
public void widgetSelected(SelectionEvent e) {
    Control composite = getControl(_DataCompositeName);
    Composite dataStackComposite = (Composite) getControl(CONTROL_NAME_DATA_STACK_COMPOSITE);
    ((StackLayout) dataStackComposite.getLayout()).topControl = composite;
    dataStackComposite.layout();
    modified(composite);
}
 
Example 40
Project: eZooKeeper   File: ZnodeNewWizardComposite1.java   Source Code and License 5 votes vote down vote up
@Override
protected void createContents() {

    GridTextInput fileGridTextInput = new GridTextInput(this, GridTextInput.Type.DEFAULT,
            CONTROL_NAME_DATA_FILE_TEXT, null, null);
    addGridTextInput(fileGridTextInput);

    Button browseButton = new Button(this, SWT.PUSH);
    browseButton.setText("&Browse...");
    browseButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {

            Text filePathText = (Text) getControl(CONTROL_NAME_DATA_FILE_TEXT);

            FileDialog fileDialog = new FileDialog(getShell());
            fileDialog.setFileName(filePathText.getText());
            String newPath = fileDialog.open();
            if (newPath != null) {
                filePathText.setText(newPath);
            }

        }

    });
}
 
Example 41
Project: pmTrans   File: MenuManager.java   Source Code and License 5 votes vote down vote up
private void createRecentTextsMenu() {
	for (MenuItem mi : recentTextsM.getItems())
		mi.dispose();

	CacheList<File> textFilesCache = pmTrans.getRecentTrasncriptions();
	for (int i = 0; i < textFilesCache.size(); i++)
		addMenuItem(recentTextsM, textFilesCache.get(i).getName(),
				SWT.NONE, textFilesCache.get(i), new SelectionAdapter() {
					@Override
					public void widgetSelected(SelectionEvent e) {
						pmTrans.openTranscriptionFile((File) ((MenuItem) e
								.getSource()).getData());
					}
				});
}
 
Example 42
Project: openaudible   File: AppMenu.java   Source Code and License 5 votes vote down vote up
public void widgetSelected(SelectionEvent selectionevent) {
    Object obj = selectionevent.getSource();
    if (obj instanceof MenuItem) {
        MenuItem mi = (MenuItem) obj;
        obj = mi.getData();
        if (obj instanceof Command)
            commandCenter.handleMenuAction((Command) obj, mi);
        else if (obj instanceof MenuCommand) {
            MenuCommand mc = (MenuCommand) obj;
            mc.execute();
        }

    }

}
 
Example 43
Project: neoscada   File: XMLSignatureWidgetFactory.java   Source Code and License 5 votes vote down vote up
@Override
public void createGridWidgets ( final DataBindingContext dbc, final Composite composite )
{
    final Label label = new Label ( composite, SWT.NONE );
    label.setText ( "Certificate:" );

    final Composite wrapper = new Composite ( composite, SWT.NONE );
    wrapper.setLayout ( new GridLayout ( 2, false ) );
    wrapper.setLayoutData ( new GridData ( SWT.FILL, SWT.FILL, true, false ) );

    this.text = new Text ( wrapper, SWT.BORDER | SWT.READ_ONLY );
    this.text.setEnabled ( false );
    this.text.setLayoutData ( new GridData ( SWT.FILL, SWT.FILL, true, true ) );

    setKeyCert ( null );

    final Button button = new Button ( wrapper, SWT.PUSH );
    button.setText ( "Select key" );
    button.addSelectionListener ( new SelectionAdapter () {
        @Override
        public void widgetSelected ( final SelectionEvent e )
        {
            openDialog ( composite.getShell () );
        }
    } );
    button.setLayoutData ( new GridData ( SWT.FILL, SWT.BEGINNING, false, false ) );
}
 
Example 44
Project: neoscada   File: CheckProfileEntry.java   Source Code and License 5 votes vote down vote up
public CheckProfileEntry ( final DataBindingContext dbc, final Composite parent, final ProfileManager profileManager, final Profile profile, final ChartContext chartContext )
{
    super ( dbc, profileManager, profile, chartContext );

    this.widget = new Button ( parent, SWT.CHECK );
    addBinding ( dbc.bindValue ( SWTObservables.observeText ( this.widget ), EMFObservables.observeValue ( profile, ChartPackage.Literals.PROFILE__LABEL ) ) );

    this.widget.addSelectionListener ( new SelectionAdapter () {
        @Override
        public void widgetSelected ( final SelectionEvent e )
        {
            fireSelection ( CheckProfileEntry.this.widget.getSelection () );
        };
    } );
}
 
Example 45
Project: neoscada   File: RadioProfileEntry.java   Source Code and License 5 votes vote down vote up
public RadioProfileEntry ( final DataBindingContext dbc, final Composite parent, final ProfileManager profileManager, final Profile profile, final ChartContext chartContext )
{
    super ( dbc, profileManager, profile, chartContext );

    this.widget = new Button ( parent, SWT.RADIO );
    addBinding ( dbc.bindValue ( SWTObservables.observeText ( this.widget ), EMFObservables.observeValue ( profile, ChartPackage.Literals.PROFILE__LABEL ) ) );

    this.widget.addSelectionListener ( new SelectionAdapter () {
        @Override
        public void widgetSelected ( final SelectionEvent e )
        {
            fireSelection ( RadioProfileEntry.this.widget.getSelection () );
        };
    } );
}
 
Example 46
Project: neoscada   File: TimeShiftActionController.java   Source Code and License 5 votes vote down vote up
public TimeShiftActionController ( final ControllerManager controllerManager, final ChartContext chartContext, final TimeShiftAction controller )
{
    super ( controllerManager.getContext (), chartContext, controller );

    final DataBindingContext ctx = controllerManager.getContext ();

    final Composite space = chartContext.getExtensionSpaceProvider ().getExtensionSpace ();
    if ( space != null )
    {
        this.button = new Button ( space, SWT.PUSH );
        this.button.addSelectionListener ( new SelectionAdapter () {
            @Override
            public void widgetSelected ( final SelectionEvent e )
            {
                action ();
            };
        } );
        addBinding ( ctx.bindValue ( PojoObservables.observeValue ( this, "milliseconds" ), EMFObservables.observeValue ( controller, ChartPackage.Literals.TIME_SHIFT_ACTION__DIFF ) ) ); //$NON-NLS-1$
        addBinding ( ctx.bindValue ( SWTObservables.observeText ( this.button ), EMFObservables.observeValue ( controller, ChartPackage.Literals.TIME_SHIFT_ACTION__LABEL ) ) );
        addBinding ( ctx.bindValue ( SWTObservables.observeTooltipText ( this.button ), EMFObservables.observeValue ( controller, ChartPackage.Literals.TIME_SHIFT_ACTION__DESCRIPTION ) ) );

        this.layoutListener = new IValueChangeListener () {

            @Override
            public void handleValueChange ( final ValueChangeEvent event )
            {
                space.layout ();
            }
        };

        this.labelProperty = EMFObservables.observeValue ( controller, ChartPackage.Literals.TIME_SHIFT_ACTION__LABEL );
        this.labelProperty.addValueChangeListener ( this.layoutListener );

        space.layout ();
    }
    else
    {
        this.button = null;
    }
}
 
Example 47
Project: neoscada   File: FilterAdvancedComposite.java   Source Code and License 5 votes vote down vote up
private Button createAddButton ()
{
    final Button b = new Button ( this, SWT.PUSH );
    b.setText ( Messages.add_assertion );
    b.addSelectionListener ( new SelectionAdapter () {
        @Override
        public void widgetSelected ( final SelectionEvent e )
        {
            AddAssertionComposite.this.orCondition.addAssertion ();
        }
    } );
    return b;
}
 
Example 48
Project: time4sys   File: GeneralPropertiesEditionPartForm.java   Source Code and License 5 votes vote down vote up
protected Composite createMinOpenCheckbox(FormToolkit widgetFactory, Composite parent) {
	minOpen = widgetFactory.createButton(parent, getDescription(NfpViewsRepository.General.Properties.minOpen, NfpMessages.GeneralPropertiesEditionPart_MinOpenLabel), SWT.CHECK);
	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(GeneralPropertiesEditionPartForm.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$
	FormUtils.createHelpButton(widgetFactory, parent, propertiesEditionComponent.getHelpContent(NfpViewsRepository.General.Properties.minOpen, NfpViewsRepository.FORM_KIND), null); //$NON-NLS-1$
	// Start of user code for createMinOpenCheckbox

	// End of user code
	return parent;
}
 
Example 49
Project: time4sys   File: GeneralPropertiesEditionPartImpl.java   Source Code and License 5 votes vote down vote up
protected Composite createIsPeriodicCheckbox(Composite parent) {
	isPeriodic = new Button(parent, SWT.CHECK);
	isPeriodic.setText(getDescription(GrmViewsRepository.General.Properties.isPeriodic,
			GrmMessages.GeneralPropertiesEditionPart_IsPeriodicLabel));
	isPeriodic.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,
								GrmViewsRepository.General.Properties.isPeriodic, PropertiesEditionEvent.COMMIT,
								PropertiesEditionEvent.SET, null, new Boolean(isPeriodic.getSelection())));
		}

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

	// End of user code
	return parent;
}
 
Example 50
Project: neoscada   File: ValueSetComposite.java   Source Code and License 5 votes vote down vote up
private void triggerCommand ( final SelectionEvent evt )
{
    if ( !WriteConfirmDialog.create ( this.context, getShell () ) )
    {
        return;
    }

    try
    {
        if ( evt.getSource ().equals ( this.setButton ) )
        {
            this.registrationManager.startWrite ( this.diDescriptorButtonSet.getConnectionInformation (), this.diDescriptorButtonSet.getItemId (), Variant.TRUE, this.callbackHandler );
        }
        else if ( evt.getSource ().equals ( this.resetButton ) )
        {
            this.registrationManager.startWrite ( this.diDescriptorButtonReset.getConnectionInformation (), this.diDescriptorButtonReset.getItemId (), Variant.TRUE, this.callbackHandler );
        }
        else
        {
            logger.warn ( "Missing click item for write operation" ); //$NON-NLS-1$
        }
    }
    catch ( final Exception e )
    {
        // FIXME: log error
    }
}
 
Example 51
Project: neoscada   File: FileSelectionPage.java   Source Code and License 5 votes vote down vote up
@Override
public void createControl ( final Composite parent )
{
    final Composite wrapper = new Composite ( parent, SWT.NONE );

    wrapper.setLayout ( new GridLayout ( 3, false ) );

    final Label label = new Label ( wrapper, SWT.NONE );
    label.setText ( Messages.FileSelectionPage_Label_OutputFile );
    label.setLayoutData ( new GridData ( SWT.CENTER, SWT.CENTER, false, false ) );

    this.text = new Text ( wrapper, SWT.SINGLE | SWT.BORDER );
    this.text.setLayoutData ( new GridData ( SWT.FILL, SWT.CENTER, true, false ) );

    final Button button = new Button ( wrapper, SWT.PUSH );
    button.setText ( Messages.FileSelectionPage_Button_Browse );
    button.addSelectionListener ( new SelectionAdapter () {
        @Override
        public void widgetSelected ( final SelectionEvent e )
        {
            updateFile ();
        }
    } );
    setControl ( wrapper );

    update ();
}
 
Example 52
Project: time4sys   File: TimingPropertiesEditionPartForm.java   Source Code and License 5 votes vote down vote up
protected Composite createIsPeriodicCheckbox(FormToolkit widgetFactory, Composite parent) {
	isPeriodic = widgetFactory.createButton(parent, getDescription(SrmViewsRepository.Timing.Properties.isPeriodic,
			SrmMessages.TimingPropertiesEditionPart_IsPeriodicLabel), SWT.CHECK);
	isPeriodic.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(TimingPropertiesEditionPartForm.this,
								SrmViewsRepository.Timing.Properties.isPeriodic, PropertiesEditionEvent.COMMIT,
								PropertiesEditionEvent.SET, null, new Boolean(isPeriodic.getSelection())));
		}

	});
	GridData isPeriodicData = new GridData(GridData.FILL_HORIZONTAL);
	isPeriodicData.horizontalSpan = 2;
	isPeriodic.setLayoutData(isPeriodicData);
	EditingUtils.setID(isPeriodic, SrmViewsRepository.Timing.Properties.isPeriodic);
	EditingUtils.setEEFtype(isPeriodic, "eef::Checkbox"); //$NON-NLS-1$
	FormUtils.createHelpButton(widgetFactory, parent, propertiesEditionComponent
			.getHelpContent(SrmViewsRepository.Timing.Properties.isPeriodic, SrmViewsRepository.FORM_KIND), null); // $NON-NLS-1$
	// Start of user code for createIsPeriodicCheckbox

	// End of user code
	return parent;
}
 
Example 53
Project: time4sys   File: GeneralPropertiesEditionPartForm.java   Source Code and License 5 votes vote down vote up
protected Composite createIsProtectedCheckbox(FormToolkit widgetFactory, Composite parent) {
	isProtected = widgetFactory.createButton(parent,
			getDescription(SrmViewsRepository.General.Properties.isProtected,
					SrmMessages.GeneralPropertiesEditionPart_IsProtectedLabel),
			SWT.CHECK);
	isProtected.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(GeneralPropertiesEditionPartForm.this,
								SrmViewsRepository.General.Properties.isProtected, PropertiesEditionEvent.COMMIT,
								PropertiesEditionEvent.SET, null, new Boolean(isProtected.getSelection())));
		}

	});
	GridData isProtectedData = new GridData(GridData.FILL_HORIZONTAL);
	isProtectedData.horizontalSpan = 2;
	isProtected.setLayoutData(isProtectedData);
	EditingUtils.setID(isProtected, SrmViewsRepository.General.Properties.isProtected);
	EditingUtils.setEEFtype(isProtected, "eef::Checkbox"); //$NON-NLS-1$
	FormUtils.createHelpButton(widgetFactory, parent, propertiesEditionComponent
			.getHelpContent(SrmViewsRepository.General.Properties.isProtected, SrmViewsRepository.FORM_KIND), null); // $NON-NLS-1$
	// Start of user code for createIsProtectedCheckbox

	// End of user code
	return parent;
}
 
Example 54
Project: convertigo-eclipse   File: EmulatorTechnologyWizardPage.java   Source Code and License 5 votes vote down vote up
public void createControl(Composite parent) {
	Composite container = new Composite(parent, SWT.NULL);
	GridLayout layout = new GridLayout();
	container.setLayout(layout);
	layout.numColumns = 2;
	layout.verticalSpacing = 9;

	Label label = new Label(container, SWT.NULL);
	label.setText("&Emulator technology:");

	emulatorTechnologyCombo = new Combo(container, SWT.NONE);
	String[] tags = EmulatorTechnologyEditor.getTags(null);
	for (int i = 0 ; i < tags.length ; i ++) {
		emulatorTechnologyCombo.add(tags[i]);
	}
	GridData gd = new GridData(GridData.FILL_HORIZONTAL);
	emulatorTechnologyCombo.setLayoutData(gd);
	emulatorTechnologyCombo.addSelectionListener(new SelectionAdapter() {
		public void widgetSelected(SelectionEvent e) {
			dialogChanged();
		}
	});
	
	initialize();
	//dialogChanged();
	setControl(container);
}
 
Example 55
Project: convertigo-eclipse   File: InteractiveSplashHandler.java   Source Code and License 5 votes vote down vote up
/**
 * 
 */
private void createUIListenersButtonCancel() {
	fButtonCancel.addSelectionListener(new SelectionAdapter() {
		public void widgetSelected(SelectionEvent e) {
			handleButtonCancelWidgetSelected();
		}
	});		
}
 
Example 56
Project: convertigo-eclipse   File: InteractiveSplashHandler.java   Source Code and License 5 votes vote down vote up
/**
 * 
 */
private void createUIListenersButtonOK() {
	fButtonOK.addSelectionListener(new SelectionAdapter() {
		public void widgetSelected(SelectionEvent e) {
			handleButtonOKWidgetSelected();
		}
	});				
}
 
Example 57
Project: Hydrograph   File: ELTSchemaGridWidget.java   Source Code and License 5 votes vote down vote up
/**
 * Adds the pull schema button
 */
private void createPullInternallyPropagatedSchema(ELTSchemaSubgroupComposite containerControl) {
 ELTDefaultButton btnPull = new ELTDefaultButton(Messages.PULL_SCHEMA);
 btnPull.buttonWidth(120);
 containerControl.attachWidget(btnPull);
 ((Button)btnPull.getSWTWidgetControl()).addSelectionListener(new SelectionAdapter() {
	 @Override
	 public void widgetSelected(SelectionEvent e) {				
		 updateSchemaWithPropogatedSchema(true);
	 }
 });
 if(getComponent().getTargetConnections()==null || getComponent().getTargetConnections().isEmpty()){
	 ((Button)btnPull.getSWTWidgetControl()).setEnabled(false);
 }
}
 
Example 58
Project: time4sys   File: GeneralPropertiesEditionPartForm.java   Source Code and License 5 votes vote down vote up
protected Composite createIsSchedulableCheckbox(FormToolkit widgetFactory, Composite parent) {
	isSchedulable = widgetFactory.createButton(parent,
			getDescription(GqamViewsRepository.General.Properties.isSchedulable,
					GqamMessages.GeneralPropertiesEditionPart_IsSchedulableLabel),
			SWT.CHECK);
	isSchedulable.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(GeneralPropertiesEditionPartForm.this,
								GqamViewsRepository.General.Properties.isSchedulable, PropertiesEditionEvent.COMMIT,
								PropertiesEditionEvent.SET, null, new Boolean(isSchedulable.getSelection())));
		}

	});
	GridData isSchedulableData = new GridData(GridData.FILL_HORIZONTAL);
	isSchedulableData.horizontalSpan = 2;
	isSchedulable.setLayoutData(isSchedulableData);
	EditingUtils.setID(isSchedulable, GqamViewsRepository.General.Properties.isSchedulable);
	EditingUtils.setEEFtype(isSchedulable, "eef::Checkbox"); //$NON-NLS-1$
	FormUtils.createHelpButton(widgetFactory, parent, propertiesEditionComponent.getHelpContent(
			GqamViewsRepository.General.Properties.isSchedulable, GqamViewsRepository.FORM_KIND), null); // $NON-NLS-1$
	// Start of user code for createIsSchedulableCheckbox

	// End of user code
	return parent;
}
 
Example 59
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 60
Project: RxSWT   File: SelectionObservable.java   Source Code and License 5 votes vote down vote up
@Override
protected void subscribeActual(Observer<? super SelectionEvent> observer) {
	if (!Preconditions.checkWidget(observer, widget)) {
		return;
	}

	RxSelectionListener listener = new RxSelectionListener(selectionAdapter, observer);
	observer.onSubscribe(listener);
	widget.addDisposeListener(e -> listener.dispose());
	selectionAdapter.addSelectionListener(listener);
}