Main Page | Packages | Class Hierarchy | Class List | File List | Class Members

ArgoPrintMenuPlugin.java

Go to the documentation of this file.
00001 // $Id: ArgoPrintMenuPlugin_8java-source.html 336 2010-01-12 20:03:17Z linus $
00002 //Copyright (c) 2003, Mikael Albertsson, Mattias Danielsson, Per Engström, 
00003 //Fredrik Gröndahl, Martin Gyllensten, Anna Kent, Anders Olsson, 
00004 //Mattias Sidebäck.
00005 //All rights reserved.
00006 //
00007 //Redistribution and use in source and binary forms, with or without 
00008 //modification, are permitted provided that the following conditions are met:
00009 //
00010 //* Redistributions of source code must retain the above copyright notice, 
00011 //  this list of conditions and the following disclaimer.
00012 // 
00013 //* Redistributions in binary form must reproduce the above copyright 
00014 //  notice, this list of conditions and the following disclaimer in the 
00015 //  documentation and/or other materials provided with the distribution.
00016 //
00017 //* Neither the name of the University of Linköping nor the names of its 
00018 //  contributors may be used to endorse or promote products derived from 
00019 //  this software without specific prior written permission. 
00020 //
00021 //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
00022 //AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
00023 //IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
00024 //ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
00025 //LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
00026 //CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
00027 //SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
00028 //INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
00029 //CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
00030 //ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 
00031 //THE POSSIBILITY OF SUCH DAMAGE.
00032 
00033 
00034 
00035 
00036 package org.argouml.ui.argoprint;
00037 
00038 import org.argouml.application.api.*;
00039 import org.argouml.uml.ui.*;
00040 
00041 import org.argoprint.uml_interface.UMLInterface;
00042 import org.argoprint.ui.*;
00043 
00044 import org.argouml.kernel.Project;
00045 import org.argouml.kernel.ProjectManager;
00046 import org.argouml.ui.ProjectBrowser;
00047 
00048 import org.argouml.model.ModelFacade;
00049 
00050 import java.awt.*;
00051 import java.awt.event.*;
00052 
00053 import java.lang.*;
00054 
00055 import java.util.*;
00056 
00057 import javax.swing.*;
00058 
00059 
00060 /**
00061  *  @author Mattias Danielsson
00062  *  @since  0.0.1
00063  */
00064 public class ArgoPrintMenuPlugin extends UMLAction
00065     implements PluggableMenu {
00066     /**
00067      * This is not publicly creatable.
00068      */
00069     protected ArgoPrintMenuPlugin() {
00070     super("Plugin ArgoPrintMenu entry", false);
00071     }
00072 
00073     ////////////////////////////////////////////////////////////////
00074     // Main methods.
00075 
00076     /**
00077      * Just let the tester know that we got executed.
00078      */
00079     public void actionPerformed(ActionEvent event) {
00080     Argo.log.info("Starting ArgoPrint");
00081 
00082     // This is where the ArgoPrint GUI frame is created and displayed
00083     ArgoPrintJDialog argoPrintDialog = 
00084         new ArgoPrintJDialog(new javax.swing.JFrame(), true);
00085     Argo.log.info("Setting Gui Log");
00086     argoPrintDialog.setLog(Argo.log);
00087     Argo.log.info("Showing ArgoPrint Dialog");
00088     argoPrintDialog.show();
00089     }
00090 
00091     public void setModuleEnabled(boolean v) { }
00092     
00093     public boolean initializeModule() {
00094         Argo.log.info ("+-----------------------------+");
00095         Argo.log.info ("| ArgoPrint initialized       |");
00096         Argo.log.info ("+-----------------------------+");
00097     return true;
00098     }
00099 
00100     public Object[] buildContext(JMenuItem a, String b) {
00101         return new Object[] {
00102         a, b
00103     };
00104     }
00105 
00106     public boolean inContext(Object[] o) {
00107         if (o.length < 2) return false;
00108        
00109     if ((o[0] instanceof JMenuItem) && ("Tools".equals(o[1]))) {
00110         return true;
00111     }
00112         return false;
00113     }
00114     public boolean isModuleEnabled() { return true; }
00115     public Vector getModulePopUpActions(Vector v, Object o) { return null; }
00116     public boolean shutdownModule() { return true; }
00117 
00118     public String getModuleName() { return "ArgoPrintMenuPlugin"; }
00119     public String getModuleDescription() { return "Menu Item for ArgoPrint"; }
00120     public String getModuleAuthor() { return "Mattias Danielsson"; }
00121     public String getModuleVersion() { return "0.0.1"; }
00122     public String getModuleKey() { return "module.argoprint.menu.plugins"; }
00123 
00124     public JMenuItem getMenuItem(JMenuItem mi, String s) {
00125         return getMenuItem(buildContext(mi, s));
00126     }
00127 
00128     public JMenuItem getMenuItem(Object [] context) {
00129         if (!inContext(context)) {
00130         return null;
00131     }
00132 
00133         JMenuItem _menuItem = new JMenuItem("ArgoPrint");
00134     _menuItem.addActionListener(this);
00135         return _menuItem;
00136     }
00137 }
00138 
00139 
00140 
00141 
00142 

Generated on Tue Dec 2 22:50:56 2003 for ArgoPrint by doxygen 1.3.4