1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 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.ui.workbench;
14 import org.simantics.Simantics;
15 import org.simantics.db.ReadGraph;
16 import org.simantics.db.Resource;
17 import org.simantics.db.exception.DatabaseException;
18 import org.simantics.db.request.Read;
19 import org.simantics.project.IProject;
22 * @author Tuukka Lehtonen
24 public class ToolTipRequest implements Read<String> {
26 private final String editorId;
28 private final IResourceEditorInput input;
30 public ToolTipRequest(String editorId, IResourceEditorInput input) {
31 this.editorId = editorId;
36 public String perform(ReadGraph graph) throws DatabaseException {
37 Resource r = input.getResource();
39 IProject p = Simantics.peekProject();
41 IEditorNamingService ems = EditorNaming.getNamingService(graph, r);
42 if (ems instanceof IEditorNamingService2)
43 return ((IEditorNamingService2) ems).getToolTipText(graph, editorId, input);
46 return graph.syncRequest(new TitleRequest(editorId, input));