mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
diff: move context hints update/process into base class
* avoid possible issues with dispose() order - we want to update hints before anything is destroyed
This commit is contained in:
@@ -118,23 +118,18 @@ public class BinaryDiffViewer extends ListenerDiffViewerBase {
|
||||
installEditorListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
@CalledInAwt
|
||||
protected void onInit() {
|
||||
super.onInit();
|
||||
processContextHints();
|
||||
}
|
||||
|
||||
@Override
|
||||
@CalledInAwt
|
||||
public void onDispose() {
|
||||
updateContextHints();
|
||||
destroyEditorListeners();
|
||||
destroyEditors();
|
||||
super.onDispose();
|
||||
}
|
||||
|
||||
private void processContextHints() {
|
||||
@Override
|
||||
@CalledInAwt
|
||||
protected void processContextHints() {
|
||||
super.processContextHints();
|
||||
if (myEditor1 == null) {
|
||||
myCurrentSide = Side.RIGHT;
|
||||
}
|
||||
@@ -147,7 +142,10 @@ public class BinaryDiffViewer extends ListenerDiffViewerBase {
|
||||
}
|
||||
}
|
||||
|
||||
private void updateContextHints() {
|
||||
@Override
|
||||
@CalledInAwt
|
||||
protected void updateContextHints() {
|
||||
super.updateContextHints();
|
||||
if (myEditor1 != null && myEditor2 != null) {
|
||||
myContext.putUserData(DiffUserDataKeys.PREFERRED_FOCUS_SIDE, myCurrentSide);
|
||||
}
|
||||
|
||||
@@ -149,7 +149,6 @@ public class OnesideDiffViewer extends TextDiffViewerBase {
|
||||
@CalledInAwt
|
||||
protected void onInit() {
|
||||
super.onInit();
|
||||
processContextHints();
|
||||
installTypingSupport();
|
||||
myPanel.setLoadingContent(); // We need loading panel only for initial rediff()
|
||||
}
|
||||
@@ -157,21 +156,24 @@ public class OnesideDiffViewer extends TextDiffViewerBase {
|
||||
@Override
|
||||
@CalledInAwt
|
||||
protected void onDispose() {
|
||||
updateContextHints();
|
||||
EditorFactory.getInstance().releaseEditor(myEditor);
|
||||
super.onDispose();
|
||||
EditorFactory.getInstance().releaseEditor(myEditor);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CalledInAwt
|
||||
protected void processContextHints() {
|
||||
super.processContextHints();
|
||||
Side side = DiffUtil.getUserData(myRequest, myContext, DiffUserDataKeys.MASTER_SIDE);
|
||||
if (side != null && side.select(myActualContent1, myActualContent2) != null) myMasterSide = side;
|
||||
|
||||
myInitialScrollHelper.processContext(myRequest);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CalledInAwt
|
||||
protected void updateContextHints() {
|
||||
super.updateContextHints();
|
||||
myInitialScrollHelper.updateContext(myRequest);
|
||||
myFoldingModel.updateContext(myRequest, getFoldingModelSettings());
|
||||
}
|
||||
|
||||
@@ -161,16 +161,18 @@ public class SimpleDiffViewer extends TwosideTextDiffViewer {
|
||||
}
|
||||
|
||||
@Override
|
||||
@CalledInAwt
|
||||
protected void processContextHints() {
|
||||
super.processContextHints();
|
||||
myInitialScrollHelper.processContext(myRequest);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CalledInAwt
|
||||
protected void updateContextHints() {
|
||||
super.updateContextHints();
|
||||
if (myFoldingModel != null) myFoldingModel.updateContext(myRequest, getFoldingModelSettings());
|
||||
myInitialScrollHelper.updateContext(myRequest);
|
||||
super.updateContextHints();
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -138,12 +138,14 @@ public class SimpleThreesideDiffViewer extends ThreesideTextDiffViewer {
|
||||
}
|
||||
|
||||
@Override
|
||||
@CalledInAwt
|
||||
protected void processContextHints() {
|
||||
super.processContextHints();
|
||||
myInitialScrollHelper.processContext(myRequest);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CalledInAwt
|
||||
protected void updateContextHints() {
|
||||
super.updateContextHints();
|
||||
myFoldingModel.updateContext(myRequest, getFoldingModelSettings());
|
||||
|
||||
@@ -58,6 +58,7 @@ public abstract class DiffViewerBase implements DiffViewer, DataProvider {
|
||||
|
||||
@NotNull
|
||||
public final FrameDiffTool.ToolbarComponents init() {
|
||||
processContextHints();
|
||||
onInit();
|
||||
|
||||
FrameDiffTool.ToolbarComponents components = new FrameDiffTool.ToolbarComponents();
|
||||
@@ -81,6 +82,8 @@ public abstract class DiffViewerBase implements DiffViewer, DataProvider {
|
||||
myDisposed = true;
|
||||
|
||||
abortRediff();
|
||||
updateContextHints();
|
||||
|
||||
onDispose();
|
||||
}
|
||||
};
|
||||
@@ -89,6 +92,14 @@ public abstract class DiffViewerBase implements DiffViewer, DataProvider {
|
||||
UIUtil.invokeLaterIfNeeded(doDispose);
|
||||
}
|
||||
|
||||
@CalledInAwt
|
||||
protected void processContextHints() {
|
||||
}
|
||||
|
||||
@CalledInAwt
|
||||
protected void updateContextHints() {
|
||||
}
|
||||
|
||||
@CalledInAwt
|
||||
public final void scheduleRediff() {
|
||||
if (isDisposed()) return;
|
||||
|
||||
+6
-8
@@ -110,27 +110,25 @@ public abstract class ThreesideTextDiffViewer extends TextDiffViewerBase {
|
||||
myEditorSettingsAction.applyDefaults();
|
||||
}
|
||||
|
||||
@Override
|
||||
@CalledInAwt
|
||||
protected void onInit() {
|
||||
super.onInit();
|
||||
processContextHints();
|
||||
}
|
||||
|
||||
@Override
|
||||
@CalledInAwt
|
||||
protected void onDispose() {
|
||||
updateContextHints();
|
||||
super.onDispose();
|
||||
destroyEditors();
|
||||
}
|
||||
|
||||
@Override
|
||||
@CalledInAwt
|
||||
protected void processContextHints() {
|
||||
super.processContextHints();
|
||||
ThreeSide side = myContext.getUserData(DiffUserDataKeys.PREFERRED_FOCUS_THREESIDE);
|
||||
if (side != null) myCurrentSide = side;
|
||||
}
|
||||
|
||||
@Override
|
||||
@CalledInAwt
|
||||
protected void updateContextHints() {
|
||||
super.updateContextHints();
|
||||
myContext.putUserData(DiffUserDataKeys.PREFERRED_FOCUS_THREESIDE, myCurrentSide);
|
||||
}
|
||||
|
||||
|
||||
+6
-8
@@ -113,22 +113,17 @@ public abstract class TwosideTextDiffViewer extends TextDiffViewerBase {
|
||||
new MyOpenInEditorWithMouseAction().register(getEditors());
|
||||
}
|
||||
|
||||
@Override
|
||||
@CalledInAwt
|
||||
protected void onInit() {
|
||||
super.onInit();
|
||||
processContextHints();
|
||||
}
|
||||
|
||||
@Override
|
||||
@CalledInAwt
|
||||
protected void onDispose() {
|
||||
updateContextHints();
|
||||
super.onDispose();
|
||||
destroyEditors();
|
||||
}
|
||||
|
||||
@Override
|
||||
@CalledInAwt
|
||||
protected void processContextHints() {
|
||||
super.processContextHints();
|
||||
if (myEditor1 == null) {
|
||||
myCurrentSide = Side.RIGHT;
|
||||
}
|
||||
@@ -141,7 +136,10 @@ public abstract class TwosideTextDiffViewer extends TextDiffViewerBase {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@CalledInAwt
|
||||
protected void updateContextHints() {
|
||||
super.updateContextHints();
|
||||
if (myEditor1 != null && myEditor2 != null) {
|
||||
myContext.putUserData(DiffUserDataKeys.PREFERRED_FOCUS_SIDE, myCurrentSide);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user