org.formaria.editor.project.helper
Class MemberReferenceCodeHelper

java.lang.Object
  extended by org.formaria.editor.project.helper.CodeHelper
      extended by org.formaria.editor.project.helper.MemberReferenceCodeHelper

public class MemberReferenceCodeHelper
extends CodeHelper

Insert a refernce to a component as a member variable, initialize the reference in thge pageCreated method and add any required imports.

Copyright (c) Formaria Ltd., 2002-2003

$Revision: 1.7 $

License: see License.txt


Constructor Summary
MemberReferenceCodeHelper()
           
 
Method Summary
 void doInsert(javax.swing.JEditorPane editor, javax.swing.text.Document d, javax.swing.text.Caret c, EditorProject currentProject, PageResource pageRes)
          Insert the new member reference, imports and initialization code
 java.lang.String getCaption()
          Get the caption displayed on the popup menu
protected  java.awt.Component getComponent(javax.swing.JEditorPane editor, Page page)
          Get the component to reference
 java.lang.Integer getMnemonic()
          Get the mnemonic key for this item
 void register(java.util.HashMap<java.lang.String,CodeHelper> resources)
          Register the helper.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MemberReferenceCodeHelper

public MemberReferenceCodeHelper()
Method Detail

register

public void register(java.util.HashMap<java.lang.String,CodeHelper> resources)
Description copied from class: CodeHelper
Register the helper. EditorProjectManager.getStaticResources() is an array of static resources and an instance of the helper should be added to this array

Overrides:
register in class CodeHelper

doInsert

public void doInsert(javax.swing.JEditorPane editor,
                     javax.swing.text.Document d,
                     javax.swing.text.Caret c,
                     EditorProject currentProject,
                     PageResource pageRes)
              throws javax.swing.text.BadLocationException
Insert the new member reference, imports and initialization code

Specified by:
doInsert in class CodeHelper
Throws:
javax.swing.text.BadLocationException

getCaption

public java.lang.String getCaption()
Get the caption displayed on the popup menu

Specified by:
getCaption in class CodeHelper
Returns:
the caption

getMnemonic

public java.lang.Integer getMnemonic()
Get the mnemonic key for this item

Specified by:
getMnemonic in class CodeHelper
Returns:
the mnemonic

getComponent

protected java.awt.Component getComponent(javax.swing.JEditorPane editor,
                                          Page page)
Get the component to reference

Parameters:
editor - the source editor window/the parent for the popup
page - the page whose components are to be listed
Returns:
the selected component or null