classes for generation wizard java added
diff --git a/org.eclipse.emf.refactor.metrics.generator/META-INF/MANIFEST.MF b/org.eclipse.emf.refactor.metrics.generator/META-INF/MANIFEST.MF
index 57f68ec..65a8b10 100644
--- a/org.eclipse.emf.refactor.metrics.generator/META-INF/MANIFEST.MF
+++ b/org.eclipse.emf.refactor.metrics.generator/META-INF/MANIFEST.MF
@@ -7,6 +7,7 @@
 Require-Bundle: org.eclipse.ui,
  org.eclipse.core.runtime,
  org.eclipse.core.resources;bundle-version="3.8.0",
+ org.eclipse.emf.ecore;bundle-version="2.8.0",
  org.eclipse.emf.refactor.metrics;bundle-version="0.7.0"
 Bundle-ActivationPolicy: lazy
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
diff --git a/org.eclipse.emf.refactor.metrics.generator/plugin.xml b/org.eclipse.emf.refactor.metrics.generator/plugin.xml
index 6ae9d8f..87fd550 100644
--- a/org.eclipse.emf.refactor.metrics.generator/plugin.xml
+++ b/org.eclipse.emf.refactor.metrics.generator/plugin.xml
@@ -5,10 +5,10 @@
          point="org.eclipse.ui.newWizards">
       <wizard
             category="org.eclipse.emf.refactor.newwizards.category"
-            class="org.eclipse.emf.refactor.metrics.generator.NewMetricWizard"
+            class="org.eclipse.emf.refactor.metrics.generator.NewMetricWizardJava"
             icon="icons/newmetric.PNG"
             id="org.eclipse.emf.refactor.metrics.newwizard"
-            name="Metric">
+            name="Metric (specified in Java)">
       </wizard>
    </extension>
 </plugin>
