Removed duplicate version fields in Base class

This commit is contained in:
Cristian Maglie 2014-11-18 14:04:14 +01:00
parent 13fd27704f
commit b0bd52b387
6 changed files with 11 additions and 37 deletions

View File

@ -58,11 +58,6 @@ import static processing.app.I18n._;
* files and images, etc) that comes from that.
*/
public class Base {
public static final int REVISION = BaseNoGui.REVISION;
/** This might be replaced by main() if there's a lib/version.txt file. */
static String VERSION_NAME = BaseNoGui.VERSION_NAME;
/** Set true if this a proper release rather than a numbered revision. */
static public boolean RELEASE = BaseNoGui.RELEASE;
static private boolean commandLine;
@ -104,8 +99,6 @@ public class Base {
BaseNoGui.initParameters(args);
BaseNoGui.initVersion();
VERSION_NAME = BaseNoGui.VERSION_NAME;
RELEASE = BaseNoGui.RELEASE;
// if (System.getProperty("mrj.version") != null) {
// //String jv = System.getProperty("java.version");
@ -1509,7 +1502,7 @@ public class Base {
g.setFont(new Font("SansSerif", Font.PLAIN, 11));
g.setColor(Color.white);
g.drawString(VERSION_NAME, 50, 30);
g.drawString(BaseNoGui.VERSION_NAME, 50, 30);
}
};
window.addMouseListener(new MouseAdapter() {

View File

@ -2208,13 +2208,8 @@ public class Editor extends JFrame implements RunnerListener {
}
header.rebuild();
// Set the title of the window to "sketch_070752a - Processing 0126"
setTitle(
I18n.format(
_("{0} | Arduino {1}"),
sketch.getName(),
Base.VERSION_NAME
)
);
setTitle(I18n.format(_("{0} | Arduino {1}"), sketch.getName(),
BaseNoGui.VERSION_NAME));
// Disable untitled setting from previous document, if any
untitled = false;

View File

@ -464,7 +464,7 @@ public class EditorStatus extends JPanel /*implements ActionListener*/ {
copyErrorButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String message = "";
message += _("Arduino: ") + Base.VERSION_NAME + " (" + System.getProperty("os.name") + "), ";
message += _("Arduino: ") + BaseNoGui.VERSION_NAME + " (" + System.getProperty("os.name") + "), ";
message += _("Board: ") + "\"" + Base.getBoardPreferences().get("name") + "\"\n\n";
message += editor.console.consoleTextPane.getText().trim();
if ((Preferences.getBoolean("build.verbose")) == false) {

View File

@ -79,7 +79,7 @@ public class UpdateCheck implements Runnable {
try {
String info;
info = URLEncoder.encode(id + "\t" +
PApplet.nf(Base.REVISION, 4) + "\t" +
PApplet.nf(BaseNoGui.REVISION, 4) + "\t" +
System.getProperty("java.version") + "\t" +
System.getProperty("java.vendor") + "\t" +
System.getProperty("os.name") + "\t" +
@ -104,7 +104,7 @@ public class UpdateCheck implements Runnable {
"would you like to visit the Arduino download page?");
if (base.activeEditor != null) {
if (latest > Base.REVISION) {
if (latest > BaseNoGui.REVISION) {
Object[] options = { _("Yes"), _("No") };
int result = JOptionPane.showOptionDialog(base.activeEditor,
prompt,

View File

@ -41,11 +41,10 @@ import processing.app.packages.LibraryList;
public class BaseNoGui {
/** Version string to be used for build */
public static final int REVISION = 158;
/** This might be replaced by main() if there's a lib/version.txt file. */
static String VERSION_NAME = "0158";
/** Set true if this a proper release rather than a numbered revision. */
static public boolean RELEASE = false;
/** Extended version string displayed on GUI */
static String VERSION_NAME = "1.5.8";
static File buildFolder;
@ -608,19 +607,6 @@ public class BaseNoGui {
}
static public void initVersion() {
try {
File versionFile = getContentFile("lib/version.txt");
if (versionFile.exists()) {
String version = PApplet.loadStrings(versionFile)[0];
if (!version.equals(VERSION_NAME) && !version.equals("${version}")) {
VERSION_NAME = version;
RELEASE = true;
}
}
} catch (Exception e) {
e.printStackTrace();
}
// help 3rd party installers find the correct hardware path
PreferencesData.set("last.ide." + VERSION_NAME + ".hardwarepath", getHardwarePath());
PreferencesData.set("last.ide." + VERSION_NAME + ".daterun", "" + (new Date()).getTime() / 1000);

View File

@ -169,11 +169,11 @@
<tokenfilter>
<linetokenizer />
<containsregex pattern="String VERSION_NAME = "/>
<replaceregex pattern="[^0-9]*" flags="g" replace=""/>
<replaceregex pattern=".*&quot;(.*)&quot;.*" flags="g" replace="\1"/>
</tokenfilter>
</filterchain>
</loadfile>
<echo message="Revision in BaseNoGui.java is: ${revision.base}" />
<echo message=" Revision in BaseNoGui.java is: ${revision.base}" />
</target>
<!-- - - - - - - - -->