Package com.dci.intellij.dbn.vfs

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


                    compilerSettings.getCompileType(), false);
        }
    }

    public void update(AnActionEvent e) {
        SourceCodeFile virtualFile = getSourcecodeFile(e);
        Presentation presentation = e.getPresentation();
        if (virtualFile == null) {
            presentation.setEnabled(false);
        } else {

            DBSchemaObject schemaObject = virtualFile.getObject();
            if (schemaObject != null) {
                DatabaseCompatibilityInterface compatibilityInterface = DatabaseCompatibilityInterface.getInstance(schemaObject);
                if (schemaObject.getProperties().is(DBObjectProperty.COMPILABLE) &&  compatibilityInterface.supportsFeature(DatabaseFeature.OBJECT_INVALIDATION)) {
                    CompilerSettings compilerSettings = getCompilerSettings(schemaObject.getProject());
                    CompileType compileType = compilerSettings.getCompileType();
                    DBObjectStatusHolder status = schemaObject.getStatus();
                    DBContentType contentType = virtualFile.getContentType();

                    boolean isDebug = compileType == CompileType.DEBUG;
                    if (compileType == CompileType.KEEP) {
                        isDebug = status.is(contentType, DBObjectStatus.DEBUG);
                    }
View Full Code Here


        super("Compare with original", null, Icons.CODE_EDITOR_DIFF);
    }

    public void actionPerformed(AnActionEvent e) {
        Editor editor = getEditor(e);
        SourceCodeFile virtualFile = getSourcecodeFile(e);
        String content = editor.getDocument().getText();
        virtualFile.setContent(content);
        String referenceText = virtualFile.getOriginalContent();

        openDiffWindow(e, referenceText, "Original version", "Local version");
    }
View Full Code Here

        openDiffWindow(e, referenceText, "Original version", "Local version");
    }

    public void update(AnActionEvent e) {
        SourceCodeFile virtualFile = getSourcecodeFile(e);
        e.getPresentation().setText("Compare with original");
        e.getPresentation().setEnabled(virtualFile != null && (
                virtualFile.getOriginalContent() != null || virtualFile.isModified()));
    }
View Full Code Here

    }

    public void actionPerformed(final AnActionEvent e) {
        final Project project = ActionUtil.getProject(e);
        final Editor editor = getEditor(e);
        final SourceCodeFile virtualFile = getSourcecodeFile(e);

        new WriteActionRunner() {
            public void run() {
                FileDocumentManager.getInstance().saveAllDocuments();
                SourceCodeManager.getInstance(project).updateSourceToDatabase(editor, virtualFile);
View Full Code Here

            }
        }.start();
    }

    public void update(AnActionEvent e) {
        SourceCodeFile virtualFile = getSourcecodeFile(e);
        Presentation presentation = e.getPresentation();
        if (virtualFile == null) {
            presentation.setEnabled(false);
        } else {
            String text =
                    virtualFile.getContentType() == DBContentType.CODE_SPEC ? "Save spec" :
                            virtualFile.getContentType() == DBContentType.CODE_BODY ? "Save body" : "Save";

            DBSchemaObject object = virtualFile.getObject();
            presentation.setEnabled(object != null && !object.getStatus().is(DBObjectStatus.SAVING) && virtualFile.isModified());
            presentation.setText(text);
        }
    }
View Full Code Here

            new BackgroundTask(project, "Loading database source code", false, true) {

                @Override
                protected void execute(@NotNull ProgressIndicator progressIndicator) throws InterruptedException {
                    final Editor editor = getEditor(e);
                    final SourceCodeFile sourcecodeFile = getSourcecodeFile(e);

                    if (editor != null && sourcecodeFile != null) {
                        boolean reloaded = sourcecodeFile.reloadFromDatabase();
                        if (reloaded) {
                            new WriteActionRunner() {
                                public void run() {
                                    editor.getDocument().setText(sourcecodeFile.getContent());
                                    sourcecodeFile.setModified(false);
                                }
                            }.start();
                        }
                    }
                }
View Full Code Here

            }.start();
        }
    }

    public void update(AnActionEvent e) {
        SourceCodeFile virtualFile = getSourcecodeFile(e);
        Presentation presentation = e.getPresentation();
        if (virtualFile == null) {
            presentation.setEnabled(false);
        } else {
            String text =
                virtualFile.getContentType() == DBContentType.CODE_SPEC ? "Reload spec" :
                virtualFile.getContentType() == DBContentType.CODE_BODY ? "Reload body" : "Reload";

            presentation.setText(text);
            presentation.setEnabled(!virtualFile.isModified());
        }
    }
View Full Code Here

                new BackgroundTask(object.getProject(), "Compiling " + object.getQualifiedNameWithType(), true) {
                    public void execute(@NotNull ProgressIndicator progressIndicator) {
                        doCompileObject(object, contentType, selectedCompileType, silently);
                        if (DatabaseFileSystem.getInstance().isFileOpened(object)) {
                            DatabaseEditableObjectFile databaseFile = object.getVirtualFile();
                            SourceCodeFile sourceCodeFile = (SourceCodeFile) databaseFile.getContentFile(contentType);
                            sourceCodeFile.updateChangeTimestamp();
                        }
                    }
                }.start();
            }
        }
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.