Example usage for org.eclipse.jdt.core IJavaElement getJavaProject

List of usage examples for org.eclipse.jdt.core IJavaElement getJavaProject

Introduction

In this page you can find the example usage for org.eclipse.jdt.core IJavaElement getJavaProject.

Prototype

IJavaProject getJavaProject();

Source Link

Document

Returns the Java project this element is contained in, or null if this element is not contained in any Java project (for instance, the IJavaModel is not contained in any Java project).

Usage

From source file:org.seasar.dbflute.emecha.eclipse.plugin.dfassist.command.NewConcreteWizardCommand.java

License:Apache License

protected boolean executeSelection(ISelection selection) {
    if (selection instanceof StructuredSelection) {
        Object firstElement = ((StructuredSelection) selection).getFirstElement();
        if (firstElement instanceof IFile) {
            NewConcreteClassWizard wizard = new NewConcreteClassWizard();
            wizard.init(PlatformUI.getWorkbench(), (StructuredSelection) selection);
            this.getWorkbench(wizard);
            return true;
        }/*from w  w w  .  j ava2 s.c  o m*/
        if (firstElement instanceof FileEditorInput) {
            final IFile file = ((FileEditorInput) firstElement).getFile();
            NewConcreteClassWizard wizard = new NewConcreteClassWizard();
            wizard.init(PlatformUI.getWorkbench(), new StructuredSelection(file));
            this.getWorkbench(wizard);
            return true;
        }
        if (firstElement instanceof CompilationUnit) {
            IJavaElement javaElement = ((CompilationUnit) firstElement).getPrimaryElement();
            if (javaElement.getElementType() == IJavaElement.COMPILATION_UNIT) {
                final IFile file = javaElement.getJavaProject().getProject().getWorkspace().getRoot()
                        .getFile(javaElement.getPath());
                NewConcreteClassWizard wizard = new NewConcreteClassWizard();
                wizard.init(PlatformUI.getWorkbench(), new StructuredSelection(file));
                this.getWorkbench(wizard);
                return true;
            }
        }
        if (firstElement instanceof SourceType) {
            IJavaElement primaryElement = ((SourceType) firstElement).getPrimaryElement();
            if (primaryElement.getElementType() == IJavaElement.TYPE) {
                final IFile file = primaryElement.getJavaProject().getProject().getWorkspace().getRoot()
                        .getFile(primaryElement.getPath());
                NewConcreteClassWizard wizard = new NewConcreteClassWizard();
                wizard.init(PlatformUI.getWorkbench(), new StructuredSelection(file));
                this.getWorkbench(wizard);
                return true;
            }
        }
    }
    return false;
}

From source file:org.seasar.s2junit4plugin.wizard.NewS2JUnit4TestCaseWizardPageOne.java

License:Apache License

/**
 * Initialized the page with the current selection
 * @param selection The selection//www .j a va2 s . c om
 */
