@@ -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