svn commit: r14982 - branches/gsoc2008/work_criticsprofiles_maurelio1234/src/org/argouml/ui/explorer

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: maurelio1234
Date: 2008-06-17 04:58:03-0700
New Revision: 14982

Added:
   branches/gsoc2008/work_criticsprofiles_maurelio1234/src/org/argouml/ui/explorer/ActionManageProfiles.java
   branches/gsoc2008/work_criticsprofiles_maurelio1234/src/org/argouml/ui/explorer/GoProfileToCritics.java
Modified:
   branches/gsoc2008/work_criticsprofiles_maurelio1234/src/org/argouml/ui/explorer/ExplorerPopup.java
   branches/gsoc2008/work_criticsprofiles_maurelio1234/src/org/argouml/ui/explorer/PerspectiveManager.java

Log:
adding new options to explorer

Added: branches/gsoc2008/work_criticsprofiles_maurelio1234/src/org/argouml/ui/explorer/ActionManageProfiles.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008/work_criticsprofiles_maurelio1234/src/org/argouml/ui/explorer/ActionManageProfiles.java?view=auto&rev=14982
==============================================================================
--- (empty file)
+++ branches/gsoc2008/work_criticsprofiles_maurelio1234/src/org/argouml/ui/explorer/ActionManageProfiles.java	2008-06-17 04:58:03-0700
@@ -0,0 +1,83 @@
+// $Id: eclipse-argo-codetemplates.xml 11347 2006-10-26 22:37:44Z linus $
+// Copyright (c) 2008 The Regents of the University of California. All
+// Rights Reserved. Permission to use, copy, modify, and distribute this
+// software and its documentation without fee, and without a written
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.ui.explorer;
+
+import java.awt.event.ActionEvent;
+import java.util.Iterator;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+
+import org.argouml.application.api.GUISettingsTabInterface;
+import org.argouml.application.helpers.ResourceLoaderWrapper;
+import org.argouml.i18n.Translator;
+import org.argouml.ui.GUI;
+import org.argouml.ui.ProfileSelectionTab;
+import org.argouml.ui.ProjectSettingsDialog;
+import org.argouml.ui.ProjectSettingsTabProfile;
+
+public class ActionManageProfiles extends AbstractAction {
+
+    /**
+     * The settings dialog.
+     */
+    private ProjectSettingsDialog dialog;
+    private ProjectSettingsTabProfile profilesTab;
+
+    /**
+     * Constructor.
+     */
+    public ActionManageProfiles() {
+        super(Translator.localize("action.manage-profiles"),
+                ResourceLoaderWrapper.lookupIcon("action.manage-profiles"));
+        // Set the tooltip string:
+        putValue(Action.SHORT_DESCRIPTION, 
+                Translator.localize("action.manage-profiles"));
+    }
+
+    /**
+     * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
+     */
+    public void actionPerformed(ActionEvent e) {
+        if (profilesTab == null) {
+            Iterator iter = GUI.getInstance().getProjectSettingsTabs()
+                    .iterator();
+            while (iter.hasNext()) {
+                GUISettingsTabInterface stp = (GUISettingsTabInterface) iter
+                        .next();
+
+                if (stp instanceof ProjectSettingsTabProfile) {
+                    profilesTab = (ProjectSettingsTabProfile) stp;
+                }
+            }
+        }
+        
+        if (dialog == null) {
+            dialog = new ProjectSettingsDialog();
+        }
+        dialog.showDialog(profilesTab);        
+    }
+
+}

Modified: branches/gsoc2008/work_criticsprofiles_maurelio1234/src/org/argouml/ui/explorer/ExplorerPopup.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008/work_criticsprofiles_maurelio1234/src/org/argouml/ui/explorer/ExplorerPopup.java?view=diff&rev=14982&p1=branches/gsoc2008/work_criticsprofiles_maurelio1234/src/org/argouml/ui/explorer/ExplorerPopup.java&p2=branches/gsoc2008/work_criticsprofiles_maurelio1234/src/org/argouml/ui/explorer/ExplorerPopup.java&r1=14981&r2=14982
==============================================================================
--- branches/gsoc2008/work_criticsprofiles_maurelio1234/src/org/argouml/ui/explorer/ExplorerPopup.java	(original)
+++ branches/gsoc2008/work_criticsprofiles_maurelio1234/src/org/argouml/ui/explorer/ExplorerPopup.java	2008-06-17 04:58:03-0700
@@ -42,12 +42,17 @@
 
 import org.apache.log4j.Logger;
 import org.argouml.i18n.Translator;
+import org.argouml.kernel.ProfileConfiguration;
 import org.argouml.kernel.Project;
 import org.argouml.kernel.ProjectManager;
 import org.argouml.model.IllegalModelElementConnectionException;
 import org.argouml.model.Model;
