下面列出了怎么用org.eclipse.ui.IPageListener的API类实例代码及写法,或者点击链接到github查看源代码。
@Override
protected void setActionsActivated(SourceViewer sourceViewer, boolean state) {
DefaultMergeEditor mergeEditor = getEditor(sourceViewer);
if (mergeEditor != null) {
mergeEditor.setActionsActivated(state);
IAction saveAction = mergeEditor.getAction(ITextEditorActionConstants.SAVE);
if (saveAction instanceof IPageListener) {
PartEventAction partEventAction = (PartEventAction) saveAction;
IWorkbenchPart compareEditorPart = getCompareConfiguration().getContainer().getWorkbenchPart();
if (state) {
partEventAction.partActivated(compareEditorPart);
} else {
partEventAction.partDeactivated(compareEditorPart);
}
}
}
}
@Override
protected void setActionsActivated(SourceViewer sourceViewer, boolean state) {
if (fEditor != null) {
Object editor = fEditor.get(sourceViewer);
if (editor instanceof TypeScriptEditorAdapter) {
TypeScriptEditorAdapter cuea = (TypeScriptEditorAdapter) editor;
cuea.setActionsActivated(state);
IAction saveAction = cuea.getAction(ITextEditorActionConstants.SAVE);
if (saveAction instanceof IPageListener) {
PartEventAction partEventAction = (PartEventAction) saveAction;
IWorkbenchPart compareEditorPart = getCompareConfiguration().getContainer().getWorkbenchPart();
if (state)
partEventAction.partActivated(compareEditorPart);
else
partEventAction.partDeactivated(compareEditorPart);
}
}
}
}
@Override
protected void setActionsActivated(SourceViewer sourceViewer, boolean state) {
if (fEditor != null) {
Object editor= fEditor.get(sourceViewer);
if (editor instanceof CompilationUnitEditorAdapter) {
CompilationUnitEditorAdapter cuea = (CompilationUnitEditorAdapter)editor;
cuea.setActionsActivated(state);
IAction saveAction= cuea.getAction(ITextEditorActionConstants.SAVE);
if (saveAction instanceof IPageListener) {
PartEventAction partEventAction = (PartEventAction) saveAction;
IWorkbenchPart compareEditorPart= getCompareConfiguration().getContainer().getWorkbenchPart();
if (state)
partEventAction.partActivated(compareEditorPart);
else
partEventAction.partDeactivated(compareEditorPart);
}
}
}
}