/** * @see * edu.buffalo.cse.green.RefactorHandler#handleAdd(edu.buffalo.cse.green.editor.model.RootModel, * org.eclipse.jdt.core.IJavaElement) */ public void handleAdd(RootModel root, E element) { TypeModel type = (TypeModel) root.getModelFromElement(element.getAncestor(TYPE)); if (type != null) { type.addChild(new MethodModel((IMethod) element)); } }
/** * @see * edu.buffalo.cse.green.RefactorHandler#handleAdd(edu.buffalo.cse.green.editor.model.RootModel, * org.eclipse.jdt.core.IJavaElement) */ public void handleAdd(RootModel root, E element) { if (element.equals(element.getPrimaryElement())) { TypeModel type = (TypeModel) root.getModelFromElement(element.getAncestor(TYPE)); if (type != null) { type.addChild(new FieldModel(element)); } } }
/** * @see * edu.buffalo.cse.green.RefactorHandler#handleAdd(edu.buffalo.cse.green.editor.model.RootModel, * org.eclipse.jdt.core.IJavaElement) */ public void handleAdd(RootModel root, E element) { // if the compilation unit exists in the editor, add the type if (root.ancestorInEditor(element.getAncestor(COMPILATION_UNIT))) { TypeModel addedType = root.createTypeModel(element); if (REMOVED_TYPE != null) { addedType.setLocation(REMOVED_TYPE.getLocation()); addedType.setSize(REMOVED_TYPE.getSize()); } } }