use of org.eclipse.ui.ISelectionService in project dsl-devkit by dsldevkit.
the class SpyViewPart method installSelectionListeners.
/**
* Install selection listeners.
*/
private void installSelectionListeners() {
ISelectionService service = getSite().getService(ISelectionService.class);
service.addPostSelectionListener(selectionListener);
selectionListener.addSelectionChangedListener(grammarView);
selectionListener.addSelectionChangedListener(eClassTypeView);
eClassTypeView.addPostSelectionChangedListener(eObjectOutline);
selectionListener.addSelectionChangedListener(eObjectOutline);
}
use of org.eclipse.ui.ISelectionService in project hale by halestudio.
the class StyledMapExtra method partOpened.
/**
* @see IPartListener2#partOpened(org.eclipse.ui.IWorkbenchPartReference)
*/
@Override
public void partOpened(IWorkbenchPartReference partRef) {
if (partRef.getPart(false) == mapView) {
mapView.restoreState();
// get services
ISelectionService selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService();
InstanceService instances = PlatformUI.getWorkbench().getService(InstanceService.class);
StyleService styles = PlatformUI.getWorkbench().getService(StyleService.class);
GeometrySchemaService geometries = PlatformUI.getWorkbench().getService(GeometrySchemaService.class);
// update
updateScenePainters(selection);
// add listeners
enableScenePainterListeners(selection, instances, styles, geometries);
layoutController.enable();
}
}
use of org.eclipse.ui.ISelectionService in project hale by halestudio.
the class ExtendedMapKit method setMapTool.
/**
* @see BasicMapKit#setMapTool(MapTool)
*/
@Override
public void setMapTool(MapTool tool) {
ISelectionService service = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService();
MapTool oldTool = getMapTool();
if (oldTool != null && oldTool instanceof ISelectionListener) {
service.removeSelectionListener((ISelectionListener) oldTool);
}
super.setMapTool(tool);
if (tool instanceof ISelectionListener) {
service.addSelectionListener((ISelectionListener) tool);
}
// set the tool as selection provider
if (tool instanceof ISelectionProvider) {
view.setSelectionProvider((ISelectionProvider) tool);
} else {
view.setSelectionProvider(null);
}
}
use of org.eclipse.ui.ISelectionService in project hale by halestudio.
the class SchemaSelectionHelper method getSchemaSelection.
/**
* Get the current schema selection
*
* @return the current schema selection or an empty model selection if it
* can't be determined
*/
public static SchemaSelection getSchemaSelection() {
SchemaSelection result = null;
try {
ISelectionService ss = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService();
ISelection selection = ss.getSelection();
if (selection instanceof SchemaSelection) {
result = (SchemaSelection) selection;
}
} catch (Throwable e) {
log.warn("Could not get current selection", e);
}
if (result == null) {
SelectionTracker tracker = SelectionTrackerUtil.getTracker();
if (tracker != null) {
result = tracker.getSelection(SchemaSelection.class);
}
}
if (result == null) {
result = new DefaultSchemaSelection();
}
return result;
}
use of org.eclipse.ui.ISelectionService in project egit by eclipse.
the class StagingView method dispose.
@Override
public void dispose() {
super.dispose();
ISelectionService srv = CommonUtils.getService(getSite(), ISelectionService.class);
srv.removePostSelectionListener(selectionChangedListener);
CommonUtils.getService(getSite(), IPartService.class).removePartListener(partListener);
if (cacheEntry != null) {
cacheEntry.removeIndexDiffChangedListener(myIndexDiffListener);
}
if (undoRedoActionGroup != null) {
undoRedoActionGroup.dispose();
}
InstanceScope.INSTANCE.getNode(org.eclipse.egit.core.Activator.getPluginId()).removePreferenceChangeListener(prefListener);
if (refsChangedListener != null) {
refsChangedListener.remove();
}
if (configChangedListener != null) {
configChangedListener.remove();
}
if (switchRepositoriesAction != null) {
switchRepositoriesAction.dispose();
switchRepositoriesAction = null;
}
getPreferenceStore().removePropertyChangeListener(uiPrefsListener);
getDialogSettings().put(STORE_SORT_STATE, sortAction.isChecked());
currentRepository = null;
lastSelection = null;
disposed = true;
}
Aggregations