mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-11 01:32:08 +10:00
add a parameter to automatically store variants to variants.xml
This commit is contained in:
@@ -27,8 +27,10 @@ import java.awt.geom.Area;
|
||||
import java.awt.geom.Point2D;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.ArrayList;
|
||||
@@ -2191,7 +2193,32 @@ public class Presenter implements IPlugInPort {
|
||||
|
||||
templates.add(template);
|
||||
|
||||
ConfigurationManager.getInstance().writeValue(TEMPLATES_KEY, templateMap);
|
||||
if (System.getProperty("org.diylc.WriteStaticVariants", "false").equalsIgnoreCase("true"))
|
||||
{
|
||||
if (defaultVariantMap == null)
|
||||
defaultVariantMap = new HashMap<String, List<Template>>();
|
||||
// unify default and user-variants
|
||||
for(Map.Entry<String, List<Template>> entry : templateMap.entrySet()) {
|
||||
if (defaultVariantMap.containsKey(entry.getKey())) {
|
||||
defaultVariantMap.get(entry.getKey()).addAll(entry.getValue());
|
||||
} else {
|
||||
defaultVariantMap.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
try {
|
||||
BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream("variants.xml"));
|
||||
XStream xStream = new XStream(new DomDriver());
|
||||
xStream.toXML(defaultVariantMap, out);
|
||||
out.close();
|
||||
// no more user variants
|
||||
ConfigurationManager.getInstance().writeValue(TEMPLATES_KEY, null);
|
||||
LOG.info("Saved default variants");
|
||||
} catch (IOException e) {
|
||||
LOG.error("Could not save default variants", e);
|
||||
}
|
||||
} else {
|
||||
ConfigurationManager.getInstance().writeValue(TEMPLATES_KEY, templateMap);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
Binary file not shown.
@@ -11,5 +11,5 @@
|
||||
<stringAttribute key="org.eclipse.debug.core.source_locator_memento" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <sourceLookupDirector> <sourceContainers duplicates="false"> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;javaProject name=&quot;Library&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.javaProject"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;javaProject name=&quot;DIYLC&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.javaProject"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;javaProject name=&quot;diylc-core&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.javaProject"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;javaProject name=&quot;diylc-library&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.javaProject"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;default/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.default"/> </sourceContainers> </sourceLookupDirector> "/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.diylc.DIYLCStarter"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="diylc-swing"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-splash:splash.png -Xms256m -Xmx512m -Dorg.diylc.scriptRun=true -Ddorg.diylc.debugContinuityAreas=true"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-splash:splash.png -Xms256m -Xmx512m -Dorg.diylc.scriptRun=true -Ddorg.diylc.debugContinuityAreas=true -Dorg.diylc.WriteStaticVariants=true"/>
|
||||
</launchConfiguration>
|
||||
|
||||
Binary file not shown.
+1294
-470
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user