Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/ApplicationWorkbenchWindowAdvisor.java')
-rw-r--r--examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/ApplicationWorkbenchWindowAdvisor.java60
1 files changed, 20 insertions, 40 deletions
diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/ApplicationWorkbenchWindowAdvisor.java b/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/ApplicationWorkbenchWindowAdvisor.java
index 0896291f3..b592b72ca 100644
--- a/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/ApplicationWorkbenchWindowAdvisor.java
+++ b/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/ApplicationWorkbenchWindowAdvisor.java
@@ -2,7 +2,6 @@ package org.eclipse.equinox.p2.examples.rcp.prestartupdate;
import java.lang.reflect.InvocationTargetException;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
@@ -21,24 +20,19 @@ import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
import org.eclipse.ui.application.WorkbenchWindowAdvisor;
public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
-
+
private static final String JUSTUPDATED = "justUpdated";
- public ApplicationWorkbenchWindowAdvisor(
- IWorkbenchWindowConfigurer configurer) {
+ public ApplicationWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) {
super(configurer);
}
- public ActionBarAdvisor createActionBarAdvisor(
- IActionBarConfigurer configurer) {
+ @Override
+ public ActionBarAdvisor createActionBarAdvisor(IActionBarConfigurer configurer) {
return new ApplicationActionBarAdvisor(configurer);
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.application.WorkbenchWindowAdvisor#preWindowOpen()
- */
+ @Override
public void preWindowOpen() {
IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
configurer.setInitialSize(new Point(600, 400));
@@ -46,19 +40,13 @@ public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
configurer.setShowStatusLine(false);
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.application.WorkbenchWindowAdvisor#postWindowOpen()
- */
+ @Override
public void postWindowOpen() {
- final IProvisioningAgent agent = (IProvisioningAgent) ServiceHelper
- .getService(Activator.bundleContext,
- IProvisioningAgent.SERVICE_NAME);
+ final IProvisioningAgent agent = (IProvisioningAgent) ServiceHelper.getService(Activator.bundleContext,
+ IProvisioningAgent.SERVICE_NAME);
if (agent == null) {
- LogHelper
- .log(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
- "No provisioning agent found. This application is not set up for updates."));
+ LogHelper.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ "No provisioning agent found. This application is not set up for updates."));
}
// XXX if we're restarting after updating, don't check again.
final IPreferenceStore prefStore = Activator.getDefault().getPreferenceStore();
@@ -70,24 +58,16 @@ public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
// XXX check for updates before starting up.
// If an update is performed, restart. Otherwise log
// the status.
- IRunnableWithProgress runnable = new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor)
- throws InvocationTargetException, InterruptedException {
- IStatus updateStatus = P2Util.checkForUpdates(agent, monitor);
- if (updateStatus.getCode() == UpdateOperation.STATUS_NOTHING_TO_UPDATE) {
- PlatformUI.getWorkbench().getDisplay()
- .asyncExec(new Runnable() {
- public void run() {
- MessageDialog.openInformation(null,
- "Updates", "No updates were found");
- }
- });
- } else if (updateStatus.getSeverity() != IStatus.ERROR) {
- prefStore.setValue(JUSTUPDATED, true);
- PlatformUI.getWorkbench().restart();
- } else {
- LogHelper.log(updateStatus);
- }
+ IRunnableWithProgress runnable = monitor -> {
+ IStatus updateStatus = P2Util.checkForUpdates(agent, monitor);
+ if (updateStatus.getCode() == UpdateOperation.STATUS_NOTHING_TO_UPDATE) {
+ PlatformUI.getWorkbench().getDisplay()
+ .asyncExec(() -> MessageDialog.openInformation(null, "Updates", "No updates were found"));
+ } else if (updateStatus.getSeverity() != IStatus.ERROR) {
+ prefStore.setValue(JUSTUPDATED, true);
+ PlatformUI.getWorkbench().restart();
+ } else {
+ LogHelper.log(updateStatus);
}
};
try {

Back to the top