Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
248 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
111 changes: 74 additions & 37 deletions
111
ecobertura.core/src/main/scala/ecobertura/core/state/PluginState.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 0 additions & 61 deletions
61
ecobertura.ui/src/main/scala/ecobertura/ui/util/JavaElementFinder.scala
This file was deleted.
Oops, something went wrong.
65 changes: 65 additions & 0 deletions
65
ecobertura.ui/src/main/scala/ecobertura/ui/util/SourceFileFinder.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* This file is part of eCobertura. | ||
* | ||
* Copyright (c) 2010 Joachim Hofer | ||
* All rights reserved. | ||
* | ||
* eCobertura is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* eCobertura is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with eCobertura. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package ecobertura.ui.util | ||
|
||
import java.util.logging._ | ||
import java.util.regex.Pattern | ||
|
||
import org.eclipse.core.resources._ | ||
import org.eclipse.search.core.text._ | ||
|
||
import ecobertura.ui.views.session.CoverageSessionClass | ||
|
||
object SourceFileFinder { | ||
val logger = Logger.getLogger("ecobertura.ui.util") | ||
val searchEngine = TextSearchEngine.create | ||
val everythingPattern = Pattern.compile(".*") | ||
|
||
def fromSourceFileName(sourceFileName: String) = new SourceFileFinder(sourceFileName) | ||
} | ||
|
||
class SourceFileFinder(sourceFileName: String) { | ||
import SourceFileFinder._ | ||
|
||
logger.fine("trying to find %s".format(sourceFileName)) | ||
val workspaceRoot = ResourcesPlugin.getWorkspace.getRoot | ||
val fileSearchPattern = Pattern.compile(Pattern.quote(sourceFileName)) | ||
val scope = TextSearchScope.newSearchScope(Array[IResource](workspaceRoot), | ||
fileSearchPattern, false) | ||
|
||
def find(callback: IFile => Unit) = { | ||
searchEngine.search(scope, new SearchHandler(callback), everythingPattern, null) | ||
} | ||
|
||
class SearchHandler(callback: IFile => Unit) extends TextSearchRequestor { | ||
private var matchFound = false | ||
|
||
override def acceptFile(file: IFile) = { | ||
logger.fine("file found: %s".format(file.toString)) | ||
matchFound = true | ||
callback(file) | ||
false | ||
} | ||
|
||
override def endReporting = { | ||
if (!matchFound) logger.fine("no match found") | ||
} | ||
} | ||
} |
Oops, something went wrong.