Changeset 1382


Ignore:
Timestamp:
Oct 29, 2011, 10:50:09 PM (6 years ago)
Author:
stefan
Message:
 
Location:
trunk/src/jlatexeditor
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/jlatexeditor/SCEManager.java

    r1374 r1382  
    190190
    191191    try {
    192       //codeAssistant.addAssistant(new ScriptingSupport());
     192      codeAssistant.addAssistant(new ScriptingSupport());
    193193      codeAssistant.addAssistant(new FileCreationSuggester());
    194194      codeAssistant.addAssistant(new PackageImportSuggester(instance));
  • trunk/src/jlatexeditor/codehelper/ScriptingSupport.java

    r1378 r1382  
    1212import util.SpellChecker;
    1313
     14import javax.swing.*;
    1415import java.io.*;
    1516import java.util.ArrayList;
     
    2930    SCEDocument document = pane.getDocument();
    3031
    31     SCEDocumentRows rows = document.getRowsModel();
     32    final SCEDocumentRows rows = document.getRowsModel();
    3233    synchronized (rows) {
    3334      int rowNr = pane.getCaret().getRow();
     
    152153        writer.close();
    153154
    154         ProcessUtil.execAndWait(new String[]{"ghc", "--make", sourceName}, scriptDir);
    155         ProcessOutput result = ProcessUtil.execAndWait(new String[] {"./" + executableName}, scriptDir);
    156         output = result.getStdout();
     155        try {
     156          ProcessUtil.execAndWait(new String[]{"ghc", "--make", sourceName}, scriptDir);
     157          ProcessOutput result = ProcessUtil.execAndWait(new String[] {"./" + executableName}, scriptDir);
     158          output = result.getStdout();
     159        } catch (IOException e1) {
     160          if (e1.getMessage().startsWith("Cannot run program")) {
     161            JOptionPane.showMessageDialog(null, "Failed to run ghc.  Is ghc installed on your system?.\nMore details about this error are written to STDOUT after you clicked OK.", "Failed to run ghc", JOptionPane.ERROR_MESSAGE);
     162          }
     163          throw e1;
     164        }
    157165      }
    158166
    159167      pane.getDocument().replace(codeEnd+1,0,endRow,0, output + "\n");
    160168    } catch (IOException e) {
    161       e.printStackTrace();
     169      e.printStackTrace();
    162170    }
    163171
Note: See TracChangeset for help on using the changeset viewer.