List of usage examples for org.eclipse.jface.window DefaultToolTip setText
public void setText(String text)
From source file:com.amitinside.mqtt.client.kura.util.FormUtil.java
License:Apache License
public static void setTootipConnectionStatus(final UISynchronize uiSynchronize, final Control control, final String host, final boolean connected) { final DefaultToolTip toolTip = new DefaultToolTip(control); toolTip.setShift(new Point(5, 5)); uiSynchronize.asyncExec(new Runnable() { @Override//from w w w.ja v a2 s . c o m public void run() { if (connected) { toolTip.setText("Connected to " + host); } else { toolTip.setText("Disconnected"); } } }); }
From source file:com.aptana.git.ui.internal.actions.DeleteBranchHandler.java
License:Open Source License
private static void showSuccessToast(final String branchName) { Job job = new UIJob("show toast") //$NON-NLS-1$ {/* ww w.j a v a 2 s . c o m*/ @Override public IStatus runInUIThread(IProgressMonitor monitor) { final Shell shell = UIUtils.getActiveShell(); String text = MessageFormat.format(Messages.DeleteBranchAction_BranchDelete_Msg, branchName); DefaultToolTip toolTip = new DefaultToolTip(shell) { @Override public Point getLocation(Point size, Event event) { final Rectangle workbenchWindowBounds = shell.getBounds(); int xCoord = workbenchWindowBounds.x + workbenchWindowBounds.width - size.x - 10; int yCoord = workbenchWindowBounds.y + workbenchWindowBounds.height - size.y - 10; return new Point(xCoord, yCoord); } }; toolTip.setHideDelay(UIUtils.DEFAULT_TOOLTIP_TIME); toolTip.setText(text); toolTip.show(new Point(0, 0)); return Status.OK_STATUS; } }; EclipseUtil.setSystemForJob(job); job.setPriority(Job.INTERACTIVE); job.schedule(); }
From source file:com.aptana.git.ui.internal.actions.DeleteRemoteHandler.java
License:Open Source License
private static void showSuccessToast(final String remoteName) { Job job = new UIJob("show toast") //$NON-NLS-1$ {//from www. j a va 2s. co m @Override public IStatus runInUIThread(IProgressMonitor monitor) { final Shell shell = UIUtils.getActiveShell(); String text = MessageFormat.format(Messages.DeleteRemoteAction_RemoteDeleted_Msg, remoteName); DefaultToolTip toolTip = new DefaultToolTip(shell) { @Override public Point getLocation(Point size, Event event) { final Rectangle workbenchWindowBounds = shell.getBounds(); int xCoord = workbenchWindowBounds.x + workbenchWindowBounds.width - size.x - 10; int yCoord = workbenchWindowBounds.y + workbenchWindowBounds.height - size.y - 10; return new Point(xCoord, yCoord); } }; toolTip.setHideDelay(UIUtils.DEFAULT_TOOLTIP_TIME); toolTip.setText(text); toolTip.show(new Point(0, 0)); return Status.OK_STATUS; } }; EclipseUtil.setSystemForJob(job); job.setPriority(Job.INTERACTIVE); job.schedule(); }
From source file:com.aptana.git.ui.internal.actions.SwitchBranchHandler.java
License:Open Source License
public static void switchBranch(final GitRepository repo, final String branchName) { String text = MessageFormat.format(Messages.SwitchBranchAction_BranchSwitch_Msg, branchName); IStatus switchStatus = repo.switchBranch(branchName, new NullProgressMonitor()); if (!switchStatus.isOK()) { // If we couldn't switch, surface up the output if (switchStatus instanceof ProcessStatus) { text = ((ProcessStatus) switchStatus).getStdErr(); } else {//from w w w.ja v a 2 s . com text = switchStatus.getMessage(); } } // Now show a tooltip "toast" for 3 seconds to announce success final Shell shell = UIUtils.getActiveShell(); DefaultToolTip toolTip = new DefaultToolTip(shell) { @Override public Point getLocation(Point size, Event event) { final Rectangle workbenchWindowBounds = shell.getBounds(); int xCoord = workbenchWindowBounds.x + workbenchWindowBounds.width - size.x - 10; int yCoord = workbenchWindowBounds.y + workbenchWindowBounds.height - size.y - 10; return new Point(xCoord, yCoord); } }; toolTip.setHideDelay(UIUtils.DEFAULT_TOOLTIP_TIME); toolTip.setText(text); toolTip.show(new Point(0, 0)); }
From source file:org.dawnsci.slicing.component.Hinter.java
License:Open Source License
public static void showHint(CellEditor cellEd, final String hint) { if (!Activator.getDefault().getPreferenceStore().getBoolean(SliceConstants.SHOW_HINTS)) return;//from ww w . ja va 2 s.c om final Control control = cellEd.getControl(); control.getDisplay().asyncExec(new Runnable() { public void run() { final DefaultToolTip tooltip = new DefaultToolTip(control, ToolTip.NO_RECREATE, true); tooltip.setText(hint); tooltip.setHideOnMouseDown(true); tooltip.setHideDelay(20000); tooltip.setRespectDisplayBounds(true); Listener listener = new Listener() { @Override public void handleEvent(Event event) { if (!control.isDisposed()) { tooltip.hide(); } control.removeListener(SWT.FocusOut, this); control.removeListener(SWT.Dispose, this); } }; control.addListener(SWT.Dispose, listener); control.addListener(SWT.FocusOut, listener); final GC gc = new GC(control); final Point size = gc.textExtent(hint); tooltip.show(new Point(-size.x - 15, 0)); } }); }
From source file:org.eclipse.epp.internal.logging.aeri.ui.ConfigurationDialog.java
License:Open Source License
private void calibrateTooltip(DefaultToolTip toolTip, String toolTipText) { toolTip.setText(toolTipText); toolTip.setFont(JFaceResources.getDialogFont()); toolTip.setShift(TOOLTIP_DISPLACEMENT); toolTip.setHideDelay(TOOLTIP_MS_HIDE_DELAY); }
From source file:org.eclipse.jface.snippets.window.Snippet020CustomizedControlTooltips.java
License:Open Source License
public Snippet020CustomizedControlTooltips(final Shell parent) { JFaceResources.getColorRegistry().put(MyToolTip.HEADER_BG_COLOR, new RGB(255, 255, 255)); JFaceResources.getFontRegistry().put(MyToolTip.HEADER_FONT, JFaceResources.getFontRegistry() .getBold(JFaceResources.getDefaultFont().getFontData()[0].getName()).getFontData()); JFaceResources.getImageRegistry().put(MyToolTip.HEADER_CLOSE_ICON, ImageDescriptor.createFromFile(Snippet020CustomizedControlTooltips.class, "showerr_tsk.gif")); JFaceResources.getImageRegistry().put(MyToolTip.HEADER_HELP_ICON, ImageDescriptor.createFromFile(Snippet020CustomizedControlTooltips.class, "linkto_help.gif")); Text text = new Text(parent, SWT.BORDER); text.setText("Hello World"); MyToolTip myTooltipLabel = new MyToolTip(text) { @Override/*from ww w . java 2s . c om*/ protected Composite createContentArea(Composite parent) { Composite comp = super.createContentArea(parent); comp.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND)); FillLayout layout = new FillLayout(); layout.marginWidth = 5; comp.setLayout(layout); Link l = new Link(comp, SWT.NONE); l.setText( "This a custom tooltip you can: \n- pop up any control you want\n- define delays\n - ... \nGo and get Eclipse from <a>http://www.eclipse.org</a>"); l.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND)); l.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { openURL(); } }); return comp; } protected void openURL() { MessageBox box = new MessageBox(parent, SWT.ICON_INFORMATION); box.setText("Eclipse.org"); box.setMessage("Here is where we'd open the URL."); box.open(); } @Override protected void openHelp() { MessageBox box = new MessageBox(parent, SWT.ICON_INFORMATION); box.setText("Info"); box.setMessage("Here is where we'd show some information."); box.open(); } }; myTooltipLabel.setShift(new Point(-5, -5)); myTooltipLabel.setHideOnMouseDown(false); myTooltipLabel.activate(); text = new Text(parent, SWT.BORDER); text.setText("Hello World"); DefaultToolTip toolTip = new DefaultToolTip(text); toolTip.setText("Hello World\nHello World"); toolTip.setBackgroundColor(parent.getDisplay().getSystemColor(SWT.COLOR_RED)); Button b = new Button(parent, SWT.PUSH); b.setText("Popup on press"); final DefaultToolTip toolTipDelayed = new DefaultToolTip(b, ToolTip.RECREATE, true); toolTipDelayed.setText("Hello World\nHello World"); toolTipDelayed.setBackgroundColor(parent.getDisplay().getSystemColor(SWT.COLOR_RED)); toolTipDelayed.setHideDelay(2000); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { toolTipDelayed.show(new Point(0, 0)); } }); }
From source file:org.eclipse.jface.snippets.window.Snippet031TableStaticTooltip.java
License:Open Source License
private void createToolTipFor(final TableViewer viewer) { DefaultToolTip toolTip = new DefaultToolTip(viewer.getControl(), ToolTip.NO_RECREATE, false); toolTip.setText("Hello World\nHello World"); toolTip.setBackgroundColor(viewer.getTable().getDisplay().getSystemColor(SWT.COLOR_RED)); toolTip.setShift(new Point(10, 5)); }
From source file:org.eclipse.nebula.widgets.geomap.jface.GeoMapViewer.java
License:Open Source License
private void handleToolTip(int x, int y) { if (getLabelProvider() instanceof IToolTipProvider) { // DefaultToolTip toolTip = (DefaultToolTip) getToolTip(); Object element = getElementAt(x, y, thumbSize); Object toolTip = ((IToolTipProvider) getLabelProvider()).getToolTip(element); if (toolTip instanceof String) { if (getToolTip() instanceof DefaultToolTip) { DefaultToolTip defaultToolTip = (DefaultToolTip) getToolTip(); defaultToolTip.setText((String) toolTip); toolTip = defaultToolTip; }/*from ww w . j a v a 2s . c o m*/ } if (lastToolTip != toolTip) { if (lastToolTip != null) { lastToolTip.deactivate(); } lastToolTip = (ToolTip) toolTip; if (lastToolTip != null) { lastToolTip.activate(); } } } }
From source file:org.jboss.tools.openshift.internal.ui.webhooks.WebHooksComponent.java
License:Open Source License
private void notifyCopied(final Text uriText) { DefaultToolTip copiedNotification = new DefaultToolTip(uriText, ToolTip.NO_RECREATE, true); copiedNotification.setText("Webhook copied to clipboard"); copiedNotification.setHideDelay(COPIED_NOTIFICATION_SHOW_DURATION); copiedNotification.show(uriText.getLocation()); copiedNotification.deactivate();//w w w . ja v a 2s . co m }