use of org.eclipse.wst.sse.ui.internal.contentoutline.IJFaceNodeAdapter in project webtools.sourceediting by eclipse.
the class JFaceNodeLabelProviderCSS method getText.
/**
* Returns the text for the label of the given element, for use in the
* given viewer.
*
* @param viewer
* The viewer that displays the element.
* @param element
* The element for which to provide the label text. Element can
* be <code>null</code> indicating no input object is set to
* the viewer.
*/
public String getText(Object element) {
String text = null;
IJFaceNodeAdapter adapter = getAdapter(element);
if (adapter != null) {
text = adapter.getLabelText(element);
}
return text;
}
use of org.eclipse.wst.sse.ui.internal.contentoutline.IJFaceNodeAdapter in project webtools.sourceediting by eclipse.
the class JFaceNodeContentProvider method getElements.
public Object[] getElements(Object object) {
// The root is usually an instance of an XMLStructuredModel in
// which case we want to extract the document.
Object topNode = object;
if (object instanceof IDOMModel) {
topNode = ((IDOMModel) object).getDocument();
}
IJFaceNodeAdapter adapter = getAdapter(topNode);
if (adapter != null) {
return adapter.getElements(topNode);
}
return new Object[0];
}
use of org.eclipse.wst.sse.ui.internal.contentoutline.IJFaceNodeAdapter in project webtools.sourceediting by eclipse.
the class JFaceNodeLabelProviderXPath method getText.
public String getText(Object element) {
if (element instanceof EmptyNodeList) {
return NO_MATCHES;
}
IJFaceNodeAdapter adapter = getAdapter(element);
if (adapter == null) {
// Could be our fake "AnyValue" Text node
if (element instanceof Text) {
return ((Text) element).getData();
} else {
return element.toString();
}
}
StringBuffer sb = new StringBuffer(adapter.getLabelText(element));
if (element instanceof Element) {
Element impl = (Element) element;
NamedNodeMap nnm = impl.getAttributes();
if (nnm.getLength() > 0) {
Attr a = (Attr) nnm.item(0);
String val = a.getNodeValue();
sb.append(" ").append(a.getName()).append("=").append(val);
}
}
return sb.toString();
}
use of org.eclipse.wst.sse.ui.internal.contentoutline.IJFaceNodeAdapter in project webtools.sourceediting by eclipse.
the class JFaceNodeContentProviderXPath method getElements.
public Object[] getElements(Object object) {
if (object instanceof IDOMModel) {
Object topNode = ((IDOMModel) object).getDocument();
IJFaceNodeAdapter adapter = getAdapter(topNode);
if (adapter != null) {
return adapter.getElements(topNode);
}
} else if (object instanceof NodeList) {
NodeList nodeList = (NodeList) object;
if (nodeList.getLength() == 0) {
return new Object[] { new EmptyNodeList() };
} else {
Node[] nodes = new Node[nodeList.getLength()];
for (int i = 0; i < nodes.length; i++) {
nodes[i] = nodeList.item(i);
}
return nodes;
}
}
return new Object[0];
}
use of org.eclipse.wst.sse.ui.internal.contentoutline.IJFaceNodeAdapter in project webtools.sourceediting by eclipse.
the class JFaceNodeLabelProviderCSS method getImage.
/**
* Returns the image for the label of the given element, for use in the
* given viewer.
*
* @param viewer
* The viewer that displays the element.
* @param element
* The element for which to provide the label image. Element
* can be <code>null</code> indicating no input object is set
* to the viewer.
*/
public Image getImage(Object element) {
Image image = null;
IJFaceNodeAdapter adapter = getAdapter(element);
if (adapter != null)
image = adapter.getLabelImage(element);
return image;
}
Aggregations