mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-16 11:21:18 +03:00
fixed java 1.5 compatibility issue
moved unknown AutoFormat class to external folder
This commit is contained in:
@ -37,10 +37,9 @@
|
|||||||
<echo message="override ${env.JAVA_HOME}/lib/tools.jar" />
|
<echo message="override ${env.JAVA_HOME}/lib/tools.jar" />
|
||||||
<fail />
|
<fail />
|
||||||
-->
|
-->
|
||||||
<javac target="1.5"
|
<javac source="1.5" target="1.5"
|
||||||
srcdir="src"
|
srcdir="src"
|
||||||
destdir="bin"
|
destdir="bin"
|
||||||
excludes="**/tools/format/**"
|
|
||||||
encoding="UTF-8"
|
encoding="UTF-8"
|
||||||
includeAntRuntime="false"
|
includeAntRuntime="false"
|
||||||
debug="true"
|
debug="true"
|
||||||
|
@ -34,7 +34,7 @@ import java.io.*;
|
|||||||
* <A HREF="http://jalopy.sourceforge.net/">Jalopy</A>. This is to replace
|
* <A HREF="http://jalopy.sourceforge.net/">Jalopy</A>. This is to replace
|
||||||
* the buggy code formatter found in previous releases.
|
* the buggy code formatter found in previous releases.
|
||||||
*/
|
*/
|
||||||
public class AutoFormat {
|
public class AutoFormat {
|
||||||
Editor editor;
|
Editor editor;
|
||||||
|
|
||||||
|
|
@ -29,7 +29,6 @@ import java.util.*;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.filechooser.FileNameExtensionFilter;
|
|
||||||
|
|
||||||
import processing.app.debug.TargetPackage;
|
import processing.app.debug.TargetPackage;
|
||||||
import processing.app.debug.TargetPlatform;
|
import processing.app.debug.TargetPlatform;
|
||||||
@ -38,7 +37,7 @@ import processing.app.helpers.Maps;
|
|||||||
import processing.app.helpers.PreferencesMap;
|
import processing.app.helpers.PreferencesMap;
|
||||||
import processing.app.helpers.filefilters.OnlyDirs;
|
import processing.app.helpers.filefilters.OnlyDirs;
|
||||||
import processing.app.helpers.filefilters.OnlyFilesWithExtension;
|
import processing.app.helpers.filefilters.OnlyFilesWithExtension;
|
||||||
import processing.app.tools.MapWithSubkeys;
|
import processing.app.javax.swing.filechooser.FileNameExtensionFilter;import processing.app.tools.MapWithSubkeys;
|
||||||
import processing.app.tools.ZipDeflater;
|
import processing.app.tools.ZipDeflater;
|
||||||
import processing.core.*;
|
import processing.core.*;
|
||||||
import static processing.app.I18n._;
|
import static processing.app.I18n._;
|
||||||
|
@ -32,7 +32,6 @@ import java.io.FilenameFilter;
|
|||||||
*/
|
*/
|
||||||
public class OnlyDirs implements FilenameFilter {
|
public class OnlyDirs implements FilenameFilter {
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean accept(File dir, String name) {
|
public boolean accept(File dir, String name) {
|
||||||
if (name.charAt(0) == '.')
|
if (name.charAt(0) == '.')
|
||||||
return false;
|
return false;
|
||||||
|
@ -32,7 +32,6 @@ public class OnlyFilesWithExtension implements FilenameFilter {
|
|||||||
extensions = ext;
|
extensions = ext;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean accept(File dir, String name) {
|
public boolean accept(File dir, String name) {
|
||||||
for (String ext : extensions)
|
for (String ext : extensions)
|
||||||
if (name.endsWith(ext))
|
if (name.endsWith(ext))
|
||||||
|
@ -0,0 +1,48 @@
|
|||||||
|
package processing.app.javax.swing.filechooser;
|
||||||
|
|
||||||
|
import javax.swing.filechooser.FileFilter;
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
public class FileNameExtensionFilter extends FileFilter {
|
||||||
|
|
||||||
|
private final String description;
|
||||||
|
private final String[] extensions;
|
||||||
|
|
||||||
|
public FileNameExtensionFilter(String description, String... exts) {
|
||||||
|
this.description = description;
|
||||||
|
this.extensions = new String[exts.length];
|
||||||
|
for (int i = 0; i < exts.length; i++) {
|
||||||
|
this.extensions[i] = exts[i].toLowerCase(Locale.ENGLISH);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean accept(File f) {
|
||||||
|
if (f == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (f.isDirectory()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
String fileName = f.getName();
|
||||||
|
int i = fileName.lastIndexOf('.');
|
||||||
|
if (i > 0 && i < fileName.length() - 1) {
|
||||||
|
String fileExtension = fileName.substring(i + 1).toLowerCase(Locale.ENGLISH);
|
||||||
|
for (String extension : extensions) {
|
||||||
|
if (extension.equals(fileExtension)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
}
|
@ -13,7 +13,7 @@
|
|||||||
<methods dir="${basedir}/src/processing/core" />
|
<methods dir="${basedir}/src/processing/core" />
|
||||||
|
|
||||||
<mkdir dir="bin" />
|
<mkdir dir="bin" />
|
||||||
<javac target="1.5"
|
<javac source="1.5" target="1.5"
|
||||||
encoding="UTF-8"
|
encoding="UTF-8"
|
||||||
includeAntRuntime="false"
|
includeAntRuntime="false"
|
||||||
srcdir="src" destdir="bin"/>
|
srcdir="src" destdir="bin"/>
|
||||||
|
Reference in New Issue
Block a user