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

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是必須的屬性,我們進(jìn)行添加 -->
<!-- anchor錨點(diǎn)非必須,但是為了像Gradle插件一樣默認(rèn)顯示在右邊,我們?cè)O(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、運(yùn)行插件

總結(jié)
以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。
- IDEA開發(fā)并部署運(yùn)行WEB項(xiàng)目全過(guò)程
- Idea調(diào)用WebService的關(guān)鍵步驟和注意事項(xiàng)
- 使用IntelliJ?IDEA創(chuàng)建簡(jiǎn)單的Java?Web項(xiàng)目完整步驟
- 手把手教你idea中創(chuàng)建一個(gè)javaweb(webapp)項(xiàng)目詳細(xì)圖文教程
- mac下idea啟動(dòng)web項(xiàng)目報(bào)錯(cuò)java.net.SocketException:socket closed問(wèn)題
- idea?2024使用Maven創(chuàng)建Java?Web項(xiàng)目詳細(xì)圖文教程
相關(guān)文章
OpenTelemetry初識(shí)及調(diào)用鏈Trace詳解
這篇文章主要為為大家介紹了OpenTelemetry初識(shí)及調(diào)用鏈Trace詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2022-12-12
使用resty Quartz執(zhí)行定時(shí)任務(wù)的配置方法
這篇文章主要為大家介紹了使用resty?Quartz來(lái)執(zhí)行定時(shí)任務(wù)的配置方法,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步2022-03-03
Java編程中快速排序算法的實(shí)現(xiàn)及相關(guān)算法優(yōu)化
這篇文章主要介紹了Java編程中快速排序算法的實(shí)現(xiàn)及相關(guān)算法優(yōu)化,快速排序算法的最差時(shí)間復(fù)雜度為(n^2),最優(yōu)時(shí)間復(fù)雜度為(n\log n),存在優(yōu)化的空間,需要的朋友可以參考下2016-05-05
如何使用Gradle實(shí)現(xiàn)類似Maven的profiles功能
這篇文章主要介紹了如何使用Gradle實(shí)現(xiàn)類似Maven的profiles功能,本文通過(guò)實(shí)例代碼給大家介紹的非常詳細(xì),感興趣的朋友跟隨小編一起看看吧2024-06-06
Java中OAuth2.0第三方授權(quán)原理與實(shí)戰(zhàn)
本文主要介紹了Java中OAuth2.0第三方授權(quán)原理與實(shí)戰(zhàn),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2022-05-05
寶塔面板配置及部署javaweb教程(全網(wǎng)最全)
這篇文章主要介紹了寶塔面板配置及部署javaweb教程(全網(wǎng)最全),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2020-06-06
Spring Cloud zuul自定義統(tǒng)一異常處理實(shí)現(xiàn)方法
這篇文章主要介紹了Spring Cloud zuul自定義統(tǒng)一異常處理實(shí)現(xiàn),需要的朋友可以參考下2018-02-02
Java中內(nèi)部類使用方法實(shí)戰(zhàn)案例分析
這篇文章主要介紹了Java中內(nèi)部類使用方法,結(jié)合具體案例形式分析了Java內(nèi)部類原理、調(diào)用方法及相關(guān)使用注意事項(xiàng),需要的朋友可以參考下2019-09-09

