Skip to content
This repository was archived by the owner on Jan 9, 2025. It is now read-only.

Commit 7657d55

Browse files
committed
Provide Pub console #117
Signed-off-by: Lakshminarayana Nekkanti <narayana.nekkanti@gmail.com>
1 parent 2018c0f commit 7657d55

File tree

3 files changed

+11
-19
lines changed

3 files changed

+11
-19
lines changed

org.eclipse.dartboard/assets/messages.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Console_Name=Dart Terminal
2+
Pub_Console_Name=Pub Terminal
23
Launch_DebugNotSupported_Title=Debug is not yet supported
34
Launch_DebugNotSupported_Body=Debug launch is not yet supported. Please use the standard run config.
45
Launch_NoProjectSelected_Title=No project selected

org.eclipse.dartboard/src/org/eclipse/dartboard/Messages.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
public class Messages extends NLS {
2020

2121
public static String Console_Name;
22+
public static String Pub_Console_Name;
2223
public static String Launch_DebugNotSupported_Title;
2324
public static String Launch_DebugNotSupported_Body;
2425
public static String Launch_NoProjectSelected_Title;

org.eclipse.dartboard/src/org/eclipse/dartboard/pub/PubService.java

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313
*******************************************************************************/
1414
package org.eclipse.dartboard.pub;
1515

16-
import java.io.BufferedReader;
1716
import java.io.IOException;
18-
import java.io.InputStreamReader;
1917
import java.util.HashMap;
2018
import java.util.Map;
2119

@@ -27,13 +25,16 @@
2725
import org.eclipse.core.runtime.IPath;
2826
import org.eclipse.core.runtime.IStatus;
2927
import org.eclipse.core.runtime.Status;
30-
import org.eclipse.core.runtime.SubMonitor;
3128
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
3229
import org.eclipse.core.runtime.jobs.Job;
3330
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
3431
import org.eclipse.dartboard.Messages;
3532
import org.eclipse.dartboard.util.PubUtil;
3633
import org.eclipse.dartboard.util.StatusUtil;
34+
import org.eclipse.debug.core.DebugPlugin;
35+
import org.eclipse.debug.core.ILaunchManager;
36+
import org.eclipse.debug.core.Launch;
37+
import org.eclipse.debug.core.model.IProcess;
3738
import org.eclipse.osgi.util.NLS;
3839
import org.slf4j.Logger;
3940
import org.slf4j.LoggerFactory;
@@ -101,22 +102,11 @@ public void get(IProject project, boolean offline) {
101102
return StatusUtil.createError(Messages.PubSync_CouldNotStartProcess, exception);
102103
}
103104

104-
try (BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()))) {
105-
SubMonitor mo = SubMonitor.convert(monitor, 100);
106-
107-
String taskName;
108-
while ((taskName = reader.readLine()) != null) {
109-
// We only want updates to the progress bar if one of the 2 operations are
110-
// started. Not for every dependency added or compilation step done.
111-
if (taskName.equalsIgnoreCase(Messages.PubSync_Task_ResolvingDependencies)
112-
|| taskName.equalsIgnoreCase(Messages.PubSync_Task_PrecompilingExecutables)) {
113-
mo.split(50);
114-
mo.setTaskName(taskName);
115-
}
116-
}
117-
} catch (IOException exception) {
118-
return StatusUtil.createError(Messages.PubSync_CouldNotStartProcess, exception);
119-
}
105+
Launch launch = new Launch(null, ILaunchManager.RUN_MODE, null);
106+
DebugPlugin.getDefault().getLaunchManager().addLaunch(launch);
107+
108+
IProcess runtimeProcess = DebugPlugin.newProcess(launch, process, Messages.Pub_Console_Name);
109+
launch.addProcess(runtimeProcess);
120110
return Status.OK_STATUS;
121111
});
122112

0 commit comments

Comments
 (0)