public static String encodeJRELibrary(String desc, IClasspathEntry[] cpentries) { StringBuffer buf= new StringBuffer(); for (int i= 0; i < cpentries.length; i++) { IClasspathEntry entry= cpentries[i]; buf.append(encode(desc)); buf.append(' '); buf.append(entry.getEntryKind()); buf.append(' '); buf.append(encodePath(entry.getPath())); buf.append(' '); buf.append(encodePath(entry.getSourceAttachmentPath())); buf.append(' '); buf.append(encodePath(entry.getSourceAttachmentRootPath())); buf.append(' '); buf.append(entry.isExported()); buf.append(' '); } return buf.toString(); }
public static String encodeJRELibrary(String desc, IClasspathEntry[] cpentries) { StringBuilder buf= new StringBuilder(); for (int i= 0; i < cpentries.length; i++) { IClasspathEntry entry= cpentries[i]; buf.append(encode(desc)); buf.append(' '); buf.append(entry.getEntryKind()); buf.append(' '); buf.append(encodePath(entry.getPath())); buf.append(' '); buf.append(encodePath(entry.getSourceAttachmentPath())); buf.append(' '); buf.append(encodePath(entry.getSourceAttachmentRootPath())); buf.append(' '); buf.append(entry.isExported()); buf.append(' '); } return buf.toString(); }
public static String encodeJRELibrary(String desc, IClasspathEntry[] cpentries) { StringBuffer buf= new StringBuffer(); for (int i= 0; i < cpentries.length; i++) { IClasspathEntry entry= cpentries[i]; buf.append(encode(desc)); buf.append(' '); buf.append(entry.getEntryKind()); buf.append(' '); buf.append(encodePath(entry.getPath())); buf.append(' '); buf.append(encodePath(entry.getSourceAttachmentPath())); buf.append(' '); buf.append(encodePath(entry.getSourceAttachmentRootPath())); buf.append(' '); buf.append(entry.isExported()); buf.append(' '); } return buf.toString(); }
/** * @see IRuntimeClasspathEntry#getSourceAttachmentRootPath() */ @Override public IPath getSourceAttachmentRootPath() { IClasspathEntry entry = getClasspathEntry(); IPath path = entry != null ? getClasspathEntry().getSourceAttachmentRootPath() : null; if (path == null && getSourceAttachmentPath() != null) { return Path.EMPTY; } return path; }
/** * @see IRuntimeClasspathEntry#getSourceAttachmentRootPath() */ @Override public IPath getSourceAttachmentRootPath() { IClasspathEntry entry = getClasspathEntry(); IPath path = entry != null ? getClasspathEntry().getSourceAttachmentRootPath() : null; if (path == null && getSourceAttachmentPath() != null) { return Path.EMPTY; } return path; }
private void setDeletedEntryProperties(IClasspathEntry entry){ fEntryKind= entry.getEntryKind(); fPath= entry.getPath(); fSourceAttachmentPath= entry.getSourceAttachmentPath(); fSourceAttachmentRootPath= entry.getSourceAttachmentRootPath(); }
private IRuntimeClasspathEntry convertClasspathEntry(IClasspathEntry entry) { if (entry == null) return null; IPath srcPath = entry.getSourceAttachmentPath(); if (srcPath != null && srcPath.segmentCount() > 0) { IRuntimeClasspathEntry rte = JavaRuntime.newArchiveRuntimeClasspathEntry(entry.getPath()); rte.setSourceAttachmentPath(srcPath); rte.setSourceAttachmentRootPath(entry.getSourceAttachmentRootPath()); return rte; } return null; }
protected void ensureClasspathEntryIsExported(List cp, IClasspathEntry entry) { if (entry.isExported()) return; int index = getIndex(cp, entry); IClasspathEntry newEntry = null; switch (entry.getEntryKind()) { case IClasspathEntry.CPE_PROJECT : newEntry = JavaCore.newProjectEntry(entry.getPath(), true); break; case IClasspathEntry.CPE_LIBRARY : newEntry = JavaCore.newLibraryEntry(entry.getPath(), entry.getSourceAttachmentPath(), entry.getSourceAttachmentRootPath(), true); break; case IClasspathEntry.CPE_VARIABLE : newEntry = JavaCore.newVariableEntry(entry.getPath(), entry.getSourceAttachmentPath(), entry.getSourceAttachmentRootPath()); default : break; } if (entry != null) cp.set(index, newEntry); }
public void requestClasspathContainerUpdate(final IPath containerPath, final IJavaProject javaProject, final IClasspathContainer sg) throws CoreException { final String key = containerPath.toString(); final IClasspathEntry[] entries = sg.getClasspathEntries(); for (int i = 0; i < entries.length; i++) { final IClasspathEntry entry = entries[i]; final IPath srcpath = entry.getSourceAttachmentPath(); final IPath srcrootpath = entry.getSourceAttachmentRootPath(); final IClasspathAttribute[] attrs = entry.getExtraAttributes(); if (srcpath != null || attrs.length > 0) { final String eid = entry.getPath().toString(); final ClasspathDecorations dec = new ClasspathDecorations(); dec.setSourceAttachmentPath(srcpath); dec.setSourceAttachmentRootPath(srcrootpath); dec.setExtraAttributes(attrs); decorations.setDecorations(key, eid, dec); } } decorations.save(); final IClasspathContainer container = JavaCore.getClasspathContainer(containerPath, javaProject); ( (J2EEComponentClasspathContainer) container ).refresh( true ); } }
@Override protected boolean deconfigureClasspath(final IClasspathEntry[] entries, final IProgressMonitor monitor) throws CoreException { final boolean rename= fImportData.isRenameJarFile(); if (rename && !fCancelled) { final IPackageFragmentRoot root= getPackageFragmentRoot(); if (root != null) { final IClasspathEntry entry= root.getRawClasspathEntry(); for (int index= 0; index < entries.length; index++) { if (entries[index].equals(entry)) { final IPath path= getTargetPath(entries[index]); if (path != null) entries[index]= JavaCore.newLibraryEntry(path, entries[index].getSourceAttachmentPath(), entries[index].getSourceAttachmentRootPath(), entries[index].getAccessRules(), entries[index].getExtraAttributes(), entries[index].isExported()); } } } } if (!fCancelled) replaceJarFile(new SubProgressMonitor(monitor, 100, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL)); return rename; }
@Override protected boolean deconfigureClasspath(final IClasspathEntry[] entries, final IProgressMonitor monitor) throws CoreException { final boolean rename= fImportData.isRenameJarFile(); if (rename && !fCancelled) { final IPackageFragmentRoot root= getPackageFragmentRoot(); if (root != null) { final IClasspathEntry entry= root.getRawClasspathEntry(); for (int index= 0; index < entries.length; index++) { if (entries[index].equals(entry)) { final IPath path= getTargetPath(entries[index]); if (path != null) entries[index]= JavaCore.newLibraryEntry(path, entries[index].getSourceAttachmentPath(), entries[index].getSourceAttachmentRootPath(), entries[index].getAccessRules(), entries[index].getExtraAttributes(), entries[index].isExported()); } } } } if (!fCancelled) replaceJarFile(new SubProgressMonitor(monitor, 100, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL)); return rename; }
/** * Prompts source attachment. * * @see org.eclipse.jface.action.IAction#run() */ public void run() { IClasspathEntry classpathEntry = BuildPathDialogAccess.configureSourceAttachment(getShell(), fEntries[0].getClasspathEntry()); if (classpathEntry != null) { for (int i = 0; i < fEntries.length; i++) { IRuntimeClasspathEntry entry = fEntries[i]; entry.setSourceAttachmentPath(classpathEntry.getSourceAttachmentPath()); entry.setSourceAttachmentRootPath(classpathEntry.getSourceAttachmentRootPath()); getViewer().refresh(entry); } getViewer().notifyChanged(); } }
private static IClasspathEntry addAttributes(IClasspathEntry entry, IClasspathAttribute[] extraAttributes) { switch (entry.getEntryKind()) { case IClasspathEntry.CPE_LIBRARY: return JavaCore.newLibraryEntry(entry.getPath(), entry.getSourceAttachmentPath(), entry.getSourceAttachmentRootPath(), entry.getAccessRules(), extraAttributes, entry.isExported()); case IClasspathEntry.CPE_PROJECT: return JavaCore.newProjectEntry(entry.getPath(), entry.getAccessRules(), entry.combineAccessRules(), extraAttributes, entry.isExported()); case IClasspathEntry.CPE_CONTAINER: return JavaCore.newContainerEntry(entry.getPath(), entry.getAccessRules(), extraAttributes, entry.isExported()); case IClasspathEntry.CPE_VARIABLE: return JavaCore.newVariableEntry(entry.getPath(), entry.getSourceAttachmentPath(), entry.getSourceAttachmentRootPath(), entry.getAccessRules(), extraAttributes, entry.isExported()); default: return entry; // other kinds are not handled } }
private void saveClasspathEntry(IClasspathEntry entry) throws IOException { if (saveNewId(entry, this.classpathEntryIds)) { saveInt(entry.getContentKind()); saveInt(entry.getEntryKind()); savePath(entry.getPath()); savePaths(entry.getInclusionPatterns()); savePaths(entry.getExclusionPatterns()); savePath(entry.getSourceAttachmentPath()); savePath(entry.getSourceAttachmentRootPath()); savePath(entry.getOutputLocation()); this.out.writeBoolean(entry.isExported()); saveAccessRules(entry.getAccessRules()); this.out.writeBoolean(entry.combineAccessRules()); saveAttributes(entry.getExtraAttributes()); } }
private void saveClasspathEntry(IClasspathEntry entry) throws IOException { if (saveNewId(entry, this.classpathEntryIds)) { saveInt(entry.getContentKind()); saveInt(entry.getEntryKind()); savePath(entry.getPath()); savePaths(entry.getInclusionPatterns()); savePaths(entry.getExclusionPatterns()); savePath(entry.getSourceAttachmentPath()); savePath(entry.getSourceAttachmentRootPath()); savePath(entry.getOutputLocation()); this.out.writeBoolean(entry.isExported()); saveAccessRules(entry.getAccessRules()); this.out.writeBoolean(entry.combineAccessRules()); saveAttributes(entry.getExtraAttributes()); } }
private void saveClasspathEntry(IClasspathEntry entry) throws IOException { if (saveNewId(entry, this.classpathEntryIds)) { saveInt(entry.getContentKind()); saveInt(entry.getEntryKind()); savePath(entry.getPath()); savePaths(entry.getInclusionPatterns()); savePaths(entry.getExclusionPatterns()); savePath(entry.getSourceAttachmentPath()); savePath(entry.getSourceAttachmentRootPath()); savePath(entry.getOutputLocation()); this.out.writeBoolean(entry.isExported()); saveAccessRules(entry.getAccessRules()); this.out.writeBoolean(entry.combineAccessRules()); saveAttributes(entry.getExtraAttributes()); } }
private void saveClasspathEntry(IClasspathEntry entry) throws IOException { if (saveNewId(entry, this.classpathEntryIds)) { saveInt(entry.getContentKind()); saveInt(entry.getEntryKind()); savePath(entry.getPath()); savePaths(entry.getInclusionPatterns()); savePaths(entry.getExclusionPatterns()); savePath(entry.getSourceAttachmentPath()); savePath(entry.getSourceAttachmentRootPath()); savePath(entry.getOutputLocation()); this.out.writeBoolean(entry.isExported()); saveAccessRules(entry.getAccessRules()); this.out.writeBoolean(entry.combineAccessRules()); saveAttributes(entry.getExtraAttributes()); } }
private void saveClasspathEntry(IClasspathEntry entry) throws IOException { if (saveNewId(entry, this.classpathEntryIds)) { saveInt(entry.getContentKind()); saveInt(entry.getEntryKind()); savePath(entry.getPath()); savePaths(entry.getInclusionPatterns()); savePaths(entry.getExclusionPatterns()); savePath(entry.getSourceAttachmentPath()); savePath(entry.getSourceAttachmentRootPath()); savePath(entry.getOutputLocation()); this.out.writeBoolean(entry.isExported()); saveAccessRules(entry.getAccessRules()); this.out.writeBoolean(entry.combineAccessRules()); saveAttributes(entry.getExtraAttributes()); } }
private void saveClasspathEntry(IClasspathEntry entry) throws IOException { if (saveNewId(entry, this.classpathEntryIds)) { saveInt(entry.getContentKind()); saveInt(entry.getEntryKind()); savePath(entry.getPath()); savePaths(entry.getInclusionPatterns()); savePaths(entry.getExclusionPatterns()); savePath(entry.getSourceAttachmentPath()); savePath(entry.getSourceAttachmentRootPath()); savePath(entry.getOutputLocation()); this.out.writeBoolean(entry.isExported()); saveAccessRules(entry.getAccessRules()); this.out.writeBoolean(entry.combineAccessRules()); saveAttributes(entry.getExtraAttributes()); } }
private IClasspathEntry addAttributes(IClasspathEntry entry, IClasspathAttribute[] extraAttributes) { switch (entry.getEntryKind()) { case IClasspathEntry.CPE_CONTAINER: return JavaCore.newContainerEntry(entry.getPath(), entry.getAccessRules(), extraAttributes, entry.isExported()); case IClasspathEntry.CPE_LIBRARY: return JavaCore.newLibraryEntry(entry.getPath(), entry.getSourceAttachmentPath(), entry.getSourceAttachmentRootPath(), entry.getAccessRules(), extraAttributes, entry.isExported()); case IClasspathEntry.CPE_PROJECT: return JavaCore.newProjectEntry(entry.getPath(), entry.getAccessRules(), entry.combineAccessRules(), extraAttributes, entry.isExported()); default: return entry; // other kinds are not handled } }