public void init(IStructuredSelection selection) {
    IJavaElement element = getInitialJavaElement(selection);

    try {
        String mainTestPath = PreferenceStoreUtil.getPreferenceStoreOfWorkspace()
                .getString(Constants.PREF_TEST_JAVA_PATH);
        IJavaProject javaProject = element.getJavaProject();
        IFolder folder = javaProject.getProject().getFolder(mainTestPath);
        if (folder.exists()) {
            IPackageFragmentRoot findPackageFragmentRoot = javaProject
                    .findPackageFragmentRoot(folder.getFullPath());
            setPackageFragmentRoot(findPackageFragmentRoot, true);
        } else {
            initContainerPage(element);
        }
    } catch (JavaModelException e) {
        Logger.error(e, this);
    }
    initTypePage(element);
    // put default class to test      
    if (element != null) {
        IType classToTest = null;
        // evaluate the enclosing type
        IType typeInCompUnit = (IType) element.getAncestor(IJavaElement.TYPE);
        if (typeInCompUnit != null) {
            if (typeInCompUnit.getCompilationUnit() != null) {
                classToTest = typeInCompUnit;
            }
        } else {
            ICompilationUnit cu = (ICompilationUnit) element.getAncestor(IJavaElement.COMPILATION_UNIT);
            if (cu != null)
                classToTest = cu.findPrimaryType();
            else {
                if (element instanceof IClassFile) {
                    try {
                        IClassFile cf = (IClassFile) element;
                        if (cf.isStructureKnown())
                            classToTest = cf.getType();
                    } catch (JavaModelException e) {
                        Logger.error(e, this);
                    }
                }
            }
        }
        if (classToTest != null) {
            try {
                if (!TestSearchEngine.isTestImplementor(classToTest)) {
                    setClassUnderTest(classToTest.getFullyQualifiedName('.'));
                }
            } catch (JavaModelException e) {
                Logger.error(e, this);
            }
        }
    }

    restoreWidgetValues();

    boolean isJunit4 = false;
    //      if (element != null && element.getElementType() != IJavaElement.JAVA_MODEL) {
    //         IJavaProject project= element.getJavaProject();
    //         try {
    //            isJunit4= project.findType(JUnitPlugin.JUNIT4_ANNOTATION_NAME) != null;
    //         } catch (JavaModelException e) {
    //            // ignore
    //         }
    //      }
    if (store.getString(Constants.PREF_TEST_GENERATION_TYPE)
            .equals(org.seasar.s2junit4plugin.Messages.getString("Preference.JUnit4"))) {
        isJunit4 = true;
    }
    setJUnit4(isJunit4, true);

    boolean isS2Junit4 = false;
    //      if (element != null && element.getElementType() != IJavaElement.JAVA_MODEL) {
    //         IJavaProject project= element.getJavaProject();
    //         try {
    //            isS2Junit4= project.findType("org.seasar.framework.unit.Seasar2") != null;
    //         } catch (JavaModelException e) {
    //            // ignore
    //         }
    //      }
    if (store.getString(Constants.PREF_TEST_GENERATION_TYPE)
            .equals(org.seasar.s2junit4plugin.Messages.getString("Preference.S2JUnit4"))) {
        isS2Junit4 = true;
    }
    setS2JUnit4(isS2Junit4, true);

    updateStatus(getStatusList());
}

From source file:org.seasar.s2junit4plugin.wizard.NewS2JUnit4TypeWizardPage.java

License:Apache License

/**
 * Initializes all fields provided by the page with a given selection.
 * //w  w  w  .j  av  a 2  s.co m
 * @param elem the selection used to initialize this page or <code>
 * null</code> if no selection was available
 */
protected void initTypePage(IJavaElement elem) {
    String initSuperclass = "java.lang.Object"; //$NON-NLS-1$
    ArrayList initSuperinterfaces = new ArrayList(5);

    IJavaProject project = null;
    IPackageFragment pack = null;
    IType enclosingType = null;

    if (elem != null) {
        // evaluate the enclosing type
        project = elem.getJavaProject();
        pack = (IPackageFragment) elem.getAncestor(IJavaElement.PACKAGE_FRAGMENT);
        IType typeInCU = (IType) elem.getAncestor(IJavaElement.TYPE);
        if (typeInCU != null) {
            if (typeInCU.getCompilationUnit() != null) {
                enclosingType = typeInCU;
            }
        } else {
            ICompilationUnit cu = (ICompilationUnit) elem.getAncestor(IJavaElement.COMPILATION_UNIT);
            if (cu != null) {
                enclosingType = cu.findPrimaryType();
            }
        }

        try {
            IType type = null;
            if (elem.getElementType() == IJavaElement.TYPE) {
                type = (IType) elem;
                if (type.exists()) {
                    String superName = S2JUnit4SuperInterfaceSelectionDialog.getNameWithTypeParameters(type);
                    if (type.isInterface()) {
                        initSuperinterfaces.add(superName);
                    } else {
                        initSuperclass = superName;
                    }
                }
            }
        } catch (JavaModelException e) {
            JavaPlugin.log(e);
            // ignore this exception now
        }
    }

    String typeName = ""; //$NON-NLS-1$

    ITextSelection selection = getCurrentTextSelection();
    if (selection != null) {
        String text = selection.getText();
        if (text != null && validateJavaTypeName(text, project).isOK()) {
            typeName = text;
        }
    }

    setPackageFragment(pack, true);
    setEnclosingType(enclosingType, true);
    setEnclosingTypeSelection(false, true);

    setTypeName(typeName, true);
    setSuperClass(initSuperclass, true);
    setSuperInterfaces(initSuperinterfaces, true);

    setAddComments(StubUtility.doAddComments(project), true); // from project or workspace
}

