Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "DLTK Adding Todo Task Tag Support"

(Summary)
(Steps)
Line 23: Line 23:
 
   point="org.eclipse.dltk.validators.core.validator">
 
   point="org.eclipse.dltk.validators.core.validator">
 
   <validatorType
 
   <validatorType
     class="org.eclipse.dltk.internal.javascript.parser.JavaScriptTodoParserType"
+
     class="org.eclipse.dltk.python.internal.core.parser.PythonTodoParserType"
     id="org.eclipse.dltk.javascript.todo"
+
     id="org.eclipse.dltk.python.todo"
     nature="org.eclipse.dltk.javascript.core.nature">
+
     nature="org.eclipse.dltk.python.core.nature">
 
   </validatorType>
 
   </validatorType>
</extension>  
+
</extension>
 
</source>
 
</source>
  
Line 33: Line 33:
  
 
<source lang="java">
 
<source lang="java">
fCommentScanner = new ScriptCommentScanner(getColorManager(), fPreferenceStore,
+
fCommentScanner = new ScriptCommentScanner(getColorManager(),
JavascriptColorConstants.JS_SINGLE_LINE_COMMENT,
+
  fPreferenceStore, PythonColorConstants.PYTHON_SINGLE_LINE_COMMENT,
JavascriptColorConstants.JS_TODO_TAG, new TodoTaskPreferences(
+
  PythonColorConstants.PYTHON_TODO_TAG, new TodoTaskPreferences(
JavaScriptPlugin.getDefault().getPluginPreferences()));
+
  PythonPlugin.getDefault().getPluginPreferences()));  
 
</source>
 
</source>
  
Line 42: Line 42:
  
 
<source lang="java">
 
<source lang="java">
public final static String COMMENT_TASK_TAGS = JavascriptColorConstants.JS_TODO_TAG;
+
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;
 
public final static String COMMENT_TASK_TAGS_BOLD = COMMENT_TASK_TAGS + EDITOR_BOLD_SUFFIX;
  
Line 49: Line 49:
 
</source>
 
</source>
  
*
+
* Create an implementation of org.eclipse.dltk.ui.preferences.TodoTaskAbstractPreferencePage and add the extension definition, ie:
 +
 
 +
<source lang="xml">
 +
<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"/>
 +
</source>
 +
 
 +
* add an entry for the color syntax to your org.eclipse.dltk.ui.preferences.AbstractScriptEditorColoringConfigurationBlock implementation, ie:
 +
 
 +
<source lang="java">
 +
{ PreferencesMessages.DLTKEditorPreferencePage_CommentTaskTags,
 +
  PythonPreferenceConstants.COMMENT_TASK_TAGS,
 +
  sCommentsCategory
 +
}
 +
</source>

Revision as of 16:00, 28 September 2008

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 
}

Back to the top