Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 109625 Details for
Bug 243215
remove filter on jad extension
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
patch for this bug
JADEditorExtensionPatch_revise.txt (text/plain), 38.14 KB, created by
Gang(Allen) Ma
on 2008-08-10 22:52:58 EDT
(
hide
)
Description:
patch for this bug
Filename:
MIME Type:
Creator:
Gang(Allen) Ma
Created:
2008-08-10 22:52:58 EDT
Size:
38.14 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mtj.ui >Index: schema/jadAttributes.exsd >=================================================================== >--- schema/jadAttributes.exsd (revision 345) >+++ schema/jadAttributes.exsd (working copy) >@@ -47,31 +47,6 @@ > <sequence minOccurs="1" maxOccurs="unbounded"> > <element ref="jadDescriptorsProvider"/> > </sequence> >- <attribute name="vendorSpec"> >- <annotation> >- <documentation> >- Indicate if the JAD attributes is vendor specific, if so set this attribute to "true", otherwise set to "false" or do not set. >- </documentation> >- </annotation> >- <simpleType> >- <restriction base="string"> >- <enumeration value="true"> >- </enumeration> >- <enumeration value="false"> >- </enumeration> >- </restriction> >- </simpleType> >- </attribute> >- <attribute name="vendorSpecTester" type="string"> >- <annotation> >- <documentation> >- the required implementation class of the <code>org.eclipse.mtj.ui.jadEditor.IVendorSpecTester</code> interface that will be used to test whether the device belongs to the vendor. >- </documentation> >- <appInfo> >- <meta.attribute kind="java" basedOn=":org.eclipse.mtj.ui.jadEditor.IVendorSpecTester"/> >- </appInfo> >- </annotation> >- </attribute> > <attribute name="pageID" type="string" use="required"> > <annotation> > <documentation> >Index: schema/jadEditorPages.exsd >=================================================================== >--- schema/jadEditorPages.exsd (revision 345) >+++ schema/jadEditorPages.exsd (working copy) >@@ -47,8 +47,7 @@ > <attribute name="class" type="string" use="required"> > <annotation> > <documentation> >- >-the page's implementation class, must public and extends <code>org.eclipse.mtj.ui.jadEditor.AbstractJADEditorPage</code> with a zero-argument constructor. >+ the page's implementation class, must public and extends <code>org.eclipse.mtj.ui.jadEditor.AbstractJADEditorPage</code> with a zero-argument constructor. > > If you want to add a property page to the editor, the class <code>org.eclipse.mtj.ui.jadEditor.JADPropertiesEditorPage</code> provide a convient implementation, you may extend from it. > </documentation> >@@ -57,31 +56,6 @@ > </appInfo> > </annotation> > </attribute> >- <attribute name="vendorSpec"> >- <annotation> >- <documentation> >- Indicate if the JAD attributes is vendor specific, if so set this attribute to "true", otherwise set to "false" or do not set. >- </documentation> >- </annotation> >- <simpleType> >- <restriction base="string"> >- <enumeration value="true"> >- </enumeration> >- <enumeration value="false"> >- </enumeration> >- </restriction> >- </simpleType> >- </attribute> >- <attribute name="vendorSpecTester" type="string"> >- <annotation> >- <documentation> >- the required implementation class of the <code>org.eclipse.mtj.ui.jadEditor.IVendorSpecTester</code> interface that will be used to test whether the device belongs to the vendor. >- </documentation> >- <appInfo> >- <meta.attribute kind="java" basedOn=":org.eclipse.mtj.ui.jadEditor.IVendorSpecTester"/> >- </appInfo> >- </annotation> >- </attribute> > <attribute name="priority" type="string"> > <annotation> > <documentation> >Index: src/org/eclipse/mtj/ui/jadEditor/AbstractJADEditorPage.java >=================================================================== >--- src/org/eclipse/mtj/ui/jadEditor/AbstractJADEditorPage.java (revision 345) >+++ src/org/eclipse/mtj/ui/jadEditor/AbstractJADEditorPage.java (working copy) >@@ -197,11 +197,11 @@ > String propertyName, Object data) { > //do nothing > } >- /** >- * >- * @return the relevant midlet suite device >- */ >- public IDevice getProjectDevice(){ >- return ((JADFormEditor)this.getEditor()).getProjectDevice(); >- } >+// /** >+// * >+// * @return the relevant midlet suite device >+// */ >+// public IDevice getProjectDevice(){ >+// return ((JADFormEditor)this.getEditor()).getProjectDevice(); >+// } > } >Index: src/org/eclipse/mtj/ui/jadEditor/IVendorSpecTester.java >=================================================================== >--- src/org/eclipse/mtj/ui/jadEditor/IVendorSpecTester.java (revision 345) >+++ src/org/eclipse/mtj/ui/jadEditor/IVendorSpecTester.java (working copy) >@@ -1,32 +0,0 @@ >-/** >- * Copyright (c) 2003,2008 Sybase 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: >- * Gang Ma (Sybase) - Initial implementation >- * >- */ >-package org.eclipse.mtj.ui.jadEditor; >- >-import org.eclipse.mtj.core.model.device.IDevice; >- >-/** >- * This interface should be implemented by vendors who want to add vendor >- * specific things such as vendor specific JAD Editor pages,JAD attributes, >- * the implementation will be used to test if the device user used meet >- * the vendor's requirements >- * @author gma >- * >- */ >-public interface IVendorSpecTester { >- /** >- * this method is used to test whether the device user used is >- * vendor specific >- * @param device TODO >- * @return >- */ >- public boolean isVendorSpec(IDevice device); >-} >Index: src/org/eclipse/mtj/ui/jadEditor/JADPropertiesEditorPage.java >=================================================================== >--- src/org/eclipse/mtj/ui/jadEditor/JADPropertiesEditorPage.java (revision 345) >+++ src/org/eclipse/mtj/ui/jadEditor/JADPropertiesEditorPage.java (working copy) >@@ -318,8 +318,8 @@ > * @return > */ > protected DescriptorPropertyDescription[] doGetDescriptors() { >- IDevice device = ((JADFormEditor)this.getEditor()).getProjectDevice(); >- return JADAttributesRegistry.getJADAttrDescriptorsByPage(getId(), device); >+// IDevice device = ((JADFormEditor)this.getEditor()).getProjectDevice(); >+ return JADAttributesRegistry.getJADAttrDescriptorsByPage(getId()); > } > > >Index: src/org/eclipse/mtj/ui/jadEditor/IJADDescriptorsProvider.java >=================================================================== >--- src/org/eclipse/mtj/ui/jadEditor/IJADDescriptorsProvider.java (revision 345) >+++ src/org/eclipse/mtj/ui/jadEditor/IJADDescriptorsProvider.java (working copy) >@@ -11,7 +11,6 @@ > */ > package org.eclipse.mtj.ui.jadEditor; > >-import org.eclipse.mtj.core.model.device.IDevice; > import org.eclipse.mtj.core.model.jad.DescriptorPropertyDescription; > > /** >@@ -26,8 +25,7 @@ > public interface IJADDescriptorsProvider { > /** > * >- * @param device TODO > * @return array off DescriptorPropertyDescription > */ >- DescriptorPropertyDescription[] getDescriptorPropertyDescriptions(IDevice device); >+ DescriptorPropertyDescription[] getDescriptorPropertyDescriptions(); > } >Index: src/org/eclipse/mtj/ui/internal/editor/jad/form/JADEditorPageConfigElement.java >=================================================================== >--- src/org/eclipse/mtj/ui/internal/editor/jad/form/JADEditorPageConfigElement.java (revision 345) >+++ src/org/eclipse/mtj/ui/internal/editor/jad/form/JADEditorPageConfigElement.java (working copy) >@@ -14,7 +14,6 @@ > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IConfigurationElement; > import org.eclipse.mtj.ui.jadEditor.AbstractJADEditorPage; >-import org.eclipse.mtj.ui.jadEditor.IVendorSpecTester; > > /** > * class wrapped IConfigurationElement instance for jadEditorPages >@@ -24,8 +23,8 @@ > */ > public class JADEditorPageConfigElement { > private static final String JAD_EDITOR_PAGE_CLASS = "class"; >- private static final String VENDOR_SPEC_ATTR = "vendorSpec"; >- private static final String VENDOR_SPEC_TESTER = "vendorSpecTester"; >+// private static final String VENDOR_SPEC_ATTR = "vendorSpec"; >+// private static final String VENDOR_SPEC_TESTER = "vendorSpecTester"; > private static final String ATTR_PRIORITY = "priority"; > > private IConfigurationElement element; >@@ -30,7 +29,7 @@ > > private IConfigurationElement element; > // private AbstractJADEditorPage page; >- private IVendorSpecTester vendorSpecTester; >+// private IVendorSpecTester vendorSpecTester; > > public JADEditorPageConfigElement( > IConfigurationElement jadAttrElement) { >@@ -44,18 +43,18 @@ > > } > >- public IVendorSpecTester getVendorSpecTester() throws CoreException { >- if (vendorSpecTester == null) { >- vendorSpecTester = (IVendorSpecTester) element >- .createExecutableExtension(VENDOR_SPEC_TESTER); >- } >- return vendorSpecTester; >- } >- >- public boolean isVendorSpec(){ >- String value = element.getAttribute(VENDOR_SPEC_ATTR); >- return value == null?false:"true".equalsIgnoreCase(value); >- } >+// public IVendorSpecTester getVendorSpecTester() throws CoreException { >+// if (vendorSpecTester == null) { >+// vendorSpecTester = (IVendorSpecTester) element >+// .createExecutableExtension(VENDOR_SPEC_TESTER); >+// } >+// return vendorSpecTester; >+// } >+// >+// public boolean isVendorSpec(){ >+// String value = element.getAttribute(VENDOR_SPEC_ATTR); >+// return value == null?false:"true".equalsIgnoreCase(value); >+// } > > /** > * Return the priority of this element. >Index: src/org/eclipse/mtj/ui/internal/editor/jad/form/JADFormEditor.java >=================================================================== >--- src/org/eclipse/mtj/ui/internal/editor/jad/form/JADFormEditor.java (revision 345) >+++ src/org/eclipse/mtj/ui/internal/editor/jad/form/JADFormEditor.java (working copy) >@@ -10,7 +10,8 @@ > * Craig Setera (EclipseME) - Initial implementation > * Diego Sandin (Motorola) - Refactoring package name to follow eclipse > * standards >- * Diego Sandin (Motorola) - Added source view page >+ * Diego Sandin (Motorola) - Added source view page >+ * Gang Ma (Sybase) - Refactoring the editor to support expansibility > */ > package org.eclipse.mtj.ui.internal.editor.jad.form; > >@@ -89,7 +90,7 @@ > */ > protected void addPages() { > JADEditorPageConfigElement[] pageElements = getAllEditorPageConfigElements(); >- IDevice projectDevice = getProjectDevice(); >+ > // sort the page elements according to the page element's priority > Arrays.sort(pageElements, new Comparator<JADEditorPageConfigElement>() { > public int compare(JADEditorPageConfigElement o1, >@@ -101,10 +102,10 @@ > for (int i = 0; i < pageElements.length; i++) { > try { > JADEditorPageConfigElement element = pageElements[i]; >- if (element.isVendorSpec() >- && !element.getVendorSpecTester().isVendorSpec( >- projectDevice)) >- continue; >+// if (element.isVendorSpec() >+// && !element.getVendorSpecTester().isVendorSpec( >+// projectDevice)) >+// continue; > AbstractJADEditorPage page = element.getJADEditorPage(); > page.setEditor(this); > addPage(page); >@@ -123,19 +124,19 @@ > > > } >- /** >- * get the project's device >- * >- * @return >- */ >- public IDevice getProjectDevice(){ >- IProject project = getJadFile().getProject(); >- IJavaProject javaProject = JavaCore.create(project); >- IMidletSuiteProject midletProject = MidletSuiteFactory >- .getMidletSuiteProject(javaProject); >- >- return midletProject.getDevice(); >- } >+// /** >+// * get the project's device >+// * >+// * @return >+// */ >+// public IDevice getProjectDevice(){ >+// IProject project = getJadFile().getProject(); >+// IJavaProject javaProject = JavaCore.create(project); >+// IMidletSuiteProject midletProject = MidletSuiteFactory >+// .getMidletSuiteProject(javaProject); >+// >+// return midletProject.getDevice(); >+// } > private JADEditorPageConfigElement[] getAllEditorPageConfigElements(){ > if(jadEditorPageConfigElements == null){ > jadEditorPageConfigElements = readAllVendorSpecJADAttributes(); >Index: src/org/eclipse/mtj/ui/internal/editor/jad/form/OTAJADDescriptorsProvider.java >=================================================================== >--- src/org/eclipse/mtj/ui/internal/editor/jad/form/OTAJADDescriptorsProvider.java (revision 345) >+++ src/org/eclipse/mtj/ui/internal/editor/jad/form/OTAJADDescriptorsProvider.java (working copy) >@@ -11,7 +11,6 @@ > */ > package org.eclipse.mtj.ui.internal.editor.jad.form; > >-import org.eclipse.mtj.core.model.device.IDevice; > import org.eclipse.mtj.core.model.jad.DescriptorPropertyDescription; > import org.eclipse.mtj.core.model.jad.IJADConstants; > import org.eclipse.mtj.ui.MTJUIStrings; >@@ -51,7 +50,7 @@ > > > >- public DescriptorPropertyDescription[] getDescriptorPropertyDescriptions(IDevice device) { >+ public DescriptorPropertyDescription[] getDescriptorPropertyDescriptions() { > return OTA_DESCRIPTORS; > } > >Index: src/org/eclipse/mtj/ui/internal/editor/jad/form/JADAttributesRegistry.java >=================================================================== >--- src/org/eclipse/mtj/ui/internal/editor/jad/form/JADAttributesRegistry.java (revision 345) >+++ src/org/eclipse/mtj/ui/internal/editor/jad/form/JADAttributesRegistry.java (working copy) >@@ -25,11 +25,10 @@ > import org.eclipse.mtj.core.model.jad.DescriptorPropertyDescription; > import org.eclipse.mtj.ui.internal.MTJUIPlugin; > import org.eclipse.mtj.ui.jadEditor.IJADDescriptorsProvider; >-import org.eclipse.mtj.ui.jadEditor.IVendorSpecTester; > > /** >- * Provide registry functionality for getting JAD attributes >- * according to the specify device and editor page. >+ * Provide registry functionality for getting JAD attributes according to the >+ * specify device and editor page. > * > * @author gma > * >@@ -40,10 +39,10 @@ > */ > public static final String JAD_ATTRIBUTE_EXTENSION = "jadAttributes"; > >- /** >- * use to store JAD Attributes configElements for different devices. >- */ >- private static Map<IDevice, JADAttributesConfigElement[]> deviceVendorJADAttrMap = new HashMap<IDevice, JADAttributesConfigElement[]>(); >+// /** >+// * use to store JAD Attributes configElements for different devices. >+// */ >+// private static Map<IDevice, JADAttributesConfigElement[]> deviceVendorJADAttrMap = new HashMap<IDevice, JADAttributesConfigElement[]>(); > > /** > * use to store generic JAD attributes(not vendor specific) for each page. >@@ -64,18 +63,20 @@ > * @return the vendor specific JAD descriptors > */ > public static DescriptorPropertyDescription[] getJADAttrDescriptorsByPage( >- String pageID, IDevice device) { >- JADAttributesConfigElement[] relatedElements = getRelatedAttrElements(pageID,device); >- DescriptorPropertyDescription[] resultAttributes = getDescriptorsFromElements(relatedElements,device); >+ String pageID) { >+ JADAttributesConfigElement[] relatedElements = getRelatedAttrElements(pageID); >+ DescriptorPropertyDescription[] resultAttributes = getDescriptorsFromElements(relatedElements); > return resultAttributes; > } >+ > /** > * return the related jadAttributes configElements > */ >- private static JADAttributesConfigElement[] getRelatedAttrElements(String pageID,IDevice device){ >+ private static JADAttributesConfigElement[] getRelatedAttrElements( >+ String pageID) { > JADAttributesConfigElement[] genericElements = null; >- JADAttributesConfigElement[] vendorSpecElements = null; >- JADAttributesConfigElement[] resultElements = null; >+ // JADAttributesConfigElement[] vendorSpecElements = null; >+ // JADAttributesConfigElement[] resultElements = null; > // get the page's generic JAD attribute descriptors > if (!genericPageJADAttrMap.containsKey(pageID)) { > genericPageJADAttrMap.put(pageID, getGenericElements(pageID)); >@@ -82,59 +83,73 @@ > } > genericElements = genericPageJADAttrMap.get(pageID); > // get the page's vendor specific JAD attributes descriptors >- vendorSpecElements = getVendorSpecElements(pageID,device); >- >- resultElements = new JADAttributesConfigElement[genericElements.length+vendorSpecElements.length]; >- System.arraycopy(genericElements, 0, resultElements, 0, genericElements.length); >- System.arraycopy(vendorSpecElements, 0, resultElements, genericElements.length, vendorSpecElements.length); >- >- return resultElements; >+ // vendorSpecElements = getVendorSpecElements(pageID,device); >+ // >+ // resultElements = new >+ // JADAttributesConfigElement[genericElements.length+vendorSpecElements.length]; >+ // System.arraycopy(genericElements, 0, resultElements, 0, >+ // genericElements.length); >+ // System.arraycopy(vendorSpecElements, 0, resultElements, >+ // genericElements.length, vendorSpecElements.length); >+ >+ // return resultElements; >+ return genericElements; > } >- /** >- * >- * @param pageID >- * the JAD Editor page's ID >- * @param device >- * the device used >- * @return >- * the vendor specific jadAttributes configElements for specific page >- */ >- private static JADAttributesConfigElement[] getVendorSpecElements(String pageID,IDevice device){ >- if (!deviceVendorJADAttrMap.containsKey(device)) { >- JADAttributesConfigElement[] elements = getAllJADAttributeElements(); >- elements = filterElementsByDevice(elements,device); >- deviceVendorJADAttrMap.put(device, elements); >- } >- JADAttributesConfigElement[] allSpecVendorElements = deviceVendorJADAttrMap.get(device); >- >- return filterElementsByPage(allSpecVendorElements,pageID); >- >- } >+ >+// /** >+// * >+// * @param pageID >+// * the JAD Editor page's ID >+// * @param device >+// * the device used >+// * @return the vendor specific jadAttributes configElements for specific >+// * page >+// */ >+// private static JADAttributesConfigElement[] getVendorSpecElements( >+// String pageID, IDevice device) { >+// if (!deviceVendorJADAttrMap.containsKey(device)) { >+// JADAttributesConfigElement[] elements = getAllJADAttributeElements(); >+// elements = filterElementsByDevice(elements, device); >+// deviceVendorJADAttrMap.put(device, elements); >+// } >+// JADAttributesConfigElement[] allSpecVendorElements = deviceVendorJADAttrMap >+// .get(device); >+// >+// return filterElementsByPage(allSpecVendorElements, pageID); >+// >+// } >+ > /** > * > * @param pageID >- * the JAD Editor page's ID >- * @return >- * the generic jadAttributes configElements for specific page >+ * the JAD Editor page's ID >+ * @return the generic jadAttributes configElements for specific page > */ >- private static JADAttributesConfigElement[] getGenericElements(String pageID){ >+ private static JADAttributesConfigElement[] getGenericElements(String pageID) { > JADAttributesConfigElement[] elements = getAllJADAttributeElements(); >- return filterElementsByPageAndVendorSpec(elements,pageID,true); >- >- } >- private static JADAttributesConfigElement[] filterElementsByDevice(JADAttributesConfigElement[] elements,IDevice device){ >- return filterElements(elements,device,null,false); >+ return filterElementsByPageAndVendorSpec(elements, pageID, true); >+ > } >- >- private static JADAttributesConfigElement[] filterElementsByPage(JADAttributesConfigElement[] elements,String pageID){ >- return filterElements(elements,null,pageID,false); >+ >+// private static JADAttributesConfigElement[] filterElementsByDevice( >+// JADAttributesConfigElement[] elements, IDevice device) { >+// return filterElements(elements, device, null, false); >+// } >+// >+// private static JADAttributesConfigElement[] filterElementsByPage( >+// JADAttributesConfigElement[] elements, String pageID) { >+// return filterElements(elements, null, pageID, false); >+// } >+ >+ private static JADAttributesConfigElement[] filterElementsByPageAndVendorSpec( >+ JADAttributesConfigElement[] elements, String pageID, >+ boolean excludeVendorSpec) { >+ return filterElements(elements, null, pageID, excludeVendorSpec); > } >- >- private static JADAttributesConfigElement[] filterElementsByPageAndVendorSpec(JADAttributesConfigElement[] elements,String pageID,boolean excludeVendorSpec){ >- return filterElements(elements,null,pageID,excludeVendorSpec); >- } >- >- private static JADAttributesConfigElement[] filterElements(JADAttributesConfigElement[] elements,IDevice device,String pageID,boolean excludeVendorSpec){ >+ >+ private static JADAttributesConfigElement[] filterElements( >+ JADAttributesConfigElement[] elements, IDevice device, >+ String pageID, boolean excludeVendorSpec) { > ArrayList<JADAttributesConfigElement> resultDescriptorList = new ArrayList<JADAttributesConfigElement>(); > for (int i = 0; i < elements.length; i++) { > JADAttributesConfigElement element = elements[i]; >@@ -139,19 +154,22 @@ > for (int i = 0; i < elements.length; i++) { > JADAttributesConfigElement element = elements[i]; > boolean satisfied = true; >- if(device!=null) >- satisfied &= element.isVendorSpec()&&isDeviceMatchVendor(device, element); >- if(pageID!=null) >- satisfied &= element.getAttributesShowPage().equalsIgnoreCase(pageID); >- if(excludeVendorSpec) >+ if (device != null) >+ satisfied &= element.isVendorSpec() >+ && isDeviceMatchVendor(device, element); >+ if (pageID != null) >+ satisfied &= element.getAttributesShowPage().equalsIgnoreCase( >+ pageID); >+ if (excludeVendorSpec) > satisfied &= !element.isVendorSpec(); >- >+ > if (satisfied) > resultDescriptorList.add(element); >- >+ > } > return resultDescriptorList.toArray(new JADAttributesConfigElement[0]); > } >+ > /** > * judge whether the configuration element is for the device > * >@@ -161,39 +179,41 @@ > */ > private static boolean isDeviceMatchVendor(IDevice device, > JADAttributesConfigElement element) { >- IVendorSpecTester vendorSpecTester = null; >- try { >- vendorSpecTester = element.getVendorSpecTester(); >- } catch (CoreException e) { >- } >- boolean matched = false; >- if (vendorSpecTester != null) { >- try { >- matched = vendorSpecTester.isVendorSpec(device); >- } catch (Exception e) { >- matched = false; >- MTJCorePlugin >- .log(IStatus.WARNING, >- "Errors happens while judging the device has vendor specifc JAD attributes", >- e); >- } >- } >- return matched; >+ // IVendorSpecTester vendorSpecTester = null; >+ // try { >+ // vendorSpecTester = element.getVendorSpecTester(); >+ // } catch (CoreException e) { >+ // } >+ // boolean matched = false; >+ // if (vendorSpecTester != null) { >+ // try { >+ // matched = vendorSpecTester.isVendorSpec(device); >+ // } catch (Exception e) { >+ // matched = false; >+ // MTJCorePlugin >+ // .log(IStatus.WARNING, >+ // "Errors happens while judging the device has vendor specifc JAD >+ // attributes", >+ // e); >+ // } >+ // } >+ // return matched; >+ return true; > } >- >+ > /** > * > * @param elements >- * config elements >+ * config elements > * @param pageID >- * editor page ID >+ * editor page ID > * @param device >- * target device >- >+ * target device >+ * > * @return DescriptorPropertyDescription array > */ > private static DescriptorPropertyDescription[] getDescriptorsFromElements( >- JADAttributesConfigElement[] elements, IDevice device) { >+ JADAttributesConfigElement[] elements) { > ArrayList<DescriptorPropertyDescription> descriptorList = new ArrayList<DescriptorPropertyDescription>(); > for (int i = 0; i < elements.length; i++) { > JADAttributesConfigElement element = elements[i]; >@@ -201,12 +221,13 @@ > IJADDescriptorsProvider provider = element > .getJadDescriptorsProvider(); > DescriptorPropertyDescription[] descriptorArray = provider >- .getDescriptorPropertyDescriptions(device); >+ .getDescriptorPropertyDescriptions(); > descriptorList.addAll(Arrays.asList(descriptorArray)); >- >+ > } catch (Exception e) { > MTJCorePlugin >- .log(IStatus.WARNING, >+ .log( >+ IStatus.WARNING, > "Errors happens while judging the device has vendor specifc JAD attributes", > e); > } >@@ -212,9 +233,10 @@ > } > } > >- return descriptorList.toArray(new DescriptorPropertyDescription[0]); >+ return descriptorList >+ .toArray(new DescriptorPropertyDescription[descriptorList >+ .size()]); > } >- > > private static JADAttributesConfigElement[] getAllJADAttributeElements() { > if (allJADAttrElements == null) { >@@ -246,7 +268,6 @@ > * > */ > static class JADAttributesConfigElement { >- private static final String VENDOR_SPEC_TESTER = "vendorSpecTester"; > private static final String JAD_DESCRIPTOR_PROVIDER_ELEMENT = "jadDescriptorsProvider"; > private static final String JAD_DESCRIPTOR_PROVIDER_CLASS = "class"; > private static final String JAD_ATTR_SHOW_PAGE = "pageID"; >@@ -253,7 +274,7 @@ > private static final String VENDOR_SPEC_ATTR = "vendorSpec"; > > private IConfigurationElement element; >- private IVendorSpecTester vendorSpecTester; >+ // private IVendorSpecTester vendorSpecTester; > private IJADDescriptorsProvider jadDescriptorsProvider; > > public JADAttributesConfigElement(IConfigurationElement jadAttrElement) { >@@ -260,13 +281,13 @@ > this.element = jadAttrElement; > } > >- public IVendorSpecTester getVendorSpecTester() throws CoreException { >- if (vendorSpecTester == null) { >- vendorSpecTester = (IVendorSpecTester) element >- .createExecutableExtension(VENDOR_SPEC_TESTER); >- } >- return vendorSpecTester; >- } >+ // public IVendorSpecTester getVendorSpecTester() throws CoreException { >+ // if (vendorSpecTester == null) { >+ // vendorSpecTester = (IVendorSpecTester) element >+ // .createExecutableExtension(VENDOR_SPEC_TESTER); >+ // } >+ // return vendorSpecTester; >+ // } > > public IJADDescriptorsProvider getJadDescriptorsProvider() > throws CoreException { >@@ -284,10 +305,10 @@ > public String getAttributesShowPage() { > return element.getAttribute(JAD_ATTR_SHOW_PAGE); > } >- >- public boolean isVendorSpec(){ >+ >+ public boolean isVendorSpec() { > String value = element.getAttribute(VENDOR_SPEC_ATTR); >- return value == null?false:"true".equalsIgnoreCase(value); >+ return value == null ? false : "true".equalsIgnoreCase(value); > } > > } >Index: src/org/eclipse/mtj/ui/internal/editor/jad/form/RequiredJADDesciptorsProvider.java >=================================================================== >--- src/org/eclipse/mtj/ui/internal/editor/jad/form/RequiredJADDesciptorsProvider.java (revision 345) >+++ src/org/eclipse/mtj/ui/internal/editor/jad/form/RequiredJADDesciptorsProvider.java (working copy) >@@ -14,7 +14,6 @@ > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IStatus; > import org.eclipse.mtj.core.internal.MTJCorePlugin; >-import org.eclipse.mtj.core.model.device.IDevice; > import org.eclipse.mtj.core.model.jad.DescriptorPropertyDescription; > import org.eclipse.mtj.core.model.jad.IJADConstants; > import org.eclipse.mtj.core.model.library.LibrarySpecification; >@@ -116,7 +115,7 @@ > return namesAndValues; > } > >- public DescriptorPropertyDescription[] getDescriptorPropertyDescriptions(IDevice device) { >+ public DescriptorPropertyDescription[] getDescriptorPropertyDescriptions() { > return REQUIRED_DESCRIPTORS; > } > >Index: src/org/eclipse/mtj/ui/internal/editor/jad/form/OptionalJADDescriptorsProvider.java >=================================================================== >--- src/org/eclipse/mtj/ui/internal/editor/jad/form/OptionalJADDescriptorsProvider.java (revision 345) >+++ src/org/eclipse/mtj/ui/internal/editor/jad/form/OptionalJADDescriptorsProvider.java (working copy) >@@ -11,7 +11,6 @@ > */ > package org.eclipse.mtj.ui.internal.editor.jad.form; > >-import org.eclipse.mtj.core.model.device.IDevice; > import org.eclipse.mtj.core.model.jad.DescriptorPropertyDescription; > import org.eclipse.mtj.core.model.jad.IJADConstants; > import org.eclipse.mtj.ui.MTJUIStrings; >@@ -62,7 +61,7 @@ > > > >- public DescriptorPropertyDescription[] getDescriptorPropertyDescriptions(IDevice device) { >+ public DescriptorPropertyDescription[] getDescriptorPropertyDescriptions() { > return OPTIONAL_DESCRIPTORS; > } > >#P org.eclipse.mtj.examples.jadextension >Index: src/org/eclipse/mtj/toolkit/uei/jadEditor/MotoJADDesciptorsProvider.java >=================================================================== >--- src/org/eclipse/mtj/toolkit/uei/jadEditor/MotoJADDesciptorsProvider.java (revision 345) >+++ src/org/eclipse/mtj/toolkit/uei/jadEditor/MotoJADDesciptorsProvider.java (working copy) >@@ -11,7 +11,6 @@ > */ > package org.eclipse.mtj.toolkit.uei.jadEditor; > >-import org.eclipse.mtj.core.model.device.IDevice; > import org.eclipse.mtj.core.model.jad.DescriptorPropertyDescription; > import org.eclipse.mtj.ui.jadEditor.IJADDescriptorsProvider; > import org.eclipse.mtj.ui.jadEditor.ListDescriptorPropertyDescription; >@@ -59,8 +58,7 @@ > > }; > >- public DescriptorPropertyDescription[] getDescriptorPropertyDescriptions( >- IDevice device) { >+ public DescriptorPropertyDescription[] getDescriptorPropertyDescriptions() { > return MOTO_JAD_DESCRIPTORS; > > } >Index: src/org/eclipse/mtj/toolkit/uei/jadEditor/MotoSpecTester.java >=================================================================== >--- src/org/eclipse/mtj/toolkit/uei/jadEditor/MotoSpecTester.java (revision 345) >+++ src/org/eclipse/mtj/toolkit/uei/jadEditor/MotoSpecTester.java (working copy) >@@ -1,36 +0,0 @@ >-/** >- * Copyright (c) 2003,2008 Sybase 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: >- * Gang Ma (Sybase) - Initial implementation >- * >- */ >-package org.eclipse.mtj.toolkit.uei.jadEditor; >- >-import java.util.regex.Matcher; >-import java.util.regex.Pattern; >- >-import org.eclipse.mtj.core.model.device.IDevice; >-import org.eclipse.mtj.ui.jadEditor.IVendorSpecTester; >-/** >- * simple implementation of IVendorSpecTester, used to test whether the device belongs >- * to motorola. >- * @author gma >- * >- */ >-public class MotoSpecTester implements IVendorSpecTester { >- >- private static final String MOTO_DEVICE_MATCHEXPRESSION = "moto*"; >- >- public boolean isVendorSpec(IDevice device) { >- Pattern matchPattern = Pattern.compile(MOTO_DEVICE_MATCHEXPRESSION); >- Matcher matcher = matchPattern.matcher(device.getGroupName().toLowerCase()); >- >- return matcher.find(); >- } >- >-} >Index: src/org/eclipse/mtj/toolkit/uei/jadEditor/NokiaSpecPropertiesEditorPage.java >=================================================================== >--- src/org/eclipse/mtj/toolkit/uei/jadEditor/NokiaSpecPropertiesEditorPage.java (revision 345) >+++ src/org/eclipse/mtj/toolkit/uei/jadEditor/NokiaSpecPropertiesEditorPage.java (working copy) >@@ -18,16 +18,17 @@ > import org.eclipse.ui.PlatformUI; > > /** >- * Nokia specific JAD editor page. >+ * Nokia S60 specific JAD editor page. >+ * > * @author gma >- * >+ * > */ > public class NokiaSpecPropertiesEditorPage extends JADPropertiesEditorPage { >- >- public static final String ID = "nokiaSpecific"; >- public static final String TITLE = "Nokia specific"; >+ >+ public static final String ID = "nokiaSpecific"; >+ public static final String TITLE = "Nokia specific"; > >- private static final String NOKIA_S40_UPDATE = "Nokia-Update"; >+ private static final String NOKIA_S40_UPDATE = "Nokia-Update"; > > private static final String NOKIA_S60_CATEGORY = "Nokia-MIDlet-Category"; > private static final String NOKIA_S60_CATEGORY_LBL = "Nokia-MIDlet-Category:"; >@@ -35,7 +36,7 @@ > private static final String NOKIA_S60_ORIGIN_DISPLAY_SIZE_LBL = "Nokia-MIDlet-Original-Display-Size:"; > private static final String NOKIA_S60_TARGET_DISPLAY_SIZE = "Nokia-MIDlet-Target-Display-Size"; > private static final String NOKIA_S60_TARGET_DISPLAY_SIZE_LBL = "Nokia-MIDlet-Target-Display-Size:"; >- >+ > private static final String NOKIA_S40_UPDATE_LBL = "Nokia-Update:"; > > private static final DescriptorPropertyDescription[] NOKIA_S60_JAD_DESCRIPTORS = new DescriptorPropertyDescription[] { >@@ -48,7 +49,7 @@ > new DescriptorPropertyDescription(NOKIA_S60_ORIGIN_DISPLAY_SIZE, > NOKIA_S60_TARGET_DISPLAY_SIZE_LBL, > DescriptorPropertyDescription.DATATYPE_STRING) }; >- >+ > private static final DescriptorPropertyDescription[] NOKIA_S40_JAD_DESCRIPTORS = new DescriptorPropertyDescription[] { new DescriptorPropertyDescription( > NOKIA_S40_UPDATE, NOKIA_S40_UPDATE_LBL, > DescriptorPropertyDescription.DATATYPE_STRING) >@@ -54,42 +55,37 @@ > DescriptorPropertyDescription.DATATYPE_STRING) > > }; >- >+ >+ public NokiaSpecPropertiesEditorPage() { >+ super(ID, TITLE); >+ } > >- public NokiaSpecPropertiesEditorPage() { >- super(ID, TITLE); >- } >- /** >- * return array of DescriptorPropertyDescription >- */ >- @Override >- protected DescriptorPropertyDescription[] doGetDescriptors() { >- IDevice device = getProjectDevice(); >- String toolKitName = device.getGroupName(); >- if (toolKitName.toLowerCase().indexOf("series 40") != -1) { >- return NOKIA_S40_JAD_DESCRIPTORS; >- } else if (toolKitName.toLowerCase().indexOf("series 60") != -1) { >- return NOKIA_S60_JAD_DESCRIPTORS; >- } >+ /** >+ * return array of DescriptorPropertyDescription >+ */ >+ @Override >+ protected DescriptorPropertyDescription[] doGetDescriptors() { >+ >+ return NOKIA_S60_JAD_DESCRIPTORS; > >- return new DescriptorPropertyDescription[0];} >- >- /** >- * @see org.eclipse.mtj.ui.jadEditor.AbstractJADEditorPage#getSectionTitle() >- */ >- protected String getSectionTitle() { >- return "Nokia Specific Properties"; >- } >+ } > >- /** >- * @see org.eclipse.mtj.ui.jadEditor.AbstractJADEditorPage#getSectionDescription() >- */ >- protected String getSectionDescription() { >- return "Nokia specific JAD properties can be specified on this page"; >- } >+ /** >+ * @see org.eclipse.mtj.ui.jadEditor.AbstractJADEditorPage#getSectionTitle() >+ */ >+ protected String getSectionTitle() { >+ return "Nokia Specific Properties"; >+ } > >- protected void addContextHelp(Composite c) { >- PlatformUI.getWorkbench().getHelpSystem().setHelp(c, >- "org.eclipse.mtj.ui.help_NokiaJADPropertiesEditorPage"); >- } >+ /** >+ * @see org.eclipse.mtj.ui.jadEditor.AbstractJADEditorPage#getSectionDescription() >+ */ >+ protected String getSectionDescription() { >+ return "Nokia specific JAD properties can be specified on this page"; >+ } >+ >+ protected void addContextHelp(Composite c) { >+ PlatformUI.getWorkbench().getHelpSystem().setHelp(c, >+ "org.eclipse.mtj.ui.help_NokiaJADPropertiesEditorPage"); >+ } > } >Index: src/org/eclipse/mtj/toolkit/uei/jadEditor/NokiaSpecTester.java >=================================================================== >--- src/org/eclipse/mtj/toolkit/uei/jadEditor/NokiaSpecTester.java (revision 345) >+++ src/org/eclipse/mtj/toolkit/uei/jadEditor/NokiaSpecTester.java (working copy) >@@ -1,40 +0,0 @@ >-/** >- * Copyright (c) 2003,2008 Sybase 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: >- * Gang Ma (Sybase) - Initial implementation >- * >- */ >-package org.eclipse.mtj.toolkit.uei.jadEditor; >- >-import java.util.regex.Matcher; >-import java.util.regex.Pattern; >- >-import org.eclipse.mtj.core.model.device.IDevice; >-import org.eclipse.mtj.ui.jadEditor.IVendorSpecTester; >-/** >- * simple implementation of IVendorSpecTester, used to test whether the device belongs >- * to Nokia. >- * @author gma >- * >- */ >-public class NokiaSpecTester implements IVendorSpecTester { >- >- private static final String Nokia_S40_MATCHEXPRESSION = "series 40*"; >- private static final String Nokia_S60_MATCHEXPRESSION = "series 60*"; >- >- public boolean isVendorSpec(IDevice device) { >- String toolkitName = device.getGroupName(); >- Pattern s40MatchPattern = Pattern.compile(Nokia_S40_MATCHEXPRESSION); >- Pattern s60MatchPattern = Pattern.compile(Nokia_S60_MATCHEXPRESSION); >- Matcher matcher1 = s40MatchPattern.matcher(toolkitName.toLowerCase()); >- Matcher matcher2 = s60MatchPattern.matcher(toolkitName.toLowerCase()); >- >- return matcher1.find()||matcher2.find(); >- } >- >-} >Index: plugin.xml >=================================================================== >--- plugin.xml (revision 345) >+++ plugin.xml (working copy) >@@ -4,8 +4,6 @@ > <extension > point="org.eclipse.mtj.ui.jadEditorPages"> > <jadEditorPage >- vendorSpec="true" >- vendorSpecTester="org.eclipse.mtj.toolkit.uei.jadEditor.MotoSpecTester" > class="org.eclipse.mtj.toolkit.uei.jadEditor.MotoSpecPropertiesEditorPage" > /> > </extension> >@@ -21,9 +19,8 @@ > <extension > point="org.eclipse.mtj.ui.jadEditorPages"> > <jadEditorPage >- vendorSpec="true" >- vendorSpecTester="org.eclipse.mtj.toolkit.uei.jadEditor.NokiaSpecTester" > class="org.eclipse.mtj.toolkit.uei.jadEditor.NokiaSpecPropertiesEditorPage" >+ priority="70" > /> > </extension> >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
wds057
:
iplog+
Actions:
View
|
Diff
Attachments on
bug 243215
: 109625