svn commit: r13001 - branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: maurelio1234
Date: 2007-07-08 13:09:34-0700
New Revision: 13001

Modified:
   branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileConfiguration.java
   branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileCpp.java
   branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileJava.java
   branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileManagerImpl.java
   branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileUML.java

Log:
Cpp, Java and UML profiles are now singleton

Modified: branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileConfiguration.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileConfiguration.java?view=diff&rev=13001&p1=branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileConfiguration.java&p2=branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileConfiguration.java&r1=13000&r2=13001
==============================================================================
--- branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileConfiguration.java	(original)
+++ branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileConfiguration.java	2007-07-08 13:09:34-0700
@@ -66,10 +66,10 @@
     public ProfileConfiguration(Project project) {

 	super(EXTENSION, project);

 	

-	defaultProfile = new ProfileUML();

+	defaultProfile = ProfileUML.getInstance();

 	

-	Profile cppProfile = new ProfileCpp();

-	Profile javaProfile = new ProfileJava();

+	Profile cppProfile = ProfileCpp.getInstance();

+	Profile javaProfile = ProfileJava.getInstance();

 	

 	ProfileManagerImpl.getInstance().registerProfile(cppProfile);

 	ProfileManagerImpl.getInstance().registerProfile(javaProfile);	


Modified: branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileCpp.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileCpp.java?view=diff&rev=13001&p1=branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileCpp.java&p2=branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileCpp.java&r1=13000&r2=13001
==============================================================================
--- branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileCpp.java	(original)
+++ branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileCpp.java	2007-07-08 13:09:34-0700
@@ -36,11 +36,23 @@
     private FormatingStrategy formatingStrategy;

     private ProfileModelLoader profileModelLoader;

     private Object model;

+    private static ProfileCpp instance;

+    

+    /**

+     * @return the unique instance for this profile

+     */

+    public static ProfileCpp getInstance() {

+        if (instance == null) {

+            instance = new ProfileCpp();

+        }

+        return instance;

+    }

 

+    

     /**

      * The default constructor for this class 

      */

-    public ProfileCpp() {

+    private ProfileCpp() {

 	profileModelLoader = new ResourceModelLoader();

 	model = profileModelLoader

 		.loadModel("/org/argouml/default-cpp.xmi");


Modified: branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileJava.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileJava.java?view=diff&rev=13001&p1=branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileJava.java&p2=branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileJava.java&r1=13000&r2=13001
==============================================================================
--- branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileJava.java	(original)
+++ branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileJava.java	2007-07-08 13:09:34-0700
@@ -36,11 +36,22 @@
     private FormatingStrategy formatingStrategy;

     private ProfileModelLoader profileModelLoader;

     private Object model;

-

+    private static ProfileJava instance;

+    

+    /**

+     * @return the unique instance for this profile

+     */

+    public static ProfileJava getInstance() {

+        if (instance == null) {

+            instance = new ProfileJava();

+        }

+        return instance;

+    }

+    

     /**

      * The default constructor for this class 

      */

-    public ProfileJava() {

+    private ProfileJava() {

 	profileModelLoader = new ResourceModelLoader();

 	model = profileModelLoader

 		.loadModel("/org/argouml/default-java.xmi");


Modified: branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileManagerImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileManagerImpl.java?view=diff&rev=13001&p1=branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileManagerImpl.java&p2=branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileManagerImpl.java&r1=13000&r2=13001
==============================================================================
--- branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileManagerImpl.java	(original)
+++ branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileManagerImpl.java	2007-07-08 13:09:34-0700
@@ -62,7 +62,9 @@
      * @see org.argouml.uml.profile.ProfileManager#registerProfile(org.argouml.uml.profile.Profile)

      */

     public void registerProfile(Profile p) {

-	profiles.add(p);

+        if (!profiles.contains(p)) {

+            profiles.add(p);

+        }

     }

 

     /**


Modified: branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileUML.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileUML.java?view=diff&rev=13001&p1=branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileUML.java&p2=branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileUML.java&r1=13000&r2=13001
==============================================================================
--- branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileUML.java	(original)
+++ branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileUML.java	2007-07-08 13:09:34-0700
@@ -36,11 +36,22 @@
     private FormatingStrategy formatingStrategy;

     private ProfileModelLoader profileModelLoader;

     private Object model;

-

+    private static ProfileUML instance;

+    

+    /**

+     * @return the unique instance for this profile

+     */

+    public static ProfileUML getInstance() {

+        if (instance == null) {

+            instance = new ProfileUML();

+        }

+        return instance;

+    }

+    

     /**

      * The default constructor for this class 

      */

-    public ProfileUML() {

+    private ProfileUML() {

         formatingStrategy = new JavaFormatingStrategy();

 	profileModelLoader = new ResourceModelLoader();

 	model = profileModelLoader
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.