Package com.aptana.interactive_console.console.codegen

Examples of com.aptana.interactive_console.console.codegen.IScriptConsoleCodeGenerator


        assertEquals(null, PythonSnippetUtils.getScriptConsoleCodeGeneratorAdapter(null));

    }

    public void testGetScriptConsoleCodeGeneratorAdapter_SelfGenerator() {
        IScriptConsoleCodeGenerator selfGenerator = new SelfGenerator();
        assertEquals(selfGenerator, PythonSnippetUtils.getScriptConsoleCodeGeneratorAdapter(selfGenerator));

    }
View Full Code Here


        }
    }

    // This tests factory registered in plugin.xml
    public void testGetAdapterForStructuredSelection() {
        IScriptConsoleCodeGenerator generator = PythonSnippetUtils
                .getScriptConsoleCodeGeneratorAdapter(StructuredSelection.EMPTY);
        assertTrue(generator != null);
        assertEquals(StructuredSelectionScriptConsoleCodeGenerator.class, generator.getClass());
    }
View Full Code Here

        }

    }

    public void testGetAdapterForStructuredSelection() {
        IScriptConsoleCodeGenerator generator = PythonSnippetUtils
                .getScriptConsoleCodeGeneratorAdapter(StructuredSelection.EMPTY);
        assertEquals(StructuredSelectionScriptConsoleCodeGenerator.class, generator.getClass());
    }
View Full Code Here

        assertEquals(true, getGen(selection).hasPyCode());
        assertEquals("(pycode1, pycode2, (pycode_inner1, pycode_inner2))", getGen(selection).getPyCode());
    }

    public void testSafeRunner() {
        IScriptConsoleCodeGenerator generator = new TestExceptionObject();
        try {
            generator.hasPyCode();
            fail();
        } catch (RuntimeException e) {
            assertEquals("hasPyCode Forced Failure", e.getMessage());
        }
        try {
            generator.getPyCode();
            fail();
        } catch (RuntimeException e) {
            assertEquals("getPyCode Forced Failure", e.getMessage());
        }

        IScriptConsoleCodeGenerator wrapped = new SafeScriptConsoleCodeGenerator(generator);
        assertEquals(false, wrapped.hasPyCode());
        assertEquals(null, wrapped.getPyCode());

        StructuredSelection selection = new StructuredSelection(generator);
        IScriptConsoleCodeGenerator wrappedSelection = new SafeScriptConsoleCodeGenerator(getGen(selection));
        assertEquals(false, wrappedSelection.hasPyCode());
        assertEquals(null, wrappedSelection.getPyCode());
    }
View Full Code Here

        private final class DragTargetAdapter implements DropTargetListener {

            private SafeScriptConsoleCodeGenerator getSafeGenerator() {
                ISelection selection = LocalSelectionTransfer.getTransfer().getSelection();
                IScriptConsoleCodeGenerator codeGenerator = PythonSnippetUtils
                        .getScriptConsoleCodeGeneratorAdapter(selection);
                return new SafeScriptConsoleCodeGenerator(codeGenerator);
            }
View Full Code Here

            /**
             * We cancel the drop if we don't have anything to drop
             */
            private boolean forceDropNone(DropTargetEvent event) {
                if (LocalSelectionTransfer.getTransfer().isSupportedType(event.currentDataType)) {
                    IScriptConsoleCodeGenerator codeGenerator = getSafeGenerator();
                    if (codeGenerator == null || codeGenerator.hasPyCode() == false) {
                        return true;
                    }
                }
                return false;
            }
View Full Code Here

                String text = null;
                if (TextTransfer.getInstance().isSupportedType(event.currentDataType)) {
                    text = (String) event.data;

                } else if (LocalSelectionTransfer.getTransfer().isSupportedType(event.currentDataType)) {
                    IScriptConsoleCodeGenerator codeGenerator = getSafeGenerator();
                    if (codeGenerator != null) {
                        text = codeGenerator.getPyCode();
                    }
                }

                if (text != null && text.length() > 0) {
                    Point selectedRange = getSelectedRange();
View Full Code Here

TOP

Related Classes of com.aptana.interactive_console.console.codegen.IScriptConsoleCodeGenerator

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.