001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one
003: * or more contributor license agreements. See the NOTICE file
004: * distributed with this work for additional information
005: * regarding copyright ownership. The ASF licenses this file
006: * to you under the Apache License, Version 2.0 (the
007: * "License"); you may not use this file except in compliance
008: * with the License. You may obtain a copy of the License at
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing,
013: * software distributed under the License is distributed on an
014: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015: * KIND, either express or implied. See the License for the
016: * specific language governing permissions and limitations
017: * under the License.
018: */
019: package org.apache.ideaplugin.plugin;
020:
021: import com.intellij.openapi.components.ApplicationComponent;
022: import com.intellij.openapi.options.Configurable;
023: import com.intellij.openapi.options.ConfigurationException;
024: import com.intellij.openapi.project.Project;
025: import org.apache.axis2.tools.wizardframe.CodegenFrame;
026:
027: import javax.swing.*;
028: import javax.xml.stream.XMLInputFactory;
029:
030: public class Axis2IdeaPlugin implements ApplicationComponent,
031: Configurable {
032: private CodegenFrame form;
033: private ImageIcon myIcon;
034:
035: /**
036: * Method is called after plugin is already created and configured. Plugin can start to communicate with
037: * other plugins only in this method.
038: */
039: public void initComponent() {
040: try {
041: XMLInputFactory.newInstance();
042: } catch (Exception e) {
043: //Fixing class loading issue
044: } catch (Throwable e) {
045: ////Fixing class loading issue
046: }
047:
048: if (form == null) {
049: form = new CodegenFrame();
050: form.setResizable(true);
051: form.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
052: }
053: if (myIcon == null) {
054: java.net.URL resource = Axis2IdeaPlugin.class
055: .getResource("/icons/icon.png");
056: myIcon = new ImageIcon(resource);
057: }
058: }
059:
060: /**
061: * This method is called on plugin disposal.
062: */
063: public void disposeComponent() {
064: }
065:
066: /**
067: * Returns the name of component
068: *
069: * @return String representing component name. Use PluginName.ComponentName notation
070: * to avoid conflicts.
071: */
072: public String getComponentName() {
073: return "ActionsSample.ActionsPlugin";
074: }
075:
076: public String getDisplayName() {
077: return "Axis2 Plug-ins";
078: }
079:
080: public Icon getIcon() {
081: return myIcon;
082: }
083:
084: public String getHelpTopic() {
085: return "No help available";
086: }
087:
088: public JComponent createComponent() {
089: if (form == null) {
090: form = new CodegenFrame();
091: }
092: return form.getRootComponent();
093: }
094:
095: public boolean isModified() {
096: return false;
097: }
098:
099: public void apply() throws ConfigurationException {
100:
101: }
102:
103: public void reset() {
104: //To change body of implemented methods use File | Settings | File Templates.
105: }
106:
107: public void disposeUIResources() {
108: form = null;
109: }
110:
111: public void showTool(Project project) {
112: form.setProject(project);
113: form.showUI();
114:
115: }
116: }
|