1 /* 2 * Copyright (c) 2025 Shenzhen Kaihong Digital. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 import com.intellij.openapi.actionSystem.AnAction; 17 import com.intellij.openapi.actionSystem.AnActionEvent; 18 import com.intellij.openapi.project.Project; 19 import com.intellij.openapi.ui.Messages; 20 21 /** 22 * <h3>类名:该类用于xxx</h3> 23 * description ${description} 24 * 25 * @author ${USER} 26 * date 2025-02-28 27 * @since 2025-02-28 28 * @version 1.0 29 */ 30 public class PlugTestAction extends AnAction { 31 /** 32 * 执行插件事件 33 * 34 * @param e 插件事件 35 */ 36 @Override actionPerformed(AnActionEvent e)37 public void actionPerformed(AnActionEvent e) { 38 // NEEDO: insert action logic here 39 System.out.println(" Plug Test Action!"); 40 Project project = e.getProject(); 41 if (project == null) { 42 Messages.showMessageDialog( 43 "No active project found", 44 "Error", 45 Messages.getErrorIcon() 46 ); 47 return; 48 } 49 50 String result = "Proto Message: protoMessage.toString()"; 51 52 Messages.showMessageDialog( 53 project, 54 result, 55 "Protobuf Demo", 56 Messages.getInformationIcon() 57 ); 58 } 59 } 60