Refine search
private void notifyFileObjectNotFound(IssueLocation issueLocation) { File file = issueLocation.getFile(projectContext, projectKeyChecker); String messageTitle = org.openide.util.NbBundle.getMessage(SonarIssuesTopComponent.class, "SonarIssuesTopComponent.unexistentFile.title"); String message = MessageFormat.format(org.openide.util.NbBundle.getMessage(SonarIssuesTopComponent.class, "SonarIssuesTopComponent.unexistentFile.text"), file.getPath()); JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), message, messageTitle, JOptionPane.WARNING_MESSAGE); }
/** * Invoked when the user clicks the icon. */ protected void onMouseClick() { TopComponent tc = WindowManager.getDefault().findTopComponent("NotificationCenterTopComponent"); tc.open(); tc.requestActive(); }
/** Finds current undo/redo. */ static UndoRedo getUndoRedo (){ TopComponent el = WindowManager.getDefault ().getRegistry ().getActivated (); return el == null ? UndoRedo.NONE : el.getUndoRedo (); }
private static TopComponent getOutputWindow() { final String outputWindowId = "output"; //NOI18N TopComponent outputWindow = WindowManager.getDefault().findTopComponent(outputWindowId); assert outputWindow != null : "Could not find the output window using id " + outputWindowId; //NOI18N return outputWindow; }
@Override public void restored() { if (SWITCH_EDITOR_COLORS) { WindowManager.getDefault().invokeWhenUIReady(new Runnable() { @Override public void run() { switchEditorColorsProfile(); } }); }; }
@Override public void run() { // Hack to force the current Project selection when the application starts up TopComponent tc = WindowManager.getDefault().findTopComponent(PROJECT_LOGICAL_TAB_ID); if (tc != null) { tc.requestActive(); } } });
@Override public boolean closing() { if (Lookup.getDefault().lookup(ProjectController.class).getCurrentProject() == null) { //Close directly if no project open return true; } int option = JOptionPane.showConfirmDialog(WindowManager.getDefault().getMainWindow(), NbBundle.getMessage(Installer.class, "CloseConfirmation.message"), NbBundle.getMessage(Installer.class, "CloseConfirmation.message"), JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE); if (option == JOptionPane.YES_OPTION) { Lookup.getDefault().lookup(ProjectControllerUI.class).saveProject(); } else if (option == JOptionPane.CANCEL_OPTION || option == JOptionPane.CLOSED_OPTION) { return false;//Exit canceled } Lookup.getDefault().lookup(ProjectController.class).closeCurrentProject(); return true; }
private void initGephi() { final ProjectController pc = Lookup.getDefault().lookup(ProjectController.class); WindowManager.getDefault().invokeWhenUIReady(new Runnable() { @Override public void run() { pc.startup(); DragNDropFrameAdapter.register(); } }); }
public void performActionAt(int index) { NewType[] nt = newTypes (); // bugfix #41587, AIOBE if array is empty if (nt.length <= index) { return; } Node[] arr; if (lookup != null) { arr = (Node[])lookup.lookup (new Lookup.Template (Node.class)).allInstances ().toArray (new Node[0]); } else { arr = WindowManager.getDefault().getRegistry ().getCurrentNodes (); } performAction (arr, nt[index]); }
private boolean cssFileFocused() { WindowManager manager = WindowManager.getDefault(); Frame mainWindow = manager.getMainWindow(); if (mainWindow.isActive()) { TopComponent.Registry registry = manager.getRegistry(); TopComponent activeTC = registry.getActivated(); if (activeTC != null) { if (activeTC instanceof CssStylesTC) { return true; } if (manager.isOpenedEditorTopComponent(activeTC)) { FileObject fob = activeTC.getLookup().lookup(FileObject.class); if ((fob != null) && "text/css".equals(fob.getMIMEType())) { // NOI18N return true; } } } } return false; }
/** * Returns the file selected in the editor. * * @return file selected in the editor. */ private static FileObject selectedEditorFile() { WindowManager manager = WindowManager.getDefault(); TopComponent.Registry registry = manager.getRegistry(); TopComponent active = registry.getActivated(); if ((active == null) || !manager.isOpenedEditorTopComponent(active)) { active = null; for (Mode mode : manager.getModes()) { if (manager.isEditorMode(mode)) { active = mode.getSelectedTopComponent(); if (active != null) { break; } } } } FileObject selectedFile = null; if (active != null) { selectedFile = active.getLookup().lookup(FileObject.class); } return selectedFile; }
private DataObject getActivatedDataObject(){ DataObject dob = null; Node[] activatedNodes = TopComponent.getRegistry().getActivatedNodes(); if (activatedNodes != null && activatedNodes.length == 1) { dob = activatedNodes[0].getLookup().lookup(DataObject.class); } if (dob == null) { TopComponent activated = TopComponent.getRegistry().getActivated(); if (activated != null && WindowManager.getDefault().isOpenedEditorTopComponent(activated)) { dob = activated.getLookup().lookup(DataObject.class); } } return dob; }
@Override public void run() { WindowManager.getDefault().getMainWindow().setCursor(Cursor.getDefaultCursor()); if (finishedMessage && file != null) { if (autoSave) { final String msg = NbBundle.getMessage(ScreenshotMaker.class, "ScreenshotMaker.finishedMessage.message", file.getAbsolutePath()); StatusDisplayer.getDefault().setStatusText(msg); } else { final String msg = NbBundle.getMessage(ScreenshotMaker.class, "ScreenshotMaker.finishedMessage.message", file.getName()); JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), msg, NbBundle.getMessage(ScreenshotMaker.class, "ScreenshotMaker.finishedMessage.title"), JOptionPane.INFORMATION_MESSAGE); } } } });
@Override public boolean openProject(URL url) { Project p = getProject(url); if (p == null) { return false; } OpenProjects.getDefault().open(new Project[] { p }, false); TopComponent projectsTC = WindowManager.getDefault().findTopComponent("projectTabLogical_tc"); // NOI18N projectsTC.requestActive(); ExplorerManager em = ((ExplorerManager.Provider) projectsTC).getExplorerManager(); Node root = em.getRootContext(); Node projNode = null; for (Node n : root.getChildren().getNodes()) { Project prj = n.getLookup().lookup(Project.class); if (prj != null && prj.getProjectDirectory().equals(p.getProjectDirectory())) { projNode = n; break; } } if (projNode == null) { // fallback projNode = root.getChildren().findChild(ProjectUtils.getInformation(p).getName()); } if (projNode != null) { try { em.setSelectedNodes(new Node[] { projNode }); } catch (Exception ignore) { // may ignore it } } return true; }
/** Invoked when an action occurs. */ @Override public void actionPerformed(ActionEvent e) { MakeExecSupport mes = node.getLookup().lookup(MakeExecSupport.class); if (mes != null) { TargetEditor targetEditor = new TargetEditor(mes.getMakeTargetsArray(), null, null); int ret = targetEditor.showOpenDialog((JFrame) WindowManager.getDefault().getMainWindow()); if (ret == TargetEditor.OK_OPTION) { mes.setMakeTargets(targetEditor.getTargets()); } } } }
private void selectProject(final Project p) { final ExplorerManager em = ((ExplorerManager.Provider) WindowManager.getDefault().findTopComponent("projectTabLogical_tc")).getExplorerManager(); // NOI18N Node root = em.getRootContext(); // Node projNode = root.getChildren ().findChild( p.getProjectDirectory().getName () ); Node projNode = null; for (Node n : root.getChildren().getNodes()) { Project prj = n.getLookup().lookup(Project.class); if (prj != null && prj.getProjectDirectory().equals(p.getProjectDirectory())) { projNode = n; break; } } if (projNode == null) { // fallback.. projNode = root.getChildren().findChild(ProjectUtils.getInformation(p).getName()); } if (projNode != null) { try { em.setSelectedNodes(new Node[]{projNode}); } catch (Exception ignore) { // may ignore it } } } };
private List<FacesModel> getVisibleModels() { List<FacesModel> visibleModels = new ArrayList<FacesModel>(); for(Mode mode : WindowManager.getDefault().getModes()) { TopComponent tc = mode.getSelectedTopComponent(); if(tc != null && tc.isOpened() && isMultiViewTopComponent(tc)){ TopComponent topComponent = getSelectedMultiView(tc); if(topComponent != null && isDesignerTopComponent(topComponent)) { // DataObject dObj = topComponent.getActivatedNodes()[0].getLookup().lookup(DataObject.class); // XXX #131996 Defend against possible NPE's. org.openide.nodes.Node[] activatedNodes = topComponent.getActivatedNodes(); if (activatedNodes == null || activatedNodes.length == 0) { info(new NullPointerException("TopComponent doesn't have any activated nodes, topComponent=" + topComponent + ", nodes=" + activatedNodes)); // NOI18N continue; } DataObject dObj = activatedNodes[0].getLookup().lookup(DataObject.class); if (dObj == null) { info(new NullPointerException("Activated node from top component" + " doesn't contain DataObject in its first activated node lookup, topComponent=" + topComponent + ", node=" + activatedNodes[0])); // NOI18N continue; } visibleModels.add((FacesModel)getModel(dObj.getPrimaryFile())); } } } return visibleModels; }
public GraphTopComponent() { initComponents(); setName(NbBundle.getMessage(GraphTopComponent.class, "CTL_GraphTopComponent")); WindowManager.getDefault().invokeWhenUIReady(new Runnable() { @Override public void run() {
public JMenuItem getPopupPresenter() { JMenu kenaiPopup = new JMenu(); //NOI18N final Node[] nodes = WindowManager.getDefault().getRegistry().getActivatedNodes(); kenaiPopup.setVisible(false); if (proj == null || !isKenaiProject(proj) || nodes.length > 1) { // hide for non-Kenai projects if (repoForProjCache.get(proj) == null && nodes.length == 1) { // start caching request, show dummy item... final JMenu dummy = new JMenu(NbBundle.getMessage(KenaiPopupMenu.class, "LBL_CHECKING")); //NOI18N dummy.setVisible(true); dummy.setEnabled(false);
public static void hidePopup() { if (popupWindow != null) { // popupWindow.getContentPane().removeAll(); Toolkit.getDefaultToolkit().removeAWTEventListener(hideListener); popupWindow.setVisible(false); popupWindow.dispose(); } WindowManager.getDefault().getMainWindow().removeWindowStateListener(hideListener); WindowManager.getDefault().getMainWindow().removeComponentListener(hideListener); popupWindow = null; }