Java Code Examples for org.eclipse.core.runtime.Platform#getLocation()

The following examples show how to use org.eclipse.core.runtime.Platform#getLocation() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CheckConfigurationFactory.java    From eclipse-cs with GNU Lesser General Public License v2.1 6 votes vote down vote up
private static IPath getTargetStateLocation(IPath newWorkspaceRoot) {

    IPath currentWorkspaceRoot = Platform.getLocation();
    IPath currentStateLocation = CheckstylePlugin.getDefault().getStateLocation();

    if (currentStateLocation == null) {
      return null;
    }
    int segmentsToRemove = currentStateLocation.matchingFirstSegments(currentWorkspaceRoot);

    // Strip it down to the extension
    currentStateLocation = currentStateLocation.removeFirstSegments(segmentsToRemove);

    // Now add to the target workspace root
    IPath targetStateLocation = newWorkspaceRoot.append(currentStateLocation);
    return targetStateLocation;

  }
 
Example 2
Source File: ConverterUtil.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 得到本地文件。
 * @param workspacePath
 * @return ;
 */
public static File toLocalFile(String workspacePath) {
	if (isWorkspacePath(workspacePath)) {
		IPath path = Platform.getLocation();
		return path.append(workspacePath).toFile();
	} else {
		return new File(workspacePath);
	}
}
 
Example 3
Source File: NewProjectNameAndLocationWizardPage.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates a new project creation wizard page.
 *
 * @param pageName the name of this page
 */
public NewProjectNameAndLocationWizardPage(String pageName) {
    super(pageName);
    setTitle("PyDev Project");
    setDescription("Create a new PyDev Project.");
    setPageComplete(false);
    initialLocationFieldValue = Platform.getLocation();
    customLocationFieldValue = ""; //$NON-NLS-1$

    fWorkingSetGroup = new WorkingSetGroup();
    setWorkingSets(new IWorkingSet[0]);
}
 
Example 4
Source File: NewLibraryWizard.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected IPath getDefaultContainerPath( )
{
	IWorkbenchWindow benchWindow = PlatformUI.getWorkbench( )
			.getActiveWorkbenchWindow( );
	IWorkbenchPart part = benchWindow.getPartService( ).getActivePart( );

	Object selection = null;
	if ( part instanceof IEditorPart )
	{
		selection = ( (IEditorPart) part ).getEditorInput( );
	}
	else
	{
		ISelection sel = benchWindow.getSelectionService( ).getSelection( );
		if ( ( sel != null ) && ( sel instanceof IStructuredSelection ) )
		{
			selection = ( (IStructuredSelection) sel ).getFirstElement( );
		}
	}

	IContainer ct = getDefaultContainer( selection );

	if ( ct == null )
	{
		IEditorPart editor = UIUtil.getActiveEditor( true );

		if ( editor != null )
		{
			ct = getDefaultContainer( editor.getEditorInput( ) );
		}
	}

	if ( ct != null )
	{
		return ct.getFullPath( );
	}

	return Platform.getLocation( );
}
 
Example 5
Source File: ConverterUtil.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 得到本地文件。
 * @param workspacePath
 * @return ;
 */
public static File toLocalFile(String workspacePath) {
	if (isWorkspacePath(workspacePath)) {
		IPath path = Platform.getLocation();
		return path.append(workspacePath).toFile();
	} else {
		return new File(workspacePath);
	}
}
 
Example 6
Source File: ConverterUtil.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 得到本地文件系统路径
 * @param workspacePath
 * @return ;
 */
public static String toLocalPath(String workspacePath) {
	if (isWorkspacePath(workspacePath)) {
		IPath path = Platform.getLocation();
		return path.append(workspacePath).toOSString();
	} else {
		return workspacePath;
	}
}
 
Example 7
Source File: ConverterUtil.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 得到本地文件系统路径
 * @param workspacePath
 * @return ;
 */
public static String toLocalPath(String workspacePath) {
	if (isWorkspacePath(workspacePath)) {
		IPath path = Platform.getLocation();
		return path.append(workspacePath).toOSString();
	} else {
		return workspacePath;
	}
}
 
Example 8
Source File: ConverterUtil.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 得到本地文件。
 * @param workspacePath
 * @return ;
 */
public static File toLocalFile(String workspacePath) {
	if (isWorkspacePath(workspacePath)) {
		IPath path = Platform.getLocation();
		return path.append(workspacePath).toFile();
	} else {
		return new File(workspacePath);
	}
}
 
Example 9
Source File: ConverterUtil.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 得到本地文件系统路径
 * @param workspacePath
 * @return ;
 */
public static String toLocalPath(String workspacePath) {
	if (isWorkspacePath(workspacePath)) {
		IPath path = Platform.getLocation();
		return path.append(workspacePath).toOSString();
	} else {
		return workspacePath;
	}
}
 
Example 10
Source File: ConverterUtil.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 得到本地文件。
 * @param workspacePath
 * @return ;
 */
public static File toLocalFile(String workspacePath) {
	if (isWorkspacePath(workspacePath)) {
		IPath path = Platform.getLocation();
		return path.append(workspacePath).toFile();
	} else {
		return new File(workspacePath);
	}
}
 
Example 11
Source File: ConverterUtil.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 得到本地文件系统路径
 * @param workspacePath
 * @return ;
 */
public static String toLocalPath(String workspacePath) {
	if (isWorkspacePath(workspacePath)) {
		IPath path = Platform.getLocation();
		return path.append(workspacePath).toOSString();
	} else {
		return workspacePath;
	}
}
 
Example 12
Source File: MainProjectWizardPage.java    From sarl with Apache License 2.0 4 votes vote down vote up
public IPath getLocation() {
	if (isUseDefaultSelected()) {
		return Platform.getLocation();
	}
	return Path.fromOSString(this.location.getText().trim());
}
 
Example 13
Source File: NewReportTemplateWizard.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Get the default location for the provided name.
 * 
 * @return the location
 */
private String getDefaultLocation( )
{
	IPath defaultPath = Platform.getLocation( );
	return defaultPath.toOSString( );
}
 
Example 14
Source File: WizardNewLibraryCreationPage.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
private String getDefaultLocation( )
{
	IPath defaultPath = Platform.getLocation( );
	return defaultPath.toOSString( );
}
 
Example 15
Source File: NewReportWizard.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Get the defualt location for the provided name.
 * 
 * @return the location
 */
private String getDefaultLocation( )
{
	IPath defaultPath = Platform.getLocation( );
	return defaultPath.toOSString( );
}
 
Example 16
Source File: RCPOpenSampleReportAction.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
private String getDefaultLocation( )
{
	IPath defaultPath = Platform.getLocation( );
	return defaultPath.toOSString( );
}
 
Example 17
Source File: NewJavaProjectWizardPageOne.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public IPath getLocation() {
	if (isUseDefaultSelected()) {
		return Platform.getLocation();
	}
	return Path.fromOSString(fLocation.getText().trim());
}