1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-06 17:26:01 +02:00

Clean up the API around QtNature. Add isProject expr def.

This commit is contained in:
Doug Schaefer 2013-12-13 17:03:52 -05:00
parent c0b973880f
commit f6957b73ab
3 changed files with 15 additions and 2 deletions

View file

@ -91,4 +91,13 @@
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
</extension>
<extension point="org.eclipse.core.expressions.definitions">
<definition id="org.eclipse.cdt.qt.core.isQtProject">
<with variable="projectNatures">
<iterate operator="or">
<equals value="org.eclipse.cdt.qt.core.qtNature"/>
</iterate>
</with>
</definition>
</extension>
</plugin>

View file

@ -14,6 +14,7 @@ import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.IProjectNature;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
public class QtNature implements IProjectNature {
private static final String ID = "org.eclipse.cdt.qt.core.qtNature";
@ -27,7 +28,7 @@ public class QtNature implements IProjectNature {
}
}
public static void addNature(IProject project) throws CoreException {
public static void addNature(IProject project, IProgressMonitor monitor) throws CoreException {
if (project.isOpen()) {
if (hasNature(project))
return;
@ -35,8 +36,10 @@ public class QtNature implements IProjectNature {
IProjectDescription desc = project.getDescription();
String[] oldIds = desc.getNatureIds();
String[] newIds = new String[oldIds.length + 1];
System.arraycopy(oldIds, 0, newIds, 0, oldIds.length);
newIds[oldIds.length] = ID;
desc.setNatureIds(newIds);
project.setDescription(desc, monitor);
}
}

View file

@ -18,6 +18,7 @@ import org.eclipse.cdt.core.testplugin.util.TestSourceReader;
import org.eclipse.cdt.qt.core.QtNature;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.NullProgressMonitor;
public class BaseQtTestCase extends BaseTestCase {
@ -46,7 +47,7 @@ public class BaseQtTestCase extends BaseTestCase {
fCProject = CProjectHelper.createCCProject(projectName, "bin", IPDOMManager.ID_FAST_INDEXER);
fProject = fCProject.getProject();
QtNature.addNature(fProject);
QtNature.addNature(fProject, new NullProgressMonitor());
fIndex = CCorePlugin.getIndexManager().getIndex(fCProject);
indexQObject_h();