-/*******************************************************************************\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.utils.ui.action;\r
-\r
-import org.eclipse.jface.action.Action;\r
-import org.eclipse.jface.resource.ImageDescriptor;\r
-\r
-/**\r
- * Extendable implementation of {@link IPriorityAction} based on {@link Action}.\r
- * PriorityActions are comparable by their priorities.\r
- * \r
- * Note: this class has a natural ordering that is inconsistent with equals.\r
- * \r
- * @author Tuukka Lehtonen\r
- */\r
-public class PriorityAction extends Action implements IPriorityAction {\r
-\r
- private final int priority;\r
- \r
- public PriorityAction() {\r
- super();\r
- this.priority = IPriorityAction.NORMAL;\r
- }\r
-\r
- public PriorityAction(String text, ImageDescriptor image) {\r
- super(text, image);\r
- this.priority = IPriorityAction.NORMAL;\r
- }\r
-\r
- public PriorityAction(String text, int style) {\r
- super(text, style);\r
- this.priority = IPriorityAction.NORMAL;\r
- }\r
-\r
- public PriorityAction(String text) {\r
- super(text);\r
- this.priority = IPriorityAction.NORMAL;\r
- }\r
-\r
- public PriorityAction(int priority) {\r
- super();\r
- this.priority = priority;\r
- }\r
-\r
- public PriorityAction(int priority, String text, ImageDescriptor image) {\r
- super(text, image);\r
- this.priority = priority;\r
- }\r
-\r
- public PriorityAction(int priority, String text, int style) {\r
- super(text, style);\r
- this.priority = priority;\r
- }\r
-\r
- public PriorityAction(int priority, String text) {\r
- super(text);\r
- this.priority = priority;\r
- }\r
- \r
- /* (non-Javadoc)\r
- * @see org.simantics.utils.ui.action.IPriorityAction#getPriority()\r
- */\r
- public int getPriority() {\r
- return priority;\r
- }\r
-\r
- public int compareTo(IPriorityAction o) {\r
- int op = o.getPriority();\r
- // delta < 0 when priority < op\r
- // delta > 0 when priority > op\r
- int delta = op - getPriority();\r
- return delta;\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.utils.ui.action;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.resource.ImageDescriptor;
+
+/**
+ * Extendable implementation of {@link IPriorityAction} based on {@link Action}.
+ * PriorityActions are comparable by their priorities.
+ *
+ * Note: this class has a natural ordering that is inconsistent with equals.
+ *
+ * @author Tuukka Lehtonen
+ */
+public class PriorityAction extends Action implements IPriorityAction {
+
+ private final int priority;
+
+ public PriorityAction() {
+ super();
+ this.priority = IPriorityAction.NORMAL;
+ }
+
+ public PriorityAction(String text, ImageDescriptor image) {
+ super(text, image);
+ this.priority = IPriorityAction.NORMAL;
+ }
+
+ public PriorityAction(String text, int style) {
+ super(text, style);
+ this.priority = IPriorityAction.NORMAL;
+ }
+
+ public PriorityAction(String text) {
+ super(text);
+ this.priority = IPriorityAction.NORMAL;
+ }
+
+ public PriorityAction(int priority) {
+ super();
+ this.priority = priority;
+ }
+
+ public PriorityAction(int priority, String text, ImageDescriptor image) {
+ super(text, image);
+ this.priority = priority;
+ }
+
+ public PriorityAction(int priority, String text, int style) {
+ super(text, style);
+ this.priority = priority;
+ }
+
+ public PriorityAction(int priority, String text) {
+ super(text);
+ this.priority = priority;
+ }
+
+ /* (non-Javadoc)
+ * @see org.simantics.utils.ui.action.IPriorityAction#getPriority()
+ */
+ public int getPriority() {
+ return priority;
+ }
+
+ public int compareTo(IPriorityAction o) {
+ int op = o.getPriority();
+ // delta < 0 when priority < op
+ // delta > 0 when priority > op
+ int delta = op - getPriority();
+ return delta;
+ }
+
+}