Java 类org.eclipse.xtext.ui.XtextProjectHelper 实例源码

项目:n4js    文件:AbstractN4JSContentAssistTest.java   
/**
 * 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();
}
项目:EASyProducer    文件:ProjectUtils.java   
/**
 * 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());
    }
}
项目:n4js    文件:ProjectUtils.java   
/** 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;
}
项目:n4js    文件:EclipseBasedProjectModelSetup.java   
/***/
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);
}
项目:n4js    文件:N4JSEclipseProject.java   
@Override
protected boolean checkExists() {
    if (XtextProjectHelper.hasNature(project)) {
        return project.getFile(N4MF_MANIFEST).exists();
    }
    return false;
}
项目:solidity-ide    文件:KickStartNewProjectAction.java   
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();
    }
}
项目:bts    文件:AbstractProjectCreator.java   
protected String[] getProjectNatures() {
      return new String[] {
        JavaCore.NATURE_ID,
    "org.eclipse.pde.PluginNature", //$NON-NLS-1$
    XtextProjectHelper.NATURE_ID
};
  }
项目:bts    文件:AbstractProjectCreator.java   
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
    };
}
项目:bts    文件:RenameElementProcessor.java   
@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;
}
项目:statecharts    文件:StatechartDiagramEditor.java   
protected void checkXtextNature() {
    IFileEditorInput editorInput = (IFileEditorInput) getEditorInput();
    IProject project = editorInput.getFile().getProject();
    if (project != null && !XtextProjectHelper.hasNature(project) && project.isAccessible()
            && !project.isHidden()) {
        addNature(project);
    }
}
项目:statecharts    文件:StatechartDiagramEditor.java   
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();
    }
}
项目:xsemantics    文件:LambdaIntegrationTest.java   
private IJavaProject createJavaProjectWithRootSrc(String string)
        throws CoreException {
    IJavaProject project = createJavaProject(string);
    addNature(project.getProject(), XtextProjectHelper.NATURE_ID);
    addSourceFolder(project, "src");
    return project;
}
项目:bts    文件:WorkspaceProjectsStateHelper.java   
protected boolean isAccessibleXtextProject(IProject p) {
    return p != null && XtextProjectHelper.hasNature(p) && XtextProjectHelper.hasNature(p);
}
项目:bts    文件:JavaProjectsStateHelper.java   
protected boolean isAccessibleXtextProject(IProject p) {
    return p != null && XtextProjectHelper.hasNature(p) && XtextProjectHelper.hasBuilder(p);
}
项目:Gauge-Eclipse    文件:GaugeProjectCreator.java   
private String[] natureIds() {
    return new String[] { JavaCore.NATURE_ID, GaugeProjectNature.NATURE_ID, XtextProjectHelper.NATURE_ID };
}
项目:xtext-ide    文件:BoaCustomProjectCreator.java   
protected String[] getProjectNatures() {
    return new String[] {
        XtextProjectHelper.NATURE_ID // we want the Xtext nature by default
    };
}
项目:xsemantics    文件:AbstractOutlineWorkbenchTest.java   
/**
 * This creates the Java project that will be used for the tests.
 * @throws CoreException
 */
protected void createTestJavaProject() throws CoreException {
    IJavaProject javaProject = createJavaProject(TEST_PROJECT);
    addNature(javaProject.getProject(), XtextProjectHelper.NATURE_ID);
}
项目:SensIDL    文件:NewSensidlProjectWizard.java   
private void addXtextNatureTo(IProject project) throws CoreException {

    String[] natureIds = (String[]) Arrays.asList(XtextProjectHelper.NATURE_ID).toArray();

    IProjectDescription description = project.getDescription();
    description.setNatureIds(natureIds);

    project.setDescription(description, null);

}