Skip to content

Commit 1ea839f

Browse files
authored
Merge pull request #28 from acardona/file-system-tree
File system tree for the Script Editor
2 parents 6965813 + 49bd653 commit 1ea839f

File tree

6 files changed

+1517
-364
lines changed

6 files changed

+1517
-364
lines changed

pom.xml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010
</parent>
1111

1212
<artifactId>script-editor</artifactId>
13-
<version>0.4.1-SNAPSHOT</version>
13+
<version>0.5.0-SNAPSHOT</version>
1414

1515
<name>SciJava Script Editor</name>
1616
<description>Script Editor and Interpreter for SciJava script languages.</description>
1717
<url>https://github.com/scijava/script-editor</url>
1818
<inceptionYear>2009</inceptionYear>
1919
<organization>
2020
<name>SciJava</name>
21-
<url>http://scijava.org/</url>
21+
<url>https://scijava.org/</url>
2222
</organization>
2323
<licenses>
2424
<license>
@@ -31,7 +31,7 @@
3131
<developer>
3232
<id>ctrueden</id>
3333
<name>Curtis Rueden</name>
34-
<url>http://imagej.net/User:Rueden</url>
34+
<url>https://imagej.net/User:Rueden</url>
3535
<roles>
3636
<role>lead</role>
3737
<role>developer</role>
@@ -45,7 +45,7 @@
4545
<contributors>
4646
<contributor>
4747
<name>Johannes Schindelin</name>
48-
<url>http://imagej.net/User:Schindelin</url>
48+
<url>https://imagej.net/User:Schindelin</url>
4949
<roles><role>founder</role></roles>
5050
<properties><id>dscho</id></properties>
5151
</contributor>
@@ -55,12 +55,12 @@
5555
</contributor>
5656
<contributor>
5757
<name>Albert Cardona</name>
58-
<url>http://imagej.net/User:Albertcardona</url>
58+
<url>https://imagej.net/User:Albertcardona</url>
5959
<properties><id>acardona</id></properties>
6060
</contributor>
6161
<contributor>
6262
<name>Jan Eglinger</name>
63-
<url>http://imagej.net/User:Eglinger</url>
63+
<url>https://imagej.net/User:Eglinger</url>
6464
<properties><id>imagejan</id></properties>
6565
</contributor>
6666
<contributor>
@@ -73,40 +73,40 @@
7373
</contributor>
7474
<contributor>
7575
<name>Stefan Helfrich</name>
76-
<url>http://imagej.net/User:Stelfrich</url>
76+
<url>https://imagej.net/User:Stelfrich</url>
7777
<properties><id>stelfrich</id></properties>
7878
</contributor>
7979
<contributor>
8080
<name>Mark Hiner</name>
81-
<url>http://imagej.net/User:Hinerm</url>
81+
<url>https://imagej.net/User:Hinerm</url>
8282
<properties><id>hinerm</id></properties>
8383
</contributor>
8484
<contributor>
8585
<name>Samuel Inverso</name>
86-
<url>http://imagej.net/User:Sinverso</url>
86+
<url>https://imagej.net/User:Sinverso</url>
8787
<properties><id>sinverso</id></properties>
8888
</contributor>
8989
<contributor>
9090
<name>Tom Kazimiers</name>
91-
<url>http://imagej.net/User:Kazimiers</url>
91+
<url>https://imagej.net/User:Kazimiers</url>
9292
<properties><id>tomka</id></properties>
9393
</contributor>
9494
<contributor>
9595
<name>Jacques Pecreaux</name>
9696
</contributor>
9797
<contributor>
9898
<name>Luke Stuyvenberg</name>
99-
<url>http://imagej.net/User:Stuyvenberg</url>
99+
<url>https://imagej.net/User:Stuyvenberg</url>
100100
<properties><id>stuyvenberg</id></properties>
101101
</contributor>
102102
<contributor>
103103
<name>Jean-Yves Tinevez</name>
104-
<url>http://imagej.net/User:JeanYvesTinevez</url>
104+
<url>https://imagej.net/User:JeanYvesTinevez</url>
105105
<properties><id>tinevez</id></properties>
106106
</contributor>
107107
<contributor>
108108
<name>Yili Zhao</name>
109-
<url>http://imagej.net/User:Panovr</url>
109+
<url>https://imagej.net/User:Panovr</url>
110110
<properties><id>panovr</id></properties>
111111
</contributor>
112112
</contributors>
@@ -129,7 +129,7 @@
129129
</scm>
130130
<issueManagement>
131131
<system>GitHub Issues</system>
132-
<url>http://github.com/scijava/script-editor/issues</url>
132+
<url>https://github.com/scijava/script-editor/issues</url>
133133
</issueManagement>
134134
<ciManagement>
135135
<system>Travis CI</system>
@@ -150,7 +150,7 @@ Genetics, and others.</license.copyrightOwners>
150150
<repositories>
151151
<repository>
152152
<id>imagej.public</id>
153-
<url>http://maven.imagej.net/content/groups/public</url>
153+
<url>https://maven.imagej.net/content/groups/public</url>
154154
</repository>
155155
</repositories>
156156

src/main/java/org/scijava/ui/swing/script/EditorPane.java

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ public boolean wasChangedOutside() {
276276
* Write the contents of this {@link EditorPane} to given file.
277277
*
278278
* @param file File to write the contents of this editor to.
279-
* @throws IOException
279+
* @throws IOException Thrown when a parent directory could not be created.
280280
*/
281281
public void write(final File file) throws IOException {
282282
final File dir = file.getParentFile();
@@ -299,7 +299,7 @@ public void write(final File file) throws IOException {
299299
* Load editor contents from given file.
300300
*
301301
* @param file file to load.
302-
* @throws IOException
302+
* @throws IOException Thrown if the canonical file path couldn't be obtained for the file.
303303
*/
304304
public void open(final File file) throws IOException {
305305
final File oldFile = curFile;
@@ -370,7 +370,7 @@ public void setFileName(final String baseName) {
370370
/**
371371
* TODO
372372
*
373-
* @param file
373+
* @param file The file to edit in this {@link EditorPane}.
374374
*/
375375
public void setFileName(final File file) {
376376
curFile = file;
@@ -613,7 +613,7 @@ public void toggleBookmark(final int line) {
613613
}
614614
catch (final BadLocationException e) {
615615
/* ignore */
616-
System.out.println("Cannot toggle bookmark at this location.");
616+
log.error("Cannot toggle bookmark at this location.");
617617
}
618618
}
619619
}
@@ -669,7 +669,7 @@ else if (c == quoteChar || c == '\n') {
669669
setText(new String(chars));
670670
}
671671
catch (final Throwable t) {
672-
t.printStackTrace();
672+
log.error(t);
673673
}
674674
finally {
675675
endAtomicEdit();
@@ -685,7 +685,7 @@ public void convertTabsToSpaces() {
685685
super.convertTabsToSpaces();
686686
}
687687
catch (final Throwable t) {
688-
t.printStackTrace();
688+
log.error(t);
689689
}
690690
finally {
691691
endAtomicEdit();
@@ -699,7 +699,7 @@ public void convertSpacesToTabs() {
699699
super.convertSpacesToTabs();
700700
}
701701
catch (final Throwable t) {
702-
t.printStackTrace();
702+
log.error(t);
703703
}
704704
finally {
705705
endAtomicEdit();
@@ -711,6 +711,7 @@ public void convertSpacesToTabs() {
711711
public static final String LINE_WRAP_PREFS = "script.editor.WrapLines";
712712
public static final String TAB_SIZE_PREFS = "script.editor.TabSize";
713713
public static final String TABS_EMULATED_PREFS = "script.editor.TabsEmulated";
714+
public static final String FOLDERS_PREFS = "script.editor.folders";
714715

715716
public static final int DEFAULT_TAB_SIZE = 4;
716717

@@ -719,27 +720,32 @@ public void convertSpacesToTabs() {
719720
*/
720721
public void loadPreferences() {
721722
resetTabSize();
722-
setFontSize(prefService.getFloat(FONT_SIZE_PREFS, getFontSize()));
723-
setLineWrap(prefService.getBoolean(LINE_WRAP_PREFS, getLineWrap()));
724-
setTabsEmulated(prefService.getBoolean(TABS_EMULATED_PREFS,
723+
setFontSize(prefService.getFloat(getClass(), FONT_SIZE_PREFS, getFontSize()));
724+
setLineWrap(prefService.getBoolean(getClass(), LINE_WRAP_PREFS, getLineWrap()));
725+
setTabsEmulated(prefService.getBoolean(getClass(), TABS_EMULATED_PREFS,
725726
getTabsEmulated()));
726727
}
728+
729+
public String loadFolders() {
730+
return prefService.get(getClass(), FOLDERS_PREFS, System.getProperty("user.home"));
731+
}
727732

728733
/**
729734
* Retrieves and saves the preferences to the persistent store
730735
*/
731-
public void savePreferences() {
732-
prefService.put(TAB_SIZE_PREFS, getTabSize());
733-
prefService.put(FONT_SIZE_PREFS, getFontSize());
734-
prefService.put(LINE_WRAP_PREFS, getLineWrap());
735-
prefService.put(TABS_EMULATED_PREFS, getTabsEmulated());
736+
public void savePreferences(final String top_folders) {
737+
prefService.put(getClass(), TAB_SIZE_PREFS, getTabSize());
738+
prefService.put(getClass(), FONT_SIZE_PREFS, getFontSize());
739+
prefService.put(getClass(), LINE_WRAP_PREFS, getLineWrap());
740+
prefService.put(getClass(), TABS_EMULATED_PREFS, getTabsEmulated());
741+
if (null != top_folders) prefService.put(getClass(), FOLDERS_PREFS, top_folders);
736742
}
737743

738744
/**
739745
* Reset tab size to current preferences.
740746
*/
741747
public void resetTabSize() {
742-
setTabSize(prefService.getInt(TAB_SIZE_PREFS, DEFAULT_TAB_SIZE));
748+
setTabSize(prefService.getInt(getClass(), TAB_SIZE_PREFS, DEFAULT_TAB_SIZE));
743749
}
744750

745751
}

0 commit comments

Comments
 (0)