001 /* This file is part of the project "Hilbert II" - http://www.qedeq.org
002 *
003 * Copyright 2000-2013, Michael Meyling <mime@qedeq.org>.
004 *
005 * "Hilbert II" is free software; you can redistribute
006 * it and/or modify it under the terms of the GNU General Public
007 * License as published by the Free Software Foundation; either
008 * version 2 of the License, or (at your option) any later version.
009 *
010 * This program is distributed in the hope that it will be useful,
011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
013 * GNU General Public License for more details.
014 */
015
016 package org.qedeq.gui.se.tree;
017
018 import javax.swing.JMenuItem;
019 import javax.swing.JPopupMenu;
020
021 import org.qedeq.gui.se.control.QedeqController;
022 import org.qedeq.gui.se.pane.QedeqGuiConfig;
023 import org.qedeq.gui.se.util.GuiHelper;
024 import org.qedeq.gui.se.util.MenuHelper;
025
026
027 /**
028 * Context menu for nodes.
029 *
030 * @author Michael Meyling
031 */
032 public final class QedeqTreeContextMenu extends JPopupMenu {
033
034 /**
035 * Constructor.
036 *
037 * @param controller Reference holder to action information.
038 */
039 public QedeqTreeContextMenu(final QedeqController controller) {
040 final String resolution = QedeqGuiConfig.getInstance().getIconSize();
041 JMenuItem item = MenuHelper.createMenuItem("Remove", 'R');
042 item.addActionListener(controller.getRemoveModuleAction());
043 item.setToolTipText("Unload selected QEDEQ modules. Changes status of dependent modules. "
044 + "Local module buffer is not affected.");
045 item.setIcon(GuiHelper.readImageIcon("tango/" + resolution + "/actions/edit-cut.png"));
046 this.add(item);
047
048 this.addSeparator();
049
050 item = MenuHelper.createMenuItem("Check Well-Formedness", 'W');
051 item.setToolTipText(
052 "Check if all formulas are well formed within selected QEDEQ modules. This includes dependency checking.");
053 item.addActionListener(controller.getCheckWellFormedAction());
054 item.setIcon(GuiHelper.readImageIcon("tango/" + resolution + "/status/software-update-available.png"));
055 this.add(item);
056
057 item = MenuHelper.createMenuItem("Check Fully-Formally Proved", 'F');
058 item.setToolTipText(
059 "Check if all propositions have formal correct proofss within selected QEDEQ modules. "
060 + "This includes dependency checking.");
061 item.addActionListener(controller.getCheckFormallyProvedAction());
062 item.setIcon(GuiHelper.readImageIcon("tango/" + resolution + "/actions/run.png"));
063 this.add(item);
064
065 this.addSeparator();
066
067 final JMenuItem[] pluginMenu = controller.getPluginMenuEntries();
068 for (int i = 0; i < pluginMenu.length; i++) {
069 this.add(pluginMenu[i]);
070 }
071
072 this.addSeparator();
073
074 item = MenuHelper.createMenuItem("Remove Plugin Results", 'R');
075 item.addActionListener(controller.getRemovePluginResultsAction());
076 item.setToolTipText(
077 "Remove all warnings and errors that were produced by all plugin executions for the selected module.");
078 item.setIcon(GuiHelper.readImageIcon("tango/" + resolution + "/actions/edit-clear.png"));
079 this.add(item);
080
081 this.addSeparator();
082
083 item = MenuHelper.createMenuItem("Terminate Threads", 'T');
084 item.addActionListener(controller.getTerminateAllAction());
085 item.setToolTipText(
086 "Terminate all currently running plugin processes.");
087 item.setIcon(GuiHelper.readImageIcon("tango/" + resolution + "/actions/process-stop.png"));
088 this.add(item);
089
090 this.addSeparator();
091
092 item = MenuHelper.createMenuItem("Load from Web", 'W');
093 item.setToolTipText("Load QEDEQ module from anywhere in the Web");
094 item.addActionListener(controller.getAddAction());
095 item.setIcon(GuiHelper.readImageIcon("tango/" + resolution + "/actions/list-add.png"));
096 this.add(item);
097
098 item = MenuHelper.createMenuItem("Load local File", 'F');
099 item.setToolTipText("Load QEDEQ module from file system");
100 item.addActionListener(controller.getAddFileAction());
101 item.setIcon(GuiHelper.readImageIcon("tango/" + resolution + "/actions/document-open.png"));
102 this.add(item);
103 }
104
105 }
|