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 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
> 
> 
> 



Back to the top