From source file:org.springframework.ide.eclipse.aop.ui.decorator.AopReferenceModelImageDecorator.java

License:Open Source License

public void decorate(Object element, IDecoration decoration) {
    // add the orange triangle to the icon if this method,
    // class or aspect is advised
    if ((element instanceof IMethod || element instanceof SourceType)) {
        IJavaElement je = (IJavaElement) element;
        IJavaProject jp = je.getJavaProject();
        // only query the model if the element is in an Spring project
        if ((jp != null) && SpringCoreUtils.isSpringProject(jp.getProject())) {
            if (je instanceof IMethod && Activator.getModel().isAdvised(je)) {
                decoration.addOverlay(AopReferenceModelImages.DESC_OVR_ADVICE, IDecoration.TOP_LEFT);
            }//from   w w w .  ja v  a2 s  .c o  m
        }
    } else if (element instanceof BeanMethodReferenceNode
            && Activator.getModel().isAdvised(((BeanMethodReferenceNode) element).getJavaElement())) {
        decoration.addOverlay(AopReferenceModelImages.DESC_OVR_ADVICE, IDecoration.TOP_LEFT);
    } else if (element instanceof AdviceAopTargetMethodNode) {
        decoration.addOverlay(AopReferenceModelImages.DESC_OVR_ADVICE, IDecoration.TOP_LEFT);
    } else if (element instanceof AdviceAopTargetBeanNode) {
        decoration.addOverlay(AopReferenceModelImages.DESC_OVR_ADVICE, IDecoration.TOP_LEFT);
    } else if (element instanceof BeanReferenceNode
            && Activator.getModel().isAdvised(((BeanReferenceNode) element).getBean())) {
        decoration.addOverlay(AopReferenceModelImages.DESC_OVR_ADVICE, IDecoration.TOP_LEFT);
    } else if (element instanceof AdvisedAopSourceMethodNode) {
        if (Activator.getModel().isAdvised(((AdvisedAopSourceMethodNode) element).getReference().getSource()))
            decoration.addOverlay(AopReferenceModelImages.DESC_OVR_ADVICE, IDecoration.TOP_LEFT);
    } else if (element instanceof AdviceRootAopReferenceNode) {
        List<IAopReference> references = ((AdviceRootAopReferenceNode) element).getReference();
        for (IAopReference reference : references) {
            if (reference.getDefinition() instanceof IAnnotationAopDefinition) {
                decoration.addOverlay(AopReferenceModelImages.DESC_OVR_ANNOTATION, IDecoration.BOTTOM_LEFT);
                break;
            }
        }
    } else if (element instanceof AdvisedAopSourceNode) {
        IAopReference reference = ((AdvisedAopSourceNode) element).getReference();
        if (reference.getDefinition() instanceof IAnnotationAopDefinition) {
            decoration.addOverlay(AopReferenceModelImages.DESC_OVR_ANNOTATION, IDecoration.BOTTOM_LEFT);
        }
    } else if (element instanceof AdviceDeclareParentAopSourceNode) {
        IAopReference reference = ((AdviceDeclareParentAopSourceNode) element).getReference();
        if (reference.getDefinition() instanceof IAnnotationAopDefinition) {
            decoration.addOverlay(AopReferenceModelImages.DESC_OVR_ANNOTATION, IDecoration.BOTTOM_LEFT);
        }
    } else if (element instanceof AdvisedDeclareParentAopSourceNode) {
        IAopReference reference = ((AdvisedDeclareParentAopSourceNode) element).getReference();
        if (reference.getDefinition() instanceof IAnnotationAopDefinition) {
            decoration.addOverlay(AopReferenceModelImages.DESC_OVR_ANNOTATION, IDecoration.BOTTOM_LEFT);
        }
    }
    // add overlay to IBeans
    else if (element instanceof IBean) {
        IBean bean = (IBean) element;
        if (Activator.getModel().isAdvised(bean)) {
            decoration.addOverlay(AopReferenceModelImages.DESC_OVR_ADVICE, IDecoration.TOP_LEFT);
        }
    }

    if (element instanceof IReferenceNode && ((IReferenceNode) element).getReferenceParticipant() != null) {
        super.decorate(((IReferenceNode) element).getReferenceParticipant(), decoration);
    }
}

