View | Details | Raw Unified | Return to bug 197056 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/pde/internal/ui/editor/schema/SchemaAttributeDetails.java (-13 / +24 lines)
Lines 9-14 Link Here
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.ui.editor.schema;
11
package org.eclipse.pde.internal.ui.editor.schema;
12
import org.eclipse.jface.layout.GridLayoutFactory;
12
import org.eclipse.osgi.util.NLS;
13
import org.eclipse.osgi.util.NLS;
13
import org.eclipse.pde.core.IModelChangedEvent;
14
import org.eclipse.pde.core.IModelChangedEvent;
14
import org.eclipse.pde.internal.core.ischema.IMetaAttribute;
15
import org.eclipse.pde.internal.core.ischema.IMetaAttribute;
Lines 28-33 Link Here
28
import org.eclipse.swt.events.SelectionAdapter;
29
import org.eclipse.swt.events.SelectionAdapter;
29
import org.eclipse.swt.events.SelectionEvent;
30
import org.eclipse.swt.events.SelectionEvent;
30
import org.eclipse.swt.graphics.Color;
31
import org.eclipse.swt.graphics.Color;
32
import org.eclipse.swt.layout.GridData;
31
import org.eclipse.swt.widgets.Button;
33
import org.eclipse.swt.widgets.Button;
32
import org.eclipse.swt.widgets.Composite;
34
import org.eclipse.swt.widgets.Composite;
33
import org.eclipse.swt.widgets.Label;
35
import org.eclipse.swt.widgets.Label;
Lines 79-84 Link Here
79
		Color foreground = toolkit.getColors().getColor(IFormColors.TITLE);
81
		Color foreground = toolkit.getColors().getColor(IFormColors.TITLE);
80
		
82
		
81
		fName = new FormEntry(parent, toolkit, PDEUIMessages.SchemaDetails_name, SWT.NONE);
83
		fName = new FormEntry(parent, toolkit, PDEUIMessages.SchemaDetails_name, SWT.NONE);
84
		// Ensures label columns on every detail page are same width
85
		((GridData)fName.getLabel().getLayoutData()).widthHint = minLabelWeight;
82
		
86
		
83
		Label label = toolkit.createLabel(parent, PDEUIMessages.SchemaDetails_deprecated);
87
		Label label = toolkit.createLabel(parent, PDEUIMessages.SchemaDetails_deprecated);
84
		label.setForeground(foreground);
88
		label.setForeground(foreground);
Lines 86-102 Link Here
86
		fDepTrue = buttons[0];
90
		fDepTrue = buttons[0];
87
		fDepFalse = buttons[1];
91
		fDepFalse = buttons[1];
88
92
89
		label = toolkit.createLabel(parent, PDEUIMessages.SchemaAttributeDetails_type);
93
		label = toolkit.createLabel(parent, PDEUIMessages.SchemaAttributeDetails_use);
90
		label.setForeground(foreground);
94
		label.setForeground(foreground);
91
		fType = createComboPart(parent, toolkit, TYPES, 2);
92
		
95
		
93
		createTypeDetails(parent, toolkit);
96
		Composite useComp = toolkit.createComposite(parent);
97
		GridData gd = new GridData(GridData.FILL_HORIZONTAL);
98
		gd.horizontalSpan = 2;
99
		useComp.setLayoutData(gd);
100
		useComp.setLayout(GridLayoutFactory.fillDefaults().margins(0,0).numColumns(2).create());
94
		
101
		
95
		label = toolkit.createLabel(parent, PDEUIMessages.SchemaAttributeDetails_use);
102
		fUse = createComboPart(useComp, toolkit, USE, 1, SWT.NONE);
103
		
104
		fValue = new FormEntry(useComp, toolkit, null, 0, 1);
105
		
106
		label = toolkit.createLabel(parent, PDEUIMessages.SchemaAttributeDetails_type);
96
		label.setForeground(foreground);
107
		label.setForeground(foreground);
97
		fUse = createComboPart(parent, toolkit, USE, 2);
108
		fType = createComboPart(parent, toolkit, TYPES, 2);
98
		
109
		
