当前位置: 首页>>代码示例>>Java>>正文


Java CoreException.getStatus方法代码示例

本文整理汇总了Java中org.eclipse.core.runtime.CoreException.getStatus方法的典型用法代码示例。如果您正苦于以下问题:Java CoreException.getStatus方法的具体用法?Java CoreException.getStatus怎么用?Java CoreException.getStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.core.runtime.CoreException的用法示例。


在下文中一共展示了CoreException.getStatus方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getNotFoundError

import org.eclipse.core.runtime.CoreException; //导入方法依赖的package包/类
private static String getNotFoundError(CoreException ce) {
    IStatus status = ce.getStatus();
    Throwable t = status.getException();
    if(t instanceof UnknownHostException ||
       // XXX maybe a different msg ?     
       t instanceof SocketTimeoutException || 
       t instanceof NoRouteToHostException ||
       t instanceof ConnectException) 
    {
        Bugzilla.LOG.log(Level.FINER, null, t);
        return NbBundle.getMessage(BugzillaExecutor.class, "MSG_HOST_NOT_FOUND");                   // NOI18N
    }
    String msg = getMessage(ce);
    if(msg != null) {
        msg = msg.trim().toLowerCase();
        if(HTTP_ERROR_NOT_FOUND.equals(msg)) {
            Bugzilla.LOG.log(Level.FINER, "returned error message [{0}]", msg);                     // NOI18N
            return NbBundle.getMessage(BugzillaExecutor.class, "MSG_HOST_NOT_FOUND");               // NOI18N
        }
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:BugzillaExecutor.java

示例2: handleCoreException

import org.eclipse.core.runtime.CoreException; //导入方法依赖的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

示例3: getKenaiRedirectError

import org.eclipse.core.runtime.CoreException; //导入方法依赖的package包/类
private static String getKenaiRedirectError(CoreException ce) {
    IStatus status = ce.getStatus();
    if(status == null) {
        return null;
    }
    Throwable cause = status.getException();
    if(cause != null && cause instanceof RedirectException) {
        String msg = cause.getMessage();
        if(msg.contains(KENAI_LOGIN_REDIRECT)) {
            Bugzilla.LOG.log(Level.FINER, "returned error message [{0}]", msg);                     // NOI18N
            return NbBundle.getMessage(BugzillaExecutor.class, "MSG_INVALID_USERNAME_OR_PASSWORD"); // NOI18N
        }
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:BugzillaExecutor.java

示例4: getMessage

import org.eclipse.core.runtime.CoreException; //导入方法依赖的package包/类
static String getMessage(CoreException ce) {
    String msg = ce.getMessage();
    if(msg != null && !msg.trim().equals("")) {                             // NOI18N
        return msg;
    }
    IStatus status = ce.getStatus();
    msg = status != null ? status.getMessage() : null;
    return msg != null ? msg.trim() : null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:BugzillaExecutor.java

示例5: notifyError

import org.eclipse.core.runtime.CoreException; //导入方法依赖的package包/类
private static void notifyError(CoreException ce, BugzillaRepository repository) {
    String msg = getMessage(ce);
    IStatus status = ce.getStatus();
    if (status instanceof BugzillaStatus) {
        BugzillaStatus bs = (BugzillaStatus) status;
        BugzillaUserMatchResponse res = bs.getUserMatchResponse();
        
        if(res != null) {
            String assignedMsg = res.getAssignedToMsg();
            String newCCMsg = res.getNewCCMsg();
            String qaContactMsg = res.getQaContactMsg();

            StringBuilder sb = new StringBuilder();
            if(msg != null) {
                sb.append(msg);
            }
            if(assignedMsg != null) {
                sb.append('\n');
                sb.append(assignedMsg);
            }
            if (newCCMsg != null) {
                sb.append('\n');
                sb.append(newCCMsg);
            }
            if (qaContactMsg != null) {
                sb.append('\n');
                sb.append(qaContactMsg);
            }
            msg = sb.toString();
        }
    }
    
    if (msg == null && status instanceof RepositoryStatus) {
        RepositoryStatus rs = (RepositoryStatus) status;
        String html = rs.getHtmlMessage();
        if(notifyHtmlMessage(html, repository, msg == null)) return;
    }
    notifyErrorMessage(msg);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:40,代码来源:BugzillaExecutor.java

示例6: handleException

import org.eclipse.core.runtime.CoreException; //导入方法依赖的package包/类
public static void handleException(Exception exception) throws Throwable {
        if (exception instanceof CoreException) {
            CoreException e = (CoreException) exception;
            IStatus status = e.getStatus();
            if (status instanceof RepositoryStatus) {
                RepositoryStatus rs = (RepositoryStatus) status;
                String html = rs.getHtmlMessage();
                if(html != null && !html.trim().equals("")) {
//                    HtmlBrowser.URLDisplayer displayer = HtmlBrowser.URLDisplayer.getDefault ();
//                    if (displayer != null) {
//                        displayer.showURL (url);
//                    } else {
//                        //LOG.info("No URLDisplayer found.");
//                    }

                    final HtmlPanel p = new HtmlPanel();
                    p.setHtml(html);
                    BugzillaUtil.show(p, "html", "ok");
                }
                throw new Exception(rs.getHtmlMessage());
            }
            if (e.getStatus().getException() != null) {
                throw e.getStatus().getException();
            }
            if (e.getCause() != null) {
                throw e.getCause();
            }
            throw e;
        }
        exception.printStackTrace();
        throw exception;
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:33,代码来源:TestUtil.java


注:本文中的org.eclipse.core.runtime.CoreException.getStatus方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。