*** empty log message ***
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/internal/mirror/MirrorCommand.java b/update/org.eclipse.update.core/src/org/eclipse/update/internal/mirror/MirrorCommand.java
index 5bba7ec..dccdb53 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/internal/mirror/MirrorCommand.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/internal/mirror/MirrorCommand.java
@@ -47,7 +47,7 @@
/**
* true if success
*/
- public boolean run() {
+ public boolean run(IProgressMonitor monitor) {
if (!validateParameters()) {
return false;
}
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/internal/standalone/DisableCommand.java b/update/org.eclipse.update.core/src/org/eclipse/update/internal/standalone/DisableCommand.java
index 04db7aa..8aa6973 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/internal/standalone/DisableCommand.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/internal/standalone/DisableCommand.java
@@ -94,7 +94,7 @@
/**
* @see Wizard#performFinish()
*/
- public boolean run() {
+ public boolean run(IProgressMonitor monitor) {
if (isVerifyOnly()) {
IStatus status =
OperationsManager.getValidator().validatePendingUnconfig(
@@ -110,7 +110,7 @@
feature);
try {
- return configOperation.execute(null, null);
+ return configOperation.execute(monitor, this);
} catch (CoreException e) {
StandaloneUpdateApplication.exceptionLogged();
UpdateCore.log(e);
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/internal/standalone/EnableCommand.java b/update/org.eclipse.update.core/src/org/eclipse/update/internal/standalone/EnableCommand.java
index a00d9b4..e5aa54f 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/internal/standalone/EnableCommand.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/internal/standalone/EnableCommand.java
@@ -95,7 +95,7 @@
/**
* @see Wizard#performFinish()
*/
- public boolean run() {
+ public boolean run(IProgressMonitor monitor) {
if (isVerifyOnly()) {
IStatus status =
OperationsManager.getValidator().validatePendingConfig(feature);
@@ -110,7 +110,7 @@
feature);
try {
- return configOperation.execute(null, null);
+ return configOperation.execute(monitor, this);
} catch (CoreException e) {
StandaloneUpdateApplication.exceptionLogged();
UpdateCore.log(e);
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/internal/standalone/InstallCommand.java b/update/org.eclipse.update.core/src/org/eclipse/update/internal/standalone/InstallCommand.java
index 238ea7f..f2014cd 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/internal/standalone/InstallCommand.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/internal/standalone/InstallCommand.java
@@ -102,9 +102,9 @@
/**
*/
- public boolean run() {
+ public boolean run(IProgressMonitor monitor) {
try {
- searchRequest.performSearch(collector, new NullProgressMonitor());
+ searchRequest.performSearch(collector, new SubProgressMonitor(monitor,1));
IInstallFeatureOperation[] operations = collector.getOperations();
if (operations == null || operations.length == 0) {
throw Utilities.newCoreException(
@@ -144,7 +144,7 @@
.createBatchInstallOperation(
operations);
try {
- installOperation.execute(new NullProgressMonitor(), this);
+ installOperation.execute(monitor, this);
System.out.println(
"Feature "
+ featureId
@@ -164,19 +164,6 @@
}
}
- /* (non-Javadoc)
- * @see org.eclipse.update.operations.IOperationListener#afterExecute(org.eclipse.update.operations.IOperation)
- */
- public boolean afterExecute(IOperation operation, Object data) {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.update.operations.IOperationListener#beforeExecute(org.eclipse.update.operations.IOperation)
- */
- public boolean beforeExecute(IOperation operation, Object data) {
- return true;
- }
class UpdateSearchResultCollector implements IUpdateSearchResultCollector {
private ArrayList operations = new ArrayList();
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/internal/standalone/ScriptedCommand.java b/update/org.eclipse.update.core/src/org/eclipse/update/internal/standalone/ScriptedCommand.java
index 3966ea7..c20f555 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/internal/standalone/ScriptedCommand.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/internal/standalone/ScriptedCommand.java
@@ -13,34 +13,56 @@
import org.eclipse.update.configuration.*;
import org.eclipse.update.core.*;
import org.eclipse.update.internal.core.*;
-import org.eclipse.update.internal.operations.*;
import org.eclipse.update.internal.api.operations.*;
+/**
+ * Parent class for all the update manager standalone commands.
+ * Subclasses will provide specific operations and the implementation of the run() method.
+ */
public abstract class ScriptedCommand implements IOperationListener {
private IInstallConfiguration config;
protected boolean verifyOnly;
+ /**
+ * Constructor
+ *
+ */
public ScriptedCommand() {
this(null);
}
+ /**
+ * Constructor.
+ *
+ * @param verifyOnly if true, the command is not executed, but will only attempt to run the command.
+ * This is mostly used when wanted to know if the command would fail.
+ */
public ScriptedCommand(String verifyOnly) {
this.verifyOnly = "true".equals(verifyOnly);
}
/**
- * Returns true if the command should only be run in simulation mode,
+ * @return true if the command should only be run in simulation mode,
* to verify if it can execute.
- * @return
*/
- public boolean isVerifyOnly() {
+ protected final boolean isVerifyOnly() {
return verifyOnly;
}
/**
+ * Convenience method that executes the command with a null progress monitor.
*/
- public abstract boolean run();
+ public final boolean run() {
+ return run(new NullProgressMonitor());
+ }
+
+ /**
+ * Executes the command. Subclasses are responsible for implementing this method.
+ * If the command was constructed with verifyOnly=true, the command should not execute, but only verify it can execute.
+ * @param monitor progress monitor during command execution.
+ */
+ public abstract boolean run(IProgressMonitor monitor);
/* (non-Javadoc)
* @see org.eclipse.update.operations.IOperationListener#afterExecute(org.eclipse.update.operations.IOperation)
@@ -56,7 +78,10 @@
return true;
}
- protected IInstallConfiguration getConfiguration() {
+ /**
+ * @return the installation configuration affected by the command
+ */
+ public final IInstallConfiguration getConfiguration() {
if (config == null) {
try {
ILocalSite localSite = SiteManager.getLocalSite();
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/internal/standalone/SearchCommand.java b/update/org.eclipse.update.core/src/org/eclipse/update/internal/standalone/SearchCommand.java
index c4a33af..2137d59 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/internal/standalone/SearchCommand.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/internal/standalone/SearchCommand.java
@@ -45,10 +45,10 @@
/**
*/
- public boolean run() {
+ public boolean run(IProgressMonitor monitor) {
try {
System.out.println("Searching on " + remoteSiteURL.toString());
- searchRequest.performSearch(collector, new NullProgressMonitor());
+ searchRequest.performSearch(collector, monitor);
System.out.println("Done.");
return true;
} catch (CoreException ce) {
@@ -66,19 +66,6 @@
}
}
- /* (non-Javadoc)
- * @see org.eclipse.update.operations.IOperationListener#afterExecute(org.eclipse.update.operations.IOperation)
- */
- public boolean afterExecute(IOperation operation, Object data) {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.update.operations.IOperationListener#beforeExecute(org.eclipse.update.operations.IOperation)
- */
- public boolean beforeExecute(IOperation operation, Object data) {
- return true;
- }
class UpdateSearchResultCollector implements IUpdateSearchResultCollector {
public void accept(IFeature feature) {
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/internal/standalone/UninstallCommand.java b/update/org.eclipse.update.core/src/org/eclipse/update/internal/standalone/UninstallCommand.java
index 1b4f3f1..8922dad 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/internal/standalone/UninstallCommand.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/internal/standalone/UninstallCommand.java
@@ -95,7 +95,7 @@
/**
* @see Wizard#performFinish()
*/
- public boolean run() {
+ public boolean run(IProgressMonitor monitor) {
if (InstallRegistry.getInstance().get("feature_"+ feature.getVersionedIdentifier()) == null) {
StandaloneUpdateApplication.exceptionLogged();
UpdateCore.log(Utilities.newCoreException("Feature " + feature + " was not installed by the update manager, so it cannot be uninstalled.",null));
@@ -113,7 +113,7 @@
feature);
try {
- return uninstallOperation.execute(null, null);
+ return uninstallOperation.execute(monitor, this);
} catch (CoreException e) {
StandaloneUpdateApplication.exceptionLogged();
UpdateCore.log(e);
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/internal/standalone/UpdateCommand.java b/update/org.eclipse.update.core/src/org/eclipse/update/internal/standalone/UpdateCommand.java
index 4e445a7..8bec4de 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/internal/standalone/UpdateCommand.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/internal/standalone/UpdateCommand.java
@@ -82,9 +82,9 @@
/**
*/
- public boolean run() {
+ public boolean run(IProgressMonitor monitor) {
try {
- searchRequest.performSearch(collector, new NullProgressMonitor());
+ searchRequest.performSearch(collector, new SubProgressMonitor(monitor,1));
IInstallFeatureOperation[] operations = collector.getOperations();
if (operations == null || operations.length == 0) {
StandaloneUpdateApplication.exceptionLogged();
@@ -123,7 +123,7 @@
.createBatchInstallOperation(
operations);
try {
- installOperation.execute(new NullProgressMonitor(), this);
+ installOperation.execute(monitor, this);
System.out.println(
"Feature " + featureId + " has successfully been updated");
return true;
@@ -150,19 +150,6 @@
}
}
- /* (non-Javadoc)
- * @see org.eclipse.update.operations.IOperationListener#afterExecute(org.eclipse.update.operations.IOperation)
- */
- public boolean afterExecute(IOperation operation, Object data) {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.update.operations.IOperationListener#beforeExecute(org.eclipse.update.operations.IOperation)
- */
- public boolean beforeExecute(IOperation operation, Object data) {
- return true;
- }
class UpdateSearchResultCollector implements IUpdateSearchResultCollector {
private ArrayList operations = new ArrayList();