svn commit: r17432 - trunk/src/argouml-app/src/org/argouml: i18n profile ui/explorer

Thomas Neustupny <[email protected]>
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: thn
Date: 2009-10-27 13:12:27-0700
New Revision: 17432

Modified:
   trunk/src/argouml-app/src/org/argouml/i18n/action.properties
   trunk/src/argouml-app/src/org/argouml/profile/UserDefinedProfile.java
   trunk/src/argouml-app/src/org/argouml/ui/explorer/ActionDeployProfile.java

Log:
UML2 profiles: some more work (like i18n), more to do

Modified: trunk/src/argouml-app/src/org/argouml/i18n/action.properties
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/i18n/action.properties?view=diff&pathrev=17432&r1=17431&r2=17432
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/i18n/action.properties	(original)
+++ trunk/src/argouml-app/src/org/argouml/i18n/action.properties	2009-10-27 13:12:27-0700
@@ -67,6 +67,7 @@
 action.cut = Cut
 action.delete-concurrent-region = Delete Concurrent Region
 action.delete-from-model = Delete From Model
+action.deploy-profile = Deploy Profile
 action.deployment-diagram = New Deployment Diagram
 action.design-goals = Design Goals...
 action.design-issues = Design Issues...

Modified: trunk/src/argouml-app/src/org/argouml/profile/UserDefinedProfile.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/profile/UserDefinedProfile.java?view=diff&pathrev=17432&r1=17431&r2=17432
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/profile/UserDefinedProfile.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/profile/UserDefinedProfile.java	2009-10-27 13:12:27-0700
@@ -188,8 +188,8 @@
             // the profile model, if there is more than one, we take the ones
             // marked as <<profile>>
             if (Model.getFacade().isAModelElement(obj)
-                    && (Model.getExtensionMechanismsHelper().hasStereotype(obj,
-                            "profile") || (packagesInProfile.size() == 1))) {
+                    && (Model.getFacade().isAProfile(obj)
+                            || (packagesInProfile.size() == 1))) {
 
                 // load profile name
                 String name = Model.getFacade().getName(obj);
@@ -203,23 +203,25 @@
                 }
                 LOG.info("profile " + displayName);
 
-                // load profile dependencies
-                String dependencyListStr = Model.getFacade()
-                        .getTaggedValueValue(obj, "Dependency");
-                StringTokenizer st = new StringTokenizer(dependencyListStr,
-                        " ,;:");
-
-                String profile = null;
-
-                while (st.hasMoreTokens()) {
-                    profile = st.nextToken();
-                    if (profile != null) {
-                        LOG.debug("AddingDependency " + profile);
-                        this.addProfileDependency(ProfileFacade.getManager()
-                                .lookForRegisteredProfile(profile));
+                if (Model.getFacade().getUmlVersion().charAt(0) == '1') {
+                    // load profile dependencies
+                    String dependencyListStr = Model.getFacade()
+                            .getTaggedValueValue(obj, "Dependency");
+                    StringTokenizer st = new StringTokenizer(dependencyListStr,
+                            " ,;:");
+
+                    String profile = null;
+
+                    while (st.hasMoreTokens()) {
+                        profile = st.nextToken();
+                        if (profile != null) {
+                            LOG.debug("AddingDependency " + profile);
+                            this.addProfileDependency(ProfileFacade.getManager()
+                                    .lookForRegisteredProfile(profile));
+                        }
                     }
                 }
-
+                // TODO: profile dependencies for UML2
             }
         }
 

Modified: trunk/src/argouml-app/src/org/argouml/ui/explorer/ActionDeployProfile.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/ui/explorer/ActionDeployProfile.java?view=diff&pathrev=17432&r1=17431&r2=17432
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/ui/explorer/ActionDeployProfile.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/ui/explorer/ActionDeployProfile.java	2009-10-27 13:12:27-0700
@@ -32,6 +32,7 @@
 import javax.swing.JFileChooser;
 
 import org.apache.log4j.Logger;
+import org.argouml.i18n.Translator;
 import org.argouml.model.Model;
 import org.argouml.persistence.PersistenceManager;
 import org.argouml.persistence.ProjectFileView;
@@ -43,10 +44,12 @@
 import org.argouml.util.ArgoFrame;
 
 /**
- * Explorer action for deploying a user editable profile. This is only needed
- * since UML2. An undeployed editable profile cannot be applied. A deployed
- * profile is no more editable, but can be applied to a model.
- *
+ * Explorer action for deploying a user editable profile. Deploying means: save
+ * it as an XMI file, immediately load it as a user profile, but don't activate
+ * it (pointless, because a profile cannot be applied to itself), and also don't
+ * change the configuration (so it will only be loaded on every startup when it
+ * is deployed into a default profile directory).
+ * 
  * @author Thomas Neustupny
  */
 public class ActionDeployProfile extends AbstractAction {
@@ -62,15 +65,11 @@
      * @param profile the selected profile
      */
     public ActionDeployProfile(Object profile) {
-        //super(Translator.localize("action.deploy-profile"));
-        super ("Deploy Profile...");
+        super(Translator.localize("action.deploy-profile") + "...");
         undeployedProfile = profile;
     }
 
     public void actionPerformed(ActionEvent arg0) {
-        // make the profile ready to be applied
-        //Object profile = Model.getExtensionMechanismsHelper()
-        //    .makeProfileApplicable(undeployedProfile);
         // get one of the default profile dirs, if available
         // (as a default value for the following save dialog)
         ProfileManager profileManager = ProfileFacade.getManager();
@@ -108,9 +107,9 @@
         PersistenceManager pm = PersistenceManager.getInstance();
         // show a chooser dialog for the file name, only xmi is allowed
         JFileChooser chooser = new JFileChooser();
-        chooser.setDialogTitle("Save Profile");
+        chooser.setDialogTitle(Translator.localize("action.deploy-profile"));
         chooser.setFileView(ProjectFileView.getInstance());
-        chooser.setApproveButtonText("Save");
+        chooser.setApproveButtonText(Translator.localize("filechooser.export"));
         chooser.setAcceptAllFileFilterUsed(true);
         pm.setXmiFileChooserFilter(chooser);
         if (fn.length() > 0) {
@@ -124,8 +123,8 @@
                 String name = theFile.getName();
                 name = pm.fixXmiExtension(name);
                 theFile = new File(theFile.getParent(), name);
-                ProjectBrowser.getInstance().trySaveWithProgressMonitor(
-                        true, theFile, false);
+                ProjectBrowser.getInstance().trySaveWithProgressMonitor(true,
+                        theFile, false);
             }
         }
         return theFile;

------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=2411798

To unsubscribe from this discussion, e-mail: [[email protected]].
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.