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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   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 17
Project: Hydrograph   File: TransformViewDataDialog.java   View source code 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 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: gw4e.project   File: GW4ELaunchConfigurationTab.java   View source code 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 20
Project: gemoc-studio   File: TemplateListSelectionPage.java   View source code 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 21
Project: Hydrograph   File: ELTLookupConfigGrid.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 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 22
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 23
Project: time4sys   File: GeneralPropertiesEditionPartForm.java   View source code 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 24
Project: n4js   File: ExternalLibraryPreferencePage.java   View source code 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 25
Project: applecommander   File: FileViewerWindow.java   View source code 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 26
Project: n4js   File: ExternalLibraryPreferencePage.java   View source code 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 27
Project: n4js   File: ExternalLibraryPreferencePage.java   View source code 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 28
Project: n4js   File: InstallNpmDependencyButtonListener.java   View source code 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 29
Project: n4js   File: UninstallNpmDependencyButtonListener.java   View source code 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 30
Project: time4sys   File: EventModelPropertiesEditionPartForm.java   View source code 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 31
Project: time4sys   File: GeneralPropertiesEditionPartForm.java   View source code 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 32
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;
}
 
Example 33
Project: time4sys   File: GeneralPropertiesEditionPartImpl.java   View source code 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 34
Project: Hydrograph   File: ValidateExpressionToolButton.java   View source code 5 votes vote down vote up
private void addSelectionListener() {
	addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			validation(expressionEditor);
		}
	});
}
 
Example 35
Project: gemoc-studio-modeldebugging   File: LaunchConfigurationMainTab.java   View source code 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 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: eZooKeeper   File: ZnodeAclComposite.java   View source code 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 38
Project: eZooKeeper   File: ZnodeNewWizardComposite1.java   View source code 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 39
Project: eZooKeeper   File: ZnodeNewWizardComposite1.java   View source code 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 40
Project: pmTrans   File: MenuManager.java   View source code 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());
					}
				});
}