本文整理汇总了Java中org.python.pydev.plugin.PyStructureConfigHelpers类的典型用法代码示例。如果您正苦于以下问题:Java PyStructureConfigHelpers类的具体用法?Java PyStructureConfigHelpers怎么用?Java PyStructureConfigHelpers使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PyStructureConfigHelpers类属于org.python.pydev.plugin包,在下文中一共展示了PyStructureConfigHelpers类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initializeBase
import org.python.pydev.plugin.PyStructureConfigHelpers; //导入依赖的package包/类
public IProject initializeBase() throws CoreException
{
//IProject project = null;;
return PyStructureConfigHelpers.createPydevProject(
projectName, null, null,
monitor, pyProjectType, projectInterpreter,
getSourceFolderHandlesCallback, null, null,
null);
}
示例2: doActionOnContainer
import org.python.pydev.plugin.PyStructureConfigHelpers; //导入依赖的package包/类
@Override
protected int doActionOnContainer(IContainer container, IProgressMonitor monitor) {
try {
IProject project = container.getProject();
IPythonPathNature pythonPathNature = PythonNature.getPythonPathNature(project);
if (pythonPathNature == null) {
Log.log("Unable to get PythonNature on project: " + project);
return 0;
}
OrderedMap<String, String> projectSourcePathMap = pythonPathNature
.getProjectSourcePathResolvedToUnresolvedMap();
String pathToAdd = container.getFullPath().toString();
if (projectSourcePathMap.containsKey(pathToAdd)) {
return 0;
}
pathToAdd = PyStructureConfigHelpers.convertToProjectRelativePath(project.getFullPath().toString(),
pathToAdd);
Collection<String> values = new ArrayList<String>(projectSourcePathMap.values());
values.add(pathToAdd);
pythonPathNature.setProjectSourcePath(StringUtils.join("|", values));
PythonNature.getPythonNature(project).rebuildPath();
return 1;
} catch (CoreException e) {
Log.log(IStatus.ERROR, "Unexpected error setting project properties", e);
}
return 0;
}
示例3: createAndConfigProject
import org.python.pydev.plugin.PyStructureConfigHelpers; //导入依赖的package包/类
/**
* This method can be overridden to provide a custom creation of the project.
*
* It should create the project, configure the folders in the pythonpath (source folders and external folders
* if applicable), set the project type and project interpreter.
*/
protected void createAndConfigProject(final IProject newProjectHandle, final IProjectDescription description,
final String projectType, final String projectInterpreter, IProgressMonitor monitor,
Object... additionalArgsToConfigProject) throws CoreException {
ICallback<List<IContainer>, IProject> getSourceFolderHandlesCallback = this.getSourceFolderHandlesCallback;
ICallback<List<IPath>, IProject> getExistingSourceFolderHandlesCallback = this.getExistingSourceFolderHandlesCallback;
PyStructureConfigHelpers.createPydevProject(description, newProjectHandle, monitor, projectType,
projectInterpreter, getSourceFolderHandlesCallback, null, getExistingSourceFolderHandlesCallback);
}
示例4: getPathAsString
import org.python.pydev.plugin.PyStructureConfigHelpers; //导入依赖的package包/类
/**
* @param project
* @return The passed path as a string (used for the selection dialog, as things come relative to the workspace).
*/
private String getPathAsString(IPath p, IProject project) {
String ret = p.toString();
if (ret.startsWith("/") == false) {
ret = "/" + ret;
}
return PyStructureConfigHelpers.convertToProjectRelativePath(project.getFullPath().toString(), ret);
}
示例5: doCreateNew
import org.python.pydev.plugin.PyStructureConfigHelpers; //导入依赖的package包/类
@Override
protected IFile doCreateNew(IProgressMonitor monitor) throws CoreException {
IProject project = filePage.getValidatedProject();
String name = filePage.getValidatedName();
IPath source = filePage.getSourceToLink();
if (project == null || !project.exists()) {
throw new RuntimeException("The project selected does not exist in the workspace.");
}
IPythonPathNature pathNature = PythonNature.getPythonPathNature(project);
if (pathNature == null) {
IPythonNature nature = PythonNature.addNature(project, monitor, null, null, null, null, null);
pathNature = nature.getPythonPathNature();
if (pathNature == null) {
throw new RuntimeException("Unable to add the nature to the seleted project.");
}
}
if (source == null || !source.toFile().exists()) {
throw new RuntimeException("The source to link to, " + source.toString() + ", does not exist.");
}
IFolder folder = project.getFolder(name);
if (!folder.exists()) {
folder.createLink(source, IResource.BACKGROUND_REFRESH, monitor);
}
String newPath = folder.getFullPath().toString();
String curr = pathNature.getProjectSourcePath(true);
if (curr == null) {
curr = "";
}
if (curr.endsWith("|")) {
curr = curr.substring(0, curr.length() - 1);
}
String newPathRel = PyStructureConfigHelpers.convertToProjectRelativePath(
project.getFullPath().toString(), newPath);
if (curr.length() > 0) {
//there is already some path
Set<String> projectSourcePathSet = pathNature.getProjectSourcePathSet(true);
if (!projectSourcePathSet.contains(newPath)) {
//only add to the path if it doesn't already contain the new path
curr += "|" + newPathRel;
}
} else {
//there is still no other path
curr = newPathRel;
}
pathNature.setProjectSourcePath(curr);
PythonNature.getPythonNature(project).rebuildPath();
return null;
}
示例6: doCreateNew
import org.python.pydev.plugin.PyStructureConfigHelpers; //导入依赖的package包/类
@Override
protected IFile doCreateNew(IProgressMonitor monitor) throws CoreException {
IProject project = filePage.getValidatedProject();
String name = filePage.getValidatedName();
if (project == null || !project.exists()) {
throw new RuntimeException("The project selected does not exist in the workspace.");
}
IPythonPathNature pathNature = PythonNature.getPythonPathNature(project);
if (pathNature == null) {
IPythonNature nature = PythonNature.addNature(project, monitor, null, null, null, null, null);
pathNature = nature.getPythonPathNature();
if (pathNature == null) {
throw new RuntimeException("Unable to add the nature to the seleted project.");
}
}
IFolder folder = project.getFolder(name);
if (folder.exists()) {
Log.log("Source folder already exists. Nothing new was created");
return null;
}
folder.create(true, true, monitor);
String newPath = folder.getFullPath().toString();
String curr = pathNature.getProjectSourcePath(false);
if (curr == null) {
curr = "";
}
if (curr.endsWith("|")) {
curr = curr.substring(0, curr.length() - 1);
}
String newPathRel = PyStructureConfigHelpers.convertToProjectRelativePath(
project.getFullPath().toString(), newPath);
if (curr.length() > 0) {
//there is already some path
Set<String> projectSourcePathSet = pathNature.getProjectSourcePathSet(true);
if (!projectSourcePathSet.contains(newPath)) {
//only add to the path if it doesn't already contain the new path
curr += "|" + newPathRel;
}
} else {
//there is still no other path
curr = newPathRel;
}
pathNature.setProjectSourcePath(curr);
PythonNature.getPythonNature(project).rebuildPath();
return null;
}
示例7: getProjectHandle
import org.python.pydev.plugin.PyStructureConfigHelpers; //导入依赖的package包/类
/**
* Creates a project resource handle for the current project name field value.
* <p>
* This method does not create the project resource; this is the responsibility
* of <code>IProject::create</code> invoked by the new project resource wizard.
* </p>
*
* @return the new project resource handle
*/
public IProject getProjectHandle() {
return PyStructureConfigHelpers.getProjectHandle(getProjectName());
}
示例8: getProjectHandle
import org.python.pydev.plugin.PyStructureConfigHelpers; //导入依赖的package包/类
/**
* Creates a project resource handle for the current project name field value.
* <p>
* This method does not create the project resource; this is the responsibility
* of <code>IProject::create</code> invoked by the new project resource wizard.
* </p>
*
* @return the new project resource handle
*/
@Override
public IProject getProjectHandle() {
return PyStructureConfigHelpers.getProjectHandle(getProjectName());
}