提交 30445436 编写于 作者: 骏烈
上级 868df497
......@@ -11,6 +11,7 @@ testdata/
*.war
*.ear
*.gradle
#hsf files
configuration
......
......@@ -2,7 +2,7 @@
<feature
id="com.alibaba.smartfox.eclipse.feature"
label="%feature.label"
version="1.0.1.qualifier"
version="1.0.2.qualifier"
provider-name="%feature.provider_name"
plugin="com.alibaba.smartfox.eclipse.plugin"
image="smartfox.png">
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>com.alibaba.smartfox.eclipse</groupId>
<artifactId>smartfox-eclipse</artifactId>
<version>1.0.1-SNAPSHOT</version>
<version>1.0.2-SNAPSHOT</version>
</parent>
<artifactId>com.alibaba.smartfox.eclipse.feature</artifactId>
<packaging>eclipse-feature</packaging>
......
......@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: com.alibaba.smartfox.eclipse.plugin
Bundle-SymbolicName: com.alibaba.smartfox.eclipse.plugin;singleton:=true
Bundle-Version: 1.0.1.qualifier
Bundle-Version: 1.0.2.qualifier
Bundle-Activator: com.alibaba.smartfox.eclipse.SmartfoxActivator
Bundle-Vendor: Alibaba
Require-Bundle: org.eclipse.ui,
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>com.alibaba.smartfox.eclipse</groupId>
<artifactId>smartfox-eclipse</artifactId>
<version>1.0.1-SNAPSHOT</version>
<version>1.0.2-SNAPSHOT</version>
</parent>
<artifactId>com.alibaba.smartfox.eclipse.plugin</artifactId>
<packaging>eclipse-plugin</packaging>
......
......@@ -46,7 +46,8 @@ open class CodeAnalysisHandler : AbstractHandler(), IElementUpdater {
element.setTooltip(text)
}
@Throws(ExecutionException::class) override fun execute(executionEvent: ExecutionEvent): Any? {
@Throws(ExecutionException::class)
override fun execute(executionEvent: ExecutionEvent): Any? {
val selection = HandlerUtil.getCurrentSelectionChecked(executionEvent)
val part = HandlerUtil.getActivePart(executionEvent)
if (part is ViewPart) {
......
......@@ -83,8 +83,13 @@ object CodeAnalysis {
return Status.OK_STATUS
}
}
job.rule = P3CMutex
job.schedule()
job.apply {
isUser = true
isSystem = false
priority = Job.INTERACTIVE
rule = P3cMutex
schedule()
}
}
fun processFileToMakers(file: IFile, monitor: IProgressMonitor): List<MarkerViolation> {
......@@ -92,10 +97,9 @@ object CodeAnalysis {
val ruleViolations = processFile(file)
MarkerUtil.removeAllMarkers(file)
val markers = ruleViolations.map {
return ruleViolations.map {
MarkerViolation(MarkerUtil.addMarker(file, it), it)
}
return markers
}
private fun processFile(file: IFile): List<RuleViolation> {
......@@ -126,4 +130,4 @@ object CodeAnalysis {
}
return report.toList()
}
}
\ No newline at end of file
}
......@@ -15,7 +15,6 @@
*/
package com.alibaba.smartfox.eclipse.job
import org.eclipse.core.resources.IResource
import org.eclipse.core.runtime.jobs.ISchedulingRule
/**
......@@ -24,12 +23,12 @@ import org.eclipse.core.runtime.jobs.ISchedulingRule
* @author caikang
* @date 2017/06/14
*/
object P3CMutex : ISchedulingRule {
object P3cMutex : ISchedulingRule {
override fun contains(rule: ISchedulingRule?): Boolean {
return isConflicting(rule)
}
override fun isConflicting(rule: ISchedulingRule?): Boolean {
return rule == this || rule is IResource
return rule == this
}
}
\ No newline at end of file
......@@ -16,7 +16,7 @@
package com.alibaba.smartfox.eclipse.ui
import com.alibaba.smartfox.eclipse.SmartfoxActivator
import com.alibaba.smartfox.eclipse.job.P3CMutex
import com.alibaba.smartfox.eclipse.job.P3cMutex
import com.alibaba.smartfox.eclipse.util.MarkerUtil
import org.eclipse.core.resources.IFile
import org.eclipse.core.resources.IMarker
......@@ -133,7 +133,7 @@ class InspectionResultView : ViewPart() {
return Status.OK_STATUS
}
}
job.rule = P3CMutex
job.rule = P3cMutex
job.schedule()
}
}
......
......@@ -27,15 +27,16 @@ import org.eclipse.core.resources.IMarker
* @date 2017/06/13
*/
object InspectionResults {
val fileViolations = linkedMapOf<IFile, List<MarkerViolation>>()
private val fileViolations = linkedMapOf<IFile, List<MarkerViolation>>()
var contentDescription = ""
val errors: List<LevelViolations> get() = run {
val result = toLevelViolationList(fileViolations.values.flatten())
contentDescription = getContentDescription(result)
result
}
val errors: List<LevelViolations>
get() {
val result = toLevelViolationList(fileViolations.values.flatten())
contentDescription = getContentDescription(result)
return result
}
lateinit var view: InspectionResultView
......
......@@ -19,7 +19,7 @@ import com.alibaba.p3c.pmd.lang.java.rule.flowcontrol.NeedBraceRule
import com.alibaba.smartfox.eclipse.RunWithoutViewRefresh
import com.alibaba.smartfox.eclipse.SmartfoxActivator
import com.alibaba.smartfox.eclipse.job.CodeAnalysis
import com.alibaba.smartfox.eclipse.job.P3CMutex
import com.alibaba.smartfox.eclipse.job.P3cMutex
import com.alibaba.smartfox.eclipse.pmd.rule.MissingOverrideAnnotationRule
import com.alibaba.smartfox.eclipse.util.CleanUps
import com.alibaba.smartfox.eclipse.util.getResolution
......@@ -57,7 +57,7 @@ class QuickFixAction(val view: InspectionResultView) : Action("Quick Fix") {
}
private fun runJob() {
val job = object : Job("Perform Quick Fix") {
val job = object : Job("Perform P3C Quick Fix") {
override fun run(monitor: IProgressMonitor): IStatus {
val subMonitor = SubMonitor.convert(monitor, markers.size)
monitor.setTaskName("Process File")
......@@ -81,8 +81,14 @@ class QuickFixAction(val view: InspectionResultView) : Action("Quick Fix") {
return Status.OK_STATUS
}
}
job.rule = P3CMutex
job.schedule()
val outJob = object:Job("P3C Quick Fix Wait analysis finish"){
override fun run(monitor: IProgressMonitor?): IStatus {
job.schedule()
return Status.OK_STATUS
}
}
outJob.rule = P3cMutex
outJob.schedule()
}
......@@ -105,4 +111,4 @@ class QuickFixAction(val view: InspectionResultView) : Action("Quick Fix") {
return ruleName == MissingOverrideAnnotationRule::class.java.simpleName
|| ruleName == NeedBraceRule::class.java.simpleName
}
}
\ No newline at end of file
}
......@@ -33,6 +33,17 @@ data class LevelViolations(var level: String, var rules: List<RuleViolations>,
it.removeMarkers()
}
}
override fun equals(other: Any?): Boolean {
if (other !is LevelViolations) {
return false
}
return level == other.level
}
override fun hashCode(): Int {
return level.hashCode()
}
}
data class RuleViolations(var rule: String, var files: List<FileMarkers>,
......@@ -42,12 +53,34 @@ data class RuleViolations(var rule: String, var files: List<FileMarkers>,
it.removeMarkers()
}
}
override fun equals(other: Any?): Boolean {
if (other !is RuleViolations) {
return false
}
return rule == other.rule
}
override fun hashCode(): Int {
return rule.hashCode()
}
}
data class FileMarkers(var file: IFile, var markers: List<MarkerViolation>) {
fun removeMarkers() {
MarkerUtil.removeAllMarkers(file)
}
override fun equals(other: Any?): Boolean {
if (other !is FileMarkers) {
return false
}
return file == other.file
}
override fun hashCode(): Int {
return file.hashCode()
}
}
data class MarkerViolation(val marker: IMarker, val violation: RuleViolation)
\ No newline at end of file
data class MarkerViolation(val marker: IMarker, val violation: RuleViolation)
......@@ -54,7 +54,6 @@ object MarkerUtil {
@Throws(CoreException::class)
fun addMarker(file: IFile, violation: RuleViolation): IMarker {
val marker = file.createMarker(MARKER_TYPE)
marker.setAttribute(IMarker.MESSAGE, violation.description)
val severity = when (violation.rule.priority) {
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>com.alibaba.smartfox.eclipse</groupId>
<artifactId>smartfox-eclipse</artifactId>
<version>1.0.1-SNAPSHOT</version>
<version>1.0.2-SNAPSHOT</version>
</parent>
<artifactId>com.alibaba.smartfox.eclipse.updatesite</artifactId>
<packaging>eclipse-repository</packaging>
......
......@@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.alibaba.smartfox.eclipse</groupId>
<artifactId>smartfox-eclipse</artifactId>
<version>1.0.1-SNAPSHOT</version>
<version>1.0.2-SNAPSHOT</version>
<packaging>pom</packaging>
<inceptionYear>2017</inceptionYear>
<properties>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册