Changeset 12651


Ignore:
Timestamp:
2006-09-01T14:38:30+12:00 (18 years ago)
Author:
mdewsnip
Message:

Minor formatting and code changes.

Location:
trunk/gli/src/org/greenstone/gatherer
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/DebugStream.java

    r8234 r12651  
    9999
    100100
    101     /** Print a stack trace to the debug stream. */
     101    /** Print a stack trace to the debug stream, and always to STDERR. */
    102102    static synchronized public void printStackTrace(Exception exception)
    103103    {
  • trunk/gli/src/org/greenstone/gatherer/cdm/MacrosManager.java

    r12368 r12651  
    4343import org.greenstone.gatherer.collection.CollectionManager;
    4444import org.greenstone.gatherer.Configuration;
     45import org.greenstone.gatherer.DebugStream;
    4546import org.greenstone.gatherer.Dictionary;
    4647import org.greenstone.gatherer.Gatherer;
    4748import org.greenstone.gatherer.gui.DesignPaneHeader;
    4849import org.greenstone.gatherer.gui.GLIButton;
     50
    4951
    5052public class MacrosManager {
     
    187189
    188190            br.close();
    189         } catch (Exception e) {
    190             System.err.println("MacrosManager Exception: "+e.getMessage());
     191        }
     192        catch (Exception exception) {
     193            DebugStream.printStackTrace(exception);
    191194        }
    192195        }
     
    194197   
    195198    private void writeMacroFile() {
    196         File extra_dm = new File(CollectionManager.getCollectionDirectoryPath()+"macros"+File.separator+"extra.dm");
     199        File extra_dm_file = new File(CollectionManager.getCollectionDirectoryPath()+"macros"+File.separator+"extra.dm");
    197200        try {
    198         if (!extra_dm.exists()) {
    199             File parent_dir = extra_dm.getParentFile();
     201        if (!extra_dm_file.exists()) {
     202            File parent_dir = extra_dm_file.getParentFile();
    200203            parent_dir.mkdirs();
    201             extra_dm.createNewFile();
     204            extra_dm_file.createNewFile();
    202205        }
    203206       
    204         BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(extra_dm), "UTF-8"));
     207        BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(extra_dm_file), "UTF-8"));
    205208        String text = macros_textarea.getText();
    206209        out.write(text, 0, text.length());
     
    208211        out.flush();
    209212        out.close();
    210         } catch (Exception e) {
    211         System.err.println("MacrosManager Exception: "+e.getMessage());
     213        }
     214        catch (Exception exception) {
     215        DebugStream.printStackTrace(exception);
    212216        }
    213217    }
     
    251255                        undo_button.setEnabled(true);
    252256            }   
    253            
    254                 } catch (Exception e) {
    255             System.err.println("MacrosManager Exception: "+e.getMessage());
     257                }
     258        catch (Exception exception) {
     259            DebugStream.printStackTrace(exception);
    256260                }           
    257261        }
    258262    }
    259263   
    260        private class RedoListener
    261        implements ActionListener {
     264
     265    private class RedoListener
     266        implements ActionListener {
    262267       
    263        public void actionPerformed(ActionEvent evt) {
    264            try {
    265            if (undo.canRedo()) {
    266                int pos = macros_textarea.getCaretPosition();
    267                undo.redo();
    268                macros_textarea.setCaretPosition(pos+1);
    269                macros_textarea.grabFocus();
    270            }
    271            if (!undo.canRedo()){
    272                redo_button.setEnabled(false);
    273            }
    274            else{
    275                redo_button.setEnabled(true);
    276            }                     
    277            
    278            } catch (Exception e) {
    279            System.err.println("MacrosManager Exception: "+e.getMessage());
    280            }
    281        }
    282        }
    283    
    284     }
    285    
    286    
    287    
     268        public void actionPerformed(ActionEvent evt) {
     269        try {
     270            if (undo.canRedo()) {
     271            int pos = macros_textarea.getCaretPosition();
     272            undo.redo();
     273            macros_textarea.setCaretPosition(pos+1);
     274            macros_textarea.grabFocus();
     275            }
     276            if (!undo.canRedo()){
     277            redo_button.setEnabled(false);
     278            }
     279            else{
     280            redo_button.setEnabled(true);
     281            }
     282        }
     283        catch (Exception exception) {
     284            DebugStream.printStackTrace(exception);
     285        }
     286        }
     287    }
     288    }
    288289}
Note: See TracChangeset for help on using the changeset viewer.