Search in sources :

Example 16 with CalledInAwt

use of org.jetbrains.annotations.CalledInAwt in project intellij-community by JetBrains.

the class ThreesideTextDiffViewer method installEditorListeners.

//
// Listeners
//
@CalledInAwt
protected void installEditorListeners() {
    new TextDiffViewerUtil.EditorActionsPopup(createEditorPopupActions()).install(getEditors());
    new TextDiffViewerUtil.EditorFontSizeSynchronizer(getEditors()).install(this);
    getEditor(ThreeSide.LEFT).getScrollingModel().addVisibleAreaListener(myVisibleAreaListener1);
    getEditor(ThreeSide.BASE).getScrollingModel().addVisibleAreaListener(myVisibleAreaListener1);
    getEditor(ThreeSide.BASE).getScrollingModel().addVisibleAreaListener(myVisibleAreaListener2);
    getEditor(ThreeSide.RIGHT).getScrollingModel().addVisibleAreaListener(myVisibleAreaListener2);
    SyncScrollSupport.SyncScrollable scrollable1 = getSyncScrollable(Side.LEFT);
    SyncScrollSupport.SyncScrollable scrollable2 = getSyncScrollable(Side.RIGHT);
    if (scrollable1 != null && scrollable2 != null) {
        mySyncScrollSupport = new ThreesideSyncScrollSupport(getEditors(), scrollable1, scrollable2);
        myEditorSettingsAction.setSyncScrollSupport(mySyncScrollSupport);
    }
}
Also used : TextDiffViewerUtil(com.intellij.diff.tools.util.base.TextDiffViewerUtil) ThreesideSyncScrollSupport(com.intellij.diff.tools.util.SyncScrollSupport.ThreesideSyncScrollSupport) ThreesideSyncScrollSupport(com.intellij.diff.tools.util.SyncScrollSupport.ThreesideSyncScrollSupport) SyncScrollSupport(com.intellij.diff.tools.util.SyncScrollSupport) CalledInAwt(org.jetbrains.annotations.CalledInAwt)

Example 17 with CalledInAwt

use of org.jetbrains.annotations.CalledInAwt in project intellij-community by JetBrains.

the class TwosideTextDiffViewer method installEditorListeners.

//
// Listeners
//
@CalledInAwt
protected void installEditorListeners() {
    new TextDiffViewerUtil.EditorActionsPopup(createEditorPopupActions()).install(getEditors());
    new TextDiffViewerUtil.EditorFontSizeSynchronizer(getEditors()).install(this);
    getEditor(Side.LEFT).getScrollingModel().addVisibleAreaListener(myVisibleAreaListener);
    getEditor(Side.RIGHT).getScrollingModel().addVisibleAreaListener(myVisibleAreaListener);
    SyncScrollSupport.SyncScrollable scrollable = getSyncScrollable();
    if (scrollable != null) {
        mySyncScrollSupport = new TwosideSyncScrollSupport(getEditors(), scrollable);
        myEditorSettingsAction.setSyncScrollSupport(mySyncScrollSupport);
    }
}
Also used : TextDiffViewerUtil(com.intellij.diff.tools.util.base.TextDiffViewerUtil) TwosideSyncScrollSupport(com.intellij.diff.tools.util.SyncScrollSupport.TwosideSyncScrollSupport) TwosideSyncScrollSupport(com.intellij.diff.tools.util.SyncScrollSupport.TwosideSyncScrollSupport) SyncScrollSupport(com.intellij.diff.tools.util.SyncScrollSupport) CalledInAwt(org.jetbrains.annotations.CalledInAwt)

Example 18 with CalledInAwt

use of org.jetbrains.annotations.CalledInAwt in project intellij-community by JetBrains.

the class MergeModelBase method collectAffectedChanges.

/*
   * Nearby changes could be affected as well (ex: by moveChangesAfterInsertion)
   *
   * null means all changes could be affected
   */
@NotNull
@CalledInAwt
private TIntArrayList collectAffectedChanges(@NotNull TIntArrayList directChanges) {
    TIntArrayList result = new TIntArrayList(directChanges.size());
    int directArrayIndex = 0;
    int otherIndex = 0;
    while (directArrayIndex < directChanges.size() && otherIndex < getChangesCount()) {
        int directIndex = directChanges.get(directArrayIndex);
        if (directIndex == otherIndex) {
            result.add(directIndex);
            otherIndex++;
            continue;
        }
        int directStart = getLineStart(directIndex);
        int directEnd = getLineEnd(directIndex);
        int otherStart = getLineStart(otherIndex);
        int otherEnd = getLineEnd(otherIndex);
        if (otherEnd < directStart) {
            otherIndex++;
            continue;
        }
        if (otherStart > directEnd) {
            directArrayIndex++;
            continue;
        }
        result.add(otherIndex);
        otherIndex++;
    }
    LOG.assertTrue(directChanges.size() <= result.size());
    return result;
}
Also used : TIntArrayList(gnu.trove.TIntArrayList) CalledInAwt(org.jetbrains.annotations.CalledInAwt) NotNull(org.jetbrains.annotations.NotNull)