diff --git a/org.eclipse.emf.refactor.metrics.generator/src/org/eclipse/emf/refactor/metrics/generator/Activator.java b/org.eclipse.emf.refactor.metrics.generator/src/org/eclipse/emf/refactor/metrics/generator/Activator.java
index 43198b6..b11cc96 100644
--- a/org.eclipse.emf.refactor.metrics.generator/src/org/eclipse/emf/refactor/metrics/generator/Activator.java
+++ b/org.eclipse.emf.refactor.metrics.generator/src/org/eclipse/emf/refactor/metrics/generator/Activator.java
@@ -27,6 +27,7 @@
 	public void start(BundleContext context) throws Exception {
 		super.start(context);
 		plugin = this;
+		GenerationManager.getInstance();
 	}
 
 	/*
diff --git a/org.eclipse.emf.refactor.metrics.generator/src/org/eclipse/emf/refactor/metrics/generator/GenerationManager.java b/org.eclipse.emf.refactor.metrics.generator/src/org/eclipse/emf/refactor/metrics/generator/GenerationManager.java
new file mode 100644
index 0000000..4286c7e
--- /dev/null
+++ b/org.eclipse.emf.refactor.metrics.generator/src/org/eclipse/emf/refactor/metrics/generator/GenerationManager.java
@@ -0,0 +1,26 @@
+package org.eclipse.emf.refactor.metrics.generator;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+public class GenerationManager {
+	
+	private static GenerationManager instance;
+	
+	private GenerationManager() {
+		System.out.println("GenerationManager initialized!");
+	}
+	
+	public static GenerationManager getInstance() {
+		if (instance == null) {
+			instance = new GenerationManager();
+		}
+		return instance;
+	}
+
+	public static void createNewMetric(IProgressMonitor monitor,
+			MetricInfo metricInfo, IProject targetProject) {
+		System.out.println("Here we go...");
+	}
+
+}
diff --git a/org.eclipse.emf.refactor.metrics.generator/src/org/eclipse/emf/refactor/metrics/generator/MetricBasicDataWizardPage.java b/org.eclipse.emf.refactor.metrics.generator/src/org/eclipse/emf/refactor/metrics/generator/MetricBasicDataWizardPage.java
new file mode 100644
index 0000000..2e74de2
--- /dev/null
+++ b/org.eclipse.emf.refactor.metrics.generator/src/org/eclipse/emf/refactor/metrics/generator/MetricBasicDataWizardPage.java
@@ -0,0 +1,248 @@
+package org.eclipse.emf.refactor.metrics.generator;
+
+import java.util.Arrays;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.emf.ecore.ENamedElement;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Text;
+
+public class MetricBasicDataWizardPage extends WizardPage implements Listener{
+
+	private static final String PAGE_NAME = "org.eclipse.emf.refactor.metrics.MetricBasicDataWizardPage";
+	private static final String PAGE_TITLE = "Basic Metric Data";
+	private static final String PAGE_DESCRIPTION = "Please specify basic metric data. \n"
+												+ "(required fields are denoted by \"*\")";
+	private Text nameTextField, idTextField, descriptionTextField;
+	private Combo projectCombo, metamodelCombo, contextCombo;
+	private boolean initialization = false;
+	private String jar = "";
+	
+	@Override
+	public void createControl(Composite parent) {
+		Composite container = new Composite(parent, SWT.NULL);
+		final GridLayout layout = new GridLayout();
+		layout.numColumns = 1;
+		container.setLayout(layout);
+		createTextFields(container);
+		initContents();
+		setControl(container);
+		this.setPageComplete(false);
+	}	
+
+	@Override
+	public boolean canFlipToNextPage() {
+		if(! initialization) {
+			return false;
+		}
+		return this.isPageComplete();
+	}
+	
+	@Override
+	public void handleEvent(Event event) {
+		if (event.widget == projectCombo) {
+			((NewMetricWizardJava)getWizard()).setTargetProject(projectCombo.getText());
+		}
+		if (event.widget == metamodelCombo) {
+			String nsURI = metamodelCombo.getText();
+			if (nsURI != null && ! nsURI.isEmpty()) {
+				EPackage ePackage = EPackage.Registry.INSTANCE.getEPackage(nsURI);
+				if (ePackage != null) {
+					jar = ePackage.getClass().getPackage().getName();
+					contextCombo.removeAll();
+					Object[] eObjectNames = new Object[ePackage.eContents().size()];
+					for (int i = 0; i < eObjectNames.length; i++) {
+						EObject eObject = ePackage.eContents().get(i);
+						if (eObject instanceof ENamedElement) {
+							eObjectNames[i] = ((ENamedElement) ePackage.eContents().get(i)).getName();
+						}
+					}					
+			        Arrays.sort(eObjectNames);
+					for(Object object : eObjectNames){
+						contextCombo.add((String)object);
+					}
+				}
+			} else {
+				jar = "";
+				contextCombo.removeAll();
+			}
+		}
+		if(!initialization){
+			updatePageComplete();
+			getWizard().getContainer().updateButtons();		
+		}
+	}
+	
+	public WizardPage getNextPage() {
+		return null;
+	}
+
+	public MetricBasicDataWizardPage() {
+		super(PAGE_NAME);
+		setTitle(PAGE_TITLE);
+		setDescription(PAGE_DESCRIPTION);
+	}
+	
+	private void createTextFields(Composite container) {
+		Label label;
+		GridData gridData;
+		Group group;
+		GridLayout layout;
+		// - Project -
+		group = new Group(container, SWT.NONE);
+		group.setText("Project Data");
+	    layout = new GridLayout();
+	    layout.numColumns = 2;
+	    group.setLayout(layout);
+	    gridData = new GridData(GridData.FILL_HORIZONTAL);
+	    group.setLayoutData(gridData);
+		// col:1
+		label = new Label(group, SWT.NONE);
+		label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
+		label.setText("Target project *:");
+		// col:2
+		projectCombo = new Combo(group, SWT.READ_ONLY);
+		final GridData projectComboData = new GridData(GridData.FILL_HORIZONTAL);
+		projectCombo.setLayoutData(projectComboData);
+		//projectCombo.setText("Select Project");
+		projectCombo.addListener(SWT.Selection, this);
+		// - Metric Data -
+		group = new Group(container, SWT.NONE);
+		group.setText("Metric Data");
+	    layout = new GridLayout();
+	    layout.numColumns = 2;
+	    group.setLayout(layout);
+	    gridData = new GridData(GridData.FILL_HORIZONTAL);
+	    group.setLayoutData(gridData);
+		// - Name -
+		// col:1
+		label = new Label(group, SWT.NONE);
+		label.setText("Name *:");
+		label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
+		// col:2
+		nameTextField = new Text(group, SWT.BORDER);
+		nameTextField.addListener(SWT.Modify, this);
+		nameTextField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+		// - Id -
+		// col:1
+		label = new Label(group, SWT.NONE);
+		label.setText("ID *:");
+		label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
+		// col:2
+		idTextField = new Text(group, SWT.BORDER);
+		idTextField.addListener(SWT.Modify, this);
+		idTextField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+		// - Description -
+		// col:1
+		label = new Label(group, SWT.NONE);
+		label.setText("Description:");
+		label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
+		// col:2
+		descriptionTextField = new Text(group, SWT.BORDER);
+		descriptionTextField.addListener(SWT.Modify, this);
+		descriptionTextField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+		// - Source -
+		group = new Group(container, SWT.NONE);
+		group.setText("Meta Model and Context Data");
+	    layout = new GridLayout();
+	    layout.numColumns = 2;
+	    group.setLayout(layout);
+	    gridData = new GridData(GridData.FILL_HORIZONTAL);
+	    group.setLayoutData(gridData);
+	    // - Metamodel -
+	 	// col:1
+	 	label = new Label(group, SWT.NONE);
+	 	label.setText("Metamodel *:");
+	 	label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
+	 	// col:2
+	 	metamodelCombo = new Combo(group, SWT.BORDER);
+	 	metamodelCombo.addListener(SWT.Selection, this);
+	    // - Context -
+	 	// col:1
+	 	label = new Label(group, SWT.NONE);
+	 	label.setText("Context *:");
+	 	label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
+	 	// col:2
+	 	contextCombo = new Combo(group, SWT.BORDER);
+	 	contextCombo.addListener(SWT.Selection, this);
+	}
+	
+	private void initContents() {
+		initialization = true;
+		initProjectsAndMetamodels();
+		initialization = false;
+	}
+	
+	private void initProjectsAndMetamodels(){
+		for (IProject project : ((NewMetricWizardJava)getWizard()).getProjects()) {
+			projectCombo.add(project.getName());
+		}
+		Object [] metamodelObjects = 
+				EPackage.Registry.INSTANCE.keySet().toArray(new Object[EPackage.Registry.INSTANCE.size()]);
+        Arrays.sort(metamodelObjects);
+		for(Object object : metamodelObjects){
+			metamodelCombo.add(object.toString());
+		}
+	}
+
+	/**
+	 * Wird jedes mal ausgeführ wenn sich der Inhalt eines Textfeldes im Wizard
+	 * verändert. Überprüft die inhalte der Textfelder und erzeugt
+	 * entschprechende Meldungen im Wizardfenster.
+	 */
+	private void updatePageComplete() {
+		if(nameTextField.getText().isEmpty()){
+			this.setMessage("Metric name is not specified.", ERROR);
+			this.setPageComplete(false);
+		}else
+		if(idTextField.getText().isEmpty()){
+			this.setMessage("Metric ID is not specified.", ERROR);
+			this.setPageComplete(false);
+		}else
+		if(metamodelCombo.getText().isEmpty()){
+			this.setMessage("Metric metamodel is not specified.", ERROR);
+			this.setPageComplete(false);
+		}else
+		if( contextCombo.getText().isEmpty()){
+			this.setMessage("Metric context is not specified.", ERROR);
+			this.setPageComplete(false);
+		}else
+		if(!checkProject()){
+			this.setMessage("Target project for the Metric is not specified.", ERROR);
+			this.setPageComplete(false);
+		}else{
+			this.setMessage("");
+			this.setPageComplete(true);
+			saveTextFieldValues();
+		}
+	}
+	
+	private boolean checkProject(){
+		if(!projectCombo.getText().isEmpty())
+			return true;
+		return false;
+	}
+	
+	private void saveTextFieldValues(){
+		((NewMetricWizardJava)getWizard()).setName(this.nameTextField.getText());
+		((NewMetricWizardJava)getWizard()).setId(this.idTextField.getText());
+		((NewMetricWizardJava)getWizard()).setDescription(this.descriptionTextField.getText());
+		((NewMetricWizardJava)getWizard()).setMetamodel(this.metamodelCombo.getText());
+		((NewMetricWizardJava)getWizard()).setContext(this.contextCombo.getText());
+		((NewMetricWizardJava)getWizard()).setJar(jar);
+	}
+
+}
+	
+
diff --git a/org.eclipse.emf.refactor.metrics.generator/src/org/eclipse/emf/refactor/metrics/generator/MetricInfo.java b/org.eclipse.emf.refactor.metrics.generator/src/org/eclipse/emf/refactor/metrics/generator/MetricInfo.java
index 3df5b1d..b180b10 100644
--- a/org.eclipse.emf.refactor.metrics.generator/src/org/eclipse/emf/refactor/metrics/generator/MetricInfo.java
+++ b/org.eclipse.emf.refactor.metrics.generator/src/org/eclipse/emf/refactor/metrics/generator/MetricInfo.java
@@ -137,4 +137,12 @@
 		this.jar = jar;
 	}
 
