-/*******************************************************************************\r
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- * VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.message.ui.test;\r
-\r
-import org.eclipse.core.commands.AbstractHandler;\r
-import org.eclipse.core.commands.ExecutionEvent;\r
-import org.eclipse.core.commands.ExecutionException;\r
-import org.eclipse.osgi.util.NLS;\r
-import org.eclipse.ui.handlers.HandlerUtil;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.Session;\r
-import org.simantics.message.DetailStatus;\r
-import org.simantics.message.IDetailStatus;\r
-import org.simantics.message.ILogger;\r
-import org.simantics.message.MessageService;\r
-import org.simantics.message.ReferenceSerializationException;\r
-import org.simantics.message.ui.Activator;\r
-import org.simantics.message.util.MessageUtil;\r
-import org.simantics.ui.SimanticsUI;\r
-import org.simantics.ui.utils.ResourceAdaptionUtils;\r
-\r
-/**\r
- * @author Tuukka Lehtonen\r
- */\r
-public class TestResourceStatusHandler extends AbstractHandler {\r
-\r
- @Override\r
- public Object execute(ExecutionEvent event) throws ExecutionException {\r
- Resource[] rs = ResourceAdaptionUtils.toResources(HandlerUtil.getCurrentSelection(event));\r
- ILogger log = MessageService.getDefault();\r
- \r
- Session s = SimanticsUI.peekSession();\r
- if (s == null)\r
- return null;\r
-\r
- try {\r
- int code = 0;\r
- for (Resource r : rs) {\r
- log.log(new DetailStatus(IDetailStatus.DEBUG, Activator.PLUGIN_ID, code++,\r
- "Logged reference to selected resource",\r
- NLS.bind(Messages.Test_message, MessageUtil.resource(s, r, "this link")),\r
- null));\r
- }\r
- } catch (ReferenceSerializationException e) {\r
- e.printStackTrace();\r
- }\r
- \r
- return null;\r
- }\r
-\r
-}\r
+/*******************************************************************************
+ * 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("<p>This is a detailed message that contains links to related information. Follow {0} to open your favorite editor for the database resource.</p>", MessageUtil.resource(s, r, "this link")), //$NON-NLS-1$
+ null));
+ }
+ } catch (ReferenceSerializationException e) {
+ e.printStackTrace();
+ }
+
+ return null;
+ }
+
+}