KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > directory > ldapstudio > actions > ReportABugAction


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License. You may obtain a copy of the License at
9  *
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  */

20
21 package org.apache.directory.ldapstudio.actions;
22
23
24 import java.net.MalformedURLException JavaDoc;
25 import java.net.URL JavaDoc;
26
27 import org.apache.directory.ldapstudio.Messages;
28 import org.eclipse.jface.action.Action;
29 import org.eclipse.jface.action.IAction;
30 import org.eclipse.jface.viewers.ISelection;
31 import org.eclipse.ui.IWorkbenchWindow;
32 import org.eclipse.ui.IWorkbenchWindowActionDelegate;
33 import org.eclipse.ui.PartInitException;
34
35
36 /**
37  * The Action is used to open a browser that displays to page for opening a new Jira
38  *
39  * @author <a HREF="mailto:dev@directory.apache.org">Apache Directory Project</a>
40  * @version $Rev$, $Date$
41  */

42 public class ReportABugAction extends Action implements IWorkbenchWindowActionDelegate
43 {
44
45     /** The workbench window */
46     private IWorkbenchWindow workbenchWindow;
47
48
49     /**
50      * Creates a new instance of ReportABugAction.
51      */

52     public ReportABugAction()
53     {
54         setId( "org.apache.directory.ldapstudio.reportABug" ); //$NON-NLS-1$
55
setText( Messages.getString( "ReportABugAction.Report_a_bug" ) ); //$NON-NLS-1$
56
setToolTipText( Messages.getString( "ReportABugAction.Open_a_web_browser" ) ); //$NON-NLS-1$
57
setEnabled( true );
58     }
59
60
61     /**
62      * Creates a new instance of ReportABugAction.
63      *
64      * @param window the workbench window
65      */

66     public ReportABugAction( IWorkbenchWindow window )
67     {
68         this();
69         init( window );
70     }
71
72
73     /**
74      * {@inheritDoc}
75      */

76     public void dispose()
77     {
78         workbenchWindow = null;
79     }
80
81
82     /**
83      * {@inheritDoc}
84      */

85     public void init( IWorkbenchWindow window )
86     {
87         workbenchWindow = window;
88     }
89
90
91     /**
92      * {@inheritDoc}
93      */

94     public void run( IAction action )
95     {
96         run();
97     }
98
99
100     /**
101      * {@inheritDoc}
102      */

103     public void selectionChanged( IAction action, ISelection selection )
104     {
105     }
106
107
108     /**
109      * {@inheritDoc}
110      */

111     public void run()
112     {
113         try
114         {
115             workbenchWindow.getWorkbench().getBrowserSupport().getExternalBrowser().openURL(
116                 new URL JavaDoc( Messages.getString("ReportABugAction.JIRA_URL") ) ); //$NON-NLS-1$
117
}
118         catch ( PartInitException e )
119         {
120         }
121         catch ( MalformedURLException JavaDoc e )
122         {
123         }
124     }
125
126 }
Popular Tags