Search in sources :

Example 1 with IOutlineElement

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();
}
Also used : Identifier(org.eclipse.titan.designer.AST.Identifier) IOutlineElement(org.eclipse.titan.designer.AST.IOutlineElement)

Example 2 with IOutlineElement

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());
}
Also used : Identifier(org.eclipse.titan.designer.AST.Identifier) ISelection(org.eclipse.jface.viewers.ISelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) IOutlineElement(org.eclipse.titan.designer.AST.IOutlineElement) Location(org.eclipse.titan.designer.AST.Location)

Example 3 with IOutlineElement

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();
}
Also used : Identifier(org.eclipse.titan.designer.AST.Identifier) IOutlineElement(org.eclipse.titan.designer.AST.IOutlineElement)

Example 4 with IOutlineElement

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());
}
Also used : Identifier(org.eclipse.titan.designer.AST.Identifier) ISelection(org.eclipse.jface.viewers.ISelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) IOutlineElement(org.eclipse.titan.designer.AST.IOutlineElement) Location(org.eclipse.titan.designer.AST.Location)

Example 5 with IOutlineElement

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);
}
Also used : IOutlineElement(org.eclipse.titan.designer.AST.IOutlineElement)

Aggregations

IOutlineElement (org.eclipse.titan.designer.AST.IOutlineElement)7 Identifier (org.eclipse.titan.designer.AST.Identifier)4 ISelection (org.eclipse.jface.viewers.ISelection)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 Location (org.eclipse.titan.designer.AST.Location)2