X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.spreadsheet.ui%2Fsrc%2Forg%2Fsimantics%2Fspreadsheet%2Fui%2FSheetWriter.java;h=827ed901ce7199de76358b9bd06850a8a38088bf;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hp=99e33385b8e16105cfc96e83571dff17f904cb7a;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.spreadsheet.ui/src/org/simantics/spreadsheet/ui/SheetWriter.java b/bundles/org.simantics.spreadsheet.ui/src/org/simantics/spreadsheet/ui/SheetWriter.java index 99e33385b..827ed901c 100644 --- a/bundles/org.simantics.spreadsheet.ui/src/org/simantics/spreadsheet/ui/SheetWriter.java +++ b/bundles/org.simantics.spreadsheet.ui/src/org/simantics/spreadsheet/ui/SheetWriter.java @@ -1,49 +1,49 @@ -/******************************************************************************* - * 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.spreadsheet.ui; - -import org.simantics.databoard.Bindings; -import org.simantics.db.Resource; -import org.simantics.db.WriteGraph; -import org.simantics.db.exception.DatabaseException; -import org.simantics.diagram.synchronization.graph.ElementWriter; -import org.simantics.g2d.element.IElement; -import org.simantics.spreadsheet.resource.SpreadsheetResource; - -public class SheetWriter implements ElementWriter { - - public static final Object LABEL = new Object(); - - @Override - public void addToGraph(WriteGraph g, IElement element, Resource elementResource) throws DatabaseException { - - final Resource sheetComponent = element.getHint(SheetClass.KEY_SHEET); - final String rvi = element.getHint(SheetClass.KEY_RVI); - - if (sheetComponent == null) - throw new IllegalArgumentException("KEY_SHEET hint not set"); - - if (rvi == null) - throw new IllegalArgumentException("KEY_RVI hint not set"); - - SpreadsheetResource sr = SpreadsheetResource.getInstance(g); - - g.claim(elementResource, sr.HasSheet, sheetComponent); - g.claimLiteral(elementResource, sr.HasRVI, rvi, Bindings.STRING); - - } - - @Override - public void removeFromGraph(WriteGraph graph, Resource elementResource) throws DatabaseException { - } - -} +/******************************************************************************* + * 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.spreadsheet.ui; + +import org.simantics.databoard.Bindings; +import org.simantics.db.Resource; +import org.simantics.db.WriteGraph; +import org.simantics.db.exception.DatabaseException; +import org.simantics.diagram.synchronization.graph.ElementWriter; +import org.simantics.g2d.element.IElement; +import org.simantics.spreadsheet.resource.SpreadsheetResource; + +public class SheetWriter implements ElementWriter { + + public static final Object LABEL = new Object(); + + @Override + public void addToGraph(WriteGraph g, IElement element, Resource elementResource) throws DatabaseException { + + final Resource sheetComponent = element.getHint(SheetClass.KEY_SHEET); + final String rvi = element.getHint(SheetClass.KEY_RVI); + + if (sheetComponent == null) + throw new IllegalArgumentException("KEY_SHEET hint not set"); + + if (rvi == null) + throw new IllegalArgumentException("KEY_RVI hint not set"); + + SpreadsheetResource sr = SpreadsheetResource.getInstance(g); + + g.claim(elementResource, sr.HasSheet, sheetComponent); + g.claimLiteral(elementResource, sr.HasRVI, rvi, Bindings.STRING); + + } + + @Override + public void removeFromGraph(WriteGraph graph, Resource elementResource) throws DatabaseException { + } + +}