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

Commit

Permalink
LANG: Fix: refresh Project when Build Target invoked directly.
Browse files Browse the repository at this point in the history
  • Loading branch information
bruno-medeiros committed Aug 12, 2015
1 parent b0f7407 commit c153123
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 14 deletions.
1 change: 1 addition & 0 deletions documentation/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### 0.13.0 RC2
* Fix missing ".exe" suffix in Windows
* Fixed: "null" text inserted when cancel pressed in Variables dialog.
* Fixed: project not being refreshed when Build Target build invoked directly from Project Explorer.

### 0.13.0
* Added support for Build Targets, based on DUB configurations (with the default and `unittest` build types).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import melnorme.lang.ide.core.utils.TextMessageUtils;
import melnorme.utilbox.collections.ArrayList2;
import melnorme.utilbox.collections.Collection2;
import melnorme.utilbox.concurrency.OperationCancellation;
import melnorme.utilbox.core.CommonException;

public class BuildOperationCreator implements BuildManagerMessages {
Expand Down Expand Up @@ -71,6 +72,13 @@ public IToolOperation newProjectBuildOperation(Collection2<BuildTarget> targetsT
addOperation(newBuildTargetOperation(project, buildTarget));
}

// refresh project
addOperation(new IToolOperation() {
@Override
public void execute(IProgressMonitor pm) throws CoreException, CommonException, OperationCancellation {
project.refreshLocal(IResource.DEPTH_INFINITE, pm);
}
});

addOperation(newMessageOperation(opInfo, headerBIG(MSG_BuildTerminated)));

Expand Down Expand Up @@ -114,13 +122,13 @@ protected IToolOperation newBuildTargetOperation(IProject project, BuildTarget b
throws CommonException {
Path buildToolPath = LangCore.getToolManager().getSDKToolPath();
try {
return createBuildTargetOperation(opInfo, project, buildToolPath, buildTarget);
return doCreateBuildTargetOperation(opInfo, project, buildToolPath, buildTarget);
} catch(CoreException e) {
throw new CommonException(e.getMessage(), e.getCause());
}
}

public CommonBuildTargetOperation createBuildTargetOperation(OperationInfo opInfo,
public IToolOperation doCreateBuildTargetOperation(OperationInfo opInfo,
IProject project, Path buildToolPath, BuildTarget buildTarget
) throws CommonException, CoreException {
ValidatedBuildTarget validatedBuildTarget = buildMgr.getValidatedBuildTarget(project, buildTarget);
Expand Down
28 changes: 17 additions & 11 deletions plugin_ide.core/src/mmrnmhrm/core/build/DeeBuildManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import melnorme.lang.ide.core.operations.OperationInfo;
import melnorme.lang.ide.core.operations.ToolMarkersUtil;
import melnorme.lang.ide.core.operations.build.BuildManager;
import melnorme.lang.ide.core.operations.build.BuildOperationCreator;
import melnorme.lang.ide.core.operations.build.BuildTarget;
import melnorme.lang.ide.core.operations.build.CommonBuildTargetOperation;
import melnorme.lang.ide.core.operations.build.IToolOperation;
Expand All @@ -33,7 +34,6 @@
import melnorme.lang.tooling.ops.SourceLineColumnRange;
import melnorme.lang.tooling.ops.ToolSourceMessage;
import melnorme.utilbox.collections.ArrayList2;
import melnorme.utilbox.collections.Collection2;
import melnorme.utilbox.collections.Indexable;
import melnorme.utilbox.concurrency.OperationCancellation;
import melnorme.utilbox.core.CommonException;
Expand Down Expand Up @@ -74,16 +74,22 @@ protected Indexable<BuildType> getBuildTypes_do() {
}

@Override
public IToolOperation newProjectClearMarkersOperation(OperationInfo opInfo, IProject project) {
return new RunInDubAgentWrapper(
super.newProjectClearMarkersOperation(opInfo, project));
}

@Override
public IToolOperation newBuildOperation(OperationInfo opInfo, IProject project, boolean clearMarkers,
Collection2<BuildTarget> targetsToBuild) throws CommonException {
return new RunInDubAgentWrapper(
super.newBuildOperation(opInfo, project, clearMarkers, targetsToBuild));
protected BuildOperationCreator createBuildOperationCreator(OperationInfo opInfo, IProject project) {
return new BuildOperationCreator(project, opInfo) {

@Override
protected IToolOperation doCreateClearBuildMarkersOperation() {
return new RunInDubAgentWrapper(super.doCreateClearBuildMarkersOperation());
}

@Override
public IToolOperation doCreateBuildTargetOperation(OperationInfo opInfo, IProject project,
Path buildToolPath, BuildTarget buildTarget) throws CommonException, CoreException {
return new RunInDubAgentWrapper(
super.doCreateBuildTargetOperation(opInfo, project, buildToolPath, buildTarget));
}

};
}

protected static class RunInDubAgentWrapper implements IToolOperation {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
*/
public class DeeToolManager extends AbstractToolManager {

protected final ITaskAgent dubProcessAgent = new CoreTaskAgent(getClass().getSimpleName());
protected final ITaskAgent dubProcessAgent = new CoreTaskAgent("DDT.DubProcessAgent");

public DeeToolManager() {
}
Expand Down

0 comments on commit c153123

Please sign in to comment.