当前位置: 首页>>代码示例>>Java>>正文


Java AppTopics类代码示例

本文整理汇总了Java中com.intellij.AppTopics的典型用法代码示例。如果您正苦于以下问题:Java AppTopics类的具体用法?Java AppTopics怎么用?Java AppTopics使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AppTopics类属于com.intellij包,在下文中一共展示了AppTopics类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: SwaggerUiUrlProvider

import com.intellij.AppTopics; //导入依赖的package包/类
private SwaggerUiUrlProvider(final FileDetector fileDetector) {
    this.fileDetector = fileDetector;
    ApplicationManager.getApplication().getMessageBus().connect().subscribe(AppTopics.FILE_DOCUMENT_SYNC, new FileDocumentManagerAdapter() {
        @Override
        public void beforeDocumentSaving(@NotNull final Document document) {
            SwaggerFileService swaggerFileService = ServiceManager.getService(SwaggerFileService.class);
            final Project[] openProjects = ProjectManager.getInstance().getOpenProjects();

            if (openProjects.length > 0) {
                final PsiFile psiFile = PsiDocumentManager.getInstance(openProjects[0]).getPsiFile(document);

                if (psiFile != null && swaggerFileService.swaggerContentExistsFor(psiFile)) {
                    final boolean swaggerFile = fileDetector.isMainSwaggerFile(psiFile) || fileDetector.isMainOpenApiFile(psiFile);

                    if (swaggerFile) {
                        swaggerFileService.convertSwaggerToHtml(psiFile);
                    }
                }
            }
        }
        });
}
 
开发者ID:zalando,项目名称:intellij-swagger,代码行数:23,代码来源:SwaggerUiUrlProvider.java

示例2: activate

