@Override public synchronized IApiComponent getWorkspaceComponent(String symbolicName) { IApiBaseline baseline = getWorkspaceBaseline(); if (baseline != null) { return baseline.getApiComponent(symbolicName); } return null; } }
/** * Returns the API component associated with this API description * * @return API component * @exception CoreException if the API component cannot be located */ private ProjectComponent getApiComponent() throws CoreException { IApiBaseline baseline = ApiBaselineManager.getManager().getWorkspaceBaseline(); ProjectComponent component = (ProjectComponent) baseline.getApiComponent(getJavaProject().getProject()); if (component == null) { throw new CoreException(new Status(IStatus.ERROR, ApiPlugin.PLUGIN_ID, "Unable to resolve project API component for API description")); //$NON-NLS-1$ } return component; }
public static IApiComponent[] getReexportedComponents(IApiComponent component) { try { IRequiredComponentDescription[] requiredComponents = component.getRequiredComponents(); int length = requiredComponents.length; if (length != 0) { List<IApiComponent> reexportedComponents = null; IApiBaseline baseline = component.getBaseline(); for (int i = 0; i < length; i++) { IRequiredComponentDescription description = requiredComponents[i]; if (description.isExported()) { String id = description.getId(); IApiComponent reexportedComponent = baseline.getApiComponent(id); if (reexportedComponent != null) { if (reexportedComponents == null) { reexportedComponents = new ArrayList<>(); } reexportedComponents.add(reexportedComponent); } } } if (reexportedComponents == null || reexportedComponents.isEmpty()) { return null; } return reexportedComponents.toArray(new IApiComponent[reexportedComponents.size()]); } } catch (CoreException e) { ApiPlugin.log(e); } return null; }
/** * Gets the {@link IApiFilterStore} for the given {@link IProject} * * @param project * @return the filter store for the given project or <code>null</code> * @throws CoreException */ static IApiFilterStore resolveFilterStore(IProject project) throws CoreException { IApiComponent component = ApiPlugin.getDefault().getApiBaselineManager().getWorkspaceBaseline().getApiComponent(project); if (component != null) { return component.getFilterStore(); } return null; }
/** * Gets the {@link IApiFilterStore} for the given {@link IProject} * @param project * @return the filter store for the given project or <code>null</code> * @throws CoreException */ static IApiFilterStore resolveFilterStore(IProject project) throws CoreException { IApiComponent component = ApiPlugin.getDefault().getApiBaselineManager().getWorkspaceBaseline().getApiComponent(project); if(component != null) { return component.getFilterStore(); } return null; }
@Override protected IApiDescription createApiDescription() throws CoreException { BundleDescription[] fragments = getBundleDescription().getFragments(); if (fragments.length == 0) { return createLocalApiDescription(); } // build a composite description ArrayList<IApiDescription> descriptions = new ArrayList<>(fragments.length); descriptions.add(createLocalApiDescription()); IApiComponent component = null; for (int i = 0; i < fragments.length; i++) { if (!fragments[i].isResolved()) { continue; } component = getBaseline().getApiComponent(fragments[i].getSymbolicName()); if (component != null) { descriptions.add(component.getApiDescription()); } else { ApiPlugin.log(new Status(IStatus.WARNING, ApiPlugin.PLUGIN_ID, NLS.bind(Messages.BundleComponent_failed_to_lookup_fragment, fragments[i].getSymbolicName()))); } } return new CompositeApiDescription(descriptions.toArray(new IApiDescription[descriptions.size()])); }
@Override public boolean visitComponent(IComponentDescriptor target) { unresolved = new ArrayList<>(); targetComponent = target; skipped = false; String id = targetComponent.getId(); if (includedElements != null && !includedElements.isEmpty() && !(includedElements.containsExactMatch(id) || includedElements.containsPartialMatch(id))) { skipped = true; return false; } if (excludedElements != null && (excludedElements.containsExactMatch(id) || excludedElements.containsPartialMatch(id))) { skipped = true; return false; } if (targetScope == null || id.matches(targetScope)) { // only analyze if it matches our scope currComponent = baseline.getApiComponent(id); return true; } skipped = true; return false; }
/** * @return the {@link IApiFilterStore} from the backing project * @throws CoreException */ IApiFilterStore getFilterStore() throws CoreException { IProject project = getProject(); IApiFilterStore store = null; if(project != null) { IApiComponent component = ApiPlugin.getDefault().getApiBaselineManager().getWorkspaceBaseline().getApiComponent(project); if(component != null) { return component.getFilterStore(); } } return store; }
/** * @return the {@link IApiFilterStore} from the backing project * @throws CoreException */ IApiFilterStore getFilterStore() throws CoreException { IProject project = getProject(); IApiFilterStore store = null; if (project != null) { IApiComponent component = ApiPlugin.getDefault().getApiBaselineManager().getWorkspaceBaseline().getApiComponent(project); if (component != null) { return component.getFilterStore(); } } return store; }
@Override public synchronized IApiComponent getHost() throws CoreException { init(); if (fBundleDescription == null) { baselineDisposed(getBaseline()); } HostSpecification host = fBundleDescription.getHost(); if (host != null) { return getBaseline().getApiComponent(host.getName()); } return null; }
return Status.CANCEL_STATUS; IApiComponent component = ApiPlugin.getDefault().getApiBaselineManager().getWorkspaceBaseline().getApiComponent(project.getName()); if(component == null) { return Status.CANCEL_STATUS;
/** * Scans the source and collects all of the changes in the given collector * * @param project the project to scan * @param collector the map to collect the edits in * @param remove if the old Javadoc tags should be removed as well * @param monitor the prgress monitor * @throws CoreException */ RefactoringStatus collectAnnotationEdits(IJavaProject project, Map<IFile, Set<TextEdit>> collector, boolean remove, IProgressMonitor monitor) throws CoreException { RefactoringStatus status = new RefactoringStatus(); IApiBaseline baseline = ApiBaselineManager.getManager().getWorkspaceBaseline(); if (baseline != null) { IApiComponent component = baseline.getApiComponent(project.getProject()); if (component != null) { IApiDescription description = component.getApiDescription(); AnnotVisitor visitor = new AnnotVisitor(project, component, description, remove, monitor); description.accept(visitor, null); collector.putAll(visitor.changes); } } return status; }
/** * resolves the {@link IApiProblemFilter} for the given marker * @param marker */ static IApiProblemFilter resolveFilter(IMarker marker) { try { String filterhandle = marker.getAttribute(IApiMarkerConstants.MARKER_ATTR_FILTER_HANDLE_ID, null); String[] values = filterhandle.split(ApiProblemFilter.HANDLE_DELIMITER); IProject project = marker.getResource().getProject(); IApiComponent component = ApiBaselineManager.getManager().getWorkspaceBaseline().getApiComponent(project); if(component != null) { IApiFilterStore store = component.getFilterStore(); IPath path = new Path(values[1]); IResource resource = project.findMember(path); if(resource == null) { resource = project.getFile(path); } int hashcode = ApiProblemFactory.getProblemHashcode(filterhandle); IApiProblemFilter[] filters = store.getFilters(resource); for (int i = 0; i < filters.length; i++) { if(filters[i].getUnderlyingProblem().hashCode() == hashcode) { return filters[i]; } } } } catch(CoreException ce) {} return null; }
/** * resolves the {@link IApiProblemFilter} for the given marker * * @param marker */ static IApiProblemFilter resolveFilter(IMarker marker) { try { String filterhandle = marker.getAttribute(IApiMarkerConstants.MARKER_ATTR_FILTER_HANDLE_ID, null); String[] values = filterhandle.split(ApiProblemFilter.HANDLE_DELIMITER); IProject project = marker.getResource().getProject(); IApiComponent component = ApiBaselineManager.getManager().getWorkspaceBaseline().getApiComponent(project); if (component != null) { IApiFilterStore store = component.getFilterStore(); IPath path = new Path(values[1]); IResource resource = project.findMember(path); if (resource == null) { resource = project.getFile(path); } int hashcode = ApiProblemFactory.getProblemHashcode(filterhandle); IApiProblemFilter[] filters = store.getFilters(resource); for (IApiProblemFilter filter : filters) { if (filter.getUnderlyingProblem().hashCode() == hashcode) { return filter; } } } } catch (CoreException ce) { } return null; }
return false; IApiComponent component = baseline.getApiComponent(project); if (component != null) { try {
IApiComponent apiComponent2 = apiComponent.getBaseline().getApiComponent(componentId); String name = reference.getResolvedReference().getName(); if (Util.getClassFile(new IApiComponent[] {
if (currentModel != null) { String id = currentModel.getBundleDescription().getSymbolicName(); IApiComponent comp = wbaseline.getApiComponent(id); Set<IApiComponent> apiComponentMultiple = wbaseline.getAllApiComponents(id); if (!apiComponentMultiple.isEmpty()) {
IApiComponent referenceComponent = this.referenceBaseline.getApiComponent(apiComponent.getSymbolicName()); if (referenceComponent == null) { return;
getApiBaselineManager(). getWorkspaceBaseline(). getApiComponent(res.getProject().getName()); if(comp != null) { return getApiComponentImage(comp);
IApiComponent referenceComponent = this.referenceBaseline.getApiComponent(component.getSymbolicName());