]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/ModelingProjectOperationsContribution.java
Remove usage of deprecated SimanticsUI-methods
[simantics/platform.git] / bundles / org.simantics.modeling.ui / src / org / simantics / modeling / ui / actions / ModelingProjectOperationsContribution.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management
3  * in Industry THTH ry.
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
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.modeling.ui.actions;
13
14 import org.simantics.Simantics;
15 import org.simantics.db.ReadGraph;
16 import org.simantics.db.Resource;
17 import org.simantics.modeling.ModelingResources;
18 import org.simantics.project.IProject;
19 import org.simantics.ui.contribution.OperationsMenuContribution;
20
21 /**
22  * @author Tuukka Lehtonen
23  */
24 public class ModelingProjectOperationsContribution extends OperationsMenuContribution {
25
26     @Override
27     protected Object[] getSelectedObjects() {
28         // Force the evaluated selection to be the currently active project.
29         IProject project = Simantics.peekProject();
30         if (project == null)
31             return Resource.NONE;
32         return new Resource[] { project.get() };
33     }
34
35     @Override
36     protected Resource getListResource(ReadGraph g) throws Exception {
37                 return ModelingResources.getInstance(g).ModelingOperations;
38     }
39
40 }