<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<!--
   Copyright (c) 2009, 2018 Red Hat, Inc.
   
   This program and the accompanying materials are made
   available under the terms of the Eclipse Public License 2.0
   which is available at https://www.eclipse.org/legal/epl-2.0/
  
   SPDX-License-Identifier: EPL-2.0

   Contributors:
       Red Hat - initial API and implementation
 -->

<plugin>

   <extension point="org.eclipse.ui.contexts">
      <context
            name="%context.name"
            id="org.eclipse.linuxtools.rpm.ui.specEditorScope"
            parentId="org.eclipse.ui.textEditorScope">
      </context>
   </extension>
   <extension
         point="org.eclipse.core.contenttype.contentTypes">
      <content-type
            base-type="org.eclipse.core.runtime.text"
            file-extensions="spec"
            id="org.eclipse.linuxtools.rpm.editor.content-type"
            name="%content-type.name"
            priority="high">
      </content-type>
   </extension>
   <extension point="org.eclipse.core.runtime.adapters">
		<factory
    		adaptableType="org.eclipse.ui.internal.genericeditor.ExtensionBasedTextEditor"
    		class="org.eclipse.linuxtools.internal.rpm.ui.editor.outline.SpecOutlinePageAdapterFactory">
   			<adapter type="org.eclipse.ui.views.contentoutline.IContentOutlinePage"/>
 		</factory>
 		<factory
    		adaptableType="org.eclipse.linuxtools.internal.rpm.ui.editor.SpecfileEditor"
    		class="org.eclipse.linuxtools.internal.rpm.ui.editor.outline.SpecOutlinePageAdapterFactory">
   			<adapter type="org.eclipse.ui.views.contentoutline.IContentOutlinePage"/>
 		</factory>
   </extension>
   <extension
         point="org.eclipse.ui.editors">
      <editor
            name="%editor.name"
            icon="icons/rpm.gif"
            contributorClass="org.eclipse.ui.texteditor.BasicTextEditorActionContributor"
            class="org.eclipse.linuxtools.internal.rpm.ui.editor.SpecfileEditor"
            id="org.eclipse.linuxtools.rpm.ui.editor.SpecfileEditor">
         <contentTypeBinding
               contentTypeId="org.eclipse.linuxtools.rpm.editor.content-type">
         </contentTypeBinding>
      </editor>
   </extension>
   <extension
         point="org.eclipse.ui.genericeditor.presentationReconcilers">
      <presentationReconciler
            class="org.eclipse.linuxtools.internal.rpm.ui.editor.SpecfilePrecentationReconciler"
            contentType="org.eclipse.linuxtools.rpm.editor.content-type">
      </presentationReconciler>
   </extension>
    <extension point="org.eclipse.ui.genericeditor.contentAssistProcessors">
      <contentAssistProcessor
            class="org.eclipse.linuxtools.internal.rpm.ui.editor.SpecfileCompletionProcessor"
            contentType="org.eclipse.linuxtools.rpm.editor.content-type">
      </contentAssistProcessor>
   </extension>
   <extension point="org.eclipse.ui.genericeditor.hoverProviders">
      <hoverProvider
     		class="org.eclipse.linuxtools.internal.rpm.ui.editor.SpecfileHover"
            contentType="org.eclipse.linuxtools.rpm.editor.content-type">
  	  </hoverProvider>
   </extension>

       <!-- Hyperlink targets and detectors -->
    <extension
    point="org.eclipse.ui.workbench.texteditor.hyperlinkDetectorTargets">
<target id="org.eclipse.linuxtools.rpm.ui.editor.SpecfileEditorTarget"
    name="RPM Editor Target">
