本文整理匯總了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();
}
}