Search in sources :

Example 1 with DefinitionListSelectionDialog

use of org.eclipse.titan.designer.finddefinition.DefinitionListSelectionDialog in project titan.EclipsePlug-ins by eclipse.

the class FindDefinitionAction method doFindDefinition.

private void doFindDefinition() {
    final DefinitionListSelectionDialog dialog = new DefinitionListSelectionDialog(Display.getDefault().getActiveShell(), new DefinitionLabelProvider(), getCurrentProject());
    dialog.setTitle("Find Definition");
    dialog.setMessage("Type the name of a definition");
    dialog.setHelpAvailable(false);
    if (targetEditor instanceof TTCN3Editor) {
        selection = ((TTCN3Editor) targetEditor).getSelectionProvider().getSelection();
    }
    if (selection instanceof TextSelection && !selection.isEmpty()) {
        final IPreferencesService prefs = Platform.getPreferencesService();
        final boolean reportDebugInformation = prefs.getBoolean(ProductConstants.PRODUCT_ID_DESIGNER, PreferenceConstants.DISPLAYDEBUGINFORMATION, true, null);
        if (reportDebugInformation) {
            TITANDebugConsole.println("text selected: " + ((TextSelection) selection).getText());
        }
        final TextSelection tSelection = (TextSelection) selection;
        dialog.setFilter(tSelection.getText());
    }
    dialog.init();
    if (dialog.open() == Window.CANCEL || dialog.getFirstResult() == null) {
        return;
    }
    final Object result = dialog.getFirstResult();
    if (!(result instanceof ILocateableNode)) {
        return;
    }
    showInEditor((ILocateableNode) result);
}
Also used : TTCN3Editor(org.eclipse.titan.designer.editors.ttcn3editor.TTCN3Editor) DefinitionListSelectionDialog(org.eclipse.titan.designer.finddefinition.DefinitionListSelectionDialog) TextSelection(org.eclipse.jface.text.TextSelection) ILocateableNode(org.eclipse.titan.designer.AST.ILocateableNode) IPreferencesService(org.eclipse.core.runtime.preferences.IPreferencesService)

Aggregations

IPreferencesService (org.eclipse.core.runtime.preferences.IPreferencesService)1 TextSelection (org.eclipse.jface.text.TextSelection)1 ILocateableNode (org.eclipse.titan.designer.AST.ILocateableNode)1 TTCN3Editor (org.eclipse.titan.designer.editors.ttcn3editor.TTCN3Editor)1 DefinitionListSelectionDialog (org.eclipse.titan.designer.finddefinition.DefinitionListSelectionDialog)1