X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics%2Fsrc%2Forg%2Fsimantics%2FNameLabelMode.java;h=6273db7de96ab2a15e186f4c7635c3526beab1d3;hb=HEAD;hp=7c5d1518cbd8413fa2bf0988ee35d5a22c9949d2;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics/src/org/simantics/NameLabelMode.java b/bundles/org.simantics/src/org/simantics/NameLabelMode.java index 7c5d1518c..6273db7de 100644 --- a/bundles/org.simantics/src/org/simantics/NameLabelMode.java +++ b/bundles/org.simantics/src/org/simantics/NameLabelMode.java @@ -1,61 +1,61 @@ -/******************************************************************************* - * Copyright (c) 2013 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: - * Semamtum Oy - initial API and implementation - *******************************************************************************/ -package org.simantics; - -import org.simantics.db.Resource; -import org.simantics.platform.ui.PlatformUIResource; - -/** - * @author Antti Villberg - * @see NameLabelUtil - */ -public enum NameLabelMode { - - NAME("Name"), - LABEL("Label"), - NAME_AND_LABEL("Name (Label)"), - LABEL_AND_NAME("Label (Name)"); - - private String label; - - NameLabelMode(String label) { - this.label = label; - } - - public String getLabel() { - return label; - } - - public NameLabelMode cycle() { - if(NAME == this) return LABEL; - else if (LABEL == this) return NAME_AND_LABEL; - else if (NAME_AND_LABEL == this) return LABEL_AND_NAME; - else return NAME; - } - - public Resource asResource(PlatformUIResource UI) { - if(NAME == this) return UI.NameLabelMode_Name; - else if (LABEL == this) return UI.NameLabelMode_Label; - else if (LABEL_AND_NAME == this) return UI.NameLabelMode_LabelAndName; - else return UI.NameLabelMode_NameAndLabel; - } - - public static NameLabelMode fromString(String value) { - if(value == null) return getDefault(); - else return valueOf(value); - } - - public static NameLabelMode getDefault() { - return NAME_AND_LABEL; - } - +/******************************************************************************* + * Copyright (c) 2013 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: + * Semamtum Oy - initial API and implementation + *******************************************************************************/ +package org.simantics; + +import org.simantics.db.Resource; +import org.simantics.platform.ui.PlatformUIResource; + +/** + * @author Antti Villberg + * @see NameLabelUtil + */ +public enum NameLabelMode { + + NAME("Name"), + LABEL("Label"), + NAME_AND_LABEL("Name (Label)"), + LABEL_AND_NAME("Label (Name)"); + + private String label; + + NameLabelMode(String label) { + this.label = label; + } + + public String getLabel() { + return label; + } + + public NameLabelMode cycle() { + if(NAME == this) return LABEL; + else if (LABEL == this) return NAME_AND_LABEL; + else if (NAME_AND_LABEL == this) return LABEL_AND_NAME; + else return NAME; + } + + public Resource asResource(PlatformUIResource UI) { + if(NAME == this) return UI.NameLabelMode_Name; + else if (LABEL == this) return UI.NameLabelMode_Label; + else if (LABEL_AND_NAME == this) return UI.NameLabelMode_LabelAndName; + else return UI.NameLabelMode_NameAndLabel; + } + + public static NameLabelMode fromString(String value) { + if(value == null) return getDefault(); + else return valueOf(value); + } + + public static NameLabelMode getDefault() { + return NAME_AND_LABEL; + } + } \ No newline at end of file