Java Code Examples for org.eclipse.swt.SWT

The following are top voted examples for showing how to use org.eclipse.swt.SWT. 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: neoscada   File: NativeTabProvider.java   View source code 7 votes vote down vote up
@Override
protected void show ()
{
    super.show ();

    final int tabIndex = findIndex ( this.index );

    if ( tabIndex < 0 )
    {
        this.item = new TabItem ( this.folder, SWT.NONE );
        this.item.setData ( "order", this.index );
    }
    else
    {
        this.item = new TabItem ( this.folder, SWT.NONE, tabIndex );
        this.item.setData ( "order", this.index );
    }

    this.item.setControl ( this.container );

    useItem ( this.item );
}
 
Example 2
Project: pgcodekeeper   File: DiffWizard.java   View source code 6 votes vote down vote up
@Override
public void createControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NONE);
    container.setLayout(new GridLayout(2, true));

    new Label(container, SWT.NONE).setText(Messages.DiffWizard_source + ':');
    new Label(container, SWT.NONE).setText(Messages.DiffWizard_target + ':');
    lblSource = new Label(container, SWT.WRAP);
    lblTarget = new Label(container, SWT.WRAP);

    diffTable = new DiffTableViewer(container, false, null);
    GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1);
    gd.widthHint = 480;
    gd.heightHint = 360;
    diffTable.setLayoutData(gd);

    setControl(container);
}
 
Example 3
Project: BiglyBT   File: SpeedTestPanel.java   View source code 6 votes vote down vote up
@Override
public void handleEvent(Event event){

    if(encryptToggle.getSelection()){
        Messages.setLanguageText(encryptToggle,"SpeedTestWizard.test.panel.encrypted");
        originalColor = encryptToggle.getForeground();
        //Color highlightColor = ColorCache.getColor(display,178,78,127);
        Color highlightColor = Colors.getSystemColor(display, SWT.COLOR_DARK_YELLOW);
        encryptToggle.setBackground(highlightColor);
    }else{
        Messages.setLanguageText(encryptToggle,"SpeedTestWizard.test.panel.standard");
        if(originalColor!=null){
            encryptToggle.setBackground(originalColor);
        }
    }
}
 
Example 4
Project: Hydrograph   File: ParameterGridDialog.java   View source code 6 votes vote down vote up
/**
 * Create the dialog.
 * @param parentShell
 */
public ParameterGridDialog(Shell parentShell) {
	super(parentShell);
	setShellStyle(SWT.CLOSE | SWT.RESIZE | SWT.TITLE | SWT.WRAP | SWT.APPLICATION_MODAL);
	runGraph=false;
	
	
	lastRowLastColumnTraverseListener=new TraverseListener() {
		
		@Override
		public void keyTraversed(TraverseEvent e) {
			if(e.detail == SWT.TRAVERSE_TAB_NEXT)
				addRowToTextGrid();
		}
	};
	
}
 
Example 5
Project: convertigo-eclipse   File: JavelinAttributeEditorComposite.java   View source code 6 votes vote down vote up
/**
 * This method initializes groupDecoration	
 *
 */
private void createGroupDecoration() {
	GridData gridData1 = new org.eclipse.swt.layout.GridData();
	gridData1.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
	gridData1.horizontalSpan = 2;
	gridData1.verticalAlignment = org.eclipse.swt.layout.GridData.CENTER;
	groupDecoration = new Group(this, SWT.NONE);
	groupDecoration.setText("Decoration");
	createCompositeIntense();
	groupDecoration.setLayoutData(gridData1);
	createCompositeReverse();
	createCompositeUnderline();
	createCompositeBlink();
	
	
}
 
Example 6
Project: BiglyBT   File: SystemTraySWT.java   View source code 6 votes vote down vote up
/**
 * Creates the global upload limit context menu item
 * @param parent The system tray contextual menu
 */
