Java Code Examples for org.eclipse.swt.SWT#ON_TOP
The following examples show how to use
org.eclipse.swt.SWT#ON_TOP .
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 translationstudio8 with GNU General Public License v2.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: 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 3
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 4
Source File: SWTUtil.java From eclipse-cs with GNU Lesser General Public License v2.1 | 6 votes |
/** * @see org.eclipse.swt.events.MouseListener#mouseDown(org.eclipse.swt.events.MouseEvent) */ @Override public void mouseDown(MouseEvent e) { Control theControl = (Control) e.widget; Display display = theControl.getDisplay(); Shell tip = new Shell(theControl.getShell(), SWT.ON_TOP | SWT.TOOL); tip.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND)); FillLayout layout = new FillLayout(); layout.marginHeight = 1; layout.marginWidth = 2; tip.setLayout(layout); Label label = new Label(tip, SWT.NONE); label.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND)); label.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND)); label.setText(theControl.getToolTipText()); label.addMouseTrackListener(this); Point size = tip.computeSize(SWT.DEFAULT, SWT.DEFAULT); Rectangle rect = theControl.getBounds(); Point pt = theControl.getParent().toDisplay(rect.x, rect.y); tip.setBounds(pt.x, pt.y, size.x, size.y); tip.setVisible(true); }
Example 5
Source File: CustomCombo.java From nebula with Eclipse Public License 2.0 | 5 votes |
void createPopup(String[] items, int selectionIndex) { // create shell and list popup = new Shell(getShell(), SWT.NO_TRIM | SWT.ON_TOP); int style = getStyle(); int listStyle = SWT.SINGLE | SWT.V_SCROLL; 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; list = new List(popup, listStyle); if (font != null) list.setFont(font); if (foreground != null) list.setForeground(foreground); if (background != null) list.setBackground(background); int[] popupEvents = { SWT.Close, SWT.Paint, SWT.Deactivate }; for (int i = 0; i < popupEvents.length; i++) popup.addListener(popupEvents[i], listener); int[] listEvents = { SWT.MouseUp, SWT.Selection, SWT.Traverse, SWT.KeyDown, SWT.KeyUp, SWT.FocusIn, SWT.Dispose }; for (int i = 0; i < listEvents.length; i++) list.addListener(listEvents[i], listener); if (items != null) list.setItems(items); if (selectionIndex != -1) list.setSelection(selectionIndex); }
Example 6
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 7
Source File: BufferDialog.java From e4macs with Eclipse Public License 1.0 | 5 votes |
void showTip(String txt, ItemPkg tp, Table table) { tip = new Shell((Shell) null, SWT.ON_TOP | SWT.TOOL); tip.setLayout(new FillLayout()); tip.setBackground(table.getBackground()); createBufferTip(tip, (IEditorReference)getSelectables().get(txt)); Point size = tip.computeSize(SWT.DEFAULT, SWT.DEFAULT); Rectangle rect = tp.getBounds(); Point pt = table.toDisplay(rect.x + getSizeAdjustment(), rect.y - size.y); tip.setBounds(pt.x, pt.y, size.x, size.y); tip.setVisible(true); }
Example 8
Source File: TexInformationControl.java From texlipse with Eclipse Public License 1.0 | 5 votes |
public TexInformationControl(TexEditor editor, Shell container) { this.editor = editor; document = editor.getTexDocument(); refMana = editor.getDocumentModel().getRefMana(); shell = new Shell(container, SWT.NO_FOCUS | SWT.ON_TOP | SWT.MODELESS); GridLayout layout = new GridLayout(2, false); layout.marginHeight = 3; layout.marginWidth = 3; shell.setLayout(layout); display = shell.getDisplay(); shell.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND)); }
Example 9
Source File: MetaXDialog.java From e4macs with Eclipse Public License 1.0 | 5 votes |
void showTip(String txt, ItemPkg tp, Table table) { tip = new Shell((Shell) null, SWT.ON_TOP | SWT.TOOL); tip.setLayout(new FillLayout()); tip.setBackground(table.getBackground()); createCommandTip(tip, (Command) getSelectables().get(txt)); Point size = tip.computeSize(SWT.DEFAULT, SWT.DEFAULT); Rectangle rect = tp.getBounds(); Point pt = table.toDisplay(rect.x + getSizeAdjustment(), rect.y - size.y); tip.setBounds(pt.x, pt.y, size.x, size.y); tip.setVisible(true); }
Example 10
Source File: StyleCombo.java From birt with Eclipse Public License 1.0 | 5 votes |
void createPopup( Object[] items, int selectionIndex ) { // create shell and list popup = new Shell( getShell( ), SWT.NO_TRIM | SWT.ON_TOP ); table = new Table( popup, SWT.SINGLE | SWT.V_SCROLL | SWT.FULL_SELECTION ); new TableColumn( table, SWT.LEFT ); if ( font != null ) table.setFont( font ); if ( foreground != null ) table.setForeground( foreground ); if ( background != null ) table.setBackground( background ); label.setBackground( table.getBackground( ) ); label.setForeground( table.getForeground( ) ); label.setFont( table.getFont( ) ); int[] popupEvents = { SWT.Close, SWT.Paint, SWT.Deactivate }; for ( int i = 0; i < popupEvents.length; i++ ) popup.addListener( popupEvents[i], listener ); int[] tableEvents = { SWT.MouseUp, SWT.Selection, SWT.Traverse, SWT.KeyDown, SWT.KeyUp, SWT.FocusIn, SWT.FocusOut, SWT.Dispose }; for ( int i = 0; i < tableEvents.length; i++ ) table.addListener( tableEvents[i], listener ); }
Example 11
Source File: TableCombo.java From Pydev with Eclipse Public License 1.0 | 5 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); // 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 }; for (int i = 0; i < popupEvents.length; i++) { popup.addListener(popupEvents[i], listener); } // add table listeners int[] tableEvents = { 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 12
Source File: CustomInformationControl.java From uima-uimaj with Apache License 2.0 | 5 votes |
/** * Initializes a new instance. * * @param parent the parent * @param contentHandler the content handler */ public CustomInformationControl(Shell parent, ICustomInformationControlContentHandler contentHandler) { mContentHandler = contentHandler; mShell = new Shell(parent, SWT.NO_FOCUS | SWT.ON_TOP); mShell.setLayout(new FillLayout()); Display display = mShell.getDisplay(); mShell.setBackground(display.getSystemColor(SWT.COLOR_BLACK)); }
Example 13
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 14
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 15
Source File: InfoPopup.java From SWET with MIT License | 4 votes |
public InfoPopup(Composite parent, String textToBeDisplayed) { super(parent.getShell(), SWT.ON_TOP, true, false, false, false, false, null, null); content = textToBeDisplayed; }
Example 16
Source File: TextAssist.java From nebula with Eclipse Public License 2.0 | 4 votes |
/** * Constructs a new instance of this class given its parent and a style * value describing its behavior and appearance. * <p> * The style value is either one of the style constants defined in class * <code>SWT</code> which is applicable to instances of this class, or must * be built by <em>bitwise OR</em>'ing together (that is, using the * <code>int</code> "|" operator) two or more of those <code>SWT</code> * style constants. The class description lists the style constants that are * applicable to the class. Style bits are also inherited from superclasses. * </p> * * @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 * @param contentProvider the content provider * * @exception IllegalArgumentException * <ul> * <li>ERROR_NULL_ARGUMENT - if the parent is null</li> * </ul> * @exception SWTException * <ul> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the * thread that created the parent</li> * <li>ERROR_INVALID_SUBCLASS - if this class is not an * allowed subclass</li> * </ul> * * @see SWT#SINGLE * @see SWT#MULTI * @see SWT#READ_ONLY * @see SWT#WRAP * @see SWT#LEFT * @see SWT#RIGHT * @see SWT#CENTER * @see SWT#PASSWORD * @see SWT#SEARCH * @see SWT#ICON_SEARCH * @see SWT#ICON_CANCEL * @see Widget#checkSubclass * @see Widget#getStyle */ public TextAssist(final Composite parent, final int style, final TextAssistContentProvider contentProvider) { super(parent, SWT.NONE); this.contentProvider = contentProvider; this.contentProvider.setTextAssist(this); setLayout(new FillLayout()); numberOfLines = 10; text = new Text(this, style); popup = new Shell(getDisplay(), SWT.ON_TOP); popup.setLayout(new FillLayout()); table = new Table(popup, SWT.SINGLE); addTextListener(); addTableListener(); final int[] events = new int[] { SWT.Move, SWT.FocusOut }; for (final int event : events) { getShell().addListener(event, e -> { popup.setVisible(false); }); } }
Example 17
Source File: AnnotationExpansionControl.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
/** * Creates a new control. * * @param parent parent shell * @param shellStyle additional style flags * @param access the annotation access */ public AnnotationExpansionControl(Shell parent, int shellStyle, IAnnotationAccess access) { fPaintListener= new MyPaintListener(); fMouseTrackListener= new MyMouseTrackListener(); fMouseListener= new MyMouseListener(); fMenuDetectListener= new MyMenuDetectListener(); fDisposeListener= new MyDisposeListener(); fViewportListener= new IViewportListener() { public void viewportChanged(int verticalOffset) { dispose(); } }; fLayouter= new LinearLayouter(); if (access instanceof IAnnotationAccessExtension) fAnnotationAccessExtension= (IAnnotationAccessExtension) access; fShell= new Shell(parent, shellStyle | SWT.NO_FOCUS | SWT.ON_TOP); Display display= fShell.getDisplay(); fShell.setBackground(display.getSystemColor(SWT.COLOR_BLACK)); fComposite= new Composite(fShell, SWT.NO_FOCUS | SWT.NO_REDRAW_RESIZE | SWT.NO_TRIM); // fComposite= new Composite(fShell, SWT.NO_FOCUS | SWT.NO_REDRAW_RESIZE | SWT.NO_TRIM | SWT.V_SCROLL); GridLayout layout= new GridLayout(1, true); layout.marginHeight= 0; layout.marginWidth= 0; fShell.setLayout(layout); GridData data= new GridData(GridData.FILL_BOTH); data.heightHint= fLayouter.getAnnotationSize() + 2 * fLayouter.getBorderWidth() + 4; fComposite.setLayoutData(data); fComposite.addMouseTrackListener(new MouseTrackAdapter() { @Override public void mouseExit(MouseEvent e) { if (fComposite == null) return; Control[] children= fComposite.getChildren(); Rectangle bounds= null; for (int i= 0; i < children.length; i++) { if (bounds == null) bounds= children[i].getBounds(); else bounds.add(children[i].getBounds()); if (bounds.contains(e.x, e.y)) return; } // if none of the children contains the event, we leave the popup dispose(); } }); // fComposite.getVerticalBar().addListener(SWT.Selection, new Listener() { // // public void handleEvent(Event event) { // Rectangle bounds= fShell.getBounds(); // int x= bounds.x - fLayouter.getAnnotationSize() - fLayouter.getBorderWidth(); // int y= bounds.y; // fShell.setBounds(x, y, bounds.width, bounds.height); // } // // }); Cursor handCursor= getHandCursor(display); fShell.setCursor(handCursor); fComposite.setCursor(handCursor); setInfoSystemColor(); }
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: CustomAbstractInformationControl.java From APICloud-Studio with GNU General Public License v3.0 | 2 votes |
/** * Creates an abstract information control with the given shell as parent. * <p> * <em>Important: Subclasses are required to call {@link #create()} at the end of their constructor.</em> * </p> * * @param parentShell * the parent of this control's shell * @param isResizable * <code>true</code> if the control should be resizable */ public CustomAbstractInformationControl(Shell parentShell, boolean isResizable) { this(parentShell, SWT.TOOL | SWT.ON_TOP | (isResizable ? SWT.RESIZE : 0), null, null); }
Example 20
Source File: CustomAbstractInformationControl.java From APICloud-Studio with GNU General Public License v3.0 | 2 votes |
/** * Creates an abstract information control with the given shell as parent. The control will not be resizable and * optionally show a status line with the given status field text. * <p> * <em>Important: Subclasses are required to call {@link #create()} at the end of their constructor.</em> * </p> * * @param parentShell * the parent of this control's shell * @param statusFieldText * the text to be used in the status field or <code>null</code> to hide the status field */ public CustomAbstractInformationControl(Shell parentShell, String statusFieldText) { this(parentShell, SWT.TOOL | SWT.ON_TOP, statusFieldText, null); }