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

Collapse All | Expand All

(-)src/org/eclipse/pde/internal/ui/PDEUIMessages.java (+6 lines)
Lines 325-330 Link Here
325
325
326
	public static String RequiresSection_sortAlpha;
326
	public static String RequiresSection_sortAlpha;
327
327
328
	public static String SchemaEditor_ElementSection_newChoice;
329
330
	public static String SchemaEditor_ElementSection_newSequence;
331
332
	public static String SchemaEditor_ElementSection_remove;
333
328
	public static String SchemaPreviewLauncher_msgEditorHasUnsavedChanges;
334
	public static String SchemaPreviewLauncher_msgEditorHasUnsavedChanges;
329
335
330
	public static String SchemaPreviewLauncher_msgSaveChanges;
336
	public static String SchemaPreviewLauncher_msgSaveChanges;
(-)src/org/eclipse/pde/internal/ui/pderesources.properties (+3 lines)
Lines 374-382 Link Here
374
SchemaEditor_SpecSection_name = Point Name:
374
SchemaEditor_SpecSection_name = Point Name:
375
375
376
SchemaEditor_ElementSection_title = Extension Point Elements
376
SchemaEditor_ElementSection_title = Extension Point Elements
377
SchemaEditor_ElementSection_remove=Remove
377
SchemaEditor_ElementSection_desc = Specify the XML elements and attributes which are allowed in this extension point.
378
SchemaEditor_ElementSection_desc = Specify the XML elements and attributes which are allowed in this extension point.
378
SchemaEditor_ElementSection_newElement = New Element
379
SchemaEditor_ElementSection_newElement = New Element
380
SchemaEditor_ElementSection_newChoice=New Choice
379
SchemaEditor_ElementSection_newAttribute = New Attribute
381
SchemaEditor_ElementSection_newAttribute = New Attribute
382
SchemaEditor_ElementSection_newSequence=New Sequence
380
SchemaAttributeDetails_defaultDefaultValue=(ENTER DEFAULT)
383
SchemaAttributeDetails_defaultDefaultValue=(ENTER DEFAULT)
381
384
382
ReviewPage_noSampleFound=No sample has been selected.
385
ReviewPage_noSampleFound=No sample has been selected.
(-)src/org/eclipse/pde/internal/ui/editor/schema/ElementSection.java (-13 / +53 lines)
Lines 119-125 Link Here
119
	public ElementSection(PDEFormPage page, Composite parent) {
119
	public ElementSection(PDEFormPage page, Composite parent) {
120
		super(page, parent, Section.DESCRIPTION, new String[] {
120
		super(page, parent, Section.DESCRIPTION, new String[] {
121
				PDEUIMessages.SchemaEditor_ElementSection_newElement,
121
				PDEUIMessages.SchemaEditor_ElementSection_newElement,
122
				PDEUIMessages.SchemaEditor_ElementSection_newAttribute });
122
				PDEUIMessages.SchemaEditor_ElementSection_newAttribute,
123
				PDEUIMessages.SchemaEditor_ElementSection_newChoice,
124
				PDEUIMessages.SchemaEditor_ElementSection_newSequence,
125
				PDEUIMessages.SchemaEditor_ElementSection_remove});
123
		getSection().setText(PDEUIMessages.SchemaEditor_ElementSection_title);
126
		getSection().setText(PDEUIMessages.SchemaEditor_ElementSection_title);
124
		getSection().setDescription(PDEUIMessages.SchemaEditor_ElementSection_desc);
127
		getSection().setDescription(PDEUIMessages.SchemaEditor_ElementSection_desc);
125
	}
128
	}
Lines 202-209 Link Here
202
		case 1:
205
		case 1:
203
			handleNewAttribute();
206
			handleNewAttribute();
204
			break;
207
			break;
208
		case 2:
209
			addCompositor(ISchemaCompositor.CHOICE);
210
			break;
211
		case 3:
212
			addCompositor(ISchemaCompositor.SEQUENCE);
213
			break;
214
		case 4:
215
			final ISelection selection = fTreeViewer.getSelection();
216
			handleDelete((IStructuredSelection)selection);
217
			break;
205
		}
218
		}
206
	}
219
	}
220
	
221
	private void addCompositor (int kind) {
222
		Object selection = ((IStructuredSelection)fTreeViewer.getSelection()).getFirstElement();
223
		ISchemaElement sourceElement = null;
224
		Object current = selection;
225
		while (current instanceof ISchemaCompositor)
226
			current = ((ISchemaCompositor)current).getParent();
227
		if (current instanceof ISchemaElement)
228
			sourceElement = (ISchemaElement) current;
229
		if (sourceElement != null)
230
			new NewCompositorAction(sourceElement, selection, kind).run();
231
	}
207
232
208
	public void dispose() {
233
	public void dispose() {
209
		if (fClipboard != null) {
234
		if (fClipboard != null) {
Lines 531-552 Link Here
531
	private void updateButtons() {
556
	private void updateButtons() {
532
		if (!fSchema.isEditable())
557
		if (!fSchema.isEditable())
533
			return;
558
			return;
534
		Object object = ((IStructuredSelection) fTreeViewer.getSelection()).getFirstElement();
559
		IStructuredSelection selection = (IStructuredSelection) fTreeViewer.getSelection();
535
		ISchemaObject sobject = (ISchemaObject) object;
560
		ISchemaObject sobject = (ISchemaObject) selection.getFirstElement();
536
561
537
		boolean canAddAttribute = false;
562
		boolean canAddAttribute = false;
538
		if (sobject != null) {
563
		if (sobject instanceof ISchemaElement) {
539
			if (sobject instanceof ISchemaElement) {
564
			if (!(sobject instanceof ISchemaRootElement)
540
				if (!(sobject instanceof ISchemaRootElement)
565
					&& !(sobject instanceof ISchemaObjectReference))
541
						&& !(sobject instanceof ISchemaObjectReference))
566
				canAddAttribute = true;
542
					canAddAttribute = true;
567
		} else if (sobject instanceof ISchemaAttribute) {
543
			} else if (sobject instanceof ISchemaAttribute) {
568
			ISchemaElement element = (ISchemaElement) (sobject.getParent());
544
				ISchemaElement element = (ISchemaElement) (sobject.getParent());
569
			if (!(element instanceof ISchemaRootElement))
545
				if (!(element instanceof ISchemaRootElement))
570
				canAddAttribute = true;
546
					canAddAttribute = true;
547
			}
548
		}
571
		}
549
		getTreePart().setButtonEnabled(1, canAddAttribute);
572
		getTreePart().setButtonEnabled(1, canAddAttribute);
573
		
574
		boolean canAddCompositor = false;
575
		if (sobject instanceof ISchemaElement || sobject instanceof ISchemaCompositor)
576
			canAddCompositor = true;
577
		getTreePart().setButtonEnabled(2, canAddCompositor);
578
		getTreePart().setButtonEnabled(3, canAddCompositor);
579
		
580
		boolean canRemove = false;
581
		for (Iterator iter = selection.iterator(); iter.hasNext();) {
582
			sobject = (ISchemaObject) iter.next();
583
			if (sobject != null && !(sobject instanceof ISchemaRootElement) && 
584
					!(sobject instanceof ISchemaAttribute && sobject.getParent() instanceof ISchemaRootElement)) {
585
				canRemove = true;
586
				break;
587
			}
588
		}
589
		getTreePart().setButtonEnabled(4, canRemove);
550
	}
590
	}
551
591
552
	private ISchemaObject getSibling(Object target, Object object) {
592
	private ISchemaObject getSibling(Object target, Object object) {

Return to bug 192259