X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.browsing.ui.swt%2Fsrc%2Forg%2Fsimantics%2Fbrowsing%2Fui%2Fswt%2FPropertyTableUtil.java;h=e41b8ba7a03e3691cf32a404ba3093b976b8bbf0;hp=dce442362867c965818dc7194365f9fb944e5037;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/PropertyTableUtil.java b/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/PropertyTableUtil.java index dce442362..e41b8ba7a 100644 --- a/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/PropertyTableUtil.java +++ b/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/PropertyTableUtil.java @@ -1,44 +1,44 @@ -/******************************************************************************* - * Copyright (c) 2007, 2012 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.jface.viewers.ISelectionProvider; -import org.eclipse.swt.widgets.Control; -import org.simantics.browsing.ui.GraphExplorer; -import org.simantics.browsing.ui.common.views.PropertyTableConstants; -import org.simantics.db.Session; -import org.simantics.db.management.ISessionContext; -import org.simantics.ui.dnd.BasicDragSource; -import org.simantics.ui.dnd.SessionContainer; - -public class PropertyTableUtil { - - /** - * @param explorer - * @return the object representing the drag source. If the object implements - * {@link SessionContainer}, its - * {@link SessionContainer#setSession(Session)} will be invoked - * every time the active database session changes. - */ - public static Object createResourceDragSource(GraphExplorer explorer) { - ISelectionProvider selectionProvider = (ISelectionProvider)explorer.getAdapter(ISelectionProvider.class); - Control control = explorer.getControl(); - return new BasicDragSource(selectionProvider, control, null, PropertyTableConstants.DND_PURPOSE_PROPERTY); - } - - public static void setupDragSource(Object dragSource, ISessionContext sessionContext) { - if (dragSource instanceof SessionContainer) { - ((SessionContainer) dragSource).setSession(sessionContext != null ? sessionContext.getSession() : null); - } - } - -} +/******************************************************************************* + * Copyright (c) 2007, 2012 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.jface.viewers.ISelectionProvider; +import org.eclipse.swt.widgets.Control; +import org.simantics.browsing.ui.GraphExplorer; +import org.simantics.browsing.ui.common.views.PropertyTableConstants; +import org.simantics.db.Session; +import org.simantics.db.management.ISessionContext; +import org.simantics.ui.dnd.BasicDragSource; +import org.simantics.ui.dnd.SessionContainer; + +public class PropertyTableUtil { + + /** + * @param explorer + * @return the object representing the drag source. If the object implements + * {@link SessionContainer}, its + * {@link SessionContainer#setSession(Session)} will be invoked + * every time the active database session changes. + */ + public static Object createResourceDragSource(GraphExplorer explorer) { + ISelectionProvider selectionProvider = (ISelectionProvider)explorer.getAdapter(ISelectionProvider.class); + Control control = explorer.getControl(); + return new BasicDragSource(selectionProvider, control, null, PropertyTableConstants.DND_PURPOSE_PROPERTY); + } + + public static void setupDragSource(Object dragSource, ISessionContext sessionContext) { + if (dragSource instanceof SessionContainer) { + ((SessionContainer) dragSource).setSession(sessionContext != null ? sessionContext.getSession() : null); + } + } + +}