Examples of ISourceLookupDirector


Examples of org.eclipse.debug.core.sourcelookup.ISourceLookupDirector

      List<IProject> projs = RunJettyRunSourceLookupUtil.findMavenRelatedProjects(configuration);
      if(projs.size() == 0 ){
        return ;
      }

      ISourceLookupDirector sourceDir = new JavaSourceLookupDirector();
      ILaunchConfigurationWorkingCopy workCopy = configuration.getWorkingCopy();
      String initMemento = workCopy.getAttribute(
          ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, "");
      if (initMemento != null && !initMemento.trim().equals("")) {
        sourceDir.initializeFromMemento(initMemento);
      }
      ISourceContainer[] existContainers = sourceDir
          .getSourceContainers();

      List<ISourceContainer> realContainers = new ArrayList<ISourceContainer>();
      //add exsits source containers
      for (ISourceContainer container : existContainers) {
        realContainers.add(container);
      }
      //check default source container
      ISourceContainer defaultContainer = new DefaultSourceContainer();
      if (!contains(existContainers, defaultContainer)) {
        realContainers.add(defaultContainer);
      }

      for (IProject dependency : projs) {
        // handle projects in current workspace
        ISourceContainer newContainer = new JavaProjectSourceContainer(
            JavaCore.create((IProject) dependency));
        if (!contains(existContainers, newContainer)) {
          realContainers.add(newContainer);
        }
      }

      sourceDir.setSourceContainers(realContainers
          .toArray(new ISourceContainer[realContainers.size()]));

      workCopy.setAttribute(
          ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO,
          sourceDir.getMemento());

      workCopy.doSave();
    } catch (Exception e) {
      // something wrong, skip add sources
    }
View Full Code Here

Examples of org.eclipse.debug.core.sourcelookup.ISourceLookupDirector

      List<IProject> projs = RunJettyRunSourceLookupUtil.findMavenRelatedProjects(configuration);
      if(projs.size() == 0 ){
        return ;
      }

      ISourceLookupDirector sourceDir = new JavaSourceLookupDirector();
      ILaunchConfigurationWorkingCopy workCopy = configuration.getWorkingCopy();
      String initMemento = workCopy.getAttribute(
          ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, "");
      if (initMemento != null && !initMemento.trim().equals("")) {
        sourceDir.initializeFromMemento(initMemento);
      }
      ISourceContainer[] existContainers = sourceDir
          .getSourceContainers();

      List<ISourceContainer> realContainers = new ArrayList<ISourceContainer>();
      //add exsits source containers
      for (ISourceContainer container : existContainers) {
        realContainers.add(container);
      }
      //check default source container
      ISourceContainer defaultContainer = new DefaultSourceContainer();
      if (!contains(existContainers, defaultContainer)) {
        realContainers.add(defaultContainer);
      }

      for (IProject dependency : projs) {
        // handle projects in current workspace
        ISourceContainer newContainer = new JavaProjectSourceContainer(
            JavaCore.create((IProject) dependency));
        if (!contains(existContainers, newContainer)) {
          realContainers.add(newContainer);
        }
      }

      sourceDir.setSourceContainers(realContainers
          .toArray(new ISourceContainer[realContainers.size()]));

      workCopy.setAttribute(
          ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO,
          sourceDir.getMemento());

      workCopy.doSave();
    } catch (Exception e) {
      // something wrong, skip add sources
    }
View Full Code Here

Examples of org.eclipse.debug.core.sourcelookup.ISourceLookupDirector

        ISourceLocator sourceLocator =
            connectedTargetData.getDebugTarget().getLaunch().getSourceLocator();
        if (sourceLocator instanceof ISourceLookupDirector == false) {
          return;
        }
        ISourceLookupDirector director = (ISourceLookupDirector) sourceLocator;


        SourcePositionMap positionMap = connectedTargetData.getSourcePositionMap();
        SourcePosition userPosition;
        {
          // First get VM positions.
          Script script = jsFunction.getScript();
          if (script == null) {
            return;
          }
          TextStreamPosition functionOpenParenPosition = jsFunction.getOpenParenPosition();
          if (functionOpenParenPosition == null) {
            return;
          }

          // Convert them to user positions.
          userPosition = positionMap.translatePosition(
              VmResourceId.forScript(script), functionOpenParenPosition.getLine(),
              functionOpenParenPosition.getColumn(), TranslateDirection.VM_TO_USER);
        }

        Object sourceObject = director.getSourceElement(userPosition.getId());
        if (sourceObject instanceof IFile == false) {
          return;
        }
        IFile resource = (IFile) sourceObject;
        IEditorPart editor;
View Full Code Here

Examples of org.eclipse.debug.core.sourcelookup.ISourceLookupDirector

      }
      if (lookupMode != LookupMode.AUTO_DETECT) {
        return null;
      }

      ISourceLookupDirector director;
      try {
        director = read(config);
      } catch (CoreException e) {
        return null;
      }
      if (director == null) {
        return null;
      }
      for (ISourceContainer sourceContainer : director.getSourceContainers()) {
        if (sourceContainer instanceof SourceNameMapperContainer) {
          return Messages.ChromiumRemoteTab_AUTO_DETECT_CONTAINER_WARNING;
        }
      }
      return null;
View Full Code Here

Examples of org.eclipse.debug.core.sourcelookup.ISourceLookupDirector

      ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
      ISourceLocator locator = launchManager.newSourceLocator(type);
      if (locator instanceof IPersistableSourceLocator2 == false) {
        return null;
      }
      ISourceLookupDirector director = (ISourceLookupDirector) locator;
      director.initializeFromMemento(memento, config);
      return director;
    }
View Full Code Here

Examples of org.eclipse.debug.core.sourcelookup.ISourceLookupDirector

    for (ILaunch launch : launches) {
      if (launch.isTerminated())
        continue;
      ISourceLocator locator = launch.getSourceLocator();
      if (locator instanceof ISourceLookupDirector) {
        ISourceLookupDirector director = (ISourceLookupDirector) locator;
        ISourceContainer[] containers = director.getSourceContainers();
        if (isAnyProjectInSourceContainers(containers, projects))
          return launch.getLaunchConfiguration();
      }
    }
    return null;
View Full Code Here

Examples of org.eclipse.debug.core.sourcelookup.ISourceLookupDirector

   */
  public static Object resolveSourceElement(Object object, ILaunch launch)
      throws CoreException {
    ISourceLocator sourceLocator = launch.getSourceLocator();
    if (sourceLocator instanceof ISourceLookupDirector) {
      ISourceLookupDirector director = (ISourceLookupDirector) sourceLocator;
      Object[] objects = director.findSourceElements(object);
      if (objects.length > 0) {
        return objects[0];
      }
    }
    return null;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.