本文整理汇总了Java中org.eclipse.equinox.p2.operations.ProvisioningJob类的典型用法代码示例。如果您正苦于以下问题:Java ProvisioningJob类的具体用法?Java ProvisioningJob怎么用?Java ProvisioningJob使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProvisioningJob类属于org.eclipse.equinox.p2.operations包,在下文中一共展示了ProvisioningJob类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: performOperation
import org.eclipse.equinox.p2.operations.ProvisioningJob; //导入依赖的package包/类
/**
* Performs a {@link ProfileChangeOperation}
*
* @param operation the operation
* @return the result status
*/
private IStatus performOperation(ProfileChangeOperation operation) {
IStatus status = operation.resolveModal(this.getProgressMonitor());
if (status.isOK()) {
ProvisioningJob provisioningJob = operation.getProvisioningJob(this.getProgressMonitor());
if (provisioningJob == null) {
System.err.println("Trying to install from the Eclipse IDE? This won't work!");
return Status.CANCEL_STATUS;
}
status = provisioningJob.runModal(this.getProgressMonitor());
}
return status;
}
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:21,代码来源:P2OperationsHandler.java
示例2: installAvailableUpdates
import org.eclipse.equinox.p2.operations.ProvisioningJob; //导入依赖的package包/类
/**
* Installs available updates from all repositories.
*
* @return the result status
*/
public IStatus installAvailableUpdates() {
ProvisioningJob provisioningJob = this.getUpdateOperation().getProvisioningJob(this.getProgressMonitor());
if (provisioningJob == null) {
System.err.println("Trying to update from the Eclipse IDE? This won't work!");
return Status.CANCEL_STATUS;
}
return provisioningJob.runModal(this.getProgressMonitor());
}
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:15,代码来源:P2OperationsHandler.java
示例3: installUpdates
import org.eclipse.equinox.p2.operations.ProvisioningJob; //导入依赖的package包/类
private void installUpdates() {
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
StringBuilder updates = new StringBuilder();
Update[] possibleUpdates = operation.getPossibleUpdates();
for (Update update : possibleUpdates) {
updates.append(getUnitDescription(update.toUpdate));
updates.append(" -> "); //$NON-NLS-1$
updates.append(getUnitDescription(update.replacement));
updates.append("\n"); //$NON-NLS-1$
}
boolean install = MessageDialog.openQuestion(null, "Updates", "Updates found! install?\n" + updates.toString());
if (install) {
ProgressMonitorDialog dialog = new ProgressMonitorDialog(Display.getDefault().getActiveShell());
try {
dialog.run(true, true, new IRunnableWithProgress() {
@Override
public void run(IProgressMonitor arg0) throws InvocationTargetException, InterruptedException {
SubMonitor sub = SubMonitor.convert(arg0, "Installing updates ...", 200);
operation.resolveModal(sub.newChild(100));
ProvisioningJob job = operation.getProvisioningJob(arg0);
job.runModal(sub.newChild(100));
AppUtils.restartAfterUpdate();
}
});
} catch (Exception e) {
e.printStackTrace();
// TODO agu
IStatus result = new Status(IStatus.ERROR, "de.iteratec.logan.core", "Update failed!", e);
StatusManager.getManager().handle(result);
}
}
}
});
}
开发者ID:agusevas,项目名称:logan,代码行数:39,代码来源:UpdateService.java
示例4: installUpdates
import org.eclipse.equinox.p2.operations.ProvisioningJob; //导入依赖的package包/类
/**
* Download and install application updates.
*
* @param agent
* @param monitor
* @return
* @throws OperationCanceledException
*/
public static IStatus installUpdates(IProvisioningAgent agent, IProgressMonitor monitor)
throws OperationCanceledException{
ProvisioningSession session = new ProvisioningSession(agent);
UpdateOperation operation = new UpdateOperation(session);
SubMonitor sub = SubMonitor.convert(monitor, "Installing updates ...", 200);
operation.resolveModal(sub.newChild(100));
ProvisioningJob job = operation.getProvisioningJob(monitor);
return job.runModal(sub.newChild(100));
}
开发者ID:elexis,项目名称:elexis-3-core,代码行数:18,代码来源:P2Util.java
示例5: checkForUpdates
import org.eclipse.equinox.p2.operations.ProvisioningJob; //导入依赖的package包/类
public static IStatus checkForUpdates(IProvisioningAgent agent, IProgressMonitor monitor) throws Exception {
try {
addUpdateSite(agent);
ProvisioningSession session = new ProvisioningSession(agent);
// the default update operation looks for updates to the currently
// running profile, using the default profile root marker. To change
// which installable units are being updated, use the more detailed
// constructors.
UpdateOperation operation = new UpdateOperation(session);
SubMonitor sub = SubMonitor.convert(monitor, "Checking for application updates...", 200);
IStatus status = operation.resolveModal(sub.newChild(100));
if (status.getCode() == UpdateOperation.STATUS_NOTHING_TO_UPDATE) {
return status;
}
if (status.getSeverity() == IStatus.CANCEL)
throw new OperationCanceledException();
if (status.getSeverity() != IStatus.ERROR) {
// More complex status handling might include showing the user what updates
// are available if there are multiples, differentiating patches vs. updates, etc.
// In this example, we simply update as suggested by the operation.
ProvisioningJob job = operation.getProvisioningJob(null);
status = job.runModal(sub.newChild(100));
if (status.getSeverity() == IStatus.CANCEL)
throw new OperationCanceledException();
}
return status;
} catch (Throwable ex) {
// LOG.error(ex);
return null;
} finally {
// if (useProxy) {
// proxySettings.resetProxy();
// }
}
}
开发者ID:cplutte,项目名称:bts,代码行数:42,代码来源:P2Util.java
示例6: installSelectedUpdates
import org.eclipse.equinox.p2.operations.ProvisioningJob; //导入依赖的package包/类
/**
* Install selected updates in to developer studio. Note: call
* {@link #setSelectedUpdates(List) setSelectedUpdates} first.
*
* @param monitor
*/
public void installSelectedUpdates(IProgressMonitor monitor) {
SubMonitor progress = SubMonitor.convert(monitor, Messages.UpdateManager_26, 2);
URI[] repos = new URI[] { getDevStudioUpdateSite() };
session = new ProvisioningSession(p2Agent);
updateOperation = new UpdateOperation(session);
updateOperation.getProvisioningContext().setArtifactRepositories(repos);
updateOperation.getProvisioningContext().setMetadataRepositories(repos);
updateOperation.setSelectedUpdates(selectedUpdates);
IStatus status = updateOperation.resolveModal(progress.newChild(1));
if (status.getSeverity() == IStatus.CANCEL) {
throw new OperationCanceledException();
} else if (status.getSeverity() == IStatus.ERROR) {
String message = status.getChildren()[0].getMessage();
UpdateMetaFileReaderJob.promptUserError(message, Messages.UpdateManager_27);
log.error(Messages.UpdateManager_27 + message);
} else {
final ProvisioningJob provisioningJob = updateOperation.getProvisioningJob(progress.newChild(1));
if (provisioningJob != null) {
provisioningJob.addJobChangeListener(new JobChangeAdapter() {
@Override
public void done(IJobChangeEvent arg0) {
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
boolean restart = MessageDialog.openQuestion(Display.getDefault().getActiveShell(),
Messages.UpdateManager_28,
Messages.UpdateManager_29 + Messages.UpdateManager_30);
if (restart) {
PlatformUI.getWorkbench().restart();
}
}
});
}
});
provisioningJob.schedule();
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
try {
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
.showView(IProgressConstants.PROGRESS_VIEW_ID);
} catch (PartInitException e) {
log.error(e);
}
}
});
} else {
log.error(Messages.UpdateManager_31);
}
}
}
开发者ID:wso2,项目名称:developer-studio,代码行数:59,代码来源:UpdateManager.java
示例7: installSelectedFeatures
import org.eclipse.equinox.p2.operations.ProvisioningJob; //导入依赖的package包/类
/**
* Install selected features in to developer studio. Note: call
* {@link #setSelectedFeaturesToInstall(List) setSelectedFeaturesToInstall}
* first.
*
* @param monitor
*/
public void installSelectedFeatures(IProgressMonitor monitor) {
SubMonitor progress = SubMonitor.convert(monitor, Messages.UpdateManager_32, 2);
URI[] repos = new URI[] { getDevStudioReleaseSite() };
session = new ProvisioningSession(p2Agent);
installOperation = new InstallOperation(session, selectedFeatures);
installOperation.getProvisioningContext().setArtifactRepositories(repos);
installOperation.getProvisioningContext().setMetadataRepositories(repos);
IStatus status = installOperation.resolveModal(progress.newChild(1));
if (status.getSeverity() == IStatus.CANCEL || progress.isCanceled()) {
throw new OperationCanceledException();
} else if (status.getSeverity() == IStatus.ERROR) {
String message = status.getChildren()[0].getMessage();
log.error(Messages.UpdateManager_33 + message);
UpdateMetaFileReaderJob.promptUserError(message, Messages.UpdateManager_33);
} else {
ProvisioningJob provisioningJob = installOperation.getProvisioningJob(progress.newChild(1));
if (provisioningJob != null) {
provisioningJob.addJobChangeListener(new JobChangeAdapter() {
@Override
public void done(IJobChangeEvent arg0) {
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
boolean restart = MessageDialog.openQuestion(Display.getDefault().getActiveShell(),
Messages.UpdateManager_34,
Messages.UpdateManager_35 + Messages.UpdateManager_36);
if (restart) {
PlatformUI.getWorkbench().restart();
}
}
});
}
});
provisioningJob.schedule();
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
try {
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
.showView(IProgressConstants.PROGRESS_VIEW_ID);
} catch (PartInitException e) {
log.error(e);
}
}
});
} else {
log.error(Messages.UpdateManager_37);
}
}
}
开发者ID:wso2,项目名称:developer-studio,代码行数:59,代码来源:UpdateManager.java
注:本文中的org.eclipse.equinox.p2.operations.ProvisioningJob类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论