⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 applicationworkbenchwindowadvisor.java

📁 基于Eclipse RCP模型下的文档管理程序源代码
💻 JAVA
字号:
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   ApplicationWorkbenchWindowAdvisor.java

package fileexplorer;

import org.eclipse.jface.action.IStatusLineManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.events.ShellAdapter;
import org.eclipse.swt.events.ShellEvent;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.*;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.application.*;

// Referenced classes of package fileexplorer:
//            ApplicationActionBarAdvisor, Activator

public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor
{

    public ApplicationWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer)
    {
        super(configurer);
    }

    public ActionBarAdvisor createActionBarAdvisor(IActionBarConfigurer configurer)
    {
        return new ApplicationActionBarAdvisor(configurer);
    }

    public void preWindowOpen()
    {
        IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
        configurer.setInitialSize(new Point(700, 500));
        configurer.setShowCoolBar(true);
        configurer.setShowMenuBar(true);
        configurer.setShowStatusLine(true);
        configurer.setShowFastViewBars(true);
        configurer.setTitle("File Explorer");
        PlatformUI.getPreferenceStore().setDefault("SHOW_TRADITIONAL_STYLE_TABS", false);
    }

    public void postWindowCreate()
    {
        super.postWindowCreate();
        getWindowConfigurer().getWindow().getShell().setMaximized(true);
        IStatusLineManager statusline = getWindowConfigurer().getActionBarConfigurer().getStatusLineManager();
        org.eclipse.swt.graphics.Image image = Activator.getImageDescriptor("/icons/debug_exc(1).gif").createImage();
        statusline.setMessage(image, "\u7528\u6237\u5728\u7EBF");
        IWorkbenchWindow window = getWindowConfigurer().getWindow();
        trayItem = initTaskItem(window);
        if(trayItem != null)
        {
            hookPopupMenu(window);
            hookMinimize(window);
        }
    }

    private void hookMinimize(final IWorkbenchWindow window)
    {
        window.getShell().addShellListener(new ShellAdapter() {

            public void shellIconified(ShellEvent e)
            {
                window.getShell().setVisible(false);
            }

            final ApplicationWorkbenchWindowAdvisor this$0;
            private final IWorkbenchWindow val$window;

            
            {
                this$0 = ApplicationWorkbenchWindowAdvisor.this;
                window = iworkbenchwindow;
                super();
            }
        }
);
        trayItem.addListener(14, new Listener() {

            public void handleEvent(Event event)
            {
                Shell shell = window.getShell();
                if(!shell.isVisible())
                {
                    shell.setVisible(true);
                    window.getShell().setMinimized(false);
                }
            }

            final ApplicationWorkbenchWindowAdvisor this$0;
            private final IWorkbenchWindow val$window;

            
            {
                this$0 = ApplicationWorkbenchWindowAdvisor.this;
                window = iworkbenchwindow;
                super();
            }
        }
);
    }

    private void hookPopupMenu(final IWorkbenchWindow window)
    {
        trayItem.addListener(35, new Listener() {

            public void handleEvent(Event event)
            {
                MenuManager trayMenu = new MenuManager();
                Menu menu = trayMenu.createContextMenu(window.getShell());
                ApplicationActionBarAdvisor.fillTrayItem(trayMenu);
                menu.setVisible(true);
            }

            final ApplicationWorkbenchWindowAdvisor this$0;
            private final IWorkbenchWindow val$window;

            
            {
                this$0 = ApplicationWorkbenchWindowAdvisor.this;
                window = iworkbenchwindow;
                super();
            }
        }
);
    }

    private TrayItem initTaskItem(IWorkbenchWindow window)
    {
        org.eclipse.swt.widgets.Tray tray = window.getShell().getDisplay().getSystemTray();
        if(tray == null)
        {
            return null;
        } else
        {
            TrayItem trayItem = new TrayItem(tray, 0);
            org.eclipse.swt.graphics.Image image = Activator.getImageDescriptor("/icons/internal_browser.gif").createImage();
            trayItem.setImage(image);
            trayItem.setToolTipText("File Explorer");
            return trayItem;
        }
    }

    public void dispose()
    {
    }

    private TrayItem trayItem;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -