Example usage for com.google.gwt.eclipse.core.properties GWTProjectProperties getEntryPointModules

List of usage examples for com.google.gwt.eclipse.core.properties GWTProjectProperties getEntryPointModules

Introduction

In this page you can find the example usage for com.google.gwt.eclipse.core.properties GWTProjectProperties getEntryPointModules.

Prototype

public static List<String> getEntryPointModules(IProject project) 

Source Link

Document

Returns the list of entry point modules for a project (user defined, or if not specified, a default list).

Usage

From source file:com.google.gdt.eclipse.suite.launch.SpeedTracerLaunchDelegate.java

License:Open Source License

private void performGwtCompile(IProject project, File extraDir, List<String> modules, IPath warOutLocation,
        IProgressMonitor monitor) throws CoreException, IOException, InterruptedException {

    monitor.beginTask("Performing GWT compile...", 100);

    try {//w  ww.j  a va 2s . co m
        GWTCompileSettings compileSettings = GWTProjectProperties.getGwtCompileSettings(project);
        compileSettings.setEntryPointModules(
                !modules.isEmpty() ? modules : GWTProjectProperties.getEntryPointModules(project));
        compileSettings.setExtraArgs("-extra " + StringUtilities.quote(extraDir.getAbsolutePath()) + " -gen "
                + StringUtilities.quote(
                        GWTPreferences.computeSpeedTracerGeneratedFolderPath(warOutLocation).toOSString()));

        // Get a message console for GWT compiler output
        CustomMessageConsole messageConsole = showGwtCompilationConsole(project);
        OutputStream consoleOutputStream = messageConsole.newMessageStream();

        TerminateProcessAction terminateAction = new TerminateProcessAction();
        messageConsole.setTerminateAction(terminateAction);

        try {
            GWTCompileRunner.compileWithCancellationSupport(JavaCore.create(project), warOutLocation,
                    compileSettings, consoleOutputStream, terminateAction, monitor, terminateAction);
        } finally {
            try {
                assert (consoleOutputStream != null);
                consoleOutputStream.close();
            } catch (IOException e) {
                // Ignore IOExceptions during stream close
            }
        }

        // refresh so that eclipse picks up on the gen files 
        project.refreshLocal(IResource.DEPTH_INFINITE, null);

    } finally {
        monitor.done();
    }
}

From source file:org.jboss.tools.maven.gwt.GWTProjectConfigurator.java

License:Open Source License

private void configureInternal(IMavenProjectFacade facade, IProgressMonitor monitor) throws CoreException {

    IPreferenceStore store = Activator.getDefault().getPreferenceStore();
    boolean configureGWT = store.getBoolean(Activator.CONFIGURE_GWT);
    log.debug("GWT Entry Point Modules configuration is {}", configureGWT ? "enabled" : "disabled");
    if (configureGWT && facade.getMavenProject().getPlugin(GWT_WAR_MAVEN_PLUGIN_KEY) != null) {

        IProject project = facade.getProject();
        String projectName = project.getName();
        IJavaProject javaProject = JavaCore.create(project);
        if (javaProject != null && javaProject.exists()) {

            Plugin pluginConfig = facade.getMavenProject().getPlugin(GWT_WAR_MAVEN_PLUGIN_KEY);

            if (pluginConfig == null) {
                //nothing to do
                return;
            }/*from   w  ww. j  av  a2s  . c o m*/
            log.debug("Configure Entry Point Modules for GWT Project {}", projectName);

            List<String> modNames = findModules(pluginConfig, javaProject);

            try {
                List<String> oldModNames = GWTProjectProperties.getEntryPointModules(project);
                if (oldModNames == null || !oldModNames.equals(modNames)) {
                    GWTProjectProperties.setEntryPointModules(project, modNames);
                }
            } catch (BackingStoreException e) {
                logError("Exception in Maven GWT Configurator, cannot set entry point modules", e);
            }

            log.debug("Configure Output location for GWT Project {}", projectName);
            IFolder m2ewtpFolder = project.getFolder("target/m2e-wtp/web-resources/");
            IPath fullpath = null;
            IFolder outputfolder = null;
            if (!runsInplace(pluginConfig) && m2ewtpFolder.exists()) {
                fullpath = m2ewtpFolder.getFullPath();
                outputfolder = m2ewtpFolder;
            } else {
                fullpath = ProjectHome.getFirstWebContentPath(project);
                if (fullpath != null) {
                    outputfolder = project.getWorkspace().getRoot().getFolder(fullpath);
                }
            }
            if (fullpath == null) {
                log.warn("Can't find output folder for project {}. GWT Configuration incomplete", projectName);
                return;
            }
            try {
                IPath lastUsedWarOutLocation = WebAppProjectProperties.getLastUsedWarOutLocation(project);
                if (!fullpath.equals(lastUsedWarOutLocation)) {
                    WebAppProjectProperties.setLastUsedWarOutLocation(project, fullpath);
                }
            } catch (BackingStoreException e) {
                logError("Exception in Maven GWT Configurator, cannot set war output location", e);
            }
            if (isErraiProject(facade)) {
                setErraiVmParams(project,
                        outputfolder.getFolder("WEB-INF/classes").getProjectRelativePath().toPortableString());
            }

        } else {
            log.debug("Skip configurator for non Java project {}", projectName);
        }
    }
}