Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 229449 | Differences between
and this patch

Collapse All | Expand All

(-)plugin.xml (-1 / +31 lines)
Lines 127-132 Link Here
127
				id="org.eclipse.mat.ui.openExternalFile">
127
				id="org.eclipse.mat.ui.openExternalFile">
128
			</action>
128
			</action>
129
		</actionSet>
129
		</actionSet>
130
		<actionSet
131
			id="org.eclipse.mat.ui.actionSet.openAcquireDialog"
132
			label="Acquire Heap Dump" visible="false">
133
			<action
134
				id="org.eclipse.mat.ui.openAcquireDialog"
135
				class="org.eclipse.mat.ui.acquire.AcquireSnapshotAction"
136
				icon="icons/open_snapshot.gif"
137
				label="Acquire Heap Dump ..." menubarPath="file/new.ext" style="push"
138
				toolbarPath="org.eclipse.ui.workbench.file/new.ext"
139
				tooltip="Acquire heap dump from a locally running VM" />
140
		</actionSet>
130
	</extension>
141
	</extension>
131
	
142
	
132
	<extension point="org.eclipse.ui.perspectiveExtensions">
143
	<extension point="org.eclipse.ui.perspectiveExtensions">
Lines 139-144 Link Here
139
				id="org.eclipse.mat.ui.actionSet.openIconAssist">
150
				id="org.eclipse.mat.ui.actionSet.openIconAssist">
140
			</actionSet>
151
			</actionSet>
141
		</perspectiveExtension>
152
		</perspectiveExtension>
153
		<perspectiveExtension
154
			targetID="org.eclipse.mat.ui.perspective">
155
			<actionSet
156
				id="org.eclipse.mat.ui.actionSet.openAcquireDialog">
157
			</actionSet>
158
		</perspectiveExtension>
142
	</extension>
159
	</extension>
143
160
144
	<extension point="org.eclipse.ui.commands">
161
	<extension point="org.eclipse.ui.commands">
Lines 163-168 Link Here
163
				optional="false">
180
				optional="false">
164
			</commandParameter>
181
			</commandParameter>
165
		</command>
182
		</command>
183
		<command
184
			id="org.eclipse.mat.ui.acquire.HeapDump"
185
			name="Acquire Heap Dump">
186
		</command>
166
	</extension>
187
	</extension>
167
188
168
	<extension point="org.eclipse.ui.handlers">
189
	<extension point="org.eclipse.ui.handlers">
Lines 182-187 Link Here
182
			class="org.eclipse.mat.ui.internal.actions.ExecuteInspectionHandler"
203
			class="org.eclipse.mat.ui.internal.actions.ExecuteInspectionHandler"
183
			commandId="org.eclipse.mat.ui.actions.executeInspection">
204
			commandId="org.eclipse.mat.ui.actions.executeInspection">
184
		</handler>
205
		</handler>
206
		<handler
207
			commandId="org.eclipse.mat.ui.acquire.HeapDump"
208
			class="org.eclipse.mat.ui.acquire.AcquireSnapshotAction$Handler">
209
		</handler>
185
	</extension>
210
	</extension>
186
211
187
	<extension point="org.eclipse.ui.bindings">
212
	<extension point="org.eclipse.ui.bindings">
Lines 200-205 Link Here
200
			contextId="org.eclipse.ui.contexts.window"
225
			contextId="org.eclipse.ui.contexts.window"
201
			schemeId="org.eclipse.mat.scheme" sequence="Alt+I">
226
			schemeId="org.eclipse.mat.scheme" sequence="Alt+I">
202
		</key>
227
		</key>
228
		<key
229
			commandId="org.eclipse.mat.ui.acquire.HeapDump"
230
			contextId="org.eclipse.ui.contexts.window"
231
			schemeId="org.eclipse.mat.scheme" sequence="Alt+A">
232
		</key>
203
	</extension>
233
	</extension>
204
234
205
	<extension point="org.eclipse.ui.intro.configExtension">
235
	<extension point="org.eclipse.ui.intro.configExtension">
Lines 253-257 Link Here
253
				category="org.eclipse.mat.tutorials"
283
				category="org.eclipse.mat.tutorials"
