View | Details | Raw Unified | Return to bug 243215
Collapse All | Expand All

(-)schema/jadAttributes.exsd (-25 lines)
Lines 47-77 Link Here
47
         <sequence minOccurs="1" maxOccurs="unbounded">
47
         <sequence minOccurs="1" maxOccurs="unbounded">
48
            <element ref="jadDescriptorsProvider"/>
48
            <element ref="jadDescriptorsProvider"/>
49
         </sequence>
49
         </sequence>
50
         <attribute name="vendorSpec">
51
            <annotation>
52
               <documentation>
53
                  Indicate if the JAD attributes is vendor specific, if so set this attribute to &quot;true&quot;, otherwise set to &quot;false&quot; or do not set.
54
               </documentation>
55
            </annotation>
56
            <simpleType>
57
               <restriction base="string">
58
                  <enumeration value="true">
59
                  </enumeration>
60
                  <enumeration value="false">
61
                  </enumeration>
62
               </restriction>
63
            </simpleType>
64
         </attribute>
65
         <attribute name="vendorSpecTester" type="string">
66
            <annotation>
67
               <documentation>
68
                  the required implementation class of the &lt;code&gt;org.eclipse.mtj.ui.jadEditor.IVendorSpecTester&lt;/code&gt; interface that will be used to test whether the device belongs to the vendor.
69
               </documentation>
70
               <appInfo>
71
                  <meta.attribute kind="java" basedOn=":org.eclipse.mtj.ui.jadEditor.IVendorSpecTester"/>
72
               </appInfo>
73
            </annotation>
74
         </attribute>
75
         <attribute name="pageID" type="string" use="required">
50
         <attribute name="pageID" type="string" use="required">
76
            <annotation>
51
            <annotation>
77
               <documentation>
52
               <documentation>
(-)schema/jadEditorPages.exsd (-27 / +1 lines)
Lines 47-54 Link Here
47
         <attribute name="class" type="string" use="required">
47
         <attribute name="class" type="string" use="required">
48
            <annotation>
48
            <annotation>
49
               <documentation>
49
               <documentation>
50
                  
50
                  the page&apos;s implementation class, must public and extends &lt;code&gt;org.eclipse.mtj.ui.jadEditor.AbstractJADEditorPage&lt;/code&gt; with a zero-argument constructor.
51
the page&apos;s implementation class, must public and extends &lt;code&gt;org.eclipse.mtj.ui.jadEditor.AbstractJADEditorPage&lt;/code&gt; with a zero-argument constructor.
52
51
53
If you want to add a property page to the editor, the class  &lt;code&gt;org.eclipse.mtj.ui.jadEditor.JADPropertiesEditorPage&lt;/code&gt; provide a convient implementation, you may extend from it.
52
If you want to add a property page to the editor, the class  &lt;code&gt;org.eclipse.mtj.ui.jadEditor.JADPropertiesEditorPage&lt;/code&gt; provide a convient implementation, you may extend from it.
54
               </documentation>
53
               </documentation>
Lines 57-87 Link Here
57
               </appInfo>
56
               </appInfo>
58
            </annotation>
57
            </annotation>
59
         </attribute>
58
         </attribute>
60
         <attribute name="vendorSpec">
61
            <annotation>
62
               <documentation>
63
                  Indicate if the JAD attributes is vendor specific, if so set this attribute to &quot;true&quot;, otherwise set to &quot;false&quot; or do not set.
64
               </documentation>
65
            </annotation>
66
            <simpleType>
67
               <restriction base="string">
68
                  <enumeration value="true">
69
                  </enumeration>
70
                  <enumeration value="false">
71
                  </enumeration>
72
               </restriction>
73
            </simpleType>
74
         </attribute>
75
         <attribute name="vendorSpecTester" type="string">
76
            <annotation>
77
               <documentation>
78
                  the required implementation class of the &lt;code&gt;org.eclipse.mtj.ui.jadEditor.IVendorSpecTester&lt;/code&gt; interface that will be used to test whether the device belongs to the vendor.
79
               </documentation>
80
               <appInfo>
81
                  <meta.attribute kind="java" basedOn=":org.eclipse.mtj.ui.jadEditor.IVendorSpecTester"/>
82
               </appInfo>
83
            </annotation>
84
         </attribute>
85
         <attribute name="priority" type="string">
59
         <attribute name="priority" type="string">
86
            <annotation>
60
            <annotation>
87
               <documentation>
61
               <documentation>
(-)src/org/eclipse/mtj/ui/jadEditor/AbstractJADEditorPage.java (-7 / +7 lines)
Lines 197-207 Link Here
197
            String propertyName, Object data) {
197
            String propertyName, Object data) {
198
       //do nothing
198
       //do nothing
199
    }
199
    }
200
    /**
200
//    /**
201
     * 
201
//     * 
202
     * @return the relevant midlet suite device
202
//     * @return the relevant midlet suite device
203
     */
203
//     */
204
    public IDevice getProjectDevice(){
204
//    public IDevice getProjectDevice(){
205
    	return ((JADFormEditor)this.getEditor()).getProjectDevice();
205
//    	return ((JADFormEditor)this.getEditor()).getProjectDevice();
206
    }
206
//    }
207
}
207
}
(-)src/org/eclipse/mtj/ui/jadEditor/IVendorSpecTester.java (-32 lines)
Lines 1-32 Link Here
1
/**
2
 * Copyright (c) 2003,2008 Sybase Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * Contributors:
9
 *     Gang Ma 		(Sybase) - Initial implementation
10
 *     
11
 */
12
package org.eclipse.mtj.ui.jadEditor;
13
14
import org.eclipse.mtj.core.model.device.IDevice;
15
16
/**
17
 * This interface should be implemented by vendors who want to add vendor 
18
 * specific things such as vendor specific JAD Editor pages,JAD attributes, 
19
 * the implementation will be used to test if the device user used meet 
20
 * the vendor's requirements 
21
 * @author gma
22
 *
23
 */
24
public interface IVendorSpecTester {
25
	/**
26
	 * this method is used to test whether the device user used is
27
	 * vendor specific
28
	 * @param device TODO
29
	 * @return
30
	 */
31
	public boolean isVendorSpec(IDevice device);
32
}
(-)src/org/eclipse/mtj/ui/jadEditor/JADPropertiesEditorPage.java (-2 / +2 lines)
Lines 318-325 Link Here
318
	 * @return
318
	 * @return
319
	 */
319
	 */
