BlaBlaPluginJUnitMainTab

BlaBlaPluginJUnitMainTab

本文介绍了更改默认值“运行程序”在Eclipse中启动配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

默认情况下,Eclipse假定您正在运行需要工作台的东西,并在启动配置的主部分中选择

我可以理解为什么这是默认的,但对于我(和我们团队中的所有人)来说,从来没有这样。我们总是需要运行我们的JUnit插件测试作为

如何更改此默认行为?
我正在使用Eclipse 4.4。

解决方案

似乎是一个自定义的 LaunchConfiguration 是一个可行的解决方案。
我做的是创建一个新的,定制的 LaunchConfiguration -Extension,它是99.999%构建在JUnitLaunchConfiguration 上。我只需要添加一个自定义

  BlaBlaJUnitPluginTestLauncher extends launching.JUnitLaunchConfigurationDelegate 

它覆盖

  launch(ILaunchConfiguration,String,ILaunch, IProgressMonitor)

方法根据需要调整应用程序参数。

  BlaBlaJUnitPluginTestTabGroup扩展org.eclipse.pde.ui.launcher.JUnitTabGroup 

为了能够初始化具有默认参数的LaunchConfig对话框,我必须:


  1. 添加自定义 BlaBlaPluginJUnitMainTab 扩展 PluginJUnitMainTab

  2. 创建自定义JUnitProgramBlock实现( BlaBlaJUnitProgramBlock

  3. BlaBlaJUnitPluginTestTabGroup中创建一个 BlaBlaJUnitProgramBlock 的实例。 BlaBlaPluginJUnitMainTab.createProgramBlock()方法

  4. 中覆盖 setDefaults -method(不确定是否真的必要)BlaBlaJUnitProgramBlock

  5. BlaBlaJUnitProgramBlock 中覆盖initializeForm方法,并调整参数。

导致以下结果:




every now and then I am launching JUnit tests from within Eclipse by using

By default Eclipse assumes you are running something which requires a workbench and chooses in the "Main" section of the launch configuration

I can understand why this is the default, but for me (and for all in our team) this is never ever the case. We always need to run our JUnit Plug-in Tests as

How do I change this default behaviour?I am currently using Eclipse 4.4.

解决方案

It seems a custom LaunchConfiguration-Extension is a viable solution attempt.What I did was to create a new, custom LaunchConfiguration-Extension which is 99.999% build on the JUnitLaunchConfiguration. I only had to add a custom

BlaBlaJUnitPluginTestLauncher extends launching.JUnitLaunchConfigurationDelegate

which overrides the

launch(ILaunchConfiguration, String, ILaunch, IProgressMonitor)

method to adjust the application parameters according to our needs.

BlaBlaJUnitPluginTestTabGroup extends org.eclipse.pde.ui.launcher.JUnitTabGroup

To be able to initialize the LaunchConfig dialog with the default parameter, I had to:

  1. Add a custom BlaBlaPluginJUnitMainTab extends PluginJUnitMainTab
  2. Create a custom JUnitProgramBlock implementation (BlaBlaJUnitProgramBlock)
  3. Creating an instance of BlaBlaJUnitProgramBlock in the BlaBlaJUnitPluginTestTabGroup.BlaBlaPluginJUnitMainTab.createProgramBlock() method
  4. Overriding setDefaults-method (not sure if its really neccessary) in BlaBlaJUnitProgramBlock
  5. Overriding initializeForm-method in the BlaBlaJUnitProgramBlock and adjust parameter there too.

Leading to the following result:

这篇关于更改默认值“运行程序”在Eclipse中启动配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 18:04