/** * Resets the AST carried by this context. * A compilation participant that modifies the environment that would result in different * bindings for the AST is expected to reset the AST on this context, so that other * participants don't get a stale AST. * <p> * Note that resetting the AST will not restart the reconcile process. Only further * participants will see the new AST. Thus participants running before the one that * resets the AST will have a stale view of the AST and its problems. Use * the compilation participant extension point to order the participants. * </p> */ public void resetAST() { this.operation.ast = null; putProblems(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER, null); putProblems(IJavaModelMarker.TASK_MARKER, null); }
/** * Returns a resolved AST with {@link AST#JLS3 JLS3} level. * It is created from the current state of the working copy. * Creates one if none exists yet. * Returns <code>null</code> if the current state of the working copy * doesn't allow the AST to be created (e.g. if the working copy's content * cannot be parsed). * <p> * If the AST level requested during reconciling is not {@link AST#JLS3} * or if binding resolutions was not requested, then a different AST is created. * Note that this AST does not become the current AST and it is only valid for * the requestor. * </p> * * @return the AST created from the current state of the working copy, * or <code>null</code> if none could be created * @exception JavaModelException if the contents of the working copy * cannot be accessed. Reasons include: * <ul> * <li> The working copy does not exist (ELEMENT_DOES_NOT_EXIST)</li> * </ul> * @deprecated JLS3 has been deprecated. This method has been replaced by {@link #getAST4()} which returns an AST * with JLS4 level. */ public org.eclipse.jdt.core.dom.CompilationUnit getAST3() throws JavaModelException { return getAST(AST.JLS3); }
@Override public void reconcile(final ReconcileContext context) { if( getCheckScope() == CheckScope.Disabled ) { return; } try { ICompilationUnit cunit = context.getWorkingCopy(); if( cunit.isStructureKnown() ) { MockASTVisitor visitor = new MockASTVisitor(cunit); context.getAST3().accept(visitor); CategorizedProblem[] probs = visitor.getProblems(); if (probs.length != 0) { context.putProblems(probs[0].getMarkerType(), probs); } } } catch (JavaModelException e) { Activator.log(e); } }
private void notifyParticipants(final CompilationUnit workingCopy) { IJavaProject javaProject = getWorkingCopy().getJavaProject(); CompilationParticipant[] participants = JavaModelManager.getJavaModelManager().compilationParticipants.getCompilationParticipants(javaProject); if (participants == null) return; final ReconcileContext context = new ReconcileContext(this, workingCopy); for (int i = 0, length = participants.length; i < length; i++) { final CompilationParticipant participant = participants[i]; SafeRunner.run(new ISafeRunnable() { @Override public void handleException(Throwable exception) { if (exception instanceof Error) { throw (Error) exception; // errors are not supposed to be caught } else if (exception instanceof OperationCanceledException) throw (OperationCanceledException) exception; else if (exception instanceof UnsupportedOperationException) { // might want to disable participant as it tried to modify the buffer of the working copy being reconciled Util.log(exception, "Reconcile participant attempted to modify the buffer of the working copy being reconciled"); //$NON-NLS-1$ } else Util.log(exception, "Exception occurred in reconcile participant"); //$NON-NLS-1$ } @Override public void run() throws Exception { participant.reconcile(context); } }); } }
private void notifyParticipants(final CompilationUnit workingCopy) { IJavaProject javaProject = getWorkingCopy().getJavaProject(); CompilationParticipant[] participants = JavaModelManager.getJavaModelManager().compilationParticipants.getCompilationParticipants(javaProject); if (participants == null) return; final ReconcileContext context = new ReconcileContext(this, workingCopy); for (int i = 0, length = participants.length; i < length; i++) { final CompilationParticipant participant = participants[i]; SafeRunner.run(new ISafeRunnable() { public void handleException(Throwable exception) { if (exception instanceof Error) { throw (Error) exception; // errors are not supposed to be caught } else if (exception instanceof OperationCanceledException) throw (OperationCanceledException) exception; else if (exception instanceof UnsupportedOperationException) { // might want to disable participant as it tried to modify the buffer of the working copy being reconciled Util.log(exception, "Reconcile participant attempted to modify the buffer of the working copy being reconciled"); //$NON-NLS-1$ } else Util.log(exception, "Exception occurred in reconcile participant"); //$NON-NLS-1$ } public void run() throws Exception { participant.reconcile(context); } }); } }
/** * Resets the AST carried by this context. * A compilation participant that modifies the environment that would result in different * bindings for the AST is expected to reset the AST on this context, so that other * participants don't get a stale AST. * <p> * Note that resetting the AST will not restart the reconcile process. Only further * participants will see the new AST. Thus participants running before the one that * resets the AST will have a stale view of the AST and its problems. Use * the compilation participant extension point to order the participants. * </p> */ public void resetAST() { this.operation.ast = null; putProblems(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER, null); putProblems(IJavaModelMarker.TASK_MARKER, null); }
private void notifyParticipants(final CompilationUnit workingCopy) { IJavaProject javaProject = getWorkingCopy().getJavaProject(); CompilationParticipant[] participants = JavaModelManager.getJavaModelManager().compilationParticipants.getCompilationParticipants(javaProject); if (participants == null) return; final ReconcileContext context = new ReconcileContext(this, workingCopy); for (int i = 0, length = participants.length; i < length; i++) { final CompilationParticipant participant = participants[i]; SafeRunner.run(new ISafeRunnable() { public void handleException(Throwable exception) { if (exception instanceof Error) { throw (Error) exception; // errors are not supposed to be caught } else if (exception instanceof OperationCanceledException) throw (OperationCanceledException) exception; else if (exception instanceof UnsupportedOperationException) { // might want to disable participant as it tried to modify the buffer of the working copy being reconciled Util.log(exception, "Reconcile participant attempted to modify the buffer of the working copy being reconciled"); //$NON-NLS-1$ } else Util.log(exception, "Exception occurred in reconcile participant"); //$NON-NLS-1$ } public void run() throws Exception { participant.reconcile(context); } }); } }
/** * Returns a resolved AST with {@link AST#JLS3 JLS3} level. * It is created from the current state of the working copy. * Creates one if none exists yet. * Returns <code>null</code> if the current state of the working copy * doesn't allow the AST to be created (e.g. if the working copy's content * cannot be parsed). * <p> * If the AST level requested during reconciling is not {@link AST#JLS3} * or if binding resolutions was not requested, then a different AST is created. * Note that this AST does not become the current AST and it is only valid for * the requestor. * </p> * * @return the AST created from the current state of the working copy, * or <code>null</code> if none could be created * @exception JavaModelException if the contents of the working copy * cannot be accessed. Reasons include: * <ul> * <li> The working copy does not exist (ELEMENT_DOES_NOT_EXIST)</li> * </ul> * @deprecated JLS3 has been deprecated. This method has been replaced by {@link #getAST4()} which returns an AST * with JLS4 level. */ public org.eclipse.jdt.core.dom.CompilationUnit getAST3() throws JavaModelException { return getAST(AST.JLS3); }
/** * Resets the AST carried by this context. * A compilation participant that modifies the environment that would result in different * bindings for the AST is expected to reset the AST on this context, so that other * participants don't get a stale AST. * <p> * Note that resetting the AST will not restart the reconcile process. Only further * participants will see the new AST. Thus participants running before the one that * resets the AST will have a stale view of the AST and its problems. Use * the compilation participant extension point to order the participants. * </p> */ public void resetAST() { this.operation.ast = null; putProblems(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER, null); putProblems(IJavaModelMarker.TASK_MARKER, null); }
private void notifyParticipants(final CompilationUnit workingCopy) { IJavaProject javaProject = getWorkingCopy().getJavaProject(); CompilationParticipant[] participants = JavaModelManager.getJavaModelManager().compilationParticipants.getCompilationParticipants(javaProject); if (participants == null) return; final ReconcileContext context = new ReconcileContext(this, workingCopy); for (int i = 0, length = participants.length; i < length; i++) { final CompilationParticipant participant = participants[i]; SafeRunner.run(new ISafeRunnable() { public void handleException(Throwable exception) { if (exception instanceof Error) { throw (Error) exception; // errors are not supposed to be caught } else if (exception instanceof OperationCanceledException) throw (OperationCanceledException) exception; else if (exception instanceof UnsupportedOperationException) { // might want to disable participant as it tried to modify the buffer of the working copy being reconciled Util.log(exception, "Reconcile participant attempted to modify the buffer of the working copy being reconciled"); //$NON-NLS-1$ } else Util.log(exception, "Exception occurred in reconcile participant"); //$NON-NLS-1$ } public void run() throws Exception { participant.reconcile(context); } }); } }
/** * Returns a resolved AST with {@link AST#JLS4 JLS4} level. * It is created from the current state of the working copy. * Creates one if none exists yet. * Returns <code>null</code> if the current state of the working copy * doesn't allow the AST to be created (e.g. if the working copy's content * cannot be parsed). * <p> * If the AST level requested during reconciling is not {@link AST#JLS4} * or if binding resolutions was not requested, then a different AST is created. * Note that this AST does not become the current AST and it is only valid for * the requestor. * </p> * * @return the AST created from the current state of the working copy, * or <code>null</code> if none could be created * @exception JavaModelException if the contents of the working copy * cannot be accessed. Reasons include: * <ul> * <li> The working copy does not exist (ELEMENT_DOES_NOT_EXIST)</li> * </ul> * @deprecated JLS4 has been deprecated. This method has been replaced by {@link #getAST8()} which returns an AST * with JLS8 level. * @since 3.7.1 */ public org.eclipse.jdt.core.dom.CompilationUnit getAST4() throws JavaModelException { return getAST(AST.JLS4); }
/** * Resets the AST carried by this context. * A compilation participant that modifies the environment that would result in different * bindings for the AST is expected to reset the AST on this context, so that other * participants don't get a stale AST. * <p> * Note that resetting the AST will not restart the reconcile process. Only further * participants will see the new AST. Thus participants running before the one that * resets the AST will have a stale view of the AST and its problems. Use * the compilation participant extension point to order the participants. * </p> */ public void resetAST() { this.operation.ast = null; putProblems(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER, null); putProblems(IJavaModelMarker.TASK_MARKER, null); }
private void notifyParticipants(final CompilationUnit workingCopy) { IJavaProject javaProject = getWorkingCopy().getJavaProject(); CompilationParticipant[] participants = JavaModelManager.getJavaModelManager().compilationParticipants.getCompilationParticipants(javaProject); if (participants == null) return; final ReconcileContext context = new ReconcileContext(this, workingCopy); for (int i = 0, length = participants.length; i < length; i++) { final CompilationParticipant participant = participants[i]; SafeRunner.run(new ISafeRunnable() { public void handleException(Throwable exception) { if (exception instanceof Error) { throw (Error) exception; // errors are not supposed to be caught } else if (exception instanceof OperationCanceledException) throw (OperationCanceledException) exception; else if (exception instanceof UnsupportedOperationException) { // might want to disable participant as it tried to modify the buffer of the working copy being reconciled Util.log(exception, "Reconcile participant attempted to modify the buffer of the working copy being reconciled"); //$NON-NLS-1$ } else Util.log(exception, "Exception occurred in reconcile participant"); //$NON-NLS-1$ } public void run() throws Exception { participant.reconcile(context); } }); } }
/** * Returns a resolved AST with {@link AST#JLS8 JLS8} level. * It is created from the current state of the working copy. * Creates one if none exists yet. * Returns <code>null</code> if the current state of the working copy * doesn't allow the AST to be created (e.g. if the working copy's content * cannot be parsed). * <p> * If the AST level requested during reconciling is not {@link AST#JLS8} * or if binding resolutions was not requested, then a different AST is created. * Note that this AST does not become the current AST and it is only valid for * the requestor. * </p> * * @return the AST created from the current state of the working copy, * or <code>null</code> if none could be created * @exception JavaModelException if the contents of the working copy * cannot be accessed. Reasons include: * <ul> * <li> The working copy does not exist (ELEMENT_DOES_NOT_EXIST)</li> * </ul> * @deprecated JLS8 has been deprecated. This method has been replaced by {@link #getAST(int)} which returns an AST * with the given level. * @since 3.10 */ public org.eclipse.jdt.core.dom.CompilationUnit getAST8() throws JavaModelException { return getAST(AST.JLS8); }
/** * Resets the AST carried by this context. * A compilation participant that modifies the environment that would result in different * bindings for the AST is expected to reset the AST on this context, so that other * participants don't get a stale AST. * <p> * Note that resetting the AST will not restart the reconcile process. Only further * participants will see the new AST. Thus participants running before the one that * resets the AST will have a stale view of the AST and its problems. Use * the compilation participant extension point to order the participants. * </p> */ public void resetAST() { this.operation.ast = null; putProblems(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER, null); putProblems(IJavaModelMarker.TASK_MARKER, null); }
private void notifyParticipants(final CompilationUnit workingCopy) { IJavaProject javaProject = getWorkingCopy().getJavaProject(); CompilationParticipant[] participants = JavaModelManager.getJavaModelManager().compilationParticipants.getCompilationParticipants(javaProject); if (participants == null) return; final ReconcileContext context = new ReconcileContext(this, workingCopy); for (int i = 0, length = participants.length; i < length; i++) { final CompilationParticipant participant = participants[i]; SafeRunner.run(new ISafeRunnable() { public void handleException(Throwable exception) { if (exception instanceof Error) { throw (Error) exception; // errors are not supposed to be caught } else if (exception instanceof OperationCanceledException) throw (OperationCanceledException) exception; else if (exception instanceof UnsupportedOperationException) { // might want to disable participant as it tried to modify the buffer of the working copy being reconciled Util.log(exception, "Reconcile participant attempted to modify the buffer of the working copy being reconciled"); //$NON-NLS-1$ } else Util.log(exception, "Exception occurred in reconcile participant"); //$NON-NLS-1$ } public void run() throws Exception { participant.reconcile(context); } }); } }
/** * Returns a resolved AST with {@link AST#JLS4 JLS4} level. * It is created from the current state of the working copy. * Creates one if none exists yet. * Returns <code>null</code> if the current state of the working copy * doesn't allow the AST to be created (e.g. if the working copy's content * cannot be parsed). * <p> * If the AST level requested during reconciling is not {@link AST#JLS4} * or if binding resolutions was not requested, then a different AST is created. * Note that this AST does not become the current AST and it is only valid for * the requestor. * </p> * * @return the AST created from the current state of the working copy, * or <code>null</code> if none could be created * @exception JavaModelException if the contents of the working copy * cannot be accessed. Reasons include: * <ul> * <li> The working copy does not exist (ELEMENT_DOES_NOT_EXIST)</li> * </ul> * @deprecated JLS4 has been deprecated. This method has been replaced by {@link #getAST8()} which returns an AST * with JLS8 level. * @since 3.7.1 */ public org.eclipse.jdt.core.dom.CompilationUnit getAST4() throws JavaModelException { return getAST(AST.JLS4); }
/** * Resets the AST carried by this context. * A compilation participant that modifies the environment that would result in different * bindings for the AST is expected to reset the AST on this context, so that other * participants don't get a stale AST. * <p> * Note that resetting the AST will not restart the reconcile process. Only further * participants will see the new AST. Thus participants running before the one that * resets the AST will have a stale view of the AST and its problems. Use * the compilation participant extension point to order the participants. * </p> */ public void resetAST() { this.operation.ast = null; putProblems(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER, null); putProblems(IJavaModelMarker.TASK_MARKER, null); }
/** * Returns a resolved AST with {@link AST#JLS8 JLS8} level. * It is created from the current state of the working copy. * Creates one if none exists yet. * Returns <code>null</code> if the current state of the working copy * doesn't allow the AST to be created (e.g. if the working copy's content * cannot be parsed). * <p> * If the AST level requested during reconciling is not {@link AST#JLS8} * or if binding resolutions was not requested, then a different AST is created. * Note that this AST does not become the current AST and it is only valid for * the requestor. * </p> * * @return the AST created from the current state of the working copy, * or <code>null</code> if none could be created * @exception JavaModelException if the contents of the working copy * cannot be accessed. Reasons include: * <ul> * <li> The working copy does not exist (ELEMENT_DOES_NOT_EXIST)</li> * </ul> * @deprecated JLS8 has been deprecated. This method has been replaced by {@link #getAST(int)} which returns an AST * with the given level. * @since 3.10 */ public org.eclipse.jdt.core.dom.CompilationUnit getAST8() throws JavaModelException { return getAST(AST.JLS8); }
/** * Resets the AST carried by this context. * A compilation participant that modifies the environment that would result in different * bindings for the AST is expected to reset the AST on this context, so that other * participants don't get a stale AST. * <p> * Note that resetting the AST will not restart the reconcile process. Only further * participants will see the new AST. Thus participants running before the one that * resets the AST will have a stale view of the AST and its problems. Use * the compilation participant extension point to order the participants. * </p> */ public void resetAST() { this.operation.ast = null; putProblems(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER, null); putProblems(IJavaModelMarker.TASK_MARKER, null); }