예제 #1
0
  @Override
  public void performApply(ILaunchConfigurationWorkingCopy config) {
    config.setAttribute(
        IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME,
        StringUtils.trimToEmpty(txtProject.getText()));

    try {
      List<String> stories = getStoriesFullPaths();
      config.setAttribute(ILaunchConstants.LAUNCH_ATTR_STORIES_FULL_PATH, stories);
    } catch (CoreException cex) {
      EasybLaunchActivator.Log(
          "Unable apply configuration due to exception while retrieving story locations", cex);
      setErrorMessage(
          "Unable apply configuration due to exception while retrieving story locations");
    }

    if (container != null) {
      config.setAttribute(
          ILaunchConstants.LAUNCH_ATTR_CONTAINER_HANDLE, container.getHandleIdentifier());
    }

    if (storyFile != null) {
      config.setAttribute(
          ILaunchConstants.LAUNCH_ATTR_STORY_PATH,
          storyFile.getProjectRelativePath().toPortableString());
    }

    config.setAttribute(
        ILaunchConstants.LAUNCH_ATTR_IS_SINGLE_STORY, btnRadioSingleStory.getSelection());
  }
예제 #2
0
  @Override
  public void initializeFrom(ILaunchConfiguration config) {

    try {
      txtProject.setText(
          config.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, ""));
    } catch (CoreException ce) {
      EasybLaunchActivator.Log("Unable to set project name for launch", ce);
      setErrorMessage("Unable to set project from configuration");
    }

    initialiseStoriesfromConfiguration(config);
  }
예제 #3
0
  private IFile chooseStory() {
    try {
      IJavaProject javaProject = getJavaProject();
      IFile[] files = BehaviourSearch.findStoryFiles(javaProject.getResource());

      BehaviourElementSelectorDialog dialog = new BehaviourElementSelectorDialog(getShell(), files);

      dialog.setTitle("Stories");
      dialog.setMessage("Choose a story");

      if (dialog.open() == Window.OK) {
        Object element = dialog.getFirstResult();
        return (IFile) element;
      }
    } catch (CoreException cex) {
      EasybLaunchActivator.Log("Unable to locate storys for story browse", cex);
      setErrorMessage("Unable to locate storys for story browse");
    }

    return null;
  }
예제 #4
0
  protected void initialiseStoriesfromConfiguration(ILaunchConfiguration config) {

    try {
      String containerHandle =
          config.getAttribute(ILaunchConstants.LAUNCH_ATTR_CONTAINER_HANDLE, "");

      if (!StringUtils.isBlank(containerHandle)) {
        container = JavaCore.create(containerHandle);
        txtMultiStories.setText(container.getElementName());
      }

    } catch (CoreException ce) {
      EasybLaunchActivator.Log("Unable to set project,resource or package name for launch", ce);
      setErrorMessage("Unable to set project,folder or package for stories from configuration");
    }

    try {
      String storyProjectPath = config.getAttribute(ILaunchConstants.LAUNCH_ATTR_STORY_PATH, "");

      IPath path = null;
      if (!StringUtils.isBlank(storyProjectPath)) {
        path = Path.fromPortableString(storyProjectPath);
      }

      IJavaProject javaProject = getJavaProject();

      if (javaProject != null) {
        IProject project = javaProject.getProject();
        if (project.findMember(path) instanceof IFile) {
          storyFile = (IFile) project.findMember(path);
        } else {
          setErrorMessage("Unable to locate " + storyProjectPath + " in project");
        }
      } else {
        setErrorMessage("No project has been set for story");
      }

      if (storyFile != null) {
        txtStory.setText(storyFile.getName());
      } else if (!StringUtils.isBlank(storyProjectPath)) {
        txtStory.setText(storyProjectPath);
      }

    } catch (CoreException ce) {
      EasybLaunchActivator.Log("Unable to set story for launch", ce);
      setErrorMessage("Unable to set story for launch");
    }

    try {
      boolean isSingleStory =
          config.getAttribute(ILaunchConstants.LAUNCH_ATTR_IS_SINGLE_STORY, true);
      setEnableSingleStory(isSingleStory);
      setEnableProject(isSingleStory);
      setEnableMultiStory(!isSingleStory);

      btnRadioSingleStory.setSelection(isSingleStory);
      btnRadioMultiStory.setSelection(!isSingleStory);

    } catch (CoreException ce) {
      EasybLaunchActivator.Log("Unable to set single or multi story radio buttons", ce);
      setErrorMessage("Unable to set single or multi story radio buttons");
    }
  }