edu.wpi.ebob.internal.jem
Class JEMClassManager

java.lang.Object
  extended by edu.wpi.ebob.internal.jem.JEMClassManager
All Implemented Interfaces:
IClassManager

public class JEMClassManager
extends java.lang.Object
implements IClassManager

Uses the Java EMF Model for performing remote operations.

Author:
Liam Morley

Nested Class Summary
private  class JEMClassManager.JavaClassChangeListener
          Tracks when changes are made to java classes in the current project.
 
Field Summary
private static IOperation ADD_OP
           
private static IOperation ALG_NEG_OP
           
private static IOperation BOOL_NEG_OP
           
private static IOperation DIV_OP
           
private  boolean isDirty
           
private  JEMClassManager.JavaClassChangeListener javaClassChangeListener
           
private  org.eclipse.jface.util.ListenerList listeners
           
private static IOperation MOD_OP
           
private static IOperation MULT_OP
           
private  org.eclipse.jdt.core.IJavaProject project
           
private  org.eclipse.jem.internal.proxy.core.ProxyFactoryRegistry registry
           
private static IOperation SUBTRACT_OP
           
 
Constructor Summary
JEMClassManager()
           
 
Method Summary
 void addClassManagerListener(IClassManagerListener listener)
           
 void associateProject(org.eclipse.jdt.core.IJavaProject javaProject)
          Associates this manager with a given Java project.
 void disassociateProject()
          Cancels the association with the given project.
 void dispose()
          Clears up any resources held by the class manager.
private  void fireDirtyFlagEvent(ClassManagerEvent event)
           
 org.eclipse.jdt.core.IJavaProject getAssociatedProject()
          Retrieves the project associated with this manager.
 IClass getClass(java.lang.String name)
          Retrieves a class with the given name.
 org.eclipse.jem.internal.proxy.core.ProxyFactoryRegistry getRegistry()
          Returns the underlying JEM ProxyFactoryRegistry associated with this manager.
 boolean isDirty()
          States whether the underlying class structure may be out of sync with the class manager.
 boolean isValid()
          Returns whether this manager is currently associated with a valid project.
 IObject performAdditionOperation(IObject left, IObject right)
          Performs left + right.
 IObject performAlgebraicNegationOperation(IObject operand)
          Performs -operand.
 IObject performBooleanNegationOperation(IObject operand)
          Performs !operand.
 IObject performDivisionOperation(IObject left, IObject right)
          Performs left / right.
 IObject performModulusOperation(IObject left, IObject right)
          Performs left % right.
 IObject performMultiplicationOperation(IObject left, IObject right)
          Performs left * right.
 IObject performOperation(IOperation op, IObject[] args)
          performs the given operation with the given arguments.
 IObject performSubtractionOperation(IObject left, IObject right)
          Performs left - right.
 void removeClassManagerListener(IClassManagerListener listener)
           
 IArray resolveArray(IClass type, IObject[] elements)
          Returns an array object using the IArray form.
 IObject resolveObject(IClass returnType, java.lang.String expression)
          Returns an object of type returnType based on the given expression, if such an expression can resolve to that returnType.
 IObject resolveValue(boolean value)
          Returns an IObject representing a primitive boolean value.
 IObject resolveValue(char value)
          Returns an IObject representing a primitive char value.
 IObject resolveValue(double value)
          Returns an IObject representing a primitive double value.
 IObject resolveValue(int value)
          Returns an IObject representing a primitive integer value.
 IObject resolveValue(java.lang.String value)
          Returns an IObject representing a primitive String value.
private  void setDirty(boolean isDirty)
          Sets the dirty flag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ADD_OP

private static final IOperation ADD_OP

SUBTRACT_OP

private static final IOperation SUBTRACT_OP

MULT_OP

private static final IOperation MULT_OP

DIV_OP

private static final IOperation DIV_OP

MOD_OP

private static final IOperation MOD_OP

ALG_NEG_OP

private static final IOperation ALG_NEG_OP

BOOL_NEG_OP

private static final IOperation BOOL_NEG_OP

registry

