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