本文整理汇总了Java中org.eclipse.core.runtime.IStatus.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java IStatus.getMessage方法的具体用法?Java IStatus.getMessage怎么用?Java IStatus.getMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.core.runtime.IStatus
的用法示例。
在下文中一共展示了IStatus.getMessage方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validateBinaries
import org.eclipse.core.runtime.IStatus; //导入方法依赖的package包/类
private void validateBinaries() throws ExitCodeException {
IStatus status = nodeJsBinaryProvider.get().validate();
if (!status.isOK()) {
System.out.println(status.getMessage());
if (null != status.getException()) {
dumpThrowable(status.getException());
}
throw new ExitCodeException(EXITCODE_CONFIGURATION_ERROR, status.getMessage(), status.getException());
}
if (null != targetPlatformFile) {
status = npmBinaryProvider.get().validate();
if (!status.isOK()) {
System.out.println(status.getMessage());
if (null != status.getException()) {
dumpThrowable(status.getException());
}
throw new ExitCodeException(EXITCODE_CONFIGURATION_ERROR, status.getMessage(), status.getException());
}
}
}
示例2: applyToStatusLine
import org.eclipse.core.runtime.IStatus; //导入方法依赖的package包/类
/** copied from PropertyAndPreferencePage */
private static void applyToStatusLine(DialogPage page, IStatus status) {
String message = status.getMessage();
if (message != null && message.length() == 0) {
message = null;
}
switch (status.getSeverity()) {
case IStatus.OK:
page.setMessage(message, IMessageProvider.NONE);
page.setErrorMessage(null);
break;
case IStatus.WARNING:
page.setMessage(message, IMessageProvider.WARNING);
page.setErrorMessage(null);
break;
case IStatus.INFO:
page.setMessage(message, IMessageProvider.INFORMATION);
page.setErrorMessage(null);
break;
default:
page.setMessage(null);
page.setErrorMessage(message);
break;
}
}
示例3: testLogExceptionThrowable
import org.eclipse.core.runtime.IStatus; //导入方法依赖的package包/类
@Test
public void testLogExceptionThrowable() throws Exception {
ILog log = Activator.getDefault().getLog();
String [] msg = new String [] {"",""};
ILogListener listener = new ILogListener() {
@Override
public void logging(IStatus status, String plugin) {
msg [0] = status.getMessage();
if (status.getSeverity()==IStatus.ERROR) {
msg [1] = "error";
}
}
};
log.addLogListener(listener);
try {
ResourceManager.logException(new Exception("test"));
assertEquals("test",msg [0]);
assertEquals("error",msg [1]);
} finally {
log.removeLogListener(listener);
}
}
示例4: testLogExceptionThrowableString
import org.eclipse.core.runtime.IStatus; //导入方法依赖的package包/类
@Test
public void testLogExceptionThrowableString() throws Exception {
ILog log = Activator.getDefault().getLog();
String [] msg = new String [] {"",""};
ILogListener listener = new ILogListener() {
@Override
public void logging(IStatus status, String plugin) {
msg [0] = status.getMessage();
if (status.getSeverity()==IStatus.ERROR) {
msg [1] = "error";
}
}
};
log.addLogListener(listener);
try {
ResourceManager.logException(new Exception("message"));
assertEquals("message",msg [0]);
assertEquals("error",msg [1]);
} finally {
log.removeLogListener(listener);
}
}
示例5: getMessage
import org.eclipse.core.runtime.IStatus; //导入方法依赖的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;
}
示例6: testLogInfo
import org.eclipse.core.runtime.IStatus; //导入方法依赖的package包/类
@Test
public void testLogInfo() throws Exception {
ILog log = Activator.getDefault().getLog();
String [] msg = new String [] {"",""};
ILogListener listener = new ILogListener() {
@Override
public void logging(IStatus status, String plugin) {
msg [0] = status.getMessage();
if (status.getSeverity()==IStatus.INFO) {
msg [1] = "info";
}
}
};
log.addLogListener(listener);
IJavaProject jp = null;
try {
jp = ProjectHelper.getOrCreateSimpleGW4EProject(PROJECT_NAME, false, false);
PreferenceManager.setLogInfoEnabled (jp.getProject().getName(),true);
ResourceManager.logInfo(jp.getProject().getName(), "infomessage");
assertEquals("infomessage",msg [0]);
assertEquals("info",msg [1]);
} finally {
PreferenceManager.setLogInfoEnabled (jp.getProject().getName(),false);
log.removeLogListener(listener);
}
}
示例7: handleStatus
import org.eclipse.core.runtime.IStatus; //导入方法依赖的package包/类
/**
* Returnes true if the given commands status != ok
* @param cmd
* @param handleExceptions
* @return
* @throws CoreException
*/
private boolean handleStatus(SynchronizeQueryCommand cmd, boolean handleExceptions) throws CoreException {
IStatus status = cmd.getStatus();
if(status == null || status.isOK()) {
return false;
}
Bugzilla.LOG.log(Level.FINE, "command {0} returned status : {1}", new Object[] {cmd, status.getMessage()}); // NOI18N
if (status.getException() instanceof CoreException) {
throw (CoreException) status.getException();
}
boolean isHtml = false;
String errMsg = null;
if(status instanceof RepositoryStatus) {
RepositoryStatus rstatus = (RepositoryStatus) status;
errMsg = rstatus.getHtmlMessage();
isHtml = errMsg != null;
}
if(errMsg == null) {
errMsg = status.getMessage();
}
cmd.setErrorMessage(errMsg);
cmd.setFailed(true);
if(!handleExceptions) {
return true;
}
BugzillaConfiguration conf = repository.getConfiguration();
if(conf.isValid()) {
BugzillaVersion version = conf.getInstalledVersion();
if(version.compareMajorMinorOnly(BugzillaAutoupdate.SUPPORTED_BUGZILLA_VERSION) > 0) {
notifyErrorMessage(
NbBundle.getMessage(BugzillaExecutor.class, "MSG_BUGZILLA_ERROR_WARNING", status.getMessage()) + "\n\n" +
NbBundle.getMessage(BugzillaExecutor.class, "MSG_BUGZILLA_VERSION_WARNING1", version) + "\n" + // NOI18N
(true ? NbBundle.getMessage(BugzillaExecutor.class, "MSG_BUGZILLA_VERSION_WARNING2") : "")); // NOI18N
return true;
}
}
if(isHtml) {
notifyHtmlMessage(errMsg, repository, true);
} else {
notifyErrorMessage(NbBundle.getMessage(BugzillaExecutor.class, "MSG_BUGZILLA_ERROR_WARNING", errMsg)); // NOI18N
}
return true;
}