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