X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.annotation.ui%2Fsrc%2Forg%2Fsimantics%2Fannotation%2Fui%2Factions%2FNewAnnotationType.java;h=f2ea61e9295e26748d37d687105cab13b55bd8c0;hb=refs%2Fchanges%2F38%2F238%2F2;hp=245c6f28092e2b88f4d4082670acec1a001c9dd9;hpb=24e2b34260f219f0d1644ca7a138894980e25b14;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.annotation.ui/src/org/simantics/annotation/ui/actions/NewAnnotationType.java b/bundles/org.simantics.annotation.ui/src/org/simantics/annotation/ui/actions/NewAnnotationType.java index 245c6f280..f2ea61e92 100644 --- a/bundles/org.simantics.annotation.ui/src/org/simantics/annotation/ui/actions/NewAnnotationType.java +++ b/bundles/org.simantics.annotation.ui/src/org/simantics/annotation/ui/actions/NewAnnotationType.java @@ -1,44 +1,44 @@ -/******************************************************************************* - * Copyright (c) 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.annotation.ui.actions; - -import org.simantics.Simantics; -import org.simantics.annotation.ui.AnnotationUtils; -import org.simantics.db.Resource; -import org.simantics.db.WriteGraph; -import org.simantics.db.common.request.WriteRequest; -import org.simantics.db.exception.DatabaseException; -import org.simantics.db.layer0.adapter.ActionFactory; - -public class NewAnnotationType implements ActionFactory { - - @Override - public Runnable create(Object target) { - if(!(target instanceof Resource)) - return null; - final Resource parent = (Resource)target; - - return new Runnable() { - @Override - public void run() { - Simantics.getSession().asyncRequest(new WriteRequest() { - @Override - public void perform(WriteGraph g) throws DatabaseException { - g.markUndoPoint(); - AnnotationUtils.newAnnotationType(g, parent); - } - }); - } - }; - } - -} +/******************************************************************************* + * Copyright (c) 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.annotation.ui.actions; + +import org.simantics.Simantics; +import org.simantics.annotation.ui.AnnotationUtils; +import org.simantics.db.Resource; +import org.simantics.db.WriteGraph; +import org.simantics.db.common.request.WriteRequest; +import org.simantics.db.exception.DatabaseException; +import org.simantics.db.layer0.adapter.ActionFactory; + +public class NewAnnotationType implements ActionFactory { + + @Override + public Runnable create(Object target) { + if(!(target instanceof Resource)) + return null; + final Resource parent = (Resource)target; + + return new Runnable() { + @Override + public void run() { + Simantics.getSession().asyncRequest(new WriteRequest() { + @Override + public void perform(WriteGraph g) throws DatabaseException { + g.markUndoPoint(); + AnnotationUtils.newAnnotationType(g, parent); + } + }); + } + }; + } + +}