X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.browsing.ui.swt%2Fsrc%2Forg%2Fsimantics%2Fbrowsing%2Fui%2Fswt%2FDefaultKeyListener.java;fp=bundles%2Forg.simantics.browsing.ui.swt%2Fsrc%2Forg%2Fsimantics%2Fbrowsing%2Fui%2Fswt%2FDefaultKeyListener.java;h=7e5de464a4223ad6f934d264f8a19c6f215fed8a;hb=969bd23cab98a79ca9101af33334000879fb60c5;hp=0000000000000000000000000000000000000000;hpb=866dba5cd5a3929bbeae85991796acb212338a08;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/DefaultKeyListener.java b/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/DefaultKeyListener.java new file mode 100644 index 000000000..7e5de464a --- /dev/null +++ b/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/DefaultKeyListener.java @@ -0,0 +1,118 @@ +/******************************************************************************* + * Copyright (c) 2007, 2010 Association for Decentralized Information Management + * in Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.browsing.ui.swt; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.viewers.IPostSelectionProvider; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.KeyAdapter; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Shell; +import org.simantics.Simantics; +import org.simantics.browsing.ui.GraphExplorer; +import org.simantics.browsing.ui.NodeContext; +import org.simantics.browsing.ui.model.queries.IsNodeContextModifiable; +import org.simantics.db.exception.DatabaseException; +import org.simantics.db.management.ISessionContext; +import org.simantics.db.management.ISessionContextProvider; +import org.simantics.ui.workbench.action.ChooseActionRequest; +import org.simantics.utils.datastructures.Function; +import org.simantics.utils.ui.ISelectionUtils; +import org.simantics.utils.ui.workbench.WorkbenchUtils; + +/** + * The default keyboard handler for {@link GraphExplorer}. + * + *
+ * Carriage return presses are handled similarly to mouse double clicks. F2 + * initiates in-line editing of the selection when possible. + *
+ * + * @author Tuukka Lehtonen + */ +public class DefaultKeyListener extends KeyAdapter { + + private final ISessionContextProvider contextProvider; + private final GraphExplorer explorer; + private final Function