org.eclipse.swt.SWT Java Examples
The following examples show how to use
org.eclipse.swt.SWT.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ContactSorterSwitcher.java From elexis-3-core with Eclipse Public License 1.0 | 6 votes |
@Override public void fill(Menu menu, int index){ for (final ContactSelectorViewerComparator.sorter sortMethod : ContactSelectorViewerComparator.sorter .values()) { MenuItem temp = new MenuItem(menu, SWT.CHECK, index); temp.setData(sortMethod); temp.setText(sortMethod.label); temp.setSelection(ContactSelectorViewerComparator.getSelectedSorter() .equals(sortMethod)); temp.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e){ ContactSelectorViewerComparator.setSelectedSorter(sortMethod); } }); } }
Example #2
Source File: MenuItemProviders.java From translationstudio8 with GNU General Public License v2.0 | 6 votes |
public static IMenuItemProvider hideColumnMenuItemProvider() { return new IMenuItemProvider() { public void addMenuItem(final NatTable natTable, final Menu popupMenu) { MenuItem menuItem = new MenuItem(popupMenu, SWT.PUSH); menuItem.setText("Hide column"); menuItem.setImage(GUIHelper.getImage("hide_column")); menuItem.setEnabled(true); menuItem.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { int columnPosition = getNatEventData(event).getColumnPosition(); natTable.doCommand(new ColumnHideCommand(natTable, columnPosition)); } }); } }; }
Example #3
Source File: SWTSkin.java From BiglyBT with GNU General Public License v2.0 | 6 votes |
protected static Listener getHandCursorListener(Display display) { if (handCursorListener == null) { handCursor = new Cursor(display, SWT.CURSOR_HAND); handCursorListener = new Listener() { @Override public void handleEvent(Event event) { if (event.type == SWT.MouseEnter) { ((Control) event.widget).setCursor(handCursor); } if (event.type == SWT.MouseExit) { ((Control) event.widget).setCursor(null); } } }; } return handCursorListener; }
Example #4
Source File: ResultSetColumnPage.java From birt with Eclipse Public License 1.0 | 6 votes |
protected void buttonPressed( int buttonId ) { ResultSetColumnModel model = getSelectedColumn( ); int index = columnList.indexOf( model ); columnList.remove( index ); switch ( buttonId ) { case SWT.UP : columnList.add( index - 1, model ); break; case SWT.DOWN : columnList.add( index + 1, model ); break; } updateTable( ); updateButtons( ); }
Example #5
Source File: StringFormatterSnippet1.java From nebula with Eclipse Public License 2.0 | 6 votes |
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new GridLayout()); shell.setSize(300, 200); FormattedText text = new FormattedText(shell, SWT.BORDER); text.setFormatter(new StringFormatter()); GridData data = new GridData(); data.widthHint = 200; text.getControl().setLayoutData(data); shell.open(); while ( ! shell.isDisposed() ) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
Example #6
Source File: UnmanageAction.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
protected Control createCustomArea(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); composite.setLayout(new GridLayout()); radio1 = new Button(composite, SWT.RADIO); radio1.addSelectionListener(selectionListener); radio1.setText(Policy.bind("Unmanage.option2")); //$NON-NLS-1$ radio2 = new Button(composite, SWT.RADIO); radio2.addSelectionListener(selectionListener); radio2.setText(Policy.bind("Unmanage.option1")); //$NON-NLS-1$ // set initial state radio1.setSelection(deleteContent); radio2.setSelection(!deleteContent); PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.DISCONNECT_ACTION); return composite; }
Example #7
Source File: Gallery.java From nebula with Eclipse Public License 2.0 | 6 votes |
/** * Returns the index of a GalleryItem when it is a root Item * * @param parentItem * @param item * @return */ protected int _indexOf(GalleryItem item) { int itemCount = getItemCount(); if (item == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); if (1 <= lastIndexOf && lastIndexOf < itemCount - 1) { if (items[lastIndexOf] == item) return lastIndexOf; if (items[lastIndexOf + 1] == item) return ++lastIndexOf; if (items[lastIndexOf - 1] == item) return --lastIndexOf; } if (lastIndexOf < itemCount / 2) { for (int i = 0; i < itemCount; i++) { if (items[i] == item) return lastIndexOf = i; } } else { for (int i = itemCount - 1; i >= 0; --i) { if (items[i] == item) return lastIndexOf = i; } } return -1; }
Example #8
Source File: MoveInnerToTopWizard.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
public void createControl(Composite parent) { initializeDialogUnits(parent); Composite newControl= new Composite(parent, SWT.NONE); setControl(newControl); PlatformUI.getWorkbench().getHelpSystem().setHelp(newControl, IJavaHelpContextIds.MOVE_INNER_TO_TOP_WIZARD_PAGE); newControl.setLayout(new GridLayout()); Dialog.applyDialogFont(newControl); GridLayout layout= new GridLayout(); layout.numColumns= 2; layout.verticalSpacing= 8; newControl.setLayout(layout); addFieldNameEntry(newControl); addFinalCheckBox(newControl); if (getMoveRefactoring().isCreatingInstanceFieldPossible()) { fFinalCheckBox.setSelection(getMoveRefactoring().isInstanceFieldMarkedFinal()); fFinalCheckBox.setEnabled(true); } else { fFinalCheckBox.setSelection(false); fFinalCheckBox.setEnabled(false); } }
Example #9
Source File: JavaCompilerPropertyPage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@Override protected Control createContents(Composite parent) { if (!fIsValidElement) { return new Composite(parent, SWT.NONE); } Composite composite= new Composite(parent, SWT.NONE); composite.setFont(parent.getFont()); GridLayout topLayout= new GridLayout(); topLayout.marginWidth= 0; topLayout.marginHeight= 0; composite.setLayout(topLayout); fIgnoreOptionalProblemsField= new SelectionButtonDialogField(SWT.CHECK); fIgnoreOptionalProblemsField.setLabelText(PreferencesMessages.JavaCompilerPropertyPage_ignore_optional_problems_label); fIgnoreOptionalProblemsField.setSelection(isIgnoringOptionalProblems()); fIgnoreOptionalProblemsField.doFillIntoGrid(composite, 1); return composite; }
Example #10
Source File: DualList.java From nebula with Eclipse Public License 2.0 | 6 votes |
private void deselect(final int start, final int end, final boolean shouldFireEvents) { checkWidget(); if (start > end) { SWT.error(SWT.ERROR_INVALID_RANGE); } final List<DLItem> toBeRemoved = new ArrayList<DLItem>(); for (int index = start; index <= end; index++) { if (index < 0 || index >= items.size()) { continue; } toBeRemoved.add(selection.get(index)); } for (final DLItem item : toBeRemoved) { selection.remove(item); if (shouldFireEvents) { fireSelectionEvent(item); } } if (shouldFireEvents) { fireSelectionChangeEvent(toBeRemoved); } toBeRemoved.clear(); redrawTables(); }
Example #11
Source File: EditRowsDialog.java From pentaho-kettle with Apache License 2.0 | 6 votes |
public EditRowsDialog( Shell parent, int style, String title, String message, RowMetaInterface rowMeta, List<Object[]> rowBuffer ) { this.title = title; this.message = message; this.rowBuffer = rowBuffer; this.rowMeta = rowMeta; this.parentShell = parent; this.style = ( style != SWT.None ) ? style : this.style; props = PropsUI.getInstance(); bounds = null; hscroll = -1; vscroll = -1; title = null; message = null; this.log = LogChannel.GENERAL; }
Example #12
Source File: JobEntrySNMPTrapDialog.java From pentaho-kettle with Apache License 2.0 | 6 votes |
private void ok() { if ( Utils.isEmpty( wName.getText() ) ) { MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR ); mb.setText( BaseMessages.getString( PKG, "System.StepJobEntryNameMissing.Title" ) ); mb.setMessage( BaseMessages.getString( PKG, "System.JobEntryNameMissing.Msg" ) ); mb.open(); return; } jobEntry.setName( wName.getText() ); jobEntry.setPort( wPort.getText() ); jobEntry.setServerName( wServerName.getText() ); jobEntry.setOID( wOID.getText() ); jobEntry.setTimeout( wTimeout.getText() ); jobEntry.setRetry( wTimeout.getText() ); jobEntry.setComString( wComString.getText() ); jobEntry.setMessage( wMessage.getText() ); jobEntry.setTargetType( wTargetType.getText() ); jobEntry.setUser( wUser.getText() ); jobEntry.setPassPhrase( wPassphrase.getText() ); jobEntry.setEngineID( wEngineID.getText() ); dispose(); }
Example #13
Source File: FormatterConfigurationBlock.java From typescript.java with MIT License | 6 votes |
@Override protected Composite createUI(Composite parent) { final ScrolledPageContent pageContent = new ScrolledPageContent(parent); Composite composite = pageContent.getBody(); GridLayout layout = new GridLayout(); layout.marginHeight = 0; layout.marginWidth = 0; composite.setLayout(layout); controlsComposite = new Composite(composite, SWT.NONE); controlsComposite.setFont(composite.getFont()); controlsComposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false)); layout = new GridLayout(); layout.marginHeight = 0; layout.marginWidth = 0; layout.numColumns = 1; controlsComposite.setLayout(layout); // editor options createEditorOptions(controlsComposite); // format options createFormatOptions(controlsComposite); return pageContent; }
Example #14
Source File: ConvertAnonymousToNestedWizard.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private Text addFieldNameField(Composite result) { Label nameLabel= new Label(result, SWT.NONE); nameLabel.setText(RefactoringMessages.ConvertAnonymousToNestedInputPage_class_name); nameLabel.setLayoutData(new GridData()); final Text classNameField= new Text(result, SWT.BORDER | SWT.SINGLE); classNameField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); classNameField.addModifyListener(new ModifyListener(){ public void modifyText(ModifyEvent e) { ConvertAnonymousToNestedInputPage.this.getConvertRefactoring().setClassName(classNameField.getText()); ConvertAnonymousToNestedInputPage.this.updateStatus(); } }); TextFieldNavigationHandler.install(classNameField); return classNameField; }
Example #15
Source File: MenuItemProviders.java From translationstudio8 with GNU General Public License v2.0 | 6 votes |
public static IMenuItemProvider renameColumnMenuItemProvider(final String label) { return new IMenuItemProvider() { public void addMenuItem(final NatTable natTable, final Menu popupMenu) { MenuItem menuItem = new MenuItem(popupMenu, SWT.PUSH); menuItem.setText(label); menuItem.setEnabled(true); menuItem.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { natTable.doCommand(new DisplayColumnRenameDialogCommand(natTable, getNatEventData(event).getColumnPosition())); } }); } }; }
Example #16
Source File: PrioritizeStreamsDialog.java From hop with Apache License 2.0 | 6 votes |
/** * Copy information from the meta-data input to the dialog fields. */ public void getData() { Table table = wFields.table; if ( input.getTransformName().length > 0 ) { table.removeAll(); } for ( int i = 0; i < input.getTransformName().length; i++ ) { TableItem ti = new TableItem( table, SWT.NONE ); ti.setText( 0, "" + ( i + 1 ) ); if ( input.getTransformName()[ i ] != null ) { ti.setText( 1, input.getTransformName()[ i ] ); } } wFields.removeEmptyRows(); wFields.setRowNums(); wFields.optWidth( true ); wTransformName.selectAll(); wTransformName.setFocus(); }
Example #17
Source File: ParameterSection.java From olca-app with Mozilla Public License 2.0 | 6 votes |
private void createComponents(Composite body, FormToolkit toolkit) { String title = forInputParameters ? M.InputParameters : M.DependentParameters; Section section = UI.section(body, toolkit, title); UI.gridData(section, true, true); Composite parent = UI.sectionClient(section, toolkit, 1); table = Tables.createViewer(parent, columns()); ParameterLabelProvider label = new ParameterLabelProvider(); table.setLabelProvider(label); addSorters(table, label); bindActions(section); Tables.bindColumnWidths(table, 0.3, 0.3, 0.2, 0.17, 0.03); int col = forInputParameters ? 1 : 2; table.getTable().getColumns()[col].setAlignment(SWT.RIGHT); Tables.onDoubleClick(table, e -> { var item = Tables.getItem(table, e); if (item == null) { onAdd(); } }); }
Example #18
Source File: WSO2UIToolkit.java From developer-studio with Apache License 2.0 | 6 votes |
public static void createLine(Composite container, int columns, Integer verticalIndent, Integer horizontalIndent) { Label label = new Label(container, SWT.SEPARATOR | SWT.HORIZONTAL); if (columns != -1) { GridData gridData = new GridData(); gridData.horizontalSpan = columns; gridData.grabExcessHorizontalSpace = true; gridData.horizontalAlignment = SWT.FILL; if (verticalIndent != null) { gridData.verticalIndent = verticalIndent; } if (horizontalIndent != null) { gridData.horizontalIndent = horizontalIndent; } label.setLayoutData(gridData); } }
Example #19
Source File: WaitDialog.java From translationstudio8 with GNU General Public License v2.0 | 6 votes |
@Override protected Control createContents(Composite parent) { centerDialogOnScreen(getShell()); Composite composite = new Composite(parent, SWT.NONE); composite.setLayout(new GridLayout(2, false)); composite.setLayoutData(new GridData(CENTER, CENTER, true, true)); composite.setRedraw(true); Label imgLabel = new Label(composite, SWT.NONE); imgLabel.setImage(iconImage); textLabel = new Label(composite, SWT.NONE); textLabel.setLayoutData(new GridData(CENTER, CENTER, true, true)); textLabel.setFont(GUIHelper.getFont(new FontData("Arial", 9, SWT.BOLD))); textLabel.setRedraw(true); textLabel.setText(msg); return composite; }
Example #20
Source File: BonitaContentProposalAdapter.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
void installListeners() { // Listeners on this popup's table and scroll bar proposalTable.addListener(SWT.FocusOut, this); final ScrollBar scrollbar = proposalTable.getVerticalBar(); if (scrollbar != null) { scrollbar.addListener(SWT.Selection, this); } // Listeners on this popup's shell getShell().addListener(SWT.Deactivate, this); getShell().addListener(SWT.Close, this); // Listeners on the target control control.addListener(SWT.MouseDoubleClick, this); control.addListener(SWT.MouseDown, this); control.addListener(SWT.Dispose, this); control.addListener(SWT.FocusOut, this); // Listeners on the target control's shell final Shell controlShell = control.getShell(); controlShell.addListener(SWT.Move, this); controlShell.addListener(SWT.Resize, this); }
Example #21
Source File: ContractInputTypeCellLabelProvider.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Override public void update(ViewerCell cell) { super.update(cell); final ContractInput element = (ContractInput) cell.getElement(); final String text = getText(element); final StyledString styledString = new StyledString(text, new StyledString.Styler() { @Override public void applyStyles(TextStyle textStyle) { if (element.getType() == ContractInputType.DATE) { textStyle.foreground = Display.getDefault().getSystemColor(SWT.COLOR_DARK_GRAY); } } }); cell.setText(styledString.getString()); cell.setStyleRanges(styledString.getStyleRanges()); }
Example #22
Source File: AbstractPictureControl.java From nebula with Eclipse Public License 2.0 | 6 votes |
/** * Create the SWT {@link Label} to host the image picture. * * @param parent * a composite control which will be the parent of the new * instance (cannot be null) * @param style * the style of control to construct * @return */ protected Label createLabelImage(Composite parent, int style) { // Create a Label Label label = createLabel(parent, style); // Create SWT GridData. the size is managed with maxImageWidth and // maxImageHeight pictureLabelImageGridData = new GridData(); pictureLabelImageGridData.horizontalAlignment = SWT.CENTER; pictureLabelImageGridData.verticalAlignment = SWT.CENTER; pictureLabelImageGridData.horizontalSpan = 2; label.setLayoutData(pictureLabelImageGridData); setMaxImageWidth(maxImageWidth); setMaxImageHeight(maxImageHeight); // Create a menu with "Delete", "Modify" Item. Menu menu = createMenu(label); if (menu != null) { label.setMenu(menu); } return label; }
Example #23
Source File: PipelineRunConfigurationDialog.java From hop with Apache License 2.0 | 6 votes |
private void addGuiCompositeWidgets() { // Remove existing children // for ( Control child : wPluginSpecificComp.getChildren() ) { child.removeListener( SWT.DefaultSelection, okListener ); child.dispose(); } if ( workingConfiguration.getEngineRunConfiguration() != null ) { guiCompositeWidgets = new GuiCompositeWidgets( runConfiguration, 25 ); guiCompositeWidgets.createCompositeWidgets( workingConfiguration.getEngineRunConfiguration(), null, wPluginSpecificComp, PipelineRunConfiguration.GUI_PLUGIN_ELEMENT_PARENT_ID, null ); for ( Control control : guiCompositeWidgets.getWidgetsMap().values() ) { control.addListener( SWT.DefaultSelection, okListener ); } } }
Example #24
Source File: PluginHelpDialog.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
@Override protected Control createDialogArea(Composite parent) { Composite tparent = (Composite) super.createDialogArea(parent); tparent.setLayout(new GridLayout()); tparent.setLayoutData(new GridData(GridData.FILL_BOTH)); Label logo = new Label(tparent, SWT.BORDER); logo.setImage(Activator.getImageDescriptor(PluginConstants.HELP_SPLASH).createImage()); return tparent; }
Example #25
Source File: AcutePreferencePage.java From aCute with Eclipse Public License 2.0 | 5 votes |
@Override protected Control createContents(Composite parent) { Composite container = new Composite(parent, SWT.NULL); container.setLayout(new GridLayout(2, false)); createDotnetPathPart(container); initializeContent(); return container; }
Example #26
Source File: SnippetDarkPanel.java From nebula with Eclipse Public License 2.0 | 5 votes |
private static void createRow(final Shell shell, final String label) { final Label lbl = new Label(shell, SWT.NONE); lbl.setText(label); lbl.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false)); final Text text = new Text(shell, SWT.SINGLE | SWT.BORDER); text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); }
Example #27
Source File: PerspectivePart.java From codeexamples-eclipse with Eclipse Public License 1.0 | 5 votes |
@PostConstruct public void postConstruct(Composite parent) { Label label = new Label(parent, SWT.NONE); label.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); label.setText("Created within original plugin"); }
Example #28
Source File: CronEditor.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
protected void createMinutesTab(TabFolder tablFolder) { final TabItem item = new TabItem(tablFolder, SWT.NONE); item.setText(Messages.minutes); final Composite minuteContent = new Composite(tablFolder, SWT.NONE); minuteContent.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); minuteContent.setLayout(GridLayoutFactory.fillDefaults().numColumns(3).margins(15, 10).create()); final Label everyLabel = new Label(minuteContent, SWT.NONE); everyLabel.setLayoutData(GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).create()); everyLabel.setText(Messages.every); final Text minuteText = new Text(minuteContent, SWT.BORDER | SWT.SINGLE); minuteText.setLayoutData(GridDataFactory.fillDefaults().hint(70, SWT.DEFAULT).create()); UpdateValueStrategy strategy = new UpdateValueStrategy(); strategy.setAfterGetValidator(dotValidator); strategy.setConverter(StringToNumberConverter.toInteger(true)); strategy.setBeforeSetValidator(new FrequencyValidator()); context.bindValue(SWTObservables.observeText(minuteText, SWT.Modify), PojoProperties.value("minuteFrequencyForMinute").observe(cronExpression), strategy, null); final Label minuteLabel = new Label(minuteContent, SWT.NONE); minuteLabel.setLayoutData(GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.CENTER).create()); minuteLabel.setText(Messages.minuteLabel); item.setControl(minuteContent); cronExpression.setMode(item.getText()); }
Example #29
Source File: ReverseConversionWizardPage.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
public void createControl(Composite parent) { initData(); // 先初始化本页面需要的数据 Composite contents = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); contents.setLayout(layout); GridData gridData = new GridData(); gridData.horizontalAlignment = SWT.FILL; gridData.grabExcessHorizontalSpace = true; contents.setLayoutData(gridData); createFilesGroup(contents); // 文件列表区域 createPropertiesGroup(contents); // 源文件属性区域组 createConversionOptionsGroup(contents); // 转换选项组 bindValue(); // 数据绑定 try { loadFiles(); // 加载文件列表 } catch (Exception e) { e.printStackTrace(); } filesTable.select(0); // 默认选中第一行数据 filesTable.notifyListeners(SWT.Selection, null); Dialog.applyDialogFont(parent); Point defaultMargins = LayoutConstants.getMargins(); GridLayoutFactory.fillDefaults().numColumns(1).margins(defaultMargins.x, defaultMargins.y) .generateLayout(contents); setControl(contents); validate(); }
Example #30
Source File: RemoteBotEditor.java From saros with GNU General Public License v2.0 | 5 votes |
@Override public void pressShortCutQuickAssignToLocalVariable() throws RemoteException { if (WidgetUtil.getOperatingSystem() == WidgetUtil.OperatingSystem.MAC) widget.pressShortcut(SWT.COMMAND, '2'); else widget.pressShortcut(SWT.CTRL, '2'); SWTUtils.sleep(1000); widget.pressShortcut(SWT.NONE, 'l'); }