private void resolveContext(CsmProject project, CharSequence qualifiedName[], Collection<CsmObject> result) { CharSequence[] cnn = qualifiedName; if (cnn != null) { if (cnn.length > 1) { resolveContext(project.getGlobalNamespace(), qualifiedName, 0, result); } else if (cnn.length == 1) { result.add(project.getGlobalNamespace()); } } }
@Override protected CsmNamespace getNamespace() { CsmProject prj = getProject(); if (prj != null){ return prj.getGlobalNamespace(); } return null; }
public CsmScope getScope() { if(scope != null) { return scope; } if (parent == null) { scope = (NamespaceImpl) file.getProject().getGlobalNamespace(); } else { if(parent instanceof NamespaceDefinitionImpl.NamespaceBuilder) { scope = ((NamespaceDefinitionImpl.NamespaceBuilder)parent).getNamespace(); } } return scope; }
public void render(AST root) { // if (file.getAbsolutePath().toString().endsWith("shared.h")) { // int i = 10; // } render(root, (NamespaceImpl) file.getProject().getGlobalNamespace(), fileContent); }
public CsmScope getScope() { if (scope != null) { return scope; } if (parent == null) { scope = (NamespaceImpl) file.getProject().getGlobalNamespace(); } else { if (parent instanceof NamespaceDefinitionImpl.NamespaceBuilder) { scope = ((NamespaceDefinitionImpl.NamespaceBuilder) parent).getNamespace(); } } return scope; }
private void processProject(CsmProject project, CsmSelect.CsmFilter filter, NameMatcher matcher) { checkCancelled(); processNamespace(project.getGlobalNamespace(), filter, matcher); }
public CsmScope getScope() { if(scope != null) { return scope; } if (parent == null) { scope = (NamespaceImpl) file.getProject().getGlobalNamespace(); } else { if(parent instanceof NamespaceDefinitionImpl.NamespaceBuilder) { scope = ((NamespaceDefinitionImpl.NamespaceBuilder)parent).getNamespace(); } } return scope; }
public void render(List<Object> objs) { render(objs, (NamespaceImpl) file.getProject().getGlobalNamespace(), fileContent); }
public List<CsmNamespace> getGlobalNamespaces(String strPrefix, boolean match) { if (project == null) { return Collections.emptyList(); } CsmNamespace globNS = project.getGlobalNamespace(); List<CsmNamespace> res = getNestedNamespaces(globNS, strPrefix, match); if (res != null && sort) { CsmSortUtilities.sortMembers(res, isNaturalSort(), isCaseSensitive()); } return res; }
/** Find classes by name and possibly in some namespace * @param nmsp namespace where the classes should be searched for. It can be null * @param begining of the name of the class. The namespace name must be omitted. * @param exactMatch whether the given name is the exact requested name * of the class or not. * @return list of the matching classes */ @Override public List<CsmClassifier> findClasses(CsmNamespace nmsp, String name, boolean exactMatch, boolean searchNested) { // System.out.println("findClasses: " + (nmsp == null ? "null" : nmsp.getName ()) + " " + name); //NOI18N List<CsmClassifier> ret = new ArrayList<CsmClassifier>(); CsmProjectContentResolver contResolver = new CsmProjectContentResolver(getCaseSensitive()); if (csmFile != null && csmFile.getProject() != null) { CsmProject prj = csmFile.getProject(); CsmNamespace ns = nmsp == null ? prj.getGlobalNamespace() : nmsp; Collection<CsmClassifier> classes = contResolver.getNamespaceClassesEnums(ns, name, exactMatch, searchNested); if (classes != null) { ret.addAll(classes); } classes = prj.getGlobalNamespace() == ns ? null : contResolver.getLibClassesEnums(name, exactMatch); if (classes != null) { ret.addAll(classes); } } return ret; }
/** ================= help methods =======================================*/ public List<CsmVariable> getGlobalVariables(String strPrefix, boolean match) { if (project == null) { return Collections.emptyList(); } CsmNamespace globNS = project.getGlobalNamespace(); // add global variables List<CsmVariable> res = getNamespaceVariables(globNS, strPrefix, match, false, false); if (res != null && sort) { CsmSortUtilities.sortMembers(res, isNaturalSort(), isCaseSensitive()); } return res; }
public List<CsmFunction> getGlobalFunctions(String strPrefix, boolean match) { if (project == null) { return Collections.emptyList(); } CsmNamespace globNS = project.getGlobalNamespace(); List<CsmFunction> res = getNamespaceFunctions(globNS, strPrefix, match, false, false); if (res != null && sort) { CsmSortUtilities.sortMembers(res, isNaturalSort(), isCaseSensitive()); } return res; }
public CsmScope getScope() { if(scope != null) { return scope; } if(parent instanceof NamespaceDefinitionImpl.NamespaceBuilder) { scope = ((NamespaceDefinitionImpl.NamespaceBuilder)parent).getNamespace(); } else { scope = (NamespaceImpl) getFile().getProject().getGlobalNamespace(); } return scope; }
private Collection<CsmNamespace> getNamespacesToSearch(CsmContext context, CsmFile file, int offset, boolean onlyInProject, boolean contextOnly) { CsmProject prj = file.getProject(); CsmProject inProject = (onlyInProject || contextOnly) ? prj : null; Collection<CsmNamespace> namespaces = new ArrayList<CsmNamespace>(); // add all namespaces from context Collection<CsmNamespace> contextNSs = getContextNamespaces(context); namespaces.addAll(contextNSs); namespaces = filterNamespaces(namespaces, inProject); if (!contextOnly && checkNamespaceDeclarations()) { namespaces.addAll(CsmUsingResolver.getDefault().findVisibleNamespaces(file, offset, inProject)); } if (prj != null) { // add global namespace CsmNamespace globNS = prj.getGlobalNamespace(); namespaces.add(globNS); } return namespaces; }
CsmProjectContentResolver libResolver = new CsmProjectContentResolver(this.startFile, lib, isCaseSensitive(), isSortNeeded(), isNaturalSort(), Collections.<CsmProject>emptyList()); Collection<? extends CsmObject> results = filter.getResults(libResolver, lib.getGlobalNamespace(), strPrefix, match, searchNested); if (match) { libElements.addAll(results);
public NamespaceKeyArray(ChildrenUpdater childrenUpdater, CsmNamespace namespace){ super(childrenUpdater, namespace.getProject(),PersistentKey.createKey(namespace)); CsmProject project = namespace.getProject(); if (namespace.equals(project.getGlobalNamespace())){ if (!project.isArtificial()) { CsmListeners.getDefault().addProgressListener(this); isRootNamespase = true; } } }
CsmNamespace ns = nmsp == null ? prj.getGlobalNamespace() : nmsp; if (checkStopAfterAppendAllNamespaceElements(ns, name, exactMatch, searchNested, searchFirst, true, csmFile, contResolver, ret, false, new HashSet<CharSequence>(), vasitedNamespaces)) { return ret; CsmNamespace libNmsp; if (ns.isGlobal()) { libNmsp = lib.getGlobalNamespace(); } else { libNmsp = lib.findNamespace(ns.getQualifiedName());
@Override public CsmScope getScope() { if(scope != null) { return scope; } if (getParent() == null) { scope = (NamespaceImpl) getFile().getProject().getGlobalNamespace(); } else { if(getParent() instanceof NamespaceDefinitionImpl.NamespaceBuilder) { scope = ((NamespaceDefinitionImpl.NamespaceBuilder)getParent()).getNamespace(); } } return scope; }
@Override public void dispose() { super.dispose(); // nobody disposes the fake forward class => we should take care of this CsmEnum cls = getCsmEnum(); if (ForwardEnum.isForwardEnum(cls)) { ((ForwardEnum) cls).dispose(); } CsmNamespace scope = getContainingFile().getProject().getGlobalNamespace(); ((NamespaceImpl) scope).removeDeclaration(this); ((ProjectBase) getContainingFile().getProject()).unregisterDeclaration(this); }
@Override public void dispose() { super.dispose(); // nobody disposes the fake forward class => we should take care of this CsmClass cls = getCsmClass(); if (ForwardClass.isForwardClass(cls)) { ((ForwardClass) cls).dispose(); } CsmNamespace scope = getContainingFile().getProject().getGlobalNamespace(); ((NamespaceImpl) scope).removeDeclaration(this); ((ProjectBase) getContainingFile().getProject()).unregisterDeclaration(this); }