? fix.diff ? midp/src/org/netbeans/modules/vmd/midp/java/MidpValidator.java ? midp/src/org/netbeans/modules/vmd/midp/java/MidpValidatorWarmUp.java Index: midp/src/org/netbeans/modules/vmd/midp/java/JavaClassNameResolver.java =================================================================== RCS file: midp/src/org/netbeans/modules/vmd/midp/java/JavaClassNameResolver.java diff -N midp/src/org/netbeans/modules/vmd/midp/java/JavaClassNameResolver.java 1,221d0 < /* < * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. < * < * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved. < * < * The contents of this file are subject to the terms of either the GNU < * General Public License Version 2 only ("GPL") or the Common < * Development and Distribution License("CDDL") (collectively, the < * "License"). You may not use this file except in compliance with the < * License. You can obtain a copy of the License at < * http://www.netbeans.org/cddl-gplv2.html < * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the < * specific language governing permissions and limitations under the < * License. When distributing the software, include this License Header < * Notice in each file and include the License file at < * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this < * particular file as subject to the "Classpath" exception as provided < * by Sun in the GPL Version 2 section of the License file that < * accompanied this code. If applicable, add the following below the < * License Header, with the fields enclosed by brackets [] replaced by < * your own identifying information: < * "Portions Copyrighted [year] [name of copyright owner]" < * < * If you wish your version of this file to be governed by only the CDDL < * or only the GPL Version 2, indicate your decision by adding < * "[Contributor] elects to include this software in this distribution < * under the [CDDL or GPL Version 2] license." If you do not indicate a < * single choice of license, a recipient has the option to distribute < * your version of this file under either the CDDL, the GPL Version 2 or < * to extend the choice of license to its licensees as provided above. < * However, if you add GPL Version 2 code and therefore, elected the GPL < * Version 2 license, then the option applies only if the new code is < * made subject to such option by the copyright holder. < * < * Contributor(s): < * < * Portions Copyrighted 2007 Sun Microsystems, Inc. < */ < package org.netbeans.modules.vmd.midp.java; < < import java.beans.PropertyChangeEvent; < import java.beans.PropertyChangeListener; < import java.io.IOException; < import java.lang.ref.WeakReference; < import java.util.ArrayList; < import java.util.List; < import java.util.WeakHashMap; < import java.util.concurrent.ConcurrentHashMap; < import java.util.concurrent.ConcurrentLinkedQueue; < import java.util.concurrent.atomic.AtomicBoolean; < import org.netbeans.api.java.classpath.ClassPath; < import org.netbeans.api.java.project.JavaProjectConstants; < import org.netbeans.api.java.source.ClasspathInfo; < import org.netbeans.api.java.source.CompilationController; < import org.netbeans.api.java.source.JavaSource; < import org.netbeans.api.java.source.Task; < import org.netbeans.api.project.Project; < import org.netbeans.api.project.SourceGroup; < import org.netbeans.modules.vmd.api.io.ProjectUtils; < import org.netbeans.modules.vmd.api.model.Debug; < import org.netbeans.modules.vmd.api.model.DesignDocument; < import org.openide.util.RequestProcessor; < import org.openide.util.WeakListeners; < < /** < * This class schedule checksing whether given fully qualified name of class is in current < * project's classpath, notifies all registered ResolveListeners about validation finished < * and contains cache of validation results. Also it listens on classpath and notifies all < * registered ResolveListeners about validation cache expiration (if classpath changed). < * < * Singleton - one instance per project. < * @see ResolveListener < * < * @author Anton Chechel < */ < public final class JavaClassNameResolver implements Runnable, PropertyChangeListener { < < private static WeakHashMap> instanceMap; < private static RequestProcessor validationRP; < < private final ConcurrentLinkedQueue validationQueue; < private final ConcurrentHashMap validationCache; < private final AtomicBoolean isValidationRunning; < < private WeakReference document; < private final List resolveListeners; < < private JavaClassNameResolver(DesignDocument document) { < validationQueue = new ConcurrentLinkedQueue(); < validationCache = new ConcurrentHashMap(); < isValidationRunning = new AtomicBoolean(); < resolveListeners = new ArrayList(); < this.document = new WeakReference(document); < < registerClassPathListener(); < } < < /** < * @return instance of JavaClassNameResolver for given DesignDocument, creates it < * if doesn't exist < */ < public synchronized static JavaClassNameResolver getInstance(DesignDocument document) { < if (instanceMap == null) { < instanceMap = new WeakHashMap>(1); < validationRP = new RequestProcessor("VMD MIDP ClassPath validation"); // NOI18N < } < < String projectID = document.getDocumentInterface().getProjectID(); < WeakReference reference = instanceMap.get(projectID); < JavaClassNameResolver instance = reference != null ? reference.get() : null; < if (instance == null) { < instance = new JavaClassNameResolver(document); < instanceMap.put(projectID, new WeakReference(instance)); < } < < return instance; < } < < /** < * Schedules checking whether given fqName is in classpath of current project. < * Invoking class should register ResolveListener and will be notified by listener.resolveFinished() < * when checking is finished. < * < * @param fqnName fully qualified name of class to be checked in classpath < * @return boolean value: true - valid, false - invalid, null - not resolved yet < */ < public Boolean isValid(String fqnName) { < if (validationCache.containsKey(fqnName)) { < return validationCache.get(fqnName); < } else { < scheduleValidation(fqnName); < return null; < } < } < < private void scheduleValidation(String fqnName) { < validationQueue.add(fqnName); < if (!isValidationRunning.getAndSet(true)) { < validationRP.post(this); < } < } < < public void run() { < while (true) { < if (validationQueue.isEmpty()) { < isValidationRunning.set(false); < break; < } < String fqnName = validationQueue.remove(); < boolean isValid = MidpJavaSupport.checkValidity(document.get(), fqnName); < validationCache.put(fqnName, isValid); < } < < fireResolveFinished(); < } < < private void registerClassPathListener() { < final ClasspathInfo info = getClasspathInfo(ProjectUtils.getProject(document.get())); < if (info == null) { < Debug.warning("Can't get ClasspathInfo for project"); // NOI18N < return; < } < < try { < Task ct = new Task() { < < public void run(CompilationController cc) throws Exception { < ClassPath cp = info.getClassPath(ClasspathInfo.PathKind.BOOT); < PropertyChangeListener wcl = WeakListeners.propertyChange(JavaClassNameResolver.this, cp); < cp.addPropertyChangeListener(wcl); < } < }; < < JavaSource.create(info).runUserActionTask(ct, true); < } catch (IOException ex) { < Debug.warning(ex); < } < } < < private ClasspathInfo getClasspathInfo(Project project) { < if (project == null) { < return null; < } < < SourceGroup group = getSourceGroup(project); < return group != null ? ClasspathInfo.create(group.getRootFolder()) : null; < } < < private SourceGroup getSourceGroup(Project project) { < SourceGroup[] sourceGroups = org.netbeans.api.project.ProjectUtils.getSources(project).getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA); < return sourceGroups != null && sourceGroups.length > 0 ? sourceGroups[0] : null; < } < < public void addResolveListenerIfNotRegistered(ResolveListener listener) { < if (!resolveListeners.contains(listener)) { < resolveListeners.add(listener); < } < } < < public void removeResolveListener(ResolveListener listener) { < resolveListeners.remove(listener); < } < < private void fireResolveFinished() { < for (ResolveListener listener : resolveListeners) { < listener.resolveFinished(); < } < } < < private void fireResolveExpired() { < for (ResolveListener listener : resolveListeners) { < listener.resolveExpired(); < } < } < < // for classpath listener < public void propertyChange(PropertyChangeEvent evt) { < validationCache.clear(); < fireResolveExpired(); < } < } Index: midp/src/org/netbeans/modules/vmd/midp/java/MidpJavaSupport.java =================================================================== RCS file: /cvs/mobility/designer2/midp/src/org/netbeans/modules/vmd/midp/java/MidpJavaSupport.java,v retrieving revision 1.1 diff -r1.1 MidpJavaSupport.java 41d40 < 43a43,58 > import java.beans.PropertyChangeEvent; > import java.beans.PropertyChangeListener; > import java.io.IOException; > import java.lang.ref.WeakReference; > import java.util.ArrayList; > import javax.lang.model.element.TypeElement; > import javax.lang.model.util.Elements; > import java.util.Collection; > import java.util.Collections; > import java.util.HashMap; > import java.util.List; > import java.util.concurrent.ConcurrentHashMap; > import java.util.concurrent.ConcurrentLinkedQueue; > import java.util.concurrent.atomic.AtomicBoolean; > import org.netbeans.api.java.classpath.ClassPath; > import org.netbeans.api.java.project.JavaProjectConstants; 48a64 > import org.netbeans.api.project.Project; 51a68 > import org.netbeans.modules.vmd.api.model.ComponentProducer; 52a70 > import org.netbeans.modules.vmd.api.model.DescriptorRegistry; 53a72 > import org.netbeans.modules.vmd.api.model.TypeID; 55,60c74,75 < < import javax.lang.model.element.TypeElement; < import javax.lang.model.util.Elements; < import java.util.Collection; < import java.util.Collections; < import java.util.List; --- > import org.openide.util.RequestProcessor; > import org.openide.util.WeakListeners; 67c82,85 < final class MidpJavaSupport { --- > public final class MidpJavaSupport implements Runnable, PropertyChangeListener { > > private static HashMap instanceMap; > private static RequestProcessor validationRP; 69c87,181 < private MidpJavaSupport() { --- > private final ConcurrentLinkedQueue validationQueue; > private final ConcurrentHashMap validationCache; > private final AtomicBoolean isValidationRunning; > private WeakReference document; > > private MidpJavaSupport(DesignDocument document) { > this.document = new WeakReference(document); > > validationQueue = new ConcurrentLinkedQueue(); > validationCache = new ConcurrentHashMap(); > isValidationRunning = new AtomicBoolean(); > > registerClassPathListener(); > } > > public Boolean checkValidityCached(TypeID typeID) { > return checkValidityCached(MidpTypes.getFQNClassName(typeID)); > } > > public Boolean checkValidityCached(String fqnName) { > if (validationCache.containsKey(fqnName)) { > return validationCache.get(fqnName); > } else { > scheduleValidation(fqnName); > return null; > } > } > > private void scheduleValidation(String fqnName) { > validationQueue.add(fqnName); > if (!isValidationRunning.getAndSet(true)) { > validationRP.post(this); > } > } > > public void run() { > if (document.get() == null) { > return; > } > > while (true) { > if (validationQueue.isEmpty()) { > isValidationRunning.set(false); > break; > } > String fqnName = validationQueue.remove(); > boolean isValid = checkValidity(document.get(), fqnName); > validationCache.put(fqnName, isValid); > } > } > > private void registerClassPathListener() { > if (document.get() == null) { > return; > } > > final ClasspathInfo info = getClasspathInfo(ProjectUtils.getProject(document.get())); > if (info == null) { > Debug.warning("Can't get ClasspathInfo for project"); // NOI18N > return; > } > > try { > Task ct = new Task() { > > public void run(CompilationController cc) throws Exception { > ClassPath cp = info.getClassPath(ClasspathInfo.PathKind.BOOT); > PropertyChangeListener wcl = WeakListeners.propertyChange(MidpJavaSupport.this, cp); > cp.addPropertyChangeListener(wcl); > } > }; > > JavaSource.create(info).runUserActionTask(ct, true); > } catch (IOException ex) { > Debug.warning(ex); > } > } > > private ClasspathInfo getClasspathInfo(Project project) { > if (project == null) { > return null; > } > > SourceGroup group = getSourceGroup(project); > return group != null ? ClasspathInfo.create(group.getRootFolder()) : null; > } > > private SourceGroup getSourceGroup(Project project) { > SourceGroup[] sourceGroups = org.netbeans.api.project.ProjectUtils.getSources(project).getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA); > return sourceGroups != null && sourceGroups.length > 0 ? sourceGroups[0] : null; > } > > // for classpath listener > public void propertyChange(PropertyChangeEvent evt) { > updateCacheInternally(); 71a184,231 > void updateCacheInternally() { > if (document.get() == null) { > return; > } > > validationCache.clear(); > > final String projectID = document.get().getDocumentInterface().getProjectID(); > final String projectType = document.get().getDocumentInterface().getProjectType(); > final List producers = new ArrayList(); > > final DescriptorRegistry registry = DescriptorRegistry.getDescriptorRegistry(projectType, projectID); > registry.readAccess(new Runnable() { > > public void run() { > producers.addAll(registry.getComponentProducers()); > } > }); > > final ClasspathInfo info = getClasspathInfo(ProjectUtils.getProject(document.get())); > if (info != null) { > try { > JavaSource.create(info).runWhenScanFinished(new Task() { > > public void run(CompilationController cc) throws Exception { > for (ComponentProducer componentProducer : producers) { > componentProducer.checkValidity(document.get(), true); > } > } > }, true); > } catch (IOException ex) { > Debug.warning(ex); > } > } > > } > > /** > * Checks whether given typeID is in classpath of current project > * > * @param document container of gived typeID > * @param typeID to be checked > * @return isValid > */ > public static boolean checkValidity(DesignDocument document, TypeID typeID) { > return checkValidity(document, MidpTypes.getFQNClassName(typeID)); > } > 79c239 < static boolean checkValidity(DesignDocument document, String fqName) { --- > public static boolean checkValidity(DesignDocument document, String fqName) { 84c244 < --- > 91c251 < --- > 103c263 < --- > 106a267,286 > /** > * @return instance of JavaClassNameResolver for given DesignDocument, creates it > * if doesn't exist > */ > public synchronized static MidpJavaSupport getCache(DesignDocument document) { > if (instanceMap == null) { > instanceMap = new HashMap(1); > validationRP = new RequestProcessor("VMD MIDP ClassPath validation"); // NOI18N > } > > String projectID = document.getDocumentInterface().getProjectID(); > MidpJavaSupport instance = instanceMap.get(projectID); > if (instance == null) { > instance = new MidpJavaSupport(document); > instanceMap.put(projectID, instance); > } > > return instance; > } > 107a288 > 110c291 < --- > 116c297 < --- > 120c301 < --- > Index: midp/src/org/netbeans/modules/vmd/midp/java/ResolveListener.java =================================================================== RCS file: midp/src/org/netbeans/modules/vmd/midp/java/ResolveListener.java diff -N midp/src/org/netbeans/modules/vmd/midp/java/ResolveListener.java 1,62d0 < /* < * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. < * < * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved. < * < * The contents of this file are subject to the terms of either the GNU < * General Public License Version 2 only ("GPL") or the Common < * Development and Distribution License("CDDL") (collectively, the < * "License"). You may not use this file except in compliance with the < * License. You can obtain a copy of the License at < * http://www.netbeans.org/cddl-gplv2.html < * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the < * specific language governing permissions and limitations under the < * License. When distributing the software, include this License Header < * Notice in each file and include the License file at < * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this < * particular file as subject to the "Classpath" exception as provided < * by Sun in the GPL Version 2 section of the License file that < * accompanied this code. If applicable, add the following below the < * License Header, with the fields enclosed by brackets [] replaced by < * your own identifying information: < * "Portions Copyrighted [year] [name of copyright owner]" < * < * If you wish your version of this file to be governed by only the CDDL < * or only the GPL Version 2, indicate your decision by adding < * "[Contributor] elects to include this software in this distribution < * under the [CDDL or GPL Version 2] license." If you do not indicate a < * single choice of license, a recipient has the option to distribute < * your version of this file under either the CDDL, the GPL Version 2 or < * to extend the choice of license to its licensees as provided above. < * However, if you add GPL Version 2 code and therefore, elected the GPL < * Version 2 license, then the option applies only if the new code is < * made subject to such option by the copyright holder. < * < * Contributor(s): < * < * Portions Copyrighted 2007 Sun Microsystems, Inc. < */ < < package org.netbeans.modules.vmd.midp.java; < < /** < * Every class what invokes JavaClassNameResolver.isValid() should implement this < * interface and register itself in JavaClassNameResolver to be notified when < * validation process of given fully qualified name is finished or cache of < * validation results is expired (in case of project class path changes for example). < * < * @author Anton Chechel < */ < public interface ResolveListener { < < /** < * Validation process being finished < */ < void resolveFinished(); < < /** < * Cache of validation result being expired < */ < void resolveExpired(); < < } Index: midp/src/org/netbeans/modules/vmd/midp/producers/ChoiceElementProducer.java =================================================================== RCS file: /cvs/mobility/designer2/midp/src/org/netbeans/modules/vmd/midp/producers/ChoiceElementProducer.java,v retrieving revision 1.6 diff -r1.6 ChoiceElementProducer.java 46c46 < import org.netbeans.modules.vmd.api.palette.PaletteSupport; --- > import org.netbeans.modules.vmd.midp.java.MidpJavaSupport; 48,49d47 < import org.netbeans.modules.vmd.midp.java.JavaClassNameResolver; < import org.netbeans.modules.vmd.midp.java.ResolveListener; 57c55 < public class ChoiceElementProducer extends ComponentProducer implements ResolveListener { --- > public class ChoiceElementProducer extends ComponentProducer { 65,77c63,67 < public boolean checkValidity(DesignDocument document) { < JavaClassNameResolver resolver = JavaClassNameResolver.getInstance(document); < resolver.addResolveListenerIfNotRegistered(this); < Boolean isValid = resolver.isValid("javax.microedition.lcdui.ChoiceGroup"); // NOI18N < return isValid != null ? isValid : true; < } < < public void resolveFinished() { < PaletteSupport.schedulePaletteRefresh(); < } < < public void resolveExpired() { < PaletteSupport.schedulePaletteRefresh(); --- > public Boolean checkValidity(DesignDocument document, boolean useCachedValue) { > if (useCachedValue) { > return MidpJavaSupport.getCache(document).checkValidityCached("javax.microedition.lcdui.ChoiceGroup"); // NOI18N > } > return MidpJavaSupport.checkValidity(document, "javax.microedition.lcdui.ChoiceGroup"); // NOI18N Index: midp/src/org/netbeans/modules/vmd/midp/producers/CommandProducer.java =================================================================== RCS file: /cvs/mobility/designer2/midp/src/org/netbeans/modules/vmd/midp/producers/CommandProducer.java,v retrieving revision 1.6 diff -r1.6 CommandProducer.java 47d46 < import org.netbeans.modules.vmd.api.palette.PaletteSupport; 49c48 < import org.netbeans.modules.vmd.midp.java.JavaClassNameResolver; --- > import org.netbeans.modules.vmd.midp.java.MidpJavaSupport; 53d51 < import org.netbeans.modules.vmd.midp.java.ResolveListener; 60c58 < public abstract class CommandProducer extends ComponentProducer implements ResolveListener { --- > public abstract class CommandProducer extends ComponentProducer { 90,102c88,92 < public boolean checkValidity(DesignDocument document) { < JavaClassNameResolver resolver = JavaClassNameResolver.getInstance(document); < resolver.addResolveListenerIfNotRegistered(this); < Boolean isValid = resolver.isValid(MidpTypes.getFQNClassName(CommandCD.TYPEID)); < return isValid != null ? isValid : true; < } < < public void resolveFinished() { < PaletteSupport.schedulePaletteRefresh(); < } < < public void resolveExpired() { < PaletteSupport.schedulePaletteRefresh(); --- > public Boolean checkValidity(DesignDocument document, boolean useCachedValue) { > if (useCachedValue) { > return MidpJavaSupport.getCache(document).checkValidityCached(CommandCD.TYPEID); > } > return MidpJavaSupport.checkValidity(document, CommandCD.TYPEID); Index: midp/src/org/netbeans/modules/vmd/midp/producers/EntryPointProducer.java =================================================================== RCS file: /cvs/mobility/designer2/midp/src/org/netbeans/modules/vmd/midp/producers/EntryPointProducer.java,v retrieving revision 1.6 diff -r1.6 EntryPointProducer.java 68c68 < public boolean checkValidity(DesignDocument document) { --- > public Boolean checkValidity(DesignDocument document, boolean useCachedValue) { Index: midp/src/org/netbeans/modules/vmd/midp/producers/IfPointProducer.java =================================================================== RCS file: /cvs/mobility/designer2/midp/src/org/netbeans/modules/vmd/midp/producers/IfPointProducer.java,v retrieving revision 1.3 diff -r1.3 IfPointProducer.java 74c74 < public boolean checkValidity(DesignDocument document) { --- > public Boolean checkValidity(DesignDocument document, boolean useCachedValue) { Index: midp/src/org/netbeans/modules/vmd/midp/producers/ListElementEventSourceProducer.java =================================================================== RCS file: /cvs/mobility/designer2/midp/src/org/netbeans/modules/vmd/midp/producers/ListElementEventSourceProducer.java,v retrieving revision 1.7 diff -r1.7 ListElementEventSourceProducer.java 46c46 < import org.netbeans.modules.vmd.api.palette.PaletteSupport; --- > import org.netbeans.modules.vmd.midp.java.MidpJavaSupport; 49,50d48 < import org.netbeans.modules.vmd.midp.java.JavaClassNameResolver; < import org.netbeans.modules.vmd.midp.java.ResolveListener; 57c55 < public class ListElementEventSourceProducer extends ComponentProducer implements ResolveListener { --- > public class ListElementEventSourceProducer extends ComponentProducer { 65,77c63,67 < public boolean checkValidity(DesignDocument document) { < JavaClassNameResolver resolver = JavaClassNameResolver.getInstance(document); < resolver.addResolveListenerIfNotRegistered(this); < Boolean isValid = resolver.isValid("javax.microedition.lcdui.List"); // NOI18N < return isValid != null ? isValid : true; < } < < public void resolveFinished() { < PaletteSupport.schedulePaletteRefresh(); < } < < public void resolveExpired() { < PaletteSupport.schedulePaletteRefresh(); --- > public Boolean checkValidity(DesignDocument document, boolean useCachedValue) { > if (useCachedValue) { > return MidpJavaSupport.getCache(document).checkValidityCached("javax.microedition.lcdui.List"); // NOI18N > } > return MidpJavaSupport.checkValidity(document, "javax.microedition.lcdui.List"); // NOI18N Index: midp/src/org/netbeans/modules/vmd/midp/producers/MidpComponentProducer.java =================================================================== RCS file: /cvs/mobility/designer2/midp/src/org/netbeans/modules/vmd/midp/producers/MidpComponentProducer.java,v retrieving revision 1.8 diff -r1.8 MidpComponentProducer.java 45,46c45 < import org.netbeans.modules.vmd.api.palette.PaletteSupport; < import org.netbeans.modules.vmd.midp.components.MidpTypes; --- > import org.netbeans.modules.vmd.midp.java.MidpJavaSupport; 54,55d52 < import org.netbeans.modules.vmd.midp.java.JavaClassNameResolver; < import org.netbeans.modules.vmd.midp.java.ResolveListener; 62c59 < public abstract class MidpComponentProducer extends ComponentProducer implements ResolveListener { --- > public abstract class MidpComponentProducer extends ComponentProducer { 68,80c65,69 < public boolean checkValidity(DesignDocument document) { < JavaClassNameResolver resolver = JavaClassNameResolver.getInstance(document); < resolver.addResolveListenerIfNotRegistered(this); < Boolean isValid = resolver.isValid(MidpTypes.getFQNClassName(getMainComponentTypeID())); < return isValid != null ? isValid : true; < } < < public void resolveFinished() { < PaletteSupport.schedulePaletteRefresh(); < } < < public void resolveExpired() { < PaletteSupport.schedulePaletteRefresh(); --- > public Boolean checkValidity(DesignDocument document, boolean useCachedValue) { > if (useCachedValue) { > return MidpJavaSupport.getCache(document).checkValidityCached(getMainComponentTypeID()); > } > return MidpJavaSupport.checkValidity(document, getMainComponentTypeID()); Index: midp/src/org/netbeans/modules/vmd/midp/resources/layer.xml =================================================================== RCS file: /cvs/mobility/designer2/midp/src/org/netbeans/modules/vmd/midp/resources/layer.xml,v retrieving revision 1.26 diff -r1.26 layer.xml 45a46,49 > > > > Index: midp/src/org/netbeans/modules/vmd/midp/serialization/MidpProducerDeserializer.java =================================================================== RCS file: /cvs/mobility/designer2/midp/src/org/netbeans/modules/vmd/midp/serialization/MidpProducerDeserializer.java,v retrieving revision 1.4 diff -r1.4 MidpProducerDeserializer.java 40c40,41 < */package org.netbeans.modules.vmd.midp.serialization; --- > */ > package org.netbeans.modules.vmd.midp.serialization; 46,47c47 < import org.netbeans.modules.vmd.midp.components.MidpTypes; < import org.netbeans.modules.vmd.midp.java.JavaClassNameResolver; --- > import org.netbeans.modules.vmd.midp.java.MidpJavaSupport; 54,55c54,55 < public MidpProducerDeserializer() { < super(MidpDocumentSupport.PROJECT_TYPE_MIDP); --- > public MidpProducerDeserializer () { > super (MidpDocumentSupport.PROJECT_TYPE_MIDP); 58,61c58,59 < public boolean checkValidity(DesignDocument document, ComponentProducer producer) { < JavaClassNameResolver resolver = JavaClassNameResolver.getInstance(document); < Boolean isValid = resolver.isValid(MidpTypes.getFQNClassName(producer.getMainComponentTypeID())); < return isValid != null ? isValid : true; --- > public boolean checkValidity (DesignDocument document, ComponentProducer producer) { > return MidpJavaSupport.checkValidity(document, producer.getMainComponentTypeID ()); 62a61 > Index: midpnb/src/org/netbeans/modules/vmd/midpnb/producers/CustomComponentProducer.java =================================================================== RCS file: /cvs/mobility/designer2/midpnb/src/org/netbeans/modules/vmd/midpnb/producers/CustomComponentProducer.java,v retrieving revision 1.22 diff -r1.22 CustomComponentProducer.java 47,49c47 < import org.netbeans.modules.vmd.api.palette.PaletteSupport; < import org.netbeans.modules.vmd.midp.java.JavaClassNameResolver; < import org.netbeans.modules.vmd.midp.java.ResolveListener; --- > import org.netbeans.modules.vmd.midp.java.MidpJavaSupport; 67c65 < public abstract class CustomComponentProducer extends ComponentProducer implements ResolveListener { --- > public abstract class CustomComponentProducer extends ComponentProducer { 73,82c71,82 < public boolean checkValidity(DesignDocument document) { < return true; < } < < public void resolveFinished() { < PaletteSupport.schedulePaletteRefresh(); < } < < public void resolveExpired() { < PaletteSupport.schedulePaletteRefresh(); --- > public Boolean checkValidity(DesignDocument document, boolean useCachedValue) { > Boolean isValid1; > Boolean isValid2; > if (useCachedValue) { > isValid1 = MidpJavaSupport.getCache(document).checkValidityCached("javax.microedition.m2g.SVGImage"); // NOI18N > isValid2 = MidpJavaSupport.getCache(document).checkValidityCached("javax.microedition.lcdui.Canvas"); // NOI18N > } else { > isValid1 = MidpJavaSupport.checkValidity(document, "javax.microedition.m2g.SVGImage"); // NOI18N > isValid2 = MidpJavaSupport.checkValidity(document, "javax.microedition.lcdui.Canvas"); // NOI18N > } > > return isValid1 != null && isValid2 != null ? isValid1 && isValid2 : null; 89,100c89 < NbBundle.getMessage(CustomComponentProducer.class, "DISP_SVG_Player"), // NOI18N < NbBundle.getMessage(CustomComponentProducer.class, "TTIP_SVG_Player"), // NOI18N < SVGPlayerCD.ICON_PATH, SVGPlayerCD.ICON_LARGE_PATH)); < } < < @Override < public boolean checkValidity(DesignDocument document) { < JavaClassNameResolver resolver = JavaClassNameResolver.getInstance(document); < resolver.addResolveListenerIfNotRegistered(this); < Boolean isValid1 = resolver.isValid("javax.microedition.m2g.SVGImage"); // NOI18N < Boolean isValid2 = resolver.isValid("javax.microedition.lcdui.Canvas"); // NOI18N < return isValid1 != null && isValid2 != null ? isValid1 && isValid2 : true; --- > NbBundle.getMessage(CustomComponentProducer.class, "DISP_SVG_Player"), NbBundle.getMessage(CustomComponentProducer.class, "TTIP_SVG_Player"), SVGPlayerCD.ICON_PATH, SVGPlayerCD.ICON_LARGE_PATH)); // NOI18N 108,119c97 < NbBundle.getMessage(CustomComponentProducer.class, "DISP_SVG_Image"), // NOI18N < NbBundle.getMessage(CustomComponentProducer.class, "TTIP_SVG_Image"), // NOI18N < SVGImageCD.ICON_PATH, SVGImageCD.ICON_LARGE_PATH)); < } < < @Override < public boolean checkValidity(DesignDocument document) { < JavaClassNameResolver resolver = JavaClassNameResolver.getInstance(document); < resolver.addResolveListenerIfNotRegistered(this); < Boolean isValid1 = resolver.isValid("javax.microedition.m2g.SVGImage"); // NOI18N < Boolean isValid2 = resolver.isValid("javax.microedition.lcdui.Canvas"); // NOI18N < return isValid1 != null && isValid2 != null ? isValid1 && isValid2 : true; --- > NbBundle.getMessage(CustomComponentProducer.class, "DISP_SVG_Image"), NbBundle.getMessage(CustomComponentProducer.class, "TTIP_SVG_Image"), SVGImageCD.ICON_PATH, SVGImageCD.ICON_LARGE_PATH)); // NOI18N 127,138c105 < NbBundle.getMessage(CustomComponentProducer.class, "DISP_SVG_Menu_Action"), // NOI18N < NbBundle.getMessage(CustomComponentProducer.class, "TTIP_SVG_Menu_Action"), // NOI18N < SVGMenuEventHandlerCD.ICON_PATH, SVGMenuEventHandlerCD.LARGE_ICON_PATH)); < } < < @Override < public boolean checkValidity(DesignDocument document) { < JavaClassNameResolver resolver = JavaClassNameResolver.getInstance(document); < resolver.addResolveListenerIfNotRegistered(this); < Boolean isValid1 = resolver.isValid("javax.microedition.m2g.SVGImage"); // NOI18N < Boolean isValid2 = resolver.isValid("javax.microedition.lcdui.Canvas"); // NOI18N < return isValid1 != null && isValid2 != null ? isValid1 && isValid2 : true; --- > NbBundle.getMessage(CustomComponentProducer.class, "DISP_SVG_Menu_Action"), NbBundle.getMessage(CustomComponentProducer.class, "TTIP_SVG_Menu_Action"), SVGMenuEventHandlerCD.ICON_PATH, SVGMenuEventHandlerCD.LARGE_ICON_PATH)); // NOI18N 146,148c113 < NbBundle.getMessage(CustomComponentProducer.class, "DISP_Table_Item"), // NOI18N < NbBundle.getMessage(CustomComponentProducer.class, "TTIP_Table_Item"), // NOI18N < TableItemCD.ICON_PATH, TableItemCD.ICON_LARGE_PATH)); --- > NbBundle.getMessage(CustomComponentProducer.class, "DISP_Table_Item"), NbBundle.getMessage(CustomComponentProducer.class, "TTIP_Table_Item"), TableItemCD.ICON_PATH, TableItemCD.ICON_LARGE_PATH)); // NOI18N 152,156c117,121 < public boolean checkValidity(DesignDocument document) { < JavaClassNameResolver resolver = JavaClassNameResolver.getInstance(document); < resolver.addResolveListenerIfNotRegistered(this); < Boolean isValid = resolver.isValid("javax.microedition.lcdui.Item"); // NOI18N < return isValid != null ? isValid : true; --- > public Boolean checkValidity(DesignDocument document, boolean useCachedValue) { > if (useCachedValue) { > return MidpJavaSupport.getCache(document).checkValidityCached("javax.microedition.lcdui.Item"); // NOI18N > } > return MidpJavaSupport.checkValidity(document, "javax.microedition.lcdui.Item"); // NOI18N 164,166c129 < NbBundle.getMessage(CustomComponentProducer.class, "DISP_Simple_Cancellable_Task"), // NOI18N < NbBundle.getMessage(CustomComponentProducer.class, "TTIP_Simple_Cancellable_Task"), // NOI18N < CancellableTaskCD.ICON_PATH, CancellableTaskCD.ICON_LARGE_PATH)); --- > NbBundle.getMessage(CustomComponentProducer.class, "DISP_Simple_Cancellable_Task"), NbBundle.getMessage(CustomComponentProducer.class, "TTIP_Simple_Cancellable_Task"), CancellableTaskCD.ICON_PATH, CancellableTaskCD.ICON_LARGE_PATH)); // NOI18N 170,174c133,137 < public boolean checkValidity(DesignDocument document) { < JavaClassNameResolver resolver = JavaClassNameResolver.getInstance(document); < resolver.addResolveListenerIfNotRegistered(this); < Boolean isValid = resolver.isValid("java.lang.Runnable"); // NOI18N < return isValid != null ? isValid : true; --- > public Boolean checkValidity(DesignDocument document, boolean useCachedValue) { > if (useCachedValue) { > return MidpJavaSupport.getCache(document).checkValidityCached("java.lang.Runnable"); // NOI18N > } > return MidpJavaSupport.checkValidity(document, "java.lang.Runnable"); // NOI18N 182,184c145 < NbBundle.getMessage(CustomComponentProducer.class, "DISP_Simple_Table_Model"), // NOI18N < NbBundle.getMessage(CustomComponentProducer.class, "TTIP_Simple_Table_Model"), // NOI18N < TableModelCD.ICON_PATH, TableModelCD.ICON_LARGE_PATH)); --- > NbBundle.getMessage(CustomComponentProducer.class, "DISP_Simple_Table_Model"), NbBundle.getMessage(CustomComponentProducer.class, "TTIP_Simple_Table_Model"), TableModelCD.ICON_PATH, TableModelCD.ICON_LARGE_PATH)); // NOI18N 188,192c149,153 < public boolean checkValidity(DesignDocument document) { < JavaClassNameResolver resolver = JavaClassNameResolver.getInstance(document); < resolver.addResolveListenerIfNotRegistered(this); < Boolean isValid = resolver.isValid("javax.microedition.lcdui.Form"); // NOI18N < return isValid != null ? isValid : true; --- > public Boolean checkValidity(DesignDocument document, boolean useCachedValue) { > if (useCachedValue) { > return MidpJavaSupport.getCache(document).checkValidityCached("javax.microedition.lcdui.Form"); // NOI18N > } > return MidpJavaSupport.checkValidity(document, "javax.microedition.lcdui.Form"); // NOI18N Index: midpnb/src/org/netbeans/modules/vmd/midpnb/producers/FileBrowserProducer.java =================================================================== RCS file: /cvs/mobility/designer2/midpnb/src/org/netbeans/modules/vmd/midpnb/producers/FileBrowserProducer.java,v retrieving revision 1.7 diff -r1.7 FileBrowserProducer.java 47a48 > import org.netbeans.modules.vmd.midp.java.MidpJavaSupport; 50d50 < import org.netbeans.modules.vmd.midp.java.JavaClassNameResolver; 65,68c65 < super(FileBrowserCD.TYPEID, new PaletteDescriptor(MidpPaletteProvider.CATEGORY_DISPLAYABLES, < NbBundle.getMessage(FileBrowserProducer.class, "DISP_File_Browser"), // NOI18N < NbBundle.getMessage(FileBrowserProducer.class, "TTIP_File_Browser"), // NOI18N < FileBrowserCD.ICON_PATH, FileBrowserCD.ICON_LARGE_PATH)); --- > super(FileBrowserCD.TYPEID, new PaletteDescriptor(MidpPaletteProvider.CATEGORY_DISPLAYABLES, NbBundle.getMessage(FileBrowserProducer.class, "DISP_File_Browser"), NbBundle.getMessage(FileBrowserProducer.class, "TTIP_File_Browser"), FileBrowserCD.ICON_PATH, FileBrowserCD.ICON_LARGE_PATH)); // NOI18N 83,87c80,84 < public boolean checkValidity(DesignDocument document) { < JavaClassNameResolver resolver = JavaClassNameResolver.getInstance(document); < resolver.addResolveListenerIfNotRegistered(this); < Boolean isValid = resolver.isValid("javax.microedition.io.file.FileSystemRegistry"); // NOI18N < return isValid != null ? isValid : true; --- > public Boolean checkValidity(DesignDocument document, boolean useCachedValue) { > if (useCachedValue) { > return MidpJavaSupport.getCache(document).checkValidityCached("javax.microedition.io.file.FileSystemRegistry"); // NOI18N > } > return MidpJavaSupport.checkValidity(document, "javax.microedition.io.file.FileSystemRegistry"); // NOI18N 89c86 < --- > Index: midpnb/src/org/netbeans/modules/vmd/midpnb/producers/LoginScreenProducer.java =================================================================== RCS file: /cvs/mobility/designer2/midpnb/src/org/netbeans/modules/vmd/midpnb/producers/LoginScreenProducer.java,v retrieving revision 1.12 diff -r1.12 LoginScreenProducer.java 40a41 > 47a49 > import org.netbeans.modules.vmd.midp.java.MidpJavaSupport; 51d52 < import org.netbeans.modules.vmd.midp.java.JavaClassNameResolver; 59c60 < /* --- > /* 65,68c66 < super(LoginScreenCD.TYPEID, new PaletteDescriptor(MidpPaletteProvider.CATEGORY_DISPLAYABLES, < NbBundle.getMessage(LoginScreenProducer.class, "DISP_Login_Screen"), // NOI18N < NbBundle.getMessage(LoginScreenProducer.class, "TTIP_Login_Screen"), // NOI18N < LoginScreenCD.ICON_PATH, LoginScreenCD.ICON_LARGE_PATH)); --- > super(LoginScreenCD.TYPEID, new PaletteDescriptor(MidpPaletteProvider.CATEGORY_DISPLAYABLES, NbBundle.getMessage(LoginScreenProducer.class, "DISP_Login_Screen"), NbBundle.getMessage(LoginScreenProducer.class, "TTIP_Login_Screen"), LoginScreenCD.ICON_PATH, LoginScreenCD.ICON_LARGE_PATH)); // NOI18N 83,84c81,82 < PropertyValue loginButtonScreen = MidpTypes.createStringValue(NbBundle.getMessage(LoginScreenProducer.class, "LBL_LoginScreen_LoginButtonScreen")); // NOI18N < loginScreen.writeProperty(LoginScreenCD.PROP_LOGIN_BUTTON_TEXT, loginButtonScreen); --- > PropertyValue loginButtonScreen = MidpTypes.createStringValue(NbBundle.getMessage(LoginScreenProducer.class, "LBL_LoginScreen_LoginButtonScreen"));//NOI18 > loginScreen.writeProperty(LoginScreenCD.PROP_LOGIN_BUTTON_TEXT,loginButtonScreen); 89,93c87,91 < public boolean checkValidity(DesignDocument document) { < JavaClassNameResolver resolver = JavaClassNameResolver.getInstance(document); < resolver.addResolveListenerIfNotRegistered(this); < Boolean isValid = resolver.isValid("javax.microedition.lcdui.Canvas"); // NOI18N < return isValid != null ? isValid : true; --- > public Boolean checkValidity(DesignDocument document, boolean useCachedValue) { > if (useCachedValue) { > return MidpJavaSupport.getCache(document).checkValidityCached("javax.microedition.lcdui.Canvas"); // NOI18N > } > return MidpJavaSupport.checkValidity(document, "javax.microedition.lcdui.Canvas"); // NOI18N 94a93 > Index: midpnb/src/org/netbeans/modules/vmd/midpnb/producers/PIMBrowserProducer.java =================================================================== RCS file: /cvs/mobility/designer2/midpnb/src/org/netbeans/modules/vmd/midpnb/producers/PIMBrowserProducer.java,v retrieving revision 1.7 diff -r1.7 PIMBrowserProducer.java 40a41 > 47a49 > import org.netbeans.modules.vmd.midp.java.MidpJavaSupport; 50d51 < import org.netbeans.modules.vmd.midp.java.JavaClassNameResolver; 63c64 < --- > 65,68c66 < super(PIMBrowserCD.TYPEID, new PaletteDescriptor(MidpPaletteProvider.CATEGORY_DISPLAYABLES, < NbBundle.getMessage(PIMBrowserProducer.class, "DISP_PIM_Browser"), // NOI18N < NbBundle.getMessage(PIMBrowserProducer.class, "TTIP_PIM_Browser"), // NOI18N < PIMBrowserCD.ICON_PATH, PIMBrowserCD.ICON_LARGE_PATH)); --- > super(PIMBrowserCD.TYPEID, new PaletteDescriptor(MidpPaletteProvider.CATEGORY_DISPLAYABLES, NbBundle.getMessage(PIMBrowserProducer.class, "DISP_PIM_Browser"), NbBundle.getMessage(PIMBrowserProducer.class, "TTIP_PIM_Browser"), PIMBrowserCD.ICON_PATH, PIMBrowserCD.ICON_LARGE_PATH)); // NOI18N 72c70 < public Result postInitialize(DesignDocument document, DesignComponent pimBrowser) { --- > public Result postInitialize (DesignDocument document, DesignComponent pimBrowser) { 78c76 < --- > 81c79 < --- > 83,87c81,85 < public boolean checkValidity(DesignDocument document) { < JavaClassNameResolver resolver = JavaClassNameResolver.getInstance(document); < resolver.addResolveListenerIfNotRegistered(this); < Boolean isValid = resolver.isValid("javax.microedition.pim.PIM"); // NOI18N < return isValid != null ? isValid : true; --- > public Boolean checkValidity(DesignDocument document, boolean useCachedValue) { > if (useCachedValue) { > return MidpJavaSupport.getCache(document).checkValidityCached("javax.microedition.pim.PIM"); // NOI18N > } > return MidpJavaSupport.checkValidity(document, "javax.microedition.pim.PIM"); // NOI18N 88a87 > Index: midpnb/src/org/netbeans/modules/vmd/midpnb/producers/SMSComposerProducer.java =================================================================== RCS file: /cvs/mobility/designer2/midpnb/src/org/netbeans/modules/vmd/midpnb/producers/SMSComposerProducer.java,v retrieving revision 1.11 diff -r1.11 SMSComposerProducer.java 40a41 > 47a49 > import org.netbeans.modules.vmd.midp.java.MidpJavaSupport; 51d52 < import org.netbeans.modules.vmd.midp.java.JavaClassNameResolver; 64c65 < --- > 66,69c67 < super(SMSComposerCD.TYPEID, new PaletteDescriptor(MidpPaletteProvider.CATEGORY_DISPLAYABLES, < NbBundle.getMessage(SMSComposerProducer.class, "DISP_SMS_Composer"), // NOI18N < NbBundle.getMessage(SMSComposerProducer.class, "TTIP_SMS_Composer"), // NOI18N < SMSComposerCD.ICON_PATH, SMSComposerCD.ICON_LARGE_PATH)); --- > super(SMSComposerCD.TYPEID, new PaletteDescriptor(MidpPaletteProvider.CATEGORY_DISPLAYABLES, NbBundle.getMessage(SMSComposerProducer.class, "DISP_SMS_Composer"), NbBundle.getMessage(SMSComposerProducer.class, "TTIP_SMS_Composer"), SMSComposerCD.ICON_PATH, SMSComposerCD.ICON_LARGE_PATH)); // NOI18N 71c69 < --- > 73c71 < public Result postInitialize(DesignDocument document, DesignComponent smsComposer) { --- > public Result postInitialize (DesignDocument document, DesignComponent smsComposer) { 85c83 < --- > 87,91c85,89 < public boolean checkValidity(DesignDocument document) { < JavaClassNameResolver resolver = JavaClassNameResolver.getInstance(document); < resolver.addResolveListenerIfNotRegistered(this); < Boolean isValid = resolver.isValid("javax.wireless.messaging.TextMessage"); // NOI18N < return isValid != null ? isValid : true; --- > public Boolean checkValidity(DesignDocument document, boolean useCachedValue) { > if (useCachedValue) { > return MidpJavaSupport.getCache(document).checkValidityCached("javax.wireless.messaging.TextMessage"); // NOI18N > } > return MidpJavaSupport.checkValidity(document, "javax.wireless.messaging.TextMessage"); // NOI18N Index: midpnb/src/org/netbeans/modules/vmd/midpnb/producers/SVGMenuElementEventSourceProducer.java =================================================================== RCS file: /cvs/mobility/designer2/midpnb/src/org/netbeans/modules/vmd/midpnb/producers/SVGMenuElementEventSourceProducer.java,v retrieving revision 1.7 diff -r1.7 SVGMenuElementEventSourceProducer.java 40a41 > 46,48c47 < import org.netbeans.modules.vmd.api.palette.PaletteSupport; < import org.netbeans.modules.vmd.midp.java.JavaClassNameResolver; < import org.netbeans.modules.vmd.midp.java.ResolveListener; --- > import org.netbeans.modules.vmd.midp.java.MidpJavaSupport; 57,58c56,57 < public class SVGMenuElementEventSourceProducer extends ComponentProducer implements ResolveListener { < --- > public class SVGMenuElementEventSourceProducer extends ComponentProducer { > 60c59 < --- > 63,65c62 < NbBundle.getMessage(SVGMenuElementEventSourceProducer.class, "DISP_SVG_Menu_Element"), // NOI18N < NbBundle.getMessage(SVGMenuElementEventSourceProducer.class, "TTIP_SVG_Menu_Element"), // NOI18N < SVGMenuElementEventSourceCD.ICON_PATH, SVGMenuElementEventSourceCD.ICON_LARGE_PATH)); --- > NbBundle.getMessage(SVGMenuElementEventSourceProducer.class, "DISP_SVG_Menu_Element"), NbBundle.getMessage(SVGMenuElementEventSourceProducer.class, "TTIP_SVG_Menu_Element"), SVGMenuElementEventSourceCD.ICON_PATH, SVGMenuElementEventSourceCD.ICON_LARGE_PATH)); // NOI18N 68,77c65,76 < public boolean checkValidity(DesignDocument document) { < JavaClassNameResolver resolver = JavaClassNameResolver.getInstance(document); < resolver.addResolveListenerIfNotRegistered(this); < Boolean isValid1 = resolver.isValid("javax.microedition.m2g.SVGImage"); // NOI18N < Boolean isValid2 = resolver.isValid("javax.microedition.lcdui.Canvas"); // NOI18N < return isValid1 != null && isValid2 != null ? isValid1 && isValid2 : true; < } < < public void resolveFinished() { < PaletteSupport.schedulePaletteRefresh(); --- > public Boolean checkValidity(DesignDocument document, boolean useCachedValue) { > Boolean isValid1; > Boolean isValid2; > if (useCachedValue) { > isValid1 = MidpJavaSupport.getCache(document).checkValidityCached("javax.microedition.m2g.SVGImage"); // NOI18N > isValid2 = MidpJavaSupport.getCache(document).checkValidityCached("javax.microedition.lcdui.Canvas"); // NOI18N > } else { > isValid1 = MidpJavaSupport.checkValidity(document, "javax.microedition.m2g.SVGImage"); // NOI18N > isValid2 = MidpJavaSupport.checkValidity(document, "javax.microedition.lcdui.Canvas"); // NOI18N > } > > return isValid1 != null && isValid2 != null ? isValid1 && isValid2 : null; 80,83d78 < public void resolveExpired() { < PaletteSupport.schedulePaletteRefresh(); < } < Index: midpnb/src/org/netbeans/modules/vmd/midpnb/producers/SVGMenuProducer.java =================================================================== RCS file: /cvs/mobility/designer2/midpnb/src/org/netbeans/modules/vmd/midpnb/producers/SVGMenuProducer.java,v retrieving revision 1.9 diff -r1.9 SVGMenuProducer.java 44a45 > import org.netbeans.modules.vmd.midp.java.MidpJavaSupport; 47d47 < import org.netbeans.modules.vmd.midp.java.JavaClassNameResolver; 61c61 < --- > 63,66c63 < super(SVGMenuCD.TYPEID, new PaletteDescriptor(MidpNbPaletteProvider.CATEGORY_SVG, < NbBundle.getMessage(SVGMenuProducer.class, "DISP_SVG_Menu"), // NOI18N < NbBundle.getMessage(SVGMenuProducer.class, "TTIP_SVG_Menu"), // NOI18N < SVGMenuCD.ICON_PATH, SVGMenuCD.ICON_LARGE_PATH)); --- > super(SVGMenuCD.TYPEID, new PaletteDescriptor(MidpNbPaletteProvider.CATEGORY_SVG, NbBundle.getMessage(SVGMenuProducer.class, "DISP_SVG_Menu"), NbBundle.getMessage(SVGMenuProducer.class, "TTIP_SVG_Menu"), SVGMenuCD.ICON_PATH, SVGMenuCD.ICON_LARGE_PATH)); // NOI18N 70c67 < public Result postInitialize(DesignDocument document, DesignComponent menu) { --- > public Result postInitialize (DesignDocument document, DesignComponent menu) { 72c69 < --- > 77c74 < --- > 80c77 < --- > 83c80 < --- > 85,90c82,93 < public boolean checkValidity(DesignDocument document) { < JavaClassNameResolver resolver = JavaClassNameResolver.getInstance(document); < resolver.addResolveListenerIfNotRegistered(this); < Boolean isValid1 = resolver.isValid("javax.microedition.m2g.SVGImage"); // NOI18N < Boolean isValid2 = resolver.isValid("javax.microedition.lcdui.Canvas"); // NOI18N < return isValid1 != null && isValid2 != null ? isValid1 && isValid2 : true; --- > public Boolean checkValidity(DesignDocument document, boolean useCachedValue) { > Boolean isValid1; > Boolean isValid2; > if (useCachedValue) { > isValid1 = MidpJavaSupport.getCache(document).checkValidityCached("javax.microedition.m2g.SVGImage"); // NOI18N > isValid2 = MidpJavaSupport.getCache(document).checkValidityCached("javax.microedition.lcdui.Canvas"); // NOI18N > } else { > isValid1 = MidpJavaSupport.checkValidity(document, "javax.microedition.m2g.SVGImage"); // NOI18N > isValid2 = MidpJavaSupport.checkValidity(document, "javax.microedition.lcdui.Canvas"); // NOI18N > } > > return isValid1 != null && isValid2 != null ? isValid1 && isValid2 : null; 92c95 < --- > Index: midpnb/src/org/netbeans/modules/vmd/midpnb/producers/SVGSplashScreenProducer.java =================================================================== RCS file: /cvs/mobility/designer2/midpnb/src/org/netbeans/modules/vmd/midpnb/producers/SVGSplashScreenProducer.java,v retrieving revision 1.8 diff -r1.8 SVGSplashScreenProducer.java 40a41 > 44a46 > import org.netbeans.modules.vmd.midp.java.MidpJavaSupport; 47d48 < import org.netbeans.modules.vmd.midp.java.JavaClassNameResolver; 60c61 < --- > 62,65c63 < super(SVGSplashScreenCD.TYPEID, new PaletteDescriptor(MidpNbPaletteProvider.CATEGORY_SVG, < NbBundle.getMessage(SVGSplashScreenProducer.class, "DISP_SVG_Splash_Screen"), // NOI18N < NbBundle.getMessage(SVGSplashScreenProducer.class, "TTIP_SVG_Splash_Screen"), // NOI18N < SVGSplashScreenCD.ICON_PATH, SVGSplashScreenCD.ICON_LARGE_PATH)); --- > super(SVGSplashScreenCD.TYPEID, new PaletteDescriptor(MidpNbPaletteProvider.CATEGORY_SVG, NbBundle.getMessage(SVGSplashScreenProducer.class, "DISP_SVG_Splash_Screen"), NbBundle.getMessage(SVGSplashScreenProducer.class, "TTIP_SVG_Splash_Screen"), SVGSplashScreenCD.ICON_PATH, SVGSplashScreenCD.ICON_LARGE_PATH)); // NOI18N 69c67 < public Result postInitialize(DesignDocument document, DesignComponent splashScreen) { --- > public Result postInitialize (DesignDocument document, DesignComponent splashScreen) { 71c69 < --- > 73c71 < --- > 76c74 < --- > 78c76 < --- > 81c79 < --- > 83,88c81,92 < public boolean checkValidity(DesignDocument document) { < JavaClassNameResolver resolver = JavaClassNameResolver.getInstance(document); < resolver.addResolveListenerIfNotRegistered(this); < Boolean isValid1 = resolver.isValid("javax.microedition.m2g.SVGImage"); // NOI18N < Boolean isValid2 = resolver.isValid("javax.microedition.lcdui.Canvas"); // NOI18N < return isValid1 != null && isValid2 != null ? isValid1 && isValid2 : true; --- > public Boolean checkValidity(DesignDocument document, boolean useCachedValue) { > Boolean isValid1; > Boolean isValid2; > if (useCachedValue) { > isValid1 = MidpJavaSupport.getCache(document).checkValidityCached("javax.microedition.m2g.SVGImage"); // NOI18N > isValid2 = MidpJavaSupport.getCache(document).checkValidityCached("javax.microedition.lcdui.Canvas"); // NOI18N > } else { > isValid1 = MidpJavaSupport.checkValidity(document, "javax.microedition.m2g.SVGImage"); // NOI18N > isValid2 = MidpJavaSupport.checkValidity(document, "javax.microedition.lcdui.Canvas"); // NOI18N > } > > return isValid1 != null && isValid2 != null ? isValid1 && isValid2 : null; 89a94 > Index: midpnb/src/org/netbeans/modules/vmd/midpnb/producers/SVGWaitScreenProducer.java =================================================================== RCS file: /cvs/mobility/designer2/midpnb/src/org/netbeans/modules/vmd/midpnb/producers/SVGWaitScreenProducer.java,v retrieving revision 1.10 diff -r1.10 SVGWaitScreenProducer.java 40a41 > 44a46 > import org.netbeans.modules.vmd.midp.java.MidpJavaSupport; 48d49 < import org.netbeans.modules.vmd.midp.java.JavaClassNameResolver; 64c65 < --- > 66,69c67 < super(SVGWaitScreenCD.TYPEID, new PaletteDescriptor(MidpNbPaletteProvider.CATEGORY_SVG, < NbBundle.getMessage(SVGWaitScreenProducer.class, "DISP_SVG_Wait_Screen"), // NOI18N < NbBundle.getMessage(SVGWaitScreenProducer.class, "TTIP_SVG_Wait_Screen"), // NOI18N < SVGWaitScreenCD.ICON_PATH, SVGWaitScreenCD.ICON_LARGE_PATH)); --- > super(SVGWaitScreenCD.TYPEID, new PaletteDescriptor(MidpNbPaletteProvider.CATEGORY_SVG, NbBundle.getMessage(SVGWaitScreenProducer.class, "DISP_SVG_Wait_Screen"), NbBundle.getMessage(SVGWaitScreenProducer.class, "TTIP_SVG_Wait_Screen"), SVGWaitScreenCD.ICON_PATH, SVGWaitScreenCD.ICON_LARGE_PATH)); // NOI18N 73,74c71,72 < public Result postInitialize(DesignDocument document, DesignComponent waitScreen) { < return produceSVGWaitScreen(document, waitScreen, true); --- > public Result postInitialize (DesignDocument document, DesignComponent waitScreen) { > return produceSVGWaitScreen (document, waitScreen, true); 77c75 < public static Result produceSVGWaitScreen(DesignDocument document, DesignComponent waitScreen, boolean createTask) { --- > public static Result produceSVGWaitScreen (DesignDocument document, DesignComponent waitScreen, boolean createTask) { 94,96c92,99 < DesignComponent task = document.createComponent(SimpleCancellableTaskCD.TYPEID); < MidpDocumentSupport.getCategoryComponent(document, ResourcesCategoryCD.TYPEID).addComponent(task); < waitScreen.writeProperty(SVGWaitScreenCD.PROP_TASK, PropertyValue.createComponentReference(task)); --- > DesignComponent task = document.createComponent (SimpleCancellableTaskCD.TYPEID); > MidpDocumentSupport.getCategoryComponent (document, ResourcesCategoryCD.TYPEID).addComponent (task); > waitScreen.writeProperty (SVGWaitScreenCD.PROP_TASK, PropertyValue.createComponentReference (task)); > > return new Result (waitScreen, successCommand, failureCommand, successEventSource, failureEventSource, task); > } else > return new Result (waitScreen, successCommand, failureCommand, successEventSource, failureEventSource); > } 98c101,107 < return new Result(waitScreen, successCommand, failureCommand, successEventSource, failureEventSource, task); --- > @Override > public Boolean checkValidity(DesignDocument document, boolean useCachedValue) { > Boolean isValid1; > Boolean isValid2; > if (useCachedValue) { > isValid1 = MidpJavaSupport.getCache(document).checkValidityCached("javax.microedition.m2g.SVGImage"); // NOI18N > isValid2 = MidpJavaSupport.getCache(document).checkValidityCached("javax.microedition.lcdui.Canvas"); // NOI18N 100c109,110 < return new Result(waitScreen, successCommand, failureCommand, successEventSource, failureEventSource); --- > isValid1 = MidpJavaSupport.checkValidity(document, "javax.microedition.m2g.SVGImage"); // NOI18N > isValid2 = MidpJavaSupport.checkValidity(document, "javax.microedition.lcdui.Canvas"); // NOI18N 101a112,113 > > return isValid1 != null && isValid2 != null ? isValid1 && isValid2 : null; 104,111d115 < @Override < public boolean checkValidity(DesignDocument document) { < JavaClassNameResolver resolver = JavaClassNameResolver.getInstance(document); < resolver.addResolveListenerIfNotRegistered(this); < Boolean isValid1 = resolver.isValid("javax.microedition.m2g.SVGImage"); // NOI18N < Boolean isValid2 = resolver.isValid("javax.microedition.lcdui.Canvas"); // NOI18N < return isValid1 != null && isValid2 != null ? isValid1 && isValid2 : true; < } Index: midpnb/src/org/netbeans/modules/vmd/midpnb/producers/SplashScreenProducer.java =================================================================== RCS file: /cvs/mobility/designer2/midpnb/src/org/netbeans/modules/vmd/midpnb/producers/SplashScreenProducer.java,v retrieving revision 1.8 diff -r1.8 SplashScreenProducer.java 44a45 > import org.netbeans.modules.vmd.midp.java.MidpJavaSupport; 47d47 < import org.netbeans.modules.vmd.midp.java.JavaClassNameResolver; 61,65c61,62 < public SplashScreenProducer() { < super(SplashScreenCD.TYPEID, new PaletteDescriptor(MidpPaletteProvider.CATEGORY_DISPLAYABLES, < NbBundle.getMessage(SplashScreenProducer.class, "DISP_Splash_Screen"), // NOI18N < NbBundle.getMessage(SplashScreenProducer.class, "TTIP_Splash_Screen"), // NOI18N < SplashScreenCD.ICON_PATH, SplashScreenCD.ICON_LARGE_PATH)); --- > public SplashScreenProducer () { > super(SplashScreenCD.TYPEID, new PaletteDescriptor (MidpPaletteProvider.CATEGORY_DISPLAYABLES, NbBundle.getMessage(SplashScreenProducer.class, "DISP_Splash_Screen"), NbBundle.getMessage(SplashScreenProducer.class, "TTIP_Splash_Screen"), SplashScreenCD.ICON_PATH, SplashScreenCD.ICON_LARGE_PATH)); // NOI18N 69,70c66,67 < public Result postInitialize(DesignDocument document, DesignComponent splashScreen) { < DesignComponent dismissCommand = MidpDocumentSupport.getSingletonCommand(document, SplashScreenDismissCommandCD.TYPEID); --- > public Result postInitialize (DesignDocument document, DesignComponent splashScreen) { > DesignComponent dismissCommand = MidpDocumentSupport.getSingletonCommand (document, SplashScreenDismissCommandCD.TYPEID); 81c78 < --- > 83,87c80,84 < public boolean checkValidity(DesignDocument document) { < JavaClassNameResolver resolver = JavaClassNameResolver.getInstance(document); < resolver.addResolveListenerIfNotRegistered(this); < Boolean isValid = resolver.isValid("javax.microedition.lcdui.Canvas"); // NOI18N < return isValid != null ? isValid : true; --- > public Boolean checkValidity(DesignDocument document, boolean useCachedValue) { > if (useCachedValue) { > return MidpJavaSupport.getCache(document).checkValidityCached("javax.microedition.lcdui.Canvas"); // NOI18N > } > return MidpJavaSupport.checkValidity(document, "javax.microedition.lcdui.Canvas"); // NOI18N 88a86 > Index: midpnb/src/org/netbeans/modules/vmd/midpnb/producers/WaitScreenProducer.java =================================================================== RCS file: /cvs/mobility/designer2/midpnb/src/org/netbeans/modules/vmd/midpnb/producers/WaitScreenProducer.java,v retrieving revision 1.13 diff -r1.13 WaitScreenProducer.java 44a45 > import org.netbeans.modules.vmd.midp.java.MidpJavaSupport; 48d48 < import org.netbeans.modules.vmd.midp.java.JavaClassNameResolver; 64c64 < --- > 66,69c66 < super(WaitScreenCD.TYPEID, new PaletteDescriptor(MidpPaletteProvider.CATEGORY_DISPLAYABLES, < NbBundle.getMessage(WaitScreenProducer.class, "DISP_Wait_Screen"), // NOI18N < NbBundle.getMessage(WaitScreenProducer.class, "TTIP_Wait_Screen"), // NOI18N < WaitScreenCD.ICON_PATH, WaitScreenCD.ICON_LARGE_PATH)); --- > super(WaitScreenCD.TYPEID, new PaletteDescriptor(MidpPaletteProvider.CATEGORY_DISPLAYABLES, NbBundle.getMessage(WaitScreenProducer.class, "DISP_Wait_Screen"), NbBundle.getMessage(WaitScreenProducer.class, "TTIP_Wait_Screen"), WaitScreenCD.ICON_PATH, WaitScreenCD.ICON_LARGE_PATH)); // NOI18N 73,74c70,71 < public Result postInitialize(DesignDocument document, DesignComponent waitScreen) { < return produceWaitScreen(document, waitScreen, true); --- > public Result postInitialize (DesignDocument document, DesignComponent waitScreen) { > return produceWaitScreen (document, waitScreen, true); 77,79c74,76 < public static Result produceWaitScreen(DesignDocument document, DesignComponent waitScreen, boolean createTask) { < DesignComponent successCommand = MidpDocumentSupport.getSingletonCommand(document, WaitScreenSuccessCommandCD.TYPEID); < DesignComponent failureCommand = MidpDocumentSupport.getSingletonCommand(document, WaitScreenFailureCommandCD.TYPEID); --- > public static Result produceWaitScreen (DesignDocument document, DesignComponent waitScreen, boolean createTask) { > DesignComponent successCommand = MidpDocumentSupport.getSingletonCommand (document, WaitScreenSuccessCommandCD.TYPEID); > DesignComponent failureCommand = MidpDocumentSupport.getSingletonCommand (document, WaitScreenFailureCommandCD.TYPEID); 94,101c91,97 < DesignComponent task = document.createComponent(SimpleCancellableTaskCD.TYPEID); < MidpDocumentSupport.getCategoryComponent(document, ResourcesCategoryCD.TYPEID).addComponent(task); < waitScreen.writeProperty(WaitScreenCD.PROP_TASK, PropertyValue.createComponentReference(task)); < < return new Result(waitScreen, successCommand, failureCommand, successEventSource, failureEventSource, task); < } else { < return new Result(waitScreen, successCommand, failureCommand, successEventSource, failureEventSource); < } --- > DesignComponent task = document.createComponent (SimpleCancellableTaskCD.TYPEID); > MidpDocumentSupport.getCategoryComponent (document, ResourcesCategoryCD.TYPEID).addComponent (task); > waitScreen.writeProperty (WaitScreenCD.PROP_TASK, PropertyValue.createComponentReference (task)); > > return new Result (waitScreen, successCommand, failureCommand, successEventSource, failureEventSource, task); > } else > return new Result (waitScreen, successCommand, failureCommand, successEventSource, failureEventSource); 105,109c101,105 < public boolean checkValidity(DesignDocument document) { < JavaClassNameResolver resolver = JavaClassNameResolver.getInstance(document); < resolver.addResolveListenerIfNotRegistered(this); < Boolean isValid = resolver.isValid("javax.microedition.lcdui.Canvas"); // NOI18N < return isValid != null ? isValid : true; --- > public Boolean checkValidity(DesignDocument document, boolean useCachedValue) { > if (useCachedValue) { > return MidpJavaSupport.getCache(document).checkValidityCached("javax.microedition.lcdui.Canvas"); // NOI18N > } > return MidpJavaSupport.checkValidity(document, "javax.microedition.lcdui.Canvas"); // NOI18N 110a107 > Index: model/src/org/netbeans/modules/vmd/api/model/ComponentProducer.java =================================================================== RCS file: /cvs/mobility/designer2/model/src/org/netbeans/modules/vmd/api/model/ComponentProducer.java,v retrieving revision 1.5 diff -r1.5 ComponentProducer.java 139c139,140 < * @return the result checking; true if the producer is valid --- > * @param useCachedValue use value from cache > * @return the result checking; true if the producer is valid, false is not valid and null if unresolved yet 141c142 < public abstract boolean checkValidity(DesignDocument document); --- > public abstract Boolean checkValidity(DesignDocument document, boolean useCachedValue); 196c197 < public boolean checkValidity(DesignDocument document) { --- > public Boolean checkValidity(DesignDocument document, boolean useCachedValue) { Index: model/src/org/netbeans/modules/vmd/api/model/presenters/actions/AddActionPresenter.java =================================================================== RCS file: /cvs/mobility/designer2/model/src/org/netbeans/modules/vmd/api/model/presenters/actions/AddActionPresenter.java,v retrieving revision 1.7 diff -r1.7 AddActionPresenter.java 91,92c91,93 < if (producer.getMainComponentTypeID ().equals(descriptor.getTypeDescriptor().getThisType()) && AcceptSupport.isAcceptable(getComponent(), producer, null)){ < if (producer.checkValidity(document)) --- > if (producer.getMainComponentTypeID ().equals(descriptor.getTypeDescriptor().getThisType()) && AcceptSupport.isAcceptable(getComponent(), producer, null)) { > Boolean isValid = producer.checkValidity(document, true); > if (isValid != null && isValid) Index: model/src/org/netbeans/modules/vmd/model/XMLComponentProducer.java =================================================================== RCS file: /cvs/mobility/designer2/model/src/org/netbeans/modules/vmd/model/XMLComponentProducer.java,v retrieving revision 1.8 diff -r1.8 XMLComponentProducer.java 124c124 < public boolean checkValidity (final DesignDocument document) { --- > public Boolean checkValidity (final DesignDocument document, boolean useCachedValue) { 139,140c139,144 < < return producers[0] == null || producers[0].checkValidity (document); --- > > if (producers[0] == null) { > return true; > } > > return producers[0].checkValidity (document, useCachedValue); Index: palette/src/org/netbeans/modules/vmd/api/palette/PaletteSupport.java =================================================================== RCS file: /cvs/mobility/designer2/palette/src/org/netbeans/modules/vmd/api/palette/PaletteSupport.java,v retrieving revision 1.5 diff -r1.5 PaletteSupport.java 50,52d49 < import org.netbeans.modules.vmd.api.model.Debug; < import org.netbeans.modules.vmd.api.model.common.ActiveDocumentSupport; < import org.netbeans.modules.vmd.palette.PaletteKit; 62,76d58 < } < < public static void schedulePaletteRefresh() { < DesignDocument document = ActiveDocumentSupport.getDefault().getActiveDocument(); < if (document != null) { < String projectType = document.getDocumentInterface().getProjectType(); < PaletteKit kit = PaletteMap.getInstance().getPaletteKitForProjectType(projectType); < if (kit != null) { < kit.schedulePaletteRefresh(); < } else { < Debug.warning("Can't get PaletteKit for " + projectType); // NOI18N < } < } else { < Debug.warning("Can't get active document"); // NOI18N < } Index: palette/src/org/netbeans/modules/vmd/palette/PaletteKit.java =================================================================== RCS file: /cvs/mobility/designer2/palette/src/org/netbeans/modules/vmd/palette/PaletteKit.java,v retrieving revision 1.28 diff -r1.28 PaletteKit.java 74d73 < private static final String PALETTE_FOLDER_NAME = "palette"; // NOI18N 76c75,76 < --- > private static final String PALETTE_FOLDER_NAME = "palette"; // NOI18N > 85d84 < private final Object validationSynch = new Object(); 88d86 < private final AtomicBoolean requiresPaletteUpdate = new AtomicBoolean(false); 185d182 < Debug.warning("Can't get PaletteController"); // NOI18N 252c249 < Debug.warning("Can't create folder for palette category: ", ex); // NOI18N --- > Debug.warning("Can't create folder for palette category: " + ex); // NOI18N 329,330c326,327 < validationQueue.add(lookup); < synchronized (validationSynch) { --- > synchronized (validationQueue) { > validationQueue.add(lookup); 341c338,339 < synchronized (validationSynch) { --- > Lookup lookup; > synchronized (validationQueue) { 345a344 > lookup = validationQueue.remove(); 347c346 < checkValidityCore(validationQueue.remove()); --- > checkValidityCore(lookup); 390c389 < boolean isValid = result[0] != null; --- > Boolean isValid = result[0] != null; 394c393 < isValid = result[0].checkValidity(activeDocument.get()); --- > isValid = result[0].checkValidity(activeDocument.get(), false); 397,412c396 < node.setValid(isValid); < } < < public void schedulePaletteRefresh() { < if (requiresPaletteUpdate.getAndSet(true)) { < return; < } < < SwingUtilities.invokeLater(new Runnable() { < public void run() { < while (requiresPaletteUpdate.getAndSet(false)) { < clearNodesStateCache(); < refreshPaletteController(); < } < } < }); --- > node.setValid(isValid == null || isValid); Index: palette/src/org/netbeans/modules/vmd/palette/PaletteMap.java =================================================================== RCS file: /cvs/mobility/designer2/palette/src/org/netbeans/modules/vmd/palette/PaletteMap.java,v retrieving revision 1.19 diff -r1.19 PaletteMap.java 42a43 > import org.netbeans.api.java.classpath.ClassPath; 54a56 > import org.openide.util.WeakListeners; 55a58,59 > import java.beans.PropertyChangeEvent; > import java.beans.PropertyChangeListener; 58a63 > import java.util.concurrent.atomic.AtomicBoolean; 65c70 < public final class PaletteMap implements ActiveDocumentSupport.Listener, DescriptorRegistryListener { --- > public final class PaletteMap implements ActiveDocumentSupport.Listener, DescriptorRegistryListener, PropertyChangeListener { 67,68c72 < private static final PaletteMap instance = new PaletteMap(); < private static RequestProcessor updateRP = new RequestProcessor("Update paletteKit"); // NOI18N --- > private static final PaletteMap INSTANCE = new PaletteMap(); 70c74 < private final WeakHashMap> kitMap = new WeakHashMap>(1); --- > private final WeakHashMap> kitMap = new WeakHashMap>(); 72a77,79 > private final AtomicBoolean requiresPaletteUpdate = new AtomicBoolean(false); > private final Set registeredProjects = new HashSet(); > private static RequestProcessor updateRP = new RequestProcessor("Update paletteKit"); // NOI18N 79c86 < return instance; --- > return INSTANCE; 104a112,115 > if (isProjectIDChanged) { > registerClassPathListener(activatedDocument); > } > 167a179,182 > public void propertyChange(PropertyChangeEvent evt) { > schedulePaletteUpdate(); > } > 170,174d184 < if (project == null) { < Debug.warning("Can't get project for " + document.getDocumentInterface().getProjectID()); // NOI18N < return; < } < 177d186 < Debug.warning("Can't get classPathInfo for " + document.getDocumentInterface().getProjectID()); // NOI18N 191c200 < public void run(CompilationController cc) throws Exception { --- > public void run(CompilationController controller) throws Exception { 197a207,225 > private void registerClassPathListener(DesignDocument document) { > final Project project = ProjectUtils.getProject(document); > final ClasspathInfo info = getClasspathInfo(project); > if (info == null) { > return; > } > > String projID = document.getDocumentInterface().getProjectID(); > if (!registeredProjects.contains(projID)) { > Task ct = new ListenerCancellableTask(info); > try { > JavaSource.create(info).runUserActionTask(ct, true); > registeredProjects.add(projID); > } catch (IOException ex) { > Debug.warning(ex); > } > } > } > 217c245,282 < --- > > private void schedulePaletteUpdate() { > if (requiresPaletteUpdate.getAndSet(true)) { > return; > } > > SwingUtilities.invokeLater(new Runnable() { > > public void run() { > while (requiresPaletteUpdate.getAndSet(false)) { > for (WeakReference kitReference : kitMap.values()) { > PaletteKit kit = kitReference.get(); > if (kit == null) { > continue; > } > kit.clearNodesStateCache(); > // HINT refresh only visible palette > kit.refreshPaletteController(); > } > } > } > }); > } > > private final class ListenerCancellableTask implements Task { > > private ClasspathInfo info; > > public ListenerCancellableTask(ClasspathInfo info) { > this.info = info; > } > > public void run(CompilationController controller) throws Exception { > ClassPath cp = info.getClassPath(ClasspathInfo.PathKind.BOOT); > PropertyChangeListener wcl = WeakListeners.propertyChange(PaletteMap.this, cp); > cp.addPropertyChangeListener(wcl); > } > }