99
		fValue = new FormEntry(parent, toolkit, PDEUIMessages.SchemaAttributeDetails_defaultValue, null, false, 6);
110
		createTypeDetails(parent, toolkit);
100
		
111
		
101
		toolkit.paintBordersFor(parent);
112
		toolkit.paintBordersFor(parent);
102
		setText(PDEUIMessages.SchemaAttributeDetails_title);
113
		setText(PDEUIMessages.SchemaAttributeDetails_title);
Lines 119-132 Link Here
119
		
130
		
120
		fUse.select(fAttribute.getUse());
131
		fUse.select(fAttribute.getUse());
121
		Object value = fAttribute.getValue();
132
		Object value = fAttribute.getValue();
122
		fValue.setValue(value != null ? value.toString() : "", true); //$NON-NLS-1$
133
		fValue.setValue(value != null ? value.toString() : PDEUIMessages.SchemaAttributeDetails_defaultDefaultValue, true);
123
		
134
		
124
		boolean editable = isEditableElement();
135
		boolean editable = isEditableElement();
125
		if (fAttribute.getUse() != 2) {
136
		if (fAttribute.getUse() != 2) {
126
			fValue.getLabel().setEnabled(false);
127
			fValue.getText().setEditable(false);
137
			fValue.getText().setEditable(false);
138
			fValue.getText().setEnabled(false);
128
		} else {
139
		} else {
129
			fValue.setEditable(editable);
140
			fValue.setEditable(editable);
141
			fValue.getText().setEnabled(true);
130
		}
142
		}
131
		fName.setEditable(editable);
143
		fName.setEditable(editable);
132
		fDepTrue.setEnabled(editable);
144
		fDepTrue.setEnabled(editable);
Lines 206-219 Link Here
206
					return;
218
					return;
207
				int use = fUse.getSelectionIndex();
219
				int use = fUse.getSelectionIndex();
208
				fAttribute.setUse(use);
220
				fAttribute.setUse(use);
209
				fValue.getLabel().setEnabled(use == 2);
221
				fValue.setEditable(use == 2);
210
				fValue.getText().setEditable(use == 2);
222
				fValue.getText().setEnabled(use == 2);
211
				if (use == 2 && fValue.getValue().length() == 0) {
223
				if (use == 2 && fValue.getValue().equals(PDEUIMessages.SchemaAttributeDetails_defaultDefaultValue)) {
212
					fValue.setValue(PDEUIMessages.SchemaAttributeDetails_defaultDefaultValue);
213
					fValue.getText().setSelection(0, fValue.getValue().length());
224
					fValue.getText().setSelection(0, fValue.getValue().length());
214
					fValue.getText().setFocus();
225
					fValue.getText().setFocus();
215
				} else if (use != 2)
226
				} else if (use != 2)
216
					fValue.setValue(""); //$NON-NLS-1$
227
					fValue.setValue(PDEUIMessages.SchemaAttributeDetails_defaultDefaultValue);
217
				
228
				
218
			}
229
			}
219
		});
230
		});
(-)src/org/eclipse/pde/internal/ui/editor/schema/SchemaElementDetails.java (-1 / +4 lines)
Lines 31-36 Link Here
31
import org.eclipse.swt.events.SelectionAdapter;
31
import org.eclipse.swt.events.SelectionAdapter;
32
import org.eclipse.swt.events.SelectionEvent;
32
import org.eclipse.swt.events.SelectionEvent;
33
import org.eclipse.swt.graphics.Color;
33
import org.eclipse.swt.graphics.Color;
34
import org.eclipse.swt.layout.GridData;
34
import org.eclipse.swt.widgets.Button;
35
import org.eclipse.swt.widgets.Button;
35
import org.eclipse.swt.widgets.Composite;
36
import org.eclipse.swt.widgets.Composite;
36
import org.eclipse.swt.widgets.Label;
37
import org.eclipse.swt.widgets.Label;
Lines 57-63 Link Here
57
		Color foreground = toolkit.getColors().getColor(IFormColors.TITLE);
58
		Color foreground = toolkit.getColors().getColor(IFormColors.TITLE);
58
		
59
		
59
		fName = new FormEntry(parent, toolkit, PDEUIMessages.SchemaDetails_name, SWT.NONE);
