private void switchViewer(IDocument oldDoc, IDocument newDoc, LinkedPosition pos) { if (oldDoc != newDoc) { // redraw current document with new position before switching viewer if (fCurrentTarget.fAnnotationModel != null) fCurrentTarget.fAnnotationModel.switchToPosition(fModel, pos); LinkedModeUITarget target= null; for (int i= 0; i < fTargets.length; i++) { if (fTargets[i].getViewer().getDocument() == newDoc) { target= fTargets[i]; break; } } if (target != fCurrentTarget) { disconnect(); fCurrentTarget= target; target.linkingFocusLost(fFramePosition, target); connect(); ensureAnnotationModelInstalled(); if (fCurrentTarget != null) fCurrentTarget.linkingFocusGained(pos, fCurrentTarget); } } }
private void switchViewer(IDocument oldDoc, IDocument newDoc, LinkedPosition pos) { if (oldDoc != newDoc) { // redraw current document with new position before switching viewer if (fCurrentTarget.fAnnotationModel != null) fCurrentTarget.fAnnotationModel.switchToPosition(fModel, pos); LinkedModeUITarget target= null; for (LinkedModeUITarget fTarget : fTargets) { if (fTarget.getViewer().getDocument() == newDoc) { target= fTarget; break; } } if (target != fCurrentTarget) { disconnect(); fCurrentTarget= target; target.linkingFocusLost(fFramePosition, target); connect(); ensureAnnotationModelInstalled(); if (fCurrentTarget != null) fCurrentTarget.linkingFocusGained(pos, fCurrentTarget); } } }
private void switchPosition(LinkedPosition pos, boolean select, boolean showProposals) { Assert.isNotNull(pos); if (pos.equals(fFramePosition)) return; if (fFramePosition != null && fCurrentTarget != null) fPositionListener.linkingFocusLost(fFramePosition, fCurrentTarget); // undo endCompoundChangeIfNeeded(); redraw(); // redraw current position being left - usually not needed IDocument oldDoc= fFramePosition == null ? null : fFramePosition.getDocument(); IDocument newDoc= pos.getDocument(); switchViewer(oldDoc, newDoc, pos); fFramePosition= pos; if (select) select(); if (fFramePosition == fExitPosition && !fIterator.isCycling()) leave(ILinkedModeListener.NONE); else { redraw(); // redraw new position ensureAnnotationModelInstalled(); } if (showProposals) triggerContentAssist(); if (fFramePosition != fExitPosition && fDoContextInfo) triggerContextInfo(); if (fFramePosition != null && fCurrentTarget != null) fPositionListener.linkingFocusGained(fFramePosition, fCurrentTarget); }
private void switchPosition(LinkedPosition pos, boolean select, boolean showProposals) { Assert.isNotNull(pos); if (pos.equals(fFramePosition)) return; if (fFramePosition != null && fCurrentTarget != null) fPositionListener.linkingFocusLost(fFramePosition, fCurrentTarget); // undo endCompoundChangeIfNeeded(); redraw(); // redraw current position being left - usually not needed IDocument oldDoc= fFramePosition == null ? null : fFramePosition.getDocument(); IDocument newDoc= pos.getDocument(); switchViewer(oldDoc, newDoc, pos); fFramePosition= pos; if (select) select(); if (fFramePosition == fExitPosition && !fIterator.isCycling()) leave(ILinkedModeListener.NONE); else { redraw(); // redraw new position ensureAnnotationModelInstalled(); } if (showProposals) triggerContentAssist(); if (fFramePosition != fExitPosition && fDoContextInfo) triggerContextInfo(); if (fFramePosition != null && fCurrentTarget != null) fPositionListener.linkingFocusGained(fFramePosition, fCurrentTarget); }