Automatic Refresh [message #163056] |
Tue, 01 August 2006 10:09  |
Eclipse User |
|
|
|
Originally posted by: wojtek.a.com
Is there a way to have Eclipse automatically refresh a file upon
application start? I am using a properties file for the I18N values, but
I am using an external editor to manage the file.
If I have the file open in an Eclipse editor, then the change is noticed
(IF I go to the editor tab), and propagated to the Web server.
I would like to have Eclipse either automatically do a refresh upon
startup, and/or have the ability to flag certain files for periodic
refresh with some settable time period.
|
|
|
|
|
Re: Automatic Refresh [message #163169 is a reply to message #163123] |
Tue, 01 August 2006 16:58   |
Eclipse User |
|
|
|
Originally posted by: wojtek.a.com
Eric Rizzo wrote:
> Wojtek wrote:
> In an effort to improve Eclipse:
> What is it about the external editor that makes it better than what
> Eclipse provides?
In an effort to remove stupid typo mistakes I have created a class
called LangKey which holds the property file key. The LangKey
constructors are held in a Lang class with nested classes. This looks
like (hope the formatting holds...):
----------------------------
public class Lang
{
public static class Menu
{
public static final LangKey HOME = new LangKey("menu.home");
public static final LangKey LOGIN = new LangKey("menu.login");
}
public static class Login
{
public static final LangKey USER_ID = new LangKey("login.userid");
public static final LangKey PASSWORD= new LangKey("login.password");
}
}
----------------------------
and so on. The LangKey class has some other attributes and functionality.
The property file then has:
----------------------------
menu.home = Home
menu.login = Login
login.userid = Your User ID
login.password = Password
----------------------------
Then when showing stuff to the user (JSP):
----------------------------
<%= lang.text(Lang.Menu.HOME) %>
----------------------------
where lang is an instance of a language class for that user. This lets
the Java compiler catch any typos and also lets the code assist, well,
assist.
The problem is coordinating the keys between the two files (and more
when other languages are added). Each new entry requires an addition to
the Lang class AND a corresponding addition to the property file, plus a
lot of fluff typing (public static final LangKey .....).
So I wrote a Q&D editor in Visual Basic (don't know enough Swing :-()
which reads in both the Lang.java file and the property file, links the
two via the property file keys, and displays the classes and keys in a
tree fashion. I can then add new nested classes, keys, and edit the
language text. Along with comments which identify parameters ({0, number}).
It then generates both files. As an added bonus, I also generate JavaDoc
which contains the actual text, along with any comments:
/**
* Parameters:
* <br>0 - min length
* <br>1 - max length
* <br>Text:
* <br>The password must be between {0,number} and {1,number} in length
*/
public static final LangKey ERR_PW_LEN = new LangKey("login.err.pwLen");
So when I hover over the Lang.Login.ERR_PW_LEN I get a tooltip which
explains the language key.
So this is all somewhat customized. Hmmm, maybe I should have created a
patent for it :-)
However changes made externally were not being picked up and propagated
out to the Web Server. I usually have both Eclipse and my editor open at
the same time. I will use John's suggestion (Thanks!)
I do know that if I was to extend the basic editor, I could set the
editor as being dirty and so on, but I really do not have the time to
delve into the mysteries of Eclipse plugins. Maybe after this project is
done....
|
|
|
Re: Automatic Refresh [message #163176 is a reply to message #163091] |
Tue, 01 August 2006 17:04  |
Eclipse User |
|
|
|
Originally posted by: wojtek.a.com
John Arthorne wrote:
> To refresh automatically: Preferences > General > Workspace > Refresh
> automatically.
Perfect! Thanks!!
|
|
|
Powered by
FUDForum. Page generated in 0.14180 seconds