Index: TopComponent.java =================================================================== RCS file: /cvs/openide/src/org/openide/windows/TopComponent.java,v retrieving revision 1.108 diff -c -r1.108 TopComponent.java *** TopComponent.java 22 Nov 2003 00:11:18 -0000 1.108 --- TopComponent.java 15 Dec 2003 16:02:57 -0000 *************** *** 88,94 **** * it from active view (on the current workspace). * @deprecated Do not use. It is redundant since workspaces are not supported anymore. */ public static final int CLOSE_LAST = 1; ! /** a lock for operations in default impl of getLookup */ private static Object defaultLookupLock = new Object (); --- 88,102 ---- * it from active view (on the current workspace). * @deprecated Do not use. It is redundant since workspaces are not supported anymore. */ public static final int CLOSE_LAST = 1; ! ! /** Persistence type of TopComponent instance. TopComponent is persistent. */ ! public static final int PERSISTENCE_ALWAYS = 0; ! /** Persistence type of TopComponent instance. TopComponent is persistent only when ! * it is opened in Mode. */ ! public static final int PERSISTENCE_ONLY_OPENED = 1; ! /** Persistence type of TopComponent instance. TopComponent is not persistent. */ ! public static final int PERSISTENCE_NEVER = 2; ! /** a lock for operations in default impl of getLookup */ private static Object defaultLookupLock = new Object (); *************** *** 125,131 **** // #27731 TopComponent itself shouldn't get the focus. // XXX What to do in case nothing in TopComponent is focusable? setFocusable(false); - initActionMap(); } --- 133,138 ---- *************** *** 220,225 **** --- 227,252 ---- WindowManager.getDefault().topComponentActivatedNodesChanged(this, this.activatedNodes); firePropertyChange("activatedNodes", old, this.activatedNodes); // NOI18N + } + + /** + * 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 + */ + public int getPersistenceType() { + //First check for 'PersistenceType' client property for compatibility. + String propValue = (String) getClientProperty("PersistenceType"); + if (propValue == null) { + return PERSISTENCE_ALWAYS; + } else if ("Never".equals(propValue)) { + return PERSISTENCE_NEVER; + } else if ("OnlyOpened".equals(propValue)) { + return PERSISTENCE_ONLY_OPENED; + } else { + return PERSISTENCE_ALWAYS; + } } /** Get the undo/redo support for this component.