/** * @param destination the destination element * @param kind the type of the source to paste * @param unit the parsed CU * @return an AbstractTypeDeclaration, a CompilationUnit, or null * @throws JavaModelException if something fails */ private ASTNode getDestinationNodeForSourceElement(IJavaElement destination, int kind, CompilationUnit unit) throws JavaModelException { final IType ancestor= getAncestorType(destination); if (ancestor != null) return ASTNodeSearchUtil.getAbstractTypeDeclarationNode(ancestor, unit); if (kind == IJavaElement.TYPE || kind == IJavaElement.PACKAGE_DECLARATION || kind == IJavaElement.IMPORT_DECLARATION || kind == IJavaElement.IMPORT_CONTAINER) return unit; return null; }
/** * @param destination the destination element * @param kind the type of the source to paste * @param unit the parsed CU * @return an AbstractTypeDeclaration, a CompilationUnit, or null * @throws JavaModelException if something fails */ private ASTNode getDestinationNodeForSourceElement(IJavaElement destination, int kind, CompilationUnit unit) throws JavaModelException { final IType ancestor= getAncestorType(destination); if (ancestor != null) return ASTNodeSearchUtil.getAbstractTypeDeclarationNode(ancestor, unit); if (kind == IJavaElement.TYPE || kind == IJavaElement.PACKAGE_DECLARATION || kind == IJavaElement.IMPORT_DECLARATION || kind == IJavaElement.IMPORT_CONTAINER) return unit; return null; }
private static boolean canPaste(int elementType, IJavaElement destination) { IType ancestorType= getAncestorType(destination); if (ancestorType != null) return canPasteToType(elementType); return canPasteToCu(elementType); } private static boolean canPasteToType(int elementType) {
/** * @return an AbstractTypeDeclaration, a CompilationUnit, or null */ private ASTNode getDestinationNodeForSourceElement(IJavaElement destination, int kind, CompilationUnit unit) throws JavaModelException { final IType ancestor= getAncestorType(destination); if (ancestor != null) return ASTNodeSearchUtil.getAbstractTypeDeclarationNode(ancestor, unit); if (kind == IJavaElement.TYPE || kind == IJavaElement.PACKAGE_DECLARATION || kind == IJavaElement.IMPORT_DECLARATION || kind == IJavaElement.IMPORT_CONTAINER) return unit; return null; }
private static boolean canPaste(int elementType, IJavaElement destination) { IType ancestorType= getAncestorType(destination); if (ancestorType != null) return canPasteToType(elementType); return canPasteToCu(elementType); } private static boolean canPasteToType(int elementType) {
private static boolean canPaste(int elementType, IJavaElement destination) { IType ancestorType= getAncestorType(destination); if (ancestorType != null) return canPasteToType(elementType); return canPasteToCu(elementType); } private static boolean canPasteToType(int elementType) {