blob: 809c40cd80f99f7f7e9ebf3aefb160bf8c7e1009 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
/*****************************************************************************
* Copyright (c) 2013 CEA LIST.
*
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Camille Letavernier (camille.letavernier@cea.fr) - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.uml.modelexplorer.handler;
import org.eclipse.core.commands.State;
import org.eclipse.papyrus.emf.facet.custom.core.ICustomizationCatalogManager;
import org.eclipse.papyrus.emf.facet.custom.core.ICustomizationCatalogManagerFactory;
import org.eclipse.papyrus.emf.facet.custom.core.ICustomizationManager;
import org.eclipse.papyrus.emf.facet.custom.metamodel.v0_2_0.custom.Customization;
import org.eclipse.papyrus.views.modelexplorer.Activator;
/**
* State for the AdvancedModelExplorer toggle action
*
* @author Camille Letavernier
*
* @see {@link ToggleAdvancedModelExplorerHandler}
*
*/
//EMF Facet 0.1 restricted & deprecated API
@SuppressWarnings({ "deprecation", "restriction" })
public class ToggleAdvancedModelExplorerState extends State {
@Override
public Boolean getValue() {
ICustomizationManager customizationManager = Activator.getDefault().getCustomizationManager();
ICustomizationCatalogManager customCatalog = ICustomizationCatalogManagerFactory.DEFAULT.getOrCreateCustomizationCatalogManager(customizationManager.getResourceSet());
Customization simpleUMLCustomization = null;
//look for SIMPLE UML Customization
for(Customization customization : customCatalog.getRegisteredCustomizations()) {
if(ToggleAdvancedModelExplorerHandler.SIMPLE_UML_CUSTOMIZATION.equals(customization.getName())){
simpleUMLCustomization= customization;
}
}
if(simpleUMLCustomization == null) {
//The SimpleUML Customization doesn't exist. The advanced mode is activated
return true;
}
if(customizationManager == null) {
//Should not happen, this is a singleton
return false;
}
return false;
//return !customizationManager.getRegisteredCustomizations().contains(simpleUMLCustomization);
}
}
|