Java Examples for org.eclipse.core.runtime.IPath
The following java examples will help you to understand the usage of org.eclipse.core.runtime.IPath. These source code samples are taken from different open source projects.
Example 1
Project: XFlow-master File: CoreClasspathContainerInitializer.java View source code |
/** * @see org.eclipse.jdt.core.ClasspathContainerInitializer#initialize(org.eclipse.core.runtime.IPath, * org.eclipse.jdt.core.IJavaProject) */ public void initialize(IPath containerPath, IJavaProject project) throws CoreException { int size = containerPath.segmentCount(); if (size > 0) { if (containerPath.segment(0).equals("KENOAH_CORELIB")) { CoreClasspathContainer container = new CoreClasspathContainer(containerPath); JavaCore.setClasspathContainer(containerPath, new IJavaProject[] { project }, new IClasspathContainer[] { container }, null); } } }
Example 2
Project: jop-master File: JOPDirectoryValidator.java View source code |
public static boolean isValid(IPath path) {
File f = path.toFile();
if (!f.exists() || !f.isDirectory()) {
return false;
}
File[] children = f.listFiles();
if (children == null) {
return false;
}
for (File c : children) {
if (c.getName().equals("build.xml")) {
return true;
}
}
return false;
}
Example 3
Project: hifivetools-master File: UserLibraryJsGlobalScopeContainerInitializer.java View source code |
/* (non-Javadoc) * @see org.eclipse.wst.jsdt.core.JsGlobalScopeContainerInitializer#initialize(org.eclipse.core.runtime.IPath, org.eclipse.wst.jsdt.core.IJavaScriptProject) */ public void initialize(IPath containerPath, IJavaScriptProject project) throws CoreException { if (isUserLibraryContainer(containerPath)) { String userLibName = containerPath.segment(1); UserLibrary entries = UserLibraryManager.getUserLibrary(userLibName); if (entries != null) { UserLibraryJsGlobalScopeContainer container = new UserLibraryJsGlobalScopeContainer(userLibName); JavaScriptCore.setJsGlobalScopeContainer(containerPath, new IJavaScriptProject[] { project }, new IJsGlobalScopeContainer[] { container }, null); } } }
Example 4
Project: cdt-master File: XCOFF32Parser.java View source code |
/* * (non-Javadoc) * * @see org.eclipse.cdt.core.IBinaryParser#getBinary(byte[], * org.eclipse.core.runtime.IPath) */ @Override public IBinaryFile getBinary(byte[] hints, IPath path) throws IOException { if (path == null) { //$NON-NLS-1$ throw new IOException(CCorePlugin.getResourceString("Util.exception.nullPath")); } IBinaryFile binary = null; try { XCoff32.Attribute attribute = null; if (hints != null && hints.length > 0) { try { attribute = XCoff32.getAttributes(hints); } catch (EOFException eof) { } } //Take a second run at it if the data array failed. if (attribute == null) { attribute = XCoff32.getAttributes(path.toOSString()); } if (attribute != null) { switch(attribute.getType()) { case XCoff32.Attribute.XCOFF_TYPE_EXE: binary = createBinaryExecutable(path); break; case XCoff32.Attribute.XCOFF_TYPE_SHLIB: binary = createBinaryShared(path); break; case XCoff32.Attribute.XCOFF_TYPE_OBJ: binary = createBinaryObject(path); break; case XCoff32.Attribute.XCOFF_TYPE_CORE: binary = createBinaryCore(path); break; } } } catch (IOException e) { binary = createBinaryArchive(path); } return binary; }
Example 5
Project: cdt-tests-runner-master File: XCOFF32Parser.java View source code |
/* * (non-Javadoc) * * @see org.eclipse.cdt.core.IBinaryParser#getBinary(byte[], * org.eclipse.core.runtime.IPath) */ public IBinaryFile getBinary(byte[] hints, IPath path) throws IOException { if (path == null) { //$NON-NLS-1$ throw new IOException(CCorePlugin.getResourceString("Util.exception.nullPath")); } IBinaryFile binary = null; try { XCoff32.Attribute attribute = null; if (hints != null && hints.length > 0) { try { attribute = XCoff32.getAttributes(hints); } catch (EOFException eof) { } } //Take a second run at it if the data array failed. if (attribute == null) { attribute = XCoff32.getAttributes(path.toOSString()); } if (attribute != null) { switch(attribute.getType()) { case XCoff32.Attribute.XCOFF_TYPE_EXE: binary = createBinaryExecutable(path); break; case XCoff32.Attribute.XCOFF_TYPE_SHLIB: binary = createBinaryShared(path); break; case XCoff32.Attribute.XCOFF_TYPE_OBJ: binary = createBinaryObject(path); break; case XCoff32.Attribute.XCOFF_TYPE_CORE: binary = createBinaryCore(path); break; } } } catch (IOException e) { binary = createBinaryArchive(path); } return binary; }
Example 6
Project: eclipse3-master File: StructuredResourceMarkerAnnotationModelFactory.java View source code |
/* * @see * org.eclipse.core.filebuffers.IAnnotationModelFactory#createAnnotationModel(org.eclipse.core * .runtime.IPath) */ public IAnnotationModel createAnnotationModel(IPath location) { IAnnotationModel model = null; IFile file = FileBuffers.getWorkspaceFileAtLocation(location); if (file != null) { model = new StructuredResourceMarkerAnnotationModel(file); } else { model = new StructuredResourceMarkerAnnotationModel(ResourcesPlugin.getWorkspace().getRoot(), location.toString()); } return model; }
Example 7
Project: webtools.sourceediting-master File: StructuredResourceMarkerAnnotationModelFactory.java View source code |
/* * @see org.eclipse.core.filebuffers.IAnnotationModelFactory#createAnnotationModel(org.eclipse.core.runtime.IPath) */ public IAnnotationModel createAnnotationModel(IPath location) { IAnnotationModel model = null; IFile file = FileBuffers.getWorkspaceFileAtLocation(location); if (file != null) { model = new StructuredResourceMarkerAnnotationModel(file); } else { model = new StructuredResourceMarkerAnnotationModel(ResourcesPlugin.getWorkspace().getRoot(), location.toString()); } return model; }
Example 8
Project: antlr4ide-master File: OutputOptionTest.java View source code |
@Test public void newOutputOption() { IPath absolutePath = Path.fromOSString("absolutePath"); IPath relativePath = Path.fromOSString("relativePath"); String packageName = "org.demo"; OutputOption option = new OutputOption(absolutePath, relativePath, packageName); assertEquals(absolutePath, option.getAbsolute()); assertEquals(relativePath, option.getRelative()); assertEquals(packageName, option.getPackageName()); }
Example 9
Project: extFM-Tooling-master File: MtextAnnotationModelFactory.java View source code |
public org.eclipse.jface.text.source.IAnnotationModel createAnnotationModel(org.eclipse.core.runtime.IPath location) {
org.eclipse.core.resources.IWorkspace workspace = org.eclipse.core.resources.ResourcesPlugin.getWorkspace();
org.eclipse.core.resources.IWorkspaceRoot root = workspace.getRoot();
org.eclipse.core.resources.IResource resource = root.findMember(location);
return new org.feature.multi.perspective.mapping.viewmapping.resource.mtext.ui.MtextAnnotationModel(resource);
}
Example 10
Project: k3-master File: RobotAnnotationModelFactory.java View source code |
public org.eclipse.jface.text.source.IAnnotationModel createAnnotationModel(org.eclipse.core.runtime.IPath location) {
org.eclipse.core.resources.IWorkspace workspace = org.eclipse.core.resources.ResourcesPlugin.getWorkspace();
org.eclipse.core.resources.IWorkspaceRoot root = workspace.getRoot();
org.eclipse.core.resources.IResource resource = root.findMember(location);
return new robot.resource.robot.ui.RobotAnnotationModel(resource);
}
Example 11
Project: radrails-master File: RailsConsoleLine.java View source code |
protected void makeRelativeToWorkspace(IProject launchedProject) {
try {
if (fFilename == null || fFilename.trim().length() == 0)
return;
String filename = fFilename;
if (fFilename.startsWith("./")) {
filename = fFilename.substring(1);
} else {
filename = '/' + fFilename;
}
IFile file = launchedProject.getFile(filename);
if (!file.exists()) {
IPath railsRoot = RailsPlugin.findRailsRoot(launchedProject);
file = launchedProject.getFile(railsRoot.append(filename));
}
fFilename = file.getFullPath().toPortableString();
} catch (RuntimeException e) {
}
}
Example 12
Project: ttc2011-master File: SslAnnotationModelFactory.java View source code |
public org.eclipse.jface.text.source.IAnnotationModel createAnnotationModel(org.eclipse.core.runtime.IPath location) {
org.eclipse.core.resources.IWorkspace workspace = org.eclipse.core.resources.ResourcesPlugin.getWorkspace();
org.eclipse.core.resources.IWorkspaceRoot root = workspace.getRoot();
org.eclipse.core.resources.IResource resource = root.findMember(location);
return new ssl.resource.ssl.ui.SslAnnotationModel(resource);
}
Example 13
Project: tdq-studio-se-master File: TOPImportHandler.java View source code |
/* * (non-Javadoc) . * * @see * org.talend.repository.items.importexport.handlers.imports.ImportBasicHandler#computeItemRecord(org.talend.repository * .items.importexport.manager.ResourcesManager, org.eclipse.core.runtime.IPath) */ @Override public ImportItem computeImportItem(ResourcesManager resManager, IPath path) { ImportItem itemRecord = new ImportItem(path); // Load the DQ specific resource such as patterns and rules. // Load resource only super.loadResource(resManager, itemRecord); IPath propertyPath = path.removeFileExtension().addFileExtension(FileConstants.PROPERTIES_EXTENSION); ResourceSet resSet = itemRecord.getResourceSet(); itemRecord = new ImportItem(propertyPath); itemRecord.setResourceSet(resSet); // Load property resource. super.computeProperty(resManager, itemRecord); Item item = itemRecord.getItem(); // only resolveAll EMF-Model items. if (item != null && !(item instanceof FileItem)) { EcoreUtil.resolveAll(itemRecord.getResourceSet()); } return itemRecord; }
Example 14
Project: CodingSpectator-master File: CodingSpectatorRefactoringHistoryCapturer.java View source code |
private void transferCodingSpectatorRefactoringHistory() {
try {
IPath codingspectatorRefactoringHistoryPath = RefactoringHistorySerializer.getCodingSpectatorRefactoringHistoryFolder();
EFSFile codingspectatorRefactoringHistory = new EFSFile(codingspectatorRefactoringHistoryPath);
EFSFile destinationInWatchedFolder = new EFSFile(CodingSpectatorDataPlugin.getStorageLocation());
if (codingspectatorRefactoringHistory.exists()) {
codingspectatorRefactoringHistory.copyTo(destinationInWatchedFolder);
}
} catch (CoreException e) {
Activator.getDefault().getLog().log(new Status(IStatus.WARNING, Activator.PLUGIN_ID, "Failed to transfer CodingSpectator data.", e));
}
}
Example 15
Project: Eclipse-Postfix-Code-Completion-master File: UserLibraryClasspathContainerInitializer.java View source code |
public void initialize(IPath containerPath, IJavaProject project) throws CoreException {
if (isUserLibraryContainer(containerPath)) {
String userLibName = containerPath.segment(1);
UserLibrary userLibrary = JavaModelManager.getUserLibraryManager().getUserLibrary(userLibName);
if (userLibrary != null) {
UserLibraryClasspathContainer container = new UserLibraryClasspathContainer(userLibName);
JavaCore.setClasspathContainer(containerPath, new IJavaProject[] { project }, new IClasspathContainer[] { container }, null);
} else if (JavaModelManager.CP_RESOLVE_VERBOSE || JavaModelManager.CP_RESOLVE_VERBOSE_FAILURE) {
verbose_no_user_library_found(project, userLibName);
}
} else if (JavaModelManager.CP_RESOLVE_VERBOSE || JavaModelManager.CP_RESOLVE_VERBOSE_FAILURE) {
verbose_not_a_user_library(project, containerPath);
}
}
Example 16
Project: eclipse.jdt.core-master File: ListenerTests.java View source code |
public void testListenerCalled() throws Exception {
clearProcessorResult(ListenerProcessor.class);
IProject project = env.getProject(getProjectName());
IPath srcRoot = getSourcePath();
String code = "package test;" + "\n" + "import org.eclipse.jdt.apt.tests.annotations.listener.ListenerAnnotation;" + "\n" + "@ListenerAnnotation" + "\n" + "public class Test" + "\n" + "{" + "\n" + "}";
env.addClass(srcRoot, "test", "Test", code);
fullBuild(project.getFullPath());
expectingNoProblems();
checkProcessorResult(ListenerProcessor.class);
}
Example 17
Project: eclipse.jdt.debug-master File: VMInstallTestsLibraryLocationResolver.java View source code |
/* * (non-Javadoc) * * @see org.eclipse.jdt.launching.ILibraryLocationResolver#getJavadocLocation(org.eclipse.core.runtime.IPath) */ @Override public URL getJavadocLocation(IPath libraryPath) { if (applies(libraryPath)) { File file = JavaTestPlugin.getDefault().getFileInPlugin(new Path("testresources/test_resolver_javadoc.zip")); if (file.isFile()) { try { return URIUtil.toURL(file.toURI()); } catch (MalformedURLException e) { e.printStackTrace(); } } } return null; }
Example 18
Project: groovy-eclipse-master File: UserLibraryClasspathContainerInitializer.java View source code |
public void initialize(IPath containerPath, IJavaProject project) throws CoreException {
if (isUserLibraryContainer(containerPath)) {
String userLibName = containerPath.segment(1);
UserLibrary userLibrary = JavaModelManager.getUserLibraryManager().getUserLibrary(userLibName);
if (userLibrary != null) {
UserLibraryClasspathContainer container = new UserLibraryClasspathContainer(userLibName);
JavaCore.setClasspathContainer(containerPath, new IJavaProject[] { project }, new IClasspathContainer[] { container }, null);
} else if (JavaModelManager.CP_RESOLVE_VERBOSE || JavaModelManager.CP_RESOLVE_VERBOSE_FAILURE) {
verbose_no_user_library_found(project, userLibName);
}
} else if (JavaModelManager.CP_RESOLVE_VERBOSE || JavaModelManager.CP_RESOLVE_VERBOSE_FAILURE) {
verbose_not_a_user_library(project, containerPath);
}
}
Example 19
Project: petals-studio-master File: PetalsHandler3x.java View source code |
/* (non-Javadoc) * @see com.ebmwebsourcing.petals.server.handlers.IPetalsVersionHandler * #getRuntimeClasspath(org.eclipse.core.runtime.IPath) */ public List<File> getRuntimeClasspath(IPath installPath) { File folder = installPath.append("lib").toFile(); if (!folder.exists() || !folder.isDirectory()) return Collections.emptyList(); List<File> result = new ArrayList<File>(); FilenameFilter filter = new FilenameFilter() { public boolean accept(File dir, String name) { return name.endsWith(".zip") || name.endsWith(".jar"); } }; for (File f : folder.listFiles(filter)) result.add(f); return result; }
Example 20
Project: webtools.jsf-master File: JSFLibrariesContainerInitializer.java View source code |
/* (non-Javadoc) * @see org.eclipse.jdt.core.ClasspathContainerInitializer#initialize(org.eclipse.core.runtime.IPath, org.eclipse.jdt.core.IJavaProject) */ public void initialize(IPath containerPath, IJavaProject project) throws CoreException { if (isJSFLibraryContainer(containerPath)) { String libId = containerPath.lastSegment(); JSFLibrary ref = JSFLibraryRegistryUtil.getInstance().getJSFLibraryRegistry().getJSFLibraryByID(libId); if (ref != null) { JSFLibraryClasspathContainer container = new JSFLibraryClasspathContainer(ref); JavaCore.setClasspathContainer(containerPath, new IJavaProject[] { project }, new IClasspathContainer[] { container }, null); } } }
Example 21
Project: eclipse-buildroot-toolchain-plugin-master File: DefaultGCCDependencyCalculator3.java View source code |
/* * (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator2#postProcessDependencyFile(org.eclipse.core.runtime.IPath, org.eclipse.cdt.managedbuilder.core.IConfiguration, org.eclipse.cdt.managedbuilder.core.ITool, org.eclipse.core.runtime.IPath) */ @Override public boolean postProcessDependencyFile(IPath dependencyFile, IConfiguration buildContext, ITool tool, IPath topBuildDirectory) { try { IWorkspaceRoot root = CCorePlugin.getWorkspace().getRoot(); IFile makefile; IPath makefilePath; if (dependencyFile.isAbsolute()) { makefilePath = dependencyFile; } else { makefilePath = topBuildDirectory.append(dependencyFile); } IPath rootPath = root.getLocation(); if (rootPath.isPrefixOf(makefilePath)) { makefilePath = makefilePath.removeFirstSegments(rootPath.segmentCount()); } makefile = root.getFile(makefilePath); IResourceInfo rcInfo = tool.getParentResourceInfo(); if (rcInfo != null) return GnuMakefileGenerator.populateDummyTargets(rcInfo, makefile, false); return GnuMakefileGenerator.populateDummyTargets(buildContext, makefile, false); } catch (CoreException e) { } catch (IOException e) { } return false; }
Example 22
Project: windowtester-master File: ClasspathContainerInitializer.java View source code |
/** * Binds a classpath container to a <code>IClasspathContainer</code> for a given * project, or silently fails if unable to do so. * * @see org.eclipse.jdt.core.ClasspathContainerInitializer#initialize(org.eclipse.core.runtime.IPath, * org.eclipse.jdt.core.IJavaProject) */ public void initialize(IPath containerPath, IJavaProject project) throws CoreException { Path path = new Path(BuildPathUtil.CLASSPATH_CONTAINER_ID); IClasspathEntry[] entries = BuildPathUtil.getRuntimeClasspathEntries(project); JavaCore.setClasspathContainer(path, new IJavaProject[] { project }, new IClasspathContainer[] { new RuntimeClasspathContainer(entries, path) }, null); }
Example 23
Project: ceylon-ide-eclipse-master File: CeylonLanguageModuleInitializer.java View source code |
/** * @see ClasspathContainerInitializer#initialize(IPath, IJavaProject) */ public void initialize(IPath containerPath, IJavaProject project) throws CoreException { int size = containerPath.segmentCount(); if (size > 0) { if (containerPath.segment(0).equals(CeylonLanguageModuleContainer.CONTAINER_ID)) { CeylonLanguageModuleContainer container = new CeylonLanguageModuleContainer(project.getProject()); JavaCore.setClasspathContainer(containerPath, new IJavaProject[] { project }, new IClasspathContainer[] { container }, null); } } }
Example 24
Project: andykunin-master File: WorkspaceAppender.java View source code |
/*
* (non-Javadoc)
*
* @see org.apache.log4j.FileAppender#activateOptions()
*/
public void activateOptions() {
IPath logPath = Platform.getStateLocation(Platform.getBundle("org.apache.log4j"));
logPath = logPath.removeLastSegments(2);
logPath = logPath.append(".log4j");
logPath = logPath.makeAbsolute();
String sPath = logPath.toString();
setFile(sPath);
super.activateOptions();
}
Example 25
Project: c4jplugin-master File: C4JRuntimeContainerInitializer.java View source code |
public void initialize(IPath containerPath, IJavaProject project) throws CoreException {
int size = containerPath.segmentCount();
if (size > 0) {
if (containerPath.segment(0).equals(C4JRuntime.C4JRT_CONTAINER)) {
C4JRuntimeContainer container = new C4JRuntimeContainer();
JavaCore.setClasspathContainer(containerPath, new IJavaProject[] { project }, new IClasspathContainer[] { container }, null);
}
}
}
Example 26
Project: CopyTo-master File: AdapterFactory.java View source code |
@SuppressWarnings("rawtypes")
public Object getAdapter(final Object adaptableObject, final Class adapterType) {
if (adapterType == Copyable.class && adaptableObject instanceof IResource) {
final IPath location = ((IResource) adaptableObject).getLocation();
if (location != null) {
try {
return new ResourceCopyable(adaptableObject, location);
} catch (final CoreException e) {
}
}
}
return null;
}
Example 27
Project: Core-Plugin-master File: ComposerNamespaceResolver.java View source code |
@Override
public String resolve(IScriptFolder container) {
if (Platform.getBundle("org.eclipse.php.composer.core") != null) {
IComposerProject project = ComposerPlugin.getDefault().getComposerProject(container.getScriptProject());
IPath path = container.getPath().makeRelativeTo(project.getFullPath());
return project.getNamespace(path);
}
return null;
}
Example 28
Project: Eclipse-Markdown-Editor-Plugin-Backup-master File: ExportHTMLAction.java View source code |
@Override
public void run() {
IEditorPart ed = ActionBarContributor.getActiveEditor();
if (!(ed instanceof MarkdownEditor)) {
return;
}
MarkdownEditor editor = (MarkdownEditor) ed;
IEditorInput i = editor.getEditorInput();
if (i instanceof IPathEditorInput) {
IPathEditorInput input = (IPathEditorInput) i;
IPath path = input.getPath();
path = path.removeFileExtension();
path = path.addFileExtension("html");
File file = path.toFile();
String html = editor.getMarkdownPage().html();
FileUtils.write(file, html);
}
}
Example 29
Project: Eclipse-Markdown-Editor-Plugin-master File: ExportHTMLAction.java View source code |
@Override
public void run() {
IEditorPart ed = ActionBarContributor.getActiveEditor();
if (!(ed instanceof MarkdownEditor)) {
return;
}
MarkdownEditor editor = (MarkdownEditor) ed;
IEditorInput i = editor.getEditorInput();
if (i instanceof IPathEditorInput) {
IPathEditorInput input = (IPathEditorInput) i;
IPath path = input.getPath();
path = path.removeFileExtension();
path = path.addFileExtension("html");
File file = path.toFile();
String html = editor.getMarkdownPage().html();
FileUtils.write(file, html);
}
}
Example 30
Project: erlide-master File: RenameFileQuickFix.java View source code |
@Override public void run() throws CoreException { final IMarker marker = getMarker(); final List<String> margs = getQuickFix().getArgs(); final IResource file = marker.getResource(); final IPath path = file.getFullPath(); final IPath newPath = path.removeLastSegments(1).append(margs.get(0) + ".erl"); file.move(newPath, true, null); }
Example 31
Project: erlide_eclipse-master File: RenameFileQuickFix.java View source code |
@Override public void run() throws CoreException { final IMarker marker = getMarker(); final List<String> margs = getQuickFix().getArgs(); final IResource file = marker.getResource(); final IPath path = file.getFullPath(); final IPath newPath = path.removeLastSegments(1).append(margs.get(0) + ".erl"); file.move(newPath, true, null); }
Example 32
Project: erlide_xtext-master File: EnvironmentPathUtils.java View source code |
public static IPath getLocalPath(final IPath path) { // } if (!isFullPath(path)) { return path; // throw new RuntimeException("Invalid path"); } String device = path.getDevice(); final int index = device.indexOf(SEPARATOR); Assert.isTrue(index >= 0); device = device.substring(index + 1); if (device.length() == 1 && device.charAt(0) == IPath.DEVICE_SEPARATOR) { device = null; } return path.setDevice(device); }
Example 33
Project: Hindsight-master File: RepoDirFinder.java View source code |
public File findRepoDir() { IProject iProject = ResourcesPlugin.getWorkspace().getRoot().getProjects()[0]; IPath location = iProject.getLocation(); if (location.append("/.git").toFile().exists()) return location.append(".git").toFile(); while (location.segmentCount() > 0 && !location.append("/.git").toFile().exists()) location = location.removeLastSegments(1); if (location.append("/.git").toFile().exists()) { IPath finalLocation = location.append("/.git"); System.out.println("repo found " + finalLocation.toPortableString()); return finalLocation.toFile(); } return null; }
Example 34
Project: lwjgl-master File: LWJGLClasspathContainerInitializer.java View source code |
/** * {@inheritDoc} * @see org.eclipse.jdt.core.ClasspathContainerInitializer#requestClasspathContainerUpdate(org.eclipse.core.runtime.IPath, org.eclipse.jdt.core.IJavaProject, org.eclipse.jdt.core.IClasspathContainer) */ public void requestClasspathContainerUpdate(IPath containerPath, IJavaProject project, IClasspathContainer containerSuggestion) throws CoreException { IClasspathEntry[] entries = containerSuggestion.getClasspathEntries(); if (entries.length == 1 && isValidLWJGLContainerPath(containerPath)) { // String version = containerPath.segment(1); // only modifiable entry in Javadoc location IClasspathAttribute[] extraAttributes = entries[0].getExtraAttributes(); for (int i = 0; i < extraAttributes.length; i++) { IClasspathAttribute attrib = extraAttributes[i]; if (attrib.getName().equals(IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME)) { break; } } rebindClasspathEntries(project.getJavaModel(), containerPath); } }
Example 35
Project: NanoVM-master File: NanoVMClasspathContainerInitializer.java View source code |
@Override
public void initialize(IPath containerPath, IJavaProject project) throws CoreException {
if (containerPath != null && containerPath.segmentCount() == 1 && NanoVMUI.LIBRARY_CONTAINER_ID.equals(containerPath.segment(0))) {
JavaCore.setClasspathContainer(containerPath, new IJavaProject[] { project }, new IClasspathContainer[] { new NanoVMClasspathContainer(project) }, null);
}
}
Example 36
Project: org.phpsrc.eclipse.pti.core-master File: INIFileUtil.java View source code |
public static INIFileEntry createIncludePathEntry(IPath[] includePaths) {
StringBuffer sb = new StringBuffer();
if (includePaths != null && includePaths.length > 0) {
sb.append(includePaths[0]);
for (int i = 1; i < includePaths.length; i++) {
sb.append(File.pathSeparator);
sb.append(includePaths[i].toOSString());
}
}
return new INIFileEntry("PHP", "include_path", sb.toString(), true);
}
Example 37
Project: rdt-master File: LoadPathContentProvider.java View source code |
public Object[] getElements(Object inputElement) {
if (!(inputElement instanceof ILoadpathEntry[]))
return null;
List<Object> children = new ArrayList<Object>();
IVMInstall vm = RubyRuntime.getDefaultVMInstall();
IPath[] libraryLocations = vm.getLibraryLocations();
ILoadpathEntry[] entries = (ILoadpathEntry[]) inputElement;
for (ILoadpathEntry loadpathEntry : entries) {
if (loadpathEntry.getEntryKind() == ILoadpathEntry.CPE_LIBRARY && contains(libraryLocations, loadpathEntry.getPath())) {
// Filter it out!
continue;
}
children.add(loadpathEntry);
}
return (Object[]) children.toArray(new Object[children.size()]);
}
Example 38
Project: substeps-eclipse-plugin-master File: ProjectManagerSuppliedSubstepsLocationFinder.java View source code |
@Override public String from(final IProject project) { final ProjectManager projectManager = projectManagerSupplier.get(); final IPath projectPath = project.getLocation(); final IPath substepsPath = projectManager.substepsFolderFor(project); if (!projectPath.isPrefixOf(substepsPath)) { return null; } return substepsPath.toOSString().substring(projectPath.toOSString().length() + 1); }
Example 39
Project: m2e-core-master File: POMMarkerAnnotationModelFactory.java View source code |
/* * @see org.eclipse.core.filebuffers.IAnnotationModelFactory#createAnnotationModel(org.eclipse.core.runtime.IPath) */ public IAnnotationModel createAnnotationModel(IPath location) { IAnnotationModel model = null; IFile file = FileBuffers.getWorkspaceFileAtLocation(location); if (file != null) { model = new POMMarkerAnnotationModel(file); } else { model = new POMMarkerAnnotationModel(ResourcesPlugin.getWorkspace().getRoot(), location.toString()); } return model; }
Example 40
Project: modellipse-master File: DiModelUtils.java View source code |
/**
* Returns the related di file. Warning : this method is here for historical
* reasons. It should be removed asap.
*
* @param file
* A file (di, model or notation).
* @return The associated DI file.
* @deprecated No replacement.
*/
public static IFile getRelatedDiFile(IFile file) {
if (file == null) {
return null;
}
IFile diFile;
if (DiModel.DI_FILE_EXTENSION.equalsIgnoreCase(file.getFileExtension())) {
diFile = file;
} else {
// Find the correct file
IPath diPath = file.getFullPath().removeFileExtension().addFileExtension(DiModel.DI_FILE_EXTENSION);
diFile = file.getParent().getFile(diPath.makeRelativeTo(file.getParent().getFullPath()));
}
return diFile;
}
Example 41
Project: yoursway-sunrise-master File: WorkingSetSettingsTransfer.java View source code |
/* * (non-Javadoc) * * @see org.eclipse.ui.preferences.SettingsTransfer#transferSettings(org.eclipse.core.runtime.IPath) */ public IStatus transferSettings(IPath newWorkspaceRoot) { IPath dataLocation = getNewWorkbenchStateLocation(newWorkspaceRoot); if (dataLocation == null) return noWorkingSettingsStatus(); dataLocation = dataLocation.append(WorkingSetManager.WORKING_SET_STATE_FILENAME); File stateFile = new File(dataLocation.toOSString()); try { IWorkingSetManager manager = PlatformUI.getWorkbench().getWorkingSetManager(); if (manager instanceof AbstractWorkingSetManager) ((AbstractWorkingSetManager) manager).saveState(stateFile); else return new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, WorkbenchMessages.WorkingSets_CannotSave); } catch (IOException e) { new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, WorkbenchMessages.ProblemSavingWorkingSetState_message, e); } return Status.OK_STATUS; }
Example 42
Project: org.eclipse.dltk.core-master File: TestieContainerInitializer.java View source code |
@Override public void initialize(IPath containerPath, IScriptProject project) throws CoreException { int size = containerPath.segmentCount(); IPath path = EnvironmentPathUtils.getFullPath(EnvironmentManager.getEnvironment(project), containerPath.removeFirstSegments(1)); path = path.makeAbsolute(); if (size > 0) { TestieContainer container = new TestieContainer(path); DLTKCore.setBuildpathContainer(containerPath, new IScriptProject[] { project }, new IBuildpathContainer[] { container }, null); } }
Example 43
Project: webtools.servertools-master File: RuntimeClasspathContainerInitializer.java View source code |
/** (non-Javadoc) * @see org.eclipse.jdt.core.ClasspathContainerInitializer#initialize(org.eclipse.core.runtime.IPath, org.eclipse.jdt.core.IJavaProject) */ public void initialize(IPath containerPath, IJavaProject project) throws CoreException { if (containerPath.segmentCount() > 0) { if (containerPath.segment(0).equals(RuntimeClasspathContainer.SERVER_CONTAINER)) { RuntimeClasspathProviderWrapper delegate = null; IRuntime runtime = null; String runtimeId = null; if (containerPath.segmentCount() > 2) { delegate = JavaServerPlugin.findRuntimeClasspathProvider(containerPath.segment(1)); runtimeId = containerPath.segment(2); if (runtimeId != null) runtime = ServerCore.findRuntime(runtimeId); } RuntimeClasspathContainer container = new RuntimeClasspathContainer(project.getProject(), containerPath, delegate, runtime, runtimeId); JavaCore.setClasspathContainer(containerPath, new IJavaProject[] { project }, new IClasspathContainer[] { container }, null); } } }
Example 44
Project: org.eclipse.koneki.ldt-master File: LuaExecutionEnvironmentContainerPropertyTester.java View source code |
@Override
public boolean test(final Object receiver, final String property, final Object[] args, final Object expectedValue) {
if (PROPERTY_ID.equals(property) && (receiver instanceof BuildPathContainer)) {
// Extract build path container path
final BuildPathContainer container = (BuildPathContainer) receiver;
final IPath entryPath = container.getBuildpathEntry().getPath();
// Check if it is a valid Execution Environment path
return LuaExecutionEnvironmentBuildpathUtil.isLuaExecutionEnvironmentContainer(entryPath);
}
return false;
}
Example 45
Project: antlr-ide-master File: GrammarRepository.java View source code |
public IGrammarBuilder createGrammarBuilder(IPath file, IProblemReporter reporter) throws CoreException {
// builder config
String projectName = file.segment(0);
IGrammarBuilder grammarBuilder = new AntlrGrammarBuilder();
// config builder
grammarBuilder.setProblemReporter(reporter);
grammarBuilder.setFile(file);
grammarBuilder.setProject(projectName);
return grammarBuilder;
}
Example 46
Project: ares-studio-master File: FilePropertyTester.java View source code |
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
if (receiver instanceof IFile) {
IFile file = (IFile) receiver;
if (IS_ON_RESPATH.equals(property)) {
boolean onResPath = false;
IPath path = file.getProjectRelativePath();
IProject project = file.getProject();
IARESProject aresProject = ARESCore.create(project);
for (IResPathEntry entry : aresProject.getRawResPath()) {
if (entry.getEntryKind() == IResPathEntry.RPE_LIBRAY && entry.getPath().equals(path)) {
onResPath = true;
}
}
return StringUtil.equalsByString(expectedValue, onResPath);
}
}
return false;
}
Example 47
Project: avr-eclipse-fork-master File: SystemPathsPosixTest.java View source code |
@Test
public void testGetSystemPath() {
if (isWindows())
return;
AVRPath[] allpaths = AVRPath.values();
for (AVRPath avrpath : allpaths) {
IPath path = SystemPathsPosix.getSystemPath(avrpath);
assertNotNull(avrpath.getName(), path);
if (!avrpath.isOptional()) {
assertFalse(avrpath.getName(), path.isEmpty());
}
}
}
Example 48
Project: axdt-master File: DebuggerConsoleFileMatcher.java View source code |
@Override
protected LinkContext openLink(LinkContext context) throws Exception {
context.correctPosition(1, -1);
String text = context.getText(getDocument());
String[] split = splitTextPosition(text);
IPath location = new Path(split[0]);
int line = Integer.parseInt(split[1]);
IFile file = getFile(location);
if (file.exists()) {
context.setLink(new FileLink(file, null, -1, -1, line));
return context;
}
return null;
}
Example 49
Project: bndtools-master File: WorkspaceURLStreamHandlerService.java View source code |
@Override public URLConnection openConnection(URL url) throws IOException { String protocol = url.getProtocol(); if (!PROTOCOL.equals(protocol)) throw new MalformedURLException("Unsupported protocol"); IPath path = new Path(url.getPath()); IWorkspace workspace = workspaceTracker.getService(); if (workspace == null) throw new IOException("Workspace is not available"); IPath workspaceLocation = workspace.getRoot().getLocation(); if (workspaceLocation == null) throw new IOException("Cannot determine workspace location."); IPath location = workspaceLocation.append(path); return new URL("file", null, location.toOSString()).openConnection(); }
Example 50
Project: bundlemaker-master File: GsonProjectDescriptionHelper.java View source code |
/**
* <p>
* </p>
*
* @param project
* @return
*/
public static Gson gson(IProjectDescriptionAwareBundleMakerProject project) {
try {
GsonBuilder builder = new GsonBuilder();
builder.excludeFieldsWithoutExposeAnnotation();
builder.setPrettyPrinting();
builder.registerTypeAdapter(IPath.class, new IPathDeserializer());
builder.registerTypeAdapter(IProjectContentProvider.class, new ProjectContentProviderJsonAdapter(new ContentProviderCompoundClassLoader()));
//
if (project != null) {
builder.registerTypeAdapter(BundleMakerProjectDescription.class, new BundleMakerProjectDescriptionInstanceCreator(project));
}
return builder.create();
} catch (CoreException e) {
throw new RuntimeException(e);
}
}
Example 51
Project: che-master File: UIResourceFilterDescription.java View source code |
/**
* @param iResourceFilterDescription
* @return a UIResourceFilterDescription
*/
public static UIResourceFilterDescription wrap(final IResourceFilterDescription iResourceFilterDescription) {
return new UIResourceFilterDescription() {
public FileInfoMatcherDescription getFileInfoMatcherDescription() {
return iResourceFilterDescription.getFileInfoMatcherDescription();
}
public IPath getPath() {
return iResourceFilterDescription.getResource().getProjectRelativePath();
}
public IProject getProject() {
return iResourceFilterDescription.getResource().getProject();
}
public int getType() {
return iResourceFilterDescription.getType();
}
};
}
Example 52
Project: che-plugins-master File: UIResourceFilterDescription.java View source code |
/**
* @param iResourceFilterDescription
* @return a UIResourceFilterDescription
*/
public static UIResourceFilterDescription wrap(final IResourceFilterDescription iResourceFilterDescription) {
return new UIResourceFilterDescription() {
public FileInfoMatcherDescription getFileInfoMatcherDescription() {
return iResourceFilterDescription.getFileInfoMatcherDescription();
}
public IPath getPath() {
return iResourceFilterDescription.getResource().getProjectRelativePath();
}
public IProject getProject() {
return iResourceFilterDescription.getResource().getProject();
}
public int getType() {
return iResourceFilterDescription.getType();
}
};
}
Example 53
Project: Composer-Eclipse-Plugin-master File: Validator.java View source code |
@Override protected void beginValidation() throws ValidationException { IPath fileLocation = firstPage.PHPLocationGroup.getLocation(); if (fileLocation.toPortableString().length() > 0) { final IFileHandle directory = environment.getFile(fileLocation); IPath futurepath = directory.getPath().append(firstPage.nameGroup.getName()); File futureFile = futurepath.toFile(); if ((futureFile.exists() && futureFile.isFile()) || (futureFile.exists() && futureFile.isDirectory() && futureFile.list().length > 0)) { throw new ValidationException("The target directory is not empty. Unable to run \"create-project\" with a target directory containing files.", Severity.ERROR); } } }
Example 54
Project: DevTools-master File: UIResourceFilterDescription.java View source code |
/**
* @param iResourceFilterDescription
* @return a UIResourceFilterDescription
*/
public static UIResourceFilterDescription wrap(final IResourceFilterDescription iResourceFilterDescription) {
return new UIResourceFilterDescription() {
public FileInfoMatcherDescription getFileInfoMatcherDescription() {
return iResourceFilterDescription.getFileInfoMatcherDescription();
}
public IPath getPath() {
return iResourceFilterDescription.getResource().getProjectRelativePath();
}
public IProject getProject() {
return iResourceFilterDescription.getResource().getProject();
}
public int getType() {
return iResourceFilterDescription.getType();
}
};
}
Example 55
Project: dltk.core-master File: TestieContainerInitializer.java View source code |
@Override public void initialize(IPath containerPath, IScriptProject project) throws CoreException { int size = containerPath.segmentCount(); IPath path = EnvironmentPathUtils.getFullPath(EnvironmentManager.getEnvironment(project), containerPath.removeFirstSegments(1)); path = path.makeAbsolute(); if (size > 0) { TestieContainer container = new TestieContainer(path); DLTKCore.setBuildpathContainer(containerPath, new IScriptProject[] { project }, new IBuildpathContainer[] { container }, null); } }
Example 56
Project: dot-emacs-master File: FileClosed.java View source code |
/** * Closes the associated eclipse tab when a vim tab is closed. * * @see org.vimplugin.listeners.IVimListener#handleEvent(org.vimplugin.VimEvent) */ public void handleEvent(final VimEvent ve) throws VimException { String event = ve.getEvent(); String argument = null; // vim has a fileClosed event, but it is not implemented. if (event.equals("keyCommand") && (argument = ve.getArgument(0)).startsWith("\"fileClosed ")) { IPath filePath = new Path(argument.substring(12, argument.length() - 1)); VimPlugin plugin = VimPlugin.getDefault(); VimConnection vc = ve.getConnection(); VimServer server = plugin.getVimserver(vc.getVimID()); for (VimEditor editor : server.getEditors()) { IPath location = editor.getSelectedFile().getRawLocation(); if (filePath.equals(location)) { editor.forceDispose(); } } } }
Example 57
Project: e-fx-clipse-master File: JavaFXClassPathExtender.java View source code |
@Override
public List<Contribution> getContributions(BundleDescription desc) {
IPath[] paths = BuildPathSupport.getPreferencePaths();
if (paths != null) {
return Collections.singletonList(new Contribution(paths[0], paths[1] == null ? BuildPathSupport.WEB_JAVADOC_LOCATION : paths[1].toFile().toURI().toString(), null, null));
}
return Collections.emptyList();
}
Example 58
Project: ecl-master File: FileClosed.java View source code |
/** * Closes the associated eclipse tab when a vim tab is closed. * * @see org.vimplugin.listeners.IVimListener#handleEvent(org.vimplugin.VimEvent) */ public void handleEvent(final VimEvent ve) throws VimException { String event = ve.getEvent(); String argument = null; // vim has a fileClosed event, but it is not implemented. if (event.equals("keyCommand") && (argument = ve.getArgument(0)).startsWith("\"fileClosed ")) { IPath filePath = new Path(argument.substring(12, argument.length() - 1)); VimPlugin plugin = VimPlugin.getDefault(); VimConnection vc = ve.getConnection(); VimServer server = plugin.getVimserver(vc.getVimID()); for (VimEditor editor : server.getEditors()) { IPath location = editor.getSelectedFile().getRawLocation(); if (filePath.equals(location)) { editor.forceDispose(); } } } }
Example 59
Project: eclim-master File: FileClosed.java View source code |
/** * Closes the associated eclipse tab when a vim tab is closed. * * @see org.vimplugin.listeners.IVimListener#handleEvent(org.vimplugin.VimEvent) */ public void handleEvent(final VimEvent ve) throws VimException { String event = ve.getEvent(); String argument = null; // vim has a fileClosed event, but it is not implemented. if (event.equals("keyCommand") && (argument = ve.getArgument(0)).startsWith("\"fileClosed ")) { IPath filePath = new Path(argument.substring(12, argument.length() - 1)); VimPlugin plugin = VimPlugin.getDefault(); VimConnection vc = ve.getConnection(); VimServer server = plugin.getVimserver(vc.getVimID()); for (VimEditor editor : server.getEditors()) { IPath location = editor.getSelectedFile().getRawLocation(); if (filePath.equals(location)) { editor.forceDispose(); } } } }
Example 60
Project: Eclipse-EGit-master File: IgnoreActionHandler.java View source code |
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
final IResource[] resources = getSelectedResources(event);
if (resources.length == 0)
return null;
List<IPath> paths = new ArrayList<>();
for (IResource resource : resources) paths.add(resource.getLocation());
IgnoreOperationUI operation = new IgnoreOperationUI(paths);
operation.run();
return null;
}
Example 61
Project: eclipse-integration-tcserver-master File: TcServerRuntimeClasspathProvider.java View source code |
public IClasspathEntry[] resolveClasspathContainer(IProject project, IRuntime runtime) { IPath installPath = TcServerRuntime.getTomcatLocation(runtime); if (installPath == null) { return new IClasspathEntry[0]; } List<IClasspathEntry> list = new ArrayList<IClasspathEntry>(); IPath path = installPath.append("lib"); addLibraryEntries(list, path.toFile(), true); return list.toArray(new IClasspathEntry[list.size()]); }
Example 62
Project: eclipse-jetty-plugin-master File: JettyPluginUtilsTest.java View source code |
private IProject createProject() { IProject project = mock(IProject.class); IPath projectLocation = new Path("/worspace/my-project"); when(project.getLocation()).thenReturn(projectLocation); IPath projectFullPath = new Path("/my-project"); when(project.getFullPath()).thenReturn(projectFullPath); return project; }
Example 63
Project: eclipse-master File: WindowsPhoneEmulator.java View source code |
public static WindowsPhoneEmulator getDefault() { IPath newToolPath = MoSyncTool.getDefault().getBinary("WP7AppLauncher/WP7AppLauncher"); if (instance == null || !Util.equals(toolPath, newToolPath)) { IPath path = newToolPath == null ? null : newToolPath; instance = new WindowsPhoneEmulator(path); } return instance; }
Example 64
Project: eclipse.jdt.ui-master File: JUnitViewEditorLauncher.java View source code |
@Override
public void open(IPath file) {
try {
JUnitPlugin.getActivePage().showView(TestRunnerViewPart.NAME);
JUnitModel.importTestRunSession(file.toFile());
} catch (CoreException e) {
ExceptionHandler.handle(e, JUnitMessages.JUnitViewEditorLauncher_dialog_title, JUnitMessages.JUnitViewEditorLauncher_error_occurred);
}
}
Example 65
Project: eclipse.platform-master File: LocationProvider.java View source code |
public IPath getLocation() {
if (fEditorInput instanceof IFileEditorInput) {
return ((IFileEditorInput) fEditorInput).getFile().getLocation();
}
ILocationProvider locationProvider = fEditorInput.getAdapter(ILocationProvider.class);
if (locationProvider != null) {
return locationProvider.getPath(fEditorInput);
}
return null;
}
Example 66
Project: eclipse.platform.ui-master File: NestedProjectsLabelProvider.java View source code |
@Override
public String getText(Object element) {
if (!(element instanceof IProject)) {
return null;
}
IProject project = (IProject) element;
IPath location = project.getLocation();
if (location != null && !location.lastSegment().equals(project.getName())) {
//$NON-NLS-1$ //$NON-NLS-2$
return labelProvider.getText(element) + " (in " + location.lastSegment() + ")";
}
return null;
}
Example 67
Project: eclipsefp-master File: PartitionedRunner.java View source code |
public List<ProcessorError> run(final IPath path) {
try {
// Run the command
StringWriter out = new StringWriter();
StringWriter err = new StringWriter();
new ProcessRunner().executeBlocking(path.toFile().getParentFile(), out, err, getExecutableName(), path.toOSString());
// Parse the output
return OutputParser.errors(selectStream(out, err).toString());
} catch (Throwable ex) {
return new ArrayList<>();
}
}
Example 68
Project: EGit-master File: IgnoreActionHandler.java View source code |
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
final IResource[] resources = getSelectedResources(event);
if (resources.length == 0)
return null;
List<IPath> paths = new ArrayList<>();
for (IResource resource : resources) paths.add(resource.getLocation());
IgnoreOperationUI operation = new IgnoreOperationUI(paths);
operation.run();
return null;
}
Example 69
Project: flower-platform-3-master File: FlowerDiagramEditorLauncherOpenInNewEditor.java View source code |
/** * Called when selecting open in new editor Loads the file in a new editor * */ @Override public void open(IPath file) { // transformation from IPath to IFile IFile[] iFiles = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(file); final FileEditorInput fileEditorInput = new FileEditorInput(iFiles[0]); PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() { public void run() { try { IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), fileEditorInput, FlowerDiagramEditor.EDITOR_ID); } catch (Exception e) { throw new RuntimeException("Could not open editor.", e); } } }); }
Example 70
Project: gda-dal-master File: FolderFieldEditor.java View source code |
@Override
protected String getNewInputObject() {
ResourceSelectionDialog resourceSelectionDialog = new ResourceSelectionDialog(getShell(), "Select a folder which contains rules", null);
if (resourceSelectionDialog.open() == Window.OK) {
IPath selectedResource = resourceSelectionDialog.getSelectedResource();
return selectedResource.toString();
}
return null;
}
Example 71
Project: geppetto-master File: Activator.java View source code |
/**
* Get a resource found in this bundle as a File. Extracting it
* into the filesystem if necessary.
*
* @param bundleRelativeResourcePath
* bundle relative path of the resource
* @return a {@link File} incarnation of the resource
* @throws IOException
*/
public static File getBundleResourceAsFile(IPath bundleRelativeResourcePath) throws IOException {
URL resourceURL = FileLocator.find(context.getBundle(), bundleRelativeResourcePath, null);
if (resourceURL == null)
return null;
resourceURL = FileLocator.toFileURL(resourceURL);
try {
return new File(URIUtil.toURI(resourceURL));
} catch (URISyntaxException e) {
throw new IllegalStateException("Failed to convert resource URL to URI", e);
}
}
Example 72
Project: GinTonic-master File: IFolderUtils.java View source code |
/** * Checks if the given folder is a source folder by comparing it with the * given sourceFolders. A folder is a source folder if its fullpath starts * any of the source folders. Use * {@link IProjectUtils#getSourceFolders(org.eclipse.core.resources.IProject)} * to obtain the source folders of a project. * * @param folder the folder * @param sourceFolders the source folder * @return true or false. */ public static boolean isSourceFolder(IFolder folder, List<IPath> sourceFolders) { IPath foldersFullPath = folder.getFullPath(); String foldersFullPathAsPortableString = foldersFullPath.toPortableString(); for (final IPath srcFolder : sourceFolders) { if (foldersFullPathAsPortableString.startsWith(srcFolder.toPortableString())) { return true; } } return false; }
Example 73
Project: gmf-tooling-master File: GMFGeneratorUtil.java View source code |
public static GenEditorGenerator loadEditorGen(String projectLocation, String gmfgenLocation) {
IPath gmfgenProjectPath = new Path(projectLocation);
String gmfgenProjectName = gmfgenProjectPath.lastSegment();
StringBuilder uri = new StringBuilder(SEPARATOR);
uri.append(gmfgenProjectName);
if (!gmfgenLocation.startsWith(SEPARATOR)) {
uri.append(SEPARATOR);
}
uri.append(gmfgenLocation);
URI gmfgenFileURI = URI.createPlatformResourceURI(uri.toString(), true);
return GMFGeneratorUtil.loadEditorGen(gmfgenFileURI);
}
Example 74
Project: gmf-tooling.uml2tools-master File: ModelElementsContentHelper.java View source code |
public static Object[] getChildren(Object parentElement, AdapterFactoryContentProvider contentProvier, ResourceSet resourceSet) {
Object[] result = myWorkbenchContentProvider.getChildren(parentElement);
if (result != null && result.length > 0) {
return result;
}
if (parentElement instanceof IFile) {
IFile modelFile = (IFile) parentElement;
IPath resourcePath = modelFile.getFullPath();
try {
Resource modelResource = resourceSet.getResource(URI.createPlatformResourceURI(resourcePath.toString(), true), true);
return contentProvier.getChildren(modelResource);
} catch (WrappedException e) {
System.err.println("Failed to get resource for filepath " + resourcePath.toString());
}
return Collections.EMPTY_LIST.toArray();
}
return contentProvier.getChildren(parentElement);
}
Example 75
Project: grails-ide-master File: GrailsPluginParser.java View source code |
public GrailsPluginVersion parse() {
if (pluginDescriptor == null) {
return null;
}
File file = new File(pluginDescriptor);
GrailsPluginVersion data = null;
if (file.exists()) {
data = new PluginDescriptorParser(pluginDescriptor).parse();
} else if (Path.EMPTY.isValidPath(pluginDescriptor)) {
IPath path = new Path(pluginDescriptor);
String lastSegment = path.lastSegment();
// plugin.xml file doesn't exist, so strip it
if (lastSegment != null && lastSegment.contains("plugin.xml")) {
path = path.removeLastSegments(1);
}
data = new GroovyPluginParser(path).parse();
}
return data;
}
Example 76
Project: HBuilder-opensource-master File: BundleUtils.java View source code |
public static File getRelative(IPath relative, Bundle bundle) {
try {
URL bundleURL = FileLocator.find(bundle, relative, null);
URL fileURL;
fileURL = FileLocator.toFileURL(bundleURL);
File f = new File(fileURL.getPath());
return f;
} catch (Exception e) {
throw new RuntimeException("Can't find relative path:" + relative + " within:" + bundle, e);
}
}
Example 77
Project: jbosstools-playground-master File: DynamicProjectTools.java View source code |
public static void convertToFacetedProject(IProject project, Set<IPath> ignoredDirectories, IProgressMonitor monitor) throws Exception {
if (!ProjectFacetsManager.isProjectFacetDefined(project.getName())) {
IFacetedProject facetedProject = ProjectFacetsManager.create(project, true, monitor);
IProjectFacet JAVA_FACET = ProjectFacetsManager.getProjectFacet("jst.java");
ProjectScope ps = new ProjectScope(project);
IEclipsePreferences JDPprojectNode = ps.getNode(JavaCore.PLUGIN_ID);
String compilerCompliance = JDPprojectNode.get(JavaCore.COMPILER_COMPLIANCE, "1.7");
;
if (!facetedProject.hasProjectFacet(JAVA_FACET)) {
facetedProject.installProjectFacet(JAVA_FACET.getVersion(compilerCompliance), null, monitor);
}
}
}
Example 78
Project: libra-master File: KnopflerfishFrameworkClasspathProvider.java View source code |
/** * @see RuntimeClasspathProviderDelegate#resolveClasspathContainer(IProject, * IRuntime) */ @Override public IClasspathEntry[] resolveClasspathContainer(IProject project, IRuntime runtime) { IPath installPath = runtime.getLocation(); if (installPath == null) return new IClasspathEntry[0]; List<IClasspathEntry> list = new ArrayList<IClasspathEntry>(); // String runtimeId = runtime.getRuntimeType().getId(); IPath path = installPath.append("bundle"); addLibraryEntries(list, path.toFile(), true); return list.toArray(new IClasspathEntry[list.size()]); }
Example 79
Project: liferay-ide-master File: FindJavaProblemsHandler.java View source code |
@Override public Object execute(ExecutionEvent event) throws ExecutionException { try { Liferay7UpgradeAssistantSettings settings = UpgradeAssistantSettingsUtil.getObjectFromStore(Liferay7UpgradeAssistantSettings.class); String[] projectLocations = settings.getJavaProjectLocations(); List<IPath> locations = new ArrayList<>(); for (String projectLocation : projectLocations) { locations.add(new Path(projectLocation)); } new MigrateProjectHandler().findMigrationProblems(locations.toArray(new IPath[0])); } catch (IOException e) { e.printStackTrace(); } return null; }
Example 80
Project: linuxtools-master File: STAnnotatedSourceNotFoundEditor.java View source code |
@Override
protected void openSourceFileAtLocation(IProject project, IPath sourceLoc, int lineNumber) {
IEditorInput input = this.getEditorInput();
if (input instanceof STAnnotatedSourceNotFoundEditorInput) {
STAnnotatedSourceNotFoundEditorInput editorInput = (STAnnotatedSourceNotFoundEditorInput) input;
SourceFile sf = editorInput.getSourceFile();
OpenSourceFileAction.openAnnotatedSourceFile(project, null, sf, sourceLoc, lineNumber);
} else {
super.openSourceFileAtLocation(project, sourceLoc, lineNumber);
}
}
Example 81
Project: monolipse-master File: BooNatureTestCase.java View source code |
public void testBooAndMonolipseResourcesAreExcludedFromSourceFolder() throws JavaModelException {
IJavaProject javaProject = JavaCore.create(getProject());
List<IClasspathEntry> sourceFolders = sourceFoldersFor(javaProject);
assertEquals(1, sourceFolders.size());
IPath[] exclusionPatterns = sourceFolders.get(0).getExclusionPatterns();
assertTrue(exclusionPatternsContains("**/.monolipse", exclusionPatterns));
assertTrue(exclusionPatternsContains("**/*.boo", exclusionPatterns));
}
Example 82
Project: mylyn-mantis-master File: MantisCorePluginModule.java View source code |
@Override
protected void configure() {
bind(StatusFactory.class);
bind(MantisAttachmentHandler.class);
bind(MantisTaskDataHandler.class);
bind(IMantisClientManager.class).to(MantisClientManager.class);
bind(MantisCommentMapper.class);
bind(IPath.class).annotatedWith(RepositoryPersistencePath.class).toProvider(RepositoryPersistencePathProvider.class);
bind(MantisRepositoryConnector.class).toInstance(mantisRepositoryConnector);
// we need a single tracer which is post-configured by the core plugin
bind(Tracer.class).to(EclipseTracer.class).in(Singleton.class);
}
Example 83
Project: org-tools-master File: JVMHelper.java View source code |
public static IPath getJavaProjectJVMPath(IJavaProject javaProject) { IPath result = null; String installLocation = null; try { IVMInstall vmInstall = JavaRuntime.getVMInstall(javaProject); installLocation = vmInstall.getInstallLocation().getAbsolutePath(); result = new Path(installLocation); } catch (Exception exc) { result = getDefaultJVMPath(); } return result; }
Example 84
Project: org.eclipse.ui.ide.format.extension.patch-master File: UIResourceFilterDescription.java View source code |
/**
* @param iResourceFilterDescription
* @return a UIResourceFilterDescription
*/
public static UIResourceFilterDescription wrap(final IResourceFilterDescription iResourceFilterDescription) {
return new UIResourceFilterDescription() {
public FileInfoMatcherDescription getFileInfoMatcherDescription() {
return iResourceFilterDescription.getFileInfoMatcherDescription();
}
public IPath getPath() {
return iResourceFilterDescription.getResource().getProjectRelativePath();
}
public IProject getProject() {
return iResourceFilterDescription.getResource().getProject();
}
public int getType() {
return iResourceFilterDescription.getType();
}
};
}
Example 85
Project: org.phpsrc.eclipse.pti.tool.phpunit-master File: PHPUnitViewEditorLauncher.java View source code |
public void open(IPath file) {
try {
TestRunnerViewPart.showTestResultsView();
PHPUnitModel.importTestRunSession(file.toFile());
} catch (CoreException e) {
ExceptionHandler.handle(e, PHPUnitMessages.JUnitViewEditorLauncher_dialog_title, PHPUnitMessages.JUnitViewEditorLauncher_error_occurred);
}
}
Example 86
Project: pdt-master File: LabelProviderUtil.java View source code |
public static String getVariableName(IPath path, int entryKind) { switch(entryKind) { case IBuildpathEntry.BPE_LIBRARY: String[] variableNames = DLTKCore.getBuildpathVariableNames(); for (String name : variableNames) { IPath variablePath = DLTKCore.getBuildpathVariable(name); if (EnvironmentPathUtils.isFull(path)) { path = EnvironmentPathUtils.getLocalPath(path); } if (path.equals(variablePath)) { return name; } } } return null; }
Example 87
Project: perconik-master File: ClassFiles.java View source code |
public static IPath path(final IClassFile file) {
LinkedList<String> segments = newLinkedList();
IJavaElement element = file;
do {
JavaElementType type = JavaElementType.valueOf(element);
if (type == JavaElementType.PACKAGE_FRAGMENT_ROOT) {
IPackageFragmentRoot root = (IPackageFragmentRoot) element;
String segment = !root.isExternal() ? element.getPath().toString() : root.getElementName();
if (segment.startsWith("/")) {
segment = segment.substring(1);
}
segments.addFirst(segment);
break;
}
String segment = element.getElementName();
if (type == JavaElementType.PACKAGE_FRAGMENT) {
segment = segment.replace('.', '/');
}
segments.addFirst(segment);
} while ((element = element.getParent()) != null);
return new Path(Joiner.on('/').skipNulls().join(segments));
}
Example 88
Project: phing-eclipse-master File: LocationProvider.java View source code |
public IPath getLocation() {
if (fEditorInput instanceof IFileEditorInput) {
return ((IFileEditorInput) fEditorInput).getFile().getLocation();
}
ILocationProvider locationProvider = (ILocationProvider) fEditorInput.getAdapter(ILocationProvider.class);
if (locationProvider != null) {
return locationProvider.getPath(fEditorInput);
}
return null;
}
Example 89
Project: Pydev-master File: BundleUtils.java View source code |
public static File getRelative(IPath relative, Bundle bundle) {
try {
URL bundleURL = FileLocator.find(bundle, relative, null);
URL fileURL;
fileURL = FileLocator.toFileURL(bundleURL);
File f = new File(fileURL.getPath());
return f;
} catch (Exception e) {
throw new RuntimeException("Can't find relative path:" + relative + " within:" + bundle, e);
}
}
Example 90
Project: quick-junit-master File: MockitoEntry.java View source code |
public IPath getPath() {
Bundle bundle = Platform.getBundle("org.mockito");
URL entry = bundle.getEntry("mockito.jar");
String fileURL = null;
try {
fileURL = URLDecoder.decode(FileLocator.toFileURL(entry).getFile(), "UTF-8");
} catch (IOException e) {
}
return new Path(fileURL);
}
Example 91
Project: rascal-eclipse-master File: AbstractEditorAction.java View source code |
protected static IFile initFile(UniversalEditor editor, ISourceProject project) {
IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
if (editor == null) {
return null;
}
IPath path = editor.getParseController().getPath();
if (project != null) {
return project.getRawProject().getFile(path);
} else {
return workspaceRoot.getFile(path);
}
}
Example 92
Project: rce-master File: CopyFullpathHandler.java View source code |
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
String fullPath = "";
ISelectionService selService = window.getSelectionService();
IStructuredSelection selection = (IStructuredSelection) selService.getSelection();
if (selection.getFirstElement() instanceof IResource) {
IResource file = (IResource) selection.getFirstElement();
IPath path = file.getLocation();
fullPath = path.toOSString();
}
ClipboardHelper.setContent(fullPath);
return null;
}
Example 93
Project: rhostudio-master File: BuildInfoHolder.java View source code |
public String getProjectLocationFullPath() {
if (isInDefaultWs) {
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IWorkspaceRoot root = workspace.getRoot();
IPath location = root.getLocation();
return location.toOSString() + File.separator + appName;
}
if (appDir.codePointAt(appDir.length() - 1) == '/' || appDir.codePointAt(appDir.length() - 1) == '\\') {
return appDir + appName;
}
return appDir + File.separator + appName;
}
Example 94
Project: run-jetty-run-master File: ResourceUtil.java View source code |
/**
* Looking resource from path , which might be absolute path and workspace relative path
* @param path
* @return
*/
public static File lookingFileFromPath(IPath path) {
if (path == null) {
throw new IllegalStateException("path shouldn't be null");
}
if (path.toFile().exists()) {
return path.toFile();
}
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
IResource resourceInRuntimeWorkspace = root.findMember(path);
if (resourceInRuntimeWorkspace == null) {
return path.toFile();
}
File file = new File(resourceInRuntimeWorkspace.getLocationURI());
if (file.exists()) {
return file;
}
return path.toFile();
}
Example 95
Project: sbt-eclipse-plugin-master File: SbtClasspathContainerInitializer.java View source code |
private void updateClasspathContainer(IPath containerPath, IJavaProject project, IClasspathContainer container) throws JavaModelException {
JavaCore.setClasspathContainer(containerPath, new IJavaProject[] { project }, new IClasspathContainer[] { container }, null);
/*
if (JavaCore.getClasspathContainer(containerPath, project) == null) {
IClasspathEntry[] entries = project.getRawClasspath();
IClasspathEntry newEntry = JavaCore.newContainerEntry(containerPath);
IClasspathEntry[] n = new IClasspathEntry[entries.length + 1];
n[0] = newEntry;
System.arraycopy(entries, 0, n, 1, entries.length);
project.setRawClasspath(n, null);
JavaCore.setClasspathContainer(containerPath, new IJavaProject[] { project }, null, null);
} */
}
Example 96
Project: Symfony-2-Eclipse-Plugin-master File: NamespaceVariableResolver.java View source code |
@Override
public void resolve(TemplateVariable variable, TemplateContext context) {
if (context instanceof SymfonyTemplateContext) {
try {
SymfonyTemplateContext symfonyContext = (SymfonyTemplateContext) context;
ISourceModule module = symfonyContext.getSourceModule();
IPath path = module.getPath().removeLastSegments(1);
String ns = SymfonyModelAccess.getDefault().findNameSpace(module.getScriptProject(), path);
if (ns != null) {
variable.setValue(ns);
variable.setResolved(true);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
Example 97
Project: tamiflex-master File: TraceFileViewerLauncher.java View source code |
public void open(IPath file) {
try {
IWorkbenchPage activePage = Activator.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
activePage.showView(ReflectionView.ID);
ReflectionView reflView = (ReflectionView) activePage.findView(ReflectionView.ID);
reflView.addTraceFile(file);
reflView.refresh();
} catch (CoreException e) {
e.printStackTrace();
}
}
Example 98
Project: TBLips-master File: JSPHyperlinkProvider.java View source code |
public HTMLHyperlinkInfo getHyperlinkInfo(IFile file, FuzzyXMLDocument doc, FuzzyXMLElement element, String attrName, String attrValue, int offset) {
if (element.getName().equals("jsp:include") && attrName.equals("page")) {
IPath path = file.getParent().getProjectRelativePath();
IResource resource = file.getProject().findMember(path.append(attrValue));
if (resource != null && resource.exists() && resource instanceof IFile) {
HTMLHyperlinkInfo info = new HTMLHyperlinkInfo();
info.setObject(resource);
info.setOffset(0);
info.setLength(attrValue.length());
return info;
}
}
return null;
}
Example 99
Project: teiid-designer-master File: TestProcedureCriteriaMappingFactory.java View source code |
public void testGenerateVariableName() {
ProcedureCriteriaMappingFactory factory = new ProcedureCriteriaMappingFactory();
//$NON-NLS-1$
IPath xsdElementPath = new Path("/root/element/sequence/element/sequence/element");
//$NON-NLS-1$
assertEquals("VARIABLES.element", factory.generateVariableName(xsdElementPath));
}
Example 100
Project: tern.java-master File: EclipsePathAdapter.java View source code |
@Override
public List<String> toArray(IPath path, Options options) {
List<String> result = new ArrayList<String>();
if (path.isAbsolute()) {
//$NON-NLS-1$
result.add("");
}
result.addAll(Arrays.asList(path.segments()));
if (path.hasTrailingSeparator()) {
//$NON-NLS-1$
result.add("");
}
return result;
}
Example 101
Project: testng-eclipse-master File: TestNGHomeInitializer.java View source code |
/**
* @see org.eclipse.jdt.core.ClasspathVariableInitializer#initialize(java.lang.String)
*/
public void initialize(String variable) {
try {
Bundle bundle = Platform.getBundle(TestNGPlugin.PLUGIN_ID);
if (bundle == null) {
clearVariable();
return;
}
URL local = null;
try {
//$NON-NLS-1$
local = FileLocator.toFileURL(bundle.getEntry("/"));
} catch (IOException e) {
clearVariable();
return;
}
IPath location = Path.fromOSString(new File(local.getPath()).getAbsolutePath());
if (null != location) {
JavaCore.setClasspathVariable(TestNGPluginConstants.TESTNG_HOME, location, null);
} else {
}
} catch (JavaModelException jmex) {
clearVariable();
}
}