Author: maurelio1234
Date: 2007-07-12 05:54:03-0700
New Revision: 13061
Modified:
branches/gsoc2007/maurelio1234/src_new/org/argouml/persistence/ProfileConfigurationFilePersister.java
branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileConfiguration.java
branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileManager.java
branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileManagerImpl.java
Log:
solving bugs:
+ profile configuration not being saved
+ loading profile already registered
Modified: branches/gsoc2007/maurelio1234/src_new/org/argouml/persistence/ProfileConfigurationFilePersister.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/src_new/org/argouml/persistence/ProfileConfigurationFilePersister.java?view=diff&rev=13061&p1=branches/gsoc2007/maurelio1234/src_new/org/argouml/persistence/ProfileConfigurationFilePersister.java&p2=branches/gsoc2007/maurelio1234/src_new/org/argouml/persistence/ProfileConfigurationFilePersister.java&r1=13060&r2=13061
==============================================================================
--- branches/gsoc2007/maurelio1234/src_new/org/argouml/persistence/ProfileConfigurationFilePersister.java (original)
+++ branches/gsoc2007/maurelio1234/src_new/org/argouml/persistence/ProfileConfigurationFilePersister.java 2007-07-12 05:54:03-0700
@@ -117,13 +117,9 @@
line = br.readLine().trim();
} else if (line.equals("<plugin>")) {
String className = br.readLine().trim();
- for (int i = 0; i < profiles.size(); ++i) {
- Profile p = (Profile) profiles.get(i);
- if (p.getClass().getName().equals(className)) {
- profile = p;
- break;
- }
- }
+
+ profile = ProfileManagerImpl.getInstance()
+ .getProfileForClass(className);
line = br.readLine().trim();
}
@@ -165,6 +161,7 @@
throws SaveException {
PrintWriter w = new PrintWriter(stream);
saveProjectMember(member, w);
+ w.flush();
}
private void saveProjectMember(ProjectMember member, PrintWriter w)
@@ -181,7 +178,7 @@
while (it.hasNext()) {
Profile profile = (Profile) it.next();
- if (profile != pc.getDefaultProfile()) {
+ if (!pc.getDefaultProfile().equals(profile)) {
if (profile instanceof UserDefinedProfile) {
w.println("\t\t<userDefined>");
w.println("\t\t\t"
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=13061&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=13060&r2=13061
==============================================================================
--- 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-12 05:54:03-0700
@@ -119,13 +119,15 @@
* @param p the profile to be applied
*/
public void addProfile(Profile p) {
- profiles.add(p);
- profileModels.add(p.getModel());
-
- FigNodeStrategy fns = p.getFigureStrategy();
- if (fns != null) {
- figNodeStrategies.add(fns);
- }
+ if (!profiles.contains(p)) {
+ profiles.add(p);
+ profileModels.add(p.getModel());
+
+ FigNodeStrategy fns = p.getFigureStrategy();
+ if (fns != null) {
+ figNodeStrategies.add(fns);
+ }
+ }
}
/**
Modified: branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileManager.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileManager.java?view=diff&rev=13061&p1=branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileManager.java&p2=branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileManager.java&r1=13060&r2=13061
==============================================================================
--- branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileManager.java (original)
+++ branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileManager.java 2007-07-12 05:54:03-0700
@@ -48,5 +48,10 @@
/**
* @return the list of registered profiles
*/
- Vector getRegisteredProfiles();
+ Vector getRegisteredProfiles();
+
+ /**
+ * @return the profile instance for the class
+ */
+ Profile getProfileForClass(String className);
}
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=13061&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=13060&r2=13061
==============================================================================
--- 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-12 05:54:03-0700
@@ -24,6 +24,7 @@
package org.argouml.uml.profile;
+import java.util.Iterator;
import java.util.Vector;
/**
@@ -63,7 +64,9 @@
*/
public void registerProfile(Profile p) {
if (!profiles.contains(p)) {
- profiles.add(p);
+ if (getProfileForClass(p.getClass().getName()) == null) {
+ profiles.add(p);
+ }
}
}
@@ -75,4 +78,24 @@
profiles.remove(p);
}
+ /**
+ * @param profileClass the profile class
+ * @return the profile object or null if there is no one
+ * @see org.argouml.uml.profile.ProfileManager#getProfileForClass(java.lang.Class)
+ */
+ public Profile getProfileForClass(String profileClass) {
+ Iterator it = profiles.iterator();
+ Profile found = null;
+
+ while(it.hasNext()) {
+ Profile p = (Profile) it.next();
+ if (p.getClass().getName().equals(profileClass)) {
+ found = p;
+ break;
+ }
+ }
+
+ return found;
+ }
+
}
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.