<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<!--
    Copyright (c) 2015, 2016 CNRS, IRIT, IRT AESE (IRT Saint Exupéry).
    All rights reserved. This program and the accompanying materials
    are made available under the terms of the LGPL 3.0
    which accompanies this distribution, and is available at
    https://www.gnu.org/licenses/lgpl-3.0-standalone.html
   
    Contributors:
         Faiez Zalila - initial API and implementation and/or initial documentation
 -->

<plugin>
	<extension
		point="org.eclipse.ui.editors">
		<editor
			class="fr.irit.fiacre.xtext.ui.FiacreExecutableExtensionFactory:org.eclipse.xtext.ui.editor.XtextEditor"
			contributorClass="org.eclipse.ui.editors.text.TextEditorActionContributor"
			default="true"
			extensions="fcr"
			id="fr.irit.fiacre.xtext.Fiacre"
			name="Fiacre Editor">
		</editor>
	</extension>
	<extension
		point="org.eclipse.ui.handlers">
		<handler
			class="fr.irit.fiacre.xtext.ui.FiacreExecutableExtensionFactory:org.eclipse.xtext.ui.editor.hyperlinking.OpenDeclarationHandler"
			commandId="org.eclipse.xtext.ui.editor.hyperlinking.OpenDeclaration">
			<activeWhen>
				<reference
					definitionId="fr.irit.fiacre.xtext.Fiacre.Editor.opened">
				</reference>
			</activeWhen>
		</handler>
		<handler
			class="fr.irit.fiacre.xtext.ui.FiacreExecutableExtensionFactory:org.eclipse.xtext.ui.editor.handler.ValidateActionHandler"
			commandId="fr.irit.fiacre.xtext.Fiacre.validate">
		<activeWhen>
			<reference
					definitionId="fr.irit.fiacre.xtext.Fiacre.Editor.opened">
			</reference>
		</activeWhen>
		</handler>
		<!-- copy qualified name -->
		<handler
			class="fr.irit.fiacre.xtext.ui.FiacreExecutableExtensionFactory:org.eclipse.xtext.ui.editor.copyqualifiedname.EditorCopyQualifiedNameHandler"
			commandId="org.eclipse.xtext.ui.editor.copyqualifiedname.EditorCopyQualifiedName">
			<activeWhen>
				<reference definitionId="fr.irit.fiacre.xtext.Fiacre.Editor.opened" />
			</activeWhen>
		</handler>
		<handler
			class="fr.irit.fiacre.xtext.ui.FiacreExecutableExtensionFactory:org.eclipse.xtext.ui.editor.copyqualifiedname.OutlineCopyQualifiedNameHandler"
			commandId="org.eclipse.xtext.ui.editor.copyqualifiedname.OutlineCopyQualifiedName">
			<activeWhen>
				<and>
					<reference definitionId="fr.irit.fiacre.xtext.Fiacre.XtextEditor.opened" />
					<iterate>
						<adapt type="org.eclipse.xtext.ui.editor.outline.IOutlineNode" />
					</iterate>
				</and>
			</activeWhen>
		</handler>
	</extension>
	<extension point="org.eclipse.core.expressions.definitions">
		<definition id="fr.irit.fiacre.xtext.Fiacre.Editor.opened">
			<and>
				<reference definitionId="isActiveEditorAnInstanceOfXtextEditor"/>
				<with variable="activeEditor">
					<test property="org.eclipse.xtext.ui.editor.XtextEditor.languageName" 
						value="fr.irit.fiacre.xtext.Fiacre" 
						forcePluginActivation="true"/>
				</with>		
			</and>
		</definition>
		<definition id="fr.irit.fiacre.xtext.Fiacre.XtextEditor.opened">
			<and>
				<reference definitionId="isXtextEditorActive"/>
				<with variable="activeEditor">
					<test property="org.eclipse.xtext.ui.editor.XtextEditor.languageName" 
						value="fr.irit.fiacre.xtext.Fiacre" 
						forcePluginActivation="true"/>
				</with>		
			</and>
		</definition>
	</extension>
	<extension
			point="org.eclipse.ui.preferencePages">
		<page
			class="fr.irit.fiacre.xtext.ui.FiacreExecutableExtensionFactory:org.eclipse.xtext.ui.editor.preferences.LanguageRootPreferencePage"
			id="fr.irit.fiacre.xtext.Fiacre"
			name="Fiacre">
			<keywordReference id="fr.irit.fiacre.xtext.ui.keyword_Fiacre"/>
		</page>
		<page
			category="fr.irit.fiacre.xtext.Fiacre"
			class="fr.irit.fiacre.xtext.ui.FiacreExecutableExtensionFactory:org.eclipse.xtext.ui.editor.syntaxcoloring.SyntaxColoringPreferencePage"
			id="fr.irit.fiacre.xtext.Fiacre.coloring"
			name="Syntax Coloring">
			<keywordReference id="fr.irit.fiacre.xtext.ui.keyword_Fiacre"/>
		</page>
		<page
			category="fr.irit.fiacre.xtext.Fiacre"
			class="fr.irit.fiacre.xtext.ui.FiacreExecutableExtensionFactory:org.eclipse.xtext.ui.editor.templates.XtextTemplatePreferencePage"
			id="fr.irit.fiacre.xtext.Fiacre.templates"
			name="Templates">
			<keywordReference id="fr.irit.fiacre.xtext.ui.keyword_Fiacre"/>
		</page>
	</extension>
	<extension
			point="org.eclipse.ui.propertyPages">
		<page
			class="fr.irit.fiacre.xtext.ui.FiacreExecutableExtensionFactory:org.eclipse.xtext.ui.editor.preferences.LanguageRootPreferencePage"
			id="fr.irit.fiacre.xtext.Fiacre"
			name="Fiacre">
			<keywordReference id="fr.irit.fiacre.xtext.ui.keyword_Fiacre"/>
			<enabledWhen>
				<adapt type="org.eclipse.core.resources.IProject"/>
			</enabledWhen>
			<filter name="projectNature" value="org.eclipse.xtext.ui.shared.xtextNature"/>
		</page>
	</extension>
	<extension
		point="org.eclipse.ui.keywords">
		<keyword
			id="fr.irit.fiacre.xtext.ui.keyword_Fiacre"
			label="Fiacre"/>
	</extension>
	<extension
		point="org.eclipse.ui.commands">
	<command
			description="Trigger expensive validation"
			id="fr.irit.fiacre.xtext.Fiacre.validate"
			name="Validate">
	</command>
	<!-- copy qualified name -->
	<command
			id="org.eclipse.xtext.ui.editor.copyqualifiedname.EditorCopyQualifiedName"
			categoryId="org.eclipse.ui.category.edit"
			description="Copy the qualified name for the selected element"
			name="Copy Qualified Name">
	</command>
	<command
			id="org.eclipse.xtext.ui.editor.copyqualifiedname.OutlineCopyQualifiedName"
			categoryId="org.eclipse.ui.category.edit"
			description="Copy the qualified name for the selected element"
			name="Copy Qualified Name">
	</command>
	</extension>
	<extension point="org.eclipse.ui.menus">
		<menuContribution
			locationURI="popup:#TextEditorContext?after=group.edit">
			 <command
				 commandId="fr.irit.fiacre.xtext.Fiacre.validate"
				 style="push"
				 tooltip="Trigger expensive validation">
			<visibleWhen checkEnabled="false">
				<reference
					definitionId="fr.irit.fiacre.xtext.Fiacre.Editor.opened">
				</reference>
			</visibleWhen>
		</command>
		</menuContribution>
		<!-- copy qualified name -->
		<menuContribution locationURI="popup:#TextEditorContext?after=copy">
			<command commandId="org.eclipse.xtext.ui.editor.copyqualifiedname.EditorCopyQualifiedName" 
				style="push" tooltip="Copy Qualified Name">
				<visibleWhen checkEnabled="false">
					<reference definitionId="fr.irit.fiacre.xtext.Fiacre.Editor.opened" />
				</visibleWhen>
			</command>
		</menuContribution>
		<menuContribution locationURI="menu:edit?after=copy">
			<command commandId="org.eclipse.xtext.ui.editor.copyqualifiedname.EditorCopyQualifiedName"
				style="push" tooltip="Copy Qualified Name">
				<visibleWhen checkEnabled="false">
					<reference definitionId="fr.irit.fiacre.xtext.Fiacre.Editor.opened" />
				</visibleWhen>
			</command>
		</menuContribution>
		<menuContribution locationURI="popup:org.eclipse.xtext.ui.outline?after=additions">
			<command commandId="org.eclipse.xtext.ui.editor.copyqualifiedname.OutlineCopyQualifiedName" 
				style="push" tooltip="Copy Qualified Name">
				<visibleWhen checkEnabled="false">
					<and>
						<reference definitionId="fr.irit.fiacre.xtext.Fiacre.XtextEditor.opened" />
						<iterate>
							<adapt type="org.eclipse.xtext.ui.editor.outline.IOutlineNode" />
						</iterate>
					</and>
				</visibleWhen>
			</command>
		</menuContribution>
	</extension>
	<extension point="org.eclipse.ui.menus">
		<menuContribution locationURI="popup:#TextEditorContext?endof=group.find">
			<command commandId="org.eclipse.xtext.ui.editor.FindReferences">
				<visibleWhen checkEnabled="false">
					<reference definitionId="fr.irit.fiacre.xtext.Fiacre.Editor.opened">
					</reference>
				</visibleWhen>
			</command>
		</menuContribution>
	</extension>
	<extension point="org.eclipse.ui.handlers">
		<handler
			class="fr.irit.fiacre.xtext.ui.FiacreExecutableExtensionFactory:org.eclipse.xtext.ui.editor.findrefs.FindReferencesHandler"
			commandId="org.eclipse.xtext.ui.editor.FindReferences">
			<activeWhen>
				<reference
					definitionId="fr.irit.fiacre.xtext.Fiacre.Editor.opened">
				</reference>
			</activeWhen>
		</handler>
	</extension>
	<!-- adding resource factories -->
	<extension
		point="org.eclipse.emf.ecore.extension_parser">
		<parser
			class="fr.irit.fiacre.xtext.ui.FiacreExecutableExtensionFactory:org.eclipse.xtext.resource.IResourceFactory"
			type="fcr">
		</parser>
	</extension>
	<extension point="org.eclipse.xtext.extension_resourceServiceProvider">
		<resourceServiceProvider
			class="fr.irit.fiacre.xtext.ui.FiacreExecutableExtensionFactory:org.eclipse.xtext.ui.resource.IResourceUIServiceProvider"
			uriExtension="fcr">
		</resourceServiceProvider>
	</extension>
	<!-- marker definitions for fr.irit.fiacre.xtext.Fiacre -->
	<extension
			id="fiacre.check.fast"
			name="Fiacre Problem"
			point="org.eclipse.core.resources.markers">
		<super type="org.eclipse.xtext.ui.check.fast"/>
		<persistent value="true"/>
	</extension>
	<extension
			id="fiacre.check.normal"
			name="Fiacre Problem"
			point="org.eclipse.core.resources.markers">
		<super type="org.eclipse.xtext.ui.check.normal"/>
		<persistent value="true"/>
	</extension>
	<extension
			id="fiacre.check.expensive"
			name="Fiacre Problem"
			point="org.eclipse.core.resources.markers">
		<super type="org.eclipse.xtext.ui.check.expensive"/>
		<persistent value="true"/>
	</extension>
	<extension point="org.eclipse.xtext.builder.participant">
		<participant
			class="fr.irit.fiacre.xtext.ui.FiacreExecutableExtensionFactory:org.eclipse.xtext.builder.IXtextBuilderParticipant"
			fileExtensions="fcr"/>
	</extension>
	<extension point="org.eclipse.ui.preferencePages">
		<page
			category="fr.irit.fiacre.xtext.Fiacre"
			class="fr.irit.fiacre.xtext.ui.FiacreExecutableExtensionFactory:org.eclipse.xtext.builder.preferences.BuilderPreferencePage"
			id="fr.irit.fiacre.xtext.Fiacre.compiler.preferencePage"
			name="Compiler">
			<keywordReference id="fr.irit.fiacre.xtext.ui.keyword_Fiacre"/>
		</page>
	</extension>
	<extension point="org.eclipse.ui.propertyPages">
		<page
			category="fr.irit.fiacre.xtext.Fiacre"
			class="fr.irit.fiacre.xtext.ui.FiacreExecutableExtensionFactory:org.eclipse.xtext.builder.preferences.BuilderPreferencePage"
			id="fr.irit.fiacre.xtext.Fiacre.compiler.propertyPage"
			name="Compiler">
			<keywordReference id="fr.irit.fiacre.xtext.ui.keyword_Fiacre"/>
			<enabledWhen>
				<adapt type="org.eclipse.core.resources.IProject"/>
			</enabledWhen>
			<filter name="projectNature" value="org.eclipse.xtext.ui.shared.xtextNature"/>
		</page>
	</extension>
	<extension point="org.eclipse.ui.menus">
		<menuContribution locationURI="popup:#TextEditorContext?after=xtext.ui.openDeclaration">
			<command
				commandId="org.eclipse.xtext.ui.OpenGeneratedFileCommand"
				id="fr.irit.fiacre.xtext.Fiacre.OpenGeneratedCode"
				style="push">
				<visibleWhen checkEnabled="false">
					<reference definitionId="fr.irit.fiacre.xtext.Fiacre.Editor.opened" />
				</visibleWhen>
			</command>
		</menuContribution>
	</extension>
	<extension point="org.eclipse.ui.handlers">
		<handler
			class="fr.irit.fiacre.xtext.ui.FiacreExecutableExtensionFactory:org.eclipse.xtext.ui.generator.trace.OpenGeneratedFileHandler"
			commandId="org.eclipse.xtext.ui.OpenGeneratedFileCommand">
			<activeWhen>
				<reference definitionId="fr.irit.fiacre.xtext.Fiacre.Editor.opened" />
			</activeWhen>
		</handler>
	</extension>
	<!-- Quick Outline -->
	<extension
		point="org.eclipse.ui.handlers">
		<handler 
			class="fr.irit.fiacre.xtext.ui.FiacreExecutableExtensionFactory:org.eclipse.xtext.ui.editor.outline.quickoutline.ShowQuickOutlineActionHandler"
			commandId="org.eclipse.xtext.ui.editor.outline.QuickOutline">
			<activeWhen>
				<reference
					definitionId="fr.irit.fiacre.xtext.Fiacre.Editor.opened">
				</reference>
			</activeWhen>
		</handler>
	</extension>
	<extension
		point="org.eclipse.ui.commands">
		<command
			description="Open the quick outline."
			id="org.eclipse.xtext.ui.editor.outline.QuickOutline"
			name="Quick Outline">
		</command>
	</extension>
	<extension point="org.eclipse.ui.menus">
		<menuContribution
			locationURI="popup:#TextEditorContext?after=group.open">
			<command commandId="org.eclipse.xtext.ui.editor.outline.QuickOutline"
				style="push"
				tooltip="Open Quick Outline">
				<visibleWhen checkEnabled="false">
					<reference definitionId="fr.irit.fiacre.xtext.Fiacre.Editor.opened"/>
				</visibleWhen>
			</command>
		</menuContribution>
	</extension>
	<!-- quickfix marker resolution generator for fr.irit.fiacre.xtext.Fiacre -->
	<extension
			point="org.eclipse.ui.ide.markerResolution">
		<markerResolutionGenerator
			class="fr.irit.fiacre.xtext.ui.FiacreExecutableExtensionFactory:org.eclipse.xtext.ui.editor.quickfix.MarkerResolutionGenerator"
			markerType="fr.irit.fiacre.xtext.ui.fiacre.check.fast">
			<attribute
				name="FIXABLE_KEY"
				value="true">
			</attribute>
		</markerResolutionGenerator>
		<markerResolutionGenerator
			class="fr.irit.fiacre.xtext.ui.FiacreExecutableExtensionFactory:org.eclipse.xtext.ui.editor.quickfix.MarkerResolutionGenerator"
			markerType="fr.irit.fiacre.xtext.ui.fiacre.check.normal">
			<attribute
				name="FIXABLE_KEY"
				value="true">
			</attribute>
		</markerResolutionGenerator>
		<markerResolutionGenerator
			class="fr.irit.fiacre.xtext.ui.FiacreExecutableExtensionFactory:org.eclipse.xtext.ui.editor.quickfix.MarkerResolutionGenerator"
			markerType="fr.irit.fiacre.xtext.ui.fiacre.check.expensive">
			<attribute
				name="FIXABLE_KEY"
				value="true">
			</attribute>
		</markerResolutionGenerator>
	</extension>
	<!-- Rename Refactoring -->
	<extension point="org.eclipse.ui.handlers">
		<handler 
			class="fr.irit.fiacre.xtext.ui.FiacreExecutableExtensionFactory:org.eclipse.xtext.ui.refactoring.ui.DefaultRenameElementHandler"
			commandId="org.eclipse.xtext.ui.refactoring.RenameElement">
			<activeWhen>
				<reference
					definitionId="fr.irit.fiacre.xtext.Fiacre.Editor.opened">
				</reference>
			</activeWhen>
		</handler>
	</extension>
	<extension point="org.eclipse.ui.menus">
		<menuContribution
			locationURI="popup:#TextEditorContext?after=group.edit">
			<command commandId="org.eclipse.xtext.ui.refactoring.RenameElement"
				style="push">
				<visibleWhen checkEnabled="false">
					<reference
						definitionId="fr.irit.fiacre.xtext.Fiacre.Editor.opened">
					</reference>
				</visibleWhen>
			</command>
		</menuContribution>
	</extension>
	<extension point="org.eclipse.ui.preferencePages">
		<page
			category="fr.irit.fiacre.xtext.Fiacre"
			class="fr.irit.fiacre.xtext.ui.FiacreExecutableExtensionFactory:org.eclipse.xtext.ui.refactoring.ui.RefactoringPreferencePage"
			id="fr.irit.fiacre.xtext.Fiacre.refactoring"
			name="Refactoring">
			<keywordReference id="fr.irit.fiacre.xtext.ui.keyword_Fiacre"/>
		</page>
	</extension>
	<extension point="org.eclipse.compare.contentViewers">
		<viewer id="fr.irit.fiacre.xtext.Fiacre.compare.contentViewers"
			class="fr.irit.fiacre.xtext.ui.FiacreExecutableExtensionFactory:org.eclipse.xtext.ui.compare.InjectableViewerCreator"
			extensions="fcr">
		</viewer>
	</extension>
	<extension point="org.eclipse.compare.contentMergeViewers">
		<viewer id="fr.irit.fiacre.xtext.Fiacre.compare.contentMergeViewers"
			class="fr.irit.fiacre.xtext.ui.FiacreExecutableExtensionFactory:org.eclipse.xtext.ui.compare.InjectableViewerCreator"
			extensions="fcr" label="Fiacre Compare">
		</viewer>
	</extension>
	<extension point="org.eclipse.ui.editors.documentProviders">
		<provider id="fr.irit.fiacre.xtext.Fiacre.editors.documentProviders"
			class="fr.irit.fiacre.xtext.ui.FiacreExecutableExtensionFactory:org.eclipse.xtext.ui.editor.model.XtextDocumentProvider"
			extensions="fcr">
		</provider>
	</extension>
	<extension point="org.eclipse.team.core.fileTypes">
		<fileTypes
			extension="fcr"
			type="text">
		</fileTypes>
	</extension>
</plugin>
