Révision 2474

tmp/org.txm.rcp/src/main/java/org/txm/rcp/AbstractSplashHandler2.java (revision 2474)
27 27
//
28 28
package org.txm.rcp;
29 29

  
30
import org.eclipse.swt.widgets.Composite;
31
import org.eclipse.ui.splash.BasicSplashHandler;
30
import org.eclipse.jface.resource.ImageDescriptor;
31
import org.eclipse.swt.events.PaintEvent;
32
import org.eclipse.swt.events.PaintListener;
33
import org.eclipse.swt.graphics.Image;
34
import org.eclipse.swt.widgets.Shell;
35
import org.eclipse.ui.internal.splash.EclipseSplashHandler;
36
import org.eclipse.ui.plugin.AbstractUIPlugin;
32 37

  
33
// TODO: Auto-generated Javadoc
34
/**
35
 * SplashScreen for TXM: not used yet
36
 */
37
public class AbstractSplashHandler2 extends BasicSplashHandler {
38

  
39
	/**
40
	 * Instantiates a new abstract splash handler2.
41
	 */
42
	public AbstractSplashHandler2() {
43
		Composite c = this.getContent();
38
//// TODO: Auto-generated Javadoc
39
///**
40
// * SplashScreen for TXM: not used yet
41
// */
42
//public class AbstractSplashHandler2 extends BasicSplashHandler {
43
//
44
//	/**
45
//	 * Instantiates a new abstract splash handler2.
46
//	 */
47
//	public AbstractSplashHandler2() {
48
//		Composite c = this.getContent();
44 49
//		new Label(c, SWT.BORDER).setText(Messages.AbstractSplashHandler2_0);
45 50
//		IProgressMonitor bundle = this.getBundleProgressMonitor();
46 51
//		// .subTask("HELLLOOOOO");
47 52
//		this.getBundleProgressMonitor().setTaskName(Messages.AbstractSplashHandler2_1);
48 53
//		System.out.println(Messages.AbstractSplashHandler2_2);
49
	}
54
//	}
55
//
56
//	/**
57
//	 * Hurler.
58
//	 *
59
//	 * @param message the message
60
//	 */
61
//	public static void hurler(String message) {
62
//
63
//	}
64
//}
50 65

  
51
	/**
52
	 * Hurler.
53
	 *
54
	 * @param message the message
55
	 */
56
	public static void hurler(String message) {
57

  
66
public class AbstractSplashHandler2 extends EclipseSplashHandler {
67
	
68
	private static final int BORDER = 10;
69
	
70
	private Image image;
71
	
72
	@Override
73
	public void init(Shell splash) {
74
		super.init(splash);
75
		
76
		// here you could check some condition on which decoration to show
77
		
78
		ImageDescriptor descriptor = IImageKeys.getImageDescriptor(IImageKeys.TXM);
79
		if (descriptor != null) {
80
			image = descriptor.createImage();
81
		}
82
		if (image != null) {
83
			final int xposition = splash.getSize().x - image.getImageData().width - BORDER;
84
			final int yposition = BORDER;
85
			getContent().addPaintListener(new PaintListener() {
86
				
87
				@Override
88
				public void paintControl(PaintEvent e) {
89
					e.gc.drawImage(image, xposition, yposition);
90
				}
91
			});
92
		}
58 93
	}
94
	
95
	@Override
96
	public void dispose() {
97
		super.dispose();
98
		if (image != null) {
99
			image.dispose();
100
		}
101
	}
102
	
59 103
}
tmp/org.txm.rcp/src/main/java/org/txm/rcp/IImageKeys.java (revision 2474)
36 36
import org.txm.utils.logger.Log;
37 37

  
38 38
/**
39
 * Stores image keys and also Image objects. 
39
 * Stores image keys and also Image objects.
40 40
 * 
41 41
 * @author mdecorde
42 42
 * @author sjacquot
43 43
 */
44 44
// FIXME: this class creates some image but never free them.
45 45
public abstract class IImageKeys {
46

  
46
	
47 47
	/** The images. */
48
	private final static HashMap<String, Image> images = new HashMap<String, Image>();
48
	private final static HashMap<String, Image> images = new HashMap<>();
49 49
	
50 50
	/** The Constant ACTION_CONCORDANCES. */
51 51
	public static final String ACTION_CONCORDANCES = "icons/concordance.png"; //$NON-NLS-1$
52
	
52 53
	public static final String CONCORDANCE_DELETE = "icons/functions/Concordances_delete_line.png"; //$NON-NLS-1$
54
	
53 55
	/** The Constant ACTION_COOCCURRENCE. */
54 56
	public static final String ACTION_COOCCURRENCE = "icons/functions/Cooccurrences.png"; //$NON-NLS-1$
55 57
	
......
91 93
	
92 94
	/** The Constant ACTION_INFO. */
93 95
	public static final String ACTION_INFO = "icons/functions/diagnostique.png"; //$NON-NLS-1$
94
		
96
	
95 97
	/** The Constant TEXT. */
96 98
	public static final String TEXT = "icons/objects/book.png"; //$NON-NLS-1$
97 99
	
......
144 146
	
145 147
	/** The Constant UNCHECKED. */
146 148
	public static final String UNCHECKED = "icons/cross.png"; //$NON-NLS-1$
147

  
149
	
148 150
	public static final String ACTION_INTERTEXTDIST = "icons/functions/dist.png"; //$NON-NLS-1$
149

  
151
	
150 152
	public static final String QUERYINDEX = "icons/functions/QueryIndex.png"; //$NON-NLS-1$
151

  
153
	
152 154
	public static final String COOCMATRIX = "icons/functions/graph.png"; //$NON-NLS-1$
153

  
155
	
154 156
	public static final String ACTION_WORDCLOUD = "icons/functions/WordCloud.png"; //$NON-NLS-1$
155

  
157
	
156 158
	public static final String CTRLSTART = "icons/control_start_blue.png"; //$NON-NLS-1$
157

  
159
	
158 160
	public static final String CTRLREVERSE = "icons/control_reverse_blue.png"; //$NON-NLS-1$
159

  
161
	
160 162
	public static final String CTRLPLAY = "icons/control_play_blue.png"; //$NON-NLS-1$
161

  
163
	
162 164
	public static final String CTRLEND = "icons/control_end_blue.png"; //$NON-NLS-1$
163

  
165
	
164 166
	public static final String CTRLFASTFORWARD = "icons/control_fastforward_blue.png"; //$NON-NLS-1$
165 167
	
166 168
	public static final String CTRLFASTFORWARDEND = "icons/control_fastforwardend_blue.png"; //$NON-NLS-1$
167

  
168

  
169
	
170
	
169 171
	public static final String CTRLREWINDSTART = "icons/control_rewindstart_blue.png"; //$NON-NLS-1$
172
	
170 173
	public static final String CTRLREWIND = "icons/control_rewind_blue.png"; //$NON-NLS-1$
171

  
174
	
172 175
	/**
173 176
	 * Chart editor export view command icon.
174 177
	 */
......
178 181
	 * Chart editor reset view command icon.
179 182
	 */
180 183
	public static final String CHARTS_RESET_VIEW = "icons/functions/charts_reset_view.png"; //$NON-NLS-1$
181

  
184
	
182 185
	/**
183 186
	 * CA Chart editor show/hide columns command icon.
184 187
	 */
......
188 191
	 * CA Chart editor show/hide rows command icon.
189 192
	 */
190 193
	public static final String CHARTS_CA_SHOW_ROWS = "icons/functions/charts_CA_show_rows.png"; //$NON-NLS-1$
191

  
194
	
192 195
	/**
193 196
	 * CAH Chart editor compute columns command icon.
194 197
	 */
......
203 206
	 * Global export chart command icon.
204 207
	 */
205 208
	public static final String CHARTS_EXPORT_CHART = "icons/functions/export_chart.png"; //$NON-NLS-1$
206

  
209
	
207 210
	/**
208 211
	 * Global export result data command icon.
209 212
	 */
210 213
	public static final String CHARTS_EXPORT_DATA = "icons/functions/export_data.png"; //$NON-NLS-1$
211

  
214
	
212 215
	public static final String PENCIL = "icons/functions/pencil.png"; //$NON-NLS-1$
216
	
213 217
	public static final String PENCIL_ADD = "icons/functions/pencil_add.png"; //$NON-NLS-1$
218
	
214 219
	public static final String PENCIL_SAVE = "icons/functions/pencil_save.png"; //$NON-NLS-1$
220
	
215 221
	public static final String PENCIL_OPEN = "icons/functions/pencil_open.png"; //$NON-NLS-1$
222
	
216 223
	public static final String PENCIL_CLOSE = "icons/functions/pencil_close.png"; //$NON-NLS-1$
217 224
	
218 225
	public static final String ACTION_ADD = "icons/add.png";//$NON-NLS-1$
226
	
219 227
	public static final String ACTION_REMOVE = "icons/remove.png";//$NON-NLS-1$
228
	
220 229
	public static final String WORLD = "icons/world.png";
221

  
230
	
222 231
	public static final String TXM_ICON = "icons/logo/TXM_logo.png";
232
	
223 233
	public static final String TXM = "icons/logo/TXM_logo_64x64.png";
224

  
234
	
235
	public static final String SPLASH = "splash.bmp";
236
	
225 237
	public static final String OPEN_DECORATOR = "icons/decorators/bullet_arrow_down.png";
238
	
226 239
	public static final String CLOSE_DECORATOR = "icons/decorators/bullet_arrow_up.png";
227

  
240
	
228 241
	public static final String TXM_FLAT_LOGO = "icons/logo/TXM_flat_logo.png";
229

  
242
	
230 243
	/**
231 244
	 * Gets the image.
232 245
	 *
......
248 261
	
249 262
	/**
250 263
	 * 
251
	 * @param plugin ID 
264
	 * @param plugin ID
252 265
	 * @param imageFilePath
253 266
	 * @return
254 267
	 */
......
258 271
	
259 272
	/**
260 273
	 * 
261
	 * @param class of plugin to find 
274
	 * @param class of plugin to find
262 275
	 * @param imageFilePath
263 276
	 * @return
264 277
	 */
......
285 298
		if (!images.containsKey(imagekey)) {
286 299
			ImageDescriptor imgg = AbstractUIPlugin.imageDescriptorFromPlugin(pluginId, imagekey);
287 300
			if (imgg == null) {
288
				Log.severe("Warning: image not found in '"+pluginId+"' -> '"+imagekey+"'");
301
				Log.severe("Warning: image not found in '" + pluginId + "' -> '" + imagekey + "'");
289 302
				return getImage("icons/null.png");
290 303
			}
291

  
304
			
292 305
			images.put(imagekey, new Image(null, imgg.getImageData()));
293 306
		}
294 307
		return images.get(imagekey);
tmp/org.txm.rcp/plugin.xml (revision 2474)
3116 3116
         point="org.eclipse.ui.splashHandlers">
3117 3117
      <splashHandler
3118 3118
            class="org.txm.rcp.AbstractSplashHandler2"
3119
            id="org.txm.rcp.splashHandler2">
3119
            id="org.txm.rcp.AbstractSplashHandler2">
3120 3120
      </splashHandler>
3121 3121
      <splashHandlerProductBinding
3122
            productId="org.txm.rcp.product"
3123
            splashId="org.txm.rcp.splash">
3122
            productId="org.txm.rcp.app"
3123
            splashId="org.txm.rcp.AbstractSplashHandler2">
3124 3124
      </splashHandlerProductBinding>
3125 3125
   </extension>
3126 3126
   <extension

Formats disponibles : Unified diff