com.bea.workshop.controls.ui.actions
Class InsertGenericControlDelegate

java.lang.Object
  extended by com.bea.workshop.controls.ui.actions.DefaultControlInsertionDelegate
      extended by com.bea.workshop.controls.ui.actions.InsertGenericControlDelegate
All Implemented Interfaces:
com.bea.workshop.controls.core.model.IControlInsertionDelegate
Direct Known Subclasses:
InsertDBControlDelegate, InsertEJBControlDelegate, InsertJMSControlDelegate

public class InsertGenericControlDelegate
extends DefaultControlInsertionDelegate

A generic control insertion delegate for inserting a reference to an extensible control, which requires a control extension to be created first.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.bea.workshop.controls.ui.actions.DefaultControlInsertionDelegate
DefaultControlInsertionDelegate.AnnotationInfo
 
Constructor Summary
InsertGenericControlDelegate()
           
 
Method Summary
static String getJavaResourcePackageName(IPath absolutePath)
          Given the absolutePath of a Java resource, returns the package name of the resource or null if the resource is not properly located in a project or folder on the build classpath or that is the build output path.
protected  NewFileWizard getNewControlFileWizard(com.bea.workshop.controls.core.model.IControlInsertionDelegateContext context)
          Method for subclasses to instantiate particular control file wizards.
static IProject getProjectOf(IPath absolutePath)
          Returns the handle of the IProject at the beginning of the given absolutePath.
static IWorkspaceRoot getWorkspaceRoot()
          Returns the IWorkspaceRoot object.
 IJavaElement insertControl(com.bea.workshop.controls.core.model.IControlInsertionDelegateContext context)
          This default implementation does only the work of inserting a control field into the compilation unit's primary type.
 
Methods inherited from class com.bea.workshop.controls.ui.actions.DefaultControlInsertionDelegate
copyJarIfNecessary, getDefaultControlDeclarationFieldName, getFileFromPlugin, insertControl, insertControl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InsertGenericControlDelegate

public InsertGenericControlDelegate()
Method Detail

insertControl

public IJavaElement insertControl(com.bea.workshop.controls.core.model.IControlInsertionDelegateContext context)
Description copied from class: DefaultControlInsertionDelegate
This default implementation does only the work of inserting a control field into the compilation unit's primary type. It does not show any wizard dialog or do anything else to collect user input. Subclassers may do so if they choose, and can continue to delegate to this class to do the field insertion if they wish. The example output of calling this is:

import org.apache.beehive.controls.api.bean.Control;
import com.somecontrolprovider.AnExampleControl;

...

@Control
private AnExampleControl control1;

Specified by:
insertControl in interface com.bea.workshop.controls.core.model.IControlInsertionDelegate
Overrides:
insertControl in class DefaultControlInsertionDelegate
Parameters:
context - the IControlInsertionDelegateContext that provides contextual information for the control insertion, and also allows some parameterization of the insertion.
Returns:
a reference to the newly inserted Java element or null if the control insertion was not successful.

getJavaResourcePackageName

public static String getJavaResourcePackageName(IPath absolutePath)
Given the absolutePath of a Java resource, returns the package name of the resource or null if the resource is not properly located in a project or folder on the build classpath or that is the build output path.

Parameters:
absolutePath - The absolute path of the Java resource.
Returns:
the package name of the Java resource.

getProjectOf

public static IProject getProjectOf(IPath absolutePath)
Returns the handle of the IProject at the beginning of the given absolutePath. Neither the given path nor the project need exist in the workspace. The path must be absolute, and must consist of at least one segment.

Returns:
An IProject handle for the project at the beginning of the given absolutePath, or null if the path does not specify a project.

getWorkspaceRoot

public static IWorkspaceRoot getWorkspaceRoot()
Returns the IWorkspaceRoot object.

Returns:
The IWorkspaceRoot object.

getNewControlFileWizard

protected NewFileWizard getNewControlFileWizard(com.bea.workshop.controls.core.model.IControlInsertionDelegateContext context)
Method for subclasses to instantiate particular control file wizards. The default implementation will pop a generic control extension wizard.

Returns:
particular file wizard object