+	@Override
+	public String toString() {
+		return "MetricInfo [name=" + name + ", description=" + description
+				+ ", project=" + project + ", context=" + context
+				+ ", metamodel=" + metamodel + ", id=" + id + ", jar=" + jar
+				+ "]";
+	}
+
 }
diff --git a/org.eclipse.emf.refactor.metrics.generator/src/org/eclipse/emf/refactor/metrics/generator/NewMetricWizard.java b/org.eclipse.emf.refactor.metrics.generator/src/org/eclipse/emf/refactor/metrics/generator/NewMetricWizard.java
deleted file mode 100644
index db4b22e..0000000
--- a/org.eclipse.emf.refactor.metrics.generator/src/org/eclipse/emf/refactor/metrics/generator/NewMetricWizard.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.eclipse.emf.refactor.metrics.generator;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.ui.INewWizard;
-import org.eclipse.ui.IWorkbench;
-
-public class NewMetricWizard extends Wizard implements INewWizard {
-
-	public NewMetricWizard() {
-		// TODO Auto-generated constructor stub
-	}
-
-	@Override
-	public void init(IWorkbench workbench, IStructuredSelection selection) {
-		// TODO Auto-generated method stub
-
-	}
-
-	@Override
-	public boolean performFinish() {
-		// TODO Auto-generated method stub
-		return false;
-	}
-
-}
diff --git a/org.eclipse.emf.refactor.metrics.generator/src/org/eclipse/emf/refactor/metrics/generator/NewMetricWizardJava.java b/org.eclipse.emf.refactor.metrics.generator/src/org/eclipse/emf/refactor/metrics/generator/NewMetricWizardJava.java
new file mode 100644
index 0000000..05aca3f
--- /dev/null
+++ b/org.eclipse.emf.refactor.metrics.generator/src/org/eclipse/emf/refactor/metrics/generator/NewMetricWizardJava.java
@@ -0,0 +1,145 @@
+package org.eclipse.emf.refactor.metrics.generator;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.LinkedList;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectNature;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+
+public class NewMetricWizardJava extends Wizard implements INewWizard {
+	
+	protected static final String TRANSFORMATIONS_DIR = "/transformations/";
+	private final String WINDOW_TITLE = "New Metric";
+	private MetricBasicDataWizardPage basicDataPage;
+	private String name, id, description, metamodel, context, jar;
+	private LinkedList<IProject> projects;
+	private IProject targetProject;
+
+	public NewMetricWizardJava() { }
+
+	@Override
+	public void init(IWorkbench workbench, IStructuredSelection selection) {
+		initProjects();
+	}
+	
+	@Override
+	public void addPages() {
+		setWindowTitle(WINDOW_TITLE);
+		basicDataPage = new MetricBasicDataWizardPage();
+		addPage(basicDataPage);
+	}
+	
+	@Override
+	public boolean canFinish() {
+		return basicDataPage.isPageComplete();
+	}
+
+	@Override
+	public boolean performFinish() {
+		try{
+			getContainer().run(true, true, new IRunnableWithProgress(){
+				public void run(IProgressMonitor monitor)throws InvocationTargetException, InterruptedException{
+					GenerationManager.getInstance();
+					GenerationManager.createNewMetric(monitor, getMetricInfo(), targetProject);
+				}
+			});
+		}
+		catch(InvocationTargetException e){
+			e.printStackTrace();
+			return false;
+		}
+		catch(InterruptedException e){
+			e.printStackTrace();
+			return false;
+		}
+		return true;
+	}
+	
+	private void initProjects(){
+		this.projects = new LinkedList<IProject>();
+		IProject[] allProjects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
+		for (IProject project : allProjects) {
+			if (project.isOpen()) {
+				IProjectNature nature = null;
+				try {
+					nature = project.getNature("org.eclipse.pde.PluginNature");
+				} catch (CoreException e) {
+					e.printStackTrace();
+				}
+				if (null != nature) 
+					this.projects.add(project);
+			}
+		}
+	}
+	
+	private MetricInfo getMetricInfo(){
+		String proj = this.targetProject.getLocation().toString();
+		MetricInfo info = new MetricInfo(this.name, this.id, this.description, 
+							this.metamodel, this.context, proj, getJar());
+		return info;
+	}
+	
+	
+	private String getJar() {
+		return jar;
+	}
+	
+	public MetricBasicDataWizardPage getDataPage() {
+		return basicDataPage;
+	}
+	
+	public LinkedList<IProject> getProjects() {
+		return projects;
+	}
+	
+	public IProject getTargetProject() {
+		return targetProject;
+	}
+	
+	public String getMetamodel() {
+		return metamodel;
+	}
+
+	public String getContext() {
+		return context;
+	}
+	
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public void setId(String id) {
+		this.id = id;
+	}
+
+	public void setDescription(String description) {
+		this.description = description;
+	}
+
+	public void setMetamodel(String metamodel) {
+		this.metamodel = metamodel;
+	}
+
+	public void setContext(String context) {
+		this.context = context;
+	}
+
+	public void setTargetProject(String projectName){
+		for (IProject project : projects)
+			if (project.getName().equals(projectName))
+				this.targetProject = project;
+	}
+
+	public void setJar(String jar) {
+		this.jar = jar;
+	}
+
+}