From source file:org.springframework.ide.eclipse.beans.core.internal.model.BeansModelUtils.java

License:Open Source License

protected static Set<IBeansConfig> getConfigsByContainingTypesUsingTypeHierarchyEngine(IResource resource,
        TypeHierarchyEngine typeEngine, IProgressMonitor monitor) {
    Set<IBeansConfig> files = new LinkedHashSet<IBeansConfig>();

    if (resource != null && resource.isAccessible() && resource.isSynchronized(IResource.DEPTH_ZERO)
            && resource.getName().endsWith(".java")) {
        Set<IBeansProject> projects = BeansCorePlugin.getModel().getProjects();
        if (projects != null) {

            IJavaElement element = JavaCore.create(resource);
            if (element instanceof ICompilationUnit && element.getJavaProject().isOnClasspath(element)) {

                try {
                    IType[] types = ((ICompilationUnit) element).getAllTypes();
                    String[] changedTypeNames = new String[types.length];
                    boolean[] changedTypeIsInterface = new boolean[types.length];
                    for (int i = 0; i < types.length; i++) {
                        changedTypeNames[i] = types[i].getFullyQualifiedName();
                        changedTypeIsInterface[i] = types[i].isInterface();
                    }//from  ww w . j  a v  a  2 s  .  c  o m

                    for (IBeansProject project : projects) {
                        if (project != null) {

                            // don't look at projects that do not have the java element on their classpath
                            if (JdtUtils.isJavaProject(project.getProject())
                                    && !JdtUtils.getJavaProject(project.getProject()).isOnClasspath(element)) {
                                continue;
                            }

                            Set<IBeansConfig> configs = project.getConfigs();
                            for (IBeansConfig config : configs) {
                                boolean configAdded = false;
                                Set<String> allBeanClasses = config.getBeanClasses();
                                for (int i = 0; i < changedTypeNames.length; i++) {
                                    for (String className : allBeanClasses) {
                                        if (changedTypeIsInterface[i] && typeEngine.doesImplement(className,
                                                changedTypeNames[i], project.getProject())) {
                                            files.add(config);
                                            configAdded = true;
                                            break;
                                        } else if (!changedTypeIsInterface[i] && typeEngine.doesExtend(
                                                className, changedTypeNames[i], project.getProject())) {
                                            files.add(config);
                                            configAdded = true;
                                            break;
                                        }
                                    }
                                    if (configAdded)
                                        break;
                                }
                            }

                            //                        typeHierarchyEngine.cleanup(project.getProject());
                        }
                    }
                } catch (JavaModelException e) {
                    BeansCorePlugin.log(e);
                }
            }
        }
    }
    return files;
}

From source file:org.springframework.ide.eclipse.beans.core.internal.model.BeansModelUtils.java

License:Open Source License