254
				name="Finding Memory Problems Tutorial"/>
284
				name="Finding Memory Problems Tutorial"/>
255
	</extension>
285
	</extension>
256
286
 
257
</plugin>
287
</plugin>
(-)src/org/eclipse/mat/ui/Messages.java (-1 / +22 lines)
Lines 273-280 Link Here
273
	public static String OverviewPane_ComponentReport;
273
	public static String OverviewPane_ComponentReport;
274
    public static String OverviewPane_NoPieChartAvailable;
274
    public static String OverviewPane_NoPieChartAvailable;
275
	public static String InspectorView_GCroot;
275
	public static String InspectorView_GCroot;
276
	
277
	public static String AcquireDialog_ChooseProcess;
278
	public static String AcquireDialog_ColumnDescription;
279
	public static String AcquireDialog_ColumnPID;
280
	public static String AcquireDialog_DialogDescription;
281
	public static String AcquireDialog_DialogName;
282
	public static String AcquireDialog_SaveLocation;
283
284
	
285
286
    public static String AcquireSnapshotAction_AcquireDialogName;
287
	public static String AcquireSnapshotAction_Confirmation;
288
	public static String AcquireSnapshotAction_DirectoryDoesntExist;
289
	public static String AcquireSnapshotAction_FailedToCreateProvider;
290
	public static String AcquireSnapshotAction_FileAlreadyExists;
291
	public static String AcquireSnapshotAction_NoProviderError;
292
	public static String AcquireSnapshotAction_UnableToCreateDirectory;
293
	public static String AcquireSnapshotAction_UnableToOpenEditor;
294
	public static String AcquireSnapshotAction_UnexpectedException;
295
276
296
277
    static
297
298
	static
