org.openide.modules
Class ModuleInstall

java.lang.Object
  |
  +--org.openide.util.SharedClassObject
        |
        +--org.openide.modules.ModuleInstall
All Implemented Interfaces:
Externalizable, Serializable

public class ModuleInstall
extends SharedClassObject

Provides hooks for a custom module that may be inserted into the IDE. This interface should be implemented by the main class of a module.

Simple modules will likely not need a main class--just a few entries in the manifest file. Even modules with a main class need not do anything in it that is already covered by manifest entries; only additional special functionality need be handled here.

Specify this class in the manifest file with OpenIDE-Module-Install.

Modules wishing to keep state associated with the installation of the module may do so by implementing not only this class but also Externalizable. In this case, they are responsible for reading and writing their own state properly (probably using ObjectOutput.writeObject(java.lang.Object) and ObjectInput.readObject()). Note that state which is logically connected to the user's configuration of the module on a possibly project-specific basis should not be stored this way, but rather using a system option. (Even if this information is not to be displayed, it should still be stored as hidden properties of the system option, so as to be switched properly during project switches.)

See Also:
Serialized Form

Constructor Summary
ModuleInstall()
           
 
Method Summary
protected  boolean clearSharedData()
          Indicate whether the shared data of the last existing instance of this class should be cleared when that instance is finalized.
 void close()
          Called when all modules agreed with closing and the IDE will be closed.
 boolean closing()
          Called when the IDE is about to exit.
 void installed()
          Called when the module is first installed into the IDE.
 void restored()
          Called when an already-installed module is restored (at IDE startup time).
 void uninstalled()
          Called when the module is uninstalled (from a running IDE).
 void updated(int release, String specVersion)
          Called when the module is loaded and the version is higher than by the previous load The default implementation calls restored().
 void validate()
          Called when a module is being considered for loading.
 
Methods inherited from class org.openide.util.SharedClassObject
addNotify, addPropertyChangeListener, equals, finalize, findObject, findObject, firePropertyChange, getLock, getProperty, hashCode, initialize, putProperty, putProperty, readExternal, removeNotify, removePropertyChangeListener, writeExternal, writeReplace
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModuleInstall

public ModuleInstall()
Method Detail

validate

public void validate()
              throws IllegalStateException
Called when a module is being considered for loading. (This would be before installed(), restored(), or updated(int, java.lang.String) are called.) If something is critically wrong with the module (missing ad-hoc dependency, missing license key, etc.) then IllegalStateException may be thrown to prevent it from being loaded (preferably with a localized annotation). The default implementation does nothing. The module cannot assume much about when this method will be called; specifically it cannot rely on layers or manifest sections to be ready, nor for the module's classloader to exist in the system class loader (so if loading bundles, icons, and so on, specifically pass in the class loader of the install class rather than relying on the default modules class loader).
Since:
1.24

installed

public void installed()
Called when the module is first installed into the IDE. Should perform whatever setup functions are required. The default implementation calls restored.

Typically, would do one-off functions, and then also call restored().


restored

public void restored()
Called when an already-installed module is restored (at IDE startup time). Should perform whatever initializations are required.

updated

public void updated(int release,
                    String specVersion)
Called when the module is loaded and the version is higher than by the previous load The default implementation calls restored().

uninstalled

public void uninstalled()
Called when the module is uninstalled (from a running IDE). Should remove whatever functionality from the IDE that it had registered.

closing

public boolean closing()
Called when the IDE is about to exit. The default implementation returns true. The module may cancel the exit if it is not prepared to be shut down.
Returns:
true if it is ok to exit the IDE

close

public void close()
Called when all modules agreed with closing and the IDE will be closed.

clearSharedData

protected boolean clearSharedData()
Description copied from class: SharedClassObject
Indicate whether the shared data of the last existing instance of this class should be cleared when that instance is finalized. Subclasses may perform additional tasks on finalization if desired. This method should be overridden in lieu of SharedClassObject.finalize().

The default implementation returns true. Classes which have precious shared data may want to return false, so that all instances may be finalized, after which new instances will pick up the same shared variables without requiring a recalculation.

Overrides:
clearSharedData in class SharedClassObject
Following copied from class: org.openide.util.SharedClassObject
Returns:
true if all shared data should be cleared, false if it should stay in memory


Built on December 12 2001.  |  Portions Copyright 1997-2001 Sun Microsystems, Inc. All rights reserved.