1 /*******************************************************************************
2 * Copyright (c) 2007, 2011 Association for Decentralized Information Management
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.issues.ui.handler;
14 import java.util.List;
16 import org.eclipse.jface.action.Action;
17 import org.eclipse.jface.resource.ImageDescriptor;
18 import org.simantics.Simantics;
19 import org.simantics.db.Resource;
20 import org.simantics.db.Session;
21 import org.simantics.db.common.utils.TagUtil;
24 * @author Tuukka Lehtonen
26 public class TagAction extends Action {
28 private final String virtualGraphId;
29 private final String tagURI;
30 private final boolean tag;
31 private final List<Resource> resources;
36 * @param virtualGraphId
38 * @param tag <code>true</code> to add tag, <code>false</code> to remove tag
41 public TagAction(String label, ImageDescriptor image, String virtualGraphId, String tagURI, boolean tag, List<Resource> input) {
44 this.virtualGraphId = virtualGraphId;
47 this.resources = input;
52 Session session = Simantics.peekSession();
54 new TagUtil(virtualGraphId, tagURI, tag).execute(session, resources);