* the Common Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/cpl-v10.html
*
- * Contributors: Klaus Hartlage - www.eclipseproject.de
+ * Contributors: www.phpeclipse.de
******************************************************************************/
package net.sourceforge.phpeclipse.actions;
+import java.io.File;
import java.util.List;
import net.sourceforge.phpeclipse.PHPeclipsePlugin;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.window.Window;
+import org.eclipse.search.internal.ui.util.ListContentProvider;
import org.eclipse.swt.graphics.Point;
import org.eclipse.ui.IEditorActionDelegate;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.actions.ActionDelegate;
import org.eclipse.ui.dialogs.ListSelectionDialog;
-import org.eclipse.ui.internal.dialogs.ListContentProvider;
public class PHPOpenAllIncludesEditorAction extends ActionDelegate implements IEditorActionDelegate {
private IWorkbenchWindow fWindow;
private PHPEditor fEditor;
private IProject fProject;
- private IncludesScanner fLineCreator;
+ private IncludesScanner fIncludesScanner;
public void dispose() {
}
ITextSelection selection = (ITextSelection) fEditor.getSelectionProvider().getSelection();
IDocument doc = fEditor.getDocumentProvider().getDocument(fEditor.getEditorInput());
- fLineCreator = new IncludesScanner(this, fProject, (IFileEditorInput) fEditor.getEditorInput());
+ fIncludesScanner = new IncludesScanner(fProject, (IFileEditorInput) fEditor.getEditorInput());
int pos = selection.getOffset();
// System.out.println(selection.getText());
String filename = getPHPIncludeText(doc, pos);
if (filename != null && !filename.equals("")) {
try {
- IFile file = fLineCreator.getIncludeFile(filename);
- fLineCreator.addFile(file);
+ IFile file = fIncludesScanner.getIncludeFile(filename);
+ fIncludesScanner.addFile(file);
} catch (Exception e) {
// ignore
}
try {
- List list = fLineCreator.getList();
+ List list = fIncludesScanner.getList();
if (list != null && list.size() > 0) {
- String workspaceLocation = PHPeclipsePlugin.getWorkspace().getRoot().getLocation().toString();
-
+// String workspaceLocation = PHPeclipsePlugin.getWorkspace().getRoot().getLocation().toString();
+ String workspaceLocation = fProject.getLocation().toString()+File.separatorChar;
+
ListSelectionDialog listSelectionDialog = new ListSelectionDialog(PHPeclipsePlugin.getDefault().getWorkbench()
.getActiveWorkbenchWindow().getShell(), list, new ListContentProvider(), new LabelProvider(),
"Select the includes to open.");