Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Visual Editor (VE) » how do i set a property for array eg: String[]
how do i set a property for array eg: String[] [message #616352] Wed, 01 August 2007 12:25
Eclipse UserFriend
Originally posted by: caye5200.yahoo.com.cn

hello, i am VE new developer. now i want devloper a property editor int
the property sheet.
i am developed a property dialog with "java.lang.Integer"
property ,eg

First i create a override file , the property is "ailgnment",
Following
..........................
<objectsToAttach xmi:id="_eStructuralFeatures" name="alignment"
unsettable="true" xsi:type="ecore:EReference">
<eAnnotations
cellEditorClassname=" com.hitachi.yokohama.dtv/com.hitachi.yokohama.dtv.editor.HLe ditor "

xsi:type=" org.eclipse.ve.internal.cde.decorators:BasePropertyDecorator "/>
</objectsToAttach>
..........................

Second i develop a Hleditror class ,Following

public class HLeditor extends DialogCellEditor implements INeedData
{
...........................
public HLeditor(Composite aComposite) {
super(aComposite);
}
//create a IJavaInstance
private static IJavaInstance createIntJavaObject(int aInt,int type)
{
String pos=pakage;
switch(aInt)
{
case 0:
switch(type)
{
case 0:
pos=pos+"HiLabel.LEFT";break;
case 1:
pos=pos+"HiLabel.FREE,10";break;
};break;
case 1:
pos=pos+"HiLabel.CENTER";break;
case 2:
pos=pos+"HiLabel.RIGHT"; break;
}
return BeanUtilities.createJavaObject(
"java.lang.Integer",
JavaEditDomainHelper.getResourceSet(fEditDomain),
BeanPropertyDescriptorAdapter.createAllocation(pos
,fEditDomain));
}


/* (non-Javadoc)
* @see
org.eclipse.jface.viewers.DialogCellEditor#openDialogBox(org .eclipse.swt.widgets.Control)
*/
protected Object openDialogBox(Control cellEditorWindow) {
....................................

if (dialog.open() != Window.CANCEL) {
return createIntJavaObject(this.postion,this.flag);
} else { return getValue();
}
}

/* (non-Javadoc)
* @see
org.eclipse.ve.internal.propertysheet.INeedData#setData(java .lang.Object)
*/
public void setData(Object data) {
fEditDomain = (EditDomain) data;
}
// A int instance varialble is created to store the value of that
property
protected void doSetValue(Object value) {
if (value != null){
INumberBeanProxy intBeanProxy = (INumberBeanProxy)
BeanProxyUtilities.getBeanProxy((IJavaInstance) value);
intValue=intBeanProxy.intValue();
}
super.doSetValue(value);
}

//update Data
protected void updateContents(Object value) {
super.updateContents(Integer.valueOf(intValue));
}
.......................................................

}

Now hava two propertis "text" and "alignment" the set Methods are
setText(String[] args) and setAlignment(int alignment ,int x)

the types how set? i try set "java.lang.Object" but
the view have error.
eg following

private IJavaInstance createStringJavaObject(String initString ) {
return BeanUtilities.createJavaObject("java.lang.Object",
JavaEditDomainHelper.getResourceSet(fEditDomain),
initString);
}

the code can genrated but the view have exception,Please tell me
,how can i do? thank you.
Previous Topic:how do i set a property for array eg: String[]
Next Topic:VE does not show up in my 3.3 installation
Goto Forum:
  


Current Time: Tue Mar 19 05:04:50 GMT 2024

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

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

Back to the top