Why am not able to see my customlayout in the properties list??? [message #115334] |
Mon, 16 January 2006 08:01  |
Eclipse User |
|
|
|
Originally posted by: dancersstar.hotmail.com
Hi,
I am trying to add my custom layout in eclipse using VE but I am not able
to see my Custom Manager in the layout properties list.
The structure of the project is:
package: com.layout contains the following code
1) CustomLayout.java
2) CustomLayoutBeanInfo.java
package: com.layout.helper contains the following code
1) CustomLayoutEditPolicy.java
2) CustomLayoutPolicyFactory.java
Folder: overrides.com.layout
1) LayoutManager.override
2) CustomLayout.override
Is it necessary to write the PolicyFactory class and EditPolicy class to
view the CustomLayout manager class in the properties list???
Code is as follows:
LayoutManager.override
-----------------------
<?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">
<event:Add featureName="eAnnotations">
<addedEObjects xsi:type="ecore:EAnnotation"
source="org.eclipse.ve.LayoutInfo">
<details
key="com.layout.CustomLayout"
value="com.layout.CustomLayout"/>
<details
key="org.eclipse.ve.internal.jfc.core.layoutManagerDisplayName "
value="CustomLayout"/>
</addedEObjects>
</event:Add>
</xmi:XMI>
----------
CustomLayout.override
<?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/codegenH elpers.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.layoutpolicyfactoryclassnam ekey "
value=" com.layout.helper/com.layout.helper.CustomLayoutPolicyFactor y "/>
</addedEObjects>
<addedEObjects xsi:type="codeGenHelpers:CodeGenHelperClass"
source="codegen.CodeGenHelperClass"
modelled="true"/>
</event:AddMany>
-----------------------------------
CustomLayoutEditPolicy.java
public class CustomLayoutEditPolicy extends FlowLayoutEditPolicy
implements IActionFilter
{
public final static String LAYOUT_ID = "com.layout.CustomLayout";
//$NON-NLS-1$
public CustomLayoutEditPolicy(VisualContainerPolicy containerPolicy) {
super(containerPolicy);
}
public void activate() {
super.activate();
CustomizeLayoutWindowAction.addLayoutCustomizationPage(getHo st().getViewer(),
GridLayoutLayoutPage.class);
}
/* (non-Javadoc)
* @see org.eclipse.ui.IActionFilter#testAttribute(java.lang.Object,
java.lang.String, java.lang.String)
*/
public boolean testAttribute(Object target, String name, String value) {
/*if (name.startsWith(CustomizeLayoutPage.LAYOUT_POLICY_KEY) &&
value.equals(LAYOUT_ID))
return true;
*/
return true;
}
}
-----------------------
CustomLayoutPolicyFactory.java
public class CustomLayoutPolicyFactory
{
public CustomLayoutPolicyFactory() {
super();
}
public EditPolicy getLayoutEditPolicy(VisualContainerPolicy
containerPolicy) {
return new CustomLayoutEditPolicy(containerPolicy);
}
public ILayoutPolicyHelper getLayoutPolicyHelper(VisualContainerPolicy
ep) {
return new FlowLayoutPolicyHelper(ep);
}
public ILayoutSwitcher getLayoutSwitcher(VisualContainerPolicy cp) {
return null;
}
public IPropertyDescriptor
getConstraintPropertyDescriptor(EStructuralFeature sfConstraint) {
return null; // No constraint, so no property descriptor.
}
public IJavaInstance getLayoutManagerInstance(IJavaObjectInstance
container, JavaHelpers javaClass, ResourceSet rset)
{
return BeanUtilities.createJavaObject(javaClass, rset, (String)null);
}
public JavaClass getConstraintClass(ResourceSet rSet) {
return null;
}
}
Thanks
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02524 seconds