private final void createUploadLimitMenu(final Menu parent) {
	if ( gm == null ){
		return;
	}
	final MenuItem uploadSpeedItem = new MenuItem(parent, SWT.CASCADE);
	uploadSpeedItem.setText(MessageText.getString("GeneralView.label.maxuploadspeed"));

	final Menu uploadSpeedMenu = new Menu(uiFunctions.getMainShell(),
			SWT.DROP_DOWN);

	uploadSpeedMenu.addListener(SWT.Show, new Listener() {
		@Override
		public void handleEvent(Event event) {
			SelectableSpeedMenu.generateMenuItems(uploadSpeedMenu, core, gm, true);
		}
	});

	uploadSpeedItem.setMenu(uploadSpeedMenu);
}
 
Example 7
Project: n4js   File: AbstractN4JSPreferencePage.java   View source code 6 votes vote down vote up
@Override
protected Control createContents(Composite parent) {
	Composite composite = new Composite(parent, SWT.NONE);
	GridLayout layout = new GridLayout();
	layout.marginHeight = 0;
	layout.marginWidth = 0;
	composite.setLayout(layout);
	composite.setFont(parent.getFont());

	GridData data = new GridData(GridData.FILL, GridData.FILL, true, true);

	configurationBlockControl = super.createContents(composite);
	configurationBlockControl.setLayoutData(data);

	if (isProjectPreferencePage()) {
		boolean useProjectSpecificSettings = hasProjectSpecificOptions();
		enableProjectSpecificSettings(useProjectSpecificSettings);
	}

	Dialog.applyDialogFont(composite);
	return composite;
}
 
Example 8
Project: Hydrograph   File: ExcelFormattingDialog.java   View source code 6 votes vote down vote up
/**
 * Create contents of the dialog.
 * 
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
	Composite container = (Composite) super.createDialogArea(parent);
	container.setLayout(new GridLayout(1, false));
	container.getShell().setText(this.windowLabel);
	
	Composite main_composite = new Composite(container, SWT.NONE);
	main_composite.setLayout(new GridLayout(1, false));
	main_composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

	createTopComposite(main_composite);

	createTableComposite(main_composite);

	populateWidget();

	return container;
}
 
Example 9
Project: Hydrograph   File: CustomAboutDialog.java   View source code 6 votes vote down vote up
void configureText(final Composite parent) {
	// Don't set caret to 'null' as this causes
	// https://bugs.eclipse.org/293263.
	// text.setCaret(null);
	Color background = JFaceColors.getBannerBackground(parent.getDisplay());
	Color foreground = JFaceColors.getBannerForeground(parent.getDisplay());

	text.setFont(parent.getFont());
	text.setText(item.getText());

	text.setBackground(background);
	text.setForeground(foreground);
	text.setMargins(TEXT_MARGIN, TEXT_MARGIN, TEXT_MARGIN, 0);

	GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
	text.setLayoutData(gd);

	aboutTextManager = new AboutTextManager(text);
	aboutTextManager.setItem(item);

	createTextMenu();

}
 
Example 10
Project: gw4e.project   File: GW4EPreferencePage.java   View source code 6 votes vote down vote up
private SWTBotShell showPreferenceDialogMAC() {
	final IWorkbench workbench = PlatformUI.getWorkbench();
	workbench.getDisplay().asyncExec(new Runnable() {
		public void run() {
			IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
			if (window != null) {
				Menu appMenu = workbench.getDisplay().getSystemMenu();
				for (MenuItem item : appMenu.getItems()) {
					if (item.getText().startsWith("Preferences")) {
						Event event = new Event();
						event.time = (int) System.currentTimeMillis();
						event.widget = item;
						event.display = workbench.getDisplay();
						item.setSelection(true);
						item.notifyListeners(SWT.Selection, event);
						break;
					}
				}
			}
		}
	});
	return  getPreferenceDialog() ;
}
 
Example 11
Project: neoscada   File: PreviewEditorImpl.java   View source code 6 votes vote down vote up
private void updateSymbol ()
{
    if ( this.symbolArea == null )
    {
        // too early
        return;
    }

    this.loadedUris.clear ();

    if ( this.viewer != null )
    {
        this.viewer.dispose ();
        this.viewer = null;
    }

    final Symbol symbol = getSymbol ();
    if ( symbol != null )
    {
        final Map<String, String> properties = new HashMap<> ();
        final SymbolLoader symbolLoader = new StaticSymbolLoader ( symbol );
        final Map<String, Object> scriptObjects = new HashMap<> ();
        this.viewer = new VisualInterfaceViewer ( this.symbolArea, SWT.NONE, symbolLoader, scriptObjects, properties, this.factoryContext );
    }
    this.symbolArea.layout ();
}
 
Example 12
Project: BiglyBT   File: ProgressReporterWindow.java   View source code 6 votes vote down vote up
/**
 * When any <code>ProgressReporterPanel</code> in this window is expanded or collapsed
 * re-layout the controls and window appropriately
 */
