Examples of DBLanguageFile


Examples of com.dci.intellij.dbn.language.common.DBLanguageFile

    public ItemPresentation getPresentation() {
        if (psiElement instanceof BasePsiElement) return (ItemPresentation) psiElement;
        return new ItemPresentation() {
            public String getPresentableText() {
                if (psiElement instanceof DBLanguageFile) {
                    DBLanguageFile file = (DBLanguageFile) psiElement;
                    return file.getName();
                }
                return psiElement.getText();
            }

            @Nullable
View Full Code Here

Examples of com.dci.intellij.dbn.language.common.DBLanguageFile

        final Document document = editor.getDocument();

        // restart highlighting
        final PsiFile file = DocumentUtil.getFile(editor);
        if (file instanceof DBLanguageFile) {
            DBLanguageFile dbLanguageFile = (DBLanguageFile) file;
            DBLanguage dbLanguage = dbLanguageFile.getDBLanguage();
            if (dbLanguage != null) {
                ConnectionHandler connectionHandler = dbLanguageFile.getActiveConnection();
                DBLanguageSyntaxHighlighter syntaxHighlighter = getSyntaxHighlighter(dbLanguage, connectionHandler);

                EditorHighlighter editorHighlighter = HighlighterFactory.createHighlighter(syntaxHighlighter, editor.getColorsScheme());
                ((EditorEx) editor).setHighlighter(editorHighlighter);
            }
View Full Code Here

Examples of com.dci.intellij.dbn.language.common.DBLanguageFile

    public ItemPresentation getPresentation() {
        if (psiElement instanceof BasePsiElement) return (ItemPresentation) psiElement;
        return new ItemPresentation() {
            public String getPresentableText() {
                if (psiElement instanceof DBLanguageFile) {
                    DBLanguageFile file = (DBLanguageFile) psiElement;
                    return file.getName();
                }
                if (psiElement instanceof ChameleonPsiElement) {
                    ChameleonPsiElement chameleonPsiElement = (ChameleonPsiElement) psiElement;
                    //return chameleonPsiElement.getLanguage().getDisplayName() + " block";
                    // todo make this dynamic
View Full Code Here

Examples of com.dci.intellij.dbn.language.common.DBLanguageFile

    public void invoke(@NotNull Project project, Editor editor, PsiFile psiFile) throws IncorrectOperationException {
        ConnectionManager connectionManager = ConnectionManager.getInstance(project);
        List<ConnectionBundle> connectionBundles = connectionManager.getConnectionBundles();

        DefaultActionGroup actionGroup = new DefaultActionGroup();
        DBLanguageFile dbLanguageFile = (DBLanguageFile) psiFile;

        boolean connectionsFound = false;
        for (ConnectionBundle connectionBundle : connectionBundles) {
            if (connectionBundle.getConnectionHandlers().size() > 0) {
                actionGroup.addSeparator();
View Full Code Here

Examples of com.dci.intellij.dbn.language.common.DBLanguageFile

    }

    public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile psiFile) {
        VirtualFile virtualFile = psiFile.getVirtualFile();
        if (psiFile instanceof DBLanguageFile && virtualFile != null && (virtualFile.isInLocalFileSystem() || virtualFile instanceof SQLConsoleFile) ) {
            DBLanguageFile file = (DBLanguageFile) psiFile;
            return file.getActiveConnection() != null;
        }
        return false;
    }
View Full Code Here

Examples of com.dci.intellij.dbn.language.common.DBLanguageFile

        return false;
    }

    public void invoke(@NotNull Project project, Editor editor, PsiFile psiFile) throws IncorrectOperationException {
        DefaultActionGroup actionGroup = new DefaultActionGroup();
        DBLanguageFile dbLanguageFile = (DBLanguageFile) psiFile;

        ConnectionHandler connectionHandler = dbLanguageFile.getActiveConnection();
        if (connectionHandler != null && !connectionHandler.isVirtual() && !connectionHandler.isDisposed()) {
            List<DBSchema> schemas = connectionHandler.getObjectBundle().getSchemas();
            for (DBSchema schema  :schemas) {
                SelectSchemaAction schemaAction = new SelectSchemaAction(schema, dbLanguageFile);
                actionGroup.add(schemaAction);
View Full Code Here

Examples of com.dci.intellij.dbn.language.common.DBLanguageFile

    }

    private void doAddCompletions(CompletionParameters parameters, CompletionResultSet result) {
        PsiFile originalFile = parameters.getOriginalFile();
        if (originalFile instanceof DBLanguageFile) {
            DBLanguageFile file = (DBLanguageFile) originalFile;

            CodeCompletionContext context = new CodeCompletionContext(file, parameters, result);
            CodeCompletionLookupConsumer consumer = new CodeCompletionLookupConsumer(context);
            DBLanguage language = context.getLanguage();


            int caretOffset = parameters.getOffset();
            if (file.findElementAt(caretOffset) instanceof PsiComment) return;

            LeafPsiElement leafBeforeCaret = PsiUtil.lookupLeafBeforeOffset(file, caretOffset);


            int invocationCount = parameters.getInvocationCount();
            if (invocationCount > 1) context.setExtended(true);

            if (leafBeforeCaret == null) {
                ElementTypeBundle elementTypeBundle = file.getElementTypeBundle();
                Set<LeafElementType> firstPossibleLeafs = elementTypeBundle.getRootElementType().getLookupCache().getFirstPossibleLeafs();
                for (LeafElementType firstPossibleLeaf : firstPossibleLeafs) {
                    if (firstPossibleLeaf instanceof TokenElementType) {
                        TokenElementType tokenElementType = (TokenElementType) firstPossibleLeaf;
                        if (context.getCodeCompletionFilterSettings().acceptReservedWord(tokenElementType.getTokenTypeCategory())) {
View Full Code Here

Examples of com.dci.intellij.dbn.language.common.DBLanguageFile

        return (DBLanguageFile) parent;
    }

    @Nullable
    public ConnectionHandler getActiveConnection() {
        DBLanguageFile file = getFile();
        return file == null ? null : file.getActiveConnection();
    }
View Full Code Here

Examples of com.dci.intellij.dbn.language.common.DBLanguageFile

        DBLanguageFile file = getFile();
        return file == null ? null : file.getActiveConnection();
    }

    public DBSchema getCurrentSchema() {
        DBLanguageFile file = getFile();
        return file == null ? null : file.getCurrentSchema();
    }
View Full Code Here

Examples of com.dci.intellij.dbn.language.common.DBLanguageFile

        }
    }

    public void fireExecution(final List<StatementExecutionProcessor> executionProcessors) {
        if (executionProcessors.size() > 0) {
            DBLanguageFile file =  executionProcessors.get(0).getFile();
            boolean continueExecution = selectConnection(file);
            if (continueExecution) {
                for (StatementExecutionProcessor executionProcessor : executionProcessors) {
                    continueExecution = executionProcessor.promptVariablesDialog();
                    if (!continueExecution) break;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.