idea插件訪問瀏覽器web地址實現(xiàn)方式
背景
以往在eclipse上面開發(fā)插件,有興致想嘗試Idea上玩一下插件開發(fā)。想要在idea上面訪問web地址
概要
記錄在idea上面訪問web地址
正文
1、點擊File->New->Project… 選擇IntelliJ Platform Plugin
2、點擊下一步后,輸入Project Name,然后點擊完成

3、新建Factory
package com.demo.view;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.wm.ToolWindow;
import com.intellij.openapi.wm.ToolWindowFactory;
import com.intellij.ui.content.Content;
import com.intellij.ui.content.ContentManager;
import javafx.application.Platform;
import javafx.embed.swing.JFXPanel;
import javafx.scene.Scene;
import javafx.scene.web.WebView;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
/**
* @author twilight
* @since V1.0
*/
public class MyToolWindowFactory implements ToolWindowFactory {
@Override
public void createToolWindowContent(
@NotNull Project project,
@NotNull ToolWindow toolWindow) {
ContentManager contentManager = toolWindow.getContentManager();
JFXPanel jfxPanel = new JFXPanel();
jfxPanel.setBounds(0,0,100,200);
Platform.runLater(new Runnable() {
@Override
public void run() {
WebView webView = new WebView();
jfxPanel.setScene(new Scene(webView));
webView.getEngine().load("https://m.runoob.com/maven/");
}
});
Content labelContent =
contentManager.getFactory()
.createContent(
jfxPanel,
"",
false
);
contentManager.addContent(labelContent);
}
}4、修改plugin.xml
<idea-plugin>
<id>com.demo.view.plugin.id</id>
<name>com.jcef.company</name>
<version>1.0</version>
<vendor email="support1@yourcompany.com" url="http://www.yourcomp1any.com">Your111Company</vendor>
<description>com.demo.view.plugin.desc/com.demo.view.plugin.desc</description>
<change-notes>com.demo.view.plugin.desccom.demo.view.plugin.desc
</change-notes>
<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/build_number_ranges.html for description -->
<idea-version since-build="173.0"/>
<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/plugin_compatibility.html
on how to target different products -->
<!-- uncomment to enable plugin in all products
<depends>com.intellij.modules.lang</depends>
-->
<!-- plugin.xml文件 -->
<extensions defaultExtensionNs="com.intellij">
<!-- Add your extensions here -->
<!-- id是必須的屬性,我們進行添加 -->
<!-- anchor錨點非必須,但是為了像Gradle插件一樣默認顯示在右邊,我們設(shè)置為right -->
<toolWindow id="web browser"
anchor="right"
factoryClass="com.demo.view.MyToolWindowFactory"
/>
</extensions>
</idea-plugin>5、打包插件
Build->PreparePlugin Module "XXX" For Deployment

6、安裝插件
File->settings...->Plugins

Restart IDE
7、運行插件

總結(jié)
以上為個人經(jīng)驗,希望能給大家一個參考,也希望大家多多支持腳本之家。
相關(guān)文章
OpenTelemetry初識及調(diào)用鏈Trace詳解
這篇文章主要為為大家介紹了OpenTelemetry初識及調(diào)用鏈Trace詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪2022-12-12
使用resty Quartz執(zhí)行定時任務(wù)的配置方法
這篇文章主要為大家介紹了使用resty?Quartz來執(zhí)行定時任務(wù)的配置方法,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步2022-03-03
Java編程中快速排序算法的實現(xiàn)及相關(guān)算法優(yōu)化
這篇文章主要介紹了Java編程中快速排序算法的實現(xiàn)及相關(guān)算法優(yōu)化,快速排序算法的最差時間復(fù)雜度為(n^2),最優(yōu)時間復(fù)雜度為(n\log n),存在優(yōu)化的空間,需要的朋友可以參考下2016-05-05
如何使用Gradle實現(xiàn)類似Maven的profiles功能
這篇文章主要介紹了如何使用Gradle實現(xiàn)類似Maven的profiles功能,本文通過實例代碼給大家介紹的非常詳細,感興趣的朋友跟隨小編一起看看吧2024-06-06
Java中OAuth2.0第三方授權(quán)原理與實戰(zhàn)
本文主要介紹了Java中OAuth2.0第三方授權(quán)原理與實戰(zhàn),文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2022-05-05
寶塔面板配置及部署javaweb教程(全網(wǎng)最全)
這篇文章主要介紹了寶塔面板配置及部署javaweb教程(全網(wǎng)最全),文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2020-06-06
Spring Cloud zuul自定義統(tǒng)一異常處理實現(xiàn)方法
這篇文章主要介紹了Spring Cloud zuul自定義統(tǒng)一異常處理實現(xiàn),需要的朋友可以參考下2018-02-02

