类org.eclipse.core.runtime.ILog源码实例Demo

下面列出了怎么用org.eclipse.core.runtime.ILog的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: n4js   文件: EclipseLogAppender.java
@Override
protected void append(LoggingEvent event) {
	if (isDoLog(event.getLevel())) {
		String logString = layout.format(event);

		ILog myLog = getLog();
		if (myLog != null) {
			String loggerName = event.getLoggerName();
			int severity = mapLevel(event.getLevel());
			final Throwable throwable = event.getThrowableInformation() != null ? event.getThrowableInformation()
					.getThrowable() : null;
			IStatus status = createStatus(severity, loggerName, logString, throwable);

			// Injector injector = N4JSActivator.getInstance().getInjector(N4JSActivator.ORG_ECLIPSE_N4JS_N4JS);
			// if (injector != null) {
			getLog().log(status);
			// }
		} else {
			// nothing to do (message should be logged to stdout by default appender)
		}
	}
}
 
源代码2 项目: xtext-eclipse   文件: EclipseLogAppender.java
@Override
protected void append(LoggingEvent event) {
	if (isDoLog(event.getLevel())) {
		String logString = layout.format(event);

		ILog myLog = getLog();
		if (myLog != null) {
			String loggerName = event.getLoggerName();
			int severity = mapLevel(event.getLevel());
			final Throwable throwable = event.getThrowableInformation() != null ? event.getThrowableInformation()
					.getThrowable() : null;
			IStatus status = createStatus(severity, loggerName, logString, throwable);
			getLog().log(status);
		} else {
			// nothing to do (message should be logged to stdout by default appender)
		}
	}
}
 
源代码3 项目: EasyMPermission   文件: ProblemReporter.java
private void msg(int msgType, String message, Throwable error) {
	int ct = squelchTimeout != 0L ? 0 : counter.incrementAndGet();
	boolean printSquelchWarning = false;
	if (squelchTimeout != 0L) {
		long now = System.currentTimeMillis();
		if (squelchTimeout > now) return;
		squelchTimeout = now + SQUELCH_TIMEOUT;
		printSquelchWarning = true;
	} else if (ct >= MAX_LOG) {
		squelchTimeout = System.currentTimeMillis() + SQUELCH_TIMEOUT;
		printSquelchWarning = true;
	}
	ILog log = Platform.getLog(bundle);
	log.log(new Status(msgType, DEFAULT_BUNDLE_NAME, message, error));
	if (printSquelchWarning) {
		log.log(new Status(IStatus.WARNING, DEFAULT_BUNDLE_NAME, "Lombok has logged too many messages; to avoid memory issues, further lombok logs will be squelched for a while. Restart eclipse to start over."));
	}
}
 
@Override
public void presentUpdateDetails(Shell shell, String updateSiteUrl, ILog log,
    String pluginId) {
  try {
    InstallUpdateHandler.launch(updateSiteUrl);
  } catch (Throwable t) {
    // Log, and fallback on dialog
    log.log(new Status(IStatus.WARNING, pluginId,
        "Could not open install wizard", t));

    MessageDialog.openInformation(
        shell,
        DEFAULT_DIALOG_TITLE,
        "An update is available for the GWT Plugin for Eclipse.  Go to \"Help > Install New Software\" to install it.");
  }
}
 
源代码5 项目: birt   文件: DocumentProvider.java
/**
 * Defines the standard procedure to handle <code>CoreExceptions</code>.
 * Exceptions are written to the plug-in log.
 * 
 * @param exception
 *            the exception to be logged
 * @param message
 *            the message to be logged
 */
protected void handleCoreException( CoreException exception, String message )
{

	Bundle bundle = Platform.getBundle( PlatformUI.PLUGIN_ID );
	ILog log = Platform.getLog( bundle );

	if ( message != null )
		log.log( new Status( IStatus.ERROR,
				PlatformUI.PLUGIN_ID,
				0,
				message,
				exception ) );
	else
		log.log( exception.getStatus( ) );
}
 
@Override
protected void setUp() throws Exception {
  ref = mock(IResourceTaskReference.class);
  ilog = mock(ILog.class);
  prefs = mock(IMechanicPreferences.class);
  log = new MechanicLog(ilog);
  super.setUp();
}
 
