获取 ConsoleLineTracker 实例
Get instance of ConsoleLineTracker
我已经为 IConsoleLineTracker
创建了一个扩展点,在 plugin.xml
中使用以下内容:
<extension point="org.eclipse.debug.ui.consoleLineTrackers">
<consoleLineTracker
id="com.example.OutputSensor"
class="com.example.OutputSensor"
processType="java">
</consoleLineTracker>
</extension>
class OutputSensor
实现 IConsoleLineTracker
。每次调用 lineAppended
方法时,我都能看到添加的行。我想将添加的行存储在 OutputSensor
的 实例 中,并从插件的其他地方访问它。
有什么方法可以访问由我的插件创建的 OutputSensor
实例吗?目前我只是在 OutputSensor
中使用静态变量,但我更愿意使用它的实例,最好是单例。
谢谢!
没有从扩展点定义创建 类 的通用机制。
我也看不到任何 public API 来获取已创建的控制台线路跟踪器。
所以我认为你能做的最好的事情就是在 OutputSensor
.
的构造函数中设置一个单例变量
我已经为 IConsoleLineTracker
创建了一个扩展点,在 plugin.xml
中使用以下内容:
<extension point="org.eclipse.debug.ui.consoleLineTrackers">
<consoleLineTracker
id="com.example.OutputSensor"
class="com.example.OutputSensor"
processType="java">
</consoleLineTracker>
</extension>
class OutputSensor
实现 IConsoleLineTracker
。每次调用 lineAppended
方法时,我都能看到添加的行。我想将添加的行存储在 OutputSensor
的 实例 中,并从插件的其他地方访问它。
有什么方法可以访问由我的插件创建的 OutputSensor
实例吗?目前我只是在 OutputSensor
中使用静态变量,但我更愿意使用它的实例,最好是单例。
谢谢!
没有从扩展点定义创建 类 的通用机制。
我也看不到任何 public API 来获取已创建的控制台线路跟踪器。
所以我认为你能做的最好的事情就是在 OutputSensor
.