Package net.sf.jabref.collab

Examples of net.sf.jabref.collab.ChangeScanner


        return; // We are just saving the file, so this message is most likely due
      // to bad timing. If not, we'll handle it on the next polling.
      //Util.pr("File '"+file.getPath()+"' has been modified.");
      updatedExternally = true;

      final ChangeScanner scanner = new ChangeScanner(frame, BasePanel.this);

      // Adding the sidepane component is Swing work, so we must do this in the Swing
      // thread:
      Thread t = new Thread() {
        public void run() {
     
      // Check if there is already a notification about external
      // changes:
      boolean hasAlready = sidePaneManager.hasComponent(FileUpdatePanel.NAME);
      if (hasAlready) {
          sidePaneManager.hideComponent(FileUpdatePanel.NAME);
          sidePaneManager.unregisterComponent(FileUpdatePanel.NAME);
      }
      FileUpdatePanel pan = new FileUpdatePanel(frame, BasePanel.this,
                  sidePaneManager, getFile(), scanner);
      sidePaneManager.register(FileUpdatePanel.NAME, pan);
      sidePaneManager.show(FileUpdatePanel.NAME);
      //setUpdatedExternally(false);
      //scanner.displayResult();
        }
    };

      // Test: running scan automatically in background
      if ((BasePanel.this.getFile() != null) &&
              !Util.waitForFileLock(BasePanel.this.getFile(), 10)) {
          // The file is locked even after the maximum wait. Do nothing.
          System.err.println("File updated externally, but change scan failed because the file is locked.");
          // Perturb the stored timestamp so successive checks are made:
          Globals.fileUpdateMonitor.perturbTimestamp(getFileMonitorHandle());
          return;
      }

      scanner.changeScan(BasePanel.this.getFile());
      try {
    scanner.join();
      } catch (InterruptedException e) {
    e.printStackTrace();
      }

      if (scanner.changesFound()) {
    SwingUtilities.invokeLater(t);
      } else {
    setUpdatedExternally(false);
    //System.out.println("No changes found.");
      }
View Full Code Here


                            if (!Util.waitForFileLock(panel.getFile(), 10)) {
                                // TODO: GUI handling of the situation when the externally modified file keeps being locked.
                                System.err.println("File locked, this will be trouble.");
                            }

                            ChangeScanner scanner = new ChangeScanner(panel.frame(), panel);
                            scanner.changeScan(panel.getFile());
                            try {
                                scanner.join();
                            } catch (InterruptedException e) {
                                e.printStackTrace();
                            }
                            if (scanner.changesFound()) {
                                scanner.displayResult(new ChangeScanner.DisplayResultCallback() {
                                    public void scanResultsResolved(boolean resolved) {
                                        if (!resolved) {
                                            cancelled = true;
                                        } else {
                                            panel.setUpdatedExternally(false);
View Full Code Here

TOP

Related Classes of net.sf.jabref.collab.ChangeScanner

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.