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 305263
Collapse All | Expand All

(-)src/org/eclipse/pde/internal/ui/launcher/FeatureBlock.java (-20 / +39 lines)
Lines 47-53 Link Here
47
 */
47
 */
48
public class FeatureBlock {
48
public class FeatureBlock {
49
49
50
	class FeatureTreeLabelProvider extends PDELabelProvider {
50
	class FeatureTreeLabelProvider extends StyledCellLabelProvider {
51
52
		PDELabelProvider pdeLabelProvider = new PDELabelProvider();
53
51
		/* (non-Javadoc)
54
		/* (non-Javadoc)
52
		 * @see org.eclipse.pde.internal.ui.util.SharedLabelProvider#getColumnImage(java.lang.Object, int)
55
		 * @see org.eclipse.pde.internal.ui.util.SharedLabelProvider#getColumnImage(java.lang.Object, int)
53
		 */
56
		 */
Lines 55-61 Link Here
55
			// If there is a workspace feature available, display the workspace feature icon, even if the user has selected external
58
			// If there is a workspace feature available, display the workspace feature icon, even if the user has selected external
56
			if (index == COLUMN_FEATURE_NAME) {
59
			if (index == COLUMN_FEATURE_NAME) {
57
				FeatureLaunchModel model = (FeatureLaunchModel) obj;
60
				FeatureLaunchModel model = (FeatureLaunchModel) obj;
58
				return getImage(model.getModel(true));
61
				return pdeLabelProvider.getImage(model.getModel(true));
59
			}
62
			}
60
			return null;
63
			return null;
61
		}
64
		}
Lines 65-78 Link Here
65
			switch (index) {
68
			switch (index) {
66
				case COLUMN_FEATURE_NAME :
69
				case COLUMN_FEATURE_NAME :
67
					return model.getId();
70
					return model.getId();
68
				case COLUMN_FEATURE_VERSION :
69
					return model.getVersion();
70
				case COLUMN_PLUGIN_RESOLUTION :
71
				case COLUMN_PLUGIN_RESOLUTION :
71
					return model.getResolutionLabel();
72
					return model.getResolutionLabel();
72
				default :
73
				default :
73
					return ""; //$NON-NLS-1$
74
					return ""; //$NON-NLS-1$
74
			}
75
			}
75
		}
76
		}
77
78
		public void update(ViewerCell cell) {
79
			switch (cell.getColumnIndex()) {
80
				case COLUMN_FEATURE_NAME :
81
					StyledString label = getStyledText(cell.getElement());
82
					cell.setStyleRanges(label.getStyleRanges());
83
					cell.setText(label.toString());
84
					cell.setImage(getColumnImage(cell.getElement(), COLUMN_FEATURE_NAME));
85
					break;
86
				case COLUMN_PLUGIN_RESOLUTION :
87
					cell.setText(getColumnText(cell.getElement(), COLUMN_PLUGIN_RESOLUTION));
88
					break;
89
			}
90
			super.update(cell);
91
		}
92
93
		public StyledString getStyledText(Object element) {
94
			FeatureLaunchModel model = (FeatureLaunchModel) element;
95
			StyledString styledString = new StyledString(getColumnText(element, COLUMN_FEATURE_NAME));
96
			styledString.append(" (", StyledString.QUALIFIER_STYLER); //$NON-NLS-1$
97
			String version = model.getVersion();
98
			styledString.append(version.substring(0, version.indexOf('-')), StyledString.QUALIFIER_STYLER);
99
			styledString.append(")", StyledString.QUALIFIER_STYLER); //$NON-NLS-1$
100
			return styledString;
101
		}
76
	}
102
	}
77
103
78
	class ButtonSelectionListener extends SelectionAdapter {
104
	class ButtonSelectionListener extends SelectionAdapter {
Lines 376-383 Link Here
376
	}
402
	}
377
403
378
	private static final int COLUMN_FEATURE_NAME = 0;
404
	private static final int COLUMN_FEATURE_NAME = 0;
379
	private static final int COLUMN_FEATURE_VERSION = 1;
405
	private static final int COLUMN_PLUGIN_RESOLUTION = 1;
