Package com.dci.intellij.dbn.vfs

Examples of com.dci.intellij.dbn.vfs.SourceCodeFile


                StringBuilder buffer = new StringBuilder();
                if (fileContentType.isBundle()) {
                    DBContentType[] contentTypes = fileContentType.getSubContentTypes();
                    for (DBContentType contentType : contentTypes) {
                        SourceCodeFile virtualFile = (SourceCodeFile) databaseFile.getContentFile(contentType);
                        String statement = virtualFile.createDDLStatement();
                        if (statement.trim().length() > 0) {
                            buffer.append(statement);
                            if (postfix.length() > 0) {
                                buffer.append("\n");
                                buffer.append(postfix);
                            }
                            buffer.append("\n");
                        }
                        if (contentType != contentTypes[contentTypes.length - 1]) buffer.append("\n");
                    }
                } else {
                    SourceCodeFile virtualFile = (SourceCodeFile) databaseFile.getContentFile(fileContentType);
                    buffer.append(virtualFile.createDDLStatement());
                    if (postfix.length() > 0) {
                        buffer.append("\n");
                        buffer.append(postfix);
                    }
                    buffer.append("\n");
View Full Code Here


        return UIUtil.isUnderGTKLookAndFeel();
    }

    public static String getParseRootId(VirtualFile virtualFile) {
        if (virtualFile instanceof SourceCodeFile) {
            SourceCodeFile sourceCodeFile = (SourceCodeFile) virtualFile;
            return sourceCodeFile.getParseRootId();
        } else if (virtualFile instanceof LightVirtualFile) {
            LightVirtualFile lightVirtualFile = (LightVirtualFile) virtualFile;
            VirtualFile originalFile = lightVirtualFile.getOriginalFile();
            return getParseRootId(originalFile);
        }
View Full Code Here

    @Override
    public void computeChildren(@NotNull XCompositeNode node) {
        valuesMap = new THashMap<String, DBProgramDebugValue>();

        SourceCodeFile sourceCodeFile = DBProgramDebugUtil.getSourceCodeFile(sourcePosition);
        PSQLFile psiFile = (PSQLFile) PsiManager.getInstance(sourceCodeFile.getProject()).findFile(sourceCodeFile);
        Document document = DocumentUtil.getDocument(sourceCodeFile);
        int offset = document.getLineStartOffset(sourcePosition.getLine());
        Set<BasePsiElement> variables = psiFile.lookupVariableDefinition(offset);

        List<DBProgramDebugValue> values = new ArrayList<DBProgramDebugValue>();
View Full Code Here

        if (parserDefinition == null) {
            throw new RuntimeException("PsiFileBase: language.getParserDefinition() returned null.");
        }
        VirtualFile virtualFile = viewProvider.getVirtualFile();
        if (virtualFile instanceof SourceCodeFile) {
            SourceCodeFile sourceCodeFile = (SourceCodeFile) virtualFile;
            this.underlyingObject = sourceCodeFile.getObject().getRef();
        }

        parseRootId = CompatibilityUtil.getParseRootId(virtualFile);

        IFileElementType nodeType = parserDefinition.getFileNodeType();
View Full Code Here

            DatabaseObjectFile databaseObjectFile = (DatabaseObjectFile) virtualFile;
            return databaseObjectFile.getObject();
        }

        if (virtualFile instanceof SourceCodeFile) {
            SourceCodeFile sourceCodeFile = (SourceCodeFile) virtualFile;
            return sourceCodeFile.getObject();
        }

        DDLFileAttachmentManager instance = DDLFileAttachmentManager.getInstance(getProject());
        DBSchemaObject editableObject = instance.getEditableObject(virtualFile);
        if (editableObject != null) {
View Full Code Here

        if (virtualFile instanceof DatabaseEditableObjectFile) {
            if (fileEditor instanceof SourceCodeEditor) {
                DatabaseEditableObjectFile editableObjectFile = (DatabaseEditableObjectFile) virtualFile;
                DBSchemaObject editableObject = editableObjectFile.getObject();
                SourceCodeEditor sourceCodeEditor = (SourceCodeEditor) fileEditor;
                SourceCodeFile sourceCodeFile = sourceCodeEditor.getVirtualFile();
                String sourceLoadError = sourceCodeFile.getSourceLoadError();
                if (StringUtil.isNotEmpty(sourceLoadError)) {
                    return createPanel(editableObject, sourceLoadError);
                }

            }
View Full Code Here

            if (descriptor != null) {
                VirtualFile virtualFile = getFile().getVirtualFile();
                FileEditorManager editorManager = FileEditorManager.getInstance(getProject());
                if (virtualFile != null) {
                    if (virtualFile instanceof SourceCodeFile) {
                        SourceCodeFile sourceCodeFile = (SourceCodeFile) virtualFile;
                        DatabaseEditableObjectFile databaseFile = sourceCodeFile.getDatabaseFile();
                        if (!editorManager.isFileOpen(databaseFile)) {
                            editorManager.openFile(databaseFile, requestFocus);
                        }
                        BasicTextEditor textEditor = EditorUtil.getFileEditor(databaseFile, virtualFile);
                        descriptor.navigateIn(textEditor.getEditor());
View Full Code Here

                doCompileObject(object, object.getContentType(), selectedCompileType, silently);
                if (DatabaseFileSystem.getInstance().isFileOpened(object)) {
                    DatabaseEditableObjectFile databaseFile = object.getVirtualFile();
                    if (object.getContentType().isBundle()) {
                        for (DBContentType contentType : object.getContentType().getSubContentTypes()) {
                            SourceCodeFile sourceCodeFile = (SourceCodeFile) databaseFile.getContentFile(contentType);
                            sourceCodeFile.updateChangeTimestamp();
                        }
                    } else {
                        SourceCodeFile sourceCodeFile = (SourceCodeFile) databaseFile.getContentFile(object.getContentType());
                        sourceCodeFile.updateChangeTimestamp();
                    }
                }
            }
        }
    }
View Full Code Here

    @NotNull
    public FileEditor createEditor(@NotNull Project project, @NotNull VirtualFile file) {
        DatabaseEditableObjectFile databaseFile;

        if (file instanceof SourceCodeFile) {
            SourceCodeFile sourceCodeFile = (SourceCodeFile) file;
            databaseFile = sourceCodeFile.getDatabaseFile();
        } else {
            databaseFile = (DatabaseEditableObjectFile) file;
        }

        SourceCodeFile sourceCodeFile = getSourceCodeFile(databaseFile);

        boolean isMainEditor = sourceCodeFile.getContentType() == databaseFile.getMainContentType();

/*
        BasicTextEditor openEditor = lookupExistingEditor(project, databaseFile);
        if (openEditor != null) return openEditor;
*/

        String editorName = getName();
        BasicTextEditor textEditor = isMainEditor ?
                new SourceCodeMainEditor(project, sourceCodeFile, editorName) :
                new SourceCodeEditor(project, sourceCodeFile, editorName);

        updateEditorActions(textEditor);
        Document document = textEditor.getEditor().getDocument();

        int documentTracking = document.hashCode();
        if (document.hashCode() != sourceCodeFile.getDocumentHashCode()) {
            document.addDocumentListener(sourceCodeFile);
            sourceCodeFile.setDocumentHashCode(documentTracking);
        }

        Icon icon = getIcon();
        if (icon != null) {
            updateTabIcon(databaseFile, textEditor, icon);
View Full Code Here

                if (subject instanceof IdentifierPsiElement) {
                    IdentifierPsiElement identifierPsiElement = (IdentifierPsiElement) subject;
                    if (identifierPsiElement.isObject() && identifierPsiElement.isValid()) {
                        VirtualFile file = PsiUtil.getVirtualFileForElement(identifierPsiElement);
                        if (file instanceof SourceCodeFile) {
                            SourceCodeFile sourceCodeFile = (SourceCodeFile) file;
                            return identifierPsiElement.getObjectType().getIcon(sourceCodeFile.getContentType());
                        }
                        return identifierPsiElement.getObjectType().getIcon();
                    }
                }
            }
View Full Code Here

TOP

Related Classes of com.dci.intellij.dbn.vfs.SourceCodeFile

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.