How to create Eclipse custom java-based new File Wizard based on code templates? - eclipse-plugin

I'm just starting into some Eclipse (juno) plugin experimentation. A key part of the plugin I want to create needs to provide the user with the ability to create New java-based classes. These classes may be 1 of 3 different types.
Is it possible to do this using variation of the NewFileWizard that will use a template for each class type under the hood?
For example, when the user is in the new Custom project they created from the plugin, I'd like them to be able to do a right-click, "New" and be given 3 choices. Depending on the choice, the wizard will use a corrosponding code template - filling in class name, package name, etc., and then generating the file in the proper project folder.
Please let me know if you need any clarification on what I'm asking.

Is it possible to do this using variation of the NewFileWizard that will use a template for each class type under the hood?
Yes.
You're basically going to have to get the Eclipse source code for the New File Wizard, bring it into an Eclipse plug-in project, and modify it to meet your specific needs.

Related

Adding a module in sugarCRM 6.5 C.E. doesn't create a corresponding folder in custom/modules

I need to add a logic hook to a module built in Module Builder in SugarCRM 6.5( Community Edition ).
This logic hook should take all the fields that I have just saved after completing a form in a module and create a new record in a different module with these fields( in order to simulate a workflow ).
All the tutorials on the internet( on logic hooks ) talk about modifying stuff in "./custom/Extension/modules//..." but, after creating and deploying a module in sugarCRM, I do NOT have my module present in either "./custom/Extension/modules/" or "./custom/modules" .
Thank you for your time,
Those directories are for customizations and extensions like studio changes and custom code like hooks.
That those directories are not present only means that there are no customizations yet, so feel free to create those folders and add your hook inside.
Make sure that you create the directories with the correct names (as stated in the tutorials), including the correct case for all letters.
Also don't forget to give the web-process ownership/write-permissions to the all folders you create in custom, otherwise Sugar might fail to save studio changes and aggregation files at some point in the future.

Xpages : Possible to inherit all Select 2 components

I have got Select2 working. Awesome, awesome component.
We have a db with some common elements which we inherit to databases. I would like to add Select2 to this db, so it will be easily available to databases, but don't know how to do that, as you have to put some items in the package explorer.
Any way to do this?
It is possible if you inherit the whole template:
create a database with all design elements you want to have as default in a database including Select2 parts in WebContent folder
define this database as template "CommonElements" (or another unique template name) in database properties
define the template "CommonElements" as "Inherit design from master template" in every database where those design elements are needed
and make sure that every additional design element has set "Prohibit design refresh"
or inherits from a design template.
In case you have additional elements in WebContent folder set "Prohibit design refresh" flag to those design elements with File > Application > Set Prohibit Refresh Properity... too
All design elements including all WebContent folders are inherited from master template when you execute File > Application > Refresh Design... or when designer process runs on server.
I don't think that is possible. You could set up a central "resources.nsf" with the select2 components and load all the resources you need (manually) from all other databases.
Unless your users do not have internet access (either fire-walled or offline) you may as well just use a CDN. That way all your users will have a cached version of the download library on all of your sites and you don't have to worry about hosting it somehow.
https://cdnjs.com/libraries/select2
for example
It might also be worth looking at the Import and Export from Domino Designer project on OpenNTF. It allows you to create an portlist.xml file, which tells the plugin which files to import. It still requires a manual action to import, but will allow you to overwrite files.
Although using plugins is the place to aim to get to, this is a perfectly valid and good practice method for handling copying all relevant files into an NSF. It's used in XPages OpenLog Logger project on OpenNTF, for the NSF-based option.

I just want to know where we need to make changes while customizing odoo?

I am new in odoo. Can u please tell me where I need to customize an odoo business application. We have a database, XML, python files etc.
Is there any need to make change in view_XML, python or pg admin?
To customize an Odoo application you definitely don't have to change the database manually (I guess that's what you mean by pgadmin).
You should not make changes to core Odoo modules or any module for that matter, instead you should create your own modules to modify existing modules or add new features.
Themes, snippets and basic view customizations (rearrange fields or show and hide existing model fields) doesn't require to write any python file (other than the required module python files).
If you want to make extend current models or add new models then you need to create new python files
The Best way to customize odoo Module is to build a new module.
For Creating new Module best tutorial is Technical Momento book and Document provided by odoo on www.odoo.com

