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

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

Introduction

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

Prototype

public static void setGwtCompileSettings(IProject project, GWTCompileSettings settings)
            throws BackingStoreException 

Source Link

Usage

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

License:Open Source License

@Override
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {

    try {/*from   w w  w .j  a  va  2 s  . c om*/
        // Remember the compilation settings for next time
        GWTProjectProperties.setGwtCompileSettings(project, compileSettings);
    } catch (BackingStoreException e) {
        // Failed to save project properties
        ExportActivator.logError(e);
    }

    final String taskName = GWTCompileRunner.computeTaskName(project);

    // Get a message console for GWT compiler output

    CustomMessageConsole messageConsole = MessageConsoleUtilities.getMessageConsole(taskName, null);

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

    messageConsole.activate();
    OutputStream consoleOutputStream = messageConsole.newMessageStream();

    try {
        IPath warLocation = null;

        if (WebAppUtilities.isWebApp(project)) {
            /*
             * First, check the additional compiler arguments to see if the
             * user specified the -war option manually. If not, use the
             * project's managed WAR output directory (if set) or failing
             * that, prompt for a file-system path.
             */
            if (!compileSettings.getExtraArgs().contains("-war")) {
                warLocation = WebAppUtilities.getWarOutLocationOrPrompt(project);
                if (warLocation == null) {
                    // User canceled the dialog
                    return Status.OK_STATUS;
                }
            }
        }

        GWTCompileRunner.compileWithCancellationSupport(JavaCore.create(project), warLocation, compileSettings,
                consoleOutputStream, terminateAction, new SubProgressMonitor(monitor, 100), terminateAction);

        exportWar(monitor);

        return Status.OK_STATUS;

    } catch (IOException e) {
        ExportActivator.logError(e);
        throw new CoreException(
                new Status(IStatus.ERROR, ExportActivator.PLUGIN_ID, e.getLocalizedMessage(), e));
    } catch (InterruptedException e) {
        ExportActivator.logError(e);
        throw new CoreException(
                new Status(IStatus.ERROR, ExportActivator.PLUGIN_ID, e.getLocalizedMessage(), e));
    } catch (OperationCanceledException e) {
        // Ignore since the user canceled
        return Status.OK_STATUS;
    } catch (CoreException e) {
        ExportActivator.logError(e);
        return e.getStatus();
    } catch (ArchiveSaveFailureException e) {
        ExportActivator.logError(e);
        throw new CoreException(
                new Status(IStatus.ERROR, ExportActivator.PLUGIN_ID, e.getLocalizedMessage(), e));
    } finally {
        terminateAction.setEnabled(false);
        monitor.done();
        try {
            assert (consoleOutputStream != null);
            consoleOutputStream.close();
        } catch (IOException e) {
            // Ignore IOExceptions during stream close
        }
    }

}

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

License:Open Source License

private void setErraiVmParams(IProject project, String path) {
    GWTCompileSettings settings = GWTProjectProperties.getGwtCompileSettings(project);
    if (settings == null) {
        settings = new GWTCompileSettings(project);
    }/*from  w  w  w .j a  v  a  2s. c o m*/
    String vmArgs = (settings.getVmArgs() == null) ? "" : settings.getVmArgs();
    if (!vmArgs.contains(ERRAI_MARSHALLING_SERVER_CLASS_OUTPUT)) {
        vmArgs += ERRAI_MARSHALLING_SERVER_CLASS_OUTPUT + path;
        settings.setVmArgs(vmArgs);

        try {
            GWTProjectProperties.setGwtCompileSettings(project, settings);
        } catch (BackingStoreException e) {
            logError("Exception in Maven GWT Configurator, cannot set VM Parameters for Errai", e);
        }
    }
}