Java Code Examples for org.eclipse.ui.IPartService#getActivePart()

The following examples show how to use org.eclipse.ui.IPartService#getActivePart() . 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: OccurrencesSearchMenuAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private RetargetAction createSubmenuAction(IPartService partService, String actionID, String text, String actionDefinitionId) {
	RetargetAction action= new RetargetAction(actionID, text);
	action.setActionDefinitionId(actionDefinitionId);

	partService.addPartListener(action);
	IWorkbenchPart activePart = partService.getActivePart();
	if (activePart != null) {
		action.partActivated(activePart);
	}
	return action;
}
 
Example 2
Source File: JavaScriptLightWeightEditor.java    From typescript.java with MIT License 4 votes vote down vote up
private IWorkbenchPart getActivePart() {
	IWorkbenchWindow window = getSite().getWorkbenchWindow();
	IPartService service = window.getPartService();
	IWorkbenchPart part = service.getActivePart();
	return part;
}
 
Example 3
Source File: JavaEditor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private IWorkbenchPart getActivePart() {
	IWorkbenchWindow window= getSite().getWorkbenchWindow();
	IPartService service= window.getPartService();
	IWorkbenchPart part= service.getActivePart();
	return part;
}
 
Example 4
Source File: WorkbenchUtils.java    From goclipse with Eclipse Public License 1.0 4 votes vote down vote up
public static IWorkbenchPart getActivePart(IWorkbenchPartSite site) {
	IWorkbenchWindow window = site.getWorkbenchWindow();
	IPartService service = window.getPartService();
	return service.getActivePart();
}