@Override
public void isCollapsed(boolean value) {
	if (null != shell && !shell.isDisposed()) {
		scrollable.setRedraw(false);
		Rectangle r = scrollable.getClientArea();
		scrollable.setMinSize(scrollChild.computeSize(r.width, SWT.DEFAULT));

		/*
		 * Resizing to fit the panel if there is only one
		 */
		if (pReporters.length == 1) {
			Point p = shell.computeSize(defaultShellWidth, SWT.DEFAULT);
			if (shell.getSize().y != p.y) {
				p.x = shell.getSize().x;
				shell.setSize(p);
			}
		}

		scrollable.layout();
		scrollable.setRedraw(true);
	}
}
 
Example 13
Project: convertigo-eclipse   File: SequenceEditor.java   View source code 6 votes vote down vote up
public void createPartControl(Composite parent) {
	try {
		parent.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
		GridLayout gridLayout = new GridLayout();
		parent.setLayout(gridLayout);
		gridLayout.horizontalSpacing = 0;
		gridLayout.marginWidth = 0;
		gridLayout.marginHeight = 0;
		gridLayout.verticalSpacing = 0;

		GridData gridData = new GridData();
		gridData.horizontalAlignment = GridData.FILL;
		gridData.verticalAlignment = GridData.FILL;
		gridData.grabExcessHorizontalSpace = true;
		gridData.grabExcessVerticalSpace = true;
		
		SequenceEditorInput sequenceEditorInput = (SequenceEditorInput) getEditorInput();
		
		sequenceEditorPart = new SequenceEditorPart(this, sequenceEditorInput.sequence, parent, SWT.None);
		sequenceEditorPart.setLayoutData(gridData);
	}
	catch(Throwable e) {
		ConvertigoPlugin.logException(e, "Unable to create editor part");
	}
}
 
Example 14
Project: BiglyBT   File: MyTorrentsSubView.java   View source code 6 votes vote down vote up
private void updateButtonVisibility(final Tag[] tags) {
 	Utils.execSWTThread(new AERunnable() {

		@Override
		public void runSupport() {
			if (btnAnyTags == null || btnAnyTags.isDisposed()) {
				return;
			}
			boolean show = tags != null && tags.length > 1;
			btnAnyTags.setVisible(show);
			FormData fd = Utils.getFilledFormData();
			fd.height = show ? SWT.DEFAULT : 0;
			btnAnyTags.setLayoutData(fd);
			Composite cTop = btnAnyTags.getParent();
			cTop.getParent().layout(true, true);
		}
	});
}
 
Example 15
Project: n4js   File: GraphCanvas.java   View source code 6 votes vote down vote up
protected void onClick(MouseEvent event) {
	// update selection
	final Node mNode = getNodeAt(event.x, event.y);
	final boolean shiftPressed = (event.stateMask & SWT.SHIFT) != 0;
	if (!shiftPressed) {
		if (mNode == null) {
			clearSelection();
		} else {
			setSelectedNodes(mNode);
		}
	} else {
		if (mNode == null) {
			// do nothing
		} else {
			toggleSelection(mNode);
		}
	}
}
 
