也就是說,如果你按照這個教程很簡單:http://www.eclipse.org/articles/Article-Properties-View/properties-view.html
您可以創建自己的自定義屬性描述符。
我已經解決了這個問題是這樣的:
import org.apache.directory.studio.ldapbrowser.common.dialogs.TextDialog;
import org.eclipse.jface.viewers.DialogCellEditor;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
public class TextDialogCellEditor extends DialogCellEditor{
protected TextDialogCellEditor(Composite parent) {
super(parent);
}
@Override
protected Object openDialogBox(Control cellEditorWindow) {
TextDialog textDialog = new TextDialog(cellEditorWindow.getShell(),(String)getValue());
textDialog.open();
if(textDialog.getReturnCode()==textDialog.OK){
setValue(textDialog.getText());
}
return getValue();
}
}
這是你自己的描述:
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.views.properties.PropertyDescriptor;
public class TextDataPropertyDescriptor extends PropertyDescriptor{
public TextDataPropertyDescriptor(Object id, String displayName) {
super(id, displayName);
// TODO Auto-generated constructor stub
}
@Override
public CellEditor createPropertyEditor(Composite parent) {
CellEditor editor = new TextDialogCellEditor(parent);
if (getValidator() != null)
editor.setValidator(getValidator());
return editor;
}
}
用途:
properties.add(new TextDataPropertyDescriptor(YourClass.PROPERTY_CONTENT,"Content"));
使用import org.apache.directory.studio.ldapbrowser.common.dialogs.TextDialog;
,您可以更新您的日食與插件,http://directory.apache.org/studio/downloads.html, 和更新這個包,org.apache.directory.studio.ldapbrowser.common;
。
將您的代碼複製到擴展AdvancedPropertySection的類中... – nanda 2010-07-14 08:41:29