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 163079 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/gmf/mappings/provider/GMFMapEditPlugin.java (+10 lines)
Lines 76-81 Link Here
76
		return plugin;
76
		return plugin;
77
	}
77
	}
78
78
79
	private boolean myShowQualifiedFeatureLabels = true;
80
81
	public static void toggleQualifiedFeatureLabelPresentation() {
82
		INSTANCE.myShowQualifiedFeatureLabels = !INSTANCE.myShowQualifiedFeatureLabels;
83
	}
84
85
	public static boolean isQualifiedFeatureLabels() {
86
		return INSTANCE.myShowQualifiedFeatureLabels;
87
	}
88
79
	static String getFeatureLabel(EStructuralFeature feature) {
89
	static String getFeatureLabel(EStructuralFeature feature) {
80
		StringBuffer sb = new StringBuffer();
90
		StringBuffer sb = new StringBuffer();
81
		if (feature.getEContainingClass() != null) {
91
		if (feature.getEContainingClass() != null) {
(-)src/org/eclipse/gmf/mappings/presentation/GMFMapEditor.java (-3 / +2 lines)
Lines 6-12 Link Here
6
 */
6
 */
7
package org.eclipse.gmf.mappings.presentation;
7
package org.eclipse.gmf.mappings.presentation;
8
8
9
10
import java.io.IOException;
9
import java.io.IOException;
11
import java.io.InputStream;
10
import java.io.InputStream;
12
import java.util.ArrayList;
11
import java.util.ArrayList;
Lines 48-54 Link Here
48
import org.eclipse.emf.ecore.EObject;
47
import org.eclipse.emf.ecore.EObject;
49
import org.eclipse.emf.ecore.EValidator;
48
import org.eclipse.emf.ecore.EValidator;
50
import org.eclipse.emf.ecore.plugin.EcorePlugin;
49
import org.eclipse.emf.ecore.plugin.EcorePlugin;
51
import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory;
52
import org.eclipse.emf.ecore.resource.Resource;
50
import org.eclipse.emf.ecore.resource.Resource;
53
import org.eclipse.emf.ecore.resource.ResourceSet;
51
import org.eclipse.emf.ecore.resource.ResourceSet;
54
import org.eclipse.emf.ecore.util.EContentAdapter;
52
import org.eclipse.emf.ecore.util.EContentAdapter;
Lines 72-77 Link Here
72
import org.eclipse.emf.edit.ui.util.EditUIUtil;
70
import org.eclipse.emf.edit.ui.util.EditUIUtil;
73
import org.eclipse.emf.edit.ui.view.ExtendedPropertySheetPage;
71
import org.eclipse.emf.edit.ui.view.ExtendedPropertySheetPage;
74
import org.eclipse.gmf.gmfgraph.provider.GMFGraphItemProviderAdapterFactory;
72
import org.eclipse.gmf.gmfgraph.provider.GMFGraphItemProviderAdapterFactory;
73
import org.eclipse.gmf.mappings.provider.EcoreItemProviderAdapterFactoryEx;
75
import org.eclipse.gmf.mappings.provider.GMFMapEditPlugin;
74
import org.eclipse.gmf.mappings.provider.GMFMapEditPlugin;
76
import org.eclipse.gmf.mappings.provider.GMFMapItemProviderAdapterFactory;
75
import org.eclipse.gmf.mappings.provider.GMFMapItemProviderAdapterFactory;
77
import org.eclipse.gmf.tooldef.provider.GMFToolItemProviderAdapterFactory;
76
import org.eclipse.gmf.tooldef.provider.GMFToolItemProviderAdapterFactory;
Lines 655-661 Link Here
655
		adapterFactory.addAdapterFactory(new GMFMapItemProviderAdapterFactory());
654
		adapterFactory.addAdapterFactory(new GMFMapItemProviderAdapterFactory());
656
		adapterFactory.addAdapterFactory(new GMFGraphItemProviderAdapterFactory());
655
		adapterFactory.addAdapterFactory(new GMFGraphItemProviderAdapterFactory());
657
		adapterFactory.addAdapterFactory(new GMFToolItemProviderAdapterFactory());
656
		adapterFactory.addAdapterFactory(new GMFToolItemProviderAdapterFactory());
658
		adapterFactory.addAdapterFactory(new EcoreItemProviderAdapterFactory());
657
		adapterFactory.addAdapterFactory(new EcoreItemProviderAdapterFactoryEx());
659
		adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());
658
		adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());
660
659
661
		// Create the command stack that will notify this editor as commands are executed.
660
		// Create the command stack that will notify this editor as commands are executed.
(-)src/org/eclipse/gmf/mappings/presentation/GMFMapActionBarContributor.java (-1 / +21 lines)
Lines 108-113 Link Here
108
			}
108
			}
109
		};
109
		};
