mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
cleaning up the commit to fit style, deal with #2449
This commit is contained in:
+3
-31
@@ -56,37 +56,9 @@
|
||||
<!-- env used to set classpath below -->
|
||||
<property environment="env" />
|
||||
|
||||
<!-- moved to the main build script -->
|
||||
<!-- ant seems to nuke ${java.home} for some reason, pointing at the JRE
|
||||
subfolder instead of the actual JDK found at JAVA_HOME.
|
||||
To avoid this, we grab the actual JAVA_HOME environment variable
|
||||
and use that to specify the location of tools.jar. -->
|
||||
<!-- if someone is better with ant please help clean this up -->
|
||||
<!--
|
||||
<property name="java_home" value="${env.JAVA_HOME}" />
|
||||
<available file="${env.JAVA_HOME}/lib/tools.jar"
|
||||
property="java_tools_found" />
|
||||
|
||||
<condition property="linux">
|
||||
<and>
|
||||
<os family="unix" />
|
||||
<not>
|
||||
<os family="mac" />
|
||||
</not>
|
||||
</and>
|
||||
</condition>
|
||||
<fail if="linux" unless="java_tools_found"
|
||||
message="The JAVA_HOME variable must be set to the location of a full JDK. For instance, on Ubuntu Linux, this might be /usr/lib/jvm/java-6-sun." />
|
||||
|
||||
<condition property="windows">
|
||||
<os family="windows" />
|
||||
</condition>
|
||||
<fail if="windows" unless="java_tools_found"
|
||||
message="The JAVA_HOME variable must be set to the location of a full JDK. For instance, on Windows, this might be c:\jdk1.6.0_19." />
|
||||
-->
|
||||
|
||||
<javac source="1.7"
|
||||
target="1.7"
|
||||
<!-- need to stay at 1.6 until we update ecj.jar -->
|
||||
<javac source="1.6"
|
||||
target="1.6"
|
||||
destdir="bin"
|
||||
excludes="**/tools/format/**"
|
||||
encoding="UTF-8"
|
||||
|
||||
@@ -727,7 +727,7 @@ public class Base {
|
||||
if (!newbieFile.createNewFile()) {
|
||||
throw new IOException(newbieFile + " already exists.");
|
||||
}
|
||||
|
||||
|
||||
// Create sketch properties.
|
||||
final File sketchProps = new File(newbieDir, "sketch.properties");
|
||||
try {
|
||||
@@ -924,7 +924,7 @@ public class Base {
|
||||
}
|
||||
nextMode = mode;
|
||||
}
|
||||
|
||||
|
||||
// Editor.State state = new Editor.State(editors);
|
||||
Editor editor = nextMode.createEditor(this, path, state);
|
||||
if (editor == null) {
|
||||
@@ -994,23 +994,24 @@ public class Base {
|
||||
}
|
||||
|
||||
private Mode promptForMode(final File sketch, final ModeInfo preferredMode) {
|
||||
final String extension = sketch.getName().substring(sketch.getName().lastIndexOf('.') + 1);
|
||||
final List<Mode> possibleModes = new ArrayList<>();
|
||||
final String extension =
|
||||
sketch.getName().substring(sketch.getName().lastIndexOf('.') + 1);
|
||||
final List<Mode> possibleModes = new ArrayList<Mode>();
|
||||
for (final Mode mode : getModeList()) {
|
||||
if (mode.canEdit(sketch))
|
||||
if (mode.canEdit(sketch)) {
|
||||
possibleModes.add(mode);
|
||||
}
|
||||
}
|
||||
if (possibleModes.size() == 1
|
||||
&& possibleModes.get(0).getIdentifier()
|
||||
if (possibleModes.size() == 1 &&
|
||||
possibleModes.get(0).getIdentifier()
|
||||
.equals(JavaMode.class.getCanonicalName())) {
|
||||
// If default mode can open it, then do so without prompting.
|
||||
// If default mode can open it, then do so without prompting.
|
||||
return possibleModes.get(0);
|
||||
}
|
||||
if (possibleModes.size() == 0) {
|
||||
if (preferredMode == null) {
|
||||
Base
|
||||
.showWarning("Modeless Dialog",
|
||||
"I don't know how to open a sketch with the \""
|
||||
Base.showWarning("Modeless Dialog",
|
||||
"I don't know how to open a sketch with the \""
|
||||
+ extension
|
||||
+ "\"\nfile extension. You'll have to install a different"
|
||||
+ "\nProcessing mode for that.");
|
||||
@@ -1021,14 +1022,14 @@ public class Base {
|
||||
return null;
|
||||
}
|
||||
final Mode[] modes = possibleModes.toArray(new Mode[possibleModes.size()]);
|
||||
final String message = preferredMode == null ? nextMode.getTitle()
|
||||
+ " Mode can't open ."
|
||||
+ extension
|
||||
+ " files, but you have one or more modes\ninstalled that can. Would you like to try one?"
|
||||
: "That's a " + preferredMode.title + " Mode sketch, but you don't have "
|
||||
+ preferredMode.title
|
||||
+ " installed.\nWould you like to try a different mode for opening a ."
|
||||
+ extension + " sketch?";
|
||||
final String message = preferredMode == null ?
|
||||
(nextMode.getTitle() + " Mode can't open ." + extension + " files, " +
|
||||
"but you have one or more modes\ninstalled that can. " +
|
||||
"Would you like to try one?") :
|
||||
("That's a " + preferredMode.title + " Mode sketch, " +
|
||||
"but you don't have " + preferredMode.title + " installed.\n" +
|
||||
"Would you like to try a different mode for opening a " +
|
||||
"." + extension + " sketch?");
|
||||
return (Mode) JOptionPane.showInputDialog(null, message, "Modal Dialog",
|
||||
JOptionPane.QUESTION_MESSAGE,
|
||||
null, modes, modes[0]);
|
||||
|
||||
Reference in New Issue
Block a user