use of org.eclipse.titan.designer.AST.IOutlineElement in project titan.EclipsePlug-ins by eclipse.
the class OutlineLabelProvider method getText.
@Override
public String getText(final Object element) {
Identifier identifier = null;
if (element instanceof IOutlineElement) {
IOutlineElement e = (IOutlineElement) element;
String outlineText = e.getOutlineText();
if (outlineText.length() != 0) {
return outlineText;
}
identifier = e.getIdentifier();
}
if (identifier == null) {
return "unknown";
}
return identifier.getDisplayName();
}
use of org.eclipse.titan.designer.AST.IOutlineElement in project titan.EclipsePlug-ins by eclipse.
the class OutlinePage method selectionChanged.
@Override
public void selectionChanged(final SelectionChangedEvent event) {
super.selectionChanged(event);
ISelection selection = event.getSelection();
if (selection.isEmpty()) {
return;
}
Object selectedElement = ((IStructuredSelection) selection).getFirstElement();
Identifier identifier = null;
if (selectedElement instanceof IOutlineElement) {
identifier = ((IOutlineElement) selectedElement).getIdentifier();
}
if (identifier == null || identifier.getLocation() == null) {
return;
}
Location location = identifier.getLocation();
editor.selectAndReveal(location.getOffset(), location.getEndOffset() - location.getOffset());
}
use of org.eclipse.titan.designer.AST.IOutlineElement in project titan.EclipsePlug-ins by eclipse.
the class OutlineLabelProvider method getText.
@Override
public String getText(final Object element) {
Identifier identifier = null;
if (element instanceof IOutlineElement) {
IOutlineElement e = (IOutlineElement) element;
String outlineText = e.getOutlineText();
if (outlineText.length() != 0) {
return outlineText;
}
identifier = e.getIdentifier();
} else if (element instanceof List<?>) {
return "imports";
}
if (identifier == null) {
return "unknown";
}
return identifier.getDisplayName();
}
use of org.eclipse.titan.designer.AST.IOutlineElement in project titan.EclipsePlug-ins by eclipse.
the class OutlinePage method selectionChanged.
@Override
public void selectionChanged(final SelectionChangedEvent event) {
super.selectionChanged(event);
ISelection selection = event.getSelection();
if (selection.isEmpty()) {
return;
}
Object selectedElement = ((IStructuredSelection) selection).getFirstElement();
Identifier identifier = null;
if (selectedElement instanceof IOutlineElement) {
identifier = ((IOutlineElement) selectedElement).getIdentifier();
}
if (identifier == null || identifier.getLocation() == null) {
return;
}
Location location = identifier.getLocation();
editor.selectAndReveal(location.getOffset(), location.getEndOffset() - location.getOffset());
}
use of org.eclipse.titan.designer.AST.IOutlineElement in project titan.EclipsePlug-ins by eclipse.
the class OutlineLabelProvider method getImage.
@Override
public Image getImage(final Object element) {
String iconName = "titan.gif";
if (element instanceof IOutlineElement) {
IOutlineElement e = (IOutlineElement) element;
iconName = e.getOutlineIcon();
} else if (element instanceof List<?>) {
iconName = "imports.gif";
}
return ImageCache.getImage(iconName);
}
Aggregations