本文整理汇总了Java中org.eclipse.core.runtime.MultiStatus.add方法的典型用法代码示例。如果您正苦于以下问题:Java MultiStatus.add方法的具体用法?Java MultiStatus.add怎么用?Java MultiStatus.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.core.runtime.MultiStatus
的用法示例。
在下文中一共展示了MultiStatus.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import org.eclipse.core.runtime.MultiStatus; //导入方法依赖的package包/类
@Override
public void run ( final IAction action )
{
final MultiStatus status = new MultiStatus ( Activator.PLUGIN_ID, 0, this.message, null );
for ( final Item item : this.items )
{
try
{
processItem ( item );
}
catch ( final PartInitException e )
{
status.add ( e.getStatus () );
}
}
if ( !status.isOK () )
{
showError ( status );
}
}
示例2: handleRemove
import org.eclipse.core.runtime.MultiStatus; //导入方法依赖的package包/类
protected void handleRemove ()
{
final MultiStatus ms = new MultiStatus ( Activator.PLUGIN_ID, 0, "Removing key providers", null );
for ( final KeyProvider provider : this.selectedProviders )
{
try
{
this.factory.remove ( provider );
}
catch ( final Exception e )
{
ms.add ( StatusHelper.convertStatus ( Activator.PLUGIN_ID, e ) );
}
}
if ( !ms.isOK () )
{
ErrorDialog.openError ( getShell (), "Error", null, ms );
}
}
示例3: handleOpen
import org.eclipse.core.runtime.MultiStatus; //导入方法依赖的package包/类
public static void handleOpen ( final IWorkbenchPage page, final ISelection selection )
{
final MultiStatus status = new MultiStatus ( Activator.PLUGIN_ID, 0, "Open editor", null );
final IEditorInput[] inputs = EditorHelper.createInput ( selection );
for ( final IEditorInput input : inputs )
{
try
{
if ( input instanceof ConfigurationEditorInput )
{
page.openEditor ( input, MultiConfigurationEditor.EDITOR_ID, true );
}
else if ( input instanceof FactoryEditorInput )
{
page.openEditor ( input, FactoryEditor.EDITOR_ID, true );
}
}
catch ( final PartInitException e )
{
status.add ( e.getStatus () );
}
}
}
示例4: execute
import org.eclipse.core.runtime.MultiStatus; //导入方法依赖的package包/类
@Override
public Object execute ( final ExecutionEvent event ) throws ExecutionException
{
final MultiStatus ms = new MultiStatus ( HivesPlugin.PLUGIN_ID, 0, getLabel (), null );
for ( final ServerLifecycle server : SelectionHelper.iterable ( getSelection (), ServerLifecycle.class ) )
{
try
{
process ( server );
}
catch ( final CoreException e )
{
ms.add ( e.getStatus () );
}
}
if ( !ms.isOK () )
{
StatusManager.getManager ().handle ( ms, StatusManager.SHOW );
}
return null;
}
示例5: combine
import org.eclipse.core.runtime.MultiStatus; //导入方法依赖的package包/类
public static IStatus combine(
final String pluginId,
final int code,
final String message,
final IStatus one,
final IStatus two) {
if (one == null && two == null) {
return null;
}
final MultiStatus newStatus = new MultiStatus(pluginId, code, message, null);
if (one != null && one.isMultiStatus()) {
newStatus.addAll(one);
} else if (one != null) {
newStatus.add(one);
}
if (two != null && two.isMultiStatus()) {
newStatus.addAll(two);
} else if (two != null) {
newStatus.add(two);
}
return newStatus;
}
示例6: handleErrors
import org.eclipse.core.runtime.MultiStatus; //导入方法依赖的package包/类
protected void handleErrors(IStatus[] errors) throws SVNException {
if (errors.length == 0) return;
if (errors.length == 1 && statusCount == 1) {
throw new SVNException(errors[0]);
}
MultiStatus result = new MultiStatus(SVNUIPlugin.ID, 0, getErrorMessage(errors, statusCount), null);
for (int i = 0; i < errors.length; i++) {
IStatus s = errors[i];
if (s.isMultiStatus()) {
result.add(new SVNStatus(s.getSeverity(), s.getMessage(), s.getException()));
result.addAll(s);
} else {
result.add(s);
}
}
throw new SVNException(result);
}
示例7: filter
import org.eclipse.core.runtime.MultiStatus; //导入方法依赖的package包/类
/**
* Return a simplified status by discarding all OK child statuses.
*/
public static IStatus filter(IStatus status) {
if (!status.isMultiStatus()) {
return status;
} else if (status.isOK()) {
// return OK_STATUS to avoids oddities like Progress View showing the MultiStatus's
// error message
return Status.OK_STATUS;
}
MultiStatus newStatus = new MultiStatus(status.getPlugin(), status.getCode(),
status.getMessage(), status.getException());
for (IStatus child : status.getChildren()) {
if (!child.isOK()) {
newStatus.add(filter(child));
}
}
return newStatus;
}
示例8: checkConflicts
import org.eclipse.core.runtime.MultiStatus; //导入方法依赖的package包/类
/**
* Check for known conflicting settings.
*/
@VisibleForTesting
static IStatus checkConflicts(RunConfiguration ours, RunConfiguration theirs,
MultiStatus status) {
Class<?> clazz = LocalAppEngineServerLaunchConfigurationDelegate.class;
// use {0,number,#} to avoid localized port numbers
if (equalPorts(ours.getPort(), theirs.getPort(),
LocalAppEngineServerBehaviour.DEFAULT_SERVER_PORT)) {
status.add(StatusUtil.error(clazz,
Messages.getString("server.port", //$NON-NLS-1$
ifNull(ours.getPort(), LocalAppEngineServerBehaviour.DEFAULT_SERVER_PORT))));
}
if (equalPorts(ours.getApiPort(), theirs.getApiPort(), 0)) {
// ours.getAdminPort() will never be null with a 0 default
Preconditions.checkNotNull(ours.getApiPort());
status.add(StatusUtil.error(clazz, Messages.getString("api.port", ours.getAdminPort()))); //$NON-NLS-1$
}
return status;
}
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:23,代码来源:LocalAppEngineServerLaunchConfigurationDelegate.java
示例9: resolveAll
import org.eclipse.core.runtime.MultiStatus; //导入方法依赖的package包/类
@Override
public IStatus resolveAll(IJavaProject javaProject, IProgressMonitor monitor) {
try {
MultiStatus status = StatusUtil.multi(this, Messages.getString("TaskResolveLibrariesError")); //$NON-NLS-1$
IClasspathEntry[] rawClasspath = javaProject.getRawClasspath();
SubMonitor subMonitor = SubMonitor.convert(monitor,
Messages.getString("TaskResolveLibraries"), //$NON-NLS-1$
getTotalWork(rawClasspath));
for (IClasspathEntry classpathEntry : rawClasspath) {
if (classpathEntry.getPath().segment(0)
.equals(LibraryClasspathContainer.CONTAINER_PATH_PREFIX)) {
IStatus resolveContainerStatus =
resolveContainer(javaProject, classpathEntry.getPath(), subMonitor.newChild(1));
status.add(resolveContainerStatus);
}
}
// rewrite if OK as otherwise Progress View shows the resolving error message
return StatusUtil.filter(status);
} catch (CoreException ex) {
return StatusUtil.error(this,
Messages.getString("TaskResolveLibrariesError"), ex); //$NON-NLS-1$
}
}
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:24,代码来源:LibraryClasspathContainerResolverService.java
示例10: addModified
import org.eclipse.core.runtime.MultiStatus; //导入方法依赖的package包/类
private static IStatus addModified(IStatus status, IFile file) {
IStatus entry =
JavaUIStatus.createError(
IJavaStatusConstants.VALIDATE_EDIT_CHANGED_CONTENT,
Messages.format(
CorextMessages.Resources_fileModified,
BasicElementLabels.getPathLabel(file.getFullPath(), false)),
null);
if (status == null) {
return entry;
} else if (status.isMultiStatus()) {
((MultiStatus) status).add(entry);
return status;
} else {
MultiStatus result =
new MultiStatus(
JavaPlugin.getPluginId(),
IJavaStatusConstants.VALIDATE_EDIT_CHANGED_CONTENT,
CorextMessages.Resources_modifiedResources,
null);
result.add(status);
result.add(entry);
return result;
}
}
示例11: deleteMarkers
import org.eclipse.core.runtime.MultiStatus; //导入方法依赖的package包/类
/**
* Delete all Markers with the given type.
*
* @param resource
* @param type
* @param includeSubtypes
* @return IMarker[]
* @throws CoreException
* with a multi-status problems in case some markers where not successfully deleted.
*/
public static void deleteMarkers(IUniformResource resource, String type, boolean includeSubtypes)
throws CoreException
{
IMarker[] toDelete = findMarkers(resource, type, includeSubtypes);
MultiStatus status = new MultiStatus(CorePlugin.PLUGIN_ID, 0, "Errors deleting markers", null); //$NON-NLS-1$
for (IMarker marker : toDelete)
{
try
{
marker.delete();
}
catch (CoreException e)
{
status.add(new Status(IStatus.ERROR, CorePlugin.PLUGIN_ID, e.getMessage(), e));
}
}
if (status.getChildren().length > 0)
{
throw new CoreException(status);
}
}
示例12: addOutOfSync
import org.eclipse.core.runtime.MultiStatus; //导入方法依赖的package包/类
private static IStatus addOutOfSync(IStatus status, IResource resource) {
IStatus entry= new Status(
IStatus.ERROR,
ResourcesPlugin.PI_RESOURCES,
IResourceStatus.OUT_OF_SYNC_LOCAL,
Messages.format(CorextMessages.Resources_outOfSync, BasicElementLabels.getPathLabel(resource.getFullPath(), false)),
null);
if (status == null) {
return entry;
} else if (status.isMultiStatus()) {
((MultiStatus)status).add(entry);
return status;
} else {
MultiStatus result= new MultiStatus(
ResourcesPlugin.PI_RESOURCES,
IResourceStatus.OUT_OF_SYNC_LOCAL,
CorextMessages.Resources_outOfSyncResources, null);
result.add(status);
result.add(entry);
return result;
}
}
示例13: getRequiredPackageFragmentRoots
import org.eclipse.core.runtime.MultiStatus; //导入方法依赖的package包/类
/**
* @param classpathEntries the path to the package fragment roots
* @param projectName the root of the project dependency tree
* @param status a status to report problems to
* @return all package fragment roots corresponding to each classpath entry start the search at project with projectName
*/
private static IPackageFragmentRoot[] getRequiredPackageFragmentRoots(IPath[] classpathEntries, final String projectName, MultiStatus status) {
ArrayList<IPackageFragmentRoot> result= new ArrayList<IPackageFragmentRoot>();
IJavaProject[] searchOrder= getProjectSearchOrder(projectName);
for (int i= 0; i < classpathEntries.length; i++) {
IPath entry= classpathEntries[i];
IPackageFragmentRoot[] elements= findRootsForClasspath(entry, searchOrder);
if (elements == null) {
status.add(new Status(IStatus.WARNING, JavaUI.ID_PLUGIN, Messages.format(FatJarPackagerMessages.FatJarPackageWizardPage_error_missingClassFile, BasicElementLabels.getPathLabel(entry, false))));
} else {
for (int j= 0; j < elements.length; j++) {
result.add(elements[j]);
}
}
}
return result.toArray(new IPackageFragmentRoot[result.size()]);
}
示例14: getSelectedElementsWithoutContainedChildren
import org.eclipse.core.runtime.MultiStatus; //导入方法依赖的package包/类
public static Object[] getSelectedElementsWithoutContainedChildren(ILaunchConfiguration launchconfig, JarPackageData data, IRunnableContext context, MultiStatus status) throws CoreException {
if (launchconfig == null)
return new Object[0];
String projectName= launchconfig.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, ""); //$NON-NLS-1$
IPath[] classpath= getClasspath(launchconfig);
IPackageFragmentRoot[] classpathResources= getRequiredPackageFragmentRoots(classpath, projectName, status);
String mainClass= getMainClass(launchconfig, status);
IType mainType= findMainMethodByName(mainClass, classpathResources, context);
if (mainType == null) {
status.add(new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, FatJarPackagerMessages.FatJarPackageWizardPage_error_noMainMethod));
}
data.setManifestMainClass(mainType);
return classpathResources;
}
示例15: handleFinishedDropMove
import org.eclipse.core.runtime.MultiStatus; //导入方法依赖的package包/类
private void handleFinishedDropMove(DragSourceEvent event) {
MultiStatus status= new MultiStatus(
JavaPlugin.getPluginId(),
IJavaStatusConstants.INTERNAL_ERROR,
JavaUIMessages.ResourceTransferDragAdapter_cannot_delete_resource,
null);
List<IResource> resources= convertSelection();
for (Iterator<IResource> iter= resources.iterator(); iter.hasNext();) {
IResource resource= iter.next();
try {
resource.delete(true, null);
} catch (CoreException e) {
status.add(e.getStatus());
}
}
int childrenCount= status.getChildren().length;
if (childrenCount > 0) {
Shell parent= SWTUtil.getShell(event.widget);
ErrorDialog error= new ErrorDialog(parent,
JavaUIMessages.ResourceTransferDragAdapter_moving_resource,
childrenCount == 1 ? JavaUIMessages.ResourceTransferDragAdapter_cannot_delete_files_singular : Messages.format(
JavaUIMessages.ResourceTransferDragAdapter_cannot_delete_files_plural, String.valueOf(childrenCount)), status, IStatus.ERROR);
error.open();
}
}