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); }
/* (non-Javadoc) * @see org.eclipse.ui.application.ActionBarAdvisor#makeActions(org.eclipse.ui.IWorkbenchWindow) */ protected void makeActions(IWorkbenchWindow window) { helpContentsAction = ActionFactory.HELP_CONTENTS.create(window); register(helpContentsAction); // helpSearchAction = ActionFactory.HELP_SEARCH.create(window); // register(helpSearchAction); // dynamicHelpAction = ActionFactory.DYNAMIC_HELP.create(window); // register(dynamicHelpAction); // aboutAction = ActionFactory.ABOUT.create(window); // register(aboutAction); quitAction = ActionFactory.QUIT.create(window); register(quitAction); saveAction = ActionFactory.SAVE.create(window); register(saveAction); saveAsAction = ActionFactory.SAVE_AS.create(window); register(saveAsAction); preferencesAction = ActionFactory.PREFERENCES.create(window); register(preferencesAction); /* newEditorAction = ActionFactory.NEW_EDITOR.create(window); register(newEditorAction); */ /* newWindowAction = ActionFactory.OPEN_NEW_WINDOW.create(window); newWindowAction.setText("New Toolbox window"); register(newWindowAction); */ resetPerspectiveAction = ActionFactory.RESET_PERSPECTIVE.create(window); register(resetPerspectiveAction); backwardHistoryAction = ActionFactory.BACKWARD_HISTORY.create(window); register(backwardHistoryAction); forwardHistoryAction = ActionFactory.FORWARD_HISTORY.create(window); register(forwardHistoryAction); }
/** * 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; }
/** @generated NOT */ protected void makeActions(IWorkbenchWindow window) { toggleCoolbarAction = ActionFactory.TOGGLE_COOLBAR.create(window); register(toggleCoolbarAction); lockToolBarAction = ActionFactory.LOCK_TOOL_BAR.create(window); register(lockToolBarAction); // register(ActionFactory.CLOSE.create(window)); // register(ActionFactory.CLOSE_ALL.create(window)); register(ActionFactory.SAVE.create(window)); register(ActionFactory.SAVE_AS.create(window)); register(ActionFactory.SAVE_ALL.create(window)); register(ActionFactory.QUIT.create(window)); register(ActionFactory.UNDO.create(window)); register(ActionFactory.REDO.create(window)); register(ActionFactory.CUT.create(window)); register(ActionFactory.COPY.create(window)); register(ActionFactory.PASTE.create(window)); register(ActionFactory.DELETE.create(window)); register(ActionFactory.SELECT_ALL.create(window)); register(ActionFactory.OPEN_NEW_WINDOW.create(window)); register(ActionFactory.PRINT.create(window)); }
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(); } }; }