Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Re: Refactor JFace Data Binding
Re: Refactor JFace Data Binding [message #330288] Thu, 24 July 2008 14:04 Go to next message
Eclipse UserFriend
Originally posted by: eclipse-news.rizzoweb.com

kerem onal wrote:
> Hi,
>
> Is there a plugin that improves the refactor capabilities of Eclipse and
> makes it compatible with jface data binding framework?

First, JFace and Data binding questions belong in the eclipse.platform
newsgroups, since they are both at a layer above SWT. I've copied
eclipse.platform to this reply.

Second, you'll have to be more specific; refactor operations are
general-purpose and I don't know what kinds of data-binding-specific
things you might be thinking of.

Eric
Re: Refactor JFace Data Binding [message #330306 is a reply to message #330288] Thu, 24 July 2008 20:53 Go to previous messageGo to next message
Matthew Hall is currently offline Matthew HallFriend
Messages: 368
Registered: July 2009
Senior Member
Eric Rizzo wrote:
> kerem onal wrote:
>> Hi,
>>
>> Is there a plugin that improves the refactor capabilities of Eclipse
>> and makes it compatible with jface data binding framework?
>
> First, JFace and Data binding questions belong in the eclipse.platform
> newsgroups, since they are both at a layer above SWT. I've copied
> eclipse.platform to this reply.
>
> Second, you'll have to be more specific; refactor operations are
> general-purpose and I don't know what kinds of data-binding-specific
> things you might be thinking of.
>
> Eric

Kerem,

Are you talking about changing property name strings when you rename
your bean properties? If that's what you're asking, then no, Eclipse
can not help you much. I've found that by exposing the property name
string as a public static field on the bean class, that refactoring
becomes a little nicer:

public class Person {
public static final String NAME = "name";

private String name;

public String getName() { return name; }

public void setName(String name) {
firePropertyChange(NAME, this.name, this.name = name);
}
}

Then, in binding code, you want to use the static field instead of a
literal string for the property name:

bindingContext.bindValue(
SWTObservables.observeText(nameText),
BeansObservables.observeValue(person, Person.NAME),
null,
null);

Thus if you decide in the future to change the "name" property to
"lastName" then the change is simpler:
* Rename name field to lastName
* Rename getName() method to getLastName()
* Rename setName() method to setLastName()
* Rename NAME field to LAST_NAME
* Change the value of LAST_NAME from "name" to "lastName"

Hope this helps,

Matthew
Re: Refactor JFace Data Binding [message #330311 is a reply to message #330306] Fri, 25 July 2008 05:29 Go to previous messageGo to next message
lembas  is currently offline lembas Friend
Messages: 13
Registered: July 2009
Junior Member
Yes I know Eclipse cannot do it, I thought I could find a plugin to bring
this feature to eclipse.

Thanks for you hint.

Kerem

> Kerem,
>
> Are you talking about changing property name strings when you rename your
> bean properties? If that's what you're asking, then no, Eclipse can not
> help you much. I've found that by exposing the property name string as a
> public static field on the bean class, that refactoring becomes a little
> nicer:
>
> public class Person {
> public static final String NAME = "name";
>
> private String name;
>
> public String getName() { return name; }
>
> public void setName(String name) {
> firePropertyChange(NAME, this.name, this.name = name);
> }
> }
>
> Then, in binding code, you want to use the static field instead of a
> literal string for the property name:
>
> bindingContext.bindValue(
> SWTObservables.observeText(nameText),
> BeansObservables.observeValue(person, Person.NAME),
> null,
> null);
>
> Thus if you decide in the future to change the "name" property to
> "lastName" then the change is simpler:
> * Rename name field to lastName
> * Rename getName() method to getLastName()
> * Rename setName() method to setLastName()
> * Rename NAME field to LAST_NAME
> * Change the value of LAST_NAME from "name" to "lastName"
>
> Hope this helps,
>
> Matthew
Re: Refactor JFace Data Binding [message #330312 is a reply to message #330288] Fri, 25 July 2008 05:31 Go to previous message
lembas  is currently offline lembas Friend
Messages: 13
Registered: July 2009
Junior Member
Thanks Eric. I searched for the eclipse.platform.jface, could not find and
posted the question here.

"Eric Rizzo" <eclipse-news@rizzoweb.com> wrote in message
news:g6a22m$lfl$2@build.eclipse.org...
> kerem onal wrote:
>> Hi,
>>
>> Is there a plugin that improves the refactor capabilities of Eclipse and
>> makes it compatible with jface data binding framework?
>
> First, JFace and Data binding questions belong in the eclipse.platform
> newsgroups, since they are both at a layer above SWT. I've copied
> eclipse.platform to this reply.
>
> Second, you'll have to be more specific; refactor operations are
> general-purpose and I don't know what kinds of data-binding-specific
> things you might be thinking of.
>
> Eric
Previous Topic:What eclipse Runnable/Job I should use to display progress on my view?
Next Topic:Change configuration location dynamically? Best practice?
Goto Forum:
  


Current Time: Fri Sep 27 07:27:58 GMT 2024

Powered by FUDForum. Page generated in 0.04589 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top