X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.modeling.ui%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2Fui%2FmodelBrowser%2Fhandlers%2FNewSubscriptionHandler.java;h=05e02e594e7541014003a453471144fa73404194;hb=e84008c029ef2336cf55ad371256c9a12a889e98;hp=8e046db1fccb06916acccbfb9446ca8812cccad0;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser/handlers/NewSubscriptionHandler.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser/handlers/NewSubscriptionHandler.java index 8e046db1f..05e02e594 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser/handlers/NewSubscriptionHandler.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser/handlers/NewSubscriptionHandler.java @@ -1,40 +1,40 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 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.modeling.ui.modelBrowser.handlers; - -import org.eclipse.core.commands.AbstractHandler; -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.ui.handlers.HandlerUtil; -import org.simantics.db.Resource; -import org.simantics.modeling.ui.actions.NewSubscription; -import org.simantics.modeling.ui.modelBrowser2.model.SubscriptionsNode; -import org.simantics.utils.ui.AdaptionUtils; - -public class NewSubscriptionHandler extends AbstractHandler { - - @Override - public Object execute(ExecutionEvent event) throws ExecutionException { - ISelection sel = HandlerUtil.getCurrentSelection(event); - SubscriptionsNode node = AdaptionUtils.adaptToSingle(sel, SubscriptionsNode.class); - if (node == null) - return null; - final Resource model = node.resource; - - new NewSubscription().create(model).run(); - - return null; - } - -} - +/******************************************************************************* + * Copyright (c) 2007, 2010 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.modeling.ui.modelBrowser.handlers; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.ui.handlers.HandlerUtil; +import org.simantics.db.Resource; +import org.simantics.modeling.ui.actions.NewSubscription; +import org.simantics.modeling.ui.modelBrowser2.model.SubscriptionsNode; +import org.simantics.utils.ui.AdaptionUtils; + +public class NewSubscriptionHandler extends AbstractHandler { + + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + ISelection sel = HandlerUtil.getCurrentSelection(event); + SubscriptionsNode node = AdaptionUtils.adaptToSingle(sel, SubscriptionsNode.class); + if (node == null) + return null; + final Resource model = node.resource; + + new NewSubscription().create(model).run(); + + return null; + } + +} +