diff options
author | Marko Živković <[email protected]> | 2014-12-17 00:26:30 +0000 |
---|---|---|
committer | Marko Živković <[email protected]> | 2014-12-17 00:26:30 +0000 |
commit | 1fd42f81c4a9884f5b702ab9ff854393b2dc5256 (patch) | |
tree | 6dd9d770bded4071dadc51a906e2a77bd36e5abd /logo/src/xlogo/kernel/userspace/files/LogoFile.java | |
parent | fadba92b2f3a41fa35ccadeb6deba540305ae5e6 (diff) |
- Limiting number of empty files to 4
- Fixed small issue, where another new line was appended to files whenever the file was opened
- Added translations for previously hard coded dialog messages.
git-svn-id: https://svn.code.sf.net/p/xlogo4schools/svn/trunk@13 3b0d7934-f7ef-4143-9606-b51f2e2281fd
Diffstat (limited to 'logo/src/xlogo/kernel/userspace/files/LogoFile.java')
-rw-r--r-- | logo/src/xlogo/kernel/userspace/files/LogoFile.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/logo/src/xlogo/kernel/userspace/files/LogoFile.java b/logo/src/xlogo/kernel/userspace/files/LogoFile.java index e4ace39..693e3f3 100644 --- a/logo/src/xlogo/kernel/userspace/files/LogoFile.java +++ b/logo/src/xlogo/kernel/userspace/files/LogoFile.java @@ -359,6 +359,14 @@ public class LogoFile extends StorableDocument implements ExecutablesContainer, return userConfig.getSourceDirectory();
}
+ /**
+ * More efficient test without generating entire text
+ */
+ @Override
+ public boolean isEmpty(){
+ return allProcedures.isEmpty() || (allProcedures.size() == 1 && allProcedures.get(0).getText().isEmpty());
+ }
+
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* SERIALIZATION AND DESERIALIZATION
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
@@ -374,6 +382,9 @@ public class LogoFile extends StorableDocument implements ExecutablesContainer, text.append(proc.getText());
text.append("\n");
}
+ if (text.length() > 0){
+ text.deleteCharAt(text.length() - 1);
+ }
return text.toString();
}
@@ -768,6 +779,5 @@ public class LogoFile extends StorableDocument implements ExecutablesContainer, for (ProcedureMapListener listener : procedureMapListeners)
listener.undefined(getPlainName(), procedure);
}
-
-
+
}
|