List of usage examples for org.eclipse.jdt.core Flags AccDefaultMethod
int AccDefaultMethod
To view the source code for org.eclipse.jdt.core Flags AccDefaultMethod.
Click Source Link
From source file:net.harawata.mybatipse.refactoring.MapperMethodRenameParticipant.java
License:Open Source License
@Override public Change createChange(IProgressMonitor monitor) throws CoreException, OperationCanceledException { if (monitor == null) { monitor = new NullProgressMonitor(); }/* w w w .jav a 2s. co m*/ monitor.beginTask("Searching mapper statement changes.", 100); try { IType type = method.getDeclaringType(); try { if (type.isInterface() && (method.getFlags() & Flags.AccDefaultMethod) == 0) { final Map<IFile, List<ReplaceEdit>> editsPerFiles = new HashMap<IFile, List<ReplaceEdit>>(); final IJavaProject project = type.getJavaProject(); final String namespace = type.getFullyQualifiedName(); final String oldId = method.getElementName(); final String newId = getArguments().getNewName(); ElementRenameInfo info = new ElementRenameInfo(); info.setProject(project); info.setNamespace(namespace); info.setOldId(oldId); info.setNewId(newId); StatementRenameEditCollector collector = new StatementRenameEditCollector(info, isSelect()); collector.collect(editsPerFiles, monitor); if (!editsPerFiles.isEmpty()) { final CompositeChange changes = new CompositeChange("Update mapper statement ID"); for (Entry<IFile, List<ReplaceEdit>> editsPerFile : editsPerFiles.entrySet()) { IFile file = editsPerFile.getKey(); TextChange change = getTextChange(file); if (change == null) { change = new TextFileChange(file.getName(), file); TextEdit editRoot = new MultiTextEdit(); change.setEdit(editRoot); changes.add(change); } for (ReplaceEdit edit : editsPerFile.getValue()) { change.getEdit().addChild(edit); } } return changes; } } } catch (JavaModelException e) { Activator.log(Status.ERROR, e.getMessage(), e); } } finally { monitor.done(); } return null; }