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

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

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

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

	previewToggleButton.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			if (!previewVisible) {
				showContentPreview();
			} else {
				hideContentPreview();
			}
		}
	});
}
 
Example 2
Project: 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: 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 4
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 5
Project: neoscada   File: DefaultPage.java   View source code 6 votes vote down vote up
@Override
protected Control createContents ( final Composite parent )
{
    final Composite wrapper = new Composite ( parent, SWT.NONE );
    wrapper.setLayout ( new GridLayout ( 1, false ) );

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

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

    return wrapper;
}
 
Example 6
Project: neoscada   File: ResetControllerImpl.java   View source code 6 votes vote down vote up
public ResetControllerImpl ( final ControllerManager controllerManager, final ChartContext chartContext, final ResetController controller )
{
    final Composite space = chartContext.getExtensionSpaceProvider ().getExtensionSpace ();
    this.resetHandler = chartContext.getResetHandler ();
    if ( space != null && this.resetHandler != null )
    {
        this.button = new Button ( space, SWT.PUSH );
        this.button.setText ( Messages.ResetControllerImpl_Label );
        this.button.addSelectionListener ( new SelectionAdapter () {
            @Override
            public void widgetSelected ( final SelectionEvent e )
            {
                action ();
            }
        } );
        space.layout ();
    }
    else
    {
        this.button = null;
    }
}
 
Example 7
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 8
Project: neoscada   File: TrendControlImage.java   View source code 6 votes vote down vote up
public TrendControlImage ( final Composite parent, final int style, final String connectionId, final String itemId, final String queryString )
{
    super ( parent, style );

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

    setLayout ( new FillLayout () );

    final Button button = new Button ( parent, SWT.PUSH | SWT.FLAT );
    button.setImage ( org.eclipse.scada.vi.details.swt.Activator.getDefault ().getImageRegistry ().get ( org.eclipse.scada.vi.details.swt.Activator.IMG_TREND ) );
    button.addSelectionListener ( new SelectionAdapter () {
        @Override
        public void widgetSelected ( final SelectionEvent e )
        {
            startHdView ();
        }
    } );
}
 
Example 9
Project: neoscada   File: LinkComposite.java   View source code 6 votes vote down vote up
public LinkComposite ( final Composite parent, final int style, final String format )
{
    super ( parent, style );

    final RowLayout layout = new RowLayout ();
    layout.wrap = false;
    layout.center = true;
    layout.spacing = 7;
    layout.pack = true;
    setLayout ( layout );

    this.textLabel = new Link ( this, SWT.NONE );
    this.textLabel.setText ( format );

    this.textLabel.addSelectionListener ( new SelectionAdapter () {

        @Override
        public void widgetSelected ( final SelectionEvent event )
        {
            logger.info ( "LinkComponent selected: {}", event.text ); //$NON-NLS-1$
            Program.launch ( event.text );
        }
    } );
}
 
Example 10
Project: neoscada   File: LoginDialog.java   View source code 6 votes vote down vote up
private Composite createAdvancedContent ( final Composite advWrapper )
{
    final Composite advContent = new Composite ( advWrapper, SWT.NONE );
    advContent.setLayout ( new GridLayout ( 1, false ) );

    final Button credentialsAsProperties = new Button ( advContent, SWT.CHECK );
    credentialsAsProperties.setText ( Messages.LoginDialog_CredentialsButtons_Text );
    credentialsAsProperties.setToolTipText ( Messages.LoginDialog_CredentialsButtons_ToolTip );

    credentialsAsProperties.setSelection ( this.flagCredentialsAsProperties );
    credentialsAsProperties.addSelectionListener ( new SelectionAdapter () {
        @Override
        public void widgetSelected ( final SelectionEvent e )
        {
            LoginDialog.this.flagCredentialsAsProperties = credentialsAsProperties.getSelection ();
        }
    } );

    return advContent;
}
 
Example 11
Project: Hydrograph   File: LoadTypeConfigurationDialog.java   View source code 6 votes vote down vote up
/**
 * The Function will cal on update and primary key button selection listener
 * @param butoon
 * @param textBox
 * @return Selection Adapter
 */
