Java 类org.eclipse.swt.widgets.TrayItem 实例源码

项目:logbook    文件:ApplicationMain.java   
/**
 * Open the window.
 */
public void open() {
    try {
        Display display = Display.getDefault();
        this.createContents();
        this.shell.open();
        this.shell.layout();
        while (!this.shell.isDisposed()) {
            if (!display.readAndDispatch()) {
                display.sleep();
            }
        }
    } finally {
        Tray tray = Display.getDefault().getSystemTray();
        if (tray != null) {
            for (TrayItem item : tray.getItems()) {
                item.dispose();
            }
        }
    }
}
项目:dazzl    文件:SystemTray.java   
private void addTrayItem() {
    Display display;
    Tray tray;
    Shell shell;

    display = Main.getDisplay();
    tray = display.getSystemTray();
    shell = Main.getShell();

    if (tray != null) {
        trayItem = new TrayItem(tray, SWT.NONE);
        trayItem.setToolTipText("Dazzl");  //$NON-NLS-1$
        trayItem.setImage(admIcon); //$NON-NLS-1$
        trayItem.addListener(SWT.MenuDetect, new Listener() {
            public void handleEvent(Event event) {
                if (menu != null) {
                    menu.setVisible(true);
                }
            }
        });
    } else {
        CommonDialogs.showError(Messages
                .getString("SystemTray.error.no_system_tray"), null);
    }
}
项目:DroidNavi    文件:TrayIcon.java   
public TrayIcon(Display display, MainWindow window) {
    if(display == null) { throw new NullPointerException("Display cannot be null."); }
    if(window == null) { throw new NullPointerException("Main window cannot be null."); }

    m_mainDisplay = display;
    m_mainWindow = window;

    // Create tray item
    Tray tray = display.getSystemTray();

    m_item = new TrayItem(tray, SWT.NONE);
    m_item.setText("Droid Navi");

    // Set Image
    m_logo = AppLogo.getLogo(AppLogo.LogoType.TRAY_ICON, display);
    m_item.setImage(m_logo);

    init(m_item);
}
项目:logbookpn    文件:ApplicationMain.java   
/**
 * Open the window.
 */
public void open() {
    try {
        Display display = Display.getDefault();
        this.createContents();
        this.shell.open();
        this.shell.layout();
        while (!this.shell.isDisposed()) {
            if (!display.readAndDispatch()) {
                display.sleep();
            }
        }
    } finally {
        Tray tray = Display.getDefault().getSystemTray();
        if (tray != null) {
            for (TrayItem item : tray.getItems()) {
                item.dispose();
            }
        }
    }
}
项目:logbook-EN    文件:ApplicationMain.java   
/**
 * Open the window.
 */
public void open() {
    try {
        Display display = Display.getDefault();
        this.createContents();
        this.shell.open();
        this.shell.layout();
        while (!this.shell.isDisposed()) {
            if (!display.readAndDispatch()) {
                display.sleep();
            }
        }
    } finally {
        Tray tray = Display.getDefault().getSystemTray();
        if (tray != null) {
            for (TrayItem item : tray.getItems()) {
                item.dispose();
            }
        }
    }
}
项目:Mailster    文件:MailsterSWTTrayItem.java   
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));
        }
    });
}
项目:TuxGuitar-1.3.1-fork    文件:TGTray.java   
public void removeTray(){
    if (this.tray != null) {
        setVisible(true);
        TrayItem items[] = this.tray.getItems();
        for(int i = 0; i < items.length; i ++){
            items[i].dispose();
        }
        this.menu.dispose();
    }
}
项目:logbook    文件:ApplicationMain.java   
/**
 * トレイアイコンを追加します
 *
 * @param display
 * @return
 */
private TrayItem addTrayItem(final Display display) {
    // トレイアイコンを追加します
    Tray tray = display.getSystemTray();
    TrayItem item = new TrayItem(tray, SWT.NONE);
    Image image = display.getSystemImage(SWT.ICON_INFORMATION);
    item.setImage(image);
    item.setToolTipText(AppConstants.NAME + AppConstants.VERSION);
    item.addListener(SWT.Selection, new TraySelectionListener(this.shell));
    item.addMenuDetectListener(new TrayItemMenuListener(this.getShell()));
    return item;
}
项目:logbookpn    文件:ApplicationMain.java   
/**
 * トレイアイコンを追加します
 * 
 * @param display
 * @return
 */
private TrayItem addTrayItem(final Display display) {
    // トレイアイコンを追加します
    Tray tray = display.getSystemTray();
    TrayItem item = new TrayItem(tray, SWT.NONE);
    Image image = display.getSystemImage(SWT.ICON_INFORMATION);
    item.setImage(image);
    item.setToolTipText(AppConstants.NAME + AppConstants.VERSION);
    item.addListener(SWT.Selection, new TraySelectionListener(this.shell));
    item.addMenuDetectListener(new TrayItemMenuListener(this.getShell()));
    return item;
}
项目:logbook-EN    文件:ApplicationMain.java   
/**
 * トレイアイコンを追加します
 * 
 * @param display
 * @return
 */
