Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: Re: [ve-dev] How to add new layout mangers to ve

Hi Rich,
Thanks for the great help :-)
I would surely avoid making same mistakes again.

Kindly tell me how is the addition of layouts with constructors
requiring arguments can be done.Whether this feature will be
available in later builds or not.

Thanks & Regards
Tanul






________________________________________________
Get your own "800" number
Voicemail, fax, email, and a lot more
http://www.ureach.com/reg/tag


---- On Thu, 3 Jun 2004, Rich Kulp (richkulp@xxxxxxxxxx) wrote:

> Hi Tanul,
> 
> It has having a problem with reading your plugin.xml. I
noticed dashes ("-
> ") on some of the lines in the sample below. Are those lines
(or some 
> unreadable character) in your real plugin.xml at those spots?
They would 
> make the plugin.xml unparsable.
> 
> If those are just an artifact of adding the plugin.xml to the
note, then 
> there are other problems too.
> 
>  
> - <extension point="org.eclipse.jem.beaninfo.registrations">
> - <registration container="MYOBJ_CONTAINER"
> plugin="com.myobj.custom">
> - <beaninfo kind="plugin" path="bin/myobjectbeaninfo.jar">
>   <searchpath package="com.myobj.custom.beaninfo" /> 
>   </beaninfo>
>   </registration>
> 
> 
> In here, remove the kind="plugin".  That is obsolete and no
longer used. 
> Also, probably your beaninfo jar shouldn't be in a bin
directory. During 
> development of your plugin, the bin directory is used for the
compiled 
> .class files for your plugin. Typically the bin directory
doesn't exist 
> when you deply your plugin. For this to work, your beaninfo
jar should be 
> somewhere else in your plugin. I don't know if you are
developing your 
> beaninfo jar within the plugin itself, or if you are
developing it 
> separately and importing it into the plugin. Either way, make
sure that 
> the jar is mentioned in the build.properties as a binary
output file so 
> that it will be exported for you.
> 
> If you are trying to develop the beaninfo's in the plugin
development 
> project too, then there are some additional things you need to
do for it 
> to work in development mode versus when deployed. We can show
you what 
> needs to be done in that case.
> 
> Second, you don't need plugin="com.myobj.custom" unless you
expect your 
> classes (i.e. the classes that your users will be using, like
the layout 
> manager) to also be running in an Eclipse environment. That
extra argument 
> tells us that we should use the beaninfo jar if the users
project was a 
> plugin developement project, and then needed to use classes
form the 
> "com.myobj.custom" plugin.
> 
> Next:
> 
> - <registration
> container="org.eclipse.jdt.launching.JRE_CONTAINER">
>   <override package="com.myobj.custom.layout"
> path="overrides/com/myobj/custom/layout"></override> 
>  
>   </registration>
> 
> 
> This override should be moved up to the previous registration
for your 
> container. The way you have it here says to add your overrides
for your 
> layout when the JRE container is in the classpath. But your
overrides are 
> only valid when YOUR container (MYOBJ_CONTAINER) is in the
classpath. 
> 
> Next:
> 
> - <extension point="org.eclipse.ve.java.core.contributors">
>   <palette container="MYOBJ_CONTAINER"
> categories="myobjpalette.xmi" plugin="com.myobj.custom" /> 
>   </extension>
> 
> 
> As before, you don't need plugin="com.myobj.custom".
> 
> Next:
> 
> - <registration container="MYOBJ_CONTAINER"
> description="MyCustomToolBar">
>   <library runtime="bin/myobject.jar"
src="src/myobject_src.zip"
> prefix="src" /> 
>   </registration>
> 
> As before, you probably don't want the jars in the bin
directory. That 
> usually is hard to work with.
> 
> 
> Finally, I don't see any overrides for the java.awt.Layout
class itself. 
> You need to override that to get your layout manager stuff
recognized for 
> the property sheet.
> 
> Thanks,
> Rich
> 
> 
> 
> tanul sangal <tanulsangal@xxxxxxxxxx> 
> Sent by: ve-dev-admin@xxxxxxxxxxx
> 06/03/2004 03:26 AM
> Please respond to
> ve-dev
> 
> 
> To
> "Jeffrey Myers" <ve-dev@xxxxxxxxxxx>
> cc
> 
> Subject
> Re: Re: [ve-dev] How to add new layout mangers to ve
> 
> 
> 
> 
> 
> 
> 
> Hi Jeffrey,
> Thanks that was of great help -:)
> 
> My plugin without layout managers is running fine on VE 1.0
> M1,but as soon as I add override info for layouts in
> beaninfo.registration and run my plugin, my pallette loads
> without the swing and custom components.
> 
> Also the following error messages are shown :
> 
> Error parsing plugin manifest file at
> c:\layout\eclipse\plugins\com.myobj.custom
> 
> Problems occurred when invoking code from plug-in:
> "org.eclipse.core.runtime"
> 
> Problems occurred when invoking code from plug-in:
> "org.eclipse.core.runtime"
> 
> and so on.
> 
> Following is my plugin.xml file :
> 
> <?xml version="1.0" ?> 
> - <plugin name="Custom" id="com.myobj.custom" version="1.0.0">
> - <requires>
>   <import plugin="org.eclipse.jem.beaninfo" /> 
>   <import plugin="org.eclipse.ve.java.core" /> 
>   <import plugin="org.eclipse.jdt.ui" /> 
>   <import plugin="org.eclipse.jdt.core" /> 
>   <import plugin="org.eclipse.jdt.launching" /> 
>   </requires>
> 
> - <extension point="org.eclipse.jem.beaninfo.registrations">
> - <registration container="MYOBJ_CONTAINER"
> plugin="com.myobj.custom">
> - <beaninfo kind="plugin" path="bin/myobjectbeaninfo.jar">
>   <searchpath package="com.myobj.custom.beaninfo" /> 
>   </beaninfo>
>   </registration>
>  
> - <registration
> container="org.eclipse.jdt.launching.JRE_CONTAINER">
>   <override package="com.myobj.custom.layout"
> path="overrides/com/myobj/custom/layout"></override> 
>  
>   </registration>
>  
>   </extension>
> - <extension
point="org.eclipse.jdt.ui.classpathContainerPage">
>   <classpathContainerPage id="MYOBJ_CONTAINER" name="Custom"
>
class="org.eclipse.ve.internal.java.wizard.RegisteredClasspathContainerWizardPage"
> /> 
>   </extension>
> - <extension
> point="org.eclipse.jdt.core.classpathContainerInitializer">
>   <classpathContainerInitializer
>
class="org.eclipse.ve.internal.java.core.RegisteredClasspathContainerInitializer"
> id="MYOBJ_CONTAINER" /> 
>   </extension>
> - <extension point="org.eclipse.ve.java.core.contributors">
>   <palette container="MYOBJ_CONTAINER"
> categories="myobjpalette.xmi" plugin="com.myobj.custom" /> 
>   </extension>
> - <extension point="org.eclipse.ve.java.core.registrations">
> - <registration container="MYOBJ_CONTAINER"
> description="MyCustomToolBar">
>   <library runtime="bin/myobject.jar"
src="src/myobject_src.zip"
> prefix="src" /> 
>   </registration>
>   </extension>
> 
>   </plugin>
> 
> 
> Kindly help me in sorting out the error.
> 
> 
> Thanks & Regards
> Tanul
> 
> 
> 
> 
> 
> ________________________________________________
> Get your own "800" number
> Voicemail, fax, email, and a lot more
> http://www.ureach.com/reg/tag
> 
> 
> ---- On Thu, 27 May 2004, Jeffrey Myers (myersj@xxxxxxxxxx)
> wrote:
> 
> > Hi Tanul,
> > 
> > The ability to add custom layout managers is a new feature
in
> VE 1.0 
> > (should work in M1)... so it hasn't been tested much yet. 
> Here's some 
> > instructions, if they don't work, please let us know.
> > Note: right now we only support adding layout managers with
no
> agument 
> > constructors.  Layout managers with constructors requiring
> arguments, such 
> > as BoxLayout are still handled as special cases requiring
more
> code.
> > 
> > 1)
> > Assuming you want to add a Swing/AWT layout manager, in your
> plugin, 
> > create a file  overrides/java/awt/LayoutManager.override
(for
> SWT this 
> > would be overrides/org/eclipse/swt/widgets/Layout.override)
> > 
> > 2)
> > Look at the existing LayoutManager.override in the same
place
> in the 
> > org.eclipse.ve.jfc plugin as a guide.
> > Copy the top of that override's file, the xmi tag
declaration
> into your 
> > file:
> > 
> > <?xml version="1.0" encoding="UTF-8"?>
> > <xmi:XMI xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"; 
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> > 
> >
> xmlns:org.eclipse.ve.internal.jcm="
> http:///org/eclipse/ve/internal/jcm.ecore";
> 
> > 
> > 
> >
> xmlns:org.eclipse.ve.internal.cde.decorators="
> http:///org/eclipse/ve/internal/cde/decorators.ecore";
> >     xmlns:org.eclipse.jem.java="java.xmi" 
> > xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore";
> >     xmlns:event="event.xmi">
> > 
> > Now add an eAnnotation tag to your override:
> >   <event:AddMany featureName="eAnnotations">
> > 
> > 3)
> > For each layout you want to add, put in this block of xmi:
> >         <addedEObjects xsi:type="ecore:EAnnotation" 
> > source="org.eclipse.ve.LayoutInfo">
> >                 <details 
> > key="org.eclipse.ve.internal.jfc.core.layoutManagerClass"
> >                         value="java.awt.BorderLayout"/>
> >                 <details 
> >
>
key="org.eclipse.ve.internal.jfc.core.layoutManagerDisplayName"
> >                         value="BorderLayout"/>
> >         </addedEObjects>
> > 
> > Replace the "java.awt.BorderLayout" value with your own
custom
> layout 
> > class (fully qualified class name).
> > Replace the "BorderLayout" value with the display name you
> wish to see in 
> > the property sheet's cell editor.
> > 
> > 4)
> > Add the closing tags to the end of your file:
> >   </event:AddMany>
> > </xmi:XMI>
> > 
> > Save your override file.
> > 
> > 5)
> > Next we need to register with beaninfo to notify it that
> you've written an 
> > override
> > Open the plugin.xml for your plugin.
> > Add the following extension within your plugin.xml:
> >    <extension
> >          point="org.eclipse.jem.beaninfo.registrations">
> >       <registration
> > 
> container="org.eclipse.jdt.launching.JRE_CONTAINER">
> >          <override
> >                package="java.awt"
> >                path="overrides/java/awt">
> >          </override>
> >       </registration>
> >    </extension>
> > 
> > Save your plugin.xml.
> > Launching the VE with your plugin active should now show
your
> custom 
> > layout on the layout property editor for Swing/AWT. 
Selecting
> it should 
> > drop an instance of that class with a no argument
constructor.
> > 
> > 6)
> > To provide visual feedback and the ability to edit the
layout
> graphically 
> > requires quite a lot more work.
> > 
> > First, create an override for your custom layout class.  If
> your class is 
> > called org.foo.layouts.MyCustomLayout, you'll need to create
> the file 
> > overrides/org/foo/layouts/MyCustomLayout.override in your
> plugin.
> > 
> > In this file add the following xmi:
> > <?xml version="1.0" encoding="UTF-8"?>
> > <event:AddMany xmi:version="2.0"
> xmlns:xmi="http://www.omg.org/XMI"; 
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> > 
> >
> xmlns:org.eclipse.ve.internal.jcm="
> http:///org/eclipse/ve/internal/jcm.ecore";
> 
> > xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore";
> > 
> >
>
xmlns:codeGenHelpers="platform:/plugin/org.eclipse.ve.java.core/overrides/codegenHelpers.ecore"
> >     xmlns:event="event.xmi" 
> >     featureName="eAnnotations">
> >   <addedEObjects
> xsi:type="org.eclipse.ve.internal.jcm:BeanDecorator">
> >     <keyedValues xsi:type="ecore:EStringToStringMapEntry" 
> >
>
key="org.eclipse.ve.internal.jfc.core.layoutpolicyfactoryclassnamekey"
> > 
> >
>
value="org.eclipse.ve.jfc/org.eclipse.ve.internal.jfc.core.BorderLayoutPolicyFactory"/>
> >   </addedEObjects>
> >   <addedEObjects
xsi:type="codeGenHelpers:CodeGenHelperClass" 
> > source="codegen.CodeGenHelperClass"
> >      modelled="true"/>
> > </event:AddMany>
> > 
> > Change the value of "
> >
>
org.eclipse.ve.jfc/org.eclipse.ve.internal.jfc.core.BorderLayoutPolicyFactory
> > " to
> > "my.plugin/my.plugin.MyCustomLayoutPolicyFactory" (replacing
> with real 
> > plugin/layout names of course)
> > 
> > 7)
> > Now create the MyCustomLayoutPolicyFactory class, extending
> the 
> > org.eclipse.ve.internal.java.visual.ILayoutPolicyFactory
> interface.
> > 
> > 8)
> > Back in your plugin.xml, add an override tag pointing to
your
> custom 
> > layout's package.
> > Look for where you entered:
> >          <override
> >                package="java.awt"
> >                path="overrides/java/awt">
> >          </override>
> > And below that, add:
> >          <override
> >                package="org.foo.layouts"
> >                path="overrides/org/foo/layouts">
> >          </override>
> > (same package and path used in step 6)
> > 
> > 9)
> > Now to actually implement your desired graphical behavior,
> you'll need to 
> > implement the methods in MyCustomLayoutPolicyFactory.  Your
> best bet for 
> > getting up to speed on how to accomplish this is reading
> through the 
> > existing layout edit policies included with the VE in
> Swing/AWT and SWT. 
> > The class
> org.eclipse.ve.internal.jfc.core.FlowLayoutPolicyFactory would

