diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/AbstractPluginBlock.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/AbstractPluginBlock.java index aa6ae9a798..0bf97106e6 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/AbstractPluginBlock.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/AbstractPluginBlock.java @@ -151,8 +151,6 @@ public abstract class AbstractPluginBlock { private PluginStatusDialog fDialog; - private boolean fControlCreated; - class PluginModelNameBuffer { private final Set nameSet; @@ -460,8 +458,6 @@ public void createControl(Composite parent, int span, int indent) { SWTUtil.setButtonDimensionHint(fValidateButton); fValidateButton.addSelectionListener(fListener); - - fControlCreated = true; } private Button createButton(Composite parent, int span, int indent, String text) { @@ -947,12 +943,6 @@ private int countChecked(Object[] elements) { } public void performApply(ILaunchConfigurationWorkingCopy config) { - if (!fControlCreated) { - // This method is also being called before the proper UI elements - // are created, which might cause a NPE - return; - } - if (fAutoIncludeRequirementsButtonChanged) { boolean includeRequirements = fAutoIncludeRequirementsButton.getSelection(); config.setAttribute(IPDELauncherConstants.AUTOMATIC_INCLUDE_REQUIREMENTS, includeRequirements); diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/PluginsTab.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/PluginsTab.java index be7c2b6954..02496a126e 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/PluginsTab.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/PluginsTab.java @@ -28,7 +28,6 @@ import org.eclipse.pde.internal.ui.launcher.PluginBlock; import org.eclipse.pde.launching.IPDELauncherConstants; import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.BusyIndicator; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.events.SelectionAdapter; @@ -60,7 +59,7 @@ public class PluginsTab extends AbstractLauncherTab { private Combo fDefaultAutoStart; private Spinner fDefaultStartLevel; private final Listener fListener; - private boolean fActivated; + private boolean fActivated = false; private static final int DEFAULT_SELECTION = 0; private static final int PLUGIN_SELECTION = 1; @@ -168,30 +167,27 @@ public void activated(ILaunchConfigurationWorkingCopy configuration) { return; } - BusyIndicator.showWhile(getControl().getDisplay(), () -> { - try { - int index = DEFAULT_SELECTION; - if (configuration.getAttribute(IPDELauncherConstants.USE_CUSTOM_FEATURES, false)) { - index = FEATURE_SELECTION; - } else if (!configuration.getAttribute(IPDELauncherConstants.USE_DEFAULT, true)) { - index = PLUGIN_SELECTION; - } - fSelectionCombo.select(index); - fBlock.setActiveBlock(index); - boolean custom = fSelectionCombo.getSelectionIndex() == PLUGIN_SELECTION; - fBlock.initializeFrom(configuration, custom); - boolean auto = configuration.getAttribute(IPDELauncherConstants.DEFAULT_AUTO_START, false); - fDefaultAutoStart.setText(Boolean.toString(auto)); - int level = configuration.getAttribute(IPDELauncherConstants.DEFAULT_START_LEVEL, 4); - fDefaultStartLevel.setSelection(level); - - // If everything ran smoothly, this tab is activated - fActivated = true; - } catch (CoreException e) { - PDEPlugin.log(e); + try { + int index = DEFAULT_SELECTION; + if (configuration.getAttribute(IPDELauncherConstants.USE_CUSTOM_FEATURES, false)) { + index = FEATURE_SELECTION; + } else if (!configuration.getAttribute(IPDELauncherConstants.USE_DEFAULT, true)) { + index = PLUGIN_SELECTION; } - }); - + fSelectionCombo.select(index); + fBlock.setActiveBlock(index); + boolean custom = fSelectionCombo.getSelectionIndex() == PLUGIN_SELECTION; + fBlock.initializeFrom(configuration, custom); + boolean auto = configuration.getAttribute(IPDELauncherConstants.DEFAULT_AUTO_START, false); + fDefaultAutoStart.setText(Boolean.toString(auto)); + int level = configuration.getAttribute(IPDELauncherConstants.DEFAULT_START_LEVEL, 4); + fDefaultStartLevel.setSelection(level); + + // If everything ran smoothly, this tab is activated + fActivated = true; + } catch (CoreException e) { + PDEPlugin.log(e); + } } @Override @@ -206,7 +202,9 @@ public void performApply(ILaunchConfigurationWorkingCopy configuration) { int index = fSelectionCombo.getSelectionIndex(); configuration.setAttribute(IPDELauncherConstants.USE_DEFAULT, index == DEFAULT_SELECTION); configuration.setAttribute(IPDELauncherConstants.USE_CUSTOM_FEATURES, index == FEATURE_SELECTION); - fBlock.performApply(configuration); + if (fActivated) { + fBlock.performApply(configuration); + } // clear default values for auto-start and start-level if default String autoText = fDefaultAutoStart.getText(); if (Boolean.toString(false).equals(autoText)) {