use of org.eclipse.jdt.core.IClasspathEntry in project che by eclipse.
the class JavaProject method areClasspathsEqual.
/**
* Compare current classpath with given one to see if any different.
* Note that the argument classpath contains its binary output.
* @param newClasspath IClasspathEntry[]
* @param newOutputLocation IPath
* @param otherClasspathWithOutput IClasspathEntry[]
* @return boolean
*/
private static boolean areClasspathsEqual(IClasspathEntry[] newClasspath, IPath newOutputLocation, IClasspathEntry[] otherClasspathWithOutput) {
if (otherClasspathWithOutput == null || otherClasspathWithOutput.length == 0)
return false;
int length = otherClasspathWithOutput.length;
if (length != newClasspath.length + 1)
// output is amongst file entries (last one)
return false;
// compare classpath entries
for (int i = 0; i < length - 1; i++) {
if (!otherClasspathWithOutput[i].equals(newClasspath[i]))
return false;
}
// compare binary outputs
IClasspathEntry output = otherClasspathWithOutput[length - 1];
if (output.getContentKind() != ClasspathEntry.K_OUTPUT || !output.getPath().equals(newOutputLocation))
return false;
return true;
}
use of org.eclipse.jdt.core.IClasspathEntry in project che by eclipse.
the class SetContainerOperation method verbose_set_container.
private void verbose_set_container() {
Util.verbose(//$NON-NLS-1$
"CPContainer SET - setting container\n" + " container path: " + this.containerPath + //$NON-NLS-1$
'\n' + //$NON-NLS-1$
" projects: {" + org.eclipse.jdt.internal.compiler.util.Util.toString(this.affectedProjects, new org.eclipse.jdt.internal.compiler.util.Util.Displayable() {
public String displayString(Object o) {
return ((IJavaProject) o).getElementName();
}
}) + //$NON-NLS-1$
"}\n values: {\n" + org.eclipse.jdt.internal.compiler.util.Util.toString(this.respectiveContainers, new org.eclipse.jdt.internal.compiler.util.Util.Displayable() {
public String displayString(Object o) {
//$NON-NLS-1$
StringBuffer buffer = new StringBuffer(" ");
if (o == null) {
//$NON-NLS-1$
buffer.append("<null>");
return buffer.toString();
}
IClasspathContainer container = (IClasspathContainer) o;
buffer.append(container.getDescription());
//$NON-NLS-1$
buffer.append(" {\n");
IClasspathEntry[] entries = container.getClasspathEntries();
if (entries != null) {
for (int i = 0; i < entries.length; i++) {
//$NON-NLS-1$
buffer.append(" ");
buffer.append(entries[i]);
buffer.append('\n');
}
}
//$NON-NLS-1$
buffer.append(" }");
return buffer.toString();
}
}) + //$NON-NLS-1$
"\n }");
}
use of org.eclipse.jdt.core.IClasspathEntry in project tdi-studio-se by Talend.
the class ComponentProjectManager method initializeClasspath.
/**
* DOC ycbai Initialize classpath of project.
*
* @param project
* @param monitor
* @throws OperationCanceledException
* @throws CoreException
*/
private void initializeClasspath(IJavaProject project, IProgressMonitor monitor) throws OperationCanceledException, CoreException {
if (monitor != null && monitor.isCanceled()) {
throw new OperationCanceledException();
}
if (project == null)
return;
IClasspathEntry[] entries = null;
List<IClasspathEntry> cpEntries = new ArrayList<IClasspathEntry>();
cpEntries.addAll(Arrays.asList(getDefaultJREClasspathEntries()));
cpEntries.addAll(getDefaultUtilClasspathEntries());
entries = (IClasspathEntry[]) cpEntries.toArray(new IClasspathEntry[cpEntries.size()]);
if (monitor != null)
monitor.worked(1);
IPath output = getOutputLocation();
IProgressMonitor subProgressMonitor = monitor == null ? new NullProgressMonitor() : new SubProgressMonitor(monitor, 2);
project.setRawClasspath(entries, output, subProgressMonitor);
}
use of org.eclipse.jdt.core.IClasspathEntry in project tdi-studio-se by Talend.
the class TalendJetEmitter method getClasspathStr.
/**
* DOC ycbai Comment method "getClasspathStr".
* <p>
* Get character string of classpath with separator.
*
* @return
*/
private String getClasspathStr() {
StringBuffer cps = new StringBuffer();
String classPathSeparator = JavaUtils.JAVA_CLASSPATH_SEPARATOR;
List<IClasspathEntry> cpes = getClasspathEntries();
for (IClasspathEntry cpe : cpes) {
String classpath = getClasspathFromEntry(cpe);
cps.append(classpath).append(classPathSeparator);
}
if (cps.length() > 0) {
cps.deleteCharAt(cps.length() - 1);
}
return cps.toString();
}
use of org.eclipse.jdt.core.IClasspathEntry in project AutoRefactor by JnRouvignac.
the class JavaCoreHelper method addSourceContainer.
private static IPackageFragmentRoot addSourceContainer(IJavaProject javaProject, String containerName) throws Exception {
final IProject project = javaProject.getProject();
final IFolder folder = project.getFolder(containerName);
createFolder(folder);
IPackageFragmentRoot root = javaProject.getPackageFragmentRoot(folder);
IClasspathEntry cpe = JavaCore.newSourceEntry(root.getPath(), EMPTY_PATHS, EMPTY_PATHS, null);
addToClasspath(javaProject, Arrays.asList(cpe));
return root;
}
Aggregations