Package com.iizigo.link.java
Class AddAnnotationPrecondition
- java.lang.Object
- com.iizigo.link.java.AddAnnotationPrecondition
- All Implemented Interfaces:
ILinkOperation
public class AddAnnotationPrecondition extends java.lang.Object implements ILinkOperation
Adds an annotation to a Java element (type or method) as a precondition to an operation.- Author:
- Christopher Mindus
Constructor Summary
Constructors Constructor Description AddAnnotationPrecondition(org.eclipse.jdt.core.IJavaElement element, java.lang.String fqnAnnotation, java.lang.String param, java.lang.String ref, boolean allowMultiple)
Constructor.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ItemNavigatorPresentation
createOperationNode(ItemNavigatorPresentation parent)
Creates the operation node for presentation in the link wizard main page.boolean
equalsOp(ILinkOperation op)
Checks if two operations are equal.org.eclipse.core.runtime.IStatus
executeOperation(ComplexOperation op)
Executes the operation.org.eclipse.core.runtime.IStatus
isOperationEnabled()
The add annotation operation is always enabled.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.iizigo.link.ILinkOperation
addPages, getDependentOperations, isOperationEnabled, isPrecondition, isSelected, isWizardDialogRequired, validateOperations
Constructor Detail
AddAnnotationPrecondition
public AddAnnotationPrecondition(org.eclipse.jdt.core.IJavaElement element, java.lang.String fqnAnnotation, java.lang.String param, java.lang.String ref, boolean allowMultiple)
Constructor.- Parameters:
element
- The Java element: method or type.fqnAnnotation
- The annotation fully qualified name.param
- The parameter in the annotation for the reference (relative reference for methods).ref
- The reference.allowMultiple
- Flag to allow multiple annotations.
Method Detail
createOperationNode
public ItemNavigatorPresentation createOperationNode(ItemNavigatorPresentation parent)
Creates the operation node for presentation in the link wizard main page.- Specified by:
createOperationNode
in interfaceILinkOperation
- Parameters:
parent
- The parent node.- Returns:
- The node.
isOperationEnabled
public org.eclipse.core.runtime.IStatus isOperationEnabled()
The add annotation operation is always enabled.- Specified by:
isOperationEnabled
in interfaceILinkOperation
- Returns:
- OK_STATUS.
executeOperation
public org.eclipse.core.runtime.IStatus executeOperation(ComplexOperation op) throws org.eclipse.core.runtime.CoreException
Executes the operation.- Specified by:
executeOperation
in interfaceILinkOperation
- Parameters:
op
- The complex operation.- Returns:
- The status of the operation. A complex operation would have a
MultiStatus
return code. - Throws:
org.eclipse.core.runtime.CoreException
- If annotation failed to be added.
equalsOp
public boolean equalsOp(ILinkOperation op)
Checks if two operations are equal.- Specified by:
equalsOp
in interfaceILinkOperation
- Parameters:
op
- Operation to compare with.- Returns:
- true if they produce the same result, false otherwise.