當前位置: 首頁>>代碼示例>>Java>>正文


Java IProjectDescription.setLocation方法代碼示例

本文整理匯總了Java中org.eclipse.core.resources.IProjectDescription.setLocation方法的典型用法代碼示例。如果您正苦於以下問題:Java IProjectDescription.setLocation方法的具體用法?Java IProjectDescription.setLocation怎麽用?Java IProjectDescription.setLocation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.core.resources.IProjectDescription的用法示例。


在下文中一共展示了IProjectDescription.setLocation方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createProject

import org.eclipse.core.resources.IProjectDescription; //導入方法依賴的package包/類
protected void createProject ( final IProgressMonitor monitor ) throws CoreException
{
    monitor.beginTask ( "Create project", 2 );

    final IProject project = this.info.getProject ();

    final IProjectDescription desc = project.getWorkspace ().newProjectDescription ( project.getName () );
    desc.setLocation ( this.info.getProjectLocation () );
    desc.setNatureIds ( new String[] { Constants.PROJECT_NATURE_CONFIGURATION, PROJECT_NATURE_JS } );

    final ICommand jsCmd = desc.newCommand ();
    jsCmd.setBuilderName ( BUILDER_JS_VALIDATOR );

    final ICommand localBuilder = desc.newCommand ();
    localBuilder.setBuilderName ( Constants.PROJECT_BUILDER );

    desc.setBuildSpec ( new ICommand[] { jsCmd, localBuilder } );

    if ( !project.exists () )
    {
        project.create ( desc, new SubProgressMonitor ( monitor, 1 ) );
        project.open ( new SubProgressMonitor ( monitor, 1 ) );
    }
    monitor.done ();
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:26,代碼來源:CreateProjectOperation.java

示例2: createProjectPluginResource

import org.eclipse.core.resources.IProjectDescription; //導入方法依賴的package包/類
public IProject createProjectPluginResource(String projectName, IProgressMonitor monitor) throws CoreException {
	IWorkspace myWorkspace = ResourcesPlugin.getWorkspace();
	IWorkspaceRoot myWorkspaceRoot = myWorkspace.getRoot();
	IProject resourceProject = myWorkspaceRoot.getProject(projectName);
	
	if (!resourceProject.exists()) {		
		if(myWorkspaceRoot.getLocation().toFile().equals(new Path(Engine.PROJECTS_PATH).toFile())){
			logDebug("createProjectPluginResource : project is in the workspace folder");
			
			resourceProject.create(monitor);
		}else{
			logDebug("createProjectPluginResource: project isn't in the workspace folder");
	
			IPath projectPath = new Path(Engine.PROJECTS_PATH + "/" + projectName).makeAbsolute();
			IProjectDescription description = myWorkspace.newProjectDescription(projectName);
			description.setLocation(projectPath);
			resourceProject.create(description, monitor);
		}
	}
	
	return resourceProject;
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:23,代碼來源:ConvertigoPlugin.java

示例3: createLinkedProject

import org.eclipse.core.resources.IProjectDescription; //導入方法依賴的package包/類
public IProject createLinkedProject(String projectName, Plugin plugin, IPath linkPath) throws CoreException {
	IWorkspace workspace = ResourcesPlugin.getWorkspace();
	IProject project = workspace.getRoot().getProject(projectName);

	IProjectDescription desc = workspace.newProjectDescription(projectName);
	File file = getFileInPlugin(plugin, linkPath);
	IPath projectLocation = new Path(file.getAbsolutePath());
	if (Platform.getLocation().equals(projectLocation))
		projectLocation = null;
	desc.setLocation(projectLocation);

	project.create(desc, NULL_MONITOR);
	if (!project.isOpen())
		project.open(NULL_MONITOR);

	return project;
}
 
開發者ID:de-jcup,項目名稱:egradle,代碼行數:18,代碼來源:EclipseResourceHelper.java

示例4: createProject

import org.eclipse.core.resources.IProjectDescription; //導入方法依賴的package包/類
/**
 * Create the project directory.
 * If the user has specified an external project location,
 * the project is created with a custom description for the location.
 * 
 * @param project project
 * @param monitor progress monitor
 * @throws CoreException
 */
private void createProject(IProject project, IProgressMonitor monitor)
        throws CoreException {

    monitor.subTask(TexlipsePlugin.getResourceString("projectWizardProgressDirectory"));
    
    if (!project.exists()) {
        if (attributes.getProjectLocation() != null) {
            IProjectDescription desc = project.getWorkspace().newProjectDescription(project.getName());
            IPath projectPath = new Path(attributes.getProjectLocation());
            IStatus stat = ResourcesPlugin.getWorkspace().validateProjectLocation(project, projectPath);
            if (stat.getSeverity() != IStatus.OK) {
                // should not happen. the location should have been checked in the wizard page
                throw new CoreException(stat);
            }
            desc.setLocation(projectPath);
            project.create(desc, monitor);
        } else {
            project.create(monitor);
        }
    }
    if (!project.isOpen()) {
        project.open(monitor);
    }
}
 
開發者ID:eclipse,項目名稱:texlipse,代碼行數:34,代碼來源:TexlipseProjectCreationOperation.java

示例5: projectRename

import org.eclipse.core.resources.IProjectDescription; //導入方法依賴的package包/類
/**
* Renames and moves the project, but does not delete the old project. It's
* the callee's reponsibility.
* 
* @param project
* @param aNewName
*/
  public static IProject projectRename(final IProject project, final String aNewName, final IProgressMonitor aMonitor)
  {
      try
      {
      	// move the project location to the new location and name
          final IProjectDescription description = project.getDescription();
          final IPath basePath = description.getLocation().removeLastSegments(1).removeTrailingSeparator();
	final IPath newPath = basePath.append(aNewName.concat(TOOLBOX_DIRECTORY_SUFFIX)).addTrailingSeparator();
          description.setLocation(newPath);
          description.setName(aNewName);

          // refresh the project prior to moving to make sure the fs and resource fw are in sync
      	project.refreshLocal(IResource.DEPTH_INFINITE, aMonitor);
          
      	project.copy(description, IResource.NONE | IResource.SHALLOW, aMonitor);
          
          return ResourcesPlugin.getWorkspace().getRoot().getProject(aNewName);
      } catch (CoreException e)
      {
          Activator.getDefault().logError("Error renaming a specification", e);
      }
      return null;
  }
 
開發者ID:tlaplus,項目名稱:tlaplus,代碼行數:31,代碼來源:ResourceHelper.java

示例6: performFinish

import org.eclipse.core.resources.IProjectDescription; //導入方法依賴的package包/類
@Override
public boolean performFinish() {
	
	try {
		createdProject = _askProjectNamePage.getProjectHandle();
		final String languageName = _askLanguageNamePage.getLanguageName();

		IWorkspace workspace = ResourcesPlugin.getWorkspace(); 
		final IProjectDescription description = workspace.newProjectDescription(createdProject.getName());
		if (!_askProjectNamePage.getLocationPath().equals(workspace.getRoot().getLocation()))
			description.setLocation(_askProjectNamePage.getLocationPath());
		//description.setLocationURI(_askProjectNamePage.getLocationURI());
		
		IWorkspaceRunnable operation = new IWorkspaceRunnable() {
			 public void run(IProgressMonitor monitor) throws CoreException {
				 createdProject.create(description, monitor);
				 createdProject.open(monitor);
				 initializeProject(createdProject, languageName);
				 createdProject.refreshLocal(IResource.DEPTH_INFINITE, monitor);
				 createdProject.touch(new NullProgressMonitor()); // [FT] One touch to force eclipse to serialize the project properties that will update accordingly the gemoc actions in the menu.
				 //createdProject.build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor());
			 }
		};
		ResourcesPlugin.getWorkspace().run(operation, null);
	} catch (CoreException exception) {
		Activator.error(exception.getMessage(), exception);
		return false;
	}
	return true;
}
 
開發者ID:eclipse,項目名稱:gemoc-studio-modeldebugging,代碼行數:31,代碼來源:AbstractCreateNewGemocLanguageProject.java

示例7: moveProjectPluginResource

import org.eclipse.core.resources.IProjectDescription; //導入方法依賴的package包/類
public void moveProjectPluginResource(String projectName, String newName) throws CoreException {
	cacheIProject.remove(projectName);
	IWorkspace myWorkspace = ResourcesPlugin.getWorkspace();
	IWorkspaceRoot myWorkspaceRoot = myWorkspace.getRoot();
	IProject resourceProject = myWorkspaceRoot.getProject(projectName);
	
	if (resourceProject.exists()) {
		IPath newProjectPath = new Path(Engine.PROJECTS_PATH + "/" + newName).makeAbsolute();
       	IProjectDescription description = myWorkspace.newProjectDescription(newName);
		description.setLocation(newProjectPath);
       	resourceProject.move(description, false, null);
	}
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:14,代碼來源:ConvertigoPlugin.java

示例8: createProject

import org.eclipse.core.resources.IProjectDescription; //導入方法依賴的package包/類
@Override
protected IProject createProject(final String localPath, final ImportOptions importOptions)
    throws CoreException {
    final IPath projectRootPath = new Path(localPath);

    final String projectName = new File(localPath).getName();
    final IProject eclipseProject = importOptions.getEclipseWorkspace().getRoot().getProject(projectName);
    final IProjectDescription description =
        importOptions.getEclipseWorkspace().newProjectDescription(projectName);

    description.setLocation(projectRootPath);

    /*
     * If this project is NOT to be beneath the workspace root, then we
     * need to specify the project description specifically.
     */
    final IPath workspaceRootLocation = importOptions.getEclipseWorkspace().getRoot().getLocation();

    if (LocalPath.isChild(workspaceRootLocation.toOSString(), projectRootPath.toOSString())) {
        /* Inside workspace root */
        eclipseProject.create(null, null);
    } else {
        /* Outside workspace root */
        eclipseProject.create(description, null);
    }

    return eclipseProject;
}
 
開發者ID:Microsoft,項目名稱:team-explorer-everywhere,代碼行數:29,代碼來源:ImportOpenProjectStrategy.java

示例9: createOrImportProject

import org.eclipse.core.resources.IProjectDescription; //導入方法依賴的package包/類
private IProject createOrImportProject(File directory, IWorkspaceRoot workspaceRoot,
		IProgressMonitor progressMonitor) throws Exception {
	IProjectDescription desc = null;
	File expectedProjectDescriptionFile = new File(directory, IProjectDescription.DESCRIPTION_FILE_NAME);
	if (expectedProjectDescriptionFile.exists()) {
		desc = ResourcesPlugin.getWorkspace()
				.loadProjectDescription(new Path(expectedProjectDescriptionFile.getAbsolutePath()));
		String expectedName = desc.getName();
		IProject projectWithSameName = workspaceRoot.getProject(expectedName);
		if (projectWithSameName.exists()) {
			if (projectWithSameName.getLocation().toFile().equals(directory)) {
				// project seems already there
				return projectWithSameName;
			}
			throw new Exception(NLS.bind(
					AngularCLIMessages.AbstractProjectCommandInterpreter_anotherProjectWithSameNameExists_description,
					expectedName));
		}
	} else {
		String projectName = directory.getName();
		if (workspaceRoot.getProject(directory.getName()).exists()) {
			int i = 1;
			do {
				projectName = directory.getName() + '(' + i + ')';
				i++;
			} while (workspaceRoot.getProject(projectName).exists());
		}

		desc = ResourcesPlugin.getWorkspace().newProjectDescription(projectName);
	}
	desc.setLocation(new Path(directory.getAbsolutePath()));
	IProject res = workspaceRoot.getProject(desc.getName());
	res.create(desc, progressMonitor);
	return res;
}
 
開發者ID:angelozerr,項目名稱:angular-eclipse,代碼行數:36,代碼來源:NgProjectJob.java

示例10: createBaseProject

import org.eclipse.core.resources.IProjectDescription; //導入方法依賴的package包/類
private static IProject createBaseProject(String projectName, IPath location) {
	IProject newProject = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);

	if (!newProject.exists()) {
		IPath projectLocation = location;
		IProjectDescription desc = newProject.getWorkspace().newProjectDescription(newProject.getName());
		if (location != null &&
				ResourcesPlugin.getWorkspace().getRoot().getLocation().equals(location)) {
			projectLocation = null;
		}
		desc.setLocation(projectLocation);
		try {
			newProject.create(desc, null);
			if (!newProject.isOpen()) {
				newProject.open(null);
			}
		} catch (CoreException e) {
               WPILibCore.logError("Can't create new project.", e);
			Display.getDefault().syncExec(new Runnable() {
			@Override
			public void run() {
				MessageDialog.openError(Display.getDefault().getActiveShell(), "Error", "Error creating project! This may occur if a project of the same name with different case exists in the Workspace");
			}
		});
		}
	}else {
		Display.getDefault().syncExec(new Runnable() {
			@Override
			public void run() {
				MessageDialog.openError(Display.getDefault().getActiveShell(), "Error", "Error! A project of the same name already exists in the Workspace");
			}
		});
	}
	return newProject;
}
 
開發者ID:wpilibsuite,項目名稱:EclipsePlugins,代碼行數:36,代碼來源:ProjectCreationUtils.java

示例11: moveProject

import org.eclipse.core.resources.IProjectDescription; //導入方法依賴的package包/類
@Override
public boolean moveProject(
    final IResourceTree tree,
    final IProject source,
    final IProjectDescription target,
    final int updateFlags,
    final IProgressMonitor progressMonitor) {
    log.trace(MessageFormat.format("moveProject: {0}", source.getFullPath())); //$NON-NLS-1$

    progressMonitor.beginTask(
        MessageFormat.format(Messages.getString("TFSMoveDeleteHook.MovingProjectFormat"), source.getFullPath()), //$NON-NLS-1$
        10);

    log.info(MessageFormat.format("Rename detected from project {0} to {1}", source, target)); //$NON-NLS-1$

    try {
        /*
         * Renaming the project only. Does not move folders, only sets the
         * new name in the .project file.
         */
        if (target.getName() != source.getName()) {
            target.setLocation(source.getLocation());
            tree.standardMoveProject(source, target, updateFlags, new SubProgressMonitor(progressMonitor, 10));
            return true;
        } else {
            /*
             * User is attempting to relocate the project. This gets hairy
             * and would involve changing WF mappings in order to pend a
             * rename.
             */
            tree.failed(
                new Status(
                    IStatus.ERROR,
                    TFSEclipseClientPlugin.PLUGIN_ID,
                    0,
                    MessageFormat.format(
                        Messages.getString("TFSMoveDeleteHook.MovingProjectNotSupportedInProductFormat"), //$NON-NLS-1$
                        ProductInformation.getCurrent().toString()),
                    null));
            return true;
        }
    } finally {
        progressMonitor.done();
    }
}
 
開發者ID:Microsoft,項目名稱:team-explorer-everywhere,代碼行數:46,代碼來源:TFSMoveDeleteHook.java

示例12: setProjectToRoot

import org.eclipse.core.resources.IProjectDescription; //導入方法依賴的package包/類
private void setProjectToRoot(final IProject project, File destPath) throws CoreException {
	IProjectDescription description = project.getDescription();
	description.setLocation(new Path(destPath.getAbsolutePath()));
	project.move(description, true, null);
}
 
開發者ID:subclipse,項目名稱:subclipse,代碼行數:6,代碼來源:CheckoutCommand.java


注:本文中的org.eclipse.core.resources.IProjectDescription.setLocation方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。