Skip to content
Commits on Source (3)
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<component id="org.eclipse.core.contenttype" version="2">
<resource path="src/org/eclipse/core/runtime/content/IContentTypeManager.java" type="org.eclipse.core.runtime.content.IContentTypeManager">
<filter comment="https://bugs.eclipse.org/bugs/show_bug.cgi?id=57908#c37" id="403853384">
<resource path="src/org/eclipse/core/runtime/content/IContentType.java" type="org.eclipse.core.runtime.content.IContentType">
<filter comment="The Javadoc comment was replaced by proper API Tools tag" id="403853384">
<message_arguments>
<message_argument value="org.eclipse.core.runtime.content.IContentTypeManager"/>
<message_argument value="org.eclipse.core.runtime.content.IContentType"/>
</message_arguments>
</filter>
</resource>
<resource path="src/org/eclipse/core/runtime/content/IContentTypeSettings.java" type="org.eclipse.core.runtime.content.IContentTypeSettings">
<resource path="src/org/eclipse/core/runtime/content/IContentTypeManager.java" type="org.eclipse.core.runtime.content.IContentTypeManager">
<filter comment="https://bugs.eclipse.org/bugs/show_bug.cgi?id=57908#c37" id="403853384">
<message_arguments>
<message_argument value="org.eclipse.core.runtime.content.IContentTypeSettings"/>
<message_argument value="org.eclipse.core.runtime.content.IContentTypeManager"/>
</message_arguments>
</filter>
</resource>
......
......@@ -127,6 +127,7 @@ org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
......@@ -138,10 +139,13 @@ org.eclipse.jdt.core.formatter.alignment_for_assignment=0
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_module_statements=16
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references=0
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
......@@ -151,6 +155,8 @@ org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_type_arguments=0
org.eclipse.jdt.core.formatter.alignment_for_type_parameters=0
org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
org.eclipse.jdt.core.formatter.blank_lines_after_package=1
......@@ -175,18 +181,21 @@ org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped=true
org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions=false
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position=true
org.eclipse.jdt.core.formatter.comment.format_block_comments=true
org.eclipse.jdt.core.formatter.comment.format_header=false
org.eclipse.jdt.core.formatter.comment.format_html=true
org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
org.eclipse.jdt.core.formatter.comment.format_line_comments=true
org.eclipse.jdt.core.formatter.comment.format_source_code=true
org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
org.eclipse.jdt.core.formatter.comment.indent_root_tags=false
org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
org.eclipse.jdt.core.formatter.comment.line_length=80
org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
......@@ -197,7 +206,7 @@ org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
......@@ -209,6 +218,7 @@ org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
org.eclipse.jdt.core.formatter.indentation.size=4
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
......@@ -236,7 +246,7 @@ org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
......@@ -403,12 +413,24 @@ org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause=common_lines
org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
org.eclipse.jdt.core.formatter.tabulation.char=tab
org.eclipse.jdt.core.formatter.tabulation.size=4
org.eclipse.jdt.core.formatter.use_on_off_tags=false
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true
org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
org.eclipse.jdt.core.incompatibleJDKLevel=ignore
......
......@@ -60,7 +60,7 @@ cleanup_settings_version=2
eclipse.preferences.version=1
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
formatter_profile=org.eclipse.jdt.ui.default.eclipse_profile
formatter_settings_version=12
formatter_settings_version=14
org.eclipse.jdt.ui.ignorelowercasenames=true
org.eclipse.jdt.ui.importorder=;
org.eclipse.jdt.ui.javadoc=false
......@@ -100,6 +100,7 @@ sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=
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_modifiers=true
sp_cleanup.remove_redundant_type_arguments=false
sp_cleanup.remove_trailing_whitespaces=true
sp_cleanup.remove_trailing_whitespaces_all=true
......
......@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.core.contenttype; singleton:=true
Bundle-Version: 3.6.0.qualifier
Bundle-Version: 3.7.0.qualifier
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Require-Bundle: org.eclipse.equinox.preferences;bundle-version="[3.2.0,4.0.0)",
......@@ -21,3 +21,4 @@ Import-Package: javax.xml.parsers,
org.xml.sax.ext,
org.xml.sax.helpers
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Automatic-Module-Name: org.eclipse.core.contenttype
......@@ -14,11 +14,11 @@
<parent>
<artifactId>eclipse.platform.runtime</artifactId>
<groupId>eclipse.platform.runtime</groupId>
<version>4.7.3-SNAPSHOT</version>
<version>4.8.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.core</groupId>
<artifactId>org.eclipse.core.contenttype</artifactId>
<version>3.6.0-SNAPSHOT</version>
<version>3.7.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
......@@ -2,9 +2,9 @@
<!-- Schema file written by PDE -->
<schema targetNamespace="org.eclipse.core.contenttype" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appinfo>
<appInfo>
<meta.schema plugin="org.eclipse.core.contenttype" id="contentTypes" name="Content Types"/>
</appinfo>
</appInfo>
<documentation>
The content types extension point allows plug-ins to contribute to the platform content type catalog. There are two forms of contributions: &lt;cite&gt;content types&lt;/cite&gt; and &lt;cite&gt;file associations&lt;/cite&gt;.
&lt;ul&gt;
......@@ -24,9 +24,9 @@ a file association extends an existing content type by associating new file name
<element name="extension">
<annotation>
<appinfo>
<appInfo>
<meta.element />
</appinfo>
</appInfo>
</annotation>
<complexType>
<sequence>
......@@ -52,9 +52,9 @@ a file association extends an existing content type by associating new file name
<documentation>
an optional name of the extension instance
</documentation>
<appinfo>
<appInfo>
<meta.attribute translatable="true"/>
</appinfo>
</appInfo>
</annotation>
</attribute>
</complexType>
......@@ -85,9 +85,9 @@ a file association extends an existing content type by associating new file name
<documentation>
the human-readable name of this content type
</documentation>
<appinfo>
<appInfo>
<meta.attribute translatable="true"/>
</appinfo>
</appInfo>
</annotation>
</attribute>
<attribute name="file-extensions" type="string">
......@@ -104,6 +104,13 @@ a file association extends an existing content type by associating new file name
</documentation>
</annotation>
</attribute>
<attribute name="file-patterns" type="string">
<annotation>
<documentation>
a comma-separated list of file name patterns to be associated with this content type. Since 3.7
</documentation>
</annotation>
</attribute>
<attribute name="priority" use="default" value="normal">
<annotation>
<documentation>
......@@ -138,9 +145,9 @@ a file association extends an existing content type by associating new file name
<documentation>
the fully qualified name of a class that implements &lt;samp&gt;org.eclipse.core.runtime.content.IContentDescriber&lt;/samp&gt; or &lt;samp&gt;org.eclipse.core.runtime.content.ITextContentDescriber&lt;/samp&gt;, or an empty string, if this content type should not have a describer even if the parent has one
</documentation>
<appinfo>
<appInfo>
<meta.attribute kind="java"/>
</appinfo>
</appInfo>
</annotation>
</attribute>
<attribute name="alias-for" type="string">
......@@ -168,9 +175,9 @@ a file association extends an existing content type by associating new file name
<documentation>
the fully qualified name of a class that implements &lt;samp&gt;org.eclipse.core.runtime.content.IContentDescriber&lt;/samp&gt; or &lt;samp&gt;org.eclipse.core.runtime.content.ITextContentDescriber&lt;/samp&gt;, or an empty string, if this content type should not have a describer even if the parent has one
</documentation>
<appinfo>
<appInfo>
<meta.attribute kind="java" basedOn="org.eclipse.core.runtime.content.IContentDescriber"/>
</appinfo>
</appInfo>
</annotation>
</attribute>
<attribute name="plugin" type="string">
......@@ -190,6 +197,9 @@ a file association extends an existing content type by associating new file name
<documentation>
the fully qualified identifier for the content type this file association contributes to
</documentation>
<appInfo>
<meta.attribute kind="identifier" basedOn="org.eclipse.core.contenttype.contentTypes/content-type/@id"/>
</appInfo>
</annotation>
</attribute>
<attribute name="file-names" type="string">
......@@ -206,6 +216,13 @@ a file association extends an existing content type by associating new file name
</documentation>
</annotation>
</attribute>
<attribute name="file-patterns" type="string">
<annotation>
<documentation>
a comma-separated list of file name patterns to be associated with this content type. Since 3.7
</documentation>
</annotation>
</attribute>
</complexType>
</element>
......@@ -253,18 +270,18 @@ a file association extends an existing content type by associating new file name
</element>
<annotation>
<appinfo>
<appInfo>
<meta.section type="since"/>
</appinfo>
</appInfo>
<documentation>
3.2
</documentation>
</annotation>
<annotation>
<appinfo>
<appInfo>
<meta.section type="examples"/>
</appinfo>
</appInfo>
<documentation>
Following is an example of a XML-based content type declaration using &lt;code&gt;org.eclipse.core.runtime.content.XMLRootElementContentDescriber2&lt;/code&gt;,
a built-in describer:
......@@ -315,9 +332,9 @@ Here is an example of a content type that defines properties:
</annotation>
<annotation>
<appinfo>
<appInfo>
<meta.section type="apiInfo"/>
</appinfo>
</appInfo>
<documentation>
The value of the class attribute in the describer element must represent an
implementor of
......@@ -328,9 +345,9 @@ implementor of
</annotation>
<annotation>
<appinfo>
<appInfo>
<meta.section type="implementation"/>
</appinfo>
</appInfo>
<documentation>
&lt;p&gt;The org.eclipse.core.contenttype plug-in provides the following content types:&lt;ul&gt;
&lt;li&gt;org.eclipse.core.runtime.text&lt;/li&gt;
......@@ -348,9 +365,9 @@ Also, the org.eclipse.core.contenttype plug-in provides ready-to-use implementat
</annotation>
<annotation>
<appinfo>
<appInfo>
<meta.section type="copyright"/>
</appinfo>
</appInfo>
<documentation>
Copyright (c) 2004, 2008 IBM Corporation and others.&lt;br&gt;
All rights reserved. This program and the accompanying materials are made
......
......@@ -160,7 +160,7 @@ public final class ContentDescription extends BasicDescription {
@Override
public String toString() {
StringBuffer result = new StringBuffer("{"); //$NON-NLS-1$
StringBuilder result = new StringBuilder("{"); //$NON-NLS-1$
if (keys != null)
if (keys instanceof QualifiedName) {
if (values != null)
......
......@@ -47,7 +47,7 @@ public class ContentMessages extends NLS {
* Pre-pend the message with the current date and the name of the current thread.
*/
public static void message(String message) {
StringBuffer buffer = new StringBuffer();
StringBuilder buffer = new StringBuilder();
buffer.append(new Date(System.currentTimeMillis()));
buffer.append(" - ["); //$NON-NLS-1$
buffer.append(Thread.currentThread().getName());
......
......@@ -51,6 +51,8 @@ public final class ContentType implements IContentType, IContentTypeInfo {
public final static String PREF_DEFAULT_CHARSET = "charset"; //$NON-NLS-1$
public final static String PREF_FILE_EXTENSIONS = "file-extensions"; //$NON-NLS-1$
public final static String PREF_FILE_NAMES = "file-names"; //$NON-NLS-1$
/** @since 3.7 */
public final static String PREF_FILE_PATTERNS = "file-patterns"; //$NON-NLS-1$
/** @since 3.6 */
public static final String PREF_USER_DEFINED = "userDefined"; //$NON-NLS-1$
/** @since 3.6 */
......@@ -89,20 +91,26 @@ public final class ContentType implements IContentType, IContentTypeInfo {
// -1 means unknown
private byte depth = -1;
public static ContentType createContentType(ContentTypeCatalog catalog, String uniqueId, String name, byte priority, String[] fileExtensions, String[] fileNames, String baseTypeId, String aliasTargetId, Map<QualifiedName, String> defaultProperties, IConfigurationElement contentTypeElement) {
public static ContentType createContentType(ContentTypeCatalog catalog, String uniqueId, String name, byte priority,
String[] fileExtensions, String[] fileNames, String[] filePatterns, String baseTypeId, String aliasTargetId,
Map<QualifiedName, String> defaultProperties, IConfigurationElement contentTypeElement) {
ContentType contentType = new ContentType(catalog.getManager());
contentType.catalog = catalog;
contentType.defaultDescription = new DefaultDescription(contentType);
contentType.id = uniqueId;
contentType.name = name;
contentType.priority = priority;
if ((fileExtensions != null && fileExtensions.length > 0) || (fileNames != null && fileNames.length > 0)) {
if ((fileExtensions != null && fileExtensions.length > 0) || (fileNames != null && fileNames.length > 0)
|| (filePatterns != null && filePatterns.length > 0)) {
contentType.builtInAssociations = true;
contentType.fileSpecs = new ArrayList<>(fileExtensions.length + fileNames.length);
contentType.fileSpecs = new ArrayList<>(fileExtensions.length + fileNames.length + filePatterns.length);
for (String fileName : fileNames)
contentType.internalAddFileSpec(fileName, FILE_NAME_SPEC | SPEC_PRE_DEFINED);
for (String fileExtension : fileExtensions)
contentType.internalAddFileSpec(fileExtension, FILE_EXTENSION_SPEC | SPEC_PRE_DEFINED);
for (String fileExtension : filePatterns) {
contentType.internalAddFileSpec(fileExtension, FILE_PATTERN_SPEC | SPEC_PRE_DEFINED);
}
}
contentType.defaultProperties = defaultProperties;
contentType.contentTypeElement = contentTypeElement;
......@@ -120,6 +128,8 @@ public final class ContentType implements IContentType, IContentTypeInfo {
return PREF_FILE_EXTENSIONS;
if ((flags & FILE_NAME_SPEC) != 0)
return PREF_FILE_NAMES;
if ((flags & FILE_PATTERN_SPEC) != 0)
return PREF_FILE_PATTERNS;
throw new IllegalArgumentException("Unknown type: " + flags); //$NON-NLS-1$
}
......@@ -139,7 +149,8 @@ public final class ContentType implements IContentType, IContentTypeInfo {
@Override
public void addFileSpec(String fileSpec, int type) throws CoreException {
Assert.isLegal(type == FILE_EXTENSION_SPEC || type == FILE_NAME_SPEC, "Unknown type: " + type); //$NON-NLS-1$
Assert.isLegal(type == FILE_EXTENSION_SPEC || type == FILE_NAME_SPEC || type == FILE_PATTERN_SPEC,
"Unknown type: " + type); //$NON-NLS-1$
String[] userSet;
synchronized (this) {
if (!internalAddFileSpec(fileSpec, type | SPEC_USER_DEFINED))
......@@ -377,8 +388,10 @@ public final class ContentType implements IContentType, IContentTypeInfo {
/**
* Returns whether this content type has the given file spec.
*
* @param text the file spec string
* @param typeMask FILE_NAME_SPEC or FILE_EXTENSION_SPEC
* @param text
* the file spec string
* @param typeMask
* FILE_NAME_SPEC or FILE_EXTENSION_SPEC or FILE_REGEXP_SPEC
* @param strict
* @return true if this file spec has already been added, false otherwise
*/
......@@ -542,11 +555,18 @@ public final class ContentType implements IContentType, IContentTypeInfo {
String[] fileExtensions = Util.parseItems(userSetFileExtensions);
for (String fileExtension : fileExtensions)
internalAddFileSpec(fileExtension, FILE_EXTENSION_SPEC | SPEC_USER_DEFINED);
// user set file name regexp
String userSetFileRegexp = contentTypeNode.get(PREF_FILE_PATTERNS, null);
String[] fileRegexps = Util.parseItems(userSetFileRegexp);
for (String fileRegexp : fileRegexps) {
internalAddFileSpec(fileRegexp, FILE_PATTERN_SPEC | SPEC_USER_DEFINED);
}
}
@Override
public void removeFileSpec(String fileSpec, int type) throws CoreException {
Assert.isLegal(type == FILE_EXTENSION_SPEC || type == FILE_NAME_SPEC, "Unknown type: " + type); //$NON-NLS-1$
Assert.isLegal(type == FILE_EXTENSION_SPEC || type == FILE_NAME_SPEC || type == FILE_PATTERN_SPEC,
"Unknown type: " + type); //$NON-NLS-1$
synchronized (this) {
if (!internalRemoveFileSpec(fileSpec, type | SPEC_USER_DEFINED))
return;
......
/*******************************************************************************
* Copyright (c) 2004, 2009 IBM Corporation and others.
* Copyright (c) 2004, 2017 IBM Corporation 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
......@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
* Mickael Istria (Red Hat Inc.) - [263316] regexp for file association
*******************************************************************************/
package org.eclipse.core.internal.content;
......@@ -77,6 +78,9 @@ public class ContentTypeBuilder {
String[] fileExtensions = Util.parseItems(fileAssociationElement.getAttribute("file-extensions")); //$NON-NLS-1$
for (String fileExtension : fileExtensions)
target.internalAddFileSpec(fileExtension, IContentType.FILE_EXTENSION_SPEC | ContentType.SPEC_PRE_DEFINED);
String[] filePatterns = Util.parseItems(fileAssociationElement.getAttribute("file-patterns")); //$NON-NLS-1$
for (String filePattern : filePatterns)
target.internalAddFileSpec(filePattern, IContentType.FILE_PATTERN_SPEC | ContentType.SPEC_PRE_DEFINED);
}
/**
......@@ -91,7 +95,8 @@ public class ContentTypeBuilder {
IEclipsePreferences node = context.getNode(id);
catalog.addContentType(ContentType.createContentType(catalog, id,
node.get(ContentType.PREF_USER_DEFINED__NAME, ContentType.EMPTY_STRING),
(byte) 0, new String[0], new String[0], node.get(ContentType.PREF_USER_DEFINED__BASE_TYPE_ID, null), null, Collections.emptyMap(),
(byte) 0, new String[0], new String[0], new String[0],
node.get(ContentType.PREF_USER_DEFINED__BASE_TYPE_ID, null), null, Collections.emptyMap(),
null));
}
for (IConfigurationElement allContentTypeCE : allContentTypeCEs)
......@@ -145,6 +150,7 @@ public class ContentTypeBuilder {
byte priority = parsePriority(contentTypeCE.getAttribute("priority")); //$NON-NLS-1$ );
String[] fileNames = Util.parseItems(contentTypeCE.getAttribute("file-names")); //$NON-NLS-1$
String[] fileExtensions = Util.parseItems(contentTypeCE.getAttribute("file-extensions")); //$NON-NLS-1$
String[] filePatterns = Util.parseItems(contentTypeCE.getAttribute("file-patterns")); //$NON-NLS-1$
String baseTypeId = getUniqueId(namespace, contentTypeCE.getAttribute("base-type")); //$NON-NLS-1$
String aliasTargetTypeId = getUniqueId(namespace, contentTypeCE.getAttribute("alias-for")); //$NON-NLS-1$
IConfigurationElement[] propertyCEs = null;
......@@ -174,8 +180,8 @@ public class ContentTypeBuilder {
defaultProperties = Collections.singletonMap(IContentDescription.CHARSET, defaultCharset);
else if (!defaultProperties.containsKey(IContentDescription.CHARSET))
defaultProperties.put(IContentDescription.CHARSET, defaultCharset);
return ContentType.createContentType(catalog, uniqueId, name, priority, fileExtensions, fileNames, baseTypeId,
aliasTargetTypeId, defaultProperties, contentTypeCE);
return ContentType.createContentType(catalog, uniqueId, name, priority, fileExtensions, fileNames, filePatterns,
baseTypeId, aliasTargetTypeId, defaultProperties, contentTypeCE);
}
// Store this around for performance
......
/*******************************************************************************
* Copyright (c) 2004, 2016 IBM Corporation and others.
* Copyright (c) 2004, 2017 IBM Corporation 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
......@@ -7,11 +7,14 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
* Mickael Istria (Red Hat Inc.) - [263316] regexp for file association
*******************************************************************************/
package org.eclipse.core.internal.content;
import java.io.*;
import java.util.*;
import java.util.Map.Entry;
import java.util.regex.Pattern;
import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.content.*;
import org.eclipse.core.runtime.content.IContentTypeManager.ISelectionPolicy;
......@@ -28,6 +31,9 @@ public final class ContentTypeCatalog {
private final Map<String, IContentType> contentTypes = new HashMap<>();
private final Map<String, Set<ContentType>> fileExtensions = new HashMap<>();
private final Map<String, Set<ContentType>> fileNames = new HashMap<>();
private final Map<String, Pattern> compiledRegexps = new HashMap<>();
private final Map<Pattern, String> initialPatternForRegexp = new HashMap<>();
private final Map<Pattern, Set<ContentType>> fileRegexps = new HashMap<>();
private int generation;
private ContentTypeManager manager;
......@@ -127,13 +133,23 @@ public final class ContentTypeCatalog {
};
private static IContentType[] concat(IContentType[][] types) {
if (types[0].length == 0)
return types[1];
if (types[1].length == 0)
return types[0];
IContentType[] result = new IContentType[types[0].length + types[1].length];
System.arraycopy(types[0], 0, result, 0, types[0].length);
System.arraycopy(types[1], 0, result, types[0].length, types[1].length);
int size = 0;
IContentType[] nonEmptyOne = NO_CONTENT_TYPES;
for (IContentType[] array : types) {
size += array.length;
if (array.length > 0) {
nonEmptyOne = array;
}
}
if (nonEmptyOne.length == size) { // no other array has content
return nonEmptyOne;
}
IContentType[] result = new IContentType[size];
int currentIndex = 0;
for (IContentType[] array : types) {
System.arraycopy(array, 0, result, currentIndex, array.length);
currentIndex += array.length;
}
return result;
}
......@@ -174,15 +190,40 @@ public final class ContentTypeCatalog {
String[] builtInFileExtensions = contentType.getFileSpecs(IContentType.IGNORE_USER_DEFINED | IContentType.FILE_EXTENSION_SPEC);
for (String builtInFileExtension : builtInFileExtensions)
associate(contentType, builtInFileExtension, IContentType.FILE_EXTENSION_SPEC);
String[] builtInFilePatterns = contentType
.getFileSpecs(IContentType.IGNORE_USER_DEFINED | IContentType.FILE_PATTERN_SPEC);
for (String builtInFilePattern : builtInFilePatterns) {
associate(contentType, builtInFilePattern, IContentType.FILE_PATTERN_SPEC);
}
}
String toRegexp(String filePattern) {
return filePattern.replace(".", "\\.").replace('?', '.').replace("*", ".*"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
synchronized void associate(ContentType contentType, String text, int type) {
Map<String, Set<ContentType>> fileSpecMap = ((type & IContentType.FILE_NAME_SPEC) != 0) ? fileNames : fileExtensions;
Map<String, Set<ContentType>> fileSpecMap = null;
if ((type & IContentType.FILE_NAME_SPEC) != 0) {
fileSpecMap = fileNames;
} else if ((type & IContentType.FILE_EXTENSION_SPEC) != 0) {
fileSpecMap = fileExtensions;
}
if (fileSpecMap != null) {
String mappingKey = FileSpec.getMappingKeyFor(text);
Set<ContentType> existing = fileSpecMap.get(mappingKey);
if (existing == null)
fileSpecMap.put(mappingKey, existing = new HashSet<>());
existing.add(contentType);
} else if ((type & IContentType.FILE_PATTERN_SPEC) != 0) {
Pattern compiledPattern = compiledRegexps.get(text);
if (compiledPattern == null) {
compiledPattern = Pattern.compile(toRegexp(text));
compiledRegexps.put(text, compiledPattern);
initialPatternForRegexp.put(compiledPattern, text);
fileRegexps.put(compiledPattern, new HashSet<>());
}
fileRegexps.get(compiledPattern).add(contentType);
}
}
private int collectMatchingByContents(int valid, IContentType[] subset, List<ContentType> destination, ILazySource contents, Map<String, Object> properties) throws IOException {
......@@ -410,15 +451,26 @@ public final class ContentTypeCatalog {
final int appropriateFullName = appropriate.size();
final int validExtension = collectMatchingByContents(validFullName, subset[1], appropriate, buffer, properties) - validFullName;
final int appropriateExtension = appropriate.size() - appropriateFullName;
final int validPattern = collectMatchingByContents(validExtension, subset[2], appropriate, buffer, properties)
- validExtension;
final int appropriatePattern = appropriate.size() - appropriateFullName - appropriateExtension;
IContentType[] result = appropriate.toArray(new IContentType[appropriate.size()]);
if (validFullName > 1)
Arrays.sort(result, 0, validFullName, validPolicy);
if (validExtension > 1)
Arrays.sort(result, validFullName, validFullName + validExtension, validPolicy);
if (validPattern > 1) {
Arrays.sort(result, validFullName + validExtension, validFullName + validExtension + validPattern,
validPolicy);
}
if (appropriateFullName - validFullName > 1)
Arrays.sort(result, validFullName + validExtension, appropriateFullName + validExtension, indeterminatePolicy);
if (appropriateExtension - validExtension > 1)
Arrays.sort(result, appropriateFullName + validExtension, appropriate.size(), indeterminatePolicy);
Arrays.sort(result, appropriateFullName + validExtension, appropriate.size() - validPattern,
indeterminatePolicy);
if (appropriatePattern - validPattern > 1) {
Arrays.sort(result, appropriate.size() - validPattern, appropriate.size(), indeterminatePolicy);
}
return result;
}
......@@ -427,8 +479,9 @@ public final class ContentTypeCatalog {
final Comparator<IContentType> validPolicy;
Comparator<IContentType> indeterminatePolicy;
if (fileName == null) {
// we only have a single array, by need to provide a two-dimensional, 2-element array
subset = new IContentType[][] {getAllContentTypes(), NO_CONTENT_TYPES};
// we only have a single array, by need to provide a two-dimensional, 3-element
// array
subset = new IContentType[][] { getAllContentTypes(), NO_CONTENT_TYPES, NO_CONTENT_TYPES };
indeterminatePolicy = policyConstantGeneralIsBetter;
validPolicy = policyConstantSpecificIsBetter;
} else {
......@@ -436,13 +489,13 @@ public final class ContentTypeCatalog {
indeterminatePolicy = policyGeneralIsBetter;
validPolicy = policySpecificIsBetter;
}
int total = subset[0].length + subset[1].length;
int total = subset[0].length + subset[1].length + subset[2].length;
if (total == 0)
// don't do further work if subset is empty
return NO_CONTENT_TYPES;
if (!forceValidation && total == 1) {
// do not do validation if not forced and only one was found (caller will validate later)
IContentType[] found = subset[0].length == 1 ? subset[0] : subset[1];
IContentType[] found = subset[0].length == 1 ? subset[0] : (subset[1].length == 1 ? subset[1] : subset[2]);
// bug 100032 - ignore binary content type if contents are text
if (!buffer.isText())
// binary buffer, caller can call the describer with no risk
......@@ -466,10 +519,11 @@ public final class ContentTypeCatalog {
*/
synchronized private IContentType[][] internalFindContentTypesFor(ContentTypeMatcher matcher, final String fileName, Comparator<IContentType> sortingPolicy) {
IScopeContext context = matcher.getContext();
IContentType[][] result = {NO_CONTENT_TYPES, NO_CONTENT_TYPES};
IContentType[][] result = { NO_CONTENT_TYPES, NO_CONTENT_TYPES, NO_CONTENT_TYPES };
final Set<ContentType> allByFileName;
Set<ContentType> existing = new HashSet<>();
final Set<ContentType> allByFileName;
if (context.equals(manager.getContext()))
allByFileName = getDirectlyAssociated(fileName, IContentTypeSettings.FILE_NAME_SPEC);
else {
......@@ -478,7 +532,11 @@ public final class ContentTypeCatalog {
}
Set<ContentType> selectedByName = selectMatchingByName(context, allByFileName, Collections.emptySet(), fileName,
IContentType.FILE_NAME_SPEC);
existing.addAll(selectedByName);
result[0] = selectedByName.toArray(new IContentType[selectedByName.size()]);
if (result[0].length > 1)
Arrays.sort(result[0], sortingPolicy);
final String fileExtension = ContentTypeManager.getFileExtension(fileName);
if (fileExtension != null) {
final Set<ContentType> allByFileExtension;
......@@ -489,16 +547,44 @@ public final class ContentTypeCatalog {
allByFileExtension.addAll(matcher.getDirectlyAssociated(this, fileExtension, IContentTypeSettings.FILE_EXTENSION_SPEC));
}
Set<ContentType> selectedByExtension = selectMatchingByName(context, allByFileExtension, selectedByName, fileExtension, IContentType.FILE_EXTENSION_SPEC);
existing.addAll(selectedByExtension);
if (!selectedByExtension.isEmpty())
result[1] = selectedByExtension.toArray(new IContentType[selectedByExtension.size()]);
}
if (result[0].length > 1)
Arrays.sort(result[0], sortingPolicy);
if (result[1].length > 1)
Arrays.sort(result[1], sortingPolicy);
final Set<ContentType> allByFilePattern;
if (context.equals(manager.getContext()))
allByFilePattern = getMatchingRegexpAssociated(fileName, IContentTypeSettings.FILE_PATTERN_SPEC);
else {
allByFilePattern = new HashSet<>(getMatchingRegexpAssociated(fileName,
IContentTypeSettings.FILE_PATTERN_SPEC | IContentType.IGNORE_USER_DEFINED));
allByFilePattern
.addAll(matcher.getMatchingRegexpAssociated(this, fileName,
IContentTypeSettings.FILE_PATTERN_SPEC));
}
existing.addAll(allByFilePattern);
if (!allByFilePattern.isEmpty())
result[2] = allByFilePattern.toArray(new IContentType[allByFilePattern.size()]);
return result;
}
private Set<ContentType> getMatchingRegexpAssociated(String fileName, int typeMask) {
if ((typeMask & IContentType.FILE_PATTERN_SPEC) == 0) {
throw new IllegalArgumentException("This method requires FILE_PATTERN_SPEC."); //$NON-NLS-1$
}
Set<ContentType> res = new HashSet<>();
for (Entry<Pattern, Set<ContentType>> spec : this.fileRegexps.entrySet()) {
if (spec.getKey().matcher(fileName).matches()) {
res.addAll(filterOnDefinitionSource(initialPatternForRegexp.get(spec.getKey()), typeMask,
spec.getValue()));
}
}
return res;
}
/**
* Returns content types directly associated with the given file spec.
*
......@@ -513,27 +599,48 @@ public final class ContentTypeCatalog {
* @return a set of content types
*/
private Set<ContentType> getDirectlyAssociated(String text, int typeMask) {
if ((typeMask & IContentType.FILE_PATTERN_SPEC) != 0) {
throw new IllegalArgumentException("This method don't allow FILE_REGEXP_SPEC."); //$NON-NLS-1$
}
Map<String, Set<ContentType>> associations = (typeMask & IContentTypeSettings.FILE_NAME_SPEC) != 0 ? fileNames : fileExtensions;
Set<ContentType> result = null;
if ((typeMask & (IContentType.IGNORE_PRE_DEFINED | IContentType.IGNORE_USER_DEFINED)) == 0)
// no restrictions, get everything
result = associations.get(FileSpec.getMappingKeyFor(text));
else {
// only those specs satisfying the type mask should be included
Set<ContentType> initialSet = associations.get(FileSpec.getMappingKeyFor(text));
if (initialSet != null && !initialSet.isEmpty()) {
Set<ContentType> result = associations.get(FileSpec.getMappingKeyFor(text));
if ((typeMask & (IContentType.IGNORE_PRE_DEFINED | IContentType.IGNORE_USER_DEFINED)) != 0) {
result = filterOnDefinitionSource(text, typeMask, result);
}
return result == null ? Collections.EMPTY_SET : result;
}
/**
* Filters a set of content-types on whether they have a mapping that matches
* provided criteria.
*
* @param text
* file name, file extension or file regexp (depending on value of
* {@code typeMask}.
* @param typeMask
* the type mask. Spec type, and definition source (pre-defined or
* user-defined) will be used
* @param contentTypes
* content types to filter from (not modified during method
* execution)
* @return set of filtered content-type
*/
private Set<ContentType> filterOnDefinitionSource(String text, int typeMask, Set<ContentType> contentTypes) {
if ((typeMask & (IContentType.IGNORE_PRE_DEFINED | IContentType.IGNORE_USER_DEFINED)) == 0) {
return contentTypes;
}
if (contentTypes != null && !contentTypes.isEmpty()) {
// copy so we can modify
result = new HashSet<>(initialSet);
contentTypes = new HashSet<>(contentTypes);
// invert the last two bits so it is easier to compare
typeMask ^= (IContentType.IGNORE_PRE_DEFINED | IContentType.IGNORE_USER_DEFINED);
for (Iterator<ContentType> i = result.iterator(); i.hasNext();) {
for (Iterator<ContentType> i = contentTypes.iterator(); i.hasNext();) {
ContentType contentType = i.next();
if (!contentType.hasFileSpec(text, typeMask, true))
i.remove();
}
}
}
return result == null ? Collections.EMPTY_SET : result;
return contentTypes;
}
synchronized ContentType internalGetContentType(String contentTypeIdentifier) {
......
......@@ -265,7 +265,7 @@ public class ContentTypeManager extends ContentTypeMatcher implements IContentTy
throw new IllegalArgumentException("Content-type '" + id + "' already exists.");//$NON-NLS-1$ //$NON-NLS-2$
}
ContentType contentType = ContentType.createContentType(getCatalog(), id, name, (byte) 0, new String[0],
new String[0], baseType != null ? baseType.getId() : null, null, null, null);
new String[0], new String[0], baseType != null ? baseType.getId() : null, null, null, null);
getCatalog().addContentType(contentType);
// Add preferences for this content type.
String currentUserDefined = getContext().getNode(ContentType.PREF_USER_DEFINED)
......
/*******************************************************************************
* Copyright (c) 2005, 2007 IBM Corporation and others.
* Copyright (c) 2005, 2017 IBM Corporation 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
......@@ -7,14 +7,17 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
* Mickael Istria (Red Hat Inc.) - [263316] regexp for file association
*******************************************************************************/
package org.eclipse.core.internal.content;
import java.io.*;
import java.util.*;
import java.util.regex.Pattern;
import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.core.runtime.content.*;
import org.eclipse.core.runtime.preferences.*;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IScopeContext;
import org.osgi.service.prefs.BackingStoreException;
/**
......@@ -93,13 +96,14 @@ public class ContentTypeMatcher implements IContentTypeMatcher {
* Enumerates all content types whose settings satisfy the given file spec type mask.
*/
public Collection<ContentType> getDirectlyAssociated(final ContentTypeCatalog catalog, final String fileSpec, final int typeMask) {
if ((typeMask & (IContentType.FILE_EXTENSION_SPEC | IContentType.FILE_NAME_SPEC)) == 0) {
throw new IllegalArgumentException("This method only apply to name or extension based associations"); //$NON-NLS-1$
}
//TODO: make sure we include built-in associations as well
final IEclipsePreferences root = context.getNode(ContentTypeManager.CONTENT_TYPE_PREF_NODE);
final Set<ContentType> result = new HashSet<>(3);
try {
root.accept(new IPreferenceNodeVisitor() {
@Override
public boolean visit(IEclipsePreferences node) {
root.accept(node -> {
if (node == root)
return true;
String[] fileSpecs = ContentTypeSettings.getFileSpecs(node, typeMask);
......@@ -111,8 +115,33 @@ public class ContentTypeMatcher implements IContentTypeMatcher {
break;
}
return false;
});
} catch (BackingStoreException bse) {
ContentType.log(ContentMessages.content_errorLoadingSettings, bse);
}
return result == null ? Collections.EMPTY_SET : result;
}
public Collection<? extends ContentType> getMatchingRegexpAssociated(ContentTypeCatalog catalog,
String fileName, final int typeMask) {
if ((typeMask & IContentType.FILE_PATTERN_SPEC) == 0) {
throw new IllegalArgumentException("This method only applies for FILE_REGEXP_SPEC."); //$NON-NLS-1$
}
final IEclipsePreferences root = context.getNode(ContentTypeManager.CONTENT_TYPE_PREF_NODE);
final Set<ContentType> result = new HashSet<>(3);
try {
root.accept(node -> {
if (node == root)
return true;
String[] fileSpecs = ContentTypeSettings.getFileSpecs(node, typeMask);
for (String fileSpecification : fileSpecs)
if (Pattern.matches(catalog.toRegexp(fileSpecification), fileName)) {
ContentType associated = catalog.getContentType(node.name());
if (associated != null)
result.add(associated);
break;
}
return false;
});
} catch (BackingStoreException bse) {
ContentType.log(ContentMessages.content_errorLoadingSettings, bse);
......@@ -133,4 +162,5 @@ public class ContentTypeMatcher implements IContentTypeMatcher {
((ContentDescription) description).setContentTypeInfo(new ContentTypeSettings((ContentType) description.getContentTypeInfo(), context));
return description;
}
}
......@@ -18,5 +18,5 @@ public interface ContentTypeVisitor {
/**
* @return CONTINUE, RETURN or STOP
*/
public int visit(ContentType contentType);
int visit(ContentType contentType);
}
......@@ -19,11 +19,11 @@ public interface IContentConstants {
/**
* Backward compatibility: name of the original runtime plugin
*/
public static final String RUNTIME_NAME = "org.eclipse.core.runtime"; //$NON-NLS-1$
String RUNTIME_NAME = "org.eclipse.core.runtime"; //$NON-NLS-1$
/**
* Name of this plugin
*/
public static final String CONTENT_NAME = "org.eclipse.core.contenttype"; //$NON-NLS-1$
String CONTENT_NAME = "org.eclipse.core.contenttype"; //$NON-NLS-1$
}
......@@ -19,11 +19,11 @@ public abstract interface IContentTypeInfo {
/**
* Returns a reference to the corresponding content type.
*/
public abstract ContentType getContentType();
ContentType getContentType();
/**
* Returns the default value for the given property, delegating to the
* ancestor type if necessary.
*/
public abstract String getDefaultProperty(QualifiedName key);
String getDefaultProperty(QualifiedName key);
}
......@@ -19,10 +19,10 @@ public interface ILazySource {
/**
* @return a boolean indicating whether this stream is character or byte-based
*/
public boolean isText();
boolean isText();
/**
* Rewinds the stream.
*/
public void rewind();
void rewind();
}
......@@ -102,7 +102,7 @@ public class Util {
public static String toListString(Object[] list, String separator) {
if (list == null || list.length == 0)
return null;
StringBuffer result = new StringBuffer();
StringBuilder result = new StringBuilder();
for (Object element : list) {
result.append(element);
result.append(separator);
......
......@@ -78,7 +78,7 @@ public final class XMLRootHandler extends DefaultHandler implements LexicalHandl
}
@Override
public final void comment(final char[] ch, final int start, final int length) {
public void comment(final char[] ch, final int start, final int length) {
// Not interested.
}
......@@ -98,7 +98,7 @@ public final class XMLRootHandler extends DefaultHandler implements LexicalHandl
* If the <code>XMLReader</code> does not support the lexical
* handler configuration option.
*/
private final SAXParser createParser(SAXParserFactory parserFactory) throws ParserConfigurationException, SAXException, SAXNotRecognizedException, SAXNotSupportedException {
private SAXParser createParser(SAXParserFactory parserFactory) throws ParserConfigurationException, SAXException, SAXNotRecognizedException, SAXNotSupportedException {
// Initialize the parser.
final SAXParser parser = parserFactory.newSAXParser();
final XMLReader reader = parser.getXMLReader();
......@@ -117,17 +117,17 @@ public final class XMLRootHandler extends DefaultHandler implements LexicalHandl
}
@Override
public final void endCDATA() {
public void endCDATA() {
// Not interested.
}
@Override
public final void endDTD() {
public void endDTD() {
// Not interested.
}
@Override
public final void endEntity(final String name) {
public void endEntity(final String name) {
// Not interested.
}
......@@ -174,12 +174,12 @@ public final class XMLRootHandler extends DefaultHandler implements LexicalHandl
}
@Override
public final void startCDATA() {
public void startCDATA() {
// Not interested.
}
@Override
public final void startDTD(final String name, final String publicId, final String systemId) throws SAXException {
public void startDTD(final String name, final String publicId, final String systemId) throws SAXException {
dtdFound = systemId;
// If we don't care about the top-level element, we can stop here.
if (!checkRoot)
......@@ -187,14 +187,14 @@ public final class XMLRootHandler extends DefaultHandler implements LexicalHandl
}
@Override
public final void startElement(final String uri, final String elementName, final String qualifiedName, final Attributes attributes) throws SAXException {
public void startElement(final String uri, final String elementName, final String qualifiedName, final Attributes attributes) throws SAXException {
elementFound = elementName;
namespaceFound = uri;
throw new StopParsingException();
}
@Override
public final void startEntity(final String name) {
public void startEntity(final String name) {
// Not interested.
}
}
......@@ -107,7 +107,7 @@ public final class BinarySignatureDescriber implements IContentDescriber, IExecu
List<Byte> bytes = new ArrayList<>();
StringTokenizer tokenizer = new StringTokenizer(data, " \t\n\r\f,"); //$NON-NLS-1$
while (tokenizer.hasMoreTokens())
bytes.add(new Byte((byte) Integer.parseInt(tokenizer.nextToken().trim(), 16)));
bytes.add(Byte.valueOf((byte) Integer.parseInt(tokenizer.nextToken().trim(), 16)));
byte[] signature = new byte[bytes.size()];
for (int i = 0; i < signature.length; i++)
signature[i] = bytes.get(i).byteValue();
......