1 /*******************************************************************************
2 * Copyright (c) 2007, 2011 Association for Decentralized Information Management in
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.modeling.ui.chart.property;
14 import org.simantics.browsing.ui.swt.widgets.impl.ModifyComboListenerImpl;
15 import org.simantics.db.Resource;
16 import org.simantics.db.WriteGraph;
17 import org.simantics.db.exception.DatabaseException;
18 import org.simantics.operation.Layer0X;
20 public class TemplateModifier extends ModifyComboListenerImpl<Resource, Resource> {
23 public void applySelection(WriteGraph graph, Resource monitor, Resource template) throws DatabaseException {
25 Layer0X L0X = Layer0X.getInstance(graph);
26 Resource exist = graph.getPossibleObject(monitor, L0X.ObtainsProperty);
27 if(template.equals(exist)) return;
29 graph.deny(monitor, L0X.ObtainsProperty);
30 graph.claim(monitor, L0X.ObtainsProperty1, null, template);