<context type="org.eclipse.ui.texteditor.ITextEditor"/>
</target>
</extension>
   <extension
  point="org.eclipse.ui.workbench.texteditor.hyperlinkDetectors">
  <hyperlinkDetector
    id="org.eclipse.linuxtools.rpm.ui.editor.hyperlink.URLHyperlinkWithMacroDetector"
    targetId="org.eclipse.linuxtools.rpm.ui.editor.SpecfileEditorTarget"
    class="org.eclipse.linuxtools.internal.rpm.ui.editor.hyperlink.URLHyperlinkWithMacroDetector"
    name="URLHyperlinkWithMacroDetector">
  </hyperlinkDetector>
  <hyperlinkDetector
    id="org.eclipse.linuxtools.rpm.ui.editor.hyperlink.SpecfileElementHyperlinkDetector"
    targetId="org.eclipse.linuxtools.rpm.ui.editor.SpecfileEditorTarget"
    class="org.eclipse.linuxtools.internal.rpm.ui.editor.hyperlink.SpecfileElementHyperlinkDetector"
    name="SpecfileElementHyperlinkDetector">
  </hyperlinkDetector>
  <hyperlinkDetector
    id="org.eclipse.linuxtools.rpm.ui.editor.hyperlink.MailHyperlinkDetector"
    targetId="org.eclipse.linuxtools.rpm.ui.editor.SpecfileEditorTarget"
    class="org.eclipse.linuxtools.internal.rpm.ui.editor.hyperlink.MailHyperlinkDetector"
    name="MailHyperlinkDetector">
  </hyperlinkDetector>
  <hyperlinkDetector
    id="org.eclipse.linuxtools.rpm.ui.editor.hyperlink.SourcesFileHyperlinkDetector"
    targetId="org.eclipse.linuxtools.rpm.ui.editor.SpecfileEditorTarget"
    class="org.eclipse.linuxtools.internal.rpm.ui.editor.hyperlink.SourcesFileHyperlinkDetector"
    name="SourcesFileHyperlinkDetector">
  </hyperlinkDetector>
