eclipse rcp 需要增加自动update功能,希望使用Equinox P2的api来做相应的自动启动更新,不需要用户的干预.
参考:https://wiki.eclipse.org/Equinox/p2/Adding_Self-Update_to_an_RCP_Application
查看官方文档,下载git代码,就是跑不通.
偶尔发现一片文章:http://javaarm.com/faces/display.xhtml?tid=3455&page=1
讲的非常详细,一步一步下来,基本上实现了菜单更新.
下面需要实现无干预的更新,
参考:http://www.vogella.com/tutorials/EclipseP2Update/article.html#tutorial_updatelocation
最终实现代码如下:
ApplicationWorkbenchWindowAdvisor:
package com.xsej.office;
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;
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.operations.UpdateOperation;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.application.ActionBarAdvisor;
import org.eclipse.ui.application.IActionBarConfigurer;
import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
import org.eclipse.ui.application.WorkbenchWindowAdvisor;
import com.xsej.office.utils.P2Util;
public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
private stati