org.eclipse.ui.actions.PartEventAction Java Examples

The following examples show how to use org.eclipse.ui.actions.PartEventAction. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DefaultMergeViewer.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
@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);
			}
		}
	}
}
 
Example #2
Source File: TypeScriptMergeViewer.java    From typescript.java with MIT License 6 votes vote down vote up
@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);
			}
		}
	}
}
 
Example #3
Source File: JavaMergeViewer.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@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);
			}
		}
	}
}