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