X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAlignFrame.java;h=3e3780a17a9ed10619944f282a40fe55e509a4c9;hb=8bcfd58a217316c956529258080b4a3b171fc14c;hp=67152f2655a89a7fa6118f1b0f09a95d0cf35b9e;hpb=1df694418a9563a3bab8b5421a77bc7c83f03f90;p=jalview.git diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 67152f2..3e3780a 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -74,6 +74,7 @@ import jalview.io.JalviewFileView; import jalview.io.JnetAnnotationMaker; import jalview.io.NewickFile; import jalview.io.TCoffeeScoreFile; +import jalview.io.gff.SequenceOntologyI; import jalview.jbgui.GAlignFrame; import jalview.schemes.Blosum62ColourScheme; import jalview.schemes.BuriedColourScheme; @@ -131,7 +132,6 @@ import java.awt.print.PageFormat; import java.awt.print.PrinterJob; import java.beans.PropertyChangeEvent; import java.io.File; -import java.lang.reflect.Method; import java.net.URL; import java.util.ArrayList; import java.util.Arrays; @@ -3641,8 +3641,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, @Override public void mousePressed(MouseEvent evt) { - if (evt.isControlDown() - || SwingUtilities.isRightMouseButton(evt)) + if (evt.isPopupTrigger()) { radioItem.removeActionListener(radioItem.getActionListeners()[0]); @@ -4715,6 +4714,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, AlignFrame newFrame = new AlignFrame(al, DEFAULT_WIDTH, DEFAULT_HEIGHT); + if (Cache.getDefault("HIDE_INTRONS", true)) + { + newFrame.hideFeatureColumns(SequenceOntologyI.EXON, false); + } String newtitle = String.format("%s %s %s", MessageManager.getString(dna ? "label.proteins" : "label.nucleotides"), MessageManager @@ -5035,6 +5038,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, "text/uri-list;class=java.lang.String"); if (t.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) { + Cache.log.debug("Drop handled as javaFileListFlavor"); // Works on Windows and MacOSX evt.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE); files = (java.util.List) t @@ -5042,9 +5046,21 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } else if (t.isDataFlavorSupported(uriListFlavor)) { + Cache.log.debug("Drop handled as uriListFlavor"); // This is used by Unix drag system evt.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE); String data = (String) t.getTransferData(uriListFlavor); + if (data == null) + { + Cache.log.debug("standard URIListFlavor (" + uriListFlavor + + ") doesn't resolve. trying others."); + // try 'best' dataflavor + data = (String) t.getTransferData(DataFlavor + .selectBestTextFlavor(t.getTransferDataFlavors())); + Cache.log.debug("Dataflavor " + + DataFlavor.selectBestTextFlavor(t + .getTransferDataFlavors()) + " returned " + data); + } files = new java.util.ArrayList(1); for (java.util.StringTokenizer st = new java.util.StringTokenizer( data, "\r\n"); st.hasMoreTokens();) @@ -5069,6 +5085,24 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, files.add(file.toString()); } } + if (files.size() < 1) + { + Cache.log + .debug("Couldn't resolve drop data with 'best text'. Here are the supported flavors:"); + if (data == null && Cache.log.isDebugEnabled()) + { + for (DataFlavor fl : t.getTransferDataFlavors()) + { + Cache.log.debug("Supported transfer dataflavor: " + + fl.toString()); + Object df = t.getTransferData(fl); + if (df != null) + { + Cache.log.debug("Retrieves: " + df); + } + } + } + } } } catch (Exception e) { @@ -5395,7 +5429,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, @Override public void tabbedPane_mousePressed(MouseEvent e) { - if (SwingUtilities.isRightMouseButton(e)) + if (e.isPopupTrigger()) { String msg = MessageManager.getString("label.enter_view_name"); String reply = JOptionPane.showInternalInputDialog(this, msg, msg, @@ -6122,19 +6156,12 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, protected void runGroovy_actionPerformed() { Desktop.setCurrentAlignFrame(this); - Object console = Desktop.instance.getGroovyConsole(); + groovy.ui.Console console = Desktop.getGroovyConsole(); if (console != null) { - /* - * use reflection here to avoid compile-time dependency - * on Groovy libraries - */ try { - Class gcClass = getClass().getClassLoader().loadClass( - "groovy.ui.Console"); - Method runScript = gcClass.getMethod("runScript"); - runScript.invoke(console); + console.runScript(); } catch (Exception ex) { System.err.println((ex.toString())); @@ -6151,6 +6178,31 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, System.err.println("Can't run Groovy script as console not found"); } } + + /** + * Hides columns containing (or not containing) a specified feature, provided + * that would not leave all columns hidden + * + * @param featureType + * @param columnsContaining + * @return + */ + public boolean hideFeatureColumns(String featureType, + boolean columnsContaining) + { + boolean notForHiding = avc.markColumnsContainingFeatures( + columnsContaining, false, false, featureType); + if (notForHiding) + { + if (avc.markColumnsContainingFeatures(!columnsContaining, false, + false, featureType)) + { + getViewport().hideSelectedColumns(); + return true; + } + } + return false; + } } class PrintThread extends Thread