mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
check if the app is run from Jar directly
This commit is contained in:
@@ -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;default/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.default"/> </sourceContainers> </sourceLookupDirector> "/>
|
<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;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.MAIN_TYPE" value="org.diylc.DIYLCStarter"/>
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="diylc-swing"/>
|
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="diylc-swing"/>
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms256m -Xmx512m -Ddorg.diylc.debugComponentAreas=true"/>
|
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms256m -Xmx512m -Dorg.diylc.scriptRun=true -Ddorg.diylc.debugComponentAreas=true"/>
|
||||||
</launchConfiguration>
|
</launchConfiguration>
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
-Xms512m -Xmx1024m -Dorg.diylc.scriptRun=true
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
java -Xms512m -Xmx2048m -Dorg.diylc.scriptRun=true -cp diylc.jar:lib org.diylc.DIYLCStarter
|
||||||
+20
-1
@@ -4,6 +4,7 @@ import java.io.FileInputStream;
|
|||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import javax.swing.JOptionPane;
|
||||||
import javax.swing.UIManager;
|
import javax.swing.UIManager;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
@@ -26,6 +27,8 @@ public class DIYLCStarter {
|
|||||||
|
|
||||||
private static final Logger LOG = Logger.getLogger(DIYLCStarter.class);
|
private static final Logger LOG = Logger.getLogger(DIYLCStarter.class);
|
||||||
|
|
||||||
|
private static final String SCRIPT_RUN = "org.diylc.scriptRun";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param args
|
* @param args
|
||||||
*/
|
*/
|
||||||
@@ -52,6 +55,22 @@ public class DIYLCStarter {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.error("Could not set Look&Feel", e);
|
LOG.error("Could not set Look&Feel", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String val = System.getProperty(SCRIPT_RUN);
|
||||||
|
if (!"true".equals(val)) {
|
||||||
|
int response = JOptionPane
|
||||||
|
.showConfirmDialog(
|
||||||
|
null,
|
||||||
|
"It is not recommended to run DIYLC by clicking on the diylc.jar file.\n" +
|
||||||
|
"Please use diylc.exe on Windows and run.sh on OSX/Linux because they\n" +
|
||||||
|
"will configure your Java for the best performance and reliability.\n" +
|
||||||
|
"Do you want to continue using the application?",
|
||||||
|
"DIYLC", JOptionPane.YES_NO_OPTION,
|
||||||
|
JOptionPane.WARNING_MESSAGE);
|
||||||
|
if (response != JOptionPane.YES_OPTION) {
|
||||||
|
System.exit(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MainFrame mainFrame = new MainFrame();
|
MainFrame mainFrame = new MainFrame();
|
||||||
mainFrame.setLocationRelativeTo(null);
|
mainFrame.setLocationRelativeTo(null);
|
||||||
@@ -69,7 +88,7 @@ public class DIYLCStarter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
properties = new Properties();
|
properties = new Properties();
|
||||||
try {
|
try {
|
||||||
LOG.info("Injecting default properties.");
|
LOG.info("Injecting default properties.");
|
||||||
|
|||||||
Reference in New Issue
Block a user