[MOBY-guts] biomoby commit

Paul Gordon gordonp at dev.open-bio.org
Thu Feb 3 21:46:40 UTC 2011


gordonp
Thu Feb  3 16:46:40 EST 2011
Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui
In directory dev.open-bio.org:/tmp/cvs-serv20182/src/main/ca/ucalgary/seahawk/gui

Modified Files:
	MobyContentClipboard.java 
Log Message:
Make empty but well-formed clipboard file on startup to avoid exceptions in various widgets like the filter
moby-live/Java/src/main/ca/ucalgary/seahawk/gui MobyContentClipboard.java,1.11,1.12
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentClipboard.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentClipboard.java	2010/04/16 20:36:17	1.11
+++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentClipboard.java	2011/02/03 21:46:40	1.12
@@ -92,6 +92,12 @@
 	    return;
 	}
 	clipboardFile.deleteOnExit();
+	try{
+	    writeClipboardDataToFile(); // Set up empty clipboard doc
+	}
+	catch(Exception e){
+	    logger.log(Level.SEVERE, "Clipboard failed to initialize, cannot write or load temp file", e);
+	}
 
 	// The dfeault is to open a new tab when contents is transfered (dropped/pasted) onto the tab,
 	// we want to override that behaviour to a collation for the clipboard
@@ -270,7 +276,7 @@
 	logger.log(Level.FINE, urlContents);
 
 	MobyDataType targetDataType = null;
-	if(collection != null){
+	if(collection != null && !collection.isEmpty()){
 	    targetDataType = collection.getDataType();
 	}
 	MobyDataObject[] mobyDataFound = client.getMobyObjects(urlContents, targetDataType);
@@ -341,21 +347,24 @@
 	}
     }
 
-    public void updateDisplay(){
+    private void writeClipboardDataToFile() throws Exception{
 	// Write to temp file
+	FileOutputStream os = new FileOutputStream(clipboardFile);
+	MobyDataUtils.toXMLDocument(os, content);
+	os.close();
+    }
+
+    public void updateDisplay(){
 	try{
-	    FileOutputStream os = new FileOutputStream(clipboardFile);
-	    MobyDataUtils.toXMLDocument(os, content);
-	    os.close();
+	    writeClipboardDataToFile();
 	    gotoURL(clipboardFile.toURI().toURL(), false);
-	}
-	catch(Exception e){
+	    tabbedPane.setTitleAt(tabbedPane.indexOfComponent(this), CLIPBOARD_TAB_NAME + 
+				  ": " + getResponseType(content));
+	    contentGUI.setVisible(true);
+	} catch(Exception e){
 	    logger.log(Level.SEVERE, "Clipboard failed to update the display, cannot write or load temp file", e);
 	    return;
 	}
-	tabbedPane.setTitleAt(tabbedPane.indexOfComponent(this), CLIPBOARD_TAB_NAME + 
-			      ": " + getResponseType(content));
-	contentGUI.setVisible(true);
     }
 
     /**




More information about the MOBY-guts mailing list