Bookmark and Share

Frquently Asked Questions

This page is continuously changing. Please come back for more information.

Q. How do I start using the plugin?

A.To see the installation details, please click on the install link. To effectively use the plugin, one has to configure it first.

Q. How can one configure the plugin?

A. You can configure it by going to Windows -> Preference -> Fast Code Pereference.

Q. Is there any feature of the plugin that can be used without configuring it first?

A . Pretty much none. But "Create Import" and "Create Instance" will work without configuring anything.

Q. Why is there one create similar menu although there are four items in the configuration?

A. Four items in the configuration represent four different types of classes or value beans. Depending on the classes you click the plugin determines what action to take.

Q. Configuring the plugin seem like long process, is there any shortcut?

A . Configuring it for use may take a while depending on how fast one learns new things. But most of the elements are pretty standard. If one's project is not too far away from standard practice, configuring it may not may not take long at all. Besides, only one person in the team can configure it and others can simply import the preferences from him/her. There may be faster way to set up also. To do this, simple go to the filesystem on your computer and go to ${workspace}\.metadata\.plugins\org.eclipse.core.runtime\.settings where ${workspace} refers to the location of the workspace. In that directory, there should be a file named fastcode.prefs. You can take this file from someone who has configured it completely and then place in the same directory and restart eclipse.

Q. Can two different types of classes reside in the same package for the plugin to work?

A. Absolutely, as long as they have different pattern, e.g. DAO classes end in DAO and value bean classes end in Bean.

Q. Do we need to have all DAO classes in same package for this plugin to work?

A. Absolutely not. One can have FooDAO com.test.foo package and BarDAO in com.test.bar package. In that, one needs slightly change the configuration. In the From class one needs to put something like (${ANY_PACKAGE}).dao.(.*).(${ANY_CLASS})DAO and in the To Class one needs to put ${1}.service.${2}.${3}Service. Notice there are three regular expression groups in stead of ususal two.

Q. There are so many items in the create configuration in the preference. Is there any way to remove them completely?

A. Absolutely, there is a check box at the bottom of the screen which says  'Remove unused configurations'. You can check this button and click OK. All unused configuration items will be gone from the view.

Q. Why isn't drop down for source path always enabled in create similar preference page and other preference pages ?

A. There is configuration for it. If you go to Windows -> Preference -> Fast Code Pereference, somewhere in the middle you will see a checkbox for Always use Default values for Path as shown below. If this is checked the default values for source path is assumed. If you have same values for path in all projects, it is a good idea to leave this checked. If you uncheck it then the drop down for source path will show up.

Q. If I remove configuration items, can I put them back If I need them later?

A. Absolutely, at the bottom of the screen, there is a restore configuration button. The plugin jar file has in resources folder called additional-templates-config.xml.  In this one can create a template of type method.body.method_name where method_name is the name of the method. It can be either simple name of the method or the fully qualified name with the fully qualified class name before it.

Q. Is a there a way to put my own custom configuration?

A. This one is little tricky, but not too difficult. To have a custom configuration, one has to edit the jar file. Open the jar file with your favorite unzipping software, then edit the file called resources/fast-code-config.xml.  Format of the file should be very familiar. Once changed, you need to restart eclipse. A typical configuration looks like :

 

Q. Why is create similar not copying mehtod or converting parameters?

A. Make sure the copy mehtods is checked in the configuration. Also make sure the covert parameter is configures correctly as shown below. Make sure the classes you want to convert has the right extension, e.g. Vo, Dto, etc and configured accordingly.

Q. Why is create similar with different name not copying mehtod or converting parameters?

A. See above answer.

Q. Can the generated methods have log statements at the beginning and end of the method?

A. Yes, the plugin can generate log statements at the beginning and end of the method. To do this one needs to go to Windows -> Preference -> Fast Code Pereference and and the Method Template textbox as shown below. One needs to edit it to include logger.debug("Entered " + ${method_name}); and logger.debug("Exited " + ${method_name}); before and after the line containing ${method_body}.

Q. Can the plugin create method body for certain methods such as afterPropertiesSet?

A. Plugin can create method bodies for any method as long as you configure it. Please open the file additional-templates-config.xml in the resources folder of the jar file and create an entry for afterPropertiesSet and put appropriate template body. Alternatively, one can export the templates and modify the additional-templates-config.xml file and import it.

Q. Why is there a create import feature when eclipse can import easily?

