Hello,
J ai un petit soucie lors de l ouverture de mon dialog, j obtiens une exception :
argument cannot be null juste après la méthode configureShell
Il semble que la méthode createClientArea ne soit jamais appeller
voici le code de ma classe
et l appelle a cette classe :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59 public class CreateImageDialog extends Dialog{ /** The title of the dialog.*/ private String title; /** The folder text. */ private static final String FOLDER_TITLE = "Folder : "; /** The file name text. */ private static final String FILENAME_TITLE = "File name : "; /** The image format text. */ private static final String IMAGE_FORMAT_TITLE = "Image format : "; /** * Constructor * * @param parent * The parent window * @param title * The title of the dialog * @param style * The style of the dialog */ public CreateImageDialog(Shell parent, String title){ super(parent); } /** * Configures the shell. * * @param shell * The shell to configure */ @Override protected void configureShell(Shell shell) { super.configureShell(shell); shell.setText(title); } /** * Creates and returns the contents of the upper part of this dialog. * This implementation creates a labeled text field for the URI(s) and buttons for browsing the * file system and workspace. These buttons are configured (selection listeners are added) by calling * {@link #prepareBrowseFileSystemButton} and {@link #prepareBrowseWorkspaceButton}, respectively. */ @Override protected Control createDialogArea(Composite parent) { Composite composite = (Composite)super.createDialogArea(parent); Label labelFolder = new Label(composite,SWT.NONE); labelFolder.setText(FOLDER_TITLE); labelFolder.setBounds(0,0,45,20); Text inputFolder = new Text(composite, SWT.SINGLE); inputFolder.setBounds(50,0,120,20); return composite; } }
Quelqu un voit il de quoi ca peut venir ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11 /** * Runs the action. This creates the image file. */ public void run() { CreateImageDialog dialog = new CreateImageDialog(Display.getCurrent().getActiveShell(),"Save As Image File"); dialog.open(); // Find the Figure to draw as an image GraphicalViewer viewer = (GraphicalViewer) workbenchPart.getAdapter(GraphicalViewer.class); ScalableRootEditPart editPart = (ScalableRootEditPart) viewer.getContents().getRoot(); ...
merci
Partager