Java Code Examples for org.eclipse.core.runtime.Platform#addLogListener()

The following examples show how to use org.eclipse.core.runtime.Platform#addLogListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LogHandler.java    From eclipse.jdt.ls with Eclipse Public License 2.0 5 votes vote down vote up
public void install(JavaClientConnection rcpConnection) {
	this.dateFormat = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM);
	this.logLevelMask = getLogLevelMask(System.getProperty("log.level", ""));//Empty by default
	this.connection = rcpConnection;

	this.logListener = new ILogListener() {
		@Override
		public void logging(IStatus status, String bundleId) {
			processLogMessage(status);
		}
	};
	Platform.addLogListener(this.logListener);
}
 
Example 2
Source File: AbstractSyntaxProjectsManagerBasedTest.java    From eclipse.jdt.ls with Eclipse Public License 2.0 5 votes vote down vote up
@Before
public void initProjectManager() throws Exception {
	clientRequests.clear();

	logListener = new SimpleLogListener();
	Platform.addLogListener(logListener);
	preferences = new Preferences();
	preferences.setRootPaths(Collections.singleton(new Path(getWorkingProjectDirectory().getAbsolutePath())));
	if (preferenceManager == null) {
		preferenceManager = mock(PreferenceManager.class);
	}
	initPreferenceManager(true);

	oldPreferenceManager = JavaLanguageServerPlugin.getPreferencesManager();
	JavaLanguageServerPlugin.setPreferencesManager(preferenceManager);
	projectsManager = new SyntaxProjectsManager(preferenceManager);
	monitor = new NullProgressMonitor();
	WorkingCopyOwner.setPrimaryBufferProvider(new WorkingCopyOwner() {
		@Override
		public IBuffer createBuffer(ICompilationUnit workingCopy) {
			ICompilationUnit original= workingCopy.getPrimary();
			IResource resource= original.getResource();
			if (resource instanceof IFile) {
				return new DocumentAdapter(workingCopy, (IFile)resource);
			}
			return DocumentAdapter.Null;
		}
	});
}
 
Example 3
Source File: AbstractProjectsManagerBasedTest.java    From eclipse.jdt.ls with Eclipse Public License 2.0 5 votes vote down vote up
@Before
public void initProjectManager() throws Exception {
	clientRequests.clear();

	logListener = new SimpleLogListener();
	Platform.addLogListener(logListener);
	preferences = new Preferences();
	preferences.setRootPaths(Collections.singleton(new Path(getWorkingProjectDirectory().getAbsolutePath())));
	preferences.setCodeGenerationTemplateGenerateComments(true);
	preferences.setMavenDownloadSources(true);
	if (preferenceManager == null) {
		preferenceManager = mock(StandardPreferenceManager.class);
	}
	initPreferenceManager(true);

	oldPreferenceManager = JavaLanguageServerPlugin.getPreferencesManager();
	JavaLanguageServerPlugin.setPreferencesManager(preferenceManager);
	projectsManager = new StandardProjectsManager(preferenceManager);
	ProgressReporterManager progressManager = new ProgressReporterManager(this.client, preferenceManager);
	progressManager.setReportThrottle(0);//disable throttling to ensure we capture all events
	Job.getJobManager().setProgressProvider(progressManager);
	monitor = progressManager.getDefaultMonitor();
	WorkingCopyOwner.setPrimaryBufferProvider(new WorkingCopyOwner() {
		@Override
		public IBuffer createBuffer(ICompilationUnit workingCopy) {
			ICompilationUnit original= workingCopy.getPrimary();
			IResource resource= original.getResource();
			if (resource instanceof IFile) {
				return new DocumentAdapter(workingCopy, (IFile)resource);
			}
			return DocumentAdapter.Null;
		}
	});
}
 
Example 4
Source File: ErrorLogListener.java    From dsl-devkit with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Registers the log listener.
 */
public void register() {
  Platform.addLogListener(logListener);
}
 
Example 5
Source File: ErrorLogListener.java    From goclipse with Eclipse Public License 1.0 4 votes vote down vote up
public ErrorLogListener(boolean register) {
	if(register) {
		Platform.addLogListener(this);
	}
}
 
Example 6
Source File: Activator.java    From elexis-3-core with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void start(BundleContext context) throws Exception{
	Platform.addLogListener(logListener);
}