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

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

Introduction

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

Prototype

public static void logError(Throwable exception) 

Source Link

Document

Log the specified error.

Usage

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

License:Open Source License

@Override
public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor)
        throws CoreException {
    if (!addVmArgs(configuration)) {
        return;/*from   ww  w  .  j  av a2s  .co  m*/
    }
    try {
        if (!ensureWarArgumentExistenceInCertainCases(configuration)) {
            return;
        }
        IJavaProject javaProject = getJavaProject(configuration);
        maybePublishModulesToWarDirectory(configuration, monitor, javaProject, false);

    } catch (Throwable t) {
        // Play safely and continue launch
        GdtPlugin.getLogger().logError(t,
                "Could not ensure WAR argument existence for the unmanaged WAR project.");
    }

    // check if this launch uses -remoteUI. If not, then don't add this launch
    // to the devmode view
    boolean addLaunch = true;
    if (launch != null) {
        try {
            List<String> args = LaunchConfigurationProcessorUtilities
                    .parseProgramArgs(launch.getLaunchConfiguration());
            if (!args.contains(RemoteUiArgumentProcessor.ARG_REMOTE_UI)) {
                addLaunch = false;
            }
        } catch (CoreException e1) {
            GWTPluginLog.logError(e1);
        }
    }

    if (addLaunch) {
        /*
         * Add the launch to the DevMode view. This is tightly coupled because at
         * the time of ILaunchListener's changed callback, the launch's process
         * does not have a command-line set. Unfortunately there isn't another
         * listener to solve our needs, so we add this glue here.
         */
        WebAppDebugModel.getInstance().addOrReturnExistingLaunchConfiguration(launch, null, null);
    }

    super.launch(configuration, mode, launch, monitor);
}

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;/*from  ww  w. jav a2  s .  c  o m*/
    }

    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.");
    }
}

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

License:Open Source License

private IStatus updateProjectAndCompileSettings() {
    project = null;/*from  ww  w .ja  va2s. co 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;
}

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

License:Open Source License

private boolean areMultipleModulesAllowed() {
    try {//www .  j  ava2 s . c  o m
        IJavaProject javaProject = JavaCore.create(project);
        if (javaProject != null) {
            GWTRuntime sdk = GWTRuntime.findSdkFor(javaProject);
            if (sdk != null) {
                return new GwtCapabilityChecker(sdk).doesCompilerAllowMultipleModules();
            }
        }
    } catch (JavaModelException e) {
        GWTPluginLog.logError(e);
    }
    return false;
}