how i do develope a property dialog [message #224056] |
Fri, 27 July 2007 03:14  |
Eclipse User |
|
|
|
Originally posted by: caye5200.yahoo.com.cn
hi , i am VE new developer. now i want devloper a property dialog
int 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.
zhaoxc ( come
from china )
|
|
|
Re: how i do develope a property dialog [message #224113 is a reply to message #224056] |
Fri, 27 July 2007 09:25  |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
This is a multi-part message in MIME format.
--------------090608050303070507020002
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
You'd likely be best off to ask on the VE newsgroup:
<news://news.eclipse.org/eclipse.tools.ve>
news://news.eclipse.org/eclipse.tools.ve
I would suggest including a stack trace in your question.
zhaoxc wrote:
> hi , i am VE new developer. now i want devloper a property dialog
> int 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.
> zhaoxc (
> come
> from china )
>
--------------090608050303070507020002
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
You'd likely be best off to ask on the VE newsgroup:<a
href="news://news.eclipse.org/eclipse.tools.ve"><br>
</a>
<blockquote><a href="news://news.eclipse.org/eclipse.tools.ve">news://news.eclipse.org/eclipse.tools.ve</a><br>
</blockquote>
I would suggest including a stack trace in your question.<br>
<br>
<br>
zhaoxc wrote:
<blockquote
cite="mid:f212445f22956027e742e751f059de60$1@www.eclipse.org"
type="cite">hi , i am
|
|
|
Powered by
FUDForum. Page generated in 0.07001 seconds