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;
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;
.setSelected(av.getGlobalColourScheme() instanceof jalview.schemes.RNAHelicesColour);
showProducts.setEnabled(canShowProducts());
- setGroovyEnabled(Desktop.instance.getGroovyConsole() != null);
+ setGroovyEnabled(Desktop.getGroovyConsole() != null);
updateEditMenuBar();
}
@Override
public void mousePressed(MouseEvent evt)
{
- if (evt.isControlDown()
- || SwingUtilities.isRightMouseButton(evt))
+ if (evt.isPopupTrigger())
{
radioItem.removeActionListener(radioItem.getActionListeners()[0]);
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
"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
}
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();)
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)
{
@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,
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()));
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