Example 16
Project: convertigo-eclipse   File: StatisticsDialog.java   View source code 6 votes vote down vote up
private void addStats() {

		for (String key : statsProject.keySet()) {
			if (key != project.getName()) {
				CLabel title = new CLabel(descriptifRight, SWT.BOLD);
				title.setText(key);
				title.setImage(new Image(display, getClass()
						.getResourceAsStream(
								"images/stats_"
										+ key.replaceAll(" ", "_")
												.toLowerCase() + "_16x16.png")));
				title.setBackground(new Color(display, 255, 255, 255));
				title.setMargins(10, 10, 0, 0);

				FontData[] fd = title.getFont().getFontData();
				fd[0].setStyle(SWT.BOLD);
				title.setFont(new Font(title.getFont().getDevice(), fd));

				CLabel subText = new CLabel(descriptifRight, SWT.NONE);
				subText.setText(statsProject.get(key)
						.replaceAll("<br/>", "\r\n").replaceAll("&nbsp;", " "));
				subText.setBackground(new Color(display, 255, 255, 255));
				subText.setMargins(30, 0, 0, 0);
			}
		}
	}
 
Example 17
Project: pgsqlblocks   File: DBProcessesFiltersView.java   View source code 6 votes vote down vote up
private void createQueryFilterView(GridData comboLayoutData, GridData textLayoutData) {
    Label label = new Label(group, SWT.NONE);
    label.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
    label.setText(resourceBundle.getString("query"));

    queryFilterCombo = new Combo(group, SWT.DROP_DOWN | SWT.READ_ONLY);
    queryFilterCombo.setLayoutData(comboLayoutData);
    fillCombo(queryFilterCombo, FilterValueType.STRING);
    queryFilterCombo.select(0);
    queryFilterCombo.addModifyListener(e -> {
        FilterCondition condition = FilterCondition.getFilterConditionFromConditionText(queryFilterCombo.getText());
        listeners.forEach(listener -> listener.processesFiltersViewQueryFilterConditionChanged(this, condition));
    });

    queryFilterText = new Text(group, SWT.NONE);
    queryFilterText.setLayoutData(textLayoutData);
    queryFilterText.addModifyListener(e -> {
        String text = queryFilterText.getText();
        final String result = text.isEmpty() ? null : text;
        listeners.forEach(listener -> listener.processesFiltersViewQueryFilterValueChanged(this, result));
    });
}
 
Example 18
Project: Hydrograph   File: ELTGraphicalEditor.java   View source code 6 votes vote down vote up
@Override
public void setInput(IEditorInput input) {
	if(input instanceof FileStoreEditorInput){
		MessageBox messageBox=new MessageBox(Display.getCurrent().getActiveShell(),SWT.ICON_WARNING);
		messageBox.setText(Messages.WARNING);
		messageBox.setMessage(Messages.JOB_OPENED_FROM_OUTSIDE_WORKSPACE_WARNING);
		messageBox.open();
	}	
	try {
		GenrateContainerData genrateContainerData = new GenrateContainerData();
		genrateContainerData.setEditorInput(input, this);
		if(StringUtils.equals(this.getJobName()+Messages.JOBEXTENSION, input.getName()) || StringUtils.equals(this.getJobName(), Messages.ELT_GRAPHICAL_EDITOR)){
			container = genrateContainerData.getContainerData();
		}else{
			this.setPartName(input.getName());
		}
		super.setInput(input);
	} catch (CoreException | IOException ce) {
		logger.error("Exception while setting input", ce);
		PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor().dispose();
		MessageDialog.openError(new Shell(), "Error", "Exception occured while opening the graph -\n"+ce.getMessage());
	}
}
 
Example 19
Project: AgentWorkbench   File: ProjectNewOpen.java   View source code 6 votes vote down vote up
@Override
  protected void configureShell(Shell newShell) {
      super.configureShell(newShell);
      this.currentShell = newShell;
      this.currentShell.setText(this.title);
      this.currentShell.getDisplay().addFilter(SWT.Traverse, new Listener() {
	@Override
	public void handleEvent(Event event) {
		switch (event.detail) {
		case SWT.TRAVERSE_ESCAPE:
			event.doit = false;
			cancelPressed();
			break;

		default:
			break;
		}
	}
});
  }
 
Example 20
Project: Hydrograph   File: DebugDataViewer.java   View source code 5 votes vote down vote up
/**
 * 
 * Create unformatted view tab in data viewer tab folder
 * 
 */
