Example usage for com.google.gwt.eclipse.core.nature GWTNature isGWTProject

List of usage examples for com.google.gwt.eclipse.core.nature GWTNature isGWTProject

Introduction

In this page you can find the example usage for com.google.gwt.eclipse.core.nature GWTNature isGWTProject.

Prototype

public static boolean isGWTProject(IProject project) 

Source Link

Document

Returns if the GWT nature installed or if the GWT facet is enabled.

Usage

From source file:com.google.gdt.eclipse.suite.markers.quickfixes.CreateAppEngineWebXMLFileMarkerResolution.java

License:Open Source License

public void run(IMarker marker) {
    IProject project = marker.getResource().getProject();

    try {/*from ww w  .  j  ava 2  s.co  m*/
        WebAppUtilities.verifyIsWebApp(project);

        IPath webInfFolderPath = WebAppUtilities.getWarSrc(project).getProjectRelativePath().append("WEB-INF");
        ResourceUtils.createFolderStructure(project, webInfFolderPath);

        IFile appengineWebXMLFile = ResourceUtils.createFile(
                project.getFullPath().append(webInfFolderPath.append("appengine-web.xml")),
                GaeProjectResources.createAppEngineWebXmlSource(GWTNature.isGWTProject(project)));

        ResourceUtils.openInDefaultEditor(
                AppEngineCorePlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell(),
                appengineWebXMLFile, true);
    } catch (CoreException e) {
        AppEngineCorePluginLog.logError(e);
        MessageDialog.openError(
                AppEngineCorePlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell(),
                "Error While Attempting to Create <WAR>/WEB-INF/appengine-web.xml",
                "Unable to create the <WAR>/WEB-INF/appengine-web.xml file. See the Error Log for more details.");
        return;
    }
}

From source file:com.google.gdt.eclipse.suite.update.builders.UpdateTriggerCompilationParticipant.java

License:Open Source License

@Override
public boolean isActive(IJavaProject project) {
    if (!project.exists()) {
        return false;
    }/*from   w ww  . ja  v a 2  s . c  o  m*/

    // Only run when preferences are set to ok, and it's a gwt project
    if (GdtPreferences.getCaptureAnalytics() && GWTNature.isGWTProject(project.getProject())) {
        runProcesses();
        return true;
    } else {
        return false;
    }
}

From source file:com.gwtplugins.gwt.eclipse.gss.clientbundle.GssResourceContentDescriber.java

License:Open Source License

private int describe(IFile file) {
    if (file == null) {
        return INDETERMINATE;
    }/*from  w  w  w  .j ava  2  s. co  m*/

    IProject project = file.getProject();
    if (project == null) {
        return INDETERMINATE;
    }

    boolean isGwtNature = GWTNature.isGWTProject(project);

    int value = file != null && isGwtNature ? VALID : INDETERMINATE;

    return value;
}

From source file:com.myeclipsedev.gdt.eclipse.ui.internal.wizard.WebComponentExportPage.java

License:Open Source License

private IJavaProject chooseProject() {
    IJavaProject[] javaProjects;//from w ww  . j a  v  a 2s  .com

    try {
        javaProjects = JavaCore.create(ResourcesPlugin.getWorkspace().getRoot()).getJavaProjects();
    } catch (JavaModelException e) {
        ExportActivator.logError(e);
        javaProjects = new IJavaProject[0];
    }

    // Filter the list to only show GWT projects
    List<IJavaProject> gwtProjects = new ArrayList<IJavaProject>();
    for (IJavaProject javaProject : javaProjects) {
        if (GWTNature.isGWTProject(javaProject.getProject())) {
            gwtProjects.add(javaProject);
        }
    }

    ILabelProvider labelProvider = new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT);
    ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), labelProvider);
    dialog.setTitle("Project Selection");
    dialog.setMessage("Choose a project to compile");
    dialog.setElements(gwtProjects.toArray(new IJavaProject[0]));
    dialog.setInitialSelections(new Object[] { JavaCore.create(project) });

    dialog.setHelpAvailable(false);
    if (dialog.open() == Window.OK) {
        return (IJavaProject) dialog.getFirstResult();
    }
    return null;
}

From source file:com.myeclipsedev.gdt.eclipse.ui.internal.wizard.WebComponentExportPage.java

License:Open Source License

private IStatus updateProjectAndCompileSettings() {
    project = null;/*w w  w  .  jav a 2s  .c o m*/

    String projectName = projectText.getText().trim();
    if (projectName.length() == 0) {
        return StatusUtilities.newErrorStatus("Enter the project name", GWTPlugin.PLUGIN_ID);
    }

    IProject enteredProject = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
    if (!enteredProject.exists()) {
        return StatusUtilities.newErrorStatus("Project does not exist", GWTPlugin.PLUGIN_ID);
    }

    if (!enteredProject.isOpen()) {
        return StatusUtilities.newErrorStatus("Project is not open", GWTPlugin.PLUGIN_ID);
    }

    if (!GWTNature.isGWTProject(enteredProject)) {
        return StatusUtilities.newErrorStatus(projectName + " is not a GWT project", GWTPlugin.PLUGIN_ID);
    }

    String validViaExtensionMsg = validateProjectViaExtensions(enteredProject);
    if (validViaExtensionMsg != null) {
        return StatusUtilities.newErrorStatus(validViaExtensionMsg, GWTPlugin.PLUGIN_ID);
    }

    project = enteredProject;

    try {
        if (IMarker.SEVERITY_ERROR == enteredProject.findMaxProblemSeverity(IMarker.PROBLEM, true,
                IResource.DEPTH_INFINITE)) {
            return StatusUtilities.newWarningStatus("The project {0} has errors.", GWTPlugin.PLUGIN_ID,
                    enteredProject.getName());
        }
    } catch (CoreException e) {
        GWTPluginLog.logError(e);
    }

    return StatusUtilities.OK_STATUS;
}