浏览代码

removed generate code action -> we use a builder for that

Andreas Mülder 14 年之前
父节点
当前提交
92c473b92a

+ 0 - 7
plugins/org.yakindu.sct.generator.ui/.classpath

@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
-	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
-	<classpathentry kind="src" path="src"/>
-	<classpathentry kind="output" path="bin"/>
-</classpath>

+ 0 - 28
plugins/org.yakindu.sct.generator.ui/.project

@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-	<name>org.yakindu.sct.generator.ui</name>
-	<comment></comment>
-	<projects>
-	</projects>
-	<buildSpec>
-		<buildCommand>
-			<name>org.eclipse.jdt.core.javabuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-		<buildCommand>
-			<name>org.eclipse.pde.ManifestBuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-		<buildCommand>
-			<name>org.eclipse.pde.SchemaBuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-	</buildSpec>
-	<natures>
-		<nature>org.eclipse.pde.PluginNature</nature>
-		<nature>org.eclipse.jdt.core.javanature</nature>
-	</natures>
-</projectDescription>

+ 0 - 8
plugins/org.yakindu.sct.generator.ui/.settings/org.eclipse.jdt.core.prefs

@@ -1,8 +0,0 @@
-#Fri Sep 09 10:24:44 CEST 2011
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5

+ 0 - 16
plugins/org.yakindu.sct.generator.ui/META-INF/MANIFEST.MF

@@ -1,16 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Yakindu SCT Generator UI
-Bundle-SymbolicName: org.yakindu.sct.generator.ui;singleton:=true
-Bundle-Version: 1.0.0.qualifier
-Bundle-Activator: org.yakindu.sct.generator.ui.GeneratorUIActivator
-Bundle-Vendor: YAKINDU
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.eclipse.core.resources,
- org.eclipse.emf,
- org.eclipse.emf.common,
- org.yakindu.sct.generator.base
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Bundle-ActivationPolicy: lazy
-Export-Package: org.yakindu.sct.generator.ui.actions

+ 0 - 7
plugins/org.yakindu.sct.generator.ui/build.properties

@@ -1,7 +0,0 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
-               .,\
-               plugin.xml,\
-               icons/
-src.includes = icons/

二进制
plugins/org.yakindu.sct.generator.ui/icons/c_app.gif


+ 0 - 19
plugins/org.yakindu.sct.generator.ui/plugin.xml

@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
-<extension point = "org.eclipse.ui.popupMenus">
-     <objectContribution
-        id="org.yakindu.sct.generator.ui"
-        objectClass="org.eclipse.core.resources.IFile"
-	    nameFilter="*.sct">
-	    <action
-           class="org.yakindu.sct.generator.ui.actions.GenerateCppActionDelegate"
-           enablesFor="1"
-           icon="icons/c_app.gif"
-           id="org.yakindu.sct.generator.ui.generateaction"
-           label="Generate C++ code"
-           menubarPath="additions">
-	    </action>
-	 </objectContribution>
-	</extension>
-</plugin>

+ 0 - 50
plugins/org.yakindu.sct.generator.ui/src/org/yakindu/sct/generator/ui/GeneratorUIActivator.java

@@ -1,50 +0,0 @@
-package org.yakindu.sct.generator.ui;
-
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class GeneratorUIActivator extends AbstractUIPlugin {
-
-	// The plug-in ID
-	public static final String PLUGIN_ID = "org.yakindu.sct.generator.ui"; //$NON-NLS-1$
-
-	// The shared instance
-	private static GeneratorUIActivator plugin;
-	
-	/**
-	 * The constructor
-	 */
-	public GeneratorUIActivator() {
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
-	 */
-	public void start(BundleContext context) throws Exception {
-		super.start(context);
-		plugin = this;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
-	 */
-	public void stop(BundleContext context) throws Exception {
-		plugin = null;
-		super.stop(context);
-	}
-
-	/**
-	 * Returns the shared instance
-	 *
-	 * @return the shared instance
-	 */
-	public static GeneratorUIActivator getDefault() {
-		return plugin;
-	}
-
-}

+ 0 - 90
plugins/org.yakindu.sct.generator.ui/src/org/yakindu/sct/generator/ui/actions/GenerateCppActionDelegate.java

@@ -1,90 +0,0 @@
-package org.yakindu.sct.generator.ui.actions;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IWorkbenchPart;
-import org.yakindu.sct.generator.base.util.GeneratorBaseUtil;
-import org.yakindu.sct.model.sexec.ExecutionFlow;
-import org.yakindu.sct.model.sgraph.Statechart;
-
-/**
- * 
- * @author andreas muelder - Initial contribution and API
- * 
- */
-public class GenerateCppActionDelegate implements IObjectActionDelegate {
-
-	private ISelection selection;
-
-	private IWorkbenchPart part;
-
-	// TODO: Introduce valdiation plugin
-	public static final String SGRAPH_ERROR_TYPE = "org.yakindu.sct.ui.editor.diagnostic";
-	public static final String STEXT_ERROR_TYPE = "org.yakindu.sct.ui.editor.xtext.diagnostic";
-
-	public void run(IAction action) {
-		try {
-			IFile selectedFile = unwrap();
-			if (selectedFile != null && isValid(selectedFile)) {
-				URI uri = URI.createPlatformResourceURI(selectedFile
-
-				.getFullPath().toString(), true);
-				String templatePath = "org::yakindu::sct::generator::cpp::templates::Main::main";
-				Statechart statechart = GeneratorBaseUtil.loadStatechart(uri);
-				ExecutionFlow executionFlow = GeneratorBaseUtil
-						.createExecutionFlowModel(statechart);
-				GeneratorBaseUtil.generate(executionFlow, templatePath,
-						selectedFile.getProject(), "src-gen");
-			}
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-	}
-
-	private boolean isValid(IFile file) {
-		try {
-			IMarker[] sgraphMarkers = file.findMarkers(SGRAPH_ERROR_TYPE, true,
-					IResource.DEPTH_INFINITE);
-			IMarker[] stextMarkers = file.findMarkers(STEXT_ERROR_TYPE, true,
-					IResource.DEPTH_INFINITE);
-			if (sgraphMarkers.length > 0 || stextMarkers.length > 0) {
-				MessageDialog
-						.openError(
-								part.getSite().getShell(),
-								"Error during code generation",
-								"The code generator could not be started because the selected resource contains errors");
-			}
-			return true;
-		} catch (Exception ex) {
-			ex.printStackTrace();
-		}
-		return false;
-	}
-
-	private IFile unwrap() {
-		if (selection instanceof StructuredSelection) {
-			Object firstElement = ((StructuredSelection) selection)
-					.getFirstElement();
-			if (firstElement instanceof IFile) {
-				return (IFile) firstElement;
-			}
-		}
-		return null;
-	}
-
-	public void selectionChanged(IAction action, ISelection selection) {
-		this.selection = selection;
-	}
-
-	public void setActivePart(IAction action, IWorkbenchPart targetPart) {
-		this.part = targetPart;
-	}
-
-}