Package ch.ethz.prose.eclipse.internal.run

Examples of ch.ethz.prose.eclipse.internal.run.AspectManagerNode


     * Test if listeners are notified when an <code>Aspect</code> has been
     * inserted.
     */
    public void testInsertAspectNotification() {
        ProseRunNode run = new ProseRunNode("test", "dummyhost", -1, null);
        AspectManagerNode aspectManager = new AspectManagerNode(run, true);
        ProsePlugin.getDefault().fireAspectInserted(aspectManager);
        assertEquals(aspectManager, listener.aspectManager);
    }
View Full Code Here


     * Test if listeners are notified when an <code>Aspect</code> has been
     * withdrawn.
     */
    public void testWithdrawAspectNotification() {
        ProseRunNode run = new ProseRunNode("test", "dummyhost", -1, null);
        AspectManagerNode aspectManager = new AspectManagerNode(run, true);
        AspectSurrogate surrogate = new AspectSurrogate("Aspect", null);
        AspectNode aspect = new AspectNode(aspectManager, surrogate);
        ProsePlugin.getDefault().fireAspectWithdrawn(aspect);
        assertEquals(aspect, listener.aspect);
    }
View Full Code Here

    /* (non-Javadoc)
     * @see org.eclipse.swt.dnd.DropTargetListener#drop(org.eclipse.swt.dnd.DropTargetEvent)
     */
    public void drop(DropTargetEvent event) {
        IType type = null;
        AspectManagerNode targetManager = (AspectManagerNode) getTarget(event);
        Object source = SelectionUtil.getSingleElement(LocalSelectionTransfer.getInstance().getSelection());
        if (source instanceof AspectNode) {
            AspectNode aspect = (AspectNode) source;

            // Since there is no classpath information in an AspectSurrogate, we
            // have to seek the aspect class.
            IJavaProject[] projects = getJavaProjects();
            for (int i = 0; i < projects.length; i++) {
                try {
                    type = projects[i].findType(aspect.getAspect().getAspectClassName());
                    if (type != null)
                        break;
                } catch (JavaModelException e) {
                    ProsePlugin.log(e.getStatus());
                    break;
                }

            }

            if (type == null) {
                ProsePlugin.openErrorDialog("No aspect found", "No project contains an aspect named "
                        + aspect.getAspect().getAspectClassName() + '.');
                event.detail = DND.DROP_NONE;
                return;
            }
        } else if (source instanceof ICompilationUnit){
            type = ((ICompilationUnit) source).findPrimaryType();
            if (type == null) {
                ProsePlugin.openErrorDialog("No type found", "Compilation unit does not contain a type: " + source + '.');
                event.detail = DND.DROP_NONE;
                return;
            }
        }

        try {
            targetManager.insertAspect(type);
        } catch (UnreachableException e) {
            ProsePlugin.openErrorDialog("Aspect insertion failed",
                    "Could not insert aspect because Prose application is not reachable.");
            event.detail = DND.DROP_NONE;
        }
View Full Code Here

TOP

Related Classes of ch.ethz.prose.eclipse.internal.run.AspectManagerNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.