*** empty log message ***

cmurphy [2008-04-03 21:31:02]
*** empty log message ***
Filename
testplugin/actions/Activator.java
testplugin/actions/CompileAction.java
testplugin/actions/plugin1.xml
testplugin/startup/Activator.java
testplugin/startup/plugin.xml
testplugin/views/Activator.java
testplugin/views/CompileOutputView.java
testplugin/views/plugin2.xml
diff --git a/testplugin/actions/Activator.java b/testplugin/actions/Activator.java
new file mode 100644
index 0000000..0d2f4e0
--- /dev/null
+++ b/testplugin/actions/Activator.java
@@ -0,0 +1,61 @@
+package testplugin.actions;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+	// The plug-in ID
+	public static final String PLUGIN_ID = "CompileAction";
+
+	// The shared instance
+	private static Activator plugin;
+
+	/**
+	 * The constructor
+	 */
+	public Activator() {
+		plugin = this;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+	 */
+	public void start(BundleContext context) throws Exception {
+		super.start(context);
+	}
+
+	/*
+	 * (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 Activator getDefault() {
+		return plugin;
+	}
+
+	/**
+	 * Returns an image descriptor for the image file at the given
+	 * plug-in relative path
+	 *
+	 * @param path the path
+	 * @return the image descriptor
+	 */
+	public static ImageDescriptor getImageDescriptor(String path) {
+		return imageDescriptorFromPlugin(PLUGIN_ID, path);
+	}
+}
diff --git a/testplugin/actions/CompileAction.java b/testplugin/actions/CompileAction.java
new file mode 100644
index 0000000..b3a19ed
--- /dev/null
+++ b/testplugin/actions/CompileAction.java
@@ -0,0 +1,84 @@
+package testplugin.actions;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.jface.dialogs.MessageDialog;
+
+import compileaction.actions.Compiler;
+
+/**
+ * Our sample action implements workbench action delegate.
+ * The action proxy will be created by the workbench and
+ * shown in the UI. When the user tries to use the action,
+ * this delegate will be created and execution will be
+ * delegated to it.
+ * @see IWorkbenchWindowActionDelegate
+ */
+public class CompileAction implements IWorkbenchWindowActionDelegate {
+	private IWorkbenchWindow window;
+	/**
+	 * The constructor.
+	 */
+	public CompileAction() {
+	}
+
+	/**
+	 * The action has been activated. The argument of the
+	 * method represents the 'real' action sitting
+	 * in the workbench UI.
+	 * @see IWorkbenchWindowActionDelegate#run
+	 */
+	public void run(IAction action) {
+		String str = null;
+		String displayName = null;
+
+		try {
+			IEditorInput iei = window.getActivePage().getActiveEditor().getEditorInput();
+			displayName = iei.getName();
+			if (iei instanceof FileEditorInput) {
+				str = (((FileEditorInput) iei).getPath()).toString();
+			}
+
+			compileoutput.views.CompileOutputView.setMessage(str);
+			String results = Compiler.compileFile(str, displayName);
+			compileoutput.views.CompileOutputView.setMessage(str + " compiled." + System.getProperty("line.separator") + results);
+		} catch(Exception e) {
+			e.printStackTrace();
+			MessageDialog.openInformation(
+					window.getShell(),
+					"TestPlugin Plug-in",
+					"View not open. Message:" + e.getMessage() + " name:" + e.toString());
+		}
+	}
+
+	/**
+	 * Selection in the workbench has been changed. We
+	 * can change the state of the 'real' action here
+	 * if we want, but this can only happen after
+	 * the delegate has been created.
+	 * @see IWorkbenchWindowActionDelegate#selectionChanged
+	 */
+	public void selectionChanged(IAction action, ISelection selection) {
+	}
+
+	/**
+	 * We can use this method to dispose of any system
+	 * resources we previously allocated.
+	 * @see IWorkbenchWindowActionDelegate#dispose
+	 */
+	public void dispose() {
+	}
+
+	/**
+	 * We will cache window object in order to
+	 * be able to provide parent shell for the message dialog.
+	 * @see IWorkbenchWindowActionDelegate#init
+	 */
+	public void init(IWorkbenchWindow window) {
+		this.window = window;
+	}
+}
\ No newline at end of file
diff --git a/testplugin/actions/plugin1.xml b/testplugin/actions/plugin1.xml
new file mode 100644
index 0000000..e238685
--- /dev/null
+++ b/testplugin/actions/plugin1.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+
+   <extension
+         point="org.eclipse.ui.actionSets">
+      <actionSet
+            label="Sample Action Set"
+            visible="true"
+            id="CompileAction.actionSet">
+         <menu
+               label="Modified Compiler Menu"
+               id="modifiedCompileMenu">
+            <separator
+                  name="compileGroup">
+            </separator>
+         </menu>
+         <action
+               label="&amp;Modified Compiler"
+               icon="icons/sample.gif"
+               class="compileaction.actions.CompileAction"
+               tooltip="Modified Compiler"
+               menubarPath="modifiedCompileMenu/compileGroup"
+               toolbarPath="compileGroup"
+               id="compileaction.actions.CompileAction">
+         </action>
+      </actionSet>
+   </extension>
+
+</plugin>
diff --git a/testplugin/startup/Activator.java b/testplugin/startup/Activator.java
new file mode 100644
index 0000000..ab1ec09
--- /dev/null
+++ b/testplugin/startup/Activator.java
@@ -0,0 +1,89 @@
+package testplugin.startup;
+
+//import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+//import org.osgi.framework.BundleContext;
+import org.eclipse.ui.IStartup;
+//import org.eclipse.ui.IWorkbenchWindow;
+//import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import java.io.*;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin implements IStartup {
+
+	// The plug-in ID
+	public static final String PLUGIN_ID = "startupPlugin";
+
+	// The shared instance
+	private static Activator plugin;
+
+	/**
+	 * The constructor
+	 */
+	public Activator() {
+		plugin = this;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+	 */
+	/*public void start(BundleContext context) throws Exception {
+		super.start(context);
+	}*/
+
+	/*
+	 * (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 Activator getDefault() {
+		return plugin;
+	}
+
+	/**
+	 * Returns an image descriptor for the image file at the given
+	 * plug-in relative path
+	 *
+	 * @param path the path
+	 * @return the image descriptor
+	 */
+	public static ImageDescriptor getImageDescriptor(String path) {
+		return imageDescriptorFromPlugin(PLUGIN_ID, path);
+	}
+
+	/**
+	 * Early startup method, which is called when eclipse starts.
+	 */
+	public void earlyStartup() {
+		//viewtester.views.SampleView.setMessage("Hello startup world");
+		FileWriter fw = null;
+		try {
+			fw = new FileWriter("/startTester.txt");
+			if (fw != null) {
+				fw.write("Hello startup world");
+			}
+			fw.close();
+		} catch (Exception e) {
+		} finally {
+			try {
+				if (fw != null) {
+					fw.close();
+				}
+			} catch (Exception e) {}
+		}
+	}
+
+}
diff --git a/testplugin/startup/plugin.xml b/testplugin/startup/plugin.xml
new file mode 100644
index 0000000..19ea019
--- /dev/null
+++ b/testplugin/startup/plugin.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+   <extension
+         point="org.eclipse.ui.startup">
+   </extension>
+
+</plugin>
diff --git a/testplugin/views/Activator.java b/testplugin/views/Activator.java
new file mode 100644
index 0000000..a6184a7
--- /dev/null
+++ b/testplugin/views/Activator.java
@@ -0,0 +1,61 @@
+package testplugin.views;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+	// The plug-in ID
+	public static final String PLUGIN_ID = "CompileOutput";
+
+	// The shared instance
+	private static Activator plugin;
+
+	/**
+	 * The constructor
+	 */
+	public Activator() {
+		plugin = this;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+	 */
+	public void start(BundleContext context) throws Exception {
+		super.start(context);
+	}
+
+	/*
+	 * (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 Activator getDefault() {
+		return plugin;
+	}
+
+	/**
+	 * Returns an image descriptor for the image file at the given
+	 * plug-in relative path
+	 *
+	 * @param path the path
+	 * @return the image descriptor
+	 */
+	public static ImageDescriptor getImageDescriptor(String path) {
+		return imageDescriptorFromPlugin(PLUGIN_ID, path);
+	}
+}
diff --git a/testplugin/views/CompileOutputView.java b/testplugin/views/CompileOutputView.java
new file mode 100644
index 0000000..a9ecdfa
--- /dev/null
+++ b/testplugin/views/CompileOutputView.java
@@ -0,0 +1,46 @@
+package testplugin.views;
+
+
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.part.*;
+
+
+/**
+ * This sample class demonstrates how to plug-in a new
+ * workbench view. The view shows data obtained from the
+ * model. The sample creates a dummy model on the fly,
+ * but a real implementation would connect to the model
+ * available either in this or another plug-in (e.g. the workspace).
+ * The view is connected to the model using a content provider.
+ * <p>
+ * The view uses a label provider to define how model
+ * objects should be presented in the view. Each
+ * view can present the same model objects using
+ * different labels and icons, if needed. Alternatively,
+ * a single label provider can be shared between views
+ * in order to ensure that objects of the same type are
+ * presented in the same way everywhere.
+ * <p>
+ */
+
+public class CompileOutputView extends ViewPart {
+	private static Label lbl;
+	private static String message = "";
+
+	public CompileOutputView() {
+		super();
+	}
+
+	public void setFocus() {
+		lbl.setFocus();
+	}
+	public void createPartControl(Composite parent) {
+		lbl = new Label(parent, 0);
+		lbl.setText(CompileOutputView.message);
+	}
+
+	public static void setMessage(String msg) {
+		lbl.setText(msg);
+	}
+}
\ No newline at end of file
diff --git a/testplugin/views/plugin2.xml b/testplugin/views/plugin2.xml
new file mode 100644
index 0000000..b63424d
--- /dev/null
+++ b/testplugin/views/plugin2.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+
+   <extension
+         point="org.eclipse.ui.views">
+      <category
+            name="Compiler Output Category"
+            id="CompileOutput">
+      </category>
+      <view
+            name="Compiler Output"
+            icon="icons/sample.gif"
+            category="CompileOutput"
+            class="compileoutput.views.CompileOutputView"
+            id="compileoutput.views.CompileOutputView">
+      </view>
+   </extension>
+   <extension
+         point="org.eclipse.ui.perspectiveExtensions">
+      <perspectiveExtension
+            targetID="org.eclipse.ui.resourcePerspective">
+         <view
+               ratio="0.5"
+               relative="org.eclipse.ui.views.TaskList"
+               relationship="right"
+               id="compileoutput.views.CompileOutputView">
+         </view>
+      </perspectiveExtension>
+   </extension>
+
+</plugin>