public Properties getProductTranslation() { initValues(); URL transURL = null; if (customizationValue != null) transURL = FileLocator.find(customizationBundle, NL_DIR.append(customizationValue).removeFileExtension().addFileExtension(PROPERTIES_FILE_EXTENSION), null); if (transURL == null && InternalPlatform.DEBUG_PLUGIN_PREFERENCES) InternalPlatform.message("No preference translations found for product/file: " + customizationBundle.getSymbolicName() + '/' + customizationValue); //$NON-NLS-1$ return loadProperties(transURL); }
/** * Private constructor to enforce singleton usage. */ private PerformanceStatsProcessor() { super("Performance Stats"); //$NON-NLS-1$ setSystem(true); setPriority(DECORATE); BundleContext context = PlatformActivator.getContext(); String filter = '(' + FrameworkLog.SERVICE_PERFORMANCE + '=' + Boolean.TRUE.toString() + ')'; Collection<ServiceReference<FrameworkLog>> references; FrameworkLog perfLog = null; try { references = context.getServiceReferences(FrameworkLog.class, filter); if (references != null && !references.isEmpty()) { //just take the first matching service perfLog = context.getService(references.iterator().next()); //make sure correct location is set IPath logLocation = Platform.getLogFileLocation(); logLocation = logLocation.removeLastSegments(1).append("performance.log"); //$NON-NLS-1$ perfLog.setFile(logLocation.toFile(), false); } } catch (Exception e) { IStatus error = new Status(IStatus.ERROR, Platform.PI_RUNTIME, 1, "Error loading performance log", e); //$NON-NLS-1$ InternalPlatform.getDefault().log(error); } //use the platform log if we couldn't create the performance log if (perfLog == null) perfLog = InternalPlatform.getDefault().getFrameworkLog(); log = perfLog; }
public IPath getPreferenceLocation(String bundleName, boolean create) throws IllegalStateException { IPath result = getStateLocation(bundleName); if (create) result.toFile().mkdirs(); return result.append(PREFERENCES_FILE_NAME); }
public char[][] fullInclusionPatternChars() { if (this.fullInclusionPatternChars == UNINIT_PATTERNS) { int length = this.inclusionPatterns.length; this.fullInclusionPatternChars = new char[length][]; IPath prefixPath = this.path.removeTrailingSeparator(); for (int i = 0; i < length; i++) { this.fullInclusionPatternChars[i] = prefixPath.append(this.inclusionPatterns[i]).toString().toCharArray(); } } return this.fullInclusionPatternChars; }
public char[][] fullExclusionPatternChars() { if (this.fullExclusionPatternChars == UNINIT_PATTERNS) { int length = this.exclusionPatterns.length; this.fullExclusionPatternChars = new char[length][]; IPath prefixPath = this.path.removeTrailingSeparator(); for (int i = 0; i < length; i++) { this.fullExclusionPatternChars[i] = prefixPath.append(this.exclusionPatterns[i]).toString().toCharArray(); } } return this.fullExclusionPatternChars; }
@Override public Optional<IProjectDescription> findProjectDescriptor(File location, IProgressMonitor monitor) { IPath descriptorLocation = Path.fromOSString(location.getPath()).append(".project"); IWorkspace workspace = ResourcesPlugin.getWorkspace(); try { IProjectDescription projectDescription = workspace.loadProjectDescription(descriptorLocation); return Optional.of(projectDescription); } catch (CoreException e) { return Optional.absent(); } }
private static File getTemplateFile() { IPath path= JavaPlugin.getDefault().getStateLocation(); path= path.append(TEMPLATE_FILE); return path.toFile(); }
private SourceFolderUpdater(IJavaProject project, List<EclipseSourceDirectory> sourceDirectories) { this.project = Preconditions.checkNotNull(project); this.sourceFoldersByPath = Maps.newLinkedHashMap(); for (EclipseSourceDirectory sourceFolder : sourceDirectories) { IPath fullPath = project.getProject().getFullPath().append(sourceFolder.getPath()); this.sourceFoldersByPath.put(fullPath, sourceFolder); } }
public IPath removeFileExtension() { String extension = getFileExtension(); if (extension == null || extension.equals("")) { //$NON-NLS-1$ return this; } String lastSegment = lastSegment(); int index = lastSegment.lastIndexOf(extension) - 1; return removeLastSegments(1).append(lastSegment.substring(0, index)); }
/** * Get the java output folder for the receiver, in the form of /project/ <output folder> * * @return java.lang.String */ public String getFullJavaOutputPath() { return Path.ROOT.append(getProjectPath()).append(getJavaOutputPath()).toString(); }
private IFolder computeTargetFolder(IPackageFragment rootPackage, RenameArguments args, IPackageFragment pack) { IPath path= pack.getParent().getPath(); path= path.append(getNewPackageName(rootPackage, args.getNewName(), pack.getElementName()).replace('.', IPath.SEPARATOR)); IFolder target= ResourcesPlugin.getWorkspace().getRoot().getFolder(path); return target; }
@Override public int visit(Entry sourceEntry) { IPath destinationPath = destination.append(sourceEntry.getPath().removeFirstSegments(source.segmentCount())); HistoryEntry destinationEntry = new HistoryEntry(destinationPath, (HistoryEntry) sourceEntry); // we may be copying to the same source bucket, collect to make change effective later // since we cannot make changes to it while iterating changes.add(destinationEntry); return CONTINUE; } }
@Override public int visit(Entry entry) { PropertyEntry sourceEntry = (PropertyEntry) entry; IPath destinationPath = destination.append(sourceEntry.getPath().removeFirstSegments(source.segmentCount())); PropertyEntry destinationEntry = new PropertyEntry(destinationPath, sourceEntry); changes.add(destinationEntry); return CONTINUE; } }
private String getDefaultLocation() { IPath path = getRootLocation(); String projectName = (String) getProperty(PROJECT_NAME); if (projectName != null) path = path.append(projectName); return path.toOSString(); }
public UnpackJarBuilder(JarPackageData jarPackage) { fSubfolder= jarPackage.getAbsoluteJarLocation().removeFileExtension().lastSegment() + SUBFOLDER_SUFFIX; fSubfolderPath= jarPackage.getAbsoluteJarLocation().removeLastSegments(1).append(fSubfolder); fJarPackage= jarPackage; }
public void addCopyDelta(IResource copy, CopyArguments arguments) { if (fIgnoreCount == 0) { IPath destination= ((IResource)arguments.getDestination()).getFullPath().append(copy.getName()); internalAdd(new CopyDescription(copy, destination)); } }
@Override public IPath getPath() { PackageFragmentRoot root = getPackageFragmentRoot(); if (root.isArchive()) { return root.getPath(); } else { return getParent().getPath().append(getElementName()); } }
private static void convertCUResourceChange(WorkspaceEdit edit, RenameCompilationUnitChange cuChange) { ICompilationUnit modifiedCU = (ICompilationUnit) cuChange.getModifiedElement(); RenameFile rf = new RenameFile(); String newCUName = cuChange.getNewName(); IPath currentPath = modifiedCU.getResource().getLocation(); rf.setOldUri(ResourceUtils.fixURI(modifiedCU.getResource().getRawLocationURI())); IPath newPath = currentPath.removeLastSegments(1).append(newCUName); rf.setNewUri(ResourceUtils.fixURI(newPath.toFile().toURI())); edit.getDocumentChanges().add(Either.forRight(rf)); }
public IPath getPath() { PackageFragmentRoot root = getPackageFragmentRoot(); if (root.isArchive()) { return root.getPath(); } else { return getParent().getPath().append(getElementName()); } }
/** * Creates a child node for a location in the file system. Does nothing and returns null if the location does not correspond to a valid file/folder. */ protected UnifiedTreeNode createChildNodeFromFileSystem(UnifiedTreeNode parent, IFileInfo info) { IPath childPath = parent.getResource().getFullPath().append(info.getName()); int type = info.isDirectory() ? IResource.FOLDER : IResource.FILE; IResource target = getWorkspace().newResource(childPath, type); return createNode(target, null, info, target.exists()); }