private org.eclipse.jem.internal.proxy.core.ProxyFactoryRegistry registry

project

private org.eclipse.jdt.core.IJavaProject project

isDirty

private boolean isDirty

listeners

private org.eclipse.jface.util.ListenerList listeners

javaClassChangeListener

private JEMClassManager.JavaClassChangeListener javaClassChangeListener
Constructor Detail

JEMClassManager

public JEMClassManager()
Method Detail

addClassManagerListener

public void addClassManagerListener(IClassManagerListener listener)
Specified by:
addClassManagerListener in interface IClassManager
See Also:
IClassManager.addClassManagerListener(IClassManagerListener)

removeClassManagerListener

public void removeClassManagerListener(IClassManagerListener listener)
Specified by:
removeClassManagerListener in interface IClassManager
See Also:
IClassManager.removeClassManagerListener(IClassManagerListener)

fireDirtyFlagEvent

private void fireDirtyFlagEvent(ClassManagerEvent event)

associateProject

public void associateProject(org.eclipse.jdt.core.IJavaProject javaProject)
Associates this manager with a given Java project. Does nothing if the current project is equal to the given project.

Specified by:
associateProject in interface IClassManager
Parameters:
javaProject - the given project, can not be null.
See Also:
IClassManager.associateProject(IJavaProject)

isValid

public boolean isValid()
Returns whether this manager is currently associated with a valid project.

Specified by:
isValid in interface IClassManager
Returns:
true if the manager is currently associated with a project, false otherwise.
See Also:
IClassManager.isValid()

isDirty

public boolean isDirty()
Description copied from interface: IClassManager
States whether the underlying class structure may be out of sync with the class manager.

Specified by:
isDirty in interface IClassManager
Returns:
true if the dirty flag has been set, false otherwise.
See Also:
IClassManager.isDirty()

setDirty

private void setDirty(boolean isDirty)
Sets the dirty flag.


disassociateProject

public void disassociateProject()
Cancels the association with the given project. Does nothing if a project is not currently associated.

Specified by:
disassociateProject in interface IClassManager
See Also:
IClassManager.disassociateProject()

getClass

public IClass getClass(java.lang.String name)
                throws java.lang.ClassNotFoundException
Retrieves a class with the given name.

Specified by:
getClass in interface IClassManager
Parameters:
name - the fully-qualified class name. Can also be "int" or another primitive type.
Returns:
the class if it exists.
Throws:
java.lang.ClassNotFoundException
See Also:
IClassManager.getClass(String)

resolveObject

public IObject resolveObject(IClass returnType,
                             java.lang.String expression)
                      throws java.lang.ClassCastException,
                             java.lang.InstantiationException,
                             RemoteException
Returns an object of type returnType based on the given expression, if such an expression can resolve to that returnType.

Specified by:
resolveObject in interface IClassManager
Throws:
RemoteException
java.lang.ClassCastException
java.lang.InstantiationException
See Also:
IClassManager.resolveObject(IClass, String)

resolveArray

public IArray resolveArray(IClass type,
                           IObject[] elements)
                    throws RemoteException
Description copied from interface: IClassManager
Returns an array object using the IArray form.

Specified by:
resolveArray in interface IClassManager
Parameters:
type - the type of the array
elements - the elements of the array
Returns:
the converted IArray object
Throws:
RemoteException
See Also:
IClassManager.resolveArray(IClass, IObject[])

resolveValue

public IObject resolveValue(boolean value)
Description copied from interface: IClassManager
Returns an IObject representing a primitive boolean value.

Specified by:
resolveValue in interface IClassManager
Parameters:
value - the boolean value, true or false.
Returns:
an IObject representing a primitive boolean value.
See Also:
IClassManager.resolveValue(boolean)

resolveValue

public IObject resolveValue(int value)
Description copied from interface: IClassManager
Returns an IObject representing a primitive integer value.

Specified by:
resolveValue in interface IClassManager
Parameters:
value - the integer value.
Returns:
an IObject representing a primitive integer value.
See Also:
IClassManager.resolveValue(int)

resolveValue

