]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - server/plugins/org.argeo.jcr.ui.explorer/src/main/java/org/argeo/jcr/ui/explorer/providers/VersionLabelProvider.java
2 * Copyright (C) 2007-2012 Argeo GmbH
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org
.argeo
.jcr
.ui
.explorer
.providers
;
18 import javax
.jcr
.Node
;
19 import javax
.jcr
.RepositoryException
;
20 import javax
.jcr
.version
.Version
;
22 import org
.argeo
.ArgeoException
;
23 import org
.eclipse
.jface
.viewers
.ColumnLabelProvider
;
26 * simple wrapping of the ColumnLabelProvider class to provide text display in
27 * order to build a tree for version. The Get text method does not assume that
28 * Version extends Node class to respect JCR 2.0 specification
31 public class VersionLabelProvider
extends ColumnLabelProvider
{
33 public String
getText(Object element
) {
35 if (element
instanceof Version
) {
36 Version version
= (Version
) element
;
37 return version
.getName();
38 } else if (element
instanceof Node
) {
39 return ((Node
) element
).getName();
41 } catch (RepositoryException re
) {
42 throw new ArgeoException(
43 "Unexpected error while getting element name", re
);
45 return super.getText(element
);