Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSopot Cela2017-01-31 10:37:05 -0500
committerSopot Cela2017-02-20 08:59:26 -0500
commitae7c6d260707e92921ca4bc923ddef30bca0d860 (patch)
tree4b3b3f17c4aa25baec64adda592eaade556f8707
parenta4cdfc7174a97c88e6a3d762a1bcc923f6d0fb03 (diff)
downloadeclipse.platform.team-ae7c6d260707e92921ca4bc923ddef30bca0d860.tar.gz
eclipse.platform.team-ae7c6d260707e92921ca4bc923ddef30bca0d860.tar.xz
eclipse.platform.team-ae7c6d260707e92921ca4bc923ddef30bca0d860.zip
First pass enables syntax highlighting for the most common features of a diff or a patch file. Change-Id: Ie434ec8fea515854bc0173d7e6b70c17066e4496 Signed-off-by: Sopot Cela <scela@redhat.com>
-rw-r--r--bundles/org.eclipse.team.genericeditor.diff.extension/.classpath7
-rw-r--r--bundles/org.eclipse.team.genericeditor.diff.extension/.project28
-rw-r--r--bundles/org.eclipse.team.genericeditor.diff.extension/.settings/org.eclipse.core.runtime.prefs2
-rw-r--r--bundles/org.eclipse.team.genericeditor.diff.extension/.settings/org.eclipse.jdt.core.prefs87
-rw-r--r--bundles/org.eclipse.team.genericeditor.diff.extension/.settings/org.eclipse.jdt.ui.prefs65
-rw-r--r--bundles/org.eclipse.team.genericeditor.diff.extension/.settings/org.eclipse.pde.prefs32
-rw-r--r--bundles/org.eclipse.team.genericeditor.diff.extension/META-INF/MANIFEST.MF17
-rw-r--r--bundles/org.eclipse.team.genericeditor.diff.extension/about.html28
-rw-r--r--bundles/org.eclipse.team.genericeditor.diff.extension/build.properties18
-rw-r--r--bundles/org.eclipse.team.genericeditor.diff.extension/plugin.properties13
-rw-r--r--bundles/org.eclipse.team.genericeditor.diff.extension/plugin.xml40
-rw-r--r--bundles/org.eclipse.team.genericeditor.diff.extension/pom.xml24
-rw-r--r--bundles/org.eclipse.team.genericeditor.diff.extension/src/org/eclipse/team/internal/genericeditor/diff/extension/partitioner/DiffPartitionScanner.java60
-rw-r--r--bundles/org.eclipse.team.genericeditor.diff.extension/src/org/eclipse/team/internal/genericeditor/diff/extension/partitioner/DiffPartitioner.java26
-rw-r--r--bundles/org.eclipse.team.genericeditor.diff.extension/src/org/eclipse/team/internal/genericeditor/diff/extension/partitioner/IDiffPartitioning.java19
-rw-r--r--bundles/org.eclipse.team.genericeditor.diff.extension/src/org/eclipse/team/internal/genericeditor/diff/extension/presentation/DiffPresentationReconciler.java64
-rw-r--r--bundles/org.eclipse.team.genericeditor.diff.extension/src/org/eclipse/team/internal/genericeditor/diff/extension/rules/StartOfLineRule.java30
-rw-r--r--pom.xml1
18 files changed, 561 insertions, 0 deletions
diff --git a/bundles/org.eclipse.team.genericeditor.diff.extension/.classpath b/bundles/org.eclipse.team.genericeditor.diff.extension/.classpath
new file mode 100644
index 000000000..eca7bdba8
--- /dev/null
+++ b/bundles/org.eclipse.team.genericeditor.diff.extension/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/bundles/org.eclipse.team.genericeditor.diff.extension/.project b/bundles/org.eclipse.team.genericeditor.diff.extension/.project
new file mode 100644
index 000000000..3122feeca
--- /dev/null
+++ b/bundles/org.eclipse.team.genericeditor.diff.extension/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.team.genericeditor.diff.extension</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/bundles/org.eclipse.team.genericeditor.diff.extension/.settings/org.eclipse.core.runtime.prefs b/bundles/org.eclipse.team.genericeditor.diff.extension/.settings/org.eclipse.core.runtime.prefs
new file mode 100644
index 000000000..c522e1f4a
--- /dev/null
+++ b/bundles/org.eclipse.team.genericeditor.diff.extension/.settings/org.eclipse.core.runtime.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+line.separator=\n
diff --git a/bundles/org.eclipse.team.genericeditor.diff.extension/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.team.genericeditor.diff.extension/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..faaf2196b
--- /dev/null
+++ b/bundles/org.eclipse.team.genericeditor.diff.extension/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,87 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.builder.cleanOutputFolder=clean
+org.eclipse.jdt.core.builder.duplicateResourceTask=warning
+org.eclipse.jdt.core.builder.invalidClasspath=abort
+org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore
+org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
+org.eclipse.jdt.core.circularClasspath=error
+org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
+org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.doc.comment.support=enabled
+org.eclipse.jdt.core.compiler.maxProblemPerUnit=100
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=error
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=protected
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
+org.eclipse.jdt.core.compiler.problem.missingDefaultCase=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disable
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=error
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLabel=error
+org.eclipse.jdt.core.compiler.problem.unusedLocal=error
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.8
+org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled
+org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL
+org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX
+org.eclipse.jdt.core.incompatibleJDKLevel=ignore
+org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/bundles/org.eclipse.team.genericeditor.diff.extension/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.team.genericeditor.diff.extension/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 000000000..80fc0ec9b
--- /dev/null
+++ b/bundles/org.eclipse.team.genericeditor.diff.extension/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,65 @@
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+internal.default.compliance=user
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=java;javax;org;com;
+org.eclipse.jdt.ui.ondemandthreshold=3
+org.eclipse.jdt.ui.staticondemandthreshold=99
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n *\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Javadoc)\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/*******************************************************************************\r\n * Copyright (c) ${year} IBM Corporation and others.\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n *\r\n * Contributors\:\r\n * IBM Corporation - initial API and implementation\r\n *******************************************************************************/\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
+sp_cleanup.add_default_serial_version_id=false
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=false
+sp_cleanup.add_missing_deprecated_annotations=false
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=false
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_functional_interfaces=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=false
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.insert_inferred_type_arguments=false
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=false
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=false
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=false
+sp_cleanup.remove_redundant_type_arguments=false
+sp_cleanup.remove_trailing_whitespaces=true
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=false
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=false
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=false
+sp_cleanup.remove_unused_private_types=false
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_anonymous_class_creation=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_lambda=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=false
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=false
diff --git a/bundles/org.eclipse.team.genericeditor.diff.extension/.settings/org.eclipse.pde.prefs b/bundles/org.eclipse.team.genericeditor.diff.extension/.settings/org.eclipse.pde.prefs
new file mode 100644
index 000000000..78a1e14db
--- /dev/null
+++ b/bundles/org.eclipse.team.genericeditor.diff.extension/.settings/org.eclipse.pde.prefs
@@ -0,0 +1,32 @@
+compilers.f.unresolved-features=1
+compilers.f.unresolved-plugins=1
+compilers.incompatible-environment=0
+compilers.p.build=1
+compilers.p.build.bin.includes=1
+compilers.p.build.encodings=2
+compilers.p.build.java.compiler=2
+compilers.p.build.java.compliance=1
+compilers.p.build.missing.output=2
+compilers.p.build.output.library=1
+compilers.p.build.source.library=1
+compilers.p.build.src.includes=1
+compilers.p.deprecated=1
+compilers.p.discouraged-class=1
+compilers.p.internal=1
+compilers.p.missing-packages=0
+compilers.p.missing-version-export-package=2
+compilers.p.missing-version-import-package=2
+compilers.p.missing-version-require-bundle=2
+compilers.p.no-required-att=0
+compilers.p.not-externalized-att=1
+compilers.p.unknown-attribute=0
+compilers.p.unknown-class=0
+compilers.p.unknown-element=0
+compilers.p.unknown-identifier=1
+compilers.p.unknown-resource=0
+compilers.p.unresolved-ex-points=0
+compilers.p.unresolved-import=0
+compilers.s.create-docs=false
+compilers.s.doc-folder=doc
+compilers.s.open-tags=1
+eclipse.preferences.version=1
diff --git a/bundles/org.eclipse.team.genericeditor.diff.extension/META-INF/MANIFEST.MF b/bundles/org.eclipse.team.genericeditor.diff.extension/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..05adcecb2
--- /dev/null
+++ b/bundles/org.eclipse.team.genericeditor.diff.extension/META-INF/MANIFEST.MF
@@ -0,0 +1,17 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.team.genericeditor.diff.extension;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Require-Bundle: org.eclipse.ui.workbench.texteditor;bundle-version="[3.10.100,4.0.0)",
+ org.eclipse.core.resources;bundle-version="[3.12.0,4.0.0)",
+ org.eclipse.core.filebuffers,
+ org.eclipse.jface.text;bundle-version="[3.11.100,4.0.0)",
+ org.eclipse.ui;bundle-version="[3.109.0,4.0.0)",
+ org.eclipse.core.contenttype
+Export-Package: org.eclipse.team.internal.genericeditor.diff.extension.partitioner;x-internal:=true,
+ org.eclipse.team.internal.genericeditor.diff.extension.presentation;x-internal:=true,
+ org.eclipse.team.internal.genericeditor.diff.extension.rules;x-internal:=true
diff --git a/bundles/org.eclipse.team.genericeditor.diff.extension/about.html b/bundles/org.eclipse.team.genericeditor.diff.extension/about.html
new file mode 100644
index 000000000..8e788d946
--- /dev/null
+++ b/bundles/org.eclipse.team.genericeditor.diff.extension/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 2, 2006</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/bundles/org.eclipse.team.genericeditor.diff.extension/build.properties b/bundles/org.eclipse.team.genericeditor.diff.extension/build.properties
new file mode 100644
index 000000000..ee4ea9188
--- /dev/null
+++ b/bundles/org.eclipse.team.genericeditor.diff.extension/build.properties
@@ -0,0 +1,18 @@
+###############################################################################
+# Copyright (c) 2017 Red Hat Inc. and others
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Sopot Cela (Red Hat Inc.) - initial implementation
+###############################################################################
+source.. = src/
+src.includes=about.html
+output.. = bin/
+bin.includes = plugin.xml,\
+ META-INF/,\
+ .,\
+ plugin.properties,\
+ about.html \ No newline at end of file
diff --git a/bundles/org.eclipse.team.genericeditor.diff.extension/plugin.properties b/bundles/org.eclipse.team.genericeditor.diff.extension/plugin.properties
new file mode 100644
index 000000000..d322959c0
--- /dev/null
+++ b/bundles/org.eclipse.team.genericeditor.diff.extension/plugin.properties
@@ -0,0 +1,13 @@
+###############################################################################
+# Copyright (c) 2017 Red Hat Inc. and others
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Sopot Cela (Red Hat Inc.) - initial implementation
+###############################################################################
+pluginName=Diff Extension for Generic Editor
+providerName=Eclipse.org
+patch_ContentTypeName= Patch or Diff File \ No newline at end of file
diff --git a/bundles/org.eclipse.team.genericeditor.diff.extension/plugin.xml b/bundles/org.eclipse.team.genericeditor.diff.extension/plugin.xml
new file mode 100644
index 000000000..808defec0
--- /dev/null
+++ b/bundles/org.eclipse.team.genericeditor.diff.extension/plugin.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<!--
+ Copyright (c) 2017 Red Hat Inc. and others.
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Distribution License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/org/documents/edl-v10.php
+
+ Contributors:
+ Sopot Cela (Red Hat Inc.) - initial implementation
+-->
+<plugin>
+ <extension
+ point="org.eclipse.ui.genericeditor.presentationReconcilers">
+ <presentationReconciler
+ class="org.eclipse.team.internal.genericeditor.diff.extension.presentation.DiffPresentationReconciler"
+ contentType="org.eclipse.team.genericeditor.diff.extension.patch">
+ </presentationReconciler>
+ </extension>
+ <extension
+ point="org.eclipse.core.filebuffers.documentSetup">
+ <participant
+ class="org.eclipse.team.internal.genericeditor.diff.extension.partitioner.DiffPartitioner"
+ contentTypeId="org.eclipse.team.genericeditor.diff.extension.patch"
+ extensions="patch,diff">
+ </participant>
+ </extension>
+ <extension
+ point="org.eclipse.core.contenttype.contentTypes">
+ <content-type
+ base-type="org.eclipse.core.runtime.text"
+ file-extensions="diff,patch"
+ id="org.eclipse.team.genericeditor.diff.extension.patch"
+ name="%patch_ContentTypeName"
+ priority="normal">
+ </content-type>
+ </extension>
+
+</plugin>
diff --git a/bundles/org.eclipse.team.genericeditor.diff.extension/pom.xml b/bundles/org.eclipse.team.genericeditor.diff.extension/pom.xml
new file mode 100644
index 000000000..3b192e918
--- /dev/null
+++ b/bundles/org.eclipse.team.genericeditor.diff.extension/pom.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2017 Red Hat Inc. and others.
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Distribution License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/org/documents/edl-v10.php
+
+ Contributors:
+ Sopot Cela (Red Hat Inc.) - initial implementation
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>eclipse.platform.team</artifactId>
+ <groupId>eclipse.platform.team</groupId>
+ <version>4.7.0-SNAPSHOT</version>
+ <relativePath>../../</relativePath>
+ </parent>
+ <groupId>org.eclipse.team</groupId>
+ <artifactId>org.eclipse.team.genericeditor.diff.extension</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+</project>
diff --git a/bundles/org.eclipse.team.genericeditor.diff.extension/src/org/eclipse/team/internal/genericeditor/diff/extension/partitioner/DiffPartitionScanner.java b/bundles/org.eclipse.team.genericeditor.diff.extension/src/org/eclipse/team/internal/genericeditor/diff/extension/partitioner/DiffPartitionScanner.java
new file mode 100644
index 000000000..b4171bc27
--- /dev/null
+++ b/bundles/org.eclipse.team.genericeditor.diff.extension/src/org/eclipse/team/internal/genericeditor/diff/extension/partitioner/DiffPartitionScanner.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat Inc. and others
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Sopot Cela (Red Hat Inc.)
+ *******************************************************************************/
+package org.eclipse.team.internal.genericeditor.diff.extension.partitioner;
+
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.rules.*;
+
+public class DiffPartitionScanner implements IDiffPartitioning, IPartitionTokenScanner {
+
+ private int headerEnd;
+ private int currentOffset;
+ private int end;
+ private int tokenStart;
+
+ @Override
+ public void setRange(IDocument document, int offset, int length) {
+ headerEnd = document.get().indexOf("diff --git");//$NON-NLS-1$
+ currentOffset = offset;
+ end = offset + length;
+ tokenStart = -1;
+ }
+
+ @Override
+ public IToken nextToken() {
+ tokenStart = currentOffset;
+ if (currentOffset < end) {
+ if (currentOffset < headerEnd) {
+ currentOffset = Math.min(headerEnd, end);
+ return new Token(PARTITION_HEADER);
+ } else {
+ currentOffset = end;
+ return new Token(PARTITION_BODY);
+ }
+ }
+ return Token.EOF;
+ }
+
+ @Override
+ public int getTokenOffset() {
+ return tokenStart;
+ }
+
+ @Override
+ public int getTokenLength() {
+ return currentOffset - tokenStart;
+ }
+
+ @Override
+ public void setPartialRange(IDocument document, int offset, int length, String contentType, int partitionOffset) {
+ setRange(document, offset, length);
+ }
+}
diff --git a/bundles/org.eclipse.team.genericeditor.diff.extension/src/org/eclipse/team/internal/genericeditor/diff/extension/partitioner/DiffPartitioner.java b/bundles/org.eclipse.team.genericeditor.diff.extension/src/org/eclipse/team/internal/genericeditor/diff/extension/partitioner/DiffPartitioner.java
new file mode 100644
index 000000000..1caf63515
--- /dev/null
+++ b/bundles/org.eclipse.team.genericeditor.diff.extension/src/org/eclipse/team/internal/genericeditor/diff/extension/partitioner/DiffPartitioner.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat Inc. and others
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Sopot Cela (Red Hat Inc.)
+ *******************************************************************************/
+package org.eclipse.team.internal.genericeditor.diff.extension.partitioner;
+
+import org.eclipse.core.filebuffers.IDocumentSetupParticipant;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.rules.FastPartitioner;
+import org.eclipse.jface.text.rules.IPartitionTokenScanner;
+
+public class DiffPartitioner implements IDocumentSetupParticipant{
+ @Override
+ public void setup(IDocument document) {
+ IPartitionTokenScanner scanner = new DiffPartitionScanner();
+ FastPartitioner partitioner = new FastPartitioner(scanner, IDiffPartitioning.LEGAL_PARTITION_TYPES);
+ document.setDocumentPartitioner(partitioner);
+ partitioner.connect(document);
+ }
+}
diff --git a/bundles/org.eclipse.team.genericeditor.diff.extension/src/org/eclipse/team/internal/genericeditor/diff/extension/partitioner/IDiffPartitioning.java b/bundles/org.eclipse.team.genericeditor.diff.extension/src/org/eclipse/team/internal/genericeditor/diff/extension/partitioner/IDiffPartitioning.java
new file mode 100644
index 000000000..a85e77b36
--- /dev/null
+++ b/bundles/org.eclipse.team.genericeditor.diff.extension/src/org/eclipse/team/internal/genericeditor/diff/extension/partitioner/IDiffPartitioning.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat Inc. and others
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Sopot Cela (Red Hat Inc.)
+ *******************************************************************************/
+package org.eclipse.team.internal.genericeditor.diff.extension.partitioner;
+
+import org.eclipse.jface.text.IDocument;
+
+public interface IDiffPartitioning {
+ public static final String PARTITION_BODY = "__PARTITION_BODY"; //$NON-NLS-1$
+ public static final String PARTITION_HEADER = "__PARTITION_HEADER"; //$NON-NLS-1$
+ public static final String[] LEGAL_PARTITION_TYPES = new String[] {PARTITION_HEADER,PARTITION_BODY, IDocument.DEFAULT_CONTENT_TYPE };
+}
diff --git a/bundles/org.eclipse.team.genericeditor.diff.extension/src/org/eclipse/team/internal/genericeditor/diff/extension/presentation/DiffPresentationReconciler.java b/bundles/org.eclipse.team.genericeditor.diff.extension/src/org/eclipse/team/internal/genericeditor/diff/extension/presentation/DiffPresentationReconciler.java
new file mode 100644
index 000000000..9c27d1c18
--- /dev/null
+++ b/bundles/org.eclipse.team.genericeditor.diff.extension/src/org/eclipse/team/internal/genericeditor/diff/extension/presentation/DiffPresentationReconciler.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat Inc. and others
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Sopot Cela (Red Hat Inc.)
+ *******************************************************************************/
+package org.eclipse.team.internal.genericeditor.diff.extension.presentation;
+
+import org.eclipse.jface.text.TextAttribute;
+import org.eclipse.jface.text.presentation.PresentationReconciler;
+import org.eclipse.jface.text.rules.*;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.team.internal.genericeditor.diff.extension.partitioner.IDiffPartitioning;
+import org.eclipse.team.internal.genericeditor.diff.extension.rules.StartOfLineRule;
+
+/**
+ * Presentation reconciler collecting different rules for syntax coloring.
+ */
+public class DiffPresentationReconciler extends PresentationReconciler {
+
+ private final TextAttribute bodyAttributeMinus = new TextAttribute(
+ Display.getCurrent().getSystemColor(SWT.COLOR_RED));
+ private final TextAttribute bodyAttributePlus = new TextAttribute(
+ Display.getCurrent().getSystemColor(SWT.COLOR_DARK_GREEN));
+ private final TextAttribute hunkAttribute = new TextAttribute(
+ Display.getCurrent().getSystemColor(SWT.COLOR_DARK_BLUE));
+ private final TextAttribute headerAttribute = new TextAttribute(
+ Display.getCurrent().getSystemColor(SWT.COLOR_DARK_MAGENTA));
+ private final TextAttribute indexDiffAttribute = new TextAttribute(
+ Display.getCurrent().getSystemColor(SWT.COLOR_DARK_CYAN));
+
+ public DiffPresentationReconciler() {
+
+ RuleBasedScanner hscanner = new RuleBasedScanner();
+ IRule[] headerRules=new IRule[3];
+ headerRules[0]=new StartOfLineRule("commit", null, new Token(headerAttribute));//$NON-NLS-1$
+ headerRules[1]=new StartOfLineRule("Author:", null, new Token(headerAttribute));//$NON-NLS-1$
+ headerRules[2]=new StartOfLineRule("Date:", null, new Token(headerAttribute));//$NON-NLS-1$
+ hscanner.setRules(headerRules);
+ DefaultDamagerRepairer hdr = new DefaultDamagerRepairer(hscanner);
+ this.setDamager(hdr, IDiffPartitioning.PARTITION_HEADER);
+ this.setRepairer(hdr, IDiffPartitioning.PARTITION_HEADER);
+
+ IRule[] bodyRules=new IRule[7];
+ bodyRules[0] = new StartOfLineRule("+", null, new Token(bodyAttributePlus));//$NON-NLS-1$
+ bodyRules[1] = new StartOfLineRule("-", null, new Token(bodyAttributeMinus));//$NON-NLS-1$
+ bodyRules[2] = new StartOfLineRule("@@", null, new Token(hunkAttribute));//$NON-NLS-1$
+ bodyRules[3]=new StartOfLineRule("diff --git", null, new Token(indexDiffAttribute));//$NON-NLS-1$
+ bodyRules[4]=new StartOfLineRule("index", null, new Token(indexDiffAttribute));//$NON-NLS-1$
+ bodyRules[5]=new StartOfLineRule("---", null, new Token(bodyAttributeMinus));//$NON-NLS-1$
+ bodyRules[6]=new StartOfLineRule("+++", null, new Token(bodyAttributePlus));//$NON-NLS-1$
+ RuleBasedScanner scanner = new RuleBasedScanner();
+ scanner.setRules(bodyRules);
+ DefaultDamagerRepairer dr = new DefaultDamagerRepairer(scanner);
+ this.setDamager(dr, IDiffPartitioning.PARTITION_BODY);
+ this.setRepairer(dr, IDiffPartitioning.PARTITION_BODY);
+
+ }
+}
diff --git a/bundles/org.eclipse.team.genericeditor.diff.extension/src/org/eclipse/team/internal/genericeditor/diff/extension/rules/StartOfLineRule.java b/bundles/org.eclipse.team.genericeditor.diff.extension/src/org/eclipse/team/internal/genericeditor/diff/extension/rules/StartOfLineRule.java
new file mode 100644
index 000000000..c7f993f8f
--- /dev/null
+++ b/bundles/org.eclipse.team.genericeditor.diff.extension/src/org/eclipse/team/internal/genericeditor/diff/extension/rules/StartOfLineRule.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat Inc. and others
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Sopot Cela (Red Hat Inc.)
+ *******************************************************************************/
+package org.eclipse.team.internal.genericeditor.diff.extension.rules;
+
+import org.eclipse.jface.text.rules.*;
+
+public class StartOfLineRule extends SingleLineRule {
+
+ public StartOfLineRule(String startSequence, String endSequence, IToken token) {
+ super(startSequence, endSequence, token);
+ }
+
+ @Override
+ public IToken evaluate(ICharacterScanner scanner) {
+ scanner.unread();
+ int c = scanner.read();
+ if ((c == '\n') || (c == -1)) {
+ return super.evaluate(scanner);
+ }
+ return Token.UNDEFINED;
+ }
+}
diff --git a/pom.xml b/pom.xml
index 9c197374c..c0f93e34b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -66,6 +66,7 @@
<module>bundles/org.eclipse.team.cvs.ssh2</module>
<module>bundles/org.eclipse.team.cvs.ui</module>
<module>bundles/org.eclipse.team.ui</module>
+ <module>bundles/org.eclipse.team.genericeditor.diff.extension</module>
<module>bundles/org.eclipse.ui.net</module>
<module>examples/org.eclipse.compare.examples</module>
<module>examples/org.eclipse.compare.examples.xml</module>

Back to the top