110
110
111
	protected final ToggleQualifiedLabels toggleLabelsAction = new ToggleQualifiedLabels();
112
		
111
	/**
113
	/**
112
	 * This will contain one {@link org.eclipse.emf.edit.ui.action.CreateChildAction} corresponding to each descriptor
114
	 * This will contain one {@link org.eclipse.emf.edit.ui.action.CreateChildAction} corresponding to each descriptor
113
	 * generated for the current selection by the item provider.
115
	 * generated for the current selection by the item provider.
Lines 396-402 Link Here
396
	 * This inserts global actions before the "additions-end" separator.
398
	 * This inserts global actions before the "additions-end" separator.
397
	 * <!-- begin-user-doc -->
399
	 * <!-- begin-user-doc -->
398
	 * <!-- end-user-doc -->
400
	 * <!-- end-user-doc -->
399
	 * @generated
401
	 * @generated NOT
400
	 */
402
	 */
401
	@Override
403
	@Override
402
	protected void addGlobalActions(IMenuManager menuManager) {
404
	protected void addGlobalActions(IMenuManager menuManager) {
Lines 407-412 Link Here
407
		menuManager.insertAfter("ui-actions", refreshViewerAction);
409
		menuManager.insertAfter("ui-actions", refreshViewerAction);
408
410
409
		super.addGlobalActions(menuManager);
411
		super.addGlobalActions(menuManager);
412
		// handwritten code starts
413
		toggleLabelsAction.update();
414
		menuManager.insertBefore("ui-actions", toggleLabelsAction);
415
		// handwritten code ends
410
	}
416
	}
411
417
412
	/**
418
	/**
Lines 420-423 Link Here
420
		return true;
426
		return true;
421
	}
427
	}
422
428
429
	private static class ToggleQualifiedLabels extends Action {
430
		public ToggleQualifiedLabels() {
431
			super(GMFMapEditPlugin.INSTANCE.getString("_UI_ToggleQualifiedLabels_menu_item"), Action.AS_CHECK_BOX);
432
		}
433
		@Override
434
		public void run() {
435
			GMFMapEditPlugin.toggleQualifiedFeatureLabelPresentation();
436
			update();
437
		}
438
439
		void update() {
440
			setChecked(GMFMapEditPlugin.isQualifiedFeatureLabels());
441
		}
442
	}
423
}
443
}
(-)plugin.properties (+4 lines)
Lines 20-25 Link Here
20
#############################################################
20
#############################################################
21
# Properties in this section ARE REALLY NEED to be translated
21
# Properties in this section ARE REALLY NEED to be translated
22
#############################################################
22
#############################################################
23
24
# next item(s) are manually added
25
_UI_ToggleQualifiedLabels_menu_item=Qualified feature names 
26
#
23
_UI_CreateChild_text = {0}
27
_UI_CreateChild_text = {0}
24
_UI_CreateChild_text2 = {1} {0}
28
_UI_CreateChild_text2 = {1} {0}
25
_UI_CreateChild_text3 = {1}
29
_UI_CreateChild_text3 = {1}
(-)src/org/eclipse/gmf/mappings/provider/EcoreItemProviderAdapterFactoryEx.java (+45 lines)
Added Link Here
1
/*
2
 * Copyright (c) 2008 Borland Software Corporation
3
 * 
4
 * All rights reserved. This program and the accompanying materials
5
 * are made available under the terms of the Eclipse Public License v1.0
6
 * which accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 *
9
 * Contributors:
10
 *    Artem Tikhomirov (Borland) - initial API and implementation
11
 */
12
package org.eclipse.gmf.mappings.provider;
13
14
import org.eclipse.emf.ecore.EStructuralFeature;
15
import org.eclipse.emf.ecore.provider.EAttributeItemProvider;
16
import org.eclipse.emf.ecore.provider.EReferenceItemProvider;
17
import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory;
18
19
/**
20
 * @author artem
21
 */
22
public class EcoreItemProviderAdapterFactoryEx extends EcoreItemProviderAdapterFactory {
23
	
24
	public EcoreItemProviderAdapterFactoryEx() {
25
		eAttributeItemProvider = new EAttributeItemProvider(this) {
26
			@Override
27
			public String getText(Object obj) {
28
				if (GMFMapEditPlugin.isQualifiedFeatureLabels()) {
29
					return GMFMapEditPlugin.getFeatureLabel((EStructuralFeature) obj);
30
				}
31
				return super.getText(obj);
32
			}
33
		};
34
		eReferenceItemProvider = new EReferenceItemProvider(this) {
35
			@Override
36
			public String getText(Object obj) {
37
				if (GMFMapEditPlugin.isQualifiedFeatureLabels()) {
38
					return GMFMapEditPlugin.getFeatureLabel((EStructuralFeature) obj);
39
				}
40
				return super.getText(obj);
41
			}
42
		};
43
	}
44
45
}

Return to bug 163079