Repository navigation
Expand file tree
/
Copy pathShellScriptGenPlugin.java
More file actions
118 lines (108 loc) · 3.52 KB
/
Copy pathShellScriptGenPlugin.java
File metadata and controls
118 lines (108 loc) · 3.52 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
package shellScriptGen;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import org.eclipse.ui.plugin.*;
import org.eclipse.jface.resource.ImageDescriptor;
import org.osgi.framework.BundleContext;
/**
* The main plugin class to be used in the desktop.\
*
* @author Amit Nithian ([email protected]) ([email protected])
* @copyright 2006
*
* This plugin is my first ever plugin and was designed to
* export Java projects to shell scripts. Many times I have found myself
* having to manually export runtime configurations to shell scripts so that
* I can run them on computers without eclipse. Requiring eclipse should not be a requirement
* to run complex java applications and also sometimes setting up ant is not always the most
* desirable option. ALL machines have some sort of shell scripting environment and so to export
* a project's runtime configuration to this format is universally guaranteed to run on any machine provided
* that the project's folder structure is the same as the eclipse project.
*
* I am learning how to write eclipse plugins so if you have any suggestions, please
* email me at [email protected]. I don't care whether you take this plugin and modify it and
* release it again but two conditions:
* <ol>
* <li>Do NOT sell this plugin or any of its code
* <li>At least recognize the fact that your plugin is a modification of mine or that
* it was inspired by this plugin.
* </ol>
*
* This plugin was inspired by the developers of the eclipse2ant plugin and I relied on that code
* to figure out how to write this one, especially when dealing with obtaining the java projects and the
* runtime configurations.
*/
public class ShellScriptGenPlugin extends AbstractUIPlugin {
//The shared instance.
private static ShellScriptGenPlugin plugin;
//Resource bundle.
private ResourceBundle resourceBundle;
/**
* The constructor.
*/
public ShellScriptGenPlugin() {
plugin = this;
try
{
this.resourceBundle = ResourceBundle
.getBundle("shellScriptGen.ShellScriptGenResources");
}
catch (MissingResourceException x)
{
resourceBundle = null;
}
}
/**
* This method is called upon plug-in activation
*/
public void start(BundleContext context) throws Exception {
super.start(context);
}
/**
* This method is called when the plug-in is stopped
*/
public void stop(BundleContext context) throws Exception {
super.stop(context);
plugin = null;
}
/**
* Returns the shared instance.
*/
public static ShellScriptGenPlugin getDefault() {
return plugin;
}
/**
* Returns an image descriptor for the image file at the given
* plug-in relative path.
*
* @param path the path
* @return the image descriptor
*/
public static ImageDescriptor getImageDescriptor(String path) {
return AbstractUIPlugin.imageDescriptorFromPlugin("ShellScriptGen", path);
}
/**
* Returns the string from the plugin's resource bundle, or 'key' if not
* found.
*/
public static String getResourceString(String key)
{
ResourceBundle bundle = ShellScriptGenPlugin.getDefault()
.getResourceBundle();
try
{
return (bundle != null) ? bundle.getString(key) : key;
}
catch (MissingResourceException e)
{
return key;
}
}
/**
* Returns the plugin's resource bundle,
*/
public ResourceBundle getResourceBundle()
{
return resourceBundle;
}
}