X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.utils.ui%2Fsrc%2Forg%2Fsimantics%2Futils%2Fui%2Faction%2FPriorityAction.java;fp=bundles%2Forg.simantics.utils.ui%2Fsrc%2Forg%2Fsimantics%2Futils%2Fui%2Faction%2FPriorityAction.java;h=c08d063453b4ec4c61fd54057e7b34ea4f9cb5d9;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hp=92e3f647923c346392ddb43938f69ef20de90cc1;hpb=24e2b34260f219f0d1644ca7a138894980e25b14;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.utils.ui/src/org/simantics/utils/ui/action/PriorityAction.java b/bundles/org.simantics.utils.ui/src/org/simantics/utils/ui/action/PriorityAction.java index 92e3f6479..c08d06345 100644 --- a/bundles/org.simantics.utils.ui/src/org/simantics/utils/ui/action/PriorityAction.java +++ b/bundles/org.simantics.utils.ui/src/org/simantics/utils/ui/action/PriorityAction.java @@ -1,84 +1,84 @@ -/******************************************************************************* - * 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; - } - -} +/******************************************************************************* + * 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; + } + +}