Examples of DBSchemaObject


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

        // map last used connection/schema
        FileConnectionMappingManager connectionMappingManager = FileConnectionMappingManager.getInstance(getProject());
        ConnectionHandler activeConnection = connectionMappingManager.getActiveConnection(virtualFile);
        if (activeConnection == null) {
            DBSchemaObject schemaObject = objectRef.get();
            if (schemaObject != null) {
                ConnectionHandler connectionHandler = schemaObject.getConnectionHandler();
                DBSchema schema = schemaObject.getSchema();
                connectionMappingManager.setActiveConnection(virtualFile, connectionHandler);
                connectionMappingManager.setCurrentSchema(virtualFile, schema);
            }
        }
View Full Code Here

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

    }

    @Override
    public void fileDeleted(@NotNull VirtualFileEvent event) {
        DBObjectRef<DBSchemaObject> objectRef = mappings.get(event.getFile().getPath());
        DBSchemaObject object = DBObjectRef.get(objectRef);
        if (object != null) {
            detachDDLFile(event.getFile());
            DatabaseFileSystem.getInstance().reopenEditor(object);
        }
    }
View Full Code Here

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

            boolean isConsole = virtualFile instanceof SQLConsoleFile;
            presentation.setVisible(!isConsole);

            if (virtualFile.isInLocalFileSystem()) {
                DDLFileAttachmentManager fileAttachmentManager = DDLFileAttachmentManager.getInstance(project);
                DBSchemaObject editableObject = fileAttachmentManager.getEditableObject(virtualFile);
                if (editableObject != null) {
                    boolean isOpened = DatabaseFileSystem.getInstance().isFileOpened(editableObject);
                    presentation.setEnabled(!isOpened);
                }
            }
View Full Code Here

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

                    enabled = true;
                }

                if (virtualFile.isInLocalFileSystem()) {
                    DDLFileAttachmentManager fileAttachmentManager = DDLFileAttachmentManager.getInstance(project);
                    DBSchemaObject editableObject = fileAttachmentManager.getEditableObject(virtualFile);
                    if (editableObject != null) {
                        boolean isOpened = DatabaseFileSystem.getInstance().isFileOpened(editableObject);
                        if (isOpened) {
                            enabled = false;
                        }
View Full Code Here

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

    @Override
    public DDLMappedNotificationPanel createNotificationPanel(VirtualFile virtualFile, FileEditor fileEditor) {
        if (virtualFile instanceof DatabaseEditableObjectFile) {
            if (fileEditor instanceof DDLFileEditor) {
                DatabaseEditableObjectFile editableObjectFile = (DatabaseEditableObjectFile) virtualFile;
                DBSchemaObject editableObject = editableObjectFile.getObject();
                DDLFileEditor ddlFileEditor = (DDLFileEditor) fileEditor;
                VirtualFile ddlVirtualFile = ddlFileEditor.getVirtualFile();
                return createPanel(ddlVirtualFile, editableObject);
            }
            return null;
        } else {
            if (virtualFile.getFileType() instanceof DBLanguageFileType) {
                DDLFileAttachmentManager attachmentManager = DDLFileAttachmentManager.getInstance(project);
                DBSchemaObject editableObject = attachmentManager.getEditableObject(virtualFile);
                if (editableObject != null) {
                    DatabaseFileSystem databaseFileSystem = DatabaseFileSystem.getInstance();
                    if (databaseFileSystem.isFileOpened(editableObject))
                        return createPanel(virtualFile, editableObject);
                }
View Full Code Here

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

            @Override
            public void run() {
                if (!project.isDisposed()) {
                    DDLFileAttachmentManager attachmentManager = DDLFileAttachmentManager.getInstance(project);
                    attachmentManager.detachDDLFile(virtualFile);
                    DBSchemaObject editableObject = DBObjectRef.get(editableObjectRef);
                    if (editableObject != null) {
                        DatabaseFileSystem.getInstance().reopenEditor(editableObject);
                    }
                }
            }
View Full Code Here

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

        }

        if (VirtualFileUtil.isLocalFileSystem(virtualFile)) {
            // if the file is a bound ddl file, then resolve the object which it is
            // linked to, and return its database connection
            DBSchemaObject schemaObject = DDLFileAttachmentManager.getInstance(project).getEditableObject(virtualFile);
            if (schemaObject != null && DatabaseFileSystem.getInstance().isFileOpened(schemaObject)) {
                return schemaObject.getConnectionHandler();
            }

            // lookup connection mappings
            ConnectionHandler connectionHandler = virtualFile.getUserData(ACTIVE_CONNECTION_KEY);
            if (connectionHandler == null) {
View Full Code Here

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

        }

        if (VirtualFileUtil.isLocalFileSystem(virtualFile) || VirtualFileUtil.isVirtualFileSystem(virtualFile)) {
            // if the file is a bound ddl file, then resolve the object which it is
            // linked to, and return its parent schema
            DBSchemaObject schemaObject = DDLFileAttachmentManager.getInstance(project).getEditableObject(virtualFile);
            if (schemaObject != null && DatabaseFileSystem.getInstance().isFileOpened(schemaObject)) {
                return schemaObject.getSchema();
            }

            // lookup schema mappings
            DBObjectRef<DBSchema> currentSchemaRef = virtualFile.getUserData(CURRENT_SCHEMA_KEY);
            if (currentSchemaRef == null) {
View Full Code Here

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

    public XSourcePosition getSourcePosition() {
        return inhibitSourcePosition ? null : sourcePosition;
    }

    public void customizePresentation(final SimpleColoredComponent component) {
        DBSchemaObject object = DBProgramDebugUtil.getObject(sourcePosition);
        if (object != null) {
            component.append(object.getQualifiedName(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
            component.append(" (line " + (sourcePosition.getLine() + 1) + ") ", SimpleTextAttributes.REGULAR_ATTRIBUTES);
            component.setIcon(object.getOriginalIcon());
        } else {
            component.append(XDebuggerBundle.message("invalid.frame"), SimpleTextAttributes.ERROR_ATTRIBUTES);
        }
    }
View Full Code Here

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

                        elementType.is(ElementTypeAttribute.OBJECT_DECLARATION) ? DBContentType.CODE_SPEC :
                        elementType.is(ElementTypeAttribute.OBJECT_SPECIFICATION) ? DBContentType.CODE_BODY : null;

                if (targetContentType != null && identifierPsiElement.getFile() instanceof PSQLFile) {
                    PSQLFile file = (PSQLFile) identifierPsiElement.getFile();
                    DBSchemaObject object = (DBSchemaObject) file.getUnderlyingObject();
                    VirtualFile virtualFile = file.getVirtualFile();

                    if (object == null || virtualFile.isInLocalFileSystem()) {
                        ElementTypeAttribute targetAttribute =
                                elementType.is(ElementTypeAttribute.OBJECT_DECLARATION) ? ElementTypeAttribute.OBJECT_SPECIFICATION :
                                elementType.is(ElementTypeAttribute.OBJECT_SPECIFICATION) ? ElementTypeAttribute.OBJECT_DECLARATION : null;

                        if (targetAttribute != null) {
                            BasePsiElement rootPsiElement = identifierPsiElement.lookupEnclosingPsiElement(ElementTypeAttribute.ROOT);

                            BasePsiElement targetElement = rootPsiElement == null ? null :
                                    rootPsiElement.lookupPsiElementBySubject(targetAttribute,
                                                identifierPsiElement.getChars(),
                                                identifierPsiElement.getObjectType());

                            if (targetElement != null) {
                                NavigationAction navigationAction = targetContentType == DBContentType.CODE_BODY ?
                                        new NavigateToDefinitionAction(null, targetElement, objectType) :
                                        new NavigateToSpecificationAction(null, targetElement, objectType);
                                Annotation annotation = holder.createInfoAnnotation(basePsiElement, null);
                                NavigationGutterRenderer gutterIconRenderer = new NavigationGutterRenderer(navigationAction, GutterIconRenderer.Alignment.RIGHT);
                                annotation.setGutterIconRenderer(gutterIconRenderer);
                            }
                            NavigateToObjectAction navigateToObjectAction = new NavigateToObjectAction(identifierPsiElement.resolveUnderlyingObject(), objectType);
                            Annotation annotation = holder.createInfoAnnotation(basePsiElement, null);
                            annotation.setGutterIconRenderer(new NavigationGutterRenderer(navigateToObjectAction, GutterIconRenderer.Alignment.LEFT));


                        }
                    } else if (object.getContentType() == DBContentType.CODE_SPEC_AND_BODY) {
                        SourceCodeManager codeEditorManager = SourceCodeManager.getInstance(object.getProject());


                        BasePsiElement targetElement = codeEditorManager.getObjectNavigationElement(object, targetContentType, identifierPsiElement.getObjectType(), identifierPsiElement.getChars());
                        if (targetElement != null) {
                            NavigationAction navigationAction = targetContentType == DBContentType.CODE_BODY ?
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.