当前位置: 首页>>代码示例>>Java>>正文


Java UpdateOperation类代码示例

本文整理汇总了Java中org.eclipse.equinox.p2.operations.UpdateOperation的典型用法代码示例。如果您正苦于以下问题:Java UpdateOperation类的具体用法?Java UpdateOperation怎么用?Java UpdateOperation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


UpdateOperation类属于org.eclipse.equinox.p2.operations包,在下文中一共展示了UpdateOperation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doExecute

import org.eclipse.equinox.p2.operations.UpdateOperation; //导入依赖的package包/类
@Override
protected void doExecute(LoadMetadataRepositoryJob job) {
    if (hasNoRepos) {
        MessageDialog.openInformation(null, "Update Yamcs Studio", "Could not check for updates since no repository is configured");
        return;
    }

    UpdateOperation operation = getProvisioningUI().getUpdateOperation(null, null);
    // check for updates
    operation.resolveModal(null);
    if (getProvisioningUI().getPolicy().continueWorkingWithOperation(operation, getShell())) {
        if (UpdateSingleIUWizard.validFor(operation)) {
            // Special case for only updating a single root
            UpdateSingleIUWizard wizard = new UpdateSingleIUWizard(getProvisioningUI(), operation);
            WizardDialog dialog = new WizardDialog(getShell(), wizard);
            dialog.create();
            dialog.open();
        } else {
            // Open the normal version of the update wizard
            getProvisioningUI().openUpdateWizard(false, operation, job);
        }
    }
}
 
开发者ID:yamcs,项目名称:yamcs-studio,代码行数:24,代码来源:UpdateHandler.java

示例2: doExecute

import org.eclipse.equinox.p2.operations.UpdateOperation; //导入依赖的package包/类
protected void doExecute(LoadMetadataRepositoryJob job) {
	if (hasNoRepos) {
		System.out.println("no repos");
		return;
	}
	UpdateOperation operation = getProvisioningUI().getUpdateOperation(null, null);
	// check for updates
	operation.resolveModal(null);
	if (getProvisioningUI().getPolicy().continueWorkingWithOperation(operation, getShell())) {
		if (UpdateSingleIUWizard.validFor(operation)) {
			// Special case for only updating a single root
			UpdateSingleIUWizard wizard = new UpdateSingleIUWizard(getProvisioningUI(), operation);
			WizardDialog dialog = new WizardDialog(getShell(), wizard);
			dialog.create();
			dialog.open();
		} else {
			// Open the normal version of the update wizard
			getProvisioningUI().openUpdateWizard(false, operation, job);
		}
	}
}
 
开发者ID:tmfev,项目名称:IDRT-Import-and-Mapping-Tool,代码行数:22,代码来源:UpdateHandler.java

示例3: continueWorkingWithOperation