+import org.argouml.profile.Profile;
+import org.argouml.profile.ProfileException;
+import org.argouml.ui.ActionProjectSettings;
 import org.argouml.ui.DisplayTextTree;
 import org.argouml.ui.targetmanager.TargetManager;
+import org.argouml.uml.cognitive.critics.CrUML;
 import org.argouml.uml.diagram.ArgoDiagram;
 import org.argouml.uml.diagram.activity.ui.UMLActivityDiagram;
 import org.argouml.uml.diagram.sequence.ui.UMLSequenceDiagram;
@@ -58,9 +63,7 @@
 import org.argouml.uml.diagram.ui.ActionAddExistingNode;
 import org.argouml.uml.diagram.ui.ActionAddExistingNodes;
 import org.argouml.uml.diagram.ui.ActionSaveDiagramToClipboard;
-import org.argouml.profile.Profile;
-import org.argouml.kernel.ProfileConfiguration;
-import org.argouml.profile.ProfileException;
+import org.argouml.uml.ui.AbstractActionNewModelElement;
 import org.argouml.uml.ui.ActionActivityDiagram;
 import org.argouml.uml.ui.ActionClassDiagram;
 import org.argouml.uml.ui.ActionCollaborationDiagram;
@@ -71,7 +74,6 @@
 import org.argouml.uml.ui.ActionSetSourcePath;
 import org.argouml.uml.ui.ActionStateDiagram;
 import org.argouml.uml.ui.ActionUseCaseDiagram;
-import org.argouml.uml.ui.AbstractActionNewModelElement;
 import org.tigris.gef.base.Diagram;
 import org.tigris.gef.graph.MutableGraphModel;
 
@@ -193,7 +195,11 @@
         if (!multiSelect && selectedItem instanceof Profile) {
             this.add(new ActionExportProfileXMI((Profile) selectedItem));
         }
-        
+
+        if (!multiSelect && selectedItem instanceof ProfileConfiguration) {
+            this.add(new ActionManageProfiles());
+        }
+
         if (modelElementsOnly) {
             initMenuCreateModelElements();
         }
