private Object getInternalFrameID(TopComponent topComponent) { Object internalFrameID = topComponent.getClientProperty("internalFrameID"); if (internalFrameID == null) { internalFrameID = "IF" + Long.toHexString(new Random().nextLong()); topComponent.putClientProperty("internalFrameID", internalFrameID); } return internalFrameID; }
public void run() { Set components = TopComponent.getRegistry().getOpened(); for (Iterator i = components.iterator(); i.hasNext();) { TopComponent tc = (TopComponent) i.next(); if (tc.getClientProperty(ResolveConflictsExecutor.class.getName()) != null) { tc.requestActive(); } } } });
@Override public void componentAdded(ContainerEvent e) { Component c = e.getChild(); while(((c = c.getParent()) != null)) { if(c instanceof TopComponent) { RequestProcessor.Task t = (RequestProcessor.Task) ((TopComponent)c).getClientProperty(REGISTER_TASK); if(t != null) { t.schedule(1000); } break; } } } @Override public void componentRemoved(ContainerEvent e) { }
@Override public void componentAdded(ContainerEvent e) { Component c = e.getChild(); while(((c = c.getParent()) != null)) { if(c instanceof TopComponent) { RequestProcessor.Task t = (RequestProcessor.Task) ((TopComponent)c).getClientProperty(REGISTER_TASK); if(t != null) { t.schedule(1000); } break; } } }
/** * Overwrite when you want to change default persistence type. Default * persistence type is PERSISTENCE_ALWAYS. * Return value should be constant over a given TC's lifetime. * @return one of P_X constants * @since 4.20 */ public int getPersistenceType() { //First check for 'PersistenceType' client property for compatibility. if (warnedClasses.add(getClass()) && !TopComponent.class.equals(getClass())) { ErrorManager.getDefault().log(ErrorManager.WARNING, "Note - " // NOI18N + getClass().getName() + " ought to override getPersistenceType()" // NOI18N + " rather than using the client property or accepting the default."); // NOI18N } String propValue = (String) getClientProperty("PersistenceType"); // NOI18N if (propValue == null) { return PERSISTENCE_ALWAYS; } else if ("Never".equals(propValue)) { // NOI18N return PERSISTENCE_NEVER; } else if ("OnlyOpened".equals(propValue)) { // NOI18N return PERSISTENCE_ONLY_OPENED; } else { return PERSISTENCE_ALWAYS; } }
/** * Overwrite when you want to change default persistence type. Default * persistence type is PERSISTENCE_ALWAYS. * Return value should be constant over a given TC's lifetime. * @return one of P_X constants * @since 4.20 */ public int getPersistenceType() { //First check for 'PersistenceType' client property for compatibility. if (warnedClasses.add(getClass()) && !TopComponent.class.equals(getClass())) { ErrorManager.getDefault().log(ErrorManager.WARNING, "Note - " // NOI18N + getClass().getName() + " ought to override getPersistenceType()" // NOI18N + " rather than using the client property or accepting the default."); // NOI18N } String propValue = (String) getClientProperty("PersistenceType"); // NOI18N if (propValue == null) { return PERSISTENCE_ALWAYS; } else if ("Never".equals(propValue)) { // NOI18N return PERSISTENCE_NEVER; } else if ("OnlyOpened".equals(propValue)) { // NOI18N return PERSISTENCE_ONLY_OPENED; } else { return PERSISTENCE_ALWAYS; } }
private static TopComponent findExistingTc(Artifact artifact) { String id = getTcId(artifact); Set<TopComponent> tcs = WindowManager.getDefault().getRegistry().getOpened(); for (TopComponent tc : tcs) { if (id.equals(tc.getClientProperty(MAVEN_TC_PROPERTY))) { return tc; } } return null; }
private boolean isOpen(Snapshot s) { File f = FileUtil.toFile(s.getFile()); if (f == null) return false; // #236480 if (s.isHeapDump()) { Set<TopComponent> tcs = WindowManager.getDefault().getRegistry().getOpened(); for (TopComponent tc : tcs) { if (f.equals(tc.getClientProperty(ProfilerTopComponent.RECENT_FILE_KEY))) return true; } } else { LoadedSnapshot ls = ResultsManager.getDefault().findLoadedSnapshot(f); if (ls != null) return true; } return false; }