Java Code Examples for org.eclipse.swt.SWT#FLAT
The following examples show how to use
org.eclipse.swt.SWT#FLAT .
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: TrendControlImage.java From neoscada with Eclipse Public License 1.0 | 6 votes |
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 2
Source File: RadioGroup.java From nebula with Eclipse Public License 2.0 | 6 votes |
private static int checkButtonStyle(int style) { int result = 0; if ((style & SWT.FLAT) != 0) { result |= SWT.FLAT; } if ((style & SWT.LEFT) != 0) { result |= SWT.LEFT; } else if ((style & SWT.CENTER) != 0) { result |= SWT.CENTER; } else if ((style & SWT.RIGHT) != 0) { result |= SWT.RIGHT; } else { result |= SWT.LEFT; } return result; }
Example 3
Source File: RenameTypeWizardSimilarElementsPage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
public void createControl(Composite parent) { ViewForm viewForm= new ViewForm(parent, SWT.BORDER | SWT.FLAT); Composite inner= new Composite(viewForm, SWT.NULL); GridLayout layout= new GridLayout(); inner.setLayout(layout); createTreeAndSourceViewer(inner); createButtonComposite(inner); viewForm.setContent(inner); setControl(viewForm); Dialog.applyDialogFont(viewForm); PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IJavaHelpContextIds.RENAME_TYPE_WIZARD_PAGE); }
Example 4
Source File: CellExpressionViewer.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Override protected void createToolbar(final int style, final TabbedPropertySheetWidgetFactory widgetFactory) { toolbar = new ToolBar(control, SWT.FLAT | SWT.NO_FOCUS); toolbar.setLayoutData(GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(false, false).create()); toolbar.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE)); final ToolItem editControl = new ToolItem(toolbar, SWT.FLAT); editControl.setImage(Pics.getImage(PicsConstants.edit)); editControl.setData(SWTBOT_WIDGET_ID_KEY, SWTBOT_ID_EDITBUTTON); editControl.addDisposeListener(disposeListener); editControl.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { editDialog = CellExpressionViewer.this.createEditDialog(); openEditDialog(editDialog); } }); }
Example 5
Source File: IterationPropertySection.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
protected ComboViewer createComboViewer(final TabbedPropertySheetWidgetFactory widgetFactory, final Composite composite, final ObservableListContentProviderWithProposalListeners contentProvider) { final ComboViewer comboViewer = new ComboViewer(composite, SWT.BORDER | SWT.READ_ONLY); comboViewer.setContentProvider(contentProvider); final IObservableSet knownElements = contentProvider.getKnownElements(); final IObservableMap[] labelMaps = EMFObservables.observeMaps(knownElements, new EStructuralFeature[] { ProcessPackage.Literals.ELEMENT__NAME, ProcessPackage.Literals.DATA__DATA_TYPE, ProcessPackage.Literals.DATA__MULTIPLE }); comboViewer.setLabelProvider(new DataLabelProvider(labelMaps)); final ToolBar toolBar = new ToolBar(composite, SWT.FLAT); widgetFactory.adapt(toolBar); final ToolItem toolItem = new ToolItem(toolBar, SWT.FLAT); toolItem.setImage(Pics.getImage(PicsConstants.clear)); toolItem.setToolTipText(Messages.clearSelection); toolItem.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { comboViewer.setSelection(new StructuredSelection()); } }); return comboViewer; }
Example 6
Source File: StyleCombo.java From birt with Eclipse Public License 1.0 | 5 votes |
static int checkStyle( int style ) { int mask = SWT.BORDER | SWT.READ_ONLY | SWT.FLAT | SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT; return style & mask; }
Example 7
Source File: TextWidget.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
protected void createEditItem(final ToolBar toolBar) { final ToolItem editButton = new ToolItem(toolBar, SWT.FLAT); editButton.setData(SWTBotConstants.SWTBOT_WIDGET_ID_KEY, SWTBotConstants.SWTBOT_ID_TRANSACTIONAL_TEXT_EDIT_BUTTON); editButton.setImage(ImageDescriptor.createFromFile(TextWidget.class, "edit.png").createImage()); editButton.addListener(SWT.Dispose, event -> editButton.getImage().dispose()); editButton.setToolTipText(Messages.edit); editButton.addListener(SWT.Selection, editListener(toolBar)); }
Example 8
Source File: ComponentTitledFolder.java From arx with Apache License 2.0 | 5 votes |
/** * Creates a new instance. * * @param parent * @param controller * @param bar * @param id * @param bottom * @param hasHidingMenu */ public ComponentTitledFolder(Composite parent, Controller controller, ComponentTitledFolderButtonBar bar, String id, Map<Composite, String> helpids, boolean bottom, boolean hasHidingMenu){ int flags = SWT.BORDER | SWT.FLAT; if (bottom) flags |= SWT.BOTTOM; else flags |= SWT.TOP; this.hasHidingMenu = hasHidingMenu; this.folder = new CTabFolder(parent, flags); this.folder.setUnselectedCloseVisible(false); this.folder.setSimple(false); // Create help button if (bar != null || controller != null) { if (bar == null) SWTUtil.createHelpButton(controller, folder, id, helpids); else createBar(controller, folder, bar); } // Prevent closing this.folder.addCTabFolder2Listener(new CTabFolder2Adapter() { @Override public void close(final CTabFolderEvent event) { event.doit = false; } }); }
Example 9
Source File: AbstractEditor.java From gama with GNU General Public License v3.0 | 5 votes |
/** * @param string * @param image */ private ToolItem createItem(final ToolBar t, final String string, final Image image) { final ToolItem i = new ToolItem(t, SWT.FLAT | SWT.PUSH); i.setToolTipText(string); i.setImage(image); return i; }
Example 10
Source File: ClientActionBarAdvisor.java From ice with Eclipse Public License 1.0 | 5 votes |
/** * This operation overrides fillCoolBar to setup the CoolBar for ICE. * * @param coolBar * - A manager for the CoolBar. */ @Override public void fillCoolBar(ICoolBarManager coolBar) { // Local Declarations IToolBarManager toolBar = new ToolBarManager(SWT.FLAT | SWT.RIGHT); // Register the create Item Action toolBar.add(createItemAction); // Register the connect Action; // Register the save actions toolBar.add(saveAction); toolBar.add(saveAllAction); // Register the import action toolBar.add(importFileAction); // Register the launch Mesh Editor action. toolBar.add(launchMeshEditorAction); // Register the import input file action for Items toolBar.add(openImportWizardAction); // Add the save toolbar to the CoolBar coolBar.add(new ToolBarContributionItem(toolBar, "iceTools")); return; }
Example 11
Source File: RecentPanel.java From Rel with Apache License 2.0 | 5 votes |
private void createItem(Composite parent, String prompt, String iconName, String dbURL, Listener action) { boolean enabled = true; if (dbURL != null) enabled = Core.databaseMayExist(dbURL); Composite panel = new Composite(parent, SWT.TRANSPARENT); panel.setLayout(new RowLayout(SWT.VERTICAL)); Composite topPanel = new Composite(panel, SWT.TRANSPARENT); topPanel.setLayout(new RowLayout(SWT.HORIZONTAL)); Button icon = new Button(topPanel, SWT.FLAT); icon.setImage(IconLoader.loadIcon(iconName)); icon.addListener(SWT.Selection, action); icon.setEnabled(enabled); if (dbURL != null) { Button removeButton = new Button(topPanel, SWT.NONE); removeButton.setText("X"); removeButton.setToolTipText("Remove this entry from this list of recently-used databases." + ((enabled) ? " The database will not be deleted." : "")); removeButton.addListener(SWT.Selection, e -> { Core.removeFromRecentlyUsedDatabaseList(dbURL); ((DbTabContentRecent)getParent()).redisplayed(); }); } Label urlButton = new Label(panel, SWT.NONE); urlButton.setText(prompt); urlButton.addListener(SWT.MouseUp, action); if (!enabled) urlButton.setForeground(getDisplay().getSystemColor(SWT.COLOR_TITLE_INACTIVE_FOREGROUND)); }
Example 12
Source File: FindComponentDialog.java From uima-uimaj with Apache License 2.0 | 5 votes |
@Override protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); AbstractSection.spacer(composite); new Label(composite, SWT.WRAP).setText("Descriptor file name pattern (e.g. ab*cde):"); searchByNameText = new Text(composite, SWT.BORDER); searchByNameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); new Label(composite, SWT.WRAP).setText("Descriptor must specify the input type:"); inputTypeText = new Text(composite, SWT.BORDER); inputTypeText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); new Label(composite, SWT.WRAP).setText("Descriptor must specify the output type:"); outputTypeText = new Text(composite, SWT.BORDER); outputTypeText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); new Label(composite, SWT.WRAP).setText("Look in:"); lookInCombo = new CCombo(composite, SWT.FLAT | SWT.BORDER | SWT.READ_ONLY); String[] projectNames = getProjectNames(); lookInCombo.add(' ' + ALL_PROJECTS); for (int i = 0; i < projectNames.length; i++) { lookInCombo.add(' ' + projectNames[i]); } lookInCombo.setText(' ' + ALL_PROJECTS); statusLabel1 = new Label(composite, SWT.NONE); statusLabel1.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); statusLabel2 = new Label(composite, SWT.NONE); statusLabel2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); newErrorMessage(composite); return composite; }
Example 13
Source File: FileViewerWindow.java From AppleCommander with GNU General Public License v2.0 | 5 votes |
/** * Creates the toolbar. */ private void createToolBar(Composite composite, Object layoutData) { toolBar = new ToolBar(composite, SWT.FLAT); toolBar.addListener(SWT.KeyUp, createToolbarCommandHandler()); if (layoutData != null) toolBar.setLayoutData(layoutData); if (nativeFilter != null) { nativeFilterAdapter = (FilterAdapter) nativeFilterAdapterMap.get(nativeFilter.getClass()); if (nativeFilterAdapter != null) { nativeToolItem = nativeFilterAdapter.create(toolBar); nativeToolItem.setSelection(true); } } hexDumpToolItem = createHexDumpToolItem(); if (nativeFilterAdapter == null) { // Default button changes for these instances. hexDumpToolItem.setSelection(true); // Prevent NullPointerExceptions if the nativeFilterAdapter does not apply. nativeFilterAdapter = hexFilterAdapter; } rawDumpToolItem = createRawDumpToolItem(); new ToolItem(toolBar, SWT.SEPARATOR); copyToolItem = createCopyToolItem(); new ToolItem(toolBar, SWT.SEPARATOR); createPrintToolItem(); toolBar.pack(); }
Example 14
Source File: ResponseView.java From http4e with Apache License 2.0 | 5 votes |
private ViewForm doToolbar( String title, final ItemModel model, final Composite parent){ final ViewForm vForm = ViewUtils.buildViewForm(title, model, parent); final ToolBar bar = new ToolBar(vForm, SWT.FLAT); ToolItem i_raw = new ToolItem(bar, SWT.RADIO); i_raw.setImage(ResourceUtils.getImage(CoreConstants.PLUGIN_CORE, CoreImages.RAW)); i_raw.setToolTipText("Raw View"); ToolItem i_pretty = new ToolItem(bar, SWT.RADIO); i_pretty.setImage(ResourceUtils.getImage(CoreConstants.PLUGIN_CORE, CoreImages.PRETTY)); i_pretty.setToolTipText("Pretty View"); ToolItem i_json = new ToolItem(bar, SWT.RADIO); i_json.setImage(ResourceUtils.getImage(CoreConstants.PLUGIN_CORE, CoreImages.JSON)); i_json.setToolTipText("JSON View"); ToolItem i_hex = new ToolItem(bar, SWT.RADIO); i_hex.setImage(ResourceUtils.getImage(CoreConstants.PLUGIN_CORE, CoreImages.HEX)); i_hex.setToolTipText("Hex View"); ToolItem i_br = new ToolItem(bar, SWT.RADIO); i_br.setImage(ResourceUtils.getImage(CoreConstants.PLUGIN_CORE, CoreImages.BROWSER)); i_br.setToolTipText("View in Browser"); vForm.setTopCenter(bar); return vForm; }
Example 15
Source File: DBConnectorsPreferencePage.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
private void createRemoveButton(Composite parent) { final Button remove = new Button(parent, SWT.FLAT); remove.setText(Messages.remove); remove.setLayoutData( GridDataFactory.fillDefaults().grab(true, false).hint(DEFAULT_BUTTON_WIDTH_HINT, SWT.DEFAULT).create()); remove.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { removeDriver(); driverManagerViewer.setInput(getSelectedConnector().getId()); } }); bindButtonWithViewer(remove, driverManagerViewer); }
Example 16
Source File: DataItemCombo.java From birt with Eclipse Public License 1.0 | 5 votes |
static int checkStyle( int style ) { int mask = SWT.BORDER | SWT.READ_ONLY | SWT.FLAT | SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT; return SWT.NO_FOCUS | ( style & mask ); }
Example 17
Source File: AbstractEditor.java From gama with GNU General Public License v3.0 | 4 votes |
protected Composite createToolbar2() { final Composite t = new Composite(composite, SWT.NONE); final GridData d = new GridData(SWT.FILL, SWT.TOP, false, false); t.setLayoutData(d); t.setBackground(HOVERED_BACKGROUND); final GridLayout id = GridLayoutFactory.fillDefaults().equalWidth(false).extendedMargins(0, 0, 0, 0).spacing(0, 0).create(); final GridData gd = GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).indent(0, -1).create(); t.setLayout(id); final String unitText = computeUnitLabel(); if (!unitText.isEmpty()) { unitItem = new Text(t, SWT.READ_ONLY | SWT.FLAT); unitItem.setText(unitText); unitItem.setBackground(HOVERED_BACKGROUND); unitItem.setEnabled(false); } if (isEditable) { final int[] codes = this.getToolItems(); for (final int i : codes) { Button item = null; switch (i) { case REVERT: item = createItem(t, "Revert to original value", GamaIcons.create("small.revert").image()); break; case PLUS: item = createPlusItem(t); break; case MINUS: item = createItem(t, "Decrement the parameter", GamaIcons.create(IGamaIcons.SMALL_MINUS).image()); break; case EDIT: item = createItem(t, "Edit the parameter", GamaIcons.create("small.edit").image()); break; case INSPECT: item = createItem(t, "Inspect the agent", GamaIcons.create("small.inspect").image()); break; case BROWSE: item = createItem(t, "Browse the list of agents", GamaIcons.create("small.browse").image()); break; case CHANGE: item = createItem(t, "Choose another agent", GamaIcons.create("small.change").image()); break; case DEFINE: item = createItem(t, "Set the parameter to undefined", GamaIcons.create("small.undefine").image()); } if (item != null) { items[i] = item; item.setBackground(HOVERED_BACKGROUND); item.setLayoutData(GridDataFactory.copyData(gd)); ; item.addSelectionListener(new ItemSelectionListener(i)); } } } id.numColumns = t.getChildren().length; t.layout(); t.pack(); return t; }
Example 18
Source File: TableCombo.java From translationstudio8 with GNU General Public License v2.0 | 4 votes |
/** * creates the popup shell. * @param selectionIndex */ void createPopup(int selectionIndex) { // create shell and table popup = new Shell(getShell(), SWT.NO_TRIM | SWT.ON_TOP); // set style int style = getStyle(); int tableStyle = SWT.SINGLE | SWT.V_SCROLL; if ((style & SWT.FLAT) != 0) tableStyle |= SWT.FLAT; if ((style & SWT.RIGHT_TO_LEFT) != 0) tableStyle |= SWT.RIGHT_TO_LEFT; if ((style & SWT.LEFT_TO_RIGHT) != 0) tableStyle |= SWT.LEFT_TO_RIGHT; // create table table = new Table(popup, SWT.SINGLE | SWT.FULL_SELECTION); if (font != null) table.setFont(font); if (foreground != null) table.setForeground(foreground); if (background != null) table.setBackground(background); // Add popup listeners int[] popupEvents = { SWT.Close, SWT.Paint, SWT.Deactivate, SWT.Help }; for (int i = 0; i < popupEvents.length; i++) { popup.addListener(popupEvents[i], listener); } // add table listeners int[] tableEvents = { SWT.MouseMove, SWT.MouseUp, SWT.Selection, SWT.Traverse, SWT.KeyDown, SWT.KeyUp, SWT.FocusIn, SWT.Dispose }; for (int i = 0; i < tableEvents.length; i++) { table.addListener(tableEvents[i], listener); } // set the selection if (selectionIndex != -1) { table.setSelection(selectionIndex); } }
Example 19
Source File: JavadocHover.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
@Override public IInformationControl doCreateInformationControl(Shell parent) { if (BrowserInformationControl.isAvailable(parent)) { ToolBarManager tbm= new ToolBarManager(SWT.FLAT); String font= PreferenceConstants.APPEARANCE_JAVADOC_FONT; BrowserInformationControl iControl= new BrowserInformationControl(parent, font, tbm); final BackAction backAction= new BackAction(iControl); backAction.setEnabled(false); tbm.add(backAction); final ForwardAction forwardAction= new ForwardAction(iControl); tbm.add(forwardAction); forwardAction.setEnabled(false); final ShowInJavadocViewAction showInJavadocViewAction= new ShowInJavadocViewAction(iControl); tbm.add(showInJavadocViewAction); final OpenDeclarationAction openDeclarationAction= new OpenDeclarationAction(iControl); tbm.add(openDeclarationAction); final SimpleSelectionProvider selectionProvider= new SimpleSelectionProvider(); if (fSite != null) { OpenAttachedJavadocAction openAttachedJavadocAction= new OpenAttachedJavadocAction(fSite); openAttachedJavadocAction.setSpecialSelectionProvider(selectionProvider); openAttachedJavadocAction.setImageDescriptor(JavaPluginImages.DESC_ELCL_OPEN_BROWSER); openAttachedJavadocAction.setDisabledImageDescriptor(JavaPluginImages.DESC_DLCL_OPEN_BROWSER); selectionProvider.addSelectionChangedListener(openAttachedJavadocAction); selectionProvider.setSelection(new StructuredSelection()); tbm.add(openAttachedJavadocAction); } IInputChangedListener inputChangeListener= new IInputChangedListener() { public void inputChanged(Object newInput) { backAction.update(); forwardAction.update(); if (newInput == null) { selectionProvider.setSelection(new StructuredSelection()); } else if (newInput instanceof BrowserInformationControlInput) { BrowserInformationControlInput input= (BrowserInformationControlInput) newInput; Object inputElement= input.getInputElement(); selectionProvider.setSelection(new StructuredSelection(inputElement)); boolean isJavaElementInput= inputElement instanceof IJavaElement; showInJavadocViewAction.setEnabled(isJavaElementInput); openDeclarationAction.setEnabled(isJavaElementInput); } } }; iControl.addInputChangeListener(inputChangeListener); tbm.update(true); addLinkListener(iControl); return iControl; } else { return new DefaultInformationControl(parent, true); } }
Example 20
Source File: TableCombo.java From tmxeditor8 with GNU General Public License v2.0 | 4 votes |
/** * creates the popup shell. * @param selectionIndex */ void createPopup(int selectionIndex) { // create shell and table popup = new Shell(getShell(), SWT.NO_TRIM | SWT.ON_TOP); // set style int style = getStyle(); int tableStyle = SWT.SINGLE | SWT.V_SCROLL; if ((style & SWT.FLAT) != 0) tableStyle |= SWT.FLAT; if ((style & SWT.RIGHT_TO_LEFT) != 0) tableStyle |= SWT.RIGHT_TO_LEFT; if ((style & SWT.LEFT_TO_RIGHT) != 0) tableStyle |= SWT.LEFT_TO_RIGHT; // create table table = new Table(popup, SWT.SINGLE | SWT.FULL_SELECTION); if (font != null) table.setFont(font); if (foreground != null) table.setForeground(foreground); if (background != null) table.setBackground(background); // Add popup listeners int[] popupEvents = { SWT.Close, SWT.Paint, SWT.Deactivate, SWT.Help }; for (int i = 0; i < popupEvents.length; i++) { popup.addListener(popupEvents[i], listener); } // add table listeners int[] tableEvents = { SWT.MouseMove, SWT.MouseUp, SWT.Selection, SWT.Traverse, SWT.KeyDown, SWT.KeyUp, SWT.FocusIn, SWT.Dispose }; for (int i = 0; i < tableEvents.length; i++) { table.addListener(tableEvents[i], listener); } // set the selection if (selectionIndex != -1) { table.setSelection(selectionIndex); } }