use of org.eclipse.ui.commands.ICommandService in project dbeaver by serge-rider.
the class SimpleCommandContext method refreshCommandState.
protected void refreshCommandState() {
ICommandService commandService = DBeaverUI.getActiveWorkbenchWindow().getService(ICommandService.class);
if (commandService != null) {
commandService.refreshElements(IWorkbenchCommandConstants.EDIT_UNDO, null);
commandService.refreshElements(IWorkbenchCommandConstants.EDIT_REDO, null);
}
}
use of org.eclipse.ui.commands.ICommandService in project dbeaver by serge-rider.
the class WorkbenchContextListener method listenWindowEvents.
private void listenWindowEvents(IWorkbenchWindow window) {
window.addPageListener(this);
for (IWorkbenchPage page : window.getPages()) {
page.addPartListener(this);
}
if (commandExecutionListener == null) {
final ICommandService commandService = PlatformUI.getWorkbench().getService(ICommandService.class);
if (commandService != null) {
commandExecutionListener = new CommandExecutionListener();
commandService.addExecutionListener(commandExecutionListener);
}
}
}
use of org.eclipse.ui.commands.ICommandService in project eclipse.platform.text by eclipse.
the class IncrementalFindTarget method uninstall.
/**
* Uninstalls itself. I.e. removes all listeners installed in <code>install</code>.
*/
private void uninstall() {
fTextViewer.removeTextListener(this);
ISelectionProvider selectionProvider = fTextViewer.getSelectionProvider();
if (selectionProvider != null)
selectionProvider.removeSelectionChangedListener(this);
StyledText text = fTextViewer.getTextWidget();
if (text != null) {
text.removeMouseListener(this);
text.removeFocusListener(this);
}
if (fTextViewer instanceof ITextViewerExtension) {
((ITextViewerExtension) fTextViewer).removeVerifyKeyListener(this);
} else {
if (text != null)
text.removeVerifyKeyListener(this);
}
ICommandService commandService = PlatformUI.getWorkbench().getAdapter(ICommandService.class);
if (commandService != null)
commandService.removeExecutionListener(this);
fInstalled = false;
}
use of org.eclipse.ui.commands.ICommandService in project eclipse.platform.text by eclipse.
the class CompoundEditExitStrategy method addListeners.
private void addListeners(ITextViewer viewer) {
fWidgetEventSource = viewer.getTextWidget();
if (fWidgetEventSource != null) {
fWidgetEventSource.addVerifyKeyListener(fEventListener);
fWidgetEventSource.addMouseListener(fEventListener);
fWidgetEventSource.addFocusListener(fEventListener);
}
ICommandService commandService = PlatformUI.getWorkbench().getAdapter(ICommandService.class);
if (commandService != null)
commandService.addExecutionListener(fEventListener);
}
use of org.eclipse.ui.commands.ICommandService in project eclipse.platform.text by eclipse.
the class CompoundEditExitStrategy method removeListeners.
private void removeListeners() {
ICommandService commandService = PlatformUI.getWorkbench().getAdapter(ICommandService.class);
if (commandService != null)
commandService.removeExecutionListener(fEventListener);
if (fWidgetEventSource != null) {
fWidgetEventSource.removeFocusListener(fEventListener);
fWidgetEventSource.removeMouseListener(fEventListener);
fWidgetEventSource.removeVerifyKeyListener(fEventListener);
fWidgetEventSource = null;
}
}
Aggregations