Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
CometeSWT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Software Control System
Libraries
java
CometeSWT
Commits
7b03c825
Commit
7b03c825
authored
Dec 16, 2014
by
Katy Saintin
Browse files
Options
Downloads
Patches
Plain Diff
Manage ToolTip on Tree
parent
bd43b04c
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/fr/soleil/comete/swt/Tree.java
+29
-7
29 additions, 7 deletions
src/main/java/fr/soleil/comete/swt/Tree.java
with
29 additions
and
7 deletions
src/main/java/fr/soleil/comete/swt/Tree.java
+
29
−
7
View file @
7b03c825
...
...
@@ -34,6 +34,8 @@ import org.eclipse.swt.graphics.Rectangle;
import
org.eclipse.swt.layout.FillLayout
;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.swt.widgets.Display
;
import
org.eclipse.swt.widgets.Event
;
import
org.eclipse.swt.widgets.Listener
;
import
org.eclipse.swt.widgets.Shell
;
import
org.eclipse.swt.widgets.TreeItem
;
...
...
@@ -74,11 +76,34 @@ public class Tree extends CometeComposite<org.eclipse.swt.widgets.Tree> implemen
@Override
protected
org
.
eclipse
.
swt
.
widgets
.
Tree
initControl
(
int
childStyle
)
{
org
.
eclipse
.
swt
.
widgets
.
Tree
tree
=
new
org
.
eclipse
.
swt
.
widgets
.
Tree
(
this
,
childStyle
);
final
org
.
eclipse
.
swt
.
widgets
.
Tree
tree
=
new
org
.
eclipse
.
swt
.
widgets
.
Tree
(
this
,
childStyle
);
tree
.
addSelectionListener
(
this
);
tree
.
addListener
(
SWT
.
MouseMove
,
new
Listener
()
{
public
void
handleEvent
(
Event
event
)
{
ITreeNode
treeNode
=
getTreeNode
(
event
.
x
,
event
.
y
);
if
(
treeNode
!=
null
)
{
tree
.
setToolTipText
(
treeNode
.
getToolTip
());
}
else
{
tree
.
setToolTipText
(
null
);
}
}
});
return
tree
;
}
private
ITreeNode
getTreeNode
(
int
x
,
int
y
)
{
ITreeNode
treeNode
=
null
;
if
((
getControl
()
!=
null
)
&&
!
getControl
().
isDisposed
())
{
org
.
eclipse
.
swt
.
widgets
.
Tree
tree
=
getControl
();
Point
point
=
new
Point
(
x
,
y
);
TreeItem
item
=
tree
.
getItem
(
point
);
if
(
item
!=
null
)
{
treeNode
=
TreeNodeTool
.
findTreeNodeForTreeItem
(
item
,
rootNode
);
}
}
return
treeNode
;
}
@Override
public
ITreeNode
getRootNode
()
{
return
rootNode
;
...
...
@@ -94,7 +119,6 @@ public class Tree extends CometeComposite<org.eclipse.swt.widgets.Tree> implemen
if
(!
getControl
().
isDisposed
())
{
// remove all nodes to keep a single root, as swt allows multiple roots
getControl
().
removeAll
();
TreeNodeTool
.
createRootTreeNode
(
getControl
(),
aRootNode
);
rootNode
=
aRootNode
;
}
...
...
@@ -126,14 +150,12 @@ public class Tree extends CometeComposite<org.eclipse.swt.widgets.Tree> implemen
@Override
public
void
run
()
{
if
(!
getControl
().
isDisposed
())
{
// remove all nodes to keep a single root, as swt allows multiple roots
TreeItem
parentItem
=
getControl
().
getParentItem
();
if
(
parentItem
!=
null
)
{
parentItem
.
setExpanded
(
expend
);
TreeItem
topItem
=
getControl
().
getTopItem
();
if
(
topItem
!=
null
)
{
topItem
.
setExpanded
(
expend
);
}
}
}
});
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment