-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #60 from pszklarska/go-to-pub-dev
Add option to go to the package on pub.dev
- Loading branch information
Showing
5 changed files
with
43 additions
and
4 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
34 changes: 34 additions & 0 deletions
34
src/main/kotlin/pl/pszklarska/pubversionchecker/quickfix/GoToPubDevQuickFix.kt
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,34 @@ | ||
package pl.pszklarska.pubversionchecker.quickfix | ||
|
||
import com.intellij.codeInsight.intention.impl.BaseIntentionAction | ||
import com.intellij.ide.BrowserUtil | ||
import com.intellij.openapi.editor.Editor | ||
import com.intellij.openapi.project.Project | ||
import com.intellij.psi.PsiFile | ||
import com.intellij.util.IncorrectOperationException | ||
import pl.pszklarska.pubversionchecker.resources.Strings | ||
|
||
|
||
private const val PUB_DEV_PACKAGES_URL = "https://pub.dev/packages/" | ||
|
||
internal class GoToPubDevQuickFix( | ||
private val packageName: String | ||
) : BaseIntentionAction() { | ||
|
||
override fun getText(): String { | ||
return Strings.goToPubDevFixDescription.format(packageName) | ||
} | ||
|
||
override fun getFamilyName(): String { | ||
return Strings.fixFamilyName | ||
} | ||
|
||
override fun isAvailable(project: Project, editor: Editor, file: PsiFile): Boolean { | ||
return true | ||
} | ||
|
||
@Throws(IncorrectOperationException::class) | ||
override fun invoke(project: Project, editor: Editor, file: PsiFile) { | ||
BrowserUtil.browse(PUB_DEV_PACKAGES_URL + packageName) | ||
} | ||
} |
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