Author: adietish
Date: 2011-10-10 08:00:31 -0400 (Mon, 10 Oct 2011)
New Revision: 35510
Modified:
trunk/as/plugins/org.jboss.tools.openshift.express.ui/META-INF/MANIFEST.MF
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ServerAdapterWizard.java
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ServerAdapterWizardModel.java
Log:
[JBIDE-9793] cloning openshift repo
Modified: trunk/as/plugins/org.jboss.tools.openshift.express.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/META-INF/MANIFEST.MF 2011-10-10
11:01:36 UTC (rev 35509)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/META-INF/MANIFEST.MF 2011-10-10
12:00:31 UTC (rev 35510)
@@ -5,8 +5,9 @@
Bundle-Version: 2.3.0.qualifier
Bundle-Activator: org.jboss.tools.openshift.express.internal.ui.OpenshiftUIActivator
Require-Bundle:
org.jboss.tools.openshift.express.client;bundle-version="2.3.0",
+ org.jboss.ide.eclipse.as.egit.core;bundle-version="2.3.0",
org.eclipse.egit.core;bundle-version="[1.1.0,2.0.0)",
- org.eclipse.jgit;bundle-version="[1.1.0,2.0.0)",
+ org.eclipse.jgit,
org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.core.databinding;bundle-version="1.4.0",
Modified:
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java
===================================================================
---
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java 2011-10-10
11:01:36 UTC (rev 35509)
+++
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java 2011-10-10
12:00:31 UTC (rev 35510)
@@ -11,8 +11,16 @@
package org.jboss.tools.openshift.express.internal.ui.wizard;
import org.eclipse.core.databinding.DataBindingContext;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
public class AdapterWizardPage extends AbstractOpenshiftWizardPage implements IWizardPage
{
@@ -25,7 +33,37 @@
@Override
protected void doCreateControls(Composite parent, DataBindingContext dbc) {
- // TODO Auto-generated method stub
+ GridLayoutFactory.fillDefaults().applyTo(parent);
+
+ Group projectGroup = new Group(parent, SWT.BORDER);
+ projectGroup.setText("Project setup");
+ GridDataFactory.fillDefaults()
+ .align(SWT.LEFT, SWT.CENTER).align(SWT.FILL, SWT.CENTER).grab(true,
false).applyTo(projectGroup);
+ GridLayoutFactory.fillDefaults().margins(6, 6).numColumns(2).applyTo(projectGroup);
+
+ Label projectNameLabel = new Label(projectGroup, SWT.NONE);
+ GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(projectNameLabel);
+ projectNameLabel.setText("Project name");
+ Text projectNameText = new Text(projectGroup, SWT.BORDER);
+ GridDataFactory.fillDefaults()
+ .align(SWT.LEFT, SWT.CENTER).align(SWT.FILL, SWT.CENTER).grab(true,
false).applyTo(projectNameText);
+
+ Label branchNameLabel = new Label(projectGroup, SWT.NONE);
+ branchNameLabel.setText("Name of remote branch");
+ GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(branchNameLabel);
+ Text branchNameText = new Text(projectGroup, SWT.BORDER);
+ GridDataFactory.fillDefaults()
+ .align(SWT.LEFT, SWT.CENTER).align(SWT.FILL, SWT.CENTER).grab(true,
false).applyTo(branchNameText);
+
+ Group serverAdapterGroup = new Group(parent, SWT.BORDER);
+ serverAdapterGroup.setText("JBoss Server adapter");
+ GridDataFactory.fillDefaults()
+ .align(SWT.LEFT, SWT.CENTER).align(SWT.FILL, SWT.FILL).grab(true,
false).applyTo(serverAdapterGroup);
+ FillLayout fillLayout = new FillLayout();
+ fillLayout.marginHeight = 6;
+ fillLayout.marginWidth = 6;
+ serverAdapterGroup.setLayout(fillLayout);
+ Button serverAdapterCheckbox = new Button(serverAdapterGroup, SWT.CHECK);
+ serverAdapterCheckbox.setText("Create a JBoss server adapter");
}
-
}
Modified:
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ServerAdapterWizard.java
===================================================================
---
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ServerAdapterWizard.java 2011-10-10
11:01:36 UTC (rev 35509)
+++
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ServerAdapterWizard.java 2011-10-10
12:00:31 UTC (rev 35510)
@@ -52,7 +52,7 @@
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
- model.createGitClone();
+ model.setupProject();
return Status.OK_STATUS;
} catch (OpenshiftException e) {
return new Status(IStatus.ERROR, OpenshiftUIActivator.PLUGIN_ID,
Modified:
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ServerAdapterWizardModel.java
===================================================================
---
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ServerAdapterWizardModel.java 2011-10-10
11:01:36 UTC (rev 35509)
+++
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ServerAdapterWizardModel.java 2011-10-10
12:00:31 UTC (rev 35510)
@@ -11,14 +11,18 @@
package org.jboss.tools.openshift.express.internal.ui.wizard;
import java.io.File;
+import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
-import java.net.MalformedURLException;
import java.net.URISyntaxException;
-import java.net.URL;
import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.egit.core.op.CloneOperation;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jgit.api.Git;
+import org.eclipse.jgit.api.InitCommand;
+import org.eclipse.jgit.lib.Constants;
+import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.transport.URIish;
+import org.jboss.ide.eclipse.as.egit.core.EGitUtils;
import org.jboss.tools.common.ui.databinding.ObservableUIPojo;
import org.jboss.tools.openshift.express.client.IApplication;
import org.jboss.tools.openshift.express.client.IUser;
@@ -48,12 +52,26 @@
this.application = application;
}
- public void createGitClone() throws OpenshiftException, URISyntaxException,
InvocationTargetException, InterruptedException {
+ public void setupProject() throws OpenshiftException, URISyntaxException,
InvocationTargetException, InterruptedException, IOException {
String applicationWorkingdir = "openshift-" + application.getName();
- File workspace = ResourcesPlugin.getWorkspace().getRoot().getLocation().toFile();
- File workDir = new File(workspace, applicationWorkingdir);
- URIish gitUri = new URIish(application.getGitUri());
- new CloneOperation(gitUri, true, null, workDir, "refs/heads/*",
"master", 10 * 1024).run(null);
+// File workspace = ResourcesPlugin.getWorkspace().getRoot().getLocation().toFile();
+// File workDir = new File(workspace, applicationWorkingdir);
+// URIish gitUri = new URIish(application.getGitUri());
+// new CloneOperation(gitUri, true, null, workDir, "refs/heads/*",
"master", 10 * 1024).run(null);
+ Repository repository = createRepository(applicationWorkingdir);
+ // TODO replace remote name by user setting
+ EGitUtils.addRemoteTo("openshift", new URIish(application.getGitUri()),
repository);
}
+
+ private Repository createRepository(String name) throws IOException {
+ InitCommand init = Git.init();
+ IPath workspace = ResourcesPlugin.getWorkspace().getRoot().getLocation();
+ IPath gitRepoProject = workspace.append(name);
+ File repositoryFile = new File(gitRepoProject.toFile(), Constants.DOT_GIT);
+ init.setDirectory(repositoryFile);
+ init.setBare(false);
+ Git git = init.call();
+ return git.getRepository();
+ }
}