X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=bundles%2Forg.simantics.message.ui%2Fsrc%2Forg%2Fsimantics%2Fmessage%2Fui%2Ftest%2FTestResourceStatusHandler.java;h=d541944efb4b62be88de7ef0b27658fc681a8197;hb=47269fe0acb894f346810417d950a1ab59cdc0ea;hp=3624fc1cf218fceed70a26a3ba0ade52d96e439f;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.message.ui/src/org/simantics/message/ui/test/TestResourceStatusHandler.java b/bundles/org.simantics.message.ui/src/org/simantics/message/ui/test/TestResourceStatusHandler.java index 3624fc1cf..d541944ef 100644 --- a/bundles/org.simantics.message.ui/src/org/simantics/message/ui/test/TestResourceStatusHandler.java +++ b/bundles/org.simantics.message.ui/src/org/simantics/message/ui/test/TestResourceStatusHandler.java @@ -1,60 +1,60 @@ -/******************************************************************************* - * 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.message.ui.test; - -import org.eclipse.core.commands.AbstractHandler; -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.osgi.util.NLS; -import org.eclipse.ui.handlers.HandlerUtil; -import org.simantics.db.Resource; -import org.simantics.db.Session; -import org.simantics.message.DetailStatus; -import org.simantics.message.IDetailStatus; -import org.simantics.message.ILogger; -import org.simantics.message.MessageService; -import org.simantics.message.ReferenceSerializationException; -import org.simantics.message.ui.Activator; -import org.simantics.message.util.MessageUtil; -import org.simantics.ui.SimanticsUI; -import org.simantics.ui.utils.ResourceAdaptionUtils; - -/** - * @author Tuukka Lehtonen - */ -public class TestResourceStatusHandler extends AbstractHandler { - - @Override - public Object execute(ExecutionEvent event) throws ExecutionException { - Resource[] rs = ResourceAdaptionUtils.toResources(HandlerUtil.getCurrentSelection(event)); - ILogger log = MessageService.getDefault(); - - Session s = SimanticsUI.peekSession(); - if (s == null) - return null; - - try { - int code = 0; - for (Resource r : rs) { - log.log(new DetailStatus(IDetailStatus.DEBUG, Activator.PLUGIN_ID, code++, - "Logged reference to selected resource", - NLS.bind(Messages.Test_message, MessageUtil.resource(s, r, "this link")), - null)); - } - } catch (ReferenceSerializationException e) { - e.printStackTrace(); - } - - 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.message.ui.test; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.osgi.util.NLS; +import org.eclipse.ui.handlers.HandlerUtil; +import org.simantics.Simantics; +import org.simantics.db.Resource; +import org.simantics.db.Session; +import org.simantics.message.DetailStatus; +import org.simantics.message.IDetailStatus; +import org.simantics.message.ILogger; +import org.simantics.message.MessageService; +import org.simantics.message.ReferenceSerializationException; +import org.simantics.message.ui.Activator; +import org.simantics.message.util.MessageUtil; +import org.simantics.ui.utils.ResourceAdaptionUtils; + +/** + * @author Tuukka Lehtonen + */ +public class TestResourceStatusHandler extends AbstractHandler { + + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + Resource[] rs = ResourceAdaptionUtils.toResources(HandlerUtil.getCurrentSelection(event)); + ILogger log = MessageService.getDefault(); + + Session s = Simantics.peekSession(); + if (s == null) + return null; + + try { + int code = 0; + for (Resource r : rs) { + log.log(new DetailStatus(IDetailStatus.DEBUG, Activator.PLUGIN_ID, code++, + "Logged reference to selected resource", //$NON-NLS-1$ + NLS.bind("

This is a detailed message that contains links to related information. Follow {0} to open your favorite editor for the database resource.

", MessageUtil.resource(s, r, "this link")), //$NON-NLS-1$ + null)); + } + } catch (ReferenceSerializationException e) { + e.printStackTrace(); + } + + return null; + } + +}