Package com.intellij.history

Examples of com.intellij.history.LocalHistoryAction


    private void refreshFile(Project project, final FilePath filePath, VcsFileRevision revision) {
        Runnable refresh = null;
        final VirtualFile vf = filePath.getVirtualFile();
        if (vf == null) {
            final LocalHistoryAction action = startLocalHistoryAction(filePath, revision);
            final VirtualFile vp = filePath.getVirtualFileParent();
            if (vp != null) {
                refresh = new Runnable() {
                    public void run() {
                        vp.refresh(false, true, new Runnable() {
                            public void run() {
                                filePath.refresh();
                                action.finish();
                            }
                        });
                    }
                };
            }
View Full Code Here


        }

        new Task.Backgroundable(project, "Loading content...") {
            @Override
            public void run(@NotNull ProgressIndicator indicator) {
                LocalHistoryAction action = file != null ? startLocalHistoryAction(filePath, revision) : LocalHistoryAction.NULL;
                final byte[] revisionContent;
                try {
                    revisionContent = VcsHistoryUtil.loadRevisionContent(revision);
                } catch (final IOException e) {
                    log.info(e);
                    ApplicationManager.getApplication().invokeLater(new Runnable() {
                        @Override public void run() {
                            Messages.showMessageDialog("Cannot load revision: " + e.getLocalizedMessage(),
                                    "Get Revision Content", Messages.getInformationIcon());
                        }
                    });
                    return;
                } catch (final VcsException e) {
                    log.info(e);
                    ApplicationManager.getApplication().invokeLater(new Runnable() {
                        @Override public void run() {
                            Messages.showMessageDialog("Cannot load revision: " + e.getLocalizedMessage(),
                                    "Get Revision Content", Messages.getInformationIcon());
                        }
                    });
                    return;
                } catch (ProcessCanceledException ex) {
                    return;
                }

                try {
                    UIUtil.invokeAndWaitIfNeeded(new Runnable() {
                        @Override
                        public void run() {
                            ApplicationManager.getApplication().runWriteAction(new Runnable() {
                                public void run() {
                                    CommandProcessor.getInstance().executeCommand(project, new Runnable() {
                                        public void run() {
                                            try {
                                                write(project, filePath, revisionContent);
                                            } catch (IOException e) {
                                                Messages.showMessageDialog("Cannot save content: " + e.getLocalizedMessage(),
                                                        "Get Revision Content", Messages.getErrorIcon());
                                            }
                                        }
                                    }, createGetActionTitle(filePath, revision), null);
                                }
                            });
                        }
                    });

                    if (file != null) {
                        VcsDirtyScopeManager.getInstance(project).fileDirty(file);
                    }
                } finally {
                    action.finish();
                }
            }
        }.queue();
    }
View Full Code Here

      final Runnable command = new Runnable() {
        public void run() {
          final Runnable run = new Runnable() {
            public void run() {
              LocalHistoryAction action = LocalHistoryAction.NULL;
              try {
                action = LocalHistory.startAction(myProject, getActionName(myDirectory, inputString));

                PsiElement[] psiElements = create(inputString, myDirectory);
                myCreatedElements = new SmartPsiElementPointer[psiElements.length];
                SmartPointerManager manager = SmartPointerManager.getInstance(myProject);
                for (int i = 0; i < myCreatedElements.length; i++) {
                  myCreatedElements[i] = manager.createSmartPsiElementPointer(psiElements[i]);
                }
              }
              catch (Exception ex) {
                exception[0] = ex;
              }
              finally {
                action.finish();
              }
            }
          };
          ApplicationManager.getApplication().runWriteAction(run);
        }
View Full Code Here

TOP

Related Classes of com.intellij.history.LocalHistoryAction

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.