Skip to content

Commit

Permalink
Plug in now works.
Browse files Browse the repository at this point in the history
  • Loading branch information
robertsearle committed Jun 26, 2008
1 parent d2e16b2 commit 88d8694
Show file tree
Hide file tree
Showing 12 changed files with 71 additions and 86 deletions.
1 change: 1 addition & 0 deletions JacobGeneratorEngine/.classpath
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry exported="true" kind="lib" path="lib/jacobgen.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jacob.jar"/>
<classpathentry exported="true" kind="lib" path="lib/log4j-1.2.15.jar"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
Expand Down
1 change: 1 addition & 0 deletions JacobGeneratorEngine/.cvsignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
JacobGen-*.zip
15 changes: 12 additions & 3 deletions JacobGeneratorEngine/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: PLUG Plug-in
Bundle-SymbolicName: PLUG; singleton:=true
Bundle-Version: 1.0.0
Bundle-Name: Jacob Generator Plug-in
Bundle-SymbolicName: JacobGenerator;singleton:=true
Bundle-Version: 1.0.01
Bundle-Activator: plug.Activator
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
Expand All @@ -15,5 +15,14 @@ Require-Bundle: org.eclipse.ui,
Eclipse-LazyStart: true
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ClassPath: lib/jacob.jar,
lib/jacobgen.jar,
lib/log4j-1.2.15.jar,
.
Export-Package: com.jacob.activeX;uses:="com.jacob.com",
com.jacob.com;uses:="com.jacob.test",
com.jacob.jacobgen,
net.sourceforge.jacob.generator,
net.sourceforge.jacob.generator.adapters;uses:="org.eclipse.emf.ecore",
net.sourceforge.jacob.generator.adapters.classInfo;uses:="net.sourceforge.jacob.generator.adapters,org.eclipse.emf.ecore",
plug;uses:="org.eclipse.jface.resource,org.eclipse.ui.plugin,org.osgi.framework",
plug.popup.actions;uses:="org.eclipse.jface.action,org.eclipse.ui,org.eclipse.jface.viewers"
8 changes: 5 additions & 3 deletions JacobGeneratorEngine/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ output.. = bin/
bin.includes = plugin.xml,\
META-INF/,\
.,\
bin/,\
lib/jacob.jar,\
lib/junit-4.4.jar,\
lib/log4j-1.2.15.jar
lib/log4j-1.2.15.jar,\
lib/jacobgen.jar,\
templates/,\
plugin.properties,\
build.properties
17 changes: 17 additions & 0 deletions JacobGeneratorEngine/build2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project default="plugin_export" name="build">
<target name="plugin_export">
<delete includeemptydirs="true" dir="dist"/>
<pde.exportPlugins destination="dist" exportSource="false" exportType="directory" plugins="JacobGenerator" useJARFormat="true"/>
<copy overwrite="true" todir="dist">
<fileset dir="lib" includes="*.dll" />
</copy>
</target>

<target name="zip" description="export is asynchronise">
<echo> ${Bundle-Version} </echo>
<zip destfile="JacobGen-1.0.01.zip" basedir="dist" compress="true" />
<delete includeemptydirs="true" dir="dist"/>
</target>

</project>
6 changes: 3 additions & 3 deletions JacobGeneratorEngine/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<extension
point="org.eclipse.ui.popupMenus">
<objectContribution
id="PLUG.contribution1"
id="PLUG.dll"
nameFilter="*.dll"
objectClass="org.eclipse.core.resources.IFile">

Expand All @@ -26,7 +26,7 @@
</action>
</objectContribution>
<objectContribution
id="PLUG.contribution1"
id="PLUG.exe"
nameFilter="*.exe"
objectClass="org.eclipse.core.resources.IFile">