private TrayItem addTrayItem(final Display display) {
    // トレイアイコンを追加します
    Tray tray = display.getSystemTray();
    TrayItem item = new TrayItem(tray, SWT.NONE);
    Image image = display.getSystemImage(SWT.ICON_INFORMATION);
    item.setImage(image);
    item.setToolTipText(AppConstants.NAME + " " + AppConstants.VERSION);
    item.addListener(SWT.Selection, new TraySelectionListener(this.shell));
    item.addMenuDetectListener(new TrayItemMenuListener(this.getShell()));
    return item;
}
项目:totallicks-tuxguitar    文件:TGTray.java   
public void removeTray(){
    if (this.tray != null) {
        setVisible(true);
        TrayItem items[] = this.tray.getItems();
        for(int i = 0; i < items.length; i ++){
            items[i].dispose();
        }
        this.icon.dispose();
        this.menu.dispose();
    }
}
项目:TeamSubb    文件:GadgetWindow.java   
@Override
public void performInitializations() {
    controller = new GadgetController(this);

    imageContainer = new Label(getShell(), SWT.NO_TRIM);

    tray = new TrayItem(Display.getDefault().getSystemTray(), SWT.NONE);

    trayMenu = new Menu(this.getShell(), SWT.POP_UP);

    openJobs = new MenuItem(trayMenu, SWT.PUSH);
    openChat = new MenuItem(trayMenu, SWT.PUSH);
    openSettings = new MenuItem(trayMenu, SWT.PUSH);
    exitApp = new MenuItem(trayMenu, SWT.PUSH);
}
项目:fullsync    文件:SystemTrayItem.java   
public void show() {
    ImageRepository imageRepository = imageRepositoryProvider.get();
    trayItem = new TrayItem(shell.getDisplay().getSystemTray(), SWT.NULL);

    imageList = new Image[2];
    imageList[0] = imageRepository.getImage("fullsync48.png"); //$NON-NLS-1$
    imageList[1] = imageRepository.getImage("fullsync48_r.png"); //$NON-NLS-1$
    imageActive = 0;

    // initialize trayItem
    trayItem.setImage(imageList[0]);
    trayItem.setToolTipText("FullSync"); //$NON-NLS-1$
    trayItem.addListener(SWT.Selection, e -> mainWindowProvider.get().setVisible(true));
    trayItem.addListener(SWT.DefaultSelection, e -> mainWindowProvider.get().setVisible(true));
    trayItem.addListener(SWT.MenuDetect, e -> menu.setVisible(true));

    // initialize popup menu
    menu = new Menu(shell, SWT.POP_UP);
    MenuItem item;
    item = new MenuItem(menu, SWT.NULL);
    item.setImage(imageRepository.getImage("fullsync16.png"));
    item.setText(Messages.getString("SystemTrayItem.OpenFullSync")); //$NON-NLS-1$
    item.addListener(SWT.Selection, e -> mainWindowProvider.get().setVisible(true));

    item = new MenuItem(menu, SWT.NULL);
    item.setText(Messages.getString("SystemTrayItem.Exit")); //$NON-NLS-1$
    item.addListener(SWT.Selection, e -> guiControllerProvider.get().closeGui());

    taskGeneratorProvider.get().addTaskGenerationListener(this);
}
项目:srimporter    文件:Overview.java   
private TrayItem initTaskItem(Shell shell) {
    final Tray tray = shell.getDisplay().getSystemTray();
    TrayItem trayItem = new TrayItem(tray, SWT.NONE);
    trayImage = AbstractUIPlugin.imageDescriptorFromPlugin(
            "com.dmagik.sheetrackimporter", "/icons/alt_window_16.gif")
            .createImage();
    trayItem.setImage(trayImage);
    trayItem.setToolTipText("Double-click to maximize SheetRack Importer");
    return trayItem;

}
项目:RxSWT    文件:SelectionAdapter.java   
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.");
}
项目:BiglyBT    文件:TrayItemSWT.java   
public TrayItemSWT(TrayDelegate tray, int style) {
    item = new TrayItem(((TraySWT) tray).getSWT(), style);
}
项目:TuxGuitar-1.3.1-fork    文件:TGTrayIcon.java   
public void setItem(TrayItem item){
    this.item = item;
}
项目:EarthquakeBulletin    文件:EnhancedTrayRestoreListener.java   
public EnhancedTrayRestoreListener(final Shell shell, final TrayItem trayItem) {
    super(shell, trayItem);
}
项目:EarthquakeBulletin    文件:TrayIcon.java   
public TrayItem getTrayItem() {
    return trayItem;
}
项目:logbook    文件:ApplicationMain.java   
/**
 * @return トレイアイコン
 */
public TrayItem getTrayItem() {
    return this.trayItem;
}
项目:RouterLogger    文件:TrayIcon.java   
public TrayItem getTrayItem() {
    return trayItem;
}
项目:JFaceUtils    文件:TrayRestoreListener.java   
/** Create a listener that restores the shell and hides the tray icon. */
public TrayRestoreListener(final Shell shell, @Nullable final TrayItem trayItem) {
    this.shell = shell;
    this.trayItem = trayItem;
}
项目:JFaceUtils    文件:TrayRestoreListener.java   
@Nullable
protected TrayItem getTrayItem() {
    return trayItem;
}
项目:DroidNavi    文件:TrayIcon.java   
private void init(TrayItem item) {
    initContextMenu();
    initListeners();
}
项目:logbookpn    文件:ApplicationMain.java   
/**
 * @return トレイアイコン
 */
public TrayItem getTrayItem() {
    return this.trayItem;
}
项目:logbook-EN    文件:ApplicationMain.java   
/**
 * @return トレイアイコン
 */
public TrayItem getTrayItem() {
    return this.trayItem;
}
项目:Mailster    文件:MailsterSWTTrayItem.java   
public MailsterSWTTrayItem()
{
    trayItem = new TrayItem(tray, SWT.NONE);
    createSystemTray();
}
项目:Mailster    文件:MailsterSWTTrayItem.java   
public TrayItem getTrayItem()
{
    return trayItem;
}
项目:totallicks-tuxguitar    文件:TGTrayIcon.java   
public void setItem(TrayItem item){
    this.item = item;
}