320
	protected DescriptorPropertyDescription[] doGetDescriptors() {
320
	protected DescriptorPropertyDescription[] doGetDescriptors() {
321
		IDevice device = ((JADFormEditor)this.getEditor()).getProjectDevice();
321
//		IDevice device = ((JADFormEditor)this.getEditor()).getProjectDevice();
322
		return JADAttributesRegistry.getJADAttrDescriptorsByPage(getId(), device);
322
		return JADAttributesRegistry.getJADAttrDescriptorsByPage(getId());
323
	}
323
	}
324
    
324
    
325
    
325
    
(-)src/org/eclipse/mtj/ui/jadEditor/IJADDescriptorsProvider.java (-3 / +1 lines)
Lines 11-17 Link Here
11
 */
11
 */
12
package org.eclipse.mtj.ui.jadEditor;
12
package org.eclipse.mtj.ui.jadEditor;
13
13
14
import org.eclipse.mtj.core.model.device.IDevice;
15
import org.eclipse.mtj.core.model.jad.DescriptorPropertyDescription;
14
import org.eclipse.mtj.core.model.jad.DescriptorPropertyDescription;
16
15
17
/**
16
/**
Lines 26-33 Link Here
26
public interface IJADDescriptorsProvider {
25
public interface IJADDescriptorsProvider {
27
	/**
26
	/**
28
	 * 
27
	 * 
29
	 * @param device TODO
30
	 * @return array off DescriptorPropertyDescription
28
	 * @return array off DescriptorPropertyDescription
31
	 */
29
	 */
32
	DescriptorPropertyDescription[] getDescriptorPropertyDescriptions(IDevice device);
30
	DescriptorPropertyDescription[] getDescriptorPropertyDescriptions();
33
}
31
}
(-)src/org/eclipse/mtj/ui/internal/editor/jad/form/JADEditorPageConfigElement.java (-16 / +15 lines)
Lines 14-20 Link Here
14
import org.eclipse.core.runtime.CoreException;
14
import org.eclipse.core.runtime.CoreException;
15
import org.eclipse.core.runtime.IConfigurationElement;
15
import org.eclipse.core.runtime.IConfigurationElement;
16
import org.eclipse.mtj.ui.jadEditor.AbstractJADEditorPage;
16
import org.eclipse.mtj.ui.jadEditor.AbstractJADEditorPage;
17
import org.eclipse.mtj.ui.jadEditor.IVendorSpecTester;
18
17
19
/**
18
/**
20
 * class wrapped IConfigurationElement instance for jadEditorPages
19
 * class wrapped IConfigurationElement instance for jadEditorPages
Lines 24-31 Link Here
24
 */
23
 */