How to execute arbitrary line of code in TFS build process?

I am creating a custom process template in our TFS server.
I would like to execute the following line of during the process, to automatically modify the assembly's revision number in AssemblyInfo.cs based on the current MMDD:
File.WriteAllText(file, Regex.Replace(File.ReadAllText(file), "(?<=\[assembly: AssemblyFileVersion\(""[0-9]*.[0-9]*.[0-9]*.)[0-9]*(?=""\)\])", Function(m) DateTime.Now.ToString("MMdd")))
Unfortunately I cannot find out how to execute an arbitrary line of VB.NET code in the build process. There are no code activities called "execute", "run" etc.
I tried to hack it by inserting a lambda function into a WriteBuildMessage() call, but found that lambdas are disallowed:
(EDIT: after other problems with that expression were fixed, it now simply gives the error: "Statement lambdas cannot be converted to expression trees" - ergo I can't do what I'm trying to do here. If "File.WriteAllLines" was string instead of void then I could return it and be laughing.)
Is there a way I can execute an arbitrary line of VB.NET code as part of the build process?
Note: I got around it by adding a node to InvokeMethod directly on System.IO.File.WriteAllText, passing the Regex.Replace call as one of the parameters.
I'll leave the question open in case anyone can provide a direct answer to the original question.
As you mentioned yourself it is possible to use the "InvokeMethod" in order to somewhat execute a line of code.
What I would suggest is to create a custom activity where you can provide it with the parameters, such as the file name and file path.
In order to achieve this two main tasks are needed:
Include a custom build process template
Creating a custom activity
You either do this in your current solution or you create a whole new solution to handle your custom activities and process template.
Include Custom Build Process Template
Whether you choose to work on your current solution or a new one, it is important to have the Process Build Template included in a separate project.
The project needs to be an "Activity Library" which is found under installed (VS 2013):
Right-click solution -> Add.. -> New Project... -> Visual C# -> Workflow
In this project you add your process template that you have been working on, by adding it as an existing item and making it a link. This can be done by pressing the small arrow at the "add" button
When this is included you will need to include several references, which can be found here [1]
Creating Custom Activities
As for the Build Process Template all the custom activities needs a project to be build in. This is to ensure that when they are to be used it is simply referencing the project or including the dll.
This project also needs to be an Activity Library, where this time the activities are to be created.
An activity is a Code Activity and can be created by:
Right-click Project -> Add -> New Item... -> Visual C# Items -> Workflow -> Code Activity
And again this project needs several references in order to build, which can be found here[1]
References:
For more information and ideas take a look at this:
[1]: Ewald Hofman - Customize Team Build
You should not create this yourself. You should use the precreate TfsVersion activity built into the TFS Community Build Tools.
https://tfsbuildextensions.codeplex.com/wikipage?title=How%20to%20integrate%20the%20TfsVersion%20build%20activity&referringTitle=Documentation
This tool will do all of the heavy lifting and is supported by the Visual Studio ALM Ranger and MVP's.

eclipse preference - where and how to store

I'm developing an Eclipse-Plugin which has it's own preference page.
First question: Is it possible to store these preferences workspace independent? Instead, I'd like to store it for the Eclipse installation. If yes, how?
Second question: I'd like to add a table to my preference page which has one column and a checkbox for each row (to sign the row entry as active or inactive). The column should contain file locations and/or urls of text files. So for the one preference setting, I'd have to store a list of location and the information whether it's active or not. Which would be the best way (which delimiters?)?
The Eclipse Preference service do support a scope context for the preference store. You can either store preferences in an Eclipse project, in the workspace, in the instance installation or into a custom scope.
Please refer to the following FAQ for more information on Eclipse Preference Scope: http://wiki.eclipse.org/FAQ_What_is_a_preference_scope%3F
For the way to store your table preferences, IMO there is no real best way to do it. I would say that you can serialize the whole table into a string using a specific pattern/matcher to parse it.
For instance, you can use the following format:
your.table.preference=(url1,boolean);(url2,boolean);(url3,boolean)