60
		fName = new FormEntry(parent, toolkit, PDEUIMessages.SchemaDetails_name, SWT.NONE);
60
		
61
		// Ensures label columns on every detail page are same width
62
		((GridData)fName.getLabel().getLayoutData()).widthHint = minLabelWeight;
63
61
		Label label = toolkit.createLabel(parent, PDEUIMessages.SchemaDetails_deprecated);
64
		Label label = toolkit.createLabel(parent, PDEUIMessages.SchemaDetails_deprecated);
62
		label.setForeground(foreground);
65
		label.setForeground(foreground);
63
		Button[] buttons = createTrueFalseButtons(parent, toolkit, 2);
66
		Button[] buttons = createTrueFalseButtons(parent, toolkit, 2);
(-)src/org/eclipse/pde/internal/ui/editor/schema/SchemaRootElementDetails.java (+3 lines)
Lines 22-27 Link Here
22
import org.eclipse.swt.events.SelectionAdapter;
22
import org.eclipse.swt.events.SelectionAdapter;
23
import org.eclipse.swt.events.SelectionEvent;
23
import org.eclipse.swt.events.SelectionEvent;
24
import org.eclipse.swt.graphics.Color;
24
import org.eclipse.swt.graphics.Color;
25
import org.eclipse.swt.layout.GridData;
25
import org.eclipse.swt.widgets.Button;
26
import org.eclipse.swt.widgets.Button;
26
import org.eclipse.swt.widgets.Composite;
27
import org.eclipse.swt.widgets.Composite;
27
import org.eclipse.swt.widgets.Label;
28
import org.eclipse.swt.widgets.Label;
Lines 45-50 Link Here
45
		Color foreground = toolkit.getColors().getColor(IFormColors.TITLE);
46
		Color foreground = toolkit.getColors().getColor(IFormColors.TITLE);
46
		
47
		
47
		fName = new FormEntry(parent, toolkit, PDEUIMessages.SchemaDetails_name, SWT.READ_ONLY);
48
		fName = new FormEntry(parent, toolkit, PDEUIMessages.SchemaDetails_name, SWT.READ_ONLY);
49
		// Ensures label columns on every detail page are same width
50
		((GridData)fName.getLabel().getLayoutData()).widthHint = minLabelWeight;
48
51
49
		Label label = toolkit.createLabel(parent, PDEUIMessages.SchemaDetails_deprecated);
52
		Label label = toolkit.createLabel(parent, PDEUIMessages.SchemaDetails_deprecated);
50
		label.setForeground(foreground);
53
		label.setForeground(foreground);
(-)src/org/eclipse/pde/internal/ui/editor/schema/AbstractSchemaDetails.java (-3 / +19 lines)
Lines 30-35 Link Here
30
import org.eclipse.swt.events.ModifyListener;
30
import org.eclipse.swt.events.ModifyListener;
31
import org.eclipse.swt.events.SelectionAdapter;
31
import org.eclipse.swt.events.SelectionAdapter;
32
import org.eclipse.swt.events.SelectionEvent;
32
import org.eclipse.swt.events.SelectionEvent;
33
import org.eclipse.swt.graphics.GC;
33
import org.eclipse.swt.layout.GridData;
34
import org.eclipse.swt.layout.GridData;
34
import org.eclipse.swt.layout.GridLayout;
35
import org.eclipse.swt.layout.GridLayout;
35
import org.eclipse.swt.widgets.Button;
36
import org.eclipse.swt.widgets.Button;
Lines 49-54 Link Here
49
	protected static final String[] BOOLS = 
50
	protected static final String[] BOOLS = 
50
		new String[] { Boolean.toString(true), Boolean.toString(false) };
51
		new String[] { Boolean.toString(true), Boolean.toString(false) };
51
	
52
	
53
	protected int minLabelWeight;
54
	
52
	private Section fSection;
55
	private Section fSection;
53
	private SchemaDtdDetailsSection fDtdSection = null;
56
	private SchemaDtdDetailsSection fDtdSection = null;
54
	private ElementSection fElementSection;
57
	private ElementSection fElementSection;
Lines 83-89 Link Here
83
	}
86
	}
84
	
