|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.bea.workshop.controls.ui.actions.DefaultControlInsertionDelegate
public class DefaultControlInsertionDelegate
Nested Class Summary | |
---|---|
static class |
DefaultControlInsertionDelegate.AnnotationInfo
Describes an annotation to be added to a generated control field. |
Constructor Summary | |
---|---|
DefaultControlInsertionDelegate()
|
Method Summary | |
---|---|
protected boolean |
copyJarIfNecessary(com.bea.workshop.controls.core.model.IControlInsertionDelegateContext ctx,
File file,
String targetFileName)
Copy the given file into the appropriate library location in the project. |
protected String |
getDefaultControlDeclarationFieldName(IType primaryType,
String shortTypeName)
By overriding this method, subclasses can provide their own field name. |
protected File |
getFileFromPlugin(Plugin plugin,
String pluginRelativePath)
Convenience method for retrieving a File from a plugin. |
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. |
IJavaElement |
insertControl(com.bea.workshop.controls.core.model.IControlInsertionDelegateContext context,
List<DefaultControlInsertionDelegate.AnnotationInfo> extraAnnotations)
Insert a control reference, as described in insertControl(IControlInsertionDelegateContext) ,
with an option to add configuration information in the form of extra annotations. |
IJavaElement |
insertControl(com.bea.workshop.controls.core.model.IControlInsertionDelegateContext context,
String annotationName,
Map<String,String> annotationAttrs)
Convenience method to insert a control with a single configuration annotation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultControlInsertionDelegate()
Method Detail |
---|
public IJavaElement insertControl(com.bea.workshop.controls.core.model.IControlInsertionDelegateContext context)
import org.apache.beehive.controls.api.bean.Control;
import com.somecontrolprovider.AnExampleControl;
...
@Control
private AnExampleControl control1;
insertControl
in interface com.bea.workshop.controls.core.model.IControlInsertionDelegate
context
- the IControlInsertionDelegateContext that provides contextual information
for the control insertion, and also allows some parameterization of the insertion.
public IJavaElement insertControl(com.bea.workshop.controls.core.model.IControlInsertionDelegateContext context, String annotationName, Map<String,String> annotationAttrs)
insertControl(IControlInsertionDelegateContext, List)
.
public IJavaElement insertControl(com.bea.workshop.controls.core.model.IControlInsertionDelegateContext context, List<DefaultControlInsertionDelegate.AnnotationInfo> extraAnnotations)
insertControl(IControlInsertionDelegateContext)
,
with an option to add configuration information in the form of extra annotations.
If any extra annotations are provided, they will be added to the new control reference field. All attributes must be provided as strings, but they will be rendered as the types that they are declared on the annotation definition. (i.e. without quotes where necessary) This can be used for configuring a new control, and will produce something like:
@ExampleSettings( someKey="someValue", someOtherKey=true )
@Control
private AnExampleControl control1;
protected final String getDefaultControlDeclarationFieldName(IType primaryType, String shortTypeName)
shortTypeName
- The type name to use for the field, which would normally be the unqualified control typeprimaryType
- the primary (outermost) type for the compilation unit in which the control field is being inserted.protected boolean copyJarIfNecessary(com.bea.workshop.controls.core.model.IControlInsertionDelegateContext ctx, File file, String targetFileName) throws FileNotFoundException, CoreException
getFileFromPlugin(Plugin, String)
can be used to get a java.io.File reference to it to pass to this method.
ctx
- The IControlInsertionDelegateContext for this insertion delegatefile
- The file to copytargetFileName
- The name to give the file after copying
FileNotFoundException
- if the file to copy does not exist
CoreException
- if an error occurs while copying the file
IllegalArgumentException
- if the current project is not a valid web or ear projectprotected File getFileFromPlugin(Plugin plugin, String pluginRelativePath) throws CoreException
copyJarIfNecessary(IControlInsertionDelegateContext, File, String)
to copy a jar that lives in a plugin.
plugin
- The Plugin that contains the filepluginRelativePath
- The path to the file, relative to the plugin root
IllegalArgumentException
- if the file does not exist
CoreException
- if there is a problem retrieving the file
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |