protected boolean isTabsToSpacesConversionEnabled() { IJavaElement element= getInputJavaElement(); IJavaProject project= element == null ? null : element.getJavaProject(); String option; if (project == null) option= JavaCore.getOption(SPACES_FOR_TABS); else option= project.getOption(SPACES_FOR_TABS, true); return JavaCore.SPACE.equals(option); }
@Override protected boolean isTabsToSpacesConversionEnabled() { IJavaElement element= getInputJavaElement(); IJavaProject project= element == null ? null : element.getJavaProject(); String option; if (project == null) option= JavaCore.getOption(SPACES_FOR_TABS); else option= project.getOption(SPACES_FOR_TABS, true); return JavaCore.SPACE.equals(option); }
@Override protected boolean isTabsToSpacesConversionEnabled() { IJavaElement element= getInputJavaElement(); IJavaProject project= element == null ? null : element.getJavaProject(); String option; if (project == null) option= JavaCore.getOption(SPACES_FOR_TABS); else option= project.getOption(SPACES_FOR_TABS, true); return JavaCore.SPACE.equals(option); }
protected void doSetInput(IEditorInput input) throws CoreException { super.doSetInput(input); configureToggleCommentAction(); if (fJavaEditorErrorTickUpdater != null) fJavaEditorErrorTickUpdater.updateEditorImage(getInputJavaElement()); }
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; } }
@Override protected void doSetInput(IEditorInput input) throws CoreException { super.doSetInput(input); configureToggleCommentAction(); if (fJavaEditorErrorTickUpdater != null) fJavaEditorErrorTickUpdater.updateEditorImage(getInputJavaElement()); }
@Override protected void doSetInput(IEditorInput input) throws CoreException { super.doSetInput(input); configureToggleCommentAction(); if (fJavaEditorErrorTickUpdater != null) fJavaEditorErrorTickUpdater.updateEditorImage(getInputJavaElement()); }
@Override public void aboutToBeReconciled() { // Notify AST provider CoreASTProvider.getInstance().aboutToBeReconciled(getInputJavaElement()); // Notify listeners for (IJavaReconcilingListener listener : fReconcilingListeners) { listener.aboutToBeReconciled(); } }
@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 void reconciled(CompilationUnit ast, boolean forced, IProgressMonitor progressMonitor) { // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=58245 JavaPlugin javaPlugin= JavaPlugin.getDefault(); if (javaPlugin == null) return; // Always notify AST provider CoreASTProvider.getInstance().reconciled(ast, getInputJavaElement(), progressMonitor); // Notify listeners for (IJavaReconcilingListener listener : fReconcilingListeners) { listener.reconciled(ast, forced, progressMonitor); } // Update Java Outline page selection if (!forced && !progressMonitor.isCanceled()) { Shell shell= getSite().getShell(); if (shell != null && !shell.isDisposed()) { shell.getDisplay().asyncExec(new Runnable() { @Override public void run() { selectionChanged(); } }); } } }
@Override public void reconciled(CompilationUnit ast, boolean forced, IProgressMonitor progressMonitor) { // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=58245 JavaPlugin javaPlugin= JavaPlugin.getDefault(); if (javaPlugin == null) return; // Always notify AST provider javaPlugin.getASTProvider().reconciled(ast, getInputJavaElement(), progressMonitor); // Notify listeners for (IJavaReconcilingListener listener : fReconcilingListeners) { listener.reconciled(ast, forced, progressMonitor); } // Update Java Outline page selection if (!forced && !progressMonitor.isCanceled()) { Shell shell= getSite().getShell(); if (shell != null && !shell.isDisposed()) { shell.getDisplay().asyncExec(new Runnable() { @Override public void run() { selectionChanged(); } }); } } }
@Override public void aboutToBeReconciled() { // Notify AST provider JavaPlugin.getDefault().getASTProvider().aboutToBeReconciled(getInputJavaElement()); // Notify listeners for (IJavaReconcilingListener listener : fReconcilingListeners) { listener.aboutToBeReconciled(); } }
public void reconciled(CompilationUnit ast, boolean forced, IProgressMonitor progressMonitor) { // see: https://bugs.eclipse.org/bugs/show_bug.cgi?id=58245 JavaPlugin javaPlugin= JavaPlugin.getDefault(); if (javaPlugin == null) return; // Always notify AST provider javaPlugin.getASTProvider().reconciled(ast, getInputJavaElement(), progressMonitor); // Notify listeners Object[] listeners = fReconcilingListeners.getListeners(); for (int i = 0, length= listeners.length; i < length; ++i) ((IJavaReconcilingListener)listeners[i]).reconciled(ast, forced, progressMonitor); // Update Java Outline page selection if (!forced && !progressMonitor.isCanceled()) { Shell shell= getSite().getShell(); if (shell != null && !shell.isDisposed()) { shell.getDisplay().asyncExec(new Runnable() { public void run() { selectionChanged(); } }); } } }
@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; } }
public void aboutToBeReconciled() { // Notify AST provider JavaPlugin.getDefault().getASTProvider().aboutToBeReconciled(getInputJavaElement()); // Notify listeners Object[] listeners = fReconcilingListeners.getListeners(); for (int i = 0, length= listeners.length; i < length; ++i) ((IJavaReconcilingListener)listeners[i]).aboutToBeReconciled(); }
final IJavaProject javaProject= getInputJavaElement().getJavaProject(); IProject project= javaProject != null ? javaProject.getProject() : null; final boolean hasProjectSettings= project != null && CleanUpPreferenceUtil.hasSettingsInScope(new ProjectScope(project));
final IJavaProject javaProject= getInputJavaElement().getJavaProject(); IProject project= javaProject != null ? javaProject.getProject() : null; final boolean hasProjectSettings= project != null && CleanUpPreferenceUtil.hasSettingsInScope(new ProjectScope(project));
/** * Returns the most narrow element including the given offset. If <code>reconcile</code> * is <code>true</code> the editor's input element is reconciled in advance. If it is * <code>false</code> this method only returns a result if the editor's input element * does not need to be reconciled. * * @param offset the offset included by the retrieved element * @param reconcile <code>true</code> if working copy should be reconciled * @return the most narrow element which includes the given offset */ protected IJavaElement getElementAt(int offset, boolean reconcile) { ICompilationUnit unit= (ICompilationUnit)getInputJavaElement(); if (unit != null) { try { if (reconcile) { JavaModelUtil.reconcile(unit); return unit.getElementAt(offset); } else if (unit.isConsistent()) return unit.getElementAt(offset); } catch (JavaModelException x) { if (!x.isDoesNotExist()) JavaPlugin.log(x.getStatus()); // nothing found, be tolerant and go on } } return null; }
/** * Returns the most narrow element including the given offset. If <code>reconcile</code> * is <code>true</code> the editor's input element is reconciled in advance. If it is * <code>false</code> this method only returns a result if the editor's input element * does not need to be reconciled. * * @param offset the offset included by the retrieved element * @param reconcile <code>true</code> if working copy should be reconciled * @return the most narrow element which includes the given offset */ @Override protected IJavaElement getElementAt(int offset, boolean reconcile) { ICompilationUnit unit= (ICompilationUnit)getInputJavaElement(); if (unit != null) { try { if (reconcile) { JavaModelUtil.reconcile(unit); return unit.getElementAt(offset); } else if (unit.isConsistent()) return unit.getElementAt(offset); } catch (JavaModelException x) { if (!x.isDoesNotExist()) JavaPlugin.log(x.getStatus()); // nothing found, be tolerant and go on } } return null; }
/** * Returns the most narrow element including the given offset. If <code>reconcile</code> * is <code>true</code> the editor's input element is reconciled in advance. If it is * <code>false</code> this method only returns a result if the editor's input element * does not need to be reconciled. * * @param offset the offset included by the retrieved element * @param reconcile <code>true</code> if working copy should be reconciled * @return the most narrow element which includes the given offset */ @Override protected IJavaElement getElementAt(int offset, boolean reconcile) { ICompilationUnit unit= (ICompilationUnit)getInputJavaElement(); if (unit != null) { try { if (reconcile) { JavaModelUtil.reconcile(unit); return unit.getElementAt(offset); } else if (unit.isConsistent()) return unit.getElementAt(offset); } catch (JavaModelException x) { if (!x.isDoesNotExist()) JavaPlugin.log(x.getStatus()); // nothing found, be tolerant and go on } } return null; }