Changeset 835
- Timestamp:
- 09/04/10 09:06:26 (17 months ago)
- Location:
- trunk/src/jlatexeditor
- Files:
-
- 4 modified
-
gui/MessagePopup.java (modified) (3 diffs)
-
gui/StatusBar.java (modified) (3 diffs)
-
JLatexEditorJFrame.java (modified) (2 diffs)
-
tools/SVN.java (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/jlatexeditor/gui/MessagePopup.java
r744 r835 14 14 15 15 private JLabel label; 16 private Color backgroundColor = new Color(192, 239, 192); 17 private Color strokeColor = new Color(0, 128, 0); 16 18 17 public MessagePopup(String message, JFrame invoker) {19 public MessagePopup(Color color, String message, JFrame invoker) { 18 20 super(message); 19 21 20 22 label = new JLabel(getLabel()); 21 23 label.setMaximumSize(new Dimension(800, 600)); 24 25 backgroundColor = mix(Color.WHITE, color, 0.75); 26 strokeColor = mix(Color.BLACK, color, 0.33); 22 27 23 28 Dimension preferred = label.getPreferredSize(); … … 34 39 addMouseListener(this); 35 40 } 41 42 private Color mix(Color c1, Color c2, double c1ratio) { 43 return new Color( 44 (int) (c1.getRed()*c1ratio + c2.getRed()*(1-c1ratio)), 45 (int) (c1.getGreen()*c1ratio + c2.getGreen()*(1-c1ratio)), 46 (int) (c1.getBlue()*c1ratio + c2.getBlue()*(1-c1ratio))); 47 } 36 48 37 49 public void setVisible(boolean b) { … … 54 66 // green rectangle 55 67 g2D.clearRect(0, 0, getWidth(), getHeight()); 56 g2D.setColor( new Color(192, 239, 192)); // 217, 231, 19468 g2D.setColor(backgroundColor); // 217, 231, 194 57 69 g2D.fillRoundRect(2, 2, getWidth() - 4, getHeight() - 4, 15, 15); 58 g2D.setColor( new Color(0, 128, 0));70 g2D.setColor(strokeColor); 59 71 g2D.setStroke(new BasicStroke(2)); 60 72 g2D.drawRoundRect(2, 2, getWidth() - 4, getHeight() - 4, 15, 15); -
trunk/src/jlatexeditor/gui/StatusBar.java
r744 r835 30 30 private CheckForUpdates updateChecker = new CheckForUpdates(); 31 31 32 private ArrayList<String> mess ges = new ArrayList<String>();32 private ArrayList<String> messages = new ArrayList<String>(); 33 33 34 34 public StatusBar(JLatexEditorJFrame jLatexEditor) { … … 58 58 59 59 public synchronized void showMessage(String shortMessage, String message) { 60 mess ges.add(message);61 new MessagePopup( message, jLatexEditor);60 messages.add(message); 61 new MessagePopup(new Color(0, 192, 0), message, jLatexEditor); 62 62 } 63 63 … … 112 112 } 113 113 114 public static class MemoryUsage extends JPanel implements ActionListener { 114 public void showTextError(String shortMessage, String textMessage) { 115 String message = "<html>" + textMessage.replaceAll("\\n", "<br>") + "</html>"; 116 messages.add(message); 117 new MessagePopup(new Color(192, 0, 0), message, jLatexEditor); 118 } 119 120 public static class MemoryUsage extends JPanel implements ActionListener { 115 121 public static Color COLOR_BAR = new Color(163, 201, 247); 116 122 public static Color COLOR_BACKGROUND = ColorUtil.mix(COLOR_BAR, 0.5, Color.WHITE); -
trunk/src/jlatexeditor/JLatexEditorJFrame.java
r834 r835 1017 1017 results = SVN.getInstance().update(getMainEditor().getFile().getParentFile()); 1018 1018 } catch (Exception exception) { 1019 statusBar.showMessage("SVN update failed", "SVN update failed: " + exception.getMessage()); 1019 exception.printStackTrace(); 1020 statusBar.showTextError("SVN update failed", "SVN update failed: " + exception.getMessage()); 1020 1021 return; 1021 1022 } … … 1050 1051 result = SVN.getInstance().commit(getMainEditor().getFile().getParentFile(), message); 1051 1052 } catch (Exception exception) { 1053 exception.printStackTrace(); 1052 1054 statusBar.showMessage("SVN update failed", "SVN update failed: " + exception.getMessage()); 1053 1055 return; -
trunk/src/jlatexeditor/tools/SVN.java
r834 r835 26 26 27 27 Process svn; 28 try { 29 svn = ProcessUtil.exec(new String[]{"svn", "--non-interactive", "update"}, dir); 30 } catch (Exception e) { 31 e.printStackTrace(); 32 throw new Exception("SVN update failed!", e); 33 } 28 svn = ProcessUtil.exec(new String[]{"svn", "--non-interactive", "update"}, dir); 34 29 35 30 BufferedReader in = new BufferedReader(new InputStreamReader(svn.getInputStream()), 100000); … … 67 62 } 68 63 69 /**70 * Check if the return code of the svn process is OK.71 *72 * @param process svn process73 */74 private void checkProcessResult(Process process, String action) throws Exception {75 76 try {77 String errorString = new String(StreamUtils.readBytesFromInputStream(process.getErrorStream()));78 throw new Exception(action + " failed due to the following error:\n" + errorString);79 } catch (IOException e) {80 e.printStackTrace();81 throw new Exception(action + " failed!", e);82 }83 }84 85 64 public synchronized Pair<Boolean, String> commit(File dir, String message) throws Exception { 86 65 message = message.replace('"', ' '); 87 66 message = message.replace('\\', ' '); 88 67 89 Process svn; 90 try { 91 svn = ProcessUtil.exec(new String[]{"svn", "--non-interactive", "commit", "-m", message}, dir); 92 } catch (Exception e) { 93 e.printStackTrace(); 94 throw new Exception("SVN update failed!", e); 95 // return new Pair<Boolean, String>(false, "<font color=red><b>Exception: " + e.getMessage() + "</b></font>"); 96 } 97 98 boolean success = true; 68 Process svn = ProcessUtil.exec(new String[]{"svn", "--non-interactive", "commit", "-m", message}, dir); 69 70 boolean success = true; 99 71 100 72 StringBuilder builder = new StringBuilder(); … … 181 153 } 182 154 155 /** 156 * Check if the return code of the svn process is OK. 157 * 158 * @param process svn process 159 */ 160 private void checkProcessResult(Process process, String action) throws Exception { 161 String errorString = new String(StreamUtils.readBytesFromInputStream(process.getErrorStream())); 162 if (!errorString.equals("")) { 163 throw new Exception(action + " failed due to the following error:\n" + errorString); 164 } 165 } 166 183 167 public static class UpdateResult { 184 168 public static final int TYPE_UPDATE = 0;
![(please configure the [header_logo] section in trac.ini)](http://jlatexeditor.endrullis.de/chrome/site/logo_xmas.png)