PlatformHolder(ILog log) {
	this.log = log;
	final IWorkspace workspace = ResourcesPlugin.getWorkspace();
	for (final IProject project : workspace.getRoot().getProjects()) {
		if (Platform.isPlatformProject(project)) {
			platformProjectAdded(project);
		}
	}
	
	addResourceChangeListenerToWorkspace();
}
 
源代码8 项目: ermasterr   文件: TestEditor.java
protected void validateState(final IEditorInput input) {

        final IDocumentProvider provider = getDocumentProvider();
        if (!(provider instanceof IDocumentProviderExtension))
            return;

        final IDocumentProviderExtension extension = (IDocumentProviderExtension) provider;

        try {

            extension.validateState(input, getSite().getShell());

        } catch (final CoreException x) {
            final IStatus status = x.getStatus();
            if (status == null || status.getSeverity() != IStatus.CANCEL) {
                final Bundle bundle = Platform.getBundle(PlatformUI.PLUGIN_ID);
                final ILog log = Platform.getLog(bundle);
                log.log(x.getStatus());

                final Shell shell = getSite().getShell();
                final String title = "EditorMessages.Editor_error_validateEdit_title";
                final String msg = "EditorMessages.Editor_error_validateEdit_message";
                ErrorDialog.openError(shell, title, msg, x.getStatus());
            }
            return;
        }

        if (fSourceViewer != null)
            fSourceViewer.setEditable(isEditable());

    }
 
源代码9 项目: sarl   文件: Slf4jEclipseLoggerFactory.java
/** Replies the Eclipse logger to be used.
 *
 * @return the logger.
 */
protected synchronized ILog getEclipseLogger() {
	if (this.eclipseLogger == null) {
		this.eclipseLogger = InternalPlatform.getDefault().getLog(getBundle());
	}
	return this.eclipseLogger;
}
 
源代码10 项目: sarl   文件: SARLMavenEclipsePluginTest.java
@Before
public void setUp() {
	this.old = Debug.out;
	Debug.out = mock(PrintStream.class);
	this.logger = mock(ILog.class);
	// Cannot create a "spyied" version of getILog() since it
	// will be directly called by the underlying implementation.
	// For providing a mock for the ILog, only subclassing is working.
	this.plugin = new SARLMavenEclipsePlugin() {
		public ILog getILog() {
			return logger;
		}
	};
	SARLMavenEclipsePlugin.setDefault(this.plugin);
}
 
源代码11 项目: sarl   文件: SARLEclipsePluginTest.java
@Before
public void setUp() {
	this.old = Debug.out;
	Debug.out = mock(PrintStream.class);
	this.logger = mock(ILog.class);
	// Cannot create a "spyied" version of getILog() since it
	// will be directly called by the underlying implementation.
	// For providing a mock for the ILog, only subclassing is working.
	this.plugin = new SARLEclipsePlugin() {
		public ILog getILog() {
			return logger;
		}
	};
	SARLEclipsePlugin.setDefault(this.plugin);
}
 
源代码12 项目: uima-uimaj   文件: EP_LogThrowErrorImpl.java
@Override
public void newError(int severity, String message, Exception exception) {
  String pluginId = JgPlugin.getUniqueIdentifier();        
  ILog log = JgPlugin.getDefault().getLog();
  log.log(new Status(logLevels[severity], pluginId, IStatus.OK, message, exception));
  if (IError.WARN < severity)
    throw new ErrorExit();
}
 
源代码13 项目: ermaster-b   文件: TestEditor.java
protected void validateState(IEditorInput input) {

		IDocumentProvider provider = getDocumentProvider();
		if (!(provider instanceof IDocumentProviderExtension))
			return;

		IDocumentProviderExtension extension = (IDocumentProviderExtension) provider;

		try {

			extension.validateState(input, getSite().getShell());

		} catch (CoreException x) {
			IStatus status = x.getStatus();
			if (status == null || status.getSeverity() != IStatus.CANCEL) {
				Bundle bundle = Platform.getBundle(PlatformUI.PLUGIN_ID);
				ILog log = Platform.getLog(bundle);
				log.log(x.getStatus());

				Shell shell = getSite().getShell();
				String title = "EditorMessages.Editor_error_validateEdit_title";
				String msg = "EditorMessages.Editor_error_validateEdit_message";
				ErrorDialog.openError(shell, title, msg, x.getStatus());
			}
			return;
		}

		if (fSourceViewer != null)
			fSourceViewer.setEditable(isEditable());

	}
 
