From: Jim Procter Date: Sun, 24 Apr 2016 12:17:30 +0000 (+0100) Subject: JAL-2077 - reinstate popups on osx X-Git-Tag: Release_2_10_0~249^2~6 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=69bab27e77ceaca6d12e0de49f8fc62e01678f53;p=jalview.git JAL-2077 - reinstate popups on osx --- diff --git a/src/MCview/PDBViewer.java b/src/MCview/PDBViewer.java index da744a4..e032c7a 100755 --- a/src/MCview/PDBViewer.java +++ b/src/MCview/PDBViewer.java @@ -62,7 +62,6 @@ import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JOptionPane; import javax.swing.JRadioButtonMenuItem; -import javax.swing.SwingUtilities; public class PDBViewer extends JInternalFrame implements Runnable { @@ -416,8 +415,7 @@ public class PDBViewer extends JInternalFrame implements Runnable @Override public void mousePressed(MouseEvent evt) { - if (evt.isControlDown() - || SwingUtilities.isRightMouseButton(evt)) + if (evt.isPopupTrigger()) { radioItem.removeActionListener(radioItem.getActionListeners()[0]); diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 67152f2..44d1d94 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -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]); @@ -5395,7 +5394,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, diff --git a/src/jalview/gui/AnnotationLabels.java b/src/jalview/gui/AnnotationLabels.java index 3105ab9..f92d67f 100755 --- a/src/jalview/gui/AnnotationLabels.java +++ b/src/jalview/gui/AnnotationLabels.java @@ -617,7 +617,7 @@ public class AnnotationLabels extends JPanel implements MouseListener, } } } - if (!SwingUtilities.isRightMouseButton(evt)) + if (!evt.isPopupTrigger()) { return; } diff --git a/src/jalview/gui/AnnotationPanel.java b/src/jalview/gui/AnnotationPanel.java index a70d4b9..bb311ef 100755 --- a/src/jalview/gui/AnnotationPanel.java +++ b/src/jalview/gui/AnnotationPanel.java @@ -54,7 +54,6 @@ import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.Scrollable; -import javax.swing.SwingUtilities; import javax.swing.ToolTipManager; /** @@ -511,7 +510,7 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, } } - if (SwingUtilities.isRightMouseButton(evt) && activeRow != -1) + if (evt.isPopupTrigger() && activeRow != -1) { if (av.getColumnSelection() == null) { diff --git a/src/jalview/gui/CutAndPasteHtmlTransfer.java b/src/jalview/gui/CutAndPasteHtmlTransfer.java index 7d5d8d7..9c06f95 100644 --- a/src/jalview/gui/CutAndPasteHtmlTransfer.java +++ b/src/jalview/gui/CutAndPasteHtmlTransfer.java @@ -222,7 +222,7 @@ public class CutAndPasteHtmlTransfer extends GCutAndPasteHtmlTransfer public void textarea_mousePressed(MouseEvent e) { - if (SwingUtilities.isRightMouseButton(e)) + if (e.isPopupTrigger()) { JPopupMenu popup = new JPopupMenu( MessageManager.getString("action.edit")); diff --git a/src/jalview/gui/CutAndPasteTransfer.java b/src/jalview/gui/CutAndPasteTransfer.java index 76f1041..1161340 100644 --- a/src/jalview/gui/CutAndPasteTransfer.java +++ b/src/jalview/gui/CutAndPasteTransfer.java @@ -358,7 +358,7 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer @Override public void textarea_mousePressed(MouseEvent e) { - if (SwingUtilities.isRightMouseButton(e)) + if (e.isPopupTrigger()) { JPopupMenu popup = new JPopupMenu( MessageManager.getString("action.edit")); diff --git a/src/jalview/gui/DasSourceBrowser.java b/src/jalview/gui/DasSourceBrowser.java index 53e3c8d..8158ee6 100644 --- a/src/jalview/gui/DasSourceBrowser.java +++ b/src/jalview/gui/DasSourceBrowser.java @@ -96,8 +96,7 @@ public class DasSourceBrowser extends GDasSourceBrowser implements { public void mouseClicked(MouseEvent evt) { - if (evt.getClickCount() == 2 - || SwingUtilities.isRightMouseButton(evt)) + if (evt.getClickCount() == 2 || evt.isPopupTrigger()) { editRemoveLocalSource(evt); } diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index b7c4098..8e863c1 100644 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -383,7 +383,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements @Override public void mousePressed(MouseEvent evt) { - if (SwingUtilities.isRightMouseButton(evt)) + if (evt.isPopupTrigger()) { showPasteMenu(evt.getX(), evt.getY()); } diff --git a/src/jalview/gui/FeatureSettings.java b/src/jalview/gui/FeatureSettings.java index c2be241..6633156 100644 --- a/src/jalview/gui/FeatureSettings.java +++ b/src/jalview/gui/FeatureSettings.java @@ -170,7 +170,7 @@ public class FeatureSettings extends JPanel implements public void mousePressed(MouseEvent evt) { selectedRow = table.rowAtPoint(evt.getPoint()); - if (SwingUtilities.isRightMouseButton(evt)) + if (evt.isPopupTrigger()) { popupSort(selectedRow, (String) table.getValueAt(selectedRow, 0), table.getValueAt(selectedRow, 1), fr.getMinMax(), diff --git a/src/jalview/gui/IdPanel.java b/src/jalview/gui/IdPanel.java index eb5faa1..e247793 100755 --- a/src/jalview/gui/IdPanel.java +++ b/src/jalview/gui/IdPanel.java @@ -191,7 +191,7 @@ public class IdPanel extends JPanel implements MouseListener, * Ignore single click. Ignore 'left' click followed by 'right' click (user * selects a row then its pop-up menu). */ - if (e.getClickCount() < 2 || SwingUtilities.isRightMouseButton(e)) + if (e.getClickCount() < 2 || e.isPopupTrigger()) { return; } @@ -316,7 +316,7 @@ public class IdPanel extends JPanel implements MouseListener, int seq = alignPanel.getSeqPanel().findSeq(e); - if (SwingUtilities.isRightMouseButton(e)) + if (e.isPopupTrigger()) { Sequence sq = (Sequence) av.getAlignment().getSequenceAt(seq); // build a new links menu based on the current links + any non-positional diff --git a/src/jalview/gui/OptsAndParamsPage.java b/src/jalview/gui/OptsAndParamsPage.java index 8a0fe77..c591feb 100644 --- a/src/jalview/gui/OptsAndParamsPage.java +++ b/src/jalview/gui/OptsAndParamsPage.java @@ -208,7 +208,7 @@ public class OptsAndParamsPage public void mouseClicked(MouseEvent e) { - if (javax.swing.SwingUtilities.isRightMouseButton(e)) + if (e.isPopupTrigger()) { showUrlPopUp(this, finfo.toString(), e.getX(), e.getY()); } @@ -528,7 +528,7 @@ public class OptsAndParamsPage public void mouseClicked(MouseEvent e) { - if (javax.swing.SwingUtilities.isRightMouseButton(e)) + if (e.isPopupTrigger()) { showUrlPopUp(this, finfo.toString(), e.getX(), e.getY()); } diff --git a/src/jalview/gui/ScalePanel.java b/src/jalview/gui/ScalePanel.java index 41de58f..3ab681c 100755 --- a/src/jalview/gui/ScalePanel.java +++ b/src/jalview/gui/ScalePanel.java @@ -39,7 +39,6 @@ import java.awt.event.MouseMotionListener; import javax.swing.JMenuItem; import javax.swing.JPanel; import javax.swing.JPopupMenu; -import javax.swing.SwingUtilities; import javax.swing.ToolTipManager; /** @@ -107,7 +106,7 @@ public class ScalePanel extends JPanel implements MouseMotionListener, min = res; max = res; - if (SwingUtilities.isRightMouseButton(evt)) + if (evt.isPopupTrigger()) { rightMouseButtonPressed(evt, res); } diff --git a/src/jalview/gui/SeqPanel.java b/src/jalview/gui/SeqPanel.java index 1f1dd2f..3fbb809 100644 --- a/src/jalview/gui/SeqPanel.java +++ b/src/jalview/gui/SeqPanel.java @@ -1599,7 +1599,7 @@ public class SeqPanel extends JPanel implements MouseListener, } - if (SwingUtilities.isRightMouseButton(evt)) + if (evt.isPopupTrigger()) { List allFeatures = ap.getFeatureRenderer() .findFeaturesAtRes(sequence.getDatasetSequence(), diff --git a/src/jalview/gui/TreeCanvas.java b/src/jalview/gui/TreeCanvas.java index 90c74be..f21c5e7 100755 --- a/src/jalview/gui/TreeCanvas.java +++ b/src/jalview/gui/TreeCanvas.java @@ -59,7 +59,6 @@ import java.util.Vector; import javax.swing.JColorChooser; import javax.swing.JPanel; import javax.swing.JScrollPane; -import javax.swing.SwingUtilities; import javax.swing.ToolTipManager; /** @@ -791,7 +790,7 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, { if (highlightNode != null) { - if (SwingUtilities.isRightMouseButton(evt)) + if (evt.isPopupTrigger()) { Color col = JColorChooser.showDialog(this, MessageManager.getString("label.select_subtree_colour"), diff --git a/src/jalview/jbgui/GAlignFrame.java b/src/jalview/jbgui/GAlignFrame.java index 1eb558e..b2eb094 100755 --- a/src/jalview/jbgui/GAlignFrame.java +++ b/src/jalview/jbgui/GAlignFrame.java @@ -55,7 +55,6 @@ import javax.swing.JPanel; import javax.swing.JRadioButtonMenuItem; import javax.swing.JTabbedPane; import javax.swing.KeyStroke; -import javax.swing.SwingUtilities; import javax.swing.event.ChangeEvent; import javax.swing.event.MenuEvent; import javax.swing.event.MenuListener; @@ -295,8 +294,7 @@ public class GAlignFrame extends JInternalFrame @Override public void mousePressed(MouseEvent evt) { - if (evt.isControlDown() - || SwingUtilities.isRightMouseButton(evt)) + if (evt.isPopupTrigger()) { radioItem.removeActionListener(radioItem.getActionListeners()[0]);