public void createUnformattedViewTabItem() {
	if (isViewTabExist(Views.UNFORMATTED_VIEW_NAME)) {
		CTabItem item = getViewTabItem(Views.UNFORMATTED_VIEW_NAME);
		tabFolder.setSelection(item);
		dataViewLoader.reloadloadViews();
		return;
	}

	CTabItem tbtmUnformattedView = new CTabItem(tabFolder, SWT.CLOSE);
	tbtmUnformattedView.setData(Views.VIEW_NAME_KEY, Views.UNFORMATTED_VIEW_NAME);
	tbtmUnformattedView.setText(Views.UNFORMATTED_VIEW_DISPLAY_NAME);
	{
		Composite composite = new Composite(tabFolder, SWT.NONE);
		tbtmUnformattedView.setControl(composite);
		composite.setLayout(new GridLayout(1, false));
		{
			unformattedViewTextarea = new StyledText(composite, SWT.BORDER | SWT.READ_ONLY | SWT.V_SCROLL
					| SWT.H_SCROLL);
			unformattedViewTextarea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
		}
	}

	tabFolder.setSelection(tbtmUnformattedView);
	dataViewLoader.setUnformattedViewTextarea(unformattedViewTextarea);
	dataViewLoader.reloadloadViews();
	actionFactory.getAction(SelectColumnAction.class.getName()).setEnabled(false);
}
 
Example 21
Project: Hydrograph   File: PropertyDialogBuilder.java   View source code 5 votes vote down vote up
private CTabItem createTab(String groupName, CTabFolder tabFolder) {
	CTabItem tabItem = new CTabItem(tabFolder, SWT.NONE);
	
	if (OSValidator.isMac()) {
		tabItem.setText(" "+WordUtils.capitalize(groupName.replace("_", " ").toLowerCase(), null));
	}
	else {
		tabItem.setText(WordUtils.capitalize(groupName.replace("_", " ").toLowerCase(), null));			
	}
	return tabItem;
}
 
Example 22
Project: time4sys   File: TimingPropertiesEditionPartImpl.java   View source code 5 votes vote down vote up
/**
 * 
 */
protected Composite createTimingPropertiesGroup(Composite parent) {
	Group timingPropertiesGroup = new Group(parent, SWT.NONE);
	timingPropertiesGroup.setText(HrmMessages.TimingPropertiesEditionPart_TimingPropertiesGroupLabel);
	GridData timingPropertiesGroupData = new GridData(GridData.FILL_HORIZONTAL);
	timingPropertiesGroupData.horizontalSpan = 3;
	timingPropertiesGroup.setLayoutData(timingPropertiesGroupData);
	GridLayout timingPropertiesGroupLayout = new GridLayout();
	timingPropertiesGroupLayout.numColumns = 3;
	timingPropertiesGroup.setLayout(timingPropertiesGroupLayout);
	return timingPropertiesGroup;
}
 
Example 23
Project: bdf2   File: ColumnDialog.java   View source code 5 votes vote down vote up
private void createBasicControl(Composite container) {
	GridLayout layout = new GridLayout();
	container.setLayout(layout);
	layout.numColumns = 6;
	layout.verticalSpacing = 10;
	layout.marginTop = 10;
	layout.marginWidth = 10;
	createErrorLabel(container);
	createColumnInfoControl(container);
	final ISWTObservableValue observableValue = SWTObservables.observeText(errorLabel);
	errorLabel.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_RED));
	dataBindingContext.bindValue(observableValue, new AggregateValidationStatus(dataBindingContext.getBindings(),
			AggregateValidationStatus.MAX_SEVERITY), null, null);
	observableValue.addChangeListener(new IChangeListener() {
		public void handleChange(ChangeEvent event) {
			if (observableValue.getValue().equals("OK")) {
				errorLabel.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));
				errorLabel.setText(DIALOG_MESSAGE);
				buttonOk.setEnabled(true);
			} else {
				errorLabel.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_RED));
				buttonOk.setEnabled(false);
			}
		}
	});

}
 
Example 24
Project: BiglyBT   File: TopBarView.java   View source code 5 votes vote down vote up
/**
 * @param view
 *
 * @since 3.0.1.1
 */
