Codota Logo
IPath.makeRelative
Code IndexAdd Codota to your IDE (free)

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

Best Java code snippets using org.eclipse.core.runtime.IPath.makeRelative (Showing top 20 results out of 504)

  • Common ways to obtain IPath
private void myMethod () {
IPath i =
  • Codota IconString fullPath;new Path(fullPath)
  • Codota IconIResource resource;resource.getLocation()
  • Codota IconIResource resource;resource.getFullPath()
  • Smart code suggestions by Codota
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.ide

/**
 * Sets the initial contents of the container name field.
 */
protected final void initialPopulateContainerField() {
  if (initialContainerFieldValue != null) {
    containerNameField.setText(initialContainerFieldValue);
  } else if (currentResourceSelection != null) {
    containerNameField.setText(currentResourceSelection.getFullPath()
        .makeRelative().toString());
  }
}
origin: org.eclipse.platform/org.eclipse.ui.navigator.resources

@Override
public String getDescription(Object anElement) {
  if (anElement instanceof IResource) {
    return ((IResource) anElement).getFullPath().makeRelative().toString();
  }
  return null;
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.ide

/**
 * Creates and returns the string that should be used as the name of the entry in the archive.
 * @param exportResource the resource to export
 * @param leadupDepth the number of resource levels to be included in the path including the resourse itself.
 */
private String createDestinationName(int leadupDepth, IResource exportResource) {
  IPath fullPath = exportResource.getFullPath();
  if (createLeadupStructure) {
    return fullPath.makeRelative().toString();
  }
  return fullPath.removeFirstSegments(fullPath.segmentCount() - leadupDepth).makeRelative().toString();
}
origin: org.eclipse.platform/org.eclipse.urischeme

/**
 * @param path Path which needs to be changed relative to OS
 * @return returns the changed string.
 */
static String stripProtocol(String path) {
  return new Path(path).setDevice(null).makeRelative().toOSString();
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.ide

/**
 * Set the resource whos name we will display.
 * @param resource
 */
protected void setResourceToDisplay(IResource resource) {
  setResourceFieldValue(resource.getFullPath().makeRelative().toString());
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

private void buildPathChangeControlPressed(DialogField field) {
  if (field == fBuildPathDialogField) {
    IContainer container= chooseContainer();
    if (container != null) {
      fBuildPathDialogField.setText(container.getFullPath().makeRelative().toString());
    }
  }
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

private void buildPathChangeControlPressed(DialogField field) {
  if (field == fBuildPathDialogField) {
    IContainer container= chooseContainer();
    if (container != null) {
      fBuildPathDialogField.setText(container.getFullPath().makeRelative().toString());
    }
  }
}
origin: org.eclipse/org.eclipse.jdt.ui

private void buildPathChangeControlPressed(DialogField field) {
  if (field == fBuildPathDialogField) {
    IContainer container= chooseContainer();
    if (container != null) {
      fBuildPathDialogField.setText(container.getFullPath().makeRelative().toString());
    }
  }
}

origin: org.eclipse/org.eclipse.jst.j2ee

protected IModuleResource[] getBinaryModuleMembers() {
  IPath archivePath = ((J2EEModuleVirtualArchiveComponent)component).getWorkspaceRelativePath();
  ModuleFile mf = null;
  if (archivePath != null) { //In Workspace
    IFile utilFile = ResourcesPlugin.getWorkspace().getRoot().getFile(archivePath);
    mf = new ModuleFile(utilFile, utilFile.getName(), ((J2EEModuleVirtualArchiveComponent)component).getRuntimePath().makeRelative());
  } else {
    File extFile = ((J2EEModuleVirtualArchiveComponent)component).getUnderlyingDiskFile();
    mf = new ModuleFile(extFile, extFile.getName(), ((J2EEModuleVirtualArchiveComponent)component).getRuntimePath().makeRelative());
  }
  return new IModuleResource[] {mf};
}

origin: org.eclipse.jdt/org.eclipse.jdt.core

/**
 * Notification before a compile that a unit is about to be compiled.
 */
public void aboutToCompile(SourceFile unit) {
  String message = Messages.bind(Messages.build_compiling, unit.resource.getFullPath().removeLastSegments(1).makeRelative().toString());
  subTask(message);
}

origin: org.eclipse.pde/org.eclipse.pde.ui

protected void handleBrowseWorkspace() {
  ContainerSelectionDialog dialog = new ContainerSelectionDialog(fLocationText.getShell(), getContainer(), true, PDEUIMessages.BaseBlock_relative);
  if (dialog.open() == Window.OK) {
    Object[] result = dialog.getResult();
    if (result.length == 0)
      return;
    IPath path = (IPath) result[0];
    fLocationText.setText("${workspace_loc:" + path.makeRelative().toString() + "}"); //$NON-NLS-1$ //$NON-NLS-2$
  }
}
origin: org.eclipse.tycho/org.eclipse.jdt.core

/**
 * Notification before a compile that a unit is about to be compiled.
 */
public void aboutToCompile(SourceFile unit) {
  String message = Messages.bind(Messages.build_compiling, unit.resource.getFullPath().removeLastSegments(1).makeRelative().toString());
  subTask(message);
}

origin: com.google.code.maven-play-plugin.org.eclipse.jdt/org.eclipse.jdt.core

/**
 * Notification before a compile that a unit is about to be compiled.
 */
public void aboutToCompile(SourceFile unit) {
  String message = Messages.bind(Messages.build_compiling, unit.resource.getFullPath().removeLastSegments(1).makeRelative().toString());
  subTask(message);
}
 
origin: org.eclipse/org.eclipse.jdt.ui

private String formatResourceMessage(IResource element) {
  IContainer parent = element.getParent();
  if (parent != null && parent.getType() != IResource.ROOT)
    return element.getName() + JavaElementLabels.CONCAT_STRING
        + parent.getFullPath().makeRelative().toString();
  else
    return element.getName();
}

origin: org.eclipse/org.eclipse.jdt.ui

private String getVariableString(IPath path) {
  String name= path.makeRelative().toString();
  IPath entryPath= JavaCore.getClasspathVariable(path.segment(0));
  if (entryPath != null) {
    String appended= entryPath.append(path.removeFirstSegments(1)).toOSString();
    return Messages.format(NewWizardMessages.CPListLabelProvider_twopart, new String[] { name, appended }); 
  } else {
    return name;
  }
}

origin: com.google.code.maven-play-plugin.org.eclipse.jdt/org.eclipse.jdt.core

/**
 * Notification while within a compile that a unit has finished being compiled.
 */
public void compiled(SourceFile unit) {
  String message = Messages.bind(Messages.build_compiling, unit.resource.getFullPath().removeLastSegments(1).makeRelative().toString());
  subTask(message);
  updateProgressDelta(this.progressPerCompilationUnit);
  checkCancelWithinCompiler();
}
 
origin: org.eclipse.jdt/org.eclipse.jdt.core

/**
 * Notification while within a compile that a unit has finished being compiled.
 */
public void compiled(SourceFile unit) {
  String message = Messages.bind(Messages.build_compiling, unit.resource.getFullPath().removeLastSegments(1).makeRelative().toString());
  subTask(message);
  updateProgressDelta(this.progressPerCompilationUnit);
  checkCancelWithinCompiler();
}

origin: org.eclipse.tycho/org.eclipse.jdt.core

/**
 * Notification while within a compile that a unit has finished being compiled.
 */
public void compiled(SourceFile unit) {
  String message = Messages.bind(Messages.build_compiling, unit.resource.getFullPath().removeLastSegments(1).makeRelative().toString());
  subTask(message);
  updateProgressDelta(this.progressPerCompilationUnit);
  checkCancelWithinCompiler();
}

origin: org.eclipse.platform/org.eclipse.search

void updateStatusLine() {
  boolean hasSingleSelection= getSelectedEntriesCount() == 1;
  String location= ""; //$NON-NLS-1$
  if (hasSingleSelection) {
    ISearchResultViewEntry entry= (ISearchResultViewEntry)getTable().getItem(getTable().getSelectionIndex()).getData();
    IPath path= entry.getResource().getFullPath();
    if (path != null)
      location= path.makeRelative().toString();
  }
  setStatusLineMessage(location);
}
origin: org.eclipse/org.eclipse.search

void updateStatusLine() {
  boolean hasSingleSelection= getSelectedEntriesCount() == 1;
  String location= ""; //$NON-NLS-1$
  if (hasSingleSelection) {
    ISearchResultViewEntry entry= (ISearchResultViewEntry)getTable().getItem(getTable().getSelectionIndex()).getData();
    IPath path= entry.getResource().getFullPath();
    if (path != null)
      location= path.makeRelative().toString();
  }
  setStatusLineMessage(location);
}
org.eclipse.core.runtimeIPathmakeRelative

Javadoc

Returns a relative path with the segments and device id of this path. Absolute paths start with a path separator and relative paths do not. If this path is relative, it is simply returned.

Popular methods of IPath

  • toString
    Returns a string representation of this path, including its device id. The same separator, "/", is u
  • toFile
    Returns a java.io.File corresponding to this path.
  • 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
  • isAbsolute,
  • isPrefixOf,
  • toPortableString,
  • makeAbsolute,
  • getDevice,
  • isEmpty,
  • addTrailingSeparator,
  • getFileExtension,
  • setDevice

Popular in Java

  • Parsing JSON documents to java classes using gson
  • requestLocationUpdates (LocationManager)
  • getSystemService (Context)
  • onRequestPermissionsResult (Fragment)
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement.A servlet is a small Java program that runs within
  • JButton (javax.swing)
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now