> > be a good place to start looking.
> > 
> > 
> > If you have questions, please ask here on the dev list or on
> the VE 
> > newsgroup.  If you have feedback or problems with these
> instructions 
> > please let me know... once we get the bugs shaken out we'll
> probably post 
> > these instructions as an article in our developer
> documentation section.
> > 
> > Good luck,
> > 
> > Jeff Myers
> > ----------------
> > Eclipse Visual Editor Development
> > 919-254-9130 - T/L 444, HYSA/501/F121
> > IBM SWG at RTP, 3039 Cornwallis Rd, RTP, NC 27709
> > Lotus Notes: Jeffrey Myers/Durham/IBM   Internet:
> myersj@xxxxxxxxxx
> > 
> > 
> > 
> > 
> > tanul sangal <tanulsangal@xxxxxxxxxx>
> > Sent by: ve-dev-admin@xxxxxxxxxxx
> > 05/27/2004 03:02 AM
> > Please respond to ve-dev
> > 
> >         To:     ve-dev@xxxxxxxxxxx
> >         cc: 
> >         Subject:        [ve-dev] How to add new layout
mangers
> to ve
> > 
> > 
> > Hi,
> > 
> > I have a plugin for ve which is adding some of my custom
> > components to the ve palette.
> > Now I want to add some custom layout managers so that they
can
> > behave within the ve in the same way as existing layout
> > managers.
> > 
> > Kindly provide me with some input on how can this be
achieved.
> > 
> > Best Regards
> > Tanul
> > 
> > 
> > 
> 
> _______________________________________________
> ve-dev mailing list
> ve-dev@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/ve-dev
> 
> 
> 
> 



Back to the top