Bonjour la liste,
- J'ai developpé un plugin (accessible via les actions File->New) "appli1", qui lance un wizard contenant 2 pages "MyPageOne" et "MPageTwo". Ce plugin fournit un point d'extension parmettant d'ajouter de nouvelles pages à "appli1"
La grammaire de ce point d'extension est la suivante
L'interface qui sera étendu par les plugins permettant d'ajouter de nouvelles pages est la suivante
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102 <?xml version='1.0' encoding='UTF-8'?> <!-- Schema file written by PDE --> <schema targetNamespace="com.serli.helloExtensionBis" xmlns="http://www.w3.org/2001/XMLSchema"> <annotation> <appinfo> <meta.schema plugin="com.serli.helloExtensionBis" id="com.serli.helloExtensionBis" name="Pages"/> </appinfo> <documentation> [Enter description of this extension point.] </documentation> </annotation> <element name="extension"> <annotation> <appinfo> <meta.element /> </appinfo> </annotation> <complexType> <sequence> <element ref="page" minOccurs="1" maxOccurs="unbounded"/> </sequence> <attribute name="point" type="string" use="required"> <annotation> <documentation> </documentation> </annotation> </attribute> <attribute name="id" type="string"> <annotation> <documentation> </documentation> </annotation> </attribute> <attribute name="name" type="string"> <annotation> <documentation> </documentation> <appinfo> <meta.attribute translatable="true"/> </appinfo> </annotation> </attribute> </complexType> </element> <element name="page"> <complexType> <attribute name="class" type="string" use="required"> <annotation> <documentation> </documentation> <appinfo> <meta.attribute kind="java" basedOn="org.eclipse.jface.wizard.Wizard:wizard.pages.IMyWizard"/> </appinfo> </annotation> </attribute> </complexType> </element> <annotation> <appinfo> <meta.section type="since"/> </appinfo> <documentation> [Enter the first release in which this extension point appears.] </documentation> </annotation> <annotation> <appinfo> <meta.section type="examples"/> </appinfo> <documentation> [Enter extension point usage example here.] </documentation> </annotation> <annotation> <appinfo> <meta.section type="apiinfo"/> </appinfo> <documentation> [Enter API information here.] </documentation> </annotation> <annotation> <appinfo> <meta.section type="implementation"/> </appinfo> <documentation> [Enter information about supplied implementation of this extension point.] </documentation> </annotation> </schema>La code qui permet d'ajouter les pages des autres plugins (plugins qui vont étendre le plugin courant) est
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 package wizard.pages; import org.eclipse.jface.wizard.IWizard; public interface IMyWizard extends IWizard{ @Override public void addPages(); }- J'ai par la suite créer un autre plugin "appli2" qui étend le plugin "appli1" qui devrait permettre d'ajouter de nouvelles pages à "appli1"
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
60
61
62
63
64
65
66 package wizard.pagesImpl; import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.Platform; import org.eclipse.jface.wizard.Wizard; import wizard.pages.*; public class MyWizard extends Wizard { //This must be the ID from your extension point private static final String IPAGES_ID = "com.serli.helloextensionbis.pages"; private MyPageOne one; private MyPageTwo two; public MyWizard(){ super(); setNeedsProgressMonitor(true); } public void addPages(){ one = new MyPageOne(); two = new MyPageTwo(); addPage(one); addPage(two); //******* runPagesExtension(); } @Override public boolean performFinish() { // TODO Auto-generated method stub //just put the result to the console, imagine here much more //intelligent stuff System.out.println(one.getText()); System.out.println(two.getText1()); return true; } private void runPagesExtension(){ try{ IConfigurationElement[] config = Platform.getExtensionRegistry() .getConfigurationElementsFor(IPAGES_ID); for (IConfigurationElement e : config){ Object o = e.createExecutableExtension("class"); if (o instanceof IMyWizard){ ((IMyWizard)o).addPages(); } } }catch(Exception ex){ System.out.println(ex.getMessage()); } } }
La classe permettant d'ajouter estMais seulement, lorsque j'exécute "appli1", il n'ajoute pas les pages fournies par "appli2". Je ne comprends pas ce qui se passe.
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146 package com.serli.helloextensionbisusage; import org.eclipse.jface.dialogs.IDialogSettings; import org.eclipse.jface.wizard.IWizardContainer; import org.eclipse.jface.wizard.IWizardPage; import org.eclipse.jface.wizard.Wizard; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.widgets.Composite; import wizard.pages.IMyWizard; public class AjoutPage extends Wizard implements IMyWizard { public AjoutPage() { // TODO Auto-generated constructor stub } @Override public void addPages() { // TODO Auto-generated method stub addPage(new MyPageThree()); } @Override public boolean canFinish() { // TODO Auto-generated method stub return false; } @Override public void createPageControls(Composite pageContainer) { // TODO Auto-generated method stub } @Override public void dispose() { // TODO Auto-generated method stub } @Override public IWizardContainer getContainer() { // TODO Auto-generated method stub return null; } @Override public Image getDefaultPageImage() { // TODO Auto-generated method stub return null; } @Override public IDialogSettings getDialogSettings() { // TODO Auto-generated method stub return null; } @Override public IWizardPage getNextPage(IWizardPage page) { // TODO Auto-generated method stub return null; } @Override public IWizardPage getPage(String pageName) { // TODO Auto-generated method stub return null; } @Override public int getPageCount() { // TODO Auto-generated method stub return 0; } @Override public IWizardPage[] getPages() { // TODO Auto-generated method stub return null; } @Override public IWizardPage getPreviousPage(IWizardPage page) { // TODO Auto-generated method stub return null; } @Override public IWizardPage getStartingPage() { // TODO Auto-generated method stub return null; } @Override public RGB getTitleBarColor() { // TODO Auto-generated method stub return null; } @Override public String getWindowTitle() { // TODO Auto-generated method stub return null; } @Override public boolean isHelpAvailable() { // TODO Auto-generated method stub return false; } @Override public boolean needsPreviousAndNextButtons() { // TODO Auto-generated method stub return false; } @Override public boolean needsProgressMonitor() { // TODO Auto-generated method stub return false; } @Override public boolean performCancel() { // TODO Auto-generated method stub return false; } @Override public boolean performFinish() { // TODO Auto-generated method stub return false; } @Override public void setContainer(IWizardContainer wizardContainer) { // TODO Auto-generated method stub } }
Merci d'avance pour votre aide.
Partager