Author: mvw
Date: 2007-07-23 01:48:23-0700
New Revision: 13111
Removed:
trunk/src_new/org/argouml/uml/generator/GenerationPreferences.java
Modified:
trunk/src_new/org/argouml/kernel/Project.java
trunk/src_new/org/argouml/kernel/ProjectImpl.java
trunk/src_new/org/argouml/kernel/ProjectSettings.java
trunk/src_new/org/argouml/persistence/ArgoParser.java
trunk/src_new/org/argouml/persistence/ArgoTokenTable.java
trunk/src_new/org/argouml/persistence/argo.tee
trunk/src_new/org/argouml/uml/generator/ui/ClassGenerationDialog.java
Log:
Get rid of separate GenerationPreferences, according Tom's TODO comment.
This will easy reducing package cycles through the kernel.
Also: make generation default export dir persist in the project.
Modified: trunk/src_new/org/argouml/kernel/Project.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/kernel/Project.java?view=diff&rev=13111&p1=trunk/src_new/org/argouml/kernel/Project.java&p2=trunk/src_new/org/argouml/kernel/Project.java&r1=13110&r2=13111
==============================================================================
--- trunk/src_new/org/argouml/kernel/Project.java (original)
+++ trunk/src_new/org/argouml/kernel/Project.java 2007-07-23 01:48:23-0700
@@ -35,7 +35,6 @@
import org.argouml.uml.Profile;
import org.argouml.uml.diagram.ArgoDiagram;
-import org.argouml.uml.generator.GenerationPreferences;
import org.tigris.gef.presentation.Fig;
/**
@@ -394,18 +393,6 @@
public Object getInitialTarget();
/**
- * @param cgp the generation preferences
- * TODO: Move to ProjectSettings - tfm
- */
- public void setGenerationPrefs(GenerationPreferences cgp);
-
- /**
- * @return the generation preferences
- * TODO: Move to ProjectSettings - tfm
- */
- public GenerationPreferences getGenerationPrefs();
-
- /**
* @return the VetoableChangeSupport
*/
public VetoableChangeSupport getVetoSupport();
Modified: trunk/src_new/org/argouml/kernel/ProjectImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/kernel/ProjectImpl.java?view=diff&rev=13111&p1=trunk/src_new/org/argouml/kernel/ProjectImpl.java&p2=trunk/src_new/org/argouml/kernel/ProjectImpl.java&r1=13110&r2=13111
==============================================================================
--- trunk/src_new/org/argouml/kernel/ProjectImpl.java (original)
+++ trunk/src_new/org/argouml/kernel/ProjectImpl.java 2007-07-23 01:48:23-0700
@@ -59,7 +59,6 @@
import org.argouml.uml.cognitive.ProjectMemberTodoList;
import org.argouml.uml.diagram.ArgoDiagram;
import org.argouml.uml.diagram.ProjectMemberDiagram;
-import org.argouml.uml.generator.GenerationPreferences;
import org.tigris.gef.presentation.Fig;
import org.tigris.gef.undo.Memento;
import org.tigris.gef.undo.UndoManager;
@@ -129,7 +128,6 @@
private Object defaultModel;
private Object currentNamespace;
private Map<String, Object> uuidRefs;
- private GenerationPreferences cgPrefs;
private transient VetoableChangeSupport vetoSupport;
private Profile profile;
@@ -174,7 +172,6 @@
searchpath = new ArrayList<String>();
historyFile = "";
- cgPrefs = new GenerationPreferences();
defaultModelTypeCache = new HashMap<String, Object>();
LOG.info("making empty project with empty model");
@@ -778,16 +775,6 @@
}
- public void setGenerationPrefs(GenerationPreferences cgp) {
- cgPrefs = cgp;
- }
-
-
- public GenerationPreferences getGenerationPrefs() {
- return cgPrefs;
- }
-
-
public VetoableChangeSupport getVetoSupport() {
if (vetoSupport == null) {
vetoSupport = new VetoableChangeSupport(this);
@@ -1069,7 +1056,6 @@
historyFile = null;
defaultModel = null;
currentNamespace = null;
- cgPrefs = null;
vetoSupport = null;
activeDiagram = null;
Modified: trunk/src_new/org/argouml/kernel/ProjectSettings.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/kernel/ProjectSettings.java?view=diff&rev=13111&p1=trunk/src_new/org/argouml/kernel/ProjectSettings.java&p2=trunk/src_new/org/argouml/kernel/ProjectSettings.java&r1=13110&r2=13111
==============================================================================
--- trunk/src_new/org/argouml/kernel/ProjectSettings.java (original)
+++ trunk/src_new/org/argouml/kernel/ProjectSettings.java 2007-07-23 01:48:23-0700
@@ -26,6 +26,7 @@
import java.beans.PropertyChangeEvent;
+import org.argouml.application.api.Argo;
import org.argouml.application.events.ArgoEventPump;
import org.argouml.application.events.ArgoEventTypes;
import org.argouml.application.events.ArgoNotationEvent;
@@ -42,7 +43,11 @@
*
* Most getters return a string, since they are used by "argo.tee".
* This is also the reason all these attributes
- * are not part of a Map or something.
+ * are not part of a Map or something. <p>
+ *
+ * TODO: The header comment is curently not used - this function
+ * is not completely implemented yet. How do we store this in the project?
+ * Where should the user enter his header comment? See issue 4813.
*
* @author michiel
*/
@@ -60,6 +65,11 @@
private boolean showStereotypes;
private boolean showSingularMultiplicities;
private int defaultShadowWidth;
+
+ /* Generation preferences: */
+ private String headerComment =
+ "Your copyright and other header comments";
+ private String generationOutputDir;
/**
@@ -104,6 +114,17 @@
Notation.KEY_SHOW_SINGULAR_MULTIPLICITIES, true);
defaultShadowWidth = Configuration.getInteger(
Notation.KEY_DEFAULT_SHADOW_WIDTH, 1);
+
+ /* Generation preferences: */
+ if (System.getProperty("file.separator").equals("/")) {
+ generationOutputDir = "/tmp";
+ } else {
+ //This does not even exist on many systems:
+ //_outputDir = "c:\\temp";
+ generationOutputDir = System.getProperty("java.io.tmpdir");
+ }
+ generationOutputDir = Configuration.getString(
+ Argo.KEY_MOST_RECENT_EXPORT_DIRECTORY, generationOutputDir);
}
@@ -672,6 +693,33 @@
setDefaultShadowWidth(Integer.parseInt(width));
}
+ /**
+ * Used by "argo.tee".
+ *
+ * @return the output directory name
+ */
+ public String getGenerationOutputDir() {
+ return generationOutputDir;
+ }
+
+ /**
+ * @param od the output directory name
+ */
+ public void setGenerationOutputDir(String od) {
+ generationOutputDir = od;
+ Configuration.setString(Argo.KEY_MOST_RECENT_EXPORT_DIRECTORY, od);
+ }
+
+ /**
+ * @return the header comment string
+ */
+ public String getHeaderComment() { return headerComment; }
+
+ /**
+ * @param c the header comment string
+ */
+ public void setHeaderComment(String c) { headerComment = c; }
+
/**
* Convenience methods to fire notation configuration change events.
Modified: trunk/src_new/org/argouml/persistence/ArgoParser.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/persistence/ArgoParser.java?view=diff&rev=13111&p1=trunk/src_new/org/argouml/persistence/ArgoParser.java&p2=trunk/src_new/org/argouml/persistence/ArgoParser.java&r1=13110&r2=13111
==============================================================================
--- trunk/src_new/org/argouml/persistence/ArgoParser.java (original)
+++ trunk/src_new/org/argouml/persistence/ArgoParser.java 2007-07-23 01:48:23-0700
@@ -200,6 +200,9 @@
case ArgoTokenTable.TOKEN_DEFAULTSHADOWWIDTH:
handleDefaultShadowWidth(e);
break;
+ case ArgoTokenTable.TOKEN_GENERATION_OUTPUT_DIR:
+ handleGenerationOutputDir(e);
+ break;
default:
if (DBG) {
LOG.warn("WARNING: unknown end tag:" + e.getName());
@@ -385,7 +388,15 @@
String dsw = e.getText().trim();
ps.setDefaultShadowWidth(dsw);
}
-
+
+ /**
+ * @param e the element
+ */
+ protected void handleGenerationOutputDir(XMLElement e) {
+ String dsw = e.getText().trim();
+ ps.setGenerationOutputDir(dsw);
+ }
+
/**
* Get the numer of diagram members read.
* @return the numer of diagram members read.
Modified: trunk/src_new/org/argouml/persistence/ArgoTokenTable.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/persistence/ArgoTokenTable.java?view=diff&rev=13111&p1=trunk/src_new/org/argouml/persistence/ArgoTokenTable.java&p2=trunk/src_new/org/argouml/persistence/ArgoTokenTable.java&r1=13110&r2=13111
==============================================================================
--- trunk/src_new/org/argouml/persistence/ArgoTokenTable.java (original)
+++ trunk/src_new/org/argouml/persistence/ArgoTokenTable.java 2007-07-23 01:48:23-0700
@@ -64,6 +64,8 @@
private static final String STRING_SHOWSTEREOTYPES = "showstereotypes";
private static final String STRING_DEFAULTSHADOWWIDTH
= "defaultshadowwidth";
+ private static final String STRING_GENERATION_OUTPUT_DIR
+ = "generationoutputdir";
/** The token for argo. */
public static final int TOKEN_ARGO = 1;
@@ -106,7 +108,8 @@
public static final int TOKEN_DEFAULTSHADOWWIDTH = 19;
/** A token for Notation Settings. */
public static final int TOKEN_SHOWBOLDNAMES = 20;
-
+ /** A token for Generation Settings. */
+ public static final int TOKEN_GENERATION_OUTPUT_DIR = 21;
/** The token for undefined. */
public static final int TOKEN_UNDEFINED = 99;
@@ -139,6 +142,8 @@
addToken(STRING_SHOWSTEREOTYPES, new Integer(TOKEN_SHOWSTEREOTYPES));
addToken(STRING_DEFAULTSHADOWWIDTH,
new Integer(TOKEN_DEFAULTSHADOWWIDTH));
+ addToken(STRING_GENERATION_OUTPUT_DIR,
+ new Integer(TOKEN_GENERATION_OUTPUT_DIR));
}
} /* end class ArgoTokenTable */
Modified: trunk/src_new/org/argouml/persistence/argo.tee
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/persistence/argo.tee?view=diff&rev=13111&p1=trunk/src_new/org/argouml/persistence/argo.tee&p2=trunk/src_new/org/argouml/persistence/argo.tee&r1=13110&r2=13111
==============================================================================
--- trunk/src_new/org/argouml/persistence/argo.tee (original)
+++ trunk/src_new/org/argouml/persistence/argo.tee 2007-07-23 01:48:23-0700
@@ -41,6 +41,7 @@
<showstereotypes><ocl>self.projectSettings.showStereotypes</ocl></showstereotypes>
<showsingularmultiplicities><ocl>self.projectSettings.showSingularMultiplicities</ocl></showsingularmultiplicities>
<defaultshadowwidth><ocl>self.projectSettings.defaultShadowWidth</ocl></defaultshadowwidth>
+ <generationoutputdir><ocl>self.projectSettings.generationOutputDir</ocl></generationoutputdir>
</settings>
<searchpath href="<ocl>self.searchPath</ocl>" />
Removed: trunk/src_new/org/argouml/uml/generator/GenerationPreferences.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/generator/GenerationPreferences.java?view=auto&rev=13110
Modified: trunk/src_new/org/argouml/uml/generator/ui/ClassGenerationDialog.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/generator/ui/ClassGenerationDialog.java?view=diff&rev=13111&p1=trunk/src_new/org/argouml/uml/generator/ui/ClassGenerationDialog.java&p2=trunk/src_new/org/argouml/uml/generator/ui/ClassGenerationDialog.java&r1=13110&r2=13111
==============================================================================
--- trunk/src_new/org/argouml/uml/generator/ui/ClassGenerationDialog.java (original)
+++ trunk/src_new/org/argouml/uml/generator/ui/ClassGenerationDialog.java 2007-07-23 01:48:23-0700
@@ -226,7 +226,7 @@
Project p = ProjectManager.getManager().getCurrentProject();
outputDirectoryComboBox.getModel().setSelectedItem(
- p.getGenerationPrefs().getOutputDir());
+ p.getProjectSettings().getGenerationOutputDir());
}
/*
@@ -276,7 +276,7 @@
Collection entries = new TreeSet();
Project p = ProjectManager.getManager().getCurrentProject();
- entries.add(p.getGenerationPrefs().getOutputDir());
+ entries.add(p.getProjectSettings().getGenerationOutputDir());
final String pathSep = System.getProperty("path.separator");
StringTokenizer allEntries = new StringTokenizer(classpath, pathSep);
@@ -302,7 +302,7 @@
((String) outputDirectoryComboBox.getModel()
.getSelectedItem()).trim();
Project p = ProjectManager.getManager().getCurrentProject();
- p.getGenerationPrefs().setOutputDir(path);
+ p.getProjectSettings().setGenerationOutputDir(path);
List[] fileNames = new Vector[languages.size()];
for (int i = 0; i < languages.size(); i++) {
fileNames[i] = new Vector();
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.