diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java index 40f3c7d6d9d..7780e958585 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java @@ -1095,6 +1095,7 @@ public class PDEUIMessages extends NLS { public static String TracingBlock_restore_default; public static String TracingBlock_restore_default_selected; + public static String TracingBlock_initializing_tracing; public static String TracingLauncherTab_name; public static String TracingLauncherTab_tracing; diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/TracingBlock.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/TracingBlock.java index dee79437636..590b3c5238e 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/TracingBlock.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/TracingBlock.java @@ -18,6 +18,7 @@ import static org.eclipse.swt.events.SelectionListener.widgetSelectedAdapter; +import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.Enumeration; import java.util.HashMap; @@ -28,9 +29,12 @@ import java.util.StringTokenizer; import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.jface.operation.IRunnableContext; +import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.CheckboxTableViewer; import org.eclipse.jface.viewers.IStructuredSelection; @@ -276,17 +280,24 @@ protected int createPropertySheet(Composite parent) { return style == SWT.NULL ? 2 : 0; } - public void initializeFrom(ILaunchConfiguration config) { + public void initializeFrom(ILaunchConfiguration config, IRunnableContext context) { fMasterOptions.clear(); disposePropertySources(); try { fTracingCheck.setSelection(config.getAttribute(IPDELauncherConstants.TRACING, false)); Map options = config.getAttribute(IPDELauncherConstants.TRACING_OPTIONS, (Map) null); - if (options == null) { - fMasterOptions.putAll(PDECore.getDefault().getTracingOptionsManager().getTracingTemplateCopy()); - } else { - fMasterOptions.putAll(PDECore.getDefault().getTracingOptionsManager().getTracingOptions(options)); - } + + // Calculating the tracing properties might be expensive + runShowingProgress(context, progressMonitor -> { + progressMonitor.beginTask(PDEUIMessages.TracingBlock_initializing_tracing, IProgressMonitor.UNKNOWN); + + final Properties properties = (options == null) + ? PDECore.getDefault().getTracingOptionsManager().getTracingTemplateCopy() + : PDECore.getDefault().getTracingOptionsManager().getTracingOptions(options); + + fMasterOptions.putAll(properties); + }); + masterCheckChanged(false); String checked = config.getAttribute(IPDELauncherConstants.TRACING_CHECKED, (String) null); if (checked == null) { @@ -323,6 +334,14 @@ public void initializeFrom(ILaunchConfiguration config) { } } + private void runShowingProgress(IRunnableContext context, IRunnableWithProgress runnable) { + try { + context.run(true, false, runnable); + } catch (InvocationTargetException | InterruptedException e) { + PDEPlugin.logException(e); + } + } + public void performApply(ILaunchConfigurationWorkingCopy config) { boolean tracingEnabled = fTracingCheck.getSelection(); config.setAttribute(IPDELauncherConstants.TRACING, tracingEnabled); diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties index b7fc95737c7..a5b57c10f67 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties @@ -601,6 +601,7 @@ TracingTab_AttributeLabel_TracingNone=Tracing select none TracingBlock_restore_default=Restore &All to Defaults TracingBlock_restore_default_selected=Restore &Selected to Defaults +TracingBlock_initializing_tracing=Initializing tracing TracingLauncherTab_name = Trac&ing TracingLauncherTab_tracing =&Enable tracing TracingLauncherTab_enableAll = E&nable All diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/TracingTab.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/TracingTab.java index 75aa4308a82..80668ba5424 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/TracingTab.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/TracingTab.java @@ -81,7 +81,7 @@ public void dispose() { @Override public void initializeFrom(ILaunchConfiguration config) { - fTracingBlock.initializeFrom(config); + fTracingBlock.initializeFrom(config, getLaunchConfigurationDialog()); } @Override