87
	
85
	public final void createContents(Composite parent) {
88
	public final void createContents(Composite parent) {
86
89
		// This is a hacked fix to ensure that the label columns on every details
90
		// page have the same width. SchemaDetails_translatable plus 11 pixels
91
		// represents the longest label on any field on any details page. This
92
		// occurs on SchemaStringAttributeDetails and 11 is the size of the
93
		// horizontal indent that contributes to the label's width.
94
		GC gc = new GC(parent);
95
		minLabelWeight = gc.textExtent(PDEUIMessages.SchemaDetails_translatable).x + 11;
96
		gc.dispose();
97
		gc = null;
98
		
87
		parent.setLayout(FormLayoutFactory.createDetailsGridLayout(false, 1));
99
		parent.setLayout(FormLayoutFactory.createDetailsGridLayout(false, 1));
88
		FormToolkit toolkit = getManagedForm().getToolkit();
100
		FormToolkit toolkit = getManagedForm().getToolkit();
89
		fSection = toolkit.createSection(parent, Section.DESCRIPTION | ExpandableComposite.TITLE_BAR);
101
		fSection = toolkit.createSection(parent, Section.DESCRIPTION | ExpandableComposite.TITLE_BAR);
Lines 244-253 Link Here
244
		fElementSection.fireSelection(selection);
256
		fElementSection.fireSelection(selection);
245
	}
257
	}
246
	
258
	
247
	protected ComboPart createComboPart(Composite parent, FormToolkit toolkit, String[] items, int colspan) {
259
	protected ComboPart createComboPart(Composite parent, FormToolkit toolkit, String[] items, int colspan, int style) {
248
		ComboPart cp = new ComboPart();
260
		ComboPart cp = new ComboPart();
249
		cp.createControl(parent, toolkit, SWT.READ_ONLY);
261
		cp.createControl(parent, toolkit, SWT.READ_ONLY);
250
		GridData gd = new GridData(GridData.FILL_HORIZONTAL);
262
		GridData gd = new GridData(style);
251
		gd.horizontalSpan = colspan;
263
		gd.horizontalSpan = colspan;
252
		gd.horizontalIndent = FormLayoutFactory.CONTROL_HORIZONTAL_INDENT;
264
		gd.horizontalIndent = FormLayoutFactory.CONTROL_HORIZONTAL_INDENT;
253
		cp.getControl().setLayoutData(gd);
265
		cp.getControl().setLayoutData(gd);
Lines 256-261 Link Here
256
		return cp;
268
		return cp;
257
	}
269
	}
258
	
270
	
271
	protected ComboPart createComboPart(Composite parent, FormToolkit toolkit, String[] items, int colspan) {
272
		return createComboPart(parent, toolkit, items, colspan, GridData.FILL_HORIZONTAL);
273
	}
274
	
259
	protected Button[] createTrueFalseButtons(Composite parent, FormToolkit toolkit, int colSpan) {
275
	protected Button[] createTrueFalseButtons(Composite parent, FormToolkit toolkit, int colSpan) {
260
		Composite comp = toolkit.createComposite(parent, SWT.NONE);
276
		Composite comp = toolkit.createComposite(parent, SWT.NONE);
261
		GridLayout gl = new GridLayout(2, false);
277
		GridLayout gl = new GridLayout(2, false);
(-)src/org/eclipse/pde/internal/ui/pderesources.properties (-1 / +1 lines)
Lines 377-383 Link Here
377
SchemaEditor_ElementSection_newChoice=New Choice
377
SchemaEditor_ElementSection_newChoice=New Choice
378
SchemaEditor_ElementSection_newAttribute = New Attribute
378
SchemaEditor_ElementSection_newAttribute = New Attribute
379
SchemaEditor_ElementSection_newSequence=New Sequence
379
SchemaEditor_ElementSection_newSequence=New Sequence
380
SchemaAttributeDetails_defaultDefaultValue=(ENTER DEFAULT)
380
SchemaAttributeDetails_defaultDefaultValue=(default)
381
381
382
ReviewPage_noSampleFound=No sample has been selected.
382
ReviewPage_noSampleFound=No sample has been selected.
383
383

Return to bug 197056