Author: adietish
Date: 2012-01-20 05:05:57 -0500 (Fri, 20 Jan 2012)
New Revision: 37996
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/ResourceUtils.java
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
Log:
[JBIDE-10479] added monitor to copy operation
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/ResourceUtils.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/ResourceUtils.java 2012-01-20
10:00:40 UTC (rev 37995)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/ResourceUtils.java 2012-01-20
10:05:57 UTC (rev 37996)
@@ -139,11 +139,12 @@
return IResource.NONE;
}
}
-
+
/**
* Copies the given paths in the given sourceFolder (which may be located
* outside of the workspace - we're using java.io.File) to the given
- * project.
+ * project. The copy operation is not using eclipse resource API, but it
+ * refreshes the project folder afterwards.
*
* @param sourceFolder
* the sourceFolder that contains the given path that shall be
@@ -154,9 +155,10 @@
* the project that the sources shall be copied to.
* @return the freshly created resources.
* @throws IOException
+ * @throws CoreException
*/
- public static Collection<IResource> copy(File sourceFolder, String[] sourcePaths,
IProject project)
- throws IOException {
+ public static Collection<IResource> copy(File sourceFolder, String[] sourcePaths,
IProject project,
+ IProgressMonitor monitor) throws IOException, CoreException {
List<IResource> resources = new ArrayList<IResource>();
File projectFolder = project.getLocation().toFile();
@@ -175,6 +177,7 @@
resources.add(project.getFile(sourcePath));
}
}
+ project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
return resources;
}
}
Modified:
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 2012-01-20
10:00:40 UTC (rev 37995)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ConfigureGitSharedProject.java 2012-01-20
10:05:57 UTC (rev 37996)
@@ -165,7 +165,7 @@
ResourceUtils.copy(tmpFolder, new String[] {
".openshift",
"deployments",
- "pom.xml" }, project);
+ "pom.xml" }, project, monitor);
FileUtil.safeDelete(tmpFolder);
project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
return copiedResources;
Modified:
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/ConfigureUnsharedProject.java 2012-01-20
10:00:40 UTC (rev 37995)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ConfigureUnsharedProject.java 2012-01-20
10:05:57 UTC (rev 37996)
@@ -26,6 +26,7 @@
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 org.jboss.tools.openshift.express.internal.ui.utils.ResourceUtils;
import com.openshift.express.client.IApplication;
import com.openshift.express.client.IUser;
@@ -49,7 +50,8 @@
* application. *
* <ul>
* <li>clones the application git repository</li>
- * <li>copies the configuration files to the user project (in the
workspace)</li>
+ * <li>copies the configuration files to the user project (in the workspace)
+ * </li>
* <li>shares the given project with git</li>
* </ul>
*
@@ -121,25 +123,26 @@
* @param monitor
* the monitor to report progress to
* @throws IOException
- * @throws URISyntaxException
- * @throws InterruptedException
- * @throws InvocationTargetException
- * @throws OpenShiftException
+ * @throws URISyntaxException
+ * @throws InterruptedException
+ * @throws InvocationTargetException
+ * @throws OpenShiftException
+ * @throws CoreException
*/
- private void copyOpenshiftConfigurations(IApplication application, String remoteName,
IProject project, IProgressMonitor monitor)
- throws IOException, OpenShiftException, InvocationTargetException,
InterruptedException, URISyntaxException {
+ private void copyOpenshiftConfigurations(IApplication application, String remoteName,
IProject project,
+ IProgressMonitor monitor)
+ throws IOException, OpenShiftException, InvocationTargetException,
InterruptedException, URISyntaxException, CoreException {
Assert.isLegal(project != null);
- File projectFolder = project.getLocation().toFile();
+ monitor.subTask(NLS.bind("Copying openshift configuration to project {0}...",
project.getName()));
File tmpFolder = FileUtils.getRandomTmpFolder();
cloneRepository(getApplication(), getRemoteName(), tmpFolder, false, monitor);
-
- monitor.subTask(NLS.bind("Copying openshift configuration to project {0}...",
project.getName()));
- FileUtils.copy(new File(tmpFolder, ".git"), projectFolder, false);
- FileUtils.copy(new File(tmpFolder, ".openshift"), projectFolder, false);
- FileUtils.copy(new File(tmpFolder, "deployments"), projectFolder, false);
- FileUtils.copy(new File(tmpFolder, "pom.xml"), projectFolder, false);
-
+ ResourceUtils.copy(tmpFolder, new String[] {
+ ".git",
+ ".openshift",
+ "deployments",
+ "pom.xml" }, project, monitor);
+
FileUtil.safeDelete(tmpFolder);
}
@@ -151,7 +154,7 @@
* @param project
* the project to which the .gitignore shall be configured
* @throws IOException
- * @throws CoreException
+ * @throws CoreException
*/
private void createGitIgnore(IProject project, IProgressMonitor monitor) throws
IOException, CoreException {
GitIgnore gitIgnore = new GitIgnore(project);