本文整理汇总了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$
}
示例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;
}
示例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);
}
}
示例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();
}
}
示例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 );
}
}
}
示例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;
}