Package com.intellij.openapi.fileEditor

Examples of com.intellij.openapi.fileEditor.FileEditorManager


    public void openFileInProject(File pFile, Project pProject) {
        if (pFile.canRead()) {
            try {
                String tUrl = VfsUtil.fixURLforIDEA(pFile.toURI().toURL().toString());
                final VirtualFile tVirtualFile = VirtualFileManager.getInstance().findFileByUrl(tUrl);
                final FileEditorManager tManager = FileEditorManager.getInstance(pProject);
                FileType tFileType = null;
                if (tVirtualFile != null) {
//                    tFileType = FileTypeManager.getInstance().getFileTypeByFile(tVirtualFile);
                    SwingUtilities.invokeLater(new Runnable() {
                         public void run() {
                             tManager.openFile(tVirtualFile, true);
                         }
                    });
                }
            } catch (MalformedURLException e) {
                log.error(e);
View Full Code Here


  private static void scheduleFilesOpeningAndPubGet(final @NotNull Project project, final @NotNull VirtualFile[] files) {
    StartupManager.getInstance(project).runWhenProjectIsInitialized(new Runnable() {
      @Override
      public void run() {
        final FileEditorManager manager = FileEditorManager.getInstance(project);
        for (VirtualFile file : files) {
          manager.openFile(file, true);

          if (PubspecYamlUtil.PUBSPEC_YAML.equals(file.getName())) {
            final AnAction pubGetAction = ActionManager.getInstance().getAction("Dart.pub.get");
            final Module module = ModuleUtilCore.findModuleForFile(file, project);
            if (pubGetAction instanceof DartPubGetAction && module != null) {
View Full Code Here

    super(commandClass);
  }

  public void update(AnActionEvent e) {

    FileEditorManager editorManager = FileEditorManager.getInstance(getProject(e));
    Editor editor = editorManager.getSelectedTextEditor();

    T command = getCommand(e);
    MutablePicoContainer container = getContainer(e);

    if (command != null && editor != null && container != null) {
View Full Code Here

        }
    }

    @Override
    public void applyHighlight(String path, int userID, String username, Boolean following, Boolean force, ArrayList<ArrayList<Integer>> ranges) {
        final FileEditorManager manager = FileEditorManager.getInstance(context.project);
        final VirtualFile virtualFile = FileDocumentManager.getInstance().getFile(document);

        if ((force || following) && virtualFile != null && virtualFile.isValid()) {
            boolean spam = false;
            if (!manager.isFileOpen(virtualFile) || !Arrays.asList(manager.getSelectedFiles()).contains(virtualFile)) {
                spam = true;
            }
            if (spam && username.length() > 0 && force) {
                context.statusMessage(String.format("%s has summoned you!", username));
            }
            manager.openFile(virtualFile, false, true);
        }

        int textLength = document.getTextLength();
        if (textLength == 0) {
            return;
View Full Code Here

    MergingUpdateQueue queue = project.getUserData(LIVE_PREVIEW_QUEUE);
    if (queue == null) {
      JComponent activationComponent = WindowManager.getInstance().getFrame(project).getRootPane();
      project.putUserData(LIVE_PREVIEW_QUEUE, queue = new MergingUpdateQueue("LIVE_PREVIEW_QUEUE", 1000, true, null, project, activationComponent));
    }
    final FileEditorManager fileEditorManager = FileEditorManager.getInstance(project);
    final MergingUpdateQueue finalQueue = queue;
    EditorFactory.getInstance().getEventMulticaster().addDocumentListener(new DocumentAdapter() {
      @Override
      public void documentChanged(DocumentEvent e) {
        Document document = e.getDocument();
        final FileDocumentManager fileDocumentManager = FileDocumentManager.getInstance();
        VirtualFile file = fileDocumentManager.getFile(document);
        if (file == null || file.getFileType() != BnfFileType.INSTANCE) return;
        finalQueue.cancelAllUpdates();
        finalQueue.queue(new Update(Boolean.TRUE, true) {
          @Override
          public void run() {
            FileManager fileManager = ((PsiManagerEx)PsiManager.getInstance(project)).getFileManager();
            for (FileEditor fileEditor : fileEditorManager.getAllEditors()) {
              if (!(fileEditor instanceof TextEditor)) continue;
              EditorEx editor = (EditorEx)((TextEditor)fileEditor).getEditor();
              Document document = editor.getDocument();
              VirtualFile virtualFile = editor.getVirtualFile();
              Language language = virtualFile instanceof LightVirtualFile ? ((LightVirtualFile)virtualFile).getLanguage() : null;
View Full Code Here

        if (projectDir == null) {
            return;
        }

        FileEditorManager fileEditorManager = FileEditorManager.getInstance(project);

        try {
            GoToolWindow toolWindow = this.getGoToolWindow(project);
            toolWindow.showAndCreate(project);
            toolWindow.clearConsoleView();
View Full Code Here

        String projectDir = project.getBasePath();
        if (projectDir == null) {
            return;
        }

        FileEditorManager fileEditorManager = FileEditorManager.getInstance(project);

        try {
            GoToolWindow toolWindow = this.getGoToolWindow(project);
            toolWindow.showAndCreate(project);
            toolWindow.clearConsoleView();
View Full Code Here

        String projectDir = project.getBasePath();
        if (projectDir == null) {
            return;
        }

        FileEditorManager fileEditorManager = FileEditorManager.getInstance(project);

        try {
            GoToolWindow toolWindow = this.getGoToolWindow(project);
            toolWindow.showAndCreate(project);
            toolWindow.clearConsoleView();
View Full Code Here

        if (projectDir == null) {
            return;
        }

        FileEditorManager fileEditorManager = FileEditorManager.getInstance(project);

        try {
            GoToolWindow toolWindow = this.getGoToolWindow(project);
            toolWindow.showAndCreate(project);
            toolWindow.clearConsoleView();
View Full Code Here

        if (projectDir == null) {
            return;
        }

        FileEditorManager fileEditorManager = FileEditorManager.getInstance(project);

        try {
            GoToolWindow toolWindow = this.getGoToolWindow(project);
            toolWindow.showAndCreate(project);
            toolWindow.clearConsoleView();
View Full Code Here

TOP

Related Classes of com.intellij.openapi.fileEditor.FileEditorManager

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.