Expand All @@ -47,7 +47,7 @@
</action>
</objectContribution>
<objectContribution
id="PLUG.contribution1"
id="PLUG.tlb"
nameFilter="*.tlb"
objectClass="org.eclipse.core.resources.IFile">

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ License, or (at your option) any later version.
* @author Robert Searle
*/
public class TestGenerator {
public static final String MODEL = "model";

public static final String MODEL_COMPANY = MODEL + java.io.File.separatorChar + "company";

final static private Logger log = Logger.getLogger(TestGenerator.class);

public static void main(final String[] args) {
Expand All @@ -53,7 +57,7 @@ public static void main(final String[] args) {
if (g.typelibFilename == null) {
System.out.println("Jacobgen you need to specify an input file");
} else {
final TLBtoECOREtoCODE gener = new TLBtoECOREtoCODE(g.destinationPackage, g.typelibFilename, "model/company");
final TLBtoECOREtoCODE gener = new TLBtoECOREtoCODE(g.destinationPackage, g.typelibFilename, MODEL_COMPANY);
try {
gener.generate();
} catch (final FileNotFoundException e) {
Expand Down
2 changes: 1 addition & 1 deletion JacobGeneratorEngine/src/plug/Activator.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
public class Activator extends AbstractUIPlugin {

// The plug-in ID
public static final String PLUGIN_ID = "PLUG";
public static final String PLUGIN_ID = "JacobGenerator";

// The shared instance
private static Activator plugin;
Expand Down
38 changes: 26 additions & 12 deletions JacobGeneratorEngine/src/plug/popup/actions/NewAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,31 @@
import java.net.URI;

import net.sourceforge.jacob.generator.TLBtoECOREtoCODE;
import net.sourceforge.jacob.generator.TestGenerator;

import org.eclipse.core.internal.resources.File;
import org.eclipse.core.internal.resources.Workspace;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IMenuCreator;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TreeSelection;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbenchPart;

import sun.rmi.runtime.Log;

public class NewAction implements IObjectActionDelegate {

private URI rawLocationURI;
private File selectedFile;

/**
* Constructor for Action1.
Expand All @@ -36,14 +47,15 @@ public void setActivePart(IAction action, IWorkbenchPart targetPart) {
/**
* @see IActionDelegate#run(IAction)
*/
@SuppressWarnings("restriction")
public void run(IAction action) {
// Shell shell = new Shell();
// IMenuCreator menuCreator = action.getMenuCreator();
try {
java.io.File file = new java.io.File (rawLocationURI);
String output = file.getParent() + file.separatorChar + "model/company";
final TLBtoECOREtoCODE gener = new TLBtoECOREtoCODE("com.sourceforge.jacobGenerated", file.getAbsolutePath(), output);
final String output = selectedFile.getLocation().toFile().getAbsoluteFile().getParent() + java.io.File.separatorChar + TestGenerator.MODEL_COMPANY;
final TLBtoECOREtoCODE gener = new TLBtoECOREtoCODE("com.sourceforge.jacobGenerated",
selectedFile.getLocation().toFile().getAbsolutePath(),
output);
gener.generate();
selectedFile.getProject().getFolder(TestGenerator.MODEL).refreshLocal(IResource.DEPTH_INFINITE, null);
} catch (RuntimeException e) {
System.out.flush();
e.printStackTrace();
Expand All @@ -53,20 +65,22 @@ public void run(IAction action) {
} catch (final IOException e) {
System.out.flush();
e.printStackTrace();
} catch (CoreException e) {
System.out.flush();
e.printStackTrace();
}
System.out.println("Done");

}

/**
* @see IActionDelegate#selectionChanged(IAction, ISelection)
*/
public void selectionChanged(IAction action, ISelection selection) {
System.out.println("NewAction.selectionChanged()");
TreeSelection treeSelection= (TreeSelection)selection;
Object firstElement2 = treeSelection.getFirstElement();
System.out.println(firstElement2.getClass());
File firstElement = (File) firstElement2;
rawLocationURI = firstElement.getRawLocationURI();
// TreeSelection treeSelection= (TreeSelection)selection;
StructuredSelection ss = (StructuredSelection) selection;
Object firstElement2 = ss.getFirstElement();
selectedFile = (File) firstElement2;
}

}
12 changes: 0 additions & 12 deletions TestHarness/META-INF/MANIFEST.MF

This file was deleted.

20 changes: 0 additions & 20 deletions TestHarness/plugin.properties

This file was deleted.

31 changes: 0 additions & 31 deletions TestHarness/plugin.xml

This file was deleted.

0 comments on commit 88d8694

Please sign in to comment.