Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » WindowBuilder » GWT Palette contribution from plugin.xml
GWT Palette contribution from plugin.xml [message #663491] Tue, 05 April 2011 10:48 Go to next message
Oussema  is currently offline Oussema Friend
Messages: 11
Registered: April 2011
Junior Member
Hi,

I'm glad to see that WindowBuilder become an open source project. Smile
I'm working on an Eclipse Plugin project to contribute to the GWT Project.
As mentionned in the document "NewComponentsTutoriel.pdf" paragraph "1.3 Contribution from plugin.xml", i used the Eclipse Extension and i specified in plugin.xml the class of my new component in order to be added to the palette. When i run an instance of Eclipse to test my plugin, a new category is added but my customized component does'nt appear !! How can i resolve this problem

Thanks for the reply

Oussema
Re: GWT Palette contribution from plugin.xml [message #663544 is a reply to message #663491] Tue, 05 April 2011 14:54 Go to previous messageGo to next message
Konstantin Scheglov is currently offline Konstantin ScheglovFriend
Messages: 555
Registered: July 2009
Senior Member
1. Show your code. Do you think that we can magically identify problem?

2. I can guess however that your component is not in the classpath of the project in which you open form to show palette. So, you may want to read about "classLoader-library" and "library" elements.


Konstantin Scheglov,
Google, Inc.
Re: GWT Palette contribution from plugin.xml [message #663559 is a reply to message #663491] Tue, 05 April 2011 15:54 Go to previous messageGo to next message
Oussema  is currently offline Oussema Friend
Messages: 11
Registered: April 2011
Junior Member
Hello,
I'm sorry if i didn't show the code.
Yes i think that my problem is related to classLoader-library and library elements.
These are the steps that i performed:
1- I created a plug-in project. This is the code of plugin.xml in order to extend windowbuilder toolkit:
<plugin>
<extension point="org.eclipse.wb.core.toolkits">
<toolkit id="com.google.gdt.eclipse.designer">
<provider class="com.google.gdt.eclipse.designer.ToolkitProvider"/>
<resourcePrefixes>
<resourcePrefix>com.google.gwt.</resourcePrefix>
</resourcePrefixes>
<palette>
<category id="com.google.gdt.eclipse.designer.oussema" name="Oussema Components"
description="My GWT Components">
<component
class="com.mycompany.project.client.Mycomposite">
</component>
</category>
</palette>
</toolkit>
</extension>
</plugin>

2- I added in the src my composite:

package com.mycompany.project.client;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;

public class Mycomposite extends Composite {

public Mycomposite() {

Button btnNewButton = new Button("New button");
initWidget(btnNewButton);
}

}
When i start an instance of Eclipse to try my plugin the new category is shown but my component does'nt appear
Should i put my component into a jar file ?
Thanks for your help Smile
Re: GWT Palette contribution from plugin.xml [message #663561 is a reply to message #663544] Tue, 05 April 2011 15:59 Go to previous messageGo to next message
Oussema  is currently offline Oussema Friend
Messages: 11
Registered: April 2011
Junior Member
Hello,
I'm sorry if i didn't show the code.
Yes i think that my problem is related to classLoader-library and library elements.
These are the steps that i performed:
1- I created a plug-in project. This is the code of plugin.xml in order to extend windowbuilder toolkit:
<plugin>
<extension point="org.eclipse.wb.core.toolkits">
<toolkit id="com.google.gdt.eclipse.designer">
<provider class="com.google.gdt.eclipse.designer.ToolkitProvider"/>
<resourcePrefixes>
<resourcePrefix>com.google.gwt.</resourcePrefix>
</resourcePrefixes>
<palette>
<category id="com.google.gdt.eclipse.designer.oussema" name="Oussema Components"
description="My GWT Components">
<component
class="com.mycompany.project.client.Mycomposite">
</component>
</category>
</palette>
</toolkit>
</extension>
</plugin>

2- I added in the src my composite:

package com.mycompany.project.client;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;

public class Mycomposite extends Composite {

public Mycomposite() {

Button btnNewButton = new Button("New button");
initWidget(btnNewButton);
}

}
When i start an instance of Eclipse to try my plugin the new category is shown but my component does'nt appear
Should i put my component into a jar file ?
Thanks for your help Smile
Re: GWT Palette contribution from plugin.xml [message #663742 is a reply to message #663561] Wed, 06 April 2011 11:27 Go to previous messageGo to next message
Konstantin Scheglov is currently offline Konstantin ScheglovFriend
Messages: 555
Registered: July 2009
Senior Member
You've used elements which you don't know what they mean. Smile

Remove "provider" and "resourcePrefixes" elements.
After this your plugins works fine on my side.


Konstantin Scheglov,
Google, Inc.

[Updated on: Wed, 06 April 2011 14:49]

Report message to a moderator

Re: GWT Palette contribution from plugin.xml [message #663786 is a reply to message #663742] Wed, 06 April 2011 13:53 Go to previous messageGo to next message
Oussema  is currently offline Oussema Friend
Messages: 11
Registered: April 2011
Junior Member
Hello,
I tried to remove "provider" and "resourcePrefixes" but it doesn't work. Here is the code of plugin.xml:
<plugin>
<extension
point="org.eclipse.wb.core.toolkits">
<toolkit id="com.google.gdt.eclipse.designer">
<palette>
<category id="com.google.gdt.eclipse.designer.oussema" name="Oussema Components"
description="My GWT Components">
<component
class="com.mycompany.project.client.Mycomposite">
</component>
</category>
</palette>
</toolkit>
</extension>
</plugin>

and my compsite is in the package com.mycompany.project.client in the src path.
When i launch my plugin as an eclipse application i create a new gwt project in which i create an entryPoint. When palette is shown there are a new category "Oussema Components" but my composite doesn't appear.
I think that i have to use classLoader-library and library elements but i don't know how ?
Thanks for your help
Best regards
Oussema
Re: GWT Palette contribution from plugin.xml [message #663813 is a reply to message #663786] Wed, 06 April 2011 14:52 Go to previous messageGo to next message
Konstantin Scheglov is currently offline Konstantin ScheglovFriend
Messages: 555
Registered: July 2009
Senior Member
In which project is MyComposite?
I've added it directly into same GWT project in which I've opened later form to test that MyComposite is on palette. Remember that in GWT you need not just add some project with component Foo into classpath, you should create GWT module and import it into GWT module with your form. Only in this class your GWT module will see Foo in ClassLoader.


Konstantin Scheglov,
Google, Inc.
Re: GWT Palette contribution from plugin.xml [message #663822 is a reply to message #663813] Wed, 06 April 2011 15:04 Go to previous messageGo to next message
Oussema  is currently offline Oussema Friend
Messages: 11
Registered: April 2011
Junior Member

MyComposite is in the src of my plugin project and not in the GWT project.
When i tried to add MyComposite class in the source of my GWT Project it works perfectly.
But i want to add components to palette automatically in the new instance of Eclipse without adding each time manually source of my new components.
So, my purpose is that when i launch my plugin project i will be able to create any GWT Project in which my components are added automatically into palette.
In this case i think that i will use classLoader-library element but i didn't know how

Thank you very much for your help

Regards Smile
Oussema
Re: GWT Palette contribution from plugin.xml [message #663908 is a reply to message #663822] Wed, 06 April 2011 18:58 Go to previous messageGo to next message
Konstantin Scheglov is currently offline Konstantin ScheglovFriend
Messages: 555
Registered: July 2009
Senior Member
No, this will not work in this way, even in case of normal toolkit, like Swing. If you want to add new class into project, you should write special palette EntryInfo which will do this. "classLoader-library" support in limited to jars.

In case of GWT situation is more complex, you can not use even jars because of the nature of GWT projects - they want to see all source and compiled all source files.

I really don't see reason for wanting such behavior. But if you want, you can code it yourself.



Konstantin Scheglov,
Google, Inc.
Re: GWT Palette contribution from plugin.xml [message #664016 is a reply to message #663908] Thu, 07 April 2011 08:28 Go to previous messageGo to next message
Oussema  is currently offline Oussema Friend
Messages: 11
Registered: April 2011
Junior Member
Thanks for the explanation.
It's more clear now.
In reality i created some customized components in GWT and i want to add it to palette, modify "proprieties" of each component and customize the generated code without adding each time the source of my components into GWT project.
I wanted to create a plugin eclipse in order to do this task for extengin GWT Designer.
I'm trying to work hard to find a solution for this problem.

Thanks a lot for your help Smile

Have a nice day

Oussema
Re: GWT Palette contribution from plugin.xml [message #664593 is a reply to message #664016] Mon, 11 April 2011 10:19 Go to previous message
Oussema  is currently offline Oussema Friend
Messages: 11
Registered: April 2011
Junior Member
Hello Smile
I finally find a solution in order to add customized GWT component to the palette from a jar file.
Step 1: Prepare the source code of your components:

1- Create a new gwt project.
2- Create a module which regroup all of your customized components ( java files ). You can put your components into the client package. For example our module called "MyModule" will look like this:

-com.mycompany.project
-MyModule.gwt.xml
-com.mycompany.project.client
-MyComponent.java
-com.mycompany.project.server


3- Export the module into a jar file ( Export all the package of your module)

Step 2: GWT Palette contribution from jar

4- Create an other GWT project in which you want to contribute to palette.
5- Import the jar file created in the previous step.
6- Create a module called for example "CustomizedModule"
7- In "CustomizedModule" modify CustomizedModule.gwt.xml and add the following line into the tag <module>:

<inherits name="com.mycompanyproject.MyModule"/>

8- Create a new project palette for our GWT project and in the folder "wbp-meta" you will find the file "com.google.gdt.eclipse.designer.wbp-palette.xml"
9- Modify this file in order to add your customized components to palette with the following code:

<?xml version="1.0" encoding="UTF-8"?>
<palette>
<category id="someUniqueId" name="Custom category" description="New Category contribution from jar " open="true">
<component class="com.mycompany.project.client.MyComponent" name="My customized component" description="You can write any description here."/>
</category>
</palette>


10- Try to open the designer. You will find another category added to palette with your new customized component

I hope that i could help who are interested.
In my case all these steps can be done from a plugin project in order to be able to have directly customized components added to palette in every GWT project. I've created a new wizard for a "Customized GWT Project" and i'm working to perform all these steps with java code. It's really exciting

Have a good developper day Smile

Oussema
Previous Topic:Palette contribution in jar
Next Topic:NPE when trying to parse existing WizardPages
Goto Forum:
  


Current Time: Thu Apr 25 12:14:49 GMT 2024

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

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

Back to the top