diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ITranslationUnit.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ITranslationUnit.java
index 88b45e4b0c2..37a0c7d825f 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ITranslationUnit.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ITranslationUnit.java
@@ -171,21 +171,6 @@ public interface ITranslationUnit extends ICElement, IParent, IOpenable, ISource
*/
INamespace createNamespace (String namespace, ICElement sibling, IProgressMonitor monitor) throws CModelException;
- /**
- * Finds the shared working copy for this element, given a IBuffer factory.
- * If no working copy has been created for this element associated with this
- * buffer factory, returns null.
- *
- * Users of this method must not destroy the resulting working copy.
- *
- * @param bufferFactory the given IBuffer factory
- * @return the found shared working copy for this element, null if none
- * @see IBufferFactory
- * @since 2.0
- * @noreference This method is not intended to be referenced by clients.
- */
- IWorkingCopy findSharedWorkingCopy(IBufferFactory bufferFactory);
-
/**
* Returns the shared working copy for this element, using the default IBuffer factory, or
* null, if no working copy has been created for this element.
@@ -271,100 +256,7 @@ public interface ITranslationUnit extends ICElement, IParent, IOpenable, ISource
* exception occurs while accessing its corresponding resource
*/
IInclude[] getIncludes() throws CModelException;
-
- /**
- * Returns a shared working copy on this element using the given factory to create
- * the buffer, or this element if this element is already a working copy.
- * This API can only answer an already existing working copy if it is based on the same
- * original translation unit AND was using the same buffer factory (i.e. as
- * defined by Object#equals).
- *
- * The life time of a shared working copy is as follows:
- *
- *
The first call to getSharedWorkingCopy(...) creates a new working copy for this
- * element
- *
Subsequent calls increment an internal counter.
- *
A call to destroy() decrements the internal counter.
- *
When this counter is 0, the working copy is destroyed.
- *
- * So users of this method must destroy exactly once the working copy.
- *
- * Note that the buffer factory will be used for the life time of this working copy, i.e. if the
- * working copy is closed then reopened, this factory will be used.
- * The buffer will be automatically initialized with the original's compilation unit content
- * upon creation.
- *
- * When the shared working copy instance is created, an ADDED ICElementDelta is reported on this
- * working copy.
- *
- * @param monitor a progress monitor used to report progress while opening this compilation unit
- * or null if no progress should be reported
- * @param factory the factory that creates a buffer that is used to get the content of the working copy
- * or null if the internal factory should be used
- * @param problemRequestor a requestor which will get notified of problems detected during
- * reconciling as they are discovered. The requestor can be set to null indicating
- * that the client is not interested in problems.
- * @exception CModelException if the contents of this element can not be
- * determined. Reasons include:
- *
- *
This C element does not exist (ELEMENT_DOES_NOT_EXIST)
- *
- * @return a shared working copy on this element using the given factory to create
- * the buffer, or this element if this element is already a working copy
- * @see IBufferFactory
- * @see IProblemRequestor
- * @since 2.0
- * @noreference This method is not intended to be referenced by clients.
- */
- IWorkingCopy getSharedWorkingCopy(IProgressMonitor monitor, IBufferFactory factory)
- throws CModelException;
- /**
- * Returns a shared working copy on this element using the given factory to create
- * the buffer, or this element if this element is already a working copy.
- * This API can only answer an already existing working copy if it is based on the same
- * original translation unit AND was using the same buffer factory (i.e. as
- * defined by Object#equals).
- *
- * The life time of a shared working copy is as follows:
- *
- *
The first call to getSharedWorkingCopy(...) creates a new working copy for this
- * element
- *
Subsequent calls increment an internal counter.
- *
A call to destroy() decrements the internal counter.
- *
When this counter is 0, the working copy is destroyed.
- *
- * So users of this method must destroy exactly once the working copy.
- *
- * Note that the buffer factory will be used for the life time of this working copy, i.e. if the
- * working copy is closed then reopened, this factory will be used.
- * The buffer will be automatically initialized with the original's compilation unit content
- * upon creation.
- *
- * When the shared working copy instance is created, an ADDED ICElementDelta is reported on this
- * working copy.
- *
- * @param monitor a progress monitor used to report progress while opening this compilation unit
- * or null if no progress should be reported
- * @param factory the factory that creates a buffer that is used to get the content of the working copy
- * or null if the internal factory should be used
- * @param problemRequestor a requestor which will get notified of problems detected during
- * reconciling as they are discovered. The requestor can be set to null indicating
- * that the client is not interested in problems.
- * @exception CModelException if the contents of this element can not be
- * determined. Reasons include:
- *
- *
This C element does not exist (ELEMENT_DOES_NOT_EXIST)
- *
- * @return a shared working copy on this element using the given factory to create
- * the buffer, or this element if this element is already a working copy
- * @see IBufferFactory
- * @see IProblemRequestor
- * @since 2.0
- * @noreference This method is not intended to be referenced by clients.
- */
- IWorkingCopy getSharedWorkingCopy(IProgressMonitor monitor, IBufferFactory factory, IProblemRequestor requestor) throws CModelException;
-
/**
* Returns a shared working copy on this element using the given factory to create the buffer, or this
* element if this element is already a working copy. This API can only answer an already existing working
@@ -485,12 +377,6 @@ public interface ITranslationUnit extends ICElement, IParent, IOpenable, ISource
*/
IWorkingCopy getWorkingCopy(IProgressMonitor monitor) throws CModelException;
- /**
- * Returns a new working copy for the Translation Unit.
- * @noreference This method is not intended to be referenced by clients.
- */
- IWorkingCopy getWorkingCopy(IProgressMonitor monitor, IBufferFactory factory) throws CModelException;
-
/**
* Return the contentType id for this file.
* @return String - contentType id
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelManager.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelManager.java
index 7013b75d991..3fbfda0a4c4 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelManager.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 QNX Software Systems and others.
+ * Copyright (c) 2000, 2009 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -50,6 +50,7 @@ import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.model.IElementChangedListener;
import org.eclipse.cdt.core.model.IIncludeReference;
import org.eclipse.cdt.core.model.IParent;
+import org.eclipse.cdt.core.model.IProblemRequestor;
import org.eclipse.cdt.core.model.ISourceRoot;
import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.cdt.core.model.IWorkingCopy;
@@ -72,6 +73,7 @@ import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.SafeRunner;
@@ -123,7 +125,7 @@ public class CModelManager implements IResourceChangeListener, ICDescriptorListe
/**
* A map from ITranslationUnit to IWorkingCopy of the shared working copies.
*/
- public Map> sharedWorkingCopies = new HashMap>();
+ private Map> sharedWorkingCopies = new HashMap>();
/**
* Set of elements which are out of sync with their buffers.
*/
@@ -1277,4 +1279,61 @@ public class CModelManager implements IResourceChangeListener, ICDescriptorListe
CCoreInternals.getPDOMManager().preCloseProject(create(project));
}
+ public IWorkingCopy[] getSharedWorkingCopies(IBufferFactory factory) {
+ // if factory is null, default factory must be used
+ if (factory == null)
+ factory = BufferManager.getDefaultBufferManager().getDefaultBufferFactory();
+
+ Map perFactoryWorkingCopies = sharedWorkingCopies.get(factory);
+ if (perFactoryWorkingCopies == null)
+ return NoWorkingCopy;
+ Collection copies = perFactoryWorkingCopies.values();
+ return copies.toArray(new IWorkingCopy[copies.size()]);
+ }
+
+ public IWorkingCopy findSharedWorkingCopy(IBufferFactory factory, ITranslationUnit tu) {
+ // if factory is null, default factory must be used
+ if (factory == null)
+ factory = BufferManager.getDefaultBufferManager();
+
+ Map perFactoryWorkingCopies = sharedWorkingCopies.get(factory);
+ if (perFactoryWorkingCopies == null)
+ return null;
+
+ return perFactoryWorkingCopies.get(tu);
+ }
+
+ public IWorkingCopy getSharedWorkingCopy(IBufferFactory factory, ITranslationUnit tu, IProblemRequestor requestor,
+ IProgressMonitor monitor) throws CModelException {
+
+ // if factory is null, default factory must be used
+ if (factory == null)
+ factory = BufferManager.getDefaultBufferManager();
+
+ Map perFactoryWorkingCopies = sharedWorkingCopies.get(factory);
+ if (perFactoryWorkingCopies == null) {
+ perFactoryWorkingCopies = new HashMap();
+ sharedWorkingCopies.put(factory, perFactoryWorkingCopies);
+ }
+ WorkingCopy workingCopy = perFactoryWorkingCopies.get(this);
+ if (workingCopy != null) {
+ workingCopy.useCount++;
+ return workingCopy;
+ }
+ CreateWorkingCopyOperation op = new CreateWorkingCopyOperation(tu, perFactoryWorkingCopies,
+ factory, requestor);
+ op.runOperation(monitor);
+ return (IWorkingCopy) op.getResultElements()[0];
+ }
+
+ public IWorkingCopy removeSharedWorkingCopy(final IBufferFactory bufferFactory, ITranslationUnit originalElement) {
+ // In order to be shared, working copies have to denote the same compilation unit
+ // AND use the same buffer factory.
+ // Assuming there is a little set of buffer factories, then use a 2 level Map cache.
+ Map perFactoryWorkingCopies = sharedWorkingCopies.get(bufferFactory);
+ if (perFactoryWorkingCopies != null) {
+ return perFactoryWorkingCopies.remove(originalElement);
+ }
+ return null;
+ }
}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/DestroyWorkingCopyOperation.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/DestroyWorkingCopyOperation.java
index 48989b82c4b..bff8ccd8de7 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/DestroyWorkingCopyOperation.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/DestroyWorkingCopyOperation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,11 +10,10 @@
*******************************************************************************/
package org.eclipse.cdt.internal.core.model;
-import java.util.Map;
-
import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ITranslationUnit;
+import org.eclipse.cdt.core.model.IWorkingCopy;
/**
* Destroys a working copy (remove it from its cache if it is shared)
@@ -37,26 +36,18 @@ public class DestroyWorkingCopyOperation extends CModelOperation {
workingCopy.close();
// if original element is not on classpath flush it from the cache
- ICElement originalElement = workingCopy.getOriginalElement();
+ ITranslationUnit originalElement = workingCopy.getOriginalElement();
if (!workingCopy.getParent().exists()) {
- ((TranslationUnit)originalElement).close();
+ originalElement.close();
}
// remove working copy from the cache if it is shared
- CModelManager manager = CModelManager.getDefault();
-
- // In order to be shared, working copies have to denote the same compilation unit
- // AND use the same buffer factory.
- // Assuming there is a little set of buffer factories, then use a 2 level Map cache.
- Map> sharedWorkingCopies = manager.sharedWorkingCopies;
-
- Map perFactoryWorkingCopies = sharedWorkingCopies.get(workingCopy.bufferFactory);
- if (perFactoryWorkingCopies != null) {
- if (perFactoryWorkingCopies.remove(originalElement) != null) {
- //System.out.println("Destroying shared working copy " + workingCopy.toStringWithAncestors());//$NON-NLS-1$
- //CModelManager.getDefault().fire(delta, ElementChangedEvent.POST_RECONCILE);
- }
+ IWorkingCopy wc = CModelManager.getDefault().removeSharedWorkingCopy(workingCopy.bufferFactory, originalElement);
+ if (wc != null) {
+ //System.out.println("Destroying shared working copy " + workingCopy.toStringWithAncestors());//$NON-NLS-1$
+ //CModelManager.getDefault().fire(delta, ElementChangedEvent.POST_RECONCILE);
}
+
// report C deltas
CElementDelta delta = new CElementDelta(this.getCModel());
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/TranslationUnit.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/TranslationUnit.java
index f3b588da3e1..8be182029ae 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/TranslationUnit.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/TranslationUnit.java
@@ -20,7 +20,6 @@ import java.io.InputStream;
import java.net.URI;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@@ -402,22 +401,7 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
}
public IWorkingCopy findSharedWorkingCopy() {
- return findSharedWorkingCopy(null);
- }
-
- public IWorkingCopy findSharedWorkingCopy(IBufferFactory factory) {
-
- // if factory is null, default factory must be used
- if (factory == null) factory = BufferManager.getDefaultBufferManager();
-
- // In order to be shared, working copies have to denote the same translation unit
- // AND use the same buffer factory.
- // Assuming there is a little set of buffer factories, then use a 2 level Map cache.
- Map> sharedWorkingCopies = CModelManager.getDefault().sharedWorkingCopies;
-
- Map perFactoryWorkingCopies = sharedWorkingCopies.get(factory);
- if (perFactoryWorkingCopies == null) return null;
- return perFactoryWorkingCopies.get(this);
+ return CModelManager.getDefault().findSharedWorkingCopy(null, this);
}
@Override
@@ -457,40 +441,7 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
public IWorkingCopy getSharedWorkingCopy(IProgressMonitor monitor, IProblemRequestor requestor)
throws CModelException {
- return getSharedWorkingCopy(monitor, null, requestor);
- }
-
- public IWorkingCopy getSharedWorkingCopy(IProgressMonitor monitor,IBufferFactory factory)
- throws CModelException {
- return getSharedWorkingCopy(monitor, factory, null);
- }
-
- public IWorkingCopy getSharedWorkingCopy(IProgressMonitor monitor,IBufferFactory factory, IProblemRequestor requestor)
- throws CModelException {
-
- // if factory is null, default factory must be used
- if (factory == null) factory = BufferManager.getDefaultBufferManager();
-
- CModelManager manager = CModelManager.getDefault();
-
- // In order to be shared, working copies have to denote the same translation unit
- // AND use the same buffer factory.
- // Assuming there is a little set of buffer factories, then use a 2 level Map cache.
- Map> sharedWorkingCopies = manager.sharedWorkingCopies;
-
- Map perFactoryWorkingCopies = sharedWorkingCopies.get(factory);
- if (perFactoryWorkingCopies == null) {
- perFactoryWorkingCopies = new HashMap();
- sharedWorkingCopies.put(factory, perFactoryWorkingCopies);
- }
- WorkingCopy workingCopy = perFactoryWorkingCopies.get(this);
- if (workingCopy != null) {
- workingCopy.useCount++;
- return workingCopy;
- }
- CreateWorkingCopyOperation op = new CreateWorkingCopyOperation(this, perFactoryWorkingCopies, factory, requestor);
- op.runOperation(monitor);
- return (IWorkingCopy) op.getResultElements()[0];
+ return CModelManager.getDefault().getSharedWorkingCopy(null, this, requestor, monitor);
}
public IWorkingCopy getWorkingCopy() throws CModelException {
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/WorkingCopy.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/WorkingCopy.java
index 5dd364d6a4d..62ce073f322 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/WorkingCopy.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/WorkingCopy.java
@@ -1,18 +1,17 @@
/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
+ * Copyright (c) 2002, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Rational Software - Initial API and implementation
- * Markus Schorn (Wind River Systems)
- * Anton Leherbauer (Wind River Systems)
+ * Rational Software - Initial API and implementation
+ * Markus Schorn (Wind River Systems)
+ * Anton Leherbauer (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.model;
-
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.net.URI;
@@ -232,12 +231,11 @@ public class WorkingCopy extends TranslationUnit implements IWorkingCopy {
}
/**
- * @see org.eclipse.cdt.core.model.ITranslationUnit#getSharedWorkingCopy(IProgressMonitor, IBufferFactory)
+ * @see org.eclipse.cdt.core.model.ITranslationUnit#getSharedWorkingCopy(IProgressMonitor, IProblemRequestor)
*/
@Override
- public IWorkingCopy getSharedWorkingCopy(IProgressMonitor monitor,IBufferFactory factory)
- throws CModelException{
- return this;
+ public IWorkingCopy getSharedWorkingCopy(IProgressMonitor monitor, IProblemRequestor requestor) {
+ return this;
}
/**
* @see org.eclipse.cdt.core.model.ITranslationUnit#getWorkingCopy()
@@ -251,7 +249,7 @@ public class WorkingCopy extends TranslationUnit implements IWorkingCopy {
* @see IWorkingCopy
*/
@Override
- public IWorkingCopy getWorkingCopy(IProgressMonitor monitor, IBufferFactory factory){
+ public IWorkingCopy getWorkingCopy(IProgressMonitor monitor){
return this;
}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java
index 4b8ca81b02e..609f56a8f9a 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java
@@ -16,10 +16,8 @@ package org.eclipse.cdt.core;
import java.io.IOException;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Map;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
@@ -50,11 +48,8 @@ import org.eclipse.cdt.internal.core.PositionTrackerManager;
import org.eclipse.cdt.internal.core.cdtvariables.CdtVariableManager;
import org.eclipse.cdt.internal.core.cdtvariables.UserVarSupplier;
import org.eclipse.cdt.internal.core.envvar.EnvironmentVariableManager;
-import org.eclipse.cdt.internal.core.model.BufferManager;
import org.eclipse.cdt.internal.core.model.CModelManager;
-import org.eclipse.cdt.internal.core.model.IBufferFactory;
import org.eclipse.cdt.internal.core.model.Util;
-import org.eclipse.cdt.internal.core.model.WorkingCopy;
import org.eclipse.cdt.internal.core.pdom.PDOMManager;
import org.eclipse.cdt.internal.core.resources.ResourceLookup;
import org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager;
@@ -225,7 +220,7 @@ public class CCorePlugin extends Plugin {
* @since 5.1
*/
public static IWorkingCopy[] getSharedWorkingCopies() {
- return getSharedWorkingCopies(null);
+ return CModelManager.getDefault().getSharedWorkingCopies(null);
}
public static String getResourceString(String key) {
@@ -1174,32 +1169,6 @@ public class CCorePlugin extends Plugin {
super();
fgCPlugin = this;
}
-
- /**
- * Answers the shared working copies currently registered for this buffer factory.
- * Working copies can be shared by several clients using the same buffer factory,see
- * IWorkingCopy.getSharedWorkingCopy.
- *
- * @param factory the given buffer factory
- * @return the list of shared working copies for a given buffer factory
- * @see IWorkingCopy
- * @noreference This method is not intended to be referenced by clients.
- */
- public static IWorkingCopy[] getSharedWorkingCopies(IBufferFactory factory) {
- // if factory is null, default factory must be used
- if (factory == null)
- factory = BufferManager.getDefaultBufferManager().getDefaultBufferFactory();
- Map> sharedWorkingCopies = CModelManager
- .getDefault().sharedWorkingCopies;
-
- Map perFactoryWorkingCopies = sharedWorkingCopies.get(factory);
- if (perFactoryWorkingCopies == null)
- return CModelManager.NoWorkingCopy;
- Collection copies = perFactoryWorkingCopies.values();
- IWorkingCopy[] result = new IWorkingCopy[copies.size()];
- copies.toArray(result);
- return result;
- }
/**
* @noreference This method is not intended to be referenced by clients.
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/BaseCElementContentProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/BaseCElementContentProvider.java
index 6dcfb8357b9..95c97490550 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/BaseCElementContentProvider.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/BaseCElementContentProvider.java
@@ -49,6 +49,8 @@ import org.eclipse.cdt.ui.CElementGrouping;
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.ui.IncludesGrouping;
import org.eclipse.cdt.ui.NamespacesGrouping;
+
+import org.eclipse.cdt.internal.core.model.CModelManager;
/**
* A base content provider for C elements. It provides access to the
@@ -208,7 +210,7 @@ public class BaseCElementContentProvider implements ITreeContentProvider {
// if it is not already a working copy
if (!(element instanceof IWorkingCopy)){
// if it has a valid working copy
- IWorkingCopy copy = tu.findSharedWorkingCopy(CUIPlugin.getDefault().getBufferFactory());
+ IWorkingCopy copy = CModelManager.getDefault().findSharedWorkingCopy(CUIPlugin.getDefault().getBufferFactory(), tu);
if (copy != null) {
tu = copy;
}
@@ -389,8 +391,7 @@ public class BaseCElementContentProvider implements ITreeContentProvider {
List list= new ArrayList();
ICElement[] children = cproject.getChildren();
- for (int i= 0; i < children.length; i++) {
- ICElement child = children[i];
+ for (ICElement child : children) {
if (child instanceof ISourceRoot && child.getResource().getType() == IResource.PROJECT) {
// Was a source root at the project, get the children of this element
ICElement[] c2 = ((ISourceRoot)child).getChildren();
@@ -565,8 +566,8 @@ public class BaseCElementContentProvider implements ITreeContentProvider {
roots = new ISourceRoot[0];
}
List