use of org.eclipse.ui.IPartListener in project tdi-studio-se by Talend.
the class ClipboardActionHandlerProvider method getGlobalActionHandler.
@Override
public IGlobalActionHandler getGlobalActionHandler(final IGlobalActionHandlerContext context) {
if (!getHandlerList().containsKey(context.getActivePart())) {
getHandlerList().put(context.getActivePart(), new ClipboardActionHandler());
context.getActivePart().getSite().getPage().addPartListener(new IPartListener() {
private IWorkbenchPart localPart = context.getActivePart();
/**
* @see org.eclipse.ui.IPartListener#partActivated(IWorkbenchPart)
*/
public void partActivated(IWorkbenchPart part) {
// NULL implementation
}
public void partBroughtToTop(IWorkbenchPart part) {
// NULL implementation
}
public void partClosed(IWorkbenchPart part) {
if (part != null && part == localPart && getHandlerList().containsKey(part)) {
getHandlerList().remove(part);
localPart.getSite().getPage().removePartListener(this);
localPart = null;
}
}
/**
* @see org.eclipse.ui.IPartListener#partDeactivated(IWorkbenchPart)
*/
public void partDeactivated(IWorkbenchPart part) {
// NULL implementation
}
/**
* @see org.eclipse.ui.IPartListener#partOpened(IWorkbenchPart)
*/
public void partOpened(IWorkbenchPart part) {
// NULL implementation
}
});
}
return (ClipboardActionHandler) getHandlerList().get(context.getActivePart());
}
use of org.eclipse.ui.IPartListener in project erlide_eclipse by erlang.
the class ErlangOutlinePage method createControl.
@Override
public void createControl(final Composite parent) {
final Tree tree = new Tree(parent, SWT.MULTI);
fOutlineViewer = new TreeViewer(tree);
fOutlineViewer.setAutoExpandLevel(0);
fOutlineViewer.setUseHashlookup(true);
fOutlineViewer.setContentProvider(fEditor.createOutlineContentProvider());
fOutlineViewer.setLabelProvider(fEditor.createOutlineLabelProvider());
fOutlineViewer.addPostSelectionChangedListener(this);
fOutlineViewer.setInput(fModule);
final IPageSite site = getSite();
fOpenAndLinkWithEditorHelper = new OpenAndLinkWithEditorHelper(fOutlineViewer, fEditor, site.getPage());
final IContextService service = site.getService(IContextService.class);
if (service != null) {
service.activateContext("org.erlide.ui.erlangOutlineAndNavigatorScope");
}
final MenuManager manager = new MenuManager();
manager.setRemoveAllWhenShown(true);
manager.addMenuListener(new IMenuListener() {
@Override
public void menuAboutToShow(final IMenuManager m) {
// recursive loop?
// menuAboutToShow(m);
contextMenuAboutToShow(m);
}
});
final Menu menu = manager.createContextMenu(tree);
tree.setMenu(menu);
site.registerContextMenu(ErlangCore.PLUGIN_ID + ".outline", manager, fOutlineViewer);
fActionGroups = new CompositeActionGroup(new ActionGroup[] { new ErlangSearchActionGroup(this) });
// register global actions
final IActionBars actionBars = site.getActionBars();
actionBars.setGlobalActionHandler(ITextEditorActionConstants.UNDO, fEditor.getAction(ITextEditorActionConstants.UNDO));
actionBars.setGlobalActionHandler(ITextEditorActionConstants.REDO, fEditor.getAction(ITextEditorActionConstants.REDO));
fActionGroups.fillActionBars(actionBars);
registerToolbarActions(actionBars);
final IHandlerService handlerService = site.getService(IHandlerService.class);
if (handlerService != null) {
handlerService.activateHandler(IWorkbenchCommandConstants.NAVIGATE_TOGGLE_LINK_WITH_EDITOR, new ActionHandler(fToggleLinkingAction));
}
fPartListener = new IPartListener() {
@Override
public void partOpened(final IWorkbenchPart part) {
// JC borde filter-metoden ovan r�cka?
addFilters();
}
@Override
public void partDeactivated(final IWorkbenchPart part) {
}
@Override
public void partClosed(final IWorkbenchPart part) {
}
@Override
public void partBroughtToTop(final IWorkbenchPart part) {
}
@Override
public void partActivated(final IWorkbenchPart part) {
addFilters();
}
};
getSite().getPage().addPartListener(fPartListener);
}
use of org.eclipse.ui.IPartListener in project eclipse-integration-commons by spring-projects.
the class WelcomeDashboard method init.
@Override
public void init(IEditorSite _site, IEditorInput input) throws PartInitException {
super.init(_site, input);
this.site = _site;
site.getPage().addPartListener(this.partListener = new IPartListener() {
@Override
public void partOpened(IWorkbenchPart part) {
}
@Override
public void partDeactivated(IWorkbenchPart part) {
}
@Override
public void partClosed(IWorkbenchPart part) {
if (WelcomeDashboard.this == part) {
IPreferenceStore prefs = IdeUiPlugin.getDefault().getPreferenceStore();
prefs.setValue(IIdeUiConstants.PREF_OPEN_DASHBOARD_STARTUP, false);
disposeListeners();
}
}
@Override
public void partBroughtToTop(IWorkbenchPart part) {
}
@Override
public void partActivated(IWorkbenchPart part) {
}
});
}
use of org.eclipse.ui.IPartListener in project eclipse-integration-commons by spring-projects.
the class MultiPageDashboardEditor method init.
@Override
public void init(IEditorSite site, IEditorInput editorInput) throws PartInitException {
setSite(site);
setInput(editorInput);
site.getPage().addPartListener(this.partListener = new IPartListener() {
@Override
public void partOpened(IWorkbenchPart part) {
}
@Override
public void partDeactivated(IWorkbenchPart part) {
}
@Override
public void partClosed(IWorkbenchPart part) {
if (MultiPageDashboardEditor.this == part) {
IPreferenceStore prefs = IdeUiPlugin.getDefault().getPreferenceStore();
prefs.setValue(IIdeUiConstants.PREF_OPEN_DASHBOARD_STARTUP, false);
disposeListeners();
}
}
@Override
public void partBroughtToTop(IWorkbenchPart part) {
}
@Override
public void partActivated(IWorkbenchPart part) {
}
});
}
use of org.eclipse.ui.IPartListener in project n4js by eclipse.
the class SourceGraphView method createPartControl.
@Override
public void createPartControl(Composite parent) {
// add listener to track the active editor
this.getSite().getPage().addPartListener(new IPartListener() {
@Override
public void partActivated(IWorkbenchPart part) {
updateActiveEditor();
}
@Override
public void partDeactivated(IWorkbenchPart part) {
updateActiveEditor();
}
@Override
public void partOpened(IWorkbenchPart part) {
updateActiveEditor();
}
@Override
public void partClosed(IWorkbenchPart part) {
updateActiveEditor();
}
@Override
public void partBroughtToTop(IWorkbenchPart part) {
// do nothing
}
});
graphList = new GraphList(parent, SWT.NONE, editorOverlay);
astGraphProvider = new ASTGraphProvider();
cfGraphProvider = new CFGraphProvider();
createAction("AST Snapshot", IAction.AS_PUSH_BUTTON, "Take an AST snapshot.", Activator.getInstance().ICON_GRAPH_AST, this::onTakeASTSnapshot);
createAction("CFG Snapshot", IAction.AS_PUSH_BUTTON, "Take a CFG snapshot.", Activator.getInstance().ICON_GRAPH_CF, this::onTakeCFGSnapshot);
// done in GH-235
// createAction(
// "DFG Snapshot", IAction.AS_PUSH_BUTTON,
// "Take a DFG snapshot.",
// Activator.getInstance().ICON_GRAPH_DF,
// this::onTakeCFGSnapshot);
createAction("Pause", IAction.AS_CHECK_BOX, "Suspend accepting snapshots that were triggered programmatically.", Activator.getInstance().ICON_PAUSE, this::onPause).setChecked(paused);
createAction("Delete", IAction.AS_PUSH_BUTTON, "Delete selected snapshots from history.", PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_DELETE), this::onDelete);
}
Aggregations