X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.browsing.ui.model%2Fsrc%2Forg%2Fsimantics%2Fbrowsing%2Fui%2Fmodel%2Fqueries%2FIsNodeContextModifiable.java;h=3cbcaee7b8d6a65a0f37be43865bf3a320a3a838;hp=4daf9a5e6ea6eab3a491c38979e503becaa9639a;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.browsing.ui.model/src/org/simantics/browsing/ui/model/queries/IsNodeContextModifiable.java b/bundles/org.simantics.browsing.ui.model/src/org/simantics/browsing/ui/model/queries/IsNodeContextModifiable.java index 4daf9a5e6..3cbcaee7b 100644 --- a/bundles/org.simantics.browsing.ui.model/src/org/simantics/browsing/ui/model/queries/IsNodeContextModifiable.java +++ b/bundles/org.simantics.browsing.ui.model/src/org/simantics/browsing/ui/model/queries/IsNodeContextModifiable.java @@ -1,44 +1,44 @@ -/******************************************************************************* - * Copyright (c) 2015 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: - * Semantum Oy - initial API and implementation - *******************************************************************************/ -package org.simantics.browsing.ui.model.queries; - -import java.util.Collections; - -import org.simantics.browsing.ui.NodeContext; -import org.simantics.browsing.ui.model.actions.ActionBrowseContext; -import org.simantics.browsing.ui.model.browsecontexts.ActionBrowseContextRequest; -import org.simantics.db.ReadGraph; -import org.simantics.db.common.procedure.adapter.TransientCacheAsyncListener; -import org.simantics.db.common.request.UnaryRead; -import org.simantics.db.exception.DatabaseException; -import org.simantics.project.ontology.ProjectResource; - -/** - * @author Tuukka Lehtonen - * @since 1.18.1 - */ -public class IsNodeContextModifiable extends UnaryRead { - - public IsNodeContextModifiable(NodeContext context) { - super(context); - } - - @Override - public Boolean perform(ReadGraph graph) throws DatabaseException { - ActionBrowseContext defaultContext = graph.syncRequest( - new ActionBrowseContextRequest(Collections.singleton(ProjectResource.getInstance(graph).ProjectActionContext)), - TransientCacheAsyncListener.instance()); - ActionBrowseContext browseContext = ActionBrowseContext.get(graph, parameter, defaultContext); - return browseContext != null && browseContext.canRename(graph, parameter); - } - -} +/******************************************************************************* + * Copyright (c) 2015 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: + * Semantum Oy - initial API and implementation + *******************************************************************************/ +package org.simantics.browsing.ui.model.queries; + +import java.util.Collections; + +import org.simantics.browsing.ui.NodeContext; +import org.simantics.browsing.ui.model.actions.ActionBrowseContext; +import org.simantics.browsing.ui.model.browsecontexts.ActionBrowseContextRequest; +import org.simantics.db.ReadGraph; +import org.simantics.db.common.procedure.adapter.TransientCacheAsyncListener; +import org.simantics.db.common.request.UnaryRead; +import org.simantics.db.exception.DatabaseException; +import org.simantics.project.ontology.ProjectResource; + +/** + * @author Tuukka Lehtonen + * @since 1.18.1 + */ +public class IsNodeContextModifiable extends UnaryRead { + + public IsNodeContextModifiable(NodeContext context) { + super(context); + } + + @Override + public Boolean perform(ReadGraph graph) throws DatabaseException { + ActionBrowseContext defaultContext = graph.syncRequest( + new ActionBrowseContextRequest(Collections.singleton(ProjectResource.getInstance(graph).ProjectActionContext)), + TransientCacheAsyncListener.instance()); + ActionBrowseContext browseContext = ActionBrowseContext.get(graph, parameter, defaultContext); + return browseContext != null && browseContext.canRename(graph, parameter); + } + +}