278
    {
299
    {
279
        // initialize resource bundle
300
        // initialize resource bundle
280
        NLS.initializeMessages(BUNDLE_NAME, Messages.class);
301
        NLS.initializeMessages(BUNDLE_NAME, Messages.class);
(-)src/org/eclipse/mat/ui/messages.properties (+15 lines)
Lines 1-3 Link Here
1
AcquireDialog_ChooseProcess=Choose a local process:
2
AcquireDialog_ColumnDescription=Description
3
AcquireDialog_ColumnPID=Process Identifier
4
AcquireDialog_DialogDescription=Acquire a heap dump from a locally running Java process.
5
AcquireDialog_DialogName=Acquire Heap Dump Dialog
6
AcquireDialog_SaveLocation=Specify a folder to save the snapshot to:
7
AcquireSnapshotAction_AcquireDialogName=Acquire dialog
8
AcquireSnapshotAction_Confirmation=Confirmation
9
AcquireSnapshotAction_DirectoryDoesntExist=Destination directory doesn't exist. Do you want to create it?
10
AcquireSnapshotAction_FailedToCreateProvider=Failed to instantiate IHeapDumpProvider
11
AcquireSnapshotAction_FileAlreadyExists=Destination file already exists. Do you want to overwrite it?
12
AcquireSnapshotAction_NoProviderError=No Heap Dump Provider is registered
13
AcquireSnapshotAction_UnableToCreateDirectory=Unable to create the destination directory.
14
AcquireSnapshotAction_UnableToOpenEditor=Unable to open editor for the file:\n
15
AcquireSnapshotAction_UnexpectedException=Unexpected exception.
1
ArgumentsTable_AddressNotComplete=<address> is not yet complete
16
ArgumentsTable_AddressNotComplete=<address> is not yet complete
2
ArgumentsTable_Argument=Argument
17
ArgumentsTable_Argument=Argument
3
ArgumentsTable_Encountered=Encountered
18
ArgumentsTable_Encountered=Encountered
(-)src/org/eclipse/mat/ui/acquire/AcquireDialog.java (+194 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2009 SAP AG.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    SAP AG - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.mat.ui.acquire;
12
13
import java.io.File;
14
import java.util.ArrayList;
15
import java.util.List;
16
17
import org.eclipse.jface.layout.GridDataFactory;
18
import org.eclipse.jface.wizard.WizardPage;
19
import org.eclipse.mat.snapshot.acquire.IHeapDumpProvider;
20
import org.eclipse.mat.snapshot.acquire.VmInfo;
21
import org.eclipse.mat.ui.MemoryAnalyserPlugin;
22
import org.eclipse.mat.ui.Messages;
23
import org.eclipse.swt.SWT;
24
import org.eclipse.swt.events.ModifyEvent;
25
import org.eclipse.swt.events.ModifyListener;
26
import org.eclipse.swt.events.SelectionAdapter;
27
import org.eclipse.swt.events.SelectionEvent;
28
import org.eclipse.swt.layout.GridLayout;
29
import org.eclipse.swt.widgets.Button;
30
import org.eclipse.swt.widgets.Composite;
31
import org.eclipse.swt.widgets.DirectoryDialog;
32
import org.eclipse.swt.widgets.Label;
33
import org.eclipse.swt.widgets.Table;
34
import org.eclipse.swt.widgets.TableColumn;
35
import org.eclipse.swt.widgets.TableItem;
36
import org.eclipse.swt.widgets.Text;
37
38
public class AcquireDialog extends WizardPage
39
{
40
    private static final String LAST_DIRECTORY_KEY = AcquireDialog.class.getName() + ".lastDir"; //$NON-NLS-1$
41
42
    private Table localVMsTable;
43
    private Text folderText;
44
    private List<IHeapDumpProvider> dumpProviders;
45
46
    public AcquireDialog(List<IHeapDumpProvider> dumpProviders)
47
    {
48
        super("acq"); //$NON-NLS-1$
49
        this.dumpProviders = dumpProviders;
50
    }
51
52
    public void createControl(Composite parent)
53
    {
54
        setTitle(Messages.AcquireDialog_DialogName);
55
        setDescription(Messages.AcquireDialog_DialogDescription);
56
57
        final Composite top = new Composite(parent, SWT.NONE);
58
        top.setLayout(new GridLayout(2, false));
59
60
        Label l1 = new Label(top, SWT.NONE);
61
        l1.setText(Messages.AcquireDialog_ChooseProcess);
62
        GridDataFactory.swtDefaults().span(2, 1).applyTo(l1);
63
64
        localVMsTable = new Table(top, SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL | SWT.FULL_SELECTION);
65
        localVMsTable.setHeaderVisible(true);
66
        localVMsTable.setLinesVisible(true);
67
        GridDataFactory.fillDefaults().grab(true, true).span(2, 1).minSize(0, 100).applyTo(localVMsTable);
68
        localVMsTable.addSelectionListener(new SelectionAdapter()
69
        {
70
            public void widgetSelected(SelectionEvent e)
71
            {
72
                getContainer().updateButtons();
73
                String proposedFileName = getProcess().getProposedFileName();
74
                if (proposedFileName == null)
75
                	proposedFileName = "java_%pid%"; //$NON-NLS-1$
76
                
77
                proposedFileName = proposedFileName.replace("%pid%", String.valueOf(getProcess().getPid())); //$NON-NLS-1$
78
                proposedFileName = getSelectedDirectory() + File.separatorChar + proposedFileName;
79
                folderText.setText(proposedFileName);
80
            }
81
82
            public void widgetDefaultSelected(SelectionEvent e)
83
            {
84
                if (getWizard().performFinish())
85
                    getShell().close();
86
            }
87
        });
88
89
        TableColumn column = new TableColumn(localVMsTable, SWT.RIGHT);
90
        column.setText(Messages.AcquireDialog_ColumnDescription);
91
        column.setWidth(230);
92
        column = new TableColumn(localVMsTable, SWT.LEFT);
93
        column.setText(Messages.AcquireDialog_ColumnPID);
94
        column.setWidth(90);
95
96
97
        List<VmInfo> vms = getAvailableVms();
98
        if (vms != null)
99
        {
100
        	for (VmInfo process : vms)
101
        	{
102
        		TableItem item = new TableItem(localVMsTable, SWT.NONE);
103
        		item.setText(0, process.getDescription());
104
        		item.setText(1, Integer.toString(process.getPid()));
105
        		item.setData(process);
106
        	}
107
        }
108
109
        folderText = new Text(top, SWT.BORDER);
110
        GridDataFactory.fillDefaults().minSize(300, 0).grab(true, false).applyTo(folderText);
111
        folderText.setText(MemoryAnalyserPlugin.getDefault().getPluginPreferences().getString(LAST_DIRECTORY_KEY));
112
        folderText.addModifyListener(new ModifyListener()
113
        {
114
        	public void modifyText(ModifyEvent e)
115
        	{
116
        		getContainer().updateButtons();
117
        	}
118
        });
119
        Label l2 = new Label(top, SWT.NONE);
120
        l2.setText(Messages.AcquireDialog_SaveLocation);
121
        GridDataFactory.swtDefaults().span(2, 1).applyTo(l2);
122
123
124
        Button b = new Button(top, SWT.NONE);
125
        b.setText("..."); //$NON-NLS-1$
126
        b.addSelectionListener(new SelectionAdapter()
127
        {
128
            public void widgetSelected(SelectionEvent e)
129
            {
130
                DirectoryDialog dialog = new DirectoryDialog(top.getShell());
131
                String folder = dialog.open();
132
133
                if (folder != null && folder.length() > 0)
134
                    folderText.setText(folder);
135
            }
136
        });
137
138
        localVMsTable.setFocus();
139
        setControl(top);
140
    }
141
142
    private List<VmInfo> getAvailableVms()
143
	{
144
    	List<VmInfo> vms = new ArrayList<VmInfo>();
145
    	for (IHeapDumpProvider provider : dumpProviders)
146
		{
147
    		List<VmInfo> providerVMs = provider.getAvailableVMs();
148
    		if (providerVMs != null)
149
			{
150
    			vms.addAll(providerVMs);
151
			}
152
		}
153
		return vms;
154
	}
155
156
	@Override
157
    public boolean isPageComplete()
158
    {
159
        return localVMsTable.getSelectionIndex() != -1 && folderText.getText().length() > 0;
160
    }
161
162
	public VmInfo getProcess()
163
	{
164
		if (localVMsTable.getSelectionIndex() == -1) return null;
165
166
		return (VmInfo) localVMsTable.getSelection()[0].getData();
167
	}
168
169
    public String getSelectedPath()
170
    {
171
        return folderText.getText();
172
    }
173
    
174
    private String getSelectedDirectory()
175
    {
176
    	String selectedPath = folderText.getText();
177
    	if (selectedPath == null)
178
    		return ""; //$NON-NLS-1$
179
    	
180
    	// if the selection is a folder, just return it
181
    	File f = new File(selectedPath);
182
    	if (f.exists() && f.isDirectory())
183
    		return selectedPath;
184
    	
185
    	// otherwise return what seems to be the deepest folder
186
    	int i = selectedPath.lastIndexOf(File.separatorChar);
187
    	return i == -1 ? selectedPath : selectedPath.substring(0, i);
188
    }
189
190
    public void saveSettings()
191
    {
192
        MemoryAnalyserPlugin.getDefault().getPluginPreferences().setValue(LAST_DIRECTORY_KEY, getSelectedDirectory());
193
    }
194
}
(-)src/org/eclipse/mat/ui/acquire/AcquireSnapshotAction.java (+280 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2009 SAP AG.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    SAP AG - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.mat.ui.acquire;
12
13
import java.io.File;
14
import java.lang.reflect.InvocationTargetException;
15
import java.util.ArrayList;
16
import java.util.List;
17
import java.util.logging.Level;
18
import java.util.logging.Logger;
19
20
import org.eclipse.core.commands.AbstractHandler;
21
import org.eclipse.core.commands.ExecutionEvent;
22
import org.eclipse.core.runtime.CoreException;
23
import org.eclipse.core.runtime.IConfigurationElement;
24
import org.eclipse.core.runtime.IProgressMonitor;
25
import org.eclipse.core.runtime.IStatus;
26
import org.eclipse.core.runtime.Path;
27
import org.eclipse.core.runtime.Platform;
28
import org.eclipse.core.runtime.Status;
29
import org.eclipse.jface.action.Action;
30
import org.eclipse.jface.action.IAction;
31
import org.eclipse.jface.dialogs.ErrorDialog;
32
import org.eclipse.jface.dialogs.MessageDialog;
33
import org.eclipse.jface.operation.IRunnableContext;
34
import org.eclipse.jface.operation.IRunnableWithProgress;
35
import org.eclipse.jface.viewers.ISelection;
36
import org.eclipse.jface.wizard.Wizard;
37
import org.eclipse.jface.wizard.WizardDialog;
38
import org.eclipse.mat.snapshot.acquire.IHeapDumpProvider;
39
import org.eclipse.mat.snapshot.acquire.VmInfo;
40
import org.eclipse.mat.ui.Messages;
41
import org.eclipse.mat.ui.editor.PathEditorInput;
42
import org.eclipse.mat.ui.util.ErrorHelper;
43
import org.eclipse.mat.ui.util.ProgressMonitorWrapper;
44
import org.eclipse.mat.util.IProgressListener;
45
import org.eclipse.swt.widgets.Shell;
46
import org.eclipse.ui.IEditorDescriptor;
47
import org.eclipse.ui.IWorkbenchWindow;
48
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
49
import org.eclipse.ui.PlatformUI;
50
import org.eclipse.ui.ide.IDE;
51
52
public class AcquireSnapshotAction extends Action implements IWorkbenchWindowActionDelegate
53
{
54
55
	public void run()
56
	{
57
		final Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
58
59
		List<IHeapDumpProvider> dumpProviders = getProviders();
60
		if (dumpProviders == null || dumpProviders.size() == 0)
61
		{
62
			showError(Messages.AcquireSnapshotAction_NoProviderError);
63
			return;
64
		}
65
66
		final AcquireDialog acquireDialog = new AcquireDialog(dumpProviders);
67
68
		Wizard wizard = new Wizard() {
69
			public boolean performFinish()
70
			{
71
72
				VmInfo selectedProcess = acquireDialog.getProcess();
73
74
				try
75
				{
76
					String selectedPath = acquireDialog.getSelectedPath();
77
					File preferredLocation = new File(selectedPath);
78
					if (!validatePath(preferredLocation)) return false;
79
80
					// request the heap dump and check if result is OK
81
					AcquireDumpOperation dumpOperation = new AcquireDumpOperation(selectedProcess, preferredLocation, getContainer());
82
					if (!dumpOperation.run().isOK()) return false;
83
84
					File destFile = dumpOperation.getResult();
85
86
					// open the heapdump
87
					Path path = new Path(destFile.getAbsolutePath());
88
					IEditorDescriptor descriptor = PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(path.toOSString());
89
90
					try
91
					{
92
						IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), new PathEditorInput(path), descriptor.getId(),
93
								true);
94
						if (PlatformUI.getWorkbench().getIntroManager().getIntro() != null)
95
						{
96
							// if this action was called with open welcome page
97
							// - set it to standby mode.
98
							PlatformUI.getWorkbench().getIntroManager().setIntroStandby(PlatformUI.getWorkbench().getIntroManager().getIntro(), true);
99
						}
100
					}
101
					catch (Exception e)
102
					{
103
						ErrorHelper.logThrowableAndShowMessage(e, Messages.AcquireSnapshotAction_UnableToOpenEditor + path);
104
					}
105
106
					if (new File(acquireDialog.getSelectedPath()).exists()) acquireDialog.saveSettings();
107
108
				}
109
				catch (Exception e)
110
				{
111
					ErrorHelper.logThrowableAndShowMessage(e);
112
					return false;
113
				}
114
				return true;
115
			}
116
117
			private boolean validatePath(File destFile)
118
			{
119
				if (destFile.exists())
120
				{
121
					if (MessageDialog.openConfirm(shell, Messages.AcquireSnapshotAction_Confirmation, Messages.AcquireSnapshotAction_FileAlreadyExists))
122
					{
123
						destFile.delete();
124
					}
125
					else
126
					{
127
						return false;
128
					}
129
				}
130
				else if (!destFile.getParentFile().exists())
131
				{
132
					if (MessageDialog.openConfirm(shell, Messages.AcquireSnapshotAction_Confirmation, Messages.AcquireSnapshotAction_DirectoryDoesntExist))
133
					{
134
						if (!destFile.getParentFile().mkdirs())
135
						{
136
							showError(Messages.AcquireSnapshotAction_UnableToCreateDirectory);
137
							destFile = null;
138
						}
139
					}
140
					else
141
					{
142
						return false;
143
					}
144
				}
145
146
				return true;
147
			}
148
149
		};
150
151
		wizard.addPage(acquireDialog);
152
		wizard.setWindowTitle(Messages.AcquireSnapshotAction_AcquireDialogName);
153
		wizard.setNeedsProgressMonitor(true);
154
155
		new WizardDialog(shell, wizard).open();
156
	}
157
158
	private List<IHeapDumpProvider> getProviders()
159
	{
160
		IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor("org.eclipse.mat.api.heapDumpProvider"); //$NON-NLS-1$
161
		if (config.length == 0) return null;
162
163
		List<IHeapDumpProvider> providers = new ArrayList<IHeapDumpProvider>();
164
		for (IConfigurationElement configurationElement : config)
165
		{
166
			String bundleName = configurationElement.getContributor().getName();
167
			Logger.getLogger(getClass().getName()).info("Loaded heapDumpProvider from " + bundleName); //$NON-NLS-1$
168
169
			try
170
			{
171
				Object provider = configurationElement.createExecutableExtension("impl"); //$NON-NLS-1$
172
				providers.add((IHeapDumpProvider) provider);
173
			}
174
			catch (CoreException e)
175
			{
176
				Logger.getLogger(getClass().getName()).log(Level.SEVERE, Messages.AcquireSnapshotAction_FailedToCreateProvider, e);
177
			}
178
		}
179
180
		return providers;
181
	}
182
183
	private void showError(String msg)
184
	{
185
		ErrorDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Error", null, ErrorHelper.createErrorStatus(msg)); //$NON-NLS-1$
186
	}
187
188
	public void dispose()
189
	{}
190
191
	public void init(IWorkbenchWindow window)
192
	{}
193
194
	public void run(IAction action)
195
	{
196
		run();
197
	}
198
199
	public void selectionChanged(IAction action, ISelection selection)
200
	{}
201
202
	public static class Handler extends AbstractHandler
203
	{
204
205
		public Handler()
206
		{}
207
208
		public Object execute(ExecutionEvent executionEvent)
209
		{
210
			new AcquireSnapshotAction().run();
211
			return null;
212
		}
213
	}
214
215
	static class AcquireDumpOperation implements IRunnableWithProgress
216
	{
217
		private IStatus status;
218
		private IRunnableContext context;
219
		private VmInfo vmInfo;
220
		private File preferredLocation;
221
		private File result;
222
223
		public AcquireDumpOperation(VmInfo vmInfo, File preferredLocation, IRunnableContext context)
224
		{
225
			this.vmInfo = vmInfo;
226
			this.preferredLocation = preferredLocation;
227
			this.context = context;
228
		}
229
230
		private IStatus doOperation(IProgressMonitor monitor)
231
		{
232
			IProgressListener listener = new ProgressMonitorWrapper(monitor);
233
			try
234
			{
235
				result = vmInfo.getHeapDumpProvider().acquireDump(vmInfo, preferredLocation, listener);
236
237
				if (listener.isCanceled()) return Status.CANCEL_STATUS;
238
			}
239
			catch (InterruptedException ignore)
240
			{
241
				// $JL-EXC$
242
			}
243
			catch (Exception e)
244
			{
245
				return ErrorHelper.createErrorStatus(e);
246
			}
247
248
			return Status.OK_STATUS;
249
250
		}
251
252
		private File getResult()
253
		{
254
			return result;
255
		}
256
257
		public final void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException
258
		{
259
			status = doOperation(monitor);
260
		}
261
262
		public final IStatus run()
263
		{
264
			try
265
			{
266
				context.run(true, true, this);
267
			}
268
			catch (Exception e)
269
			{
270
				status = ErrorHelper.createErrorStatus(Messages.AcquireSnapshotAction_UnexpectedException, e);
271
			}
272
273
			// report error if any occurred
274
			if (!status.isOK() && status != Status.CANCEL_STATUS)
275
				ErrorDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Error", null, status); //$NON-NLS-1$
276
277
			return status;
278
		}
279
	}
280
}

Return to bug 229449