have xml content outline improvment, but... [message #87701] |
Mon, 28 March 2005 10:38  |
Eclipse User |
|
|
|
Hi wst's,
I made this simple addition to getLabelText of JFaceNodeAdapter:
/**
* Fetches the label text specific to this object instance.
*/
public String getLabelText(Object object) {
String result = getNodeName(object);
Node node = (Node) object;
Node firstAttribute = node.getAttributes().item(0);
if(firstAttribute!=null) {
return result + " " + firstAttribute.getNodeName() + "=\""
+ firstAttribute.getNodeValue() + "\"";
} else {
return result;
}
}
This basically makes the outline content much more usable since you can
now see
the first attribute of elements.
But for doing this I have 2 "issues":
1. This should probably be controlled by the user with an on-off button.
Can someone point me
in the direction on where xml outline content preferences should be
stored ? (I plan to just add
it as a option on the existing outline menu)
2. The content outline is not updated very often. Changing and attribute
does not refresh the outline view - is there
some way to make it update when attributes are added/removed ?
Thank you
-max
|
|
|
|
|
|
|
Re: have xml content outline improvment, but... [message #89096 is a reply to message #89005] |
Thu, 31 March 2005 03:55  |
Eclipse User |
|
|
|
max,
i still think the current behaviour (no outline update for attributes) is acceptable for most users.
When you open a really large xml document it will slow down eclipse so much that you will thank god
for not updating the outline because of a attribute change.
By the way - if you dont like, just change it:
A xml editor preference for justifying the outline behaviour
would be a nice contribution.
Many Regards,
Lars
Max Rydahl Andersen wrote:
>>
>> you do not depend on xpath - it is never used. the label is generated
>> by just replacing @[attribute-name] with
>> [attribute-value]. where is the overkill ?
>
>
> ok - sorry, placed to much in the @ syntax ,)
>
> (but to my defense its still some overhead)
>
> ...anyhow if that is not the overhead then I still would like to
> know why sending focused events on attribute changes is not done so
> an outline can update accordingly.
>
> /max
>
>>>
>>>>
>>>> > 2. The content outline is not updated very often. Changing and
>>>> > attribute does not refresh the outline view - is there
>>>> > some way to make it update when attributes are added/removed ?
>>>>
>>>> you can listen to the xml editor document to receive such changes.
>>>> but beware of it - it slows the editing really down. the best
>>>> solution for me was to provide an refresh button in the outline
>>>> bar where the user may decide manually to refresh the outline.
>>>
>>> well, our JBossIDE xml editor doesnt seem to be much burdend with
>>> notifications
>>> and updating the outline, so I know it can be done for the simple
>>> case (which I have here)
>>> -max
>>>
>>>> Many Regards,
>>>>
>>>> Lars
>>>>
>>>> Max Rydahl Andersen wrote:
>>>>
>>>>> Hi wst's,
>>>>> I made this simple addition to getLabelText of JFaceNodeAdapter:
>>>>> /**
>>>>> * Fetches the label text specific to this object instance.
>>>>> */
>>>>> public String getLabelText(Object object) {
>>>>> String result = getNodeName(object);
>>>>> Node node = (Node) object;
>>>>> Node firstAttribute = node.getAttributes().item(0);
>>>>> if(firstAttribute!=null) {
>>>>> return result + " " + firstAttribute.getNodeName() +
>>>>> "=\"" + firstAttribute.getNodeValue() + "\"";
>>>>> } else {
>>>>> return result;
>>>>> }
>>>>> }
>>>>> This basically makes the outline content much more usable since
>>>>> you can now see
>>>>> the first attribute of elements.
>>>>> But for doing this I have 2 "issues":
>>>>> 1. This should probably be controlled by the user with an on-off
>>>>> button. Can someone point me
>>>>> in the direction on where xml outline content preferences should
>>>>> be stored ? (I plan to just add
>>>>> it as a option on the existing outline menu)
>>>>> 2. The content outline is not updated very often. Changing and
>>>>> attribute does not refresh the outline view - is there
>>>>> some way to make it update when attributes are added/removed ?
>>>>> Thank you
>>>>> -max
>>>
>>>
>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.07256 seconds