protected static Set<IBeansConfig> getConfigsByContainingTypesJDT(IResource resource,
        IProgressMonitor monitor) {//  w  ww .  j a v  a 2s. co m
    Set<IBeansConfig> files = new LinkedHashSet<IBeansConfig>();

    if (resource != null && resource.isAccessible() && resource.isSynchronized(IResource.DEPTH_ZERO)
            && resource.getName().endsWith(".java")) {
        Set<IBeansProject> projects = BeansCorePlugin.getModel().getProjects();
        if (projects != null) {

            IJavaElement element = JavaCore.create(resource);
            if (element instanceof ICompilationUnit && element.getJavaProject().isOnClasspath(element)) {

                try {
                    IType[] types = ((ICompilationUnit) element).getAllTypes();
                    Set<List<IType>> hierachies = new HashSet<List<IType>>();
                    List<IType> relevantTypes = Arrays.asList(types);
                    for (IType type : types) {
                        IType[] subTypes = SuperTypeHierarchyCache.getTypeHierarchy(type, monitor)
                                .getAllSubtypes(type);
                        if (subTypes != null && subTypes.length > 0) {
                            hierachies.add(Arrays.asList(subTypes));
                        }
                    }

                    for (IBeansProject project : projects) {
                        if (project != null) {
                            Set<IBeansConfig> configs = project.getConfigs();
                            for (IBeansConfig config : configs) {

                                Set<String> allBeanClasses = config.getBeanClasses();
                                for (String className : allBeanClasses) {
                                    IType type = JdtUtils.getJavaType(project.getProject(), className);
                                    if (type != null) {
                                        // 1. check if the bean class is clear match
                                        if (relevantTypes.contains(type)) {
                                            files.add(config);
                                        } else {
                                            for (List<IType> subTypes : hierachies) {
                                                if (subTypes.contains(type)) {
                                                    files.add(config);
                                                    break;
                                                }
                                            }
                                        }
                                        // 3. break the for loop if file is already in
                                        if (files.contains(config)) {
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                    }
                } catch (JavaModelException e) {
                    BeansCorePlugin.log(e);
                }
            }
        }
    }

    return files;
}

From source file:org.springframework.ide.eclipse.beans.core.internal.model.BeansModelUtils.java

License:Open Source License

protected static Set<IBean> getBeansByContainingTypesUsingTypeHierarchyEngine(IResource resource,
        TypeHierarchyEngine typeEngine, IProgressMonitor monitor) {
    Set<IBean> files = new LinkedHashSet<IBean>();

    if (resource != null && resource.isAccessible() && resource.isSynchronized(IResource.DEPTH_ZERO)
            && resource.getName().endsWith(".java")) {
        Set<IBeansProject> projects = BeansCorePlugin.getModel().getProjects();
        if (projects != null) {

            IJavaElement element = JavaCore.create(resource);
            if (element instanceof ICompilationUnit && element.getJavaProject().isOnClasspath(element)) {

                try {
                    IType[] types = ((ICompilationUnit) element).getAllTypes();
                    String[] changedTypeNames = new String[types.length];
                    boolean[] changedTypeIsInterface = new boolean[types.length];
                    for (int i = 0; i < types.length; i++) {
                        changedTypeNames[i] = types[i].getFullyQualifiedName();
                        changedTypeIsInterface[i] = types[i].isInterface();
                    }// ww  w.jav a 2 s .  c o  m

                    for (IBeansProject project : projects) {
                        if (project != null) {

                            // don't look at projects that do not have the java element on their classpath
                            if (JdtUtils.isJavaProject(project.getProject())
                                    && !JdtUtils.getJavaProject(project.getProject()).isOnClasspath(element)) {
                                continue;
                            }

                            Set<IBeansConfig> configs = project.getConfigs();
                            for (IBeansConfig config : configs) {
                                Set<IBean> allBeans = getBeans(config);

                                for (IBean bean : allBeans) {
                                    String className = resolveBeanTypeAsString(bean);

                                    if (className != null) {
                                        for (int i = 0; i < changedTypeNames.length; i++) {
                                            if (changedTypeIsInterface[i] && typeEngine.doesImplement(className,
                                                    changedTypeNames[i], project.getProject())) {
                                                files.add(bean);
                                                break;
                                            } else if (!changedTypeIsInterface[i] && typeEngine.doesExtend(
                                                    className, changedTypeNames[i], project.getProject())) {
                                                files.add(bean);
                                                break;
                                            }
                                        }
                                    } else {
                                        // We can't determine the beans type so don't be cleverer as we can and let
                                        // it be processed again
                                        // One last check before adding too much that is not even on the resource's
                                        // classpath
                                        if (project != null && JdtUtils.isJavaProject(project.getProject())
                                                && JdtUtils.getJavaProject(project.getProject())
                                                        .isOnClasspath(resource)) {
                                            files.add(bean);
                                        }
                                    }
                                }
                            }

                            //                        typeHierarchyEngine.cleanup(project.getProject());
                        }
                    }
                } catch (JavaModelException e) {
                    BeansCorePlugin.log(e);
                }
            }
        }
    }
    return files;
}

From source file:org.springframework.ide.eclipse.beans.core.internal.model.BeansModelUtils.java

License:Open Source License

protected static Set<IBean> getBeansByContainingTypesJDT(IResource resource, IProgressMonitor monitor) {
    Set<IBean> files = new LinkedHashSet<IBean>();

    if (resource != null && resource.isAccessible() && resource.isSynchronized(IResource.DEPTH_ZERO)
            && resource.getName().endsWith(".java")) {
        Set<IBeansProject> projects = BeansCorePlugin.getModel().getProjects();
        if (projects != null) {

            IJavaElement element = JavaCore.create(resource);
            if (element instanceof ICompilationUnit && element.getJavaProject().isOnClasspath(element)) {

                try {
                    IType[] types = ((ICompilationUnit) element).getAllTypes();
                    Set<List<IType>> hierachies = new HashSet<List<IType>>();
                    List<IType> relevantTypes = Arrays.asList(types);
                    for (IType type : types) {
                        IType[] subTypes = SuperTypeHierarchyCache.getTypeHierarchy(type, monitor)
                                .getAllSubtypes(type);
                        if (subTypes != null && subTypes.length > 0) {
                            hierachies.add(Arrays.asList(subTypes));
                        }/*from w w w. j  a  v a 2  s.c o  m*/
                    }

                    for (IBeansProject project : projects) {
                        if (project != null) {
                            Set<IBeansConfig> configs = project.getConfigs();
                            for (IBeansConfig config : configs) {
                                Set<IBean> allBeans = getBeans(config);

                                for (IBean bean : allBeans) {
                                    IType type = resolveBeanType(bean);
                                    if (type != null) {
                                        if (relevantTypes.contains(type)) {
                                            files.add(bean);
                                        } else {
                                            for (List<IType> subTypes : hierachies) {
                                                if (subTypes.contains(type)) {
                                                    files.add(bean);
                                                    break;
                                                }
                                            }
                                        }
                                    } else {
                                        // We can't determine the beans type so don't be cleverer as we can and let
                                        // it be processed again
                                        // One last check before adding too much that is not even on the resource's
                                        // classpath
                                        if (project != null && JdtUtils.isJavaProject(project.getProject())
                                                && JdtUtils.getJavaProject(project.getProject())
                                                        .isOnClasspath(resource)) {
                                            files.add(bean);
                                        }
                                    }
                                }
                            }
                        }
                    }
                } catch (JavaModelException e) {
                    BeansCorePlugin.log(e);
                }
            }
        }
    }
    return files;
}

From source file:org.springframework.ide.eclipse.beans.ui.model.BeansModelLabelDecorator.java

License:Open Source License

protected void decorateJavaElement(IJavaElement element, IDecoration decoration) {
    int type = element.getElementType();
    if (type == IJavaElement.PACKAGE_FRAGMENT_ROOT || type == IJavaElement.CLASS_FILE
            || type == IJavaElement.COMPILATION_UNIT) {
        IBeansModel model = BeansCorePlugin.getModel();
        IBeansProject project = model.getProject(element.getJavaProject().getProject());
        if (project instanceof ILazyInitializedModelElement
                && ((ILazyInitializedModelElement) project).isInitialized()) {
            try {
                if (type == IJavaElement.PACKAGE_FRAGMENT_ROOT) {

                    // Decorate JAR file
                    IResource resource = ((IPackageFragmentRoot) element).getResource();
                    if (resource instanceof IFile) {
                        for (IBeansConfig config : project.getConfigs()) {
                            if (config.getElementResource().equals(resource)) {
                                decoration.addOverlay(BeansUIImages.DESC_OVR_SPRING);
                                break;
                            }/*from w w  w.  ja  va2  s. c  o  m*/
                        }
                    }
                } else if (type == IJavaElement.CLASS_FILE) {

                    // Decorate Java class file
                    IType javaType = ((IClassFile) element).getType();
                    if (BeansModelUtils.isBeanClass(javaType)) {
                        decoration.addOverlay(BeansUIImages.DESC_OVR_SPRING);
                    }
                } else if (type == IJavaElement.COMPILATION_UNIT) {

                    // Decorate Java source file
                    for (IType javaType : ((ICompilationUnit) element).getTypes()) {
                        if (BeansModelUtils.isBeanClass(javaType)) {
                            decoration.addOverlay(BeansUIImages.DESC_OVR_SPRING);
                            break;
                        }
                    }
                }
            } catch (JavaModelException e) {
                // Ignore
            }
        }
    }
}

From source file:org.springframework.ide.eclipse.boot.core.BootJavaElementPropertyTester.java

License:Open Source License

private boolean isInBootProject(IJavaElement je) {
    if (je != null) {
        IJavaProject jp = je.getJavaProject();
        if (jp != null) {
            return BootPropertyTester.isBootProject(jp.getProject());
        }/*  www .  j  a va2 s  .c o  m*/
    }
    return false;
}