public static ToolTip createAndShowBalloonToolTip(Shell shell, int iconStyle, String message, String title, int pos, boolean autohide) { int posX = shell.getLocation().x; int posY = shell.getLocation().y; if (pos == 1) { posX += shell.getSize().x; } else if (pos == 2) { posX += shell.getSize().x; posY += shell.getSize().y; } else { posY += shell.getSize().y; } ToolTip tt = createBallonToolTip(shell, iconStyle, message, title, posX, posY); tt.setAutoHide(autohide); tt.setVisible(true); return tt; }
public StringTypeEditor(IStringifier<Object> stringifier, Composite parent, Object value, boolean editable) { super(Object.class); this.stringifier = stringifier; super.setObject(value); this.text = createText(parent, value, editable); addTextListeners(); tip = new ToolTip(text.getShell(), SWT.BALLOON | SWT.ICON_ERROR); // For some reason, applying a color at creation, does not get it to update correctly // so simply do it next in the queue. parent.getDisplay().asyncExec(new Runnable() { public void run() { updateValidityColor(false); // make sure the color is set right in the case where you ALLOW errors. } }); }
@Override public boolean canConnectToSource(INode oldSource, INode newSource, INode target, EConnectionType lineStyle, String connectorName, String connectionName) { if (oldSource != null && newSource != null && (T_REST_REQUEST.equals(newSource.getComponent().getName()) || T_REST_REQUEST .equals(oldSource.getComponent().getName()))) { ToolTip tooltip = new ToolTip(PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getShell(), SWT.ICON_WARNING); tooltip.setText(Messages.RESTRequestReconnectionValidation_WarningMsg); // tooltip.setMessage("It's not allowed to reconnect to or from a tRESTRequest component"); tooltip.setAutoHide(true); tooltip.setVisible(true); return false; } return true; }
public static void showTrayItemTooltipMessage(final TrayItem trayItem, final String title, final String message) { final Shell sShell = MailsterSWT.getInstance().getShell(); Display.getDefault().asyncExec(new Thread() { public void run() { final ToolTip tip = new ToolTip(sShell, SWT.BALLOON | SWT.ICON_INFORMATION); tip.setMessage(message); tip.setText(title); if (Display.getDefault().getSystemTray() != null) trayItem.setToolTip(tip); else tip.setLocation(sShell.getLocation()); tip.setVisible(true); tip.setAutoHide(ConfigurationManager.CONFIG_STORE.getBoolean(ConfigurationManager.AUTO_HIDE_NOTIFICATIONS_KEY)); } }); }
private IAction createRegionActions() { final String regionViewName = PlotUtil.getRegionViewName(); final ToolTip tip = new ToolTip(viewer.getTable().getShell(), SWT.BALLOON); MenuAction rois = new MenuAction("Add Region"); ActionContributionItem menu = (ActionContributionItem)system.getActionBars().getMenuManager().find(BasePlottingConstants.ADD_REGION); IAction menuAction = (IAction)menu.getAction(); for (RegionType regionType : regionTypes) { IAction action = new Action("Press to click and drag a "+regionType.getName()+" on '"+PlotUtil.getRegionViewName()+"'") { @Override public void run() { try { ScanRegions.createRegion(system, regionType, null); ViewUtil.showTip(tip, "Click and drag in the '"+regionViewName+"' to create a scan region."); } catch (Exception e) { logger.error("Unable to create region!", e); } rois.setSelectedAction(this); } }; final ImageDescriptor des = findImageDescriptor(menuAction, regionType.getId()); action.setImageDescriptor(des); rois.add(action); } rois.setSelectedAction(rois.getAction(0)); return rois; }
protected void createBoundingBox() throws GeneratorException { this.value = ScanRegions.createBoxFromPlot(); if (value!=null) { setValueValid(true); fireApplyEditorValue(); } else { try { ScanRegions.createRegion(PlotUtil.getRegionSystem(), RegionType.BOX, null); ViewUtil.showTip(new ToolTip(defaultLabel.getShell(), SWT.BALLOON), "Drag a box in the '"+PlotUtil.getRegionSystem().getPlotName()+"' to create a scan region."); } catch (Exception e) { logger.error("Unable to create region!", e); } } }
/** * Show the top where the mouse is. * @param tip * @param message */ public static void showTip(ToolTip tip, String message) { if (tip==null) return; tip.setMessage(message); PointerInfo a = MouseInfo.getPointerInfo(); java.awt.Point loc = a.getLocation(); tip.setLocation(loc.x, loc.y+20); tip.setVisible(true); }
public static ToolTip createBallonToolTip(Shell shell, int iconStyle, String message, String title, int posX, int posY) { final ToolTip tip = new ToolTip(shell, SWT.BALLOON | iconStyle); tip.setMessage(message); tip.setText(title); if (posX < 0 || posY < 0) tip.setLocation(shell.getLocation().x+shell.getSize().x, shell.getLocation().y+shell.getSize().y); else tip.setLocation(posX, posY); return tip; }
public static ToolTip createAndShowBalloonToolTip(Shell shell, int iconStyle, String message, String title, int posX, int posY, boolean autohide) { ToolTip tt = createBallonToolTip(shell, iconStyle, message, title, posX, posY); tt.setAutoHide(autohide); tt.setVisible(true); return tt; }
public void show(String title, String message) { ToolTip tooltip = new ToolTip(shell.getShell(), SWT.BALLOON | SWT.ICON_INFORMATION); tooltip.setText(title); tooltip.setMessage(message); shell.getTrayItem().setToolTip(tooltip); tooltip.setVisible(true); tooltip.setAutoHide(true); }
@Override public void run() { // 現在時刻 Date now = Calendar.getInstance().getTime(); List<String> notice = new ArrayList<String>(); boolean visibleHome = false; // 遠征を更新する if (this.updateDeck(now, notice)) { PlayerThread.randomExpeditionSoundPlay(); visibleHome |= AppConfig.get().isVisibleOnReturnMission(); } // 入渠を更新する if (this.updateNdock(now, notice)) { PlayerThread.randomDockSoundPlay(); visibleHome |= AppConfig.get().isVisibleOnReturnBathwater(); } if (visibleHome) { this.main.getTabFolder().setSelection(0); } if (AppConfig.get().isUseBalloon()) { // バルーンツールチップを表示する try { // 遠征・入渠のお知らせ if (notice.size() > 0) { ToolTip tip = new ToolTip(this.main.getShell(), SWT.BALLOON | SWT.ICON_INFORMATION); tip.setText("遠征・入渠"); tip.setMessage(StringUtils.join(notice, "\r\n")); this.main.getTrayItem().setToolTip(tip); tip.setVisible(true); } } catch (Exception e) { LoggerHolder.LOG.warn("お知らせの表示に失敗しました", e); } } }
/** * 艦隊が出撃中で大破した場合に警告を行います */ private void postFatal() { if (this.badlyDamage && GlobalContext.isSortie(this.dock.getId())) { if (AppConfig.get().isBalloonBybadlyDamage()) { List<ShipDto> ships = this.dock.getShips(); StringBuilder sb = new StringBuilder(); sb.append(AppConstants.MESSAGE_STOP_SORTIE); sb.append("\n"); for (ShipDto shipDto : ships) { if (shipDto.isBadlyDamage()) { sb.append(shipDto.getName()); sb.append("(" + shipDto.getLv() + ")"); sb.append(" : "); List<ItemDto> items = shipDto.getItem(); List<String> names = new ArrayList<String>(); for (ItemDto itemDto : items) { if (itemDto != null) { names.add(itemDto.getName()); } } sb.append(StringUtils.join(names, ",")); sb.append("\n"); } } ToolTip tip = new ToolTip(this.getShell(), SWT.BALLOON | SWT.ICON_ERROR); tip.setText("大破警告"); tip.setMessage(sb.toString()); this.main.getTrayItem().setToolTip(tip); tip.setVisible(true); } // 大破時にサウンドを再生する PlayerThread.randomBadlySoundPlay(); } }
private static void showToolTipSWTwidget(Control control, int style, String title, String message) { ToolTip tooltip = new ToolTip(control.getShell(), /*SWT.BALLOON | */ style); tooltip.setAutoHide(true); tooltip.setLocation(control.toDisplay(control.getSize().x/2, control.getSize().y + 5)); tooltip.setText(title); tooltip.setMessage(message); tooltip.setVisible(true); }
private static void showToolTipSWTJface(Control control, int style, String title, String message) { DefaultToolTip tooltip = new DefaultToolTip(control, org.eclipse.jface.window.ToolTip.NO_RECREATE, true); tooltip.setHideDelay(TOOLTIP_HIDE_DELAY); tooltip.setText("[" + title+ "]\n\n" + message); tooltip.setImage(control.getDisplay().getSystemImage(/*SWT.ICON_INFORMATION*/ style)); tooltip.show(control.toDisplay(control.getSize().x/2, 5)); }
public GridMouseHandler(final Grid<T> grid, final GC gc, final Collection<IGridListener<T>> listeners, final ToolTip toolTip) { this.grid = grid; this.gridModel = grid.getGridModel(); this.viewport = grid.getViewport(); this.listeners = listeners; this.toolTip = toolTip; this.gc = gc; }
public Grid(final Composite parent) { super(parent, SWT.V_SCROLL | SWT.H_SCROLL | SWT.DOUBLE_BUFFERED /*| SWT.NO_BACKGROUND | SWT.NO_REDRAW_RESIZE*/); resourceManager = new ResourceManager(parent.getDisplay()); gc = new GC(this); computedArea = new Point(-1, -1); gridModel = new GridModel<T>(this, resourceManager, gc); modelListener = new GridModelListener(); gridModel.addListener(modelListener); viewport = new Viewport<T>(this); gridRenderer = new GridRenderer<T>(this); disposeListener = new GridDisposeListener(); resizeListener = new ResizeListener(); scrollListener = new ScrollListener(); focusListener = new GridFocusListener(); listeners = new ArrayList<>(); toolTip = new ToolTip(parent.getShell(), SWT.NONE); toolTip.setAutoHide(true); keyboardHandler = createKeyboardHandler(gc); mouseHandler = createMouseHandler(gc, listeners, toolTip); parent.addDisposeListener(disposeListener); setKeyboardHandler(keyboardHandler); setMouseHandler(mouseHandler); addPaintListener(gridRenderer); addListener(SWT.Resize, resizeListener); addFocusListener(focusListener); getVerticalBar().addSelectionListener(scrollListener); getHorizontalBar().addSelectionListener(scrollListener); }
private void showMessage(final int style, final String title, final String message) { if (trayItem != null && !trayItem.isDisposed()) { final ToolTip currentTip = trayItem.getToolTip(); if (currentTip != null && !currentTip.isDisposed()) { currentTip.dispose(); } final ToolTip tip = new ToolTip(shell, SWT.BALLOON | style); tip.setText(title); tip.setMessage(message); trayItem.setToolTip(tip); tip.setVisible(true); } }
public TextEditor(Text text, IStringifier stringifier) { super(Object.class); this.stringifier = stringifier; this.text = text; addListeners(); bubble = new ToolTip(text.getShell(), SWT.BALLOON | SWT.ICON_ERROR); }
public TextEditor(Composite parent, IStringifier stringifier, boolean editable) { super(Object.class); this.stringifier = stringifier; this.text = createText(parent, editable); addListeners(); if (text != null) bubble = new ToolTip(text.getShell(), SWT.BALLOON | SWT.ICON_ERROR); }
public StringTypeEditor(IStringifier<Object> stringifier, Text text) { super(Object.class); this.stringifier = stringifier; this.text = text; addTextListeners(); tip = new ToolTip(text.getShell(), SWT.BALLOON | SWT.ICON_INFORMATION); }
/** * 艦隊が出撃中で大破した場合に警告を行います */ private void postFatal() { if (this.badlyDamage && GlobalContext.isSortie(this.dock.getId())) { if (AppConfig.get().isBalloonBybadlyDamage()) { List<ShipDto> ships = this.dock.getShips(); StringBuilder sb = new StringBuilder(); sb.append(AppConstants.MESSAGE_STOP_SORTIE); sb.append("\n"); for (ShipDto shipDto : ships) { if (shipDto.isBadlyDamage()) { sb.append(shipDto.getName()); sb.append("(" + shipDto.getLv() + ")"); sb.append(" : "); List<ItemDto> items = shipDto.getItem(); List<String> names = new ArrayList<String>(); for (ItemDto itemDto : items) { if (itemDto != null) { names.add(itemDto.getName()); } } sb.append(StringUtils.join(names, ",")); sb.append("\n"); } } ToolTip tip = new ToolTip(this.getShell(), SWT.BALLOON | SWT.ICON_ERROR); tip.setText("大破警告"); tip.setMessage(sb.toString()); this.main.getTrayItem().setToolTip(tip); tip.setVisible(true); } // 大破時にサウンドを再生する Sound.randomBadlySoundPlay(); } }
@Override public void run() { // 現在時刻 Date now = Calendar.getInstance().getTime(); List<String> notice = new ArrayList<String>(); boolean visibleHome = false; // 遠征を更新する if (this.updateDeck(now, notice)) { Sound.randomExpeditionSoundPlay(); visibleHome |= AppConfig.get().isVisibleOnReturnMission(); } // 入渠を更新する if (this.updateNdock(now, notice)) { Sound.randomDockSoundPlay(); visibleHome |= AppConfig.get().isVisibleOnReturnBathwater(); } if (visibleHome) { this.main.getTabFolder().setSelection(0); } if (AppConfig.get().isUseBalloon()) { // バルーンツールチップを表示する try { // 遠征・入渠のお知らせ if (notice.size() > 0) { ToolTip tip = new ToolTip(this.main.getShell(), SWT.BALLOON | SWT.ICON_INFORMATION); tip.setText("Notification"); tip.setMessage(StringUtils.join(notice, "\r\n")); this.main.getTrayItem().setToolTip(tip); tip.setVisible(true); } } catch (Exception e) { LOG.warn("Failed to display the notification", e); } } }
/** * 艦隊が出撃中で大破した場合に警告を行います */ private void postFatal() { if (this.badlyDamage && GlobalContext.isSortie(this.dock.getId())) { if (AppConfig.get().isBalloonBybadlyDamage()) { List<ShipDto> ships = this.dock.getShips(); StringBuilder sb = new StringBuilder(); sb.append(AppConstants.MESSAGE_STOP_SORTIE); sb.append("\n"); for (ShipDto shipDto : ships) { if (shipDto.isBadlyDamage()) { sb.append(shipDto.getName()); sb.append("(" + shipDto.getLv() + ")"); sb.append(" : "); List<ItemDto> items = shipDto.getItem(); List<String> names = new ArrayList<String>(); for (ItemDto itemDto : items) { if (itemDto != null) { names.add(itemDto.getName()); } } sb.append(StringUtils.join(names, ",")); sb.append("\n"); } } ToolTip tip = new ToolTip(this.getShell(), SWT.BALLOON | SWT.ICON_ERROR); tip.setText("Warning"); tip.setMessage(sb.toString()); this.main.getTrayItem().setToolTip(tip); tip.setVisible(true); } // 大破時にサウンドを再生する Sound.randomBadlySoundPlay(); } }
private void showTip(String message) { if (!store.getBoolean(DevicePreferenceConstants.SHOW_CONTROL_TOOLTIPS)) return; if (tip==null) this.tip = new ToolTip(seriesTable.getControl().getShell(), SWT.BALLOON); ViewUtil.showTip(tip, message); }
static SelectionAdapter create(Widget widget) { if (widget instanceof Button) { return create((Button) widget); } else if (widget instanceof CCombo) { return create((CCombo) widget); } else if (widget instanceof Combo) { return create((Combo) widget); } else if (widget instanceof CoolItem) { return create((CoolItem) widget); } else if (widget instanceof CTabFolder) { return create((CTabFolder) widget); } else if (widget instanceof DateTime) { return create((DateTime) widget); } else if (widget instanceof Link) { return create((Link) widget); } else if (widget instanceof List) { return create((List) widget); } else if (widget instanceof MenuItem) { return create((MenuItem) widget); } else if (widget instanceof Sash) { return create((Sash) widget); } else if (widget instanceof Scale) { return create((Scale) widget); } else if (widget instanceof Slider) { return create((Slider) widget); } else if (widget instanceof Spinner) { return create((Spinner) widget); } else if (widget instanceof StyledText) { return create((StyledText) widget); } else if (widget instanceof TabFolder) { return create((TabFolder) widget); } else if (widget instanceof Table) { return create((Table) widget); } else if (widget instanceof TableColumn) { return create((TableColumn) widget); } else if (widget instanceof TableCursor) { return create((TableCursor) widget); } else if (widget instanceof Text) { return create((Text) widget); } else if (widget instanceof ToolItem) { return create((ToolItem) widget); } else if (widget instanceof ToolTip) { return create((ToolTip) widget); } else if (widget instanceof TrayItem) { return create((TrayItem) widget); } else if (widget instanceof Tree) { return create((Tree) widget); } else if (widget instanceof TreeColumn) { return create((TreeColumn) widget); } else if (widget instanceof TreeCursor) { return create((TreeCursor) widget); } throw new IllegalArgumentException("The given widget (" + widget.getClass().getName() + ") is not supported."); }
public void showBalloonToolTip(final Earthquake earthquake) { if (trayItem != null && !trayItem.isDisposed()) { final StringBuilder text = new StringBuilder(); text.append("M ").append(earthquake.getMagnitude()).append(", ").append(earthquake.getRegion()); final StringBuilder message = new StringBuilder(); final DateFormat df = ResultsTable.dateFormat.get(); df.setTimeZone(TimeZone.getTimeZone(configuration.getString("timezone", EarthquakeBulletin.Defaults.TIME_ZONE_ID))); message.append(df.format(earthquake.getTime())).append(' '); message.append(earthquake.getLatitude()).append(' '); message.append(earthquake.getLongitude()).append(' '); message.append(earthquake.getDepth()).append(' '); message.append(earthquake.getStatus()); final ToolTip toolTip; if (earthquake.getMagnitude() >= configuration.getFloat("magnitude.xxl", ResultsTable.Defaults.MAGNITUDE_XXL)) { toolTip = toolTips.get(SWT.ICON_ERROR); } else if (earthquake.getMagnitude() >= configuration.getFloat("magnitude.big", ResultsTable.Defaults.MAGNITUDE_BIG)) { toolTip = toolTips.get(SWT.ICON_WARNING); } else { toolTip = toolTips.get(SWT.ICON_INFORMATION); } try { trayItem.getDisplay().syncExec(new Runnable() { @Override public void run() { logger.log(Level.FINE, "{0}", text); trayItem.setToolTip(toolTip); toolTip.setText(text.toString().trim()); toolTip.setMessage(message.toString().trim()); toolTip.setVisible(true); } }); } catch (final RuntimeException e) { logger.log(Level.WARNING, e.toString(), e); } } }
public ToolTip getToolTip() { return toolTip; }
protected GridMouseHandler<T> createMouseHandler(final GC gc, final Collection<IGridListener<T>> listeners, final ToolTip toolTip) { return new GridMouseHandler<T>(this, gc, listeners, toolTip); }
@Override public void run() { // 現在時刻 Date now = Calendar.getInstance().getTime(); List<String> noticeMission = new ArrayList<String>(); List<String> noticeNdock = new ArrayList<String>(); boolean visibleHome = false; // 遠征を更新する if (this.updateDeck(now, noticeMission)) { Sound.randomExpeditionSoundPlay(); visibleHome |= AppConfig.get().isVisibleOnReturnMission(); } // 入渠を更新する if (this.updateNdock(now, noticeNdock)) { Sound.randomDockSoundPlay(); visibleHome |= AppConfig.get().isVisibleOnReturnBathwater(); } if (visibleHome) { this.main.getTabFolder().setSelection(0); } if (AppConfig.get().isUseBalloon()) { // バルーンツールチップを表示する try { // 遠征・入渠のお知らせ List<String> notice = new ArrayList<String>(); notice.addAll(noticeMission); notice.addAll(noticeNdock); if (notice.size() > 0) { ToolTip tip = new ToolTip(this.main.getShell(), SWT.BALLOON | SWT.ICON_INFORMATION); tip.setText("遠征・入渠"); tip.setMessage(StringUtils.join(notice, "\r\n")); this.main.getTrayItem().setToolTip(tip); tip.setVisible(true); } } catch (Exception e) { LOG.warn("お知らせの表示に失敗しました", e); } } // Push通知 遠征 if ((noticeMission.size() > 0) && AppConfig.get().getPushMission()) { PushNotify.add(StringUtils.join(noticeMission, "\r\n"), "遠征", AppConfig.get().getPushPriorityMission()); } // Push通知 入渠 if ((noticeNdock.size() > 0) && AppConfig.get().getPushNdock()) { PushNotify.add(StringUtils.join(noticeNdock, "\r\n"), "入渠", AppConfig.get().getPushPriorityNdock()); } }