Am 04.11.2011 14:05, schrieb Jörn Kottmann:
On 11/4/11 1:37 PM, Peter Klügl (Commented) (JIRA) wrote:
[
https://issues.apache.org/jira/browse/UIMA-2273?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13143958#comment-13143958
]
Peter Klügl commented on UIMA-2273:
-----------------------------------
I wonder a bit about two methods:
FeatureStructureTreeContentProvider (fsview)
public void inputChanged(Viewer viewer, Object oldInput, Object
newInput) {
if (oldInput != null) {
mDocument.removeChangeListener(this);
}
if (newInput == null) {
mCurrentType = null;
return;
}
mCurrentType = (Type) newInput;
mDocument.addChangeListener(this);
Display.getDefault().syncExec(new Runnable() {
public void run() {
mFSList.refresh();
}
});
}
This one gets a ICasDocument, and then just does a complete refresh,
but if I remember correctly
the combo box which contains the types must also be updated.
But isn't a type given? (mCurrentType = (Type) newInput;). The listener
of the document isn't replaced here since the field and not the argument
is used. I added that logic to the casDocumentChanged method now and
waiting for your feedback.
FeatureStructureContentProvider (editview)
public void inputChanged(final Viewer viewer, Object oldInput, Object
newInput) {
this.viewer = viewer;
if (newInput != null) {
Display.getDefault().syncExec(new Runnable() {
public void run() {
viewer.refresh();
}
});
}
}
Both methods do not contain any logic for exchanging the listener and
do not use the the document as input (needs to be set). So I guess I
implement the logic in the new casDocumentChanged method?
The later one just needs a type system and does not need to register
any listeners, because the type system cannot change,
even not when you change the CAS view. We should clean the code up to
pass this in via setInput.
Oh, the type system cannot change? I have a use case where this can
happen easily. Sometime in future, I really like to have this
functionality :-)
Didn't we want to move casDocumentChanged to an ICasEditorListener?
There the casDocumenChanged method implementation
should call setInput, and the setInput logic should be fixed to work
properly.
Committed. Haven't had a closer look at the logic yet, so I just added
inputChanged(mFSList, mCurrentType, mCurrentType);
Peter
--
---------------------------------------------------------------------
Dipl.-Inf. Peter Klügl
Universität Würzburg Tel.: +49-(0)931-31-86741
Am Hubland Fax.: +49-(0)931-31-86732
97074 Würzburg mail: [email protected]
http://www.is.informatik.uni-wuerzburg.de/en/staff/kluegl_peter/
---------------------------------------------------------------------