blob: 4110ae78123c268d4bdf65dbe20d12aa92e9ffdd (
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
|
/*****************************************************************************
* Copyright (c) 2010 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
*
*****************************************************************************/
package org.eclipse.papyrus.domaincontextcodegen;
import java.util.Iterator;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbenchPart;
public class SetUMLIconInElementTypesAction implements IObjectActionDelegate {
protected ElementTypes types = null;
public SetUMLIconInElementTypesAction() {
}
public void run(IAction action) {
DomainContext domain = (DomainContext) types.eContainer();
ElementTypes types = domain.getElementTypes();
Iterator<ElementType> it = types.getTypes().iterator();
while (it.hasNext()) {
ElementType elementType = it.next();
if (elementType instanceof MetaClassType) {
MetaClassType mClassType = (MetaClassType) elementType;
mClassType.setIcon("platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/" + mClassType.getName() + ".gif");
}
}
}
public void selectionChanged(IAction action, ISelection selection) {
if (selection instanceof IStructuredSelection) {
if (((IStructuredSelection) selection).getFirstElement() instanceof ElementTypes) {
types = (ElementTypes) ((IStructuredSelection) selection).getFirstElement();
}
}
}
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
}
}
|