/** * Parses directory path and obtains simple form path * * @param href * directory path in format a/../c/1 or a//b/c * to /c/1 and a/b/c * @return normalized directory path, or null */ public static String normalizeDirectoryPath(String href) { if (href != null) { return new Path(href).toString(); } return null; } }
/** * Cleaning the baseValue has been done in the validator, no need to do the same as method generatePropertiesNamePatternsForEncoding() */ public static String[] generatePropertiesNamePatternsForValidation(String baseValue, String elementName) { String regex = null; if (elementName.equals(ELEMENT_RESOURCE_BUNDLE)) { baseValue = new Path(baseValue.replace(".", IPath.SEPARATOR + "")).toString(); } else if (elementName.equals(ELEMENT_PORTAL_PROPERTIES)) { baseValue = new Path(baseValue.replace(PROPERTIES_FILE_SUFFIX, "")).toString(); } else if (elementName.equals(ELEMENT_LANGUAGE_PROPERTIES)) { baseValue = new Path(baseValue.replace(PROPERTIES_FILE_SUFFIX, "")).toString(); if (baseValue.contains("*")) { regex = baseValue.replace("*", ".*"); baseValue = null; } } String[] retval = {baseValue, regex}; return retval; }
/** * Creates an {@link IApiProblem} for the given API component * * @param component * @return a new API component resolution problem or <code>null</code> */ private void createApiComponentResolutionProblem(final IApiComponent component, final String message) { IApiProblem problem = ApiProblemFactory.newApiComponentResolutionProblem(Path.EMPTY.toString(), new String[] { component.getSymbolicName(), message }, new String[] { IApiMarkerConstants.API_MARKER_ATTR_ID }, new Object[] { Integer.valueOf(IApiMarkerConstants.API_COMPONENT_RESOLUTION_MARKER_ID) }, IElementDescriptor.RESOURCE, IApiProblem.API_COMPONENT_RESOLUTION); addProblem(problem); }
/** * Checks to see if there is a default API baseline set in the workspace, if * not create a marker */ private void checkDefaultBaselineSet() { if (ignoreDefaultBaselineCheck()) { if (ApiPlugin.DEBUG_API_ANALYZER) { System.out.println("Ignoring check for default API baseline"); //$NON-NLS-1$ } return; } if (ApiPlugin.DEBUG_API_ANALYZER) { System.out.println("Checking if the default API baseline is set"); //$NON-NLS-1$ } IApiProblem problem = ApiProblemFactory.newApiBaselineProblem(Path.EMPTY.toString(), new String[] { IApiMarkerConstants.API_MARKER_ATTR_ID }, new Object[] { Integer.valueOf(IApiMarkerConstants.DEFAULT_API_BASELINE_MARKER_ID) }, IElementDescriptor.RESOURCE, IApiProblem.API_BASELINE_MISSING); addProblem(problem); }
/** * Called when a new project is found. This class is instantiated once and * then used for any project that has a bnd container associated. We create * a link between the project and the Bnd Model. A delegating container * object is created to link the project to the container so it can get its * classpath entries. Note that the container object is not stored or * remembered because we create a new one for every update (otherwise the * update is not visible for some reason) */ public void initialize(IPath containerPath, IJavaProject project) throws CoreException { // We maintain the models in the actitvator because other // parts also use the model. Unfortunately, one can only // do this with a static method :-( Project model = central.getModel(project); if (model == null) throw new CoreException( new Status(IStatus.ERROR, ID.toString(), "Can not create model, likely the project does not contain a bnd.bnd file")); // Update the Java Model so the changes become visible. // Notice the unreferenced object. requestClasspathContainerUpdate(containerPath, project, new BndContainer(model)); }
public void widgetSelected(SelectionEvent e) { ContainerSelectionDialog dialog = new ContainerSelectionDialog(container.getShell(), ResourcesPlugin.getWorkspace().getRoot(), false, "Select new file container"); dialog.showClosedProjects(false); if (dialog.open() == ContainerSelectionDialog.OK) { Object[] res = dialog.getResult(); if (res.length == 1) { result.setText(((Path) res[0]).toString()); } } } });
/** * Called when a new project is found. This class is instantiated once and * then used for any project that has a bnd container associated. We create * a link between the project and the Bnd Model. A delegating container * object is created to link the project to the container so it can get its * classpath entries. Note that the container object is not stored or * remembered because we create a new one for every update (otherwise the * update is not visible for some reason) */ public void initialize(IPath containerPath, IJavaProject project) throws CoreException { // We maintain the models in the actitvator because other // parts also use the model. Unfortunately, one can only // do this with a static method :-( Project model = central.getModel(project); if (model == null) throw new CoreException( new Status(IStatus.ERROR, ID.toString(), "Can not create model, likely the project does not contain a bnd.bnd file")); // Update the Java Model so the changes become visible. // Notice the unreferenced object. requestClasspathContainerUpdate(containerPath, project, new BndContainer(model)); }
/** * Updates the content of the Gradle classpath container asynchronously on the target project. * <p/> * This method finds the Gradle classpath container on the project and requests the content * update. * * @throws GradlePluginsRuntimeException if the classpath container update request fails * @param project the target project */ public static void requestUpdateOf(IJavaProject project) { ClasspathContainerInitializer initializer = JavaCore.getClasspathContainerInitializer(CONTAINER_PATH.toString()); try { initializer.requestClasspathContainerUpdate(CONTAINER_PATH, project, null); } catch (CoreException e) { throw new GradlePluginsRuntimeException(e); } }
String prefix = key.substring(0, key.length() - LocalMetaArea.F_TREE.length()); if (prefix.equals(Path.ROOT.toString())) continue; IProject project = workspace.getRoot().getProject(prefix);
String prefix = key.substring(0, key.length() - LocalMetaArea.F_TREE.length()); if (prefix.equals(Path.ROOT.toString())) continue; IProject project = workspace.getRoot().getProject(prefix);
/** * Sets the absolute file system path of the file this element is defined within. */ public void setFilePath(String path) { if (path == null) { return; } URL url = null; try { url = new URL(path); } catch (MalformedURLException e) { fFilePath = path; return; } try { URL fileURL = FileLocator.toFileURL(url); // To be worked in 4.6 via Bug 476266 if (IAntCoreConstants.FILE.equals(fileURL.getProtocol())) { fFilePath = new Path((URIUtil.toFile(URIUtil.toURI(fileURL))).getAbsolutePath()).toString(); } } catch (URISyntaxException e) { AntUIPlugin.log(e); } catch (IOException e) { AntUIPlugin.log(e); } }
String prefix = key.substring(0, key.length() - LocalMetaArea.F_TREE.length()); if (prefix.equals(Path.ROOT.toString())) continue; IProject project = workspace.getRoot().getProject(prefix);
/** * Checks if the setting to scan for invalid references is not set to be * ignored AND there are no descriptions installed * * @param component * @param monitor * @since 1.0.400 */ void checkEEDescriptions() { if (ignoreEEDescriptionCheck()) { if (ApiPlugin.DEBUG_API_ANALYZER) { System.out.println("Ignoring check for API EE descriptions"); //$NON-NLS-1$ } return; } if (ApiPlugin.DEBUG_API_ANALYZER) { System.out.println("Checking if there are any API EE descriptions installed if the preference is set to not be 'ignore'"); //$NON-NLS-1$ } String[] ees = StubApiComponent.getInstalledMetadata(); if (ees.length < 1) { IApiProblem problem = ApiProblemFactory.newApiUsageProblem(Path.EMPTY.toString(), null, new String[] { fJavaProject.getElementName() }, new String[] { IApiMarkerConstants.API_MARKER_ATTR_ID }, new Object[] { Integer.valueOf(IApiMarkerConstants.API_USAGE_MARKER_ID) }, -1, -1, -1, IElementDescriptor.RESOURCE, IApiProblem.MISSING_EE_DESCRIPTIONS); addProblem(problem); } }
protected void handleIncludeFile(String filename) { if (filename != null && fProcessIncludes) { IPath basePath = getModelPath(); if(basePath != null) { IPath localRoot = TaglibIndex.getContextRoot(basePath); String uri = StringUtils.strip(filename); String filePath = null; if(uri.startsWith(Path.ROOT.toString())) { filePath = localRoot.append(uri).toString(); } else { filePath = basePath.removeLastSegments(1).append(uri).toString(); } if (!getIncludes().contains(filePath) && !filePath.equals(basePath.toString())) { getIncludes().push(filePath); JSPIncludeRegionHelper helper = new JSPIncludeRegionHelper(this); helper.parse(filePath); getIncludes().pop(); } } } }
resourceBundle.replace(".", IPath.SEPARATOR + "")).toString();
Object[] result = dialog.getResult(); if(result.length == 1) { projectText.setText(((Path) result[0]).toString());
String _string = p.toString(); String _plus = (".." + _string); _xblockexpression_1 = URI.createURI(_plus);
String _string = originPath.toString(); String _plus = ("found standard path for " + _string); ClasspathUtil.logger.debug(_plus); return IterableExtensions.join(((Iterable<?>)Conversions.doWrapArray(relativePath.removeFirstSegments(3).segments())), "."); } else { String _string_1 = originPath.toString(); String _plus_1 = ("use default package for " + _string_1); ClasspathUtil.logger.debug(_plus_1);
IApiProblem problem = ApiProblemFactory.newFatalProblem(Path.EMPTY.toString(), new String[] { project.getName() }, IApiProblem.FATAL_JDT_BUILDPATH_PROBLEM); createMarkerForProblem(IApiProblem.CATEGORY_FATAL_PROBLEM, IApiMarkerConstants.FATAL_PROBLEM_MARKER, problem); return true;