From: Tuukka Lehtonen Date: Thu, 11 Oct 2018 12:52:33 +0000 (+0000) Subject: Merge "Log an error if there are two resources with the same GUID." X-Git-Tag: v1.43.0~136^2~333 X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=commitdiff_plain;h=71bdfa937786c8b8bc9f984c819ae9f9df09359b;hp=9872ffa2c8aa476434964118e6de68e7fd7c6bae Merge "Log an error if there are two resources with the same GUID." --- diff --git a/bundles/org.simantics.browsing.ui.graph.impl/src/org/simantics/browsing/ui/graph/impl/contribution/FinalLabelerContributionImpl.java b/bundles/org.simantics.browsing.ui.graph.impl/src/org/simantics/browsing/ui/graph/impl/contribution/FinalLabelerContributionImpl.java index ed5688694..cf1e3223d 100644 --- a/bundles/org.simantics.browsing.ui.graph.impl/src/org/simantics/browsing/ui/graph/impl/contribution/FinalLabelerContributionImpl.java +++ b/bundles/org.simantics.browsing.ui.graph.impl/src/org/simantics/browsing/ui/graph/impl/contribution/FinalLabelerContributionImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 Association for Decentralized Information Management + * Copyright (c) 2007, 2018 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 @@ -8,12 +8,15 @@ * * Contributors: * VTT Technical Research Centre of Finland - initial API and implementation + * Semantum Oy - gitlab #146 - tooltip support *******************************************************************************/ package org.simantics.browsing.ui.graph.impl.contribution; import java.util.Collections; import java.util.Map; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Event; import org.simantics.Simantics; import org.simantics.browsing.ui.BuiltinKeys; import org.simantics.browsing.ui.BuiltinKeys.LabelerKey; @@ -24,6 +27,7 @@ import org.simantics.browsing.ui.PrimitiveQueryUpdater; import org.simantics.browsing.ui.common.labelers.LabelerContent; import org.simantics.browsing.ui.common.labelers.LabelerStub; import org.simantics.browsing.ui.common.node.IModifiableNode; +import org.simantics.browsing.ui.graph.impl.contributor.labeler.ColumnLabelerContributorImpl; import org.simantics.browsing.ui.graph.impl.request.ResourceQuery; import org.simantics.db.AsyncReadGraph; import org.simantics.db.ReadGraph; @@ -161,6 +165,16 @@ public abstract class FinalLabelerContributionImpl extends LabelerStub { } + @Override + public boolean shouldCreateToolTip(Event event, NodeContext nodeContext) { + return createToolTip(event, nodeContext); + } + + @Override + public Composite createToolTipContentArea(Event event, Composite parent, NodeContext nodeContext) { + return (Composite)createToolTipContent(event, parent, nodeContext); + } + // OVERRIDE public Modifier getModifier(ReadGraph graph, UndoContext undoContext, NodeContext context, String columnKey) throws DatabaseException { @@ -171,4 +185,12 @@ public abstract class FinalLabelerContributionImpl extends LabelerStub { public abstract int category(ReadGraph graph, NodeContext context) throws DatabaseException; + public boolean createToolTip(Object event, NodeContext nodeContext) { + return false; + } + + public Object createToolTipContent(Object event, Object parent, NodeContext nodeContext) { + return null; + } + } diff --git a/bundles/org.simantics.browsing.ui.graph.impl/src/org/simantics/browsing/ui/graph/impl/contributor/labeler/ColumnLabelerContributorImpl.java b/bundles/org.simantics.browsing.ui.graph.impl/src/org/simantics/browsing/ui/graph/impl/contributor/labeler/ColumnLabelerContributorImpl.java index d1dab0fb9..47dcf92c2 100644 --- a/bundles/org.simantics.browsing.ui.graph.impl/src/org/simantics/browsing/ui/graph/impl/contributor/labeler/ColumnLabelerContributorImpl.java +++ b/bundles/org.simantics.browsing.ui.graph.impl/src/org/simantics/browsing/ui/graph/impl/contributor/labeler/ColumnLabelerContributorImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 Association for Decentralized Information Management + * Copyright (c) 2007, 2018 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 @@ -8,6 +8,7 @@ * * Contributors: * VTT Technical Research Centre of Finland - initial API and implementation + * Semantum Oy - gitlab #146 - tooltip support *******************************************************************************/ package org.simantics.browsing.ui.graph.impl.contributor.labeler; @@ -55,6 +56,14 @@ abstract public class ColumnLabelerContributorImpl implements Contributor implements Contributor= x && event.x < (x+w)) { + column = c; + break; + } + x+=w; + } + event.data = column.getData(); GENodeQueryManager manager = new GENodeQueryManager(explorerContext, null, null, TreeItemReference.create(treeItem.getParentItem())); nodeContext = (NodeContext) treeItem.getData(); if (nodeContext != null) diff --git a/bundles/org.simantics.jdbc/.project b/bundles/org.simantics.jdbc/.project index 3af9a2f8f..8ce9c486a 100644 --- a/bundles/org.simantics.jdbc/.project +++ b/bundles/org.simantics.jdbc/.project @@ -1,34 +1,28 @@ - - - org.simantics.jdbc - - - - - - org.simantics.graph.builder - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - org.simantics.graph.nature - - + + + org.simantics.jdbc + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser/handlers/ContextualHelp.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser/handlers/ContextualHelp.java index 9a1ea8360..0d0ec7ce6 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser/handlers/ContextualHelp.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser/handlers/ContextualHelp.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2017 Association for Decentralized Information Management + * Copyright (c) 2007, 2018 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 @@ -9,6 +9,7 @@ * Contributors: * VTT Technical Research Centre of Finland - initial API and implementation * Semantum Oy - #7116 regression fix + * Semantum Oy - gitlab #147 - expose getPossibleId implementation *******************************************************************************/ package org.simantics.modeling.ui.modelBrowser.handlers; @@ -46,33 +47,7 @@ public class ContextualHelp extends AbstractHandler { return Simantics.getSession().syncRequest(new UniqueRead() { @Override public String perform(ReadGraph graph) throws DatabaseException { - ModelingResources MOD = ModelingResources.getInstance(graph); - if (resource != null) { - Resource component = graph.getPossibleObject(resource, MOD.ElementToComponent); - String id = component != null ? graph.getPossibleRelatedValue2(component, MOD.contextualHelpId, Bindings.STRING) : null; - if (id != null) - return id; - id = graph.getPossibleRelatedValue2(resource, MOD.contextualHelpId, Bindings.STRING); - if (id != null) - return id; - } - - if (variable != null) { - String id = variable.getPossiblePropertyValue(graph, MOD.contextualHelpId, Bindings.STRING); - if (id != null) - return id; - } - - // TODO: consider removing this block - if (sel != null) { - PropertyVariables vars = AdaptionUtils.adaptToSingle(sel, PropertyVariables.class); - Variable var = vars != null ? vars.getConfiguration() : null; - String id = var != null ? var.getPossiblePropertyValue(graph, MOD.contextualHelpId, Bindings.STRING) : null; - if (id != null) - return id; - } - - return null; + return getPossibleId(graph, resource, variable, sel); } }); } catch (DatabaseException e) { @@ -89,4 +64,34 @@ public class ContextualHelp extends AbstractHandler { return null; } + public static String getPossibleId(ReadGraph graph, Resource resource, Variable variable, ISelection sel) throws DatabaseException { + ModelingResources MOD = ModelingResources.getInstance(graph); + if (resource != null) { + Resource component = graph.getPossibleObject(resource, MOD.ElementToComponent); + String id = component != null ? graph.getPossibleRelatedValue2(component, MOD.contextualHelpId, Bindings.STRING) : null; + if (id != null) + return id; + id = graph.getPossibleRelatedValue2(resource, MOD.contextualHelpId, Bindings.STRING); + if (id != null) + return id; + } + + if (variable != null) { + String id = variable.getPossiblePropertyValue(graph, MOD.contextualHelpId, Bindings.STRING); + if (id != null) + return id; + } + + // TODO: consider removing this block + if (sel != null) { + PropertyVariables vars = AdaptionUtils.adaptToSingle(sel, PropertyVariables.class); + Variable var = vars != null ? vars.getConfiguration() : null; + String id = var != null ? var.getPossiblePropertyValue(graph, MOD.contextualHelpId, Bindings.STRING) : null; + if (id != null) + return id; + } + + return null; + } + } diff --git a/bundles/org.simantics.scenegraph.profile/src/org/simantics/scenegraph/profile/common/ProfileObserver.java b/bundles/org.simantics.scenegraph.profile/src/org/simantics/scenegraph/profile/common/ProfileObserver.java index 6fc72b3d3..efac19055 100644 --- a/bundles/org.simantics.scenegraph.profile/src/org/simantics/scenegraph/profile/common/ProfileObserver.java +++ b/bundles/org.simantics.scenegraph.profile/src/org/simantics/scenegraph/profile/common/ProfileObserver.java @@ -252,7 +252,7 @@ public class ProfileObserver implements EvaluationContext { if (value == null) { map.remove(key); if (map.isEmpty()) - properties.remove(element); + temporaryProperties.remove(element); } else map.put(key, value); }