svn commit: r15513 - trunk/src/argouml-app/src/org/argouml/profile/internal/ProfileManagerImpl.java
| Newsgroups | gmane.comp.lang.uml.argouml.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: thn
Date: 2008-08-05 13:47:25-0700
New Revision: 15513
Modified:
trunk/src/argouml-app/src/org/argouml/profile/internal/ProfileManagerImpl.java
Log:
Issue 5101: All ArgoUML supported XMI file extensions should be allowed
(I forgot to support all file extensions for the Refresh from the Standard XMI directories)
Modified: trunk/src/argouml-app/src/org/argouml/profile/internal/ProfileManagerImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/profile/internal/ProfileManagerImpl.java?view=diff&rev=15513&p1=trunk/src/argouml-app/src/org/argouml/profile/internal/ProfileManagerImpl.java&p2=trunk/src/argouml-app/src/org/argouml/profile/internal/ProfileManagerImpl.java&r1=15512&r2=15513
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/profile/internal/ProfileManagerImpl.java (original)
+++ trunk/src/argouml-app/src/org/argouml/profile/internal/ProfileManagerImpl.java 2008-08-05 13:47:25-0700
@@ -40,6 +40,7 @@
import org.argouml.profile.ProfileException;
import org.argouml.profile.ProfileManager;
import org.argouml.profile.UserDefinedProfile;
+import org.argouml.profile.UserDefinedProfileHelper;
/**
* Default <code>ProfileManager</code> implementation
@@ -291,28 +292,35 @@
public void refreshRegisteredProfiles() {
+ ArrayList<File> dirs = new ArrayList<File>();
+
for (String dirName : searchDirectories) {
File dir = new File(dirName);
-
if (dir.exists()) {
- for (File file : dir.listFiles()) {
- // TODO: Allow .zargo as profile as well?
- if (file.getName().toLowerCase().endsWith(".xmi")) {
-
- boolean found =
- findUserDefinedProfile(file) != null;
-
- if (!found) {
- UserDefinedProfile udp = null;
- try {
- udp = new UserDefinedProfile(file);
- registerProfile(udp);
- } catch (ProfileException e) {
- // if an exception is raised file is unusable
- LOG.warn("Failed to load user defined profile "
- + file.getAbsolutePath() + ".", e);
- }
- }
+ dirs.add(dir);
+ }
+ }
+
+ if (!dirs.isEmpty()) {
+ // TODO: Allow .zargo as profile as well?
+ File[] fileArray = new File[dirs.size()];
+ for (int i = 0; i < dirs.size(); i++) {
+ fileArray[i] = dirs.get(i);
+ }
+ List<File> dirList
+ = UserDefinedProfileHelper.getFileList(fileArray);
+ for (File file : dirList) {
+ boolean found =
+ findUserDefinedProfile(file) != null;
+ if (!found) {
+ UserDefinedProfile udp = null;
+ try {
+ udp = new UserDefinedProfile(file);
+ registerProfile(udp);
+ } catch (ProfileException e) {
+ // if an exception is raised file is unusable
+ LOG.warn("Failed to load user defined profile "
+ + file.getAbsolutePath() + ".", e);
}
}
}