當前位置: 首頁>>代碼示例>>Java>>正文


Java IStatus.getMessage方法代碼示例

本文整理匯總了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());
		}
	}
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:21,代碼來源:N4jscBase.java

示例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;
	}
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:26,代碼來源:AbstractN4JSPreferencePage.java

示例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);
	}
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:23,代碼來源:ResourceManagerTest.java

示例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);
	}
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:23,代碼來源:ResourceManagerTest.java

示例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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:10,代碼來源:BugzillaExecutor.java

示例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);
	}
	
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:28,代碼來源:ResourceManagerTest.java

示例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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:54,代碼來源:BugzillaExecutor.java


注:本文中的org.eclipse.core.runtime.IStatus.getMessage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。