[ jEdit-devel ] getting a property from mode or from buffer

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[ jEdit-devel ] getting a property from mode or from buffer

Jarekczek
Administrator
The correct order is ask then change. But after the change a reflection
came to me. What should be actually used and does it depend on context:

A.
buffer.getStringProperty("x")

or

B.
(String) buffer.getMode().getProperty("x)

See related revision:
jedit.svn.sourceforge.net/viewvc/jedit?view=revision&revision=21964

where I changed B to A.

I wonder about contexts where JEditBuffer is used and not Buffer
(standalone text area?). In these cases buffer properties are not
defaulted to mode properties, if I read the code properly. Or maybe they
should anyway?

Maybe this is a jedit api pitfall and I should make a note about it in
wiki :)

Jarek

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
--
-----------------------------------------------
jEdit Developers' List
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jedit-devel
Reply | Threaded
Open this post in threaded view
|

Re: [ jEdit-devel ] getting a property from mode or from buffer

Matthieu Casanova
Administrator
It seems you are right, it should at least use mode properties as default.
But another thing I was thinking about is that Buffer could use the IProperty interface instead of calling jEdit.getProperty(), and of couse JEditBuffer could also use it, this way the getDefaultProperty() method could be the same for both and pulled in JEditBuffer.

Matthieu

2012/7/31 Jarek Czekalski <[hidden email]>
The correct order is ask then change. But after the change a reflection
came to me. What should be actually used and does it depend on context:

A.
buffer.getStringProperty("x")

or

B.
(String) buffer.getMode().getProperty("x)

See related revision:
jedit.svn.sourceforge.net/viewvc/jedit?view=revision&revision=21964

where I changed B to A.

I wonder about contexts where JEditBuffer is used and not Buffer
(standalone text area?). In these cases buffer properties are not
defaulted to mode properties, if I read the code properly. Or maybe they
should anyway?

Maybe this is a jedit api pitfall and I should make a note about it in
wiki :)

Jarek

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
--
-----------------------------------------------
jEdit Developers' List
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jedit-devel


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
--
-----------------------------------------------
jEdit Developers' List
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jedit-devel
Reply | Threaded
Open this post in threaded view
|

Re: [ jEdit-devel ] getting a property from mode or from buffer

Jarekczek
Administrator
So my decision was probably ok. And now after doing a hypersearch for getmode.*get.*property it looks like the B syntax is not used at all, for no property. It was used only with noWordSep in search related files.

Jarek

W dniu 2012-08-01 09:55, Matthieu Casanova pisze:
It seems you are right, it should at least use mode properties as default.
But another thing I was thinking about is that Buffer could use the IProperty interface instead of calling jEdit.getProperty(), and of couse JEditBuffer could also use it, this way the getDefaultProperty() method could be the same for both and pulled in JEditBuffer.

Matthieu

2012/7/31 Jarek Czekalski <[hidden email]>
The correct order is ask then change. But after the change a reflection
came to me. What should be actually used and does it depend on context:

A.
buffer.getStringProperty("x")

or

B.
(String) buffer.getMode().getProperty("x)

See related revision:
jedit.svn.sourceforge.net/viewvc/jedit?view=revision&revision=21964

where I changed B to A.

I wonder about contexts where JEditBuffer is used and not Buffer
(standalone text area?). In these cases buffer properties are not
defaulted to mode properties, if I read the code properly. Or maybe they
should anyway?

Maybe this is a jedit api pitfall and I should make a note about it in
wiki :)

Jarek

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
--
-----------------------------------------------
jEdit Developers' List
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jedit-devel




------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
--
-----------------------------------------------
jEdit Developers' List
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jedit-devel