private void addTopBarView(UISWTViewCore view, Composite composite) {
	Composite parent = new Composite(composite, SWT.None);
	parent.setLayoutData(Utils.getFilledFormData());
	parent.setLayout(new FormLayout());

	view.initialize(parent);
	parent.setVisible(false);

	Control[] children = parent.getChildren();
	for (int i = 0; i < children.length; i++) {
		Control control = children[i];
		Object ld = control.getLayoutData();
		boolean useGridLayout = ld != null && (ld instanceof GridData);
		if (useGridLayout) {
			GridLayout gridLayout = new GridLayout();
			gridLayout.horizontalSpacing = 0;
			gridLayout.marginHeight = 0;
			gridLayout.marginWidth = 0;
			gridLayout.verticalSpacing = 0;
			parent.setLayout(gridLayout);
			break;
		} else if (ld == null) {
			control.setLayoutData(Utils.getFilledFormData());
		}
	}

	topbarViews.add(view);

	if ( listPlugins != null ){

		if ( isEnabled( view )){

			listPlugins.add( getViewName( view ));
		}
	}
}
 
Example 25
Project: Hydrograph   File: XmlFilePathModifyListener.java   View source code 5 votes vote down vote up
@Override
public Listener getListener(PropertyDialogButtonBar propertyDialogButtonBar, ListenerHelper helper, Widget... widgets) {
	final Widget[] widgetList = widgets;
	if (helper != null) {
		txtDecorator = (ControlDecoration) helper.get(HelperType.CONTROL_DECORATION);
	}
	
	Listener listener=new Listener() {
		
		@Override
		public void handleEvent(Event event) {
			IPath path = new Path(((Text) widgetList[0]).getText().trim());
			if (event.type == SWT.Modify ) {
				if (StringUtils.isNotBlank(path.segment(0))) {
					if (path.lastSegment().endsWith(".xml")) {
						txtDecorator.hide();
						((Text) widgetList[0]).setToolTipText("");
						((Text) widgetList[0]).setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 255, 255, 255));

					}else{
						txtDecorator.show();
						txtDecorator.setDescriptionText("Select valid XML file");
						((Text) widgetList[0]).setToolTipText(txtDecorator.getDescriptionText());
						((Text) widgetList[0]).setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 255, 255, 204));
					}
				}
			}
		}
	};
	
	return listener;
}
 
Example 26
Project: ide-plugins   File: PluginDialog.java   View source code 5 votes vote down vote up
protected Composite createBottomContent() {
    Composite bottom = new Composite(composite, SWT.NONE);
    bottom.setBackground(backColor);
    
    GridLayout layout = new GridLayout(2, true);
    layout.marginTop = 0;
    layout.marginLeft = 20;
    layout.marginRight = 20;
    bottom.setLayout(layout);
    bottom.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    
    return bottom;
}
 
Example 27
Project: neoscada   File: ConfigurationFormToolkit.java   View source code 5 votes vote down vote up
public void createStandardCheckbox ( final Composite parent, final String attributeName, final String label, final IObservableMap data, final Object valueType )
{
    final Button button = this.toolkit.createButton ( parent, label, SWT.CHECK );
    {
        final GridData gd = new GridData ( GridData.FILL_HORIZONTAL );
        gd.horizontalSpan = 3;
        button.setLayoutData ( gd );
        final IObservableValue value = Observables.observeMapEntry ( data, attributeName, valueType );
        this.dbc.bindValue ( WidgetProperties.selection ().observe ( button ), value );
    }
}
 
Example 28
Project: gw4e.project   File: FolderSelectionGroup.java   View source code 5 votes vote down vote up
private void fireEvent () {
	if (listener != null) {
		Event changeEvent = new Event();
		changeEvent.type = SWT.Selection;
		listener.handleEvent(changeEvent);
	}		
}
 
Example 29
Project: n4js   File: WorkspaceWizardPage.java   View source code 5 votes vote down vote up
/**
 * Adds the content proposal field decoration to a given control.
 *
 * @param control
 *            The control to decorate
 */
private ControlDecoration createContentProposalDecoration(Control control) {
	ControlDecoration decoration = new ControlDecoration(control, SWT.TOP | SWT.LEFT);
	decoration.setImage(contentProposalDecorationImage);
	decoration.setShowOnlyOnFocus(true);
	return decoration;
}
 
Example 30
Project: neoscada   File: WriteOperationWizardValuePage.java   View source code 5 votes vote down vote up
private void setValueText ( final String value, final boolean systemText )
{
    this.convertedValue.setText ( value );

    if ( systemText )
    {
        final Color color = this.convertedValue.getDisplay ().getSystemColor ( SWT.COLOR_RED );
        this.convertedValue.setForeground ( color );
    }
    else
    {
        this.convertedValue.setForeground ( this.defaultValueColor );
    }
}
 
Example 31
Project: Hydrograph   File: FTPOperationConfigUtility.java   View source code 5 votes vote down vote up
private void selectionListener(Button button, Text txt){
	button.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			FileDialog filedialog = new FileDialog(button.getShell(), SWT.None);
			txt.setText(filedialog.open());
		}
	});
}
 
Example 32
Project: ide-plugins   File: OptionsPage.java   View source code 5 votes vote down vote up
public OptionsPage() {
	super(GRID);
	setDescription("Gluon Settings");
	if (ProjectData.alreadyOptedIn()) {
		this.userEmail = PREFERENCES.get(ProjectConstants.PARAM_USER_EMAIL, "");
		this.userUptodate = PREFERENCES.getBoolean(ProjectConstants.PARAM_USER_UPTODATE, true);
		this.userMobileLicense = PREFERENCES.get(ProjectConstants.PARAM_USER_LICENSE_MOBILE, "");
		this.userDesktopLicense = PREFERENCES.get(ProjectConstants.PARAM_USER_LICENSE_DESKTOP, "");
	}
	color = Display.getCurrent().getSystemColor(SWT.COLOR_RED);
}
 
Example 33
Project: gw4e.project   File: GeneratorChoiceComposite.java   View source code 5 votes vote down vote up
private void createNewMode() {
	btnCreateNewRadioButton = new Button(this, SWT.RADIO);
	btnCreateNewRadioButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 12, 1));
	btnCreateNewRadioButton.setText(MessageUtil.getString("standalone_mode"));
	btnCreateNewRadioButton.setSelection(false);
	btnCreateNewRadioButton.addListener(SWT.Selection, new Listener() {
		public void handleEvent(Event e) {
			switch (e.type) {
			case SWT.Selection:
				updateUI();
				break;
			}
		}
	});
	btnCreateNewRadioButton.setData(GW4E_CONVERSION_WIDGET_ID, GW4E_NEWCLASS_CHECKBOX);

	Composite composite = new Composite(this, SWT.NONE);
	composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 12, 1));
	composite.setLayout(new GridLayout(12, false));

	lblNewClassnameLabel = new Label(composite, SWT.NONE);
	lblNewClassnameLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 4, 1));
	lblNewClassnameLabel.setText("Class name");
	lblNewClassnameLabel.setEnabled(false);

	newClassnameText = new Text(composite, SWT.BORDER);
	newClassnameText.setEnabled(false);
	newClassnameText.addModifyListener(new ModifyListener() {
		public void modifyText(ModifyEvent event) {
			listener.handleEvent(null);
		}
	});
	newClassnameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 8, 1));
	newClassnameText.setEnabled(false);
	newClassnameText.setData(GW4E_CONVERSION_WIDGET_ID, GW4E_NEWCLASS_TEXT);
}
 
