Skip to content
This repository has been archived by the owner on Dec 11, 2022. It is now read-only.

Commit

Permalink
feat: use entrypoint from stagehand for launch config creation
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas Hungershausen committed Feb 3, 2020
1 parent 9fecf3b commit 92fa69a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public void createControl(Composite parent) {
labelSdkLocation.setText(Messages.Preference_SDKLocation_Dart);
GridDataFactory.swtDefaults().applyTo(labelSdkLocation);

textSdkLocation = new Text(comp, SWT.NONE);
textSdkLocation = new Text(comp, SWT.BORDER);
textSdkLocation.setMessage(Messages.Launch_SDKLocation_Message);
GridDataFactory.fillDefaults().grab(true, false).applyTo(textSdkLocation);
textSdkLocation.addModifyListener(event -> updateLaunchConfigurationDialog());
Expand All @@ -92,7 +92,7 @@ public void createControl(Composite parent) {
labelMainClass.setText(Messages.Launch_MainClass);
GridDataFactory.swtDefaults().applyTo(labelMainClass);

textMainClass = new Text(comp, SWT.NONE);
textMainClass = new Text(comp, SWT.BORDER);
textMainClass.setMessage(Messages.Launch_MainClass_Message);
GridDataFactory.fillDefaults().grab(true, false).applyTo(textMainClass);
textMainClass.addModifyListener(event -> updateLaunchConfigurationDialog());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.Platform;
import org.eclipse.dartboard.dart.Constants;
import org.eclipse.dartboard.dart.stagehand.StagehandGenerator;
import org.eclipse.dartboard.logging.DartLog;
import org.eclipse.dartboard.messages.Messages;
import org.eclipse.dartboard.util.PlatformUIUtil;
Expand Down Expand Up @@ -102,6 +103,7 @@ private void launchProject(IProject project, String mode) {
LaunchConfigurationsMessages.CreateLaunchConfigurationAction_New_configuration_2));

copy.setAttribute(Constants.LAUNCH_SELECTED_PROJECT, project.getName());
copy.setAttribute(Constants.LAUNCH_MAIN_CLASS, project.getPersistentProperty(StagehandGenerator.QN_ENTRYPOINT));

int result = DebugUITools.openLaunchConfigurationDialog(PlatformUIUtil.getActiveShell(), copy,
Constants.LAUNCH_GROUP, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.QualifiedName;
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.dart.Constants;
import org.eclipse.dartboard.dart.util.PubUtil;
import org.eclipse.dartboard.logging.DartLog;
import org.eclipse.dartboard.messages.Messages;
Expand All @@ -25,6 +27,7 @@
public class StagehandGenerator {

private static final ILog LOG = Platform.getLog(StagehandGenerator.class);
public static final QualifiedName QN_ENTRYPOINT = new QualifiedName(Constants.PLUGIN_ID, "entryPoint");

public static void generate(StagehandTemplate generator, IProject project) {
if (project == null) {
Expand Down Expand Up @@ -71,6 +74,7 @@ public static void generate(StagehandTemplate generator, IProject project) {
public void done(IJobChangeEvent event) {
try {
project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
project.setPersistentProperty(QN_ENTRYPOINT, generator.getEntrypoint());
} catch (CoreException e) {
LOG.log(DartLog.createError("Could not refresh project", e)); //$NON-NLS-1$
}
Expand Down

0 comments on commit 92fa69a

Please sign in to comment.