newbie: Creating a JFace dialog [message #76941] |
Fri, 14 January 2005 13:49  |
Eclipse User |
|
|
|
Hi all
I'm quite new to the visual editor.
I'm trying now to create a new property sheet editor. Since I'm not fond
of writing GUI code by hand (I hate it in fact), I tried creating the
editor using the VE, without success up to now.
I'm quite sure its because I'm missing some important part...
Anybody can supply a pointer?
thx
Eric.
|
|
|
|
|
|
|
Re: newbie: Creating a JFace dialog [message #78157 is a reply to message #77919] |
Tue, 25 January 2005 01:12   |
Eclipse User |
|
|
|
Hi again.
I tried just that.
Also tried using the constants:
SWT.NONE and SWT.EMBEDDED, no use. I only get an empty dialog with ok and
cancel buttons in it.
Playing with composites like this is exactly what I am looking for. What
am I doing wrong..?
I created a composite using VE with a 2 labels and a text area. This is to
be used as a propertySheet editor. So, i have derived a class from
jface.dialogs.Dialog. In this class, i have the method:
I can't find the void method but ther is this one:
protected Control createDialogArea(Composite parent)
{
MyTestComposite comp = new MyTestComposite(parent,SWT.NULL);
return comp;
}
I can also see the createContents method but the doc discourages using it.
Anyway, no matter which I use, I always get my empty dialog.
I open the dialog from the PropertyDescriptor using this code:
result = new ExtendedDialogCellEditor(composite, getLabelProvider())
{
protected Object openDialogBox(Control cellEditorWindow)
{
TestDialog2 dialog = new TestDialog2(cellEditorWindow.getShell());
dialog.open();
return "whatever";
}
};
Sorry for the bother, but many thx for the help.
Eric.
David Orme wrote:
> Eric Giguère wrote:
>> Hi David
>> My composite class cannot be used as it is can't it? I'm missing the
>> part where I can link what I create using the VE with the dialog object.
> Your dialog object has a createControl() method for creating its UI.
> Just put one line in there:
> public void createControl(Composite parent) {
> new MyComposite(parent, SWT.NULL);
> }
> (of course, substitute your composite class for MyComposite...)
> Regards,
> Dave Orme
|
|
|
Re: newbie: Creating a JFace dialog [message #79143 is a reply to message #78157] |
Fri, 04 February 2005 15:22   |
Eclipse User |
|
|
|
Eric Giguère wrote:
> Hi again.
>
> I tried just that.
>
> Also tried using the constants:
> SWT.NONE and SWT.EMBEDDED, no use. I only get an empty dialog with ok
> and cancel buttons in it.
>
> Playing with composites like this is exactly what I am looking for. What
> am I doing wrong..?
>
> I created a composite using VE with a 2 labels and a text area. This is
> to be used as a propertySheet editor. So, i have derived a class from
> jface.dialogs.Dialog. In this class, i have the method:
>
> I can't find the void method but ther is this one:
>
> protected Control createDialogArea(Composite parent)
> {
> MyTestComposite comp = new MyTestComposite(parent,SWT.NULL);
> return comp;
> }
>
> I can also see the createContents method but the doc discourages using it.
> Anyway, no matter which I use, I always get my empty dialog.
>
> I open the dialog from the PropertyDescriptor using this code:
> result = new ExtendedDialogCellEditor(composite, getLabelProvider())
> {
> protected Object openDialogBox(Control cellEditorWindow)
> {
> TestDialog2 dialog = new TestDialog2(cellEditorWindow.getShell());
> dialog.open();
> return "whatever";
> }
> };
>
> Sorry for the bother, but many thx for the help.
I'm sorry it's taken so long to get back to you. I've had one thing
after another come up, the last being a reinstall of my whole
computer... :-}
I think you're missing a layout manager on the parent. Try inserting:
parent.setLayout(new FillLayout());
before the line that creates your test Composite. Please write back if
this doesn't work.
Best regards,
Dave Orme
|
|
|
|
Re: newbie: Creating a JFace dialog [message #79230 is a reply to message #79156] |
Sun, 06 February 2005 22:00  |
Eclipse User |
|
|
|
thx a lot David!
Eric
David J. Orme wrote:
> Eric Giguère wrote:
>> I can't find the void method but ther is this one:
>>
>> protected Control createDialogArea(Composite parent)
>> {
>> MyTestComposite comp = new MyTestComposite(parent,SWT.NULL);
>> return comp;
>> }
> This code works fine for me:
> public class TestDialog extends Dialog {
> /**
> * @param parentShell
> */
> public TestDialog(Shell parentShell) {
> super(parentShell);
> }
> /* (non-Javadoc)
> * @see
>
org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclips e.swt.widgets.Composite)
> */
> protected Control createDialogArea(Composite parent) {
> parent.setLayout(new FillLayout());
> return new MyDialogContents(parent, SWT.NULL);
> }
> }
> Best Regards,
> Dave Orme
|
|
|
|
Re: newbie: Creating a JFace dialog [message #604600 is a reply to message #76941] |
Mon, 17 January 2005 10:13  |
Eclipse User |
|
|
|
Eric Giguère wrote:
> Hi all
> I'm quite new to the visual editor. I'm trying now to create a new
> property sheet editor. Since I'm not fond of writing GUI code by hand (I
> hate it in fact), I tried creating the editor using the VE, without
> success up to now.
I suggest using VE to create a new SWT control that subclasses
Composite. Then your property sheet editor only needs to instantiate
your new control and use it. You eliminate 95%+ of manual coding that way.
Regards,
Dave Orme
--
Visual Editor Project leader
db4objects Senior Engineer (www.db4o.com)
Essential Data Project maintainer (essentialdata.sf.net)
|
|
|
Re: newbie: Creating a JFace dialog [message #604727 is a reply to message #77360] |
Wed, 19 January 2005 23:17  |
Eclipse User |
|
|
|
Hi David
I've done this, I've created a new Composite using the Visual Editor.
Now, How can I connect this composite to a dialog that will be the editor
that will be launched from the property sheet?
My composite class cannot be used as it is can't it? I'm missing the part
where I can link what I create using the VE with the dialog object.
thx for the help!
Eric.
David Orme wrote:
> Eric Giguère wrote:
>> Hi all
>> I'm quite new to the visual editor. I'm trying now to create a new
>> property sheet editor. Since I'm not fond of writing GUI code by hand (I
>> hate it in fact), I tried creating the editor using the VE, without
>> success up to now.
> I suggest using VE to create a new SWT control that subclasses
> Composite. Then your property sheet editor only needs to instantiate
> your new control and use it. You eliminate 95%+ of manual coding that way.
> Regards,
> Dave Orme
|
|
|
Re: newbie: Creating a JFace dialog [message #604768 is a reply to message #77752] |
Mon, 24 January 2005 08:48  |
Eclipse User |
|
|
|
Eric Giguère wrote:
> Hi David
> My composite class cannot be used as it is can't it? I'm missing the
> part where I can link what I create using the VE with the dialog object.
Your dialog object has a createControl() method for creating its UI.
Just put one line in there:
public void createControl(Composite parent) {
new MyComposite(parent, SWT.NULL);
}
(of course, substitute your composite class for MyComposite...)
Regards,
Dave Orme
--
Visual Editor Project leader
db4objects Senior Engineer (www.db4o.com)
Essential Data Project maintainer (essentialdata.sf.net)
|
|
|
Re: newbie: Creating a JFace dialog [message #604808 is a reply to message #77919] |
Tue, 25 January 2005 01:12  |
Eclipse User |
|
|
|
Hi again.
I tried just that.
Also tried using the constants:
SWT.NONE and SWT.EMBEDDED, no use. I only get an empty dialog with ok and
cancel buttons in it.
Playing with composites like this is exactly what I am looking for. What
am I doing wrong..?
I created a composite using VE with a 2 labels and a text area. This is to
be used as a propertySheet editor. So, i have derived a class from
jface.dialogs.Dialog. In this class, i have the method:
I can't find the void method but ther is this one:
protected Control createDialogArea(Composite parent)
{
MyTestComposite comp = new MyTestComposite(parent,SWT.NULL);
return comp;
}
I can also see the createContents method but the doc discourages using it.
Anyway, no matter which I use, I always get my empty dialog.
I open the dialog from the PropertyDescriptor using this code:
result = new ExtendedDialogCellEditor(composite, getLabelProvider())
{
protected Object openDialogBox(Control cellEditorWindow)
{
TestDialog2 dialog = new TestDialog2(cellEditorWindow.getShell());
dialog.open();
return "whatever";
}
};
Sorry for the bother, but many thx for the help.
Eric.
David Orme wrote:
> Eric Giguère wrote:
>> Hi David
>> My composite class cannot be used as it is can't it? I'm missing the
>> part where I can link what I create using the VE with the dialog object.
> Your dialog object has a createControl() method for creating its UI.
> Just put one line in there:
> public void createControl(Composite parent) {
> new MyComposite(parent, SWT.NULL);
> }
> (of course, substitute your composite class for MyComposite...)
> Regards,
> Dave Orme
|
|
|
Re: newbie: Creating a JFace dialog [message #604996 is a reply to message #78157] |
Fri, 04 February 2005 15:22  |
Eclipse User |
|
|
|
Eric Giguère wrote:
> Hi again.
>
> I tried just that.
>
> Also tried using the constants:
> SWT.NONE and SWT.EMBEDDED, no use. I only get an empty dialog with ok
> and cancel buttons in it.
>
> Playing with composites like this is exactly what I am looking for. What
> am I doing wrong..?
>
> I created a composite using VE with a 2 labels and a text area. This is
> to be used as a propertySheet editor. So, i have derived a class from
> jface.dialogs.Dialog. In this class, i have the method:
>
> I can't find the void method but ther is this one:
>
> protected Control createDialogArea(Composite parent)
> {
> MyTestComposite comp = new MyTestComposite(parent,SWT.NULL);
> return comp;
> }
>
> I can also see the createContents method but the doc discourages using it.
> Anyway, no matter which I use, I always get my empty dialog.
>
> I open the dialog from the PropertyDescriptor using this code:
> result = new ExtendedDialogCellEditor(composite, getLabelProvider())
> {
> protected Object openDialogBox(Control cellEditorWindow)
> {
> TestDialog2 dialog = new TestDialog2(cellEditorWindow.getShell());
> dialog.open();
> return "whatever";
> }
> };
>
> Sorry for the bother, but many thx for the help.
I'm sorry it's taken so long to get back to you. I've had one thing
after another come up, the last being a reinstall of my whole
computer... :-}
I think you're missing a layout manager on the parent. Try inserting:
parent.setLayout(new FillLayout());
before the line that creates your test Composite. Please write back if
this doesn't work.
Best regards,
Dave Orme
|
|
|
Re: newbie: Creating a JFace dialog [message #605000 is a reply to message #78157] |
Fri, 04 February 2005 15:59  |
Eclipse User |
|
|
|
Eric Giguère wrote:
> I can't find the void method but ther is this one:
>
> protected Control createDialogArea(Composite parent)
> {
> MyTestComposite comp = new MyTestComposite(parent,SWT.NULL);
> return comp;
> }
This code works fine for me:
public class TestDialog extends Dialog {
/**
* @param parentShell
*/
public TestDialog(Shell parentShell) {
super(parentShell);
}
/* (non-Javadoc)
* @see
org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclips e.swt.widgets.Composite)
*/
protected Control createDialogArea(Composite parent) {
parent.setLayout(new FillLayout());
return new MyDialogContents(parent, SWT.NULL);
}
}
Best Regards,
Dave Orme
|
|
|
Re: newbie: Creating a JFace dialog [message #605020 is a reply to message #79156] |
Sun, 06 February 2005 22:00  |
Eclipse User |
|
|
|
thx a lot David!
Eric
David J. Orme wrote:
> Eric Giguère wrote:
>> I can't find the void method but ther is this one:
>>
>> protected Control createDialogArea(Composite parent)
>> {
>> MyTestComposite comp = new MyTestComposite(parent,SWT.NULL);
>> return comp;
>> }
> This code works fine for me:
> public class TestDialog extends Dialog {
> /**
> * @param parentShell
> */
> public TestDialog(Shell parentShell) {
> super(parentShell);
> }
> /* (non-Javadoc)
> * @see
>
org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclips e.swt.widgets.Composite)
> */
> protected Control createDialogArea(Composite parent) {
> parent.setLayout(new FillLayout());
> return new MyDialogContents(parent, SWT.NULL);
> }
> }
> Best Regards,
> Dave Orme
|
|
|
Powered by
FUDForum. Page generated in 0.55501 seconds