blob: 6bccb44a8dca6f7098d25d9716a03c0ff7e3d19f (
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
|
/*****************************************************************************
* Copyright (c) 2011 LIFL & 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:
* Cedric Dumoulin (LIFL) cedric.dumoulin@lifl.fr - Initial API and implementation
* Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr
*****************************************************************************/
package org.eclipse.papyrus.uml.table.defaultt.handlers;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.facet.widgets.nattable.tableconfiguration2.TableConfiguration2;
import org.eclipse.papyrus.table.common.handlers.AbstractCreateNattableEditorCommand;
import org.eclipse.papyrus.uml.table.defaultt.Activator;
import org.eclipse.papyrus.uml.table.defaultt.editor.DefaultNattableEditor;
/**
* @author dumoulin
*
*/
public class CreateNattableEditorCommand extends AbstractCreateNattableEditorCommand {
/**
*
* Constructor.
*
*/
public CreateNattableEditorCommand() {
super(DefaultNattableEditor.EDITOR_TYPE, DefaultNattableEditor.DEFAULT_NAME);
}
/**
*
* {@inheritDoc}
*/
@Override
protected TableConfiguration2 getTableConfiguration2() {
ResourceSet resourceSet = new ResourceSetImpl();
String symbolicName = Activator.getInstance().getBundle().getSymbolicName();
URI uri = URI.createPlatformPluginURI(symbolicName + "/resources/default.tableconfiguration2", true); //$NON-NLS-1$
Resource resource = resourceSet.getResource(uri, true);
TableConfiguration2 tableConfiguration = null;
if(resource.getContents().get(0) instanceof TableConfiguration2) {
tableConfiguration = (TableConfiguration2)resource.getContents().get(0);
return tableConfiguration;
}
return null;
}
}
|