GEF in SWT dialog [message #240915] |
Wed, 23 January 2008 10:16  |
Eclipse User |
|
|
|
Originally posted by: h.hristov.prosyst.bg
HI,
is it possible to use GEF in SWT dialog?
I tried something but figures do not paint.
I have a class which creates a shell, add a Section in the shell and in the
Section I add ScrollingGraphicalViewer
Here the open method. In ContentProvider.INSTANCE.newSampleGraph() I add
parent graph and three figures to that graph.
public void open() {
shell = new Shell(parent, SWT.DIALOG_TRIM);
shell.setSize(888, 720);
shell.setText("Editor for access control");
shell.setBackground(backgroundColor);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
layout.marginHeight = 1;
layout.marginWidth = 1;
layout.verticalSpacing = 15;
layout.horizontalSpacing = 0;
shell.setLayout(layout);
workspace = new Section(shell, SWT.BORDER);
workspace.setBackground(white);
GridData workspaceData = new GridData(880, 623);
workspaceData.horizontalSpan = 2;
workspace.setLayoutData(workspaceData);
cancelButton = new Button(shell, SWT.PUSH);
cancelButton.setText("Cancel");
GridData cancelData = new GridData(GridData.HORIZONTAL_ALIGN_END);
cancelData.horizontalIndent = 674;
cancelData.verticalIndent = 10;
cancelData.heightHint = 20;
cancelData.widthHint = 80;
cancelButton.setLayoutData(cancelData);
cancelButton.addSelectionListener(this);
okButton = new Button(shell, SWT.PUSH);
okButton.setText("OK");
GridData okData = new GridData();
okData.verticalIndent = 10;
okData.horizontalIndent = 24;
okData.widthHint = 80;
okData.heightHint = 20;
okButton.setLayoutData(okData);
okButton.addSelectionListener(this);
ScrollingGraphicalViewer viewer = new ScrollingGraphicalViewer();
viewer.createControl(workspace);
viewer.setRootEditPart(new ScalableFreeformRootEditPart());
viewer.getControl().setBackground(ColorConstants.white);
viewer.setEditPartFactory(new GraphicalEditPartFactory());
viewer.setContents(ContentProvider.INSTANCE.newSampleGraph() );
shell.setLocation(30, 30);
shell.open();
Display display = parent.getDisplay();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
white.dispose();
white = null;
backgroundColor.dispose();
backgroundColor = null;
titleColor.dispose();
titleColor = null;
backgroundOne.dispose();
backgroundOne = null;
backgroundTwo.dispose();
backgroundTwo = null;
overviewTitleColor.dispose();
overviewTitleColor = null;
tableHeaderColor.dispose();
tableHeaderColor = null;
}
regards
--
---------------------------------------------------------
dipl. eng. Hristo Hristov . Programmer
ProSyst Labs EOOD
1606 Sofia, Bulgaria . 48 Vladajska Str.
Tel. +359 2 952 35 81; Fax +359 2 953 26 17
Mobile: +359 887 398 646
http://www.prosyst.com . h.hristov@prosyst.com
---------------------------------------------------------
stay in touch with your product
---------------------------------------------------------
|
|
|
Re: GEF in SWT dialog [message #241120 is a reply to message #240915] |
Tue, 29 January 2008 10:04   |
Eclipse User |
|
|
|
Originally posted by: cfondacci.free.fr
Hello,
Yes it is possible and works well for me.
From your code, I think everything should be OK.
Are you sure "ContentProvider.INSTANCE.newSampleGraph()" does return a
non-empty graph model ?
"Hristo Hristov" <h.hristov@prosyst.bg> a écrit dans le message de
news:fn7lno$2et$1@build.eclipse.org...
> HI,
> is it possible to use GEF in SWT dialog?
> I tried something but figures do not paint.
> I have a class which creates a shell, add a Section in the shell and in
> the
> Section I add ScrollingGraphicalViewer
> Here the open method. In ContentProvider.INSTANCE.newSampleGraph() I add
> parent graph and three figures to that graph.
>
> public void open() {
> shell = new Shell(parent, SWT.DIALOG_TRIM);
> shell.setSize(888, 720);
> shell.setText("Editor for access control");
> shell.setBackground(backgroundColor);
> GridLayout layout = new GridLayout();
> layout.numColumns = 2;
> layout.marginHeight = 1;
> layout.marginWidth = 1;
> layout.verticalSpacing = 15;
> layout.horizontalSpacing = 0;
> shell.setLayout(layout);
>
> workspace = new Section(shell, SWT.BORDER);
> workspace.setBackground(white);
> GridData workspaceData = new GridData(880, 623);
> workspaceData.horizontalSpan = 2;
> workspace.setLayoutData(workspaceData);
>
> cancelButton = new Button(shell, SWT.PUSH);
> cancelButton.setText("Cancel");
> GridData cancelData = new GridData(GridData.HORIZONTAL_ALIGN_END);
> cancelData.horizontalIndent = 674;
> cancelData.verticalIndent = 10;
> cancelData.heightHint = 20;
> cancelData.widthHint = 80;
> cancelButton.setLayoutData(cancelData);
> cancelButton.addSelectionListener(this);
>
> okButton = new Button(shell, SWT.PUSH);
> okButton.setText("OK");
> GridData okData = new GridData();
> okData.verticalIndent = 10;
> okData.horizontalIndent = 24;
> okData.widthHint = 80;
> okData.heightHint = 20;
> okButton.setLayoutData(okData);
> okButton.addSelectionListener(this);
>
> ScrollingGraphicalViewer viewer = new ScrollingGraphicalViewer();
> viewer.createControl(workspace);
> viewer.setRootEditPart(new ScalableFreeformRootEditPart());
> viewer.getControl().setBackground(ColorConstants.white);
> viewer.setEditPartFactory(new GraphicalEditPartFactory());
> viewer.setContents(ContentProvider.INSTANCE.newSampleGraph() );
>
> shell.setLocation(30, 30);
>
> shell.open();
>
> Display display = parent.getDisplay();
> while (!shell.isDisposed()) {
> if (!display.readAndDispatch())
> display.sleep();
> }
> white.dispose();
> white = null;
> backgroundColor.dispose();
> backgroundColor = null;
> titleColor.dispose();
> titleColor = null;
> backgroundOne.dispose();
> backgroundOne = null;
> backgroundTwo.dispose();
> backgroundTwo = null;
> overviewTitleColor.dispose();
> overviewTitleColor = null;
> tableHeaderColor.dispose();
> tableHeaderColor = null;
> }
>
> regards
> --
> ---------------------------------------------------------
> dipl. eng. Hristo Hristov . Programmer
> ProSyst Labs EOOD
> 1606 Sofia, Bulgaria . 48 Vladajska Str.
> Tel. +359 2 952 35 81; Fax +359 2 953 26 17
> Mobile: +359 887 398 646
> http://www.prosyst.com . h.hristov@prosyst.com
> ---------------------------------------------------------
> stay in touch with your product
> ---------------------------------------------------------
>
>
|
|
|
Re: GEF in SWT dialog [message #241135 is a reply to message #241120] |
Wed, 30 January 2008 02:37  |
Eclipse User |
|
|
|
Originally posted by: h.hristov.prosyst.bg
Hi,
I replaced Section with Composite and it's worked.
--
---------------------------------------------------------
dipl. eng. Hristo Hristov . Programmer
ProSyst Labs EOOD
1606 Sofia, Bulgaria . 48 Vladajska Str.
Tel. +359 2 952 35 81; Fax +359 2 953 26 17
Mobile: +359 887 398 646
http://www.prosyst.com . h.hristov@prosyst.com
---------------------------------------------------------
stay in touch with your product
---------------------------------------------------------
"Christophe Fondacci" <cfondacci@free.fr> wrote in message
news:fnnfai$6sc$1@build.eclipse.org...
> Hello,
>
> Yes it is possible and works well for me.
> From your code, I think everything should be OK.
>
> Are you sure "ContentProvider.INSTANCE.newSampleGraph()" does return a
> non-empty graph model ?
>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03254 seconds