25
public class JADEditorPageConfigElement {
24
public class JADEditorPageConfigElement {
26
	private static final String JAD_EDITOR_PAGE_CLASS = "class";
25
	private static final String JAD_EDITOR_PAGE_CLASS = "class";
27
	private static final String VENDOR_SPEC_ATTR = "vendorSpec";
26
//	private static final String VENDOR_SPEC_ATTR = "vendorSpec";
28
	private static final String VENDOR_SPEC_TESTER = "vendorSpecTester";
27
//	private static final String VENDOR_SPEC_TESTER = "vendorSpecTester";
29
	private static final String ATTR_PRIORITY = "priority";
28
	private static final String ATTR_PRIORITY = "priority";
30
	
29
	
31
	private IConfigurationElement element;
30
	private IConfigurationElement element;
Lines 30-36 Link Here
30
	
29
	
31
	private IConfigurationElement element;
30
	private IConfigurationElement element;
32
//	private AbstractJADEditorPage page;
31
//	private AbstractJADEditorPage page;
33
	private IVendorSpecTester vendorSpecTester;
32
//	private IVendorSpecTester vendorSpecTester;
34
	
33
	
35
	public JADEditorPageConfigElement(
34
	public JADEditorPageConfigElement(
36
			IConfigurationElement jadAttrElement) {
35
			IConfigurationElement jadAttrElement) {
Lines 44-61 Link Here
44
		
43
		
45
	}
44
	}
46
	
45
	
47
	public IVendorSpecTester getVendorSpecTester() throws CoreException {
46
//	public IVendorSpecTester getVendorSpecTester() throws CoreException {
48
		if (vendorSpecTester == null) {
47
//		if (vendorSpecTester == null) {
49
			vendorSpecTester = (IVendorSpecTester) element
48
//			vendorSpecTester = (IVendorSpecTester) element
50
					.createExecutableExtension(VENDOR_SPEC_TESTER);
49
//					.createExecutableExtension(VENDOR_SPEC_TESTER);
51
		}
50
//		}
52
		return vendorSpecTester;
51
//		return vendorSpecTester;
53
	}
52
//	}
54
	
53
//	
55
	public boolean isVendorSpec(){
54
//	public boolean isVendorSpec(){
56
		String value = element.getAttribute(VENDOR_SPEC_ATTR);
55
//		String value = element.getAttribute(VENDOR_SPEC_ATTR);
57
		return value == null?false:"true".equalsIgnoreCase(value);
56
//		return value == null?false:"true".equalsIgnoreCase(value);
58
	}
57
//	}
59
	
58
	
60
	/**
59
	/**
61
     * Return the priority of this element.
60
     * Return the priority of this element.
(-)src/org/eclipse/mtj/ui/internal/editor/jad/form/JADFormEditor.java (-19 / +20 lines)
Lines 10-16 Link Here
10
 *     Craig Setera (EclipseME) - Initial implementation
10
 *     Craig Setera (EclipseME) - Initial implementation
11
 *     Diego Sandin (Motorola)  - Refactoring package name to follow eclipse
11
 *     Diego Sandin (Motorola)  - Refactoring package name to follow eclipse
12
 *                                standards
12
 *                                standards
13
 *     Diego Sandin (Motorola)  - Added source view page                     
13
 *     Diego Sandin (Motorola)  - Added source view page
14
 *     Gang Ma      (Sybase)	- Refactoring the editor to support expansibility                    
14
 */
15
 */
15
package org.eclipse.mtj.ui.internal.editor.jad.form;
16
package org.eclipse.mtj.ui.internal.editor.jad.form;
16
17
Lines 89-95 Link Here
89
     */
90
     */
90
    protected void addPages() {
91
    protected void addPages() {
91
    	JADEditorPageConfigElement[] pageElements = getAllEditorPageConfigElements();
92
    	JADEditorPageConfigElement[] pageElements = getAllEditorPageConfigElements();
92
		IDevice projectDevice = getProjectDevice();
93
		
93
		// sort the page elements according to the page element's priority
94
		// sort the page elements according to the page element's priority
94
		Arrays.sort(pageElements, new Comparator<JADEditorPageConfigElement>() {
95
		Arrays.sort(pageElements, new Comparator<JADEditorPageConfigElement>() {
95
			public int compare(JADEditorPageConfigElement o1,
96
			public int compare(JADEditorPageConfigElement o1,
Lines 101-110 Link Here
101
		for (int i = 0; i < pageElements.length; i++) {
102
		for (int i = 0; i < pageElements.length; i++) {
102
			try {
103
			try {
103
				JADEditorPageConfigElement element = pageElements[i];
104
				JADEditorPageConfigElement element = pageElements[i];
104
				if (element.isVendorSpec()
105
//				if (element.isVendorSpec()
105
						&& !element.getVendorSpecTester().isVendorSpec(
106
//						&& !element.getVendorSpecTester().isVendorSpec(
106
								projectDevice))
107
//								projectDevice))
107
					continue;
108
//					continue;
108
				AbstractJADEditorPage page = element.getJADEditorPage();
109
				AbstractJADEditorPage page = element.getJADEditorPage();
109
				page.setEditor(this);
110
				page.setEditor(this);
110
				addPage(page);
111
				addPage(page);
Lines 123-141 Link Here
123
124
124
        
125
        
125
    }
126
    }
126
    /**
127
//    /**
127
	 * get the project's device
128
//	 * get the project's device
128
	 * 
129
//	 * 
129
	 * @return
130
//	 * @return
130
	 */
131
//	 */
131
    public IDevice getProjectDevice(){
132
//    public IDevice getProjectDevice(){
132
		IProject project = getJadFile().getProject();
133
//		IProject project = getJadFile().getProject();
133
		IJavaProject javaProject = JavaCore.create(project);
134
//		IJavaProject javaProject = JavaCore.create(project);
134
        IMidletSuiteProject midletProject = MidletSuiteFactory
135
//        IMidletSuiteProject midletProject = MidletSuiteFactory
135
                .getMidletSuiteProject(javaProject);
136
//                .getMidletSuiteProject(javaProject);
136
        
137
//        
137
        return midletProject.getDevice();
138
//        return midletProject.getDevice();
138
	}
139
//	}
139
    private JADEditorPageConfigElement[] getAllEditorPageConfigElements(){
140
    private JADEditorPageConfigElement[] getAllEditorPageConfigElements(){
140
    	if(jadEditorPageConfigElements == null){
141
    	if(jadEditorPageConfigElements == null){
141
    		jadEditorPageConfigElements = readAllVendorSpecJADAttributes();
142
    		jadEditorPageConfigElements = readAllVendorSpecJADAttributes();
(-)src/org/eclipse/mtj/ui/internal/editor/jad/form/OTAJADDescriptorsProvider.java (-2 / +1 lines)
Lines 11-17 Link Here
11
 */
11
 */
12
package org.eclipse.mtj.ui.internal.editor.jad.form;
12
package org.eclipse.mtj.ui.internal.editor.jad.form;
13
13
14
import org.eclipse.mtj.core.model.device.IDevice;
15
import org.eclipse.mtj.core.model.jad.DescriptorPropertyDescription;
14
import org.eclipse.mtj.core.model.jad.DescriptorPropertyDescription;
16
import org.eclipse.mtj.core.model.jad.IJADConstants;
15
import org.eclipse.mtj.core.model.jad.IJADConstants;
17
import org.eclipse.mtj.ui.MTJUIStrings;
16
import org.eclipse.mtj.ui.MTJUIStrings;
Lines 51-57 Link Here
51
    
50
    
52
   
51
   
53
52
54
	public DescriptorPropertyDescription[] getDescriptorPropertyDescriptions(IDevice device) {
53
	public DescriptorPropertyDescription[] getDescriptorPropertyDescriptions() {
55
		return OTA_DESCRIPTORS;
54
		return OTA_DESCRIPTORS;
56
	}
55
	}
57
56
(-)src/org/eclipse/mtj/ui/internal/editor/jad/form/JADAttributesRegistry.java (-106 / +127 lines)
Lines 25-35 Link Here
25
import org.eclipse.mtj.core.model.jad.DescriptorPropertyDescription;
25
import org.eclipse.mtj.core.model.jad.DescriptorPropertyDescription;
26
import org.eclipse.mtj.ui.internal.MTJUIPlugin;
26
import org.eclipse.mtj.ui.internal.MTJUIPlugin;
27
import org.eclipse.mtj.ui.jadEditor.IJADDescriptorsProvider;
27
import org.eclipse.mtj.ui.jadEditor.IJADDescriptorsProvider;
28
import org.eclipse.mtj.ui.jadEditor.IVendorSpecTester;
29
28
30
/**
29
/**
31
 * Provide registry functionality for getting JAD attributes
30
 * Provide registry functionality for getting JAD attributes according to the
32
 * according to the specify device and editor page.
31
 * specify device and editor page.
33
 * 
32
 * 
34
 * @author gma
33
 * @author gma
35
 * 
34
 * 
Lines 40-49 Link Here
40
	 */
39
	 */
41
	public static final String JAD_ATTRIBUTE_EXTENSION = "jadAttributes";
40
	public static final String JAD_ATTRIBUTE_EXTENSION = "jadAttributes";
42
41
43
	/**
42
//	/**
44
	 * use to store JAD Attributes configElements for different devices.
43
//	 * use to store JAD Attributes configElements for different devices.
45
	 */
44
//	 */
46
	private static Map<IDevice, JADAttributesConfigElement[]> deviceVendorJADAttrMap = new HashMap<IDevice, JADAttributesConfigElement[]>();
45
//	private static Map<IDevice, JADAttributesConfigElement[]> deviceVendorJADAttrMap = new HashMap<IDevice, JADAttributesConfigElement[]>();
47
46
48
	/**
47
	/**
49
	 * use to store generic JAD attributes(not vendor specific) for each page.
48
	 * use to store generic JAD attributes(not vendor specific) for each page.
Lines 64-81 Link Here
64
	 * @return the vendor specific JAD descriptors
63
	 * @return the vendor specific JAD descriptors
65
	 */
64
	 */
66
	public static DescriptorPropertyDescription[] getJADAttrDescriptorsByPage(
65
	public static DescriptorPropertyDescription[] getJADAttrDescriptorsByPage(
67
			String pageID, IDevice device) {
66
			String pageID) {
68
		JADAttributesConfigElement[] relatedElements = getRelatedAttrElements(pageID,device);
67
		JADAttributesConfigElement[] relatedElements = getRelatedAttrElements(pageID);
69
		DescriptorPropertyDescription[] resultAttributes = getDescriptorsFromElements(relatedElements,device);
68
		DescriptorPropertyDescription[] resultAttributes = getDescriptorsFromElements(relatedElements);
70
		return resultAttributes;
69
		return resultAttributes;
71
	}
70
	}
71
72
	/**
72
	/**
73
	 * return the related jadAttributes configElements
73
	 * return the related jadAttributes configElements
74
	 */
74
	 */
75
	private static JADAttributesConfigElement[] getRelatedAttrElements(String pageID,IDevice device){
75
	private static JADAttributesConfigElement[] getRelatedAttrElements(
76
			String pageID) {
76
		JADAttributesConfigElement[] genericElements = null;
77
		JADAttributesConfigElement[] genericElements = null;
77
		JADAttributesConfigElement[] vendorSpecElements = null;
78
		// JADAttributesConfigElement[] vendorSpecElements = null;
78
		JADAttributesConfigElement[] resultElements = null;
79
		// JADAttributesConfigElement[] resultElements = null;
79
		// get the page's generic JAD attribute descriptors
80
		// get the page's generic JAD attribute descriptors
80
		if (!genericPageJADAttrMap.containsKey(pageID)) {
81
		if (!genericPageJADAttrMap.containsKey(pageID)) {
81
			genericPageJADAttrMap.put(pageID, getGenericElements(pageID));
82
			genericPageJADAttrMap.put(pageID, getGenericElements(pageID));
Lines 82-140 Link Here
82
		}
83
		}
83
		genericElements = genericPageJADAttrMap.get(pageID);
84
		genericElements = genericPageJADAttrMap.get(pageID);
84
		// get the page's vendor specific JAD attributes descriptors
85
		// get the page's vendor specific JAD attributes descriptors
85
		vendorSpecElements = getVendorSpecElements(pageID,device);
86
		// vendorSpecElements = getVendorSpecElements(pageID,device);
86
		
87
		//		
87
		resultElements = new JADAttributesConfigElement[genericElements.length+vendorSpecElements.length];
88
		// resultElements = new
88
		System.arraycopy(genericElements, 0, resultElements, 0, genericElements.length);
89
		// JADAttributesConfigElement[genericElements.length+vendorSpecElements.length];
89
		System.arraycopy(vendorSpecElements, 0, resultElements, genericElements.length, vendorSpecElements.length);
90
		// System.arraycopy(genericElements, 0, resultElements, 0,
90
		
91
		// genericElements.length);
91
		return resultElements;
92
		// System.arraycopy(vendorSpecElements, 0, resultElements,
93
		// genericElements.length, vendorSpecElements.length);
94
95
		// return resultElements;
96
		return genericElements;
92
	}
97
	}
93
	/**
98
94
	 * 
99
//	/**
95
	 * @param pageID
100
//	 * 
96
	 * 		the JAD Editor page's ID
101
//	 * @param pageID
97
	 * @param device
102
//	 *            the JAD Editor page's ID
98
	 * 		the device used
103
//	 * @param device
99
	 * @return
104
//	 *            the device used
100
	 * 		the vendor specific jadAttributes configElements for specific page
105
//	 * @return the vendor specific jadAttributes configElements for specific
101
	 */
106
//	 *         page
102
	private static JADAttributesConfigElement[] getVendorSpecElements(String pageID,IDevice device){
107
//	 */
103
		if (!deviceVendorJADAttrMap.containsKey(device)) {
108
//	private static JADAttributesConfigElement[] getVendorSpecElements(
104
			JADAttributesConfigElement[] elements = getAllJADAttributeElements();
109
//			String pageID, IDevice device) {
105
			elements = filterElementsByDevice(elements,device);
110
//		if (!deviceVendorJADAttrMap.containsKey(device)) {
106
			deviceVendorJADAttrMap.put(device, elements);
111
//			JADAttributesConfigElement[] elements = getAllJADAttributeElements();
107
		}
112
//			elements = filterElementsByDevice(elements, device);
108
		JADAttributesConfigElement[] allSpecVendorElements = deviceVendorJADAttrMap.get(device);
113
//			deviceVendorJADAttrMap.put(device, elements);
109
		
114
//		}
110
		return filterElementsByPage(allSpecVendorElements,pageID);
115
//		JADAttributesConfigElement[] allSpecVendorElements = deviceVendorJADAttrMap
111
		
116
//				.get(device);
112
	}
117
//
118
//		return filterElementsByPage(allSpecVendorElements, pageID);
119
//
120
//	}
121
113
	/**
122
	/**
114
	 * 
123
	 * 
115
	 * @param pageID
124
	 * @param pageID
116
	 * 		the JAD Editor page's ID
125
	 *            the JAD Editor page's ID
117
	 * @return
126
	 * @return the generic jadAttributes configElements for specific page
118
	 * 		the generic jadAttributes configElements for specific page
119
	 */
127
	 */
120
	private static JADAttributesConfigElement[] getGenericElements(String pageID){
128
	private static JADAttributesConfigElement[] getGenericElements(String pageID) {
121
		JADAttributesConfigElement[] elements = getAllJADAttributeElements();
129
		JADAttributesConfigElement[] elements = getAllJADAttributeElements();
122
		return filterElementsByPageAndVendorSpec(elements,pageID,true);
130
		return filterElementsByPageAndVendorSpec(elements, pageID, true);
123
	
131
124
	}
125
	private static JADAttributesConfigElement[] filterElementsByDevice(JADAttributesConfigElement[] elements,IDevice device){
126
		return filterElements(elements,device,null,false);
127
	}
132
	}
128
	
133
129
	private static JADAttributesConfigElement[] filterElementsByPage(JADAttributesConfigElement[] elements,String pageID){
134
//	private static JADAttributesConfigElement[] filterElementsByDevice(
130
		return filterElements(elements,null,pageID,false);
135
//			JADAttributesConfigElement[] elements, IDevice device) {
136
//		return filterElements(elements, device, null, false);
137
//	}
138
//
139
//	private static JADAttributesConfigElement[] filterElementsByPage(
140
//			JADAttributesConfigElement[] elements, String pageID) {
141
//		return filterElements(elements, null, pageID, false);
142
//	}
143
144
	private static JADAttributesConfigElement[] filterElementsByPageAndVendorSpec(
145
			JADAttributesConfigElement[] elements, String pageID,
146
			boolean excludeVendorSpec) {
147
		return filterElements(elements, null, pageID, excludeVendorSpec);
131
	}
148
	}
132
	
149
133
	private static JADAttributesConfigElement[] filterElementsByPageAndVendorSpec(JADAttributesConfigElement[] elements,String pageID,boolean excludeVendorSpec){
150
	private static JADAttributesConfigElement[] filterElements(
134
		return filterElements(elements,null,pageID,excludeVendorSpec);
151
			JADAttributesConfigElement[] elements, IDevice device,
135
	}
152
			String pageID, boolean excludeVendorSpec) {
136
	
137
	private static JADAttributesConfigElement[] filterElements(JADAttributesConfigElement[] elements,IDevice device,String pageID,boolean excludeVendorSpec){
138
		ArrayList<JADAttributesConfigElement> resultDescriptorList = new ArrayList<JADAttributesConfigElement>();
153
		ArrayList<JADAttributesConfigElement> resultDescriptorList = new ArrayList<JADAttributesConfigElement>();
139
		for (int i = 0; i < elements.length; i++) {
154
		for (int i = 0; i < elements.length; i++) {
140
			JADAttributesConfigElement element = elements[i];
155
			JADAttributesConfigElement element = elements[i];
Lines 139-157 Link Here
139
		for (int i = 0; i < elements.length; i++) {
154
		for (int i = 0; i < elements.length; i++) {
140
			JADAttributesConfigElement element = elements[i];
155
			JADAttributesConfigElement element = elements[i];
141
			boolean satisfied = true;
156
			boolean satisfied = true;
142
			if(device!=null)
157
			if (device != null)
143
				satisfied &= element.isVendorSpec()&&isDeviceMatchVendor(device, element);
158
				satisfied &= element.isVendorSpec()
144
			if(pageID!=null)
159
						&& isDeviceMatchVendor(device, element);
145
				satisfied &= element.getAttributesShowPage().equalsIgnoreCase(pageID);
160
			if (pageID != null)
146
			if(excludeVendorSpec)
161
				satisfied &= element.getAttributesShowPage().equalsIgnoreCase(
162
						pageID);
163
			if (excludeVendorSpec)
147
				satisfied &= !element.isVendorSpec();
164
				satisfied &= !element.isVendorSpec();
148
			
165
149
			if (satisfied)
166
			if (satisfied)
150
				resultDescriptorList.add(element);
167
				resultDescriptorList.add(element);
151
			
168
152
		}
169
		}
153
		return resultDescriptorList.toArray(new JADAttributesConfigElement[0]);
170
		return resultDescriptorList.toArray(new JADAttributesConfigElement[0]);
154
	}
171
	}
172
155
	/**
173
	/**
156
	 * judge whether the configuration element is for the device
174
	 * judge whether the configuration element is for the device
157
	 * 
175
	 * 
Lines 161-199 Link Here
161
	 */
179
	 */
162
	private static boolean isDeviceMatchVendor(IDevice device,
180
	private static boolean isDeviceMatchVendor(IDevice device,
163
			JADAttributesConfigElement element) {
181
			JADAttributesConfigElement element) {
164
		IVendorSpecTester vendorSpecTester = null;
182
		// IVendorSpecTester vendorSpecTester = null;
165
		try {
183
		// try {
166
			vendorSpecTester = element.getVendorSpecTester();
184
		// vendorSpecTester = element.getVendorSpecTester();
167
		} catch (CoreException e) {
185
		// } catch (CoreException e) {
168
		}
186
		// }
169
		boolean matched = false;
187
		// boolean matched = false;
170
		if (vendorSpecTester != null) {
188
		// if (vendorSpecTester != null) {
171
			try {
189
		// try {
172
				matched = vendorSpecTester.isVendorSpec(device);
190
		// matched = vendorSpecTester.isVendorSpec(device);
173
			} catch (Exception e) {
191
		// } catch (Exception e) {
174
				matched = false;
192
		// matched = false;
175
				MTJCorePlugin
193
		// MTJCorePlugin
176
						.log(IStatus.WARNING,
194
		// .log(IStatus.WARNING,
177
								"Errors happens while judging the device has vendor specifc JAD attributes",
195
		// "Errors happens while judging the device has vendor specifc JAD
178
								e);
196
		// attributes",
179
			}
197
		// e);
180
		}
198
		// }
181
		return matched;
199
		// }
200
		// return matched;
201
		return true;
182
	}
202
	}
183
	
203
184
	/**
204
	/**
185
	 * 
205
	 * 
186
	 * @param elements
206
	 * @param elements
187
	 * 			config elements
207
	 *            config elements
188
	 * @param pageID
208
	 * @param pageID
189
	 * 			editor page ID
209
	 *            editor page ID
190
	 * @param device
210
	 * @param device
191
	 * 			target device
211
	 *            target device
192
	 
212
	 * 
193
	 * @return DescriptorPropertyDescription array
213
	 * @return DescriptorPropertyDescription array
194
	 */
214
	 */
195
	private static DescriptorPropertyDescription[] getDescriptorsFromElements(
215
	private static DescriptorPropertyDescription[] getDescriptorsFromElements(
196
			JADAttributesConfigElement[] elements, IDevice device) {
216
			JADAttributesConfigElement[] elements) {
197
		ArrayList<DescriptorPropertyDescription> descriptorList = new ArrayList<DescriptorPropertyDescription>();
217
		ArrayList<DescriptorPropertyDescription> descriptorList = new ArrayList<DescriptorPropertyDescription>();
198
		for (int i = 0; i < elements.length; i++) {
218
		for (int i = 0; i < elements.length; i++) {
199
			JADAttributesConfigElement element = elements[i];
219
			JADAttributesConfigElement element = elements[i];
Lines 201-212 Link Here
201
				IJADDescriptorsProvider provider = element
221
				IJADDescriptorsProvider provider = element
202
						.getJadDescriptorsProvider();
222
						.getJadDescriptorsProvider();
203
				DescriptorPropertyDescription[] descriptorArray = provider
223
				DescriptorPropertyDescription[] descriptorArray = provider
204
						.getDescriptorPropertyDescriptions(device);
224
						.getDescriptorPropertyDescriptions();
205
				descriptorList.addAll(Arrays.asList(descriptorArray));
225
				descriptorList.addAll(Arrays.asList(descriptorArray));
206
				
226
207
			} catch (Exception e) {
227
			} catch (Exception e) {
208
				MTJCorePlugin
228
				MTJCorePlugin
209
						.log(IStatus.WARNING,
229
						.log(
230
								IStatus.WARNING,
210
								"Errors happens while judging the device has vendor specifc JAD attributes",
231
								"Errors happens while judging the device has vendor specifc JAD attributes",
211
								e);
232
								e);
212
			}
233
			}
Lines 212-220 Link Here
212
			}
233
			}
213
		}
234
		}
214
235
215
		return descriptorList.toArray(new DescriptorPropertyDescription[0]);
236
		return descriptorList
237
				.toArray(new DescriptorPropertyDescription[descriptorList
238
						.size()]);
216
	}
239
	}
217
	
218
240
219
	private static JADAttributesConfigElement[] getAllJADAttributeElements() {
241
	private static JADAttributesConfigElement[] getAllJADAttributeElements() {
220
		if (allJADAttrElements == null) {
242
		if (allJADAttrElements == null) {
Lines 246-252 Link Here
246
	 * 
268
	 * 
247
	 */
269
	 */
248
	static class JADAttributesConfigElement {
270
	static class JADAttributesConfigElement {
249
		private static final String VENDOR_SPEC_TESTER = "vendorSpecTester";
250
		private static final String JAD_DESCRIPTOR_PROVIDER_ELEMENT = "jadDescriptorsProvider";
271
		private static final String JAD_DESCRIPTOR_PROVIDER_ELEMENT = "jadDescriptorsProvider";
251
		private static final String JAD_DESCRIPTOR_PROVIDER_CLASS = "class";
272
		private static final String JAD_DESCRIPTOR_PROVIDER_CLASS = "class";
252
		private static final String JAD_ATTR_SHOW_PAGE = "pageID";
273
		private static final String JAD_ATTR_SHOW_PAGE = "pageID";
Lines 253-259 Link Here
253
		private static final String VENDOR_SPEC_ATTR = "vendorSpec";
274
		private static final String VENDOR_SPEC_ATTR = "vendorSpec";
254
275
255
		private IConfigurationElement element;
276
		private IConfigurationElement element;
256
		private IVendorSpecTester vendorSpecTester;
277
		// private IVendorSpecTester vendorSpecTester;
257
		private IJADDescriptorsProvider jadDescriptorsProvider;
278
		private IJADDescriptorsProvider jadDescriptorsProvider;
258
279
259
		public JADAttributesConfigElement(IConfigurationElement jadAttrElement) {
280
		public JADAttributesConfigElement(IConfigurationElement jadAttrElement) {
Lines 260-272 Link Here
260
			this.element = jadAttrElement;
281
			this.element = jadAttrElement;
261
		}
282
		}
262
283
263
		public IVendorSpecTester getVendorSpecTester() throws CoreException {
284
		// public IVendorSpecTester getVendorSpecTester() throws CoreException {
264
			if (vendorSpecTester == null) {
285
		// if (vendorSpecTester == null) {
265
				vendorSpecTester = (IVendorSpecTester) element
286
		// vendorSpecTester = (IVendorSpecTester) element
266
						.createExecutableExtension(VENDOR_SPEC_TESTER);
287
		// .createExecutableExtension(VENDOR_SPEC_TESTER);
267
			}
288
		// }
268
			return vendorSpecTester;
289
		// return vendorSpecTester;
269
		}
290
		// }
270
291
271
		public IJADDescriptorsProvider getJadDescriptorsProvider()
292
		public IJADDescriptorsProvider getJadDescriptorsProvider()
272
				throws CoreException {
293
				throws CoreException {
Lines 284-293 Link Here
284
		public String getAttributesShowPage() {
305
		public String getAttributesShowPage() {
285
			return element.getAttribute(JAD_ATTR_SHOW_PAGE);
306
			return element.getAttribute(JAD_ATTR_SHOW_PAGE);
286
		}
307
		}
287
		
308
288
		public boolean isVendorSpec(){
309
		public boolean isVendorSpec() {
289
			String value = element.getAttribute(VENDOR_SPEC_ATTR);
310
			String value = element.getAttribute(VENDOR_SPEC_ATTR);
290
			return value == null?false:"true".equalsIgnoreCase(value);
311
			return value == null ? false : "true".equalsIgnoreCase(value);
291
		}
312
		}
292
313
293
	}
314
	}
(-)src/org/eclipse/mtj/ui/internal/editor/jad/form/RequiredJADDesciptorsProvider.java (-2 / +1 lines)
Lines 14-20 Link Here
14
import org.eclipse.core.runtime.CoreException;
14
import org.eclipse.core.runtime.CoreException;
15
import org.eclipse.core.runtime.IStatus;
15
import org.eclipse.core.runtime.IStatus;
16
import org.eclipse.mtj.core.internal.MTJCorePlugin;
16
import org.eclipse.mtj.core.internal.MTJCorePlugin;
17
import org.eclipse.mtj.core.model.device.IDevice;
18
import org.eclipse.mtj.core.model.jad.DescriptorPropertyDescription;
17
import org.eclipse.mtj.core.model.jad.DescriptorPropertyDescription;
19
import org.eclipse.mtj.core.model.jad.IJADConstants;
18
import org.eclipse.mtj.core.model.jad.IJADConstants;
20
import org.eclipse.mtj.core.model.library.LibrarySpecification;
19
import org.eclipse.mtj.core.model.library.LibrarySpecification;
Lines 116-122 Link Here
116
        return namesAndValues;
115
        return namesAndValues;
117
    }
116
    }
118
117
119
	public DescriptorPropertyDescription[] getDescriptorPropertyDescriptions(IDevice device) {
118
	public DescriptorPropertyDescription[] getDescriptorPropertyDescriptions() {
120
		return REQUIRED_DESCRIPTORS;
119
		return REQUIRED_DESCRIPTORS;
121
	}
120
	}
122
121
(-)src/org/eclipse/mtj/ui/internal/editor/jad/form/OptionalJADDescriptorsProvider.java (-2 / +1 lines)
Lines 11-17 Link Here
11
 */
11
 */
12
package org.eclipse.mtj.ui.internal.editor.jad.form;
12
package org.eclipse.mtj.ui.internal.editor.jad.form;
13
13
14
import org.eclipse.mtj.core.model.device.IDevice;
15
import org.eclipse.mtj.core.model.jad.DescriptorPropertyDescription;
14
import org.eclipse.mtj.core.model.jad.DescriptorPropertyDescription;
16
import org.eclipse.mtj.core.model.jad.IJADConstants;
15
import org.eclipse.mtj.core.model.jad.IJADConstants;
17
import org.eclipse.mtj.ui.MTJUIStrings;
16
import org.eclipse.mtj.ui.MTJUIStrings;
Lines 62-68 Link Here
62
    
61
    
63
   
62
   
64
63
65
	public DescriptorPropertyDescription[] getDescriptorPropertyDescriptions(IDevice device) {
64
	public DescriptorPropertyDescription[] getDescriptorPropertyDescriptions() {
66
		return OPTIONAL_DESCRIPTORS;
65
		return OPTIONAL_DESCRIPTORS;
67
	}
66
	}
68
67
(-)src/org/eclipse/mtj/toolkit/uei/jadEditor/MotoJADDesciptorsProvider.java (-3 / +1 lines)
Lines 11-17 Link Here
11
 */
11
 */
12
package org.eclipse.mtj.toolkit.uei.jadEditor;
12
package org.eclipse.mtj.toolkit.uei.jadEditor;
13
13
14
import org.eclipse.mtj.core.model.device.IDevice;
15
import org.eclipse.mtj.core.model.jad.DescriptorPropertyDescription;
14
import org.eclipse.mtj.core.model.jad.DescriptorPropertyDescription;
16
import org.eclipse.mtj.ui.jadEditor.IJADDescriptorsProvider;
15
import org.eclipse.mtj.ui.jadEditor.IJADDescriptorsProvider;
17
import org.eclipse.mtj.ui.jadEditor.ListDescriptorPropertyDescription;
16
import org.eclipse.mtj.ui.jadEditor.ListDescriptorPropertyDescription;
Lines 59-66 Link Here
59
58
60
	};
59
	};
61
60
62
	public DescriptorPropertyDescription[] getDescriptorPropertyDescriptions(
61
	public DescriptorPropertyDescription[] getDescriptorPropertyDescriptions() {
63
			IDevice device) {
64
		return MOTO_JAD_DESCRIPTORS;
62
		return MOTO_JAD_DESCRIPTORS;
65
63
66
	}
64
	}
(-)src/org/eclipse/mtj/toolkit/uei/jadEditor/MotoSpecTester.java (-36 lines)
Lines 1-36 Link Here
1
/**
2
 * Copyright (c) 2003,2008 Sybase Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * Contributors:
9
 *     Gang Ma 		(Sybase) - Initial implementation
10
 *     
11
 */
12
package org.eclipse.mtj.toolkit.uei.jadEditor;
13
14
import java.util.regex.Matcher;
15
import java.util.regex.Pattern;
16
17
import org.eclipse.mtj.core.model.device.IDevice;
18
import org.eclipse.mtj.ui.jadEditor.IVendorSpecTester;
19
/**
20
 * simple implementation of IVendorSpecTester, used to test whether the device belongs
21
 * to motorola.
22
 * @author gma
23
 *
24
 */
25
public class MotoSpecTester implements IVendorSpecTester {
26
27
	private static final String MOTO_DEVICE_MATCHEXPRESSION = "moto*";
28
	
29
	public boolean isVendorSpec(IDevice device) {
30
		Pattern matchPattern = Pattern.compile(MOTO_DEVICE_MATCHEXPRESSION);
31
		Matcher matcher = matchPattern.matcher(device.getGroupName().toLowerCase());
32
		
33
		return matcher.find();
34
	}
35
36
}
(-)src/org/eclipse/mtj/toolkit/uei/jadEditor/NokiaSpecPropertiesEditorPage.java (-42 / +38 lines)
Lines 18-33 Link Here
18
import org.eclipse.ui.PlatformUI;
18
import org.eclipse.ui.PlatformUI;
19
19
20
/**
20
/**
21
 * Nokia specific JAD editor page.
21
 * Nokia S60 specific JAD editor page.
22
 * 
22
 * @author gma
23
 * @author gma
23
 *
24
 * 
24
 */
25
 */
25
public class NokiaSpecPropertiesEditorPage extends JADPropertiesEditorPage {
26
public class NokiaSpecPropertiesEditorPage extends JADPropertiesEditorPage {
26
    
27
27
    public static final String ID = "nokiaSpecific";
28
	public static final String ID = "nokiaSpecific";
28
    public static final String TITLE = "Nokia specific";
29
	public static final String TITLE = "Nokia specific";
29
30
30
    private static final String NOKIA_S40_UPDATE = "Nokia-Update";
31
	private static final String NOKIA_S40_UPDATE = "Nokia-Update";
31
32
32
	private static final String NOKIA_S60_CATEGORY = "Nokia-MIDlet-Category";
33
	private static final String NOKIA_S60_CATEGORY = "Nokia-MIDlet-Category";
33
	private static final String NOKIA_S60_CATEGORY_LBL = "Nokia-MIDlet-Category:";
34
	private static final String NOKIA_S60_CATEGORY_LBL = "Nokia-MIDlet-Category:";
Lines 35-41 Link Here
35
	private static final String NOKIA_S60_ORIGIN_DISPLAY_SIZE_LBL = "Nokia-MIDlet-Original-Display-Size:";
36
	private static final String NOKIA_S60_ORIGIN_DISPLAY_SIZE_LBL = "Nokia-MIDlet-Original-Display-Size:";
36
	private static final String NOKIA_S60_TARGET_DISPLAY_SIZE = "Nokia-MIDlet-Target-Display-Size";
37
	private static final String NOKIA_S60_TARGET_DISPLAY_SIZE = "Nokia-MIDlet-Target-Display-Size";
37
	private static final String NOKIA_S60_TARGET_DISPLAY_SIZE_LBL = "Nokia-MIDlet-Target-Display-Size:";
38
	private static final String NOKIA_S60_TARGET_DISPLAY_SIZE_LBL = "Nokia-MIDlet-Target-Display-Size:";
38
	
39
39
	private static final String NOKIA_S40_UPDATE_LBL = "Nokia-Update:";
40
	private static final String NOKIA_S40_UPDATE_LBL = "Nokia-Update:";
40
41
41
	private static final DescriptorPropertyDescription[] NOKIA_S60_JAD_DESCRIPTORS = new DescriptorPropertyDescription[] {
42
	private static final DescriptorPropertyDescription[] NOKIA_S60_JAD_DESCRIPTORS = new DescriptorPropertyDescription[] {
Lines 48-54 Link Here
48
			new DescriptorPropertyDescription(NOKIA_S60_ORIGIN_DISPLAY_SIZE,
49
			new DescriptorPropertyDescription(NOKIA_S60_ORIGIN_DISPLAY_SIZE,
49
					NOKIA_S60_TARGET_DISPLAY_SIZE_LBL,
50
					NOKIA_S60_TARGET_DISPLAY_SIZE_LBL,
50
					DescriptorPropertyDescription.DATATYPE_STRING) };
51
					DescriptorPropertyDescription.DATATYPE_STRING) };
51
	
52
52
	private static final DescriptorPropertyDescription[] NOKIA_S40_JAD_DESCRIPTORS = new DescriptorPropertyDescription[] { new DescriptorPropertyDescription(
53
	private static final DescriptorPropertyDescription[] NOKIA_S40_JAD_DESCRIPTORS = new DescriptorPropertyDescription[] { new DescriptorPropertyDescription(
53
			NOKIA_S40_UPDATE, NOKIA_S40_UPDATE_LBL,
54
			NOKIA_S40_UPDATE, NOKIA_S40_UPDATE_LBL,
54
			DescriptorPropertyDescription.DATATYPE_STRING)
55
			DescriptorPropertyDescription.DATATYPE_STRING)
Lines 54-95 Link Here
54
			DescriptorPropertyDescription.DATATYPE_STRING)
55
			DescriptorPropertyDescription.DATATYPE_STRING)
55
56
56
	};
57
	};
57
    
58
59
	public NokiaSpecPropertiesEditorPage() {
60
		super(ID, TITLE);
61
	}
58
62
59
    public NokiaSpecPropertiesEditorPage() {
63
	/**
60
        super(ID, TITLE);
64
	 * return array of DescriptorPropertyDescription
61
    }
65
	 */
62
    /**
66
	@Override
63
     * return array of DescriptorPropertyDescription
67
	protected DescriptorPropertyDescription[] doGetDescriptors() {
64
     */
68
		
65
    @Override
69
		return NOKIA_S60_JAD_DESCRIPTORS;
66
    protected DescriptorPropertyDescription[] doGetDescriptors() {
67
		IDevice device = getProjectDevice();
68
		String toolKitName = device.getGroupName();
69
		if (toolKitName.toLowerCase().indexOf("series 40") != -1) {
70
			return NOKIA_S40_JAD_DESCRIPTORS;
71
		} else if (toolKitName.toLowerCase().indexOf("series 60") != -1) {
72
			return NOKIA_S60_JAD_DESCRIPTORS;
73
		}
74
		
70
		
75
		return new DescriptorPropertyDescription[0];}
71
	}
76
    
77
    /**
78
     * @see org.eclipse.mtj.ui.jadEditor.AbstractJADEditorPage#getSectionTitle()
79
     */
80
    protected String getSectionTitle() {
81
        return "Nokia Specific Properties";
82
    }
83
72
84
    /**
73
	/**
85
     * @see org.eclipse.mtj.ui.jadEditor.AbstractJADEditorPage#getSectionDescription()
74
	 * @see org.eclipse.mtj.ui.jadEditor.AbstractJADEditorPage#getSectionTitle()
86
     */
75
	 */
87
    protected String getSectionDescription() {
76
	protected String getSectionTitle() {
88
        return "Nokia specific JAD properties can be specified on this page";
77
		return "Nokia Specific Properties";
89
    }
78
	}
90
79
91
    protected void addContextHelp(Composite c) {
80
	/**
92
        PlatformUI.getWorkbench().getHelpSystem().setHelp(c,
81
	 * @see org.eclipse.mtj.ui.jadEditor.AbstractJADEditorPage#getSectionDescription()
93
                "org.eclipse.mtj.ui.help_NokiaJADPropertiesEditorPage");
82
	 */
94
    }
83
	protected String getSectionDescription() {
84
		return "Nokia specific JAD properties can be specified on this page";
85
	}
86
87
	protected void addContextHelp(Composite c) {
88
		PlatformUI.getWorkbench().getHelpSystem().setHelp(c,
89
				"org.eclipse.mtj.ui.help_NokiaJADPropertiesEditorPage");
90
	}
95
}
91
}
(-)src/org/eclipse/mtj/toolkit/uei/jadEditor/NokiaSpecTester.java (-40 lines)
Lines 1-40 Link Here
1
/**
2
 * Copyright (c) 2003,2008 Sybase Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * Contributors:
9
 *     Gang Ma 		(Sybase) - Initial implementation
10
 *     
11
 */
12
package org.eclipse.mtj.toolkit.uei.jadEditor;
13
14
import java.util.regex.Matcher;
15
import java.util.regex.Pattern;
16
17
import org.eclipse.mtj.core.model.device.IDevice;
18
import org.eclipse.mtj.ui.jadEditor.IVendorSpecTester;
19
/**
20
 * simple implementation of IVendorSpecTester, used to test whether the device belongs
21
 * to Nokia.
22
 * @author gma
23
 *
24
 */
25
public class NokiaSpecTester implements IVendorSpecTester {
26
27
	private static final String Nokia_S40_MATCHEXPRESSION = "series 40*";
28
	private static final String Nokia_S60_MATCHEXPRESSION = "series 60*";
29
	
30
	public boolean isVendorSpec(IDevice device) {
31
		String toolkitName = device.getGroupName();
32
		Pattern s40MatchPattern = Pattern.compile(Nokia_S40_MATCHEXPRESSION);
33
		Pattern s60MatchPattern = Pattern.compile(Nokia_S60_MATCHEXPRESSION);
34
		Matcher matcher1 = s40MatchPattern.matcher(toolkitName.toLowerCase());
35
		Matcher matcher2 = s60MatchPattern.matcher(toolkitName.toLowerCase());
36
		
37
		return matcher1.find()||matcher2.find();
38
	}
39
40
}
(-)plugin.xml (-4 / +1 lines)
Lines 4-11 Link Here
4
   <extension
4
   <extension
5
          point="org.eclipse.mtj.ui.jadEditorPages">
5
          point="org.eclipse.mtj.ui.jadEditorPages">
6
       <jadEditorPage
6
       <jadEditorPage
7
       		vendorSpec="true"
8
       		vendorSpecTester="org.eclipse.mtj.toolkit.uei.jadEditor.MotoSpecTester"
9
       		class="org.eclipse.mtj.toolkit.uei.jadEditor.MotoSpecPropertiesEditorPage"
7
       		class="org.eclipse.mtj.toolkit.uei.jadEditor.MotoSpecPropertiesEditorPage"
10
       		/>
8
       		/>
11
    </extension>
9
    </extension>
Lines 21-29 Link Here
21
    <extension
19
    <extension
22
          point="org.eclipse.mtj.ui.jadEditorPages">
20
          point="org.eclipse.mtj.ui.jadEditorPages">
23
       <jadEditorPage
21
       <jadEditorPage
24
       		vendorSpec="true"
25
       		vendorSpecTester="org.eclipse.mtj.toolkit.uei.jadEditor.NokiaSpecTester"
26
       		class="org.eclipse.mtj.toolkit.uei.jadEditor.NokiaSpecPropertiesEditorPage"
22
       		class="org.eclipse.mtj.toolkit.uei.jadEditor.NokiaSpecPropertiesEditorPage"
23
       		priority="70"
27
       		/>
24
       		/>
28
    </extension>
25
    </extension>
29
26

Return to bug 243215