Example usage for com.google.gwt.eclipse.core.compile GWTCompileRunner computeTaskName

List of usage examples for com.google.gwt.eclipse.core.compile GWTCompileRunner computeTaskName

Introduction

In this page you can find the example usage for com.google.gwt.eclipse.core.compile GWTCompileRunner computeTaskName.

Prototype

public static String computeTaskName(IProject project) 

Source Link

Usage

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

License:Open Source License

private static CustomMessageConsole showGwtCompilationConsole(IProject project) {
    CustomMessageConsole messageConsole = MessageConsoleUtilities
            .getMessageConsole(GWTCompileRunner.computeTaskName(project), null);
    messageConsole.activate();/*from  w  w w .  j  a v a 2s .c  o  m*/
    return messageConsole;
}

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 www.  ja  va2 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
        }
    }

}