@@ -59,6 +59,7 @@ public class PluginsTab extends AbstractLauncherTab {
59
59
private Combo fDefaultAutoStart ;
60
60
private Spinner fDefaultStartLevel ;
61
61
private final Listener fListener ;
62
+ private boolean fActivated ;
62
63
63
64
private static final int DEFAULT_SELECTION = 0 ;
64
65
private static final int PLUGIN_SELECTION = 1 ;
@@ -156,6 +157,16 @@ public void createControl(Composite parent) {
156
157
157
158
@ Override
158
159
public void initializeFrom (ILaunchConfiguration configuration ) {
160
+ // Long-running initialization happens on first activation of this tab
161
+ }
162
+
163
+ @ Override
164
+ public void activated (ILaunchConfigurationWorkingCopy configuration ) {
165
+ if (fActivated ) {
166
+ // Since this method can be expensive, only activate this tab once.
167
+ return ;
168
+ }
169
+
159
170
try {
160
171
int index = DEFAULT_SELECTION ;
161
172
if (configuration .getAttribute (IPDELauncherConstants .USE_CUSTOM_FEATURES , false )) {
@@ -171,6 +182,9 @@ public void initializeFrom(ILaunchConfiguration configuration) {
171
182
fDefaultAutoStart .setText (Boolean .toString (auto ));
172
183
int level = configuration .getAttribute (IPDELauncherConstants .DEFAULT_START_LEVEL , 4 );
173
184
fDefaultStartLevel .setSelection (level );
185
+
186
+ // If everything ran smoothly, this tab is activated
187
+ fActivated = true ;
174
188
} catch (CoreException e ) {
175
189
PDEPlugin .log (e );
176
190
}
@@ -185,10 +199,13 @@ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
185
199
186
200
@ Override
187
201
public void performApply (ILaunchConfigurationWorkingCopy configuration ) {
202
+ if (!fActivated ) {
203
+ return ;
204
+ }
188
205
int index = fSelectionCombo .getSelectionIndex ();
189
206
configuration .setAttribute (IPDELauncherConstants .USE_DEFAULT , index == DEFAULT_SELECTION );
190
207
configuration .setAttribute (IPDELauncherConstants .USE_CUSTOM_FEATURES , index == FEATURE_SELECTION );
191
- fBlock .performApply (configuration );
208
+ fBlock .performApply (configuration );
192
209
// clear default values for auto-start and start-level if default
193
210
String autoText = fDefaultAutoStart .getText ();
194
211
if (Boolean .toString (false ).equals (autoText )) {
@@ -217,16 +234,9 @@ public Image getImage() {
217
234
return fImage ;
218
235
}
219
236
220
- /**
221
- * Validates the tab. If the feature option is chosen, and the workspace is not correctly set up,
222
- * the error message is set.
223
- *
224
- * @see org.eclipse.pde.ui.launcher.AbstractLauncherTab#validateTab()
225
- */
226
237
@ Override
227
238
public void validateTab () {
228
- String errorMessage = null ;
229
- setErrorMessage (errorMessage );
239
+ setErrorMessage (null );
230
240
}
231
241
232
242
@ Override
0 commit comments