| /******************************************************************************* |
| * Copyright (c) 2012 SAP AG. |
| * 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: |
| * Georgi Konstantinov - initial API and implementation. |
| *******************************************************************************/ |
| package org.eclipse.wst.sse.sieditor.search.ui.tree; |
| |
| import org.eclipse.jface.resource.ImageRegistry; |
| import org.eclipse.swt.graphics.Image; |
| import org.eclipse.wst.sse.sieditor.model.api.INamespacedObject; |
| import org.eclipse.wst.sse.sieditor.ui.Activator; |
| import org.eclipse.wst.sse.sieditor.ui.v2.UIConstants; |
| import org.eclipse.wst.sse.sieditor.ui.v2.dt.nodes.IDataTypesTreeNode; |
| import org.eclipse.wst.sse.sieditor.ui.v2.nodes.ITreeNode; |
| |
| public class NamespaceNode extends AbstractTreeNode implements IDataTypesTreeNode { |
| |
| private INamespacedObject namespacedObject; |
| |
| public NamespaceNode(INamespacedObject namespacedObject, ITreeNode parent) { |
| super(parent, namespacedObject); |
| this.namespacedObject = namespacedObject; |
| } |
| |
| private String getNamespaceDisplayText() { |
| String namespace = namespacedObject.getNamespace(); |
| if (namespace == null || UIConstants.EMPTY_STRING.equals(namespace.trim())) { |
| return org.eclipse.wst.sse.sieditor.ui.v2.dt.nodes.impl.NamespaceNode.NO_NS_STRING; |
| } |
| return namespace; |
| } |
| |
| @Override |
| public Image getImage() { |
| return getImageRegistry().get(Activator.NODE_NAMESPACE); |
| } |
| |
| protected ImageRegistry getImageRegistry() { |
| return Activator.getDefault().getImageRegistry(); |
| } |
| |
| @Override |
| public String getDisplayName() { |
| return getNamespaceDisplayText(); |
| } |
| |
| @Override |
| public String getTreeDisplayText() { |
| return getNamespaceDisplayText(); |
| } |
| |
| @Override |
| public String getTypeDisplayText() { |
| return getNamespaceDisplayText(); |
| } |
| } |