示例#1
0
 private void checkAbstractMarkupLanguage(MarkupLanguage language, String field) {
   if (!(language instanceof AbstractMarkupLanguage)) {
     throw new BuildException(
         MessageFormat.format(
             Messages.getString("MarkupTask.2"),
             field, //$NON-NLS-1$
             language.getName()));
   }
 }
示例#2
0
 /**
  * Create a {@link MarkupLanguage markup language parser} for the {@link #getMarkupLanguage()
  * specified markup language}.
  *
  * @return the markup language
  * @throws BuildException if the markup language is not specified or if it is unknown.
  */
 protected MarkupLanguage createMarkupLanguage() throws BuildException {
   if (markupLanguage == null) {
     throw new BuildException(Messages.getString("MarkupTask.0")); // $NON-NLS-1$
   }
   try {
     MarkupLanguage language =
         ServiceLocator.getInstance(getClass().getClassLoader()).getMarkupLanguage(markupLanguage);
     if (internalLinkPattern != null) {
       checkAbstractMarkupLanguage(language, "internalLinkPattern"); // $NON-NLS-1$
       ((AbstractMarkupLanguage) language).setInternalLinkPattern(internalLinkPattern);
     }
     if (markupLanguageConfiguration != null) {
       language.configure(markupLanguageConfiguration);
     }
     return language;
   } catch (IllegalArgumentException e) {
     throw new BuildException(e.getMessage(), e);
   }
 }
 public Object getInformation2(ITextViewer textViewer, IRegion subject) {
   if (outline == null) {
     // If the outline was not set then parse it.  This can happen in a task editor
     if (markupLanguage != null) {
       IDocument document = textViewer.getDocument();
       if (document != null && document.getLength() > 0) {
         MarkupLanguage language = markupLanguage.clone();
         OutlineParser outlineParser = new OutlineParser();
         outlineParser.setMarkupLanguage(language.clone());
         String markup = document.get();
         final OutlineItem outline = outlineParser.parse(markup);
         if (MarkupSourceViewerConfiguration.this.file != null) {
           outline.setResourcePath(
               MarkupSourceViewerConfiguration.this.file.getFullPath().toString());
         }
         return outline;
       }
     }
   }
   return outline;
 }
 public void setMarkupLanguage(MarkupLanguage markupLanguage) {
   templates =
       markupLanguage == null
           ? null
           : WikiTextUiPlugin.getDefault().getTemplates().get(markupLanguage.getName());
 }