當前位置: 首頁>>代碼示例>>Java>>正文


Java MultiStatus.getChildren方法代碼示例

本文整理匯總了Java中org.eclipse.core.runtime.MultiStatus.getChildren方法的典型用法代碼示例。如果您正苦於以下問題:Java MultiStatus.getChildren方法的具體用法?Java MultiStatus.getChildren怎麽用?Java MultiStatus.getChildren使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.core.runtime.MultiStatus的用法示例。


在下文中一共展示了MultiStatus.getChildren方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: handleCoreException

import org.eclipse.core.runtime.MultiStatus; //導入方法依賴的package包/類
/**
 * Handles a core exception thrown during a testing environment operation
 */
private void handleCoreException(CoreException e) {
  e.printStackTrace();
  IStatus status = e.getStatus();
  String message = e.getMessage();
  if (status.isMultiStatus()) {
    MultiStatus multiStatus = (MultiStatus) status;
    IStatus[] children = multiStatus.getChildren();
    StringBuffer buffer = new StringBuffer();
    for (int i = 0, max = children.length; i < max; i++) {
      IStatus child = children[i];
      if (child != null) {
        buffer.append(child.getMessage());
        buffer.append(System.getProperty("line.separator"));//$NON-NLS-1$
        Throwable childException = child.getException();
        if (childException != null) {
          childException.printStackTrace();
        }
      }
    }
    message = buffer.toString();
  }
  Assert.isTrue(false, "Core exception in testing environment: " + message); //$NON-NLS-1$
}
 
開發者ID:RuiChen08,項目名稱:dacapobench,代碼行數:27,代碼來源:TestingEnvironment.java

示例2: isValid

import org.eclipse.core.runtime.MultiStatus; //導入方法依賴的package包/類
/**
 * @see nexcore.tool.uml.ui.core.project.ITreeNode#isValid()
 */
public boolean isValid() {
    IFile file = WorkspaceSynchronizer.getFile(eobject.eResource());
    try {
        file.deleteMarkers(IMarker.PROBLEM, true, 0);
        IStatus valid = ModelUpdater.isValid(file);
        if (valid.getSeverity() != IStatus.OK) {
            if (valid.isMultiStatus()) {
                MultiStatus status = (MultiStatus) valid;
                IStatus[] children = status.getChildren();
                for (IStatus s : children) {
                    IMarker createMarker = file.createMarker(IMarker.PROBLEM);
                    createMarker.setAttribute(IMarker.MESSAGE, s.getMessage());
                    createMarker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
                }
            }
        }
        return valid.getSeverity() == IStatus.OK;
    } catch (Exception e) {
        e.printStackTrace();
    }
    return false;
}
 
開發者ID:SK-HOLDINGS-CC,項目名稱:NEXCORE-UML-Modeler,代碼行數:26,代碼來源:UMLFileTreeNode.java

示例3: 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);
	}
}
 
開發者ID:apicloudcom,項目名稱:APICloud-Studio,代碼行數:32,代碼來源:MarkerUtils.java

示例4: 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();
	}
}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:26,代碼來源:ResourceTransferDragAdapter.java

示例5: throwMultiStatus

import org.eclipse.core.runtime.MultiStatus; //導入方法依賴的package包/類
public void throwMultiStatus ( final MultiStatus ms ) throws CoreException
{
    if ( !ms.isOK () )
    {
        if ( ms.getChildren ().length == 1 )
        {
            throw new CoreException ( ms.getChildren ()[0] );
        }
        else
        {
            throw new CoreException ( ms );
        }
    }
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:15,代碼來源:ServerDescriptorImpl.java

示例6: execute

import org.eclipse.core.runtime.MultiStatus; //導入方法依賴的package包/類
@Override
public Object execute ( final ExecutionEvent event ) throws ExecutionException
{
    final MultiStatus ms = new MultiStatus ( Activator.PLUGIN_ID, 0, "Opening preview", null );

    for ( final IFile file : SelectionHelper.iterable ( getSelection (), IFile.class ) )
    {
        final IEditorInput input = new FileEditorInput ( file );
        try
        {
            getActivePage ().openEditor ( input, PreviewEditorImpl.EDITOR_ID, true, IWorkbenchPage.MATCH_ID );
        }
        catch ( final PartInitException e )
        {
            ms.add ( e.getStatus () );
        }
    }

    if ( !ms.isOK () )
    {
        final IStatus[] childs = ms.getChildren ();
        if ( childs.length < 2 )
        {
            StatusManager.getManager ().handle ( childs[0], StatusManager.SHOW );
        }
        else
        {
            StatusManager.getManager ().handle ( ms, StatusManager.SHOW );
        }
    }

    return null;
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:34,代碼來源:PreviewHandler.java


注:本文中的org.eclipse.core.runtime.MultiStatus.getChildren方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。