JBoss Tools SVN: r34095 - trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-08-19 12:22:44 -0400 (Fri, 19 Aug 2011)
New Revision: 34095
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/EGitUtils.java
Log:
[JBIDE-9513] implementing push test
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/EGitUtils.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/EGitUtils.java 2011-08-19 14:12:32 UTC (rev 34094)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/EGitUtils.java 2011-08-19 16:22:44 UTC (rev 34095)
@@ -69,8 +69,8 @@
null,
null,
null,
- getSubject(userConfig.getAuthorName(), userConfig.getAuthorEmail()),
- getSubject(userConfig.getCommitterName(), userConfig.getCommitterEmail()),
+ getFormattedUser(userConfig.getAuthorName(), userConfig.getAuthorEmail()),
+ getFormattedUser(userConfig.getCommitterName(), userConfig.getCommitterEmail()),
"Initial commit");
op.setCommitAll(true);
op.setRepository(repository);
@@ -205,17 +205,28 @@
}
/**
- * Gets the UserConfig from the given repository
+ * Gets the UserConfig from the given repository. The UserConfig of a repo
+ * holds the default author and committer.
*
* @param repository
* the repository
- * @return the user config
+ * @return the user configuration
+ * @throws CoreException
+ *
+ * @see PersonIdent(Repository)
+ * @see CommittHelper#calculateCommitInfo
*/
- private static UserConfig getUserConfig(Repository repository) {
+ private static UserConfig getUserConfig(Repository repository) throws CoreException {
+ if (repository.getConfig() == null) {
+ IStatus status = new Status(IStatus.ERROR, EGitCoreActivator.PLUGIN_ID,
+ NLS.bind("no user configuration (author, committer) are present in repository \"{0}\"",
+ repository.toString()));
+ throw new CoreException(status);
+ }
return repository.getConfig().get(UserConfig.KEY);
}
- private static String getSubject(String name, String email) {
+ private static String getFormattedUser(String name, String email) {
return new StringBuilder().append(name).append(" <").append(email).append('>').toString();
}
14 years, 7 months
JBoss Tools SVN: r34094 - in trunk/vpe: plugins/org.jboss.tools.vpe.html/src/org/jboss/tools/vpe/html/template and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2011-08-19 10:12:32 -0400 (Fri, 19 Aug 2011)
New Revision: 34094
Added:
trunk/vpe/plugins/org.jboss.tools.vpe.html/src/org/jboss/tools/vpe/html/template/HtmlTemplate.java
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.html/templates/vpe-templates-html.xml
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java
trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/components/core/html.html.xml
Log:
https://issues.jboss.org/browse/JBIDE-9567 , xmlns attribute was added to HTML template.
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java 2011-08-19 11:24:38 UTC (rev 34093)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java 2011-08-19 14:12:32 UTC (rev 34094)
@@ -114,6 +114,7 @@
public static final String ATTR_SPAN = "span"; //$NON-NLS-1$
public static final String ATTR_BACKGROUND = "background"; //$NON-NLS-1$
public static final String ATTR_BGCOLOR = "bgcolor"; //$NON-NLS-1$
+ public static final String ATTR_XMLNS = "xmlns"; //$NON-NLS-1$
/*
* Use this constant if you have to span a column to entire row.
Added: trunk/vpe/plugins/org.jboss.tools.vpe.html/src/org/jboss/tools/vpe/html/template/HtmlTemplate.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.html/src/org/jboss/tools/vpe/html/template/HtmlTemplate.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.html/src/org/jboss/tools/vpe/html/template/HtmlTemplate.java 2011-08-19 14:12:32 UTC (rev 34094)
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2011 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.vpe.html.template;
+
+import org.jboss.tools.vpe.editor.context.VpePageContext;
+import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
+import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.vpe.editor.util.HTML;
+import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMNode;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+public class HtmlTemplate extends VpeAbstractTemplate {
+
+ @Override
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
+ nsIDOMDocument visualDocument) {
+ Element sourceElement = (Element) sourceNode;
+ /*
+ * Set "xmlns" attribute to the generated by VPE html stub.
+ */
+ if (sourceElement.hasAttribute(HTML.ATTR_XMLNS)) {
+ String xmlnsAttr = sourceElement.getAttribute(HTML.ATTR_XMLNS);
+ nsIDOMNode htmlNode = visualDocument.getElementsByTagName(HTML.TAG_HTML).item(0);
+ nsIDOMElement htmlElement = (nsIDOMElement)htmlNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+ htmlElement.setAttribute(HTML.ATTR_XMLNS, xmlnsAttr);
+ }
+ nsIDOMNode divElement = visualDocument.createElement(HTML.TAG_DIV);
+ return new VpeCreationData(divElement);
+ }
+}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.html/templates/vpe-templates-html.xml
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.html/templates/vpe-templates-html.xml 2011-08-19 11:24:38 UTC (rev 34093)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.html/templates/vpe-templates-html.xml 2011-08-19 14:12:32 UTC (rev 34094)
@@ -1153,8 +1153,7 @@
</vpe:tag>
<vpe:tag name="html" case-sensitive="no">
- <vpe:template children="yes" modify="yes">
- <div/>
+ <vpe:template children="yes" modify="yes" class="org.jboss.tools.vpe.html.template.HtmlTemplate">
<vpe:dnd>
<vpe:drop container="yes" />
</vpe:dnd>
Modified: trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/components/core/html.html.xml
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/components/core/html.html.xml 2011-08-19 11:24:38 UTC (rev 34093)
+++ trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/components/core/html.html.xml 2011-08-19 14:12:32 UTC (rev 34094)
@@ -1,6 +1,6 @@
<tests>
<test id="html">
- <DIV STYLE="-moz-user-modify: read-write;">
+ <DIV>
<DIV STYLE="display: none; -moz-user-modify: read-only;">
<BR VPE:PSEUDO-ELEMENT="yes"
STYLE="font-style: italic; color: green; -moz-user-modify: read-only;" />
@@ -8,7 +8,7 @@
</DIV>
<DIV>
<H1 STYLE="-moz-user-modify: read-write;">
- <SPAN>
+ <SPAN CLASS="vpe-text">
html
</SPAN>
</H1>
14 years, 7 months
JBoss Tools SVN: r34093 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/xpl.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2011-08-19 07:24:38 -0400 (Fri, 19 Aug 2011)
New Revision: 34093
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/xpl/ServerSourcePathComputerDelegate.java
Log:
JBIDE-9527 add isacessible check
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/xpl/ServerSourcePathComputerDelegate.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/xpl/ServerSourcePathComputerDelegate.java 2011-08-19 09:42:51 UTC (rev 34092)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/xpl/ServerSourcePathComputerDelegate.java 2011-08-19 11:24:38 UTC (rev 34093)
@@ -83,7 +83,7 @@
{
processModules(sourcefolderList, cModule, javaProjectList, server, monitor);
}
- if (project != null) {
+ if (project != null && project.isAccessible()) {
IFolder moduleFolder = project.getFolder(modules[i].getName());
if (moduleFolder.exists()) {
sourcefolderList.add(new FolderSourceContainer(moduleFolder, true));
14 years, 7 months
JBoss Tools SVN: r34092 - trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test.
by jbosstools-commits@lists.jboss.org
Author: lzoubek(a)redhat.com
Date: 2011-08-19 05:42:51 -0400 (Fri, 19 Aug 2011)
New Revision: 34092
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAutoTestCase.java
Log:
vpe bot tests: no need to run it on more than 1 runtime
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAutoTestCase.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAutoTestCase.java 2011-08-19 09:01:46 UTC (rev 34091)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAutoTestCase.java 2011-08-19 09:42:51 UTC (rev 34092)
@@ -4,26 +4,20 @@
import java.io.File;
import java.io.IOException;
-import java.io.InputStream;
import java.util.Arrays;
import java.util.List;
-import java.util.Properties;
+
import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
import org.eclipse.swtbot.swt.finder.SWTBot;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
import org.eclipse.swtbot.swt.finder.results.VoidResult;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotCheckBox;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
-import org.jboss.tools.test.TestProperties;
-import org.jboss.tools.vpe.ui.bot.test.Activator;
import org.jboss.tools.ui.bot.ext.SWTBotExt;
import org.jboss.tools.ui.bot.ext.SWTJBTExt;
import org.jboss.tools.ui.bot.ext.SWTTestExt;
@@ -33,15 +27,14 @@
import org.jboss.tools.ui.bot.ext.config.Annotations.ServerState;
import org.jboss.tools.ui.bot.ext.gen.ActionItem;
import org.jboss.tools.ui.bot.ext.gen.ActionItem.NewObject.JBossToolsWebJSFJSFProject;
-import org.jboss.tools.vpe.editor.xpl.CustomSashForm;
import org.jboss.tools.ui.bot.ext.types.IDELabel;
-import org.jboss.tools.ui.bot.ext.wizards.SWTBotWizard;
import org.jboss.tools.ui.bot.test.JBTSWTBotTestCase;
import org.jboss.tools.ui.bot.test.SWTBotJSPMultiPageEditor;
import org.jboss.tools.ui.bot.test.WidgetVariables;
import org.jboss.tools.vpe.editor.VpeController;
import org.jboss.tools.vpe.editor.VpeEditorPart;
import org.jboss.tools.vpe.editor.mapping.VpeNodeMapping;
+import org.jboss.tools.vpe.editor.xpl.CustomSashForm;
import org.junit.After;
import org.junit.Before;
import org.mozilla.interfaces.nsIDOMDocument;
@@ -54,6 +47,7 @@
@Require(server = @Server(state = ServerState.Present),
clearProjects=false,
clearWorkspace=false,
+ runOnce=true,
perspective="Web Development"
)
public abstract class VPEAutoTestCase extends JBTSWTBotTestCase {
14 years, 7 months
JBoss Tools SVN: r34091 - trunk/forge/plugins/org.jboss.tools.forge.runtime.ext.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2011-08-19 05:01:46 -0400 (Fri, 19 Aug 2011)
New Revision: 34091
Removed:
trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/bin.index
Log:
JBIDE-9561: get rid of bin.index
Deleted: trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/bin.index
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/bin.index 2011-08-19 09:00:47 UTC (rev 34090)
+++ trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/bin.index 2011-08-19 09:01:46 UTC (rev 34091)
@@ -1,8 +0,0 @@
-
-META-INF
-org
-org/jboss
-org/jboss/tools
-org/jboss/tools/forge
-org/jboss/tools/forge/runtime
-org/jboss/tools/forge/runtime/ext
14 years, 7 months
JBoss Tools SVN: r34090 - in trunk/forge/plugins/org.jboss.tools.forge.runtime.ext: META-INF and 9 other directories.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2011-08-19 05:00:47 -0400 (Fri, 19 Aug 2011)
New Revision: 34090
Added:
trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/bin.index
trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/src/
trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/src/META-INF/
trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/src/META-INF/beans.xml
trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/src/META-INF/forge.xml
trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/src/org/
trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/src/org/jboss/
trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/src/org/jboss/tools/
trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/src/org/jboss/tools/forge/
trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/src/org/jboss/tools/forge/runtime/
trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/src/org/jboss/tools/forge/runtime/ext/
trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/src/org/jboss/tools/forge/runtime/ext/EventHandler.java
trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/src/org/jboss/tools/forge/runtime/ext/MetaCommandTriggeredAction.java
Removed:
trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/META-INF/beans.xml
trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/META-INF/forge.xml
Modified:
trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/.classpath
trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/META-INF/MANIFEST.MF
trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/build.properties
trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/modules/org/jboss/tools/forge/runtime/ext/main/module.xml
Log:
JBIDE-9561: put the classes in the 'bin' folder again
Modified: trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/.classpath
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/.classpath 2011-08-19 08:59:26 UTC (rev 34089)
+++ trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/.classpath 2011-08-19 09:00:47 UTC (rev 34090)
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry excluding="modules/" kind="src" path=""/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry exported="true" kind="lib" path="bin/"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="output" path=""/>
+ <classpathentry kind="output" path="bin"/>
</classpath>
Modified: trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/META-INF/MANIFEST.MF
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/META-INF/MANIFEST.MF 2011-08-19 08:59:26 UTC (rev 34089)
+++ trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/META-INF/MANIFEST.MF 2011-08-19 09:00:47 UTC (rev 34090)
@@ -6,3 +6,4 @@
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Vendor: JBoss by Red Hat
Require-Bundle: org.jboss.tools.forge.runtime;bundle-version="1.0.0"
+Bundle-ClassPath: bin/
Deleted: trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/META-INF/beans.xml
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/META-INF/beans.xml 2011-08-19 08:59:26 UTC (rev 34089)
+++ trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/META-INF/beans.xml 2011-08-19 09:00:47 UTC (rev 34090)
@@ -1,5 +0,0 @@
-<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="
- http://java.sun.com/xml/ns/javaee
- http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
-</beans>
Deleted: trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/META-INF/forge.xml
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/META-INF/forge.xml 2011-08-19 08:59:26 UTC (rev 34089)
+++ trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/META-INF/forge.xml 2011-08-19 09:00:47 UTC (rev 34090)
@@ -1 +0,0 @@
-<forge/>
\ No newline at end of file
Added: trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/bin.index
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/bin.index (rev 0)
+++ trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/bin.index 2011-08-19 09:00:47 UTC (rev 34090)
@@ -0,0 +1,8 @@
+
+META-INF
+org
+org/jboss
+org/jboss/tools
+org/jboss/tools/forge
+org/jboss/tools/forge/runtime
+org/jboss/tools/forge/runtime/ext
Modified: trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/build.properties
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/build.properties 2011-08-19 08:59:26 UTC (rev 34089)
+++ trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/build.properties 2011-08-19 09:00:47 UTC (rev 34090)
@@ -1,5 +1,6 @@
-source.. = .
-output.. = .
bin.includes = META-INF/,\
modules/,\
- .
\ No newline at end of file
+ bin/
+jars.compile.order = bin/
+source.bin/ = src/
+output.bin/ = bin/
Modified: trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/modules/org/jboss/tools/forge/runtime/ext/main/module.xml
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/modules/org/jboss/tools/forge/runtime/ext/main/module.xml 2011-08-19 08:59:26 UTC (rev 34089)
+++ trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/modules/org/jboss/tools/forge/runtime/ext/main/module.xml 2011-08-19 09:00:47 UTC (rev 34090)
@@ -3,7 +3,7 @@
<module xmlns="urn:jboss:module:1.0" name="org.jboss.tools.forge.runtime.ext">
<resources>
- <resource-root path="../../../../../../../.." />
+ <resource-root path="../../../../../../../../bin" />
</resources>
<dependencies>
Copied: trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/src/META-INF/beans.xml (from rev 34085, trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/META-INF/beans.xml)
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/src/META-INF/beans.xml (rev 0)
+++ trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/src/META-INF/beans.xml 2011-08-19 09:00:47 UTC (rev 34090)
@@ -0,0 +1,5 @@
+<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://java.sun.com/xml/ns/javaee
+ http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
+</beans>
Copied: trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/src/META-INF/forge.xml (from rev 34085, trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/META-INF/forge.xml)
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/src/META-INF/forge.xml (rev 0)
+++ trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/src/META-INF/forge.xml 2011-08-19 09:00:47 UTC (rev 34090)
@@ -0,0 +1 @@
+<forge/>
\ No newline at end of file
Copied: trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/src/org/jboss/tools/forge/runtime/ext/EventHandler.java (from rev 34085, trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/org/jboss/tools/forge/runtime/ext/EventHandler.java)
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/src/org/jboss/tools/forge/runtime/ext/EventHandler.java (rev 0)
+++ trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/src/org/jboss/tools/forge/runtime/ext/EventHandler.java 2011-08-19 09:00:47 UTC (rev 34090)
@@ -0,0 +1,24 @@
+package org.jboss.tools.forge.runtime.ext;
+
+import javax.enterprise.event.Observes;
+import javax.inject.Inject;
+
+import org.jboss.forge.shell.Shell;
+import org.jboss.forge.shell.events.PostStartup;
+
+public class EventHandler {
+
+ private static final String ESCAPE = new String(new char[] { 27, '[', '%'} );
+
+ @Inject
+ private Shell shell;
+
+ public void startup(@Observes PostStartup event) {
+ sendEscaped("PostStartup");
+ }
+
+ private void sendEscaped(String str) {
+ shell.print(ESCAPE + str + ESCAPE);
+ }
+
+}
Copied: trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/src/org/jboss/tools/forge/runtime/ext/MetaCommandTriggeredAction.java (from rev 34085, trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/org/jboss/tools/forge/runtime/ext/MetaCommandTriggeredAction.java)
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/src/org/jboss/tools/forge/runtime/ext/MetaCommandTriggeredAction.java (rev 0)
+++ trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/src/org/jboss/tools/forge/runtime/ext/MetaCommandTriggeredAction.java 2011-08-19 09:00:47 UTC (rev 34090)
@@ -0,0 +1,71 @@
+package org.jboss.tools.forge.runtime.ext;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import javax.inject.Inject;
+
+import org.jboss.forge.shell.Shell;
+import org.jboss.forge.shell.command.CommandMetadata;
+import org.jboss.forge.shell.command.PluginMetadata;
+import org.jboss.forge.shell.command.PluginRegistry;
+import org.jboss.forge.shell.spi.TriggeredAction;
+
+public class MetaCommandTriggeredAction implements TriggeredAction {
+
+ private static final String ESCAPE = new String(new char[] { 27, '[', '%' });
+
+ @Inject Shell shell;
+
+ @Inject PluginRegistry registry;
+
+ @Override
+ public ActionListener getListener() {
+ return new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ try {
+ shell.print(ESCAPE);
+ String text = shell.readLine();
+ shell.print(ESCAPE);
+ handleHiddenCommand(text);
+ } catch (IOException e1) {
+ e1.printStackTrace();
+ }
+ }
+ };
+ }
+
+ private void handleHiddenCommand(String text) {
+ if ("plugin-candidates-query".equals(text)) {
+ shell.print(ESCAPE + "plugin-candidates-answer: " + getPluginCandidates() + ESCAPE);
+ }
+ }
+
+ private String getPluginCandidates() {
+ StringBuffer resultBuffer = new StringBuffer();
+ Map<String, List<PluginMetadata>> plugins = registry.getPlugins();
+ for (Entry<String, List<PluginMetadata>> entry : plugins.entrySet()) {
+ for (PluginMetadata pluginMeta : entry.getValue()) {
+ List<CommandMetadata> commands = pluginMeta.getAllCommands();
+ if (!commands.isEmpty()) {
+ resultBuffer.append("p:").append(pluginMeta.getName()).append(' ');
+ for (CommandMetadata commandMeta : commands) {
+ resultBuffer.append("c:").append(commandMeta.getName()).append(' ');
+ }
+ }
+ }
+ }
+ return resultBuffer.toString();
+ }
+
+ @Override
+ public char getTrigger() {
+ return (char)31;
+ }
+
+}
14 years, 7 months
JBoss Tools SVN: r34088 - in trunk/as/plugins/org.jboss.ide.eclipse.as.egit.ui: META-INF and 1 other directories.
by jbosstools-commits@lists.jboss.org
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
14 years, 7 months
JBoss Tools SVN: r34087 - trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-08-19 04:49:51 -0400 (Fri, 19 Aug 2011)
New Revision: 34087
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/EGitUtils.java
Removed:
trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/EgitUtils.java
Log:
[JBIDE-9513] added a UI action so that the commit and push with egit utils can be triggered by the user
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/EGitUtils.java (from rev 34048, trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/EgitUtils.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/EGitUtils.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/EGitUtils.java 2011-08-19 08:49:51 UTC (rev 34087)
@@ -0,0 +1,312 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.egit.core;
+
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.egit.core.op.CommitOperation;
+import org.eclipse.egit.core.op.PushOperation;
+import org.eclipse.egit.core.op.PushOperationSpecification;
+import org.eclipse.egit.core.project.RepositoryMapping;
+import org.eclipse.jgit.errors.NotSupportedException;
+import org.eclipse.jgit.lib.ConfigConstants;
+import org.eclipse.jgit.lib.Constants;
+import org.eclipse.jgit.lib.ObjectId;
+import org.eclipse.jgit.lib.Repository;
+import org.eclipse.jgit.lib.UserConfig;
+import org.eclipse.jgit.transport.RefSpec;
+import org.eclipse.jgit.transport.RemoteConfig;
+import org.eclipse.jgit.transport.Transport;
+import org.eclipse.jgit.transport.URIish;
+import org.eclipse.osgi.util.NLS;
+import org.jboss.ide.eclipse.as.egit.core.internal.EGitCoreActivator;
+
+/**
+ * The Class EGitUtils.
+ *
+ * @author André Dietisheim
+ */
+public class EGitUtils {
+
+ private static final RefSpec DEFAULT_PUSH_REF_SPEC =
+ new RefSpec("refs/heads/*:refs/heads/*"); //$NON-NLS-1$
+
+ private static final int PUSH_TIMEOUT = 10 * 1024;
+
+ /**
+ * Commits the given project to it's configured repository.
+ *
+ * @param project
+ * the project
+ * @param monitor
+ * the monitor
+ * @throws CoreException
+ * the core exception
+ */
+ public static void commit(IProject project, IProgressMonitor monitor) throws CoreException {
+ /**
+ * TODO: add capability to commit selectively
+ */
+ Repository repository = getRepository(project);
+ UserConfig userConfig = getUserConfig(repository);
+ CommitOperation op = new CommitOperation(
+ null,
+ null,
+ null,
+ getSubject(userConfig.getAuthorName(), userConfig.getAuthorEmail()),
+ getSubject(userConfig.getCommitterName(), userConfig.getCommitterEmail()),
+ "Initial commit");
+ op.setCommitAll(true);
+ op.setRepository(repository);
+ op.execute(monitor);
+ }
+
+ /**
+ * Pushes the given repository to it's configured remote.
+ *
+ * @param repository
+ * the source repository
+ * @param monitor
+ * the monitor
+ * @throws CoreException
+ * the core exception
+ */
+ public static void push(Repository repository, IProgressMonitor monitor)
+ throws CoreException {
+ try {
+ RemoteConfig remoteConfig = getRemoteConfig(repository);
+ if (remoteConfig == null) {
+ IStatus status = new Status(IStatus.ERROR, EGitCoreActivator.PLUGIN_ID, NLS.bind(
+ "Repository \"{0}\" has no remote repository configured", repository.toString()));
+ throw new CoreException(status);
+ }
+ PushOperation pop = createPushOperation(repository, remoteConfig);
+ pop.run(monitor);
+ } catch (CoreException e) {
+ throw e;
+ } catch (Exception e) {
+ IStatus status = new Status(IStatus.ERROR, EGitCoreActivator.PLUGIN_ID,
+ NLS.bind("Could not push repo {0}", repository.toString()), e);
+ throw new CoreException(status);
+ }
+ }
+
+ private static PushOperation createPushOperation(String remoteName, Repository repository) {
+ return new PushOperation(repository, remoteName, false, PUSH_TIMEOUT);
+ }
+
+ private static PushOperation createPushOperation(Repository repository, RemoteConfig remoteConfig)
+ throws CoreException {
+
+ PushOperationSpecification spec = new PushOperationSpecification();
+ List<URIish> urisToPush = getPushURIs(remoteConfig);
+ List<RefSpec> pushRefSpecs = getPushRefSpecs(remoteConfig);
+ addURIRefToPushSpecification(urisToPush, pushRefSpecs, repository, spec);
+
+ return new PushOperation(repository, spec, false, PUSH_TIMEOUT);
+ }
+
+ /**
+ * Adds the given push uris to the given push operation specification.
+ *
+ * @param urisToPush
+ * the uris to push
+ * @param pushRefSpecs
+ * the push ref specs
+ * @param repository
+ * the repository
+ * @param spec
+ * the spec
+ * @throws CoreException
+ * the core exception
+ */
+ private static void addURIRefToPushSpecification(List<URIish> urisToPush, List<RefSpec> pushRefSpecs,
+ Repository repository, PushOperationSpecification spec) throws CoreException {
+ for (URIish uri : urisToPush) {
+ try {
+ spec.addURIRefUpdates(uri,
+ Transport.open(repository, uri).findRemoteRefUpdatesFor(pushRefSpecs));
+ } catch (NotSupportedException e) {
+ IStatus status =
+ new Status(IStatus.ERROR, EGitCoreActivator.PLUGIN_ID, NLS.bind(
+ "Could not connect repository \"{0}\" to a remote", repository.toString()), e);
+ throw new CoreException(status);
+ } catch (IOException e) {
+ IStatus status = new Status(IStatus.ERROR, EGitCoreActivator.PLUGIN_ID, NLS.bind(
+ "Could not convert remote specifications for repository \"{0}\" to a remote",
+ repository.toString()), e);
+ throw new CoreException(status);
+ }
+ }
+ }
+
+ /**
+ * Gets the push uris from the given remoteConfig.
+ *
+ * @param remoteConfig
+ * the remote config
+ * @return the push ur is
+ */
+ private static List<URIish> getPushURIs(RemoteConfig remoteConfig) {
+ List<URIish> urisToPush = new ArrayList<URIish>();
+ for (URIish uri : remoteConfig.getPushURIs())
+ urisToPush.add(uri);
+ if (urisToPush.isEmpty() && !remoteConfig.getURIs().isEmpty())
+ urisToPush.add(remoteConfig.getURIs().get(0));
+ return urisToPush;
+ }
+
+ /**
+ * Gets the push RefSpecs from the given remote configuration.
+ *
+ * @param config
+ * the config
+ * @return the push ref specs
+ */
+ private static List<RefSpec> getPushRefSpecs(RemoteConfig config) {
+ List<RefSpec> pushRefSpecs = new ArrayList<RefSpec>();
+ pushRefSpecs.addAll(config.getPushRefSpecs());
+ if (pushRefSpecs.isEmpty()) {
+ // default push to all branches
+ pushRefSpecs.add(DEFAULT_PUSH_REF_SPEC);
+ }
+ return pushRefSpecs;
+ }
+
+ /**
+ * Gets the repository that is configured to the given project.
+ *
+ * @param project
+ * the project
+ * @return the repository
+ */
+ public static Repository getRepository(IProject project) {
+ RepositoryMapping repositoryMapping = RepositoryMapping.getMapping(project);
+ if (repositoryMapping == null) {
+ return null;
+ }
+ return repositoryMapping.getRepository();
+ }
+
+ /**
+ * Gets the UserConfig from the given repository
+ *
+ * @param repository
+ * the repository
+ * @return the user config
+ */
+ private static UserConfig getUserConfig(Repository repository) {
+ return repository.getConfig().get(UserConfig.KEY);
+ }
+
+ private static String getSubject(String name, String email) {
+ return new StringBuilder().append(name).append(" <").append(email).append('>').toString();
+ }
+
+ /**
+ * Returns the configuration of the remote repository that is set to the
+ * given repository. Returns
+ * <code>null</null> if none was configured or if there's no remote repo configured.
+ *
+ * @param repository
+ * the repository to get the remote repo configuration from
+ * @return the configurtion of the remote repository
+ * @throws CoreException
+ * the core exception
+ */
+ private static RemoteConfig getRemoteConfig(Repository repository) throws CoreException {
+ String branch = null;
+ try {
+ branch = repository.getBranch();
+ } catch (IOException e) {
+ IStatus status = new Status(IStatus.ERROR, EGitCoreActivator.PLUGIN_ID,
+ NLS.bind("Could not get branch on repository \"{0}\"", repository.toString()), e);
+ throw new CoreException(status);
+ }
+
+ String remoteName = getRemoteName(repository, branch);
+ List<RemoteConfig> allRemotes = getRemoteConfigs(repository);
+ return getRemoteConfig(remoteName, allRemotes);
+ }
+
+ /**
+ * Gets the remote config with the given name from the list of remote
+ * repositories.
+ *
+ * @param remoteName
+ * the remote name
+ * @param remoteRepositories
+ * the remote repositories
+ * @return the remote config
+ */
+ private static RemoteConfig getRemoteConfig(String remoteName, List<RemoteConfig> remoteRepositories) {
+ RemoteConfig defaultConfig = null;
+ RemoteConfig configuredConfig = null;
+ for (RemoteConfig config : remoteRepositories) {
+ if (config.getName().equals(Constants.DEFAULT_REMOTE_NAME))
+ defaultConfig = config;
+ if (remoteName != null && config.getName().equals(remoteName))
+ configuredConfig = config;
+ }
+
+ if (configuredConfig == null) {
+ return defaultConfig;
+ }
+ return configuredConfig;
+ }
+
+ /**
+ * Gets the remote configs from the given repository.
+ *
+ * @param repository
+ * the repository
+ * @return the remote configs
+ */
+ private static List<RemoteConfig> getRemoteConfigs(Repository repository) {
+ List<RemoteConfig> remoteConfigs = new ArrayList<RemoteConfig>();
+ try {
+ remoteConfigs =
+ RemoteConfig.getAllRemoteConfigs(repository.getConfig());
+ } catch (URISyntaxException e) {
+ remoteConfigs = new ArrayList<RemoteConfig>();
+ }
+ return remoteConfigs;
+ }
+
+ /**
+ * Gets the name of the remote repository for a given repository and branch.
+ *
+ * @param repository
+ * the repository
+ * @param branch
+ * the branch
+ * @return the remote name
+ */
+ private static String getRemoteName(Repository repository, String branch) {
+ String remoteName = null;
+ if (ObjectId.isId(branch)) {
+ remoteName = Constants.DEFAULT_REMOTE_NAME;
+ } else {
+ remoteName = repository.getConfig().getString(
+ ConfigConstants.CONFIG_BRANCH_SECTION, branch,
+ ConfigConstants.CONFIG_REMOTE_SECTION);
+ }
+ return remoteName;
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/EGitUtils.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/EgitUtils.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/EgitUtils.java 2011-08-19 08:21:18 UTC (rev 34086)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/EgitUtils.java 2011-08-19 08:49:51 UTC (rev 34087)
@@ -1,312 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.ide.eclipse.as.egit.core;
-
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.egit.core.op.CommitOperation;
-import org.eclipse.egit.core.op.PushOperation;
-import org.eclipse.egit.core.op.PushOperationSpecification;
-import org.eclipse.egit.core.project.RepositoryMapping;
-import org.eclipse.jgit.errors.NotSupportedException;
-import org.eclipse.jgit.lib.ConfigConstants;
-import org.eclipse.jgit.lib.Constants;
-import org.eclipse.jgit.lib.ObjectId;
-import org.eclipse.jgit.lib.Repository;
-import org.eclipse.jgit.lib.UserConfig;
-import org.eclipse.jgit.transport.RefSpec;
-import org.eclipse.jgit.transport.RemoteConfig;
-import org.eclipse.jgit.transport.Transport;
-import org.eclipse.jgit.transport.URIish;
-import org.eclipse.osgi.util.NLS;
-import org.jboss.ide.eclipse.as.egit.core.internal.EGitCoreActivator;
-
-/**
- * The Class EgitUtils.
- *
- * @author André Dietisheim
- */
-public class EgitUtils {
-
- private static final RefSpec DEFAULT_PUSH_REF_SPEC =
- new RefSpec("refs/heads/*:refs/heads/*"); //$NON-NLS-1$
-
- private static final int PUSH_TIMEOUT = 10 * 1024;
-
- /**
- * Commits the given project to it's configured repository.
- *
- * @param project
- * the project
- * @param monitor
- * the monitor
- * @throws CoreException
- * the core exception
- */
- public static void commit(IProject project, IProgressMonitor monitor) throws CoreException {
- /**
- * TODO: add capability to commit selectively
- */
- Repository repository = getRepository(project);
- UserConfig userConfig = getUserConfig(repository);
- CommitOperation op = new CommitOperation(
- null,
- null,
- null,
- getSubject(userConfig.getAuthorName(), userConfig.getAuthorEmail()),
- getSubject(userConfig.getCommitterName(), userConfig.getCommitterEmail()),
- "Initial commit");
- op.setCommitAll(true);
- op.setRepository(repository);
- op.execute(monitor);
- }
-
- /**
- * Pushes the given repository to it's configured remote.
- *
- * @param repository
- * the source repository
- * @param monitor
- * the monitor
- * @throws CoreException
- * the core exception
- */
- public static void push(Repository repository, IProgressMonitor monitor)
- throws CoreException {
- try {
- RemoteConfig remoteConfig = getRemoteConfig(repository);
- if (remoteConfig == null) {
- IStatus status = new Status(IStatus.ERROR, EGitCoreActivator.PLUGIN_ID, NLS.bind(
- "Repository \"{0}\" has no remote repository configured", repository.toString()));
- throw new CoreException(status);
- }
- PushOperation pop = createPushOperation(repository, remoteConfig);
- pop.run(monitor);
- } catch (CoreException e) {
- throw e;
- } catch (Exception e) {
- IStatus status = new Status(IStatus.ERROR, EGitCoreActivator.PLUGIN_ID,
- NLS.bind("Could not push repo {0}", repository.toString()), e);
- throw new CoreException(status);
- }
- }
-
- private static PushOperation createPushOperation(String remoteName, Repository repository) {
- return new PushOperation(repository, remoteName, false, PUSH_TIMEOUT);
- }
-
- private static PushOperation createPushOperation(Repository repository, RemoteConfig remoteConfig)
- throws CoreException {
-
- PushOperationSpecification spec = new PushOperationSpecification();
- List<URIish> urisToPush = getPushURIs(remoteConfig);
- List<RefSpec> pushRefSpecs = getPushRefSpecs(remoteConfig);
- addURIRefToPushSpecification(urisToPush, pushRefSpecs, repository, spec);
-
- return new PushOperation(repository, spec, false, PUSH_TIMEOUT);
- }
-
- /**
- * Adds the given push uris to the given push operation specification.
- *
- * @param urisToPush
- * the uris to push
- * @param pushRefSpecs
- * the push ref specs
- * @param repository
- * the repository
- * @param spec
- * the spec
- * @throws CoreException
- * the core exception
- */
- private static void addURIRefToPushSpecification(List<URIish> urisToPush, List<RefSpec> pushRefSpecs,
- Repository repository, PushOperationSpecification spec) throws CoreException {
- for (URIish uri : urisToPush) {
- try {
- spec.addURIRefUpdates(uri,
- Transport.open(repository, uri).findRemoteRefUpdatesFor(pushRefSpecs));
- } catch (NotSupportedException e) {
- IStatus status =
- new Status(IStatus.ERROR, EGitCoreActivator.PLUGIN_ID, NLS.bind(
- "Could not connect repository \"{0}\" to a remote", repository.toString()), e);
- throw new CoreException(status);
- } catch (IOException e) {
- IStatus status = new Status(IStatus.ERROR, EGitCoreActivator.PLUGIN_ID, NLS.bind(
- "Could not convert remote specifications for repository \"{0}\" to a remote",
- repository.toString()), e);
- throw new CoreException(status);
- }
- }
- }
-
- /**
- * Gets the push uris from the given remoteConfig.
- *
- * @param remoteConfig
- * the remote config
- * @return the push ur is
- */
- private static List<URIish> getPushURIs(RemoteConfig remoteConfig) {
- List<URIish> urisToPush = new ArrayList<URIish>();
- for (URIish uri : remoteConfig.getPushURIs())
- urisToPush.add(uri);
- if (urisToPush.isEmpty() && !remoteConfig.getURIs().isEmpty())
- urisToPush.add(remoteConfig.getURIs().get(0));
- return urisToPush;
- }
-
- /**
- * Gets the push RefSpecs from the given remote configuration.
- *
- * @param config
- * the config
- * @return the push ref specs
- */
- private static List<RefSpec> getPushRefSpecs(RemoteConfig config) {
- List<RefSpec> pushRefSpecs = new ArrayList<RefSpec>();
- pushRefSpecs.addAll(config.getPushRefSpecs());
- if (pushRefSpecs.isEmpty()) {
- // default push to all branches
- pushRefSpecs.add(DEFAULT_PUSH_REF_SPEC);
- }
- return pushRefSpecs;
- }
-
- /**
- * Gets the repository that is configured to the given project.
- *
- * @param project
- * the project
- * @return the repository
- */
- private static Repository getRepository(IProject project) {
- RepositoryMapping repositoryMapping = RepositoryMapping.getMapping(project);
- if (repositoryMapping == null) {
- return null;
- }
- return repositoryMapping.getRepository();
- }
-
- /**
- * Gets the UserConfig from the given repository
- *
- * @param repository
- * the repository
- * @return the user config
- */
- private static UserConfig getUserConfig(Repository repository) {
- return repository.getConfig().get(UserConfig.KEY);
- }
-
- private static String getSubject(String name, String email) {
- return new StringBuilder().append(name).append(" <").append(email).append('>').toString();
- }
-
- /**
- * Returns the configuration of the remote repository that is set to the
- * given repository. Returns
- * <code>null</null> if none was configured or if there's no remote repo configured.
- *
- * @param repository
- * the repository to get the remote repo configuration from
- * @return the configurtion of the remote repository
- * @throws CoreException
- * the core exception
- */
- public static RemoteConfig getRemoteConfig(Repository repository) throws CoreException {
- String branch = null;
- try {
- branch = repository.getBranch();
- } catch (IOException e) {
- IStatus status = new Status(IStatus.ERROR, EGitCoreActivator.PLUGIN_ID,
- NLS.bind("Could not get branch on repository \"{0}\"", repository.toString()), e);
- throw new CoreException(status);
- }
-
- String remoteName = getRemoteName(repository, branch);
- List<RemoteConfig> allRemotes = getRemoteConfigs(repository);
- return getRemoteConfig(remoteName, allRemotes);
- }
-
- /**
- * Gets the remote config with the given name from the list of remote
- * repositories.
- *
- * @param remoteName
- * the remote name
- * @param remoteRepositories
- * the remote repositories
- * @return the remote config
- */
- private static RemoteConfig getRemoteConfig(String remoteName, List<RemoteConfig> remoteRepositories) {
- RemoteConfig defaultConfig = null;
- RemoteConfig configuredConfig = null;
- for (RemoteConfig config : remoteRepositories) {
- if (config.getName().equals(Constants.DEFAULT_REMOTE_NAME))
- defaultConfig = config;
- if (remoteName != null && config.getName().equals(remoteName))
- configuredConfig = config;
- }
-
- if (configuredConfig == null) {
- return defaultConfig;
- }
- return configuredConfig;
- }
-
- /**
- * Gets the remote configs from the given repository.
- *
- * @param repository
- * the repository
- * @return the remote configs
- */
- private static List<RemoteConfig> getRemoteConfigs(Repository repository) {
- List<RemoteConfig> remoteConfigs = new ArrayList<RemoteConfig>();
- try {
- remoteConfigs =
- RemoteConfig.getAllRemoteConfigs(repository.getConfig());
- } catch (URISyntaxException e) {
- remoteConfigs = new ArrayList<RemoteConfig>();
- }
- return remoteConfigs;
- }
-
- /**
- * Gets the name of the remote repository for a given repository and branch.
- *
- * @param repository
- * the repository
- * @param branch
- * the branch
- * @return the remote name
- */
- private static String getRemoteName(Repository repository, String branch) {
- String remoteName = null;
- if (ObjectId.isId(branch)) {
- remoteName = Constants.DEFAULT_REMOTE_NAME;
- } else {
- remoteName = repository.getConfig().getString(
- ConfigConstants.CONFIG_BRANCH_SECTION, branch,
- ConfigConstants.CONFIG_REMOTE_SECTION);
- }
- return remoteName;
- }
-}
14 years, 7 months
JBoss Tools SVN: r34086 - trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/project.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2011-08-19 04:21:18 -0400 (Fri, 19 Aug 2011)
New Revision: 34086
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/project/JBossSARModuleFactory.java
Log:
https://issues.jboss.org/browse/JBIDE-9016 - Tired of having Dennis yell at me
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/project/JBossSARModuleFactory.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/project/JBossSARModuleFactory.java 2011-08-19 01:32:55 UTC (rev 34085)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/project/JBossSARModuleFactory.java 2011-08-19 08:21:18 UTC (rev 34086)
@@ -14,6 +14,9 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
import org.eclipse.wst.common.componentcore.internal.flat.IChildModuleReference;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.common.project.facet.core.IFacetedProject;
@@ -21,7 +24,7 @@
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.web.internal.deployables.FlatComponentDeployable;
-import org.jboss.ide.eclipse.as.wtp.core.modules.JBTFlatModuleDelegate;
+import org.jboss.ide.eclipse.as.ui.mbeans.Activator;
import org.jboss.ide.eclipse.as.wtp.core.modules.JBTFlatProjectModuleFactory;
public class JBossSARModuleFactory extends JBTFlatProjectModuleFactory {
@@ -56,8 +59,11 @@
* if the project is closed, inaccessible, is not
* a faceted project, etc, it is not an error. The
* project simply cannot be handled by this factory.
+ *
+ * But I'll log it anyway :/
*/
-
+ Platform.getLog(Platform.getBundle(Activator.PLUGIN_ID)).log(
+ new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e));
}
return false;
14 years, 7 months