Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1447)

Unified Diff: editor/tools/plugins/com.google.dart.tools.search/src/com/google/dart/tools/search/internal/ui/text/FileSearchPage.java

Issue 10387008: External file text search engine support. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: editor/tools/plugins/com.google.dart.tools.search/src/com/google/dart/tools/search/internal/ui/text/FileSearchPage.java
===================================================================
--- editor/tools/plugins/com.google.dart.tools.search/src/com/google/dart/tools/search/internal/ui/text/FileSearchPage.java (revision 7355)
+++ editor/tools/plugins/com.google.dart.tools.search/src/com/google/dart/tools/search/internal/ui/text/FileSearchPage.java (working copy)
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, the Dart project authors.
+ * Copyright (c) 2012, the Dart project authors.
*
* Licensed under the Eclipse Public License v1.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
@@ -21,6 +21,8 @@
import com.google.dart.tools.search.ui.text.AbstractTextSearchViewPage;
import com.google.dart.tools.search.ui.text.Match;
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IAdaptable;
@@ -39,13 +41,14 @@
import org.eclipse.swt.dnd.DND;
import org.eclipse.swt.dnd.Transfer;
import org.eclipse.ui.IMemento;
-import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.actions.ActionContext;
import org.eclipse.ui.actions.ActionGroup;
+import org.eclipse.ui.ide.IDE;
import org.eclipse.ui.part.ResourceTransfer;
import org.eclipse.ui.views.navigator.NavigatorDragAdapter;
+import java.io.File;
import java.util.Set;
@SuppressWarnings("deprecation")
@@ -278,7 +281,7 @@
protected void evaluateChangedElements(Match[] matches, Set changedElements) {
if (showLineMatches()) {
for (int i = 0; i < matches.length; i++) {
- changedElements.add(((FileMatch) matches[i]).getLineElement());
+ changedElements.add(((FileResourceMatch) matches[i]).getLineElement());
}
} else {
super.evaluateChangedElements(matches, changedElements);
@@ -323,22 +326,20 @@
return;
}
}
+ if (firstElement instanceof File) {
+ IFileStore file = EFS.getLocalFileSystem().fromLocalFile((File) firstElement);
+ try {
+ IDE.openEditorOnFileStore(getSite().getPage(), file);
+ } catch (PartInitException e) {
+ ErrorDialog.openError(getSite().getShell(),
+ SearchMessages.FileSearchPage_open_file_dialog_title,
+ SearchMessages.FileSearchPage_open_file_failed, e.getStatus());
+ }
+ }
}
super.handleOpen(event);
}
- @Override
- protected void showMatch(Match match, int offset, int length, boolean activate)
- throws PartInitException {
- IFile file = (IFile) match.getElement();
- IWorkbenchPage page = getSite().getPage();
- if (offset >= 0 && length != 0) {
- openAndSelect(page, file, offset, length, activate);
- } else {
- open(page, file, activate);
- }
- }
-
private void addDragAdapters(StructuredViewer viewer) {
Transfer[] transfers = new Transfer[] {ResourceTransfer.getInstance()};
int ops = DND.DROP_COPY | DND.DROP_LINK;
@@ -360,9 +361,12 @@
}
private boolean showLineMatches() {
- AbstractTextSearchResult input = getInput();
- return getLayout() == FLAG_LAYOUT_TREE && input != null
- && !((FileSearchQuery) input.getQuery()).isFileNameSearch();
+ //TODO(pquitslund): line match presentation disabled
+ return false;
+
+// AbstractTextSearchResult input = getInput();
+// return getLayout() == FLAG_LAYOUT_TREE && input != null
+// && !((FileSearchQuery) input.getQuery()).isFileNameSearch();
}
}

Powered by Google App Engine
This is Rietveld 408576698