Search in sources :

Example 21 with ISelectionService

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);
}
Also used : ISelectionService(org.eclipse.ui.ISelectionService)

Example 22 with ISelectionService

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();
    }
}
Also used : StyleService(eu.esdihumboldt.hale.ui.common.service.style.StyleService) ISelectionService(org.eclipse.ui.ISelectionService) InstanceService(eu.esdihumboldt.hale.ui.service.instance.InstanceService) GeometrySchemaService(eu.esdihumboldt.hale.ui.geometry.service.GeometrySchemaService)

Example 23 with ISelectionService

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);
    }
}
Also used : ISelectionProvider(org.eclipse.jface.viewers.ISelectionProvider) ISelectionService(org.eclipse.ui.ISelectionService) MapTool(de.fhg.igd.mapviewer.MapTool) ISelectionListener(org.eclipse.ui.ISelectionListener)

Example 24 with ISelectionService

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;
}
Also used : SelectionTracker(eu.esdihumboldt.hale.ui.util.selection.SelectionTracker) DefaultSchemaSelection(eu.esdihumboldt.hale.ui.selection.impl.DefaultSchemaSelection) ISelection(org.eclipse.jface.viewers.ISelection) ISelectionService(org.eclipse.ui.ISelectionService) DefaultSchemaSelection(eu.esdihumboldt.hale.ui.selection.impl.DefaultSchemaSelection)

Example 25 with ISelectionService

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;
}
Also used : ISelectionService(org.eclipse.ui.ISelectionService) IPartService(org.eclipse.ui.IPartService)

Aggregations

ISelectionService (org.eclipse.ui.ISelectionService)38 ISelection (org.eclipse.jface.viewers.ISelection)19 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)19 IResource (org.eclipse.core.resources.IResource)15 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)12 IProject (org.eclipse.core.resources.IProject)9 IWorkbench (org.eclipse.ui.IWorkbench)8 IJavaProject (org.eclipse.jdt.core.IJavaProject)7 IEditorPart (org.eclipse.ui.IEditorPart)7 IFile (org.eclipse.core.resources.IFile)6 ExecutionException (org.eclipse.core.commands.ExecutionException)3 RepositoryMapping (org.eclipse.egit.core.project.RepositoryMapping)3 RepositoryTreeNode (org.eclipse.egit.ui.internal.repository.tree.RepositoryTreeNode)3 Repository (org.eclipse.jgit.lib.Repository)3 SWT (org.eclipse.swt.SWT)3 ISelectionListener (org.eclipse.ui.ISelectionListener)3 PlatformUI (org.eclipse.ui.PlatformUI)3 StyleService (eu.esdihumboldt.hale.ui.common.service.style.StyleService)2 GeometrySchemaService (eu.esdihumboldt.hale.ui.geometry.service.GeometrySchemaService)2 InstanceService (eu.esdihumboldt.hale.ui.service.instance.InstanceService)2