org.netbeans.modules.editor.codetemplates/1 1.2.22

org.netbeans.lib.editor.codetemplates.api
Class CodeTemplateManager

java.lang.Object
  extended by org.netbeans.lib.editor.codetemplates.api.CodeTemplateManager

public final class CodeTemplateManager
extends Object

Code template manager maintains list of code templates for a particular document type and allows temporary code templates to be created.


Method Summary
 CodeTemplate createTemporary(String parametrizedText)
          Create temporary code template for an ad hoc insertion.
static CodeTemplateManager get(Document doc)
          Get an instance of the manager for the given document.
 Collection getCodeTemplates()
          Get unmodifiable collection of the code templates for this manager.
 boolean isLoaded()
          Check whether asynchronous loading of the code templates into this manager was already finished.
 void registerLoadedListener(ChangeListener listener)
          Register change listener waiting for the state when this manager becomes loaded with the code templates.
 void waitLoaded()
          Wait for this manager to become loaded with the code templates.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

get

public static CodeTemplateManager get(Document doc)
Get an instance of the manager for the given document.

Parameters:
doc - document for which the instance of the manager should be obtained.

getCodeTemplates

public Collection getCodeTemplates()
Get unmodifiable collection of the code templates for this manager.
This method will block until the code templates will be loaded.

Returns:
non-null unmodifiable collection of the code templates.

createTemporary

public CodeTemplate createTemporary(String parametrizedText)
Create temporary code template for an ad hoc insertion.

Parameters:
parametrizedText - non-null parametrized text of the code template.
Returns:
non-null code template that can be inserted into the document.

isLoaded

public boolean isLoaded()
Check whether asynchronous loading of the code templates into this manager was already finished.

Returns:
true if this manager is already loaded with the code templates or false if the templates are still being loaded.
See Also:
registerLoadedListener(ChangeListener)

waitLoaded

public void waitLoaded()
Wait for this manager to become loaded with the code templates.
If this manager is already loaded this method returns immediately.


registerLoadedListener

public void registerLoadedListener(ChangeListener listener)
Register change listener waiting for the state when this manager becomes loaded with the code templates.

In case the manager is already loaded the registered listener will be fired immediately in the same thread.

There is no unregistration of the listeners because they are forgotten automatically once the manager becomes loaded.

Parameters:
listener - change listener to be fired once this manager becomes loaded by the code templates.

org.netbeans.modules.editor.codetemplates/1 1.2.22

Built on July 11 2007.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.