use of org.springframework.tooling.ls.eclipse.gotosymbol.dialogs.GotoSymbolDialogModel.Match in project sts4 by spring-projects.
the class GotoSymbolDialog method getFirstElement.
private SymbolInformation getFirstElement(TreeViewer list) {
TreeItem[] items = list.getTree().getItems();
if (items != null && items.length > 0) {
TreeItem item = items[0];
Object data = item.getData();
if (data instanceof Match) {
data = ((Match<?>) data).value;
if (data instanceof SymbolInformation) {
return (SymbolInformation) data;
}
}
}
return null;
}
use of org.springframework.tooling.ls.eclipse.gotosymbol.dialogs.GotoSymbolDialogModel.Match in project sts4 by spring-projects.
the class GotoSymbolDialog method getTarget.
/**
* Determine the 'target' for the dialog's action.
*/
private SymbolInformation getTarget(TreeViewer list) {
ISelection sel = list.getSelection();
if (sel instanceof IStructuredSelection) {
IStructuredSelection ss = (IStructuredSelection) sel;
Object selected = ss.getFirstElement();
if (selected instanceof Match) {
selected = ((Match<?>) selected).value;
if (selected instanceof SymbolInformation) {
return (SymbolInformation) selected;
}
}
}
// This allows user to execute the action without explicitly selecting an element.
return getFirstElement(list);
}
Aggregations