@Override protected final void actionPerformed(PhpModule phpModule) { // called via shortcut if (!CakePhpUtils.isCakePHP(phpModule)) { return; } JTextComponent editor = EditorRegistry.lastFocusedComponent(); if (editor == null) { return; } Document document = editor.getDocument(); if (document == null) { return; } FileObject fileObject = NbEditorUtilities.getFileObject(document); if (fileObject == null) { return; } // get go to files CakePhpGoToStatusFactory factory = CakePhpGoToStatusFactory.getInstance(); CakePhpGoToStatus status = factory.create(fileObject, editor.getCaretPosition()); final List<GoToItem> items = getGoToItems(status); if (items == null || items.isEmpty()) { return; } // if there are multiple items, show popup list if (items.size() == 1 && !CakePreferences.isShowPopupForOneItem(phpModule)) { for (GoToItem item : items) { UiUtils.open(item.getFileObject(), item.getOffset()); return; } } // show popup try { Rectangle rectangle = editor.modelToView(editor.getCaretPosition()); final Point point = new Point(rectangle.x, rectangle.y + rectangle.height); SwingUtilities.convertPointToScreen(point, editor); SwingUtilities.invokeLater( new Runnable() { @Override public void run() { String title = getPopupTitle(); if (title == null) { title = ""; // NOI18N } PopupUtil.showPopup(new GoToPopup(title, items), title, point.x, point.y, true, 0); } }); } catch (BadLocationException ex) { Exceptions.printStackTrace(ex); } }
public CakePhpIgnoredFilesExtender(PhpModule phpModule) { assert phpModule != null; if (CakePreferences.ignoreTmpDirectory(phpModule)) { CakePhpModule cakeModule = CakePhpModule.forPhpModule(phpModule); if (cakeModule == null) { appTmp = null; } else { FileObject tmpDirectory = cakeModule.getDirectory(DIR_TYPE.APP, FILE_TYPE.TMP, null); appTmp = tmpDirectory == null ? null : FileUtil.toFile(tmpDirectory); } } else { appTmp = null; } }