本文整理汇总了Java中org.eclipse.text.undo.IDocumentUndoManager.transferUndoHistory方法的典型用法代码示例。如果您正苦于以下问题:Java IDocumentUndoManager.transferUndoHistory方法的具体用法?Java IDocumentUndoManager.transferUndoHistory怎么用?Java IDocumentUndoManager.transferUndoHistory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.text.undo.IDocumentUndoManager
的用法示例。
在下文中一共展示了IDocumentUndoManager.transferUndoHistory方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: elementMoved
import org.eclipse.text.undo.IDocumentUndoManager; //导入方法依赖的package包/类
@Override
public void elementMoved(final Object originalElement, final Object movedElement) {
if (originalElement != null && originalElement.equals(editorPart.getEditorInput())) {
final boolean doValidationAsync = Display.getCurrent() != null;
final Runnable r = new Runnable() {
@Override
public void run() {
if (movedElement == null || movedElement instanceof IEditorInput) {
final String previousContent;
IDocumentUndoManager previousUndoManager = null;
IDocument changed = null;
final boolean wasDirty = editorPart.isDirty();
changed = documentProvider.getDocument(editorPart.getEditorInput());
if (changed != null) {
if (wasDirty)
previousContent = changed.get();
else
previousContent = null;
previousUndoManager = DocumentUndoManagerRegistry.getDocumentUndoManager(changed);
if (previousUndoManager != null)
previousUndoManager.connect(this);
} else
previousContent = null;
editorPart.setInputWithNotify((IEditorInput) movedElement);
if (previousUndoManager != null) {
final IDocument newDocument = documentProvider.getDocument(movedElement);
if (newDocument != null) {
final IDocumentUndoManager newUndoManager = DocumentUndoManagerRegistry.getDocumentUndoManager(newDocument);
if (newUndoManager != null)
newUndoManager.transferUndoHistory(previousUndoManager);
}
previousUndoManager.disconnect(this);
}
if (wasDirty && changed != null) {
final Runnable r2 = new Runnable() {
@Override
public void run() {
documentProvider.getDocument(editorPart.getEditorInput()).set(previousContent);
}
};
execute(r2, doValidationAsync);
}
}
}
};
execute(r, false);
}
}
示例2: elementMoved
import org.eclipse.text.undo.IDocumentUndoManager; //导入方法依赖的package包/类
@Override
public void elementMoved(final Object originalElement, final Object movedElement) {
if (originalElement != null && originalElement.equals(getEditorInput())) {
final boolean doValidationAsync = Display.getCurrent() != null;
final Runnable r = new Runnable() {
@Override
public void run() {
enableSanityChecking(true);
if (fSourceViewer == null)
return;
if (movedElement == null || movedElement instanceof IEditorInput) {
final IDocumentProvider d = getDocumentProvider();
final String previousContent;
IDocumentUndoManager previousUndoManager = null;
IDocument changed = null;
final boolean wasDirty = isDirty();
changed = d.getDocument(getEditorInput());
if (changed != null) {
if (wasDirty)
previousContent = changed.get();
else
previousContent = null;
previousUndoManager = DocumentUndoManagerRegistry.getDocumentUndoManager(changed);
if (previousUndoManager != null)
previousUndoManager.connect(this);
} else
previousContent = null;
setInput((IEditorInput) movedElement);
// The undo manager needs to be replaced with one
// for the new document.
// Transfer the undo history and then disconnect
// from the old undo manager.
if (previousUndoManager != null) {
final IDocument newDocument = getDocumentProvider().getDocument(movedElement);
if (newDocument != null) {
final IDocumentUndoManager newUndoManager = DocumentUndoManagerRegistry.getDocumentUndoManager(newDocument);
if (newUndoManager != null)
newUndoManager.transferUndoHistory(previousUndoManager);
}
previousUndoManager.disconnect(this);
}
if (wasDirty && changed != null) {
final Runnable r2 = new Runnable() {
@Override
public void run() {
validateState(getEditorInput());
d.getDocument(getEditorInput()).set(previousContent);
}
};
execute(r2, doValidationAsync);
}
}
}
};
execute(r, false);
}
}
示例3: elementMoved
import org.eclipse.text.undo.IDocumentUndoManager; //导入方法依赖的package包/类
public void elementMoved(final Object originalElement,
final Object movedElement) {
if (originalElement != null
&& originalElement.equals(editorPart.getEditorInput())) {
final boolean doValidationAsync = Display.getCurrent() != null;
Runnable r = new Runnable() {
public void run() {
if (movedElement == null
|| movedElement instanceof IEditorInput) {
final String previousContent;
IDocumentUndoManager previousUndoManager = null;
IDocument changed = null;
boolean wasDirty = editorPart.isDirty();
changed = documentProvider.getDocument(editorPart
.getEditorInput());
if (changed != null) {
if (wasDirty)
previousContent = changed.get();
else
previousContent = null;
previousUndoManager = DocumentUndoManagerRegistry
.getDocumentUndoManager(changed);
if (previousUndoManager != null)
previousUndoManager.connect(this);
} else
previousContent = null;
editorPart
.setInputWithNotify((IEditorInput) movedElement);
if (previousUndoManager != null) {
IDocument newDocument = documentProvider
.getDocument(movedElement);
if (newDocument != null) {
IDocumentUndoManager newUndoManager = DocumentUndoManagerRegistry
.getDocumentUndoManager(newDocument);
if (newUndoManager != null)
newUndoManager
.transferUndoHistory(previousUndoManager);
}
previousUndoManager.disconnect(this);
}
if (wasDirty && changed != null) {
Runnable r2 = new Runnable() {
public void run() {
documentProvider.getDocument(
editorPart.getEditorInput()).set(
previousContent);
}
};
execute(r2, doValidationAsync);
}
}
}
};
execute(r, false);
}
}
示例4: elementMoved
import org.eclipse.text.undo.IDocumentUndoManager; //导入方法依赖的package包/类
public void elementMoved(final Object originalElement,
final Object movedElement) {
if (originalElement != null
&& originalElement.equals(getEditorInput())) {
final boolean doValidationAsync = Display.getCurrent() != null;
Runnable r = new Runnable() {
public void run() {
enableSanityChecking(true);
if (fSourceViewer == null)
return;
if (movedElement == null
|| movedElement instanceof IEditorInput) {
final IDocumentProvider d = getDocumentProvider();
final String previousContent;
IDocumentUndoManager previousUndoManager = null;
IDocument changed = null;
boolean wasDirty = isDirty();
changed = d.getDocument(getEditorInput());
if (changed != null) {
if (wasDirty)
previousContent = changed.get();
else
previousContent = null;
previousUndoManager = DocumentUndoManagerRegistry
.getDocumentUndoManager(changed);
if (previousUndoManager != null)
previousUndoManager.connect(this);
} else
previousContent = null;
setInput((IEditorInput) movedElement);
// The undo manager needs to be replaced with one
// for the new document.
// Transfer the undo history and then disconnect
// from the old undo manager.
if (previousUndoManager != null) {
IDocument newDocument = getDocumentProvider()
.getDocument(movedElement);
if (newDocument != null) {
IDocumentUndoManager newUndoManager = DocumentUndoManagerRegistry
.getDocumentUndoManager(newDocument);
if (newUndoManager != null)
newUndoManager
.transferUndoHistory(previousUndoManager);
}
previousUndoManager.disconnect(this);
}
if (wasDirty && changed != null) {
Runnable r2 = new Runnable() {
public void run() {
validateState(getEditorInput());
d.getDocument(getEditorInput()).set(
previousContent);
}
};
execute(r2, doValidationAsync);
}
}
}
};
execute(r, false);
}
}
示例5: elementMoved
import org.eclipse.text.undo.IDocumentUndoManager; //导入方法依赖的package包/类
@Override
public void elementMoved(final Object originalElement, final Object movedElement) {
if (originalElement != null && originalElement.equals(editorPart.getEditorInput())) {
final boolean doValidationAsync = Display.getCurrent() != null;
final Runnable r = new Runnable() {
@Override
public void run() {
if (movedElement == null || movedElement instanceof IEditorInput) {
final String previousContent;
IDocumentUndoManager previousUndoManager = null;
IDocument changed = null;
final boolean wasDirty = editorPart.isDirty();
changed = documentProvider.getDocument(editorPart.getEditorInput());
if (changed != null) {
if (wasDirty) {
previousContent = changed.get();
} else {
previousContent = null;
}
previousUndoManager = DocumentUndoManagerRegistry.getDocumentUndoManager(changed);
if (previousUndoManager != null) {
previousUndoManager.connect(this);
}
} else {
previousContent = null;
}
editorPart.setInputWithNotify((IEditorInput) movedElement);
if (previousUndoManager != null) {
final IDocument newDocument = documentProvider.getDocument(movedElement);
if (newDocument != null) {
final IDocumentUndoManager newUndoManager = DocumentUndoManagerRegistry.getDocumentUndoManager(newDocument);
if (newUndoManager != null)
newUndoManager.transferUndoHistory(previousUndoManager);
}
previousUndoManager.disconnect(this);
}
if (wasDirty && changed != null) {
final Runnable r2 = new Runnable() {
@Override
public void run() {
documentProvider.getDocument(editorPart.getEditorInput()).set(previousContent);
}
};
execute(r2, doValidationAsync);
}
}
}
};
execute(r, false);
}
}