public IObject resolveValue(double value)
Description copied from interface: IClassManager
Returns an IObject representing a primitive double value.

Specified by:
resolveValue in interface IClassManager
Parameters:
value - the double value.
Returns:
an IObject representing a primitive double value.
See Also:
IClassManager.resolveValue(double)

resolveValue

public IObject resolveValue(char value)
Description copied from interface: IClassManager
Returns an IObject representing a primitive char value.

Specified by:
resolveValue in interface IClassManager
Parameters:
value - the char value.
Returns:
an IObject representing a primitive char value.
See Also:
IClassManager.resolveValue(char)

resolveValue

public IObject resolveValue(java.lang.String value)
Description copied from interface: IClassManager
Returns an IObject representing a primitive String value.

Specified by:
resolveValue in interface IClassManager
Parameters:
value - the String value.
Returns:
an IObject representing a primitive String value.
See Also:
IClassManager.resolveValue(String)

getAssociatedProject

public org.eclipse.jdt.core.IJavaProject getAssociatedProject()
Retrieves the project associated with this manager.

Specified by:
getAssociatedProject in interface IClassManager
Returns:
the project associated with this manager.
See Also:
IClassManager.getAssociatedProject()

getRegistry

public org.eclipse.jem.internal.proxy.core.ProxyFactoryRegistry getRegistry()
Returns the underlying JEM ProxyFactoryRegistry associated with this manager.

Returns:
Returns the registry.

performOperation

public IObject performOperation(IOperation op,
                                IObject[] args)
                         throws RemoteException
performs the given operation with the given arguments.

Specified by:
performOperation in interface IClassManager
Throws:
RemoteException
See Also:
IClassManager.performOperation(IOperation, IObject[])

performAdditionOperation

public IObject performAdditionOperation(IObject left,
                                        IObject right)
                                 throws RemoteException
Performs left + right.

Specified by:
performAdditionOperation in interface IClassManager
Throws:
RemoteException
See Also:
IClassManager.performAdditionOperation(IObject, IObject)

performSubtractionOperation

public IObject performSubtractionOperation(IObject left,
                                           IObject right)
                                    throws RemoteException
Performs left - right.

Specified by:
performSubtractionOperation in interface IClassManager
Throws:
RemoteException
See Also:
IClassManager.performSubtractionOperation(IObject, IObject)

performMultiplicationOperation

public IObject performMultiplicationOperation(IObject left,
                                              IObject right)
                                       throws RemoteException
Performs left * right.

Specified by:
performMultiplicationOperation in interface IClassManager
Throws:
RemoteException
See Also:
IClassManager.performMultiplicationOperation(IObject, IObject)

performDivisionOperation

public IObject performDivisionOperation(IObject left,
                                        IObject right)
                                 throws RemoteException
Performs left / right.

Specified by:
performDivisionOperation in interface IClassManager
Throws:
RemoteException
See Also:
IClassManager.performDivisionOperation(IObject, IObject)

performModulusOperation

public IObject performModulusOperation(IObject left,
                                       IObject right)
                                throws RemoteException
Performs left % right.

Specified by:
performModulusOperation in interface IClassManager
Throws:
RemoteException
See Also:
IClassManager.performModulusOperation(IObject, IObject)

performAlgebraicNegationOperation

public IObject performAlgebraicNegationOperation(IObject operand)
                                          throws RemoteException
Description copied from interface: IClassManager
Performs -operand.

Specified by:
performAlgebraicNegationOperation in interface IClassManager
Throws:
RemoteException
See Also:
IClassManager.performAlgebraicNegationOperation(IObject)

performBooleanNegationOperation

public IObject performBooleanNegationOperation(IObject operand)
                                        throws RemoteException
Description copied from interface: IClassManager
Performs !operand.

Specified by:
performBooleanNegationOperation in interface IClassManager
Throws:
RemoteException
See Also:
IClassManager.performBooleanNegationOperation(IObject)

dispose

public void dispose()
Description copied from interface: IClassManager
Clears up any resources held by the class manager.

Specified by:
dispose in interface IClassManager
See Also:
IClassManager.dispose()