1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Merge remote-tracking branch 'cdt/master' into sd90

This commit is contained in:
Andrew Gvozdev 2012-04-16 19:00:27 -04:00
commit 775d00a41d
3 changed files with 37 additions and 20 deletions

View file

@ -45,6 +45,7 @@ import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot; import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.resources.WorkspaceJob;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
@ -358,9 +359,9 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
} }
isExecuted = true; isExecuted = true;
Job job = new Job(ManagedMakeMessages.getResourceString("AbstractBuiltinSpecsDetector.DiscoverBuiltInSettingsJobName")) { //$NON-NLS-1$ WorkspaceJob job = new WorkspaceJob(ManagedMakeMessages.getResourceString("AbstractBuiltinSpecsDetector.DiscoverBuiltInSettingsJobName")) { //$NON-NLS-1$
@Override @Override
protected IStatus run(IProgressMonitor monitor) { public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
IStatus status; IStatus status;
try { try {
startup(currentCfgDescription, null); startup(currentCfgDescription, null);

View file

@ -49,7 +49,7 @@ import org.eclipse.core.runtime.NullProgressMonitor;
/** /**
* @author David * @author David
* *
* To change the template for this generated type comment go to * To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments * Window>Preferences>Java>Code Generation>Code and Comments
*/ */
@ -62,7 +62,7 @@ public class CDescriptorTests extends BaseTestCase {
/** /**
* Constructor for CDescriptorTest. * Constructor for CDescriptorTest.
* *
* @param name * @param name
*/ */
public CDescriptorTests(String name) { public CDescriptorTests(String name) {
@ -92,7 +92,7 @@ public class CDescriptorTests extends BaseTestCase {
}; };
return wrapper; return wrapper;
} }
@Override @Override
protected void setUp() throws Exception { protected void setUp() throws Exception {
fProject.open(new NullProgressMonitor()); fProject.open(new NullProgressMonitor());
@ -101,7 +101,7 @@ public class CDescriptorTests extends BaseTestCase {
@Override @Override
protected void tearDown() throws Exception { protected void tearDown() throws Exception {
} }
private static void addNatureToProject(IProject proj, String natureId, IProgressMonitor monitor) throws CoreException { private static void addNatureToProject(IProject proj, String natureId, IProgressMonitor monitor) throws CoreException {
IProjectDescription description = proj.getDescription(); IProjectDescription description = proj.getDescription();
String[] prevNatures = description.getNatureIds(); String[] prevNatures = description.getNatureIds();
@ -193,8 +193,11 @@ public class CDescriptorTests extends BaseTestCase {
}; };
t.start(); t.start();
ICDescriptor desc = CCorePlugin.getDefault().getCProjectDescription(fProject, true); ICDescriptor desc = CCorePlugin.getDefault().getCProjectDescription(fProject, true);
t.join(); try {
t.join();
} catch (InterruptedException e) {
}
ICStorageElement data = desc.getProjectStorageElement("testElement0"); ICStorageElement data = desc.getProjectStorageElement("testElement0");
data.createChild("test"); data.createChild("test");
desc.saveProjectData(); desc.saveProjectData();
@ -204,7 +207,7 @@ public class CDescriptorTests extends BaseTestCase {
/* /*
* This tests concurrent descriptor modification inside of a ICDescriptor operation run * This tests concurrent descriptor modification inside of a ICDescriptor operation run
* with * with
* CConfigBasedDescriptorManager.runDescriptorOperation(IProject project, ICDescriptorOperation op, IProgressMonitor monitor) * CConfigBasedDescriptorManager.runDescriptorOperation(IProject project, ICDescriptorOperation op, IProgressMonitor monitor)
*/ */
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=185930 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=185930
@ -253,7 +256,10 @@ public class CDescriptorTests extends BaseTestCase {
} }
for (int j = 0; j < threads.length; j++) { for (int j = 0; j < threads.length; j++) {
if (threads[j] != null) { if (threads[j] != null) {
threads[j].join(); try {
threads[j].join();
} catch (InterruptedException e) {
}
} }
assertNull("Exception occurred: "+exception[j], exception[j]); assertNull("Exception occurred: "+exception[j], exception[j]);
} }
@ -267,7 +273,7 @@ public class CDescriptorTests extends BaseTestCase {
} }
/* /*
* This test should pass as two threads, operating on the * This test should pass as two threads, operating on the
* different storage elements (outside of an operation) should be safe * different storage elements (outside of an operation) should be safe
*/ */
public void testConcurrentDifferentStorageElementModification() throws Exception { public void testConcurrentDifferentStorageElementModification() throws Exception {
@ -291,7 +297,10 @@ public class CDescriptorTests extends BaseTestCase {
ICStorageElement data = desc.getProjectStorageElement("testElement5"); ICStorageElement data = desc.getProjectStorageElement("testElement5");
data.createChild("test"); data.createChild("test");
desc.saveProjectData(); desc.saveProjectData();
t.join(); try {
t.join();
} catch (InterruptedException e) {
}
fLastEvent = null; fLastEvent = null;
} }
@ -324,8 +333,11 @@ public class CDescriptorTests extends BaseTestCase {
ICStorageElement data = desc.getProjectStorageElement("testElement6"); ICStorageElement data = desc.getProjectStorageElement("testElement6");
data.createChild("test"); data.createChild("test");
desc.saveProjectData(); desc.saveProjectData();
t.join(); try {
t.join();
} catch (InterruptedException e) {
}
fLastEvent = null; fLastEvent = null;
} }
Assert.assertEquals(200, CCorePlugin.getDefault().getCProjectDescription(fProject, false).getProjectStorageElement("testElement6").getChildren().length); Assert.assertEquals(200, CCorePlugin.getDefault().getCProjectDescription(fProject, false).getProjectStorageElement("testElement6").getChildren().length);
@ -356,8 +368,11 @@ public class CDescriptorTests extends BaseTestCase {
ICStorageElement data = desc.getProjectStorageElement("testElement0"); ICStorageElement data = desc.getProjectStorageElement("testElement0");
data.createChild("test"); data.createChild("test");
desc.saveProjectData(); desc.saveProjectData();
t.join(); try {
t.join();
} catch (InterruptedException e) {
}
fLastEvent = null; fLastEvent = null;
} }
} }
@ -488,7 +503,7 @@ public class CDescriptorTests extends BaseTestCase {
String dotCProject1 = readDotCProjectFile(fProject); String dotCProject1 = readDotCProjectFile(fProject);
long mtime1 = fProject.getFile(".cproject").getLocalTimeStamp(); long mtime1 = fProject.getFile(".cproject").getLocalTimeStamp();
desc = CCorePlugin.getDefault().getCProjectDescription(fProject, true); desc = CCorePlugin.getDefault().getCProjectDescription(fProject, true);
data = desc.getProjectStorageElement("testElement"); data = desc.getProjectStorageElement("testElement");
for (ICStorageElement child : data.getChildren()) { for (ICStorageElement child : data.getChildren()) {
@ -522,11 +537,11 @@ public class CDescriptorTests extends BaseTestCase {
/** /**
* Read .cproject file. * Read .cproject file.
* *
* @param project * @param project
* @return content of .cproject file * @return content of .cproject file
* @throws CoreException * @throws CoreException
* @throws IOException * @throws IOException
*/ */
private static String readDotCProjectFile(IProject project) throws CoreException, IOException { private static String readDotCProjectFile(IProject project) throws CoreException, IOException {
IFile cProjectFile = project.getFile(".cproject"); IFile cProjectFile = project.getFile(".cproject");

View file

@ -590,6 +590,7 @@ public class LanguageSettingsProvidersSerializer {
} }
}; };
job.setRule(ResourcesPlugin.getWorkspace().getRoot());
job.schedule(); job.schedule();
} }