源代码14 项目: n4js   文件: EclipseLogAppender.java
private ILog getLog() {
	ensureInitialized();
	return log;
}
 
源代码15 项目: neoscada   文件: GeneratorLocator.java
public GeneratorLocator ( final BundleContext context, final ILog log )
{
    this.context = context;
    this.log = log;
}
 
源代码16 项目: workspacemechanic   文件: MechanicLog.java
public MechanicLog(ILog log) {
  this.log = Preconditions.checkNotNull(log);
}
 
源代码17 项目: xtext-eclipse   文件: EclipseLogAppender.java
private ILog getLog() {
	ensureInitialized();
	return log;
}
 
源代码18 项目: LogViewer   文件: LoggerImpl.java
public LoggerImpl(ILog log, String pluginId) {
	this.log = log;
	this.pluginId = pluginId;
}
 
源代码19 项目: gwt-eclipse-plugin   文件: LogUtils.java
private static String getBundleSymbolicName(ILog log) {
  return log.getBundle().getSymbolicName();
}
 
void presentUpdateDetails(Shell shell, String updateSiteUrl, ILog log,
String pluginId);
 
源代码21 项目: developer-studio   文件: DeveloperStudioLog.java
public static ILog getLog() {
 return LOG;
}
 
源代码22 项目: goclipse   文件: LangCorePlugin.java
@Override
public void logStatus(StatusException se) {
	int severity = EclipseUtils.toEclipseSeverity(se);
	ILog log = LangCorePlugin.getInstance().getLog();
	log.log(EclipseCore.createStatus(severity, se.getMessage(), se.getCause()));
}
 
源代码23 项目: bonita-studio   文件: Activator.java
public ILog getLogger(){
    return Platform.getLog(Platform.getBundle(Activator.PLUGIN_ID));
}
 
源代码24 项目: gwt-eclipse-plugin   文件: LogUtils.java
/**
 * Log the specified error.
 * 
 * @param message a human-readable message, localized to the current locale.
 */
public static void logError(ILog log, String message) {
  logError(log, null, message);
}
 
源代码25 项目: gwt-eclipse-plugin   文件: LogUtils.java
/**
 * Log the specified error.
 * 
 * @param message a human-readable message, localized to the current locale.
 * @param args message arguments.
 */
public static void logError(ILog log, String message, Object... args) {
  logError(log, null, message, args);
}
 
源代码26 项目: gwt-eclipse-plugin   文件: LogUtils.java
/**
 * Log the specified error.
 * 
 * @param exception a low-level exception.
 */
public static void logError(ILog log, Throwable exception) {
  logError(log, exception, "Unexpected Exception");
}
 
源代码27 项目: gwt-eclipse-plugin   文件: LogUtils.java
/**
 * Log the specified error.
 * 
 * @param exception a low-level exception, or <code>null</code> if not
 *          applicable.
 * @param message a human-readable message, localized to the current locale.
 */
public static void logError(ILog log, Throwable exception, String message) {
  log(log, IStatus.ERROR, IStatus.OK, message, exception);
}
 
源代码28 项目: gwt-eclipse-plugin   文件: LogUtils.java
/**
 * Log the specified error.
 * 
 * @param exception a low-level exception, or <code>null</code> if not
 *          applicable.
 * @param message a human-readable message, localized to the current locale.
 * @param args message arguments.
 */
public static void logError(ILog log, Throwable exception, String message,
    Object... args) {
  message = MessageFormat.format(message, args);
  log(log, IStatus.ERROR, IStatus.OK, message, exception);
}
 
源代码29 项目: gwt-eclipse-plugin   文件: LogUtils.java
/**
 * Log the specified information.
 * 
 * @param message a human-readable message, localized to the current locale.
 */
public static void logInfo(ILog log, String message) {
  logInfo(log, message, new Object[0]);
}
 
源代码30 项目: gwt-eclipse-plugin   文件: LogUtils.java
/**
 * Log the specified information.
 * 
 * @param message a human-readable message, localized to the current locale.
 * @param args message arguments.
 */
public static void logInfo(ILog log, String message, Object... args) {
  message = MessageFormat.format(message, args);
  log(log, IStatus.INFO, IStatus.OK, message, null);
}
 
 类所在包
 同包方法