Tabnine Logo
IPath.toFile
Code IndexAdd Tabnine to your IDE (free)

How to use
toFile
method
in
org.eclipse.core.runtime.IPath

Best Java code snippets using org.eclipse.core.runtime.IPath.toFile (Showing top 20 results out of 1,476)

origin: org.eclipse.core/runtime

public IPath getStateLocation(Bundle bundle, boolean create) throws IllegalStateException {
  assertInitialized();
  IPath result = getMetaArea().getStateLocation(bundle);
  if (create)
    result.toFile().mkdirs();
  return result;
}
origin: org.eclipse.core/runtime

if (!path.toFile().exists()) {
  String msg = NLS.bind(PrefsMessages.preferences_fileNotFound, path.toOSString());
  throw new CoreException(new Status(IStatus.ERROR, PrefsMessages.OWNER_NAME, 1, msg, null));
InputStream input = null;
try {
  input = new BufferedInputStream(new FileInputStream(path.toFile()));
  service.importPreferences(input);
} catch (FileNotFoundException e) {
origin: org.eclipse.core/runtime

File file = path.toFile();
if (file.exists())
  file.delete();
origin: org.eclipse.core/runtime

/**
 * 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;
}
origin: eclipse/eclipse.jdt.ls

public static String getWorkspaceInvisibleProjectName(IPath workspacePath) {
  String fileName = workspacePath.toFile().getName();
  String projectName = fileName + "_" + Integer.toHexString(workspacePath.toPortableString().hashCode());
  return projectName;
}
origin: org.eclipse.platform/org.eclipse.core.resources

/**
 * Reads and returns a project description stored at the given location
 */
public ProjectDescription read(IPath location) throws IOException {
  try (
    BufferedInputStream file = new BufferedInputStream(new FileInputStream(location.toFile()));
  ) {
    return read(new InputSource(file));
  }
}
origin: eclipse/buildship

private void verifyNoWorkspaceRootIsImported(File rootDir, IProgressMonitor monitor) {
  File workspaceRoot = ResourcesPlugin.getWorkspace().getRoot().getLocation().toFile();
  if (rootDir.equals(workspaceRoot)) {
    throw new UnsupportedConfigurationException(String.format("Project %s location matches workspace root %s", rootDir.getName(), workspaceRoot.getAbsolutePath()));
  }
}
origin: org.eclipse.neoscada.ide/org.eclipse.scada.configuration.world.lib

protected void createDriver ( final IFolder nodeDir, final IProgressMonitor monitor, final File packageFolder, final Map<String, String> replacements, final String driverName ) throws IOException, Exception
{
  final File sourceDir = new File ( nodeDir.getLocation ().toFile (), driverName );
  replacements.put ( "driverName", driverName );
  processDriver ( monitor, packageFolder, replacements, driverName, sourceDir );
  replacements.remove ( "driverName" );
}
origin: org.eclipse.platform/org.eclipse.core.resources

/**
 * Creates the meta area root directory.
 */
public synchronized void createMetaArea() throws CoreException {
  java.io.File workspaceLocation = metaAreaLocation.toFile();
  Workspace.clear(workspaceLocation);
  if (!workspaceLocation.mkdirs()) {
    String message = NLS.bind(Messages.resources_writeWorkspaceMeta, workspaceLocation);
    throw new ResourceException(IResourceStatus.FAILED_WRITE_METADATA, null, message, null);
  }
}
origin: org.eclipse.equinox/common

public IPath getPreferenceLocation(String bundleName, boolean create) throws IllegalStateException {
  IPath result = getStateLocation(bundleName);
  if (create)
    result.toFile().mkdirs();
  return result.append(PREFERENCES_FILE_NAME);
}
origin: com.github.veithen.cosmos.bootstrap/org.eclipse.equinox.common

public IPath getPreferenceLocation(String bundleName, boolean create) throws IllegalStateException {
  IPath result = getStateLocation(bundleName);
  if (create)
    result.toFile().mkdirs();
  return result.append(PREFERENCES_FILE_NAME);
}
origin: infinitest/infinitest

/**
 * Returns a File that corresponds to the absolute location of the project's
 * root directory.
 */
public File workingDirectory() {
  return project.getProject().getLocation().toFile();
}
origin: eclipse/buildship

public DefaultBuildConfigurationProperties readBuildConfiguratonProperties(IProject project) {
  Preconditions.checkNotNull(project);
  PreferenceStore preferences = PreferenceStore.forProjectScope(project, PREF_NODE);
  return readPreferences(preferences, project.getLocation().toFile());
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.core.runtime

public IPath getStateLocation(Bundle bundle, boolean create) throws IllegalStateException {
  assertInitialized();
  IPath result = getMetaArea().getStateLocation(bundle);
  if (create)
    result.toFile().mkdirs();
  return result;
}
origin: org.eclipse.tycho/org.eclipse.jdt.core

/**
 * Returns the File to use for saving and restoring the last built state for the given project.
 */
private File getSerializationFile(IProject project) {
  if (!project.exists()) return null;
  IPath workingLocation = project.getWorkingLocation(JavaCore.PLUGIN_ID);
  return workingLocation.append("state.dat").toFile(); //$NON-NLS-1$
}
origin: org.eclipse.pde/org.eclipse.pde.ui

static File getSerializationFile(IProject project) {
  if (!project.exists()) {
    return null;
  }
  IPath workingLocation = project.getWorkingLocation(API_TOOL_PLUGIN_ID);
  return workingLocation.append("state.dat").toFile(); //$NON-NLS-1$
}
origin: eclipse/eclipse.jdt.ls

private String getPackageName(IPath javaFile) {
  IProject project = JavaLanguageServerPlugin.getProjectsManager().getDefaultProject();
  if (project == null || !project.isAccessible()) {
    return "";
  }
  IJavaProject javaProject = JavaCore.create(project);
  return JDTUtils.getPackageName(javaProject, javaFile.toFile().toURI());
}
origin: eclipse/buildship

@Override
public void deleteProjectConfiguration(IProject project) {
  if (project.isAccessible()) {
    this.buildConfigurationPersistence.deletePathToRoot(project);
  } else {
    this.buildConfigurationPersistence.deletePathToRoot(project.getLocation().toFile());
  }
}
origin: eclipse/eclipse.jdt.ls

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));
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

/**
 * Stores the widget values in the JAR package.
 */
@Override
protected void updateModel() {
  super.updateModel();
  String comboText= fAntScriptNamesCombo.getText();
  IPath path= Path.fromOSString(comboText);
  if (path.segmentCount() > 0 && ensureAntScriptFileIsValid(path.toFile()) && path.getFileExtension() == null)
    path= path.addFileExtension(ANTSCRIPT_EXTENSION);
  fAntScriptLocation= getAbsoluteLocation(path);
}
org.eclipse.core.runtimeIPathtoFile

Javadoc

Returns a java.io.File corresponding to this path.

Popular methods of IPath

  • toString
    Returns a string representation of this path, including its device id. The same separator, "/", is u
  • toOSString
    Returns a string representation of this path which uses the platform-dependent path separator define
  • append
    Returns the canonicalized path obtained from the concatenation of the given path's segments to the e
  • segmentCount
    Returns the number of segments in this path. Note that both root and empty paths have 0 segments.
  • removeLastSegments
    Returns a copy of this path with the given number of segments removed from the end. The device id is
  • lastSegment
    Returns the last segment of this path, ornull if it does not have any segments.
  • removeFirstSegments
    Returns a copy of this path with the given number of segments removed from the beginning. The device
  • segment
    Returns the specified segment of this path, ornull if the path does not have such a segment.
  • equals
    Returns whether this path equals the given object. Equality for paths is defined to be: same sequenc
  • isAbsolute
    Returns whether this path is an absolute path (ignoring any device id). Absolute paths start with a
  • isPrefixOf
    Returns whether this path is a prefix of the given path. To be a prefix, this path's segments must a
  • toPortableString
    Returns a platform-neutral string representation of this path. The format is not specified, except t
  • isPrefixOf,
  • toPortableString,
  • makeRelative,
  • makeAbsolute,
  • getDevice,
  • isEmpty,
  • addTrailingSeparator,
  • getFileExtension,
  • setDevice

Popular in Java

  • Making http post requests using okhttp
  • getSupportFragmentManager (FragmentActivity)
  • scheduleAtFixedRate (Timer)
  • findViewById (Activity)
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • Kernel (java.awt.image)
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • JTextField (javax.swing)
  • Top 17 Free Sublime Text Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now