</extension>

   <extension
       id="specfileerror"
       point="org.eclipse.core.resources.markers"
       name="%extension.name">
       <super type="org.eclipse.core.resources.problemmarker"/>
       <super type="org.eclipse.core.resources.textmarker"/>
       <persistent value="true"/>
    </extension>
     <extension
       id="specfiletask"
       point="org.eclipse.core.resources.markers"
       name="%extension.name.0">
       <super type="org.eclipse.core.resources.taskmarker"/>
       <persistent value="true"/>
    </extension>
   <extension
         point="org.eclipse.ui.editors.documentProviders">
      <provider
            class="org.eclipse.linuxtools.internal.rpm.ui.editor.SpecfileDocumentProvider"
            extensions="spec,spec2"
            id="org.eclipse.linuxtools.rpm.ui.editor.specfileDocumentProvider">
      </provider>
   </extension>
   <extension
         point="org.eclipse.linuxtools.changelog.core.parserContribution">
      <parser
            class="org.eclipse.linuxtools.internal.rpm.ui.editor.actions.SpecfileChangelogParser"
            editor="SpecfileEditor"
            name="SpecfileChangelogParser"/>
   </extension>
   <extension
         point="org.eclipse.linuxtools.changelog.core.formatterContribution">
      <formatter
            class="org.eclipse.linuxtools.internal.rpm.ui.editor.actions.SpecfileChangelogFormatter"
            id="org.eclipse.linuxtools.rpm.ui.editor.actions.specfilechangelogformatter"
            inFile="true"
            name="SpecfileChangelogFormatter">
         <filePattern pattern=".*\.spec"/>
      </formatter>
   </extension>

   <extension
         point="org.eclipse.ui.editors.templates">
      <contextType
            class="org.eclipse.jface.text.templates.TemplateContextType"
            name="preSection"
            id="org.eclipse.linuxtools.rpm.ui.editor.preSection"/>
      <contextType
            class="org.eclipse.jface.text.templates.TemplateContextType"
            name="buildSection"
            id="org.eclipse.linuxtools.rpm.ui.editor.buildSection"/>
      <contextType
            class="org.eclipse.jface.text.templates.TemplateContextType"
            name="preambleSection"
            id="org.eclipse.linuxtools.rpm.ui.editor.preambleSection"/>
      <include file="templates/templates.xml"/>
      <contextType
            class="org.eclipse.jface.text.templates.TemplateContextType"
            id="org.eclipse.linuxtools.rpm.ui.editor.installSection"
            name="fileSection"/>
      <contextType
            class="org.eclipse.jface.text.templates.TemplateContextType"
            id="org.eclipse.linuxtools.rpm.ui.editor.changelogSection"
            name="changelogSection"/>
      <include file="templates/templates.xml"/>
   </extension>
   <extension
         point="org.eclipse.ui.preferencePages">
      <page 
            category="org.eclipse.linuxtools.rpm.ui.mainpage"
            class="org.eclipse.linuxtools.internal.rpm.ui.editor.preferences.MainPreferencePage"
            id="org.eclipse.linuxtools.rpm.ui.editor.mainpage"
            name="%page.name"/>
      <page
            category="org.eclipse.linuxtools.rpm.ui.editor.mainpage"
            class="org.eclipse.linuxtools.internal.rpm.ui.editor.preferences.RpmProposalsPreferencePage"
            id="org.eclipse.linuxtools.rpm.ui.editor.preferences.RpmProposalsPreferencePage"
            name="%page.name.0"/>
      <page
            category="org.eclipse.linuxtools.rpm.ui.editor.mainpage"
            class="org.eclipse.linuxtools.internal.rpm.ui.editor.preferences.MacroProposalsPreferencePage"
            id="org.eclipse.linuxtools.rpm.ui.editor.preferences.MacroProposalsPreferencePage"
            name="%page.name.1"/>
      <page
            category="org.eclipse.linuxtools.rpm.ui.editor.mainpage"
            class="org.eclipse.linuxtools.internal.rpm.ui.editor.preferences.SpecTemplatePreferencePage"
            id="org.eclipse.linuxtools.rpm.ui.editor.preferences.SpecTemplatePreferencePage"
            name="%page.name.2"/>
      <page
            category="org.eclipse.linuxtools.rpm.ui.editor.preferences.RpmProposalsPreferencePage"
            class="org.eclipse.linuxtools.internal.rpm.ui.editor.preferences.RpmInformationsPreferencePage"
            id="org.eclipse.linuxtools.rpm.ui.editor.preferences.RpmInformationsPreferencePage"
            name="%page.name.3"/>
      <page
            category="org.eclipse.linuxtools.rpm.ui.editor.mainpage"
            class="org.eclipse.linuxtools.internal.rpm.ui.editor.preferences.TaskTagsPreferencePage"
            id="org.eclipse.linuxtools.rpm.ui.editor.preferences.TaskTagsPreferencePage"
            name="%page.name.4"/>
   </extension>

   <extension
         point="org.eclipse.core.runtime.preferences">
      <initializer class="org.eclipse.linuxtools.internal.rpm.ui.editor.preferences.PreferenceInitializer"/>
   </extension>
   <extension
         point="org.eclipse.ui.editors.annotationTypes">
         <type
             name="org.eclipse.linuxtools.rpm.ui.editor.highlightannotation"
             super="org.eclipse.ui.workbench.texteditor.info">
             <!--markerSeverity="0"-->
         </type>
   </extension>

   <extension
         point="org.eclipse.ui.editors.markerAnnotationSpecification">
      <specification
            annotationType="org.eclipse.linuxtools.rpm.ui.editor.highlightannotation"
            verticalRulerPreferenceKey="highlight.rulers.vertical"
            textPreferenceKey="highlight.text"
            colorPreferenceKey="highlight.color"
            highlightPreferenceKey="highlight.background"
            textPreferenceValue="false"
            textStylePreferenceValue="UNDERLINE"
            overviewRulerPreferenceKey="highlight.rulers.overview"
            presentationLayer="4"
            highlightPreferenceValue="true"
            label="Macro"
            icon="icons/occurrence_obj.gif"
            colorPreferenceValue="253,255,155"
            verticalRulerPreferenceValue="true"
            overviewRulerPreferenceValue="true"
            textStylePreferenceKey="highlight.text.style">
      </specification>
   </extension>
   <extension
         point="org.eclipse.ui.newWizards">
      <category
            id="org.eclipse.linuxtools.rpm.ui.editor"
            name="%category.name">
      </category>
      <wizard
            category="org.eclipse.linuxtools.rpm.ui.editor"
            class="org.eclipse.linuxtools.internal.rpm.ui.editor.wizards.SpecfileNewWizard"
            icon="icons/rpm.gif"
            id="org.eclipse.linuxtools.rpm.ui.editor.wizards.SpecfileNewWizard"
            name="%wizard.name">
      </wizard>
   </extension>
   <!-- Commands -->
   <extension
         point="org.eclipse.ui.commands">
         <category
            name="%category.name.0"
            description="%category.description"
            id="rpmEditor.category"/>
         <command
            categoryId="rpmEditor.category"
            name="%command.name"
            id="rpmEditor.toggleComment.command"/>
         <command
            categoryId="rpmEditor.category"
            name="%command.name.0"
            id="rpmEditor.organizePatches.command"/>
         <command
             categoryId="rpmEditor.category"
            id="rpmEditor.showOutline.command"
            name="%command.name.1"/>
         <command
               categoryId="rpmEditor.category"
               id="rpmEditor.downloadSources.command"
               name="%command.name.2">
         </command>
         <command
               categoryId="rpmEditor.category"
               id="rpmEditor.prepareSources.command"
               name="%command.name.3">
         </command>
   </extension>
   <extension point="org.eclipse.ui.handlers">
        <handler
              class="org.eclipse.linuxtools.internal.rpm.ui.editor.actions.SpecfileEditorToggleCommentActionDelegate"
              commandId="rpmEditor.toggleComment.command">
           <activeWhen>
              <reference
                    definitionId="org.eclipse.linuxtools.rpm.ui.editor.specEditorActive">
              </reference>
           </activeWhen>
        </handler>
        <handler
              class="org.eclipse.linuxtools.internal.rpm.ui.editor.actions.SpecfileEditorOrganizePatchesActionDelegate"
              commandId="rpmEditor.organizePatches.command">
           <activeWhen>
              <reference
                    definitionId="org.eclipse.linuxtools.rpm.ui.editor.specEditorActive">
              </reference>
           </activeWhen>
        </handler>
        <handler
              class="org.eclipse.linuxtools.internal.rpm.ui.editor.actions.SpecfileEditorShowOutlineActionDelegate"
              commandId="rpmEditor.showOutline.command">
           <activeWhen>
              <reference
                    definitionId="org.eclipse.linuxtools.rpm.ui.editor.specEditorActive">
              </reference>
           </activeWhen>
        </handler>
        <handler
              class="org.eclipse.linuxtools.internal.rpm.ui.editor.actions.SpecfileEditorDownloadSourcesActionDelegate"
              commandId="rpmEditor.downloadSources.command">
        </handler>
        <handler
              class="org.eclipse.linuxtools.internal.rpm.ui.editor.actions.SpecfileEditorPrepareSourcesActionDelegate"
              commandId="rpmEditor.prepareSources.command">
        </handler>
   </extension>
   <!-- Key bindings -->
   <extension
     point="org.eclipse.ui.bindings">
      <key
           sequence="Ctrl+Shift+C"
           commandId="rpmEditor.toggleComment.command"
           contextId="org.eclipse.linuxtools.rpm.ui.specEditorScope"
           schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/>
      <key
           sequence="Ctrl+Shift+O"
           commandId="rpmEditor.organizePatches.command"
           contextId="org.eclipse.linuxtools.rpm.ui.specEditorScope"
           schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/>
      <key
             sequence="Ctrl+O"
           commandId="rpmEditor.showOutline.command"
           contextId="org.eclipse.linuxtools.rpm.ui.specEditorScope"
           schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/>
      <key
            commandId="rpmEditor.downloadSources.command"
            contextId="org.eclipse.linuxtools.rpm.ui.specEditorScope"
            schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
            sequence="Ctrl+Shift+R D">
      </key>
      <key
            commandId="rpmEditor.prepareSources.command"
            contextId="org.eclipse.linuxtools.rpm.ui.specEditorScope"
            schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
            sequence="Ctrl+Shift+R P">
      </key>
   </extension>
   <!-- Editor menu actions -->
   <extension
         point="org.eclipse.ui.menus">
         <menuContribution
            locationURI="popup:org.eclipse.linuxtools.rpm.ui.popup?before=org.eclipse.linuxtools.rpm.ui.sourcesep">
         <command
               commandId="rpmEditor.downloadSources.command"
               label="%command.name.2"
               tooltip="%command.name.2">
            <visibleWhen
                  checkEnabled="false">
               <reference
                     definitionId="org.eclipse.linuxtools.rpm.core.rpmselection">
               </reference>
            </visibleWhen>
         </command>
         <command
               commandId="rpmEditor.prepareSources.command"
               label="%command.name.3"
               tooltip="%command.name.3">
            <visibleWhen
                  checkEnabled="false">
               <reference
                     definitionId="org.eclipse.linuxtools.rpm.core.rpmselection">
               </reference>
            </visibleWhen>
         </command>
      </menuContribution>
         <menuContribution
               locationURI="popup:org.eclipse.linuxtools.rpm.ui.popup?before=org.eclipse.linuxtools.rpm.ui.miscsep">
            <command
                  commandId="rpmEditor.toggleComment.command"
                  label="%command.label"
                  tooltip="%command.tooltip">
               <visibleWhen checkEnabled="true" />
            </command>
            <command
                  commandId="rpmEditor.organizePatches.command"
                  label="%command.label.0"
                  tooltip="%command.tooltip.0">
               <visibleWhen checkEnabled="true" />
            </command>
            <command
                  commandId="rpmEditor.showOutline.command"
                  label="%command.label.1"
                  tooltip="%command.tooltip.1">
               <visibleWhen checkEnabled="true" />
            </command>
         </menuContribution>
   </extension>
   <!-- Compare support-->
   <extension point="org.eclipse.compare.contentMergeViewers">
      <viewer
        id="org.eclipse.linuxtools.rpm.ui.editor.SpecMergeViewer"
        extensions="spec,spec2"
        class="org.eclipse.linuxtools.internal.rpm.ui.editor.compare.SpecMergeViewerCreator">
      </viewer>
   </extension>
   <extension point="org.eclipse.compare.structureMergeViewers">
      <viewer
        id="org.eclipse.linuxtools.rpm.ui.editor.SpecStructureMergeViewer"
        extensions="spec"
        class="org.eclipse.linuxtools.internal.rpm.ui.editor.compare.SpecStructureMergeViewerCreator">
      </viewer>
   </extension>
   <extension point ="org.eclipse.compare.structureCreators">
         <structureCreator id="org.eclipse.linuxtools.rpm.ui.editor.SpecStructureCreator"
        class="org.eclipse.linuxtools.internal.rpm.ui.editor.compare.SpecStructureCreator" extensions="spec"/>
   </extension>
   <extension
         point="org.eclipse.core.expressions.definitions">
      <definition
            id="org.eclipse.linuxtools.rpm.ui.editor.specEditorActive">
          <with variable="activeEditorInput">
			 <adapt type="org.eclipse.core.resources.IFile">
         		 <test property="org.eclipse.core.resources.contentTypeId" value="org.eclipse.linuxtools.rpm.editor.content-type" />
    		 </adapt>
		  </with>
      </definition>
   </extension>
    <extension
         point="org.eclipse.ui.themes">
      <themeElementCategory
            id="org.eclipse.linuxtools.rpm.editor.presentation"
            label="RPM .spec file editor">
      </themeElementCategory>
      <colorDefinition
            categoryId="org.eclipse.linuxtools.rpm.editor.presentation"
            id="org.eclipse.linuxtools.rpm.edtor.color.default"
            label="Default"
            value="0,0,0">
      </colorDefinition>
      <colorDefinition
            categoryId="org.eclipse.linuxtools.rpm.editor.presentation"
            id="org.eclipse.linuxtools.rpm.editor.color.sections"
            label="RPM Section name"
            value="128,0,0">
      </colorDefinition>
      <colorDefinition
            categoryId="org.eclipse.linuxtools.rpm.editor.presentation"
            id="org.eclipse.linuxtools.rpm.editor.color.macros"
            label="Macros"
            value="0,0,128">
      </colorDefinition>
      <colorDefinition
            categoryId="org.eclipse.linuxtools.rpm.editor.presentation"
            id="org.eclipse.linuxtools.rpm.editor.color.keywords"
            label="Keywords"
            value="127,0,85">
      </colorDefinition>
      <colorDefinition
            categoryId="org.eclipse.linuxtools.rpm.editor.presentation"
            id="org.eclipse.linuxtools.rpm.editor.color.defines"
            label="Defines"
            value="0,128,0">
      </colorDefinition>
      <colorDefinition
            categoryId="org.eclipse.linuxtools.rpm.editor.presentation"
            id="org.eclipse.linuxtools.rpm.editor.color.tags"
            label="Tags"
            value="255,101,52">
      </colorDefinition>
      <colorDefinition
            categoryId="org.eclipse.linuxtools.rpm.editor.presentation"
            id="org.eclipse.linuxtools.rpm.editor.color.comment"
            label="Comment"
            value="63,95,191">
      </colorDefinition>
      <colorDefinition
            categoryId="org.eclipse.linuxtools.rpm.editor.presentation"
            id="org.eclipse.linuxtools.rpm.editor.color.packages"
            label="Package names"
            value="0,0,128">
      </colorDefinition>
      <colorDefinition
            categoryId="org.eclipse.linuxtools.rpm.editor.presentation"
            id="org.eclipse.linuxtools.rpm.editor.color.author_email"
            label="Author email"
            value="10,20,175">
      </colorDefinition>
      <colorDefinition
            categoryId="org.eclipse.linuxtools.rpm.editor.presentation"
            id="org.eclipse.linuxtools.rpm.editor.color.ver_rel"
            label="Version.Release string"
            value="255,101,52">
      </colorDefinition>
   </extension>
</plugin>