380
	private static final int COLUMN_PLUGIN_RESOLUTION = 2;
381
406
382
	private static final String COLUMN_ID = "columnID"; //$NON-NLS-1$
407
	private static final String COLUMN_ID = "columnID"; //$NON-NLS-1$
383
	private static final String PROPERTY_RESOLUTION = "resolution"; //$NON-NLS-1$
408
	private static final String PROPERTY_RESOLUTION = "resolution"; //$NON-NLS-1$
Lines 459-479 Link Here
459
484
460
		TreeColumn column1 = new TreeColumn(fTree.getTree(), SWT.LEFT);
485
		TreeColumn column1 = new TreeColumn(fTree.getTree(), SWT.LEFT);
461
		column1.setText(PDEUIMessages.FeatureBlock_features);
486
		column1.setText(PDEUIMessages.FeatureBlock_features);
462
		column1.setWidth(300);
487
		column1.setWidth(400);
463
		column1.addSelectionListener(fListener);
488
		column1.addSelectionListener(fListener);
464
		column1.setData(COLUMN_ID, new Integer(0));
489
		column1.setData(COLUMN_ID, new Integer(COLUMN_FEATURE_NAME));
465
490
466
		TreeColumn column2 = new TreeColumn(fTree.getTree(), SWT.LEFT);
491
		TreeColumn column2 = new TreeColumn(fTree.getTree(), SWT.CENTER);
467
		column2.setText(PDEUIMessages.FeatureBlock_version);
492
		column2.setText(PDEUIMessages.FeatureBlock_pluginResolution);
468
		column2.setWidth(250);
493
		column2.setWidth(100);
469
		column2.addSelectionListener(fListener);
494
		column2.addSelectionListener(fListener);
470
		column2.setData(COLUMN_ID, new Integer(1));
495
		column2.setData(COLUMN_ID, new Integer(COLUMN_PLUGIN_RESOLUTION));
471
472
		TreeColumn column3 = new TreeColumn(fTree.getTree(), SWT.CENTER);
473
		column3.setText(PDEUIMessages.FeatureBlock_pluginResolution);
474
		column3.setWidth(100);
475
		column3.addSelectionListener(fListener);
476
		column3.setData(COLUMN_ID, new Integer(3));
477
496
478
		fTree.getTree().setHeaderVisible(true);
497
		fTree.getTree().setHeaderVisible(true);
479
		fTree.setLabelProvider(new FeatureTreeLabelProvider());
498
		fTree.setLabelProvider(new FeatureTreeLabelProvider());
Lines 487-494 Link Here
487
		String[] items = new String[] {PDEUIMessages.FeatureBlock_default, PDEUIMessages.FeatureBlock_workspaceBefore, PDEUIMessages.FeatureBlock_externalBefore};
506
		String[] items = new String[] {PDEUIMessages.FeatureBlock_default, PDEUIMessages.FeatureBlock_workspaceBefore, PDEUIMessages.FeatureBlock_externalBefore};
488
		ComboBoxCellEditor cellEditor = new ComboBoxCellEditor(fTree.getTree(), items);
507
		ComboBoxCellEditor cellEditor = new ComboBoxCellEditor(fTree.getTree(), items);
489
		cellEditor.getControl().pack();
508
		cellEditor.getControl().pack();
490
		fTree.setCellEditors(new CellEditor[] {null, null, cellEditor, cellEditor});
509
		fTree.setCellEditors(new CellEditor[] {null, cellEditor});
491
		fTree.setColumnProperties(new String[] {null, null, PROPERTY_RESOLUTION});
510
		fTree.setColumnProperties(new String[] {null, PROPERTY_RESOLUTION});
492
		fTree.setCellModifier(new LocationCellModifier());
511
		fTree.setCellModifier(new LocationCellModifier());
493
		fTree.addDoubleClickListener(new IDoubleClickListener() {
512
		fTree.addDoubleClickListener(new IDoubleClickListener() {
494
			public void doubleClick(DoubleClickEvent event) {
513
			public void doubleClick(DoubleClickEvent event) {

Return to bug 305263