blob: d729966b66bc77ea5b62af6bfbbb9e269c7a904b (
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) 2007, 2009, 2013 Borland Software Corporation and others
*
* 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:
* Alexander Shatalin (Borland) - initial API and implementation
* Michael Golubev (Montages) - #386838 - migrate to Xtend2
*/
package aspects.xpt.navigator
import com.google.inject.Inject
import com.google.inject.Singleton
import org.eclipse.gmf.codegen.gmfgen.GenNavigator
import xpt.Common
import xpt.CodeStyle
@Singleton class AbstractNavigatorItem extends xpt.navigator.AbstractNavigatorItem {
@Inject extension Common;
@Inject extension CodeStyle
override def registerAdapterFactory(GenNavigator it) '''
«generatedMemberComment()»
static {
@SuppressWarnings("rawtypes")
final Class[] supportedTypes = new Class[] { org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor.class };
final org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor propertySheetPageContributor = new org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor() {
«overrideI(it.editorGen.diagram)»
public String getContributorId() {
return "«editorGen.plugin.ID»"; «nonNLS(1)»
}
};
org.eclipse.core.runtime.Platform.getAdapterManager().registerAdapters(new org.eclipse.core.runtime.IAdapterFactory() {
«overrideI(it.editorGen.diagram)»
@SuppressWarnings("rawtypes")
public Object getAdapter(Object adaptableObject, Class adapterType) {
if (adaptableObject instanceof «qualifiedClassName(it)» && adapterType == org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor.class) {
return propertySheetPageContributor;
}
return null;
}
«overrideI(it.editorGen.diagram)»
@SuppressWarnings("rawtypes")
public Class[] getAdapterList() {
return supportedTypes;
}
}, «qualifiedClassName(it)».class);
}
'''
}
|