本文整理匯總了Java中org.eclipse.core.runtime.MultiStatus.merge方法的典型用法代碼示例。如果您正苦於以下問題:Java MultiStatus.merge方法的具體用法?Java MultiStatus.merge怎麽用?Java MultiStatus.merge使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.core.runtime.MultiStatus
的用法示例。
在下文中一共展示了MultiStatus.merge方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: performOk
import org.eclipse.core.runtime.MultiStatus; //導入方法依賴的package包/類
@Override
public boolean performOk() {
final MultiStatus multistatus = statusHelper
.createMultiStatus("Status of importing target platform.");
try {
new ProgressMonitorDialog(getShell()).run(true, false, monitor -> {
final IStatus status = store.save(monitor);
if (!status.isOK()) {
setMessage(status.getMessage(), ERROR);
multistatus.merge(status);
} else {
updateInput(viewer, store.getLocations());
}
});
} catch (final InvocationTargetException | InterruptedException exc) {
multistatus.merge(statusHelper.createError("Error while building external libraries.", exc));
}
if (multistatus.isOK())
return super.performOk();
else
return false;
}
示例2: maintenanceReinstallNpms
import org.eclipse.core.runtime.MultiStatus; //導入方法依賴的package包/類
/**
* Actions to be taken if reinstalling npms is requested.
*
* @param userChoice
* options object used to decide if / how actions should be performed
* @param multistatus
* the status used accumulate issues
* @param monitor
* the monitor used to interact with npm manager
* @param packageNames
* names of the packages and their versions to reinstall
*
*/
private void maintenanceReinstallNpms(final MaintenanceActionsChoice userChoice,
final MultiStatus multistatus, IProgressMonitor monitor, Map<String, String> packageNames) {
if (userChoice.decisionReinstall) {
// unless all npms were purged, uninstall known ones
if (!userChoice.decisionPurgeNpm) {
IStatus uninstallStatus = unintallAndUpdate(packageNames.keySet(), monitor);
if (!uninstallStatus.isOK())
multistatus.merge(uninstallStatus);
}
IStatus installStatus = intallAndUpdate(packageNames, monitor);
if (!installStatus.isOK())
multistatus.merge(installStatus);
}
}
示例3: maintenanceDeleteNpms
import org.eclipse.core.runtime.MultiStatus; //導入方法依賴的package包/類
/**
* Actions to be taken if deleting npms is requested.
*
* @param userChoice
* options object used to decide if / how actions should be performed
* @param multistatus
* the status used accumulate issues
*/
private void maintenanceDeleteNpms(final MaintenanceActionsChoice userChoice, final MultiStatus multistatus) {
if (userChoice.decisionPurgeNpm) {
// get folder
File npmFolder = N4_NPM_FOLDER_SUPPLIER.get();
if (npmFolder.exists()) {
FileDeleter.delete(npmFolder, (IOException ioe) -> multistatus.merge(
statusHelper.createError("Exception during deletion of the npm folder.", ioe)));
}
if (!npmFolder.exists()) {
// recreate npm folder
if (!repairNpmFolderState()) {
multistatus.merge(statusHelper
.createError("The npm folder was not recreated correctly."));
}
} else {// should never happen
multistatus
.merge(statusHelper.createError("Could not verify deletion of " + npmFolder.getAbsolutePath()));
}
// other actions like reinstall depends on this state
externalLibraryWorkspace.updateState();
}
}
示例4: maintenanceResetTypeDefinitions
import org.eclipse.core.runtime.MultiStatus; //導入方法依賴的package包/類
/**
* Actions to be taken if reseting type definitions is requested.
*
* @param userChoice
* options object used to decide if / how actions should be performed
* @param multistatus
* the status used accumulate issues
*/
private void maintenanceResetTypeDefinitions(final MaintenanceActionsChoice userChoice,
final MultiStatus multistatus) {
if (userChoice.decisionResetTypeDefinitions) {
// get folder
File typeDefinitionsFolder = gitSupplier.get();
if (typeDefinitionsFolder.exists()) {
FileDeleter.delete(typeDefinitionsFolder, (IOException ioe) -> multistatus.merge(
statusHelper.createError("Exception during deletion of the type definitions.", ioe)));
}
if (!typeDefinitionsFolder.exists()) {
// recreate npm folder
if (!gitSupplier.repairTypeDefinitions()) {
multistatus.merge(
statusHelper.createError("The type definitions folder was not recreated correctly."));
}
} else { // should never happen
multistatus.merge(statusHelper
.createError("Could not verify deletion of " + typeDefinitionsFolder.getAbsolutePath()));
}
}
}
示例5: installUninstallNPMs
import org.eclipse.core.runtime.MultiStatus; //導入方法依賴的package包/類
private void installUninstallNPMs(final Map<String, String> versionedNPMs, final IProgressMonitor monitor,
final MultiStatus status, final Set<String> requestedNPMs, final Set<String> oldNPMs) {
logger.logInfo(LINE_SINGLE);
logger.logInfo("Installing packages... [step 1 of 4]");
monitor.setTaskName("Installing packages... [step 1 of 4]");
// calculate already installed to skip
final Set<String> npmNamesToInstall = difference(requestedNPMs, oldNPMs);
final Set<String> npmsToInstall = versionedNPMs.entrySet().stream()
// skip already installed
.filter(e -> npmNamesToInstall.contains(e.getKey()))
// [name, @">=1.0.0 <2.0.0"] to [[email protected]">=1.0.0 <2.0.0"]
.map(e -> e.getKey() + Strings.emptyIfNull(e.getValue()))
.collect(Collectors.toSet());
IStatus installStatus = batchInstallUninstall(monitor, npmsToInstall, true);
// log possible errors, but proceed with the process
// assume that at least some packages were installed correctly and can be adapted
if (!installStatus.isOK()) {
logger.logInfo("Some packages could not be installed due to errors, see log for details.");
status.merge(installStatus);
}
monitor.worked(2);
}
示例6: adaptNPMPackages
import org.eclipse.core.runtime.MultiStatus; //導入方法依賴的package包/類
private Collection<File> adaptNPMPackages(final IProgressMonitor monitor, final MultiStatus status,
final Collection<String> addedDependencies) {
logger.logInfo(LINE_SINGLE);
logger.logInfo("Adapting npm package structure to N4JS project structure... [step 3 of 4]");
monitor.setTaskName("Adapting npm package structure to N4JS project structure... [step 3 of 4]");
final Pair<IStatus, Collection<File>> result = npmPackageToProjectAdapter.adaptPackages(addedDependencies);
final IStatus adaptionStatus = result.getFirst();
// log possible errors, but proceed with the process
// assume that at least some packages were installed correctly and can be adapted
if (!adaptionStatus.isOK()) {
logger.logError(adaptionStatus);
status.merge(adaptionStatus);
}
final Collection<File> adaptedPackages = result.getSecond();
logger.logInfo("Packages structures has been adapted to N4JS project structure.");
monitor.worked(2);
logger.logInfo(LINE_SINGLE);
return adaptedPackages;
}
示例7: merge
import org.eclipse.core.runtime.MultiStatus; //導入方法依賴的package包/類
public static IStatus merge(IStatus status, IStatus newStatus) {
if (status == null) {
return newStatus;
} else {
if (status instanceof MultiStatus) {
((MultiStatus) status).merge(newStatus);
return status;
} else {
MultiStatus merged = new MultiStatus(status.getPlugin(), status.getCode(),
status.getMessage(), status.getException());
merged.merge(newStatus);
return merged;
}
}
}
示例8: maintenanceUpateState
import org.eclipse.core.runtime.MultiStatus; //導入方法依賴的package包/類
/**
* Updates all affected state after maintenance actions have been performed. In particular updates state of the
* workspace, persisted preferences state, and displayed preferences.
*
* @param userChoice
* options object used to decide if / how actions should be performed
* @param multistatus
* the status used accumulate issues
* @param monitor
* the monitor used to interact with npm manager
*/
private void maintenanceUpateState(final MaintenanceActionsChoice userChoice,
final MultiStatus multistatus, IProgressMonitor monitor) {
if (userChoice.decisionReload || userChoice.decisionReinstall || userChoice.decisionPurgeNpm
|| userChoice.decisionResetTypeDefinitions) {
externalLibraryWorkspace.updateState();
try {
externalLibrariesReloadHelper.reloadLibraries(true, monitor);
} catch (InvocationTargetException e) {
multistatus.merge(
statusHelper.createError("Error when reloading libraries after maintenance actions.", e));
}
updateInput(viewer, store.getLocations());
}
}
示例9: widgetSelected
import org.eclipse.core.runtime.MultiStatus; //導入方法依賴的package包/類
@Override
public void widgetSelected(final SelectionEvent e) {
final MultiStatus multistatus = statusHelper.createMultiStatus("Status of installing npm dependencies.");
InstallNpmDependencyDialog dialog = new InstallNpmDependencyDialog(getShell(),
packageNameValidator.get(), packageVersionValidator.get());
dialog.open();
final String packageName = dialog.getPackageName();
if (!StringExtensions.isNullOrEmpty(packageName) && dialog.getReturnCode() == Window.OK) {
try {
final String packageVersion = dialog.getVersionConstraint();
new ProgressMonitorDialog(getShell()).run(true, false, monitor -> {
multistatus
.merge(installAction.apply(Collections.singletonMap(packageName, packageVersion), monitor));
});
} catch (final InvocationTargetException | InterruptedException exc) {
multistatus.merge(
statusHelper.createError("Error while installing npm dependency: '" + packageName + "'.",
exc));
} finally {
if (!multistatus.isOK()) {
N4JSActivator.getInstance().getLog().log(multistatus);
getDisplay().asyncExec(() -> openError(
UIUtils.getShell(),
"npm Install Failed",
"Error while installing '" + packageName
+ "' npm package.\nPlease check your Error Log view for the detailed npm log about the failure."));
}
}
}
}
示例10: widgetSelected
import org.eclipse.core.runtime.MultiStatus; //導入方法依賴的package包/類
@Override
public void widgetSelected(final SelectionEvent e) {
final MultiStatus multistatus = statusHelper.createMultiStatus("Status of uninstalling npm dependencies.");
final InputDialog dialog = new InputDialog(UIUtils.getShell(), "npm Uninstall",
"Specify an npm package name to uninstall:", initalValue.get(), validator.get());
dialog.open();
final String packageName = dialog.getValue();
if (!StringExtensions.isNullOrEmpty(packageName) && dialog.getReturnCode() == Window.OK) {
try {
new ProgressMonitorDialog(UIUtils.getShell()).run(true, false, monitor -> {
multistatus.merge(uninstallAction.apply(Arrays.asList(packageName), monitor));
});
} catch (final InvocationTargetException | InterruptedException exc) {
multistatus.merge(
statusHelper.createError("Error while uninstalling npm dependency: '" + packageName + "'.",
exc));
} finally {
if (!multistatus.isOK()) {
N4JSActivator.getInstance().getLog().log(multistatus);
getDisplay().asyncExec(() -> openError(
UIUtils.getShell(),
"npm Uninstall Failed",
"Error while uninstalling '" + packageName
+ "' npm package.\nPlease check your Error Log view for the detailed npm log about the failure."));
}
}
}
}
示例11: refreshInstalledNpmPackagesInternal
import org.eclipse.core.runtime.MultiStatus; //導入方法依賴的package包/類
private IStatus refreshInstalledNpmPackagesInternal(final IProgressMonitor monitor) {
checkNotNull(monitor, "monitor");
final Collection<String> packageNames = getAllNpmProjectsMapping().keySet();
if (packageNames.isEmpty()) {
return statusHelper.OK();
}
final SubMonitor subMonitor = SubMonitor.convert(monitor, packageNames.size() + 1);
try {
logger.logInfo(LINE_DOUBLE);
logger.logInfo("Refreshing installed npm packages.");
subMonitor.setTaskName("Refreshing cache for type definitions files...");
performGitPull(subMonitor.newChild(1, SubMonitor.SUPPRESS_ALL_LABELS));
final MultiStatus refreshStatus = statusHelper
.createMultiStatus("Status of refreshing definitions for npm packages.");
for (final String packageName : packageNames) {
final IStatus status = refreshInstalledNpmPackage(packageName, false, subMonitor.newChild(1));
if (!status.isOK()) {
logger.logError(status);
refreshStatus.merge(status);
}
}
logger.logInfo("Installed npm packages have been refreshed.");
logger.logInfo(LINE_DOUBLE);
return refreshStatus;
} finally {
subMonitor.done();
}
}
示例12: queryHistory
import org.eclipse.core.runtime.MultiStatus; //導入方法依賴的package包/類
/**
* Queries history in item mode for the class's configured resource and
* returns the changesets found.
*
* Consumes one unit of work from the given {@link IProgressMonitor}.
*
* @param progressMonitor
* a progress monitor used for running {@link QueryHistoryCommand}; 1
* unit of work will be used by this method (must not be
* <code>null</code> )
* @param multiStatus
* a {@link MultiStatus} into which the status of the history query
* will be merged (must not be <code>null</code>)
* @return the changesets returned by the server, <code>null</code> if no
* changesets were returned by the server or the user cancelled
*/
private Changeset[] queryHistory(final IProgressMonitor progressMonitor, final MultiStatus multiStatus)
throws Exception {
Check.notNull(progressMonitor, "progressMonitor"); //$NON-NLS-1$
Check.notNull(multiStatus, "multiStatus"); //$NON-NLS-1$
try {
final String messageFormat = Messages.getString("AnnotateCommand.ProgressQueryingHistoryFormat"); //$NON-NLS-1$
final String message = MessageFormat.format(messageFormat, resource.getLocation().toOSString());
progressMonitor.setTaskName(message);
final QueryHistoryCommand queryHistoryCommand = new QueryHistoryCommand(
repository,
resource.getLocation().toOSString(),
new WorkspaceVersionSpec(repository.getWorkspace()),
RecursionType.NONE,
BEGINNING_OF_TIME,
new WorkspaceVersionSpec(repository.getWorkspace()));
final IStatus status = queryHistoryCommand.run(new NullProgressMonitor());
multiStatus.merge(status);
return queryHistoryCommand.getChangesets();
} finally {
progressMonitor.worked(1);
}
}
示例13: fromString
import org.eclipse.core.runtime.MultiStatus; //導入方法依賴的package包/類
public static SVNRepositoryLocation fromString(String location)
throws SVNException {
try {
return fromString(location, false);
} catch (SVNException e) {
// Parsing failed. Include a status that
// shows the passed location and the proper form
MultiStatus error = new MultiStatus(SVNProviderPlugin.ID, SVNStatus.ERROR, Policy.bind("SVNRepositoryLocation.invalidFormat", new Object[] { location }), null); //$NON-NLS-1$
error.merge(new SVNStatus(SVNStatus.ERROR, Policy.bind("SVNRepositoryLocation.locationForm"))); //$NON-NLS-1$
error.merge(e.getStatus());
throw new SVNException(error);
}
}
示例14: getStatusToDisplay
import org.eclipse.core.runtime.MultiStatus; //導入方法依賴的package包/類
/**
* Return the status to be displayed in an error dialog for the given list
* of non-OK status.
*
* This method can be overridden by subclasses. Returning an OK status will
* prevent the error dialog from being shown.
*/
protected IStatus getStatusToDisplay(IStatus[] problems) {
if (problems.length == 1) {
return problems[0];
}
MultiStatus combinedStatus = new MultiStatus(SVNUIPlugin.ID, 0, getMultiStatusMessage(), null); //$NON-NLS-1$
for (int i = 0; i < problems.length; i++) {
combinedStatus.merge(problems[i]);
}
return combinedStatus;
}
示例15: upgradeProjects
import org.eclipse.core.runtime.MultiStatus; //導入方法依賴的package包/類
/**
* Perform the upgrade.
*/
private IStatus upgradeProjects(Collection<IProject> projects, SubMonitor progress) {
progress.setWorkRemaining(projects.size());
MultiStatus status = StatusUtil.multi(this, Messages.getString("updating.projects.jobname")); //$NON-NLS-1$
for (IProject project : projects) {
progress.subTask(Messages.getString("updating.project", project.getName())); //$NON-NLS-1$
IStatus result = CloudToolsEclipseProjectUpdater.updateProject(project, progress.newChild(1));
status.merge(result);
}
// rewrite if OK as otherwise Progress View shows the "Updating projects for..." message
return StatusUtil.filter(status);
}
開發者ID:GoogleCloudPlatform,項目名稱:google-cloud-eclipse,代碼行數:15,代碼來源:CloudToolsEclipseProjectNotifier.java