@Override public int compare(ICompilationUnit o1, ICompilationUnit o2) { String name1 = o1.getElementName(); String name2 = o2.getElementName(); return name1.compareTo(name2); } });
@Override public int compare(ICompilationUnit o1, ICompilationUnit o2) { String name1= o1.getElementName(); String name2= o2.getElementName(); return name1.compareTo(name2); } });
@Override public int compare(ICompilationUnit o1, ICompilationUnit o2) { String name1= o1.getElementName(); String name2= o2.getElementName(); return name1.compareTo(name2); } });
/** * @see org.eclipse.jdt.internal.compiler.env.IDependent#getFileName() */ @Override public char[] getFileName() { return this.typeHandle.getCompilationUnit().getElementName().toCharArray(); }
/** * Creates a new rename compilation unit processor. * @param unit the compilation unit, or <code>null</code> if invoked by scripting * @throws CoreException if the cu is broken */ public RenameCompilationUnitProcessor(ICompilationUnit unit) throws CoreException { fCu= unit; if (fCu != null) { computeRenameTypeRefactoring(); setNewElementName(fCu.getElementName()); } }
private String getFileName(TextChange change) { Object modifiedElement= change.getModifiedElement(); if (modifiedElement instanceof IFile) { return ((IFile) modifiedElement).getName(); } else if (modifiedElement instanceof ICompilationUnit) { return ((ICompilationUnit) modifiedElement).getElementName(); } return null; } }
private static IFile getFile(ICompilationUnit cunit) throws CoreException { IFile file= (IFile)cunit.getResource(); if (file == null) { String message= Messages.format(JavaManipulationMessages.UndoCompilationUnitChange_no_file, TextProcessor.process(cunit.getElementName())); throw new CoreException(new Status(IStatus.ERROR, JavaManipulationPlugin.getPluginId(), message)); } return file; }
private final String getSingleElementName() { switch (getContentKind()) { case ONLY_FOLDERS: return fFolders[0].getName(); case ONLY_FILES: return fFiles[0].getName(); case ONLY_CUS: return fCus[0].getElementName(); } return null; }
private static boolean isPrimaryType(IType type) { String cuName = type.getCompilationUnit().getElementName(); String typeName = type.getElementName(); return type.getDeclaringType() == null && JavaCore.removeJavaLikeExtension(cuName).equals(typeName); }
private boolean isPrimaryType() { String cuName= fType.getCompilationUnit().getElementName(); String typeName= fType.getElementName(); return Checks.isTopLevel(fType) && JavaCore.removeJavaLikeExtension(cuName).equals(typeName); }
private final String getSingleElementName() { switch (getContentKind()) { case ONLY_FOLDERS: return fFolders[0].getName(); case ONLY_FILES: return fFiles[0].getName(); case ONLY_CUS: return fCus[0].getElementName(); } return null; }
private boolean canOverwrite(ICompilationUnit cu) { if (fDestination instanceof IPackageFragment){ IPackageFragment destination= (IPackageFragment)fDestination; return ! destination.equals(cu.getParent()) && destination.getCompilationUnit(cu.getElementName()).exists(); } else { return willOverwrite(ReorgUtils.getResource(cu)); } }
public String getName() { return Messages.format(RefactoringCoreMessages.CopyCompilationUnitChange_copy, new String[]{getCu().getElementName(), getPackageName(getDestinationPackage())}); } }
private static void addShadowsError(ICompilationUnit cu, SearchMatch oldMatch, RefactoringStatus result) { // Old match not found in new matches -> reference has been shadowed //TODO: should not have to filter declarations: if (oldMatch instanceof MethodDeclarationMatch || oldMatch instanceof FieldDeclarationMatch) return; ISourceRange range= new SourceRange(oldMatch.getOffset(), oldMatch.getLength()); RefactoringStatusContext context= JavaStatusContext.create(cu, range); String message= Messages.format(RefactoringCoreMessages.RenameAnalyzeUtil_shadows, cu.getElementName()); result.addError(message, context); }
private boolean willRenameCU() { String name = JavaCore.removeJavaLikeExtension(fType.getCompilationUnit().getElementName()); if (!(Checks.isTopLevel(fType) && name.equals(fType.getElementName()))) { return false; } if (!checkNewPathValidity().isOK()) { return false; } if (!Checks.checkCompilationUnitNewName(fType.getCompilationUnit(), getNewElementName()).isOK()) { return false; } return true; }
public static String getFileComment(ICompilationUnit cu, String lineDelimiter) throws CoreException { Template template= getCodeTemplate(CodeTemplateContextType.FILECOMMENT_ID, cu.getJavaProject()); if (template == null) { return null; } IJavaProject project= cu.getJavaProject(); CodeTemplateContext context= new CodeTemplateContext(template.getContextTypeId(), project, lineDelimiter); context.setCompilationUnitVariables(cu); context.setVariable(CodeTemplateContextType.TYPENAME, JavaCore.removeJavaLikeExtension(cu.getElementName())); return evaluateTemplate(context, template); }
public static String getFileComment(ICompilationUnit cu, String lineDelimiter) throws CoreException { Template template= getCodeTemplate(CodeTemplateContextType.FILECOMMENT_ID, cu.getJavaProject()); if (template == null) { return null; } IJavaProject project= cu.getJavaProject(); CodeTemplateContext context= new CodeTemplateContext(template.getContextTypeId(), project, lineDelimiter); context.setCompilationUnitVariables(cu); context.setVariable(CodeTemplateContextType.TYPENAME, JavaCore.removeJavaLikeExtension(cu.getElementName())); return evaluateTemplate(context, template); }
public static String getFileComment(ICompilationUnit cu, String lineDelimiter) throws CoreException { Template template= getCodeTemplate(CodeTemplateContextType.FILECOMMENT_ID, cu.getJavaProject()); if (template == null) { return null; } IJavaProject project= cu.getJavaProject(); CodeTemplateContext context= new CodeTemplateContext(template.getContextTypeId(), project, lineDelimiter); context.setCompilationUnitVariables(cu); context.setVariable(CodeTemplateContextType.TYPENAME, JavaCore.removeJavaLikeExtension(cu.getElementName())); return evaluateTemplate(context, template); }
@Override protected RenameModifications computeRenameModifications() { RenameModifications result = new RenameModifications(); result.rename(fType, new RenameTypeArguments(getNewElementName(), getUpdateReferences(), getUpdateSimilarDeclarations(), getSimilarElements()), createParticipantDescriptorFilter()); if (isPrimaryType()) { ICompilationUnit cu = fType.getCompilationUnit(); String newCUName = getNewCompilationUnit().getElementName(); result.rename(cu, new RenameArguments(newCUName, getUpdateReferences())); } return result; }
@Override protected RenameModifications computeRenameModifications() { RenameModifications result= new RenameModifications(); result.rename(fType, new RenameTypeArguments(getNewElementName(), getUpdateReferences(), getUpdateSimilarDeclarations(), getSimilarElements()), createParticipantDescriptorFilter()); if (isPrimaryType()) { ICompilationUnit cu= fType.getCompilationUnit(); String newCUName= getNewCompilationUnit().getElementName(); result.rename(cu, new RenameArguments(newCUName, getUpdateReferences())); } return result; }