]> gerrit.simantics Code Review - simantics/platform.git/blob - SearchLinksHandler.java
1aafd86357fc0467b2a5179e5bd1d6f72a0cce37
[simantics/platform.git] / SearchLinksHandler.java
1 package org.simantics.document.linking.actions;
2
3 import org.eclipse.core.commands.AbstractHandler;
4 import org.eclipse.core.commands.ExecutionEvent;
5 import org.eclipse.core.commands.ExecutionException;
6 import org.eclipse.jface.viewers.ISelection;
7 import org.eclipse.ui.handlers.HandlerUtil;
8 import org.simantics.db.Resource;
9 import org.simantics.utils.ui.AdaptionUtils;
10
11 public class SearchLinksHandler extends AbstractHandler{
12         
13         @Override
14         public Object execute(ExecutionEvent event) throws ExecutionException {
15                 ISelection selection = HandlerUtil.getCurrentSelection(event);
16                 Resource r = AdaptionUtils.adaptToSingle(selection, Resource.class);
17                 if (r == null)
18                         return null;
19                 SearchLinksAction action = new SearchLinksAction();
20                 action.create(r).run();
21                 return null;
22         }
23
24 }