A. It is true eclipse can import very easily, but does not work very well with static imports. This feature should be used for static imports only. Once invoked, it checks if the class has any static member and if so it will put a static import if one wishes. In ecipse, one has to configure for static import and then it will clutter up the auto complete box (when one types Ctrl - Space ) whether one needs them or not.

Q. What kind of files can be created with this plugin?

A. Pretty much any kind of files needed for java development, interface, classes, value beans, spring configurations, dozer bean mapping configurations, jsps, resource bundles, struts configuration (struts-config.xml), jsf managed bean, jsf configuration (faces-config.xml) etc.

Q. What can be done if the templates are not working?

A. Make sure the template is correct. Also make sure that the variation and variation fields are correct. Also note that in velocity set command you cannot do #set(${foo} = "bar"), correct way to do set is #set($foo = "bar"). Also it is to be noted that to put a quotation mark inside set is little tricky, one needs to define a variable #set($Qt = '"') and then use it as ${Qt} inside set command.

Q. What can be done if no templates are showing?

A. When Ctrl-Alt-Shit-T is typed no template types are showing or the preference for templates (Windows -> Preference -->Fast Code Preference-->Template Preferences) is empty. This can happen if the templates-config.xml file in the plug-in jar file is not correct. It is also problematic if there is a problem with Internet connection. If necessary please set up the proxy for Internet connection. One can also open the plugin jar file and edit the templates-config.xml file and remove the line containing the DTD. This will remove the dependency on Internet connection and it may start working.

Q. Can the templates mechanism be used to create to create getter setters?

A. This can be done very easily as well. The details are described here.

Q. Templates seem to bring up too many popups, is there a way to minimize that?

A. This is just necessary. However, there is the Last Snippet Actoin menu item (Ctl-Alt-Shift-L shortcut) which one can use to repeat the last action which will reuse the last template type and the class one selected before. One will just have to select the fields to create different template. One can also use it from the menu at the top. One can attach a special keyboard shortcut to a particular option by going to Windows -> Preference -> General -> Keys ( or by pressing Ctrl-Shift-L twice).  

Q. Can more templates be included in the plugin?

A. More templates can be included by putting them in resources/templates-config.xml. This file is present in the plugin jar file. Templates can be removed from there as well. Alternatively, one can export the templates from the templates menu and add new templates to the templates–config.xml. Then the new templates can be imported from the templates menu. however, templates added or removed this may will not affect the templates menu. They will show up when the user types Ctrl-Alt-Shift-T as available template types.

Q. What to do if some of the templates are not working as expected?

A Some templates may not be correct, one can download the most updated templates from here.

Q. Can the hqls the plugin generates be used as it is?

A. No, the plugin will generate quite a bit of code for hql but one still needs to edit them manually to make it perfect before using. 

Q. What can be done if the SQL generated by plug in does not seem to be correct with latest release?

A. The database templates have been changed a little in the latest release. There used to be insert_fields,update_fields,select_fields for fields placeholders. In the latest release, all these placeholders have been changed to just fields. Make sure you update these templates. You can update either from preferences or by importing database template. The latest database template can be downloaded from database-templates-config.xml.

Example:

 Before:

#foreach ($field in ${insert_fields})

 Now:

#foreach ($field in ${fields})

Q. The plug-in generates the toString method, but why it does not generate the equals or hashCode?

A The equals and hashCode methods need to be generated together. The plug-in does not create two methods at one time. Please use the equals and hashCode methods from the eclipse source menu.

Q. Can the hqls the plugin generates be used as it is?

A. No, the plugin will generate quite a bit of code for hql but one still needs to edit them manually to make it perfect before using. 

Q. Is there anything that this plugin does not do?

A. This plugin does not connect to database and create DAO or POJOs to start with. For that there are plenty of good plugins available in the market. Also the plugin cannot do complex methods or jsps by itself. It only creates similar classes from a given classes also create associated files e.g. the implementation of interface and several types of configuration files.

Q. What are junit test profiles and do I need to create one?

A. A deafult porfile is created for junit tests. This profile applies to all classes. If someone wants to different kinds junit tests (e.g. one kind of test for DAO classes, and another for Service classes), then different profiles are necessary.

Q. What do I do if I get errors?

A.  You can go to your workspace/.metadata and look at your logs. You might want to look into your preference and make sure all fields are entered correctly.

Q. Does the plugin work with java below version 5?

A . It is recommended to use Java 5.0 or above. But if you are not using Java 5.0, you temporarly switch to Java 5.0 and use some of the features like "Create Similar Class".

Design downloaded from Free Templates - your source for free web templates