01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one
03: * or more contributor license agreements. See the NOTICE file
04: * distributed with this work for additional information
05: * regarding copyright ownership. The ASF licenses this file
06: * to you under the Apache License, Version 2.0 (the
07: * "License"); you may not use this file except in compliance
08: * with the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing,
13: * software distributed under the License is distributed on an
14: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15: * KIND, either express or implied. See the License for the
16: * specific language governing permissions and limitations
17: * under the License.
18: */
19: package org.apache.ideaplugin.plugin;
20:
21: import com.intellij.openapi.actionSystem.*;
22: import com.intellij.openapi.application.Application;
23: import com.intellij.openapi.application.ApplicationManager;
24: import com.intellij.openapi.project.Project;
25:
26: import javax.swing.*;
27:
28: /**
29: * Author: Deepal Jayasinghe
30: * Date: Sep 24, 2005
31: * Time: 10:22:08 AM
32: */
33: public class Axis2PluginAction extends AnAction {
34:
35: private ImageIcon myIcon;
36:
37: public Axis2PluginAction() {
38: super ("GC", "Axis2 plugins", null);
39: }
40:
41: public void actionPerformed(AnActionEvent anActionEvent) {
42: Application application = ApplicationManager.getApplication();
43: Project project = (Project) anActionEvent.getDataContext()
44: .getData(DataConstants.PROJECT);
45:
46: Axis2IdeaPlugin axis2component = (Axis2IdeaPlugin) application
47: .getComponent(Axis2IdeaPlugin.class);
48: axis2component.showTool(project);
49: }
50:
51: public void update(AnActionEvent event) {
52: super .update(event);
53: Presentation presentation = event.getPresentation();
54: if (ActionPlaces.MAIN_TOOLBAR.equals(event.getPlace())) {
55: if (myIcon == null) {
56: java.net.URL resource = Axis2PluginAction.class
57: .getResource("/icons/icon.png");
58: myIcon = new ImageIcon(resource);
59: }
60: presentation.setIcon(myIcon);
61: }
62: }
63:
64: }
|