Package com.dci.intellij.dbn.vfs

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


        };
        ApplicationManager.getApplication().runReadAction(readProcess);
    }

    private void registerDefaultBreakpoint() {
        SourceCodeFile sourceCodeFile = (SourceCodeFile) getMainDatabaseFile().getMainContentFile();
        PSQLFile psqlFile = (PSQLFile) sourceCodeFile.getPsiFile();
        if (psqlFile != null) {
            DBMethod method = executionInput.getMethod();
            if (method != null) {
                BasePsiElement basePsiElement = psqlFile.lookupObjectDeclaration(method.getObjectType().getGenericType(), method.getName());
                if (basePsiElement != null) {
View Full Code Here


    @Override
    public boolean canPutAt(@NotNull VirtualFile file, int line, @NotNull Project project) {
        if (file.getFileType().equals(PSQLFileType.INSTANCE)) {
            if (file instanceof SourceCodeFile) {
                SourceCodeFile sourceCodeFile = (SourceCodeFile) file;
                DBContentType contentType = sourceCodeFile.getContentType();
                if (contentType == DBContentType.CODE || contentType == DBContentType.CODE_BODY) {
                    Document document = DocumentUtil.getDocument(file);
                    int lineOffset = document.getLineStartOffset(line);
                    PsiFile psiFile = PsiUtil.getPsiFile(project, file);
                    PsiElement element = psiFile.findElementAt(lineOffset);
View Full Code Here

                DatabaseEditableObjectFile databaseFile = (DatabaseEditableObjectFile) virtualFile;
                return databaseFile.getObject();
            }

            if (virtualFile instanceof SourceCodeFile) {
                SourceCodeFile sourceCodeFile = (SourceCodeFile) virtualFile;
                return sourceCodeFile.getDatabaseFile().getObject();
            }
        }
        return null;
    }
View Full Code Here

    public AbstractDiffAction(String text, String description, javax.swing.Icon icon) {
        super(text, description, icon);
    }

    protected void openDiffWindow(AnActionEvent e, final String referenceText, final String referenceTitle, final String windowTitle) {
        final SourceCodeFile virtualFile = getSourcecodeFile(e);
        final Project project = ActionUtil.getProject(e);
        if (project!= null && virtualFile != null) {
            new SimpleLaterInvocator() {
                public void execute() {
                    SimpleContent originalContent = new SimpleContent(referenceText, virtualFile.getFileType());
                    DBSourceFileContent changedContent = new DBSourceFileContent(project, virtualFile);

                    DBSchemaObject object = virtualFile.getObject();
                    if (object != null) {
                        String title =
                                object.getSchema().getName() + "." +
                                        object.getName() + " " +
                                        object.getTypeName() + " - " + windowTitle;
View Full Code Here

    public DDLFileAction() {
        super("DDL File", null, Icons.CODE_EDITOR_DDL_FILE);
    }

    public void actionPerformed(AnActionEvent e) {
        SourceCodeFile sourcecodeFile = getSourcecodeFile(e);
        if (sourcecodeFile != null) {
            DBSchemaObject object = sourcecodeFile.getObject();
            actionGroup = new DefaultActionGroup();
            actionGroup.add(new CreateDDLFileAction(object));
            actionGroup.add(new AttachDDLFileAction(object));
            actionGroup.add(new DetachDDLFileAction(object));
View Full Code Here

            showBelowComponent(popup, component);
        }
    }

    public void update(AnActionEvent e) {
        SourceCodeFile sourcecodeFile = getSourcecodeFile(e);
        Presentation presentation = e.getPresentation();
        presentation.setIcon(Icons.CODE_EDITOR_DDL_FILE);
        presentation.setText("DDL Files");
        presentation.setEnabled(sourcecodeFile != null);
    }
View Full Code Here

        if (project != null && !project.isDisposed()) {
            new BackgroundTask(project, "Reverting local changes", false) {
                @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();

                            sourceCodeFile.getDatabaseFile().updateDDLFiles(sourceCodeFile.getContentType());
                        }
                    }
                }
            }.start();
        }
View Full Code Here

            }.start();
        }
    }

    public void update(AnActionEvent e) {
        SourceCodeFile virtualFile = getSourcecodeFile(e);
        Presentation presentation = e.getPresentation();
        presentation.setEnabled(virtualFile!= null && virtualFile.isModified());
        presentation.setText("Rollback changes");
    }
View Full Code Here

        final Project project = ActionUtil.getProject(e);
        if (project != null) {
            new BackgroundTask(project, "Loading database source code", false, true) {
                @Override
                protected void execute(@NotNull ProgressIndicator progressIndicator) throws InterruptedException {
                    SourceCodeFile virtualFile = getSourcecodeFile(e);
                    Editor editor = getEditor(e);
                    if (virtualFile != null && editor != null) {
                        String content = editor.getDocument().getText();
                        virtualFile.setContent(content);
                        DBSchemaObject object = virtualFile.getObject();
                        if (object != null) {
                            try {
                                SourceCodeManager sourceCodeManager = SourceCodeManager.getInstance(project);
                                String referenceText = sourceCodeManager.loadSourceCodeFromDatabase(object, virtualFile.getContentType());
                                if (!progressIndicator.isCanceled()) {
                                    openDiffWindow(e, referenceText, "Database version", "Local version vs. database version");
                                }

                            } catch (SQLException e1) {
View Full Code Here

    public CompileObjectAction() {
        super("", "", Icons.OBEJCT_COMPILE);
    }

    public void actionPerformed(AnActionEvent e) {
        SourceCodeFile virtualFile = getSourcecodeFile(e);
        if (virtualFile!= null) {
            Project project = virtualFile.getProject();
            DatabaseCompilerManager compilerManager = DatabaseCompilerManager.getInstance(project);
            CompilerSettings compilerSettings = getCompilerSettings(project);
            compilerManager.compileObject(
                    virtualFile.getObject(),
                    virtualFile.getContentType(),
                    compilerSettings.getCompileType(), false);
        }
    }
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.