国产片侵犯亲女视频播放_亚洲精品二区_在线免费国产视频_欧美精品一区二区三区在线_少妇久久久_在线观看av不卡

服務器之家:專注于服務器技術(shù)及軟件下載分享
分類導航

PHP教程|ASP.NET教程|JAVA教程|ASP教程|編程技術(shù)|正則表達式|C/C++|IOS|C#|Swift|Android|JavaScript|易語言|

服務器之家 - 編程語言 - JAVA教程 - Intellij Idea插件開發(fā)之創(chuàng)建項目層級的右鍵菜單

Intellij Idea插件開發(fā)之創(chuàng)建項目層級的右鍵菜單

2021-04-07 13:26zhangmingCSDN JAVA教程

這篇文章主要介紹了Intellij Idea插件開發(fā)之創(chuàng)建項目層級的右鍵菜單,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧

在使用android studio的過程中,發(fā)現(xiàn)自帶的一些插件無法滿足項目的實際需要,便著手自己開發(fā)對應的插件。下面是我開發(fā)插件過程中的一個記錄,會持續(xù)和大家分享。

分享一:創(chuàng)建project右鍵菜單

1,按照項目向?qū)б徊揭徊絼?chuàng)建一個demo項目,就不再介紹了,可以參照這篇文章 http://www.jfrwli.cn/article/153905.html

2,創(chuàng)建action,在plugin配置文件中你會看到

?
1
2
3
<action id="firstaction" class="firstaction" text="firstaction" description="右鍵action">
  <add-to-group group-id="projectviewpopupmenu" anchor="after" relative-to-action="replaceinpath"/>
 </action>

Intellij Idea插件開發(fā)之創(chuàng)建項目層級的右鍵菜單

3,運行后,ide會另外開啟一個ide(由一個類似genymotion的容器包裹)。看效果是不是很熟悉,對,這就是常用project右鍵菜單:

Intellij Idea插件開發(fā)之創(chuàng)建項目層級的右鍵菜單

4,根據(jù)觸發(fā)的文件類型動態(tài)控制action的隱藏顯示

?
1
2
3
4
5
@override
public void update(anactionevent event) {//根據(jù)擴展名是否是jar,顯示隱藏此action
 string extension = getfileextension(event.getdatacontext());
 this.gettemplatepresentation().setenabled(extension != null && "jar".equals(extension));
}

完整代碼:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import com.intellij.openapi.actionsystem.*;
import com.intellij.openapi.project.project;
import com.intellij.openapi.ui.messages;
import com.intellij.openapi.vfs.virtualfile;
 
/**
 * created by abc on 16/8/17.
 */
public class firstaction extends anaction {
 
 private project mproject;
 
 @override
 public void actionperformed(anactionevent event) {
  mproject = event.getdata(platformdatakeys.project);
  datacontext datacontext = event.getdatacontext();
  if ("jar".equals(getfileextension(datacontext))) {//根據(jù)擴展名判定是否進行下面的處理
   //獲取選中的文件
   virtualfile file = datakeys.virtual_file.getdata(event.getdatacontext());
   if (file != null) {
    messages.showmessagedialog(mproject, file.getname(), "select file", messages.getinformationicon());
   }
  }
 }
 
 @override
 public void update(anactionevent event) {
  //在action顯示之前,根據(jù)選中文件擴展名判定是否顯示此action
  string extension = getfileextension(event.getdatacontext());
  this.gettemplatepresentation().setenabled(extension != null && "jar".equals(extension));
 }
 
 public static string getfileextension(datacontext datacontext) {
  virtualfile file = datakeys.virtual_file.getdata(datacontext);
  return file == null ? null : file.getextension();
 }
}

以上就是本文的全部內(nèi)容,希望對大家的學習有所幫助,也希望大家多多支持服務器之家

原文鏈接:http://blog.csdn.net/zhangbuzhangbu/article/details/52227403

延伸 · 閱讀

精彩推薦
主站蜘蛛池模板: 亚洲精品久久久一区二区三区 | 国产精品久久久久aaaa九色 | 视频一区二区三区在线观看 | 久久在线 | www国产在线观看 | 激情婷婷 | 国产精品成人在线视频 | 欧美福利一区二区 | 亚洲欧洲精品视频 | www.国产一区 | 狠狠躁夜夜躁人人爽天天高潮 | 五月天婷婷社区 | 色九区| 一区欧美 | 激情视频日本 | 欧美精品三区 | 高清三区 | 午夜特片网| 亚洲视屏| 久久a国产| 国产精品久久精品 | 久久99国产精品久久99果冻传媒 | 久久久精品 | 日韩a电影 | 艹艹网| 一性一交一色生活片 | 91精品国产日韩91久久久久久 | h色视频在线观看 | 日韩成人影院 | 免费欧美一级 | 中文字幕一区二区三区精彩视频 | 无毛网站 | 欧美日韩激情在线 | 夜夜春精品视频高清69式 | 精品国产乱码久久久久久丨区2区 | 国变精品美女久久久久av爽 | 国产永久免费在线观看 | 黄免费| 精品久草 | 欧洲一区二区三区精品 | 久久久高清|