Java Code Examples for org.eclipse.swt.SWT#NO_TRIM
The following examples show how to use
org.eclipse.swt.SWT#NO_TRIM .
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: GridToolTip.java From nebula with Eclipse Public License 2.0 | 6 votes |
/** * Creates an inplace tooltip. * * @param parent parent control. */ public GridToolTip(final Control parent) { super(parent, SWT.NONE); shell = new Shell(parent.getShell(), SWT.NO_TRIM | SWT.ON_TOP | SWT.NO_FOCUS | SWT.TOOL); shell.setBackground(shell.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND)); shell.setForeground(shell.getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND)); parent.addListener(SWT.Dispose, new Listener() { public void handleEvent(Event arg0) { shell.dispose(); dispose(); } }); shell.addListener(SWT.Paint, new Listener() { public void handleEvent(Event e) { onPaint(e.gc); } }); }
Example 2
Source File: PopOverShell.java From swt-bling with MIT License | 6 votes |
/** * Provides the backbone for Custom Widgets that need a <code>Shell</code> popped over a <code>Control</code> or * <code>CustomElementDataProvider</code>. If you're using a <code>CustomElementDataProvider</code>, pass the * <code>CustomElementDataProvider.getPaintedElement()</code> as the parentControl. * @param parentControl The control you want the PopOverShell to appear above. In the case of * <code>CustomElementDataProvider</code>, pass * <code>CustomElementDataProvider.getPaintedElement()</code>. * @param customElementDataProvider The <code>CustomElementDataProvider</code> you want the PopOverShell to appear * above (or null if you're using a Control) */ public PopOverShell(Control parentControl, CustomElementDataProvider customElementDataProvider) { super(parentControl, SWT.NONE); displaySafe = new DisplaySafe(); if (customElementDataProvider != null) { poppedOverItem = new PoppedOverItem(customElementDataProvider); } else { poppedOverItem = new PoppedOverItem(parentControl); } this.parentControl = parentControl; parentShell = AncestryHelper.getShellFromControl(poppedOverItem.getControl()); backgroundColor = ColorFactory.getColor(getDisplay(), BACKGROUND_COLOR); // SWT.TOOL adds a drop shadow on supported platforms popOverShell = new Shell(parentShell, SWT.NO_TRIM | SWT.TOOL); popOverShell.setBackground(backgroundColor); popOverShell.setLayout(new FillLayout()); attachListeners(); }
Example 3
Source File: SWTUtil.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
/** * Creates the tab folder for displaying the composite fragments * * @param parent */ public static CTabFolder createTabFolder(Composite parent) { Display display = getStandardDisplay(); Color c1 = display.getSystemColor(SWT.COLOR_TITLE_BACKGROUND), c2 = display .getSystemColor(SWT.COLOR_TITLE_BACKGROUND_GRADIENT); CTabFolder tabs = new CTabFolder(parent, SWT.NO_REDRAW_RESIZE | SWT.NO_TRIM | SWT.FLAT); GridData gd = new GridData(GridData.FILL_BOTH); gd.horizontalSpan = 2; tabs.setSelectionBackground(new Color[] { c1, c2 }, new int[] { 100 }, true); tabs.setSelectionForeground(getStandardDisplay().getSystemColor(SWT.COLOR_TITLE_FOREGROUND)); tabs.setSimple(PlatformUI.getPreferenceStore().getBoolean( IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS)); tabs.setLayoutData(gd); tabs.setBorderVisible(true); tabs.setFont(parent.getFont()); return tabs; }
Example 4
Source File: ShowUsesHandler.java From tlaplus with MIT License | 6 votes |
public ShowUsesPopupDialog(Shell parent, String[] moduleList, SemanticNode[][] usesArray) { super(parent, SWT.NO_TRIM, true, // takeFocusOnOpen false, // persistSize true, // persistLocation true, // showDialogMenu true, // showPersistActions "Choose Module", // titleText "Click or choose by typing prefix or arrow keys and enter."); // infoText this.parent = parent; this.moduleList = moduleList; this.showUses = usesArray; this.editor = EditorUtil.getTLAEditorWithFocus(); if (this.editor != null) { module = ResourceHelper.getModuleNode(editor.getModuleName()); } }
Example 5
Source File: WorkbenchHelper.java From gama with GNU General Public License v3.0 | 6 votes |
public static Shell obtainFullScreenShell(final int id) { final Monitor[] monitors = WorkbenchHelper.getDisplay().getMonitors(); int monitorId = id; if (monitorId < 0) { monitorId = 0; } if (monitorId > monitors.length - 1) { monitorId = monitors.length - 1; } final Rectangle bounds = monitors[monitorId].getBounds(); final Shell fullScreenShell = new Shell(WorkbenchHelper.getDisplay(), SWT.NO_TRIM | SWT.ON_TOP); fullScreenShell.setBounds(bounds); final FillLayout fl = new FillLayout(); fl.marginHeight = 0; fl.marginWidth = 0; fl.spacing = 0; // final GridLayout gl = new GridLayout(1, true); // gl.horizontalSpacing = 0; // gl.marginHeight = 0; // gl.marginWidth = 0; // gl.verticalSpacing = 0; fullScreenShell.setLayout(fl); return fullScreenShell; }
Example 6
Source File: BlurredPanel.java From nebula with Eclipse Public License 2.0 | 6 votes |
/** * Show the blurred panel */ public void show() { if (parent.isDisposed()) { SWT.error(SWT.ERROR_WIDGET_DISPOSED); } panel = new Shell(parent, SWT.APPLICATION_MODAL | SWT.NO_TRIM); panel.setLayout(new FillLayout()); panel.addListener(SWT.KeyUp, event -> { event.doit = false; }); canvas = new Canvas(panel, SWT.NO_BACKGROUND | SWT.DOUBLE_BUFFERED); canvas.addPaintListener(event -> { paintCanvas(event); }); panel.setBounds(panel.getDisplay().map(parent, null, parent.getClientArea())); panel.open(); }
Example 7
Source File: Notifier.java From nebula with Eclipse Public License 2.0 | 6 votes |
/** * Creates a notification window * * @param image image. If <code>null</code>, a default image is used * @param title title, the title of the window * @param text text of the window * @param colors color set * @return the notification window as a shell object */ protected static Shell createNotificationWindow(final Image image, final String title, final String text, final NotifierColors colors) { final Shell shell = new Shell(Display.getDefault().getActiveShell(), SWT.NO_TRIM | SWT.NO_FOCUS | SWT.ON_TOP); shell.setLayout(new GridLayout(2, false)); shell.setBackgroundMode(SWT.INHERIT_FORCE); createTitle(shell, title, colors); createImage(shell, image); createText(shell, text, colors); createBackground(shell, colors); createCloseAction(shell); shell.addListener(SWT.Dispose, event -> { colors.dispose(); }); shell.pack(); shell.setMinimumSize(320, 100); return shell; }
Example 8
Source File: MainSplash.java From arx with Apache License 2.0 | 6 votes |
/** * Creates a new instance. * * @param display * @param monitor */ public MainSplash(Display display, Monitor monitor) { this.version = ARXAnonymizer.VERSION; this.splash = Resources.getSplash(display); this.shell = new Shell(SWT.ON_TOP | (isMac() ? 0 : SWT.NO_TRIM)); this.shell.setImages(Resources.getIconSet(display)); this.shell.setSize(splash.getBounds().width, splash.getBounds().height); // Center SWTUtil.center(shell, monitor); // Paint shell.addPaintListener(new PaintListener(){ public void paintControl(PaintEvent arg0) { paint(arg0.gc); } }); }
Example 9
Source File: MultipleSelectionCombo.java From pentaho-kettle with Apache License 2.0 | 5 votes |
private void initFloatShell() { Point p = displayText.getParent().toDisplay( displayText.getLocation() ); Point size = displayText.getSize(); Rectangle shellRect = new Rectangle( p.x, p.y + size.y, size.x, 0 ); floatShell = new Shell( MultipleSelectionCombo.this.getShell(), SWT.NO_TRIM ); GridLayout gl = new GridLayout(); gl.marginBottom = 2; gl.marginTop = 2; gl.marginRight = 0; gl.marginLeft = 0; gl.marginWidth = 0; gl.marginHeight = 0; floatShell.setLayout( gl ); list = new List( floatShell, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL ); for ( String value : comboItems ) { list.add( value ); } GridData gd = new GridData( GridData.FILL_BOTH ); list.setLayoutData( gd ); floatShell.setSize( shellRect.width, 100 ); floatShell.setLocation( shellRect.x, shellRect.y ); list.addMouseListener( new MouseAdapter() { @Override public void mouseUp( MouseEvent event ) { super.mouseUp( event ); comboSelection = list.getSelectionIndices(); displayText(); } } ); floatShell.open(); }
Example 10
Source File: SetToolTipImage.java From AndroidRobot with Apache License 2.0 | 5 votes |
/** * Create contents of the window. */ protected void createContents() { shell = new Shell(SWT.NO_TRIM | SWT.ON_TOP); shell.setSize(width, height); shell.setBackground(display.getSystemColor(SWT.COLOR_DARK_MAGENTA)); shell.setLayoutData(new GridData(GridData.FILL_BOTH)); shell.setLayout(new GridLayout(1, true)); //shell.setText("SWT Application"); picture = new Label(shell,SWT.NULL); picture.setLayoutData(new GridData(GridData.FILL_BOTH)); setImage(); }
Example 11
Source File: TableCombo.java From nebula with Eclipse Public License 2.0 | 5 votes |
/** * creates the popup shell. * * @param selectionIndex */ void createPopup(final int selectionIndex) { // create shell and table popup = new Shell(getShell(), SWT.NO_TRIM | SWT.ON_TOP); // 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 final int[] popupEvents = { SWT.Close, SWT.Paint, SWT.Deactivate, SWT.Help }; for (final int popupEvent : popupEvents) { popup.addListener(popupEvent, listener); } // add table listeners final int[] tableEvents = { SWT.MouseUp, SWT.Selection, SWT.Traverse, SWT.KeyDown, SWT.KeyUp, SWT.FocusIn, SWT.Dispose }; for (final int tableEvent : tableEvents) { table.addListener(tableEvent, listener); } // set the selection if (selectionIndex != -1) { table.setSelection(selectionIndex); } }
Example 12
Source File: RenameInformationPopup.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
public void open() { // Must cache here, since editor context is not available in menu from popup shell: fOpenDialogBinding= getOpenDialogBinding(); Shell workbenchShell= fEditor.getSite().getShell(); final Display display= workbenchShell.getDisplay(); fPopup= new Shell(workbenchShell, SWT.ON_TOP | SWT.NO_TRIM | SWT.TOOL); fPopupLayout= new GridLayout(2, false); fPopupLayout.marginWidth= 1; fPopupLayout.marginHeight= 1; fPopupLayout.marginLeft= 4; fPopupLayout.horizontalSpacing= 0; fPopup.setLayout(fPopupLayout); createContent(fPopup); updatePopupLocation(true); new PopupVisibilityManager().start(); // Leave linked mode when popup loses focus // (except when focus goes back to workbench window or menu is open): fPopup.addShellListener(new ShellAdapter() { @Override public void shellDeactivated(ShellEvent e) { if (fIsMenuUp) return; final Shell editorShell= fEditor.getSite().getShell(); display.asyncExec(new Runnable() { // post to UI thread since editor shell only gets activated after popup has lost focus public void run() { Shell activeShell= display.getActiveShell(); if (activeShell != editorShell) { fRenameLinkedMode.cancel(); } } }); } }); if (! MAC) { // carbon and cocoa draw their own border... fPopup.addPaintListener(new PaintListener() { public void paintControl(PaintEvent pe) { pe.gc.drawPolygon(getPolygon(true)); } }); } // fPopup.moveBelow(null); // make sure hovers are on top of the info popup // XXX workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=170774 // fPopup.moveBelow(workbenchShell.getShells()[0]); UIJob delayJob= new UIJob(display, ReorgMessages.RenameInformationPopup_delayJobName) { @Override public IStatus runInUIThread(IProgressMonitor monitor) { fDelayJobFinished= true; if (fPopup != null && ! fPopup.isDisposed()) { updateVisibility(); } return Status.OK_STATUS; } }; delayJob.setSystem(true); delayJob.setPriority(Job.INTERACTIVE); delayJob.schedule(POPUP_VISIBILITY_DELAY); }
Example 13
Source File: RenameRefactoringPopup.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
public void open() { // Must cache here, since editor context is not available in menu from popup shell: openDialogBinding = getOpenDialogBinding(); Shell workbenchShell = editor.getSite().getShell(); final Display display = workbenchShell.getDisplay(); popup = new Shell(workbenchShell, SWT.ON_TOP | SWT.NO_TRIM | SWT.TOOL); popupLayout = new GridLayout(2, false); popupLayout.marginWidth = 1; popupLayout.marginHeight = 1; popupLayout.marginLeft = 4; popupLayout.horizontalSpacing = 0; popup.setLayout(popupLayout); createContent(popup); updatePopupLocation(); new PopupVisibilityManager().start(); // Leave linked mode when popup loses focus // (except when focus goes back to workbench window or menu is open): popup.addShellListener(new ShellAdapter() { @Override public void shellDeactivated(ShellEvent e) { if (iSMenuUp) return; final Shell editorShell = editor.getSite().getShell(); display.asyncExec(new Runnable() { // post to UI thread since editor shell only gets activated after popup has lost focus @Override public void run() { Shell activeShell = display.getActiveShell(); if (activeShell != editorShell) { controller.cancelLinkedMode(); } } }); } }); if (!MAC) { // carbon and cocoa draw their own border... popup.addPaintListener(new PaintListener() { @Override public void paintControl(PaintEvent pe) { pe.gc.drawPolygon(getPolygon(true)); } }); } UIJob delayJob = new UIJob(display, "Delayed RenameInformationPopup") { @Override public IStatus runInUIThread(IProgressMonitor monitor) { delayJobFinished = true; if (popup != null && !popup.isDisposed()) { updateVisibility(); } return Status.OK_STATUS; } }; delayJob.setSystem(true); delayJob.setPriority(Job.INTERACTIVE); delayJob.schedule(POPUP_VISIBILITY_DELAY); }
Example 14
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 15
Source File: BaseCombo.java From nebula with Eclipse Public License 2.0 | 4 votes |
private void createContentShell() { contentShell = new Shell(getShell(), SWT.NO_TRIM | SWT.ON_TOP); contentShell.addListener(SWT.Close, shellListener); contentShell.addListener(SWT.Deactivate, shellListener); }
Example 16
Source File: CTreeCombo.java From nebula with Eclipse Public License 2.0 | 4 votes |
void createPopup(Collection<CTreeComboItem> items, CTreeComboItem selectedItem) { // create shell and list popup = new Shell(getShell(), SWT.NO_TRIM | SWT.ON_TOP); final int style = getStyle(); int listStyle = SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE; if ((style & SWT.FLAT) != 0) { listStyle |= SWT.FLAT; } if ((style & SWT.RIGHT_TO_LEFT) != 0) { listStyle |= SWT.RIGHT_TO_LEFT; } if ((style & SWT.LEFT_TO_RIGHT) != 0) { listStyle |= SWT.LEFT_TO_RIGHT; } tree = new Tree(popup, listStyle); tree.addTreeListener(hookListener); if (font != null) { tree.setFont(font); } if (foreground != null) { tree.setForeground(foreground); } if (background != null) { tree.setBackground(background); } final int[] popupEvents = { SWT.Close, SWT.Paint, SWT.Deactivate }; for (int i = 0; i < popupEvents.length; i++) { popup.addListener(popupEvents[i], listener); } final int[] listEvents = { SWT.MouseUp, SWT.Selection, SWT.Traverse, SWT.KeyDown, SWT.KeyUp, SWT.FocusIn, SWT.Dispose, SWT.Collapse, SWT.Expand }; for (int i = 0; i < listEvents.length; i++) { tree.addListener(listEvents[i], listener); } for (final CTreeComboColumn c : columns) { final TreeColumn col = new TreeColumn(tree, SWT.NONE); c.setRealTreeColumn(col); } if (items != null) { createTreeItems(items.toArray(new CTreeComboItem[0])); } if (selectedItem != null) { tree.setSelection(selectedItem.getRealTreeItem()); } }
Example 17
Source File: SWTSplashWindow.java From tuxguitar with GNU Lesser General Public License v2.1 | 4 votes |
public SWTSplashWindow(Display display) { super(new Shell(display, SWT.NO_TRIM | SWT.NO_BACKGROUND)); this.getControl().setLayout(new FillLayout()); this.getControl().addPaintListener(new SWTPaintListener(this)); }
Example 18
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); } }
Example 19
Source File: InformationControl.java From APICloud-Studio with GNU General Public License v3.0 | 2 votes |
/** * Creates a default information control with the given shell as parent. The given * information presenter is used to process the information to be displayed. The given * styles are applied to the created styled text widget. * * @param parent the parent shell * @param style the additional styles for the styled text widget * @param presenter the presenter to be used */ public InformationControl(Shell parent,int style, IInformationPresenter presenter) { this(parent, SWT.TOOL | SWT.NO_TRIM, style, presenter); }
Example 20
Source File: SourceViewerInformationControl.java From APICloud-Studio with GNU General Public License v3.0 | 2 votes |
/** * Creates a source viewer information control with the given shell as * parent and the given font. * * @param parent the parent shell * @param symbolicFontName the symbolic font name */ public SourceViewerInformationControl(Shell parent, String symbolicFontName) { this(parent, SWT.NO_TRIM | SWT.TOOL, SWT.NONE, symbolicFontName, null); }