Example 34
Project: BiglyBT   File: SubscriptionWizard.java   View source code 5 votes vote down vote up
private Composite createCreateComposite(Composite parent) {
	Composite composite = new Composite(parent,SWT.NONE);

	FillLayout layout = new FillLayout();
	layout.marginHeight = 8;
	layout.marginWidth  = 8;

	composite.setLayout(layout);

	createTabFolder = new TabFolder(composite,SWT.NONE);
	createTabFolder.setFont(subTitleFont);

	createSearchTabItem = new TabItem(createTabFolder,SWT.NONE);
	createSearchTabItem.setText(MessageText.getString("Wizard.Subscription.create.search"));
	createSearchTabItem.setControl(createCreateSearchComposite(createTabFolder));

	createRSSTabItem = new TabItem(createTabFolder,SWT.NONE);
	createRSSTabItem.setText("  " + MessageText.getString("Wizard.Subscription.create.rss"));
	createRSSTabItem.setControl(createCreateRSSComposite(createTabFolder));

	createTabFolder.addListener(SWT.Selection, new Listener() {
		@Override
		public void handleEvent(Event event) {
			TabItem[] selectedItems = createTabFolder.getSelection();
			if(selectedItems.length != 1) {
				return;
			}
			TabItem selectedItem = selectedItems[0];
			if(selectedItem == createRSSTabItem) {
				setMode(MODE_CREATE_RSS);
			} else {
				setMode(MODE_CREATE_SEARCH);
			}
		}
	});

	return composite;
}
 
Example 35
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(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 36
Project: convertigo-eclipse   File: MobileSmartSourceEditorComposite.java   View source code 5 votes vote down vote up
public MobileSmartSourceEditorComposite(Composite parent, int style, AbstractDialogCellEditor cellEditor) {
	super(parent, style, cellEditor);
	
	DatabaseObjectTreeObject dbto = cellEditor.databaseObjectTreeObject;
	String source = (String)cellEditor.getEditorData();
	
	this.setLayout(new GridLayout(1, false));
	
	mpc = new MobilePickerComposite(this, true);
	mpc.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
	mpc.setCurrentInput(dbto, source);
}
 
Example 37
Project: Hydrograph   File: ComponentTooltip.java   View source code 5 votes vote down vote up
/**
 * Create scrolled composite
 * @param parent
 * @return
 */
private ScrolledComposite createScrolledComposite(Composite parent) {
	ScrolledComposite scrolledComposite = new ScrolledComposite(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
	scrolledComposite.setExpandHorizontal(true);
	scrolledComposite.setExpandVertical(true);
	
	logger.debug("ComponentTooltip.createScrolledComposite() - created scrolled composite " + scrolledComposite);
	
	return scrolledComposite;
}
 
Example 38
Project: bdf2   File: ImportFromDatabaseWizardPage.java   View source code 5 votes vote down vote up
@Override
public void createControl(Composite parent) {
	setPageComplete(false);
	Composite container = new Composite(parent, SWT.NULL);
	GridLayout layout = new GridLayout();
	container.setLayout(layout);
	layout.numColumns = 1;
	layout.verticalSpacing = 9;
	createTreeViewer(container);
	initTreeViewerData();
	addListeners();
	setControl(container);

}
 
Example 39
Project: Hydrograph   File: HiveInputExtractMetaStoreDialog.java   View source code 5 votes vote down vote up
/**
 * Create contents of the dialog.
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
	
	getShell().setText("Credentials Required");
	
	Composite container = (Composite) super.createDialogArea(parent);
	container.getLayout();

	
	Composite composite = new Composite(container, SWT.NONE);
	composite.setLayout(new GridLayout(4, false));
	composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
	new Label(composite, SWT.NONE);
	new Label(composite, SWT.NONE);
	new Label(composite, SWT.NONE);
	new Label(composite, SWT.NONE);
	new Label(composite, SWT.NONE);
	
	Label lblUserName = new Label(composite, SWT.NONE);
	lblUserName.setText("User Name");
	new Label(composite, SWT.NONE);
	
	username = new Text(composite, SWT.BORDER);
	username.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	new Label(composite, SWT.NONE);
	
	Label lblPassword = new Label(composite, SWT.NONE);
	lblPassword.setText("Password");
	new Label(composite, SWT.NONE);
	
	password = new Text(composite, SWT.PASSWORD|SWT.BORDER);
	password.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	
	createErrorComposite(container);

	return container;
}
 
Example 40
Project: convertigo-eclipse   File: SmartTypeEditor.java   View source code 5 votes vote down vote up
@Override
protected Control createContents(Composite cell) {
	Text text = new Text(cell, SWT.NONE);
	text.setText("lol");
	Control control = super.createContents(cell);
	control.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_CYAN));
	return control;
}