Author: adietish
Date: 2011-08-19 04:50:06 -0400 (Fri, 19 Aug 2011)
New Revision: 34088
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.egit.ui/src/org/jboss/ide/eclipse/as/egit/internal/ui/commands/EGitUtilsCommitAndPushHandler.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.egit.ui/META-INF/MANIFEST.MF
trunk/as/plugins/org.jboss.ide.eclipse.as.egit.ui/plugin.xml
Log:
[JBIDE-9513] added a UI action so that the commit and push with egit utils can be
triggered by the user
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.egit.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.egit.ui/META-INF/MANIFEST.MF 2011-08-19
08:49:51 UTC (rev 34087)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.egit.ui/META-INF/MANIFEST.MF 2011-08-19
08:50:06 UTC (rev 34088)
@@ -10,6 +10,7 @@
org.eclipse.core.runtime,
org.eclipse.core.expressions;bundle-version="[3.4.300,4.0.0)",
org.eclipse.core.resources;bundle-version="[3.7.100,4.0.0)",
- org.eclipse.ui.ide;bundle-version="[3.7.0,4.0.0)"
+ org.eclipse.ui.ide;bundle-version="[3.7.0,4.0.0)",
+ org.jboss.ide.eclipse.as.egit.core;bundle-version="0.0.1"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.egit.ui/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.egit.ui/plugin.xml 2011-08-19 08:49:51 UTC
(rev 34087)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.egit.ui/plugin.xml 2011-08-19 08:50:06 UTC
(rev 34088)
@@ -8,6 +8,10 @@
id="org.jboss.ide.eclipse.as.egit.ui.commands.CommitAndPushCommand"
name="pushAndCommit">
</command>
+ <command
+
id="org.jboss.ide.eclipse.as.egit.ui.commands.EGitUtilsCommitAndPushCommand"
+ name="EGit Utils commit and push">
+ </command>
</extension>
<extension
point="org.eclipse.ui.handlers">
@@ -35,6 +39,30 @@
</and>
</activeWhen>
</handler>
+ <handler
+
class="org.jboss.ide.eclipse.as.egit.internal.ui.commands.EGitUtilsCommitAndPushHandler"
+
commandId="org.jboss.ide.eclipse.as.egit.ui.commands.EGitUtilsCommitAndPushCommand">
+ <activeWhen>
+ <and>
+ <count
+ value="+">
+ </count>
+ <iterate>
+ <or>
+ <adapt
+ type="org.eclipse.core.resources.IResource">
+ </adapt>
+ <adapt
+
type="org.eclipse.core.resources.mapping.ResourceMapping">
+ </adapt>
+ <adapt
+ type="org.eclipse.ui.IContributorResourceAdapter">
+ </adapt>
+ </or>
+ </iterate>
+ </and>
+ </activeWhen>
+ </handler>
</extension>
<extension
point="org.eclipse.ui.menus">
@@ -66,6 +94,34 @@
</visibleWhen>
</command>
</menuContribution>
+ <menuContribution
+ allPopups="true"
+ locationURI="popup:team.main?after=group1">
+ <command
+
commandId="org.jboss.ide.eclipse.as.egit.ui.commands.EGitUtilsCommitAndPushCommand"
+ label="EGit utils Commit and Push --- REMOVE ME ---"
+ style="push"
+ tooltip="EGit utils Commit And Push">
+ <visibleWhen
+ checkEnabled="false">
+ <and>
+ <count
+ value="1">
+ </count>
+ <iterate>
+ <and>
+ <adapt
+ type="org.eclipse.core.resources.IProject">
+ <test
+ property="GitResource.isShared">
+ </test>
+ </adapt>
+ </and>
+ </iterate>
+ </and>
+ </visibleWhen>
+ </command>
+ </menuContribution>
</extension>
<extension
point="org.eclipse.core.expressions.propertyTesters">
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.egit.ui/src/org/jboss/ide/eclipse/as/egit/internal/ui/commands/EGitUtilsCommitAndPushHandler.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.egit.ui/src/org/jboss/ide/eclipse/as/egit/internal/ui/commands/EGitUtilsCommitAndPushHandler.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.egit.ui/src/org/jboss/ide/eclipse/as/egit/internal/ui/commands/EGitUtilsCommitAndPushHandler.java 2011-08-19
08:50:06 UTC (rev 34088)
@@ -0,0 +1,39 @@
+package org.jboss.ide.eclipse.as.egit.internal.ui.commands;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.jboss.ide.eclipse.as.egit.core.EGitUtils;
+
+/**
+ *
+ * This is a test handler that should be removed in the finaly Milestone!
+ *
+ * @author André Dietisheim
+ *
+ */
+public class EGitUtilsCommitAndPushHandler extends AbstractHandler {
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ ISelection selection = HandlerUtil.getCurrentSelection(event);
+ Assert.isTrue(selection instanceof IStructuredSelection);
+ IStructuredSelection structuredSelection = (IStructuredSelection) selection;
+ Object selectedElement = structuredSelection.getFirstElement();
+ IProject project = (IProject) Platform.getAdapterManager().getAdapter(selectedElement,
IProject.class);
+ try {
+ EGitUtils.commit(project, null);
+ EGitUtils.push(EGitUtils.getRepository(project), null);
+ } catch (CoreException e) {
+ throw new ExecutionException(e.getStatus().getMessage(),
e.getStatus().getException());
+ }
+ return null;
+ }
+}
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.egit.ui/src/org/jboss/ide/eclipse/as/egit/internal/ui/commands/EGitUtilsCommitAndPushHandler.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Show replies by date