Search in sources :

Example 6 with DiscordIntegrationProjectComponent

use of com.almightyalpaca.jetbrains.plugins.discord.components.DiscordIntegrationProjectComponent in project Intellij-Discord-Integration by Almighty-Alpaca.

the class VirtualFileListener method propertyChanged.

@Override
public void propertyChanged(@NotNull VirtualFilePropertyEvent event) {
    VirtualFile file = event.getFile();
    FileDocumentManager documentManager = FileDocumentManager.getInstance();
    Document document = documentManager.getDocument(file);
    if (document != null) {
        Editor[] editors = EditorFactory.getInstance().getEditors(document);
        for (Editor editor : editors) {
            Project project = editor.getProject();
            DiscordIntegrationProjectComponent component = DiscordIntegrationProjectComponent.getInstance(project);
            if (component != null && component.getFiles().containsKey(file)) {
                if ((event.getPropertyName().equals(VirtualFile.PROP_NAME))) {
                    component.fileUpdateName(file);
                } else if ((event.getPropertyName().equals(VirtualFile.PROP_WRITABLE))) {
                    component.fileUpdateReadOnly(event.getFile());
                }
            }
        }
    }
}
Also used : Project(com.intellij.openapi.project.Project) DiscordIntegrationProjectComponent(com.almightyalpaca.jetbrains.plugins.discord.components.DiscordIntegrationProjectComponent) FileDocumentManager(com.intellij.openapi.fileEditor.FileDocumentManager) Document(com.intellij.openapi.editor.Document) Editor(com.intellij.openapi.editor.Editor)

Example 7 with DiscordIntegrationProjectComponent

use of com.almightyalpaca.jetbrains.plugins.discord.components.DiscordIntegrationProjectComponent in project Intellij-Discord-Integration by Almighty-Alpaca.

the class DiscordIntegrationProjectConfigurable method apply.

@Override
public void apply() {
    if (this.panel != null) {
        this.panel.apply();
        InstanceInfo instance = this.applicationComponent.getInstanceInfo();
        DiscordIntegrationProjectComponent component = DiscordIntegrationProjectComponent.getInstance(this.settingsProviderProject.getProject());
        if (component != null) {
            ProjectInfo project = component.getProjectInfo();
            this.applicationComponent.updateData(data -> data.instanceSetSettings(System.currentTimeMillis(), instance, this.settingsProviderApplication.getSettings()));
            this.applicationComponent.updateData(data -> data.projectSetSettings(System.currentTimeMillis(), instance, project, this.settingsProviderProject.getSettings()));
            this.applicationComponent.checkExperiementalWindowListener();
        }
    }
}
Also used : DiscordIntegrationProjectComponent(com.almightyalpaca.jetbrains.plugins.discord.components.DiscordIntegrationProjectComponent) ProjectInfo(com.almightyalpaca.jetbrains.plugins.discord.data.ProjectInfo) InstanceInfo(com.almightyalpaca.jetbrains.plugins.discord.data.InstanceInfo)

Example 8 with DiscordIntegrationProjectComponent

use of com.almightyalpaca.jetbrains.plugins.discord.components.DiscordIntegrationProjectComponent in project Intellij-Discord-Integration by Almighty-Alpaca.

the class DocumentListener method documentChanged.

@Override
public void documentChanged(DocumentEvent event) {
    LOG.trace("DocumentListener#documentChanged({})", event.getDocument());
    Document document = event.getDocument();
    Editor[] editors = EditorFactory.getInstance().getEditors(document);
    FileDocumentManager documentManager = FileDocumentManager.getInstance();
    for (Editor editor : editors) {
        Project project = editor.getProject();
        DiscordIntegrationProjectComponent component = DiscordIntegrationProjectComponent.getInstance(project);
        if (component != null)
            component.updateTimeAccessed(documentManager.getFile(document));
    }
}
Also used : Project(com.intellij.openapi.project.Project) DiscordIntegrationProjectComponent(com.almightyalpaca.jetbrains.plugins.discord.components.DiscordIntegrationProjectComponent) FileDocumentManager(com.intellij.openapi.fileEditor.FileDocumentManager) Document(com.intellij.openapi.editor.Document) Editor(com.intellij.openapi.editor.Editor)

Example 9 with DiscordIntegrationProjectComponent

use of com.almightyalpaca.jetbrains.plugins.discord.components.DiscordIntegrationProjectComponent in project Intellij-Discord-Integration by Almighty-Alpaca.

the class FileEditorManagerListener method fileClosed.

@Override
public void fileClosed(@NotNull FileEditorManager source, @NotNull VirtualFile file) {
    LOG.trace("FileEditorManagerListener#fileClosed({}, {})", source, file);
    Project project = source.getProject();
    DiscordIntegrationProjectComponent component = DiscordIntegrationProjectComponent.getInstance(project);
    if (component != null)
        component.fileRemove(file);
}
Also used : Project(com.intellij.openapi.project.Project) DiscordIntegrationProjectComponent(com.almightyalpaca.jetbrains.plugins.discord.components.DiscordIntegrationProjectComponent)

Example 10 with DiscordIntegrationProjectComponent

use of com.almightyalpaca.jetbrains.plugins.discord.components.DiscordIntegrationProjectComponent in project Intellij-Discord-Integration by Almighty-Alpaca.

the class VisibleAreaListener method visibleAreaChanged.

@Override
public void visibleAreaChanged(VisibleAreaEvent event) {
    LOG.trace("VisibleAreaListener#visibleAreaChanged({})", event);
    FileDocumentManager documentManager = FileDocumentManager.getInstance();
    Project project = event.getEditor().getProject();
    DiscordIntegrationProjectComponent component = DiscordIntegrationProjectComponent.getInstance(project);
    if (component != null)
        component.updateTimeAccessed(documentManager.getFile(event.getEditor().getDocument()));
}
Also used : Project(com.intellij.openapi.project.Project) DiscordIntegrationProjectComponent(com.almightyalpaca.jetbrains.plugins.discord.components.DiscordIntegrationProjectComponent) FileDocumentManager(com.intellij.openapi.fileEditor.FileDocumentManager)

Aggregations

DiscordIntegrationProjectComponent (com.almightyalpaca.jetbrains.plugins.discord.components.DiscordIntegrationProjectComponent)10 Project (com.intellij.openapi.project.Project)9 FileDocumentManager (com.intellij.openapi.fileEditor.FileDocumentManager)5 Editor (com.intellij.openapi.editor.Editor)3 InstanceInfo (com.almightyalpaca.jetbrains.plugins.discord.data.InstanceInfo)2 ProjectInfo (com.almightyalpaca.jetbrains.plugins.discord.data.ProjectInfo)2 Document (com.intellij.openapi.editor.Document)2 DiscordIntegrationApplicationComponent (com.almightyalpaca.jetbrains.plugins.discord.components.DiscordIntegrationApplicationComponent)1 ProjectSettingsStorage (com.almightyalpaca.jetbrains.plugins.discord.settings.data.storage.ProjectSettingsStorage)1