@Nullable @Override public JComponent createComponent() { textLocalProfilerCsvPath.getButton().addMouseListener(new MyMouseListener()); return mainPanel; }
public TwigNamespaceDialog(Project project, TableView<TwigPath> tableView) { this.tableView = tableView; this.project = project; setContentPane(contentPane); setModal(true); getRootPane().setDefaultButton(buttonOK); this.setOkState(); this.namespacePath.getTextField().getDocument().addDocumentListener(new ChangeDocumentListener()); this.name.getDocument().addDocumentListener(new ChangeDocumentListener()); buttonOK.addActionListener(e -> onOK()); buttonCancel.addActionListener(e -> onCancel()); namespacePath.getButton().addMouseListener(createPathButtonMouseListener(namespacePath.getTextField(), FileChooserDescriptorFactory.createSingleFolderDescriptor())); setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { onCancel(); } }); contentPane.registerKeyboardAction(e -> onCancel(), KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); }
public JComponent createComponent() { pathToTranslationRootTextField.getButton().addMouseListener(createPathButtonMouseListener(pathToTranslationRootTextField.getTextField(), FileChooserDescriptorFactory.createSingleFolderDescriptor())); pathToTranslationRootTextFieldReset.addMouseListener(createResetPathButtonMouseListener(pathToTranslationRootTextField.getTextField(), Settings.DEFAULT_TRANSLATION_PATH)); directoryToApp.getButton().addMouseListener(createPathButtonMouseListener(directoryToApp.getTextField(), FileChooserDescriptorFactory.createSingleFolderDescriptor())); directoryToAppReset.addMouseListener(createResetPathButtonMouseListener(directoryToApp.getTextField(), Settings.DEFAULT_APP_DIRECTORY)); directoryToWeb.getButton().addMouseListener(createPathButtonMouseListener(directoryToWeb.getTextField(), FileChooserDescriptorFactory.createSingleFolderDescriptor())); directoryToWebReset.addMouseListener(createResetPathButtonMouseListener(directoryToWeb.getTextField(), Settings.DEFAULT_WEB_DIRECTORY)); enableSchedulerCheckBox.setEnabled(WebDeploymentUtil.isEnabled(project)); buttonReindex.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { IndexUtil.forceReindex(); super.mouseClicked(e); } }); return panel1; }
public static void initDFileTextWithBrowse(final @NotNull Project project, final @NotNull TextFieldWithBrowseButton textWithBrowse) { textWithBrowse.getButton().addActionListener(event -> { final String initialPath = FileUtil.toSystemIndependentName(textWithBrowse.getText().trim()); final VirtualFile initialFile = initialPath.isEmpty() ? null : LocalFileSystem.getInstance().findFileByPath(initialPath); final PsiFile initialPsiFile = initialFile == null ? null : PsiManager.getInstance(project).findFile(initialFile); final TreeFileChooser fileChooser = TreeFileChooserFactory.getInstance(project).createFileChooser( DlangBundle.INSTANCE.message("choose.dlanguage.main.file"), initialPsiFile, DlangFileType.INSTANCE, file -> !DlangWritingAccessProvider.isInDLanguageSdkOrDLanguagePackagesFolder(file) ); fileChooser.showDialog(); final PsiFile selectedFile = fileChooser.getSelectedFile(); final VirtualFile virtualFile = selectedFile == null ? null : selectedFile.getVirtualFile(); if (virtualFile != null) { final String path = FileUtil.toSystemDependentName(virtualFile.getPath()); textWithBrowse.setText(path); } }); }
fileChooser.getButton().addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) {