Author: adietish
Date: 2012-01-10 08:13:30 -0500 (Tue, 10 Jan 2012)
New Revision: 37741
Added:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ConfigureGitSharedProject.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ConfigureUnsharedProject.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportNewProject.java
Removed:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/AddToExistingProjectOperation.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportNewProjectOperation.java
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardModel.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewApplicationWizardPage.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportProjectWizardModel.java
Log:
[JBIDE-10479] renamed AddToExistingProjectOperation -> ConfigureUnsharedProject, added
ConfigureGitSharedProject
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardModel.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardModel.java 2012-01-10
13:04:24 UTC (rev 37740)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardModel.java 2012-01-10
13:13:30 UTC (rev 37741)
@@ -78,7 +78,7 @@
}
public IApplication createApplication(String name, ICartridge cartridge,
IProgressMonitor monitor) throws OpenShiftException {
- monitor.subTask("creating application...");
+// monitor.subTask("creating application...");
IApplication application = getUser().createApplication(name, cartridge);
waitForAccessible(application, monitor);
return application;
@@ -89,7 +89,7 @@
}
private void waitForAccessible(IApplication application, IProgressMonitor monitor)
throws OpenShiftApplicationNotAvailableException, OpenShiftException {
- monitor.subTask("waiting for application to become accessible...");
+// monitor.subTask("waiting for application to become accessible...");
if (!application.waitForAccessible(APP_CREATION_TIMEOUT * 1000)) {
throw new OpenShiftApplicationNotAvailableException(NLS.bind(
OpenShiftExpressUIMessages.HOSTNAME_NOT_ANSWERING,
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewApplicationWizardPage.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewApplicationWizardPage.java 2012-01-10
13:04:24 UTC (rev 37740)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewApplicationWizardPage.java 2012-01-10
13:13:30 UTC (rev 37741)
@@ -169,7 +169,7 @@
public boolean createApplication() {
final DelegatingProgressMonitor delegatingMonitor = new DelegatingProgressMonitor();
- Job job = new Job(NLS.bind("New application {0}", wizardModel.getName())) {
+ Job job = new Job(NLS.bind("Creating new application {0}",
wizardModel.getName())) {
@Override
protected IStatus run(IProgressMonitor monitor) {
@@ -184,6 +184,8 @@
return OpenShiftUIActivator.createErrorStatus(
"Could not create application \"{0}\"",
(Throwable) e, wizardModel.getName());
+ } finally {
+ delegatingMonitor.done();
}
}
};
@@ -191,6 +193,7 @@
Future<IStatus> jobResult = WizardUtils.runInWizard(job, delegatingMonitor,
getContainer());
return JobUtils.isOk(jobResult.get(10, TimeUnit.SECONDS));
} catch (Exception e) {
+ OpenShiftUIActivator.log(e);
return false;
}
}
Deleted:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/AddToExistingProjectOperation.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/AddToExistingProjectOperation.java 2012-01-10
13:04:24 UTC (rev 37740)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/AddToExistingProjectOperation.java 2012-01-10
13:13:30 UTC (rev 37741)
@@ -1,166 +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.tools.openshift.express.internal.ui.wizard.appimport;
-
-import java.io.File;
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.net.MalformedURLException;
-import java.net.URISyntaxException;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jgit.lib.Repository;
-import org.eclipse.jgit.transport.URIish;
-import org.eclipse.osgi.util.NLS;
-import org.jboss.ide.eclipse.as.core.util.FileUtil;
-import org.jboss.tools.openshift.egit.core.EGitUtils;
-import org.jboss.tools.openshift.egit.core.GitIgnore;
-import org.jboss.tools.openshift.express.internal.ui.utils.FileUtils;
-
-import com.openshift.express.client.IApplication;
-import com.openshift.express.client.IUser;
-import com.openshift.express.client.OpenShiftException;
-
-/**
- * @author André Dietisheim <adietish(a)redhat.com>
- */
-public class AddToExistingProjectOperation extends AbstractImportApplicationOperation {
-
- public AddToExistingProjectOperation(String projectName, IApplication application,
String remoteName,
- IUser user) {
- super(projectName, application, remoteName);
- }
-
- /**
- * Enables the user chosen project to be used on the chosen OpenShift
- * application. Clones the application git repository, copies the
- * configuration files to the user project (in the workspace), shares the
- * user project with git and creates the server adapter.
- *
- * @param monitor
- * the monitor to report progress to
- * @return
- * @throws URISyntaxException
- * The OpenShift application repository could not be cloned,
- * because the uri it is located at is not a valid git uri
- * @throws OpenShiftException
- *
- * @throws InvocationTargetException
- * The OpenShift application repository could not be cloned, the
- * clone operation failed.
- * @throws InterruptedException
- * The OpenShift application repository could not be cloned, the
- * clone operation was interrupted.
- * @throws IOException
- * The configuration files could not be copied from the git
- * clone to the user project
- * @throws CoreException
- * The user project could not be shared with the git
- *
- * @see #cloneRepository
- * @see #copyOpenshiftConfiguration
- * @see #shareProject
- * @see #createServerAdapterIfRequired
- */
- @Override
- public List<IProject> execute(IProgressMonitor monitor)
- throws OpenShiftException, InvocationTargetException, InterruptedException,
IOException, CoreException,
- URISyntaxException {
- // File repositoryFile =
- // model.cloneRepository(monitor);
- // model.importProject(repositoryFile, monitor);
- // Repository repository =
- // model.shareProject(monitor);
- // model.mergeWithApplicationRepository(repository,
- // monitor);
- File tmpFolder = FileUtils.getRandomTmpFolder();
- File repositoryFile = cloneRepository(getApplication(), getRemoteName(), tmpFolder,
monitor);
- IProject project = getProject(getProjectName());
- copyOpenshiftConfigurations(repositoryFile, project, monitor);
- FileUtil.safeDelete(tmpFolder);
-
- shareProject(project, monitor);
- return Collections.singletonList(project);
- }
-
- private void shareProject(IProject project, IProgressMonitor monitor) throws
CoreException {
- monitor.subTask(NLS.bind("Sharing project {0}...", project.getName()));
- EGitUtils.share(project, monitor);
- }
-
- /**
- * Copies the openshift configuration from the given source folder to the
- * given project. Copies
- * <ul>
- * <li>.git</li>
- * <li>.openshift</li>
- * <li>deployments</li>
- * <li>pom.xml</li>
- * </ul>
- * to the project in the workspace
- *
- * @param sourceFolder
- * the source to copy the openshift config from
- * @param project
- * the project to copy the configuration to.
- * @param monitor
- * the monitor to report progress to
- * @throws IOException
- */
- private void copyOpenshiftConfigurations(final File sourceFolder, IProject project,
IProgressMonitor monitor)
- throws IOException {
- Assert.isLegal(project != null);
- File projectFolder = project.getLocation().toFile();
- monitor.subTask(NLS.bind("Copying openshift configuration to project {0}...",
project.getName()));
- FileUtils.copy(new File(sourceFolder, ".git"), projectFolder, false);
- FileUtils.copy(new File(sourceFolder, ".openshift"), projectFolder, false);
- FileUtils.copy(new File(sourceFolder, "deployments"), projectFolder, false);
- FileUtils.copy(new File(sourceFolder, "pom.xml"), projectFolder, false);
- createGitIgnore(projectFolder);
- }
-
- /**
- * Creates the git ignore file with a predefined set of entries. An existing
- * .gitignore file is not overwritten, we then just dont do anything.
- *
- * @param projectFolder
- * @throws IOException
- */
- private void createGitIgnore(File projectFolder) throws IOException {
- GitIgnore gitIgnore = new GitIgnore(projectFolder);
- // TODO: merge existing .gitignore
- // (
https://issues.jboss.org/browse/JBIDE-10391)
- if (gitIgnore.exists()) {
- return;
- }
- gitIgnore.add("target")
- .add(".settings")
- .add(".project")
- .add(".classpath")
- .add(".factorypath");
- gitIgnore.write(false);
- }
-
- @SuppressWarnings("unused")
- private void mergeWithApplicationRepository(Repository repository, IApplication
application,
- IProgressMonitor monitor)
- throws MalformedURLException, URISyntaxException, IOException, OpenShiftException,
CoreException,
- InvocationTargetException {
- URIish uri = new URIish(application.getGitUri());
- EGitUtils.addRemoteTo("openshift", uri, repository);
- EGitUtils.mergeWithRemote(uri, "refs/remotes/openshift/HEAD", repository,
monitor);
- }
-}
Added:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ConfigureGitSharedProject.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ConfigureGitSharedProject.java
(rev 0)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ConfigureGitSharedProject.java 2012-01-10
13:13:30 UTC (rev 37741)
@@ -0,0 +1,142 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.ui.wizard.appimport;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.net.MalformedURLException;
+import java.net.URISyntaxException;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jgit.lib.Repository;
+import org.eclipse.jgit.transport.URIish;
+import org.eclipse.osgi.util.NLS;
+import org.jboss.ide.eclipse.as.core.util.FileUtil;
+import org.jboss.tools.openshift.egit.core.EGitUtils;
+import org.jboss.tools.openshift.egit.core.GitIgnore;
+import org.jboss.tools.openshift.express.internal.ui.utils.FileUtils;
+
+import com.openshift.express.client.IApplication;
+import com.openshift.express.client.IUser;
+import com.openshift.express.client.OpenShiftException;
+
+/**
+ * @author André Dietisheim <adietish(a)redhat.com>
+ */
+public class ConfigureGitSharedProject extends AbstractImportApplicationOperation {
+
+ public ConfigureGitSharedProject(String projectName, IApplication application, String
remoteName,
+ IUser user) {
+ super(projectName, application, remoteName);
+ }
+
+ /**
+ * Enables the user chosen project to be used on the chosen OpenShift
+ * application. Clones the application git repository, copies the
+ * configuration files to the user project (in the workspace), shares the
+ * user project with git and creates the server adapter.
+ *
+ * @param monitor
+ * the monitor to report progress to
+ * @return
+ * @throws URISyntaxException
+ * The OpenShift application repository could not be cloned,
+ * because the uri it is located at is not a valid git uri
+ * @throws OpenShiftException
+ *
+ * @throws InvocationTargetException
+ * The OpenShift application repository could not be cloned, the
+ * clone operation failed.
+ * @throws InterruptedException
+ * The OpenShift application repository could not be cloned, the
+ * clone operation was interrupted.
+ * @throws IOException
+ * The configuration files could not be copied from the git
+ * clone to the user project
+ * @throws CoreException
+ * The user project could not be shared with the git
+ *
+ * @see #cloneRepository
+ * @see #copyOpenshiftConfiguration
+ * @see #shareProject
+ * @see #createServerAdapterIfRequired
+ */
+ @Override
+ public List<IProject> execute(IProgressMonitor monitor)
+ throws OpenShiftException, InvocationTargetException, InterruptedException,
IOException, CoreException,
+ URISyntaxException {
+ IProject project = getProject(getProjectName());
+ Assert.isTrue(EGitUtils.isSharedWithGit(project));
+
+ File tmpFolder = FileUtils.getRandomTmpFolder();
+ File repositoryFile = cloneRepository(getApplication(), getRemoteName(), tmpFolder,
monitor);
+ copyOpenshiftConfigurations(repositoryFile, project, monitor);
+ FileUtil.safeDelete(tmpFolder);
+
+ return Collections.singletonList(project);
+ }
+
+ /**
+ * Copies the openshift configuration from the given source folder to the
+ * given project. Copies
+ * <ul>
+ * <li>.openshift</li>
+ * <li>deployments</li>
+ * <li>pom.xml</li>
+ * </ul>
+ * to the project in the workspace
+ *
+ * @param sourceFolder
+ * the source to copy the openshift config from
+ * @param project
+ * the project to copy the configuration to.
+ * @param monitor
+ * the monitor to report progress to
+ * @throws IOException
+ */
+ private void copyOpenshiftConfigurations(final File sourceFolder, IProject project,
IProgressMonitor monitor)
+ throws IOException {
+ Assert.isLegal(project != null);
+ File projectFolder = project.getLocation().toFile();
+ monitor.subTask(NLS.bind("Copying openshift configuration to project {0}...",
project.getName()));
+ FileUtils.copy(new File(sourceFolder, ".openshift"), projectFolder, false);
+ FileUtils.copy(new File(sourceFolder, "deployments"), projectFolder, false);
+ createGitIgnore(projectFolder);
+ }
+
+ /**
+ * Creates the git ignore file with a predefined set of entries. An existing
+ * .gitignore file is not overwritten, we then just dont do anything.
+ *
+ * @param projectFolder
+ * @throws IOException
+ */
+ private void createGitIgnore(File projectFolder) throws IOException {
+ GitIgnore gitIgnore = new GitIgnore(projectFolder);
+ // TODO: merge existing .gitignore
+ // (
https://issues.jboss.org/browse/JBIDE-10391)
+ if (gitIgnore.exists()) {
+ return;
+ }
+ gitIgnore.add("target")
+ .add(".settings")
+ .add(".project")
+ .add(".classpath")
+ .add(".factorypath");
+ gitIgnore.write(false);
+ }
+}
Property changes on:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ConfigureGitSharedProject.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ConfigureUnsharedProject.java
(from rev 37726,
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/AddToExistingProjectOperation.java)
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ConfigureUnsharedProject.java
(rev 0)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ConfigureUnsharedProject.java 2012-01-10
13:13:30 UTC (rev 37741)
@@ -0,0 +1,162 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.ui.wizard.appimport;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.net.URISyntaxException;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osgi.util.NLS;
+import org.jboss.ide.eclipse.as.core.util.FileUtil;
+import org.jboss.tools.openshift.egit.core.EGitUtils;
+import org.jboss.tools.openshift.egit.core.GitIgnore;
+import org.jboss.tools.openshift.express.internal.ui.utils.FileUtils;
+
+import com.openshift.express.client.IApplication;
+import com.openshift.express.client.IUser;
+import com.openshift.express.client.OpenShiftException;
+
+/**
+ * @author André Dietisheim <adietish(a)redhat.com>
+ */
+public class ConfigureUnsharedProject extends AbstractImportApplicationOperation {
+
+ public ConfigureUnsharedProject(String projectName, IApplication application, String
remoteName,
+ IUser user) {
+ super(projectName, application, remoteName);
+ }
+
+ /**
+ * Enables the user chosen project to be used on the chosen OpenShift
+ * application. Clones the application git repository, copies the
+ * configuration files to the user project (in the workspace), shares the
+ * user project with git and creates the server adapter.
+ *
+ * @param monitor
+ * the monitor to report progress to
+ * @return
+ * @throws URISyntaxException
+ * The OpenShift application repository could not be cloned,
+ * because the uri it is located at is not a valid git uri
+ * @throws OpenShiftException
+ *
+ * @throws InvocationTargetException
+ * The OpenShift application repository could not be cloned, the
+ * clone operation failed.
+ * @throws InterruptedException
+ * The OpenShift application repository could not be cloned, the
+ * clone operation was interrupted.
+ * @throws IOException
+ * The configuration files could not be copied from the git
+ * clone to the user project
+ * @throws CoreException
+ * The user project could not be shared with the git
+ *
+ * @see #cloneRepository
+ * @see #copyOpenshiftConfiguration
+ * @see #shareProject
+ * @see #createServerAdapterIfRequired
+ */
+ @Override
+ public List<IProject> execute(IProgressMonitor monitor)
+ throws OpenShiftException, InvocationTargetException, InterruptedException,
IOException, CoreException,
+ URISyntaxException {
+ // File repositoryFile =
+ // model.cloneRepository(monitor);
+ // model.importProject(repositoryFile, monitor);
+ // Repository repository =
+ // model.shareProject(monitor);
+ // model.mergeWithApplicationRepository(repository,
+ // monitor);
+ File tmpFolder = FileUtils.getRandomTmpFolder();
+ File repositoryFile = cloneRepository(getApplication(), getRemoteName(), tmpFolder,
monitor);
+ IProject project = getProject(getProjectName());
+ copyOpenshiftConfigurations(repositoryFile, project, monitor);
+ FileUtil.safeDelete(tmpFolder);
+
+ shareProject(project, monitor);
+ return Collections.singletonList(project);
+ }
+
+ private void shareProject(IProject project, IProgressMonitor monitor) throws
CoreException {
+ monitor.subTask(NLS.bind("Sharing project {0}...", project.getName()));
+ EGitUtils.share(project, monitor);
+ }
+
+ /**
+ * Copies the openshift configuration from the given source folder to the
+ * given project. Copies
+ * <ul>
+ * <li>.git</li>
+ * <li>.openshift</li>
+ * <li>deployments</li>
+ * <li>pom.xml</li>
+ * </ul>
+ * to the project in the workspace
+ *
+ * @param sourceFolder
+ * the source to copy the openshift config from
+ * @param project
+ * the project to copy the configuration to.
+ * @param monitor
+ * the monitor to report progress to
+ * @throws IOException
+ */
+ private void copyOpenshiftConfigurations(final File sourceFolder, IProject project,
IProgressMonitor monitor)
+ throws IOException {
+ Assert.isLegal(project != null);
+ File projectFolder = project.getLocation().toFile();
+ monitor.subTask(NLS.bind("Copying openshift configuration to project {0}...",
project.getName()));
+ FileUtils.copy(new File(sourceFolder, ".git"), projectFolder, false);
+ FileUtils.copy(new File(sourceFolder, ".openshift"), projectFolder, false);
+ FileUtils.copy(new File(sourceFolder, "deployments"), projectFolder, false);
+ FileUtils.copy(new File(sourceFolder, "pom.xml"), projectFolder, false);
+ createGitIgnore(projectFolder);
+ }
+
+ /**
+ * Creates the git ignore file with a predefined set of entries. An existing
+ * .gitignore file is not overwritten, we then just dont do anything.
+ *
+ * @param projectFolder
+ * @throws IOException
+ */
+ private void createGitIgnore(File projectFolder) throws IOException {
+ GitIgnore gitIgnore = new GitIgnore(projectFolder);
+ // TODO: merge existing .gitignore
+ // (
https://issues.jboss.org/browse/JBIDE-10391)
+ if (gitIgnore.exists()) {
+ return;
+ }
+ gitIgnore.add("target")
+ .add(".settings")
+ .add(".project")
+ .add(".classpath")
+ .add(".factorypath");
+ gitIgnore.write(false);
+ }
+
+// private void mergeWithApplicationRepository(Repository repository, IApplication
application,
+// IProgressMonitor monitor)
+// throws MalformedURLException, URISyntaxException, IOException, OpenShiftException,
CoreException,
+// InvocationTargetException {
+// URIish uri = new URIish(application.getGitUri());
+// EGitUtils.addRemoteTo("openshift", uri, repository);
+// EGitUtils.mergeWithRemote(uri, "refs/remotes/openshift/HEAD", repository,
monitor);
+// }
+}
Property changes on:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ConfigureUnsharedProject.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportNewProject.java
(from rev 37719,
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportNewProjectOperation.java)
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportNewProject.java
(rev 0)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportNewProject.java 2012-01-10
13:13:30 UTC (rev 37741)
@@ -0,0 +1,138 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.ui.wizard.appimport;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.net.MalformedURLException;
+import java.net.URISyntaxException;
+import java.util.Collections;
+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.jgit.lib.Repository;
+import org.eclipse.jgit.transport.URIish;
+import org.eclipse.osgi.util.NLS;
+import org.jboss.tools.openshift.egit.core.EGitUtils;
+import org.jboss.tools.openshift.express.internal.ui.ImportFailedException;
+import org.jboss.tools.openshift.express.internal.ui.WontOverwriteException;
+import
org.jboss.tools.openshift.express.internal.ui.wizard.appimport.project.GeneralProjectImportOperation;
+import
org.jboss.tools.openshift.express.internal.ui.wizard.appimport.project.MavenProjectImportOperation;
+
+import com.openshift.express.client.IApplication;
+import com.openshift.express.client.OpenShiftException;
+
+/**
+ * @author André Dietisheim <adietish(a)redhat.com>
+ */
+public class ImportNewProject extends AbstractImportApplicationOperation {
+
+ private File cloneDestination;
+
+ public ImportNewProject(String projectName, IApplication application, String
remoteName,
+ File cloneDestination) {
+ super(projectName, application, remoteName);
+ this.cloneDestination = cloneDestination;
+ }
+
+ /**
+ * Imports the (new) project that the user has chosen into the workspace.
+ *
+ * @param monitor
+ * the monitor to report progress to
+ * @throws OpenShiftException
+ * @throws CoreException
+ * @throws InterruptedException
+ * @throws URISyntaxException
+ * @throws InvocationTargetException
+ */
+ public List<IProject> execute(IProgressMonitor monitor)
+ throws OpenShiftException, CoreException, InterruptedException, URISyntaxException,
+ InvocationTargetException {
+ if (cloneDestinationExists()) {
+ throw new WontOverwriteException(
+ NLS.bind("There's already a folder at {0}. The new OpenShift project would
overwrite it. " +
+ "Please choose another destination to clone to.",
+ getCloneDestination().getAbsolutePath()));
+ }
+
+ File repositoryFolder =
+ cloneRepository(getApplication(), getRemoteName(), cloneDestination, monitor);
+ List<IProject> importedProjects = importProjectsFrom(repositoryFolder, monitor);
+ if (importedProjects.size() == 0) {
+ throw new ImportFailedException(
+ NLS.bind("Could not import project {0}. One of the possible reasons is that
there's already a " +
+ "project in your workspace that matches the openshift application/maven name
of the " +
+ "OpenShift application. " +
+ "Please rename your workspace project in that case and start over
again."
+ , getProjectName()));
+ }
+
+ connectToGitRepo(importedProjects, repositoryFolder, monitor);
+ return importedProjects;
+ }
+
+ @SuppressWarnings("unused")
+ private void mergeWithApplicationRepository(Repository repository, IApplication
application,
+ IProgressMonitor monitor)
+ throws MalformedURLException, URISyntaxException, IOException, OpenShiftException,
CoreException,
+ InvocationTargetException {
+ URIish uri = new URIish(application.getGitUri());
+ EGitUtils.addRemoteTo("openshift", uri, repository);
+ EGitUtils.mergeWithRemote(uri, "refs/remotes/openshift/HEAD", repository,
monitor);
+ }
+
+ /**
+ * Imports the projects that are within the given folder. Supports maven and
+ * general projects
+ *
+ * @param folder
+ * the folder the projects are located in
+ * @param monitor
+ * the monitor to report progress to
+ * @return
+ * @throws CoreException
+ * @throws InterruptedException
+ */
+ private List<IProject> importProjectsFrom(final File folder, IProgressMonitor
monitor)
+ throws CoreException, InterruptedException {
+ MavenProjectImportOperation mavenImport = new MavenProjectImportOperation(folder);
+ List<IProject> importedProjects = Collections.emptyList();
+ if (mavenImport.isMavenProject()) {
+ importedProjects = mavenImport.importToWorkspace(monitor);
+ } else {
+ importedProjects = new
GeneralProjectImportOperation(folder).importToWorkspace(monitor);
+ }
+ return importedProjects;
+ }
+
+ private void connectToGitRepo(List<IProject> projects, File projectFolder,
IProgressMonitor monitor)
+ throws CoreException {
+ for (IProject project : projects) {
+ if (project != null) {
+ EGitUtils.connect(project, monitor);
+ }
+ }
+ }
+
+ protected File getCloneDestination() {
+ return cloneDestination;
+ }
+
+ protected boolean cloneDestinationExists() {
+ return cloneDestination != null
+ && cloneDestination.exists();
+ }
+
+}
Property changes on:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportNewProject.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Deleted:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportNewProjectOperation.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportNewProjectOperation.java 2012-01-10
13:04:24 UTC (rev 37740)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportNewProjectOperation.java 2012-01-10
13:13:30 UTC (rev 37741)
@@ -1,138 +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.tools.openshift.express.internal.ui.wizard.appimport;
-
-import java.io.File;
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.net.MalformedURLException;
-import java.net.URISyntaxException;
-import java.util.Collections;
-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.jgit.lib.Repository;
-import org.eclipse.jgit.transport.URIish;
-import org.eclipse.osgi.util.NLS;
-import org.jboss.tools.openshift.egit.core.EGitUtils;
-import org.jboss.tools.openshift.express.internal.ui.ImportFailedException;
-import org.jboss.tools.openshift.express.internal.ui.WontOverwriteException;
-import
org.jboss.tools.openshift.express.internal.ui.wizard.appimport.project.GeneralProjectImportOperation;
-import
org.jboss.tools.openshift.express.internal.ui.wizard.appimport.project.MavenProjectImportOperation;
-
-import com.openshift.express.client.IApplication;
-import com.openshift.express.client.OpenShiftException;
-
-/**
- * @author André Dietisheim <adietish(a)redhat.com>
- */
-public class ImportNewProjectOperation extends AbstractImportApplicationOperation {
-
- private File cloneDestination;
-
- public ImportNewProjectOperation(String projectName, IApplication application, String
remoteName,
- File cloneDestination) {
- super(projectName, application, remoteName);
- this.cloneDestination = cloneDestination;
- }
-
- /**
- * Imports the (new) project that the user has chosen into the workspace.
- *
- * @param monitor
- * the monitor to report progress to
- * @throws OpenShiftException
- * @throws CoreException
- * @throws InterruptedException
- * @throws URISyntaxException
- * @throws InvocationTargetException
- */
- public List<IProject> execute(IProgressMonitor monitor)
- throws OpenShiftException, CoreException, InterruptedException, URISyntaxException,
- InvocationTargetException {
- if (cloneDestinationExists()) {
- throw new WontOverwriteException(
- NLS.bind("There's already a folder at {0}. The new OpenShift project would
overwrite it. " +
- "Please choose another destination to clone to.",
- getCloneDestination().getAbsolutePath()));
- }
-
- File repositoryFolder =
- cloneRepository(getApplication(), getRemoteName(), cloneDestination, monitor);
- List<IProject> importedProjects = importProjectsFrom(repositoryFolder, monitor);
- if (importedProjects.size() == 0) {
- throw new ImportFailedException(
- NLS.bind("Could not import project {0}. One of the possible reasons is that
there's already a " +
- "project in your workspace that matches the openshift application/maven name
of the " +
- "OpenShift application. " +
- "Please rename your workspace project in that case and start over
again."
- , getProjectName()));
- }
-
- connectToGitRepo(importedProjects, repositoryFolder, monitor);
- return importedProjects;
- }
-
- @SuppressWarnings("unused")
- private void mergeWithApplicationRepository(Repository repository, IApplication
application,
- IProgressMonitor monitor)
- throws MalformedURLException, URISyntaxException, IOException, OpenShiftException,
CoreException,
- InvocationTargetException {
- URIish uri = new URIish(application.getGitUri());
- EGitUtils.addRemoteTo("openshift", uri, repository);
- EGitUtils.mergeWithRemote(uri, "refs/remotes/openshift/HEAD", repository,
monitor);
- }
-
- /**
- * Imports the projects that are within the given folder. Supports maven and
- * general projects
- *
- * @param folder
- * the folder the projects are located in
- * @param monitor
- * the monitor to report progress to
- * @return
- * @throws CoreException
- * @throws InterruptedException
- */
- private List<IProject> importProjectsFrom(final File folder, IProgressMonitor
monitor)
- throws CoreException, InterruptedException {
- MavenProjectImportOperation mavenImport = new MavenProjectImportOperation(folder);
- List<IProject> importedProjects = Collections.emptyList();
- if (mavenImport.isMavenProject()) {
- importedProjects = mavenImport.importToWorkspace(monitor);
- } else {
- importedProjects = new
GeneralProjectImportOperation(folder).importToWorkspace(monitor);
- }
- return importedProjects;
- }
-
- private void connectToGitRepo(List<IProject> projects, File projectFolder,
IProgressMonitor monitor)
- throws CoreException {
- for (IProject project : projects) {
- if (project != null) {
- EGitUtils.connect(project, monitor);
- }
- }
- }
-
- protected File getCloneDestination() {
- return cloneDestination;
- }
-
- protected boolean cloneDestinationExists() {
- return cloneDestination != null
- && cloneDestination.exists();
- }
-
-}
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportProjectWizardModel.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportProjectWizardModel.java 2012-01-10
13:04:24 UTC (rev 37740)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportProjectWizardModel.java 2012-01-10
13:13:30 UTC (rev 37741)
@@ -65,7 +65,7 @@
*/
public void importProject(IProgressMonitor monitor) throws OpenShiftException,
CoreException, InterruptedException,
URISyntaxException, InvocationTargetException {
- List<IProject> importedProjects = new ImportNewProjectOperation(getProjectName()
+ List<IProject> importedProjects = new ImportNewProject(getProjectName()
, getApplication()
, getRemoteName()
, getRepositoryFile())
@@ -101,7 +101,7 @@
public void addToExistingProject(IProgressMonitor monitor)
throws OpenShiftException, InvocationTargetException, InterruptedException,
IOException, CoreException,
URISyntaxException {
- List<IProject> importedProjects = new AddToExistingProjectOperation(
+ List<IProject> importedProjects = new ConfigureUnsharedProject(
getProjectName()
, getApplication()
, getRemoteName()