Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
af3
kernel
Commits
4ec19b23
Commit
4ec19b23
authored
Jun 08, 2016
by
Simon Barner
Browse files
- Enforce full update of annotation views on setUpdateEnabled(true)
parent
e7740cdf
Changes
1
Hide whitespace changes
Inline
Side-by-side
org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/annotation/view/AnnotationViewPartBase.java
View file @
4ec19b23
...
...
@@ -60,7 +60,7 @@ import org.fortiss.tooling.kernel.service.IPersistencyService;
* @author barner
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash:
E5338A681AFA613876C560BD968F34A9
* @ConQAT.Rating YELLOW Hash:
B5EED9862BC0107F49D3E471B16282D7
*/
public
abstract
class
AnnotationViewPartBase
extends
ViewPart
implements
ISelectionListener
,
IAnnotationViewPart
{
...
...
@@ -71,6 +71,9 @@ public abstract class AnnotationViewPartBase extends ViewPart implements ISelect
/** Last selected object. */
private
IModelElement
lastSelectedObject
;
/** Last root element determined during the last successful {@link #update(IModelElement)}. */
private
IProjectRootElement
lastRootElement
;
/**
* Root element for which the {@link #changeListener} has been installed to (recursively)
* watch for model changes (to trigger an update of this {@link AnnotationViewPartBase}).
...
...
@@ -229,11 +232,19 @@ public abstract class AnnotationViewPartBase extends ViewPart implements ISelect
* {@link #update(Collection)}, and update model change listeners.
*/
protected
void
update
(
IModelElement
modelElement
)
{
EObject
rootElement
=
getParentElement
(
modelElement
,
IProjectRootElement
.
class
,
true
);
IProjectRootElement
rootElement
=
getParentElement
(
modelElement
,
IProjectRootElement
.
class
,
true
);
if
(
rootElement
==
null
)
{
return
;
}
lastRootElement
=
rootElement
;
update
(
rootElement
);
}
/** Perform update for given {@link IProjectRootElement}. */
private
void
update
(
IProjectRootElement
rootElement
)
{
// Check cache if annotation entries for the given root element have already been determined
Collection
<
AnnotationEntry
>
annotationEntries
=
lastAnnotationEntriesMap
.
get
(
rootElement
);
...
...
@@ -315,6 +326,12 @@ public abstract class AnnotationViewPartBase extends ViewPart implements ISelect
activeInstances
.
remove
(
this
);
}
/** Enforces a full update of the view based on {@link #lastRootElement}. */
private
void
forceFullUpdate
()
{
lastAnnotationEntriesMap
.
clear
();
update
(
lastRootElement
);
}
/** Sets {@link #isUpdateEnabled}. If the update is re-enabled, the view is refreshed. */
public
static
synchronized
void
setUpdateEnabled
(
boolean
isUpdateEnabled
)
{
AnnotationViewPartBase
.
isUpdateEnabled
=
isUpdateEnabled
;
...
...
@@ -323,7 +340,7 @@ public abstract class AnnotationViewPartBase extends ViewPart implements ISelect
@Override
public
void
run
()
{
for
(
AnnotationViewPartBase
avp
:
activeInstances
)
{
avp
.
u
pdate
();
avp
.
forceFullU
pdate
();
}
}
});
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment