Package com.dci.intellij.dbn.object.common

Examples of com.dci.intellij.dbn.object.common.DBSchemaObject


            SourceCodeFile sourceCodeFile = (SourceCodeFile) virtualFile;
            return sourceCodeFile.getObject();
        }

        DDLFileAttachmentManager instance = DDLFileAttachmentManager.getInstance(getProject());
        DBSchemaObject editableObject = instance.getEditableObject(virtualFile);
        if (editableObject != null) {
            return editableObject;
        }

View Full Code Here


            Object lastPathEntity = path.getLastPathComponent();
            if (lastPathEntity instanceof DBObject) {
                final DBObject object = (DBObject) lastPathEntity;
                DBObjectProperties properties = object.getProperties();
                if (properties.is(DBObjectProperty.EDITABLE)) {
                    DBSchemaObject schemaObject = (DBSchemaObject) object;
                    DatabaseFileSystem.getInstance().openEditor(schemaObject);
                    event.consume();
                } else if (properties.is(DBObjectProperty.NAVIGABLE)) {
                    DatabaseFileSystem.getInstance().openEditor(object);
                    event.consume();
View Full Code Here

    @NotNull
    public FileEditorState readState(@NotNull Element sourceElement, @NotNull Project project, @NotNull VirtualFile virtualFile) {
        if (virtualFile instanceof DatabaseEditableObjectFile) {
            DatabaseEditableObjectFile editableObjectFile = (DatabaseEditableObjectFile) virtualFile;
            DBSchemaObject object = editableObjectFile.getObject();
            if (object instanceof DBDataset) {
                DatasetEditorState editorState = new DatasetEditorState();
                editorState.readState(sourceElement);
                return editorState;
View Full Code Here

    @Override
    public SourceCodeLoadErrorNotificationPanel createNotificationPanel(VirtualFile virtualFile, FileEditor fileEditor) {
        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

            append(virtualFile.getName(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
            append(" (" + virtualFile.getPath() + ")", SimpleTextAttributes.GRAY_ATTRIBUTES);
        }
        else if (value instanceof CompilerMessagesObjectNode){
            CompilerMessagesObjectNode compilerMessagesObjectNode = (CompilerMessagesObjectNode) value;
            DBSchemaObject object = compilerMessagesObjectNode.getObject();

            if (object != null) {
                setIcon(object.getOriginalIcon());
                append(object.getQualifiedName(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
                append(" - " + object.getConnectionHandler().getPresentableText(), SimpleTextAttributes.GRAY_ATTRIBUTES);
            }
        }
        else if (value instanceof CompilerMessageNode) {
            CompilerMessageNode node = (CompilerMessageNode) value;
            CompilerMessage message = node.getCompilerMessage();
View Full Code Here

        for (int i=0; i< count; i++) {
            if (progressIndicator.isCanceled()) {
                break;
            } else {
                progressIndicator.setFraction(CommonUtil.getProgressPercentage(i, count));
                DBSchemaObject object = objects.get(i);
                if (object.getContentType().isBundle()) {
                    for (DBContentType contentType : object.getContentType().getSubContentTypes()) {
                        if (!object.getStatus().is(contentType, DBObjectStatus.VALID)) {
                            doCompileObject(object, contentType, compileType, true);
                            progressIndicator.setText2("Compiling " + object.getQualifiedNameWithType());
                        }
                    }
                } else {
                    if (!object.getStatus().is(DBObjectStatus.VALID)) {
                        doCompileObject(object, object.getContentType(), compileType, true);
                        progressIndicator.setText2("Compiling " + object.getQualifiedNameWithType());
                    }
                }
            }
        }
    }
View Full Code Here

    @Override
    public DatasetLoadErrorNotificationPanel createNotificationPanel(VirtualFile virtualFile, FileEditor fileEditor) {
        if (virtualFile instanceof DatabaseEditableObjectFile) {
            if (fileEditor instanceof DatasetEditor) {
                DatabaseEditableObjectFile editableObjectFile = (DatabaseEditableObjectFile) virtualFile;
                DBSchemaObject editableObject = editableObjectFile.getObject();
                DatasetEditor datasetEditor = (DatasetEditor) fileEditor;
                String sourceLoadError = datasetEditor.getDataLoadError();
                if (StringUtil.isNotEmpty(sourceLoadError)) {
                    return createPanel(editableObject, sourceLoadError);
                }
View Full Code Here

        }
    }

    public void updateSourceToDatabase(final Editor editor, final SourceCodeFile virtualFile) {
        DatabaseDebuggerManager debuggerManager = DatabaseDebuggerManager.getInstance(virtualFile.getProject());
        final DBSchemaObject object = virtualFile.getObject();
        if (object != null) {
            if (!debuggerManager.checkForbiddenOperation(virtualFile.getActiveConnection())) {
                object.getStatus().set(DBObjectStatus.SAVING, false);
                return;
            }

            final Project project = virtualFile.getProject();
            final DBContentType contentType = virtualFile.getContentType();
            object.getStatus().set(DBObjectStatus.SAVING, true);

            new BackgroundTask(project, "Checking for third party changes on " + object.getQualifiedNameWithType(), true) {
                public void execute(@NotNull ProgressIndicator progressIndicator) {
                    try {
                        String content = editor.getDocument().getText();
                        if (isValidObjectTypeAndName(content, object, contentType)) {
                            Timestamp lastUpdated = object.loadChangeTimestamp(contentType);
                            if (lastUpdated != null && lastUpdated.after(virtualFile.getChangeTimestamp())) {

                                virtualFile.setContent(content);
                                String message =
                                        "The " + object.getQualifiedNameWithType() +
                                                " has been changed by another user. \nYou will be prompted to merge the changes";
                                MessageUtil.showErrorDialog(message, "Version conflict");

                                String databaseContent = loadSourceCodeFromDatabase(object, contentType);
                                showSourceDiffDialog(databaseContent, virtualFile, editor);
                            } else {
                                doUpdateSourceToDatabase(object, virtualFile, editor);
                                //sourceCodeEditor.afterSave();
                            }

                        } else {
                            String message = "You are not allowed to change the name or the type of the object";
                            object.getStatus().set(DBObjectStatus.SAVING, false);
                            MessageUtil.showErrorDialog(message, "Illegal action");
                        }
                    } catch (SQLException ex) {
                        if (!DatabaseCompatibilityInterface.getInstance(object).supportsFeature(DatabaseFeature.OBJECT_REPLACING)) {
                            virtualFile.updateChangeTimestamp();
                        }
                        MessageUtil.showErrorDialog("Could not save changes to database.", ex);
                        object.getStatus().set(DBObjectStatus.SAVING, false);
                    }
                }
            }.start();
        }
View Full Code Here

                        virtualFile,
                        virtualFile.getProject(),
                        ActionButtonPresentation.APPLY,
                        ActionButtonPresentation.CANCEL_WITH_PROMPT);
                mergeRequest.setVersionTitles(new String[]{"Database version", "Merge result", "Your version"});
                final DBSchemaObject object = virtualFile.getObject();
                mergeRequest.setWindowTitle("Version conflict resolution for " + object.getQualifiedNameWithType());

                DiffManager.getInstance().getDiffTool().show(mergeRequest);

                int result = mergeRequest.getResult();
                if (result == 0) {
                    doUpdateSourceToDatabase(object, virtualFile, editor);
                    //sourceCodeEditor.afterSave();
                } else if (result == 1) {
                    new WriteActionRunner() {
                        public void run() {
                            editor.getDocument().setText(virtualFile.getContent());
                            object.getStatus().set(DBObjectStatus.SAVING, false);
                        }
                    }.start();
                }
            }
        }.start();
View Full Code Here

    private int hashCode;
    private SourceCodeOffsets offsets;

    public SourceCodeFile(final DatabaseEditableObjectFile databaseFile, DBContentType contentType) {
        super(databaseFile, contentType);
        DBSchemaObject object = getObject();
        if (object != null) {
            hashCode = (object.getQualifiedNameWithConnectionId() + contentType.getDescription()).hashCode();
            updateChangeTimestamp();
            setCharset(databaseFile.getConnectionHandler().getSettings().getDetailSettings().getCharset());
            try {
                SourceCodeManager sourceCodeManager = SourceCodeManager.getInstance(getProject());
                SourceCodeContent sourceCodeContent = sourceCodeManager.loadSourceFromDatabase(object, contentType);
View Full Code Here

TOP

Related Classes of com.dci.intellij.dbn.object.common.DBSchemaObject

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.