From: Debayan Sutradhar Date: Mon, 07 Jun 2021 23:19:20 +0530 Subject: add gitaction to git --- add gitaction to git --- --- /dev/null +++ b/gitclone/pom.xml @@ -0,0 +1,95 @@ + + + 4.0.0 + + com.stream-pi + gitclone + 1.0.0 + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.1.0 + + + test-jar + package + + test-jar + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 11 + + + + + + + 1.0.0-SNAPSHOT + + 16-ea+6 + + UTF-8 + 11 + 11 + + + + + + org.eclipse.jgit + org.eclipse.jgit + 5.9.0.202009080501-r + + + + org.openjfx + javafx-controls + ${JavaFXVersion} + + + + org.openjfx + javafx-graphics + ${JavaFXVersion} + + + + org.openjfx + javafx-base + ${JavaFXVersion} + + + + + + com.stream-pi + action-api + ${ActionAPIVersion} + + + + + + + org.kordamp.ikonli + ikonli-material-pack + 11.5.0 + + + + + + --- /dev/null +++ b/gitclone/src/main/java/com/stream_pi/gitclone/GitClone.java @@ -0,0 +1,68 @@ +package com.stream_pi.gitclone; + +import com.stream_pi.action_api.actionproperty.property.ControlType; +import com.stream_pi.action_api.actionproperty.property.FileExtensionFilter; +import com.stream_pi.action_api.actionproperty.property.Property; +import com.stream_pi.action_api.actionproperty.property.Type; +import com.stream_pi.action_api.externalplugin.NormalAction; +import com.stream_pi.util.alert.StreamPiAlert; +import com.stream_pi.util.exception.MinorException; +import com.stream_pi.util.version.Version; +import javafx.scene.control.Button; + +import java.io.File; + +import org.eclipse.jgit.api.CloneCommand; +import org.eclipse.jgit.api.Git; +import org.eclipse.jgit.api.errors.GitAPIException; +import org.eclipse.jgit.api.errors.InvalidRemoteException; +import org.eclipse.jgit.api.errors.TransportException; + +public class GitClone extends NormalAction +{ + + private Git call; + + + public GitClone() + { + setName("Git - Git Clone"); + setAuthor("quimodotcom"); + setHelpLink("https://github.com/quimodotcom/essentialactions"); + setServerButtonGraphic("fas-git"); + setVersion(new Version(1,0,1)); + + setCategory("Git Integration"); + + } + + @Override + public void initProperties() throws Exception { + //Called First + + Property property1 = new Property("cloneURL", Type.STRING); + property1.setDefaultValueStr("https://hmmmmyummy.com/somegitrepo"); + property1.setDisplayName("Git Repo URL"); + + Property property2 = new Property("path", Type.STRING); + property2.setDisplayName("Output Path"); + + + addClientProperties( + property1, + property2 + ); + } + + + @Override + public void onActionClicked() throws MinorException, InvalidRemoteException, TransportException, GitAPIException + { + CloneCommand git = Git.cloneRepository(); + Property property1 = getClientProperties().getSingleProperty("cloneURL"); + git.setURI(property1.getStringValue()); + git.setDirectory(new File(getClientProperties().getSingleProperty("path").getStringValue())); + git.setCloneAllBranches(true); + git.call(); + } +} --- /dev/null +++ b/gitclone/src/main/java/module-info.java @@ -0,0 +1,7 @@ +module com.stream_pi.gitclone +{ + requires com.stream_pi.action_api; + requires org.kordamp.ikonli.javafx; + requires org.eclipse.jgit; + provides com.stream_pi.action_api.externalplugin.ExternalPlugin with com.stream_pi.gitclone.GitClone; +}