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);
}
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;
}
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;
}
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;
}
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;
}
Aggregations