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

Provide Pub console #117 #121

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions org.eclipse.dartboard/assets/messages.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Console_Name=Dart Terminal
Pub_Console_Name=Pub Terminal
Launch_DebugNotSupported_Title=Debug is not yet supported
Launch_DebugNotSupported_Body=Debug launch is not yet supported. Please use the standard run config.
Launch_NoProjectSelected_Title=No project selected
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
public class Messages extends NLS {

public static String Console_Name;
public static String Pub_Console_Name;
public static String Launch_DebugNotSupported_Title;
public static String Launch_DebugNotSupported_Body;
public static String Launch_NoProjectSelected_Title;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
*******************************************************************************/
package org.eclipse.dartboard.pub;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;

Expand All @@ -27,13 +25,16 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.dartboard.Messages;
import org.eclipse.dartboard.util.PubUtil;
import org.eclipse.dartboard.util.StatusUtil;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.core.Launch;
import org.eclipse.debug.core.model.IProcess;
import org.eclipse.osgi.util.NLS;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -101,22 +102,11 @@ public void get(IProject project, boolean offline) {
return StatusUtil.createError(Messages.PubSync_CouldNotStartProcess, exception);
}

try (BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()))) {
SubMonitor mo = SubMonitor.convert(monitor, 100);

String taskName;
while ((taskName = reader.readLine()) != null) {
// We only want updates to the progress bar if one of the 2 operations are
// started. Not for every dependency added or compilation step done.
if (taskName.equalsIgnoreCase(Messages.PubSync_Task_ResolvingDependencies)
|| taskName.equalsIgnoreCase(Messages.PubSync_Task_PrecompilingExecutables)) {
mo.split(50);
mo.setTaskName(taskName);
}
}
} catch (IOException exception) {
return StatusUtil.createError(Messages.PubSync_CouldNotStartProcess, exception);
}
Launch launch = new Launch(null, ILaunchManager.RUN_MODE, null);
DebugPlugin.getDefault().getLaunchManager().addLaunch(launch);

IProcess runtimeProcess = DebugPlugin.newProcess(launch, process, Messages.Pub_Console_Name);
launch.addProcess(runtimeProcess);
return Status.OK_STATUS;
});

Expand Down