@Nullable private void loadBranches(final String selectedBranchesHolder, final Runnable runnable) { final ProgressManager pm = ProgressManager.getInstance(); pm.run(new ModalityIgnorantBackgroundableTask(myProject, SvnBundle.message("compare.with.branch.progress.loading.branches")) { @Override protected void doInAwtIfFail(Exception e) { runnable.run(); } @Override protected void doInAwtIfCancel() { runnable.run(); } @Override protected void doInAwtIfSuccess() { runnable.run(); } @Override protected void runImpl(@NotNull ProgressIndicator indicator) { final SvnBranchConfigManager manager = SvnBranchConfigurationManager.getInstance(myProject).getSvnBranchConfigManager(); new NewRootBunch.BranchesLoadRunnable(myProject, manager, selectedBranchesHolder, InfoReliability.setByUser, myVcsRoot, null, false).run(); } }); }
@Nullable private void loadBranches(final String selectedBranchesHolder, final Runnable runnable) { final ProgressManager pm = ProgressManager.getInstance(); pm.run(new ModalityIgnorantBackgroundableTask(myProject, SvnBundle.message("compare.with.branch.progress.loading.branches")) { @Override protected void doInAwtIfFail(Exception e) { runnable.run(); } @Override protected void doInAwtIfCancel() { runnable.run(); } @Override protected void doInAwtIfSuccess() { runnable.run(); } @Override protected void runImpl(@NotNull ProgressIndicator indicator) { final NewRootBunch manager = SvnBranchConfigurationManager.getInstance(myProject).getSvnBranchConfigManager(); manager.reloadBranches(myVcsRoot, selectedBranchesHolder, InfoReliability.setByUser, false); } }); }
private void fromFragmentedContent(final FragmentedContent fragmentedContent) { ApplicationManager.getApplication().runReadAction(new Runnable() { // todo @Override public void run() { if (DumbService.isDumb(myProject)) { throw new ModalityIgnorantBackgroundableTask.ToBeRepeatedException(); } myOneSide = fragmentedContent.isOneSide(); myIsAddition = fragmentedContent.isAddition(); List<BeforeAfter<TextRange>> expandedRanges = expand(fragmentedContent.getRanges(), VcsConfiguration.getInstance(myProject).SHORT_DIFF_EXTRA_LINES, fragmentedContent.getBefore(), fragmentedContent.getAfter()); // add "artificial" empty lines final Document document = fragmentedContent.getBefore(); final Document document1 = fragmentedContent.getAfter(); // line starts BeforeAfter<Integer> lines = new BeforeAfter<Integer>(0, 0); for (BeforeAfter<TextRange> lineNumbers : expandedRanges) { if (lines.getBefore() > 0 || lines.getAfter() > 0) { oldConvertor.emptyLine(lines.getBefore()); newConvertor.emptyLine(lines.getAfter()); lines = new BeforeAfter<Integer>(lines.getBefore() + 1, lines.getAfter() + 1); sbOld.append('\n'); sbNew.append('\n'); } myLineRanges.add(lines); oldConvertor.put(lines.getBefore(), lineNumbers.getBefore().getStartOffset()); newConvertor.put(lines.getAfter(), lineNumbers.getAfter().getStartOffset()); if (sbOld.length() > 0) { sbOld.append('\n'); } final TextRange beforeRange = new TextRange(document.getLineStartOffset(lineNumbers.getBefore().getStartOffset()), document.getLineEndOffset(lineNumbers.getBefore().getEndOffset())); myBeforeFragments.add(beforeRange); sbOld.append(document.getText(beforeRange)); if (sbNew.length() > 0) { sbNew.append('\n'); } final TextRange afterRange = new TextRange(document1.getLineStartOffset(lineNumbers.getAfter().getStartOffset()), document1.getLineEndOffset(lineNumbers.getAfter().getEndOffset())); myAfterFragments.add(afterRange); sbNew.append(document1.getText(afterRange)); int before = lines.getBefore() + lineNumbers.getBefore().getEndOffset() - lineNumbers.getBefore().getStartOffset() + 1; int after = lines.getAfter() + lineNumbers.getAfter().getEndOffset() - lineNumbers.getAfter().getStartOffset() + 1; lines = new BeforeAfter<Integer>(before, after); } myLineRanges.add(new BeforeAfter<Integer>(lines.getBefore() == 0 ? 0 : lines.getBefore() - 1, lines.getAfter() == 0 ? 0 : lines.getAfter() - 1)); if (!expandedRanges.isEmpty()) { BeforeAfter<TextRange> last = expandedRanges.get(expandedRanges.size() - 1); if (sbOld.length() > 0) { if (document.getLineEndOffset(last.getBefore().getEndOffset()) != document.getTextLength()) { sbOld.append('\n'); oldConvertor.emptyLine(lines.getBefore()); } } if (sbNew.length() > 0) { if (document1.getLineEndOffset(last.getAfter().getEndOffset()) != document1.getTextLength()) { sbNew.append('\n'); newConvertor.emptyLine(lines.getAfter()); } } } setHighlighters(fragmentedContent.getBefore(), fragmentedContent.getAfter(), expandedRanges, fragmentedContent); setTodoHighlighting(fragmentedContent.getBefore(), fragmentedContent.getAfter()); } }); }
@Override protected void onFileChosen(@NotNull final VirtualFile chosenFile) { String oldText = myDirectoryTextField.getText(); super.onFileChosen(chosenFile); final VcsDescriptor wrapper = (VcsDescriptor) myVCSComboBox.getSelectedItem(); if (oldText.length() == 0 && (wrapper == null || wrapper.isNone())) { final ModalityIgnorantBackgroundableTask task = new ModalityIgnorantBackgroundableTask(myProject, "Looking for VCS administrative area", false) { VcsDescriptor probableVcs = null; @Override protected void doInAwtIfFail(Exception e) { } @Override protected void doInAwtIfCancel() { } @Override protected void doInAwtIfSuccess() { if (probableVcs != null) { // todo none myVCSComboBox.setSelectedItem(probableVcs); } } @Override protected void runImpl(@NotNull ProgressIndicator indicator) { for (VcsDescriptor vcs : myVcses.values()) { if (vcs.probablyUnderVcs(chosenFile)) { if (probableVcs != null) { probableVcs = null; break; } probableVcs = vcs; } } } }; ProgressManager.getInstance().run(task); } }
private void fromFragmentedContent(final FragmentedContent fragmentedContent) { ApplicationManager.getApplication().runReadAction(new Runnable() { // todo @Override public void run() { if (DumbService.isDumb(myProject)) { throw new ModalityIgnorantBackgroundableTask.ToBeRepeatedException(); } myOneSide = fragmentedContent.isOneSide(); myIsAddition = fragmentedContent.isAddition(); List<BeforeAfter<TextRange>> expandedRanges = expand(fragmentedContent.getRanges(), VcsConfiguration.getInstance(myProject).SHORT_DIFF_EXTRA_LINES, fragmentedContent.getBefore(), fragmentedContent.getAfter()); // add "artificial" empty lines // line starts BeforeAfter<Integer> lines = new BeforeAfter<Integer>(0, 0); for (BeforeAfter<TextRange> lineNumbers : expandedRanges) { if (lines.getBefore() > 0 || lines.getAfter() > 0) { oldConvertor.emptyLine(lines.getBefore()); newConvertor.emptyLine(lines.getAfter()); lines = new BeforeAfter<Integer>(lines.getBefore() + 1, lines.getAfter() + 1); sbOld.append('\n'); sbNew.append('\n'); } myLineRanges.add(lines); oldConvertor.put(lines.getBefore(), lineNumbers.getBefore().getStartOffset()); newConvertor.put(lines.getAfter(), lineNumbers.getAfter().getStartOffset()); final Document document = fragmentedContent.getBefore(); if (sbOld.length() > 0) { sbOld.append('\n'); } final TextRange beforeRange = new TextRange(document.getLineStartOffset(lineNumbers.getBefore().getStartOffset()), document.getLineEndOffset(lineNumbers.getBefore().getEndOffset())); myBeforeFragments.add(beforeRange); sbOld.append(document.getText(beforeRange)); final Document document1 = fragmentedContent.getAfter(); if (sbNew.length() > 0) { sbNew.append('\n'); } final TextRange afterRange = new TextRange(document1.getLineStartOffset(lineNumbers.getAfter().getStartOffset()), document1.getLineEndOffset(lineNumbers.getAfter().getEndOffset())); myAfterFragments.add(afterRange); sbNew.append(document1.getText(afterRange)); int before = lines.getBefore() + lineNumbers.getBefore().getEndOffset() - lineNumbers.getBefore().getStartOffset() + 1; int after = lines.getAfter() + lineNumbers.getAfter().getEndOffset() - lineNumbers.getAfter().getStartOffset() + 1; lines = new BeforeAfter<Integer>(before, after); } myLineRanges.add(new BeforeAfter<Integer>(lines.getBefore() == 0 ? 0 : lines.getBefore() - 1, lines.getAfter() == 0 ? 0 : lines.getAfter() - 1)); setHighlighters(fragmentedContent.getBefore(), fragmentedContent.getAfter(), expandedRanges); setTodoHighlighting(fragmentedContent.getBefore(), fragmentedContent.getAfter()); } }); }
@Override protected void onFileChoosen(final VirtualFile chosenFile) { String oldText = myDirectoryTextField.getText(); super.onFileChoosen(chosenFile); final VcsDescriptor wrapper = (VcsDescriptor) myVCSComboBox.getSelectedItem(); if (oldText.length() == 0 && (wrapper == null || wrapper.isNone())) { final ModalityIgnorantBackgroundableTask task = new ModalityIgnorantBackgroundableTask(myProject, "Looking for VCS administrative area", false) { VcsDescriptor probableVcs = null; @Override protected void doInAwtIfFail(Exception e) { } @Override protected void doInAwtIfCancel() { } @Override protected void doInAwtIfSuccess() { if (probableVcs != null) { // todo none myVCSComboBox.setSelectedItem(probableVcs); } } @Override protected void runImpl(@NotNull ProgressIndicator indicator) { for (VcsDescriptor vcs : myVcses.values()) { if (vcs.probablyUnderVcs(chosenFile)) { if (probableVcs != null) { probableVcs = null; break; } probableVcs = vcs; } } } }; ProgressManager.getInstance().run(task); } }
@Override protected void onFileChosen(@Nonnull final VirtualFile chosenFile) { String oldText = myDirectoryTextField.getText(); super.onFileChosen(chosenFile); final VcsDescriptor wrapper = (VcsDescriptor) myVCSComboBox.getSelectedItem(); if (oldText.length() == 0 && (wrapper == null || wrapper.isNone())) { final ModalityIgnorantBackgroundableTask task = new ModalityIgnorantBackgroundableTask(myProject, "Looking for VCS administrative area", false) { VcsDescriptor probableVcs = null; @Override protected void doInAwtIfFail(Exception e) { } @Override protected void doInAwtIfCancel() { } @Override protected void doInAwtIfSuccess() { if (probableVcs != null) { // todo none myVCSComboBox.setSelectedItem(probableVcs); } } @Override protected void runImpl(@Nonnull ProgressIndicator indicator) { for (VcsDescriptor vcs : myVcses.values()) { if (vcs.probablyUnderVcs(chosenFile)) { if (probableVcs != null) { probableVcs = null; break; } probableVcs = vcs; } } } }; ProgressManager.getInstance().run(task); } }