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

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


    }

    public PsiFile initializePsiFile(DatabaseFileViewProvider fileViewProvider, DBLanguage language) {
        ConnectionHandler connectionHandler = getConnectionHandler();

        DBSchemaObject underlyingObject = getObject();
        String parseRootId = getParseRootId();
        if (parseRootId != null) {
            DBLanguageDialect languageDialect = connectionHandler.getLanguageDialect(language);
            if (languageDialect != null) {
                DBLanguageFile file = (DBLanguageFile) languageDialect.getParserDefinition().createFile(fileViewProvider);
View Full Code Here


        }
        return null;
    }

    public String getParseRootId() {
        DBSchemaObject schemaObject = getObject();
        return schemaObject == null ? null : schemaObject.getCodeParseRootId(contentType);
    }
View Full Code Here

    public DBLanguageFile getPsiFile() {
        return (DBLanguageFile) PsiUtil.getPsiFile(getProject(), this);
    }

    public void updateChangeTimestamp() {
        DBSchemaObject object = getObject();
        if (object != null) {
            try {
                Timestamp timestamp = object.loadChangeTimestamp(getContentType());
                if (timestamp != null) {
                    changeTimestamp = timestamp;
                }
            } catch (SQLException e) {
                e.printStackTrace();
View Full Code Here

    public boolean reloadFromDatabase() {
        try {
            updateChangeTimestamp();
            originalContent = null;

            DBSchemaObject object = getObject();
            if (object != null) {
                SourceCodeManager sourceCodeManager = SourceCodeManager.getInstance(getProject());
                SourceCodeContent sourceCodeContent = sourceCodeManager.loadSourceFromDatabase(object, contentType);
                content = sourceCodeContent.getSourceCode();
                offsets = sourceCodeContent.getOffsets();

                getDatabaseFile().updateDDLFiles(getContentType());
                setModified(false);
                sourceLoadError = null;
                return true;
            } else {
                return false;
            }
        } catch (SQLException e) {
            sourceLoadError = e.getMessage();
            DBSchemaObject object = databaseFile.getObject();
            if (object != null) {
                MessageUtil.showErrorDialog("Could not reload sourcecode for " + object.getQualifiedNameWithType() + " from database.", e);
            }
            return false;
        } finally {
            Project project = getProject();
            if (project != null && !project.isDisposed()) {
View Full Code Here

            }
        }
    }

    public void updateToDatabase() throws SQLException {
        DBSchemaObject object = getObject();
        if (object != null) {
            object.executeUpdateDDL(getContentType(), getLastSavedContent(), content);
            updateChangeTimestamp();
            getDatabaseFile().updateDDLFiles(getContentType());
            setModified(false);
            lastSavedContent = content;
        }
View Full Code Here

    public ObjectActionGroup(DBObject object) {
        DatabaseCompatibilityInterface compatibilityInterface = DatabaseCompatibilityInterface.getInstance(object);

        DBObjectProperties properties = object.getProperties();
        if(object instanceof DBSchemaObject) {
            DBSchemaObject schemaObject = (DBSchemaObject) object;

            if (properties.is(DBObjectProperty.EDITABLE)) {
                DBContentType contentType = schemaObject.getContentType();
                if (contentType == DBContentType.DATA || contentType == DBContentType.CODE_AND_DATA) {
                    add(new EditObjectDataAction(schemaObject));
                }

                if (contentType == DBContentType.CODE || contentType == DBContentType.CODE_AND_DATA || contentType == DBContentType.CODE_SPEC_AND_BODY) {
View Full Code Here

    public byte[] contentsToByteArray() {
        return content.getBytes(getCharset());
    }

    public String createDDLStatement() {
        DBSchemaObject object = getObject();
        if (object != null) {
            String content = this.content.trim();
            if (content.length() > 0) {
                return object.createDDLStatement(content);
            }
        }
        return "";
    }
View Full Code Here

        content = null;
        super.dispose();
    }

    public int getGuardedBlockEndOffset() {
        DBSchemaObject object = getObject();
        if (object != null) {
            String name = object.getName();
            int index = StringUtil.indexOfIgnoreCase(content, name, 0);
            if (index > -1) {
                return index + name.length();
            }
        }
View Full Code Here

        return dataset;
    }

    @Nullable
    private DBSchemaObject getObjectFallbackOnSynonym(DBObjectList<? extends DBSchemaObject> objects, String name) {
        DBSchemaObject object = objects.getObject(name);
        if (object == null && DatabaseCompatibilityInterface.getInstance(this).supportsObjectType(DBObjectType.SYNONYM.getTypeId())) {
            DBSynonym synonym = synonyms.getObject(name);
            if (synonym != null) {
                DBObject underlyingObject = synonym.getUnderlyingObject();
                if (underlyingObject != null) {
View Full Code Here

        try {
            connection = getConnectionHandler().getPoolConnection();
            resultSet = getConnectionHandler().getInterfaceProvider().getMetadataInterface().loadInvalidObjects(getName(), connection);
            while (resultSet != null && resultSet.next()) {
                String objectName = resultSet.getString("OBJECT_NAME");
                DBSchemaObject schemaObject = (DBSchemaObject) getChildObjectNoLoad(objectName);
                if (schemaObject != null && schemaObject.getStatus().has(DBObjectStatus.VALID)) {
                    DBObjectStatusHolder objectStatus = schemaObject.getStatus();
                    boolean statusChanged;

                    if (schemaObject.getContentType().isBundle()) {
                        String objectType = resultSet.getString("OBJECT_TYPE");
                        statusChanged = objectType.contains("BODY") ?
                                objectStatus.set(DBContentType.CODE_BODY, DBObjectStatus.VALID, false) :
                                objectStatus.set(DBContentType.CODE_SPEC, DBObjectStatus.VALID, false);
                    }
                    else {
                        statusChanged = objectStatus.set(DBObjectStatus.VALID, false);
                    }
                    if (statusChanged) {
                        refreshNodes.add(schemaObject.getTreeParent());
                    }
                }
            }

            resultSet = getConnectionHandler().getInterfaceProvider().getMetadataInterface().loadDebugObjects(getName(), connection);
            while (resultSet != null && resultSet.next()) {
                String objectName = resultSet.getString("OBJECT_NAME");
                DBSchemaObject schemaObject = (DBSchemaObject) getChildObjectNoLoad(objectName);
                if (schemaObject != null && schemaObject.getStatus().has(DBObjectStatus.DEBUG)) {
                    DBObjectStatusHolder objectStatus = schemaObject.getStatus();
                    boolean statusChanged;

                    if (schemaObject.getContentType().isBundle()) {
                        String objectType = resultSet.getString("OBJECT_TYPE");
                        statusChanged = objectType.contains("BODY") ?
                                objectStatus.set(DBContentType.CODE_BODY, DBObjectStatus.DEBUG, true) :
                                objectStatus.set(DBContentType.CODE_SPEC, DBObjectStatus.DEBUG, true);
                    }
                    else {
                        statusChanged = objectStatus.set(DBObjectStatus.DEBUG, true);
                    }
                    if (statusChanged) {
                        refreshNodes.add(schemaObject.getTreeParent());
                    }
                }
            }

        } catch (SQLException e) {
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.