@@ -844,7 +850,8 @@
             Object selectedItem) {
         boolean found = selectedItem instanceof ProfileConfiguration
                 || selectedItem instanceof Profile
-                || selectedItem instanceof ArgoDiagram;
+                || selectedItem instanceof ArgoDiagram
+                || selectedItem instanceof CrUML;
                 
         if (!found) {
             for (Profile profile : currentProject.getProfileConfiguration()

Added: branches/gsoc2008/work_criticsprofiles_maurelio1234/src/org/argouml/ui/explorer/GoProfileToCritics.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008/work_criticsprofiles_maurelio1234/src/org/argouml/ui/explorer/GoProfileToCritics.java?view=auto&rev=14982
==============================================================================
--- (empty file)
+++ branches/gsoc2008/work_criticsprofiles_maurelio1234/src/org/argouml/ui/explorer/GoProfileToCritics.java	2008-06-17 04:58:03-0700
@@ -0,0 +1,66 @@
+// $Id: eclipse-argo-codetemplates.xml 11347 2006-10-26 22:37:44Z linus $
+// Copyright (c) 2008 The Regents of the University of California. All
+// Rights Reserved. Permission to use, copy, modify, and distribute this
+// software and its documentation without fee, and without a written
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.ui.explorer;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Set;
+
+import org.argouml.i18n.Translator;
+import org.argouml.profile.Profile;
+import org.argouml.ui.explorer.rules.PerspectiveRule;
+
+/**
+ * Show the critics exported by a Profile
+ *
+ * @author maurelio1234
+ */
+public class GoProfileToCritics implements PerspectiveRule {
+
+    /*
+     * @see org.argouml.ui.explorer.rules.PerspectiveRule#getRuleName()
+     */
+    public String getRuleName() {
+        return Translator.localize("misc.profile.critic");
+    }
+
+    /*
+     * @see org.argouml.ui.explorer.rules.PerspectiveRule#getChildren(java.lang.Object)
+     */
+    public Collection getChildren(Object parent) {
+        if (parent instanceof Profile) {
+            return ((Profile) parent).getCritics();
+        }
+        return Collections.EMPTY_SET;
+    }
+
+    /*
+     * @see org.argouml.ui.explorer.rules.PerspectiveRule#getDependencies(java.lang.Object)
+     */
+    public Set getDependencies(Object parent) {
+        // TODO: What?
+        return Collections.EMPTY_SET;
+    }
+}

Modified: branches/gsoc2008/work_criticsprofiles_maurelio1234/src/org/argouml/ui/explorer/PerspectiveManager.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008/work_criticsprofiles_maurelio1234/src/org/argouml/ui/explorer/PerspectiveManager.java?view=diff&rev=14982&p1=branches/gsoc2008/work_criticsprofiles_maurelio1234/src/org/argouml/ui/explorer/PerspectiveManager.java&p2=branches/gsoc2008/work_criticsprofiles_maurelio1234/src/org/argouml/ui/explorer/PerspectiveManager.java&r1=14981&r2=14982
==============================================================================
--- branches/gsoc2008/work_criticsprofiles_maurelio1234/src/org/argouml/ui/explorer/PerspectiveManager.java	(original)
+++ branches/gsoc2008/work_criticsprofiles_maurelio1234/src/org/argouml/ui/explorer/PerspectiveManager.java	2008-06-17 04:58:03-0700
@@ -332,6 +332,7 @@
         classPerspective.addRule(new GoProjectToProfileConfiguration());
         classPerspective.addRule(new GoProfileConfigurationToProfile());
         classPerspective.addRule(new GoProfileToModel());
+        classPerspective.addRule(new GoProfileToCritics());
         classPerspective.addRule(new GoProjectToRoots());
         classPerspective.addRule(new GoNamespaceToClassifierAndPackage());
         classPerspective.addRule(new GoNamespaceToDiagram());
@@ -350,6 +351,7 @@
         packagePerspective.addRule(new GoProjectToProfileConfiguration());
         packagePerspective.addRule(new GoProfileConfigurationToProfile());
         packagePerspective.addRule(new GoProfileToModel());
+        packagePerspective.addRule(new GoProfileToCritics());
         packagePerspective.addRule(new GoProjectToRoots());
         packagePerspective.addRule(new GoNamespaceToOwnedElements());
         packagePerspective.addRule(new GoPackageToElementImport());
@@ -398,6 +400,7 @@
         diagramPerspective.addRule(new GoProjectToProfileConfiguration());
         diagramPerspective.addRule(new GoProfileConfigurationToProfile());
         diagramPerspective.addRule(new GoProfileToModel());
+        diagramPerspective.addRule(new GoProfileToCritics());
         diagramPerspective.addRule(new GoModelToDiagrams());
         diagramPerspective.addRule(new GoDiagramToNode());
         diagramPerspective.addRule(new GoDiagramToEdge());
@@ -412,6 +415,7 @@
         inheritancePerspective.addRule(new GoProjectToProfileConfiguration());
         classPerspective.addRule(new GoProfileConfigurationToProfile());
         classPerspective.addRule(new GoProfileToModel());
+        classPerspective.addRule(new GoProfileToCritics());
         inheritancePerspective.addRule(new GoModelToBaseElements());
         inheritancePerspective
                 .addRule(new GoGeneralizableElementToSpecialized());
@@ -423,6 +427,7 @@
         associationsPerspective.addRule(new GoProjectToProfileConfiguration());
         associationsPerspective.addRule(new GoProfileConfigurationToProfile());
         associationsPerspective.addRule(new GoProfileToModel());
+        associationsPerspective.addRule(new GoProfileToCritics());
         associationsPerspective.addRule(new GoNamespaceToDiagram());
         associationsPerspective.addRule(new GoPackageToClass());
         associationsPerspective.addRule(new GoClassToAssociatedClass());
@@ -434,6 +439,7 @@
         residencePerspective.addRule(new GoProjectToProfileConfiguration());
         residencePerspective.addRule(new GoProfileConfigurationToProfile());
         residencePerspective.addRule(new GoProfileToModel());
+        residencePerspective.addRule(new GoProfileToCritics());
         residencePerspective.addRule(new GoModelToNode());
         residencePerspective.addRule(new GoNodeToResidentComponent());
         residencePerspective.addRule(new GoComponentToResidentModelElement());
@@ -468,6 +474,7 @@
         compositionPerspective.addRule(new GoProjectToProfileConfiguration());
         compositionPerspective.addRule(new GoProfileConfigurationToProfile());
         compositionPerspective.addRule(new GoProfileToModel());
+        compositionPerspective.addRule(new GoProfileToCritics());
         compositionPerspective.addRule(new GoProjectToRoots());
         compositionPerspective.addRule(new GoModelElementToContents());
         compositionPerspective.addRule(new GoModelElementToContainedDiagrams());
@@ -533,6 +540,7 @@
             new GoProjectToProfileConfiguration(), 
             new GoProfileConfigurationToProfile(),
             new GoProfileToModel(),
+            new GoProfileToCritics(),
             new GoProjectToRoots(),
             new GoSignalToReception(), new GoStateMachineToTop(),
             new GoStatemachineToDiagram(), new GoStateMachineToState(),
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.