/** * Invoked when the user clicks the icon. */ protected void onMouseClick() { TopComponent tc = WindowManager.getDefault().findTopComponent("NotificationCenterTopComponent"); tc.open(); tc.requestActive(); }
private static FileObject getOpenFileObj() { TopComponent activatedTopComponent = TopComponent.getRegistry() .getActivated(); if (activatedTopComponent == null) { return null; } DataObject dataObj = activatedTopComponent.getLookup() .lookup(DataObject.class); if ((dataObj == null) || !dataObj.isValid()) { return null; } return dataObj.getPrimaryFile(); }
@Override protected void componentActivated() { super.componentActivated(); active = true; }
@Override public void actionPerformed(ActionEvent ae) { TopComponent tc = MultiViews.createMultiView(mimeType, context); tc.open(); tc.requestActive(); } }
@Override public void performAction() { TopComponent tc = ClassViewTopComponent.findDefault(); if (!tc.isOpened()) { tc.open(); Preferences ps = NbPreferences.forModule(ClassViewTopComponent.class); ps.putBoolean(ClassViewTopComponent.OPENED_PREFERENCE, true); // NOI18N } tc.requestActive(); }
Set<TopComponent> tcs = TopComponent.getRegistry().getOpened(); for (final TopComponent tc : tcs) { Lookup l = tc.getLookup(); final DataObject tcDataObject = l.lookup(DataObject.class); if (tcDataObject != null && dataObject.equals(tcDataObject)) { final MultiViewHandler handler = MultiViews.findMultiViewHandler(tc); final EditorCookie editorCookie = dataObject.getLookup().lookup(EditorCookie.class); if(editorCookie != null) { Runnable r = new Runnable() { if(SwingUtilities.isEventDispatchThread()) { r.run(); } else { SwingUtilities.invokeLater(r); EditCookie editCookie = dataObject.getLookup().lookup(EditCookie.class); if(editCookie != null) { TopComponent.getRegistry().addPropertyChangeListener(new TCOpenedListener(dataObject, files)); editCookie.edit(); return;
private void updateName() { if (callback != null) { TopComponent tc = callback.getTopComponent(); final String name = getNameInternal(); tc.setHtmlDisplayName(name); tc.setDisplayName(name); tc.setName(getName()); tc.setToolTipText(getToolTipText()); } }
void requestActive(final boolean b) { super.requestActive(); Component c = chats.getSelectedComponent(); if (c!=null) { c.requestFocus(); } if (chats.getTabCount()==1 && b) { SwingUtilities.invokeLater(new Runnable() { public void run() { if (chats.getTabCount()==1 && b && chats.isShowing()) { //showPopup(null); } } }); } }
&& ret == false && !e.isConsumed() Keymap km = (Keymap)Lookup.getDefault().lookup(Keymap.class); Action action = (km != null) ? km.getAction(ks) : null; action = ((ContextAwareAction)action).createContextAwareInstance(getLookup()); } else if(SwingUtilities.getWindowAncestor(e.getComponent()) instanceof java.awt.Dialog) {
private FileObject getCurrentFile() { Node[] activatedNodes = TopComponent.getRegistry().getActivatedNodes(); if (activatedNodes == null || activatedNodes.length != 1) { return null; } DataObject dobj = activatedNodes[0].getLookup().lookup(DataObject.class); if (dobj == null) { return null; } FileObject fo = dobj.getPrimaryFile(); return fo; }
private void update() { project = null; TopComponent tc = TopComponent.getRegistry().getActivated(); if (tc != null) { FileObject fo = tc.getLookup().lookup(FileObject.class); if (fo == null) { DataObject dob = tc.getLookup().lookup(DataObject.class); if (dob != null) { fo = dob.getPrimaryFile(); } } if (fo != null) { Project p = FileOwnerQuery.getOwner(fo); if (p != null) { project = p; } } } if (project != null) { applicable = true; name = NbBundle.getMessage(SearchScopeCurrentProject.class, "SearchScopeCurrentProject", shortName(project)); //NOI18N icon = ProjectUtils.getInformation(project).getIcon(); } else { applicable = false; name = ""; //NOI18N icon = null; } notifyListeners(); }
@Override protected boolean enable(Node[] nodes) { TopComponent activated = TopComponent.getRegistry().getActivated(); if (activated instanceof DiffSetupSource) { return true; } VCSContext context = HgUtils.getCurrentContext(nodes); if(!HgUtils.isFromHgRepository(context)) { return false; } return Lookup.getDefault().lookup(DiffProvider.class) != null; }
/*package*/ static void navigateToOccurrence(boolean next) { final Node[] activatedNodes = TopComponent.getRegistry().getActivatedNodes(); // check whether current file is C/C++ DataObject dobj = activatedNodes[0].getLookup().lookup(DataObject.class); FileObject fo = (dobj == null) ? null : dobj.getPrimaryFile(); String mime = (fo == null) ? "" : fo.getMIMEType(); if (MIMENames.isHeaderOrCppOrC(mime)) { EditorCookie ec = dobj.getLookup().lookup(EditorCookie.class); Document doc = ec.getDocument(); int position = CaretAwareCsmFileTaskFactory.getLastPosition(dobj.getPrimaryFile()); int goTo = findOccurrencePosition(next, doc, position); if (goTo > 0) { JEditorPane pane = NbDocument.findRecentEditorPane(ec); pane.setCaretPosition(goTo); } else { StatusDisplayer.getDefault().setStatusText(NbBundle.getMessage(SemanticUtils.class, "cpp-no-marked-occurrence")); } } } }
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 final void run() { try { Source source = Source.create(document); ParserManager.parse(Collections.singleton(source), this); } catch (ParseException e) { LOG.log(Level.WARNING, null, e); return; } TopComponent activetc = TopComponent.getRegistry().getActivated(); if (ui != null) { UI.openRefactoringUI(ui, activetc); } else { JOptionPane.showMessageDialog(null, NbBundle.getMessage(CPActionsImplementationProvider.class, "ERR_CannotRefactorLoc"));//NOI18N } }
TopComponent tc = (TopComponent) SwingUtilities.getAncestorOfClass(TopComponent.class, currentPane); tc.requestActive(); ab.setAnnotationMessage(NbBundle.getMessage(AnnotateAction.class, "CTL_AnnotationSubstitute")); // NOI18N; support.start(rp, repository, NbBundle.getMessage(AnnotateAction.class, "MSG_Annotation_Progress")); // NOI18N
public void propertyChange(PropertyChangeEvent evt) { Node[] nodes = dataProviderExplorerPanel.getExplorerManager().getSelectedNodes(); tc.requestActive(); tc.setActivatedNodes(nodes); boolean canAdd = false; if((nodes != null) && (nodes.length > 0)){ Action[] actions = nodes[0].getActions(true); for(int i=0; i< actions.length; i++){ if(actions[i] instanceof NodeAction){ final NodeAction nodeAction = (NodeAction)actions[i]; if (nodeAction.getName().equals(NbBundle.getMessage(AddDataProviderDialog.class, "Add_to_Form"))){ canAdd = true; break; } } } } addButton.setEnabled(canAdd); }
if (qbp != null) { TopComponent qb = qbp.qb; if (!qb.isOpened()) { qb.open(); qb.requestActive(); return qb; try { if (dbconn == null) { throw new NamingException(NbBundle.getMessage(SqlCommandCustomizer.class, "NAME_NOT_FOUND") + " " + dsName);
public void modelProjectForDataSources(Project currentProj) { project = currentProj; ModelSet.addModelSetsListener(modelingListener); topComponent = TopComponent.getRegistry().getActivated(); topComponent.setCursor(Utilities.createProgressCursor(topComponent)); String progressBarLabel = org.openide.util.NbBundle.getMessage(DataSourceResolver.class, "LBL_ProgressBar"); //NOI18N try { // model project FacesModelSet modelSet = FacesModelSet.startModeling(project); if (modelSet == null) { handle = ProgressHandleFactory.createHandle(progressBarLabel); handle.start(); handle.switchToIndeterminate(); } // If modeling has been completed then terminate the progress cursor and update the project if (modelSet != null) { if (handle != null) { handle.finish(); } ModelSet.removeModelSetsListener(modelingListener); ProjectDataSourceTracker.refreshDataSourceReferences(project); update(project); } } finally { topComponent.setCursor(null); } }