Changeset 661
- Timestamp:
- 02/04/10 21:53:25 (3 years ago)
- Location:
- trunk/src/jlatexeditor
- Files:
-
- 2 modified
-
gui/StatusBar.java (modified) (10 diffs)
-
JLatexEditorJFrame.java (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/jlatexeditor/gui/StatusBar.java
r660 r661 10 10 import java.awt.event.ActionEvent; 11 11 import java.awt.event.ActionListener; 12 import java.awt.event.MouseEvent; 13 import java.awt.event.MouseListener; 12 14 import java.awt.geom.Rectangle2D; 13 15 import java.io.File; … … 17 19 * StatusBar. 18 20 */ 19 public class StatusBar extends JPanel implements ActionListener {21 public class StatusBar extends JPanel implements ActionListener, MouseListener { 20 22 private JLatexEditorJFrame jLatexEditor; 21 23 … … 24 26 private JPanel left = new JPanel(); 25 27 26 private boolean checkForUpdates = true;28 private boolean hadException = false; 27 29 private JLabel updatesAvailable = new JLabel("SVN updates are available."); 30 private CheckForUpdates updateChecker = new CheckForUpdates(); 28 31 29 32 private ArrayList<String> messges = new ArrayList<String>(); … … 45 48 updatesAvailable.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEtchedBorder(), BorderFactory.createEmptyBorder(1,3,1,3))); 46 49 updatesAvailable.setVisible(false); 50 updatesAvailable.addMouseListener(this); 47 51 center.add(updatesAvailable); 48 52 … … 50 54 setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED)); 51 55 52 new CheckForUpdates().start();56 updateChecker.start(); 53 57 } 54 58 … … 58 62 } 59 63 60 public synchronized void checkForUpdates() { 61 if(!checkForUpdates) return; 64 public void checkForUpdates() { 65 updateChecker.check(); 66 } 62 67 68 private synchronized void checkForUpdates_() { 63 69 boolean hasUpdates = false; 64 70 … … 66 72 if(!file.exists()) return; 67 73 File dir = file.getParentFile(); 74 if(!new File(dir, ".svn").exists()) return; 75 68 76 try { 69 77 ArrayList<SVN.StatusResult> results = SVN.getInstance().status(dir); … … 72 80 } 73 81 } catch (Exception e) { 74 e.printStackTrace();75 checkForUpdates = false;82 if(!hadException) e.printStackTrace(); 83 hadException = true; 76 84 } 77 85 78 System.out.println(hasUpdates); 79 updatesAvailable.setVisible(hasUpdates); 86 setUpdatesAvailableVisible(hasUpdates); 80 87 } 81 88 … … 86 93 public void actionPerformed(ActionEvent e) { 87 94 checkForUpdates(); 95 } 96 97 public void mouseClicked(MouseEvent e) { 98 } 99 100 public void mousePressed(MouseEvent e) { 101 setUpdatesAvailableVisible(false); 102 jLatexEditor.actionPerformed(new ActionEvent(this, 0, "svn update")); 103 } 104 105 public void mouseReleased(MouseEvent e) { 106 } 107 108 public void mouseEntered(MouseEvent e) { 109 } 110 111 public void mouseExited(MouseEvent e) { 88 112 } 89 113 … … 127 151 } 128 152 153 public synchronized void check() { 154 notifyAll(); 155 } 156 129 157 public void run() { 130 checkForUpdates(); 158 while(true) { 159 checkForUpdates_(); 131 160 132 try { 133 synchronized (this) { wait(120000); } 134 } catch (InterruptedException e) { } 161 try { 162 synchronized (this) { wait(120000); } 163 } catch (InterruptedException e) { } 164 } 135 165 } 136 166 } -
trunk/src/jlatexeditor/JLatexEditorJFrame.java
r660 r661 697 697 checkExternalModification(false); 698 698 statusBar.showMessage("SVN update", builder.toString()); 699 statusBar.setUpdatesAvailableVisible(false); 699 700 } else 700 701 // svn commit … … 1021 1022 1022 1023 backgroundParser.parse(); 1024 statusBar.checkForUpdates(); 1023 1025 } 1024 1026 if(closeIcon.contains(e.getX() - closeIcon.getX(), e.getY() - closeIcon.getY())) {
![(please configure the [header_logo] section in trac.ini)](http://jlatexeditor.endrullis.de/chrome/site/logo.png)