public IFix createFix(ICompilationUnit compilationUnit) throws CoreException { if (compilationUnit == null) return null; if (!isEnabled(CleanUpConstants.FORMAT_SOURCE_CODE)) return null; HashMap preferences= new HashMap(compilationUnit.getJavaProject().getOptions(true)); boolean singleLineComment= DefaultCodeFormatterConstants.TRUE.equals(preferences.get(DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_LINE_COMMENT)); boolean blockComment= DefaultCodeFormatterConstants.TRUE.equals(preferences.get(DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_BLOCK_COMMENT)); boolean javaDoc= DefaultCodeFormatterConstants.TRUE.equals(preferences.get(DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_JAVADOC_COMMENT)); return CommentFormatFix.createCleanUp(compilationUnit, singleLineComment, blockComment, javaDoc, preferences); }
private JavaProjectOptions getJavaProjectOptions(IJavaElement javaElement) { final IJavaProject javaProject = getIJavaProject(javaElement); JavaProjectOptions options = javaProjects.get(javaProject); if (options == null) { options = new JavaProjectOptionsImpl(javaProject.getOptions(true)); javaProjects.put(javaProject, options); } return options; }
/** * @since 2.9, */ public static Map<String, String> getJavaOptions(GenModel genModel) { IJavaProject javaProject = getJavaProject(genModel); Map<String, String> options = javaProject != null ? javaProject.getOptions(true) : JavaCore.getOptions(); return options; }
public static Map<String, String> getJavaOptions(IProject project) { if (!isJavaProject(project)) { return null; } IJavaProject javaProject = JavaCore.create(project); return javaProject.getOptions(true); }
private Map<String, String> getCompilerOptions(ITypedElement input) { IJavaElement element= findJavaElement(input); if (element != null) { IJavaProject javaProject= element.getJavaProject(); if (javaProject != null) return javaProject.getOptions(true); } return null; }
private Map<String, String> getCompilerOptions(ITypedElement input) { IJavaElement element= findJavaElement(input); if (element != null) { IJavaProject javaProject= element.getJavaProject(); if (javaProject != null) return javaProject.getOptions(true); } return null; }
public AbstractSourceFileLocator(IPackageFragmentRoot root) { this.root = root; final Map<?, ?> options = root.getJavaProject().getOptions(true); this.tabWidth = IndentManipulation.getTabWidth(options); }
private static CompilationUnit createAST(IJavaElement element, String cuSource) { Assert.isNotNull(element); ASTParser parser = ASTParser.newParser(IASTSharedValues.SHARED_AST_LEVEL); IJavaProject javaProject = element.getJavaProject(); parser.setProject(javaProject); Map<String, String> options = javaProject.getOptions(true); options.put(JavaCore.COMPILER_DOC_COMMENT_SUPPORT, JavaCore.ENABLED); // workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=212207 parser.setCompilerOptions(options); parser.setSource(cuSource.toCharArray()); return (CompilationUnit) parser.createAST(null); }
SourceMapper createSourceMapper(IPath sourcePath, IPath rootPath) { SourceMapper mapper = new SourceMapper( sourcePath, rootPath == null ? null : rootPath.toOSString(), getJavaProject().getOptions(true)); // cannot use workspace options if external jar is 1.5 jar and workspace options are 1.4 options return mapper; } /*
private static CompilationUnit createAST(IJavaElement element, String cuSource) { Assert.isNotNull(element); ASTParser parser= ASTParser.newParser(ASTProvider.SHARED_AST_LEVEL); IJavaProject javaProject= element.getJavaProject(); parser.setProject(javaProject); Map<String, String> options= javaProject.getOptions(true); options.put(JavaCore.COMPILER_DOC_COMMENT_SUPPORT, JavaCore.ENABLED); // workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=212207 parser.setCompilerOptions(options); parser.setSource(cuSource.toCharArray()); return (CompilationUnit) parser.createAST(null); }
private static CompilationUnit createAST(IJavaElement element, String cuSource) { Assert.isNotNull(element); ASTParser parser= ASTParser.newParser(IASTSharedValues.SHARED_AST_LEVEL); IJavaProject javaProject= element.getJavaProject(); parser.setProject(javaProject); Map<String, String> options= javaProject.getOptions(true); options.put(JavaCore.COMPILER_DOC_COMMENT_SUPPORT, JavaCore.ENABLED); // workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=212207 parser.setCompilerOptions(options); parser.setSource(cuSource.toCharArray()); return (CompilationUnit) parser.createAST(null); }
public IFormattingContext createFormattingContext() { IFormattingContext context= new CommentFormattingContext(); Map preferences; IJavaElement inputJavaElement= getInputJavaElement(); IJavaProject javaProject= inputJavaElement != null ? inputJavaElement.getJavaProject() : null; if (javaProject == null) preferences= new HashMap(JavaCore.getOptions()); else preferences= new HashMap(javaProject.getOptions(true)); context.setProperty(FormattingContextProperties.CONTEXT_PREFERENCES, preferences); return context; } }
private static CompilationUnit createAST(IJavaElement element, String cuSource) { ASTParser parser = ASTParser.newParser(IASTSharedValues.SHARED_AST_LEVEL); IJavaProject javaProject= element.getJavaProject(); parser.setProject(javaProject); Map<String, String> options= javaProject.getOptions(true); options.put(JavaCore.COMPILER_DOC_COMMENT_SUPPORT, JavaCore.ENABLED); // workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=212207 parser.setCompilerOptions(options); parser.setSource(cuSource.toCharArray()); return (CompilationUnit) parser.createAST(null); }
public TextEdit getDeleteEdit() { final ASTRewrite rewriter= ASTRewrite.create(fDeclaration.getAST()); rewriter.remove(fDeclaration, null); return rewriter.rewriteAST(fDocument, fTypeRoot.getJavaProject().getOptions(true)); }
public TextEdit getDeleteEdit() { final ASTRewrite rewriter= ASTRewrite.create(fDeclaration.getAST()); rewriter.remove(fDeclaration, null); return rewriter.rewriteAST(fDocument, fTypeRoot.getJavaProject().getOptions(true)); }
public TextEdit getDeleteEdit() { final ASTRewrite rewriter= ASTRewrite.create(fDeclaration.getAST()); rewriter.remove(fDeclaration, null); return rewriter.rewriteAST(fDocument, fTypeRoot.getJavaProject().getOptions(true)); }
SourceMapper createSourceMapper(IPath sourcePath, IPath rootPath) throws JavaModelException { IClasspathEntry entry = ((JavaProject) getParent()).getClasspathEntryFor(getPath()); String encoding = (entry== null) ? null : ((ClasspathEntry) entry).getSourceAttachmentEncoding(); SourceMapper mapper = new SourceMapper( sourcePath, rootPath == null ? null : rootPath.toOSString(), getJavaProject().getOptions(true),// cannot use workspace options if external jar is 1.5 jar and workspace options are 1.4 options encoding); return mapper; } /*
SourceMapper createSourceMapper(IPath sourcePath, IPath rootPath) throws JavaModelException { IClasspathEntry entry = ((JavaProject) getParent()).getClasspathEntryFor(getPath()); String encoding = (entry== null) ? null : ((ClasspathEntry) entry).getSourceAttachmentEncoding(); SourceMapper mapper = new SourceMapper( sourcePath, rootPath == null ? null : rootPath.toOSString(), getJavaProject().getOptions(true),// cannot use workspace options if external jar is 1.5 jar and workspace options are 1.4 options encoding); return mapper; } /*
SourceMapper createSourceMapper(IPath sourcePath, IPath rootPath) throws JavaModelException { IClasspathEntry entry = ((JavaProject) getParent()).getClasspathEntryFor(getPath()); String encoding = (entry== null) ? null : ((ClasspathEntry) entry).getSourceAttachmentEncoding(); SourceMapper mapper = new SourceMapper( sourcePath, rootPath == null ? null : rootPath.toOSString(), getJavaProject().getOptions(true),// cannot use workspace options if external jar is 1.5 jar and workspace options are 1.4 options encoding); return mapper; } /*
SourceMapper createSourceMapper(IPath sourcePath, IPath rootPath) throws JavaModelException { IClasspathEntry entry = ((JavaProject) getParent()).getClasspathEntryFor(getPath()); String encoding = (entry== null) ? null : ((ClasspathEntry) entry).getSourceAttachmentEncoding(); SourceMapper mapper = new SourceMapper( sourcePath, rootPath == null ? null : rootPath.toOSString(), getJavaProject().getOptions(true),// cannot use workspace options if external jar is 1.5 jar and workspace options are 1.4 options encoding); return mapper; }