You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by dk...@apache.org on 2011/10/06 12:13:51 UTC

svn commit: r1179557 - in /cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc: ./ META-INF/ src/main/java/org/apache/cayenne/ src/main/java/org/apache/cayenne/extensions/actions/

Author: dkazimirchyk
Date: Thu Oct  6 10:13:50 2011
New Revision: 1179557

URL: http://svn.apache.org/viewvc?rev=1179557&view=rev
Log:
CayenneModeler Eclipse Plugin: added button to Eclipse toolbar which brings to front currently running Modeler instance

Added:
    cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/actions/
    cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/actions/ModelerToolbarAction.java
Modified:
    cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/META-INF/MANIFEST.MF
    cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/plugin.xml
    cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/Activator.java

Modified: cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/META-INF/MANIFEST.MF?rev=1179557&r1=1179556&r2=1179557&view=diff
==============================================================================
--- cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/META-INF/MANIFEST.MF (original)
+++ cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/META-INF/MANIFEST.MF Thu Oct  6 10:13:50 2011
@@ -36,7 +36,7 @@ Created-By: Apache Maven Bundle Plugin
 Require-Bundle: org.eclipse.core.runtime,org.eclipse.core.resources,or
  g.eclipse.ui,org.eclipse.jface
 Bundle-Vendor: Apache Cayenne
-Build-Jdk: 1.6.0_20
+Build-Jdk: 1.6.0_22
 Bundle-Version: 3.1.0.M4-SNAPSHOT
 Bnd-LastModified: 1316501641847
 Bundle-Activator: org.apache.cayenne.Activator

Modified: cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/plugin.xml
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/plugin.xml?rev=1179557&r1=1179556&r2=1179557&view=diff
==============================================================================
--- cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/plugin.xml (original)
+++ cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/plugin.xml Thu Oct  6 10:13:50 2011
@@ -38,4 +38,18 @@
             <contentTypeBinding contentTypeId="org.apache.cayenne.extensions.modeler.datamapFile"/>
         </editor> 
     </extension> 
+    
+    <extension point="org.eclipse.ui.actionSets">
+    	<actionSet 
+    		id="org.apache.cayenne.extensions.actionset"
+    		label="Cayenne Actions"
+    		visible="true">
+    		<action 
+    			class="org.apache.cayenne.extensions.actions.ModelerToolbarAction"
+    			toolbarPath="Normal/cayenneGroup"
+    			icon="icons/cayenne.png"
+    			tooltip="CayenneModeler">
+    		</action>
+    	</actionSet>
+    </extension>
 </plugin>
\ No newline at end of file

Modified: cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/Activator.java
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/Activator.java?rev=1179557&r1=1179556&r2=1179557&view=diff
==============================================================================
--- cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/Activator.java (original)
+++ cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/Activator.java Thu Oct  6 10:13:50 2011
@@ -116,4 +116,8 @@ public class Activator extends AbstractU
 		}
 		return injector;
 	}
+	
+	public Injector getInjector() {
+		return injector;
+	}
 }

Added: cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/actions/ModelerToolbarAction.java
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/actions/ModelerToolbarAction.java?rev=1179557&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/actions/ModelerToolbarAction.java (added)
+++ cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/actions/ModelerToolbarAction.java Thu Oct  6 10:13:50 2011
@@ -0,0 +1,40 @@
+package org.apache.cayenne.extensions.actions;
+
+import org.apache.cayenne.Activator;
+import org.apache.cayenne.di.Injector;
+import org.apache.cayenne.extensions.modeler.PluginApplication;
+import org.apache.cayenne.modeler.Application;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+
+public class ModelerToolbarAction implements IWorkbenchWindowActionDelegate {
+
+	public void run(IAction arg0) {
+		Injector injector = Activator.getDefault().getInjector();
+		
+		// if Modeler is not started then doing nothing
+		if (injector == null) {
+			return;
+		}
+		
+		PluginApplication application = (PluginApplication)injector.getInstance(Application.class);
+		if (application != null && application.isStarted()) {
+			application.toFront();
+		}
+	}
+
+	public void selectionChanged(IAction arg0, ISelection arg1) {
+		// noop
+	}
+
+	public void dispose() {
+		// noop
+	}
+
+	public void init(IWorkbenchWindow arg0) {
+		// noop
+	}
+
+}