import com.intellij.AppTopics; //导入依赖的package包/类
public void activate() {
  if (myConnection == null) {
    myListenerDisposable = Disposer.newDisposable();
    Disposer.register(myProject, myListenerDisposable);
    EditorFactory.getInstance().getEventMulticaster().addDocumentListener(myListener, myListenerDisposable);
    myConnection = ApplicationManager.getApplication().getMessageBus().connect(myProject);
    myConnection.subscribe(AppTopics.FILE_DOCUMENT_SYNC, new FileDocumentManagerAdapter() {
      @Override
      public void beforeAllDocumentsSaving() {
        myDocumentSavingInProgress = true;
        ApplicationManager.getApplication().invokeLater(new Runnable() {
          @Override
          public void run() {
            myDocumentSavingInProgress = false;
          }
        }, ModalityState.any());
      }
    });
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:DelayedDocumentWatcher.java

示例3: testSaveDocument_DoNotSaveIfModStampEqualsToFile

import com.intellij.AppTopics; //导入依赖的package包/类
public void testSaveDocument_DoNotSaveIfModStampEqualsToFile() throws Exception {
  final VirtualFile file = createFile();
  final DocumentEx document = (DocumentEx)myDocumentManager.getDocument(file);
  assertNotNull(file.toString(), document);
  WriteCommandAction.runWriteCommandAction(myProject, new Runnable() {
    @Override
    public void run() {
      document.insertString(0, "zzz");
      document.setModificationStamp(file.getModificationStamp());
    }
  });

  getProject().getMessageBus().connect(getTestRootDisposable()).subscribe(AppTopics.FILE_DOCUMENT_SYNC, new FileDocumentManagerAdapter() {
    @Override
    public void beforeDocumentSaving(@NotNull Document documentToSave) {
      assertNotSame(document, documentToSave);
    }
  });

  myDocumentManager.saveDocument(document);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:FileDocumentManagerImplTest.java

示例4: PsiVFSListener

import com.intellij.AppTopics; //导入依赖的package包/类
public PsiVFSListener(Project project) {
  myProject = project;
  myFileTypeManager = FileTypeManager.getInstance();
  myProjectRootManager = ProjectRootManager.getInstance(project);
  myManager = (PsiManagerImpl) PsiManager.getInstance(project);
  myFileManager = (FileManagerImpl) myManager.getFileManager();

  myConnection = project.getMessageBus().connect(project);

  StartupManager.getInstance(project).registerPreStartupActivity(new Runnable() {
    @Override
    public void run() {
      myConnection.subscribe(ProjectTopics.PROJECT_ROOTS, new MyModuleRootListener());
      myConnection.subscribe(FileTypeManager.TOPIC, new FileTypeListener.Adapter() {
        @Override
        public void fileTypesChanged(@NotNull FileTypeEvent e) {
          myFileManager.processFileTypesChanged();
        }
      });
      myConnection.subscribe(AppTopics.FILE_DOCUMENT_SYNC, new MyFileDocumentManagerAdapter());
      myFileManager.markInitialized();
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:PsiVFSListener.java

示例5: JavaFileManagerImpl

import com.intellij.AppTopics; //导入依赖的package包/类
public JavaFileManagerImpl(final PsiManagerEx manager, final ProjectRootManager projectRootManager, MessageBus bus,
                           final StartupManager startupManager) {
  super(manager, projectRootManager, bus);

  myConnection.subscribe(AppTopics.FILE_DOCUMENT_SYNC, new FileDocumentManagerAdapter() {
    @Override
    public void fileWithNoDocumentChanged(@NotNull final VirtualFile file) {
      clearNonRepositoryMaps();
    }
  });
  


  startupManager.registerStartupActivity(
    new Runnable() {
      @Override
      public void run() {
        initialize();
      }
    }
  );

}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:JavaFileManagerImpl.java

示例6: setupEventListeners

import com.intellij.AppTopics; //导入依赖的package包/类
private void setupEventListeners() {
    ApplicationManager.getApplication().invokeLater(new Runnable(){
        public void run() {

            // save file
            MessageBus bus = ApplicationManager.getApplication().getMessageBus();
            connection = bus.connect();
            connection.subscribe(AppTopics.FILE_DOCUMENT_SYNC, new CustomSaveListener());

            // edit document
            EditorFactory.getInstance().getEventMulticaster().addDocumentListener(new CustomDocumentListener());

            // mouse press
            EditorFactory.getInstance().getEventMulticaster().addEditorMouseListener(new CustomEditorMouseListener());

            // scroll document
            EditorFactory.getInstance().getEventMulticaster().addVisibleAreaListener(new CustomVisibleAreaListener());
        }
    });
}
 
开发者ID:wakatime,项目名称:jetbrains-wakatime,代码行数:21,代码来源:WakaTime.java

示例7: testSaveDocument_DoNotSaveIfModStampEqualsToFile

import com.intellij.AppTopics; //导入依赖的package包/类
public void testSaveDocument_DoNotSaveIfModStampEqualsToFile() throws Exception {
  final VirtualFile file = createFile();
  final DocumentEx document = (DocumentEx)myDocumentManager.getDocument(file);
  assertNotNull(file.toString(), document);
  WriteCommandAction.runWriteCommandAction(myProject, new Runnable() {
    @Override
    public void run() {
      document.insertString(0, "zzz");
      document.setModificationStamp(file.getModificationStamp());
    }
  });

  getProject().getMessageBus().connect(getTestRootDisposable()).subscribe(AppTopics.FILE_DOCUMENT_SYNC, new FileDocumentManagerAdapter() {
    @Override
    public void beforeDocumentSaving(@Nonnull Document documentToSave) {
      assertNotSame(document, documentToSave);
    }
  });

  myDocumentManager.saveDocument(document);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:22,代码来源:FileDocumentManagerImplTest.java

示例8: PsiVFSListener

import com.intellij.AppTopics; //导入依赖的package包/类
public PsiVFSListener(Project project) {
  installGlobalListener();

  myProject = project;
  myFileTypeManager = FileTypeManager.getInstance();
  myProjectRootManager = ProjectRootManager.getInstance(project);
  myManager = (PsiManagerImpl)PsiManager.getInstance(project);
  myFileManager = (FileManagerImpl)myManager.getFileManager();

  StartupManager.getInstance(project).registerPreStartupActivity(() -> {
    MessageBusConnection connection = project.getMessageBus().connect(project);
    connection.subscribe(ProjectTopics.PROJECT_ROOTS, new MyModuleRootListener());
    connection.subscribe(FileTypeManager.TOPIC, new FileTypeListener() {
      @Override
      public void fileTypesChanged(@Nonnull FileTypeEvent e) {
        myFileManager.processFileTypesChanged();
      }
    });
    connection.subscribe(AppTopics.FILE_DOCUMENT_SYNC, new MyFileDocumentManagerAdapter());
  });
}
 
开发者ID:consulo,项目名称:consulo,代码行数:22,代码来源:PsiVFSListener.java

示例9: initComponent

import com.intellij.AppTopics; //导入依赖的package包/类
@Override
public void initComponent() {
    Boolean reasonReformatOnSave = Boolean.valueOf(System.getProperty("reasonReformatOnSave"));
    if (reasonReformatOnSave) {
        Notifications.Bus.notify(new RmlNotification("Refmt", "reformat on save is enabled", NotificationType.INFORMATION));
        ReformatOnSave handler = new ReformatOnSave();
        ApplicationManager.getApplication().getMessageBus().connect().subscribe(AppTopics.FILE_DOCUMENT_SYNC, handler);
    }
}
 
开发者ID:reasonml-editor,项目名称:reasonml-idea-plugin,代码行数:10,代码来源:ReasonDocumentManager.java

示例10: initComponent

import com.intellij.AppTopics; //导入依赖的package包/类
public void initComponent() {
    LOGGER.debug("phpfmt welcome!", String.format("Debug mode is: %s", settings.isDebug()? "On": "Off"));
    toEventLog(settings.isDebug(), "phpfmt updating phpfmt...", String.format("engine: %s, version: %s.", settings.getEngineChannel(), settings.getEngineVersion()));
    selfUpdate();
    final MessageBus bus = ApplicationManager.getApplication().getMessageBus();
    final MessageBusConnection connection = bus.connect();
    connection.subscribe(AppTopics.FILE_DOCUMENT_SYNC, new FileListener());
}
 
开发者ID:Shaked,项目名称:phpstorm-phpfmt,代码行数:9,代码来源:Component.java

示例11: install

import com.intellij.AppTopics; //导入依赖的package包/类
@Override
public void install(@NotNull StatusBar statusBar) {
  super.install(statusBar);
  MessageBusConnection connection = ApplicationManager.getApplication().getMessageBus().connect(this);
  connection.subscribe(AppTopics.FILE_DOCUMENT_SYNC, new FileDocumentManagerAdapter() {
    @Override
    public void fileContentReloaded(@NotNull VirtualFile file, @NotNull Document document) {
      update();
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:LineSeparatorPanel.java

示例12: testReplaceDocumentTextWithTheSameText

import com.intellij.AppTopics; //导入依赖的package包/类
public void testReplaceDocumentTextWithTheSameText() throws Exception {
  final VirtualFile file = createFile();
  final DocumentEx document = (DocumentEx)myDocumentManager.getDocument(file);

  final String newText = "test text";
  assertNotNull(file.toString(), document);
  WriteCommandAction.runWriteCommandAction(myProject, new Runnable() {
    @Override
    public void run() {
      document.replaceString(0, document.getTextLength(), newText);
      assertTrue(myDocumentManager.isDocumentUnsaved(document));
      myDocumentManager.saveDocument(document);

      getProject().getMessageBus().connect(getTestRootDisposable())
        .subscribe(AppTopics.FILE_DOCUMENT_SYNC, new FileDocumentManagerAdapter() {
          @Override
          public void beforeDocumentSaving(@NotNull Document documentToSave) {
            assertNotSame(document, documentToSave);
          }
        });

      final long modificationStamp = document.getModificationStamp();

      document.replaceString(0, document.getTextLength(), newText);
      if (myDocumentManager.isDocumentUnsaved(document)) {
        assertTrue(document.getModificationStamp() > modificationStamp);
      }
      else {
        assertEquals(modificationStamp, document.getModificationStamp());
      }
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:FileDocumentManagerImplTest.java

示例13: initComponent

import com.intellij.AppTopics; //导入依赖的package包/类
public void initComponent() {
  ApplicationManager.getApplication().getMessageBus().connect().subscribe(AppTopics.FILE_DOCUMENT_SYNC, new FileDocumentManagerAdapter() {
    @Override
    public void beforeAllDocumentsSaving() {
      Map<Document, Project> documentsToWarn = getDocumentsBeingCommitted();
      if (!documentsToWarn.isEmpty()) {
        boolean allowSave = showAllowSaveDialog(documentsToWarn);
        updateSaveability(documentsToWarn, allowSave);
      }
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:VetoSavingCommittingDocumentsAdapter.java

示例14: install

import com.intellij.AppTopics; //导入依赖的package包/类
public void install() {
  class Listener extends FileDocumentManagerAdapter implements ProjectEx.ProjectSaved {
    @Override
    public void beforeDocumentSaving(@NotNull Document document) {
      if (document == myConsole.getEditorDocument()) {
        saveHistory();
      }
    }

    @Override
    public void saved(@NotNull Project project) {
      saveHistory();
    }
  }
  Listener listener = new Listener();
  ApplicationManager.getApplication().getMessageBus().connect(myConsole).subscribe(ProjectEx.ProjectSaved.TOPIC, listener);
  myConsole.getProject().getMessageBus().connect(myConsole).subscribe(AppTopics.FILE_DOCUMENT_SYNC, listener);

  myConsole.getVirtualFile().putUserData(CONTROLLER_KEY, this);
  Disposer.register(myConsole, new Disposable() {
    @Override
    public void dispose() {
      myConsole.getVirtualFile().putUserData(CONTROLLER_KEY, null);
      saveHistory();
    }
  });
  if (myHelper.getModel().getHistorySize() == 0) {
    loadHistory(myHelper.getId());
  }
  configureActions();
  myLastSaveStamp = getCurrentTimeStamp();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:ConsoleHistoryController.java

示例15: PsiDocumentManagerImpl

import com.intellij.AppTopics; //导入依赖的package包/类
public PsiDocumentManagerImpl(@NotNull final Project project,
                              @NotNull PsiManager psiManager,
                              @NotNull EditorFactory editorFactory,
                              @NotNull MessageBus bus,
                              @NonNls @NotNull final DocumentCommitThread documentCommitThread) {
  super(project, psiManager, bus, documentCommitThread);
  myDocumentCommitThread = documentCommitThread;
  editorFactory.getEventMulticaster().addDocumentListener(this, project);
  MessageBusConnection busConnection = bus.connect();
  busConnection.subscribe(AppTopics.FILE_DOCUMENT_SYNC, new FileDocumentManagerAdapter() {
    @Override
    public void fileContentLoaded(@NotNull final VirtualFile virtualFile, @NotNull Document document) {
      PsiFile psiFile = ApplicationManager.getApplication().runReadAction(new Computable<PsiFile>() {
        @Override
        public PsiFile compute() {
          return myProject.isDisposed() || !virtualFile.isValid() ? null : getCachedPsiFile(virtualFile);
        }
      });
      fireDocumentCreated(document, psiFile);
    }
  });
  busConnection.subscribe(DocumentBulkUpdateListener.TOPIC, new DocumentBulkUpdateListener.Adapter() {
    @Override
    public void updateFinished(@NotNull Document doc) {
      documentCommitThread.queueCommit(project, doc, "Bulk update finished", ApplicationManager.getApplication().getDefaultModalityState());
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:PsiDocumentManagerImpl.java


注:本文中的com.intellij.AppTopics类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。