Permalink
Browse files

Updated tooling.core project #359

  Added empty builder
  • Loading branch information...
ujhelyiz committed Nov 29, 2012
1 parent c604c26 commit fea313bed68072b208994b9389dd755790155195
@@ -3,16 +3,19 @@
<plugin>
<extension-point id="generatorFragment" name="EMF-IncQuery Code Generation Fragment" schema="schema/generatorFragment.exsd"/>
<extension
- id="org.eclipse.viatra2.emf.incquery.projectnature"
+ id="org.eclipse.incquery.projectnature"
point="org.eclipse.core.resources.natures">
<runtime>
<run
class="org.eclipse.incquery.tooling.core.project.IncQueryNature">
</run>
</runtime>
+ <builder
+ id="org.eclipse.incquery.tooling.core.projectbuilder">
+ </builder>
</extension>
<extension
- id="org.eclipse.viatra2.emf.incquery.tooling.generator.marker.inference"
+ id="org.eclipse.incquery.tooling.core.generator.marker.inference"
name="EMF-IncQuery Generator Marker"
point="org.eclipse.core.resources.markers">
<super
@@ -23,7 +26,7 @@
</persistent>
</extension>
<extension
- id="org.eclipse.viatra2.emf.incquery.tooling.generator.marker.fragment"
+ id="org.eclipse.incquery.tooling.core.generator.marker.fragment"
name="EMF-IncQuery Generator Marker"
point="org.eclipse.core.resources.markers">
<super
@@ -33,5 +36,15 @@
value="true">
</persistent>
</extension>
+ <extension
+ id="projectbuilder"
+ name="EMF-IncQuery Project Builder"
+ point="org.eclipse.core.resources.builders">
+ <builder
+ hasNature="true">
+ <run
+ class="org.eclipse.incquery.tooling.core.project.IncQueryProjectBuilder">
+ </run></builder>
+ </extension>
</plugin>
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.viatra2.emf.incquery.tooling.generator" xmlns="http://www.w3.org/2001/XMLSchema">
+<schema targetNamespace="org.eclipse.incquery.tooling.core.generator" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appinfo>
<meta.schema plugin="org.eclipse.incquery.tooling.core" id="generatorFragment" name="EMF-IncQuery Code Generation Fragment"/>
@@ -23,6 +23,7 @@
private static BundleContext context;
private Injector injector;
public static IncQueryGeneratorPlugin INSTANCE;
+ public static final String BUNDLE_ID = "org.eclipse.incquery.tooling.core";
public static BundleContext getContext() {
return context;
@@ -11,12 +11,12 @@
package org.eclipse.incquery.tooling.core.generator.builder;
+import org.eclipse.incquery.tooling.core.generator.IncQueryGeneratorPlugin;
+
public final class GeneratorIssueCodes {
private GeneratorIssueCodes() {}
-
- private static final String GENERATOR_ROOT_CODE = "org.eclipse.viatra2.emf.incquery.tooling.generator.";
- public static final String INVALID_PATTERN_MODEL_CODE = GENERATOR_ROOT_CODE + "invalid.patternmodel";
- public static final String INVALID_TYPEREF_CODE = GENERATOR_ROOT_CODE + "invalid.typeref";
+ public static final String INVALID_PATTERN_MODEL_CODE = IncQueryGeneratorPlugin.BUNDLE_ID + ".invalid.patternmodel";
+ public static final String INVALID_TYPEREF_CODE = IncQueryGeneratorPlugin.BUNDLE_ID + ".invalid.typeref";
}
@@ -22,12 +22,12 @@
* An error type for use in the JvmModelInferrer. It is differentiated from {@link #FRAGMENT_ERROR_TYPE}, as the
* two builds have different lifecycles, so cleaning has to be executed at different points.
*/
- static final String JVMINFERENCE_ERROR_TYPE = "org.eclipse.viatra2.emf.incquery.tooling.generator.marker.inference";
+ static final String JVMINFERENCE_ERROR_TYPE = "org.eclipse.incquery.tooling.core.generator.marker.inference";
/**
* An error type for use in the generator fragments. It is differentiated from {@link #JVMINFERENCE_ERROR_TYPE}, as the
* two builds have different lifecycles, so cleaning has to be executed at different points.
*/
- static final String FRAGMENT_ERROR_TYPE = "org.eclipse.viatra2.emf.incquery.tooling.generator.marker.fragment";
+ static final String FRAGMENT_ERROR_TYPE = "org.eclipse.incquery.tooling.core.generator.marker.fragment";
/**
* Clears all problem markers from the resource and all its descendants.
@@ -40,7 +40,7 @@
@Inject
private Logger logger;
- static final String EXTENSIONID = "org.eclipse.viatra2.emf.incquery.tooling.generator.generatorFragment";
+ static final String EXTENSIONID = "org.eclipse.incquery.tooling.core.generatorFragment";
static final String GENERIC_ATTRIBUTE = "";
private Multimap<String, IGenerationFragment> fragments;
@@ -51,14 +51,6 @@
@Inject
private Primitives primitives;
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.viatra2.patternlanguage.types.EMFPatternTypeProvider#
- * getTypeReferenceForVariableWithEClassifier
- * (org.eclipse.emf.ecore.EClassifier,
- * org.eclipse.incquery.patternlanguage.PatternLanguage.Variable)
- */
@Override
protected JvmTypeReference getTypeReferenceForVariableWithEClassifier(EClassifier classifier, Variable variable) {
JvmTypeReference typeReference = super.getTypeReferenceForVariableWithEClassifier(classifier, variable);
@@ -11,7 +11,9 @@
package org.eclipse.incquery.tooling.core.project;
+import org.eclipse.core.resources.ICommand;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.IProjectNature;
import org.eclipse.core.runtime.CoreException;
@@ -24,9 +26,9 @@
* The project nature identifier used for defining the project nature of an
* IncQuery project.
*/
- public static final String NATURE_ID = "org.eclipse.viatra2.emf.incquery.projectnature"; //$NON-NLS-1$
- public static final String BUNDLE_ID = "org.eclipse.viatra2.emf.incquery.core"; //$NON-NLS-1$
- public static final String MODEL_BUNDLE_ID = "org.eclipse.viatra2.emf.importer.generic"; //$NON-NLS-1$
+ public static final String NATURE_ID = "org.eclipse.incquery.projectnature"; //$NON-NLS-1$
+ public static final String BUNDLE_ID = "org.eclipse.incquery.tooling.core"; //$NON-NLS-1$
+ public static final String BUILDER_ID = BUNDLE_ID + ".projectbuilder";//$NON-NLS-1$
public static final String SRCGEN_DIR = "src-gen/"; //$NON-NLS-1$
public static final String SRC_DIR = "src/"; //$NON-NLS-1$
public static final String EXECUTION_ENVIRONMENT = "JavaSE-1.6"; //$NON_NLS-1$
@@ -55,9 +57,43 @@ public void setProject(IProject project) {
}
public void configure() throws CoreException {
+ IProjectDescription desc = project.getDescription();
+ ICommand[] commands = desc.getBuildSpec();
+ for (int i = 0; i < commands.length; i++) {
+ if (commands[i].getBuilderName().equals(BUILDER_ID)) {
+ return; // Builder is already configured, returning
+ }
+ }
+
+ ICommand command = desc.newCommand();
+ command.setBuilderName(BUILDER_ID);
+ ICommand[] newCommandList = new ICommand[commands.length + 1];
+ System.arraycopy(commands, 0, newCommandList, 0, commands.length);
+ newCommandList[commands.length] = command;
+ desc.setBuildSpec(newCommandList);
+ project.setDescription(desc, null);
}
public void deconfigure() throws CoreException {
+ IProjectDescription desc = project.getDescription();
+ ICommand[] commands = desc.getBuildSpec();
+ int index = 0;
+ for (; index < commands.length; index++) {
+ if (commands[index].getBuilderName().equals(BUILDER_ID)) {
+ break; // Builder is already configured, returning
+ }
+ }
+ if (index == commands.length) {
+ return;
+ }
+ ICommand command = desc.newCommand();
+ command.setBuilderName(BUILDER_ID);
+ ICommand[] newCommandList = new ICommand[commands.length - 1];
+ System.arraycopy(commands, 0, newCommandList, 0, index);
+ System.arraycopy(commands, index + 1, desc, index, commands.length - index);
+ newCommandList[commands.length] = command;
+ desc.setBuildSpec(newCommandList);
+ project.setDescription(desc, null);
}
}
@@ -0,0 +1,24 @@
+package org.eclipse.incquery.tooling.core.project;
+
+import java.util.Map;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+/**
+ * An incremental project builder for IncQuery projects. Currently it is an empty builder implementation - registered
+ * for future use.
+ *
+ * @author Zoltan Ujhelyi
+ *
+ */
+public class IncQueryProjectBuilder extends IncrementalProjectBuilder {
+
+ @Override
+ protected IProject[] build(int kind, Map<String, String> args, IProgressMonitor monitor) throws CoreException {
+ return null;
+ }
+
+}
@@ -30,6 +30,7 @@
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.incquery.runtime.IncQueryRuntimePlugin;
import org.eclipse.incquery.tooling.core.generator.IncQueryGeneratorPlugin;
import org.eclipse.pde.core.plugin.IExtensions;
import org.eclipse.pde.core.plugin.IPluginExtension;
@@ -111,8 +112,7 @@ public IRequiredBundleDescription apply(String input) {
public static void createProject(IProjectDescription description,
IProject proj, List<String> additionalDependencies, IProgressMonitor monitor) throws CoreException {
List<String> dependencies = Lists.newArrayList("org.eclipse.pde.core", "org.eclipse.emf.ecore",
- "org.eclipse.emf.transaction",
- "org.eclipse.viatra2.emf.incquery.runtime",
+ "org.eclipse.emf.transaction", IncQueryRuntimePlugin.PLUGIN_ID,
"org.eclipse.xtext.xbase.lib");
if (additionalDependencies != null) {
dependencies.addAll(additionalDependencies);

0 comments on commit fea313b

Please sign in to comment.