]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.browsing.ui.model/src/org/simantics/browsing/ui/model/modifiers/NoModifierRule.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.browsing.ui.model / src / org / simantics / browsing / ui / model / modifiers / NoModifierRule.java
1 /*******************************************************************************\r
2  * Copyright (c) 2007, 2011 Association for Decentralized Information Management\r
3  * in Industry THTH ry.\r
4  * All rights reserved. This program and the accompanying materials\r
5  * are made available under the terms of the Eclipse Public License v1.0\r
6  * which accompanies this distribution, and is available at\r
7  * http://www.eclipse.org/legal/epl-v10.html\r
8  *\r
9  * Contributors:\r
10  *     VTT Technical Research Centre of Finland - initial API and implementation\r
11  *******************************************************************************/\r
12 package org.simantics.browsing.ui.model.modifiers;\r
13 \r
14 import org.simantics.browsing.ui.content.Labeler.Modifier;\r
15 import org.simantics.browsing.ui.model.browsecontexts.BrowseContext;\r
16 import org.simantics.db.ReadGraph;\r
17 import org.simantics.db.exception.DatabaseException;\r
18 \r
19 /**\r
20  * @author Tuukka Lehtonen\r
21  */\r
22 public enum NoModifierRule implements ModifierRule {\r
23 \r
24     INSTANCE;\r
25 \r
26     /**\r
27      * This modifier is fixed to indicate that there shall be no modifier. It is\r
28      * processed in\r
29      * {@link BrowseContext#getModifier(ReadGraph, org.simantics.browsing.ui.NodeContext, String)}\r
30      * .\r
31      */\r
32     public static Modifier NO_MODIFIER = new Modifier() {\r
33         @Override\r
34         public String getValue() {\r
35             throw new UnsupportedOperationException();\r
36         }\r
37         @Override\r
38         public String isValid(String label) {\r
39             throw new UnsupportedOperationException();\r
40         }\r
41         @Override\r
42         public void modify(String label) {\r
43             throw new UnsupportedOperationException();\r
44         }\r
45     };\r
46 \r
47     public static NoModifierRule get() {\r
48         return INSTANCE;\r
49     }\r
50 \r
51     /**\r
52      * Compatible with any content type.\r
53      */\r
54     @Override\r
55     public boolean isCompatible(Class<?> contentType) {\r
56         return true;\r
57     }\r
58 \r
59     @Override\r
60     public Modifier getModifier(ReadGraph graph, Object content,\r
61             String columnKey) throws DatabaseException {\r
62         return NO_MODIFIER;\r
63     }\r
64 \r
65 }\r