Lines 1-5
Link Here
|
1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
2 |
* Copyright (c) 2000, 2010 IBM Corporation and others. |
2 |
* Copyright (c) 2000, 2011 IBM Corporation and others. |
3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
Lines 295-301
Link Here
|
295 |
* @return <code>true</code> if the given compilation unit is the active one |
295 |
* @return <code>true</code> if the given compilation unit is the active one |
296 |
* @since 3.1 |
296 |
* @since 3.1 |
297 |
*/ |
297 |
*/ |
298 |
public boolean isActive(ICompilationUnit cu) { |
298 |
public synchronized boolean isActive(ICompilationUnit cu) { |
299 |
return cu != null && cu.equals(fActiveJavaElement); |
299 |
return cu != null && cu.equals(fActiveJavaElement); |
300 |
} |
300 |
} |
301 |
|
301 |
|
Lines 407-413
Link Here
|
407 |
* @param progressMonitor the progress monitor or <code>null</code> |
407 |
* @param progressMonitor the progress monitor or <code>null</code> |
408 |
* @return the AST or <code>null</code> if the AST is not available |
408 |
* @return the AST or <code>null</code> if the AST is not available |
409 |
*/ |
409 |
*/ |
410 |
public CompilationUnit getAST(ITypeRoot input, WAIT_FLAG waitFlag, IProgressMonitor progressMonitor) { |
410 |
public CompilationUnit getAST(final ITypeRoot input, WAIT_FLAG waitFlag, IProgressMonitor progressMonitor) { |
411 |
if (input == null || waitFlag == null) |
411 |
if (input == null || waitFlag == null) |
412 |
throw new IllegalArgumentException("input or wait flag are null"); //$NON-NLS-1$ |
412 |
throw new IllegalArgumentException("input or wait flag are null"); //$NON-NLS-1$ |
413 |
|
413 |
|
Lines 436-452
Link Here
|
436 |
|
436 |
|
437 |
final boolean canReturnNull= waitFlag == SharedASTProvider.WAIT_NO || (waitFlag == SharedASTProvider.WAIT_ACTIVE_ONLY && !(isActiveElement && fAST == null)); |
437 |
final boolean canReturnNull= waitFlag == SharedASTProvider.WAIT_NO || (waitFlag == SharedASTProvider.WAIT_ACTIVE_ONLY && !(isActiveElement && fAST == null)); |
438 |
boolean isReconciling= false; |
438 |
boolean isReconciling= false; |
|
|
439 |
final ITypeRoot activeElement; |
439 |
if (isActiveElement) { |
440 |
if (isActiveElement) { |
440 |
synchronized (fReconcileLock) { |
441 |
synchronized (fReconcileLock) { |
|
|
442 |
activeElement= fReconcilingJavaElement; |
441 |
isReconciling= isReconciling(input); |
443 |
isReconciling= isReconciling(input); |
442 |
if (!isReconciling && !canReturnNull) |
444 |
if (!isReconciling && !canReturnNull) |
443 |
aboutToBeReconciled(input); |
445 |
aboutToBeReconciled(input); |
444 |
} |
446 |
} |
445 |
} |
447 |
} else |
|
|
448 |
activeElement= null; |
446 |
|
449 |
|
447 |
if (isReconciling) { |
450 |
if (isReconciling) { |
448 |
try { |
451 |
try { |
449 |
final ITypeRoot activeElement= fReconcilingJavaElement; |
|
|
450 |
|
452 |
|
451 |
// Wait for AST |
453 |
// Wait for AST |
452 |
synchronized (fWaitLock) { |
454 |
synchronized (fWaitLock) { |