@Override public IFormattingContext createFormattingContext() { // it's ok to use instance preferences here as subclasses replace // with project dependent versions (see CompilationUnitEditor.AdaptedSourceViewer) IFormattingContext context= new JavaFormattingContext(); Map<String, String> map= new HashMap<>(JavaCore.getOptions()); context.setProperty(FormattingContextProperties.CONTEXT_PREFERENCES, map); return context; }
@Override public IFormattingContext createFormattingContext() { // it's ok to use instance preferences here as subclasses replace // with project dependent versions (see CompilationUnitEditor.AdaptedSourceViewer) IFormattingContext context= new JavaFormattingContext(); Map<String, String> map= new HashMap<>(JavaCore.getOptions()); context.setProperty(FormattingContextProperties.CONTEXT_PREFERENCES, map); return context; }
@Override public IFormattingContext createFormattingContext() { IFormattingContext context= new JavaFormattingContext(); Map<String, String> 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; } }
@Override public IFormattingContext createFormattingContext() { IFormattingContext context= new JavaFormattingContext(); Map<String, String> preferences; IJavaElement inputJavaElement= getInputJavaElement(); IJavaProject javaProject= inputJavaElement != null ? inputJavaElement.getJavaProject() : null; if (javaProject == null) preferences= new HashMap<>(JavaCore.getOptions()); else preferences= FormatterProfileManager.getProjectSettings(javaProject); context.setProperty(FormattingContextProperties.CONTEXT_PREFERENCES, preferences); context.setProperty(JavaFormattingContext.KEY_SOURCE_PATH, inputJavaElement != null ? inputJavaElement.getPath().toString() : null); return context; } }
final IFormattingContext context = new JavaFormattingContext(); try { final IContentFormatter formatter = fViewerConfiguration.getContentFormatter(fSourceViewer);
final IFormattingContext context = new JavaFormattingContext(); try { final IContentFormatter formatter = fViewerConfiguration.getContentFormatter(fSourceViewer);
final IFormattingContext context = new JavaFormattingContext(); try { final IContentFormatter formatter = fViewerConfiguration.getContentFormatter(fSourceViewer);