org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/internal/util/OpenFilesRunnable.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/internal/util/OpenFilesRunnable.java Tue Aug 17 13:40:28 2010 -0700
@@ -0,0 +1,53 @@
+/**
+ * Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Symbian Foundation - initial contribution.
+ * Contributors:
+ * Description:
+ * Overview:
+ * Details:
+ * Platforms/Drives/Compatibility:
+ * Assumptions/Requirement/Pre-requisites:
+ * Failures and causes:
+ */
+package org.symbian.tools.tmw.internal.util;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.ide.IDE;
+import org.symbian.tools.tmw.ui.TMWCoreUI;
+
+public class OpenFilesRunnable implements IRunnableWithProgress {
+ private final IFile[] openFiles;
+
+ public OpenFilesRunnable(Set<IFile> openFiles) {
+ this.openFiles = openFiles.toArray(new IFile[openFiles.size()]);
+ }
+
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ monitor.beginTask("Opening files in editors", openFiles.length);
+ for (IFile file : openFiles) {
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ try {
+ IDE.openEditor(page, file);
+ } catch (PartInitException e) {
+ TMWCoreUI.log(e);
+ }
+ monitor.worked(1);
+ }
+ monitor.done();
+ }
+}