import org.eclipse.equinox.p2.operations.UpdateOperation; //导入依赖的package包/类
@Override
public boolean continueWorkingWithOperation(ProfileChangeOperation operation, Shell shell) {

	Assert.isTrue(operation.getResolutionResult() != null);
	IStatus status = operation.getResolutionResult();
	// user cancelled
	if (status.getSeverity() == IStatus.CANCEL)
		return false;

	// Special case those statuses where we would never want to open a wizard
	if (status.getCode() == UpdateOperation.STATUS_NOTHING_TO_UPDATE) {
		MessageDialog.openInformation(shell, P2UpdateUtil.CHECK_UPDATE_JOB_NAME, P2UpdateUtil.UPDATE_PROMPT_INFO_NO_UPDATE);
		return false;
	}

	// there is no plan, so we can't continue. Report any reason found
	if (operation.getProvisioningPlan() == null && !status.isOK()) {
		StatusManager.getManager().handle(status, StatusManager.LOG | StatusManager.SHOW);
		return false;
	}

	// Allow the wizard to open otherwise.
	return true;
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:25,代码来源:UpdatePolicy.java

示例4: doUpdate

import org.eclipse.equinox.p2.operations.UpdateOperation; //导入依赖的package包/类
private void doUpdate() {
	if (operation == null) {
		return;
	}
	IStatus status = operation.getResolutionResult();
	// user cancelled
	if (status.getSeverity() == IStatus.CANCEL)
		return;

	// Special case those statuses where we would never want to open a wizard
	if (status.getCode() == UpdateOperation.STATUS_NOTHING_TO_UPDATE) {		
		return;
	}
	
	if (getProvisioningUI().getPolicy().continueWorkingWithOperation(operation, getShell())) {
		UpdateWizard wizard = new UpdateWizard(getProvisioningUI(), operation, operation.getSelectedUpdates());
		TSWizardDialog dialog = new TSWizardDialog(getShell(), wizard);
		dialog.create();
		dialog.open();
	}
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:22,代码来源:AutomaticUpdate.java

示例5: doExecute

import org.eclipse.equinox.p2.operations.UpdateOperation; //导入依赖的package包/类
protected void doExecute(LoadMetadataRepositoryJob job) {
	if (hasNoRepos) {
		return;
	}
	UpdateOperation operation = getProvisioningUI().getUpdateOperation(null, null);
	// check for updates
	operation.resolveModal(null);
	if (getProvisioningUI().getPolicy().continueWorkingWithOperation(operation, getShell())) {
		if (UpdateSingleIUWizard.validFor(operation)) {
			// Special case for only updating a single root
			UpdateSingleIUWizard wizard = new UpdateSingleIUWizard(getProvisioningUI(), operation);
			WizardDialog dialog = new WizardDialog(getShell(), wizard);
			dialog.create();
			dialog.open();
		} else {
			// Open the normal version of the update wizard
			getProvisioningUI().openUpdateWizard(false, operation, job);
		}
	}
}
 
开发者ID:winture,项目名称:wt-studio,代码行数:21,代码来源:UpdateHandler.java

示例6: update

import org.eclipse.equinox.p2.operations.UpdateOperation; //导入依赖的package包/类
public IStatus update(IProgressMonitor progressMonitor) {
  if (agent == null) {
    return new Status(IStatus.ERROR, "de.iteratec.logan.core", "Update failed!");
  }

  SubMonitor sub = SubMonitor.convert(progressMonitor, "Checking for application updates...", 200);
  IStatus result = operation.resolveModal(sub.newChild(100));
  if (result.getCode() == UpdateOperation.STATUS_NOTHING_TO_UPDATE) {
    // popUpInformation("Nothing to update!");
    return new Status(IStatus.OK, "de.iteratec.logan.core", "Nothing to update!");
  }
  else {
    installUpdates();
  }

  return result;
}
 
开发者ID:agusevas,项目名称:logan,代码行数:18,代码来源:UpdateService.java

示例7: doExecute

import org.eclipse.equinox.p2.operations.UpdateOperation; //导入依赖的package包/类
protected void doExecute(LoadMetadataRepositoryJob job){
	if (hasNoRepos) {
		return;
	}
	UpdateOperation operation = getProvisioningUI().getUpdateOperation(null, null);
	// check for updates
	operation.resolveModal(null);
	if (getProvisioningUI().getPolicy().continueWorkingWithOperation(operation, getShell())) {
		if (UpdateSingleIUWizard.validFor(operation)) {
			// Special case for only updating a single root
			UpdateSingleIUWizard wizard =
				new UpdateSingleIUWizard(getProvisioningUI(), operation);
			WizardDialog dialog = new WizardDialog(getShell(), wizard);
			dialog.create();
			dialog.open();
		} else {
			// Open the normal version of the update wizard
			getProvisioningUI().openUpdateWizard(false, operation, job);
		}
	}
}
 
开发者ID:elexis,项目名称:elexis-3-core,代码行数:22,代码来源:UpdateHandler.java

示例8: UpdateDescriptionPage

import org.eclipse.equinox.p2.operations.UpdateOperation; //导入依赖的package包/类
/**
 * root 参数未使用
 * @param operation
 * @param root
 * @param ui
 */
protected UpdateDescriptionPage(UpdateOperation operation, IUElementListRoot root, ProvisioningUI ui) {
	super("MyUpdsateDescriptionPage");
	setTitle(P2UpdateUtil.UI_WIZARD_DESC_PAGE_TITLE);
	setDescription(P2UpdateUtil.UI_WIZARD_DESC_PAGE_DESC);
	this.ui = ui;
	this.root = root;
	this.operation = operation;
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:15,代码来源:UpdateDescriptionPage.java

示例9: UpdateWizardPage

import org.eclipse.equinox.p2.operations.UpdateOperation; //导入依赖的package包/类
protected UpdateWizardPage(UpdateOperation operation,IUElementListRoot root, ProvisioningUI ui) {
	super("MyUpdasteWizardPage1", ui, null);
	this.ui = ui;
	this.operation = operation;
	this.input = root;
	setTitle(P2UpdateUtil.UI_WIZARD_PAGE_TITLE);
	setDescription(P2UpdateUtil.UI_WIZARD_PAGE_DESC);
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:9,代码来源:UpdateWizardPage.java

示例10: updateCaches

import org.eclipse.equinox.p2.operations.UpdateOperation; //导入依赖的package包/类
@Override
protected void updateCaches(IUElementListRoot newRoot,
		ProfileChangeOperation op) {
	operation = (UpdateOperation) op;
	if (newRoot != null) {
		setDrilldownElements(newRoot, operation);
		if (treeViewer != null) {
			if (input != newRoot)
				treeViewer.setInput(newRoot);
			else
				treeViewer.refresh();
		}
		input = newRoot;
	}
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:16,代码来源:UpdateWizardPage.java

示例11: UpdateWizard

import org.eclipse.equinox.p2.operations.UpdateOperation; //导入依赖的package包/类
public UpdateWizard(ProvisioningUI ui, UpdateOperation operation, Object[] initialSelections) {
	Assert.isLegal(operation.hasResolved(), "Cannot create an update wizard on an unresolved operation"); //$NON-NLS-1$
	setWindowTitle(P2UpdateUtil.UI_WIZARD_DIALOG_TITLE);
	// setDefaultPageImageDescriptor(ProvUIImages.getImageDescriptor(ProvUIImages.WIZARD_BANNER_UPDATE));
	this.operation = operation;
	// this.initialSelections = (Update[]) initialSelections;
	this.ui = ui;
	// initializeResolutionModelElements(initialSelections);
	setNeedsProgressMonitor(true);
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:11,代码来源:UpdateWizard.java

示例12: checkForUpdates

import org.eclipse.equinox.p2.operations.UpdateOperation; //导入依赖的package包/类
/**
 * Check for application updates.
 * 
 * @param agent
 * @param monitor
 * @return
 * @throws OperationCanceledException
 */
public static IStatus checkForUpdates(IProvisioningAgent agent, IProgressMonitor monitor)
	throws OperationCanceledException{
	System.out.println(">> checkForUpdates");
	ProvisioningSession session = new ProvisioningSession(agent);
	UpdateOperation operation = new UpdateOperation(session);
	SubMonitor sub = SubMonitor.convert(monitor, "Checking for application updates...", 200);
	return operation.resolveModal(sub.newChild(100));
}
 
开发者ID:elexis,项目名称:elexis-3-core,代码行数:17,代码来源:P2Util.java

示例13: installUpdates

import org.eclipse.equinox.p2.operations.UpdateOperation; //导入依赖的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

示例14: startP2Updates

import org.eclipse.equinox.p2.operations.UpdateOperation; //导入依赖的package包/类
/**
 * Starts a p2-based update procedure
 */
public void startP2Updates() {

	// --- Check for available updates -------
	System.out.println("P2 Update: Check for updates ...");
	
	if (Application.isOperatingHeadless() == false) {
		this.getProgressMonitor().setVisible(true);
		this.getProgressMonitor().setProgress(0);
	}
	
	IStatus status = P2OperationsHandler.getInstance().checkForUpdates();
	if (status.getSeverity()!=IStatus.ERROR) {

		if (status.getCode()==UpdateOperation.STATUS_NOTHING_TO_UPDATE) {
			// --- No updates found --------------
			System.out.println("P2 Update: No updates found!");
			
			if (Application.isOperatingHeadless() == false) {
				this.getProgressMonitor().setProgress(100);
				this.getProgressMonitor().setVisible(false);
				this.getProgressMonitor().dispose();
			}
			
			if (Application.isOperatingHeadless()==false && this.manualyExecutedByUser==true) {
				JOptionPane.showMessageDialog(null, Language.translate("Keine Updates gefunden") + "!", Language.translate("Keine Updates gefunden"), JOptionPane.INFORMATION_MESSAGE);
			}

		} else {

			// --- Ask for user confirmation if specified in the settings -------
			boolean installUpdates = true;
			if (this.askBeforeDownload==true) {
				
				// --- Temporary hide the progress dialog, otherwise the confirmation dialog would not be shown-------- 
				if(this.executionMode == ExecutionMode.APPLICATION) {
					this.getProgressMonitor().setVisible(false);
				}
				
				// --- Show confirmation dialog ----------
				int userAnswer = JOptionPane.showConfirmDialog(null, Language.translate("Updates verfügbar, installieren?"), "Agent.GUI Update", JOptionPane.YES_NO_OPTION);
				if (userAnswer == JOptionPane.NO_OPTION) {
					installUpdates = false;
					System.out.println("P2 Update: Update canceled by user.");
					if(Application.isOperatingHeadless() == false) {
						this.getProgressMonitor().setVisible(false);
						this.getProgressMonitor().dispose();
					}
				}
			}
			

			if (installUpdates==true) {
				// --- Change progress dialog texts ----------------
				if (Application.isOperatingHeadless() == false) {
					this.getProgressMonitor().setHeaderText(Language.translate("Installiere Updates"));
					this.getProgressMonitor().setProgressText(Language.translate("Installiere") + "...");
					this.getProgressMonitor().setVisible(true);
					this.getProgressMonitor().setProgress(30);
				}
				status = P2OperationsHandler.getInstance().installAvailableUpdates();
				if (status.isOK()) {
					System.out.println("P2 Update: Updates sucessfully installed, restarting...");
					Application.restart();
				} else {
					System.err.println("P2 Update: Error installing updates.");
				}
			}
			
			if (Application.isOperatingHeadless() == false) {
				this.getProgressMonitor().setProgress(100);
				this.getProgressMonitor().setVisible(false);
				this.getProgressMonitor().dispose();
			}

		}
	}
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:81,代码来源:AgentGuiUpdater.java

示例15: checkForUpdates

import org.eclipse.equinox.p2.operations.UpdateOperation; //导入依赖的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


注:本文中的org.eclipse.equinox.p2.operations.UpdateOperation类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。