Example 19 with CalledInAwt

use of org.jetbrains.annotations.CalledInAwt in project intellij-community by JetBrains.

the class ApplyPatchDifferentiatedDialog method runExecutor.

@CalledInAwt
private void runExecutor(ApplyPatchExecutor executor) {
    final Collection<AbstractFilePatchInProgress> included = getIncluded();
    if (included.isEmpty())
        return;
    final MultiMap<VirtualFile, AbstractFilePatchInProgress> patchGroups = new MultiMap<>();
    for (AbstractFilePatchInProgress patchInProgress : included) {
        patchGroups.putValue(patchInProgress.getBase(), patchInProgress);
    }
    final LocalChangeList selected = getSelectedChangeList();
    FilePresentationModel presentation = myRecentPathFileChange.get();
    VirtualFile vf = presentation != null ? presentation.getVf() : null;
    executor.apply(getOriginalRemaining(), patchGroups, selected, vf == null ? null : vf.getName(), myReader == null ? null : myReader.getAdditionalInfo(ApplyPatchDefaultExecutor.pathsFromGroups(patchGroups)));
}
Also used : MultiMap(com.intellij.util.containers.MultiMap) LocalChangeList(com.intellij.openapi.vcs.changes.LocalChangeList) CalledInAwt(org.jetbrains.annotations.CalledInAwt)

Example 20 with CalledInAwt

use of org.jetbrains.annotations.CalledInAwt in project intellij-community by JetBrains.

the class ApplyPatchAction method showAndGetApplyPatch.

@CalledInAwt
public static Boolean showAndGetApplyPatch(@NotNull final Project project, @NotNull final File file) {
    VirtualFile vFile = VfsUtil.findFileByIoFile(file, true);
    String patchPath = file.getPath();
    if (vFile == null) {
        VcsNotifier.getInstance(project).notifyWeakError("Can't find patch file " + patchPath);
        return false;
    }
    if (!isPatchFile(file)) {
        VcsNotifier.getInstance(project).notifyWeakError("Selected file " + patchPath + " is not patch type file ");
        return false;
    }
    final ApplyPatchDifferentiatedDialog dialog = new ApplyPatchDifferentiatedDialog(project, new ApplyPatchDefaultExecutor(project), Collections.emptyList(), ApplyPatchMode.APPLY_PATCH_IN_MEMORY, vFile);
    dialog.setModal(true);
    return dialog.showAndGet();
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) CalledInAwt(org.jetbrains.annotations.CalledInAwt)

Aggregations

CalledInAwt (org.jetbrains.annotations.CalledInAwt)25 VirtualFile (com.intellij.openapi.vfs.VirtualFile)6 Project (com.intellij.openapi.project.Project)5 NotNull (org.jetbrains.annotations.NotNull)5 FileEditor (com.intellij.openapi.fileEditor.FileEditor)4 Nullable (org.jetbrains.annotations.Nullable)4 RangeHighlighter (com.intellij.openapi.editor.markup.RangeHighlighter)3 StatusBar (com.intellij.openapi.wm.StatusBar)3 SyncScrollSupport (com.intellij.diff.tools.util.SyncScrollSupport)2 TextDiffViewerUtil (com.intellij.diff.tools.util.base.TextDiffViewerUtil)2 Document (com.intellij.openapi.editor.Document)2 Editor (com.intellij.openapi.editor.Editor)2 FileEditorManager (com.intellij.openapi.fileEditor.FileEditorManager)2 EmptyProgressIndicator (com.intellij.openapi.progress.EmptyProgressIndicator)2 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)2 EditorNotificationPanel (com.intellij.ui.EditorNotificationPanel)2 List (java.util.List)2 MessageDiffRequest (com.intellij.diff.requests.MessageDiffRequest)1 ThreesideSyncScrollSupport (com.intellij.diff.tools.util.SyncScrollSupport.ThreesideSyncScrollSupport)1 TwosideSyncScrollSupport (com.intellij.diff.tools.util.SyncScrollSupport.TwosideSyncScrollSupport)1