Skip to content
This repository has been archived by the owner on Apr 3, 2018. It is now read-only.

Commit

Permalink
Add warning message about build command output.
Browse files Browse the repository at this point in the history
  • Loading branch information
bruno-medeiros committed May 26, 2016
1 parent d6cad5e commit 959e006
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
3 changes: 2 additions & 1 deletion documentation/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ From the context menu of a Build Target, you can also directly create a Run or D

Each Go project has 3 built-in Build Targets:
* `build`: The default build. Builds all Go packages present in the project (excluding test packages).
* `build-tests`: Builds all Go test packages present in the project.
* `build-tests`: Builds all Go test packages present in the project.
* `lint`: Run a lint tool on the project's packages. The default settings calls [gometalinter](https://github.com/alecthomas/gometalinter). A different tool can be used, but the output of the command should be in the same format as the `gometalinter` or `go build` commands, in order for GoClipse to extract error messages.
* `[run-tests]`: Builds all and *runs* Go tests.


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,16 @@
package com.googlecode.goclipse.ui.properties;

import org.eclipse.core.resources.IProject;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;

import melnorme.lang.ide.core.operations.build.VariablesResolver;
import melnorme.lang.ide.ui.build.BuildTargetEditor;
import melnorme.lang.ide.ui.build.CommandInvocationEditor;
import melnorme.lang.ide.ui.preferences.ProjectBuildConfigurationComponent;
import melnorme.lang.ide.ui.preferences.pages.BuildConfigurationPropertyPage;
import melnorme.util.swt.components.misc.StatusMessageWidget;
import melnorme.utilbox.status.Severity;

public class GoProjectBuildConfigurationPropertyPage extends BuildConfigurationPropertyPage {

Expand All @@ -24,10 +31,45 @@ protected ProjectBuildConfigurationComponent createProjectConfigWidget(IProject

public class GoProjectOptionsBlock extends ProjectBuildConfigurationComponent {

public static final String BUILD_COMMAND_OUTPUT_FORMAT_MESSAGE =
"For GoClipse to extract error/warning messages from the output of this command, " +
"the output must be in the same format of either the `go build` or `gometalinter` command.";

public GoProjectOptionsBlock(IProject project) {
super(project);
}

@Override
protected BuildTargetEditor init_createBuildTargetSettingsComponent() {
return new BuildTargetEditor(
getBuildManager(),
true,
this::getDefaultBuildCommand,
this::getDefaultExecutablePath
) {
@Override
protected CommandInvocationEditor init_createArgumentsField() {
VariablesResolver varResolver = buildManager.getToolManager().getVariablesManager(null);
StatusMessageWidget statusWidget = new StatusMessageWidget() {

@Override
protected void createContents(Composite topControl) {
super.createContents(topControl);
((GridData) hintText.getLayoutData()).widthHint = 250;
}

@Override
public void updateWidgetFromInput() {
setStatusMessage(Severity.INFO, BUILD_COMMAND_OUTPUT_FORMAT_MESSAGE);
}
};
BuildCommandEditor buildCommandEditor = new BuildCommandEditor(getDefaultBuildCommand, varResolver);
buildCommandEditor.addChildWidget(statusWidget);
return buildCommandEditor;
}
};
}

}

}

0 comments on commit 959e006

Please sign in to comment.