Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 171083
Collapse All | Expand All

(-)src/org/eclipse/tptp/test/auto/gui/internal/resolvers/NonTrivialWidgetResolver.java (+28 lines)
Lines 247-271 Link Here
247
			{
247
			{
248
				Control[] children = ((Composite)parent).getChildren();
248
				Control[] children = ((Composite)parent).getChildren();
249
				int buttonInx = 0;
249
				int buttonInx = 0;
250
				// if there are multiple buttons with the same text label
251
				int sameTextButtons = 0;
252
				String indexWeight = "0.2";
253
				String lengthWeight = "0.3";
250
				
254
				
251
				/* Find the index of the button */
255
				/* Find the index of the button */
252
				for (int i = 0; i < children.length; i++)
256
				for (int i = 0; i < children.length; i++)
253
				{
257
				{
258
					if (text != null && children[i] instanceof Button){
259
						String label = ((Button)children[i]).getText();
260
						if (label != null){
261
							label = label.replaceAll("\\&", "");						
262
							if (label.compareTo(text)  == 0)
263
								sameTextButtons++;
264
						}
265
					}
254
					if (button == children[i])
266
					if (button == children[i])
255
					{
267
					{
256
						buttonInx = i;
268
						buttonInx = i;
257
						break;
269
						break;
258
					}
270
					}
259
				}
271
				}
272
				if (sameTextButtons > 0){
273
					// two or more buttons with the same label in the 
274
					// same child list under a composite parent
275
					// so shift the weighting to favor the button index
276
					// to get the right weighting
277
					indexWeight = "0.4";
278
					lengthWeight = "0.1";
279
				}
260
				
280
				
261
				Object[] properties = 
281
				Object[] properties = 
262
				{
282
				{
283
						new Object[] {text, "0.3"},
284
						new Object[] {hoverText, "0.3"},
285
						new Object[] {String.valueOf(children.length), lengthWeight},
286
						new Object[] {size, "0.1"},
287
						new Object[] {location, "0.1"},
288
						new Object[] {String.valueOf(buttonInx), indexWeight},
289
						/*
263
					new Object[] {text, "0.3"},
290
					new Object[] {text, "0.3"},
264
					new Object[] {hoverText, "0.3"},
291
					new Object[] {hoverText, "0.3"},
265
					new Object[] {String.valueOf(children.length), "0.3"},
292
					new Object[] {String.valueOf(children.length), "0.3"},
266
					new Object[] {size, "0.2"},
293
					new Object[] {size, "0.2"},
267
					new Object[] {location, "0.1"},
294
					new Object[] {location, "0.1"},
268
					new Object[] {String.valueOf(buttonInx), "0.2"},
295
					new Object[] {String.valueOf(buttonInx), "0.2"},
296
					*/
269
				};
297
				};
270
				
298
				
271
				float threshold = 0.7f;
299
				float threshold = 0.7f;

Return to bug 171083