Example usage for com.google.gwt.eclipse.core GWTPluginLog logWarning

List of usage examples for com.google.gwt.eclipse.core GWTPluginLog logWarning

Introduction

In this page you can find the example usage for com.google.gwt.eclipse.core GWTPluginLog logWarning.

Prototype

public static void logWarning(Throwable exception, String message) 

Source Link

Document

Log the specified warning.

Usage

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

License:Open Source License

@Override
public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor)
        throws CoreException {

    final String finalUrl = SpeedTracerLaunchConfiguration.getAbsoluteUrl(configuration);

    /*/*from w  w w.j  a  va2  s.  c  o m*/
     * LaunchConfigurations (in the OOPHM model) are added in one of two places:
     * (1) here and (2) as a callback from the GWT SDK's DevMode. For Speed
     * Tracer launches, the SpeedTracerLaunchConfiguration subclass must be used
     * (instead of just LaunchConfiguration.) Therefore, we call this method
     * _BEFORE_ we call through to super.launch() so there is no chance the GWT
     * SDK DevMode can add the launch configuration model object before us (if
     * it were to, it would add a regular LaunchConfiguration instance instead
     * of SpeedTracerLaunchConfiguration.)
     * 
     * TODO: This needs to be cleaned up. Speed Tracer launch support has been
     * added uncleanly to the existing DevMode view/model framework.
     */
    WebAppDebugModel.getInstance().addOrReturnExistingLaunchConfiguration(launch, null,
            new ILaunchConfigurationFactory() {
                public LaunchConfiguration newLaunchConfiguration(ILaunch launch, String name,
                        WebAppDebugModel model) {
                    return new com.google.gwt.eclipse.oophm.model.SpeedTracerLaunchConfiguration(launch,
                            finalUrl, name, model);
                }
            });

    /*
     * Our super class, JavaLaunchDelegate, does not understand the profile
     * mode. Since we only use profile mode for UI purposes, pretend we are
     * launching as run mode.
     */
    super.launch(configuration, ILaunchManager.RUN_MODE, launch, monitor);

    try {

        SpeedTracerBrowserUtilities.createTrampolineFileAndAddToLaunch(finalUrl, launch);

    } catch (Throwable e) {
        Display.getDefault().asyncExec(new Runnable() {
            public void run() {
                MessageDialog.openWarning(SWTUtilities.getShell(), "Speed Tracer error",
                        "Speed Tracer will not be opened automatically, please click on the Speed Tracer icon in the Chrome toolbar");
            }
        });
        GWTPluginLog.logWarning(e, "Could not create trampoline HTML file for Speed Tracer");
    }

    // Open Chrome
    SpeedTracerBrowserUtilities.openBrowser(finalUrl, launch);
}

From source file:com.gwtplugins.gwt.eclipse.gss.ExtractingGssFormattingStrategy.java

License:Open Source License

@Override
protected void format(IDocument document, TypedPosition partition) {

    GssExtractor extractor = GssExtractor.extract(document, partition.getOffset(), partition.getLength(),
            new GssResourceAwareModelLoader());
    if (extractor == null) {
        GWTPluginLog.logError("Could not format CSS block due to error in extracting the document.");
        return;/*w w  w . ja  va  2s.  com*/
    }

    ICSSDocument cssDocument = extractor.getCssDocument();
    String formattedCssBlock = formatCss(cssDocument);

    formattedCssBlock = adjustFormattedCssWhitespace(formattedCssBlock, document, partition, extractor);
    if (formattedCssBlock == null) {
        return;
    }

    try {
        String currentText = document.get(partition.getOffset(), partition.getLength());

        if (formattedCssBlock.equals(currentText)) {
            // Do nothing
            return;
        }

        if (!StringUtilities.equalsIgnoreWhitespace(formattedCssBlock, currentText, true)) {
            // Do nothing, since the formatting cause non-whitespace/non-case
            // changes, which a formatter is not supposed to do
            // (Give it a dummy exception so it prints a stack trace)
            GWTPluginLog.logError(new Exception(),
                    "Could not format text because the CSS formatter caused non-whitespace/non-case changes.  Please ensure your CSS is valid.");
            return;
        }

        document.replace(partition.getOffset(), partition.getLength(), formattedCssBlock.toString());
    } catch (BadLocationException e) {
        GWTPluginLog.logWarning(e, "Could not format CSS block.");
    }
}