-/*******************************************************************************\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.ui;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collections;\r
-import java.util.EventObject;\r
-import java.util.List;\r
-\r
-import org.eclipse.jface.action.IAction;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.utils.datastructures.hints.HintContext;\r
-import org.simantics.utils.ui.action.IPriorityAction;\r
-import org.simantics.utils.ui.action.PriorityActionAdapter;\r
-\r
-/**\r
- * TODO: multiple selection support\r
- * \r
- * @author Tuukka Lehtonen\r
- */\r
-public class DoubleClickEvent extends EventObject {\r
-\r
- private static final long serialVersionUID = 1730213767249571862L;\r
-\r
- private boolean consumed = false;\r
-\r
- private final ReadGraph graph;\r
-\r
- private final Object resource;\r
-\r
- private List<IPriorityAction> actions = new ArrayList<IPriorityAction>();\r
-\r
- private HintContext hintContext = new HintContext();\r
-\r
- public DoubleClickEvent(Object source, ReadGraph g, Object resource) {\r
- super(source);\r
- this.graph = g;\r
- this.resource = resource;\r
- }\r
-\r
- public ReadGraph getGraph() {\r
- return graph;\r
- }\r
-\r
- public Object getResource() {\r
- return resource;\r
- }\r
-\r
- /**\r
- * Mark the event as accepted which suppresses further double click handler\r
- * calls.\r
- */\r
- public void consume() {\r
- consumed = true;\r
- }\r
-\r
- public boolean isConsumed() {\r
- return consumed;\r
- }\r
-\r
- /**\r
- * Add a possible action with normal priority.\r
- * \r
- * @param action\r
- */\r
- public void add(IAction action) {\r
- actions.add(new PriorityActionAdapter(IPriorityAction.NORMAL, action));\r
- }\r
-\r
- /**\r
- * Add a possible prioritized action.\r
- * \r
- * @param action\r
- */\r
- public void add(IPriorityAction action) {\r
- actions.add(action);\r
- }\r
-\r
- /**\r
- * Only used internally by the doubleclick extension point.\r
- * \r
- * @return\r
- */\r
- public IPriorityAction[] getOrderedActions() {\r
- List<IPriorityAction> copy = new ArrayList<IPriorityAction>(actions);\r
- Collections.sort(copy);\r
- return copy.toArray(new IPriorityAction[copy.size()]);\r
- }\r
-\r
- public HintContext getHintContext() {\r
- return hintContext;\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.ui;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.EventObject;
+import java.util.List;
+
+import org.eclipse.jface.action.IAction;
+import org.simantics.db.ReadGraph;
+import org.simantics.utils.datastructures.hints.HintContext;
+import org.simantics.utils.ui.action.IPriorityAction;
+import org.simantics.utils.ui.action.PriorityActionAdapter;
+
+/**
+ * TODO: multiple selection support
+ *
+ * @author Tuukka Lehtonen
+ */
+public class DoubleClickEvent extends EventObject {
+
+ private static final long serialVersionUID = 1730213767249571862L;
+
+ private boolean consumed = false;
+
+ private final ReadGraph graph;
+
+ private final Object resource;
+
+ private List<IPriorityAction> actions = new ArrayList<IPriorityAction>();
+
+ private HintContext hintContext = new HintContext();
+
+ public DoubleClickEvent(Object source, ReadGraph g, Object resource) {
+ super(source);
+ this.graph = g;
+ this.resource = resource;
+ }
+
+ public ReadGraph getGraph() {
+ return graph;
+ }
+
+ public Object getResource() {
+ return resource;
+ }
+
+ /**
+ * Mark the event as accepted which suppresses further double click handler
+ * calls.
+ */
+ public void consume() {
+ consumed = true;
+ }
+
+ public boolean isConsumed() {
+ return consumed;
+ }
+
+ /**
+ * Add a possible action with normal priority.
+ *
+ * @param action
+ */
+ public void add(IAction action) {
+ actions.add(new PriorityActionAdapter(IPriorityAction.NORMAL, action));
+ }
+
+ /**
+ * Add a possible prioritized action.
+ *
+ * @param action
+ */
+ public void add(IPriorityAction action) {
+ actions.add(action);
+ }
+
+ /**
+ * Only used internally by the doubleclick extension point.
+ *
+ * @return
+ */
+ public IPriorityAction[] getOrderedActions() {
+ List<IPriorityAction> copy = new ArrayList<IPriorityAction>(actions);
+ Collections.sort(copy);
+ return copy.toArray(new IPriorityAction[copy.size()]);
+ }
+
+ public HintContext getHintContext() {
+ return hintContext;
+ }
+
+}