protected void makeActions(IWorkbenchWindow window) {
    exitAction = ActionFactory.QUIT.create(window);
    register(exitAction);

    saveAsAction = ActionFactory.SAVE_AS.create(window);
    register(saveAsAction);

    closeAction = ActionFactory.CLOSE.create(window);
    register(closeAction);

    closeAllAction = ActionFactory.CLOSE_ALL.create(window);
    register(closeAllAction);

    closeOthersAction = ActionFactory.CLOSE_OTHERS.create(window);
    register(closeOthersAction);

    aboutAction = ActionFactory.ABOUT.create(window);
    register(aboutAction);

    openPreferencesAction = ActionFactory.PREFERENCES.create(window);
    register(openPreferencesAction);

    changePerspMenuItem = ContributionItemFactory.PERSPECTIVES_SHORTLIST.create(window);

    showViewMenu = ContributionItemFactory.VIEWS_SHORTLIST.create(window);
  }
 /**
  * Creates the 'File' menu
  *
  * @param window
  * @return
  */
 protected IMenuManager createFileMenu(IWorkbenchWindow window) {
   IMenuManager menu = new MenuManager("File", IWorkbenchActionConstants.M_FILE);
   menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_START));
   IMenuManager newMenu = new MenuManager("New", "new");
   newMenu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
   menu.add(newMenu);
   menu.add(new Separator());
   menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
   menu.add(new Separator());
   addToMenuAndRegister(menu, ActionFactory.CLOSE.create(window));
   addToMenuAndRegister(menu, ActionFactory.CLOSE_ALL.create(window));
   menu.add(new Separator());
   addToMenuAndRegister(menu, ActionFactory.SAVE.create(window));
   addToMenuAndRegister(menu, ActionFactory.SAVE_AS.create(window));
   addToMenuAndRegister(menu, ActionFactory.SAVE_ALL.create(window));
   menu.add(new Separator());
   addToMenuAndRegister(menu, ActionFactory.QUIT.create(window));
   menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_END));
   return menu;
 }
  protected void makeActions(final IWorkbenchWindow window) {
    // Creates the actions and registers them.
    // Registering is needed to ensure that key bindings work.
    // The corresponding commands keybindings are defined in the plugin.xml
    // file.
    // Registering also provides automatic disposal of the actions when
    // the window is closed.

    this.window = window;

    exitAction = ActionFactory.QUIT.create(window);
    register(exitAction);
    {
      closeAction = ActionFactory.CLOSE.create(window);
      register(closeAction);
    }
    {
      closeAllAction = ActionFactory.CLOSE_ALL.create(window);
      register(closeAllAction);
    }
    {
      saveAction = ActionFactory.SAVE.create(window);
      register(saveAction);
    }
    {
      saveAsAction = ActionFactory.SAVE_AS.create(window);
      register(saveAsAction);
    }
    {
      saveAllAction = ActionFactory.SAVE_ALL.create(window);
      register(saveAllAction);
    }
    sizeAction1 =
        new Action("176x208") {
          public void run() {
            Settings.setScreenSize(176, 208);
          }
        };

    sizeAction2 =
        new Action("240x320") {
          public void run() {
            Settings.setScreenSize(240, 320);
          }
        };

    sizeAction3 =
        new Action("320x240") {
          public void run() {
            Settings.setScreenSize(320, 240);
          }
        };

    sizeAction4 =
        new Action("480x320") {
          public void run() {
            Settings.setScreenSize(480, 320);
          }
        };

    sizeAction5 =
        new Action("640x360") {
          public void run() {
            Settings.setScreenSize(640, 360);
          }
        };

    sizeAction6 =
        new Action("960x640") {
          public void run() {
            Settings.setScreenSize(960, 640);
          }
        };

    undoAction =
        new Action("&Undo") {
          public void run() {
            this.firePropertyChange("chosen", this, this);
          }
        };
    undoAction.setEnabled(false);
    undoAction.setImageDescriptor(
        ResourceManager.getPluginImageDescriptor(
            WorkshopPlugin.getDefault(), "icons/undo_edit(1).gif"));
    undoAction.setDisabledImageDescriptor(
        ResourceManager.getPluginImageDescriptor(
            WorkshopPlugin.getDefault(), "icons/undo_edit.gif"));
    undoAction.setAccelerator(SWT.CTRL | 'z');

    redoAction =
        new Action("&Redo") {
          public void run() {
            this.firePropertyChange("chosen", this, this);
          }
        };
    redoAction.setEnabled(false);
    redoAction.setImageDescriptor(
        ResourceManager.getPluginImageDescriptor(
            WorkshopPlugin.getDefault(), "icons/redo_edit(1).gif"));
    redoAction.setDisabledImageDescriptor(
        ResourceManager.getPluginImageDescriptor(
            WorkshopPlugin.getDefault(), "icons/redo_edit.gif"));
    redoAction.setAccelerator(SWT.CTRL | 'y');
    {
      newWizardDropDownAction = ActionFactory.NEW_WIZARD_DROP_DOWN.create(window);
      register(newWizardDropDownAction);
    }

    chooseImageEditorAction =
        new Action("工具设置...") {
          public void run() {
            onChooseImageEditor();
          }
        };

    viewDirectoryAction =
        new Action("Resource Explorer") {
          public void run() {
            try {
              window.getActivePage().showView(DirectoryView.ID);
            } catch (Exception e) {
            }
          }
        };
    viewDirectoryAction.setImageDescriptor(
        ResourceManager.getPluginImageDescriptor(WorkshopPlugin.getDefault(), "icons/items.gif"));

    viewTileLibraryAction =
        new Action("Tile Library") {
          public void run() {
            try {
              window.getActivePage().showView(TileLibView.ID);
            } catch (Exception e) {
              e.printStackTrace();
            }
          }
        };
    viewTileLibraryAction.setImageDescriptor(
        ResourceManager.getPluginImageDescriptor(WorkshopPlugin.getDefault(), "icons/tilelib.gif"));

    viewTileViewAction =
        new Action("Tile Viewer") {
          public void run() {
            try {
              window.getActivePage().showView(TileView.ID);
              //			window.getActivePage().showView("org.eclipse.swt.sleak.views.SleakView");
            } catch (Exception e) {
              e.printStackTrace();
            }
          }
        };
    viewTileViewAction.setImageDescriptor(
        ResourceManager.getPluginImageDescriptor(WorkshopPlugin.getDefault(), "icons/tiles.gif"));

    optimizeColorsAction =
        new Action("Optimize PNG Colors...") {
          public void run() {
            new PNGColorOptimizer().run(window.getShell());
          }
        };

    openLogDirAction =
        new Action("打开日志目录") {
          public void run() {
            String dir = Settings.logDir;
            String cmd = "explorer.exe \"" + dir + "\"";
            try {
              Runtime.getRuntime().exec(cmd);
            } catch (Exception e) {
            }
          }
        };

    projectViewAction =
        new Action("ProjectView") {
          public void run() {
            try {
              window.getActivePage().showView(ProjectView.ID);
            } catch (Exception e) {
              e.printStackTrace();
            }
          }
        };
    projectViewAction.setImageDescriptor(
        ResourceManager.getPluginImageDescriptor(WorkshopPlugin.getDefault(), "icons/project.gif"));

    frameDelayAction5 =
        new Action("20毫秒") {
          public void run() {
            Settings.animateFrameDelay = 20;
          }
        };

    frameDelayAction6 =
        new Action("10毫秒") {
          public void run() {
            Settings.animateFrameDelay = 10;
          }
        };

    frameDelayAction1 =
        new Action("40毫秒") {
          public void run() {
            Settings.animateFrameDelay = 40;
          }
        };

    frameDelayAction2 =
        new Action("60毫秒") {
          public void run() {
            Settings.animateFrameDelay = 60;
          }
        };

    frameDelayAction3 =
        new Action("80毫秒") {
          public void run() {
            Settings.animateFrameDelay = 80;
          }
        };

    frameDelayAction4 =
        new Action("100毫秒") {
          public void run() {
            Settings.animateFrameDelay = 100;
          }
        };

    limitPIPAction =
        new Action("限制PIP图片大小", IAction.AS_CHECK_BOX) {
          public void run() {
            PipImage.limitSize = !PipImage.limitSize;
          }
        };
    limitPIPAction.setChecked(PipImage.limitSize);

    allowMultiCompAction =
        new Action("允许一个PIP包含多个压缩纹理", IAction.AS_CHECK_BOX) {
          public void run() {
            PipImage.allowMultiCompressTexturesInOneFile =
                !PipImage.allowMultiCompressTexturesInOneFile;
          }
        };
    allowMultiCompAction.setChecked(PipImage.allowMultiCompressTexturesInOneFile);

    actionFontTool =
        new Action("字体工具...") {
          public void run() {
            FontViewDialog dlg = new FontViewDialog(window.getShell());
            dlg.open();
          }
        };

    openglAction =
        new Action("OpenGL模式", IAction.AS_CHECK_BOX) {
          public void run() {
            GLUtils.glEnabled = !GLUtils.glEnabled;
          }
        };
    openglAction.setImageDescriptor(
        ResourceManager.getPluginImageDescriptor(WorkshopPlugin.getDefault(), "icons/gl.gif"));
    openglAction.setToolTipText("开启/关闭OpenGL模式");
    openglAction.setChecked(GLUtils.glEnabled);

    optimizeImageAction =
        new Action("图片优化工具...") {
          public void run() {
            try {
              IFileStore fileStore = EFS.getLocalFileSystem().getStore(new Path("."));
              FileStoreEditorInput input = new FileStoreEditorInput(fileStore);
              window.getActivePage().openEditor(input, ImageOptimizeEditor.ID);
            } catch (Exception e) {
              e.printStackTrace();
            }
          }
        };

    comparePipAction =
        new Action("比较PIP图片...") {
          public void run() {
            try {
              IFileStore fileStore = EFS.getLocalFileSystem().getStore(new Path("."));
              FileStoreEditorInput input = new FileStoreEditorInput(fileStore);
              window.getActivePage().openEditor(input, ImageCompareEditor.ID);
            } catch (Exception e) {
              e.printStackTrace();
            }
          }
        };

    batchConvertAction =
        new Action("批量格式转换...") {
          public void run() {
            DirectoryDialog dlg = new DirectoryDialog(window.getShell());
            dlg.setMessage("请选择源目录:");
            String dir = dlg.open();
            if (dir == null) {
              return;
            }
            dlg.setMessage("请选择目标目录:");
            String targetDir = dlg.open();
            if (targetDir == null) {
              return;
            }

            BatchConvertDialog dlg2 = new BatchConvertDialog(window.getShell());
            try {
              dlg2.setDirectory(dir, targetDir);
              dlg2.open();
            } catch (Exception e1) {
              SWTUtils.showError(window.getShell(), "错误", e1);
            }
          }
        };

    testAction =
        new Action("test") {
          public void run() {
            // new TestPathDialog(null).open();
          }
        };
  }