private SelectionAdapter updateAndPrimaryWidgetSelection(Button butoon, Text textBox){
	SelectionAdapter adapter = new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			String buttonText;
			//TODO as above
			/*if(StringUtils.equalsIgnoreCase(butoon.getText(), Messages.UPDATE_BY_KEYS)){
				buttonText = Messages.UPDATE_KEYS_WINDOW_LABEL;
			}else{*/
			buttonText = Messages.PRIMARY_KEYS_WINDOW_LABEL;
			FieldDialog fieldDialog = new FieldDialog(new Shell(), propertyDialogButtonBar);
			fieldDialog.setComponentName(buttonText);
			fieldDialog.setSourceFieldsFromPropagatedSchema(schemaFields);
			if(StringUtils.isNotBlank(textBox.getText())){
				fieldDialog.setPropertyFromCommaSepratedString(textBox.getText());
			}
			fieldDialog.open();
			String valueForNewTableTextBox = fieldDialog.getResultAsCommaSeprated();
			if(valueForNewTableTextBox !=null){
				textBox.setText(valueForNewTableTextBox);
			}
		}
	};
	return adapter;	
}
 
Example 12
Project: gw4e.project   File: LabelizedCheckBoxes.java   View source code 6 votes vote down vote up
/**
 * Create the composite.
 * @param parent
 * @param style
 */
public LabelizedCheckBoxes(Composite parent,
		int style, 
		String [] labels,
		boolean [] enabled,
		boolean [] checked,
		SelectionAdapter [] checkBoxSelectionAdapters) {
	super(parent, style);
	setLayout(new GridLayout(10, false));
	buttons = new Button [labels.length]; 
	for (int i = 0; i < labels.length; i++) {
		buttons [i] = new Button(parent, SWT.CHECK);
		buttons [i].setEnabled(enabled [i]);
		buttons [i].setSelection(checked [i]);
		buttons [i].setText(labels [i]);
		if (checkBoxSelectionAdapters[i]!=null) {
			buttons [i].addSelectionListener(checkBoxSelectionAdapters[i]);
		}
		buttons [i].setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 6, 1));
		buttons [i].setData(PROJECT_PROPERTY_PAGE_WIDGET_ID, BUTTON+"."+i);

		}
}
 
Example 13
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 14
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 15
Project: pgcodekeeper   File: FilterDialog.java   View source code 6 votes vote down vote up
@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    Button btnReset = createButton(parent, IDialogConstants.NO_ID, Messages.FilterDialog_reset, false);
    createButton(parent, IDialogConstants.CANCEL_ID, Messages.FilterDialog_cancel, false);

    btnReset.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            text.setText(""); //$NON-NLS-1$
            btnRegEx.setSelection(false);
            objViewer.setAllChecked(false);
            chgViewer.setAllChecked(false);
        }
    });
}
 
Example 16
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 17
Project: Hydrograph   File: ParameterGridDialog.java   View source code 6 votes vote down vote up
public void addGridRowSelectionListener(){
	for(Composite row: textGrid.getGrid()){

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

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

			@Override
			public void widgetSelected(SelectionEvent e) {
				// TODO Auto-generated method stub
				super.widgetSelected(e);
				changeHeaderCheckboxSelection();
			}
		});
	}
}
 
Example 18
Project: time4sys   File: GeneralPropertiesEditionPartForm.java   View source code 5 votes vote down vote up
protected Composite createIsStaticCheckbox(FormToolkit widgetFactory, Composite parent) {
	isStatic = widgetFactory.createButton(parent, getDescription(HrmViewsRepository.General.Properties.isStatic,
			HrmMessages.GeneralPropertiesEditionPart_IsStaticLabel), SWT.CHECK);
	isStatic.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,
								HrmViewsRepository.General.Properties.isStatic, PropertiesEditionEvent.COMMIT,
								PropertiesEditionEvent.SET, null, new Boolean(isStatic.getSelection())));
		}

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

	// End of user code
	return parent;
}
 
Example 19
Project: time4sys   File: OtherPropertiesEditionPartForm.java   View source code 5 votes vote down vote up
protected Composite createIsMaskableCheckbox(FormToolkit widgetFactory, Composite parent) {
	isMaskable = widgetFactory.createButton(parent, getDescription(SrmViewsRepository.Other.Properties.isMaskable,
			SrmMessages.OtherPropertiesEditionPart_IsMaskableLabel), SWT.CHECK);
	isMaskable.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(OtherPropertiesEditionPartForm.this,
								SrmViewsRepository.Other.Properties.isMaskable, PropertiesEditionEvent.COMMIT,
								PropertiesEditionEvent.SET, null, new Boolean(isMaskable.getSelection())));
		}

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

	// End of user code
	return parent;
}
 
Example 20
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 21
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 22
Project: time4sys   File: GeneralPropertiesEditionPartImpl.java   View source code 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 23
Project: Hydrograph   File: JDBCDriverClassWidget.java   View source code 5 votes vote down vote up
private boolean addComboSelectionListner() {
	combo.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent event) {
			String str = ((Combo)event.getSource()).getText();
			if(dropDownConfig.getItems().contains(str)){
				jdbcDriverClassTextBoxDecorator.hide();
				jdbcDriverClassTextBox.setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 255, 255, 255));
				if(str.equalsIgnoreCase(Messages.ORACLE)){
					jdbcDriverClassTextBox.setText(Messages.ORACLE_DRIVER_CLASS);
				}else if(str.equalsIgnoreCase(Messages.REDSHIFT)){
					jdbcDriverClassTextBox.setText(Messages.REDSHIFT_DRIVER_CLASS);
				}else if(str.equalsIgnoreCase(Messages.MYSQL)){
					jdbcDriverClassTextBox.setText(Messages.MYSQL_DRIVER_CLASS);
				}else if(str.equalsIgnoreCase(Messages.TERADATA)){
					jdbcDriverClassTextBox.setText(Messages.TERADATA_DRIVER_CLASS);
				}else if(str.equalsIgnoreCase(Messages.OTHERS)){
					jdbcDriverClassTextBox.setText("");
					jdbcDriverClassTextBox.setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 255, 255, 204));
					jdbcDriverClassTextBoxDecorator.setMarginWidth(3);
					jdbcDriverClassTextBoxDecorator.show();
				}
			}
		}
		
	});
	return true;
}
 
Example 24
Project: pmTrans   File: BarManager.java   View source code 5 votes vote down vote up
private ToolItem addItemToToolBar(ToolBar bar, String text, String toolTip,
		int type, SelectionAdapter listener, Image icon) {
	ToolItem item = addItemToToolBar(bar, text, toolTip, type);

	if (listener != null)
		item.addSelectionListener(listener);
	if (icon != null)
		item.setImage(icon);

	return item;
}
 
Example 25
Project: pmTrans   File: MenuManager.java   View source code 5 votes vote down vote up
private void createRecentAudiosMenu() {
	for (MenuItem mi : recentAudiosM.getItems())
		mi.dispose();

	CacheList<File> audioFilesCache = pmTrans.getRecentAudios();
	for (int i = 0; i < audioFilesCache.size(); i++)
		addMenuItem(recentAudiosM, audioFilesCache.get(i).getName(),
				SWT.NONE, audioFilesCache.get(i), new SelectionAdapter() {
					@Override
					public void widgetSelected(SelectionEvent e) {
						pmTrans.openAudioFile((File) ((MenuItem) e
								.getSource()).getData());
					}
				});
}
 
Example 26
Project: time4sys   File: GeneralPropertiesEditionPartForm.java   View source code 5 votes vote down vote up
protected Composite createIsProtectedCheckbox(FormToolkit widgetFactory, Composite parent) {
	isProtected = widgetFactory.createButton(parent,
			getDescription(GrmViewsRepository.General.Properties.isProtected,
					GrmMessages.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,
								GrmViewsRepository.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, GrmViewsRepository.General.Properties.isProtected);
	EditingUtils.setEEFtype(isProtected, "eef::Checkbox"); //$NON-NLS-1$
	FormUtils.createHelpButton(widgetFactory, parent, propertiesEditionComponent
			.getHelpContent(GrmViewsRepository.General.Properties.isProtected, GrmViewsRepository.FORM_KIND), null); // $NON-NLS-1$
	// Start of user code for createIsProtectedCheckbox

	// End of user code
	return parent;
}
 
Example 27
Project: time4sys   File: GeneralPropertiesEditionPartForm.java   View source code 5 votes vote down vote up
protected Composite createIsNonVolatileCheckbox(FormToolkit widgetFactory, Composite parent) {
	isNonVolatile = widgetFactory.createButton(parent,
			getDescription(HrmViewsRepository.General.Properties.isNonVolatile,
					HrmMessages.GeneralPropertiesEditionPart_IsNonVolatileLabel),
			SWT.CHECK);
	isNonVolatile.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,
								HrmViewsRepository.General.Properties.isNonVolatile, PropertiesEditionEvent.COMMIT,
								PropertiesEditionEvent.SET, null, new Boolean(isNonVolatile.getSelection())));
		}

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

	// End of user code
	return parent;
}
 
Example 28
Project: time4sys   File: OtherPropertiesEditionPartImpl.java   View source code 5 votes vote down vote up
protected Composite createIsMaskableCheckbox(Composite parent) {
	isMaskable = new Button(parent, SWT.CHECK);
	isMaskable.setText(getDescription(SrmViewsRepository.Other.Properties.isMaskable,
			SrmMessages.OtherPropertiesEditionPart_IsMaskableLabel));
	isMaskable.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(OtherPropertiesEditionPartImpl.this,
								SrmViewsRepository.Other.Properties.isMaskable, PropertiesEditionEvent.COMMIT,
								PropertiesEditionEvent.SET, null, new Boolean(isMaskable.getSelection())));
		}

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

	// End of user code
	return parent;
}
 
Example 29
Project: Hydrograph   File: WorksheetWidget.java   View source code 5 votes vote down vote up
private void attachSelectionListener(Button isFieldCheckBox) {
	isFieldCheckBox.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			propDialogButtonBar.enableApplyButton(true);
		}
	});
}
 
Example 30
Project: neoscada   File: CheckProfileEntry.java   View source code 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 31
Project: neoscada   File: RadioProfileEntry.java   View source code 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 32
Project: neoscada   File: TimeShiftActionController.java   View source code 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 33
Project: Hydrograph   File: ELTRetentionLogicWidget.java   View source code 5 votes vote down vote up
@Override
public void attachToPropertySubGroup(AbstractELTContainerWidget container) {
	
	ELTDefaultSubgroupComposite eltSuDefaultSubgroupComposite = new ELTDefaultSubgroupComposite(container.getContainerControl());
	eltSuDefaultSubgroupComposite.createContainerWidget();
	eltSuDefaultSubgroupComposite.numberOfBasicWidgets(4);
	
	AbstractELTWidget eltDefaultLable = new ELTDefaultLable("Retain");
	eltSuDefaultSubgroupComposite.attachWidget(eltDefaultLable);
	setPropertyHelpWidget((Control) eltDefaultLable.getSWTWidgetControl());
	
	SelectionListener selectionListener = new SelectionAdapter () {
		
         @Override
		public void widgetSelected(SelectionEvent event) {
        	 Button button = ((Button) event.widget);
           properties = button.getText();
           propertyDialogButtonBar.enableApplyButton(true);
            logger.debug( "Radio Button Value",button.getText());
           // button.getSelection();
         };
      };
	
	First = new ELTRadioButton("First");
	eltSuDefaultSubgroupComposite.attachWidget(First);
	((Button) First.getSWTWidgetControl()).addSelectionListener(selectionListener);
	//button=(Button) First.getSWTWidgetControl();
	
	Last = new ELTRadioButton("Last");
	eltSuDefaultSubgroupComposite.attachWidget(Last);
	((Button) Last.getSWTWidgetControl()).addSelectionListener(selectionListener);
	
	Unique = new ELTRadioButton("Unique");
	eltSuDefaultSubgroupComposite.attachWidget(Unique);
	((Button) Unique.getSWTWidgetControl()).addSelectionListener(selectionListener);
	
	populateWidget();
	
}
 
Example 34
Project: Hydrograph   File: ExcelFormattingDialog.java   View source code 5 votes vote down vote up
private void attachDeleteButtonListener(Button deleteButton) {
	deleteButton.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			setValueForCellEditor();
			TableItem[] selection = targetTableViewer.getTable().getSelection();
			String comboValue = combo.getText();
			for(TableItem item : selection){
				if(item != null){
					for(String listvalue : new ArrayList<>(draggedFields)){
						if(StringUtils.equals(listvalue, item.getText())){
							draggedFields.remove(listvalue);
						}
					}
				}
				
				combo.setItems(convertToArray(draggedFields));
				if(StringUtils.equals(comboValue, item.getText())){
					combo.select(0);
				}else{
					combo.setText(comboValue);
				}
				
			}
			
			top_composite.layout();
			top_composite.getParent().layout();

			WidgetUtility.setCursorOnDeleteRow(targetTableViewer, listOfExcelConfiguration);
			targetTableViewer.refresh();
			if (listOfExcelConfiguration.size() < 1) {
				deleteButton.setEnabled(false);
			}
			
			highlightDropFields();
		}
	});
}
 
Example 35
Project: neoscada   File: FilterAdvancedComposite.java   View source code 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 36
Project: Hydrograph   File: TransformDialog.java   View source code 5 votes vote down vote up
private void addSelectionListenerToBrowseButton(
		final OperationClassComposite operationClassComposite) {
	operationClassComposite.getBrowseButton().addSelectionListener(new SelectionAdapter() {
   			
			@Override
			public void widgetSelected(SelectionEvent e) {
				MappingSheetRow orignalMappingSheetRow = (MappingSheetRow) ((Button) e.widget).getData(Messages.MAPPING_SHEET);
				Text operationClassTextBox=(Text)((Button)e.widget).getData(OPERATION_CLASS_TEXT_BOX);
				MappingSheetRow oldMappingSheetRow = (MappingSheetRow) orignalMappingSheetRow.clone();
				OperationClassDialog operationClassDialog = new OperationClassDialog(operationClassComposite.getBrowseButton().getShell(), component
						.getComponentName(), orignalMappingSheetRow, propertyDialogButtonBar, widgetConfig,
						transformDialog);
				operationClassDialog.open();
				orignalMappingSheetRow.setComboBoxValue(operationClassDialog.getMappingSheetRow().getComboBoxValue());
				orignalMappingSheetRow.setOperationClassPath(operationClassDialog.getMappingSheetRow()
						.getOperationClassPath());
				orignalMappingSheetRow.setClassParameter(operationClassDialog.getMappingSheetRow().isClassParameter());
               
				orignalMappingSheetRow.setOperationClassFullPath(operationClassDialog.getMappingSheetRow()
						.getOperationClassFullPath());
				operationClassTextBox.setText(operationClassDialog.getMappingSheetRow().getOperationClassPath());
				
				if (operationClassDialog.isCancelPressed() && (!(operationClassDialog.isApplyPressed()))) {
					orignalMappingSheetRow.setNameValueProperty(oldMappingSheetRow.getNameValueProperty());
				}
				if (operationClassDialog.isNoPressed())
					pressCancel();
				if (operationClassDialog.isYesPressed())
					pressOK();
				super.widgetSelected(e);
			}

		});
}
 
Example 37
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 38
Project: neoscada   File: FilterAdvancedComposite.java   View source code 5 votes vote down vote up
private Button createRemoveButton ()
{
    final Button b = new Button ( this, SWT.PUSH );
    b.setText ( Messages.remove );
    b.addSelectionListener ( new SelectionAdapter () {
        @Override
        public void widgetSelected ( final SelectionEvent e )
        {
            AssertionComposite.this.orCondition.removeAssertion ( AssertionComposite.this );
        }
    } );
    return b;
}
 
Example 39
Project: neoscada   File: FileSelectionPage.java   View source code 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 40
Project: neoscada   File: DefinitionContributionItem.java   View source code 5 votes vote down vote up
@Override
public void fill ( final org.eclipse.swt.widgets.Menu menu, final int index )
{
    final MenuItem item = new MenuItem ( menu, SWT.NONE, index );

    final Profile profile = getProfile ();

    final String name = this.definition.getName () == null ? "<unnamed>" : this.definition.getName ();
    String profileName = profile != null ? profile.getName () : "default";
    if ( profileName == null )
    {
        profileName = "<unnamed>";
    }

    item.setText ( String.format ( "Run %s (%s)", name, profileName ) );

    item.addSelectionListener ( new SelectionAdapter () {
        @Override
        public void widgetSelected ( final SelectionEvent evt )
        {
            try
            {
                run ( name );
            }
            catch ( final Exception e )
            {
                logger.warn ( "Failed to run", e );
                StatusManager.getManager ().handle ( StatusHelper.convertStatus ( Activator.PLUGIN_ID, e ), StatusManager.BLOCK );
            }
        }
    } );
}