|
43 | 43 | */ |
44 | 44 | public class RoboconfModelerPlugin extends AbstractUIPlugin { |
45 | 45 |
|
46 | | - // The plug-in ID |
47 | | - public static final String PLUGIN_ID = "net.roboconf.eclipse.modeler"; |
| 46 | + // The plug-in ID |
| 47 | + public static final String PLUGIN_ID = "net.roboconf.eclipse.modeler"; |
48 | 48 |
|
49 | | - // The shared instance |
50 | | - private static RoboconfModelerPlugin plugin; |
51 | | - private Set<Viewpoint> viewpoints; |
| 49 | + // The shared instance |
| 50 | + private static RoboconfModelerPlugin plugin; |
| 51 | + private Set<Viewpoint> viewpoints; |
52 | 52 |
|
53 | 53 |
|
54 | | - /** |
55 | | - * Constructor. |
56 | | - */ |
57 | | - public RoboconfModelerPlugin() { |
58 | | - // nothing |
59 | | - } |
| 54 | + /** |
| 55 | + * Constructor. |
| 56 | + */ |
| 57 | + public RoboconfModelerPlugin() { |
| 58 | + // nothing |
| 59 | + } |
60 | 60 |
|
61 | 61 |
|
62 | | - @Override |
| 62 | + @Override |
63 | 63 | public void start(BundleContext context) throws Exception { |
64 | | - super.start(context); |
65 | | - plugin = this; |
| 64 | + super.start(context); |
| 65 | + plugin = this; |
66 | 66 |
|
67 | | - this.viewpoints = new HashSet<> (); |
68 | | - this.viewpoints.addAll( ViewpointRegistry.getInstance().registerFromPlugin( |
69 | | - PLUGIN_ID + "/description/graph.odesign" )); |
70 | | - } |
| 67 | + this.viewpoints = new HashSet<> (); |
| 68 | + this.viewpoints.addAll( ViewpointRegistry.getInstance().registerFromPlugin( |
| 69 | + PLUGIN_ID + "/description/graph.odesign" )); |
| 70 | + } |
71 | 71 |
|
72 | 72 |
|
73 | | - @Override |
| 73 | + @Override |
74 | 74 | public void stop(BundleContext context) throws Exception { |
75 | 75 |
|
76 | | - plugin = null; |
77 | | - if (this.viewpoints != null) { |
78 | | - for (final Viewpoint viewpoint: this.viewpoints) { |
79 | | - ViewpointRegistry.getInstance().disposeFromPlugin(viewpoint); |
80 | | - } |
| 76 | + plugin = null; |
| 77 | + if (this.viewpoints != null) { |
| 78 | + for (final Viewpoint viewpoint: this.viewpoints) { |
| 79 | + ViewpointRegistry.getInstance().disposeFromPlugin(viewpoint); |
| 80 | + } |
81 | 81 |
|
82 | | - this.viewpoints.clear(); |
83 | | - this.viewpoints = null; |
84 | | - } |
| 82 | + this.viewpoints.clear(); |
| 83 | + this.viewpoints = null; |
| 84 | + } |
85 | 85 |
|
86 | | - super.stop(context); |
87 | | - } |
| 86 | + super.stop(context); |
| 87 | + } |
88 | 88 |
|
89 | 89 |
|
90 | | - /** |
91 | | - * @return the shared instance |
92 | | - */ |
93 | | - public static RoboconfModelerPlugin getDefault() { |
94 | | - return plugin; |
95 | | - } |
| 90 | + /** |
| 91 | + * @return the shared instance |
| 92 | + */ |
| 93 | + public static RoboconfModelerPlugin getDefault() { |
| 94 | + return plugin; |
| 95 | + } |
96 | 96 |
|
97 | 97 |
|
98 | | - /** |
99 | | - * Logs an exception. |
100 | | - * @param e the exception to log |
101 | | - * @param severity the severity, given as one of the {@link IStatus} constants |
102 | | - */ |
103 | | - public static void log( Exception e, int severity ) { |
| 98 | + /** |
| 99 | + * Logs an exception. |
| 100 | + * @param e the exception to log |
| 101 | + * @param severity the severity, given as one of the {@link IStatus} constants |
| 102 | + */ |
| 103 | + public static void log( Exception e, int severity ) { |
104 | 104 |
|
105 | | - String msg = e.getMessage(); |
106 | | - if( msg == null || msg.trim().length() == 0 ) |
107 | | - msg = "An error occurred."; |
| 105 | + String msg = e.getMessage(); |
| 106 | + if( msg == null || msg.trim().length() == 0 ) |
| 107 | + msg = "An error occurred."; |
108 | 108 |
|
109 | | - IStatus status = new Status( severity, PLUGIN_ID, msg, e ); |
110 | | - getDefault().getLog().log( status ); |
111 | | - } |
| 109 | + IStatus status = new Status( severity, PLUGIN_ID, msg, e ); |
| 110 | + getDefault().getLog().log( status ); |
| 111 | + } |
112 | 112 |
|
113 | 113 |
|
114 | | - /** |
115 | | - * Logs a message. |
116 | | - * @param message the message to log |
117 | | - * @param severity the severity, given as one of the {@link IStatus} constants |
118 | | - */ |
119 | | - public static void log( String message, int severity ) { |
120 | | - IStatus status = new Status( severity, PLUGIN_ID, message ); |
121 | | - getDefault().getLog().log( status ); |
122 | | - } |
| 114 | + /** |
| 115 | + * Logs a message. |
| 116 | + * @param message the message to log |
| 117 | + * @param severity the severity, given as one of the {@link IStatus} constants |
| 118 | + */ |
| 119 | + public static void log( String message, int severity ) { |
| 120 | + IStatus status = new Status( severity, PLUGIN_ID, message ); |
| 121 | + getDefault().getLog().log( status ); |
| 122 | + } |
123 | 123 |
|
124 | 124 |
|
125 | | - public static Image findImage( String filePath ) { |
| 125 | + public static Image findImage( String filePath ) { |
126 | 126 |
|
127 | | - ImageDescriptor desc = imageDescriptorFromPlugin( PLUGIN_ID, filePath ); |
128 | | - Image img = null; |
| 127 | + ImageDescriptor desc = imageDescriptorFromPlugin( PLUGIN_ID, filePath ); |
| 128 | + Image img = null; |
129 | 129 | try { |
130 | 130 | img = desc.createImage(); |
131 | 131 |
|
132 | 132 | } catch( Exception e ) { |
133 | 133 | log( "Image " + filePath + " could not be found.", IStatus.ERROR ); |
134 | 134 | } |
135 | 135 |
|
136 | | - return img; |
137 | | - } |
| 136 | + return img; |
| 137 | + } |
138 | 138 | } |
0 commit comments