Skip to main content
summaryrefslogtreecommitdiffstats
path: root/qt
diff options
context:
space:
mode:
authorDoug Schaefer2013-12-13 17:03:52 -0500
committerDoug Schaefer2013-12-13 17:03:52 -0500
commitf6957b73aba276392effe789f8dbfc10f401b793 (patch)
treef8c841444c4943a1c4e87e8233ea25ff1c23d96d /qt
parentc0b973880f1bd6504e203f54ba7483ca2edd76a6 (diff)
downloadorg.eclipse.cdt-f6957b73aba276392effe789f8dbfc10f401b793.tar.gz
org.eclipse.cdt-f6957b73aba276392effe789f8dbfc10f401b793.tar.xz
org.eclipse.cdt-f6957b73aba276392effe789f8dbfc10f401b793.zip
Clean up the API around QtNature. Add isProject expr def.
Diffstat (limited to 'qt')
-rw-r--r--qt/org.eclipse.cdt.qt.core/plugin.xml9
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/QtNature.java5
-rw-r--r--qt/org.eclipse.cdt.qt.tests/src/org/eclipse/cdt/qt/tests/BaseQtTestCase.java3
3 files changed, 15 insertions, 2 deletions
diff --git a/qt/org.eclipse.cdt.qt.core/plugin.xml b/qt/org.eclipse.cdt.qt.core/plugin.xml
index aa0f7908f2..08c187ec49 100644
--- a/qt/org.eclipse.cdt.qt.core/plugin.xml
+++ b/qt/org.eclipse.cdt.qt.core/plugin.xml
@@ -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>
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/QtNature.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/QtNature.java
index a6f9a7a874..cb7d261098 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/QtNature.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/QtNature.java
@@ -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);
}
}
diff --git a/qt/org.eclipse.cdt.qt.tests/src/org/eclipse/cdt/qt/tests/BaseQtTestCase.java b/qt/org.eclipse.cdt.qt.tests/src/org/eclipse/cdt/qt/tests/BaseQtTestCase.java
index b06355f9e3..2c023b29ba 100644
--- a/qt/org.eclipse.cdt.qt.tests/src/org/eclipse/cdt/qt/tests/BaseQtTestCase.java
+++ b/qt/org.eclipse.cdt.qt.tests/src/org/eclipse/cdt/qt/tests/BaseQtTestCase.java
@@ -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();

Back to the top