Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Arpad Lovassy
titan.EclipsePlug-ins
Commits
c6f5fce6
Commit
c6f5fce6
authored
May 24, 2022
by
Miklos Magyari
Committed by
Arpad Lovassy
May 24, 2022
Browse files
Fixed cursor navigation for outline selection (issue
#488
)
parent
3068817d
Changes
2
Hide whitespace changes
Inline
Side-by-side
org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/ttcn3editor/OutlinePage.java
View file @
c6f5fce6
...
...
@@ -40,7 +40,12 @@ import org.eclipse.titan.designer.parsers.GlobalParser;
import
org.eclipse.titan.designer.parsers.ProjectSourceParser
;
import
org.eclipse.titan.designer.preferences.PreferenceConstants
;
import
org.eclipse.ui.IActionBars
;
import
org.eclipse.ui.IWorkbench
;
import
org.eclipse.ui.IWorkbenchPage
;
import
org.eclipse.ui.IWorkbenchPart
;
import
org.eclipse.ui.PlatformUI
;
import
org.eclipse.ui.texteditor.AbstractTextEditor
;
import
org.eclipse.ui.views.contentoutline.ContentOutline
;
import
org.eclipse.ui.views.contentoutline.ContentOutlinePage
;
/**
...
...
@@ -341,24 +346,31 @@ public final class OutlinePage extends ContentOutlinePage {
public
void
selectionChanged
(
final
SelectionChangedEvent
event
)
{
super
.
selectionChanged
(
event
);
final
I
Selection
selection
=
event
.
getSelection
();
if
(
selection
.
isEmpty
()
)
{
final
I
WorkbenchPage
page
=
PlatformUI
.
getWorkbench
().
getActiveWorkbenchWindow
().
getActivePage
();
if
(
page
==
null
)
{
return
;
}
final
Object
selectedElement
=
((
IStructuredSelection
)
selection
).
getFirstElement
();
Identifier
identifier
=
null
;
if
(
selectedElement
instanceof
IOutlineElement
)
{
identifier
=
((
IOutlineElement
)
selectedElement
).
getIdentifier
();
}
if
(
identifier
==
null
||
identifier
.
getLocation
()
==
null
)
{
return
;
final
IWorkbenchPart
part
=
page
.
getActivePart
();
if
(
part
instanceof
ContentOutline
)
{
final
ISelection
selection
=
event
.
getSelection
();
if
(
selection
.
isEmpty
())
{
return
;
}
final
Object
selectedElement
=
((
IStructuredSelection
)
selection
).
getFirstElement
();
Identifier
identifier
=
null
;
if
(
selectedElement
instanceof
IOutlineElement
)
{
identifier
=
((
IOutlineElement
)
selectedElement
).
getIdentifier
();
}
if
(
identifier
==
null
||
identifier
.
getLocation
()
==
null
)
{
return
;
}
final
Location
location
=
identifier
.
getLocation
();
editor
.
selectAndReveal
(
location
.
getOffset
(),
location
.
getEndOffset
()
-
location
.
getOffset
());
}
final
Location
location
=
identifier
.
getLocation
();
editor
.
selectAndReveal
(
location
.
getOffset
(),
location
.
getEndOffset
()
-
location
.
getOffset
());
}
private
Module
getModule
()
{
...
...
org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/ttcn3editor/TTCN3Editor.java
View file @
c6f5fce6
...
...
@@ -37,10 +37,13 @@ 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.jface.viewers.TreePath
;
import
org.eclipse.jface.viewers.TreeSelection
;
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.Assignment
;
import
org.eclipse.titan.designer.AST.Module
;
import
org.eclipse.titan.designer.declarationsearch.Declaration
;
import
org.eclipse.titan.designer.declarationsearch.IdentifierFinderVisitor
;
...
...
@@ -463,10 +466,15 @@ public final class TTCN3Editor extends AbstractDecoratedTextEditor implements IS
if
(
declaration
==
null
)
{
return
;
}
Object
segments
[]
=
new
Object
[
2
];
segments
[
1
]
=
declaration
.
getAssignment
();
outlinePage
.
setSelection
(
new
StructuredSelection
(
segments
));
TreeSelection
selection
=
(
TreeSelection
)
outlinePage
.
getSelection
();
TreePath
[]
paths
=
selection
.
getPaths
();
TreePath
tp
=
paths
.
length
>
0
?
paths
[
0
]
:
null
;
if
(
tp
==
null
||
!
tp
.
getLastSegment
().
equals
(
declaration
.
getAssignment
()))
{
Object
segments
[]
=
new
Object
[
2
];
segments
[
1
]
=
declaration
.
getAssignment
();
outlinePage
.
setSelection
(
new
StructuredSelection
(
segments
));
}
}
@Override
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment