Package org.eclipse.cdt.core.model

Examples of org.eclipse.cdt.core.model.ICProject


  /**
   * Rebuilts the index of the selected project in the workspace.
   */
  public static void rebuiltIndex(IProject proj) {
    ICProject cproject = CoreModel.getDefault().getCModel().getCProject(proj.getName());
    CCorePlugin.getIndexManager().reindex(cproject);
  }
View Full Code Here


      throw new IllegalArgumentException(Services.getMessage(
            "project.missing.nature", project.getName(), name));
    }

    ICProject cproject = CoreModel.getDefault().create(project);
    if(cproject == null || !cproject.exists()){
      throw new IllegalArgumentException(
          Services.getMessage("project.not.found", project));
    }

    return cproject;
View Full Code Here

    String offset = commandLine.getValue(Options.OFFSET_OPTION);
    String length = commandLine.getValue(Options.LENGTH_OPTION);

    IProject project = projectName != null ?
      ProjectUtils.getProject(projectName) : null;
    ICProject cproject = null;
    if (project != null){
      cproject = CUtils.getCProject(project);
    }

    // element search
View Full Code Here

  public Object execute(CommandLine commandLine)
    throws Exception
  {
    String projectName = commandLine.getValue(Options.PROJECT_OPTION);
    IProject project = ProjectUtils.getProject(projectName);
    ICProject cproject = CoreModel.getDefault().create(project);
    ArrayList<String> results = new ArrayList<String>();
    for (IIncludeReference ref : cproject.getIncludeReferences()){
      results.add(ref.getPath().toOSString());
    }
    return results;
  }
View Full Code Here

  public Object execute(CommandLine commandLine)
    throws Exception
  {
    String projectName = commandLine.getValue(Options.PROJECT_OPTION);
    IProject project = ProjectUtils.getProject(projectName);
    ICProject cproject = CoreModel.getDefault().create(project);
    ArrayList<String> results = new ArrayList<String>();
    for (ISourceRoot root : cproject.getSourceRoots()){
      results.add(ProjectUtils
        .getFilePath(project, root.getPath().toOSString()));
    }
    return results;
  }
View Full Code Here

  {
    String file = commandLine.getValue(Options.FILE_OPTION);
    String projectName = commandLine.getValue(Options.PROJECT_OPTION);

    IProject project = ProjectUtils.getProject(projectName);
    ICProject cproject = CUtils.getCProject(project);
    if(cproject.exists()){
      ITranslationUnit src = CUtils.getTranslationUnit(cproject, file);

      // refresh the index
      CCorePlugin.getIndexManager().update(
          new ICElement[]{src}, IIndexManager.UPDATE_ALL);
View Full Code Here

    String file = commandLine.getValue(Options.FILE_OPTION);
    boolean callees = commandLine.hasOption(CALLEES_OPTION);
    int offset = getOffset(commandLine);
    int length = commandLine.getIntValue(Options.LENGTH_OPTION);

    ICProject cproject = CUtils.getCProject(projectName);

    CUIPlugin cuiPlugin = CUIPlugin.getDefault();
    ITranslationUnit src = CUtils.getTranslationUnit(cproject, file);
    CCorePlugin.getIndexManager().update(
        new ICElement[]{src}, IIndexManager.UPDATE_ALL);
    CCorePlugin.getIndexManager().joinIndexer(3000, new NullProgressMonitor());
    src = src.getWorkingCopy();

    IEditorInput input = new FileEditorInput((IFile)src.getResource());

    // hack... there has to be a better way
    WorkingCopyManager manager = (WorkingCopyManager)
      cuiPlugin.getWorkingCopyManager();
    manager.connect(input);
    manager.setWorkingCopy(input, (IWorkingCopy)src);

    HashMap<String,Object> result = new HashMap<String,Object>();
    try{
      // more hacks to got get around gui dependency
      ASTProvider provider = ASTProvider.getASTProvider();
      Field astCache = ASTProvider.class.getDeclaredField("fCache");
      astCache.setAccessible(true);
      ((ASTCache)astCache.get(provider)).setActiveElement(src);

      TextSelection selection = new TextSelection(offset, length);
      Method findDefinitions = CallHierarchyUI.class.getDeclaredMethod(
          "findDefinitions",
          ICProject.class, IEditorInput.class, ITextSelection.class);
      findDefinitions.setAccessible(true);
      ICElement[] elements = (ICElement[])findDefinitions.invoke(
          null, cproject, input, selection);

      if (elements != null && elements.length > 0) {
        ICElement element = elements[0];
        Set<ICElement> seen = new HashSet<ICElement>();
        ICProject project = element.getCProject();
        ICProject[] scope = getScope(SCOPE_PROJECT, project);
        IIndex index = CCorePlugin.getIndexManager().getIndex(
            scope, IIndexManager.ADD_DEPENDENCIES | IIndexManager.ADD_DEPENDENT);
        index.acquireReadLock();
        try{
View Full Code Here

      IIndex index, ICElement element, Set<ICElement> seen)
    throws Exception
  {
    ArrayList<HashMap<String,Object>> results =
      new ArrayList<HashMap<String,Object>>();
    ICProject project = element.getCProject();
    IIndexBinding calleeBinding = IndexUI.elementToBinding(index, element);
    if (calleeBinding != null) {
      results.addAll(findCallers(index, calleeBinding, true, project, seen));
      if (calleeBinding instanceof ICPPMethod) {
        // cdt 8.1.1 requires a second arg (point: IASTNode), but cdt 8.1.1
View Full Code Here

  private ArrayList<HashMap<String,Object>> findCallees(
      IIndex index, ICElement element, Set<ICElement> seen)
      throws Exception
  {
    ICProject project = element.getCProject();
    IIndexName name = IndexUI.elementToName(index, element);
    IIndexName[] enclosedNames = name.getEnclosedNames();

    ArrayList<Call> calls = new ArrayList<Call>(enclosedNames.length);
    for (IIndexName enclosedName : enclosedNames) {
View Full Code Here

      }
    }

    try{
      handler.createProject(project, true, true, new NullProgressMonitor());
      ICProject cproject = CUtils.getCProject(project);
      CCorePlugin.getIndexManager().reindex(cproject);
    }catch(Exception e){
      throw new RuntimeException(e);
    }
  }
View Full Code Here

TOP

Related Classes of org.eclipse.cdt.core.model.ICProject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.