Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

DLTK Adding Todo Task Tag Support

Revision as of 16:01, 28 September 2008 by Jgangemi.gmail.com (Talk | contribs) (Steps)

Summary

WORK IN PROGRESS!!!!

This mini tutorial outlines the steps required to add todo task tag support to your plugin.

Prerequisites

This tutorial assumes the following have been implemented:

  • document partitioning
  • syntax highlighting

Steps

  • If you have not done so already, set up a preference initializer for your core plugin.
  • Once complete, initialize your plugin store's default values with a call to: TodoTaskPreferences.initializeDefaultValues(store);
  • Add org.eclipse.dltk.validators.core as a dependency for your core plugin.
  • Create an implementation of org.eclipse.dltk.validators.core.AbstractTodoParserBuildParticipantType and add the extension definition, ie:
<extension
  point="org.eclipse.dltk.validators.core.validator">
  <validatorType
    class="org.eclipse.dltk.python.internal.core.parser.PythonTodoParserType"
    id="org.eclipse.dltk.python.todo"
    nature="org.eclipse.dltk.python.core.nature">
  </validatorType>
</extension>
  • replace the comment scanner in your org.eclipse.dltk.ui.text.ScriptSourceViewerConfiguration implementation with a org.eclipse.dltk.ui.text.ScriptCommentScanner, ie:
fCommentScanner = new ScriptCommentScanner(getColorManager(),
					   fPreferenceStore, PythonColorConstants.PYTHON_SINGLE_LINE_COMMENT,
					   PythonColorConstants.PYTHON_TODO_TAG, new TodoTaskPreferences(
					   PythonPlugin.getDefault().getPluginPreferences()));
  • add ui preference constants and their initialization values, ie:
public final static String COMMENT_TASK_TAGS = PythonColorConstants.PYTHON_TODO_TAG;
public final static String COMMENT_TASK_TAGS_BOLD = COMMENT_TASK_TAGS + EDITOR_BOLD_SUFFIX;
 
PreferenceConverter.setDefault(store, COMMENT_TASK_TAGS, new RGB(127, 159, 191));
store.setDefault(COMMENT_TASK_TAGS_BOLD, true);
  • Create an implementation of org.eclipse.dltk.ui.preferences.TodoTaskAbstractPreferencePage and add the extension definition, ie:
<page
  category="org.eclipse.dltk.python.preferences"
  class="org.eclipse.dltk.python.internal.ui.preferences.PythonTodoTaskPreferencePage"
  id="org.eclipse.dltk.python.ui.editor.TodoTasks"
  name="%PythonTaskTags.name"/>
  • add an entry for the color syntax to your org.eclipse.dltk.ui.preferences.AbstractScriptEditorColoringConfigurationBlock implementation, ie:
{ PreferencesMessages.DLTKEditorPreferencePage_CommentTaskTags,
  PythonPreferenceConstants.COMMENT_TASK_TAGS, 
  sCommentsCategory 
}
  • and you're done! if all went right, you should have task tag support.

Back to the top