+ /**
+ * do a vamsas document update or update jalview from the vamsas document
+ *
+ * @param fromJalview
+ * true to update from jalview to the vamsas document
+ */
+ protected void dealWithDocumentUpdate(boolean fromJalview)
+ {
+ // called by update handler for document update.
+ Cache.log.debug("Updating jalview from changed vamsas document.");
+ disableGui(true);
+ try
+ {
+ long time = System.currentTimeMillis();
+ IClientDocument cdoc = vclient.getClientDocument();
+ if (Cache.log.isDebugEnabled())
+ {
+ Cache.log.debug("Time taken to get ClientDocument = "
+ + (System.currentTimeMillis() - time));
+ time = System.currentTimeMillis();
+ }
+ if (fromJalview)
+ {
+ this.updateVamsasDocument(cdoc);
+ if (Cache.log.isDebugEnabled())
+ {
+ Cache.log
+ .debug("Time taken to update Vamsas Document from jalview\t= "
+ + (System.currentTimeMillis() - time));
+ time = System.currentTimeMillis();
+ }
+ cdoc.setVamsasRoots(cdoc.getVamsasRoots());
+ if (Cache.log.isDebugEnabled())
+ {
+ Cache.log.debug("Time taken to set Document Roots\t\t= "
+ + (System.currentTimeMillis() - time));
+ time = System.currentTimeMillis();
+ }
+ }
+ else
+ {
+ updateJalview(cdoc);
+ if (Cache.log.isDebugEnabled())
+ {
+ Cache.log
+ .debug("Time taken to update Jalview from vamsas document Roots\t= "
+ + (System.currentTimeMillis() - time));
+ time = System.currentTimeMillis();
+ }
+
+ }
+ vclient.updateDocument(cdoc);
+ if (Cache.log.isDebugEnabled())
+ {
+ Cache.log.debug("Time taken to update Session Document\t= "
+ + (System.currentTimeMillis() - time));
+ time = System.currentTimeMillis();
+ }
+ cdoc = null;
+ } catch (Exception ee)
+ {
+ System.err.println("Exception whilst updating :");
+ ee.printStackTrace(System.err);
+ }
+ Cache.log.debug("Finished updating from document change.");
+ disableGui(false);
+ }
+