本文整理汇总了Java中org.eclipse.xtext.ui.XtextProjectHelper类的典型用法代码示例。如果您正苦于以下问题:Java XtextProjectHelper类的具体用法?Java XtextProjectHelper怎么用?Java XtextProjectHelper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
XtextProjectHelper类属于org.eclipse.xtext.ui包,在下文中一共展示了XtextProjectHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createTestProject
import org.eclipse.xtext.ui.XtextProjectHelper; //导入依赖的package包/类
/**
* Creates a project with two files.
*/
@SuppressWarnings("resource")
@BeforeClass
public static void createTestProject() throws Exception {
staticProject = ProjectUtils.createJSProject(PROJECT_NAME);
IFolder path = staticProject.getFolder("src").getFolder("path");
path.create(true, true, null);
IFile libFile = path.getFile("Libs.n4js");
libFile.create(new StringInputStream(
"export public class MyFirstClass {} export public class MySecondClass {} class MyHiddenClass {}",
libFile.getCharset()), true, monitor());
IFile moreLibFile = path.getFile("MoreLibs.n4js");
moreLibFile.create(new StringInputStream(
"export public class MoreLibFirstClass {} export public class MoreLibSecondClass {}",
moreLibFile.getCharset()), true, monitor());
IFile testFile = path.getFile("Test.n4js");
testFile.create(new StringInputStream("", testFile.getCharset()), true, monitor());
addNature(staticProject, XtextProjectHelper.NATURE_ID);
ProjectUtils.waitForAutoBuild();
}
示例2: toggleNature
import org.eclipse.xtext.ui.XtextProjectHelper; //导入依赖的package包/类
/**
* Toggles the EASy nature of <code>project</code>.
*
* @param project the project to toggle the EASy nature for
* @throws IOException in case of initialization problems
* @throws InvalidProjectnameException if a projectname is not valid
*/
public static final void toggleNature(IProject project) throws IOException, InvalidProjectnameException {
try {
boolean hasNature = NatureUtils.hasNature(project, EASyNature.NATURE_ID);
if (!hasNature) {
ResourcesMgmt.INSTANCE.addEASyNatures(project, XtextProjectHelper.NATURE_ID, EASyNature.NATURE_ID);
} else {
String projectID = ResourcesMgmt.INSTANCE.getIDfromResource(project);
ProductLineProject deletedPLP = (ProductLineProject) SPLsManager.INSTANCE.getPLP(projectID);
if (null != deletedPLP) {
deletedPLP.close();
}
NatureUtils.removeNature(project, EASyNature.NATURE_ID, null);
project.refreshLocal(IProject.DEPTH_INFINITE, null);
}
} catch (CoreException e) {
throw new IOException(e.getMessage());
}
}
示例3: configureProjectWithXtext
import org.eclipse.xtext.ui.XtextProjectHelper; //导入依赖的package包/类
/** Applies the Xtext nature to the project and creates (if necessary) and returns the source folder. */
public static IFolder configureProjectWithXtext(IProject project, String sourceFolder) throws CoreException {
addNature(project.getProject(), XtextProjectHelper.NATURE_ID);
IFolder folder = project.getProject().getFolder(sourceFolder);
if (!folder.exists()) {
folder.create(true, true, null);
}
return folder;
}
示例4: createTempProject
import org.eclipse.xtext.ui.XtextProjectHelper; //导入依赖的package包/类
/***/
protected URI createTempProject(String projectName) throws CoreException {
IProjectDescription description = workspace.getWorkspace().newProjectDescription(projectName);
// deliberately avoid the build command
description.setNatureIds(new String[] { XtextProjectHelper.NATURE_ID });
IProject newProject = workspace.getProject(projectName);
newProject.create(null);
newProject.open(null);
newProject.setDescription(description, null);
return URI.createPlatformResourceURI(projectName, true);
}
示例5: checkExists
import org.eclipse.xtext.ui.XtextProjectHelper; //导入依赖的package包/类
@Override
protected boolean checkExists() {
if (XtextProjectHelper.hasNature(project)) {
return project.getFile(N4MF_MANIFEST).exists();
}
return false;
}
示例6: addNature
import org.eclipse.xtext.ui.XtextProjectHelper; //导入依赖的package包/类
public void addNature(IProject project) {
try {
IProjectDescription description = project.getDescription();
String[] natures = description.getNatureIds();
String[] newNatures = new String[natures.length + 1];
System.arraycopy(natures, 0, newNatures, 0, natures.length);
newNatures[natures.length] = XtextProjectHelper.NATURE_ID;
description.setNatureIds(newNatures);
project.setDescription(description, null);
} catch (CoreException e) {
e.printStackTrace();
}
}
示例7: getProjectNatures
import org.eclipse.xtext.ui.XtextProjectHelper; //导入依赖的package包/类
protected String[] getProjectNatures() {
return new String[] {
JavaCore.NATURE_ID,
"org.eclipse.pde.PluginNature", //$NON-NLS-1$
XtextProjectHelper.NATURE_ID
};
}
示例8: getBuilders
import org.eclipse.xtext.ui.XtextProjectHelper; //导入依赖的package包/类
protected String[] getBuilders() {
return new String[]{
JavaCore.BUILDER_ID,
"org.eclipse.pde.ManifestBuilder", //$NON-NLS-1$
"org.eclipse.pde.SchemaBuilder", //$NON-NLS-1$
XtextProjectHelper.BUILDER_ID
};
}
示例9: loadParticipants
import org.eclipse.xtext.ui.XtextProjectHelper; //导入依赖的package包/类
@Override
public RefactoringParticipant[] loadParticipants(RefactoringStatus status, SharableParticipants sharedParticipants)
throws CoreException {
RenameParticipant[] renameParticipants = ParticipantManager.loadRenameParticipants(status, this,
renameElementContext, new RenameArguments(newName, true),
new String[] { XtextProjectHelper.NATURE_ID }, sharedParticipants);
return renameParticipants;
}
示例10: checkXtextNature
import org.eclipse.xtext.ui.XtextProjectHelper; //导入依赖的package包/类
protected void checkXtextNature() {
IFileEditorInput editorInput = (IFileEditorInput) getEditorInput();
IProject project = editorInput.getFile().getProject();
if (project != null && !XtextProjectHelper.hasNature(project) && project.isAccessible()
&& !project.isHidden()) {
addNature(project);
}
}
示例11: createJavaProjectWithRootSrc
import org.eclipse.xtext.ui.XtextProjectHelper; //导入依赖的package包/类
private IJavaProject createJavaProjectWithRootSrc(String string)
throws CoreException {
IJavaProject project = createJavaProject(string);
addNature(project.getProject(), XtextProjectHelper.NATURE_ID);
addSourceFolder(project, "src");
return project;
}
示例12: isAccessibleXtextProject
import org.eclipse.xtext.ui.XtextProjectHelper; //导入依赖的package包/类
protected boolean isAccessibleXtextProject(IProject p) {
return p != null && XtextProjectHelper.hasNature(p) && XtextProjectHelper.hasNature(p);
}
示例13: isAccessibleXtextProject
import org.eclipse.xtext.ui.XtextProjectHelper; //导入依赖的package包/类
protected boolean isAccessibleXtextProject(IProject p) {
return p != null && XtextProjectHelper.hasNature(p) && XtextProjectHelper.hasBuilder(p);
}
示例14: natureIds
import org.eclipse.xtext.ui.XtextProjectHelper; //导入依赖的package包/类
private String[] natureIds() {
return new String[] { JavaCore.NATURE_ID, GaugeProjectNature.NATURE_ID, XtextProjectHelper.NATURE_ID };
}
示例15: getProjectNatures
import org.eclipse.xtext.ui.XtextProjectHelper; //导入依赖的package包/类
protected String[] getProjectNatures() {
return new String[] {
XtextProjectHelper.NATURE_ID // we want the Xtext nature by default
};
}