use of org.eclipse.core.runtime.ILogListener in project eclipse.platform.text by eclipse.
the class MarkerAnnotationOrderTest method testDirectDependency.
@Test
public void testDirectDependency() {
final ArrayList<IStatus> list = new ArrayList<>(2);
Bundle bundle = Platform.getBundle(EditorsUI.PLUGIN_ID);
ILog log = Platform.getLog(bundle);
log.addLogListener(new ILogListener() {
@Override
public void logging(IStatus status, String plugin) {
list.add(status);
}
});
TestMarkerAnnotationModel t1 = new TestMarkerAnnotationModel();
Position position = new Position(0);
position.delete();
IDocument d = null;
try {
t1.updateMarker(d, null, position);
} catch (CoreException e) {
fail("update marker failed to execute");
log(e);
}
assertEquals("Wrong number of messages", 2, list.size());
assertEquals("Wrong Message for first status", "Marker Updater 'org.eclipse.ui.texteditor.BasicMarkerUpdaterTest2' and 'org.eclipse.ui.texteditor.BasicMarkerUpdaterTest1' depend on each other, 'org.eclipse.ui.texteditor.BasicMarkerUpdaterTest2' will run before 'org.eclipse.ui.texteditor.BasicMarkerUpdaterTest1'", ((Status) list.get(0)).getMessage());
assertEquals("Wrong Message for second status", "Marker Updater 'org.eclipse.ui.texteditor.BasicMarkerUpdaterTest4' and 'org.eclipse.ui.texteditor.BasicMarkerUpdaterTest1' depend on each other, 'org.eclipse.ui.texteditor.BasicMarkerUpdaterTest4' will run before 'org.eclipse.ui.texteditor.BasicMarkerUpdaterTest1'", ((Status) list.get(1)).getMessage());
}
use of org.eclipse.core.runtime.ILogListener in project eclipse.platform.text by eclipse.
the class StatusEditorTest method doNotThrowOnActivationInStale.
/*
* https://bugs.eclipse.org/bugs/attachment.cgi?bugid=320672
*
* No exceptions are thrown when a status editor displaying an erroneous status is activated with a mouse click.
* @throws Exception
*/
@Test
public void doNotThrowOnActivationInStale() throws Exception {
IEditorPart editor1 = openNonExistentFile(page, new URI("file:/1.txt"));
openNonExistentFile(page, new URI("file:/2.txt"));
ILog log = Platform.getLog(Platform.getBundle("org.eclipse.e4.ui.workbench"));
List<String> logEvents = new ArrayList<>();
ILogListener listener = (status, plugin) -> logEvents.add(status.toString());
log.addLogListener(listener);
// Clicks are not equivalent to activation from API, so we need this
// hack to imitate tab clicks.
CTabFolder folder = (CTabFolder) (((PartSite) editor1.getSite()).getModel().getParent().getWidget());
try {
folder.setSelection(0);
processEvents();
folder.setSelection(1);
processEvents();
} finally {
log.removeLogListener(listener);
}
if (!logEvents.isEmpty()) {
Assert.assertEquals("Unexpected errors logged", "", logEvents.toString());
}
}
Aggregations