Search in sources :

Example 6 with DoubleClickListener

use of com.intellij.ui.DoubleClickListener in project intellij-community by JetBrains.

the class MacrosDialog method addListeners.

private void addListeners() {
    myMacrosList.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

        @Override
        public void valueChanged(ListSelectionEvent e) {
            Macro macro = getSelectedMacro();
            if (macro == null) {
                myPreviewTextarea.setText("");
                setOKActionEnabled(false);
            } else {
                myPreviewTextarea.setText(macro.preview());
                setOKActionEnabled(true);
            }
        }
    });
    new DoubleClickListener() {

        @Override
        protected boolean onDoubleClick(MouseEvent e) {
            if (getSelectedMacro() != null) {
                close(OK_EXIT_CODE);
                return true;
            }
            return false;
        }
    }.installOn(myMacrosList);
}
Also used : MouseEvent(java.awt.event.MouseEvent) DoubleClickListener(com.intellij.ui.DoubleClickListener) ListSelectionEvent(javax.swing.event.ListSelectionEvent) ListSelectionListener(javax.swing.event.ListSelectionListener)

Example 7 with DoubleClickListener

use of com.intellij.ui.DoubleClickListener in project intellij-community by JetBrains.

the class JdkChooserPanel method showDialog.

private static Sdk showDialog(final Project project, String title, final Component parent, Sdk jdkToSelect) {
    final JdkChooserPanel jdkChooserPanel = new JdkChooserPanel(project);
    jdkChooserPanel.fillList(null, null);
    final MyDialog dialog = jdkChooserPanel.new MyDialog(parent);
    if (title != null) {
        dialog.setTitle(title);
    }
    if (jdkToSelect != null) {
        jdkChooserPanel.selectJdk(jdkToSelect);
    } else {
        ScrollingUtil.ensureSelectionExists(jdkChooserPanel.myList);
    }
    new DoubleClickListener() {

        @Override
        protected boolean onDoubleClick(MouseEvent e) {
            dialog.clickDefaultButton();
            return true;
        }
    }.installOn(jdkChooserPanel.myList);
    return dialog.showAndGet() ? jdkChooserPanel.getChosenJdk() : null;
}
Also used : MouseEvent(java.awt.event.MouseEvent) DoubleClickListener(com.intellij.ui.DoubleClickListener)

Example 8 with DoubleClickListener

use of com.intellij.ui.DoubleClickListener in project intellij-community by JetBrains.

the class ConvertToInstanceMethodDialog method createTargetVariableChooser.

@Override
protected JList createTargetVariableChooser() {
    final JList variableChooser = super.createTargetVariableChooser();
    new DoubleClickListener() {

        @Override
        protected boolean onDoubleClick(MouseEvent e) {
            Point point = e.getPoint();
            int index = variableChooser.locationToIndex(point);
            if (index == -1)
                return false;
            if (!variableChooser.getCellBounds(index, index).contains(point))
                return false;
            doRefactorAction();
            return true;
        }
    }.installOn(variableChooser);
    return variableChooser;
}
Also used : MouseEvent(java.awt.event.MouseEvent) DoubleClickListener(com.intellij.ui.DoubleClickListener)

Example 9 with DoubleClickListener

use of com.intellij.ui.DoubleClickListener in project android by JetBrains.

the class DeepLinkChooserDialog method createCenterPanel.

@Nullable
@Override
protected JComponent createCenterPanel() {
    JScrollPane scrollPane = new JBScrollPane(myList);
    myList.setSelectedIndex(0);
    new DoubleClickListener() {

        @Override
        protected boolean onDoubleClick(MouseEvent e) {
            int index = myList.locationToIndex(e.getPoint());
            if (index != -1 && myList.getModel().getElementAt(index) != null) {
                myList.setSelectedIndex(index);
                doOKAction();
            }
            return false;
        }
    }.installOn(myList);
    return scrollPane;
}
Also used : MouseEvent(java.awt.event.MouseEvent) DoubleClickListener(com.intellij.ui.DoubleClickListener) JBScrollPane(com.intellij.ui.components.JBScrollPane) Nullable(org.jetbrains.annotations.Nullable)

Example 10 with DoubleClickListener

use of com.intellij.ui.DoubleClickListener in project android by JetBrains.

the class ThemeSelectionDialog method createCenterPanel.

@Nullable
@Override
protected JComponent createCenterPanel() {
    JPanel contentPanel = myPanel.getContentPanel();
    contentPanel.setPreferredSize(JBUI.size(800, 500));
    myPanel.installDoubleClickListener(new DoubleClickListener() {

        @Override
        protected boolean onDoubleClick(MouseEvent event) {
            close(OK_EXIT_CODE);
            return true;
        }
    });
    return contentPanel;
}
Also used : MouseEvent(java.awt.event.MouseEvent) DoubleClickListener(com.intellij.ui.DoubleClickListener) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

DoubleClickListener (com.intellij.ui.DoubleClickListener)17 MouseEvent (java.awt.event.MouseEvent)16 TreeSelectionEvent (javax.swing.event.TreeSelectionEvent)4 TreeSelectionListener (javax.swing.event.TreeSelectionListener)4 ListSelectionEvent (javax.swing.event.ListSelectionEvent)3 ListSelectionListener (javax.swing.event.ListSelectionListener)3 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)3 DefaultTreeModel (javax.swing.tree.DefaultTreeModel)3 Nullable (org.jetbrains.annotations.Nullable)3 BaseProjectTreeBuilder (com.intellij.ide.projectView.BaseProjectTreeBuilder)2 AbstractProjectTreeStructure (com.intellij.ide.projectView.impl.AbstractProjectTreeStructure)2 ProjectAbstractTreeStructureBase (com.intellij.ide.projectView.impl.ProjectAbstractTreeStructureBase)2 ProjectTreeBuilder (com.intellij.ide.projectView.impl.ProjectTreeBuilder)2 NodeRenderer (com.intellij.ide.util.treeView.NodeRenderer)2 Disposable (com.intellij.openapi.Disposable)2 ModalityState (com.intellij.openapi.application.ModalityState)2 TabbedPaneWrapper (com.intellij.ui.TabbedPaneWrapper)2 TreeSpeedSearch (com.intellij.ui.TreeSpeedSearch)2 JBList (com.intellij.ui.components.JBList)2 Tree (com.intellij.ui.treeStructure.Tree)2