Example usage for org.aspectj.bridge Message Message

List of usage examples for org.aspectj.bridge Message Message

Introduction

In this page you can find the example usage for org.aspectj.bridge Message Message.

Prototype

public Message(String message, IMessage.Kind kind, Throwable thrown, ISourceLocation sourceLocation) 

Source Link

Document

Create a message, handling null values for message and kind if thrown is not null.

Usage

From source file:org.caesarj.compiler.aspectj.CaesarScope.java

License:Open Source License

/**
 * @see org.aspectj.weaver.patterns.IScope#message(Kind, IHasPosition, String)
 *//* w ww .jav a 2s.c o m*/
public void message(IMessage.Kind kind, IHasPosition location, String message) {

    getMessageHandler().handleMessage(new Message(message, kind, null, makeSourceLocation(location)));
}

From source file:org.eclipse.ajdt.ui.tests.ajde.UIMessageHandlerTest.java

License:Open Source License

/**
 * For an error with a throwable we expect an error dialog to appear
 * containing the information/*from   w w w  .java  2s .co m*/
 */
public void testHandleErrorWithMessageAndThrowable() throws Exception {
    IProject project = createPredefinedProject("Bean Example"); //$NON-NLS-1$
    AJDTErrorHandler.setShowErrorDialogs(false);
    String message = ""; //$NON-NLS-1$
    try {
        IBuildMessageHandler handler = AspectJPlugin.getDefault().getCompilerFactory()
                .getCompilerForProject(project).getMessageHandler();

        IMessage msg = new Message("fake error", IMessage.ERROR, new AbortException("fake abort"), null); //$NON-NLS-1$ //$NON-NLS-2$
        handler.handleMessage(msg);
    } catch (RuntimeException re) {
        message = re.getMessage();
    }
    assertTrue("expected a runtime error with message 'fake abort' when " + //$NON-NLS-1$
            " testing error handling but didn't find one", //$NON-NLS-1$
            message.equals("org.aspectj.bridge.AbortException: fake abort")); //$NON-NLS-1$
}

From source file:org.eclipse.ajdt.ui.tests.ajde.UIMessageHandlerTest.java

License:Open Source License

/**
 * For an abort message we expect an error dialog to appear containing the
 * information//from ww w .  j a v  a 2  s . com
 */
public void testHandleAbortWithMessageAndThrowable() throws Exception {
    IProject project = createPredefinedProject("Bean Example"); //$NON-NLS-1$
    AJDTErrorHandler.setShowErrorDialogs(false);
    String message = ""; //$NON-NLS-1$
    try {
        IBuildMessageHandler handler = AspectJPlugin.getDefault().getCompilerFactory()
                .getCompilerForProject(project).getMessageHandler();

        IMessage msg = new Message("fake abort", IMessage.ABORT, new AbortException("fake abort"), null); //$NON-NLS-1$ //$NON-NLS-2$
        handler.handleMessage(msg);
    } catch (RuntimeException re) {
        message = re.getMessage();
    }
    assertTrue("expected a runtime error with message 'fake abort' when " + //$NON-NLS-1$
            " testing error handling but didn't find one", //$NON-NLS-1$
            message.equals("org.aspectj.bridge.AbortException: fake abort")); //$NON-NLS-1$
}