Commit 813a29e1 authored by Miklos Magyari's avatar Miklos Magyari
Browse files

When navigating in the ttcn3 source, select the corresponding outline item


Signed-off-by: Miklos Magyari's avatarMiklos Magyari <miklos.magyari@sigmatechnology.se>
parent 5e441d4e
/******************************************************************************
* Copyright (c) 2000-2021 Ericsson Telecom AB
* Copyright (c) 2000-2022 Ericsson Telecom AB
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
......@@ -36,10 +36,14 @@ import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.titan.designer.Activator;
import org.eclipse.titan.designer.HeadlessStorage;
import org.eclipse.titan.designer.AST.Module;
import org.eclipse.titan.designer.declarationsearch.Declaration;
import org.eclipse.titan.designer.declarationsearch.IdentifierFinderVisitor;
import org.eclipse.titan.designer.editors.ColorManager;
import org.eclipse.titan.designer.editors.EditorTracker;
import org.eclipse.titan.designer.editors.FoldingSupport;
......@@ -140,6 +144,8 @@ public final class TTCN3Editor extends AbstractDecoratedTextEditor implements IS
}
}
};
private SemanticHighlightingListener semanticHighlightingListener = null;
......@@ -444,6 +450,23 @@ public final class TTCN3Editor extends AbstractDecoratedTextEditor implements IS
super.handleCursorPositionChanged();
occurrencesMarker.markOccurences(getDocument(), getCarretOffset());
final IFile file = getEditorInput().getAdapter(IFile.class);
final ProjectSourceParser projectSourceParser = GlobalParser.getProjectSourceParser(file.getProject());
final Module tempModule = projectSourceParser.containedModule(file);
if (tempModule == null) {
return;
}
final IdentifierFinderVisitor visitor = new IdentifierFinderVisitor(getCarretOffset());
tempModule.accept(visitor);
final Declaration declaration = visitor.getReferencedDeclaration();
if (declaration == null) {
return;
}
Object segments[] = new Object[2];
segments[1] = declaration.getAssignment();
outlinePage.setSelection(new StructuredSelection(segments));
}
@Override
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment