Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.dawn.codegen/src/org/eclipse/emf/cdo/dawn')
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.codegen/src/org/eclipse/emf/cdo/dawn/codegen/DawnCodeGenPlugin.java106
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.codegen/src/org/eclipse/emf/cdo/dawn/codegen/actions/GenerateDawnGenModelAction.java386
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.codegen/src/org/eclipse/emf/cdo/dawn/codegen/creators/Creator.java42
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.codegen/src/org/eclipse/emf/cdo/dawn/codegen/creators/impl/AbstractFragmentCreator.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.codegen/src/org/eclipse/emf/cdo/dawn/codegen/messages/Messages.java70
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.codegen/src/org/eclipse/emf/cdo/dawn/codegen/messages/messages.properties13
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.codegen/src/org/eclipse/emf/cdo/dawn/codegen/util/DawnWorkflowUtil.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.codegen/src/org/eclipse/emf/cdo/dawn/codegen/util/ProjectCreationHelper.java848
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.codegen/src/org/eclipse/emf/cdo/dawn/codegen/util/Utils.ext2
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.codegen/src/org/eclipse/emf/cdo/dawn/codegen/util/Utils.java230
10 files changed, 855 insertions, 846 deletions
diff --git a/plugins/org.eclipse.emf.cdo.dawn.codegen/src/org/eclipse/emf/cdo/dawn/codegen/DawnCodeGenPlugin.java b/plugins/org.eclipse.emf.cdo.dawn.codegen/src/org/eclipse/emf/cdo/dawn/codegen/DawnCodeGenPlugin.java
index 672457c482..90df14cf5d 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.codegen/src/org/eclipse/emf/cdo/dawn/codegen/DawnCodeGenPlugin.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.codegen/src/org/eclipse/emf/cdo/dawn/codegen/DawnCodeGenPlugin.java
@@ -1,53 +1,53 @@
-/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) 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:
- * Martin Fluegge - initial API and implementation
- */
-package org.eclipse.emf.cdo.dawn.codegen;
-
-import org.eclipse.core.runtime.Plugin;
-
-import org.osgi.framework.BundleContext;
-
-/**
- * @author Martin Fluegge
- */
-public class DawnCodeGenPlugin extends Plugin
-{
- public static final String PLUGIN_ID = "org.eclipse.emf.cdo.dawn.codegen"; //$NON-NLS-1$
-
- private static DawnCodeGenPlugin plugin;
-
- public DawnCodeGenPlugin()
- {
- }
-
- @Override
- public void start(BundleContext context) throws Exception
- {
- super.start(context);
- plugin = this;
- }
-
- @Override
- public void stop(BundleContext context) throws Exception
- {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static DawnCodeGenPlugin getDefault()
- {
- return plugin;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) 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:
+ * Martin Fluegge - initial API and implementation
+ */
+package org.eclipse.emf.cdo.dawn.codegen;
+
+import org.eclipse.core.runtime.Plugin;
+
+import org.osgi.framework.BundleContext;
+
+/**
+ * @author Martin Fluegge
+ */
+public class DawnCodeGenPlugin extends Plugin
+{
+ public static final String PLUGIN_ID = "org.eclipse.emf.cdo.dawn.codegen"; //$NON-NLS-1$
+
+ private static DawnCodeGenPlugin plugin;
+
+ public DawnCodeGenPlugin()
+ {
+ }
+
+ @Override
+ public void start(BundleContext context) throws Exception
+ {
+ super.start(context);
+ plugin = this;
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception
+ {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static DawnCodeGenPlugin getDefault()
+ {
+ return plugin;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.codegen/src/org/eclipse/emf/cdo/dawn/codegen/actions/GenerateDawnGenModelAction.java b/plugins/org.eclipse.emf.cdo.dawn.codegen/src/org/eclipse/emf/cdo/dawn/codegen/actions/GenerateDawnGenModelAction.java
index 8707f3eb9e..f582e79dd2 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.codegen/src/org/eclipse/emf/cdo/dawn/codegen/actions/GenerateDawnGenModelAction.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.codegen/src/org/eclipse/emf/cdo/dawn/codegen/actions/GenerateDawnGenModelAction.java
@@ -1,193 +1,193 @@
-/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) 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:
- * Martin Fluegge - initial API and implementation
- */
-package org.eclipse.emf.cdo.dawn.codegen.actions;
-
-import org.eclipse.emf.cdo.dawn.codegen.dawngenmodel.DawnFragmentGenerator;
-import org.eclipse.emf.cdo.dawn.codegen.dawngenmodel.DawnGenerator;
-import org.eclipse.emf.cdo.dawn.codegen.dawngenmodel.DawngenmodelFactory;
-import org.eclipse.emf.cdo.dawn.codegen.util.ProjectCreationHelper;
-
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
-import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Collections;
-
-/**
- * @author Martin Fluegge
- */
-public abstract class GenerateDawnGenModelAction implements IObjectActionDelegate
-{
- /**
- * @since 1.0
- */
- protected IResource selectedElement;
-
- public final static String dawngenmodelFileExtension = "dawngenmodel";
-
- /**
- * @since 1.0
- */
- protected final String generalPrefix = "Dawn";
-
- public void setActivePart(IAction action, IWorkbenchPart targetPart)
- {
- }
-
- public void run(IAction action)
- {
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- try
- {
- window.run(true, true, new IRunnableWithProgress()
- {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException
- {
- monitor.beginTask("Generate Dawn Code", 1000);
- IFile genFile = (IFile)selectedElement;
-
- String genModelFile = genFile.getRawLocationURI().toString();
- String path = genModelFile.replace(genFile.getName(), "");
-
- ResourceSet resourceSet = createResourceSet();
- String modelname = "default";
- modelname = getModelName(genFile);
-
- Resource dawnGenModelResource = getResource(path, modelname, resourceSet, dawngenmodelFileExtension);
- Resource dawnFragmentModelResource = getDawnFragmentModelResource(path, modelname, resourceSet);
-
- DawnGenerator dawnGenerator = getDawngenerator(dawnGenModelResource);
-
- DawnFragmentGenerator fragmentGenerator = getDawnFragmentGenerator(genFile, resourceSet);
- fragmentGenerator.setDawnGenerator(dawnGenerator);
-
- dawnGenModelResource.getContents().add(dawnGenerator);
- dawnFragmentModelResource.getContents().add(fragmentGenerator);
-
- try
- {
- dawnGenModelResource.save(Collections.EMPTY_MAP);
- dawnFragmentModelResource.save(Collections.EMPTY_MAP);
- }
- catch (IOException ex)
- {
- throw new RuntimeException(ex);
- }
-
- ProjectCreationHelper.refreshProject(null, monitor);
- }
-
- private DawnGenerator getDawngenerator(Resource dawnGenModelResource)
- {
- DawnGenerator dawnGenerator;
-
- if (dawnGenModelResource.getContents().size() != 0)
- {
- dawnGenerator = (DawnGenerator)dawnGenModelResource.getContents().get(0);
- }
- else
- {
- dawnGenerator = DawngenmodelFactory.eINSTANCE.createDawnGenerator();
- }
- return dawnGenerator;
- }
-
- });
- }
- catch (InvocationTargetException ex)
- {
- throw new RuntimeException(ex);
- }
- catch (InterruptedException ex)
- {
- throw new RuntimeException(ex);
- }
- }
-
- /**
- * @since 1.0
- */
- protected abstract Resource getDawnFragmentModelResource(String path, String modelname, ResourceSet resourceSet);
-
- /**
- * @since 1.0
- */
- protected abstract DawnFragmentGenerator getDawnFragmentGenerator(IFile genFile, ResourceSet resourceSet);
-
- private String getModelName(IFile genFile)
- {
- int lastIndexOf = genFile.getName().lastIndexOf(".");
- return genFile.getName().substring(0, lastIndexOf);
- }
-
- /**
- * @since 1.0
- */
- protected Resource getResource(String path, String modelname, ResourceSet resourceSet, String extension)
- {
- String resourcePath = path + "" + modelname + "." + extension;
- URI uri = URI.createURI(resourcePath);
- Resource resource = null;
- try
- {
- resource = resourceSet.getResource(uri, true);
- }
- catch (Exception ignore)
- {
- // ignore
- }
-
- if (resource == null)
- {
- resource = resourceSet.createResource(uri);
- }
- return resource;
- }
-
- /**
- * @since 1.0
- */
- protected ResourceSet createResourceSet()
- {
- ResourceSet resourceSet = new ResourceSetImpl();
- resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap()
- .put(dawngenmodelFileExtension, new XMIResourceFactoryImpl());
- return resourceSet;
- }
-
- public void selectionChanged(IAction action, ISelection selection)
- {
- if (selection instanceof IStructuredSelection)
- {
- Object sel = ((IStructuredSelection)selection).getFirstElement();
- if (sel instanceof IResource)
- {
- selectedElement = (IResource)sel;
- }
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) 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:
+ * Martin Fluegge - initial API and implementation
+ */
+package org.eclipse.emf.cdo.dawn.codegen.actions;
+
+import org.eclipse.emf.cdo.dawn.codegen.dawngenmodel.DawnFragmentGenerator;
+import org.eclipse.emf.cdo.dawn.codegen.dawngenmodel.DawnGenerator;
+import org.eclipse.emf.cdo.dawn.codegen.dawngenmodel.DawngenmodelFactory;
+import org.eclipse.emf.cdo.dawn.codegen.util.ProjectCreationHelper;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Collections;
+
+/**
+ * @author Martin Fluegge
+ */
+public abstract class GenerateDawnGenModelAction implements IObjectActionDelegate
+{
+ /**
+ * @since 1.0
+ */
+ protected IResource selectedElement;
+
+ public final static String dawngenmodelFileExtension = "dawngenmodel";
+
+ /**
+ * @since 1.0
+ */
+ protected final String generalPrefix = "Dawn";
+
+ public void setActivePart(IAction action, IWorkbenchPart targetPart)
+ {
+ }
+
+ public void run(IAction action)
+ {
+ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ try
+ {
+ window.run(true, true, new IRunnableWithProgress()
+ {
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException
+ {
+ monitor.beginTask("Generate Dawn Code", 1000);
+ IFile genFile = (IFile)selectedElement;
+
+ String genModelFile = genFile.getRawLocationURI().toString();
+ String path = genModelFile.replace(genFile.getName(), "");
+
+ ResourceSet resourceSet = createResourceSet();
+ String modelname = "default";
+ modelname = getModelName(genFile);
+
+ Resource dawnGenModelResource = getResource(path, modelname, resourceSet, dawngenmodelFileExtension);
+ Resource dawnFragmentModelResource = getDawnFragmentModelResource(path, modelname, resourceSet);
+
+ DawnGenerator dawnGenerator = getDawngenerator(dawnGenModelResource);
+
+ DawnFragmentGenerator fragmentGenerator = getDawnFragmentGenerator(genFile, resourceSet);
+ fragmentGenerator.setDawnGenerator(dawnGenerator);
+
+ dawnGenModelResource.getContents().add(dawnGenerator);
+ dawnFragmentModelResource.getContents().add(fragmentGenerator);
+
+ try
+ {
+ dawnGenModelResource.save(Collections.EMPTY_MAP);
+ dawnFragmentModelResource.save(Collections.EMPTY_MAP);
+ }
+ catch (IOException ex)
+ {
+ throw new RuntimeException(ex);
+ }
+
+ ProjectCreationHelper.refreshProject(null, monitor);
+ }
+
+ private DawnGenerator getDawngenerator(Resource dawnGenModelResource)
+ {
+ DawnGenerator dawnGenerator;
+
+ if (dawnGenModelResource.getContents().size() != 0)
+ {
+ dawnGenerator = (DawnGenerator)dawnGenModelResource.getContents().get(0);
+ }
+ else
+ {
+ dawnGenerator = DawngenmodelFactory.eINSTANCE.createDawnGenerator();
+ }
+ return dawnGenerator;
+ }
+
+ });
+ }
+ catch (InvocationTargetException ex)
+ {
+ throw new RuntimeException(ex);
+ }
+ catch (InterruptedException ex)
+ {
+ throw new RuntimeException(ex);
+ }
+ }
+
+ /**
+ * @since 1.0
+ */
+ protected abstract Resource getDawnFragmentModelResource(String path, String modelname, ResourceSet resourceSet);
+
+ /**
+ * @since 1.0
+ */
+ protected abstract DawnFragmentGenerator getDawnFragmentGenerator(IFile genFile, ResourceSet resourceSet);
+
+ private String getModelName(IFile genFile)
+ {
+ int lastIndexOf = genFile.getName().lastIndexOf(".");
+ return genFile.getName().substring(0, lastIndexOf);
+ }
+
+ /**
+ * @since 1.0
+ */
+ protected Resource getResource(String path, String modelname, ResourceSet resourceSet, String extension)
+ {
+ String resourcePath = path + "" + modelname + "." + extension;
+ URI uri = URI.createURI(resourcePath);
+ Resource resource = null;
+ try
+ {
+ resource = resourceSet.getResource(uri, true);
+ }
+ catch (Exception ignore)
+ {
+ // ignore
+ }
+
+ if (resource == null)
+ {
+ resource = resourceSet.createResource(uri);
+ }
+ return resource;
+ }
+
+ /**
+ * @since 1.0
+ */
+ protected ResourceSet createResourceSet()
+ {
+ ResourceSet resourceSet = new ResourceSetImpl();
+ resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap()
+ .put(dawngenmodelFileExtension, new XMIResourceFactoryImpl());
+ return resourceSet;
+ }
+
+ public void selectionChanged(IAction action, ISelection selection)
+ {
+ if (selection instanceof IStructuredSelection)
+ {
+ Object sel = ((IStructuredSelection)selection).getFirstElement();
+ if (sel instanceof IResource)
+ {
+ selectedElement = (IResource)sel;
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.codegen/src/org/eclipse/emf/cdo/dawn/codegen/creators/Creator.java b/plugins/org.eclipse.emf.cdo.dawn.codegen/src/org/eclipse/emf/cdo/dawn/codegen/creators/Creator.java
index 8f2afe6141..81a492ed1e 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.codegen/src/org/eclipse/emf/cdo/dawn/codegen/creators/Creator.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.codegen/src/org/eclipse/emf/cdo/dawn/codegen/creators/Creator.java
@@ -1,21 +1,21 @@
-/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) 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:
- * Martin Fluegge - initial API and implementation
- */
-package org.eclipse.emf.cdo.dawn.codegen.creators;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-
-/**
- * @author Martin Fluegge
- */
-public interface Creator
-{
- public void create(IProgressMonitor monitor);
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) 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:
+ * Martin Fluegge - initial API and implementation
+ */
+package org.eclipse.emf.cdo.dawn.codegen.creators;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+
+/**
+ * @author Martin Fluegge
+ */
+public interface Creator
+{
+ public void create(IProgressMonitor monitor);
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.codegen/src/org/eclipse/emf/cdo/dawn/codegen/creators/impl/AbstractFragmentCreator.java b/plugins/org.eclipse.emf.cdo.dawn.codegen/src/org/eclipse/emf/cdo/dawn/codegen/creators/impl/AbstractFragmentCreator.java
index 61237db30b..6e33de0a4e 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.codegen/src/org/eclipse/emf/cdo/dawn/codegen/creators/impl/AbstractFragmentCreator.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.codegen/src/org/eclipse/emf/cdo/dawn/codegen/creators/impl/AbstractFragmentCreator.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) 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
diff --git a/plugins/org.eclipse.emf.cdo.dawn.codegen/src/org/eclipse/emf/cdo/dawn/codegen/messages/Messages.java b/plugins/org.eclipse.emf.cdo.dawn.codegen/src/org/eclipse/emf/cdo/dawn/codegen/messages/Messages.java
index 54aa3e6fda..529f91032e 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.codegen/src/org/eclipse/emf/cdo/dawn/codegen/messages/Messages.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.codegen/src/org/eclipse/emf/cdo/dawn/codegen/messages/Messages.java
@@ -1,35 +1,35 @@
-/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) 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:
- * Martin Fluegge - initial API and implementation
- */
-package org.eclipse.emf.cdo.dawn.codegen.messages;
-
-import org.eclipse.osgi.util.NLS;
-
-/**
- * @author Martin Fluegge
- * @since 1.0
- */
-public class Messages extends NLS
-{
- private static final String BUNDLE_NAME = "org.eclipse.emf.cdo.dawn.codegen.messages"; //$NON-NLS-1$
-
- public static String GenerateClientCodeAction_0;
-
- public static String GenerateEMFFragmentAction_0;
- static
- {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages()
- {
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) 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:
+ * Martin Fluegge - initial API and implementation
+ */
+package org.eclipse.emf.cdo.dawn.codegen.messages;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * @author Martin Fluegge
+ * @since 1.0
+ */
+public class Messages extends NLS
+{
+ private static final String BUNDLE_NAME = "org.eclipse.emf.cdo.dawn.codegen.messages"; //$NON-NLS-1$
+
+ public static String GenerateClientCodeAction_0;
+
+ public static String GenerateEMFFragmentAction_0;
+ static
+ {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages()
+ {
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.codegen/src/org/eclipse/emf/cdo/dawn/codegen/messages/messages.properties b/plugins/org.eclipse.emf.cdo.dawn.codegen/src/org/eclipse/emf/cdo/dawn/codegen/messages/messages.properties
index 2b7322ab2c..8dfe1732e7 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.codegen/src/org/eclipse/emf/cdo/dawn/codegen/messages/messages.properties
+++ b/plugins/org.eclipse.emf.cdo.dawn.codegen/src/org/eclipse/emf/cdo/dawn/codegen/messages/messages.properties
@@ -1,2 +1,11 @@
-GenerateEMFFragmentAction_0=Generating Dawn EMF fragment...
-GenerateClientCodeAction_0=Generating Dawn GMF fragment...
+# Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) 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:
+# Eike Stepper - initial API and implementation
+
+GenerateEMFFragmentAction_0=Generating Dawn EMF fragment...
+GenerateClientCodeAction_0=Generating Dawn GMF fragment...
diff --git a/plugins/org.eclipse.emf.cdo.dawn.codegen/src/org/eclipse/emf/cdo/dawn/codegen/util/DawnWorkflowUtil.java b/plugins/org.eclipse.emf.cdo.dawn.codegen/src/org/eclipse/emf/cdo/dawn/codegen/util/DawnWorkflowUtil.java
index d4d08e8301..149da16831 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.codegen/src/org/eclipse/emf/cdo/dawn/codegen/util/DawnWorkflowUtil.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.codegen/src/org/eclipse/emf/cdo/dawn/codegen/util/DawnWorkflowUtil.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) 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
diff --git a/plugins/org.eclipse.emf.cdo.dawn.codegen/src/org/eclipse/emf/cdo/dawn/codegen/util/ProjectCreationHelper.java b/plugins/org.eclipse.emf.cdo.dawn.codegen/src/org/eclipse/emf/cdo/dawn/codegen/util/ProjectCreationHelper.java
index 3de9738331..d4b5cc5f96 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.codegen/src/org/eclipse/emf/cdo/dawn/codegen/util/ProjectCreationHelper.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.codegen/src/org/eclipse/emf/cdo/dawn/codegen/util/ProjectCreationHelper.java
@@ -1,424 +1,424 @@
-/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) 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:
- * Martin Fluegge - initial API and implementation
- */
-package org.eclipse.emf.cdo.dawn.codegen.util;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.IResource;
-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.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.launching.JavaRuntime;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-
-/**
- * @author Martin Fluegge
- */
-public class ProjectCreationHelper
-{
-
- private String name;
-
- private String[] natures;
-
- public String getName()
- {
- return name;
- }
-
- public IProject getProject()
- {
- return ResourcesPlugin.getWorkspace().getRoot().getProject(name);
- }
-
- public IProject createProject() throws CoreException
- {
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
-
- if (!project.exists())
- {
- project.create(null);
- }
-
- if (!project.isOpen())
- {
- project.open(null);
- }
-
- IProjectDescription description = project.getDescription();
- description.setNatureIds(natures);
- project.setDescription(description, null);
-
- return project;
- }
-
- /**
- * @param path
- * @param javaProject
- * @throws JavaModelException
- */
- public static void addJarToBuildPath(String path, IJavaProject javaProject) throws JavaModelException
- {
- IClasspathEntry newLibraryEntry = JavaCore.newLibraryEntry(new Path(path), null, null);
- ProjectCreationHelper.addToClasspath(javaProject, newLibraryEntry);
- }
-
- public static void addJarToBuildPath(IPath path, IJavaProject javaProject) throws JavaModelException
- {
- IClasspathEntry newLibraryEntry = JavaCore.newLibraryEntry(path, null, null);
- ProjectCreationHelper.addToClasspath(javaProject, newLibraryEntry);
- }
-
- public static void addVariableEntryToBuildPath(IPath path, IJavaProject javaProject) throws JavaModelException
- {
- IClasspathEntry newLibraryEntry = JavaCore.newVariableEntry(path, null, null);
- ProjectCreationHelper.addToClasspath(javaProject, newLibraryEntry);
- }
-
- /**
- * adds all jar files in this folder to the build path. Searches only on level 1
- *
- * @param folder
- * the folder which contains the jar files
- * @param javaProject
- * @throws CoreException
- */
- public static void addAllJarsToBuildPath(IFolder folder, IJavaProject javaProject) throws CoreException
- {
- try
- {
- folder.refreshLocal(100, new NullProgressMonitor());
- for (IResource resource : folder.members())
- {
-
- if (resource instanceof IFile && resource.getRawLocation().toString().endsWith(".jar"))
- {
- addJarToBuildPath(resource.getRawLocation(), javaProject);
- }
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-
- /**
- * @param javaProject
- * @param newEntry
- * @throws JavaModelException
- */
- public final static void addToClasspath(IJavaProject javaProject, IClasspathEntry newEntry) throws JavaModelException
- {
- if (newEntry == null)
- {
- return;
- }
- IClasspathEntry[] oldEntries = javaProject.getRawClasspath();
- IClasspathEntry[] newEntries = new IClasspathEntry[oldEntries.length + 1];
- System.arraycopy(oldEntries, 0, newEntries, 0, oldEntries.length);
-
- newEntries[oldEntries.length] = newEntry;
- javaProject.setRawClasspath(newEntries, null);
- }
-
- /**
- * @param javaProject
- * @param toBeRemoved
- * @throws JavaModelException
- */
- public final static void removeFromClasspath(IJavaProject javaProject, IPath toBeRemoved) throws JavaModelException
- {
- IClasspathEntry[] oldEntries = javaProject.getRawClasspath();
- ArrayList<IClasspathEntry> newEntries = new ArrayList<IClasspathEntry>();
-
- for (IClasspathEntry classpathEntry : oldEntries)
- {
- if (!classpathEntry.getPath().equals(toBeRemoved))
- {
- newEntries.add(classpathEntry);
- }
- }
-
- IClasspathEntry[] newEntriesArray = new IClasspathEntry[newEntries.size()];
- javaProject.setRawClasspath(newEntries.toArray(newEntriesArray), null);
- }
-
- /**
- * @return the newly created java project
- * @throws CoreException
- */
- public IJavaProject createJavaProject() throws CoreException
- {
- IProject project = createProject();
- return createJavaProject(project);
- }
-
- /**
- * Creates a JavaProject prom the given project
- *
- * @param project
- * @return the created JavaProject
- */
- public IJavaProject createJavaProject(IProject project)
- {
- try
- {
- // addJavaNature(project);
- IJavaProject javaProject = JavaCore.create(project);
- if (!javaProject.isOpen())
- {
- javaProject.open(null);
- }
- createBinFolder(project, javaProject);
- clearSourcePath(javaProject);
-
- IClasspathEntry sourceFolder = createSourceFolder("src", project);
-
- addToClasspath(javaProject, sourceFolder);
- addJREContainerToProject(javaProject);
- return javaProject;
- }
- catch (CoreException e)
- {
- e.printStackTrace();
- }
- return null;
-
- }
-
- /**
- * @param javaProject
- * @throws JavaModelException
- */
- private void addJREContainerToProject(IJavaProject javaProject) throws JavaModelException
- {
- addToClasspath(javaProject, JavaRuntime.getDefaultJREContainerEntry());
- }
-
- /**
- * @param javaProject
- * @throws JavaModelException
- */
- private void clearSourcePath(IJavaProject javaProject) throws JavaModelException
- {
- javaProject.setRawClasspath(new IClasspathEntry[] {}, new NullProgressMonitor()); // clean classpath, means remove
- // Project root from classpath
- }
-
- /**
- * @param project
- * @throws CoreException
- */
- public void addJavaNature(IProject project) throws CoreException
- {
- IProjectDescription description = project.getDescription();
- String[] natures = description.getNatureIds();
- String[] newNatures = new String[natures.length + 1];
- System.arraycopy(natures, 0, newNatures, 0, natures.length);
- newNatures[natures.length] = JavaCore.NATURE_ID;
- description.setNatureIds(newNatures);
- project.setDescription(description, new NullProgressMonitor());
- }
-
- /**
- * @param path
- * @param project
- * @return
- * @throws CoreException
- */
- private IClasspathEntry createSourceFolder(String path, IProject project) throws CoreException
- {
- IFolder srcFolder = project.getFolder(new Path(path));
- if (!srcFolder.exists())
- {
- srcFolder.create(false, true, null);
- IPath sourceFolderPath = srcFolder.getFullPath();
- IClasspathEntry entry = JavaCore.newSourceEntry(sourceFolderPath);
-
- return entry;
- }
- return null;
- }
-
- /**
- * @param path
- * @param project
- * @param javaProject
- * @return the created source folder
- * @throws CoreException
- */
- public IFolder createSourceFolder(String path, IProject project, IJavaProject javaProject) throws CoreException
- {
- IFolder srcFolder = project.getFolder(new Path(path));
- if (!srcFolder.exists())
- {
- srcFolder.create(false, true, null);
- IPath sourceFolderPath = srcFolder.getFullPath();
- IClasspathEntry entry = JavaCore.newSourceEntry(sourceFolderPath);
- addToClasspath(javaProject, entry);
- return srcFolder;
- }
- return null;
- }
-
- /**
- * @param project
- * @param javaProject
- * @throws CoreException
- * @throws JavaModelException
- */
- private void createBinFolder(IProject project, IJavaProject javaProject) throws CoreException, JavaModelException
- {
- createOutputFolder("bin", project, javaProject);
- }
-
- /**
- * @param project
- * @param javaProject
- * @throws CoreException
- * @throws JavaModelException
- */
- private void createOutputFolder(String path, IProject project, IJavaProject javaProject) throws CoreException,
- JavaModelException
- {
- try
- {
- IFolder binFolder = project.getFolder(new Path(path));
- if (!binFolder.exists())
- {
- binFolder.create(true, true, null);
- javaProject.setOutputLocation(binFolder.getFullPath(), null);
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-
- /**
- * @param name
- * @param project
- * @return the created folder
- */
- public IFolder createFolder(String name, IProject project)
- {
- IFolder folder = project.getFolder(name);
-
- if (!folder.exists())
- {
- try
- {
- folder.create(IResource.NONE, true, null);
- }
- catch (CoreException e)
- {
- e.printStackTrace();
- }
- }
- return folder;
- }
-
- public IFolder getFolder(String name, IProject project)
- {
- IFolder folder = project.getFolder(name);
-
- return folder;
- }
-
- /**
- * @param name
- * @param folder
- * @param content
- * @return the created file
- */
- public IFile createFile(String name, IFolder folder, String content)
- {
- IFile file = folder.getFile("web.xml");
-
- try
- {
-
- if (!file.exists())
- {
- byte[] bytes = content.getBytes();
- InputStream source = new ByteArrayInputStream(bytes);
- file.create(source, IResource.NONE, null);
-
- }
- }
- catch (CoreException e)
- {
- e.printStackTrace();
- }
- return file;
- }
-
- public void setName(String name)
- {
- this.name = name;
- }
-
- public String[] getNatures()
- {
- return natures;
- }
-
- public void setNatures(String[] natures)
- {
- this.natures = natures;
- }
-
- public ProjectCreationHelper()
- {
- }
-
- public static void refreshProject(IResource resource, IProgressMonitor monitor) throws InvocationTargetException,
- InterruptedException
- {
- IRunnableWithProgress op = new WorkspaceModifyOperation(null)
- {
- @Override
- protected void execute(IProgressMonitor monitor) throws CoreException, InterruptedException
- {
- try
- {
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- root.refreshLocal(IResource.DEPTH_INFINITE, monitor);
-
- }
- catch (CoreException e)
- {
-
- e.printStackTrace();
- }
- }
- };
- op.run(monitor);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) 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:
+ * Martin Fluegge - initial API and implementation
+ */
+package org.eclipse.emf.cdo.dawn.codegen.util;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IResource;
+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.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.ui.actions.WorkspaceModifyOperation;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+
+/**
+ * @author Martin Fluegge
+ */
+public class ProjectCreationHelper
+{
+
+ private String name;
+
+ private String[] natures;
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public IProject getProject()
+ {
+ return ResourcesPlugin.getWorkspace().getRoot().getProject(name);
+ }
+
+ public IProject createProject() throws CoreException
+ {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
+
+ if (!project.exists())
+ {
+ project.create(null);
+ }
+
+ if (!project.isOpen())
+ {
+ project.open(null);
+ }
+
+ IProjectDescription description = project.getDescription();
+ description.setNatureIds(natures);
+ project.setDescription(description, null);
+
+ return project;
+ }
+
+ /**
+ * @param path
+ * @param javaProject
+ * @throws JavaModelException
+ */
+ public static void addJarToBuildPath(String path, IJavaProject javaProject) throws JavaModelException
+ {
+ IClasspathEntry newLibraryEntry = JavaCore.newLibraryEntry(new Path(path), null, null);
+ ProjectCreationHelper.addToClasspath(javaProject, newLibraryEntry);
+ }
+
+ public static void addJarToBuildPath(IPath path, IJavaProject javaProject) throws JavaModelException
+ {
+ IClasspathEntry newLibraryEntry = JavaCore.newLibraryEntry(path, null, null);
+ ProjectCreationHelper.addToClasspath(javaProject, newLibraryEntry);
+ }
+
+ public static void addVariableEntryToBuildPath(IPath path, IJavaProject javaProject) throws JavaModelException
+ {
+ IClasspathEntry newLibraryEntry = JavaCore.newVariableEntry(path, null, null);
+ ProjectCreationHelper.addToClasspath(javaProject, newLibraryEntry);
+ }
+
+ /**
+ * adds all jar files in this folder to the build path. Searches only on level 1
+ *
+ * @param folder
+ * the folder which contains the jar files
+ * @param javaProject
+ * @throws CoreException
+ */
+ public static void addAllJarsToBuildPath(IFolder folder, IJavaProject javaProject) throws CoreException
+ {
+ try
+ {
+ folder.refreshLocal(100, new NullProgressMonitor());
+ for (IResource resource : folder.members())
+ {
+
+ if (resource instanceof IFile && resource.getRawLocation().toString().endsWith(".jar"))
+ {
+ addJarToBuildPath(resource.getRawLocation(), javaProject);
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @param javaProject
+ * @param newEntry
+ * @throws JavaModelException
+ */
+ public final static void addToClasspath(IJavaProject javaProject, IClasspathEntry newEntry) throws JavaModelException
+ {
+ if (newEntry == null)
+ {
+ return;
+ }
+ IClasspathEntry[] oldEntries = javaProject.getRawClasspath();
+ IClasspathEntry[] newEntries = new IClasspathEntry[oldEntries.length + 1];
+ System.arraycopy(oldEntries, 0, newEntries, 0, oldEntries.length);
+
+ newEntries[oldEntries.length] = newEntry;
+ javaProject.setRawClasspath(newEntries, null);
+ }
+
+ /**
+ * @param javaProject
+ * @param toBeRemoved
+ * @throws JavaModelException
+ */
+ public final static void removeFromClasspath(IJavaProject javaProject, IPath toBeRemoved) throws JavaModelException
+ {
+ IClasspathEntry[] oldEntries = javaProject.getRawClasspath();
+ ArrayList<IClasspathEntry> newEntries = new ArrayList<IClasspathEntry>();
+
+ for (IClasspathEntry classpathEntry : oldEntries)
+ {
+ if (!classpathEntry.getPath().equals(toBeRemoved))
+ {
+ newEntries.add(classpathEntry);
+ }
+ }
+
+ IClasspathEntry[] newEntriesArray = new IClasspathEntry[newEntries.size()];
+ javaProject.setRawClasspath(newEntries.toArray(newEntriesArray), null);
+ }
+
+ /**
+ * @return the newly created java project
+ * @throws CoreException
+ */
+ public IJavaProject createJavaProject() throws CoreException
+ {
+ IProject project = createProject();
+ return createJavaProject(project);
+ }
+
+ /**
+ * Creates a JavaProject prom the given project
+ *
+ * @param project
+ * @return the created JavaProject
+ */
+ public IJavaProject createJavaProject(IProject project)
+ {
+ try
+ {
+ // addJavaNature(project);
+ IJavaProject javaProject = JavaCore.create(project);
+ if (!javaProject.isOpen())
+ {
+ javaProject.open(null);
+ }
+ createBinFolder(project, javaProject);
+ clearSourcePath(javaProject);
+
+ IClasspathEntry sourceFolder = createSourceFolder("src", project);
+
+ addToClasspath(javaProject, sourceFolder);
+ addJREContainerToProject(javaProject);
+ return javaProject;
+ }
+ catch (CoreException e)
+ {
+ e.printStackTrace();
+ }
+ return null;
+
+ }
+
+ /**
+ * @param javaProject
+ * @throws JavaModelException
+ */
+ private void addJREContainerToProject(IJavaProject javaProject) throws JavaModelException
+ {
+ addToClasspath(javaProject, JavaRuntime.getDefaultJREContainerEntry());
+ }
+
+ /**
+ * @param javaProject
+ * @throws JavaModelException
+ */
+ private void clearSourcePath(IJavaProject javaProject) throws JavaModelException
+ {
+ javaProject.setRawClasspath(new IClasspathEntry[] {}, new NullProgressMonitor()); // clean classpath, means remove
+ // Project root from classpath
+ }
+
+ /**
+ * @param project
+ * @throws CoreException
+ */
+ public void addJavaNature(IProject project) throws CoreException
+ {
+ IProjectDescription description = project.getDescription();
+ String[] natures = description.getNatureIds();
+ String[] newNatures = new String[natures.length + 1];
+ System.arraycopy(natures, 0, newNatures, 0, natures.length);
+ newNatures[natures.length] = JavaCore.NATURE_ID;
+ description.setNatureIds(newNatures);
+ project.setDescription(description, new NullProgressMonitor());
+ }
+
+ /**
+ * @param path
+ * @param project
+ * @return
+ * @throws CoreException
+ */
+ private IClasspathEntry createSourceFolder(String path, IProject project) throws CoreException
+ {
+ IFolder srcFolder = project.getFolder(new Path(path));
+ if (!srcFolder.exists())
+ {
+ srcFolder.create(false, true, null);
+ IPath sourceFolderPath = srcFolder.getFullPath();
+ IClasspathEntry entry = JavaCore.newSourceEntry(sourceFolderPath);
+
+ return entry;
+ }
+ return null;
+ }
+
+ /**
+ * @param path
+ * @param project
+ * @param javaProject
+ * @return the created source folder
+ * @throws CoreException
+ */
+ public IFolder createSourceFolder(String path, IProject project, IJavaProject javaProject) throws CoreException
+ {
+ IFolder srcFolder = project.getFolder(new Path(path));
+ if (!srcFolder.exists())
+ {
+ srcFolder.create(false, true, null);
+ IPath sourceFolderPath = srcFolder.getFullPath();
+ IClasspathEntry entry = JavaCore.newSourceEntry(sourceFolderPath);
+ addToClasspath(javaProject, entry);
+ return srcFolder;
+ }
+ return null;
+ }
+
+ /**
+ * @param project
+ * @param javaProject
+ * @throws CoreException
+ * @throws JavaModelException
+ */
+ private void createBinFolder(IProject project, IJavaProject javaProject) throws CoreException, JavaModelException
+ {
+ createOutputFolder("bin", project, javaProject);
+ }
+
+ /**
+ * @param project
+ * @param javaProject
+ * @throws CoreException
+ * @throws JavaModelException
+ */
+ private void createOutputFolder(String path, IProject project, IJavaProject javaProject) throws CoreException,
+ JavaModelException
+ {
+ try
+ {
+ IFolder binFolder = project.getFolder(new Path(path));
+ if (!binFolder.exists())
+ {
+ binFolder.create(true, true, null);
+ javaProject.setOutputLocation(binFolder.getFullPath(), null);
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @param name
+ * @param project
+ * @return the created folder
+ */
+ public IFolder createFolder(String name, IProject project)
+ {
+ IFolder folder = project.getFolder(name);
+
+ if (!folder.exists())
+ {
+ try
+ {
+ folder.create(IResource.NONE, true, null);
+ }
+ catch (CoreException e)
+ {
+ e.printStackTrace();
+ }
+ }
+ return folder;
+ }
+
+ public IFolder getFolder(String name, IProject project)
+ {
+ IFolder folder = project.getFolder(name);
+
+ return folder;
+ }
+
+ /**
+ * @param name
+ * @param folder
+ * @param content
+ * @return the created file
+ */
+ public IFile createFile(String name, IFolder folder, String content)
+ {
+ IFile file = folder.getFile("web.xml");
+
+ try
+ {
+
+ if (!file.exists())
+ {
+ byte[] bytes = content.getBytes();
+ InputStream source = new ByteArrayInputStream(bytes);
+ file.create(source, IResource.NONE, null);
+
+ }
+ }
+ catch (CoreException e)
+ {
+ e.printStackTrace();
+ }
+ return file;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String[] getNatures()
+ {
+ return natures;
+ }
+
+ public void setNatures(String[] natures)
+ {
+ this.natures = natures;
+ }
+
+ public ProjectCreationHelper()
+ {
+ }
+
+ public static void refreshProject(IResource resource, IProgressMonitor monitor) throws InvocationTargetException,
+ InterruptedException
+ {
+ IRunnableWithProgress op = new WorkspaceModifyOperation(null)
+ {
+ @Override
+ protected void execute(IProgressMonitor monitor) throws CoreException, InterruptedException
+ {
+ try
+ {
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ root.refreshLocal(IResource.DEPTH_INFINITE, monitor);
+
+ }
+ catch (CoreException e)
+ {
+
+ e.printStackTrace();
+ }
+ }
+ };
+ op.run(monitor);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.codegen/src/org/eclipse/emf/cdo/dawn/codegen/util/Utils.ext b/plugins/org.eclipse.emf.cdo.dawn.codegen/src/org/eclipse/emf/cdo/dawn/codegen/util/Utils.ext
index dedcbcad36..f264141018 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.codegen/src/org/eclipse/emf/cdo/dawn/codegen/util/Utils.ext
+++ b/plugins/org.eclipse.emf.cdo.dawn.codegen/src/org/eclipse/emf/cdo/dawn/codegen/util/Utils.ext
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) 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
diff --git a/plugins/org.eclipse.emf.cdo.dawn.codegen/src/org/eclipse/emf/cdo/dawn/codegen/util/Utils.java b/plugins/org.eclipse.emf.cdo.dawn.codegen/src/org/eclipse/emf/cdo/dawn/codegen/util/Utils.java
index 1ac979f7a4..11d4d9c967 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.codegen/src/org/eclipse/emf/cdo/dawn/codegen/util/Utils.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.codegen/src/org/eclipse/emf/cdo/dawn/codegen/util/Utils.java
@@ -1,115 +1,115 @@
-/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) 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:
- * Martin Fluegge - initial API and implementation
- */
-package org.eclipse.emf.cdo.dawn.codegen.util;
-
-import org.eclipse.emf.codegen.ecore.genmodel.GenPackage;
-
-import org.eclipse.swt.widgets.Canvas;
-
-import java.util.List;
-
-/**
- * @author Martin Fluegge
- */
-public class Utils
-{
- public static String packagePath = "";
-
- public static String packageName = "";
-
- public static String diagramPluginID = "";
-
- public static String diagramPackage = "";
-
- public static String timestamp()
- {
- return String.valueOf(System.currentTimeMillis());
- }
-
- public static String getPackagePath()
- {
- return packagePath;
- }
-
- public static String getPackageName()
- {
- return packageName;
- }
-
- public static String getDiagramPluginID()
- {
- return diagramPluginID;
- }
-
- public static String setGlobals(Canvas e)
- {
- // packageName=e.getName();
- // packagePath=e.getName().replace(".", "/");
- return "";
- }
-
- public static String setPackage(String pName)
- {
- diagramPluginID = pName + ".diagram";
- packageName = pName.replace("class", "clazz");
- packagePath = pName.replace(".", "/");
- return "";
- }
-
- public static String setDiagramPackage(String pName)
- {
- diagramPackage = pName;
- return "";
- }
-
- public static String getDiagramPackage()
- {
- return diagramPackage;
- }
-
- public static String getRootPackage()
- {
- String ret = diagramPackage.replace(".diagram", "");
- return ret;
- }
-
- public static String getDiagramPackagePath()
- {
- return diagramPackage.replace(".", "/");
- }
-
- public static String getUniqueIdentifierName(String uniqueIdentifier)
- {
- String ret = uniqueIdentifier.substring(uniqueIdentifier.lastIndexOf(".") + 1, uniqueIdentifier.length());
- return ret;
- }
-
- public static String toModelName(String uniqueIdentifier)
- {
- String ret = uniqueIdentifier.substring(uniqueIdentifier.lastIndexOf(".") + 1, uniqueIdentifier.length());
- ret = ret.substring(0, ret.lastIndexOf("_"));
- return ret;
- }
-
- public static String toModelNameFromGetterName(String uniqueIdentifier)
- {
- String ret = uniqueIdentifier.replace("getFigure", "");
- return ret;
- }
-
- /**
- * @since 1.0
- */
- public static String getEMFFileName(List<GenPackage> genPackages)
- {
- return genPackages.get(0).getFileExtension();
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) 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:
+ * Martin Fluegge - initial API and implementation
+ */
+package org.eclipse.emf.cdo.dawn.codegen.util;
+
+import org.eclipse.emf.codegen.ecore.genmodel.GenPackage;
+
+import org.eclipse.swt.widgets.Canvas;
+
+import java.util.List;
+
+/**
+ * @author Martin Fluegge
+ */
+public class Utils
+{
+ public static String packagePath = "";
+
+ public static String packageName = "";
+
+ public static String diagramPluginID = "";
+
+ public static String diagramPackage = "";
+
+ public static String timestamp()
+ {
+ return String.valueOf(System.currentTimeMillis());
+ }
+
+ public static String getPackagePath()
+ {
+ return packagePath;
+ }
+
+ public static String getPackageName()
+ {
+ return packageName;
+ }
+
+ public static String getDiagramPluginID()
+ {
+ return diagramPluginID;
+ }
+
+ public static String setGlobals(Canvas e)
+ {
+ // packageName=e.getName();
+ // packagePath=e.getName().replace(".", "/");
+ return "";
+ }
+
+ public static String setPackage(String pName)
+ {
+ diagramPluginID = pName + ".diagram";
+ packageName = pName.replace("class", "clazz");
+ packagePath = pName.replace(".", "/");
+ return "";
+ }
+
+ public static String setDiagramPackage(String pName)
+ {
+ diagramPackage = pName;
+ return "";
+ }
+
+ public static String getDiagramPackage()
+ {
+ return diagramPackage;
+ }
+
+ public static String getRootPackage()
+ {
+ String ret = diagramPackage.replace(".diagram", "");
+ return ret;
+ }
+
+ public static String getDiagramPackagePath()
+ {
+ return diagramPackage.replace(".", "/");
+ }
+
+ public static String getUniqueIdentifierName(String uniqueIdentifier)
+ {
+ String ret = uniqueIdentifier.substring(uniqueIdentifier.lastIndexOf(".") + 1, uniqueIdentifier.length());
+ return ret;
+ }
+
+ public static String toModelName(String uniqueIdentifier)
+ {
+ String ret = uniqueIdentifier.substring(uniqueIdentifier.lastIndexOf(".") + 1, uniqueIdentifier.length());
+ ret = ret.substring(0, ret.lastIndexOf("_"));
+ return ret;
+ }
+
+ public static String toModelNameFromGetterName(String uniqueIdentifier)
+ {
+ String ret = uniqueIdentifier.replace("getFigure", "");
+ return ret;
+ }
+
+ /**
+ * @since 1.0
+ */
+ public static String getEMFFileName(List<GenPackage> genPackages)
+ {
+ return genPackages.get(0).getFileExtension();
+ }
+}

Back to the top