Skip to main content
Jump to: navigation, search

Difference between revisions of "Tip of the Day/Extending/JSonTipProvider"

(JSon Schema)
(JSon Schema)
Line 10: Line 10:
 
==JSon Schema==
 
==JSon Schema==
 
<nowiki>
 
<nowiki>
 +
<pre>
 
  {
 
  {
 
   "$id": "http://example.com/example.json",
 
   "$id": "http://example.com/example.json",
Line 175: Line 176:
 
   }
 
   }
 
  }
 
  }
 +
</pre>
 
</nowiki>
 
</nowiki>

Revision as of 12:51, 11 May 2018

JSon Tip Provider

A JSon Tip provider requires a JSon file with information. The TipProvider implementation can be very simple. An accompanying JSon file is dynamically fetched from the internet or it is statically included with your bundle.

In case you pull it from the internet, make sure that you do not waste bandwidth by pulling a file that you already have (use the HTTP HEAD function).

Examples

JSon Schema

<pre> { "$id": "http://example.com/example.json", "type": "object", "properties": { "provider": { "$id": "/properties/provider", "type": "object", "properties": { "image": { "$id": "/properties/provider/properties/image", "type": "string", "title": "The Image Schema ", "description": "a base 64 encoded image of 48x48 with transparant background.", "default": "", "examples": [ "data:image/png;base64,iV..C" ] }, "description": { "$id": "/properties/provider/properties/description", "type": "string", "title": "The Description Schema ", "description": "sss", "default": "", "examples": [ "JSon Tip Provider" ] }, "expression": { "$id": "/properties/provider/properties/expression", "type": "string", "title": "The Expression Schema ", "default": "", "examples": [ "<with variable=\"activeWorkbenchWindow.activePerspective\"><equals value=\"org.eclipse.jdt.ui.JavaPerspective\"></equals></with>" ] }, "variables": { "$id": "/properties/provider/properties/variables", "type": "object", "properties": { "foo": { "$id": "/properties/provider/properties/variables/properties/foo", "type": "string", "title": "The Foo Schema ", "default": "", "examples": [ "Example of substitution variable inside your url or html: ${tip.foo}" ] }, "bar": { "$id": "/properties/provider/properties/variables/properties/bar", "type": "string", "title": "The Bar Schema ", "default": "", "examples": [ "Example of substitution variable inside your url or html: ${tip.bar}" ] } } }, "tips": { "$id": "/properties/provider/properties/tips", "type": "array", "items": { "$id": "/properties/provider/properties/tips/items", "type": "object", "properties": { "subject": { "$id": "/properties/provider/properties/tips/items/properties/subject", "type": "string", "title": "The Subject Schema ", "default": "", "examples": [ "Embedded Full Screen YouTube video" ] }, "date": { "$id": "/properties/provider/properties/tips/items/properties/date", "type": "string", "title": "The Date Schema ", "default": "", "examples": [ "2018-02-12" ] }, "image": { "$id": "/properties/provider/properties/tips/items/properties/image", "type": "string", "title": "The Image Schema ", "default": "", "examples": [ "data:image/png;base64,iV..C" ] }, "ratio": { "$id": "/properties/provider/properties/tips/items/properties/ratio", "type": "number", "title": "The Ratio Schema ", "default": 0, "examples": [ 1.350000023841858 ] }, "maxWidth": { "$id": "/properties/provider/properties/tips/items/properties/maxWidth", "type": "integer", "title": "The Maxwidth Schema ", "default": 0, "examples": [ 500 ] }, "maxHeight": { "$id": "/properties/provider/properties/tips/items/properties/maxHeight", "type": "integer", "title": "The Maxheight Schema ", "default": 0, "examples": [ 300 ] }, "actionId": { "$id": "/properties/provider/properties/tips/items/properties/actionId", "type": "string", "title": "The Actionid Schema ", "default": "", "examples": [ "preferences" ] }, "html": { "$id": "/properties/provider/properties/tips/items/properties/html", "type": "string", "title": "The Html Schema ", "default": "", "examples": [ "<h2>title<h2><p>html text</p>" ] }, "url": { "$id": "/properties/provider/properties/tips/items/properties/url", "type": "string", "title": "The Url Schema ", "default": "", "examples": [ "http://some.com/tip.html" ] } }, "required": [ "subject", "html", "url" ] } } }, "required": [ "description", "tips" ] } } } </pre>

Back to the top