/** * Initializes this control based on the settings in the given * AbstractSourceLookupDirector */ public void initializeFrom(ISourceLookupDirector locator) { if(fConfig == null) { fConfig = locator.getLaunchConfiguration(); } fPathViewer.setEntries(locator.getSourceContainers()); fDuplicatesButton.setSelection(locator.isFindDuplicates()); fLocator = locator; fAddAction.setSourceLookupDirector(locator); fEditAction.setSourceLookupDirector(locator); fRestoreDefaultAction.setSourceLookupDirector(locator); setDirty(false); }
protected void setSourceLocator(ILaunch launch) throws CoreException { ILaunchConfiguration configuration = launch.getLaunchConfiguration(); if (launch.getSourceLocator() == null) { ISourceLookupDirector sourceLocator = new JavaSourceLookupDirector(); ISourcePathComputer locator = getLaunchManager().getSourcePathComputer(SOURCE_LOCATOR); if (locator != null) { sourceLocator.setSourcePathComputer(locator); //$NON-NLS-1$ sourceLocator.initializeDefaults(configuration); launch.setSourceLocator(sourceLocator); } } }
/** * Returns the launch configuration for which a default source lookup * path will be computed, or <code>null</code> if none. * * @return the launch configuration for which a default source lookup * path will be computed, or <code>null</code> */ protected ILaunchConfiguration getLaunchConfiguration() { ISourceLookupDirector director = getDirector(); if (director != null) { return director.getLaunchConfiguration(); } return null; }
ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, ""); if (initMemento != null && !initMemento.trim().equals("")) { sourceDir.initializeFromMemento(initMemento); .getSourceContainers(); sourceDir.setSourceContainers(realContainers .toArray(new ISourceContainer[realContainers.size()])); sourceDir.getMemento());
if(configuration == null) { try { ILaunchConfiguration config = fLocator.getLaunchConfiguration(); if(config != null) { workingCopy = config.getWorkingCopy(); fLocator.setSourceContainers(fPathViewer.getEntries()); fLocator.setFindDuplicates(fDuplicatesButton.getSelection()); workingCopy.setAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_ID, (String)null); } else { workingCopy.setAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, fLocator.getMemento()); workingCopy.setAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_ID, fLocator.getId());
/** * Returns the source containers currently registered with this participant's * source lookup director. * * @return the source containers currently registered with this participant's * source lookup director */ protected ISourceContainer[] getSourceContainers() { ISourceLookupDirector director = getDirector(); if (director != null) { return director.getSourceContainers(); } return new ISourceContainer[0]; }
public void initializeFrom(ILaunchConfiguration configuration) { if (fLocator != null) { fLocator.dispose(); fLocator = null; fLocator.initializeDefaults(configuration); } else { fLocator.initializeFromMemento(memento, configuration);
/** * Returns whether this participant's source lookup director is configured * to search for duplicate source elements. * * @return whether this participant's source lookup director is configured * to search for duplicate source elements * @since 3.5 */ public boolean isFindDuplicates() { ISourceLookupDirector director = getDirector(); if (director != null) { return director.isFindDuplicates(); } return false; }
@Override public Object[] findSourceElements(String name) throws CoreException { if (name == null) { return EMPTY; } // chrome-extension://ciinnplnpkjlnbjklingpjkakiapmmpm/foo/bar/baz.dart if (!name.startsWith(CHROME_PREFIX)) { return EMPTY; } String path = name.substring(CHROME_PREFIX.length()); if (path.indexOf('/') != -1) { path = path.substring(path.indexOf('/') + 1); } ILaunchConfiguration launch = getDirector().getLaunchConfiguration(); SDBGLaunchConfigWrapper wrapper = new SDBGLaunchConfigWrapper(launch); IResource launchResource = wrapper.getApplicationResource(); if (launchResource != null) { IContainer parent = launchResource.getParent(); IResource target = parent.findMember(path); if (target != null) { return new Object[] {target}; } } return EMPTY; }
/** * Returns internal jars (source containers) currently used by the * given source lookup director. * * @param director source lookup director jars are being added to * @return the list of any found {@link ArchiveSourceContainer}s */ protected List<ISourceContainer> getSelectedJars(ISourceLookupDirector director) { ISourceContainer[] containers = director.getSourceContainers(); List<ISourceContainer> jars = new ArrayList<>(); for (int i = 0; i < containers.length; i++) { ISourceContainer container = containers[i]; if (container.getType().getId().equals(ArchiveSourceContainer.TYPE_ID)) { jars.add(container); } } return jars; }
/** * Returns whether this container's source should search for duplicate source * elements. Since 3.5, the current participant is consulted to determine if * duplicates should be found. Fall back to querying the source lookup director * if the participant is not an {@link AbstractSourceLookupParticipant}. * * @return whether to search for duplicate source elements */ protected boolean isFindDuplicates() { ISourceLookupDirector director = getDirector(); if (director != null) { if (director instanceof AbstractSourceLookupDirector) { AbstractSourceLookupDirector asld = (AbstractSourceLookupDirector) director; ISourceLookupParticipant participant = asld.getCurrentParticipant(); if (participant instanceof AbstractSourceLookupParticipant ) { AbstractSourceLookupParticipant aslp = (AbstractSourceLookupParticipant) participant; return aslp.isFindDuplicates(); } } return director.isFindDuplicates(); } return false; }
@Override protected ISourceContainer[] createSourceContainers() throws CoreException { IRuntimeClasspathEntry entry = JavaRuntime.newRuntimeContainerClasspathEntry(getPath(), IRuntimeClasspathEntry.USER_CLASSES); IRuntimeClasspathEntry[] entries = JavaRuntime.resolveSourceLookupPath(new IRuntimeClasspathEntry[]{entry}, getDirector().getLaunchConfiguration()); return JavaRuntime.getSourceContainers(entries); }
/** * Returns the possible projects that can be added * * @param director the source lookup director currently being edited */ protected List getPossibleAdditions(ISourceLookupDirector director) { IJavaProject[] projects; IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); try { projects= JavaCore.create(root).getJavaProjects(); } catch (JavaModelException e) { JDIDebugUIPlugin.log(e); projects= new IJavaProject[0]; } List remaining = new ArrayList(); for (int i = 0; i < projects.length; i++) { remaining.add(projects[i]); } List alreadySelected = new ArrayList(); ISourceContainer[] containers = director.getSourceContainers(); for (int i = 0; i < containers.length; i++) { ISourceContainer container = containers[i]; if (container.getType().getId().equals(JavaProjectSourceContainer.TYPE_ID)) { alreadySelected.add(((JavaProjectSourceContainer)container).getJavaProject()); } } remaining.removeAll(alreadySelected); return remaining; }
/** * Assigns a default source locator to the given launch if a source locator * has not yet been assigned to it, and the associated launch configuration * does not specify a source locator. * * @param launch * launch object * @param configuration * configuration being launched * @exception CoreException * if unable to set the source locator */ protected void setDefaultSourceLocator(ILaunch launch, ILaunchConfiguration configuration) throws CoreException { // set default source locator if none specified if (launch.getSourceLocator() == null) { ISourceLookupDirector sourceLocator = new JavaSourceLookupDirector(); sourceLocator .setSourcePathComputer(getLaunchManager() .getSourcePathComputer( "org.eclipse.jdt.launching.sourceLookup.javaSourcePathComputer")); //$NON-NLS-1$ sourceLocator.initializeDefaults(configuration); launch.setSourceLocator(sourceLocator); } } /**
@Override protected ISourceContainer[] createSourceContainers() throws CoreException { IRuntimeClasspathEntry entry = JavaRuntime.newRuntimeContainerClasspathEntry(getPath(), IRuntimeClasspathEntry.USER_CLASSES); IRuntimeClasspathEntry[] entries = JavaRuntime.resolveSourceLookupPath(new IRuntimeClasspathEntry[]{entry}, getDirector().getLaunchConfiguration()); return JavaRuntime.getSourceContainers(entries); }
ISourceContainer[] containers = director.getSourceContainers(); for (int i = 0; i < containers.length; i++) { ISourceContainer container = containers[i];
/** * Assigns a default source locator to the given launch if a source locator * has not yet been assigned to it, and the associated launch configuration * does not specify a source locator. * * @param launch * launch object * @param configuration * configuration being launched * @exception CoreException * if unable to set the source locator */ protected void setDefaultSourceLocator(ILaunch launch, ILaunchConfiguration configuration) throws CoreException { // set default source locator if none specified if (launch.getSourceLocator() == null) { ISourceLookupDirector sourceLocator = new JavaSourceLookupDirector(); sourceLocator .setSourcePathComputer(getLaunchManager() .getSourcePathComputer( "org.eclipse.jdt.launching.sourceLookup.javaSourcePathComputer")); //$NON-NLS-1$ sourceLocator.initializeDefaults(configuration); launch.setSourceLocator(sourceLocator); } } /**
/** * Returns the associated container or <code>null</code> if unavailable. * * @return classpath container or <code>null</code> * @throws CoreException if unable to retrieve container */ public IClasspathContainer getClasspathContainer() throws CoreException { ISourceLookupDirector director = getDirector(); if (director != null) { ILaunchConfiguration configuration = director.getLaunchConfiguration(); if (configuration != null) { IJavaProject project = JavaRuntime.getJavaProject(configuration); if (project != null) { return JavaCore.getClasspathContainer(getPath(), project); } } } return null; }
ISourceContainer[] containers = director.getSourceContainers(); for (int i = 0; i < containers.length; i++) { ISourceContainer container = containers[i];
/** * Returns the associated container or <code>null</code> if unavailable. * * @return classpath container or <code>null</code> * @throws CoreException if unable to retrieve container */ public IClasspathContainer getClasspathContainer() throws CoreException { ISourceLookupDirector director = getDirector(); if (director != null) { ILaunchConfiguration configuration = director.getLaunchConfiguration(); if (configuration != null) { IJavaProject project = JavaRuntime.getJavaProject(configuration); if (project != null) { return JavaCore.getClasspathContainer(getPath(), project); } } } return null; }