本文整理汇总了Java中org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob.addJobChangeListener方法的典型用法代码示例。如果您正苦于以下问题:Java LoadMetadataRepositoryJob.addJobChangeListener方法的具体用法?Java LoadMetadataRepositoryJob.addJobChangeListener怎么用?Java LoadMetadataRepositoryJob.addJobChangeListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob
的用法示例。
在下文中一共展示了LoadMetadataRepositoryJob.addJobChangeListener方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doExecuteAndLoad
import org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob; //导入方法依赖的package包/类
void doExecuteAndLoad() {
if (preloadRepositories()) {
//cancel any load that is already running
Job.getJobManager().cancel(LoadMetadataRepositoryJob.LOAD_FAMILY);
final LoadMetadataRepositoryJob loadJob = new LoadMetadataRepositoryJob(getProvisioningUI());
setLoadJobProperties(loadJob);
if (waitForPreload()) {
loadJob.addJobChangeListener(new JobChangeAdapter() {
public void done(IJobChangeEvent event) {
if (PlatformUI.isWorkbenchRunning())
if (event.getResult().isOK()) {
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
public void run() {
doExecute(loadJob);
}
});
}
}
});
loadJob.setUser(true);
loadJob.schedule();
} else {
loadJob.setSystem(true);
loadJob.setUser(false);
loadJob.schedule();
doExecute(null);
}
} else {
doExecute(null);
}
}
示例2: doExecuteAndLoad
import org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob; //导入方法依赖的package包/类
void doExecuteAndLoad() {
if (preloadRepositories()) {
//cancel any load that is already running
Job.getJobManager().cancel(LoadMetadataRepositoryJob.LOAD_FAMILY);
final LoadMetadataRepositoryJob loadJob = new LoadMetadataRepositoryJob(getProvisioningUI());
setLoadJobProperties(loadJob);
if (waitForPreload()) {
loadJob.addJobChangeListener(new JobChangeAdapter() {
public void done(IJobChangeEvent event) {
if (PlatformUI.isWorkbenchRunning())
if (event.getResult().isOK()) {
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
public void run() {
doExecute(loadJob);
}
});
}
}
});
loadJob.setUser(true);
loadJob.schedule();
} else {
loadJob.setSystem(true);
loadJob.setUser(false);
loadJob.schedule();
doExecute(null);
}
} else {
doExecute(null);
}
}
示例3: doExecuteAndLoad
import org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob; //导入方法依赖的package包/类
void doExecuteAndLoad() {
if (preloadRepositories()) {
//cancel any load that is already running
Job.getJobManager().cancel(LoadMetadataRepositoryJob.LOAD_FAMILY);
final LoadMetadataRepositoryJob loadJob = new LoadMetadataRepositoryJob(getProvisioningUI());
setLoadJobProperties(loadJob);
if (waitForPreload()) {
loadJob.addJobChangeListener(new JobChangeAdapter() {
public void done(IJobChangeEvent event) {
if (PlatformUI.isWorkbenchRunning())
if (event.getResult().isOK()) {
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
public void run() {
doExecute(loadJob);
}
});
}
}
});
loadJob.setUser(true);
loadJob.schedule();
} else {
loadJob.setSystem(true);
loadJob.setUser(false);
loadJob.schedule();
doExecute(null);
}
} else {
doExecute(null);
}
}
示例4: doExecuteAndLoad
import org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob; //导入方法依赖的package包/类
void doExecuteAndLoad(){
if (preloadRepositories()) {
// cancel any load that is already running
Job.getJobManager().cancel(LoadMetadataRepositoryJob.LOAD_FAMILY);
final LoadMetadataRepositoryJob loadJob =
new LoadMetadataRepositoryJob(getProvisioningUI());
setLoadJobProperties(loadJob);
if (waitForPreload()) {
loadJob.addJobChangeListener(new JobChangeAdapter() {
public void done(IJobChangeEvent event){
if (PlatformUI.isWorkbenchRunning())
if (event.getResult().isOK()) {
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
public void run(){
doExecute(loadJob);
}
});
}
}
});
loadJob.setUser(true);
loadJob.schedule();
} else {
loadJob.setSystem(true);
loadJob.setUser(false);
loadJob.schedule();
doExecute(null);
}
} else {
doExecute(null);
}
}
示例5: doExecuteAndLoad
import org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob; //导入方法依赖的package包/类
void doExecuteAndLoad() {
if (preloadRepositories()) {
//cancel any load that is already running
Job.getJobManager().cancel(LoadMetadataRepositoryJob.LOAD_FAMILY);
final LoadMetadataRepositoryJob loadJob = new LoadMetadataRepositoryJob(getProvisioningUI()) {
public IStatus runModal(IProgressMonitor monitor) {
SubMonitor sub = SubMonitor.convert(monitor, getProgressTaskName(), 1000);
IStatus status = super.runModal(sub.newChild(500));
if (status.getSeverity() == IStatus.CANCEL)
return status;
try {
doPostLoadBackgroundWork(sub.newChild(500));
} catch (OperationCanceledException e) {
return Status.CANCEL_STATUS;
}
if (shouldAccumulateFailures()) {
// If we are accumulating failures, don't return a combined status here. By returning OK,
// we are indicating that the operation should continue with the repositories that
// did load.
return Status.OK_STATUS;
}
return status;
}
};
setLoadJobProperties(loadJob);
if (waitForPreload()) {
loadJob.addJobChangeListener(new JobChangeAdapter() {
public void done(IJobChangeEvent event) {
if (PlatformUI.isWorkbenchRunning())
if (event.getResult().isOK()) {
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
public void run() {
doExecute(loadJob);
}
});
}
}
});
loadJob.setUser(true);
loadJob.schedule();
} else {
loadJob.setSystem(true);
loadJob.setUser(false);
loadJob.schedule();
doExecute(null);
}
} else {
doExecute(null);
}
}
示例6: doExecuteAndLoad
import org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob; //导入方法依赖的package包/类
void doExecuteAndLoad() {
if (preloadRepositories()) {
// cancel any load that is already running
final IStatus[] checkStatus = new IStatus[1];
Job.getJobManager().cancel(LoadMetadataRepositoryJob.LOAD_FAMILY);
final LoadMetadataRepositoryJob loadJob = new LoadMetadataRepositoryJob(getProvisioningUI()) {
public IStatus runModal(IProgressMonitor monitor) {
SubMonitor sub = SubMonitor.convert(monitor, getProgressTaskName(), 1000);
IStatus status = super.runModal(sub.newChild(500));
if (status.getSeverity() == IStatus.CANCEL)
return status;
if (status.getSeverity() != IStatus.OK) {
// 记录检查错误
checkStatus[0] = status;
return Status.OK_STATUS;
}
try {
doPostLoadBackgroundWork(sub.newChild(500));
} catch (OperationCanceledException e) {
return Status.CANCEL_STATUS;
}
return status;
}
};
setLoadJobProperties(loadJob);
loadJob.setName(P2UpdateUtil.CHECK_UPDATE_JOB_NAME);
if (waitForPreload()) {
loadJob.addJobChangeListener(new JobChangeAdapter() {
public void done(IJobChangeEvent event) {
if (PlatformUI.isWorkbenchRunning())
if (event.getResult().isOK()) {
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
public void run() {
if (checkStatus[0] != null) {
// 提示连接异常
P2UpdateUtil.openConnectErrorInfoDialog(getShell(),
P2UpdateUtil.INFO_TYPE_CHECK);
return;
}
doExecute(loadJob);
}
});
}
}
});
loadJob.setUser(true);
loadJob.schedule();
} else {
loadJob.setSystem(true);
loadJob.setUser(false);
loadJob.schedule();
doExecute(null);
}
} else {
doExecute(null);
}
}
示例7: checkForUpdates
import org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob; //导入方法依赖的package包/类
public void checkForUpdates() throws OperationCanceledException {
// 检查 propfile
String profileId = getProvisioningUI().getProfileId();
IProvisioningAgent agent = getProvisioningUI().getSession().getProvisioningAgent();
IProfile profile = null;
if (agent != null) {
IProfileRegistry registry = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME);
if (registry != null) {
profile = registry.getProfile(profileId);
}
}
if (profile == null) {
// Inform the user nicely
P2UpdateUtil.openConnectErrorInfoDialog(getShell(), P2UpdateUtil.INFO_TYPE_AUTO_CHECK);
return;
}
// 开始检查前先确定是否有repository
RepositoryTracker repoMan = getProvisioningUI().getRepositoryTracker();
if (repoMan.getKnownRepositories(getProvisioningUI().getSession()).length == 0) {
P2UpdateUtil.openConnectErrorInfoDialog(getShell(), P2UpdateUtil.INFO_TYPE_AUTO_CHECK);
return;
}
final IStatus[] checkStatus = new IStatus[1];
Job.getJobManager().cancel(LoadMetadataRepositoryJob.LOAD_FAMILY);
final LoadMetadataRepositoryJob loadJob = new LoadMetadataRepositoryJob(getProvisioningUI()) {
public IStatus runModal(IProgressMonitor monitor) {
SubMonitor sub = SubMonitor.convert(monitor, P2UpdateUtil.CHECK_UPDATE_TASK_NAME, 1000);
// load repository
IStatus status = super.runModal(sub.newChild(500));
if (status.getSeverity() == IStatus.CANCEL) {
return status;
}
if (status.getSeverity() != Status.OK) {
// load repository error
checkStatus[0] = status;
}
operation = getProvisioningUI().getUpdateOperation(null, null);
// check for updates
IStatus resolveStatus = operation.resolveModal(sub.newChild(500));
if (resolveStatus.getSeverity() == IStatus.CANCEL) {
return Status.CANCEL_STATUS;
}
return Status.OK_STATUS;
}
};
loadJob.setName(P2UpdateUtil.ATUO_CHECK_UPDATE_JOB_NAME);
loadJob.setProperty(LoadMetadataRepositoryJob.ACCUMULATE_LOAD_ERRORS, Boolean.toString(true));
loadJob.addJobChangeListener(new JobChangeAdapter() {
public void done(IJobChangeEvent event) {
if (PlatformUI.isWorkbenchRunning())
if (event.getResult().isOK()) {
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
public void run() {
if (checkStatus[0] != null) {
// 提示连接异常
P2UpdateUtil.openConnectErrorInfoDialog(getShell(),
P2UpdateUtil.INFO_TYPE_AUTO_CHECK);
return;
}
doUpdate();
}
});
}
}
});
loadJob.setUser(true);
loadJob.schedule();
}