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().setVisible(false); |
128 |
} else { |
139 |
} else { |
129 |
fValue.setEditable(editable); |
140 |
fValue.setEditable(editable); |
|
|
141 |
fValue.getText().setVisible(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().setVisible(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 |
}); |