mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 14:12:10 +02:00
Revert "Bug 489563 - API change for Language Settings Providers."
This reverts the changes we've made for language settings providers so that I can start again with a cleaner approach. Change-Id: Icddd5a465a8f217594af5b07011a56bf1dfdf014
This commit is contained in:
parent
52432d7370
commit
c29243b187
52 changed files with 5351 additions and 5900 deletions
|
@ -25,10 +25,8 @@ import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager;
|
import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager;
|
||||||
import org.eclipse.cdt.core.testplugin.ResourceHelper;
|
import org.eclipse.cdt.core.testplugin.ResourceHelper;
|
||||||
import org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuildCommandParser;
|
import org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuildCommandParser;
|
||||||
import org.eclipse.core.resources.IBuildConfiguration;
|
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.Adapters;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -63,8 +61,6 @@ public class LibtoolGCCBuildCommandParserTest {
|
||||||
IProject project = ResourceHelper.createCDTProjectWithConfig(projectName);
|
IProject project = ResourceHelper.createCDTProjectWithConfig(projectName);
|
||||||
ICConfigurationDescription[] cfgDescriptions = getConfigurationDescriptions(project);
|
ICConfigurationDescription[] cfgDescriptions = getConfigurationDescriptions(project);
|
||||||
ICConfigurationDescription cfgDescription = cfgDescriptions[0];
|
ICConfigurationDescription cfgDescription = cfgDescriptions[0];
|
||||||
IBuildConfiguration config = Adapters.adapt(cfgDescription, IBuildConfiguration.class);
|
|
||||||
assertNotNull(config);
|
|
||||||
|
|
||||||
IFile file1 = ResourceHelper.createFile(project, "file1.cpp");
|
IFile file1 = ResourceHelper.createFile(project, "file1.cpp");
|
||||||
IFile file2 = ResourceHelper.createFile(project, "file2.cpp");
|
IFile file2 = ResourceHelper.createFile(project, "file2.cpp");
|
||||||
|
@ -81,11 +77,11 @@ public class LibtoolGCCBuildCommandParserTest {
|
||||||
parser.processLine("libtool: compile: g++ -I/path0 file2.cpp");
|
parser.processLine("libtool: compile: g++ -I/path0 file2.cpp");
|
||||||
parser.processLine("libtool: compile: cc -I/path0 file3.cpp");
|
parser.processLine("libtool: compile: cc -I/path0 file3.cpp");
|
||||||
parser.shutdown();
|
parser.shutdown();
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(config, file1, languageId);
|
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file1, languageId);
|
||||||
assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0));
|
assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0));
|
||||||
entries = parser.getSettingEntries(config, file2, languageId);
|
entries = parser.getSettingEntries(cfgDescription, file2, languageId);
|
||||||
assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0));
|
assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0));
|
||||||
entries = parser.getSettingEntries(config, file3, languageId);
|
entries = parser.getSettingEntries(cfgDescription, file3, languageId);
|
||||||
assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0));
|
assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#Thu Oct 08 20:38:59 EDT 2009
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
||||||
|
@ -84,6 +85,262 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
|
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
||||||
org.eclipse.jdt.core.compiler.source=1.7
|
org.eclipse.jdt.core.compiler.source=1.7
|
||||||
|
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_enum_constant=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
|
||||||
|
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=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
|
||||||
|
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_selector_in_method_invocation=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
|
||||||
|
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.blank_lines_after_imports=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_after_package=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_field=0
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_method=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_package=0
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=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.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.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.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.line_length=110
|
||||||
|
org.eclipse.jdt.core.formatter.compact_else_if=true
|
||||||
|
org.eclipse.jdt.core.formatter.continuation_indentation=2
|
||||||
|
org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
|
||||||
|
org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=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
|
||||||
|
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
|
||||||
|
org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
|
||||||
|
org.eclipse.jdt.core.formatter.indent_empty_lines=false
|
||||||
|
org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
|
||||||
|
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=insert
|
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=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_member=insert
|
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert
|
||||||
org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter
|
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
|
||||||
|
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_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
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.join_lines_in_comments=true
|
||||||
|
org.eclipse.jdt.core.formatter.join_wrapped_lines=true
|
||||||
|
org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
|
||||||
|
org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
|
||||||
|
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
|
||||||
|
org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
|
||||||
|
org.eclipse.jdt.core.formatter.lineSplit=110
|
||||||
|
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.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_tabs_only_for_leading_indentations=false
|
||||||
|
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
eclipse.preferences.version=1
|
|
||||||
formatter_settings_version=12
|
|
|
@ -47,9 +47,7 @@ import org.eclipse.cdt.internal.core.envvar.UserDefinedEnvironmentSupplier;
|
||||||
import org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager;
|
import org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager;
|
||||||
import org.eclipse.cdt.managedbuilder.language.settings.providers.AbstractBuiltinSpecsDetector;
|
import org.eclipse.cdt.managedbuilder.language.settings.providers.AbstractBuiltinSpecsDetector;
|
||||||
import org.eclipse.cdt.utils.envvar.StorableEnvironment;
|
import org.eclipse.cdt.utils.envvar.StorableEnvironment;
|
||||||
import org.eclipse.core.resources.IBuildConfiguration;
|
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.Adapters;
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
@ -85,12 +83,10 @@ public class BuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
protected List<String> parseOptions(String line) {
|
protected List<String> parseOptions(String line) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected AbstractOptionParser[] getOptionParsers() {
|
protected AbstractOptionParser[] getOptionParsers() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getCompilerCommand(String languageId) {
|
protected String getCompilerCommand(String languageId) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -105,7 +101,6 @@ public class BuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
protected void startupForLanguage(String languageId) throws CoreException {
|
protected void startupForLanguage(String languageId) throws CoreException {
|
||||||
super.startupForLanguage(languageId);
|
super.startupForLanguage(languageId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void shutdownForLanguage() {
|
protected void shutdownForLanguage() {
|
||||||
super.shutdownForLanguage();
|
super.shutdownForLanguage();
|
||||||
|
@ -121,7 +116,6 @@ public class BuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
super.execute();
|
super.execute();
|
||||||
waitForProviderToFinish();
|
waitForProviderToFinish();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean isExecuted() {
|
protected boolean isExecuted() {
|
||||||
return isExecuted;
|
return isExecuted;
|
||||||
}
|
}
|
||||||
|
@ -134,19 +128,15 @@ public class BuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
private int executedCount = 0;
|
private int executedCount = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void startup(ICConfigurationDescription cfgDescription, IWorkingDirectoryTracker cwdTracker)
|
public void startup(ICConfigurationDescription cfgDescription, IWorkingDirectoryTracker cwdTracker) throws CoreException {
|
||||||
throws CoreException {
|
|
||||||
executedCount++;
|
executedCount++;
|
||||||
super.startup(cfgDescription, cwdTracker);
|
super.startup(cfgDescription, cwdTracker);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MockBuiltinSpecsDetectorEnvironmentChangeListener cloneShallow()
|
public MockBuiltinSpecsDetectorEnvironmentChangeListener cloneShallow() throws CloneNotSupportedException {
|
||||||
throws CloneNotSupportedException {
|
|
||||||
MockBuiltinSpecsDetectorEnvironmentChangeListener clone = (MockBuiltinSpecsDetectorEnvironmentChangeListener) super.cloneShallow();
|
MockBuiltinSpecsDetectorEnvironmentChangeListener clone = (MockBuiltinSpecsDetectorEnvironmentChangeListener) super.cloneShallow();
|
||||||
return clone;
|
return clone;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MockBuiltinSpecsDetectorEnvironmentChangeListener clone() throws CloneNotSupportedException {
|
public MockBuiltinSpecsDetectorEnvironmentChangeListener clone() throws CloneNotSupportedException {
|
||||||
MockBuiltinSpecsDetectorEnvironmentChangeListener clone = (MockBuiltinSpecsDetectorEnvironmentChangeListener) super.clone();
|
MockBuiltinSpecsDetectorEnvironmentChangeListener clone = (MockBuiltinSpecsDetectorEnvironmentChangeListener) super.clone();
|
||||||
|
@ -168,21 +158,17 @@ public class BuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
protected boolean validateEnvironment() {
|
protected boolean validateEnvironment() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void execute() {
|
protected void execute() {
|
||||||
super.execute();
|
super.execute();
|
||||||
sampleEnvVarValue = environmentMap.get(ENV_SAMPLE);
|
sampleEnvVarValue = environmentMap.get(ENV_SAMPLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MockBuiltinSpecsDetectorEnvironmentChangeListener cloneShallow()
|
public MockBuiltinSpecsDetectorEnvironmentChangeListener cloneShallow() throws CloneNotSupportedException {
|
||||||
throws CloneNotSupportedException {
|
|
||||||
MockBuiltinSpecsDetectorEnvironmentChangeListener clone = (MockBuiltinSpecsDetectorEnvironmentChangeListener) super.cloneShallow();
|
MockBuiltinSpecsDetectorEnvironmentChangeListener clone = (MockBuiltinSpecsDetectorEnvironmentChangeListener) super.cloneShallow();
|
||||||
clone.sampleEnvVarValue = sampleEnvVarValue;
|
clone.sampleEnvVarValue = sampleEnvVarValue;
|
||||||
return clone;
|
return clone;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MockBuiltinSpecsDetectorEnvironmentChangeListener clone() throws CloneNotSupportedException {
|
public MockBuiltinSpecsDetectorEnvironmentChangeListener clone() throws CloneNotSupportedException {
|
||||||
MockBuiltinSpecsDetectorEnvironmentChangeListener clone = (MockBuiltinSpecsDetectorEnvironmentChangeListener) super.clone();
|
MockBuiltinSpecsDetectorEnvironmentChangeListener clone = (MockBuiltinSpecsDetectorEnvironmentChangeListener) super.clone();
|
||||||
|
@ -193,7 +179,6 @@ public class BuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
protected boolean isExecuted() {
|
protected boolean isExecuted() {
|
||||||
return isExecuted;
|
return isExecuted;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSampleEnvVar() {
|
public String getSampleEnvVar() {
|
||||||
return sampleEnvVarValue;
|
return sampleEnvVarValue;
|
||||||
}
|
}
|
||||||
|
@ -204,38 +189,28 @@ public class BuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
*/
|
*/
|
||||||
private class MockConsoleBuiltinSpecsDetector extends AbstractBuiltinSpecsDetector {
|
private class MockConsoleBuiltinSpecsDetector extends AbstractBuiltinSpecsDetector {
|
||||||
@SuppressWarnings("nls")
|
@SuppressWarnings("nls")
|
||||||
private final AbstractOptionParser[] optionParsers = { new MacroOptionParser("#define (\\S*) *(\\S*)",
|
private final AbstractOptionParser[] optionParsers = {
|
||||||
"$1", "$2", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), };
|
new MacroOptionParser("#define (\\S*) *(\\S*)", "$1", "$2", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY),
|
||||||
|
};
|
||||||
@Override
|
@Override
|
||||||
protected int runProgramForLanguage(String languageId, String command, String[] envp,
|
protected int runProgramForLanguage(String languageId, String command, String[] envp, URI workingDirectoryURI, OutputStream consoleOut, OutputStream consoleErr, IProgressMonitor monitor) throws CoreException, IOException {
|
||||||
URI workingDirectoryURI, OutputStream consoleOut, OutputStream consoleErr,
|
|
||||||
IProgressMonitor monitor) throws CoreException, IOException {
|
|
||||||
String line = "#define MACRO VALUE";
|
String line = "#define MACRO VALUE";
|
||||||
consoleOut.write((line + '\n').getBytes());
|
consoleOut.write((line + '\n').getBytes());
|
||||||
consoleOut.flush();
|
consoleOut.flush();
|
||||||
return ICommandLauncher.OK;
|
return ICommandLauncher.OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected IStatus runForEachLanguage(IProgressMonitor monitor) {
|
protected IStatus runForEachLanguage(IProgressMonitor monitor) {
|
||||||
return super.runForEachLanguage(monitor);
|
return super.runForEachLanguage(monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<String> parseOptions(final String line) {
|
protected List<String> parseOptions(final String line) {
|
||||||
return new ArrayList<String>() {
|
return new ArrayList<String>() {{ add(line); }};
|
||||||
{
|
|
||||||
add(line);
|
|
||||||
}
|
}
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected AbstractOptionParser[] getOptionParsers() {
|
protected AbstractOptionParser[] getOptionParsers() {
|
||||||
return optionParsers;
|
return optionParsers;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getCompilerCommand(String languageId) {
|
protected String getCompilerCommand(String languageId) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -291,7 +266,7 @@ public class BuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
assertEquals(PROVIDER_ID, provider.getId());
|
assertEquals(PROVIDER_ID, provider.getId());
|
||||||
assertEquals(PROVIDER_NAME, provider.getName());
|
assertEquals(PROVIDER_NAME, provider.getName());
|
||||||
assertEquals(null, provider.getLanguageScope());
|
assertEquals(null, provider.getLanguageScope());
|
||||||
assertEquals(null, provider.getSettingEntries((IBuildConfiguration) null, null, null));
|
assertEquals(null, provider.getSettingEntries(null, null, null));
|
||||||
assertEquals("", provider.getCommand());
|
assertEquals("", provider.getCommand());
|
||||||
assertEquals(false, provider.isExecuted());
|
assertEquals(false, provider.isExecuted());
|
||||||
assertEquals(false, provider.isConsoleEnabled());
|
assertEquals(false, provider.isConsoleEnabled());
|
||||||
|
@ -305,15 +280,14 @@ public class BuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
Map<String, String> properties = new HashMap<String, String>();
|
Map<String, String> properties = new HashMap<String, String>();
|
||||||
properties.put(ATTR_PARAMETER, CUSTOM_COMMAND_1);
|
properties.put(ATTR_PARAMETER, CUSTOM_COMMAND_1);
|
||||||
List<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>();
|
List<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>();
|
||||||
ICLanguageSettingEntry entry = new CMacroEntry("MACRO", "VALUE",
|
ICLanguageSettingEntry entry = new CMacroEntry("MACRO", "VALUE", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY);
|
||||||
ICSettingEntry.BUILTIN | ICSettingEntry.READONLY);
|
|
||||||
entries.add(entry);
|
entries.add(entry);
|
||||||
|
|
||||||
provider.configureProvider(PROVIDER_ID, PROVIDER_NAME, languages, entries, properties);
|
provider.configureProvider(PROVIDER_ID, PROVIDER_NAME, languages, entries, properties);
|
||||||
assertEquals(PROVIDER_ID, provider.getId());
|
assertEquals(PROVIDER_ID, provider.getId());
|
||||||
assertEquals(PROVIDER_NAME, provider.getName());
|
assertEquals(PROVIDER_NAME, provider.getName());
|
||||||
assertEquals(languages, provider.getLanguageScope());
|
assertEquals(languages, provider.getLanguageScope());
|
||||||
assertEquals(entries, provider.getSettingEntries((IBuildConfiguration) null, null, null));
|
assertEquals(entries, provider.getSettingEntries(null, null, null));
|
||||||
assertEquals(CUSTOM_COMMAND_1, provider.getCommand());
|
assertEquals(CUSTOM_COMMAND_1, provider.getCommand());
|
||||||
assertEquals(false, provider.isConsoleEnabled());
|
assertEquals(false, provider.isConsoleEnabled());
|
||||||
assertEquals(false, provider.isExecuted());
|
assertEquals(false, provider.isExecuted());
|
||||||
|
@ -326,7 +300,7 @@ public class BuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
|
|
||||||
provider.execute();
|
provider.execute();
|
||||||
assertEquals(true, provider.isExecuted());
|
assertEquals(true, provider.isExecuted());
|
||||||
assertEquals(null, provider.getSettingEntries((IBuildConfiguration) null, null, null));
|
assertEquals(null, provider.getSettingEntries(null, null, null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -340,7 +314,6 @@ public class BuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
public MockDetectorCloneable clone() throws CloneNotSupportedException {
|
public MockDetectorCloneable clone() throws CloneNotSupportedException {
|
||||||
return (MockDetectorCloneable) super.clone();
|
return (MockDetectorCloneable) super.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MockDetectorCloneable cloneShallow() throws CloneNotSupportedException {
|
public MockDetectorCloneable cloneShallow() throws CloneNotSupportedException {
|
||||||
return (MockDetectorCloneable) super.cloneShallow();
|
return (MockDetectorCloneable) super.cloneShallow();
|
||||||
|
@ -353,8 +326,7 @@ public class BuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
List<String> languages = new ArrayList<String>();
|
List<String> languages = new ArrayList<String>();
|
||||||
languages.add(LANGUAGE_ID);
|
languages.add(LANGUAGE_ID);
|
||||||
List<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>();
|
List<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>();
|
||||||
ICLanguageSettingEntry entry = new CMacroEntry("MACRO", "VALUE",
|
ICLanguageSettingEntry entry = new CMacroEntry("MACRO", "VALUE", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY);
|
||||||
ICSettingEntry.BUILTIN | ICSettingEntry.READONLY);
|
|
||||||
entries.add(entry);
|
entries.add(entry);
|
||||||
|
|
||||||
// check clone after initialization
|
// check clone after initialization
|
||||||
|
@ -412,9 +384,8 @@ public class BuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
{
|
{
|
||||||
MockDetectorCloneable clone = provider.clone();
|
MockDetectorCloneable clone = provider.clone();
|
||||||
List<ICLanguageSettingEntry> entries2 = new ArrayList<ICLanguageSettingEntry>();
|
List<ICLanguageSettingEntry> entries2 = new ArrayList<ICLanguageSettingEntry>();
|
||||||
entries2.add(
|
entries2.add(new CMacroEntry("MACRO2", "VALUE2", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY));
|
||||||
new CMacroEntry("MACRO2", "VALUE2", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY));
|
clone.setSettingEntries(null, null, null, entries2);
|
||||||
clone.setSettingEntries((IBuildConfiguration) null, null, null, entries2);
|
|
||||||
assertFalse(provider.equals(clone));
|
assertFalse(provider.equals(clone));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -425,7 +396,7 @@ public class BuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
assertEquals(false, clone.isExecuted());
|
assertEquals(false, clone.isExecuted());
|
||||||
assertFalse(provider2.equals(clone));
|
assertFalse(provider2.equals(clone));
|
||||||
|
|
||||||
provider2.setSettingEntries((IBuildConfiguration) null, null, null, null);
|
provider2.setSettingEntries(null, null, null, null);
|
||||||
assertFalse(provider2.equals(clone));
|
assertFalse(provider2.equals(clone));
|
||||||
|
|
||||||
clone.execute();
|
clone.execute();
|
||||||
|
@ -493,7 +464,7 @@ public class BuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
MockBuiltinSpecsDetectorExecutedFlag provider = new MockBuiltinSpecsDetectorExecutedFlag();
|
MockBuiltinSpecsDetectorExecutedFlag provider = new MockBuiltinSpecsDetectorExecutedFlag();
|
||||||
List<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>();
|
List<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>();
|
||||||
entries.add(new CIncludePathEntry("path0", 1));
|
entries.add(new CIncludePathEntry("path0", 1));
|
||||||
provider.setSettingEntries((IBuildConfiguration) null, null, null, entries);
|
provider.setSettingEntries(null, null, null, entries);
|
||||||
// serialize entries
|
// serialize entries
|
||||||
Document doc = XmlUtil.newDocument();
|
Document doc = XmlUtil.newDocument();
|
||||||
rootElement = XmlUtil.appendElement(doc, ELEM_TEST);
|
rootElement = XmlUtil.appendElement(doc, ELEM_TEST);
|
||||||
|
@ -511,7 +482,7 @@ public class BuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
|
|
||||||
// load the XML to the new provider
|
// load the XML to the new provider
|
||||||
provider.load(rootElement);
|
provider.load(rootElement);
|
||||||
List<ICLanguageSettingEntry> entries = provider.getSettingEntries((IBuildConfiguration) null, null, null);
|
List<ICLanguageSettingEntry> entries = provider.getSettingEntries(null, null, null);
|
||||||
assertNotNull(entries);
|
assertNotNull(entries);
|
||||||
assertTrue(entries.size() > 0);
|
assertTrue(entries.size() > 0);
|
||||||
assertEquals(new CIncludePathEntry("path0", 1), entries.get(0));
|
assertEquals(new CIncludePathEntry("path0", 1), entries.get(0));
|
||||||
|
@ -532,7 +503,7 @@ public class BuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
|
|
||||||
// execute provider
|
// execute provider
|
||||||
provider.execute();
|
provider.execute();
|
||||||
List<ICLanguageSettingEntry> entries = provider.getSettingEntries((IBuildConfiguration) null, null, null);
|
List<ICLanguageSettingEntry> entries = provider.getSettingEntries(null, null, null);
|
||||||
assertEquals(null, entries);
|
assertEquals(null, entries);
|
||||||
// executed provider should NOT appear as empty even with no entries set
|
// executed provider should NOT appear as empty even with no entries set
|
||||||
assertEquals(false, provider.isEmpty());
|
assertEquals(false, provider.isEmpty());
|
||||||
|
@ -573,11 +544,7 @@ public class BuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
ICConfigurationDescription cfgDescription = cfgDescriptions[0];
|
ICConfigurationDescription cfgDescription = cfgDescriptions[0];
|
||||||
|
|
||||||
MockConsoleBuiltinSpecsDetector provider = new MockConsoleBuiltinSpecsDetector();
|
MockConsoleBuiltinSpecsDetector provider = new MockConsoleBuiltinSpecsDetector();
|
||||||
provider.setLanguageScope(new ArrayList<String>() {
|
provider.setLanguageScope(new ArrayList<String>() {{add(LANGUAGE_ID);}});
|
||||||
{
|
|
||||||
add(LANGUAGE_ID);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Run provider
|
// Run provider
|
||||||
provider.startup(cfgDescription, null);
|
provider.startup(cfgDescription, null);
|
||||||
|
@ -586,14 +553,12 @@ public class BuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
|
|
||||||
assertFalse(provider.isEmpty());
|
assertFalse(provider.isEmpty());
|
||||||
|
|
||||||
List<ICLanguageSettingEntry> noentries = provider.getSettingEntries((IBuildConfiguration) null, null, null);
|
List<ICLanguageSettingEntry> noentries = provider.getSettingEntries(null, null, null);
|
||||||
assertNull(noentries);
|
assertNull(noentries);
|
||||||
|
|
||||||
// Check parsed entries
|
// Check parsed entries
|
||||||
IBuildConfiguration config = Adapters.adapt(cfgDescription, IBuildConfiguration.class);
|
List<ICLanguageSettingEntry> entries = provider.getSettingEntries(cfgDescription, null, LANGUAGE_ID);
|
||||||
List<ICLanguageSettingEntry> entries = provider.getSettingEntries(config, null, LANGUAGE_ID);
|
ICLanguageSettingEntry expected = new CMacroEntry("MACRO", "VALUE", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY);
|
||||||
ICLanguageSettingEntry expected = new CMacroEntry("MACRO", "VALUE",
|
|
||||||
ICSettingEntry.BUILTIN | ICSettingEntry.READONLY);
|
|
||||||
assertEquals(expected, entries.get(0));
|
assertEquals(expected, entries.get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -603,11 +568,7 @@ public class BuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
public void testAbstractBuiltinSpecsDetector_RunGlobal() throws Exception {
|
public void testAbstractBuiltinSpecsDetector_RunGlobal() throws Exception {
|
||||||
// Create provider
|
// Create provider
|
||||||
MockConsoleBuiltinSpecsDetector provider = new MockConsoleBuiltinSpecsDetector();
|
MockConsoleBuiltinSpecsDetector provider = new MockConsoleBuiltinSpecsDetector();
|
||||||
provider.setLanguageScope(new ArrayList<String>() {
|
provider.setLanguageScope(new ArrayList<String>() {{add(LANGUAGE_ID);}});
|
||||||
{
|
|
||||||
add(LANGUAGE_ID);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Run provider
|
// Run provider
|
||||||
provider.startup(null, null);
|
provider.startup(null, null);
|
||||||
|
@ -617,10 +578,8 @@ public class BuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
assertFalse(provider.isEmpty());
|
assertFalse(provider.isEmpty());
|
||||||
|
|
||||||
// Check parsed entries
|
// Check parsed entries
|
||||||
List<ICLanguageSettingEntry> entries =
|
List<ICLanguageSettingEntry> entries = provider.getSettingEntries(null, null, LANGUAGE_ID);
|
||||||
provider.getSettingEntries((IBuildConfiguration) null, null, LANGUAGE_ID);
|
ICLanguageSettingEntry expected = new CMacroEntry("MACRO", "VALUE", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY);
|
||||||
ICLanguageSettingEntry expected = new CMacroEntry("MACRO", "VALUE",
|
|
||||||
ICSettingEntry.BUILTIN | ICSettingEntry.READONLY);
|
|
||||||
assertEquals(expected, entries.get(0));
|
assertEquals(expected, entries.get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -636,8 +595,7 @@ public class BuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
|
|
||||||
// Create provider
|
// Create provider
|
||||||
MockBuiltinSpecsDetectorEnvironmentChangeListener provider = new MockBuiltinSpecsDetectorEnvironmentChangeListener();
|
MockBuiltinSpecsDetectorEnvironmentChangeListener provider = new MockBuiltinSpecsDetectorEnvironmentChangeListener();
|
||||||
// register environment listener on configuration - note that provider is not included in the
|
// register environment listener on configuration - note that provider is not included in the configuration
|
||||||
// configuration
|
|
||||||
provider.registerListener(cfgDescription);
|
provider.registerListener(cfgDescription);
|
||||||
waitForProviderToFinish();
|
waitForProviderToFinish();
|
||||||
assertEquals(true, provider.isExecuted());
|
assertEquals(true, provider.isExecuted());
|
||||||
|
@ -649,10 +607,8 @@ public class BuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
|
|
||||||
// Set an environment variable to the configuration
|
// Set an environment variable to the configuration
|
||||||
{
|
{
|
||||||
ICProjectDescription prjDescriptionWritable = CoreModel.getDefault()
|
ICProjectDescription prjDescriptionWritable = CoreModel.getDefault().getProjectDescription(project, true);
|
||||||
.getProjectDescription(project, true);
|
ICConfigurationDescription cfgDescriptionWritable = prjDescriptionWritable.getActiveConfiguration();
|
||||||
ICConfigurationDescription cfgDescriptionWritable = prjDescriptionWritable
|
|
||||||
.getActiveConfiguration();
|
|
||||||
// create and set sample environment variable in the configuration
|
// create and set sample environment variable in the configuration
|
||||||
IEnvironmentVariableManager envManager = CCorePlugin.getDefault().getBuildEnvironmentManager();
|
IEnvironmentVariableManager envManager = CCorePlugin.getDefault().getBuildEnvironmentManager();
|
||||||
IContributedEnvironment contribEnv = envManager.getContributedEnvironment();
|
IContributedEnvironment contribEnv = envManager.getContributedEnvironment();
|
||||||
|
@ -679,10 +635,8 @@ public class BuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
|
|
||||||
// Set an environment variable to the configuration
|
// Set an environment variable to the configuration
|
||||||
{
|
{
|
||||||
ICProjectDescription prjDescriptionWritable = CoreModel.getDefault()
|
ICProjectDescription prjDescriptionWritable = CoreModel.getDefault().getProjectDescription(project, true);
|
||||||
.getProjectDescription(project, true);
|
ICConfigurationDescription cfgDescriptionWritable = prjDescriptionWritable.getActiveConfiguration();
|
||||||
ICConfigurationDescription cfgDescriptionWritable = prjDescriptionWritable
|
|
||||||
.getActiveConfiguration();
|
|
||||||
// create and set sample environment variable in the configuration
|
// create and set sample environment variable in the configuration
|
||||||
IEnvironmentVariableManager envManager = CCorePlugin.getDefault().getBuildEnvironmentManager();
|
IEnvironmentVariableManager envManager = CCorePlugin.getDefault().getBuildEnvironmentManager();
|
||||||
IContributedEnvironment contribEnv = envManager.getContributedEnvironment();
|
IContributedEnvironment contribEnv = envManager.getContributedEnvironment();
|
||||||
|
@ -713,16 +667,13 @@ public class BuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
|
|
||||||
// Assign a provider to configuration
|
// Assign a provider to configuration
|
||||||
{
|
{
|
||||||
ICProjectDescription prjDescriptionWritable = CoreModel.getDefault()
|
ICProjectDescription prjDescriptionWritable = CoreModel.getDefault().getProjectDescription(project, true);
|
||||||
.getProjectDescription(project, true);
|
ICConfigurationDescription cfgDescriptionWritable = prjDescriptionWritable.getActiveConfiguration();
|
||||||
ICConfigurationDescription cfgDescriptionWritable = prjDescriptionWritable
|
|
||||||
.getActiveConfiguration();
|
|
||||||
// Create provider
|
// Create provider
|
||||||
MockBuiltinSpecsDetectorEnvironmentChangeListener provider = new MockBuiltinSpecsDetectorEnvironmentChangeListener();
|
MockBuiltinSpecsDetectorEnvironmentChangeListener provider = new MockBuiltinSpecsDetectorEnvironmentChangeListener();
|
||||||
List<ILanguageSettingsProvider> providers = new ArrayList<ILanguageSettingsProvider>();
|
List<ILanguageSettingsProvider> providers = new ArrayList<ILanguageSettingsProvider>();
|
||||||
providers.add(provider);
|
providers.add(provider);
|
||||||
((ILanguageSettingsProvidersKeeper) cfgDescriptionWritable)
|
((ILanguageSettingsProvidersKeeper) cfgDescriptionWritable).setLanguageSettingProviders(providers);
|
||||||
.setLanguageSettingProviders(providers);
|
|
||||||
// Write to project description
|
// Write to project description
|
||||||
CProjectDescriptionManager.getInstance().setProjectDescription(project, prjDescriptionWritable);
|
CProjectDescriptionManager.getInstance().setProjectDescription(project, prjDescriptionWritable);
|
||||||
|
|
||||||
|
@ -734,10 +685,8 @@ public class BuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
|
|
||||||
// Set environment variable to the configuration
|
// Set environment variable to the configuration
|
||||||
{
|
{
|
||||||
ICProjectDescription prjDescriptionWritable = CoreModel.getDefault()
|
ICProjectDescription prjDescriptionWritable = CoreModel.getDefault().getProjectDescription(project, true);
|
||||||
.getProjectDescription(project, true);
|
ICConfigurationDescription cfgDescriptionWritable = prjDescriptionWritable.getActiveConfiguration();
|
||||||
ICConfigurationDescription cfgDescriptionWritable = prjDescriptionWritable
|
|
||||||
.getActiveConfiguration();
|
|
||||||
IEnvironmentVariableManager envManager = CCorePlugin.getDefault().getBuildEnvironmentManager();
|
IEnvironmentVariableManager envManager = CCorePlugin.getDefault().getBuildEnvironmentManager();
|
||||||
IContributedEnvironment contribEnv = envManager.getContributedEnvironment();
|
IContributedEnvironment contribEnv = envManager.getContributedEnvironment();
|
||||||
|
|
||||||
|
@ -746,10 +695,8 @@ public class BuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
contribEnv.addVariable(var, cfgDescriptionWritable);
|
contribEnv.addVariable(var, cfgDescriptionWritable);
|
||||||
assertEquals(var, envManager.getVariable(ENV_SAMPLE, cfgDescriptionWritable, true));
|
assertEquals(var, envManager.getVariable(ENV_SAMPLE, cfgDescriptionWritable, true));
|
||||||
|
|
||||||
List<ILanguageSettingsProvider> providers = ((ILanguageSettingsProvidersKeeper) cfgDescriptionWritable)
|
List<ILanguageSettingsProvider> providers = ((ILanguageSettingsProvidersKeeper) cfgDescriptionWritable).getLanguageSettingProviders();
|
||||||
.getLanguageSettingProviders();
|
MockBuiltinSpecsDetectorEnvironmentChangeListener provider = (MockBuiltinSpecsDetectorEnvironmentChangeListener) providers.get(0);
|
||||||
MockBuiltinSpecsDetectorEnvironmentChangeListener provider = (MockBuiltinSpecsDetectorEnvironmentChangeListener) providers
|
|
||||||
.get(0);
|
|
||||||
// unset "isExecuted" flag
|
// unset "isExecuted" flag
|
||||||
provider.clear();
|
provider.clear();
|
||||||
assertEquals(false, provider.isExecuted());
|
assertEquals(false, provider.isExecuted());
|
||||||
|
@ -763,8 +710,7 @@ public class BuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
// Check if the provider got executed
|
// Check if the provider got executed
|
||||||
{
|
{
|
||||||
// check if environment variable got there
|
// check if environment variable got there
|
||||||
ICProjectDescription prjDescription = CoreModel.getDefault().getProjectDescription(project,
|
ICProjectDescription prjDescription = CoreModel.getDefault().getProjectDescription(project, false);
|
||||||
false);
|
|
||||||
ICConfigurationDescription cfgDescription = prjDescription.getActiveConfiguration();
|
ICConfigurationDescription cfgDescription = prjDescription.getActiveConfiguration();
|
||||||
IEnvironmentVariableManager envManager = CCorePlugin.getDefault().getBuildEnvironmentManager();
|
IEnvironmentVariableManager envManager = CCorePlugin.getDefault().getBuildEnvironmentManager();
|
||||||
IEnvironmentVariable var = envManager.getVariable(ENV_SAMPLE, cfgDescription, true);
|
IEnvironmentVariable var = envManager.getVariable(ENV_SAMPLE, cfgDescription, true);
|
||||||
|
@ -772,10 +718,8 @@ public class BuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
assertEquals(ENV_SAMPLE_VALUE_1, var.getValue());
|
assertEquals(ENV_SAMPLE_VALUE_1, var.getValue());
|
||||||
|
|
||||||
// check if provider got executed with new value
|
// check if provider got executed with new value
|
||||||
List<ILanguageSettingsProvider> providers = ((ILanguageSettingsProvidersKeeper) cfgDescription)
|
List<ILanguageSettingsProvider> providers = ((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders();
|
||||||
.getLanguageSettingProviders();
|
MockBuiltinSpecsDetectorEnvironmentChangeListener provider = (MockBuiltinSpecsDetectorEnvironmentChangeListener) providers.get(0);
|
||||||
MockBuiltinSpecsDetectorEnvironmentChangeListener provider = (MockBuiltinSpecsDetectorEnvironmentChangeListener) providers
|
|
||||||
.get(0);
|
|
||||||
assertEquals(true, provider.isExecuted());
|
assertEquals(true, provider.isExecuted());
|
||||||
assertEquals(ENV_SAMPLE_VALUE_1, provider.getSampleEnvVar());
|
assertEquals(ENV_SAMPLE_VALUE_1, provider.getSampleEnvVar());
|
||||||
}
|
}
|
||||||
|
@ -783,10 +727,8 @@ public class BuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
// Repeat one more time with different value of environment variable
|
// Repeat one more time with different value of environment variable
|
||||||
// Set another environment variable to the configuration
|
// Set another environment variable to the configuration
|
||||||
{
|
{
|
||||||
ICProjectDescription prjDescriptionWritable = CoreModel.getDefault()
|
ICProjectDescription prjDescriptionWritable = CoreModel.getDefault().getProjectDescription(project, true);
|
||||||
.getProjectDescription(project, true);
|
ICConfigurationDescription cfgDescriptionWritable = prjDescriptionWritable.getActiveConfiguration();
|
||||||
ICConfigurationDescription cfgDescriptionWritable = prjDescriptionWritable
|
|
||||||
.getActiveConfiguration();
|
|
||||||
IEnvironmentVariableManager envManager = CCorePlugin.getDefault().getBuildEnvironmentManager();
|
IEnvironmentVariableManager envManager = CCorePlugin.getDefault().getBuildEnvironmentManager();
|
||||||
IContributedEnvironment contribEnv = envManager.getContributedEnvironment();
|
IContributedEnvironment contribEnv = envManager.getContributedEnvironment();
|
||||||
|
|
||||||
|
@ -795,10 +737,8 @@ public class BuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
contribEnv.addVariable(var, cfgDescriptionWritable);
|
contribEnv.addVariable(var, cfgDescriptionWritable);
|
||||||
assertEquals(var, envManager.getVariable(ENV_SAMPLE, cfgDescriptionWritable, true));
|
assertEquals(var, envManager.getVariable(ENV_SAMPLE, cfgDescriptionWritable, true));
|
||||||
|
|
||||||
List<ILanguageSettingsProvider> providers = ((ILanguageSettingsProvidersKeeper) cfgDescriptionWritable)
|
List<ILanguageSettingsProvider> providers = ((ILanguageSettingsProvidersKeeper) cfgDescriptionWritable).getLanguageSettingProviders();
|
||||||
.getLanguageSettingProviders();
|
MockBuiltinSpecsDetectorEnvironmentChangeListener provider = (MockBuiltinSpecsDetectorEnvironmentChangeListener) providers.get(0);
|
||||||
MockBuiltinSpecsDetectorEnvironmentChangeListener provider = (MockBuiltinSpecsDetectorEnvironmentChangeListener) providers
|
|
||||||
.get(0);
|
|
||||||
// unset "isExecuted" flag
|
// unset "isExecuted" flag
|
||||||
provider.clear();
|
provider.clear();
|
||||||
assertEquals(false, provider.isExecuted());
|
assertEquals(false, provider.isExecuted());
|
||||||
|
@ -812,8 +752,7 @@ public class BuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
// Check if the provider got executed
|
// Check if the provider got executed
|
||||||
{
|
{
|
||||||
// check if environment variable got there
|
// check if environment variable got there
|
||||||
ICProjectDescription prjDescription = CoreModel.getDefault().getProjectDescription(project,
|
ICProjectDescription prjDescription = CoreModel.getDefault().getProjectDescription(project, false);
|
||||||
false);
|
|
||||||
ICConfigurationDescription cfgDescription = prjDescription.getActiveConfiguration();
|
ICConfigurationDescription cfgDescription = prjDescription.getActiveConfiguration();
|
||||||
IEnvironmentVariableManager envManager = CCorePlugin.getDefault().getBuildEnvironmentManager();
|
IEnvironmentVariableManager envManager = CCorePlugin.getDefault().getBuildEnvironmentManager();
|
||||||
IEnvironmentVariable var = envManager.getVariable(ENV_SAMPLE, cfgDescription, true);
|
IEnvironmentVariable var = envManager.getVariable(ENV_SAMPLE, cfgDescription, true);
|
||||||
|
@ -821,10 +760,8 @@ public class BuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
assertEquals(ENV_SAMPLE_VALUE_2, var.getValue());
|
assertEquals(ENV_SAMPLE_VALUE_2, var.getValue());
|
||||||
|
|
||||||
// check if provider got executed with new value
|
// check if provider got executed with new value
|
||||||
List<ILanguageSettingsProvider> providers = ((ILanguageSettingsProvidersKeeper) cfgDescription)
|
List<ILanguageSettingsProvider> providers = ((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders();
|
||||||
.getLanguageSettingProviders();
|
MockBuiltinSpecsDetectorEnvironmentChangeListener provider = (MockBuiltinSpecsDetectorEnvironmentChangeListener) providers.get(0);
|
||||||
MockBuiltinSpecsDetectorEnvironmentChangeListener provider = (MockBuiltinSpecsDetectorEnvironmentChangeListener) providers
|
|
||||||
.get(0);
|
|
||||||
assertEquals(true, provider.isExecuted());
|
assertEquals(true, provider.isExecuted());
|
||||||
assertEquals(ENV_SAMPLE_VALUE_2, provider.getSampleEnvVar());
|
assertEquals(ENV_SAMPLE_VALUE_2, provider.getSampleEnvVar());
|
||||||
}
|
}
|
||||||
|
@ -906,6 +843,7 @@ public class BuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
long lastModifiedUpdated = compiler.lastModified();
|
long lastModifiedUpdated = compiler.lastModified();
|
||||||
assertTrue(lastModifiedUpdated != lastModified);
|
assertTrue(lastModifiedUpdated != lastModified);
|
||||||
|
|
||||||
|
|
||||||
// Check that an event triggers rerun after upgrade
|
// Check that an event triggers rerun after upgrade
|
||||||
provider.handleEvent(null);
|
provider.handleEvent(null);
|
||||||
waitForProviderToFinish();
|
waitForProviderToFinish();
|
||||||
|
@ -1002,30 +940,18 @@ public class BuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
*/
|
*/
|
||||||
public void testAbstractBuiltinSpecsDetector_GroupSettings() throws Exception {
|
public void testAbstractBuiltinSpecsDetector_GroupSettings() throws Exception {
|
||||||
// define benchmarks
|
// define benchmarks
|
||||||
final CIncludePathEntry includePath_1 = new CIncludePathEntry("/include/path_1",
|
final CIncludePathEntry includePath_1 = new CIncludePathEntry("/include/path_1", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY);
|
||||||
ICSettingEntry.BUILTIN | ICSettingEntry.READONLY);
|
final CIncludePathEntry includePath_2 = new CIncludePathEntry("/include/path_2", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY);
|
||||||
final CIncludePathEntry includePath_2 = new CIncludePathEntry("/include/path_2",
|
final CIncludeFileEntry includeFile_1 = new CIncludeFileEntry(new Path("/include.file1"), ICSettingEntry.BUILTIN | ICSettingEntry.READONLY);
|
||||||
ICSettingEntry.BUILTIN | ICSettingEntry.READONLY);
|
final CIncludeFileEntry includeFile_2 = new CIncludeFileEntry(new Path("/include.file2"), ICSettingEntry.BUILTIN | ICSettingEntry.READONLY);
|
||||||
final CIncludeFileEntry includeFile_1 = new CIncludeFileEntry(new Path("/include.file1"),
|
final CMacroEntry macro_1 = new CMacroEntry("MACRO_1", "", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY);
|
||||||
ICSettingEntry.BUILTIN | ICSettingEntry.READONLY);
|
final CMacroEntry macro_2 = new CMacroEntry("MACRO_2", "", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY |ICSettingEntry.UNDEFINED);
|
||||||
final CIncludeFileEntry includeFile_2 = new CIncludeFileEntry(new Path("/include.file2"),
|
final CMacroFileEntry macroFile_1 = new CMacroFileEntry(new Path("/macro.file1"), ICSettingEntry.BUILTIN | ICSettingEntry.READONLY);
|
||||||
ICSettingEntry.BUILTIN | ICSettingEntry.READONLY);
|
final CMacroFileEntry macroFile_2 = new CMacroFileEntry(new Path("/macro.file2"), ICSettingEntry.BUILTIN | ICSettingEntry.READONLY);
|
||||||
final CMacroEntry macro_1 = new CMacroEntry("MACRO_1", "",
|
final CLibraryPathEntry libraryPath_1 = new CLibraryPathEntry(new Path("/lib/path_1"), ICSettingEntry.BUILTIN | ICSettingEntry.READONLY);
|
||||||
ICSettingEntry.BUILTIN | ICSettingEntry.READONLY);
|
final CLibraryPathEntry libraryPath_2 = new CLibraryPathEntry(new Path("/lib/path_2"), ICSettingEntry.BUILTIN | ICSettingEntry.READONLY);
|
||||||
final CMacroEntry macro_2 = new CMacroEntry("MACRO_2", "",
|
final CLibraryFileEntry libraryFile_1 = new CLibraryFileEntry("lib_1.a", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY);
|
||||||
ICSettingEntry.BUILTIN | ICSettingEntry.READONLY | ICSettingEntry.UNDEFINED);
|
final CLibraryFileEntry libraryFile_2 = new CLibraryFileEntry("lib_2.a", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY);
|
||||||
final CMacroFileEntry macroFile_1 = new CMacroFileEntry(new Path("/macro.file1"),
|
|
||||||
ICSettingEntry.BUILTIN | ICSettingEntry.READONLY);
|
|
||||||
final CMacroFileEntry macroFile_2 = new CMacroFileEntry(new Path("/macro.file2"),
|
|
||||||
ICSettingEntry.BUILTIN | ICSettingEntry.READONLY);
|
|
||||||
final CLibraryPathEntry libraryPath_1 = new CLibraryPathEntry(new Path("/lib/path_1"),
|
|
||||||
ICSettingEntry.BUILTIN | ICSettingEntry.READONLY);
|
|
||||||
final CLibraryPathEntry libraryPath_2 = new CLibraryPathEntry(new Path("/lib/path_2"),
|
|
||||||
ICSettingEntry.BUILTIN | ICSettingEntry.READONLY);
|
|
||||||
final CLibraryFileEntry libraryFile_1 = new CLibraryFileEntry("lib_1.a",
|
|
||||||
ICSettingEntry.BUILTIN | ICSettingEntry.READONLY);
|
|
||||||
final CLibraryFileEntry libraryFile_2 = new CLibraryFileEntry("lib_2.a",
|
|
||||||
ICSettingEntry.BUILTIN | ICSettingEntry.READONLY);
|
|
||||||
|
|
||||||
// Define mock detector adding unorganized entries
|
// Define mock detector adding unorganized entries
|
||||||
MockBuiltinSpecsDetector provider = new MockBuiltinSpecsDetector() {
|
MockBuiltinSpecsDetector provider = new MockBuiltinSpecsDetector() {
|
||||||
|
@ -1056,7 +982,7 @@ public class BuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
provider.shutdown();
|
provider.shutdown();
|
||||||
|
|
||||||
// compare benchmarks, expected well-sorted
|
// compare benchmarks, expected well-sorted
|
||||||
List<ICLanguageSettingEntry> entries = provider.getSettingEntries((IBuildConfiguration) null, null, null);
|
List<ICLanguageSettingEntry> entries = provider.getSettingEntries(null, null, null);
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
assertEquals(includePath_1, entries.get(i++));
|
assertEquals(includePath_1, entries.get(i++));
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -36,7 +36,6 @@ import org.eclipse.cdt.managedbuilder.internal.language.settings.providers.GCCBu
|
||||||
import org.eclipse.cdt.managedbuilder.language.settings.providers.AbstractBuiltinSpecsDetector;
|
import org.eclipse.cdt.managedbuilder.language.settings.providers.AbstractBuiltinSpecsDetector;
|
||||||
import org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector;
|
import org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector;
|
||||||
import org.eclipse.cdt.managedbuilder.testplugin.ManagedBuildTestHelper;
|
import org.eclipse.cdt.managedbuilder.testplugin.ManagedBuildTestHelper;
|
||||||
import org.eclipse.core.resources.IBuildConfiguration;
|
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
@ -198,7 +197,7 @@ public class GCCBuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
detector.shutdownForLanguage();
|
detector.shutdownForLanguage();
|
||||||
detector.shutdown();
|
detector.shutdown();
|
||||||
|
|
||||||
List<ICLanguageSettingEntry> entries = detector.getSettingEntries((IBuildConfiguration) null, null, null);
|
List<ICLanguageSettingEntry> entries = detector.getSettingEntries(null, null, null);
|
||||||
assertEquals(new CMacroEntry("MACRO", null, ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(0));
|
assertEquals(new CMacroEntry("MACRO", null, ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(0));
|
||||||
assertEquals(1, entries.size());
|
assertEquals(1, entries.size());
|
||||||
}
|
}
|
||||||
|
@ -215,7 +214,7 @@ public class GCCBuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
detector.shutdownForLanguage();
|
detector.shutdownForLanguage();
|
||||||
detector.shutdown();
|
detector.shutdown();
|
||||||
|
|
||||||
List<ICLanguageSettingEntry> entries = detector.getSettingEntries((IBuildConfiguration) null, null, null);
|
List<ICLanguageSettingEntry> entries = detector.getSettingEntries(null, null, null);
|
||||||
assertEquals(new CMacroEntry("MACRO", "VALUE", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(0));
|
assertEquals(new CMacroEntry("MACRO", "VALUE", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(0));
|
||||||
assertEquals(1, entries.size());
|
assertEquals(1, entries.size());
|
||||||
}
|
}
|
||||||
|
@ -232,7 +231,7 @@ public class GCCBuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
detector.shutdownForLanguage();
|
detector.shutdownForLanguage();
|
||||||
detector.shutdown();
|
detector.shutdown();
|
||||||
|
|
||||||
List<ICLanguageSettingEntry> entries = detector.getSettingEntries((IBuildConfiguration) null, null, null);
|
List<ICLanguageSettingEntry> entries = detector.getSettingEntries(null, null, null);
|
||||||
assertEquals(new CMacroEntry("MACRO", "(3)", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(0));
|
assertEquals(new CMacroEntry("MACRO", "(3)", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(0));
|
||||||
assertEquals(1, entries.size());
|
assertEquals(1, entries.size());
|
||||||
}
|
}
|
||||||
|
@ -252,7 +251,7 @@ public class GCCBuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
detector.shutdownForLanguage();
|
detector.shutdownForLanguage();
|
||||||
detector.shutdown();
|
detector.shutdown();
|
||||||
|
|
||||||
List<ICLanguageSettingEntry> entries = detector.getSettingEntries((IBuildConfiguration) null, null, null);
|
List<ICLanguageSettingEntry> entries = detector.getSettingEntries(null, null, null);
|
||||||
int index = 0;
|
int index = 0;
|
||||||
assertEquals(new CMacroEntry("MACRO_1", "VALUE", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(index++));
|
assertEquals(new CMacroEntry("MACRO_1", "VALUE", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(index++));
|
||||||
assertEquals(new CMacroEntry("MACRO_2", "VALUE", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(index++));
|
assertEquals(new CMacroEntry("MACRO_2", "VALUE", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(index++));
|
||||||
|
@ -273,7 +272,7 @@ public class GCCBuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
detector.shutdownForLanguage();
|
detector.shutdownForLanguage();
|
||||||
detector.shutdown();
|
detector.shutdown();
|
||||||
|
|
||||||
List<ICLanguageSettingEntry> entries = detector.getSettingEntries((IBuildConfiguration) null, null, null);
|
List<ICLanguageSettingEntry> entries = detector.getSettingEntries(null, null, null);
|
||||||
assertEquals(new CMacroEntry("MACRO()", "VALUE", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(0));
|
assertEquals(new CMacroEntry("MACRO()", "VALUE", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(0));
|
||||||
assertEquals(1, entries.size());
|
assertEquals(1, entries.size());
|
||||||
}
|
}
|
||||||
|
@ -290,7 +289,7 @@ public class GCCBuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
detector.shutdownForLanguage();
|
detector.shutdownForLanguage();
|
||||||
detector.shutdown();
|
detector.shutdown();
|
||||||
|
|
||||||
List<ICLanguageSettingEntry> entries = detector.getSettingEntries((IBuildConfiguration) null, null, null);
|
List<ICLanguageSettingEntry> entries = detector.getSettingEntries(null, null, null);
|
||||||
assertEquals(new CMacroEntry("MACRO(X)", "VALUE", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(0));
|
assertEquals(new CMacroEntry("MACRO(X)", "VALUE", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(0));
|
||||||
assertEquals(1, entries.size());
|
assertEquals(1, entries.size());
|
||||||
}
|
}
|
||||||
|
@ -307,7 +306,7 @@ public class GCCBuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
detector.shutdownForLanguage();
|
detector.shutdownForLanguage();
|
||||||
detector.shutdown();
|
detector.shutdown();
|
||||||
|
|
||||||
List<ICLanguageSettingEntry> entries = detector.getSettingEntries((IBuildConfiguration) null, null, null);
|
List<ICLanguageSettingEntry> entries = detector.getSettingEntries(null, null, null);
|
||||||
assertEquals(new CMacroEntry("MACRO(P1, P2)", "VALUE(P1, P2)", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(0));
|
assertEquals(new CMacroEntry("MACRO(P1, P2)", "VALUE(P1, P2)", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(0));
|
||||||
assertEquals(1, entries.size());
|
assertEquals(1, entries.size());
|
||||||
}
|
}
|
||||||
|
@ -324,7 +323,7 @@ public class GCCBuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
detector.shutdownForLanguage();
|
detector.shutdownForLanguage();
|
||||||
detector.shutdown();
|
detector.shutdown();
|
||||||
|
|
||||||
List<ICLanguageSettingEntry> entries = detector.getSettingEntries((IBuildConfiguration) null, null, null);
|
List<ICLanguageSettingEntry> entries = detector.getSettingEntries(null, null, null);
|
||||||
assertEquals(new CMacroEntry("MACRO(P1, P2)", null, ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(0));
|
assertEquals(new CMacroEntry("MACRO(P1, P2)", null, ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(0));
|
||||||
assertEquals(1, entries.size());
|
assertEquals(1, entries.size());
|
||||||
}
|
}
|
||||||
|
@ -343,7 +342,7 @@ public class GCCBuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
detector.shutdownForLanguage();
|
detector.shutdownForLanguage();
|
||||||
detector.shutdown();
|
detector.shutdown();
|
||||||
|
|
||||||
List<ICLanguageSettingEntry> entries = detector.getSettingEntries((IBuildConfiguration) null, null, null);
|
List<ICLanguageSettingEntry> entries = detector.getSettingEntries(null, null, null);
|
||||||
int index = 0;
|
int index = 0;
|
||||||
assertEquals(new CMacroEntry("MACRO_1(P1, P2)", "VALUE(P1, P2)", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(index++));
|
assertEquals(new CMacroEntry("MACRO_1(P1, P2)", "VALUE(P1, P2)", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(index++));
|
||||||
assertEquals(new CMacroEntry("MACRO_2(P1, P2)", "VALUE(P1, P2)", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(index++));
|
assertEquals(new CMacroEntry("MACRO_2(P1, P2)", "VALUE(P1, P2)", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(index++));
|
||||||
|
@ -390,7 +389,7 @@ public class GCCBuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
detector.shutdownForLanguage();
|
detector.shutdownForLanguage();
|
||||||
detector.shutdown();
|
detector.shutdown();
|
||||||
|
|
||||||
List<ICLanguageSettingEntry> entries = detector.getSettingEntries((IBuildConfiguration) null, null, null);
|
List<ICLanguageSettingEntry> entries = detector.getSettingEntries(null, null, null);
|
||||||
int index = 0;
|
int index = 0;
|
||||||
assertEquals(new CIncludePathEntry(loc+"/local/include", ICSettingEntry.LOCAL | ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(index++));
|
assertEquals(new CIncludePathEntry(loc+"/local/include", ICSettingEntry.LOCAL | ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(index++));
|
||||||
assertEquals(new CIncludePathEntry(loc+"/usr/include", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(index++));
|
assertEquals(new CIncludePathEntry(loc+"/usr/include", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(index++));
|
||||||
|
@ -423,7 +422,7 @@ public class GCCBuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
detector.shutdownForLanguage();
|
detector.shutdownForLanguage();
|
||||||
detector.shutdown();
|
detector.shutdown();
|
||||||
|
|
||||||
List<ICLanguageSettingEntry> entries = detector.getSettingEntries((IBuildConfiguration) null, null, null);
|
List<ICLanguageSettingEntry> entries = detector.getSettingEntries(null, null, null);
|
||||||
int index = 0;
|
int index = 0;
|
||||||
assertEquals(new CIncludePathEntry(loc+"/local/include", ICSettingEntry.LOCAL | ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(index++));
|
assertEquals(new CIncludePathEntry(loc+"/local/include", ICSettingEntry.LOCAL | ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(index++));
|
||||||
assertEquals(new CIncludePathEntry(loc+"/usr/include", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(index++));
|
assertEquals(new CIncludePathEntry(loc+"/usr/include", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(index++));
|
||||||
|
@ -462,7 +461,7 @@ public class GCCBuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
detector.shutdown();
|
detector.shutdown();
|
||||||
|
|
||||||
// check populated entries
|
// check populated entries
|
||||||
List<ICLanguageSettingEntry> entries = detector.getSettingEntries((IBuildConfiguration) null, null, null);
|
List<ICLanguageSettingEntry> entries = detector.getSettingEntries(null, null, null);
|
||||||
assertEquals(new CIncludePathEntry(dir2.removeLastSegments(1), ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(0));
|
assertEquals(new CIncludePathEntry(dir2.removeLastSegments(1), ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(0));
|
||||||
assertEquals(1, entries.size());
|
assertEquals(1, entries.size());
|
||||||
}
|
}
|
||||||
|
@ -492,7 +491,7 @@ public class GCCBuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
detector.shutdownForLanguage();
|
detector.shutdownForLanguage();
|
||||||
detector.shutdown();
|
detector.shutdown();
|
||||||
|
|
||||||
List<ICLanguageSettingEntry> entries = detector.getSettingEntries((IBuildConfiguration) null, null, null);
|
List<ICLanguageSettingEntry> entries = detector.getSettingEntries(null, null, null);
|
||||||
int index = 0;
|
int index = 0;
|
||||||
assertEquals(new CIncludePathEntry(loc+"/usr/include", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(index++));
|
assertEquals(new CIncludePathEntry(loc+"/usr/include", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(index++));
|
||||||
assertEquals(index, entries.size());
|
assertEquals(index, entries.size());
|
||||||
|
@ -521,7 +520,7 @@ public class GCCBuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
detector.shutdown();
|
detector.shutdown();
|
||||||
|
|
||||||
// check populated entries
|
// check populated entries
|
||||||
List<ICLanguageSettingEntry> entries = detector.getSettingEntries((IBuildConfiguration) null, null, null);
|
List<ICLanguageSettingEntry> entries = detector.getSettingEntries(null, null, null);
|
||||||
assertEquals(new CIncludePathEntry(new Path(windowsLocation), ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(0));
|
assertEquals(new CIncludePathEntry(new Path(windowsLocation), ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(0));
|
||||||
assertEquals(1, entries.size());
|
assertEquals(1, entries.size());
|
||||||
}
|
}
|
||||||
|
@ -556,7 +555,7 @@ public class GCCBuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
detector.shutdown();
|
detector.shutdown();
|
||||||
|
|
||||||
// check populated entries
|
// check populated entries
|
||||||
List<ICLanguageSettingEntry> entries = detector.getSettingEntries((IBuildConfiguration) null, null, null);
|
List<ICLanguageSettingEntry> entries = detector.getSettingEntries(null, null, null);
|
||||||
assertEquals(new CIncludePathEntry(new Path(windowsLocation), ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(0));
|
assertEquals(new CIncludePathEntry(new Path(windowsLocation), ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(0));
|
||||||
assertEquals(1, entries.size());
|
assertEquals(1, entries.size());
|
||||||
}
|
}
|
||||||
|
@ -581,7 +580,7 @@ public class GCCBuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
ICConfigurationDescription[] cfgDescriptions = prjDescriptionWritable.getConfigurations();
|
ICConfigurationDescription[] cfgDescriptions = prjDescriptionWritable.getConfigurations();
|
||||||
assertTrue(cfgDescriptions.length > 0);
|
assertTrue(cfgDescriptions.length > 0);
|
||||||
ICConfigurationDescription cfgDescription = cfgDescriptions[0];
|
ICConfigurationDescription cfgDescription = cfgDescriptions[0];
|
||||||
List<ILanguageSettingsProvider> providers = new ArrayList<>();
|
List<ILanguageSettingsProvider> providers = new ArrayList<ILanguageSettingsProvider>();
|
||||||
providers.add(detector);
|
providers.add(detector);
|
||||||
((ILanguageSettingsProvidersKeeper) cfgDescription).setLanguageSettingProviders(providers);
|
((ILanguageSettingsProvidersKeeper) cfgDescription).setLanguageSettingProviders(providers);
|
||||||
// change the default command in all the tools of the toolchain
|
// change the default command in all the tools of the toolchain
|
||||||
|
|
|
@ -25,7 +25,6 @@ import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||||
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
|
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
|
||||||
import org.eclipse.cdt.internal.core.language.settings.providers.ReferencedProjectsLanguageSettingsProvider;
|
import org.eclipse.cdt.internal.core.language.settings.providers.ReferencedProjectsLanguageSettingsProvider;
|
||||||
import org.eclipse.cdt.managedbuilder.testplugin.ManagedBuildTestHelper;
|
import org.eclipse.cdt.managedbuilder.testplugin.ManagedBuildTestHelper;
|
||||||
import org.eclipse.core.resources.IBuildConfiguration;
|
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
|
|
||||||
|
@ -56,11 +55,9 @@ public class LanguageSettingsProvidersMBSTest extends BaseTestCase {
|
||||||
* Test that null arguments don't crash the provider.
|
* Test that null arguments don't crash the provider.
|
||||||
*/
|
*/
|
||||||
public void testNulls() throws Exception {
|
public void testNulls() throws Exception {
|
||||||
ILanguageSettingsProvider provider = LanguageSettingsManager
|
ILanguageSettingsProvider provider = LanguageSettingsManager.getWorkspaceProvider(MBS_LANGUAGE_SETTINGS_PROVIDER_ID);
|
||||||
.getWorkspaceProvider(MBS_LANGUAGE_SETTINGS_PROVIDER_ID);
|
|
||||||
assertNotNull(provider);
|
assertNotNull(provider);
|
||||||
List<ICLanguageSettingEntry> entries = provider.getSettingEntries((IBuildConfiguration) null, null,
|
List<ICLanguageSettingEntry> entries = provider.getSettingEntries(null, null, null);
|
||||||
null);
|
|
||||||
assertEquals(null, entries);
|
assertEquals(null, entries);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,8 +76,7 @@ public class LanguageSettingsProvidersMBSTest extends BaseTestCase {
|
||||||
assertNotNull(cfgDescription);
|
assertNotNull(cfgDescription);
|
||||||
assertTrue(cfgDescription instanceof ILanguageSettingsProvidersKeeper);
|
assertTrue(cfgDescription instanceof ILanguageSettingsProvidersKeeper);
|
||||||
|
|
||||||
List<ILanguageSettingsProvider> providers = ((ILanguageSettingsProvidersKeeper) cfgDescription)
|
List<ILanguageSettingsProvider> providers = ((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders();
|
||||||
.getLanguageSettingProviders();
|
|
||||||
{
|
{
|
||||||
ILanguageSettingsProvider provider = providers.get(0);
|
ILanguageSettingsProvider provider = providers.get(0);
|
||||||
String id = provider.getId();
|
String id = provider.getId();
|
||||||
|
@ -114,8 +110,8 @@ public class LanguageSettingsProvidersMBSTest extends BaseTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test that no unnecessary storage file is created for language settings for default set of language
|
* Test that no unnecessary storage file is created for language settings for default set
|
||||||
* settings providers.
|
* of language settings providers.
|
||||||
*/
|
*/
|
||||||
public void testProjectPersistence_Defaults() throws Exception {
|
public void testProjectPersistence_Defaults() throws Exception {
|
||||||
// create a new project
|
// create a new project
|
||||||
|
@ -129,10 +125,8 @@ public class LanguageSettingsProvidersMBSTest extends BaseTestCase {
|
||||||
assertNotNull(cfgDescription);
|
assertNotNull(cfgDescription);
|
||||||
assertTrue(cfgDescription instanceof ILanguageSettingsProvidersKeeper);
|
assertTrue(cfgDescription instanceof ILanguageSettingsProvidersKeeper);
|
||||||
|
|
||||||
String[] defaultIds = ((ILanguageSettingsProvidersKeeper) cfgDescription)
|
String[] defaultIds = ((ILanguageSettingsProvidersKeeper) cfgDescription).getDefaultLanguageSettingsProvidersIds();
|
||||||
.getDefaultLanguageSettingsProvidersIds();
|
List<ILanguageSettingsProvider> providers = ((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders();
|
||||||
List<ILanguageSettingsProvider> providers = ((ILanguageSettingsProvidersKeeper) cfgDescription)
|
|
||||||
.getLanguageSettingProviders();
|
|
||||||
assertEquals(defaultIds.length, providers.size());
|
assertEquals(defaultIds.length, providers.size());
|
||||||
for (int i = 0; i < defaultIds.length; i++) {
|
for (int i = 0; i < defaultIds.length; i++) {
|
||||||
assertEquals(providers.get(i).getId(), defaultIds[i]);
|
assertEquals(providers.get(i).getId(), defaultIds[i]);
|
||||||
|
@ -146,8 +140,7 @@ public class LanguageSettingsProvidersMBSTest extends BaseTestCase {
|
||||||
assertEquals(false, xmlStorageFile.getParent().exists()); // .settings folder
|
assertEquals(false, xmlStorageFile.getParent().exists()); // .settings folder
|
||||||
|
|
||||||
// no settings file in workspace area
|
// no settings file in workspace area
|
||||||
String xmlPrjWspStorageFileLocation = LanguageSettingsPersistenceProjectTests
|
String xmlPrjWspStorageFileLocation = LanguageSettingsPersistenceProjectTests.getStoreLocationInWorkspaceArea(project.getName()+'.'+LANGUAGE_SETTINGS_WORKSPACE_XML);
|
||||||
.getStoreLocationInWorkspaceArea(project.getName() + '.' + LANGUAGE_SETTINGS_WORKSPACE_XML);
|
|
||||||
java.io.File xmlStorageFilePrjWsp = new java.io.File(xmlPrjWspStorageFileLocation);
|
java.io.File xmlStorageFilePrjWsp = new java.io.File(xmlPrjWspStorageFileLocation);
|
||||||
assertEquals(false, xmlStorageFilePrjWsp.exists());
|
assertEquals(false, xmlStorageFilePrjWsp.exists());
|
||||||
}
|
}
|
||||||
|
@ -167,10 +160,8 @@ public class LanguageSettingsProvidersMBSTest extends BaseTestCase {
|
||||||
assertNotNull(cfgDescription);
|
assertNotNull(cfgDescription);
|
||||||
assertTrue(cfgDescription instanceof ILanguageSettingsProvidersKeeper);
|
assertTrue(cfgDescription instanceof ILanguageSettingsProvidersKeeper);
|
||||||
|
|
||||||
((ILanguageSettingsProvidersKeeper) cfgDescription)
|
((ILanguageSettingsProvidersKeeper) cfgDescription).setLanguageSettingProviders(new ArrayList<ILanguageSettingsProvider>());
|
||||||
.setLanguageSettingProviders(new ArrayList<ILanguageSettingsProvider>());
|
assertTrue(((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders().size() == 0);
|
||||||
assertTrue(((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders()
|
|
||||||
.size() == 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CoreModel.getDefault().setProjectDescription(project, prjDescription);
|
CoreModel.getDefault().setProjectDescription(project, prjDescription);
|
||||||
|
@ -180,8 +171,7 @@ public class LanguageSettingsProvidersMBSTest extends BaseTestCase {
|
||||||
assertEquals(true, xmlStorageFile.exists());
|
assertEquals(true, xmlStorageFile.exists());
|
||||||
|
|
||||||
// no settings file in workspace area
|
// no settings file in workspace area
|
||||||
String xmlPrjWspStorageFileLocation = LanguageSettingsPersistenceProjectTests
|
String xmlPrjWspStorageFileLocation = LanguageSettingsPersistenceProjectTests.getStoreLocationInWorkspaceArea(project.getName()+'.'+LANGUAGE_SETTINGS_WORKSPACE_XML);
|
||||||
.getStoreLocationInWorkspaceArea(project.getName() + '.' + LANGUAGE_SETTINGS_WORKSPACE_XML);
|
|
||||||
java.io.File xmlStorageFilePrjWsp = new java.io.File(xmlPrjWspStorageFileLocation);
|
java.io.File xmlStorageFilePrjWsp = new java.io.File(xmlPrjWspStorageFileLocation);
|
||||||
assertEquals(false, xmlStorageFilePrjWsp.exists());
|
assertEquals(false, xmlStorageFilePrjWsp.exists());
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#Thu Apr 29 13:15:20 EDT 2010
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
||||||
|
@ -80,6 +81,262 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
|
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
||||||
org.eclipse.jdt.core.compiler.source=1.7
|
org.eclipse.jdt.core.compiler.source=1.7
|
||||||
|
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_enum_constant=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
|
||||||
|
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=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
|
||||||
|
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_selector_in_method_invocation=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
|
||||||
|
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.blank_lines_after_imports=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_after_package=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_field=0
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_method=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_package=0
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=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.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.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.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.line_length=110
|
||||||
|
org.eclipse.jdt.core.formatter.compact_else_if=true
|
||||||
|
org.eclipse.jdt.core.formatter.continuation_indentation=2
|
||||||
|
org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
|
||||||
|
org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=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
|
||||||
|
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
|
||||||
|
org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
|
||||||
|
org.eclipse.jdt.core.formatter.indent_empty_lines=false
|
||||||
|
org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
|
||||||
|
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=insert
|
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=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_member=insert
|
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert
|
||||||
org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter
|
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
|
||||||
|
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_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
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.join_lines_in_comments=true
|
||||||
|
org.eclipse.jdt.core.formatter.join_wrapped_lines=true
|
||||||
|
org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
|
||||||
|
org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
|
||||||
|
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
|
||||||
|
org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
|
||||||
|
org.eclipse.jdt.core.formatter.lineSplit=110
|
||||||
|
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.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_tabs_only_for_leading_indentations=false
|
||||||
|
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
eclipse.preferences.version=1
|
|
||||||
formatter_settings_version=12
|
|
|
@ -31,7 +31,6 @@ import org.eclipse.cdt.core.settings.model.ICSettingBase;
|
||||||
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
||||||
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
|
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
|
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
|
||||||
import org.eclipse.core.resources.IBuildConfiguration;
|
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
@ -42,17 +41,10 @@ import org.eclipse.core.variables.VariablesPlugin;
|
||||||
/**
|
/**
|
||||||
* Implementation of language settings provider for CDT Managed Build System.
|
* Implementation of language settings provider for CDT Managed Build System.
|
||||||
*/
|
*/
|
||||||
public class MBSLanguageSettingsProvider extends AbstractExecutableExtensionBase
|
public class MBSLanguageSettingsProvider extends AbstractExecutableExtensionBase implements ILanguageSettingsBroadcastingProvider {
|
||||||
implements ILanguageSettingsBroadcastingProvider {
|
|
||||||
@Override
|
@Override
|
||||||
public List<ICLanguageSettingEntry> getSettingEntries(IBuildConfiguration config, IResource rc,
|
public List<ICLanguageSettingEntry> getSettingEntries(ICConfigurationDescription cfgDescription, IResource rc, String languageId) {
|
||||||
String languageId) {
|
if (cfgDescription == null || rc == null) {
|
||||||
if (config == null || rc == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
ICConfigurationDescription cfgDescription = config.getAdapter(ICConfigurationDescription.class);
|
|
||||||
if (cfgDescription == null) {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +56,7 @@ public class MBSLanguageSettingsProvider extends AbstractExecutableExtensionBase
|
||||||
if (ls != null) {
|
if (ls != null) {
|
||||||
languageSettings = new ICLanguageSetting[] { ls };
|
languageSettings = new ICLanguageSetting[] { ls };
|
||||||
} else {
|
} else {
|
||||||
return getSettingEntries(config, rc.getParent(), languageId);
|
return getSettingEntries(cfgDescription, rc.getParent(), languageId);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ICResourceDescription rcDescription = cfgDescription.getResourceDescription(projectPath, false);
|
ICResourceDescription rcDescription = cfgDescription.getResourceDescription(projectPath, false);
|
||||||
|
@ -82,8 +74,7 @@ public class MBSLanguageSettingsProvider extends AbstractExecutableExtensionBase
|
||||||
int kindsBits = langSetting.getSupportedEntryKinds();
|
int kindsBits = langSetting.getSupportedEntryKinds();
|
||||||
for (int kind=1; kind <= kindsBits; kind <<= 1) {
|
for (int kind=1; kind <= kindsBits; kind <<= 1) {
|
||||||
if ((kindsBits & kind) != 0) {
|
if ((kindsBits & kind) != 0) {
|
||||||
List<ICLanguageSettingEntry> additions = langSetting
|
List<ICLanguageSettingEntry> additions = langSetting.getSettingEntriesList(kind);
|
||||||
.getSettingEntriesList(kind);
|
|
||||||
for (ICLanguageSettingEntry entry : additions) {
|
for (ICLanguageSettingEntry entry : additions) {
|
||||||
if (entry instanceof ICPathEntry) {
|
if (entry instanceof ICPathEntry) {
|
||||||
// have to use getName() rather than getLocation() and not use IPath operations to avoid collapsing ".."
|
// have to use getName() rather than getLocation() and not use IPath operations to avoid collapsing ".."
|
||||||
|
@ -92,25 +83,16 @@ public class MBSLanguageSettingsProvider extends AbstractExecutableExtensionBase
|
||||||
// We need to add project-rooted entry for relative path as MBS counts it this way in some UI
|
// We need to add project-rooted entry for relative path as MBS counts it this way in some UI
|
||||||
// The relative entry below also should be added for indexer to resolve from source file locations
|
// The relative entry below also should be added for indexer to resolve from source file locations
|
||||||
|
|
||||||
ICdtVariableManager varManager = CCorePlugin.getDefault()
|
ICdtVariableManager varManager = CCorePlugin.getDefault().getCdtVariableManager();
|
||||||
.getCdtVariableManager();
|
|
||||||
try {
|
try {
|
||||||
// Substitute build/environment variables
|
// Substitute build/environment variables
|
||||||
String location = varManager.resolveValue(pathStr, "", null, //$NON-NLS-1$
|
String location = varManager.resolveValue(pathStr, "", null, cfgDescription); //$NON-NLS-1$
|
||||||
cfgDescription);
|
|
||||||
if (!new Path(location).isAbsolute()) {
|
if (!new Path(location).isAbsolute()) {
|
||||||
IStringVariableManager mngr = VariablesPlugin.getDefault()
|
IStringVariableManager mngr = VariablesPlugin.getDefault().getStringVariableManager();
|
||||||
.getStringVariableManager();
|
String projectRootedPath = mngr.generateVariableExpression("workspace_loc", rc.getProject().getName()) + Path.SEPARATOR + pathStr; //$NON-NLS-1$
|
||||||
String projectRootedPath = mngr
|
|
||||||
.generateVariableExpression("workspace_loc", //$NON-NLS-1$
|
|
||||||
rc.getProject().getName())
|
|
||||||
+ Path.SEPARATOR + pathStr;
|
|
||||||
// clear "RESOLVED" flag
|
// clear "RESOLVED" flag
|
||||||
int flags = entry.getFlags() & ~(ICSettingEntry.RESOLVED
|
int flags = entry.getFlags() & ~(ICSettingEntry.RESOLVED | ICSettingEntry.VALUE_WORKSPACE_PATH);
|
||||||
| ICSettingEntry.VALUE_WORKSPACE_PATH);
|
ICLanguageSettingEntry projectRootedEntry = (ICLanguageSettingEntry) CDataUtil.createEntry(kind, projectRootedPath, projectRootedPath, null, flags);
|
||||||
ICLanguageSettingEntry projectRootedEntry = (ICLanguageSettingEntry) CDataUtil
|
|
||||||
.createEntry(kind, projectRootedPath,
|
|
||||||
projectRootedPath, null, flags);
|
|
||||||
if (! list.contains(projectRootedEntry)) {
|
if (! list.contains(projectRootedEntry)) {
|
||||||
list.add(projectRootedEntry);
|
list.add(projectRootedEntry);
|
||||||
}
|
}
|
||||||
|
@ -167,12 +149,10 @@ public class MBSLanguageSettingsProvider extends AbstractExecutableExtensionBase
|
||||||
public boolean isEmpty() {
|
public boolean isEmpty() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LanguageSettingsStorage clone() throws CloneNotSupportedException {
|
public LanguageSettingsStorage clone() throws CloneNotSupportedException {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
// Note that this always triggers change event even if nothing changed in MBS
|
// Note that this always triggers change event even if nothing changed in MBS
|
||||||
|
|
|
@ -23,21 +23,17 @@ import org.eclipse.cdt.core.errorparsers.RegexErrorPattern;
|
||||||
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvider;
|
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvider;
|
||||||
import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsManager;
|
import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsManager;
|
||||||
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
||||||
import org.eclipse.core.resources.IBuildConfiguration;
|
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.Adapters;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract class for providers parsing compiler option from build command when present in build
|
* Abstract class for providers parsing compiler option from build command when present in build output.
|
||||||
* output.
|
|
||||||
* <p>
|
* <p>
|
||||||
* <strong>EXPERIMENTAL</strong>. This class interface is not stable yet as it is not currently (CDT
|
* <strong>EXPERIMENTAL</strong>. This class interface is not stable yet as
|
||||||
* 8.1, Juno) clear how it may need to be used in future. There is no guarantee that this API will
|
* it is not currently (CDT 8.1, Juno) clear how it may need to be used in future.
|
||||||
* work or that it will remain the same. Please do not use this API without consulting with the CDT
|
* There is no guarantee that this API will work or that it will remain the same.
|
||||||
* team.
|
* Please do not use this API without consulting with the CDT team.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
|
||||||
* @noextend This class is not intended to be subclassed by clients.
|
* @noextend This class is not intended to be subclassed by clients.
|
||||||
*
|
*
|
||||||
* @since 8.1
|
* @since 8.1
|
||||||
|
@ -51,11 +47,12 @@ public abstract class AbstractBuildCommandParser extends AbstractLanguageSetting
|
||||||
private static final String VALUE_FOLDER_SCOPE = "per-folder"; //$NON-NLS-1$
|
private static final String VALUE_FOLDER_SCOPE = "per-folder"; //$NON-NLS-1$
|
||||||
private static final String VALUE_PROJECT_SCOPE = "per-project"; //$NON-NLS-1$
|
private static final String VALUE_PROJECT_SCOPE = "per-project"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
|
||||||
private static final String LEADING_PATH_PATTERN = "\\S+[/\\\\]"; //$NON-NLS-1$
|
private static final String LEADING_PATH_PATTERN = "\\S+[/\\\\]"; //$NON-NLS-1$
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* "foo" Using look-ahead and look-behind to resolve ambiguity with "\"
|
* "foo"
|
||||||
* {@link #QUOTE_BSLASH_QUOTE}
|
* Using look-ahead and look-behind to resolve ambiguity with "\" {@link #QUOTE_BSLASH_QUOTE}
|
||||||
*/
|
*/
|
||||||
private static final String QUOTE = "(\"(?!\\\\).*?(?<!\\\\)\")"; //$NON-NLS-1$
|
private static final String QUOTE = "(\"(?!\\\\).*?(?<!\\\\)\")"; //$NON-NLS-1$
|
||||||
/** \"foo\" */
|
/** \"foo\" */
|
||||||
|
@ -65,8 +62,7 @@ public abstract class AbstractBuildCommandParser extends AbstractLanguageSetting
|
||||||
/** "\"foo\"" */
|
/** "\"foo\"" */
|
||||||
private static final String QUOTE_BSLASH_QUOTE = "(\"\\\\\".*?\\\\\"\")"; //$NON-NLS-1$
|
private static final String QUOTE_BSLASH_QUOTE = "(\"\\\\\".*?\\\\\"\")"; //$NON-NLS-1$
|
||||||
|
|
||||||
private static final Pattern OPTIONS_PATTERN = Pattern.compile("-[^\\s\"'\\\\]*(\\s*(" + QUOTE + "|" //$NON-NLS-1$ //$NON-NLS-2$
|
private static final Pattern OPTIONS_PATTERN = Pattern.compile("-[^\\s\"'\\\\]*(\\s*(" + QUOTE +"|" + QUOTE_BSLASH_QUOTE + "|" + BSLASH_QUOTE + "|" + SINGLE_QUOTE + "|([^-\\s][^\\s]+)))?"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$<
|
||||||
+ QUOTE_BSLASH_QUOTE + "|" + BSLASH_QUOTE + "|" + SINGLE_QUOTE + "|([^-\\s][^\\s]+)))?"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
|
||||||
private static final int OPTION_GROUP = 0;
|
private static final int OPTION_GROUP = 0;
|
||||||
|
|
||||||
public enum ResourceScope {
|
public enum ResourceScope {
|
||||||
|
@ -81,8 +77,7 @@ public abstract class AbstractBuildCommandParser extends AbstractLanguageSetting
|
||||||
@SuppressWarnings("nls")
|
@SuppressWarnings("nls")
|
||||||
private static final String[] COMPILER_COMMAND_PATTERN_TEMPLATES = {
|
private static final String[] COMPILER_COMMAND_PATTERN_TEMPLATES = {
|
||||||
"${COMPILER_PATTERN}.*\\s" + "()([^'\"\\s]*\\.${EXTENSIONS_PATTERN})(\\s.*)?[\r\n]*", // compiling unquoted file
|
"${COMPILER_PATTERN}.*\\s" + "()([^'\"\\s]*\\.${EXTENSIONS_PATTERN})(\\s.*)?[\r\n]*", // compiling unquoted file
|
||||||
"${COMPILER_PATTERN}.*\\s"
|
"${COMPILER_PATTERN}.*\\s" + "(['\"])(.*\\.${EXTENSIONS_PATTERN})\\${COMPILER_GROUPS+1}(\\s.*)?[\r\n]*" // compiling quoted file
|
||||||
+ "(['\"])(.*\\.${EXTENSIONS_PATTERN})\\${COMPILER_GROUPS+1}(\\s.*)?[\r\n]*" // compiling quoted file
|
|
||||||
};
|
};
|
||||||
private static final int FILE_GROUP = 2;
|
private static final int FILE_GROUP = 2;
|
||||||
|
|
||||||
|
@ -93,9 +88,10 @@ public abstract class AbstractBuildCommandParser extends AbstractLanguageSetting
|
||||||
private String partialLine;
|
private String partialLine;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The compiler command pattern without specifying compiler options. The options are intended to
|
* The compiler command pattern without specifying compiler options.
|
||||||
* be handled with option parsers, see {@link #getOptionParsers()}. This is regular expression
|
* The options are intended to be handled with option parsers,
|
||||||
* pattern.
|
* see {@link #getOptionParsers()}.
|
||||||
|
* This is regular expression pattern.
|
||||||
*
|
*
|
||||||
* @return the compiler command pattern.
|
* @return the compiler command pattern.
|
||||||
*/
|
*/
|
||||||
|
@ -105,9 +101,8 @@ public abstract class AbstractBuildCommandParser extends AbstractLanguageSetting
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set compiler command pattern for the provider. See {@link #getCompilerPattern()}.
|
* Set compiler command pattern for the provider. See {@link #getCompilerPattern()}.
|
||||||
*
|
* @param commandPattern - value of the command pattern to set.
|
||||||
* @param commandPattern
|
* This is regular expression pattern.
|
||||||
* - value of the command pattern to set. This is regular expression pattern.
|
|
||||||
*/
|
*/
|
||||||
public void setCompilerPattern(String commandPattern) {
|
public void setCompilerPattern(String commandPattern) {
|
||||||
setProperty(ATTR_PARAMETER, commandPattern);
|
setProperty(ATTR_PARAMETER, commandPattern);
|
||||||
|
@ -123,15 +118,11 @@ public abstract class AbstractBuildCommandParser extends AbstractLanguageSetting
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return resource scope of the entries, i.e. level in resource hierarchy where language
|
* @return resource scope of the entries, i.e. level in resource hierarchy where language settings entries
|
||||||
* settings entries will be applied by the provider. Resource scope can be one of the
|
* will be applied by the provider. Resource scope can be one of the following:
|
||||||
* following: <br>
|
* <br>- {@code AbstractBuildCommandParser.ResourceScope.FILE} - apply entries to the file being parsed.
|
||||||
* - {@code AbstractBuildCommandParser.ResourceScope.FILE} - apply entries to the file
|
* <br>- {@code AbstractBuildCommandParser.ResourceScope.FOLDER} - apply entries to the enclosing folder.
|
||||||
* being parsed. <br>
|
* <br>- {@code AbstractBuildCommandParser.ResourceScope.PROJECT} - apply entries to the project level.
|
||||||
* - {@code AbstractBuildCommandParser.ResourceScope.FOLDER} - apply entries to the
|
|
||||||
* enclosing folder. <br>
|
|
||||||
* - {@code AbstractBuildCommandParser.ResourceScope.PROJECT} - apply entries to the
|
|
||||||
* project level.
|
|
||||||
*/
|
*/
|
||||||
public ResourceScope getResourceScope() {
|
public ResourceScope getResourceScope() {
|
||||||
if (resourceScope == null) {
|
if (resourceScope == null) {
|
||||||
|
@ -150,17 +141,13 @@ public abstract class AbstractBuildCommandParser extends AbstractLanguageSetting
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set resource scope of the entries, i.e. level in resource hierarchy where language settings
|
* Set resource scope of the entries, i.e. level in resource hierarchy where language settings entries
|
||||||
* entries will be applied by the provider.
|
* will be applied by the provider.
|
||||||
*
|
*
|
||||||
* @param rcScope
|
* @param rcScope - resource scope can be one of the following:
|
||||||
* - resource scope can be one of the following: <br>
|
* <br>- {@code AbstractBuildCommandParser.ResourceScope.FILE} - apply entries to the file being parsed.
|
||||||
* - {@code AbstractBuildCommandParser.ResourceScope.FILE} - apply entries to the
|
* <br>- {@code AbstractBuildCommandParser.ResourceScope.FOLDER} - apply entries to the enclosing folder.
|
||||||
* file being parsed. <br>
|
* <br>- {@code AbstractBuildCommandParser.ResourceScope.PROJECT} - apply entries to the project level.
|
||||||
* - {@code AbstractBuildCommandParser.ResourceScope.FOLDER} - apply entries to the
|
|
||||||
* enclosing folder. <br>
|
|
||||||
* - {@code AbstractBuildCommandParser.ResourceScope.PROJECT} - apply entries to the
|
|
||||||
* project level.
|
|
||||||
*/
|
*/
|
||||||
public void setResourceScope(ResourceScope rcScope) {
|
public void setResourceScope(ResourceScope rcScope) {
|
||||||
resourceScope = rcScope;
|
resourceScope = rcScope;
|
||||||
|
@ -200,13 +187,11 @@ public abstract class AbstractBuildCommandParser extends AbstractLanguageSetting
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IBuildConfiguration currentConfig = Adapters.adapt(currentCfgDescription, IBuildConfiguration.class);
|
setSettingEntries(currentCfgDescription, rc, currentLanguageId, entries);
|
||||||
setSettingEntries(currentConfig, rc, currentLanguageId, entries);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adjust count for file group taking into consideration extra groups added by
|
* Adjust count for file group taking into consideration extra groups added by {@link #getCompilerPatternExtended()}.
|
||||||
* {@link #getCompilerPatternExtended()}.
|
|
||||||
*/
|
*/
|
||||||
private int adjustFileGroup() {
|
private int adjustFileGroup() {
|
||||||
return countGroups(getCompilerPatternExtended()) + FILE_GROUP;
|
return countGroups(getCompilerPatternExtended()) + FILE_GROUP;
|
||||||
|
@ -217,9 +202,10 @@ public abstract class AbstractBuildCommandParser extends AbstractLanguageSetting
|
||||||
*/
|
*/
|
||||||
private String makePattern(String template) {
|
private String makePattern(String template) {
|
||||||
@SuppressWarnings("nls")
|
@SuppressWarnings("nls")
|
||||||
String pattern = template.replace("${COMPILER_PATTERN}", getCompilerPatternExtended())
|
String pattern = template
|
||||||
.replace("${EXTENSIONS_PATTERN}", getPatternFileExtensions()).replace("${COMPILER_GROUPS+1}",
|
.replace("${COMPILER_PATTERN}", getCompilerPatternExtended())
|
||||||
new Integer(countGroups(getCompilerPatternExtended()) + 1).toString());
|
.replace("${EXTENSIONS_PATTERN}", getPatternFileExtensions())
|
||||||
|
.replace("${COMPILER_GROUPS+1}", new Integer(countGroups(getCompilerPatternExtended()) + 1).toString());
|
||||||
return pattern;
|
return pattern;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -298,8 +284,8 @@ public abstract class AbstractBuildCommandParser extends AbstractLanguageSetting
|
||||||
|
|
||||||
// If the character preceding the '\' is also '\', it's not a line continuation -
|
// If the character preceding the '\' is also '\', it's not a line continuation -
|
||||||
// the first '\' escapes the second.
|
// the first '\' escapes the second.
|
||||||
if (line.length() > 0 && line.charAt(line.length() - 1) == '\\'
|
if (line.length() > 0 && line.charAt(line.length() - 1) == '\\' &&
|
||||||
&& (line.length() == 1 || line.charAt(line.length() - 2) != '\\')) {
|
(line.length() == 1 || line.charAt(line.length() - 2) != '\\')) {
|
||||||
// Line ends in line continuation - save it for later.
|
// Line ends in line continuation - save it for later.
|
||||||
String fragment = line.substring(0, line.length() - 1);
|
String fragment = line.substring(0, line.length() - 1);
|
||||||
if (partialLine == null) {
|
if (partialLine == null) {
|
||||||
|
@ -317,18 +303,14 @@ public abstract class AbstractBuildCommandParser extends AbstractLanguageSetting
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Trivial Error Parser which allows highlighting of output lines matching the patterns of this
|
* Trivial Error Parser which allows highlighting of output lines matching the patterns
|
||||||
* parser. Intended for better troubleshooting experience. Implementers are supposed to add the
|
* of this parser. Intended for better troubleshooting experience.
|
||||||
* error parser via extension point {@code org.eclipse.cdt.core.ErrorParser}.
|
* Implementers are supposed to add the error parser via extension point {@code org.eclipse.cdt.core.ErrorParser}.
|
||||||
*/
|
*/
|
||||||
protected static abstract class AbstractBuildCommandPatternHighlighter extends RegexErrorParser
|
protected static abstract class AbstractBuildCommandPatternHighlighter extends RegexErrorParser implements IErrorParser2 {
|
||||||
implements IErrorParser2 {
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
* @param parserId - build command parser ID specified in the extension {@code org.eclipse.cdt.core.LanguageSettingsProvider}.
|
||||||
* @param parserId
|
|
||||||
* - build command parser ID specified in the extension
|
|
||||||
* {@code org.eclipse.cdt.core.LanguageSettingsProvider}.
|
|
||||||
*/
|
*/
|
||||||
public AbstractBuildCommandPatternHighlighter(String parserId) {
|
public AbstractBuildCommandPatternHighlighter(String parserId) {
|
||||||
init(parserId);
|
init(parserId);
|
||||||
|
@ -336,20 +318,16 @@ public abstract class AbstractBuildCommandParser extends AbstractLanguageSetting
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the error parser.
|
* Initialize the error parser.
|
||||||
*
|
* @param parserId - language settings provider (the build command parser) ID.
|
||||||
* @param parserId
|
|
||||||
* - language settings provider (the build command parser) ID.
|
|
||||||
*/
|
*/
|
||||||
protected void init(String parserId) {
|
protected void init(String parserId) {
|
||||||
AbstractBuildCommandParser buildCommandParser = (AbstractBuildCommandParser) LanguageSettingsManager
|
AbstractBuildCommandParser buildCommandParser = (AbstractBuildCommandParser) LanguageSettingsManager.getExtensionProviderCopy(parserId, false);
|
||||||
.getExtensionProviderCopy(parserId, false);
|
|
||||||
if (buildCommandParser != null) {
|
if (buildCommandParser != null) {
|
||||||
for (String template : COMPILER_COMMAND_PATTERN_TEMPLATES) {
|
for (String template : COMPILER_COMMAND_PATTERN_TEMPLATES) {
|
||||||
String pattern = buildCommandParser.makePattern(template);
|
String pattern = buildCommandParser.makePattern(template);
|
||||||
String fileExpr = "$"+buildCommandParser.adjustFileGroup(); //$NON-NLS-1$
|
String fileExpr = "$"+buildCommandParser.adjustFileGroup(); //$NON-NLS-1$
|
||||||
String descExpr = "$0"; //$NON-NLS-1$
|
String descExpr = "$0"; //$NON-NLS-1$
|
||||||
addPattern(new RegexErrorPattern(pattern, fileExpr, null, descExpr, null,
|
addPattern(new RegexErrorPattern(pattern, fileExpr, null, descExpr, null, IMarkerGenerator.SEVERITY_WARNING, true));
|
||||||
IMarkerGenerator.SEVERITY_WARNING, true));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -360,4 +338,5 @@ public abstract class AbstractBuildCommandParser extends AbstractLanguageSetting
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,13 +55,11 @@ import org.eclipse.cdt.utils.CommandLineUtil;
|
||||||
import org.eclipse.cdt.utils.PathUtil;
|
import org.eclipse.cdt.utils.PathUtil;
|
||||||
import org.eclipse.cdt.utils.envvar.IEnvironmentChangeEvent;
|
import org.eclipse.cdt.utils.envvar.IEnvironmentChangeEvent;
|
||||||
import org.eclipse.cdt.utils.envvar.IEnvironmentChangeListener;
|
import org.eclipse.cdt.utils.envvar.IEnvironmentChangeListener;
|
||||||
import org.eclipse.core.resources.IBuildConfiguration;
|
|
||||||
import org.eclipse.core.resources.IMarker;
|
import org.eclipse.core.resources.IMarker;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.resources.IWorkspaceRoot;
|
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||||
import org.eclipse.core.resources.ResourcesPlugin;
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
import org.eclipse.core.resources.WorkspaceJob;
|
import org.eclipse.core.resources.WorkspaceJob;
|
||||||
import org.eclipse.core.runtime.Adapters;
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
@ -79,14 +77,14 @@ import org.eclipse.core.runtime.jobs.Job;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract parser capable to execute compiler command printing built-in compiler specs and parse built-in
|
* Abstract parser capable to execute compiler command printing built-in compiler
|
||||||
* language settings out of it.
|
* specs and parse built-in language settings out of it.
|
||||||
* <p>
|
* <p>
|
||||||
* <strong>EXPERIMENTAL</strong>. This class interface is not stable yet as it is not currently (CDT 8.1,
|
* <strong>EXPERIMENTAL</strong>. This class interface is not stable yet as
|
||||||
* Juno) clear how it may need to be used in future. There is no guarantee that this API will work or that it
|
* it is not currently (CDT 8.1, Juno) clear how it may need to be used in future.
|
||||||
* will remain the same. Please do not use this API without consulting with the CDT team.
|
* There is no guarantee that this API will work or that it will remain the same.
|
||||||
|
* Please do not use this API without consulting with the CDT team.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
|
||||||
* @noextend This class is not intended to be subclassed by clients.
|
* @noextend This class is not intended to be subclassed by clients.
|
||||||
*
|
*
|
||||||
* @since 8.1
|
* @since 8.1
|
||||||
|
@ -161,15 +159,12 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
final String providerName = getName();
|
final String providerName = getName();
|
||||||
final String providerId = getId();
|
final String providerId = getId();
|
||||||
// Add markers in a job to avoid deadlocks
|
// Add markers in a job to avoid deadlocks
|
||||||
Job markerJob = new Job(ManagedMakeMessages
|
Job markerJob = new Job(ManagedMakeMessages.getResourceString("AbstractBuiltinSpecsDetector.AddScannerDiscoveryMarkers")) { //$NON-NLS-1$
|
||||||
.getResourceString("AbstractBuiltinSpecsDetector.AddScannerDiscoveryMarkers")) { //$NON-NLS-1$
|
|
||||||
@Override
|
@Override
|
||||||
protected IStatus run(IProgressMonitor monitor) {
|
protected IStatus run(IProgressMonitor monitor) {
|
||||||
// Avoid duplicates as different languages can generate identical errors
|
// Avoid duplicates as different languages can generate identical errors
|
||||||
try {
|
try {
|
||||||
IMarker[] markers = problemMarkerInfo.file.findMarkers(
|
IMarker[] markers = problemMarkerInfo.file.findMarkers(SDMarkerGenerator.SCANNER_DISCOVERY_PROBLEM_MARKER, false, IResource.DEPTH_ZERO);
|
||||||
SDMarkerGenerator.SCANNER_DISCOVERY_PROBLEM_MARKER, false,
|
|
||||||
IResource.DEPTH_ZERO);
|
|
||||||
for (IMarker marker : markers) {
|
for (IMarker marker : markers) {
|
||||||
int sev = ((Integer) marker.getAttribute(IMarker.SEVERITY)).intValue();
|
int sev = ((Integer) marker.getAttribute(IMarker.SEVERITY)).intValue();
|
||||||
if (sev == problemMarkerInfo.severity) {
|
if (sev == problemMarkerInfo.severity) {
|
||||||
|
@ -180,31 +175,24 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
return new Status(IStatus.ERROR, ManagedBuilderCorePlugin.PLUGIN_ID,
|
return new Status(IStatus.ERROR, ManagedBuilderCorePlugin.PLUGIN_ID, "Error checking markers.", e); //$NON-NLS-1$
|
||||||
"Error checking markers.", e); //$NON-NLS-1$
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
IMarker marker = problemMarkerInfo.file
|
IMarker marker = problemMarkerInfo.file.createMarker(SDMarkerGenerator.SCANNER_DISCOVERY_PROBLEM_MARKER);
|
||||||
.createMarker(SDMarkerGenerator.SCANNER_DISCOVERY_PROBLEM_MARKER);
|
|
||||||
marker.setAttribute(IMarker.MESSAGE, problemMarkerInfo.description);
|
marker.setAttribute(IMarker.MESSAGE, problemMarkerInfo.description);
|
||||||
marker.setAttribute(IMarker.SEVERITY, problemMarkerInfo.severity);
|
marker.setAttribute(IMarker.SEVERITY, problemMarkerInfo.severity);
|
||||||
marker.setAttribute(SDMarkerGenerator.ATTR_PROVIDER, providerId);
|
marker.setAttribute(SDMarkerGenerator.ATTR_PROVIDER, providerId);
|
||||||
|
|
||||||
if (problemMarkerInfo.file instanceof IWorkspaceRoot) {
|
if (problemMarkerInfo.file instanceof IWorkspaceRoot) {
|
||||||
String msgPreferences = ManagedMakeMessages.getFormattedString(
|
String msgPreferences = ManagedMakeMessages.getFormattedString("AbstractBuiltinSpecsDetector.ScannerDiscoveryMarkerLocationPreferences", providerName); //$NON-NLS-1$
|
||||||
"AbstractBuiltinSpecsDetector.ScannerDiscoveryMarkerLocationPreferences", //$NON-NLS-1$
|
|
||||||
providerName);
|
|
||||||
marker.setAttribute(IMarker.LOCATION, msgPreferences);
|
marker.setAttribute(IMarker.LOCATION, msgPreferences);
|
||||||
} else {
|
} else {
|
||||||
String msgProperties = ManagedMakeMessages.getFormattedString(
|
String msgProperties = ManagedMakeMessages.getFormattedString("AbstractBuiltinSpecsDetector.ScannerDiscoveryMarkerLocationProperties", providerName); //$NON-NLS-1$
|
||||||
"AbstractBuiltinSpecsDetector.ScannerDiscoveryMarkerLocationProperties", //$NON-NLS-1$
|
|
||||||
providerName);
|
|
||||||
marker.setAttribute(IMarker.LOCATION, msgProperties);
|
marker.setAttribute(IMarker.LOCATION, msgProperties);
|
||||||
}
|
}
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
return new Status(IStatus.ERROR, ManagedBuilderCorePlugin.PLUGIN_ID,
|
return new Status(IStatus.ERROR, ManagedBuilderCorePlugin.PLUGIN_ID, "Error adding markers.", e); //$NON-NLS-1$
|
||||||
"Error adding markers.", e); //$NON-NLS-1$
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status.OK_STATUS;
|
return Status.OK_STATUS;
|
||||||
|
@ -218,22 +206,19 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
/**
|
/**
|
||||||
* Delete markers previously set by this provider for the resource.
|
* Delete markers previously set by this provider for the resource.
|
||||||
*
|
*
|
||||||
* @param rc
|
* @param rc - resource to check markers.
|
||||||
* - resource to check markers.
|
|
||||||
*/
|
*/
|
||||||
public void deleteMarkers(IResource rc) {
|
public void deleteMarkers(IResource rc) {
|
||||||
String providerId = getId();
|
String providerId = getId();
|
||||||
try {
|
try {
|
||||||
IMarker[] markers = rc.findMarkers(SCANNER_DISCOVERY_PROBLEM_MARKER, false,
|
IMarker[] markers = rc.findMarkers(SCANNER_DISCOVERY_PROBLEM_MARKER, false, IResource.DEPTH_ZERO);
|
||||||
IResource.DEPTH_ZERO);
|
|
||||||
for (IMarker marker : markers) {
|
for (IMarker marker : markers) {
|
||||||
if (providerId.equals(marker.getAttribute(ATTR_PROVIDER))) {
|
if (providerId.equals(marker.getAttribute(ATTR_PROVIDER))) {
|
||||||
marker.delete();
|
marker.delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
ManagedBuilderCorePlugin.log(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.PLUGIN_ID,
|
ManagedBuilderCorePlugin.log(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.PLUGIN_ID, "Error deleting markers.", e)); //$NON-NLS-1$
|
||||||
"Error deleting markers.", e)); //$NON-NLS-1$
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,16 +229,13 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
*/
|
*/
|
||||||
private class ConsoleParserAdapter implements ICBuildOutputParser {
|
private class ConsoleParserAdapter implements ICBuildOutputParser {
|
||||||
@Override
|
@Override
|
||||||
public void startup(ICConfigurationDescription cfgDescription, IWorkingDirectoryTracker cwdTracker)
|
public void startup(ICConfigurationDescription cfgDescription, IWorkingDirectoryTracker cwdTracker) throws CoreException {
|
||||||
throws CoreException {
|
|
||||||
AbstractBuiltinSpecsDetector.this.cwdTracker = cwdTracker;
|
AbstractBuiltinSpecsDetector.this.cwdTracker = cwdTracker;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean processLine(String line) {
|
public boolean processLine(String line) {
|
||||||
return AbstractBuiltinSpecsDetector.this.processLine(line);
|
return AbstractBuiltinSpecsDetector.this.processLine(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void shutdown() {
|
public void shutdown() {
|
||||||
AbstractBuiltinSpecsDetector.this.cwdTracker = null;
|
AbstractBuiltinSpecsDetector.this.cwdTracker = null;
|
||||||
|
@ -261,12 +243,11 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compiler command without arguments. This value is used to replace macro ${COMMAND}. In particular, this
|
* Compiler command without arguments. This value is used to replace macro ${COMMAND}.
|
||||||
* method is implemented in {@link ToolchainBuiltinSpecsDetector} which retrieves the command from
|
* In particular, this method is implemented in {@link ToolchainBuiltinSpecsDetector}
|
||||||
* tool-chain.
|
* which retrieves the command from tool-chain.
|
||||||
*
|
*
|
||||||
* @param languageId
|
* @param languageId - language ID.
|
||||||
* - language ID.
|
|
||||||
* @return compiler command without arguments, i.e. compiler program.
|
* @return compiler command without arguments, i.e. compiler program.
|
||||||
*/
|
*/
|
||||||
protected abstract String getCompilerCommand(String languageId);
|
protected abstract String getCompilerCommand(String languageId);
|
||||||
|
@ -274,12 +255,13 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
/**
|
/**
|
||||||
* The command to run. Some macros could be specified in there:
|
* The command to run. Some macros could be specified in there:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <b>${COMMAND}</b> - compiler command without arguments (compiler program). Normally would come from the
|
* <b>${COMMAND}</b> - compiler command without arguments (compiler program).
|
||||||
* tool-chain.<br>
|
* Normally would come from the tool-chain.<br>
|
||||||
* <b>${INPUTS}</b> - path to spec file which will be placed in workspace area.<br>
|
* <b>${INPUTS}</b> - path to spec file which will be placed in workspace area.<br>
|
||||||
* <b>${EXT}</b> - file extension calculated from language ID.
|
* <b>${EXT}</b> - file extension calculated from language ID.
|
||||||
* </ul>
|
* </ul>
|
||||||
* The parameter could be taken from the extension in {@code plugin.xml} or from property file.
|
* The parameter could be taken from the extension
|
||||||
|
* in {@code plugin.xml} or from property file.
|
||||||
*
|
*
|
||||||
* @return the command to run or empty string if command is not defined.
|
* @return the command to run or empty string if command is not defined.
|
||||||
*/
|
*/
|
||||||
|
@ -289,9 +271,7 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set custom command for the provider. See {@link #getCommand()}.
|
* Set custom command for the provider. See {@link #getCommand()}.
|
||||||
*
|
* @param command - value of custom command to set.
|
||||||
* @param command
|
|
||||||
* - value of custom command to set.
|
|
||||||
*/
|
*/
|
||||||
public void setCommand(String command) {
|
public void setCommand(String command) {
|
||||||
setProperty(ATTR_PARAMETER, command);
|
setProperty(ATTR_PARAMETER, command);
|
||||||
|
@ -307,22 +287,19 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
/**
|
/**
|
||||||
* Enable or disable console output for this provider.
|
* Enable or disable console output for this provider.
|
||||||
*
|
*
|
||||||
* @param enable
|
* @param enable - {@code true} to enable console output or {@code false} to disable.
|
||||||
* - {@code true} to enable console output or {@code false} to disable.
|
|
||||||
*/
|
*/
|
||||||
public void setConsoleEnabled(boolean enable) {
|
public void setConsoleEnabled(boolean enable) {
|
||||||
isConsoleEnabled = enable;
|
isConsoleEnabled = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Expand macros specified in the compiler command. See {@link #getCommand()} for the recognized list of
|
* Expand macros specified in the compiler command. See {@link #getCommand()} for
|
||||||
* macros.
|
* the recognized list of macros.
|
||||||
*
|
*
|
||||||
* @param languageId
|
* @param languageId - language ID.
|
||||||
* - language ID.
|
|
||||||
* @return - resolved command to run.
|
* @return - resolved command to run.
|
||||||
* @throws CoreException
|
* @throws CoreException if something goes wrong.
|
||||||
* if something goes wrong.
|
|
||||||
*/
|
*/
|
||||||
protected String resolveCommand(String languageId) throws CoreException {
|
protected String resolveCommand(String languageId) throws CoreException {
|
||||||
String cmd = getCommand();
|
String cmd = getCommand();
|
||||||
|
@ -411,8 +388,7 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void startup(ICConfigurationDescription cfgDescription, IWorkingDirectoryTracker cwdTracker)
|
public void startup(ICConfigurationDescription cfgDescription, IWorkingDirectoryTracker cwdTracker) throws CoreException {
|
||||||
throws CoreException {
|
|
||||||
super.startup(cfgDescription, cwdTracker);
|
super.startup(cfgDescription, cwdTracker);
|
||||||
|
|
||||||
mappedRootURI = null;
|
mappedRootURI = null;
|
||||||
|
@ -457,8 +433,7 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
if (location != null) {
|
if (location != null) {
|
||||||
java.io.File file = new java.io.File(location.toString());
|
java.io.File file = new java.io.File(location.toString());
|
||||||
try {
|
try {
|
||||||
// handles symbolic links as java.io.File.getCanonicalPath() resolves symlinks on
|
// handles symbolic links as java.io.File.getCanonicalPath() resolves symlinks on UNIX
|
||||||
// UNIX
|
|
||||||
file = file.getCanonicalFile();
|
file = file.getCanonicalFile();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
ManagedBuilderCorePlugin.log(e);
|
ManagedBuilderCorePlugin.log(e);
|
||||||
|
@ -476,10 +451,12 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method does 2 related things: <br>
|
* This method does 2 related things:
|
||||||
* 1. Validate environment, i.e. check that environment for running the command has not changed. If
|
* <br>
|
||||||
* environment changed {@link #execute()} will rerun the command even if flag {@link #isExecuted} suggests
|
* 1. Validate environment, i.e. check that environment for running the command has not changed.
|
||||||
* that it was run already. <br>
|
* If environment changed {@link #execute()} will rerun the command even if flag {@link #isExecuted}
|
||||||
|
* suggests that it was run already.
|
||||||
|
* <br>
|
||||||
* 2. The relevant environment is cached here so the new one is validated against it at the next call.
|
* 2. The relevant environment is cached here so the new one is validated against it at the next call.
|
||||||
* {@link #validateEnvironment()} will be called right before running the job to execute the command.
|
* {@link #validateEnvironment()} will be called right before running the job to execute the command.
|
||||||
*
|
*
|
||||||
|
@ -496,8 +473,8 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute provider's command which is expected to print built-in compiler options (specs) to build
|
* Execute provider's command which is expected to print built-in compiler options (specs) to build output.
|
||||||
* output. The parser will parse output and generate language settings for corresponding resources.
|
* The parser will parse output and generate language settings for corresponding resources.
|
||||||
*/
|
*/
|
||||||
protected void execute() {
|
protected void execute() {
|
||||||
environmentMap = createEnvironmentMap(currentCfgDescription);
|
environmentMap = createEnvironmentMap(currentCfgDescription);
|
||||||
|
@ -505,8 +482,7 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
WorkspaceJob job = new WorkspaceJob(ManagedMakeMessages
|
WorkspaceJob job = new WorkspaceJob(ManagedMakeMessages.getResourceString("AbstractBuiltinSpecsDetector.DiscoverBuiltInSettingsJobName")) { //$NON-NLS-1$
|
||||||
.getResourceString("AbstractBuiltinSpecsDetector.DiscoverBuiltInSettingsJobName")) { //$NON-NLS-1$
|
|
||||||
@Override
|
@Override
|
||||||
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
|
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
|
||||||
isExecuted = false;
|
isExecuted = false;
|
||||||
|
@ -520,8 +496,7 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
status = runForEachLanguage(monitor);
|
status = runForEachLanguage(monitor);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
ManagedBuilderCorePlugin.log(e);
|
ManagedBuilderCorePlugin.log(e);
|
||||||
status = new Status(IStatus.ERROR, ManagedBuilderCorePlugin.PLUGIN_ID, IStatus.ERROR,
|
status = new Status(IStatus.ERROR, ManagedBuilderCorePlugin.PLUGIN_ID, IStatus.ERROR, "Error running Builtin Specs Detector", e); //$NON-NLS-1$
|
||||||
"Error running Builtin Specs Detector", e); //$NON-NLS-1$
|
|
||||||
} finally {
|
} finally {
|
||||||
isExecuted = true;
|
isExecuted = true;
|
||||||
shutdown();
|
shutdown();
|
||||||
|
@ -529,7 +504,6 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean belongsTo(Object family) {
|
public boolean belongsTo(Object family) {
|
||||||
return family == JOB_FAMILY_BUILTIN_SPECS_DETECTOR;
|
return family == JOB_FAMILY_BUILTIN_SPECS_DETECTOR;
|
||||||
|
@ -553,14 +527,12 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
/**
|
/**
|
||||||
* Run built-in specs command for each language.
|
* Run built-in specs command for each language.
|
||||||
*
|
*
|
||||||
* @param monitor
|
* @param monitor - progress monitor in the initial state where {@link IProgressMonitor#beginTask(String, int)}
|
||||||
* - progress monitor in the initial state where
|
* has not been called yet.
|
||||||
* {@link IProgressMonitor#beginTask(String, int)} has not been called yet.
|
|
||||||
* @return status of operation.
|
* @return status of operation.
|
||||||
*/
|
*/
|
||||||
protected IStatus runForEachLanguage(IProgressMonitor monitor) {
|
protected IStatus runForEachLanguage(IProgressMonitor monitor) {
|
||||||
MultiStatus status = new MultiStatus(ManagedBuilderCorePlugin.PLUGIN_ID, IStatus.OK,
|
MultiStatus status = new MultiStatus(ManagedBuilderCorePlugin.PLUGIN_ID, IStatus.OK, "Problem running CDT Scanner Discovery provider " + getId(), null); //$NON-NLS-1$
|
||||||
"Problem running CDT Scanner Discovery provider " + getId(), null); //$NON-NLS-1$
|
|
||||||
|
|
||||||
if (monitor == null) {
|
if (monitor == null) {
|
||||||
monitor = new NullProgressMonitor();
|
monitor = new NullProgressMonitor();
|
||||||
|
@ -571,44 +543,32 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
|
|
||||||
List<String> languageIds = getLanguageScope();
|
List<String> languageIds = getLanguageScope();
|
||||||
if (languageIds != null) {
|
if (languageIds != null) {
|
||||||
monitor.beginTask(
|
monitor.beginTask(ManagedMakeMessages.getResourceString("AbstractBuiltinSpecsDetector.ScannerDiscoveryTaskTitle"), //$NON-NLS-1$
|
||||||
ManagedMakeMessages
|
TICKS_REMOVE_MARKERS + languageIds.size()*TICKS_RUN_FOR_ONE_LANGUAGE + TICKS_SERIALIZATION);
|
||||||
.getResourceString("AbstractBuiltinSpecsDetector.ScannerDiscoveryTaskTitle"), //$NON-NLS-1$
|
|
||||||
TICKS_REMOVE_MARKERS + languageIds.size() * TICKS_RUN_FOR_ONE_LANGUAGE
|
|
||||||
+ TICKS_SERIALIZATION);
|
|
||||||
|
|
||||||
IResource markersResource = currentProject != null ? currentProject
|
IResource markersResource = currentProject != null ? currentProject : ResourcesPlugin.getWorkspace().getRoot();
|
||||||
: ResourcesPlugin.getWorkspace().getRoot();
|
|
||||||
|
|
||||||
monitor.subTask(
|
monitor.subTask(ManagedMakeMessages.getFormattedString("AbstractBuiltinSpecsDetector.ClearingMarkers", markersResource.getFullPath().toString())); //$NON-NLS-1$
|
||||||
ManagedMakeMessages.getFormattedString("AbstractBuiltinSpecsDetector.ClearingMarkers", //$NON-NLS-1$
|
|
||||||
markersResource.getFullPath().toString()));
|
|
||||||
markerGenerator.deleteMarkers(markersResource);
|
markerGenerator.deleteMarkers(markersResource);
|
||||||
if (monitor.isCanceled())
|
if (monitor.isCanceled())
|
||||||
throw new OperationCanceledException();
|
throw new OperationCanceledException();
|
||||||
|
|
||||||
monitor.worked(TICKS_REMOVE_MARKERS);
|
monitor.worked(TICKS_REMOVE_MARKERS);
|
||||||
|
|
||||||
IBuildConfiguration currentConfig = Adapters.adapt(currentCfgDescription,
|
|
||||||
IBuildConfiguration.class);
|
|
||||||
|
|
||||||
for (String languageId : languageIds) {
|
for (String languageId : languageIds) {
|
||||||
List<ICLanguageSettingEntry> oldEntries = getSettingEntries(currentConfig, null,
|
List<ICLanguageSettingEntry> oldEntries = getSettingEntries(currentCfgDescription, null, languageId);
|
||||||
languageId);
|
|
||||||
try {
|
try {
|
||||||
startupForLanguage(languageId);
|
startupForLanguage(languageId);
|
||||||
runForLanguage(new SubProgressMonitor(monitor, TICKS_RUN_FOR_ONE_LANGUAGE));
|
runForLanguage(new SubProgressMonitor(monitor, TICKS_RUN_FOR_ONE_LANGUAGE));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
IStatus s = new Status(IStatus.ERROR, ManagedBuilderCorePlugin.PLUGIN_ID,
|
IStatus s = new Status(IStatus.ERROR, ManagedBuilderCorePlugin.PLUGIN_ID, IStatus.ERROR, "Error running Builtin Specs Detector", e); //$NON-NLS-1$
|
||||||
IStatus.ERROR, "Error running Builtin Specs Detector", e); //$NON-NLS-1$
|
|
||||||
ManagedBuilderCorePlugin.log(s);
|
ManagedBuilderCorePlugin.log(s);
|
||||||
status.merge(s);
|
status.merge(s);
|
||||||
} finally {
|
} finally {
|
||||||
shutdownForLanguage();
|
shutdownForLanguage();
|
||||||
}
|
}
|
||||||
if (!isChanged) {
|
if (!isChanged) {
|
||||||
List<ICLanguageSettingEntry> newEntries = getSettingEntries(currentConfig, null,
|
List<ICLanguageSettingEntry> newEntries = getSettingEntries(currentCfgDescription, null, languageId);
|
||||||
languageId);
|
|
||||||
isChanged = newEntries != oldEntries;
|
isChanged = newEntries != oldEntries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -617,8 +577,7 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
monitor.subTask(
|
monitor.subTask(ManagedMakeMessages.getResourceString("AbstractBuiltinSpecsDetector.SerializingResults")); //$NON-NLS-1$
|
||||||
ManagedMakeMessages.getResourceString("AbstractBuiltinSpecsDetector.SerializingResults")); //$NON-NLS-1$
|
|
||||||
if (isChanged) { // avoids resource and settings change notifications
|
if (isChanged) { // avoids resource and settings change notifications
|
||||||
IStatus s = serializeLanguageSettings(currentCfgDescription);
|
IStatus s = serializeLanguageSettings(currentCfgDescription);
|
||||||
status.merge(s);
|
status.merge(s);
|
||||||
|
@ -628,8 +587,7 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
} catch (OperationCanceledException e) {
|
} catch (OperationCanceledException e) {
|
||||||
// user chose to cancel operation, do not threaten them with red error signs
|
// user chose to cancel operation, do not threaten them with red error signs
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
status.merge(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.PLUGIN_ID, IStatus.ERROR,
|
status.merge(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.PLUGIN_ID, IStatus.ERROR, "Error running Builtin Specs Detector", e)); //$NON-NLS-1$
|
||||||
"Error running Builtin Specs Detector", e)); //$NON-NLS-1$
|
|
||||||
ManagedBuilderCorePlugin.log(status);
|
ManagedBuilderCorePlugin.log(status);
|
||||||
} finally {
|
} finally {
|
||||||
monitor.done();
|
monitor.done();
|
||||||
|
@ -641,10 +599,8 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
/**
|
/**
|
||||||
* Initialize provider before running for a language.
|
* Initialize provider before running for a language.
|
||||||
*
|
*
|
||||||
* @param languageId
|
* @param languageId - language ID.
|
||||||
* - language ID.
|
* @throws CoreException if something goes wrong.
|
||||||
* @throws CoreException
|
|
||||||
* if something goes wrong.
|
|
||||||
*/
|
*/
|
||||||
protected void startupForLanguage(String languageId) throws CoreException {
|
protected void startupForLanguage(String languageId) throws CoreException {
|
||||||
currentLanguageId = languageId;
|
currentLanguageId = languageId;
|
||||||
|
@ -662,9 +618,7 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
protected void shutdownForLanguage() {
|
protected void shutdownForLanguage() {
|
||||||
if (detectedSettingEntries != null && detectedSettingEntries.size() > 0) {
|
if (detectedSettingEntries != null && detectedSettingEntries.size() > 0) {
|
||||||
collected = detectedSettingEntries.size();
|
collected = detectedSettingEntries.size();
|
||||||
IBuildConfiguration currentConfig = Adapters.adapt(currentCfgDescription,
|
setSettingEntries(currentCfgDescription, currentResource, currentLanguageId, detectedSettingEntries);
|
||||||
IBuildConfiguration.class);
|
|
||||||
setSettingEntries(currentConfig, currentResource, currentLanguageId, detectedSettingEntries);
|
|
||||||
}
|
}
|
||||||
detectedSettingEntries = null;
|
detectedSettingEntries = null;
|
||||||
|
|
||||||
|
@ -680,9 +634,8 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
/**
|
/**
|
||||||
* Run built-in specs command for one language.
|
* Run built-in specs command for one language.
|
||||||
*
|
*
|
||||||
* @param monitor
|
* @param monitor - progress monitor in the initial state where {@link IProgressMonitor#beginTask(String, int)}
|
||||||
* - progress monitor in the initial state where
|
* has not been called yet.
|
||||||
* {@link IProgressMonitor#beginTask(String, int)} has not been called yet.
|
|
||||||
*/
|
*/
|
||||||
private void runForLanguage(IProgressMonitor monitor) throws CoreException {
|
private void runForLanguage(IProgressMonitor monitor) throws CoreException {
|
||||||
buildRunnerHelper = new BuildRunnerHelper(currentProject);
|
buildRunnerHelper = new BuildRunnerHelper(currentProject);
|
||||||
|
@ -691,9 +644,7 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
monitor = new NullProgressMonitor();
|
monitor = new NullProgressMonitor();
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
monitor.beginTask(
|
monitor.beginTask(ManagedMakeMessages.getFormattedString("AbstractBuiltinSpecsDetector.RunningScannerDiscovery", getName()), //$NON-NLS-1$
|
||||||
ManagedMakeMessages.getFormattedString(
|
|
||||||
"AbstractBuiltinSpecsDetector.RunningScannerDiscovery", getName()), //$NON-NLS-1$
|
|
||||||
TICKS_EXECUTE_COMMAND + TICKS_OUTPUT_PARSING);
|
TICKS_EXECUTE_COMMAND + TICKS_OUTPUT_PARSING);
|
||||||
|
|
||||||
IConsole console;
|
IConsole console;
|
||||||
|
@ -701,8 +652,7 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
console = startProviderConsole();
|
console = startProviderConsole();
|
||||||
} else {
|
} else {
|
||||||
// that looks in extension points registry and won't find the id, this console is not shown
|
// that looks in extension points registry and won't find the id, this console is not shown
|
||||||
console = CCorePlugin.getDefault()
|
console = CCorePlugin.getDefault().getConsole(ManagedBuilderCorePlugin.PLUGIN_ID + ".console.hidden"); //$NON-NLS-1$
|
||||||
.getConsole(ManagedBuilderCorePlugin.PLUGIN_ID + ".console.hidden"); //$NON-NLS-1$
|
|
||||||
}
|
}
|
||||||
console.start(currentProject);
|
console.start(currentProject);
|
||||||
|
|
||||||
|
@ -723,32 +673,27 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
String[] envp = toEnvp(environmentMap);
|
String[] envp = toEnvp(environmentMap);
|
||||||
|
|
||||||
// Using GMAKE_ERROR_PARSER_ID as it can handle generated error messages
|
// Using GMAKE_ERROR_PARSER_ID as it can handle generated error messages
|
||||||
ErrorParserManager epm = new ErrorParserManager(currentProject, buildDirURI, markerGenerator,
|
ErrorParserManager epm = new ErrorParserManager(currentProject, buildDirURI, markerGenerator, new String[] {GMAKE_ERROR_PARSER_ID});
|
||||||
new String[] { GMAKE_ERROR_PARSER_ID });
|
|
||||||
ConsoleParserAdapter consoleParser = new ConsoleParserAdapter();
|
ConsoleParserAdapter consoleParser = new ConsoleParserAdapter();
|
||||||
consoleParser.startup(currentCfgDescription, epm);
|
consoleParser.startup(currentCfgDescription, epm);
|
||||||
List<IConsoleParser> parsers = new ArrayList<IConsoleParser>();
|
List<IConsoleParser> parsers = new ArrayList<IConsoleParser>();
|
||||||
parsers.add(consoleParser);
|
parsers.add(consoleParser);
|
||||||
|
|
||||||
buildRunnerHelper.setLaunchParameters(launcher, program, args, buildDirURI, envp);
|
buildRunnerHelper.setLaunchParameters(launcher, program, args, buildDirURI, envp);
|
||||||
buildRunnerHelper.prepareStreams(epm, parsers, console,
|
buildRunnerHelper.prepareStreams(epm, parsers, console, new SubProgressMonitor(monitor, TICKS_OUTPUT_PARSING));
|
||||||
new SubProgressMonitor(monitor, TICKS_OUTPUT_PARSING));
|
|
||||||
|
|
||||||
buildRunnerHelper.greeting(ManagedMakeMessages
|
buildRunnerHelper.greeting(ManagedMakeMessages.getFormattedString("AbstractBuiltinSpecsDetector.RunningScannerDiscovery", getName())); //$NON-NLS-1$
|
||||||
.getFormattedString("AbstractBuiltinSpecsDetector.RunningScannerDiscovery", getName())); //$NON-NLS-1$
|
|
||||||
|
|
||||||
OutputStream outStream = buildRunnerHelper.getOutputStream();
|
OutputStream outStream = buildRunnerHelper.getOutputStream();
|
||||||
OutputStream errStream = buildRunnerHelper.getErrorStream();
|
OutputStream errStream = buildRunnerHelper.getErrorStream();
|
||||||
runProgramForLanguage(currentLanguageId, currentCommandResolved, envp, buildDirURI, outStream,
|
runProgramForLanguage(currentLanguageId, currentCommandResolved, envp, buildDirURI, outStream, errStream,
|
||||||
errStream, new SubProgressMonitor(monitor, TICKS_EXECUTE_COMMAND,
|
new SubProgressMonitor(monitor, TICKS_EXECUTE_COMMAND, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK));
|
||||||
SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK));
|
|
||||||
|
|
||||||
buildRunnerHelper.close();
|
buildRunnerHelper.close();
|
||||||
buildRunnerHelper.goodbye();
|
buildRunnerHelper.goodbye();
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
ManagedBuilderCorePlugin.log(new CoreException(new Status(IStatus.ERROR,
|
ManagedBuilderCorePlugin.log(new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.PLUGIN_ID, "Error running Builtin Specs Detector" , e))); //$NON-NLS-1$
|
||||||
ManagedBuilderCorePlugin.PLUGIN_ID, "Error running Builtin Specs Detector", e))); //$NON-NLS-1$
|
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
buildRunnerHelper.close();
|
buildRunnerHelper.close();
|
||||||
|
@ -760,8 +705,8 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns list of environment variables to be used during execution of provider's command. Implementers
|
* Returns list of environment variables to be used during execution of provider's command.
|
||||||
* are expected to add their variables to the end of the list.
|
* Implementers are expected to add their variables to the end of the list.
|
||||||
*
|
*
|
||||||
* @return list of environment variables.
|
* @return list of environment variables.
|
||||||
* @since 8.2
|
* @since 8.2
|
||||||
|
@ -770,8 +715,7 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
if (envMngr == null) {
|
if (envMngr == null) {
|
||||||
envMngr = CCorePlugin.getDefault().getBuildEnvironmentManager();
|
envMngr = CCorePlugin.getDefault().getBuildEnvironmentManager();
|
||||||
}
|
}
|
||||||
List<IEnvironmentVariable> vars = new ArrayList<IEnvironmentVariable>(
|
List<IEnvironmentVariable> vars = new ArrayList<IEnvironmentVariable>(Arrays.asList(envMngr.getVariables(currentCfgDescription, true)));
|
||||||
Arrays.asList(envMngr.getVariables(currentCfgDescription, true)));
|
|
||||||
|
|
||||||
// On POSIX (Linux, UNIX) systems reset language variables to default (English)
|
// On POSIX (Linux, UNIX) systems reset language variables to default (English)
|
||||||
// with UTF-8 encoding since GNU compilers can handle only UTF-8 characters.
|
// with UTF-8 encoding since GNU compilers can handle only UTF-8 characters.
|
||||||
|
@ -811,9 +755,7 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
return envp.toArray(new String[envp.size()]);
|
return envp.toArray(new String[envp.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int runProgramForLanguage(String languageId, String command, String[] envp,
|
protected int runProgramForLanguage(String languageId, String command, String[] envp, URI workingDirectoryURI, OutputStream consoleOut, OutputStream consoleErr, IProgressMonitor monitor) throws CoreException, IOException {
|
||||||
URI workingDirectoryURI, OutputStream consoleOut, OutputStream consoleErr,
|
|
||||||
IProgressMonitor monitor) throws CoreException, IOException {
|
|
||||||
return buildRunnerHelper.build(monitor);
|
return buildRunnerHelper.build(monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -832,7 +774,6 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create and start the provider console.
|
* Create and start the provider console.
|
||||||
*
|
|
||||||
* @return CDT console.
|
* @return CDT console.
|
||||||
*/
|
*/
|
||||||
private IConsole startProviderConsole() {
|
private IConsole startProviderConsole() {
|
||||||
|
@ -847,39 +788,32 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
}
|
}
|
||||||
ILanguage ld = LanguageManager.getInstance().getLanguage(currentLanguageId);
|
ILanguage ld = LanguageManager.getInstance().getLanguage(currentLanguageId);
|
||||||
if (ld != null) {
|
if (ld != null) {
|
||||||
String consoleId = ManagedBuilderCorePlugin.PLUGIN_ID + '.' + getId() + '.'
|
String consoleId = ManagedBuilderCorePlugin.PLUGIN_ID + '.' + getId() + '.' + currentLanguageId;
|
||||||
+ currentLanguageId;
|
|
||||||
String consoleName = getName() + ", " + ld.getName(); //$NON-NLS-1$
|
String consoleName = getName() + ", " + ld.getName(); //$NON-NLS-1$
|
||||||
URL defaultIcon = Platform.getBundle(CDT_MANAGEDBUILDER_UI_PLUGIN_ID)
|
URL defaultIcon = Platform.getBundle(CDT_MANAGEDBUILDER_UI_PLUGIN_ID).getEntry(DEFAULT_CONSOLE_ICON);
|
||||||
.getEntry(DEFAULT_CONSOLE_ICON);
|
|
||||||
if (defaultIcon == null) {
|
if (defaultIcon == null) {
|
||||||
@SuppressWarnings("nls")
|
@SuppressWarnings("nls")
|
||||||
String msg = "Unable to find icon " + DEFAULT_CONSOLE_ICON + " in plugin "
|
String msg = "Unable to find icon " + DEFAULT_CONSOLE_ICON + " in plugin " + CDT_MANAGEDBUILDER_UI_PLUGIN_ID;
|
||||||
+ CDT_MANAGEDBUILDER_UI_PLUGIN_ID;
|
ManagedBuilderCorePlugin.log(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.PLUGIN_ID, msg));
|
||||||
ManagedBuilderCorePlugin
|
|
||||||
.log(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.PLUGIN_ID, msg));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
console = CCorePlugin.getDefault().getConsole(extConsoleId, consoleId, consoleName,
|
console = CCorePlugin.getDefault().getConsole(extConsoleId, consoleId, consoleName, defaultIcon);
|
||||||
defaultIcon);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (console == null) {
|
if (console == null) {
|
||||||
// that looks in extension points registry and won't find the id, this console is not shown
|
// that looks in extension points registry and won't find the id, this console is not shown
|
||||||
console = CCorePlugin.getDefault()
|
console = CCorePlugin.getDefault().getConsole(ManagedBuilderCorePlugin.PLUGIN_ID + ".console.hidden"); //$NON-NLS-1$
|
||||||
.getConsole(ManagedBuilderCorePlugin.PLUGIN_ID + ".console.hidden"); //$NON-NLS-1$
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return console;
|
return console;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get path to spec file which normally would be placed in workspace area. This value is used to replace
|
* Get path to spec file which normally would be placed in workspace area.
|
||||||
* macro ${INPUTS}.
|
* This value is used to replace macro ${INPUTS}.
|
||||||
*
|
*
|
||||||
* @param languageId
|
* @param languageId - language ID.
|
||||||
* - language ID.
|
|
||||||
* @return full path to the specs file.
|
* @return full path to the specs file.
|
||||||
*/
|
*/
|
||||||
protected String getSpecFile(String languageId) {
|
protected String getSpecFile(String languageId) {
|
||||||
|
@ -909,12 +843,11 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine file extension by language id. This implementation retrieves first extension from the list as
|
* Determine file extension by language id. This implementation retrieves first extension
|
||||||
* there could be multiple extensions associated with the given language. This value is used to replace
|
* from the list as there could be multiple extensions associated with the given language.
|
||||||
* macro ${EXT}.
|
* This value is used to replace macro ${EXT}.
|
||||||
*
|
*
|
||||||
* @param languageId
|
* @param languageId - given language ID.
|
||||||
* - given language ID.
|
|
||||||
* @return file extension associated with the language or {@code null} if not found.
|
* @return file extension associated with the language or {@code null} if not found.
|
||||||
*/
|
*/
|
||||||
protected String getSpecFileExtension(String languageId) {
|
protected String getSpecFileExtension(String languageId) {
|
||||||
|
@ -931,18 +864,16 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ext == null) {
|
if (ext == null) {
|
||||||
ManagedBuilderCorePlugin.log(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.PLUGIN_ID,
|
ManagedBuilderCorePlugin.log(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.PLUGIN_ID, "Unable to find file extension for language " + languageId)); //$NON-NLS-1$
|
||||||
"Unable to find file extension for language " + languageId)); //$NON-NLS-1$
|
|
||||||
}
|
}
|
||||||
return ext;
|
return ext;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine additional options to pass to scanner discovery command. These options are intended to come
|
* Determine additional options to pass to scanner discovery command.
|
||||||
* from the tool-chain.
|
* These options are intended to come from the tool-chain.
|
||||||
*
|
*
|
||||||
* @param languageId
|
* @param languageId - language ID.
|
||||||
* - language ID.
|
|
||||||
* @return additional options to pass to scanner discovery command.
|
* @return additional options to pass to scanner discovery command.
|
||||||
*
|
*
|
||||||
* @since 8.3
|
* @since 8.3
|
||||||
|
@ -976,8 +907,7 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
try {
|
try {
|
||||||
envPathHash = Long.parseLong(envPathHashStr);
|
envPathHash = Long.parseLong(envPathHashStr);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
ManagedBuilderCorePlugin.log(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.PLUGIN_ID,
|
ManagedBuilderCorePlugin.log(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.PLUGIN_ID, "Wrong integer format [" + envPathHashStr + "]", e)); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
"Wrong integer format [" + envPathHashStr + "]", e)); //$NON-NLS-1$ //$NON-NLS-2$
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,14 +42,12 @@ import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
|
||||||
import org.eclipse.cdt.utils.EFSExtensionManager;
|
import org.eclipse.cdt.utils.EFSExtensionManager;
|
||||||
import org.eclipse.cdt.utils.cdtvariables.CdtVariableResolver;
|
import org.eclipse.cdt.utils.cdtvariables.CdtVariableResolver;
|
||||||
import org.eclipse.core.filesystem.EFS;
|
import org.eclipse.core.filesystem.EFS;
|
||||||
import org.eclipse.core.resources.IBuildConfiguration;
|
|
||||||
import org.eclipse.core.resources.IContainer;
|
import org.eclipse.core.resources.IContainer;
|
||||||
import org.eclipse.core.resources.IFolder;
|
import org.eclipse.core.resources.IFolder;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.resources.IWorkspaceRoot;
|
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||||
import org.eclipse.core.resources.ResourcesPlugin;
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
import org.eclipse.core.runtime.Adapters;
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
@ -63,22 +61,19 @@ import org.w3c.dom.Element;
|
||||||
/**
|
/**
|
||||||
* Abstract class for language settings providers capable to parse build output.
|
* Abstract class for language settings providers capable to parse build output.
|
||||||
* <p>
|
* <p>
|
||||||
* <strong>EXPERIMENTAL</strong>. This class interface is not stable yet as it is not currently (CDT
|
* <strong>EXPERIMENTAL</strong>. This class interface is not stable yet as
|
||||||
* 8.1, Juno) clear how it may need to be used in future. There is no guarantee that this API will
|
* it is not currently (CDT 8.1, Juno) clear how it may need to be used in future.
|
||||||
* work or that it will remain the same. Please do not use this API without consulting with the CDT
|
* There is no guarantee that this API will work or that it will remain the same.
|
||||||
* team.
|
* Please do not use this API without consulting with the CDT team.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
|
||||||
* @noextend This class is not intended to be subclassed by clients.
|
* @noextend This class is not intended to be subclassed by clients.
|
||||||
*
|
*
|
||||||
* @since 8.1
|
* @since 8.1
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSettingsSerializableProvider
|
public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSettingsSerializableProvider implements ICBuildOutputParser {
|
||||||
implements ICBuildOutputParser {
|
|
||||||
protected static final String ATTR_KEEP_RELATIVE_PATHS = "keep-relative-paths"; //$NON-NLS-1$
|
protected static final String ATTR_KEEP_RELATIVE_PATHS = "keep-relative-paths"; //$NON-NLS-1$
|
||||||
// evaluates to "/${ProjName)/"
|
// evaluates to "/${ProjName)/"
|
||||||
private static final String PROJ_NAME_PREFIX = '/'
|
private static final String PROJ_NAME_PREFIX = '/' + CdtVariableResolver.createVariableReference(CdtVariableResolver.VAR_PROJ_NAME) + '/';
|
||||||
+ CdtVariableResolver.createVariableReference(CdtVariableResolver.VAR_PROJ_NAME) + '/';
|
|
||||||
|
|
||||||
protected ICConfigurationDescription currentCfgDescription = null;
|
protected ICConfigurationDescription currentCfgDescription = null;
|
||||||
protected IWorkingDirectoryTracker cwdTracker = null;
|
protected IWorkingDirectoryTracker cwdTracker = null;
|
||||||
|
@ -94,32 +89,26 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
|
|
||||||
private static final EFSExtensionProvider efsProviderDefault = new EFSExtensionProvider() {
|
private static final EFSExtensionProvider efsProviderDefault = new EFSExtensionProvider() {
|
||||||
final EFSExtensionManager efsManager = EFSExtensionManager.getDefault();
|
final EFSExtensionManager efsManager = EFSExtensionManager.getDefault();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPathFromURI(URI locationURI) {
|
public String getPathFromURI(URI locationURI) {
|
||||||
return efsManager.getPathFromURI(locationURI);
|
return efsManager.getPathFromURI(locationURI);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public URI getLinkedURI(URI locationURI) {
|
public URI getLinkedURI(URI locationURI) {
|
||||||
return efsManager.getLinkedURI(locationURI);
|
return efsManager.getLinkedURI(locationURI);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public URI createNewURIFromPath(URI locationOnSameFilesystem, String path) {
|
public URI createNewURIFromPath(URI locationOnSameFilesystem, String path) {
|
||||||
return efsManager.createNewURIFromPath(locationOnSameFilesystem, path);
|
return efsManager.createNewURIFromPath(locationOnSameFilesystem, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getMappedPath(URI locationURI) {
|
public String getMappedPath(URI locationURI) {
|
||||||
return efsManager.getMappedPath(locationURI);
|
return efsManager.getMappedPath(locationURI);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isVirtual(URI locationURI) {
|
public boolean isVirtual(URI locationURI) {
|
||||||
return efsManager.isVirtual(locationURI);
|
return efsManager.isVirtual(locationURI);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public URI append(URI baseURI, String extension) {
|
public URI append(URI baseURI, String extension) {
|
||||||
return efsManager.append(baseURI, extension);
|
return efsManager.append(baseURI, extension);
|
||||||
|
@ -127,9 +116,9 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract class defining common functionality for option parsers. The purpose of this parser
|
* Abstract class defining common functionality for option parsers.
|
||||||
* is to parse a portion of string representing a single option and create a language settings
|
* The purpose of this parser is to parse a portion of string representing
|
||||||
* entry out of it.
|
* a single option and create a language settings entry out of it.
|
||||||
*
|
*
|
||||||
* See {@link GCCBuildCommandParser} for an example how to define the parsers.
|
* See {@link GCCBuildCommandParser} for an example how to define the parsers.
|
||||||
*/
|
*/
|
||||||
|
@ -147,19 +136,13 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
* @param kind
|
* @param kind - kind of language settings entries being parsed by the parser.
|
||||||
* - kind of language settings entries being parsed by the parser.
|
* @param pattern - regular expression pattern being parsed by the parser.
|
||||||
* @param pattern
|
* @param nameExpression - capturing group expression defining name of an entry.
|
||||||
* - regular expression pattern being parsed by the parser.
|
* @param valueExpression - capturing group expression defining value of an entry.
|
||||||
* @param nameExpression
|
* @param extraFlag - extra-flag to add while creating language settings entry.
|
||||||
* - capturing group expression defining name of an entry.
|
|
||||||
* @param valueExpression
|
|
||||||
* - capturing group expression defining value of an entry.
|
|
||||||
* @param extraFlag
|
|
||||||
* - extra-flag to add while creating language settings entry.
|
|
||||||
*/
|
*/
|
||||||
public AbstractOptionParser(int kind, String pattern, String nameExpression, String valueExpression,
|
public AbstractOptionParser(int kind, String pattern, String nameExpression, String valueExpression, int extraFlag) {
|
||||||
int extraFlag) {
|
|
||||||
this.kind = kind;
|
this.kind = kind;
|
||||||
this.patternStr = pattern;
|
this.patternStr = pattern;
|
||||||
this.nameExpression = nameExpression;
|
this.nameExpression = nameExpression;
|
||||||
|
@ -170,16 +153,11 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create language settings entry of appropriate kind and considering extra-flag passed in
|
* Create language settings entry of appropriate kind and considering extra-flag passed in constructor.
|
||||||
* constructor.
|
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name - name of language settings entry.
|
||||||
* - name of language settings entry.
|
* @param value - value of language settings entry.
|
||||||
* @param value
|
* @param flag - flag to set. Note that the flag will be amended with the extra-flag defined in constructor.
|
||||||
* - value of language settings entry.
|
|
||||||
* @param flag
|
|
||||||
* - flag to set. Note that the flag will be amended with the extra-flag defined
|
|
||||||
* in constructor.
|
|
||||||
* @return new language settings entry.
|
* @return new language settings entry.
|
||||||
*/
|
*/
|
||||||
public ICLanguageSettingEntry createEntry(String name, String value, int flag) {
|
public ICLanguageSettingEntry createEntry(String name, String value, int flag) {
|
||||||
|
@ -214,13 +192,12 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test for a match and parse a portion of input string representing a single option to
|
* Test for a match and parse a portion of input string representing a single option
|
||||||
* retrieve name and value.
|
* to retrieve name and value.
|
||||||
*
|
*
|
||||||
* @param optionString
|
* @param optionString - an option to test and parse, possibly with an argument.
|
||||||
* - an option to test and parse, possibly with an argument.
|
* @return {@code true} if the option is a match to parser's regular expression
|
||||||
* @return {@code true} if the option is a match to parser's regular expression or
|
* or {@code false} otherwise.
|
||||||
* {@code false} otherwise.
|
|
||||||
*/
|
*/
|
||||||
public boolean parseOption(String optionString) {
|
public boolean parseOption(String optionString) {
|
||||||
// get rid of extra text at the end (for example file name could be confused for an argument)
|
// get rid of extra text at the end (for example file name could be confused for an argument)
|
||||||
|
@ -244,7 +221,6 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
public IncludePathOptionParser(String pattern, String nameExpression) {
|
public IncludePathOptionParser(String pattern, String nameExpression) {
|
||||||
super(ICLanguageSettingEntry.INCLUDE_PATH, pattern, nameExpression, nameExpression, 0);
|
super(ICLanguageSettingEntry.INCLUDE_PATH, pattern, nameExpression, nameExpression, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IncludePathOptionParser(String pattern, String nameExpression, int extraFlag) {
|
public IncludePathOptionParser(String pattern, String nameExpression, int extraFlag) {
|
||||||
super(ICLanguageSettingEntry.INCLUDE_PATH, pattern, nameExpression, nameExpression, extraFlag);
|
super(ICLanguageSettingEntry.INCLUDE_PATH, pattern, nameExpression, nameExpression, extraFlag);
|
||||||
}
|
}
|
||||||
|
@ -256,25 +232,17 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
protected static class IncludeFileOptionParser extends AbstractOptionParser {
|
protected static class IncludeFileOptionParser extends AbstractOptionParser {
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
* @param pattern - regular expression pattern being parsed by the parser.
|
||||||
* @param pattern
|
* @param nameExpression - capturing group expression defining name of an entry.
|
||||||
* - regular expression pattern being parsed by the parser.
|
|
||||||
* @param nameExpression
|
|
||||||
* - capturing group expression defining name of an entry.
|
|
||||||
*/
|
*/
|
||||||
public IncludeFileOptionParser(String pattern, String nameExpression) {
|
public IncludeFileOptionParser(String pattern, String nameExpression) {
|
||||||
super(ICLanguageSettingEntry.INCLUDE_FILE, pattern, nameExpression, nameExpression, 0);
|
super(ICLanguageSettingEntry.INCLUDE_FILE, pattern, nameExpression, nameExpression, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
* @param pattern - regular expression pattern being parsed by the parser.
|
||||||
* @param pattern
|
* @param nameExpression - capturing group expression defining name of an entry.
|
||||||
* - regular expression pattern being parsed by the parser.
|
* @param extraFlag - extra-flag to add while creating language settings entry.
|
||||||
* @param nameExpression
|
|
||||||
* - capturing group expression defining name of an entry.
|
|
||||||
* @param extraFlag
|
|
||||||
* - extra-flag to add while creating language settings entry.
|
|
||||||
*/
|
*/
|
||||||
public IncludeFileOptionParser(String pattern, String nameExpression, int extraFlag) {
|
public IncludeFileOptionParser(String pattern, String nameExpression, int extraFlag) {
|
||||||
super(ICLanguageSettingEntry.INCLUDE_FILE, pattern, nameExpression, nameExpression, extraFlag);
|
super(ICLanguageSettingEntry.INCLUDE_FILE, pattern, nameExpression, nameExpression, extraFlag);
|
||||||
|
@ -287,44 +255,28 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
protected static class MacroOptionParser extends AbstractOptionParser {
|
protected static class MacroOptionParser extends AbstractOptionParser {
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
* @param pattern - regular expression pattern being parsed by the parser.
|
||||||
* @param pattern
|
* @param nameExpression - capturing group expression defining name of an entry.
|
||||||
* - regular expression pattern being parsed by the parser.
|
* @param valueExpression - capturing group expression defining value of an entry.
|
||||||
* @param nameExpression
|
|
||||||
* - capturing group expression defining name of an entry.
|
|
||||||
* @param valueExpression
|
|
||||||
* - capturing group expression defining value of an entry.
|
|
||||||
*/
|
*/
|
||||||
public MacroOptionParser(String pattern, String nameExpression, String valueExpression) {
|
public MacroOptionParser(String pattern, String nameExpression, String valueExpression) {
|
||||||
super(ICLanguageSettingEntry.MACRO, pattern, nameExpression, valueExpression, 0);
|
super(ICLanguageSettingEntry.MACRO, pattern, nameExpression, valueExpression, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
* @param pattern - regular expression pattern being parsed by the parser.
|
||||||
* @param pattern
|
* @param nameExpression - capturing group expression defining name of an entry.
|
||||||
* - regular expression pattern being parsed by the parser.
|
* @param valueExpression - capturing group expression defining value of an entry.
|
||||||
* @param nameExpression
|
* @param extraFlag - extra-flag to add while creating language settings entry.
|
||||||
* - capturing group expression defining name of an entry.
|
|
||||||
* @param valueExpression
|
|
||||||
* - capturing group expression defining value of an entry.
|
|
||||||
* @param extraFlag
|
|
||||||
* - extra-flag to add while creating language settings entry.
|
|
||||||
*/
|
*/
|
||||||
public MacroOptionParser(String pattern, String nameExpression, String valueExpression,
|
public MacroOptionParser(String pattern, String nameExpression, String valueExpression, int extraFlag) {
|
||||||
int extraFlag) {
|
|
||||||
super(ICLanguageSettingEntry.MACRO, pattern, nameExpression, valueExpression, extraFlag);
|
super(ICLanguageSettingEntry.MACRO, pattern, nameExpression, valueExpression, extraFlag);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
* @param pattern - regular expression pattern being parsed by the parser.
|
||||||
* @param pattern
|
* @param nameExpression - capturing group expression defining name of an entry.
|
||||||
* - regular expression pattern being parsed by the parser.
|
* @param extraFlag - extra-flag to add while creating language settings entry.
|
||||||
* @param nameExpression
|
|
||||||
* - capturing group expression defining name of an entry.
|
|
||||||
* @param extraFlag
|
|
||||||
* - extra-flag to add while creating language settings entry.
|
|
||||||
*/
|
*/
|
||||||
public MacroOptionParser(String pattern, String nameExpression, int extraFlag) {
|
public MacroOptionParser(String pattern, String nameExpression, int extraFlag) {
|
||||||
super(ICLanguageSettingEntry.MACRO, pattern, nameExpression, null, extraFlag);
|
super(ICLanguageSettingEntry.MACRO, pattern, nameExpression, null, extraFlag);
|
||||||
|
@ -337,25 +289,17 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
protected static class MacroFileOptionParser extends AbstractOptionParser {
|
protected static class MacroFileOptionParser extends AbstractOptionParser {
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
* @param pattern - regular expression pattern being parsed by the parser.
|
||||||
* @param pattern
|
* @param nameExpression - capturing group expression defining name of an entry.
|
||||||
* - regular expression pattern being parsed by the parser.
|
|
||||||
* @param nameExpression
|
|
||||||
* - capturing group expression defining name of an entry.
|
|
||||||
*/
|
*/
|
||||||
public MacroFileOptionParser(String pattern, String nameExpression) {
|
public MacroFileOptionParser(String pattern, String nameExpression) {
|
||||||
super(ICLanguageSettingEntry.MACRO_FILE, pattern, nameExpression, nameExpression, 0);
|
super(ICLanguageSettingEntry.MACRO_FILE, pattern, nameExpression, nameExpression, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
* @param pattern - regular expression pattern being parsed by the parser.
|
||||||
* @param pattern
|
* @param nameExpression - capturing group expression defining name of an entry.
|
||||||
* - regular expression pattern being parsed by the parser.
|
* @param extraFlag - extra-flag to add while creating language settings entry.
|
||||||
* @param nameExpression
|
|
||||||
* - capturing group expression defining name of an entry.
|
|
||||||
* @param extraFlag
|
|
||||||
* - extra-flag to add while creating language settings entry.
|
|
||||||
*/
|
*/
|
||||||
public MacroFileOptionParser(String pattern, String nameExpression, int extraFlag) {
|
public MacroFileOptionParser(String pattern, String nameExpression, int extraFlag) {
|
||||||
super(ICLanguageSettingEntry.MACRO_FILE, pattern, nameExpression, nameExpression, extraFlag);
|
super(ICLanguageSettingEntry.MACRO_FILE, pattern, nameExpression, nameExpression, extraFlag);
|
||||||
|
@ -368,25 +312,17 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
protected static class LibraryPathOptionParser extends AbstractOptionParser {
|
protected static class LibraryPathOptionParser extends AbstractOptionParser {
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
* @param pattern - regular expression pattern being parsed by the parser.
|
||||||
* @param pattern
|
* @param nameExpression - capturing group expression defining name of an entry.
|
||||||
* - regular expression pattern being parsed by the parser.
|
|
||||||
* @param nameExpression
|
|
||||||
* - capturing group expression defining name of an entry.
|
|
||||||
*/
|
*/
|
||||||
public LibraryPathOptionParser(String pattern, String nameExpression) {
|
public LibraryPathOptionParser(String pattern, String nameExpression) {
|
||||||
super(ICLanguageSettingEntry.LIBRARY_PATH, pattern, nameExpression, nameExpression, 0);
|
super(ICLanguageSettingEntry.LIBRARY_PATH, pattern, nameExpression, nameExpression, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
* @param pattern - regular expression pattern being parsed by the parser.
|
||||||
* @param pattern
|
* @param nameExpression - capturing group expression defining name of an entry.
|
||||||
* - regular expression pattern being parsed by the parser.
|
* @param extraFlag - extra-flag to add while creating language settings entry.
|
||||||
* @param nameExpression
|
|
||||||
* - capturing group expression defining name of an entry.
|
|
||||||
* @param extraFlag
|
|
||||||
* - extra-flag to add while creating language settings entry.
|
|
||||||
*/
|
*/
|
||||||
public LibraryPathOptionParser(String pattern, String nameExpression, int extraFlag) {
|
public LibraryPathOptionParser(String pattern, String nameExpression, int extraFlag) {
|
||||||
super(ICLanguageSettingEntry.LIBRARY_PATH, pattern, nameExpression, nameExpression, extraFlag);
|
super(ICLanguageSettingEntry.LIBRARY_PATH, pattern, nameExpression, nameExpression, extraFlag);
|
||||||
|
@ -399,25 +335,17 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
protected static class LibraryFileOptionParser extends AbstractOptionParser {
|
protected static class LibraryFileOptionParser extends AbstractOptionParser {
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
* @param pattern - regular expression pattern being parsed by the parser.
|
||||||
* @param pattern
|
* @param nameExpression - capturing group expression defining name of an entry.
|
||||||
* - regular expression pattern being parsed by the parser.
|
|
||||||
* @param nameExpression
|
|
||||||
* - capturing group expression defining name of an entry.
|
|
||||||
*/
|
*/
|
||||||
public LibraryFileOptionParser(String pattern, String nameExpression) {
|
public LibraryFileOptionParser(String pattern, String nameExpression) {
|
||||||
super(ICLanguageSettingEntry.LIBRARY_FILE, pattern, nameExpression, nameExpression, 0);
|
super(ICLanguageSettingEntry.LIBRARY_FILE, pattern, nameExpression, nameExpression, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
* @param pattern - regular expression pattern being parsed by the parser.
|
||||||
* @param pattern
|
* @param nameExpression - capturing group expression defining name of an entry.
|
||||||
* - regular expression pattern being parsed by the parser.
|
* @param extraFlag - extra-flag to add while creating language settings entry.
|
||||||
* @param nameExpression
|
|
||||||
* - capturing group expression defining name of an entry.
|
|
||||||
* @param extraFlag
|
|
||||||
* - extra-flag to add while creating language settings entry.
|
|
||||||
*/
|
*/
|
||||||
public LibraryFileOptionParser(String pattern, String nameExpression, int extraFlag) {
|
public LibraryFileOptionParser(String pattern, String nameExpression, int extraFlag) {
|
||||||
super(ICLanguageSettingEntry.LIBRARY_FILE, pattern, nameExpression, nameExpression, extraFlag);
|
super(ICLanguageSettingEntry.LIBRARY_FILE, pattern, nameExpression, nameExpression, extraFlag);
|
||||||
|
@ -425,63 +353,60 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse the line returning the resource name as appears in the output. This is the resource
|
* Parse the line returning the resource name as appears in the output.
|
||||||
* where {@link ICLanguageSettingEntry} list is being added.
|
* This is the resource where {@link ICLanguageSettingEntry} list is being added.
|
||||||
*
|
*
|
||||||
* @param line
|
* @param line - one input line from the output stripped from end of line characters.
|
||||||
* - one input line from the output stripped from end of line characters.
|
* @return the resource name as appears in the output or {@code null}.
|
||||||
* @return the resource name as appears in the output or {@code null}. Note that {@code null}
|
* Note that {@code null} can have different semantics and can mean "no resource found"
|
||||||
* can have different semantics and can mean "no resource found" or "applicable to any
|
* or "applicable to any resource". By default "no resource found" is used in this
|
||||||
* resource". By default "no resource found" is used in this abstract class but
|
* abstract class but extenders can handle otherwise.
|
||||||
* extenders can handle otherwise.
|
|
||||||
*/
|
*/
|
||||||
protected abstract String parseResourceName(String line);
|
protected abstract String parseResourceName(String line);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse the line returning the list of substrings to be treated each as input to the option
|
* Parse the line returning the list of substrings to be treated each as input to
|
||||||
* parsers. It is assumed that each substring presents one {@link ICLanguageSettingEntry} (for
|
* the option parsers. It is assumed that each substring presents one
|
||||||
* example compiler options {@code -I/path} or {@code -DMACRO=1}).
|
* {@link ICLanguageSettingEntry} (for example compiler options {@code -I/path} or
|
||||||
|
* {@code -DMACRO=1}).
|
||||||
*
|
*
|
||||||
* @param line
|
* @param line - one input line from the output stripped from end of line characters.
|
||||||
* - one input line from the output stripped from end of line characters.
|
|
||||||
* @return list of substrings representing language settings entries.
|
* @return list of substrings representing language settings entries.
|
||||||
*/
|
*/
|
||||||
protected abstract List<String> parseOptions(String line);
|
protected abstract List<String> parseOptions(String line);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array of option parsers defining how to parse a string to
|
* @return array of option parsers defining how to parse a string to
|
||||||
* {@link ICLanguageSettingEntry}. See {@link AbstractOptionParser} and its specific
|
* {@link ICLanguageSettingEntry}.
|
||||||
* extenders.
|
* See {@link AbstractOptionParser} and its specific extenders.
|
||||||
*/
|
*/
|
||||||
protected abstract AbstractOptionParser[] getOptionParsers();
|
protected abstract AbstractOptionParser[] getOptionParsers();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {@code true} when the provider tries to resolve relative or remote paths to the
|
* @return {@code true} when the provider tries to resolve relative or remote paths
|
||||||
* existing paths in the workspace or local file-system using certain heuristics.
|
* to the existing paths in the workspace or local file-system using certain heuristics.
|
||||||
*/
|
*/
|
||||||
public boolean isResolvingPaths() {
|
public boolean isResolvingPaths() {
|
||||||
return isResolvingPaths;
|
return isResolvingPaths;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable or disable resolving relative or remote paths to the existing paths in the workspace
|
* Enable or disable resolving relative or remote paths to the existing paths
|
||||||
* or local file-system.
|
* in the workspace or local file-system.
|
||||||
*
|
*
|
||||||
* @param resolvePaths
|
* @param resolvePaths - set {@code true} to enable or {@code false} to disable
|
||||||
* - set {@code true} to enable or {@code false} to disable resolving paths. When
|
* resolving paths. When this parameter is set to {@code false} the paths will
|
||||||
* this parameter is set to {@code false} the paths will be kept as they appear in
|
* be kept as they appear in the build output.
|
||||||
* the build output.
|
|
||||||
*/
|
*/
|
||||||
public void setResolvingPaths(boolean resolvePaths) {
|
public void setResolvingPaths(boolean resolvePaths) {
|
||||||
this.isResolvingPaths = resolvePaths;
|
this.isResolvingPaths = resolvePaths;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void startup(ICConfigurationDescription cfgDescription, IWorkingDirectoryTracker cwdTracker)
|
public void startup(ICConfigurationDescription cfgDescription, IWorkingDirectoryTracker cwdTracker) throws CoreException {
|
||||||
throws CoreException {
|
|
||||||
this.currentCfgDescription = cfgDescription;
|
this.currentCfgDescription = cfgDescription;
|
||||||
this.currentProject = cfgDescription != null ? cfgDescription.getProjectDescription().getProject()
|
this.currentProject = cfgDescription != null ? cfgDescription.getProjectDescription().getProject() : null;
|
||||||
: null;
|
|
||||||
this.cwdTracker = cwdTracker;
|
this.cwdTracker = cwdTracker;
|
||||||
this.efsProvider = getEFSProvider();
|
this.efsProvider = getEFSProvider();
|
||||||
}
|
}
|
||||||
|
@ -507,18 +432,18 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* URI of directory where the build is happening. This URI could point to a remote
|
* URI of directory where the build is happening. This URI could point to a remote file-system
|
||||||
* file-system for remote builds. Most often it is the same file-system as for
|
* for remote builds. Most often it is the same file-system as for currentResource but
|
||||||
* currentResource but it can be different file-system (and different URI schema).
|
* it can be different file-system (and different URI schema).
|
||||||
*/
|
*/
|
||||||
URI buildDirURI = null;
|
URI buildDirURI = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Where source tree starts if mapped. This kind of mapping is useful for example in cases
|
* Where source tree starts if mapped. This kind of mapping is useful for example in cases when
|
||||||
* when the absolute path to the source file on the remote system is simulated inside a
|
* the absolute path to the source file on the remote system is simulated inside a project in the
|
||||||
* project in the workspace. This URI is rooted on the same file-system where
|
* workspace.
|
||||||
* currentResource resides. In general this file-system (or even URI schema) does not have
|
* This URI is rooted on the same file-system where currentResource resides. In general this file-system
|
||||||
* to match that of buildDirURI.
|
* (or even URI schema) does not have to match that of buildDirURI.
|
||||||
*/
|
*/
|
||||||
URI mappedRootURI = null;
|
URI mappedRootURI = null;
|
||||||
|
|
||||||
|
@ -537,8 +462,7 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
try {
|
try {
|
||||||
if (optionParser.parseOption(option)) {
|
if (optionParser.parseOption(option)) {
|
||||||
ICLanguageSettingEntry entry = null;
|
ICLanguageSettingEntry entry = null;
|
||||||
if (isResolvingPaths
|
if (isResolvingPaths && (optionParser.isForFile() || optionParser.isForFolder())) {
|
||||||
&& (optionParser.isForFile() || optionParser.isForFolder())) {
|
|
||||||
URI baseURI = mappedRootURI;
|
URI baseURI = mappedRootURI;
|
||||||
if (buildDirURI != null && !new Path(optionParser.parsedName).isAbsolute()) {
|
if (buildDirURI != null && !new Path(optionParser.parsedName).isAbsolute()) {
|
||||||
if (mappedRootURI != null) {
|
if (mappedRootURI != null) {
|
||||||
|
@ -547,11 +471,9 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
baseURI = buildDirURI;
|
baseURI = buildDirURI;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
entry = createResolvedPathEntry(optionParser, optionParser.parsedName, 0,
|
entry = createResolvedPathEntry(optionParser, optionParser.parsedName, 0, baseURI);
|
||||||
baseURI);
|
|
||||||
} else {
|
} else {
|
||||||
entry = optionParser.createEntry(optionParser.parsedName,
|
entry = optionParser.createEntry(optionParser.parsedName, optionParser.parsedValue, 0);
|
||||||
optionParser.parsedValue, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entry != null && !entries.contains(entry)) {
|
if (entry != null && !entries.contains(entry)) {
|
||||||
|
@ -561,10 +483,8 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
@SuppressWarnings("nls")
|
@SuppressWarnings("nls")
|
||||||
String msg = "Exception trying to parse option [" + option + "], class "
|
String msg = "Exception trying to parse option [" + option + "], class " + getClass().getSimpleName();
|
||||||
+ getClass().getSimpleName();
|
ManagedBuilderCorePlugin.log(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.PLUGIN_ID, msg, e));
|
||||||
ManagedBuilderCorePlugin
|
|
||||||
.log(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.PLUGIN_ID, msg, e));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -578,14 +498,13 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* In case when absolute path is mapped to the source tree in a project this function will try
|
* In case when absolute path is mapped to the source tree in a project
|
||||||
* to figure mapping and return "mapped root", i.e URI where the root path would be mapped. The
|
* this function will try to figure mapping and return "mapped root",
|
||||||
* mapped root will be used to prepend to other "absolute" paths where appropriate.
|
* i.e URI where the root path would be mapped. The mapped root will be
|
||||||
|
* used to prepend to other "absolute" paths where appropriate.
|
||||||
*
|
*
|
||||||
* @param resource
|
* @param resource - a resource referred by parsed path
|
||||||
* - a resource referred by parsed path
|
* @param parsedResourceName - path as appears in the output
|
||||||
* @param parsedResourceName
|
|
||||||
* - path as appears in the output
|
|
||||||
* @return mapped path as URI
|
* @return mapped path as URI
|
||||||
*/
|
*/
|
||||||
protected URI getMappedRootURI(IResource resource, String parsedResourceName) {
|
protected URI getMappedRootURI(IResource resource, String parsedResourceName) {
|
||||||
|
@ -623,8 +542,7 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
* Determine current build directory considering currentResource (resource being compiled),
|
* Determine current build directory considering currentResource (resource being compiled),
|
||||||
* parsedResourceName and mappedRootURI.
|
* parsedResourceName and mappedRootURI.
|
||||||
*
|
*
|
||||||
* @param mappedRootURI
|
* @param mappedRootURI - root of the source tree when mapped to remote file-system.
|
||||||
* - root of the source tree when mapped to remote file-system.
|
|
||||||
* @return {@link URI} of current build directory
|
* @return {@link URI} of current build directory
|
||||||
*/
|
*/
|
||||||
protected URI getBuildDirURI(URI mappedRootURI) {
|
protected URI getBuildDirURI(URI mappedRootURI) {
|
||||||
|
@ -632,8 +550,7 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
|
|
||||||
// try to deduce build directory from full path of currentResource and partial path of parsedResourceName
|
// try to deduce build directory from full path of currentResource and partial path of parsedResourceName
|
||||||
URI cwdURI = null;
|
URI cwdURI = null;
|
||||||
if (currentResource != null && parsedResourceName != null
|
if (currentResource != null && parsedResourceName != null && !new Path(parsedResourceName).isAbsolute()) {
|
||||||
&& !new Path(parsedResourceName).isAbsolute()) {
|
|
||||||
cwdURI = findBaseLocationURI(currentResource.getLocationURI(), parsedResourceName);
|
cwdURI = findBaseLocationURI(currentResource.getLocationURI(), parsedResourceName);
|
||||||
}
|
}
|
||||||
String cwdPath = cwdURI != null ? efsProvider.getPathFromURI(cwdURI) : null;
|
String cwdPath = cwdURI != null ? efsProvider.getPathFromURI(cwdURI) : null;
|
||||||
|
@ -686,15 +603,13 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets language settings entries for current configuration description, current resource and
|
* Sets language settings entries for current configuration description, current resource
|
||||||
* current language ID.
|
* and current language ID.
|
||||||
*
|
*
|
||||||
* @param entries
|
* @param entries - language settings entries to set.
|
||||||
* - language settings entries to set.
|
|
||||||
*/
|
*/
|
||||||
protected void setSettingEntries(List<? extends ICLanguageSettingEntry> entries) {
|
protected void setSettingEntries(List<? extends ICLanguageSettingEntry> entries) {
|
||||||
IBuildConfiguration currentConfig = Adapters.adapt(currentCfgDescription, IBuildConfiguration.class);
|
setSettingEntries(currentCfgDescription, currentResource, currentLanguageId, entries);
|
||||||
setSettingEntries(currentConfig, currentResource, currentLanguageId, entries);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -723,8 +638,7 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
/**
|
/**
|
||||||
* Determine if the language is in scope of the provider.
|
* Determine if the language is in scope of the provider.
|
||||||
*
|
*
|
||||||
* @param languageId
|
* @param languageId - language ID.
|
||||||
* - language ID.
|
|
||||||
* @return {@code true} if the language is in scope, {@code false } otherwise.
|
* @return {@code true} if the language is in scope, {@code false } otherwise.
|
||||||
*/
|
*/
|
||||||
protected boolean isLanguageInScope(String languageId) {
|
protected boolean isLanguageInScope(String languageId) {
|
||||||
|
@ -733,11 +647,10 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find file resource in the workspace for a given URI with a preference for the resource to
|
* Find file resource in the workspace for a given URI with a preference for the resource
|
||||||
* reside in the given project.
|
* to reside in the given project.
|
||||||
*/
|
*/
|
||||||
private static IResource findFileForLocationURI(URI uri, IProject preferredProject,
|
private static IResource findFileForLocationURI(URI uri, IProject preferredProject, boolean checkExistence) {
|
||||||
boolean checkExistence) {
|
|
||||||
IResource sourceFile = null;
|
IResource sourceFile = null;
|
||||||
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
|
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
|
||||||
IResource[] resources = root.findFilesForLocationURI(uri);
|
IResource[] resources = root.findFilesForLocationURI(uri);
|
||||||
|
@ -756,11 +669,10 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a resource in workspace corresponding the given folder {@link URI} preferable residing
|
* Return a resource in workspace corresponding the given folder {@link URI} preferable residing in
|
||||||
* in the provided project.
|
* the provided project.
|
||||||
*/
|
*/
|
||||||
private static IResource findContainerForLocationURI(URI uri, IProject preferredProject,
|
private static IResource findContainerForLocationURI(URI uri, IProject preferredProject, boolean checkExistence) {
|
||||||
boolean checkExistence) {
|
|
||||||
IResource resource = null;
|
IResource resource = null;
|
||||||
IResource[] resources = ResourcesPlugin.getWorkspace().getRoot().findContainersForLocationURI(uri);
|
IResource[] resources = ResourcesPlugin.getWorkspace().getRoot().findContainersForLocationURI(uri);
|
||||||
for (IResource rc : resources) {
|
for (IResource rc : resources) {
|
||||||
|
@ -818,8 +730,7 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@SuppressWarnings("nls")
|
@SuppressWarnings("nls")
|
||||||
String msg = "Exception trying to resolve value [" + strBuilderCWD + "]";
|
String msg = "Exception trying to resolve value [" + strBuilderCWD + "]";
|
||||||
ManagedBuilderCorePlugin
|
ManagedBuilderCorePlugin.log(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.PLUGIN_ID, msg, e));
|
||||||
.log(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.PLUGIN_ID, msg, e));
|
|
||||||
}
|
}
|
||||||
builderCWD = new Path(strBuilderCWD);
|
builderCWD = new Path(strBuilderCWD);
|
||||||
|
|
||||||
|
@ -838,9 +749,9 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find base location of the file, i.e. location of the directory which results from removing
|
* Find base location of the file, i.e. location of the directory which
|
||||||
* trailing relativeFileName from fileURI or {@code null} if fileURI doesn't represent
|
* results from removing trailing relativeFileName from fileURI or
|
||||||
* relativeFileName.
|
* {@code null} if fileURI doesn't represent relativeFileName.
|
||||||
*/
|
*/
|
||||||
private static URI findBaseLocationURI(URI fileURI, String relativeFileName) {
|
private static URI findBaseLocationURI(URI fileURI, String relativeFileName) {
|
||||||
URI cwdURI = null;
|
URI cwdURI = null;
|
||||||
|
@ -869,8 +780,8 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
cwdURI = new URI(fileURI.getScheme(), fileURI.getUserInfo(), fileURI.getHost(), fileURI.getPort(),
|
cwdURI = new URI(fileURI.getScheme(), fileURI.getUserInfo(), fileURI.getHost(),
|
||||||
path + '/', fileURI.getQuery(), fileURI.getFragment());
|
fileURI.getPort(), path + '/', fileURI.getQuery(), fileURI.getFragment());
|
||||||
} catch (URISyntaxException e) {
|
} catch (URISyntaxException e) {
|
||||||
// It should be valid URI here or something is really wrong
|
// It should be valid URI here or something is really wrong
|
||||||
ManagedBuilderCorePlugin.log(e);
|
ManagedBuilderCorePlugin.log(e);
|
||||||
|
@ -880,11 +791,10 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The manipulations here are done to resolve problems such as "../" navigation for symbolic
|
* The manipulations here are done to resolve problems such as "../" navigation for symbolic links where
|
||||||
* links where "link/.." cannot be collapsed as it must follow the real file-system path.
|
* "link/.." cannot be collapsed as it must follow the real file-system path. {@link java.io.File#getCanonicalPath()}
|
||||||
* {@link java.io.File#getCanonicalPath()} deals with that correctly but {@link Path} or
|
* deals with that correctly but {@link Path} or {@link URI} try to normalize the path which would be incorrect here.
|
||||||
* {@link URI} try to normalize the path which would be incorrect here. Another issue being
|
* Another issue being resolved here is fixing drive letters in URI syntax.
|
||||||
* resolved here is fixing drive letters in URI syntax.
|
|
||||||
*/
|
*/
|
||||||
private static URI resolvePathFromBaseLocation(String pathStr0, IPath baseLocation) {
|
private static URI resolvePathFromBaseLocation(String pathStr0, IPath baseLocation) {
|
||||||
String pathStr = pathStr0;
|
String pathStr = pathStr0;
|
||||||
|
@ -941,10 +851,8 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
/**
|
/**
|
||||||
* Determine URI on the local file-system considering possible mapping.
|
* Determine URI on the local file-system considering possible mapping.
|
||||||
*
|
*
|
||||||
* @param pathStr
|
* @param pathStr - path to the resource, can be absolute or relative
|
||||||
* - path to the resource, can be absolute or relative
|
* @param baseURI - base {@link URI} where path to the resource is rooted
|
||||||
* @param baseURI
|
|
||||||
* - base {@link URI} where path to the resource is rooted
|
|
||||||
* @return {@link URI} of the resource
|
* @return {@link URI} of the resource
|
||||||
*/
|
*/
|
||||||
private URI determineMappedURI(String pathStr, URI baseURI) {
|
private URI determineMappedURI(String pathStr, URI baseURI) {
|
||||||
|
@ -961,8 +869,7 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
uri = resolvePathFromBaseLocation(pathStr, baseLocation);
|
uri = resolvePathFromBaseLocation(pathStr, baseLocation);
|
||||||
} else {
|
} else {
|
||||||
// location on a remote file-system
|
// location on a remote file-system
|
||||||
IPath path = new Path(pathStr); // use canonicalized path here, in particular replace all '\' with
|
IPath path = new Path(pathStr); // use canonicalized path here, in particular replace all '\' with '/' for Windows paths
|
||||||
// '/' for Windows paths
|
|
||||||
URI remoteUri = efsProvider.append(baseURI, path.toString());
|
URI remoteUri = efsProvider.append(baseURI, path.toString());
|
||||||
if (remoteUri != null) {
|
if (remoteUri != null) {
|
||||||
String localPath = efsProvider.getMappedPath(remoteUri);
|
String localPath = efsProvider.getMappedPath(remoteUri);
|
||||||
|
@ -1057,8 +964,7 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
if (projects.length > 0) {
|
if (projects.length > 0) {
|
||||||
IResource rc = null;
|
IResource rc = null;
|
||||||
for (IProject prj : projects) {
|
for (IProject prj : projects) {
|
||||||
if (!prj.equals(currentProject) && !referencedProjectsNames.contains(prj.getName())
|
if (!prj.equals(currentProject) && !referencedProjectsNames.contains(prj.getName()) && prj.isOpen()) {
|
||||||
&& prj.isOpen()) {
|
|
||||||
List<IResource> result = findPathInFolder(path, prj);
|
List<IResource> result = findPathInFolder(path, prj);
|
||||||
int size = result.size();
|
int size = result.size();
|
||||||
if (size == 1 && rc == null) {
|
if (size == 1 && rc == null) {
|
||||||
|
@ -1080,8 +986,7 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get location on the local file-system considering possible mapping by EFS provider. See
|
* Get location on the local file-system considering possible mapping by EFS provider. See {@link EFSExtensionManager}.
|
||||||
* {@link EFSExtensionManager}.
|
|
||||||
*/
|
*/
|
||||||
private IPath getFilesystemLocation(URI uri) {
|
private IPath getFilesystemLocation(URI uri) {
|
||||||
if (uri == null)
|
if (uri == null)
|
||||||
|
@ -1108,17 +1013,14 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
/**
|
/**
|
||||||
* Resolve and create language settings path entry.
|
* Resolve and create language settings path entry.
|
||||||
*/
|
*/
|
||||||
private ICLanguageSettingEntry createResolvedPathEntry(AbstractOptionParser optionParser,
|
private ICLanguageSettingEntry createResolvedPathEntry(AbstractOptionParser optionParser, String parsedPath, int flag, URI baseURI) {
|
||||||
String parsedPath, int flag, URI baseURI) {
|
|
||||||
URI uri = determineMappedURI(parsedPath, baseURI);
|
URI uri = determineMappedURI(parsedPath, baseURI);
|
||||||
boolean isRelative = !new Path(parsedPath).isAbsolute();
|
boolean isRelative = !new Path(parsedPath).isAbsolute();
|
||||||
// is mapped something that is not a project root
|
// is mapped something that is not a project root
|
||||||
boolean isRemapped = baseURI != null && currentProject != null
|
boolean isRemapped = baseURI != null && currentProject != null && !baseURI.equals(currentProject.getLocationURI());
|
||||||
&& !baseURI.equals(currentProject.getLocationURI());
|
|
||||||
boolean presentAsRelative = isRelative || isRemapped;
|
boolean presentAsRelative = isRelative || isRemapped;
|
||||||
|
|
||||||
ICLanguageSettingEntry entry = resolvePathEntryInWorkspace(optionParser, uri, flag,
|
ICLanguageSettingEntry entry = resolvePathEntryInWorkspace(optionParser, uri, flag, presentAsRelative);
|
||||||
presentAsRelative);
|
|
||||||
if (entry != null) {
|
if (entry != null) {
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
@ -1142,11 +1044,10 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a language settings entry for a given resource. This will represent relative path
|
* Create a language settings entry for a given resource.
|
||||||
* using CDT variable ${ProjName}.
|
* This will represent relative path using CDT variable ${ProjName}.
|
||||||
*/
|
*/
|
||||||
private ICLanguageSettingEntry createPathEntry(AbstractOptionParser optionParser, IResource rc,
|
private ICLanguageSettingEntry createPathEntry(AbstractOptionParser optionParser, IResource rc, boolean isRelative, int flag) {
|
||||||
boolean isRelative, int flag) {
|
|
||||||
String path;
|
String path;
|
||||||
if (isRelative && rc.getProject().equals(currentProject)) {
|
if (isRelative && rc.getProject().equals(currentProject)) {
|
||||||
path = PROJ_NAME_PREFIX + rc.getFullPath().removeFirstSegments(1);
|
path = PROJ_NAME_PREFIX + rc.getFullPath().removeFirstSegments(1);
|
||||||
|
@ -1161,8 +1062,7 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
/**
|
/**
|
||||||
* Find an existing resource in the workspace and create a language settings entry for it.
|
* Find an existing resource in the workspace and create a language settings entry for it.
|
||||||
*/
|
*/
|
||||||
private ICLanguageSettingEntry resolvePathEntryInWorkspace(AbstractOptionParser optionParser, URI uri,
|
private ICLanguageSettingEntry resolvePathEntryInWorkspace(AbstractOptionParser optionParser, URI uri, int flag, boolean isRelative) {
|
||||||
int flag, boolean isRelative) {
|
|
||||||
if (uri != null && uri.isAbsolute()) {
|
if (uri != null && uri.isAbsolute()) {
|
||||||
IResource rc = null;
|
IResource rc = null;
|
||||||
if (optionParser.isForFolder()) {
|
if (optionParser.isForFolder()) {
|
||||||
|
@ -1180,8 +1080,7 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
/**
|
/**
|
||||||
* Find a resource on the file-system and create a language settings entry for it.
|
* Find a resource on the file-system and create a language settings entry for it.
|
||||||
*/
|
*/
|
||||||
private ICLanguageSettingEntry resolvePathEntryInFilesystem(AbstractOptionParser optionParser, URI uri,
|
private ICLanguageSettingEntry resolvePathEntryInFilesystem(AbstractOptionParser optionParser, URI uri, int flag) {
|
||||||
int flag) {
|
|
||||||
IPath location = getFilesystemLocation(uri);
|
IPath location = getFilesystemLocation(uri);
|
||||||
if (location != null) {
|
if (location != null) {
|
||||||
String loc = location.toString();
|
String loc = location.toString();
|
||||||
|
@ -1193,11 +1092,9 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find a best fit for the resource in the workspace and create a language settings entry for
|
* Find a best fit for the resource in the workspace and create a language settings entry for it.
|
||||||
* it.
|
|
||||||
*/
|
*/
|
||||||
private ICLanguageSettingEntry resolvePathEntryInWorkspaceAsBestFit(AbstractOptionParser optionParser,
|
private ICLanguageSettingEntry resolvePathEntryInWorkspaceAsBestFit(AbstractOptionParser optionParser, String parsedPath, int flag, boolean isRelative) {
|
||||||
String parsedPath, int flag, boolean isRelative) {
|
|
||||||
IResource rc = findBestFitInWorkspace(parsedPath);
|
IResource rc = findBestFitInWorkspace(parsedPath);
|
||||||
if (rc != null) {
|
if (rc != null) {
|
||||||
return createPathEntry(optionParser, rc, isRelative, flag);
|
return createPathEntry(optionParser, rc, isRelative, flag);
|
||||||
|
@ -1206,11 +1103,9 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Try to map a resource in the workspace even if it does not exist and create a language
|
* Try to map a resource in the workspace even if it does not exist and create a language settings entry for it.
|
||||||
* settings entry for it.
|
|
||||||
*/
|
*/
|
||||||
private ICLanguageSettingEntry resolvePathEntryInWorkspaceToNonexistingResource(
|
private ICLanguageSettingEntry resolvePathEntryInWorkspaceToNonexistingResource(AbstractOptionParser optionParser, URI uri, int flag, boolean isRelative) {
|
||||||
AbstractOptionParser optionParser, URI uri, int flag, boolean isRelative) {
|
|
||||||
if (uri != null && uri.isAbsolute()) {
|
if (uri != null && uri.isAbsolute()) {
|
||||||
IResource rc = null;
|
IResource rc = null;
|
||||||
if (optionParser.isForFolder()) {
|
if (optionParser.isForFolder()) {
|
||||||
|
@ -1226,11 +1121,9 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Try to map a resource on the file-system even if it does not exist and create a language
|
* Try to map a resource on the file-system even if it does not exist and create a language settings entry for it.
|
||||||
* settings entry for it.
|
|
||||||
*/
|
*/
|
||||||
private ICLanguageSettingEntry resolvePathEntryInFilesystemToNonExistingResource(
|
private ICLanguageSettingEntry resolvePathEntryInFilesystemToNonExistingResource(AbstractOptionParser optionParser, URI uri, int flag) {
|
||||||
AbstractOptionParser optionParser, URI uri, int flag) {
|
|
||||||
IPath location = getFilesystemLocation(uri);
|
IPath location = getFilesystemLocation(uri);
|
||||||
if (location != null) {
|
if (location != null) {
|
||||||
return optionParser.createEntry(location.toString(), location.toString(), flag);
|
return optionParser.createEntry(location.toString(), location.toString(), flag);
|
||||||
|
@ -1239,11 +1132,10 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Count how many groups are present in regular expression. The implementation is simplistic but
|
* Count how many groups are present in regular expression.
|
||||||
* should be sufficient for the cause.
|
* The implementation is simplistic but should be sufficient for the cause.
|
||||||
*
|
*
|
||||||
* @param str
|
* @param str - regular expression to count the groups.
|
||||||
* - regular expression to count the groups.
|
|
||||||
* @return number of the groups (groups are enclosed in round brackets) present.
|
* @return number of the groups (groups are enclosed in round brackets) present.
|
||||||
*/
|
*/
|
||||||
protected static int countGroups(String str) {
|
protected static int countGroups(String str) {
|
||||||
|
@ -1272,8 +1164,8 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct regular expression to find any file extension for C or C++. Returns expression
|
* Construct regular expression to find any file extension for C or C++.
|
||||||
* shaped in form of "((cpp)|(c++)|(c))".
|
* Returns expression shaped in form of "((cpp)|(c++)|(c))".
|
||||||
*
|
*
|
||||||
* @return regular expression for searching C/C++ file extensions.
|
* @return regular expression for searching C/C++ file extensions.
|
||||||
*/
|
*/
|
||||||
|
@ -1297,9 +1189,9 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
* This {@link EFSExtensionProvider} is capable to translate EFS paths to and from local
|
* This {@link EFSExtensionProvider} is capable to translate EFS paths to and from local
|
||||||
* file-system. Added mostly for Cygwin translations.
|
* file-system. Added mostly for Cygwin translations.
|
||||||
*
|
*
|
||||||
* This usage of {@link EFSExtensionProvider} is somewhat a misnomer. This provider is not an
|
* This usage of {@link EFSExtensionProvider} is somewhat a misnomer. This provider is not
|
||||||
* "extension" provider but rather a wrapper on {@link EFSExtensionManager} which in fact will
|
* an "extension" provider but rather a wrapper on {@link EFSExtensionManager} which in fact
|
||||||
* use genuine {@link EFSExtensionProvider}s defined as extensions.
|
* will use genuine {@link EFSExtensionProvider}s defined as extensions.
|
||||||
*
|
*
|
||||||
* @since 8.2
|
* @since 8.2
|
||||||
*/
|
*/
|
||||||
|
@ -1318,8 +1210,7 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
public void loadAttributes(Element providerNode) {
|
public void loadAttributes(Element providerNode) {
|
||||||
super.loadAttributes(providerNode);
|
super.loadAttributes(providerNode);
|
||||||
|
|
||||||
String expandRelativePathsValue = XmlUtil.determineAttributeValue(providerNode,
|
String expandRelativePathsValue = XmlUtil.determineAttributeValue(providerNode, ATTR_KEEP_RELATIVE_PATHS);
|
||||||
ATTR_KEEP_RELATIVE_PATHS);
|
|
||||||
if (expandRelativePathsValue!=null)
|
if (expandRelativePathsValue!=null)
|
||||||
isResolvingPaths = ! Boolean.parseBoolean(expandRelativePathsValue);
|
isResolvingPaths = ! Boolean.parseBoolean(expandRelativePathsValue);
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,4 +59,288 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disa
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
|
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
||||||
org.eclipse.jdt.core.compiler.source=1.7
|
org.eclipse.jdt.core.compiler.source=1.7
|
||||||
org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter
|
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
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
|
||||||
|
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_expressions_in_array_initializer=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
|
||||||
|
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
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
|
||||||
|
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_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
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_field=0
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_method=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_package=0
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
|
||||||
|
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.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.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.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.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
|
||||||
|
org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
|
||||||
|
org.eclipse.jdt.core.formatter.compact_else_if=true
|
||||||
|
org.eclipse.jdt.core.formatter.continuation_indentation=2
|
||||||
|
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.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
|
||||||
|
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
|
||||||
|
org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
|
||||||
|
org.eclipse.jdt.core.formatter.indent_empty_lines=false
|
||||||
|
org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
|
||||||
|
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_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
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
|
||||||
|
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=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
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.join_lines_in_comments=true
|
||||||
|
org.eclipse.jdt.core.formatter.join_wrapped_lines=true
|
||||||
|
org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
|
||||||
|
org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
|
||||||
|
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
|
||||||
|
org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
|
||||||
|
org.eclipse.jdt.core.formatter.lineSplit=120
|
||||||
|
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.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_binary_operator=true
|
||||||
|
org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
|
||||||
|
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
|
formatter_profile=org.eclipse.jdt.ui.default.eclipse_profile
|
||||||
formatter_settings_version=12
|
formatter_settings_version=12
|
||||||
internal.default.compliance=user
|
internal.default.compliance=user
|
||||||
|
|
|
@ -16,6 +16,8 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import junit.framework.TestSuite;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.settings.model.CIncludeFileEntry;
|
import org.eclipse.cdt.core.settings.model.CIncludeFileEntry;
|
||||||
import org.eclipse.cdt.core.settings.model.CIncludePathEntry;
|
import org.eclipse.cdt.core.settings.model.CIncludePathEntry;
|
||||||
import org.eclipse.cdt.core.settings.model.CLibraryFileEntry;
|
import org.eclipse.cdt.core.settings.model.CLibraryFileEntry;
|
||||||
|
@ -27,13 +29,10 @@ import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
||||||
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
|
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
|
||||||
import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsExtensionManager;
|
import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsExtensionManager;
|
||||||
import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsProvidersSerializer;
|
import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsProvidersSerializer;
|
||||||
import org.eclipse.core.resources.IBuildConfiguration;
|
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.ResourcesPlugin;
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
|
|
||||||
import junit.framework.TestSuite;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test cases testing LanguageSettingsProvider extensions
|
* Test cases testing LanguageSettingsProvider extensions
|
||||||
*/
|
*/
|
||||||
|
@ -339,7 +338,7 @@ public class LanguageSettingsExtensionsTests extends BaseTestCase {
|
||||||
|
|
||||||
List<ICLanguageSettingEntry> expected = new ArrayList<ICLanguageSettingEntry>();
|
List<ICLanguageSettingEntry> expected = new ArrayList<ICLanguageSettingEntry>();
|
||||||
expected.add(EXTENSION_EDITABLE_PROVIDER_ENTRY);
|
expected.add(EXTENSION_EDITABLE_PROVIDER_ENTRY);
|
||||||
assertEquals(expected, provider.getSettingEntries((IBuildConfiguration) null, null, null));
|
assertEquals(expected, provider.getSettingEntries(null, null, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -14,6 +14,8 @@ package org.eclipse.cdt.core.language.settings.providers;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import junit.framework.TestSuite;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.AbstractExecutableExtensionBase;
|
import org.eclipse.cdt.core.AbstractExecutableExtensionBase;
|
||||||
import org.eclipse.cdt.core.settings.model.CIncludeFileEntry;
|
import org.eclipse.cdt.core.settings.model.CIncludeFileEntry;
|
||||||
import org.eclipse.cdt.core.settings.model.CIncludePathEntry;
|
import org.eclipse.cdt.core.settings.model.CIncludePathEntry;
|
||||||
|
@ -29,18 +31,12 @@ import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSetting
|
||||||
import org.eclipse.cdt.internal.core.language.settings.providers.ReferencedProjectsLanguageSettingsProvider;
|
import org.eclipse.cdt.internal.core.language.settings.providers.ReferencedProjectsLanguageSettingsProvider;
|
||||||
import org.eclipse.cdt.internal.core.settings.model.CConfigurationDescription;
|
import org.eclipse.cdt.internal.core.settings.model.CConfigurationDescription;
|
||||||
import org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager;
|
import org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager;
|
||||||
import org.eclipse.core.resources.IBuildConfiguration;
|
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IFolder;
|
import org.eclipse.core.resources.IFolder;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.resources.ResourcesPlugin;
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
import org.eclipse.core.runtime.Adapters;
|
|
||||||
import org.eclipse.core.runtime.IAdapterFactory;
|
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
import org.eclipse.core.runtime.Platform;
|
|
||||||
|
|
||||||
import junit.framework.TestSuite;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test cases testing {@link LanguageSettingsManager} utility methods.
|
* Test cases testing {@link LanguageSettingsManager} utility methods.
|
||||||
|
@ -66,85 +62,48 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
|
||||||
/**
|
/**
|
||||||
* Mock configuration description.
|
* Mock configuration description.
|
||||||
*/
|
*/
|
||||||
class MockConfigurationDescription extends CModelMock.DummyCConfigurationDescription
|
class MockConfigurationDescription extends CModelMock.DummyCConfigurationDescription implements ILanguageSettingsProvidersKeeper {
|
||||||
implements ILanguageSettingsProvidersKeeper {
|
|
||||||
List<ILanguageSettingsProvider> providers = new ArrayList<ILanguageSettingsProvider>();
|
List<ILanguageSettingsProvider> providers = new ArrayList<ILanguageSettingsProvider>();
|
||||||
String[] defaultProvidersIds = null;
|
String[] defaultProvidersIds = null;
|
||||||
|
|
||||||
public MockConfigurationDescription(String id) {
|
public MockConfigurationDescription(String id) {
|
||||||
super(id);
|
super(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setLanguageSettingProviders(List<? extends ILanguageSettingsProvider> providers) {
|
public void setLanguageSettingProviders(List<? extends ILanguageSettingsProvider> providers) {
|
||||||
this.providers = new ArrayList<ILanguageSettingsProvider>(providers);
|
this.providers = new ArrayList<ILanguageSettingsProvider>(providers);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ILanguageSettingsProvider> getLanguageSettingProviders() {
|
public List<ILanguageSettingsProvider> getLanguageSettingProviders() {
|
||||||
return providers;
|
return providers;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setDefaultLanguageSettingsProvidersIds(String[] ids) {
|
public void setDefaultLanguageSettingsProvidersIds(String[] ids) {
|
||||||
defaultProvidersIds = ids;
|
defaultProvidersIds = ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] getDefaultLanguageSettingsProvidersIds() {
|
public String[] getDefaultLanguageSettingsProvidersIds() {
|
||||||
return defaultProvidersIds;
|
return defaultProvidersIds;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class MockBuildConfiguration implements IBuildConfiguration {
|
|
||||||
private final MockConfigurationDescription cfgDesc;
|
|
||||||
|
|
||||||
public MockBuildConfiguration(MockConfigurationDescription cfgDesc) {
|
|
||||||
this.cfgDesc = cfgDesc;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public <T> T getAdapter(Class<T> adapter) {
|
|
||||||
if (adapter.isInstance(cfgDesc)) {
|
|
||||||
return (T) cfgDesc;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IProject getProject() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return cfgDesc.getId();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mock language sttings provider.
|
* Mock language sttings provider.
|
||||||
*/
|
*/
|
||||||
private class MockProvider extends AbstractExecutableExtensionBase implements ILanguageSettingsProvider {
|
private class MockProvider extends AbstractExecutableExtensionBase implements ILanguageSettingsProvider {
|
||||||
private List<ICLanguageSettingEntry> entries;
|
private List<ICLanguageSettingEntry> entries;
|
||||||
|
|
||||||
public MockProvider(String id, String name, List<ICLanguageSettingEntry> entries) {
|
public MockProvider(String id, String name, List<ICLanguageSettingEntry> entries) {
|
||||||
super(id, name);
|
super(id, name);
|
||||||
this.entries = entries;
|
this.entries = entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ICLanguageSettingEntry> getSettingEntries(IBuildConfiguration config, IResource rc,
|
public List<ICLanguageSettingEntry> getSettingEntries(ICConfigurationDescription cfgDescription, IResource rc, String languageId) {
|
||||||
String languageId) {
|
|
||||||
return entries;
|
return entries;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
* @param name - name of the test.
|
||||||
* @param name
|
|
||||||
* - name of the test.
|
|
||||||
*/
|
*/
|
||||||
public LanguageSettingsManagerTests(String name) {
|
public LanguageSettingsManagerTests(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
|
@ -154,18 +113,6 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
Platform.getAdapterManager().registerAdapters(new IAdapterFactory() {
|
|
||||||
@Override
|
|
||||||
public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
|
|
||||||
MockConfigurationDescription cfgDesc = (MockConfigurationDescription) adaptableObject;
|
|
||||||
return (T) new MockBuildConfiguration(cfgDesc);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Class<?>[] getAdapterList() {
|
|
||||||
return new Class<?>[] { IBuildConfiguration.class };
|
|
||||||
}
|
|
||||||
}, MockConfigurationDescription.class);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -184,8 +131,7 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
|
||||||
/**
|
/**
|
||||||
* main function of the class.
|
* main function of the class.
|
||||||
*
|
*
|
||||||
* @param args
|
* @param args - arguments
|
||||||
* - arguments
|
|
||||||
*/
|
*/
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
junit.textui.TestRunner.run(suite());
|
junit.textui.TestRunner.run(suite());
|
||||||
|
@ -228,8 +174,7 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
|
||||||
// Create model project and accompanied descriptions
|
// Create model project and accompanied descriptions
|
||||||
String projectName = getName();
|
String projectName = getName();
|
||||||
IProject project = ResourceHelper.createCDTProjectWithConfig(projectName);
|
IProject project = ResourceHelper.createCDTProjectWithConfig(projectName);
|
||||||
ICProjectDescription prjDescriptionWritable = CProjectDescriptionManager.getInstance()
|
ICProjectDescription prjDescriptionWritable = CProjectDescriptionManager.getInstance().getProjectDescription(project, true);
|
||||||
.getProjectDescription(project, true);
|
|
||||||
|
|
||||||
ICConfigurationDescription[] cfgDescriptions = prjDescriptionWritable.getConfigurations();
|
ICConfigurationDescription[] cfgDescriptions = prjDescriptionWritable.getConfigurations();
|
||||||
ICConfigurationDescription cfgDescriptionWritable = cfgDescriptions[0];
|
ICConfigurationDescription cfgDescriptionWritable = cfgDescriptions[0];
|
||||||
|
@ -257,9 +202,6 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
|
||||||
public void testRudeProviders() throws Exception {
|
public void testRudeProviders() throws Exception {
|
||||||
// mock configuration description
|
// mock configuration description
|
||||||
MockConfigurationDescription cfgDescription = new MockConfigurationDescription(CFG_ID);
|
MockConfigurationDescription cfgDescription = new MockConfigurationDescription(CFG_ID);
|
||||||
IBuildConfiguration config = Adapters.adapt(cfgDescription, IBuildConfiguration.class);
|
|
||||||
assertNotNull(config);
|
|
||||||
|
|
||||||
// set impolite provider returning null by getSettingEntries()
|
// set impolite provider returning null by getSettingEntries()
|
||||||
ILanguageSettingsProvider providerNull = new MockProvider(PROVIDER_1, PROVIDER_NAME_1, null);
|
ILanguageSettingsProvider providerNull = new MockProvider(PROVIDER_1, PROVIDER_NAME_1, null);
|
||||||
{
|
{
|
||||||
|
@ -270,14 +212,14 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
|
||||||
|
|
||||||
// use provider returning null, no exception should be recorded
|
// use provider returning null, no exception should be recorded
|
||||||
{
|
{
|
||||||
List<ICLanguageSettingEntry> actual = LanguageSettingsManager.getSettingEntriesUpResourceTree(providerNull,
|
List<ICLanguageSettingEntry> actual = LanguageSettingsManager
|
||||||
config, FILE_0, LANG_ID);
|
.getSettingEntriesUpResourceTree(providerNull, cfgDescription, FILE_0, LANG_ID);
|
||||||
assertNotNull(actual);
|
assertNotNull(actual);
|
||||||
assertEquals(0, actual.size());
|
assertEquals(0, actual.size());
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
List<ICLanguageSettingEntry> actual = LanguageSettingsProvidersSerializer.getSettingEntriesByKind(config,
|
List<ICLanguageSettingEntry> actual = LanguageSettingsProvidersSerializer
|
||||||
FILE_0, LANG_ID, 0);
|
.getSettingEntriesByKind(cfgDescription, FILE_0, LANG_ID, 0);
|
||||||
assertNotNull(actual);
|
assertNotNull(actual);
|
||||||
assertEquals(0, actual.size());
|
assertEquals(0, actual.size());
|
||||||
}
|
}
|
||||||
|
@ -298,13 +240,13 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
|
||||||
// use provider returning null as item in array
|
// use provider returning null as item in array
|
||||||
{
|
{
|
||||||
List<ICLanguageSettingEntry> actual = LanguageSettingsManager
|
List<ICLanguageSettingEntry> actual = LanguageSettingsManager
|
||||||
.getSettingEntriesUpResourceTree(providerNull_2, config, FILE_0, LANG_ID);
|
.getSettingEntriesUpResourceTree(providerNull_2, cfgDescription, FILE_0, LANG_ID);
|
||||||
assertNotNull(actual);
|
assertNotNull(actual);
|
||||||
assertEquals(1, actual.size());
|
assertEquals(1, actual.size());
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
List<ICLanguageSettingEntry> actual = LanguageSettingsProvidersSerializer.getSettingEntriesByKind(config,
|
List<ICLanguageSettingEntry> actual = LanguageSettingsProvidersSerializer
|
||||||
FILE_0, LANG_ID, 0);
|
.getSettingEntriesByKind(cfgDescription, FILE_0, LANG_ID, 0);
|
||||||
assertNotNull(actual);
|
assertNotNull(actual);
|
||||||
assertEquals(0, actual.size());
|
assertEquals(0, actual.size());
|
||||||
}
|
}
|
||||||
|
@ -315,8 +257,7 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
|
||||||
|
|
||||||
ILanguageSettingsProvider providerNPE = new MockProvider(PROVIDER_1, PROVIDER_NAME_1, null) {
|
ILanguageSettingsProvider providerNPE = new MockProvider(PROVIDER_1, PROVIDER_NAME_1, null) {
|
||||||
@Override
|
@Override
|
||||||
public List<ICLanguageSettingEntry> getSettingEntries(IBuildConfiguration config, IResource rc,
|
public List<ICLanguageSettingEntry> getSettingEntries(ICConfigurationDescription cfgDescription, IResource rc, String languageId) {
|
||||||
String languageId) {
|
|
||||||
throw new NullPointerException("Can you handle me?");
|
throw new NullPointerException("Can you handle me?");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -336,20 +277,16 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
|
||||||
*/
|
*/
|
||||||
public void testProvider_Basic() throws Exception {
|
public void testProvider_Basic() throws Exception {
|
||||||
final MockConfigurationDescription modelCfgDescription = new MockConfigurationDescription(CFG_ID);
|
final MockConfigurationDescription modelCfgDescription = new MockConfigurationDescription(CFG_ID);
|
||||||
IBuildConfiguration modelConfig = Adapters.adapt(modelCfgDescription, IBuildConfiguration.class);
|
|
||||||
assertNotNull(modelConfig);
|
|
||||||
|
|
||||||
final List<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>();
|
final List<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>();
|
||||||
entries.add(new CIncludePathEntry("path0", 0));
|
entries.add(new CIncludePathEntry("path0", 0));
|
||||||
|
|
||||||
List<ILanguageSettingsProvider> providers = new ArrayList<ILanguageSettingsProvider>();
|
List<ILanguageSettingsProvider> providers = new ArrayList<ILanguageSettingsProvider>();
|
||||||
// define provider returning entries when configuration id matches and
|
// define provider returning entries when configuration id matches and null otherwise
|
||||||
// null otherwise
|
|
||||||
ILanguageSettingsProvider providerYes = new MockProvider(PROVIDER_0, PROVIDER_NAME_0, null) {
|
ILanguageSettingsProvider providerYes = new MockProvider(PROVIDER_0, PROVIDER_NAME_0, null) {
|
||||||
@Override
|
@Override
|
||||||
public List<ICLanguageSettingEntry> getSettingEntries(IBuildConfiguration config, IResource rc,
|
public List<ICLanguageSettingEntry> getSettingEntries(ICConfigurationDescription cfgDescription, IResource rc, String languageId) {
|
||||||
String languageId) {
|
if (cfgDescription.getId().equals(modelCfgDescription.getId())) {
|
||||||
if (config.getName().equals(modelCfgDescription.getId())) {
|
|
||||||
return entries;
|
return entries;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -357,13 +294,11 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
|
||||||
|
|
||||||
};
|
};
|
||||||
providers.add(providerYes);
|
providers.add(providerYes);
|
||||||
// define provider returning entries when configuration id does NOT
|
// define provider returning entries when configuration id does NOT match and null otherwise
|
||||||
// match and null otherwise
|
|
||||||
ILanguageSettingsProvider providerNo = new MockProvider(PROVIDER_1, PROVIDER_NAME_1, null) {
|
ILanguageSettingsProvider providerNo = new MockProvider(PROVIDER_1, PROVIDER_NAME_1, null) {
|
||||||
@Override
|
@Override
|
||||||
public List<ICLanguageSettingEntry> getSettingEntries(IBuildConfiguration config, IResource rc,
|
public List<ICLanguageSettingEntry> getSettingEntries(ICConfigurationDescription cfgDescription, IResource rc, String languageId) {
|
||||||
String languageId) {
|
if (cfgDescription!= null && !cfgDescription.getId().equals(modelCfgDescription.getId())) {
|
||||||
if (config != null && !config.getName().equals(modelCfgDescription.getId())) {
|
|
||||||
return entries;
|
return entries;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -375,16 +310,16 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
|
||||||
|
|
||||||
{
|
{
|
||||||
// retrieve the entries with provider returning the given list
|
// retrieve the entries with provider returning the given list
|
||||||
List<ICLanguageSettingEntry> actual = LanguageSettingsManager.getSettingEntriesUpResourceTree(providerYes,
|
List<ICLanguageSettingEntry> actual = LanguageSettingsManager
|
||||||
modelConfig, FILE_0, LANG_ID);
|
.getSettingEntriesUpResourceTree(providerYes, modelCfgDescription, FILE_0, LANG_ID);
|
||||||
assertEquals(entries.get(0), actual.get(0));
|
assertEquals(entries.get(0), actual.get(0));
|
||||||
assertEquals(entries.size(), actual.size());
|
assertEquals(entries.size(), actual.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// retrieve the entries with provider returning empty list
|
// retrieve the entries with provider returning empty list
|
||||||
List<ICLanguageSettingEntry> actual = LanguageSettingsManager.getSettingEntriesUpResourceTree(providerNo,
|
List<ICLanguageSettingEntry> actual = LanguageSettingsManager
|
||||||
modelConfig, FILE_0, LANG_ID);
|
.getSettingEntriesUpResourceTree(providerNo, modelCfgDescription, FILE_0, LANG_ID);
|
||||||
assertEquals(0, actual.size());
|
assertEquals(0, actual.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -394,8 +329,6 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
|
||||||
*/
|
*/
|
||||||
public void testProvider_Regular() throws Exception {
|
public void testProvider_Regular() throws Exception {
|
||||||
MockConfigurationDescription cfgDescription = new MockConfigurationDescription(CFG_ID);
|
MockConfigurationDescription cfgDescription = new MockConfigurationDescription(CFG_ID);
|
||||||
IBuildConfiguration config = Adapters.adapt(cfgDescription, IBuildConfiguration.class);
|
|
||||||
assertNotNull(config);
|
|
||||||
|
|
||||||
// create couple of providers
|
// create couple of providers
|
||||||
List<ICLanguageSettingEntry> entries1 = new ArrayList<ICLanguageSettingEntry>();
|
List<ICLanguageSettingEntry> entries1 = new ArrayList<ICLanguageSettingEntry>();
|
||||||
|
@ -416,8 +349,8 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
|
||||||
|
|
||||||
{
|
{
|
||||||
// retrieve the entries for provider-1
|
// retrieve the entries for provider-1
|
||||||
List<ICLanguageSettingEntry> actual = LanguageSettingsManager.getSettingEntriesUpResourceTree(provider1,
|
List<ICLanguageSettingEntry> actual = LanguageSettingsManager
|
||||||
config, FILE_0, LANG_ID);
|
.getSettingEntriesUpResourceTree(provider1, cfgDescription, FILE_0, LANG_ID);
|
||||||
assertNotSame(entries1, actual);
|
assertNotSame(entries1, actual);
|
||||||
|
|
||||||
ICLanguageSettingEntry[] entriesArray = entries1.toArray(new ICLanguageSettingEntry[0]);
|
ICLanguageSettingEntry[] entriesArray = entries1.toArray(new ICLanguageSettingEntry[0]);
|
||||||
|
@ -430,8 +363,8 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
|
||||||
|
|
||||||
{
|
{
|
||||||
// retrieve the entries for provider-2
|
// retrieve the entries for provider-2
|
||||||
List<ICLanguageSettingEntry> actual = LanguageSettingsManager.getSettingEntriesUpResourceTree(provider2,
|
List<ICLanguageSettingEntry> actual = LanguageSettingsManager
|
||||||
config, FILE_0, LANG_ID);
|
.getSettingEntriesUpResourceTree(provider2, cfgDescription, FILE_0, LANG_ID);
|
||||||
assertNotSame(entries2, actual);
|
assertNotSame(entries2, actual);
|
||||||
|
|
||||||
ICLanguageSettingEntry[] entriesArray = entries2.toArray(new ICLanguageSettingEntry[0]);
|
ICLanguageSettingEntry[] entriesArray = entries2.toArray(new ICLanguageSettingEntry[0]);
|
||||||
|
@ -450,14 +383,11 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
|
||||||
// Create model project and accompanied descriptions
|
// Create model project and accompanied descriptions
|
||||||
String projectName = getName();
|
String projectName = getName();
|
||||||
IProject project = ResourceHelper.createCDTProjectWithConfig(projectName);
|
IProject project = ResourceHelper.createCDTProjectWithConfig(projectName);
|
||||||
ICProjectDescription prjDescriptionWritable = CProjectDescriptionManager.getInstance()
|
ICProjectDescription prjDescriptionWritable = CProjectDescriptionManager.getInstance().getProjectDescription(project, true);
|
||||||
.getProjectDescription(project, true);
|
|
||||||
ICConfigurationDescription[] cfgDescriptions = prjDescriptionWritable.getConfigurations();
|
ICConfigurationDescription[] cfgDescriptions = prjDescriptionWritable.getConfigurations();
|
||||||
|
|
||||||
ICConfigurationDescription cfgDescriptionWritable = cfgDescriptions[0];
|
ICConfigurationDescription cfgDescriptionWritable = cfgDescriptions[0];
|
||||||
assertTrue(cfgDescriptionWritable instanceof CConfigurationDescription);
|
assertTrue(cfgDescriptionWritable instanceof CConfigurationDescription);
|
||||||
IBuildConfiguration configWritable = Adapters.adapt(cfgDescriptionWritable, IBuildConfiguration.class);
|
|
||||||
assertNotNull(configWritable);
|
|
||||||
|
|
||||||
final IFolder parentFolder = ResourceHelper.createFolder(project, "/ParentFolder/");
|
final IFolder parentFolder = ResourceHelper.createFolder(project, "/ParentFolder/");
|
||||||
assertNotNull(parentFolder);
|
assertNotNull(parentFolder);
|
||||||
|
@ -470,8 +400,7 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
|
||||||
List<ILanguageSettingsProvider> providers = new ArrayList<ILanguageSettingsProvider>();
|
List<ILanguageSettingsProvider> providers = new ArrayList<ILanguageSettingsProvider>();
|
||||||
ILanguageSettingsProvider provider = new MockProvider(PROVIDER_0, PROVIDER_NAME_0, null) {
|
ILanguageSettingsProvider provider = new MockProvider(PROVIDER_0, PROVIDER_NAME_0, null) {
|
||||||
@Override
|
@Override
|
||||||
public List<ICLanguageSettingEntry> getSettingEntries(IBuildConfiguration config, IResource rc,
|
public List<ICLanguageSettingEntry> getSettingEntries(ICConfigurationDescription cfgDescription, IResource rc, String languageId) {
|
||||||
String languageId) {
|
|
||||||
if (rc!=null && rc.equals(parentFolder)) {
|
if (rc!=null && rc.equals(parentFolder)) {
|
||||||
return entries;
|
return entries;
|
||||||
}
|
}
|
||||||
|
@ -488,8 +417,8 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
|
||||||
{
|
{
|
||||||
// retrieve entries for a derived resource (in a subfolder)
|
// retrieve entries for a derived resource (in a subfolder)
|
||||||
IFile derived = ResourceHelper.createFile(project, "/ParentFolder/Subfolder/resource");
|
IFile derived = ResourceHelper.createFile(project, "/ParentFolder/Subfolder/resource");
|
||||||
List<ICLanguageSettingEntry> actual = LanguageSettingsManager.getSettingEntriesUpResourceTree(provider,
|
List<ICLanguageSettingEntry> actual = LanguageSettingsManager
|
||||||
configWritable, derived, LANG_ID);
|
.getSettingEntriesUpResourceTree(provider, cfgDescriptionWritable, derived, LANG_ID);
|
||||||
// taken from parent folder
|
// taken from parent folder
|
||||||
assertEquals(entries.get(0),actual.get(0));
|
assertEquals(entries.get(0),actual.get(0));
|
||||||
assertEquals(entries.size(), actual.size());
|
assertEquals(entries.size(), actual.size());
|
||||||
|
@ -497,17 +426,16 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
|
||||||
|
|
||||||
{
|
{
|
||||||
// retrieve entries for not related resource
|
// retrieve entries for not related resource
|
||||||
IFile notRelated = ResourcesPlugin.getWorkspace().getRoot()
|
IFile notRelated = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path("/AnotherFolder/Subfolder/resource"));
|
||||||
.getFile(new Path("/AnotherFolder/Subfolder/resource"));
|
List<ICLanguageSettingEntry> actual = LanguageSettingsManager
|
||||||
List<ICLanguageSettingEntry> actual = LanguageSettingsManager.getSettingEntriesUpResourceTree(provider,
|
.getSettingEntriesUpResourceTree(provider, cfgDescriptionWritable, notRelated, LANG_ID);
|
||||||
configWritable, notRelated, LANG_ID);
|
|
||||||
assertEquals(0, actual.size());
|
assertEquals(0, actual.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// test distinction between no settings and empty settings
|
// test distinction between no settings and empty settings
|
||||||
List<ICLanguageSettingEntry> actual = LanguageSettingsManager.getSettingEntriesUpResourceTree(provider,
|
List<ICLanguageSettingEntry> actual = LanguageSettingsManager
|
||||||
configWritable, emptySettingsPath, LANG_ID);
|
.getSettingEntriesUpResourceTree(provider, cfgDescriptionWritable, emptySettingsPath, LANG_ID);
|
||||||
// NOT taken from parent folder
|
// NOT taken from parent folder
|
||||||
assertEquals(0, actual.size());
|
assertEquals(0, actual.size());
|
||||||
}
|
}
|
||||||
|
@ -520,14 +448,11 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
|
||||||
// Create model project and accompanied descriptions
|
// Create model project and accompanied descriptions
|
||||||
String projectName = getName();
|
String projectName = getName();
|
||||||
IProject project = ResourceHelper.createCDTProjectWithConfig(projectName);
|
IProject project = ResourceHelper.createCDTProjectWithConfig(projectName);
|
||||||
ICProjectDescription prjDescriptionWritable = CProjectDescriptionManager.getInstance()
|
ICProjectDescription prjDescriptionWritable = CProjectDescriptionManager.getInstance().getProjectDescription(project, true);
|
||||||
.getProjectDescription(project, true);
|
|
||||||
ICConfigurationDescription[] cfgDescriptions = prjDescriptionWritable.getConfigurations();
|
ICConfigurationDescription[] cfgDescriptions = prjDescriptionWritable.getConfigurations();
|
||||||
|
|
||||||
ICConfigurationDescription cfgDescriptionWritable = cfgDescriptions[0];
|
ICConfigurationDescription cfgDescriptionWritable = cfgDescriptions[0];
|
||||||
assertTrue(cfgDescriptionWritable instanceof CConfigurationDescription);
|
assertTrue(cfgDescriptionWritable instanceof CConfigurationDescription);
|
||||||
IBuildConfiguration configWritable = Adapters.adapt(cfgDescriptionWritable, IBuildConfiguration.class);
|
|
||||||
assertNotNull(configWritable);
|
|
||||||
|
|
||||||
final IFolder parentFolder = ResourceHelper.createFolder(project, "/ParentFolder/");
|
final IFolder parentFolder = ResourceHelper.createFolder(project, "/ParentFolder/");
|
||||||
assertNotNull(parentFolder);
|
assertNotNull(parentFolder);
|
||||||
|
@ -540,9 +465,8 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
|
||||||
List<ILanguageSettingsProvider> providers = new ArrayList<ILanguageSettingsProvider>();
|
List<ILanguageSettingsProvider> providers = new ArrayList<ILanguageSettingsProvider>();
|
||||||
ILanguageSettingsProvider provider = new MockProvider(PROVIDER_0, PROVIDER_NAME_0, null) {
|
ILanguageSettingsProvider provider = new MockProvider(PROVIDER_0, PROVIDER_NAME_0, null) {
|
||||||
@Override
|
@Override
|
||||||
public List<ICLanguageSettingEntry> getSettingEntries(IBuildConfiguration config, IResource rc,
|
public List<ICLanguageSettingEntry> getSettingEntries(ICConfigurationDescription cfgDescription, IResource rc, String languageId) {
|
||||||
String languageId) {
|
if (cfgDescription==null && rc==null) {
|
||||||
if (config == null && rc == null) {
|
|
||||||
return entries;
|
return entries;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -555,8 +479,8 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
|
||||||
{
|
{
|
||||||
// retrieve entries for a resource
|
// retrieve entries for a resource
|
||||||
IFile derived = ResourceHelper.createFile(project, "/ParentFolder/Subfolder/resource");
|
IFile derived = ResourceHelper.createFile(project, "/ParentFolder/Subfolder/resource");
|
||||||
List<ICLanguageSettingEntry> actual = LanguageSettingsManager.getSettingEntriesUpResourceTree(provider,
|
List<ICLanguageSettingEntry> actual = LanguageSettingsManager
|
||||||
configWritable, derived, LANG_ID);
|
.getSettingEntriesUpResourceTree(provider, cfgDescriptionWritable, derived, LANG_ID);
|
||||||
// default entries given
|
// default entries given
|
||||||
assertEquals(entries.get(0),actual.get(0));
|
assertEquals(entries.get(0),actual.get(0));
|
||||||
assertEquals(entries.size(), actual.size());
|
assertEquals(entries.size(), actual.size());
|
||||||
|
@ -568,8 +492,6 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
|
||||||
*/
|
*/
|
||||||
public void testEntriesByKind_Regular() throws Exception {
|
public void testEntriesByKind_Regular() throws Exception {
|
||||||
MockConfigurationDescription cfgDescription = new MockConfigurationDescription(CFG_ID);
|
MockConfigurationDescription cfgDescription = new MockConfigurationDescription(CFG_ID);
|
||||||
IBuildConfiguration config = Adapters.adapt(cfgDescription, IBuildConfiguration.class);
|
|
||||||
assertNotNull(config);
|
|
||||||
|
|
||||||
// contribute the entries
|
// contribute the entries
|
||||||
List<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>();
|
List<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>();
|
||||||
|
@ -585,15 +507,15 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
|
||||||
cfgDescription.setLanguageSettingProviders(providers);
|
cfgDescription.setLanguageSettingProviders(providers);
|
||||||
|
|
||||||
// retrieve entries by kind
|
// retrieve entries by kind
|
||||||
List<ICLanguageSettingEntry> includes = LanguageSettingsProvidersSerializer.getSettingEntriesByKind(config,
|
List<ICLanguageSettingEntry> includes = LanguageSettingsProvidersSerializer
|
||||||
FILE_0, LANG_ID, ICSettingEntry.INCLUDE_PATH);
|
.getSettingEntriesByKind(cfgDescription, FILE_0, LANG_ID, ICSettingEntry.INCLUDE_PATH);
|
||||||
assertEquals(new CIncludePathEntry("path0", 0),includes.get(0));
|
assertEquals(new CIncludePathEntry("path0", 0),includes.get(0));
|
||||||
assertEquals(new CIncludePathEntry("path1", 0),includes.get(1));
|
assertEquals(new CIncludePathEntry("path1", 0),includes.get(1));
|
||||||
assertEquals(new CIncludePathEntry("path2", 0),includes.get(2));
|
assertEquals(new CIncludePathEntry("path2", 0),includes.get(2));
|
||||||
assertEquals(3, includes.size());
|
assertEquals(3, includes.size());
|
||||||
|
|
||||||
List<ICLanguageSettingEntry> macros = LanguageSettingsProvidersSerializer.getSettingEntriesByKind(config,
|
List<ICLanguageSettingEntry> macros = LanguageSettingsProvidersSerializer
|
||||||
FILE_0, LANG_ID, ICSettingEntry.MACRO);
|
.getSettingEntriesByKind(cfgDescription, FILE_0, LANG_ID, ICSettingEntry.MACRO);
|
||||||
assertEquals(new CMacroEntry("MACRO0", "value0",0), macros.get(0));
|
assertEquals(new CMacroEntry("MACRO0", "value0",0), macros.get(0));
|
||||||
assertEquals(new CMacroEntry("MACRO1", "value1",0), macros.get(1));
|
assertEquals(new CMacroEntry("MACRO1", "value1",0), macros.get(1));
|
||||||
assertEquals(2, macros.size());
|
assertEquals(2, macros.size());
|
||||||
|
@ -604,8 +526,6 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
|
||||||
*/
|
*/
|
||||||
public void testEntriesByKind_ConflictingEntries() throws Exception {
|
public void testEntriesByKind_ConflictingEntries() throws Exception {
|
||||||
MockConfigurationDescription cfgDescription = new MockConfigurationDescription(CFG_ID);
|
MockConfigurationDescription cfgDescription = new MockConfigurationDescription(CFG_ID);
|
||||||
IBuildConfiguration config = Adapters.adapt(cfgDescription, IBuildConfiguration.class);
|
|
||||||
assertNotNull(config);
|
|
||||||
|
|
||||||
// contribute the entries
|
// contribute the entries
|
||||||
List<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>();
|
List<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>();
|
||||||
|
@ -619,8 +539,7 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
|
||||||
cfgDescription.setLanguageSettingProviders(providers);
|
cfgDescription.setLanguageSettingProviders(providers);
|
||||||
|
|
||||||
// retrieve entries by kind, only first entry should be returned
|
// retrieve entries by kind, only first entry should be returned
|
||||||
List<ICLanguageSettingEntry> includes = LanguageSettingsProvidersSerializer.getSettingEntriesByKind(config,
|
List<ICLanguageSettingEntry> includes = LanguageSettingsProvidersSerializer.getSettingEntriesByKind(cfgDescription, FILE_0, LANG_ID, ICSettingEntry.INCLUDE_PATH);
|
||||||
FILE_0, LANG_ID, ICSettingEntry.INCLUDE_PATH);
|
|
||||||
assertEquals(1, includes.size());
|
assertEquals(1, includes.size());
|
||||||
assertEquals(entries.get(0),includes.get(0));
|
assertEquals(entries.get(0),includes.get(0));
|
||||||
}
|
}
|
||||||
|
@ -630,8 +549,6 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
|
||||||
*/
|
*/
|
||||||
public void testEntriesByKind_Undefined() throws Exception {
|
public void testEntriesByKind_Undefined() throws Exception {
|
||||||
MockConfigurationDescription cfgDescription = new MockConfigurationDescription(CFG_ID);
|
MockConfigurationDescription cfgDescription = new MockConfigurationDescription(CFG_ID);
|
||||||
IBuildConfiguration config = Adapters.adapt(cfgDescription, IBuildConfiguration.class);
|
|
||||||
assertNotNull(config);
|
|
||||||
|
|
||||||
// contribute the entries
|
// contribute the entries
|
||||||
List<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>();
|
List<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>();
|
||||||
|
@ -644,8 +561,8 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
|
||||||
cfgDescription.setLanguageSettingProviders(providers);
|
cfgDescription.setLanguageSettingProviders(providers);
|
||||||
|
|
||||||
// retrieve entries by kind, no entries should be returned
|
// retrieve entries by kind, no entries should be returned
|
||||||
List<ICLanguageSettingEntry> includes = LanguageSettingsProvidersSerializer.getSettingEntriesByKind(config,
|
List<ICLanguageSettingEntry> includes = LanguageSettingsProvidersSerializer
|
||||||
FILE_0, LANG_ID, ICSettingEntry.INCLUDE_PATH);
|
.getSettingEntriesByKind(cfgDescription, FILE_0, LANG_ID, ICSettingEntry.INCLUDE_PATH);
|
||||||
assertEquals(0, includes.size());
|
assertEquals(0, includes.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -654,8 +571,6 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
|
||||||
*/
|
*/
|
||||||
public void testEntriesByKind_LocalAndSystem() throws Exception {
|
public void testEntriesByKind_LocalAndSystem() throws Exception {
|
||||||
MockConfigurationDescription cfgDescription = new MockConfigurationDescription(CFG_ID);
|
MockConfigurationDescription cfgDescription = new MockConfigurationDescription(CFG_ID);
|
||||||
IBuildConfiguration config = Adapters.adapt(cfgDescription, IBuildConfiguration.class);
|
|
||||||
assertNotNull(config);
|
|
||||||
|
|
||||||
// contribute the entries
|
// contribute the entries
|
||||||
List<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>();
|
List<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>();
|
||||||
|
@ -672,7 +587,7 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
|
||||||
{
|
{
|
||||||
// retrieve local entries
|
// retrieve local entries
|
||||||
List<ICLanguageSettingEntry> includes = LanguageSettingsProvidersSerializer
|
List<ICLanguageSettingEntry> includes = LanguageSettingsProvidersSerializer
|
||||||
.getLocalSettingEntriesByKind(config, FILE_0, LANG_ID, ICSettingEntry.INCLUDE_PATH);
|
.getLocalSettingEntriesByKind(cfgDescription, FILE_0, LANG_ID, ICSettingEntry.INCLUDE_PATH);
|
||||||
assertEquals(localIncludeEntry, includes.get(0));
|
assertEquals(localIncludeEntry, includes.get(0));
|
||||||
assertEquals(1, includes.size());
|
assertEquals(1, includes.size());
|
||||||
}
|
}
|
||||||
|
@ -680,15 +595,15 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
|
||||||
{
|
{
|
||||||
// retrieve system entries
|
// retrieve system entries
|
||||||
List<ICLanguageSettingEntry> includes = LanguageSettingsProvidersSerializer
|
List<ICLanguageSettingEntry> includes = LanguageSettingsProvidersSerializer
|
||||||
.getSystemSettingEntriesByKind(config, FILE_0, LANG_ID, ICSettingEntry.INCLUDE_PATH);
|
.getSystemSettingEntriesByKind(cfgDescription, FILE_0, LANG_ID, ICSettingEntry.INCLUDE_PATH);
|
||||||
assertEquals(systemIncludeEntry, includes.get(0));
|
assertEquals(systemIncludeEntry, includes.get(0));
|
||||||
assertEquals(1, includes.size());
|
assertEquals(1, includes.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// retrieve both local and system
|
// retrieve both local and system
|
||||||
List<ICLanguageSettingEntry> includes = LanguageSettingsProvidersSerializer.getSettingEntriesByKind(config,
|
List<ICLanguageSettingEntry> includes = LanguageSettingsProvidersSerializer
|
||||||
FILE_0, LANG_ID, ICSettingEntry.INCLUDE_PATH);
|
.getSettingEntriesByKind(cfgDescription, FILE_0, LANG_ID, ICSettingEntry.INCLUDE_PATH);
|
||||||
assertEquals(entries.get(0), includes.get(0));
|
assertEquals(entries.get(0), includes.get(0));
|
||||||
assertEquals(entries.get(1), includes.get(1));
|
assertEquals(entries.get(1), includes.get(1));
|
||||||
assertEquals(2, includes.size());
|
assertEquals(2, includes.size());
|
||||||
|
@ -700,8 +615,6 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
|
||||||
*/
|
*/
|
||||||
public void testEntriesByKind_ConflictingProviders() throws Exception {
|
public void testEntriesByKind_ConflictingProviders() throws Exception {
|
||||||
MockConfigurationDescription cfgDescription = new MockConfigurationDescription(CFG_ID);
|
MockConfigurationDescription cfgDescription = new MockConfigurationDescription(CFG_ID);
|
||||||
IBuildConfiguration config = Adapters.adapt(cfgDescription, IBuildConfiguration.class);
|
|
||||||
assertNotNull(config);
|
|
||||||
|
|
||||||
// contribute the entries
|
// contribute the entries
|
||||||
List<ILanguageSettingsProvider> providers = new ArrayList<ILanguageSettingsProvider>();
|
List<ILanguageSettingsProvider> providers = new ArrayList<ILanguageSettingsProvider>();
|
||||||
|
@ -726,8 +639,8 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
|
||||||
cfgDescription.setLanguageSettingProviders(providers);
|
cfgDescription.setLanguageSettingProviders(providers);
|
||||||
|
|
||||||
// retrieve entries by kind
|
// retrieve entries by kind
|
||||||
List<ICLanguageSettingEntry> includes = LanguageSettingsProvidersSerializer.getSettingEntriesByKind(config,
|
List<ICLanguageSettingEntry> includes = LanguageSettingsProvidersSerializer
|
||||||
FILE_0, LANG_ID, ICSettingEntry.INCLUDE_PATH);
|
.getSettingEntriesByKind(cfgDescription, FILE_0, LANG_ID, ICSettingEntry.INCLUDE_PATH);
|
||||||
// path0 is taken from higher priority provider
|
// path0 is taken from higher priority provider
|
||||||
assertEquals(entriesHigh.get(0),includes.get(0));
|
assertEquals(entriesHigh.get(0),includes.get(0));
|
||||||
// path1 disablement by lower priority provider is ignored
|
// path1 disablement by lower priority provider is ignored
|
||||||
|
@ -743,7 +656,6 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
|
||||||
*/
|
*/
|
||||||
public void testEntriesByKind_CompositeKind() throws Exception {
|
public void testEntriesByKind_CompositeKind() throws Exception {
|
||||||
MockConfigurationDescription cfgDescription = new MockConfigurationDescription(CFG_ID);
|
MockConfigurationDescription cfgDescription = new MockConfigurationDescription(CFG_ID);
|
||||||
IBuildConfiguration config = Adapters.adapt(cfgDescription, IBuildConfiguration.class);
|
|
||||||
|
|
||||||
// contribute the entries
|
// contribute the entries
|
||||||
List<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>();
|
List<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>();
|
||||||
|
@ -761,8 +673,8 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
|
||||||
cfgDescription.setLanguageSettingProviders(providers);
|
cfgDescription.setLanguageSettingProviders(providers);
|
||||||
|
|
||||||
// retrieve entries by kind
|
// retrieve entries by kind
|
||||||
List<ICLanguageSettingEntry> result = LanguageSettingsProvidersSerializer.getSettingEntriesByKind(config,
|
List<ICLanguageSettingEntry> result = LanguageSettingsProvidersSerializer
|
||||||
FILE_0, LANG_ID, ICSettingEntry.INCLUDE_PATH | ICSettingEntry.MACRO);
|
.getSettingEntriesByKind(cfgDescription, FILE_0, LANG_ID, ICSettingEntry.INCLUDE_PATH | ICSettingEntry.MACRO);
|
||||||
assertEquals(new CIncludePathEntry("path0", 0), result.get(0));
|
assertEquals(new CIncludePathEntry("path0", 0), result.get(0));
|
||||||
assertEquals(new CMacroEntry("MACRO0", "value0",0), result.get(1));
|
assertEquals(new CMacroEntry("MACRO0", "value0",0), result.get(1));
|
||||||
assertEquals(new CIncludePathEntry("path1", 0), result.get(2));
|
assertEquals(new CIncludePathEntry("path1", 0), result.get(2));
|
||||||
|
@ -778,22 +690,19 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
|
||||||
// Create model project and accompanied descriptions
|
// Create model project and accompanied descriptions
|
||||||
String projectName = getName();
|
String projectName = getName();
|
||||||
IProject project = ResourceHelper.createCDTProjectWithConfig(projectName);
|
IProject project = ResourceHelper.createCDTProjectWithConfig(projectName);
|
||||||
ICProjectDescription prjDescriptionWritable = CProjectDescriptionManager.getInstance()
|
ICProjectDescription prjDescriptionWritable = CProjectDescriptionManager.getInstance().getProjectDescription(project, true);
|
||||||
.getProjectDescription(project, true);
|
|
||||||
|
|
||||||
ICConfigurationDescription[] cfgDescriptions = prjDescriptionWritable.getConfigurations();
|
ICConfigurationDescription[] cfgDescriptions = prjDescriptionWritable.getConfigurations();
|
||||||
ICConfigurationDescription cfgDescription = cfgDescriptions[0];
|
ICConfigurationDescription cfgDescription = cfgDescriptions[0];
|
||||||
assertTrue(cfgDescription instanceof CConfigurationDescription);
|
assertTrue(cfgDescription instanceof CConfigurationDescription);
|
||||||
|
|
||||||
// Select a sample workspace provider for the test
|
// Select a sample workspace provider for the test
|
||||||
ILanguageSettingsProvider workspaceProvider = LanguageSettingsManager
|
ILanguageSettingsProvider workspaceProvider = LanguageSettingsManager.getWorkspaceProvider(EXTENSION_BASE_PROVIDER_ID);
|
||||||
.getWorkspaceProvider(EXTENSION_BASE_PROVIDER_ID);
|
|
||||||
assertNotNull(workspaceProvider);
|
assertNotNull(workspaceProvider);
|
||||||
|
|
||||||
{
|
{
|
||||||
// ensure no test provider is set yet but default providers
|
// ensure no test provider is set yet but default providers
|
||||||
List<ILanguageSettingsProvider> providers = ((ILanguageSettingsProvidersKeeper) cfgDescription)
|
List<ILanguageSettingsProvider> providers = ((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders();
|
||||||
.getLanguageSettingProviders();
|
|
||||||
assertEquals(ScannerDiscoveryLegacySupport.USER_LANGUAGE_SETTINGS_PROVIDER_ID, providers.get(0).getId());
|
assertEquals(ScannerDiscoveryLegacySupport.USER_LANGUAGE_SETTINGS_PROVIDER_ID, providers.get(0).getId());
|
||||||
assertEquals(ReferencedProjectsLanguageSettingsProvider.ID, providers.get(1).getId());
|
assertEquals(ReferencedProjectsLanguageSettingsProvider.ID, providers.get(1).getId());
|
||||||
assertEquals(ScannerDiscoveryLegacySupport.MBS_LANGUAGE_SETTINGS_PROVIDER_ID, providers.get(2).getId());
|
assertEquals(ScannerDiscoveryLegacySupport.MBS_LANGUAGE_SETTINGS_PROVIDER_ID, providers.get(2).getId());
|
||||||
|
@ -807,8 +716,7 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
// check that test provider got there
|
// check that test provider got there
|
||||||
List<ILanguageSettingsProvider> providers = ((ILanguageSettingsProvidersKeeper) cfgDescription)
|
List<ILanguageSettingsProvider> providers = ((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders();
|
||||||
.getLanguageSettingProviders();
|
|
||||||
assertEquals(workspaceProvider, providers.get(0));
|
assertEquals(workspaceProvider, providers.get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -822,14 +730,12 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
|
||||||
|
|
||||||
{
|
{
|
||||||
// check that test provider got loaded
|
// check that test provider got loaded
|
||||||
ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance()
|
ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project, false);
|
||||||
.getProjectDescription(project, false);
|
|
||||||
ICConfigurationDescription[] loadedCfgDescriptions = prjDescription.getConfigurations();
|
ICConfigurationDescription[] loadedCfgDescriptions = prjDescription.getConfigurations();
|
||||||
ICConfigurationDescription loadedCfgDescription = loadedCfgDescriptions[0];
|
ICConfigurationDescription loadedCfgDescription = loadedCfgDescriptions[0];
|
||||||
assertTrue(cfgDescription instanceof CConfigurationDescription);
|
assertTrue(cfgDescription instanceof CConfigurationDescription);
|
||||||
|
|
||||||
List<ILanguageSettingsProvider> loadedProviders = ((ILanguageSettingsProvidersKeeper) loadedCfgDescription)
|
List<ILanguageSettingsProvider> loadedProviders = ((ILanguageSettingsProvidersKeeper) loadedCfgDescription).getLanguageSettingProviders();
|
||||||
.getLanguageSettingProviders();
|
|
||||||
assertTrue(LanguageSettingsManager.isWorkspaceProvider(loadedProviders.get(0)));
|
assertTrue(LanguageSettingsManager.isWorkspaceProvider(loadedProviders.get(0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -840,8 +746,7 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
|
||||||
*/
|
*/
|
||||||
public void testWorkspaceProvider_Basic() throws Exception {
|
public void testWorkspaceProvider_Basic() throws Exception {
|
||||||
// get workspace provider
|
// get workspace provider
|
||||||
ILanguageSettingsProvider provider = LanguageSettingsManager
|
ILanguageSettingsProvider provider = LanguageSettingsManager.getWorkspaceProvider(EXTENSION_SERIALIZABLE_PROVIDER_ID);
|
||||||
.getWorkspaceProvider(EXTENSION_SERIALIZABLE_PROVIDER_ID);
|
|
||||||
assertEquals(EXTENSION_SERIALIZABLE_PROVIDER_ID, provider.getId());
|
assertEquals(EXTENSION_SERIALIZABLE_PROVIDER_ID, provider.getId());
|
||||||
assertEquals(EXTENSION_SERIALIZABLE_PROVIDER_NAME, provider.getName());
|
assertEquals(EXTENSION_SERIALIZABLE_PROVIDER_NAME, provider.getName());
|
||||||
|
|
||||||
|
@ -855,10 +760,9 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
|
||||||
|
|
||||||
{
|
{
|
||||||
// make sure entries are the same
|
// make sure entries are the same
|
||||||
List<ICLanguageSettingEntry> entries = provider.getSettingEntries((IBuildConfiguration) null, null, null);
|
List<ICLanguageSettingEntry> entries = provider.getSettingEntries(null, null, null);
|
||||||
assertEquals(1, entries.size()); // defined in the extension
|
assertEquals(1, entries.size()); // defined in the extension
|
||||||
List<ICLanguageSettingEntry> rawEntries = rawProvider.getSettingEntries((IBuildConfiguration) null, null,
|
List<ICLanguageSettingEntry> rawEntries = rawProvider.getSettingEntries(null, null, null);
|
||||||
null);
|
|
||||||
assertEquals(entries, rawEntries);
|
assertEquals(entries, rawEntries);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -867,11 +771,10 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
|
||||||
List<ICLanguageSettingEntry> newEntries = new ArrayList<ICLanguageSettingEntry>();
|
List<ICLanguageSettingEntry> newEntries = new ArrayList<ICLanguageSettingEntry>();
|
||||||
newEntries.add(new CIncludePathEntry("path0", 0));
|
newEntries.add(new CIncludePathEntry("path0", 0));
|
||||||
newEntries.add(new CIncludePathEntry("path1", 0));
|
newEntries.add(new CIncludePathEntry("path1", 0));
|
||||||
((LanguageSettingsSerializableProvider) rawProvider).setSettingEntries((IBuildConfiguration) null, null, null, newEntries);
|
((LanguageSettingsSerializableProvider)rawProvider).setSettingEntries(null, null, null, newEntries);
|
||||||
|
|
||||||
// check that the workspace provider gets them too
|
// check that the workspace provider gets them too
|
||||||
List<ICLanguageSettingEntry> newRawEntries = rawProvider.getSettingEntries((IBuildConfiguration) null, null,
|
List<ICLanguageSettingEntry> newRawEntries = rawProvider.getSettingEntries(null, null, null);
|
||||||
null);
|
|
||||||
assertEquals(newEntries, newRawEntries);
|
assertEquals(newEntries, newRawEntries);
|
||||||
assertEquals(2, newEntries.size());
|
assertEquals(2, newEntries.size());
|
||||||
}
|
}
|
||||||
|
@ -881,10 +784,8 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
|
||||||
* Test workspace providers equality.
|
* Test workspace providers equality.
|
||||||
*/
|
*/
|
||||||
public void testWorkspaceProvider_Equals() throws Exception {
|
public void testWorkspaceProvider_Equals() throws Exception {
|
||||||
ILanguageSettingsProvider providerA = LanguageSettingsManager
|
ILanguageSettingsProvider providerA = LanguageSettingsManager.getWorkspaceProvider(EXTENSION_SERIALIZABLE_PROVIDER_ID);
|
||||||
.getWorkspaceProvider(EXTENSION_SERIALIZABLE_PROVIDER_ID);
|
ILanguageSettingsProvider providerB = LanguageSettingsManager.getWorkspaceProvider(EXTENSION_SERIALIZABLE_PROVIDER_ID);
|
||||||
ILanguageSettingsProvider providerB = LanguageSettingsManager
|
|
||||||
.getWorkspaceProvider(EXTENSION_SERIALIZABLE_PROVIDER_ID);
|
|
||||||
assertEquals(providerA, providerB);
|
assertEquals(providerA, providerB);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -893,11 +794,10 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
|
||||||
*/
|
*/
|
||||||
public void testWorkspaceProvider_ReplaceRawProvider() throws Exception {
|
public void testWorkspaceProvider_ReplaceRawProvider() throws Exception {
|
||||||
// get sample workspace provider
|
// get sample workspace provider
|
||||||
ILanguageSettingsProvider provider = LanguageSettingsManager
|
ILanguageSettingsProvider provider = LanguageSettingsManager.getWorkspaceProvider(EXTENSION_EDITABLE_PROVIDER_ID);
|
||||||
.getWorkspaceProvider(EXTENSION_EDITABLE_PROVIDER_ID);
|
|
||||||
{
|
{
|
||||||
// check on its entries (1 predefined entry via extension point)
|
// check on its entries (1 predefined entry via extension point)
|
||||||
List<ICLanguageSettingEntry> entries = provider.getSettingEntries((IBuildConfiguration) null, null, null);
|
List<ICLanguageSettingEntry> entries = provider.getSettingEntries(null, null, null);
|
||||||
assertEquals(1, entries.size()); // defined in the extension
|
assertEquals(1, entries.size()); // defined in the extension
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -910,16 +810,15 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
|
||||||
{
|
{
|
||||||
// replace raw provider
|
// replace raw provider
|
||||||
List<ILanguageSettingsProvider> providers = new ArrayList<ILanguageSettingsProvider>();
|
List<ILanguageSettingsProvider> providers = new ArrayList<ILanguageSettingsProvider>();
|
||||||
LanguageSettingsSerializableProvider newRawProvider = new LanguageSettingsSerializableProvider(
|
LanguageSettingsSerializableProvider newRawProvider = new LanguageSettingsSerializableProvider(EXTENSION_EDITABLE_PROVIDER_ID, PROVIDER_NAME_0);
|
||||||
EXTENSION_EDITABLE_PROVIDER_ID, PROVIDER_NAME_0);
|
newRawProvider.setSettingEntries(null, null, null, newEntries);
|
||||||
newRawProvider.setSettingEntries((IBuildConfiguration) null, null, null, newEntries);
|
|
||||||
providers.add(newRawProvider);
|
providers.add(newRawProvider);
|
||||||
LanguageSettingsManager.setWorkspaceProviders(providers);
|
LanguageSettingsManager.setWorkspaceProviders(providers);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// check that provider provides the new entries
|
// check that provider provides the new entries
|
||||||
List<ICLanguageSettingEntry> entries = provider.getSettingEntries((IBuildConfiguration) null, null, null);
|
List<ICLanguageSettingEntry> entries = provider.getSettingEntries(null, null, null);
|
||||||
assertEquals(newEntries.size(), entries.size());
|
assertEquals(newEntries.size(), entries.size());
|
||||||
assertEquals(newEntries, entries);
|
assertEquals(newEntries, entries);
|
||||||
}
|
}
|
||||||
|
@ -930,8 +829,7 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
|
||||||
*/
|
*/
|
||||||
public void testWorkspaceProvider_ReplaceWithWorkspaceProvider() throws Exception {
|
public void testWorkspaceProvider_ReplaceWithWorkspaceProvider() throws Exception {
|
||||||
// get sample workspace provider
|
// get sample workspace provider
|
||||||
ILanguageSettingsProvider provider = LanguageSettingsManager
|
ILanguageSettingsProvider provider = LanguageSettingsManager.getWorkspaceProvider(EXTENSION_SERIALIZABLE_PROVIDER_ID);
|
||||||
.getWorkspaceProvider(EXTENSION_SERIALIZABLE_PROVIDER_ID);
|
|
||||||
ILanguageSettingsProvider rawProvider = LanguageSettingsManager.getRawProvider(provider);
|
ILanguageSettingsProvider rawProvider = LanguageSettingsManager.getRawProvider(provider);
|
||||||
assertNotSame(provider, rawProvider);
|
assertNotSame(provider, rawProvider);
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -18,6 +18,8 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import junit.framework.TestSuite;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.model.CoreModel;
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
import org.eclipse.cdt.core.settings.model.CIncludePathEntry;
|
import org.eclipse.cdt.core.settings.model.CIncludePathEntry;
|
||||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
|
@ -29,22 +31,16 @@ import org.eclipse.cdt.core.settings.model.util.CDataUtil;
|
||||||
import org.eclipse.cdt.core.testplugin.ResourceHelper;
|
import org.eclipse.cdt.core.testplugin.ResourceHelper;
|
||||||
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
|
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
|
||||||
import org.eclipse.cdt.internal.core.language.settings.providers.ReferencedProjectsLanguageSettingsProvider;
|
import org.eclipse.cdt.internal.core.language.settings.providers.ReferencedProjectsLanguageSettingsProvider;
|
||||||
import org.eclipse.core.resources.IBuildConfiguration;
|
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.Adapters;
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
import junit.framework.TestSuite;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test cases testing ReferencedProjectsLanguageSettingsProvider functionality
|
* Test cases testing ReferencedProjectsLanguageSettingsProvider functionality
|
||||||
*/
|
*/
|
||||||
public class LanguageSettingsProviderReferencedProjectsTests extends BaseTestCase {
|
public class LanguageSettingsProviderReferencedProjectsTests extends BaseTestCase {
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
* @param name - name of the test.
|
||||||
* @param name
|
|
||||||
* - name of the test.
|
|
||||||
*/
|
*/
|
||||||
public LanguageSettingsProviderReferencedProjectsTests(String name) {
|
public LanguageSettingsProviderReferencedProjectsTests(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
|
@ -71,8 +67,7 @@ public class LanguageSettingsProviderReferencedProjectsTests extends BaseTestCas
|
||||||
/**
|
/**
|
||||||
* main function of the class.
|
* main function of the class.
|
||||||
*
|
*
|
||||||
* @param args
|
* @param args - arguments
|
||||||
* - arguments
|
|
||||||
*/
|
*/
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
junit.textui.TestRunner.run(suite());
|
junit.textui.TestRunner.run(suite());
|
||||||
|
@ -108,13 +103,8 @@ public class LanguageSettingsProviderReferencedProjectsTests extends BaseTestCas
|
||||||
ICConfigurationDescription[] cfgDescriptions = projectDescription.getConfigurations();
|
ICConfigurationDescription[] cfgDescriptions = projectDescription.getConfigurations();
|
||||||
ICConfigurationDescription cfgDescription = cfgDescriptions[0];
|
ICConfigurationDescription cfgDescription = cfgDescriptions[0];
|
||||||
|
|
||||||
final ICConfigurationDescription cfgDescriptionReferenced = getConfigurationDescriptions(
|
final ICConfigurationDescription cfgDescriptionReferenced = getConfigurationDescriptions(projectReferenced)[0];
|
||||||
projectReferenced)[0];
|
cfgDescription.setReferenceInfo(new HashMap<String, String>() {{ put(projectReferenced.getName(), cfgDescriptionReferenced.getId()); }});
|
||||||
cfgDescription.setReferenceInfo(new HashMap<String, String>() {
|
|
||||||
{
|
|
||||||
put(projectReferenced.getName(), cfgDescriptionReferenced.getId());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
coreModel.setProjectDescription(project, projectDescription);
|
coreModel.setProjectDescription(project, projectDescription);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,10 +124,9 @@ public class LanguageSettingsProviderReferencedProjectsTests extends BaseTestCas
|
||||||
* Test that null arguments don't crash the provider.
|
* Test that null arguments don't crash the provider.
|
||||||
*/
|
*/
|
||||||
public void testNulls() throws Exception {
|
public void testNulls() throws Exception {
|
||||||
ILanguageSettingsProvider provider = LanguageSettingsManager
|
ILanguageSettingsProvider provider = LanguageSettingsManager.getWorkspaceProvider(ReferencedProjectsLanguageSettingsProvider.ID);
|
||||||
.getWorkspaceProvider(ReferencedProjectsLanguageSettingsProvider.ID);
|
|
||||||
assertNotNull(provider);
|
assertNotNull(provider);
|
||||||
List<ICLanguageSettingEntry> entries = provider.getSettingEntries((IBuildConfiguration) null, null, null);
|
List<ICLanguageSettingEntry> entries = provider.getSettingEntries(null, null, null);
|
||||||
assertEquals(null, entries);
|
assertEquals(null, entries);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,34 +144,27 @@ public class LanguageSettingsProviderReferencedProjectsTests extends BaseTestCas
|
||||||
// get cfgDescription
|
// get cfgDescription
|
||||||
ICConfigurationDescription[] cfgDescriptions = getConfigurationDescriptions(project);
|
ICConfigurationDescription[] cfgDescriptions = getConfigurationDescriptions(project);
|
||||||
ICConfigurationDescription cfgDescription = cfgDescriptions[0];
|
ICConfigurationDescription cfgDescription = cfgDescriptions[0];
|
||||||
IBuildConfiguration config = Adapters.adapt(cfgDescription, IBuildConfiguration.class);
|
|
||||||
assertNotNull(config);
|
|
||||||
|
|
||||||
{
|
{
|
||||||
// double-check that provider for referenced projects is set in the configuration
|
// double-check that provider for referenced projects is set in the configuration
|
||||||
ILanguageSettingsProvider refProjectsProvider = LanguageSettingsManager
|
ILanguageSettingsProvider refProjectsProvider = LanguageSettingsManager.getWorkspaceProvider(ReferencedProjectsLanguageSettingsProvider.ID);
|
||||||
.getWorkspaceProvider(ReferencedProjectsLanguageSettingsProvider.ID);
|
|
||||||
assertNotNull(refProjectsProvider);
|
assertNotNull(refProjectsProvider);
|
||||||
List<ILanguageSettingsProvider> providers = ((ILanguageSettingsProvidersKeeper) cfgDescription)
|
List<ILanguageSettingsProvider> providers = ((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders();
|
||||||
.getLanguageSettingProviders();
|
|
||||||
assertTrue(providers.contains(refProjectsProvider));
|
assertTrue(providers.contains(refProjectsProvider));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check that no setting entries are set initially
|
// Check that no setting entries are set initially
|
||||||
{
|
{
|
||||||
List<ICLanguageSettingEntry> entries = LanguageSettingsManager.getSettingEntriesByKind(config, project,
|
List<ICLanguageSettingEntry> entries = LanguageSettingsManager.getSettingEntriesByKind(cfgDescription, project, null, ICSettingEntry.ALL);
|
||||||
null, ICSettingEntry.ALL);
|
|
||||||
assertEquals(0, entries.size());
|
assertEquals(0, entries.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add an entry into a non-referenced project
|
// Add an entry into a non-referenced project
|
||||||
CIncludePathEntry nonRefEntry = CDataUtil.createCIncludePathEntry("non-referenced-exported",
|
CIncludePathEntry nonRefEntry = CDataUtil.createCIncludePathEntry("non-referenced-exported", ICSettingEntry.EXPORTED);
|
||||||
ICSettingEntry.EXPORTED);
|
|
||||||
{
|
{
|
||||||
ICConfigurationDescription[] nonRefCfgDescriptions = getConfigurationDescriptions(nonReferencedProject);
|
ICConfigurationDescription[] nonRefCfgDescriptions = getConfigurationDescriptions(nonReferencedProject);
|
||||||
ICConfigurationDescription nonRefCfgDescription = nonRefCfgDescriptions[0];
|
ICConfigurationDescription nonRefCfgDescription = nonRefCfgDescriptions[0];
|
||||||
List<ILanguageSettingsProvider> providersNonRef = ((ILanguageSettingsProvidersKeeper) nonRefCfgDescription)
|
List<ILanguageSettingsProvider> providersNonRef = ((ILanguageSettingsProvidersKeeper) nonRefCfgDescription).getLanguageSettingProviders();
|
||||||
.getLanguageSettingProviders();
|
|
||||||
// get user provider which is the first one
|
// get user provider which is the first one
|
||||||
ILanguageSettingsProvider userProviderNonRef = providersNonRef.get(0);
|
ILanguageSettingsProvider userProviderNonRef = providersNonRef.get(0);
|
||||||
assertEquals(ScannerDiscoveryLegacySupport.USER_LANGUAGE_SETTINGS_PROVIDER_ID, userProviderNonRef.getId());
|
assertEquals(ScannerDiscoveryLegacySupport.USER_LANGUAGE_SETTINGS_PROVIDER_ID, userProviderNonRef.getId());
|
||||||
|
@ -190,12 +172,11 @@ public class LanguageSettingsProviderReferencedProjectsTests extends BaseTestCas
|
||||||
// add sample entries
|
// add sample entries
|
||||||
ArrayList<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>();
|
ArrayList<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>();
|
||||||
entries.add(nonRefEntry);
|
entries.add(nonRefEntry);
|
||||||
((LanguageSettingsGenericProvider) userProviderNonRef).setSettingEntries((IBuildConfiguration) null, null, null, entries);
|
((LanguageSettingsGenericProvider) userProviderNonRef).setSettingEntries(null, null, null, entries);
|
||||||
}
|
}
|
||||||
// Confirm that that does not add entries to the main project
|
// Confirm that that does not add entries to the main project
|
||||||
{
|
{
|
||||||
List<ICLanguageSettingEntry> entries = LanguageSettingsManager.getSettingEntriesByKind(config, project,
|
List<ICLanguageSettingEntry> entries = LanguageSettingsManager.getSettingEntriesByKind(cfgDescription, project, null, ICSettingEntry.ALL);
|
||||||
null, ICSettingEntry.ALL);
|
|
||||||
assertEquals(0, entries.size());
|
assertEquals(0, entries.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,10 +185,7 @@ public class LanguageSettingsProviderReferencedProjectsTests extends BaseTestCas
|
||||||
{
|
{
|
||||||
ICConfigurationDescription[] refCfgDescriptions = getConfigurationDescriptions(referencedProject);
|
ICConfigurationDescription[] refCfgDescriptions = getConfigurationDescriptions(referencedProject);
|
||||||
ICConfigurationDescription refCfgDescription = refCfgDescriptions[0];
|
ICConfigurationDescription refCfgDescription = refCfgDescriptions[0];
|
||||||
IBuildConfiguration refConfig = Adapters.adapt(refCfgDescription, IBuildConfiguration.class);
|
List<ILanguageSettingsProvider> providersRef = ((ILanguageSettingsProvidersKeeper) refCfgDescription).getLanguageSettingProviders();
|
||||||
assertNotNull(refConfig);
|
|
||||||
List<ILanguageSettingsProvider> providersRef = ((ILanguageSettingsProvidersKeeper) refCfgDescription)
|
|
||||||
.getLanguageSettingProviders();
|
|
||||||
// get user provider which is the first one
|
// get user provider which is the first one
|
||||||
ILanguageSettingsProvider userProviderRef = providersRef.get(0);
|
ILanguageSettingsProvider userProviderRef = providersRef.get(0);
|
||||||
assertEquals(ScannerDiscoveryLegacySupport.USER_LANGUAGE_SETTINGS_PROVIDER_ID, userProviderRef.getId());
|
assertEquals(ScannerDiscoveryLegacySupport.USER_LANGUAGE_SETTINGS_PROVIDER_ID, userProviderRef.getId());
|
||||||
|
@ -217,16 +195,13 @@ public class LanguageSettingsProviderReferencedProjectsTests extends BaseTestCas
|
||||||
CIncludePathEntry refEntryNotExported = CDataUtil.createCIncludePathEntry("referenced-not-exported", 0);
|
CIncludePathEntry refEntryNotExported = CDataUtil.createCIncludePathEntry("referenced-not-exported", 0);
|
||||||
entries.add(refEntry);
|
entries.add(refEntry);
|
||||||
entries.add(refEntryNotExported);
|
entries.add(refEntryNotExported);
|
||||||
((LanguageSettingsGenericProvider) userProviderRef).setSettingEntries((IBuildConfiguration) null, null, null, entries);
|
((LanguageSettingsGenericProvider) userProviderRef).setSettingEntries(null, null, null, entries);
|
||||||
List<ICLanguageSettingEntry> entriesActual = LanguageSettingsManager.getSettingEntriesByKind(refConfig,
|
List<ICLanguageSettingEntry> entriesActual = LanguageSettingsManager.getSettingEntriesByKind(refCfgDescription, project, null, ICSettingEntry.ALL);
|
||||||
project, null, ICSettingEntry.ALL);
|
|
||||||
assertEquals(entries, entriesActual);
|
assertEquals(entries, entriesActual);
|
||||||
}
|
}
|
||||||
// Check that the new entries from referenced project made it to the
|
// Check that the new entries from referenced project made it to the main project
|
||||||
// main project
|
|
||||||
{
|
{
|
||||||
List<ICLanguageSettingEntry> entries = LanguageSettingsManager.getSettingEntriesByKind(config, project,
|
List<ICLanguageSettingEntry> entries = LanguageSettingsManager.getSettingEntriesByKind(cfgDescription, project, null, ICSettingEntry.ALL);
|
||||||
null, ICSettingEntry.ALL);
|
|
||||||
assertEquals(CDataUtil.createCIncludePathEntry(refEntry.getName(), 0), entries.get(0));
|
assertEquals(CDataUtil.createCIncludePathEntry(refEntry.getName(), 0), entries.get(0));
|
||||||
assertEquals(1, entries.size());
|
assertEquals(1, entries.size());
|
||||||
}
|
}
|
||||||
|
@ -247,41 +222,30 @@ public class LanguageSettingsProviderReferencedProjectsTests extends BaseTestCas
|
||||||
// get cfgDescriptions to work with
|
// get cfgDescriptions to work with
|
||||||
ICConfigurationDescription[] cfgDescriptionsA = getConfigurationDescriptions(projectA);
|
ICConfigurationDescription[] cfgDescriptionsA = getConfigurationDescriptions(projectA);
|
||||||
ICConfigurationDescription cfgDescriptionA = cfgDescriptionsA[0];
|
ICConfigurationDescription cfgDescriptionA = cfgDescriptionsA[0];
|
||||||
IBuildConfiguration configA = Adapters.adapt(cfgDescriptionA, IBuildConfiguration.class);
|
|
||||||
assertNotNull(configA);
|
|
||||||
ICConfigurationDescription[] cfgDescriptionsB = getConfigurationDescriptions(projectB);
|
ICConfigurationDescription[] cfgDescriptionsB = getConfigurationDescriptions(projectB);
|
||||||
ICConfigurationDescription cfgDescriptionB = cfgDescriptionsB[0];
|
ICConfigurationDescription cfgDescriptionB = cfgDescriptionsB[0];
|
||||||
IBuildConfiguration configB = Adapters.adapt(cfgDescriptionB, IBuildConfiguration.class);
|
|
||||||
assertNotNull(configB);
|
|
||||||
// double-check that provider for referenced projects is set in the configurations
|
// double-check that provider for referenced projects is set in the configurations
|
||||||
ILanguageSettingsProvider refProjectsProvider = LanguageSettingsManager
|
ILanguageSettingsProvider refProjectsProvider = LanguageSettingsManager.getWorkspaceProvider(ReferencedProjectsLanguageSettingsProvider.ID);
|
||||||
.getWorkspaceProvider(ReferencedProjectsLanguageSettingsProvider.ID);
|
|
||||||
assertNotNull(refProjectsProvider);
|
assertNotNull(refProjectsProvider);
|
||||||
List<ILanguageSettingsProvider> providersA = ((ILanguageSettingsProvidersKeeper) cfgDescriptionA)
|
List<ILanguageSettingsProvider> providersA = ((ILanguageSettingsProvidersKeeper) cfgDescriptionA).getLanguageSettingProviders();
|
||||||
.getLanguageSettingProviders();
|
|
||||||
assertTrue(providersA.contains(refProjectsProvider));
|
assertTrue(providersA.contains(refProjectsProvider));
|
||||||
List<ILanguageSettingsProvider> providersB = ((ILanguageSettingsProvidersKeeper) cfgDescriptionB)
|
List<ILanguageSettingsProvider> providersB = ((ILanguageSettingsProvidersKeeper) cfgDescriptionB).getLanguageSettingProviders();
|
||||||
.getLanguageSettingProviders();
|
|
||||||
assertTrue(providersB.contains(refProjectsProvider));
|
assertTrue(providersB.contains(refProjectsProvider));
|
||||||
|
|
||||||
// Check that no setting entries are set initially
|
// Check that no setting entries are set initially
|
||||||
List<ICLanguageSettingEntry> entriesA = LanguageSettingsManager.getSettingEntriesByKind(configA, projectA,
|
List<ICLanguageSettingEntry> entriesA = LanguageSettingsManager.getSettingEntriesByKind(cfgDescriptionA, projectA, null, ICSettingEntry.ALL);
|
||||||
null, ICSettingEntry.ALL);
|
|
||||||
assertEquals(0, entriesA.size());
|
assertEquals(0, entriesA.size());
|
||||||
List<ICLanguageSettingEntry> entriesB = LanguageSettingsManager.getSettingEntriesByKind(configB, projectB,
|
List<ICLanguageSettingEntry> entriesB = LanguageSettingsManager.getSettingEntriesByKind(cfgDescriptionA, projectB, null, ICSettingEntry.ALL);
|
||||||
null, ICSettingEntry.ALL);
|
|
||||||
assertEquals(0, entriesB.size());
|
assertEquals(0, entriesB.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
CIncludePathEntry entryExportedA = CDataUtil.createCIncludePathEntry("referenced-exported-A",
|
CIncludePathEntry entryExportedA = CDataUtil.createCIncludePathEntry("referenced-exported-A", ICSettingEntry.EXPORTED);
|
||||||
ICSettingEntry.EXPORTED);
|
|
||||||
CIncludePathEntry entryNotExportedA = CDataUtil.createCIncludePathEntry("referenced-not-exported-A", 0);
|
CIncludePathEntry entryNotExportedA = CDataUtil.createCIncludePathEntry("referenced-not-exported-A", 0);
|
||||||
// Add entries into a project A
|
// Add entries into a project A
|
||||||
{
|
{
|
||||||
ICConfigurationDescription[] refCfgDescriptions = getConfigurationDescriptions(projectA);
|
ICConfigurationDescription[] refCfgDescriptions = getConfigurationDescriptions(projectA);
|
||||||
ICConfigurationDescription refCfgDescription = refCfgDescriptions[0];
|
ICConfigurationDescription refCfgDescription = refCfgDescriptions[0];
|
||||||
List<ILanguageSettingsProvider> providersRef = ((ILanguageSettingsProvidersKeeper) refCfgDescription)
|
List<ILanguageSettingsProvider> providersRef = ((ILanguageSettingsProvidersKeeper) refCfgDescription).getLanguageSettingProviders();
|
||||||
.getLanguageSettingProviders();
|
|
||||||
// get user provider which is the first one
|
// get user provider which is the first one
|
||||||
ILanguageSettingsProvider userProviderRef = providersRef.get(0);
|
ILanguageSettingsProvider userProviderRef = providersRef.get(0);
|
||||||
assertEquals(ScannerDiscoveryLegacySupport.USER_LANGUAGE_SETTINGS_PROVIDER_ID, userProviderRef.getId());
|
assertEquals(ScannerDiscoveryLegacySupport.USER_LANGUAGE_SETTINGS_PROVIDER_ID, userProviderRef.getId());
|
||||||
|
@ -290,18 +254,16 @@ public class LanguageSettingsProviderReferencedProjectsTests extends BaseTestCas
|
||||||
ArrayList<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>();
|
ArrayList<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>();
|
||||||
entries.add(entryExportedA);
|
entries.add(entryExportedA);
|
||||||
entries.add(entryNotExportedA);
|
entries.add(entryNotExportedA);
|
||||||
((LanguageSettingsGenericProvider) userProviderRef).setSettingEntries((IBuildConfiguration) null, null, null, entries);
|
((LanguageSettingsGenericProvider) userProviderRef).setSettingEntries(null, null, null, entries);
|
||||||
}
|
}
|
||||||
|
|
||||||
CIncludePathEntry entryExportedB = CDataUtil.createCIncludePathEntry("referenced-exported-B",
|
CIncludePathEntry entryExportedB = CDataUtil.createCIncludePathEntry("referenced-exported-B", ICSettingEntry.EXPORTED);
|
||||||
ICSettingEntry.EXPORTED);
|
|
||||||
CIncludePathEntry entryNotExportedB = CDataUtil.createCIncludePathEntry("referenced-not-exported-B", 0);
|
CIncludePathEntry entryNotExportedB = CDataUtil.createCIncludePathEntry("referenced-not-exported-B", 0);
|
||||||
// Add entries into a project B
|
// Add entries into a project B
|
||||||
{
|
{
|
||||||
ICConfigurationDescription[] refCfgDescriptions = getConfigurationDescriptions(projectB);
|
ICConfigurationDescription[] refCfgDescriptions = getConfigurationDescriptions(projectB);
|
||||||
ICConfigurationDescription refCfgDescription = refCfgDescriptions[0];
|
ICConfigurationDescription refCfgDescription = refCfgDescriptions[0];
|
||||||
List<ILanguageSettingsProvider> providersRef = ((ILanguageSettingsProvidersKeeper) refCfgDescription)
|
List<ILanguageSettingsProvider> providersRef = ((ILanguageSettingsProvidersKeeper) refCfgDescription).getLanguageSettingProviders();
|
||||||
.getLanguageSettingProviders();
|
|
||||||
// get user provider which is the first one
|
// get user provider which is the first one
|
||||||
ILanguageSettingsProvider userProviderRef = providersRef.get(0);
|
ILanguageSettingsProvider userProviderRef = providersRef.get(0);
|
||||||
assertEquals(ScannerDiscoveryLegacySupport.USER_LANGUAGE_SETTINGS_PROVIDER_ID, userProviderRef.getId());
|
assertEquals(ScannerDiscoveryLegacySupport.USER_LANGUAGE_SETTINGS_PROVIDER_ID, userProviderRef.getId());
|
||||||
|
@ -310,17 +272,14 @@ public class LanguageSettingsProviderReferencedProjectsTests extends BaseTestCas
|
||||||
ArrayList<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>();
|
ArrayList<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>();
|
||||||
entries.add(entryExportedB);
|
entries.add(entryExportedB);
|
||||||
entries.add(entryNotExportedB);
|
entries.add(entryNotExportedB);
|
||||||
((LanguageSettingsGenericProvider) userProviderRef).setSettingEntries((IBuildConfiguration) null, null, null, entries);
|
((LanguageSettingsGenericProvider) userProviderRef).setSettingEntries(null, null, null, entries);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check that the new entries from projectB made it to projectA
|
// Check that the new entries from projectB made it to projectA
|
||||||
{
|
{
|
||||||
ICConfigurationDescription[] cfgDescriptionsA = getConfigurationDescriptions(projectA);
|
ICConfigurationDescription[] cfgDescriptionsA = getConfigurationDescriptions(projectA);
|
||||||
ICConfigurationDescription cfgDescriptionA = cfgDescriptionsA[0];
|
ICConfigurationDescription cfgDescriptionA = cfgDescriptionsA[0];
|
||||||
IBuildConfiguration configA = Adapters.adapt(cfgDescriptionA, IBuildConfiguration.class);
|
List<ICLanguageSettingEntry> entries = LanguageSettingsManager.getSettingEntriesByKind(cfgDescriptionA, projectA, null, ICSettingEntry.ALL);
|
||||||
assertNotNull(configA);
|
|
||||||
List<ICLanguageSettingEntry> entries = LanguageSettingsManager.getSettingEntriesByKind(configA, projectA,
|
|
||||||
null, ICSettingEntry.ALL);
|
|
||||||
assertEquals(entryExportedA, entries.get(0));
|
assertEquals(entryExportedA, entries.get(0));
|
||||||
assertEquals(entryNotExportedA, entries.get(1));
|
assertEquals(entryNotExportedA, entries.get(1));
|
||||||
assertEquals(CDataUtil.createCIncludePathEntry(entryExportedB.getName(), 0), entries.get(2));
|
assertEquals(CDataUtil.createCIncludePathEntry(entryExportedB.getName(), 0), entries.get(2));
|
||||||
|
@ -330,9 +289,7 @@ public class LanguageSettingsProviderReferencedProjectsTests extends BaseTestCas
|
||||||
{
|
{
|
||||||
ICConfigurationDescription[] cfgDescriptionsB = getConfigurationDescriptions(projectB);
|
ICConfigurationDescription[] cfgDescriptionsB = getConfigurationDescriptions(projectB);
|
||||||
ICConfigurationDescription cfgDescriptionB = cfgDescriptionsB[0];
|
ICConfigurationDescription cfgDescriptionB = cfgDescriptionsB[0];
|
||||||
IBuildConfiguration configB = Adapters.adapt(cfgDescriptionB, IBuildConfiguration.class);
|
List<ICLanguageSettingEntry> entries = LanguageSettingsManager.getSettingEntriesByKind(cfgDescriptionB, projectB, null, ICSettingEntry.ALL);
|
||||||
List<ICLanguageSettingEntry> entries = LanguageSettingsManager.getSettingEntriesByKind(configB, projectB,
|
|
||||||
null, ICSettingEntry.ALL);
|
|
||||||
assertEquals(entryExportedB, entries.get(0));
|
assertEquals(entryExportedB, entries.get(0));
|
||||||
assertEquals(entryNotExportedB, entries.get(1));
|
assertEquals(entryNotExportedB, entries.get(1));
|
||||||
assertEquals(CDataUtil.createCIncludePathEntry(entryExportedA.getName(), 0), entries.get(2));
|
assertEquals(CDataUtil.createCIncludePathEntry(entryExportedA.getName(), 0), entries.get(2));
|
||||||
|
|
|
@ -15,6 +15,8 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import junit.framework.TestSuite;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.model.ILanguage;
|
import org.eclipse.cdt.core.model.ILanguage;
|
||||||
import org.eclipse.cdt.core.model.LanguageManager;
|
import org.eclipse.cdt.core.model.LanguageManager;
|
||||||
import org.eclipse.cdt.core.parser.ExtendedScannerInfo;
|
import org.eclipse.cdt.core.parser.ExtendedScannerInfo;
|
||||||
|
@ -32,19 +34,15 @@ import org.eclipse.cdt.core.testplugin.ResourceHelper;
|
||||||
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
|
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
|
||||||
import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsScannerInfoProvider;
|
import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsScannerInfoProvider;
|
||||||
import org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager;
|
import org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager;
|
||||||
import org.eclipse.core.resources.IBuildConfiguration;
|
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IFolder;
|
import org.eclipse.core.resources.IFolder;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.resources.ResourcesPlugin;
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
import org.eclipse.core.runtime.Adapters;
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
|
|
||||||
import junit.framework.TestSuite;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test cases testing LanguageSettingsProvider functionality
|
* Test cases testing LanguageSettingsProvider functionality
|
||||||
*/
|
*/
|
||||||
|
@ -67,17 +65,14 @@ public class LanguageSettingsScannerInfoProviderTests extends BaseTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ICLanguageSettingEntry> getSettingEntries(IBuildConfiguration config, IResource rc,
|
public List<ICLanguageSettingEntry> getSettingEntries(ICConfigurationDescription cfgDescription, IResource rc, String languageId) {
|
||||||
String languageId) {
|
|
||||||
return entries;
|
return entries;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
* @param name - name of the test.
|
||||||
* @param name
|
|
||||||
* - name of the test.
|
|
||||||
*/
|
*/
|
||||||
public LanguageSettingsScannerInfoProviderTests(String name) {
|
public LanguageSettingsScannerInfoProviderTests(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
|
@ -104,8 +99,7 @@ public class LanguageSettingsScannerInfoProviderTests extends BaseTestCase {
|
||||||
/**
|
/**
|
||||||
* main function of the class.
|
* main function of the class.
|
||||||
*
|
*
|
||||||
* @param args
|
* @param args - arguments
|
||||||
* - arguments
|
|
||||||
*/
|
*/
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
junit.textui.TestRunner.run(suite());
|
junit.textui.TestRunner.run(suite());
|
||||||
|
@ -130,8 +124,7 @@ public class LanguageSettingsScannerInfoProviderTests extends BaseTestCase {
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
// triplecheck builderCWD for different project/configuration descriptions
|
// triplecheck builderCWD for different project/configuration descriptions
|
||||||
ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance()
|
ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project, READ_ONLY);
|
||||||
.getProjectDescription(project, READ_ONLY);
|
|
||||||
assertNotNull(prjDescription);
|
assertNotNull(prjDescription);
|
||||||
ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
|
ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
|
||||||
assertNotNull(cfgDescription);
|
assertNotNull(cfgDescription);
|
||||||
|
@ -160,8 +153,7 @@ public class LanguageSettingsScannerInfoProviderTests extends BaseTestCase {
|
||||||
{
|
{
|
||||||
// Handle prjDescription==null
|
// Handle prjDescription==null
|
||||||
IProject project = FAKE_FILE.getProject();
|
IProject project = FAKE_FILE.getProject();
|
||||||
ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance()
|
ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project, READ_ONLY);
|
||||||
.getProjectDescription(project, READ_ONLY);
|
|
||||||
assertNull(prjDescription);
|
assertNull(prjDescription);
|
||||||
|
|
||||||
LanguageSettingsScannerInfoProvider scannerInfoProvider = new LanguageSettingsScannerInfoProvider();
|
LanguageSettingsScannerInfoProvider scannerInfoProvider = new LanguageSettingsScannerInfoProvider();
|
||||||
|
@ -179,8 +171,7 @@ public class LanguageSettingsScannerInfoProviderTests extends BaseTestCase {
|
||||||
IProject project = ResourceHelper.createCDTProjectWithConfig(getName());
|
IProject project = ResourceHelper.createCDTProjectWithConfig(getName());
|
||||||
IFile file = ResourceHelper.createFile(project, "file");
|
IFile file = ResourceHelper.createFile(project, "file");
|
||||||
|
|
||||||
ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance()
|
ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project, READ_ONLY);
|
||||||
.getProjectDescription(project, READ_ONLY);
|
|
||||||
assertNotNull(prjDescription);
|
assertNotNull(prjDescription);
|
||||||
ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
|
ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
|
||||||
assertNotNull(cfgDescription);
|
assertNotNull(cfgDescription);
|
||||||
|
@ -208,8 +199,7 @@ public class LanguageSettingsScannerInfoProviderTests extends BaseTestCase {
|
||||||
IFile file = ResourceHelper.createFile(project, "file.c");
|
IFile file = ResourceHelper.createFile(project, "file.c");
|
||||||
|
|
||||||
// confirm that language==null
|
// confirm that language==null
|
||||||
ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project,
|
ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project, READ_ONLY);
|
||||||
READ_ONLY);
|
|
||||||
assertNotNull(prjDescription);
|
assertNotNull(prjDescription);
|
||||||
ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
|
ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
|
||||||
assertNotNull(cfgDescription);
|
assertNotNull(cfgDescription);
|
||||||
|
@ -231,8 +221,7 @@ public class LanguageSettingsScannerInfoProviderTests extends BaseTestCase {
|
||||||
public void testRegular() throws Exception {
|
public void testRegular() throws Exception {
|
||||||
// create a project
|
// create a project
|
||||||
IProject project = ResourceHelper.createCDTProjectWithConfig(getName());
|
IProject project = ResourceHelper.createCDTProjectWithConfig(getName());
|
||||||
ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project,
|
ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project, WRITEABLE);
|
||||||
WRITEABLE);
|
|
||||||
assertNotNull(prjDescription);
|
assertNotNull(prjDescription);
|
||||||
ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
|
ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
|
||||||
assertNotNull(cfgDescription);
|
assertNotNull(cfgDescription);
|
||||||
|
@ -304,8 +293,7 @@ public class LanguageSettingsScannerInfoProviderTests extends BaseTestCase {
|
||||||
public void testLocal() throws Exception {
|
public void testLocal() throws Exception {
|
||||||
// create a project
|
// create a project
|
||||||
IProject project = ResourceHelper.createCDTProjectWithConfig(getName());
|
IProject project = ResourceHelper.createCDTProjectWithConfig(getName());
|
||||||
ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project,
|
ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project, WRITEABLE);
|
||||||
WRITEABLE);
|
|
||||||
assertNotNull(prjDescription);
|
assertNotNull(prjDescription);
|
||||||
ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
|
ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
|
||||||
assertNotNull(cfgDescription);
|
assertNotNull(cfgDescription);
|
||||||
|
@ -359,8 +347,7 @@ public class LanguageSettingsScannerInfoProviderTests extends BaseTestCase {
|
||||||
public void testFramework() throws Exception {
|
public void testFramework() throws Exception {
|
||||||
// create a project
|
// create a project
|
||||||
IProject project = ResourceHelper.createCDTProjectWithConfig(getName());
|
IProject project = ResourceHelper.createCDTProjectWithConfig(getName());
|
||||||
ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project,
|
ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project, WRITEABLE);
|
||||||
WRITEABLE);
|
|
||||||
assertNotNull(prjDescription);
|
assertNotNull(prjDescription);
|
||||||
ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
|
ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
|
||||||
assertNotNull(cfgDescription);
|
assertNotNull(cfgDescription);
|
||||||
|
@ -403,8 +390,7 @@ public class LanguageSettingsScannerInfoProviderTests extends BaseTestCase {
|
||||||
public void testDuplicate() throws Exception {
|
public void testDuplicate() throws Exception {
|
||||||
// create a project
|
// create a project
|
||||||
IProject project = ResourceHelper.createCDTProjectWithConfig(getName());
|
IProject project = ResourceHelper.createCDTProjectWithConfig(getName());
|
||||||
ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project,
|
ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project, WRITEABLE);
|
||||||
WRITEABLE);
|
|
||||||
assertNotNull(prjDescription);
|
assertNotNull(prjDescription);
|
||||||
ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
|
ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
|
||||||
assertNotNull(cfgDescription);
|
assertNotNull(cfgDescription);
|
||||||
|
@ -454,8 +440,7 @@ public class LanguageSettingsScannerInfoProviderTests extends BaseTestCase {
|
||||||
public void testWorkspacePath() throws Exception {
|
public void testWorkspacePath() throws Exception {
|
||||||
// create a project
|
// create a project
|
||||||
IProject project = ResourceHelper.createCDTProjectWithConfig(getName());
|
IProject project = ResourceHelper.createCDTProjectWithConfig(getName());
|
||||||
ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project,
|
ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project, WRITEABLE);
|
||||||
WRITEABLE);
|
|
||||||
assertNotNull(prjDescription);
|
assertNotNull(prjDescription);
|
||||||
ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
|
ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
|
||||||
assertNotNull(cfgDescription);
|
assertNotNull(cfgDescription);
|
||||||
|
@ -482,12 +467,9 @@ public class LanguageSettingsScannerInfoProviderTests extends BaseTestCase {
|
||||||
|
|
||||||
// contribute the entries
|
// contribute the entries
|
||||||
CIncludePathEntry incWorkspaceEntry_1 = new CIncludePathEntry(incWorkspace_1, 0);
|
CIncludePathEntry incWorkspaceEntry_1 = new CIncludePathEntry(incWorkspace_1, 0);
|
||||||
CIncludePathEntry incWorkspaceEntry_2 = new CIncludePathEntry(incWorkspacePath_2,
|
CIncludePathEntry incWorkspaceEntry_2 = new CIncludePathEntry(incWorkspacePath_2, ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED);
|
||||||
ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED);
|
CIncludePathEntry incWorkspaceEntry_3 = new CIncludePathEntry(incWorkspaceRelativePath_3, ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED);
|
||||||
CIncludePathEntry incWorkspaceEntry_3 = new CIncludePathEntry(incWorkspaceRelativePath_3,
|
CIncludePathEntry incWorkspaceEntry_4 = new CIncludePathEntry(incWorkspacePathNoResolved_4, ICSettingEntry.VALUE_WORKSPACE_PATH);
|
||||||
ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED);
|
|
||||||
CIncludePathEntry incWorkspaceEntry_4 = new CIncludePathEntry(incWorkspacePathNoResolved_4,
|
|
||||||
ICSettingEntry.VALUE_WORKSPACE_PATH);
|
|
||||||
CIncludePathEntry incFilesystemEntry = new CIncludePathEntry(incFilesystem, 0);
|
CIncludePathEntry incFilesystemEntry = new CIncludePathEntry(incFilesystem, 0);
|
||||||
|
|
||||||
List<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>();
|
List<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>();
|
||||||
|
@ -529,13 +511,12 @@ public class LanguageSettingsScannerInfoProviderTests extends BaseTestCase {
|
||||||
// change drive on build working directory
|
// change drive on build working directory
|
||||||
String buildCwdDevice = project.getLocation().getDevice();
|
String buildCwdDevice = project.getLocation().getDevice();
|
||||||
|
|
||||||
// Test manually with a device which is different from project location device (path should exist)
|
// // Test manually with a device which is different from project location device (path should exist)
|
||||||
// IPath buildCWD = new Path("D:/build/path");
|
// IPath buildCWD = new Path("D:/build/path");
|
||||||
// String buildCwdDevice = buildCWD.getDevice();
|
// String buildCwdDevice = buildCWD.getDevice();
|
||||||
|
|
||||||
// get project/configuration descriptions
|
// get project/configuration descriptions
|
||||||
ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project,
|
ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project, WRITEABLE);
|
||||||
WRITEABLE);
|
|
||||||
assertNotNull(prjDescription);
|
assertNotNull(prjDescription);
|
||||||
ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
|
ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
|
||||||
assertNotNull(cfgDescription);
|
assertNotNull(cfgDescription);
|
||||||
|
@ -582,14 +563,12 @@ public class LanguageSettingsScannerInfoProviderTests extends BaseTestCase {
|
||||||
IFolder relativeFolder = ResourceHelper.createFolder(project, "buildDir/"+relativePath);
|
IFolder relativeFolder = ResourceHelper.createFolder(project, "buildDir/"+relativePath);
|
||||||
IFolder relativeFolderProjName = ResourceHelper.createFolder(project, "buildDir/"+prjName);
|
IFolder relativeFolderProjName = ResourceHelper.createFolder(project, "buildDir/"+prjName);
|
||||||
String markedResolved = "-MarkedResolved";
|
String markedResolved = "-MarkedResolved";
|
||||||
IFolder relativeFolderProjNameResolved = ResourceHelper.createFolder(project,
|
IFolder relativeFolderProjNameResolved = ResourceHelper.createFolder(project, "buildDir/" + prjName+markedResolved);
|
||||||
"buildDir/" + prjName + markedResolved);
|
|
||||||
IPath buildCWD=buildFolder.getLocation();
|
IPath buildCWD=buildFolder.getLocation();
|
||||||
setBuilderCWD(project, buildCWD);
|
setBuilderCWD(project, buildCWD);
|
||||||
|
|
||||||
// get project/configuration descriptions
|
// get project/configuration descriptions
|
||||||
ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project,
|
ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project, WRITEABLE);
|
||||||
WRITEABLE);
|
|
||||||
assertNotNull(prjDescription);
|
assertNotNull(prjDescription);
|
||||||
ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
|
ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
|
||||||
assertNotNull(cfgDescription);
|
assertNotNull(cfgDescription);
|
||||||
|
@ -601,8 +580,7 @@ public class LanguageSettingsScannerInfoProviderTests extends BaseTestCase {
|
||||||
// contribute the entries
|
// contribute the entries
|
||||||
CIncludePathEntry incRelativeEntry = new CIncludePathEntry(new Path(relativePath), 0);
|
CIncludePathEntry incRelativeEntry = new CIncludePathEntry(new Path(relativePath), 0);
|
||||||
CIncludePathEntry incProjNameEntry = new CIncludePathEntry(new Path("${ProjName}"), 0);
|
CIncludePathEntry incProjNameEntry = new CIncludePathEntry(new Path("${ProjName}"), 0);
|
||||||
CIncludePathEntry incProjNameMarkedResolvedEntry = new CIncludePathEntry(
|
CIncludePathEntry incProjNameMarkedResolvedEntry = new CIncludePathEntry(new Path("${ProjName}"+markedResolved), ICSettingEntry.RESOLVED);
|
||||||
new Path("${ProjName}" + markedResolved), ICSettingEntry.RESOLVED);
|
|
||||||
List<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>();
|
List<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>();
|
||||||
entries.add(incRelativeEntry);
|
entries.add(incRelativeEntry);
|
||||||
entries.add(incProjNameEntry);
|
entries.add(incProjNameEntry);
|
||||||
|
@ -660,8 +638,7 @@ public class LanguageSettingsScannerInfoProviderTests extends BaseTestCase {
|
||||||
IFolder incFolder_dotdot_slash_path = ResourceHelper.createFolder(project, "include2"); // "/ProjPath/buildDir/../include2"
|
IFolder incFolder_dotdot_slash_path = ResourceHelper.createFolder(project, "include2"); // "/ProjPath/buildDir/../include2"
|
||||||
|
|
||||||
// get project/configuration descriptions
|
// get project/configuration descriptions
|
||||||
ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project,
|
ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project, WRITEABLE);
|
||||||
WRITEABLE);
|
|
||||||
assertNotNull(prjDescription);
|
assertNotNull(prjDescription);
|
||||||
ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
|
ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
|
||||||
assertNotNull(cfgDescription);
|
assertNotNull(cfgDescription);
|
||||||
|
@ -672,17 +649,13 @@ public class LanguageSettingsScannerInfoProviderTests extends BaseTestCase {
|
||||||
|
|
||||||
// contribute the entries
|
// contribute the entries
|
||||||
CIncludePathEntry incRelativeEntry_dot = new CIncludePathEntry(new Path(relativePath_dot), 0);
|
CIncludePathEntry incRelativeEntry_dot = new CIncludePathEntry(new Path(relativePath_dot), 0);
|
||||||
CIncludePathEntry incRelativeEntry_dot_slash_path = new CIncludePathEntry(new Path(relativePath_dot_slash_path),
|
CIncludePathEntry incRelativeEntry_dot_slash_path = new CIncludePathEntry(new Path(relativePath_dot_slash_path), 0);
|
||||||
0);
|
|
||||||
CIncludePathEntry incRelativeEntry_dotdot = new CIncludePathEntry(new Path(relativePath_dotdot), 0);
|
CIncludePathEntry incRelativeEntry_dotdot = new CIncludePathEntry(new Path(relativePath_dotdot), 0);
|
||||||
CIncludePathEntry incRelativeEntry_dotdot_slash_path = new CIncludePathEntry(
|
CIncludePathEntry incRelativeEntry_dotdot_slash_path = new CIncludePathEntry(new Path(relativePath_dotdot_slash_path), 0);
|
||||||
new Path(relativePath_dotdot_slash_path), 0);
|
|
||||||
CIncludePathEntry incEntry_dotdot_path = new CIncludePathEntry(locationPath_dotdot_path, 0);
|
CIncludePathEntry incEntry_dotdot_path = new CIncludePathEntry(locationPath_dotdot_path, 0);
|
||||||
// use LOCAL flag not to clash with plain dot entries
|
// use LOCAL flag not to clash with plain dot entries
|
||||||
CIncludePathEntry incRelativeEntry_dotdot_slash = new CIncludePathEntry(new Path(relativePath_dotdot_slash),
|
CIncludePathEntry incRelativeEntry_dotdot_slash = new CIncludePathEntry(new Path(relativePath_dotdot_slash), ICSettingEntry.LOCAL);
|
||||||
ICSettingEntry.LOCAL);
|
CIncludePathEntry incRelativeEntry_dot_slash = new CIncludePathEntry(new Path(relativePath_dot_slash), ICSettingEntry.LOCAL);
|
||||||
CIncludePathEntry incRelativeEntry_dot_slash = new CIncludePathEntry(new Path(relativePath_dot_slash),
|
|
||||||
ICSettingEntry.LOCAL);
|
|
||||||
|
|
||||||
List<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>();
|
List<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>();
|
||||||
entries.add(incRelativeEntry_dot);
|
entries.add(incRelativeEntry_dot);
|
||||||
|
@ -748,8 +721,7 @@ public class LanguageSettingsScannerInfoProviderTests extends BaseTestCase {
|
||||||
String envPathStr = "${ProjDirPath}/Folder";
|
String envPathStr = "${ProjDirPath}/Folder";
|
||||||
|
|
||||||
// get project/configuration descriptions
|
// get project/configuration descriptions
|
||||||
ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project,
|
ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project, WRITEABLE);
|
||||||
WRITEABLE);
|
|
||||||
assertNotNull(prjDescription);
|
assertNotNull(prjDescription);
|
||||||
ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
|
ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
|
||||||
assertNotNull(cfgDescription);
|
assertNotNull(cfgDescription);
|
||||||
|
@ -796,8 +768,7 @@ public class LanguageSettingsScannerInfoProviderTests extends BaseTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ICLanguageSettingEntry> getSettingEntries(IBuildConfiguration config, IResource rc,
|
public List<ICLanguageSettingEntry> getSettingEntries(ICConfigurationDescription cfgDescription, IResource rc, String languageId) {
|
||||||
String languageId) {
|
|
||||||
if (this.rc.equals(rc))
|
if (this.rc.equals(rc))
|
||||||
return entries;
|
return entries;
|
||||||
return null;
|
return null;
|
||||||
|
@ -806,14 +777,11 @@ public class LanguageSettingsScannerInfoProviderTests extends BaseTestCase {
|
||||||
|
|
||||||
// create a project
|
// create a project
|
||||||
IProject project = ResourceHelper.createCDTProjectWithConfig(getName());
|
IProject project = ResourceHelper.createCDTProjectWithConfig(getName());
|
||||||
ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project,
|
ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project, WRITEABLE);
|
||||||
WRITEABLE);
|
|
||||||
assertNotNull(prjDescription);
|
assertNotNull(prjDescription);
|
||||||
ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
|
ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
|
||||||
assertNotNull(cfgDescription);
|
assertNotNull(cfgDescription);
|
||||||
assertTrue(cfgDescription instanceof ILanguageSettingsProvidersKeeper);
|
assertTrue(cfgDescription instanceof ILanguageSettingsProvidersKeeper);
|
||||||
IBuildConfiguration config = Adapters.adapt(cfgDescription, IBuildConfiguration.class);
|
|
||||||
assertNotNull(config);
|
|
||||||
|
|
||||||
// sample file
|
// sample file
|
||||||
IFolder parentFolder = ResourceHelper.createFolder(project, "ParentFolder");
|
IFolder parentFolder = ResourceHelper.createFolder(project, "ParentFolder");
|
||||||
|
@ -828,8 +796,8 @@ public class LanguageSettingsScannerInfoProviderTests extends BaseTestCase {
|
||||||
|
|
||||||
// add provider for parent folder
|
// add provider for parent folder
|
||||||
ILanguageSettingsProvider provider = new MockProviderForResource(parentFolder, entries);
|
ILanguageSettingsProvider provider = new MockProviderForResource(parentFolder, entries);
|
||||||
assertNull(provider.getSettingEntries(config, file, null));
|
assertNull(provider.getSettingEntries(cfgDescription, file, null));
|
||||||
assertEquals(includePathEntry, provider.getSettingEntries(config, parentFolder, null).get(0));
|
assertEquals(includePathEntry, provider.getSettingEntries(cfgDescription, parentFolder, null).get(0));
|
||||||
|
|
||||||
List<ILanguageSettingsProvider> providers = new ArrayList<ILanguageSettingsProvider>();
|
List<ILanguageSettingsProvider> providers = new ArrayList<ILanguageSettingsProvider>();
|
||||||
providers.add(provider);
|
providers.add(provider);
|
||||||
|
@ -857,8 +825,7 @@ public class LanguageSettingsScannerInfoProviderTests extends BaseTestCase {
|
||||||
String envPathStr = "${ProjDirPath}/Folder";
|
String envPathStr = "${ProjDirPath}/Folder";
|
||||||
|
|
||||||
// get project/configuration descriptions
|
// get project/configuration descriptions
|
||||||
ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project,
|
ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project, WRITEABLE);
|
||||||
WRITEABLE);
|
|
||||||
assertNotNull(prjDescription);
|
assertNotNull(prjDescription);
|
||||||
ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
|
ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
|
||||||
assertNotNull(cfgDescription);
|
assertNotNull(cfgDescription);
|
||||||
|
@ -926,8 +893,7 @@ public class LanguageSettingsScannerInfoProviderTests extends BaseTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ICLanguageSettingEntry> getSettingEntries(IBuildConfiguration config, IResource rc,
|
public List<ICLanguageSettingEntry> getSettingEntries(ICConfigurationDescription cfgDescription, IResource rc, String languageId) {
|
||||||
String languageId) {
|
|
||||||
if (langId==null || langId.equals(languageId))
|
if (langId==null || langId.equals(languageId))
|
||||||
return entries;
|
return entries;
|
||||||
return new ArrayList<ICLanguageSettingEntry>();
|
return new ArrayList<ICLanguageSettingEntry>();
|
||||||
|
@ -943,8 +909,7 @@ public class LanguageSettingsScannerInfoProviderTests extends BaseTestCase {
|
||||||
IFolder incFolderC = ResourceHelper.createFolder(project, "includeC");
|
IFolder incFolderC = ResourceHelper.createFolder(project, "includeC");
|
||||||
|
|
||||||
// get project/configuration descriptions
|
// get project/configuration descriptions
|
||||||
ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project,
|
ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project, WRITEABLE);
|
||||||
WRITEABLE);
|
|
||||||
assertNotNull(prjDescription);
|
assertNotNull(prjDescription);
|
||||||
ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
|
ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
|
||||||
assertNotNull(cfgDescription);
|
assertNotNull(cfgDescription);
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -14,8 +14,8 @@ package org.eclipse.cdt.core.language.settings.providers;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.AbstractExecutableExtensionBase;
|
import org.eclipse.cdt.core.AbstractExecutableExtensionBase;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
||||||
import org.eclipse.core.resources.IBuildConfiguration;
|
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -23,7 +23,7 @@ import org.eclipse.core.resources.IResource;
|
||||||
*/
|
*/
|
||||||
public class MockLanguageSettingsProvider extends AbstractExecutableExtensionBase implements ILanguageSettingsProvider {
|
public class MockLanguageSettingsProvider extends AbstractExecutableExtensionBase implements ILanguageSettingsProvider {
|
||||||
@Override
|
@Override
|
||||||
public List<ICLanguageSettingEntry> getSettingEntries(IBuildConfiguration config, IResource rc, String languageId) {
|
public List<ICLanguageSettingEntry> getSettingEntries(ICConfigurationDescription cfgDescription, IResource rc, String languageId) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,6 @@ import org.eclipse.cdt.core.settings.model.ICStorageElement;
|
||||||
import org.eclipse.cdt.core.settings.model.ICTargetPlatformSetting;
|
import org.eclipse.cdt.core.settings.model.ICTargetPlatformSetting;
|
||||||
import org.eclipse.cdt.core.settings.model.WriteAccessException;
|
import org.eclipse.cdt.core.settings.model.WriteAccessException;
|
||||||
import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
|
import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
|
||||||
import org.eclipse.core.resources.IBuildConfiguration;
|
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
@ -43,8 +42,8 @@ import org.eclipse.core.runtime.QualifiedName;
|
||||||
*/
|
*/
|
||||||
public class CModelMock {
|
public class CModelMock {
|
||||||
/**
|
/**
|
||||||
* Dummy implementation of ICProjectDescription for testing. Feel free to
|
* Dummy implementation of ICProjectDescription for testing.
|
||||||
* override the methods you are interested to mock.
|
* Feel free to override the methods you are interested to mock.
|
||||||
*/
|
*/
|
||||||
public static class DummyCProjectDescription implements ICProjectDescription {
|
public static class DummyCProjectDescription implements ICProjectDescription {
|
||||||
|
|
||||||
|
@ -89,7 +88,8 @@ public class CModelMock {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICStorageElement getStorage(String id, boolean create) throws CoreException {
|
public ICStorageElement getStorage(String id, boolean create)
|
||||||
|
throws CoreException {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,17 +136,20 @@ public class CModelMock {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setActiveConfiguration(ICConfigurationDescription cfg) throws WriteAccessException {
|
public void setActiveConfiguration(ICConfigurationDescription cfg)
|
||||||
|
throws WriteAccessException {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICConfigurationDescription createConfiguration(String id, String name, ICConfigurationDescription base)
|
public ICConfigurationDescription createConfiguration(String id,
|
||||||
|
String name, ICConfigurationDescription base)
|
||||||
throws CoreException, WriteAccessException {
|
throws CoreException, WriteAccessException {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICConfigurationDescription createConfiguration(String buildSystemId, CConfigurationData data)
|
public ICConfigurationDescription createConfiguration(
|
||||||
|
String buildSystemId, CConfigurationData data)
|
||||||
throws CoreException, WriteAccessException {
|
throws CoreException, WriteAccessException {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -162,11 +165,13 @@ public class CModelMock {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeConfiguration(String name) throws WriteAccessException {
|
public void removeConfiguration(String name)
|
||||||
|
throws WriteAccessException {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeConfiguration(ICConfigurationDescription cfg) throws WriteAccessException {
|
public void removeConfiguration(ICConfigurationDescription cfg)
|
||||||
|
throws WriteAccessException {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -195,7 +200,8 @@ public class CModelMock {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setDefaultSettingConfiguration(ICConfigurationDescription cfg) {
|
public void setDefaultSettingConfiguration(
|
||||||
|
ICConfigurationDescription cfg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -210,8 +216,8 @@ public class CModelMock {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dummy implementation of ICConfigurationDescription for testing. Feel free
|
* Dummy implementation of ICConfigurationDescription for testing.
|
||||||
* to override the methods you are interested to mock.
|
* Feel free to override the methods you are interested to mock.
|
||||||
*/
|
*/
|
||||||
public static class DummyCConfigurationDescription implements ICConfigurationDescription {
|
public static class DummyCConfigurationDescription implements ICConfigurationDescription {
|
||||||
private String id;
|
private String id;
|
||||||
|
@ -261,7 +267,8 @@ public class CModelMock {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICStorageElement getStorage(String id, boolean create) throws CoreException {
|
public ICStorageElement getStorage(String id, boolean create)
|
||||||
|
throws CoreException {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -319,23 +326,27 @@ public class CModelMock {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICResourceDescription getResourceDescription(IPath path, boolean exactPath) {
|
public ICResourceDescription getResourceDescription(IPath path,
|
||||||
|
boolean exactPath) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeResourceDescription(ICResourceDescription des) throws CoreException, WriteAccessException {
|
public void removeResourceDescription(ICResourceDescription des)
|
||||||
|
throws CoreException, WriteAccessException {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICFileDescription createFileDescription(IPath path, ICResourceDescription base)
|
public ICFileDescription createFileDescription(IPath path,
|
||||||
throws CoreException, WriteAccessException {
|
ICResourceDescription base) throws CoreException,
|
||||||
|
WriteAccessException {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICFolderDescription createFolderDescription(IPath path, ICFolderDescription base)
|
public ICFolderDescription createFolderDescription(IPath path,
|
||||||
throws CoreException, WriteAccessException {
|
ICFolderDescription base) throws CoreException,
|
||||||
|
WriteAccessException {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -396,8 +407,9 @@ public class CModelMock {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICExternalSetting createExternalSetting(String[] languageIDs, String[] contentTypeIds,
|
public ICExternalSetting createExternalSetting(String[] languageIDs,
|
||||||
String[] extensions, ICSettingEntry[] entries) throws WriteAccessException {
|
String[] contentTypeIds, String[] extensions,
|
||||||
|
ICSettingEntry[] entries) throws WriteAccessException {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -477,37 +489,6 @@ public class CModelMock {
|
||||||
public CConfigurationStatus getConfigurationStatus() {
|
public CConfigurationStatus getConfigurationStatus() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public static class DummyBuildConfiguration implements IBuildConfiguration {
|
|
||||||
private final DummyCConfigurationDescription desc;
|
|
||||||
|
|
||||||
public DummyBuildConfiguration(DummyCConfigurationDescription desc) {
|
|
||||||
this.desc = desc;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public <T> T getAdapter(Class<T> adapter) {
|
|
||||||
if (adapter.isInstance(desc)) {
|
|
||||||
return (T) desc;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IProject getProject() {
|
|
||||||
ICProjectDescription projDesc = desc.getProjectDescription();
|
|
||||||
if (projDesc != null) {
|
|
||||||
return projDesc.getProject();
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return desc.getName();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,4 +78,287 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
|
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
||||||
org.eclipse.jdt.core.compiler.source=1.8
|
org.eclipse.jdt.core.compiler.source=1.8
|
||||||
org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter
|
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
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
|
||||||
|
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_expressions_in_array_initializer=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
|
||||||
|
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
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
|
||||||
|
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_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
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_field=0
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_method=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_package=0
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
|
||||||
|
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.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.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.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.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
|
||||||
|
org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
|
||||||
|
org.eclipse.jdt.core.formatter.compact_else_if=true
|
||||||
|
org.eclipse.jdt.core.formatter.continuation_indentation=2
|
||||||
|
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.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
|
||||||
|
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
|
||||||
|
org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
|
||||||
|
org.eclipse.jdt.core.formatter.indent_empty_lines=false
|
||||||
|
org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
|
||||||
|
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_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
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
|
||||||
|
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_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
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.join_lines_in_comments=true
|
||||||
|
org.eclipse.jdt.core.formatter.join_wrapped_lines=true
|
||||||
|
org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
|
||||||
|
org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
|
||||||
|
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
|
||||||
|
org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
|
||||||
|
org.eclipse.jdt.core.formatter.lineSplit=110
|
||||||
|
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.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_binary_operator=true
|
||||||
|
org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
|
||||||
|
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
|
formatter_profile=_CDT
|
||||||
formatter_settings_version=12
|
formatter_settings_version=12
|
||||||
internal.default.compliance=user
|
internal.default.compliance=user
|
||||||
|
|
|
@ -10,21 +10,32 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.language.settings.providers;
|
package org.eclipse.cdt.core.language.settings.providers;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
||||||
|
import org.eclipse.core.resources.IResource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This interface is to be implemented by providers which want to broadcast the changes in their
|
* This interface is to be implemented by providers which want to broadcast the changes in their setting entries
|
||||||
* setting entries with {@link ILanguageSettingsChangeEvent}.
|
* with {@link ILanguageSettingsChangeEvent}.
|
||||||
*
|
*
|
||||||
* @since 5.4
|
* @since 5.4
|
||||||
*/
|
*/
|
||||||
public interface ILanguageSettingsBroadcastingProvider extends ILanguageSettingsProvider {
|
public interface ILanguageSettingsBroadcastingProvider extends ILanguageSettingsProvider {
|
||||||
|
@Override
|
||||||
|
public String getId();
|
||||||
|
@Override
|
||||||
|
public String getName();
|
||||||
|
@Override
|
||||||
|
public List<ICLanguageSettingEntry> getSettingEntries(ICConfigurationDescription cfgDescription, IResource rc, String languageId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a copy of internal storage. This should be a deep copy/clone of the storage. It is
|
* Return a copy of internal storage. This should be a deep copy/clone of the storage.
|
||||||
* used to calculate the delta and being kept in the last state object of configuration
|
* It is used to calculate the delta and being kept in the last state object of configuration
|
||||||
* description to compare to a new state later.
|
* description to compare to a new state later.
|
||||||
*
|
*
|
||||||
* @return a copy of internal storage.
|
* @return a copy of internal storage.
|
||||||
*/
|
*/
|
||||||
public LanguageSettingsStorage copyStorage();
|
public LanguageSettingsStorage copyStorage();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,67 +14,42 @@ import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
||||||
import org.eclipse.core.resources.IBuildConfiguration;
|
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This interface is used in UI to identify classes allowing user to modify settings externally
|
* This interface is used in UI to identify classes allowing user to modify settings externally
|
||||||
* contrary to some subclasses of {@link LanguageSettingsSerializableProvider} managing their
|
* contrary to some subclasses of {@link LanguageSettingsSerializableProvider} managing
|
||||||
* settings themselves and not providing such option to the user.
|
* their settings themselves and not providing such option to the user.
|
||||||
*
|
*
|
||||||
* @since 5.4
|
* @since 5.4
|
||||||
*/
|
*/
|
||||||
public interface ILanguageSettingsEditableProvider extends ILanguageSettingsBroadcastingProvider, Cloneable {
|
public interface ILanguageSettingsEditableProvider extends ILanguageSettingsBroadcastingProvider, Cloneable {
|
||||||
|
@Override
|
||||||
|
public String getId();
|
||||||
|
@Override
|
||||||
|
public String getName();
|
||||||
|
@Override
|
||||||
|
public List<ICLanguageSettingEntry> getSettingEntries(ICConfigurationDescription cfgDescription, IResource rc, String languageId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets language settings entries for the provider.
|
* Sets language settings entries for the provider.
|
||||||
*
|
*
|
||||||
* @param config
|
* @param cfgDescription - configuration description.
|
||||||
* configuration.
|
* @param rc - resource such as file or folder. If {@code null} the entries are
|
||||||
* @param rc
|
* considered to be being defined as default entries for resources.
|
||||||
* resource such as file or folder. If {@code null} the entries are considered to be
|
* @param languageId - language id. If {@code null}, then entries are considered
|
||||||
* being defined as default entries for resources.
|
* to be defined as default entries for languages.
|
||||||
* @param languageId
|
* @param entries - language settings entries to set.
|
||||||
* language id. If {@code null}, then entries are considered to be defined as default
|
|
||||||
* entries for languages.
|
|
||||||
* @param entries
|
|
||||||
* language settings entries to set.
|
|
||||||
* @since 6.0
|
|
||||||
*/
|
*/
|
||||||
default public void setSettingEntries(IBuildConfiguration config, IResource rc, String languageId,
|
public void setSettingEntries(ICConfigurationDescription cfgDescription, IResource rc, String languageId,
|
||||||
List<? extends ICLanguageSettingEntry> entries) {
|
List<? extends ICLanguageSettingEntry> entries);
|
||||||
// Call the old method by default
|
|
||||||
setSettingEntries(config.getAdapter(ICConfigurationDescription.class), rc, languageId, entries);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets language settings entries for the provider.
|
* Shallow clone of the provider. "Shallow" is defined here as the exact copy except that
|
||||||
*
|
* the copy will have zero language settings entries.
|
||||||
* @param cfgDescription
|
|
||||||
* configuration description.
|
|
||||||
* @param rc
|
|
||||||
* resource such as file or folder. If {@code null} the entries are considered to be
|
|
||||||
* being defined as default entries for resources.
|
|
||||||
* @param languageId
|
|
||||||
* language id. If {@code null}, then entries are considered to be defined as default
|
|
||||||
* entries for languages.
|
|
||||||
* @param entries
|
|
||||||
* language settings entries to set.
|
|
||||||
* @deprecated use {@link #getSettingEntries(IBuildConfiguration, IResource, String)}
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
default public void setSettingEntries(ICConfigurationDescription cfgDescription, IResource rc, String languageId,
|
|
||||||
List<? extends ICLanguageSettingEntry> entries) {
|
|
||||||
// Do nothing by default
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Shallow clone of the provider. "Shallow" is defined here as the exact copy except that the
|
|
||||||
* copy will have zero language settings entries.
|
|
||||||
*
|
*
|
||||||
* @return shallow copy of the provider.
|
* @return shallow copy of the provider.
|
||||||
* @throws CloneNotSupportedException
|
* @throws CloneNotSupportedException in case {@link #clone()} throws the exception.
|
||||||
* in case {@link #clone()} throws the exception.
|
|
||||||
*/
|
*/
|
||||||
public ILanguageSettingsEditableProvider cloneShallow() throws CloneNotSupportedException;
|
public ILanguageSettingsEditableProvider cloneShallow() throws CloneNotSupportedException;
|
||||||
|
|
||||||
|
@ -82,5 +57,4 @@ public interface ILanguageSettingsEditableProvider extends ILanguageSettingsBroa
|
||||||
* @see Object#clone()
|
* @see Object#clone()
|
||||||
*/
|
*/
|
||||||
public ILanguageSettingsEditableProvider clone() throws CloneNotSupportedException;
|
public ILanguageSettingsEditableProvider clone() throws CloneNotSupportedException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,36 +17,35 @@ import org.eclipse.cdt.core.model.LanguageManager;
|
||||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
||||||
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
||||||
import org.eclipse.core.resources.IBuildConfiguration;
|
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base interface to provide list of {@link ICLanguageSettingEntry}. This interface is used to
|
* Base interface to provide list of {@link ICLanguageSettingEntry}.
|
||||||
* deliver additions to compiler options such as include paths (-I) or preprocessor defines (-D) and
|
* This interface is used to deliver additions to compiler options such as
|
||||||
* others (see {@link ICSettingEntry#INCLUDE_PATH} and other kinds). <br>
|
* include paths (-I) or preprocessor defines (-D) and others (see
|
||||||
* <br>
|
* {@link ICSettingEntry#INCLUDE_PATH} and other kinds).
|
||||||
|
* <br><br>
|
||||||
* To define a provider like that use extension point
|
* To define a provider like that use extension point
|
||||||
* {@code org.eclipse.cdt.core.LanguageSettingsProvider} and implement this interface. The
|
* {@code org.eclipse.cdt.core.LanguageSettingsProvider} and implement this
|
||||||
* recommended way of implementing is to extend {@link LanguageSettingsSerializableProvider} and
|
* interface. The recommended way of implementing is to extend
|
||||||
* implement {@link ILanguageSettingsEditableProvider}. That will give the ability to persist and
|
* {@link LanguageSettingsSerializableProvider} and implement {@link ILanguageSettingsEditableProvider}.
|
||||||
* edit/clean entries by user in UI. The clone methods defined by
|
* That will give the ability to persist and edit/clean entries by user in UI.
|
||||||
* {@link ILanguageSettingsEditableProvider} should be chained as done for example by
|
* The clone methods defined by {@link ILanguageSettingsEditableProvider} should be
|
||||||
* {@link LanguageSettingsGenericProvider}. <br>
|
* chained as done for example by {@link LanguageSettingsGenericProvider}.
|
||||||
* <br>
|
* <br><br>
|
||||||
* CDT provides a few general use implementations in the core such as
|
* CDT provides a few general use implementations in the core such as {@link LanguageSettingsBaseProvider}
|
||||||
* {@link LanguageSettingsBaseProvider} or {@link LanguageSettingsSerializableProvider} or
|
* or {@link LanguageSettingsSerializableProvider} or {@link LanguageSettingsGenericProvider}
|
||||||
* {@link LanguageSettingsGenericProvider} which could be used out of the box or built upon. There
|
* which could be used out of the box or built upon. There are also abstract classes in build
|
||||||
* are also abstract classes in build plugins {@code AbstractBuildCommandParser} and
|
* plugins {@code AbstractBuildCommandParser} and {@code AbstractBuiltinSpecsDetector} which
|
||||||
* {@code AbstractBuiltinSpecsDetector} which serve as a base for output parsers and built-in
|
* serve as a base for output parsers and built-in compiler language settings detectors.
|
||||||
* compiler language settings detectors. See also extension point schema description
|
* See also extension point schema description LanguageSettingsProvider.exsd.
|
||||||
* LanguageSettingsProvider.exsd.
|
|
||||||
*
|
*
|
||||||
* @since 5.4
|
* @since 5.4
|
||||||
*/
|
*/
|
||||||
public interface ILanguageSettingsProvider {
|
public interface ILanguageSettingsProvider {
|
||||||
/**
|
/**
|
||||||
* Id is used to keep track of the providers internally. Use unique id to represent the
|
* Id is used to keep track of the providers internally. Use unique id
|
||||||
* provider.
|
* to represent the provider.
|
||||||
*
|
*
|
||||||
* @return Id of the provider.
|
* @return Id of the provider.
|
||||||
*/
|
*/
|
||||||
|
@ -60,72 +59,28 @@ public interface ILanguageSettingsProvider {
|
||||||
public String getName();
|
public String getName();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the list of setting entries for the given configuration description, resource and
|
* Returns the list of setting entries for the given configuration description,
|
||||||
* language. <br>
|
* resource and language.
|
||||||
* <br>
|
* <br><br>
|
||||||
* Note to implementers - this method should not be used to do any long running operations such
|
* Note to implementers - this method should not be used to do any long running
|
||||||
* as extensive calculations or reading files. If you need to do so, the recommended way is to
|
* operations such as extensive calculations or reading files. If you need to do
|
||||||
* do the calculations outside of this function call - in advance and on appropriate event. For
|
* so, the recommended way is to do the calculations outside of
|
||||||
* example, Build Output Parser prepares the list and stores it in internal cache while parsing
|
* this function call - in advance and on appropriate event. For example, Build
|
||||||
* output. {@link #getSettingEntries(IBuildConfiguration, IResource, String)} will return cached
|
* Output Parser prepares the list and stores it in internal cache while parsing output.
|
||||||
* entries when asked. You can also implement {@link ICListenerAgent} interface to get
|
* {@link #getSettingEntries(ICConfigurationDescription, IResource, String)} will
|
||||||
* registered and listen to arbitrary events.
|
* return cached entries when asked. You can also implement {@link ICListenerAgent}
|
||||||
|
* interface to get registered and listen to arbitrary events.
|
||||||
*
|
*
|
||||||
* @param config
|
* @param cfgDescription - configuration description.
|
||||||
* - configuration.
|
* @param rc - resource such as file or folder.
|
||||||
* @param rc
|
* If {@code null}, the default entries for all resources are returned.
|
||||||
* - resource such as file or folder. If {@code null}, the default entries for all
|
* @param languageId - language id.
|
||||||
* resources are returned.
|
* If {@code null}, the default entries for all languages are returned.
|
||||||
* @param languageId
|
* (see {@link LanguageManager#getLanguageForFile(org.eclipse.core.resources.IFile, ICConfigurationDescription)}).
|
||||||
* - language id. If {@code null}, the default entries for all languages are
|
|
||||||
* returned. (see
|
|
||||||
* {@link LanguageManager#getLanguageForFile(org.eclipse.core.resources.IFile, ICConfigurationDescription)}
|
|
||||||
* ).
|
|
||||||
*
|
*
|
||||||
* @return the list of setting entries or {@code null} if no settings defined. The list needs to
|
* @return the list of setting entries or {@code null} if no settings defined.
|
||||||
* be a pooled list created by {@link LanguageSettingsStorage#getPooledList(List)} to
|
* The list needs to be a pooled list created by {@link LanguageSettingsStorage#getPooledList(List)}
|
||||||
* save memory and avoid deep equality comparisons.
|
* to save memory and avoid deep equality comparisons.
|
||||||
* @since 6.0
|
|
||||||
*/
|
*/
|
||||||
default public List<ICLanguageSettingEntry> getSettingEntries(IBuildConfiguration config, IResource rc,
|
public List<ICLanguageSettingEntry> getSettingEntries(ICConfigurationDescription cfgDescription, IResource rc, String languageId);
|
||||||
String languageId) {
|
|
||||||
// call the old one by default
|
|
||||||
return getSettingEntries(config.getAdapter(ICConfigurationDescription.class), rc, languageId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the list of setting entries for the given configuration description, resource and
|
|
||||||
* language. <br>
|
|
||||||
* <br>
|
|
||||||
* Note to implementers - this method should not be used to do any long running operations such
|
|
||||||
* as extensive calculations or reading files. If you need to do so, the recommended way is to
|
|
||||||
* do the calculations outside of this function call - in advance and on appropriate event. For
|
|
||||||
* example, Build Output Parser prepares the list and stores it in internal cache while parsing
|
|
||||||
* output. {@link #getSettingEntries(IBuildConfiguration, IResource, String)} will return cached
|
|
||||||
* entries when asked. You can also implement {@link ICListenerAgent} interface to get
|
|
||||||
* registered and listen to arbitrary events.
|
|
||||||
*
|
|
||||||
* @param cfgDescription
|
|
||||||
* - configuration description.
|
|
||||||
* @param rc
|
|
||||||
* - resource such as file or folder. If {@code null}, the default entries for all
|
|
||||||
* resources are returned.
|
|
||||||
* @param languageId
|
|
||||||
* - language id. If {@code null}, the default entries for all languages are
|
|
||||||
* returned. (see
|
|
||||||
* {@link LanguageManager#getLanguageForFile(org.eclipse.core.resources.IFile, ICConfigurationDescription)}
|
|
||||||
* ).
|
|
||||||
*
|
|
||||||
* @return the list of setting entries or {@code null} if no settings defined. The list needs to
|
|
||||||
* be a pooled list created by {@link LanguageSettingsStorage#getPooledList(List)} to
|
|
||||||
* save memory and avoid deep equality comparisons.
|
|
||||||
* @deprecated use {@link #getSettingEntries(IBuildConfiguration, IResource, String)}
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
default public List<ICLanguageSettingEntry> getSettingEntries(ICConfigurationDescription cfgDescription,
|
|
||||||
IResource rc, String languageId) {
|
|
||||||
// return null by default
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,24 +23,19 @@ import org.eclipse.cdt.core.AbstractExecutableExtensionBase;
|
||||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
||||||
import org.eclipse.cdt.internal.core.settings.model.SettingsModelMessages;
|
import org.eclipse.cdt.internal.core.settings.model.SettingsModelMessages;
|
||||||
import org.eclipse.core.resources.IBuildConfiguration;
|
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@code LanguageSettingsBaseProvider} is a basic implementation of
|
* {@code LanguageSettingsBaseProvider} is a basic implementation of {@link ILanguageSettingsProvider}
|
||||||
* {@link ILanguageSettingsProvider} for the extensions defined by
|
* for the extensions defined by {@code org.eclipse.cdt.core.LanguageSettingsProvider} extension point.
|
||||||
* {@code org.eclipse.cdt.core.LanguageSettingsProvider} extension point.
|
|
||||||
*
|
*
|
||||||
* This implementation supports "static" list of entries for languages specified in the extension
|
* This implementation supports "static" list of entries for languages specified in
|
||||||
* point.
|
* the extension point.
|
||||||
*
|
*
|
||||||
* @since 5.4
|
* @since 5.4
|
||||||
*/
|
*/
|
||||||
public class LanguageSettingsBaseProvider extends AbstractExecutableExtensionBase
|
public class LanguageSettingsBaseProvider extends AbstractExecutableExtensionBase implements ILanguageSettingsProvider {
|
||||||
implements ILanguageSettingsProvider {
|
/** Language scope, i.e. list of languages the entries will be provided for. */
|
||||||
/**
|
|
||||||
* Language scope, i.e. list of languages the entries will be provided for.
|
|
||||||
*/
|
|
||||||
protected List<String> languageScope = null;
|
protected List<String> languageScope = null;
|
||||||
|
|
||||||
/** Provider-specific properties */
|
/** Provider-specific properties */
|
||||||
|
@ -59,10 +54,8 @@ public class LanguageSettingsBaseProvider extends AbstractExecutableExtensionBas
|
||||||
/**
|
/**
|
||||||
* Constructor. Creates an "empty" non-configured provider.
|
* Constructor. Creates an "empty" non-configured provider.
|
||||||
*
|
*
|
||||||
* @param id
|
* @param id - id of the provider.
|
||||||
* - id of the provider.
|
* @param name - name of the provider to be presented to a user.
|
||||||
* @param name
|
|
||||||
* - name of the provider to be presented to a user.
|
|
||||||
*/
|
*/
|
||||||
public LanguageSettingsBaseProvider(String id, String name) {
|
public LanguageSettingsBaseProvider(String id, String name) {
|
||||||
super(id, name);
|
super(id, name);
|
||||||
|
@ -71,16 +64,13 @@ public class LanguageSettingsBaseProvider extends AbstractExecutableExtensionBas
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
* @param id
|
* @param id - id of the provider.
|
||||||
* - id of the provider.
|
* @param name - name of the provider to be presented to a user.
|
||||||
* @param name
|
* @param languages - list of languages the {@code entries} provided for.
|
||||||
* - name of the provider to be presented to a user.
|
* {@code languages} can be {@code null}, in this case the {@code entries}
|
||||||
* @param languages
|
* are provided for any language.
|
||||||
* - list of languages the {@code entries} provided for. {@code languages} can be
|
* @param entries - the list of language settings entries this provider provides.
|
||||||
* {@code null}, in this case the {@code entries} are provided for any language.
|
* If {@code null} is passed, the provider creates an empty list.
|
||||||
* @param entries
|
|
||||||
* - the list of language settings entries this provider provides. If {@code null} is
|
|
||||||
* passed, the provider creates an empty list.
|
|
||||||
*/
|
*/
|
||||||
public LanguageSettingsBaseProvider(String id, String name, List<String> languages,
|
public LanguageSettingsBaseProvider(String id, String name, List<String> languages,
|
||||||
List<ICLanguageSettingEntry> entries) {
|
List<ICLanguageSettingEntry> entries) {
|
||||||
|
@ -92,18 +82,14 @@ public class LanguageSettingsBaseProvider extends AbstractExecutableExtensionBas
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
* @param id
|
* @param id - id of the provider.
|
||||||
* - id of the provider.
|
* @param name - name of the provider to be presented to a user.
|
||||||
* @param name
|
* @param languages - list of languages the {@code entries} provided for.
|
||||||
* - name of the provider to be presented to a user.
|
* {@code languages} can be {@code null}, in this case the {@code entries}
|
||||||
* @param languages
|
* are provided for any language.
|
||||||
* - list of languages the {@code entries} provided for. {@code languages} can be
|
* @param entries - the list of language settings entries this provider provides.
|
||||||
* {@code null}, in this case the {@code entries} are provided for any language.
|
* If {@code null} is passed, the provider creates an empty list.
|
||||||
* @param entries
|
* @param properties - custom properties as the means to customize providers.
|
||||||
* - the list of language settings entries this provider provides. If {@code null} is
|
|
||||||
* passed, the provider creates an empty list.
|
|
||||||
* @param properties
|
|
||||||
* - custom properties as the means to customize providers.
|
|
||||||
*/
|
*/
|
||||||
public LanguageSettingsBaseProvider(String id, String name, List<String> languages,
|
public LanguageSettingsBaseProvider(String id, String name, List<String> languages,
|
||||||
List<ICLanguageSettingEntry> entries, Map<String, String> properties) {
|
List<ICLanguageSettingEntry> entries, Map<String, String> properties) {
|
||||||
|
@ -115,33 +101,28 @@ public class LanguageSettingsBaseProvider extends AbstractExecutableExtensionBas
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A method to configure the provider. The initialization of provider from the extension point
|
* A method to configure the provider. The initialization of provider from
|
||||||
* is done in 2 steps. First, the class is created as an executable extension using the default
|
* the extension point is done in 2 steps. First, the class is created as
|
||||||
* provider. Then this method is used to configure the provider. <br>
|
* an executable extension using the default provider. Then this method is
|
||||||
* <br>
|
* used to configure the provider.
|
||||||
|
*<br><br>
|
||||||
* It is not allowed to reconfigure the provider.
|
* It is not allowed to reconfigure the provider.
|
||||||
*
|
*
|
||||||
* @param id
|
* @param id - id of the provider.
|
||||||
* - id of the provider.
|
* @param name - name of the provider to be presented to a user.
|
||||||
* @param name
|
* @param languages - list of languages the {@code entries} provided for.
|
||||||
* - name of the provider to be presented to a user.
|
* {@code languages} can be {@code null}, in this case the {@code entries}
|
||||||
* @param languages
|
* are provided for any language.
|
||||||
* - list of languages the {@code entries} provided for. {@code languages} can be
|
* @param entries - the list of language settings entries this provider provides.
|
||||||
* {@code null}, in this case the {@code entries} are provided for any language.
|
* If {@code null} is passed, the provider creates an empty list.
|
||||||
* @param entries
|
* @param properties - custom properties as the means to customize providers.
|
||||||
* - the list of language settings entries this provider provides. If {@code null} is
|
|
||||||
* passed, the provider creates an empty list.
|
|
||||||
* @param properties
|
|
||||||
* - custom properties as the means to customize providers.
|
|
||||||
*
|
*
|
||||||
* @throws UnsupportedOperationException
|
* @throws UnsupportedOperationException if an attempt to reconfigure provider is made.
|
||||||
* if an attempt to reconfigure provider is made.
|
|
||||||
*/
|
*/
|
||||||
public void configureProvider(String id, String name, List<String> languages,
|
public void configureProvider(String id, String name, List<String> languages,
|
||||||
List<ICLanguageSettingEntry> entries, Map<String, String> properties) {
|
List<ICLanguageSettingEntry> entries, Map<String, String> properties) {
|
||||||
if (this.entries!=null || !this.properties.isEmpty())
|
if (this.entries!=null || !this.properties.isEmpty())
|
||||||
throw new UnsupportedOperationException(
|
throw new UnsupportedOperationException(SettingsModelMessages.getString("LanguageSettingsBaseProvider.CanBeConfiguredOnlyOnce")); //$NON-NLS-1$
|
||||||
SettingsModelMessages.getString("LanguageSettingsBaseProvider.CanBeConfiguredOnlyOnce")); //$NON-NLS-1$
|
|
||||||
|
|
||||||
setId(id);
|
setId(id);
|
||||||
setName(name);
|
setName(name);
|
||||||
|
@ -152,16 +133,16 @@ public class LanguageSettingsBaseProvider extends AbstractExecutableExtensionBas
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@code LanguageSettingsBaseProvider} keeps the list of key-value pairs so extenders of this
|
* {@code LanguageSettingsBaseProvider} keeps the list of key-value pairs
|
||||||
* class can customize the provider. The properties of {@code LanguageSettingsBaseProvider} come
|
* so extenders of this class can customize the provider. The properties
|
||||||
* from the extension in plugin.xml although the extenders can provide their own method. <br>
|
* of {@code LanguageSettingsBaseProvider} come from the extension in plugin.xml
|
||||||
* <br>
|
* although the extenders can provide their own method.
|
||||||
* Please note that empty string value is treated as "default" value and the same as
|
* <br><br>
|
||||||
* {@code null} and the same as missing property, which allows {@link #equals(Object)} evaluate
|
* Please note that empty string value is treated as "default" value and
|
||||||
* the property as equal while comparing providers.
|
* the same as {@code null} and the same as missing property, which allows
|
||||||
|
* {@link #equals(Object)} evaluate the property as equal while comparing providers.
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key - property to check the value.
|
||||||
* - property to check the value.
|
|
||||||
* @return value of the property. If the property is missing returns empty string.
|
* @return value of the property. If the property is missing returns empty string.
|
||||||
*/
|
*/
|
||||||
public String getProperty(String key) {
|
public String getProperty(String key) {
|
||||||
|
@ -174,13 +155,11 @@ public class LanguageSettingsBaseProvider extends AbstractExecutableExtensionBas
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convenience method to get boolean property.
|
* Convenience method to get boolean property.
|
||||||
*
|
|
||||||
* @see #getProperty(String)
|
* @see #getProperty(String)
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key - property to check the value.
|
||||||
* - property to check the value.
|
* @return boolean value of the property. If the property is missing or cannot be
|
||||||
* @return boolean value of the property. If the property is missing or cannot be interpreted as
|
* interpreted as boolean returns {@code false}.
|
||||||
* boolean returns {@code false}.
|
|
||||||
*/
|
*/
|
||||||
public boolean getPropertyBool(String key) {
|
public boolean getPropertyBool(String key) {
|
||||||
return Boolean.parseBoolean(properties.get(key));
|
return Boolean.parseBoolean(properties.get(key));
|
||||||
|
@ -196,43 +175,30 @@ public class LanguageSettingsBaseProvider extends AbstractExecutableExtensionBas
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*
|
*
|
||||||
* @param languageId
|
* @param languageId - language id. If {@code null}, then entries defined for
|
||||||
* - language id. If {@code null}, then entries defined for the language scope are
|
* the language scope are returned. See {@link #getLanguageScope()}
|
||||||
* returned. See {@link #getLanguageScope()}
|
|
||||||
*
|
*
|
||||||
* @return unmodifiable list of setting entries or {@code null} if no settings defined. the list
|
* @return unmodifiable list of setting entries or {@code null} if no settings defined.
|
||||||
* is internally pooled and guaranteed to be the same object for equal lists.
|
* the list is internally pooled and guaranteed to be the same object for equal
|
||||||
* @since 6.0
|
* lists.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<ICLanguageSettingEntry> getSettingEntries(IBuildConfiguration config, IResource rc, String languageId) {
|
public List<ICLanguageSettingEntry> getSettingEntries(ICConfigurationDescription cfgDescription,
|
||||||
// For backwards compatibility
|
IResource rc, String languageId) {
|
||||||
if (config != null) {
|
|
||||||
ICConfigurationDescription cfgDesc = config.getAdapter(ICConfigurationDescription.class);
|
|
||||||
if (cfgDesc != null) {
|
|
||||||
List<ICLanguageSettingEntry> entriesOld = getSettingEntries(cfgDesc, rc, languageId);
|
|
||||||
if (entriesOld != null) {
|
|
||||||
return entriesOld;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (languageScope == null) {
|
if (languageScope == null) {
|
||||||
return entries;
|
return entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String lang : languageScope) {
|
for (String lang : languageScope) {
|
||||||
if (lang.equals(languageId)) {
|
if (lang.equals(languageId)) {
|
||||||
return entries;
|
return entries;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the unmodifiable list of languages this provider provides for. If {@code null}, the
|
* @return the unmodifiable list of languages this provider provides for.
|
||||||
* provider provides for any language.
|
* If {@code null}, the provider provides for any language.
|
||||||
*/
|
*/
|
||||||
public List<String> getLanguageScope() {
|
public List<String> getLanguageScope() {
|
||||||
if (languageScope==null)
|
if (languageScope==null)
|
||||||
|
@ -301,8 +267,7 @@ public class LanguageSettingsBaseProvider extends AbstractExecutableExtensionBas
|
||||||
} else if (other.properties == null) {
|
} else if (other.properties == null) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
// The trouble to ensure default properties are equal to missing
|
// The trouble to ensure default properties are equal to missing ones.
|
||||||
// ones.
|
|
||||||
Set<String> keys = new HashSet<String>(properties.keySet());
|
Set<String> keys = new HashSet<String>(properties.keySet());
|
||||||
keys.addAll(other.properties.keySet());
|
keys.addAll(other.properties.keySet());
|
||||||
for (String key : keys) {
|
for (String key : keys) {
|
||||||
|
|
|
@ -28,90 +28,78 @@ import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
||||||
import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsExtensionManager;
|
import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsExtensionManager;
|
||||||
import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsProvidersSerializer;
|
import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsProvidersSerializer;
|
||||||
import org.eclipse.core.resources.IBuildConfiguration;
|
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A collection of utility methods to manage language settings providers. See
|
* A collection of utility methods to manage language settings providers.
|
||||||
* {@link ILanguageSettingsProvider}.
|
* See {@link ILanguageSettingsProvider}.
|
||||||
*
|
*
|
||||||
* @since 5.4
|
* @since 5.4
|
||||||
*/
|
*/
|
||||||
public class LanguageSettingsManager {
|
public class LanguageSettingsManager {
|
||||||
/**
|
/**
|
||||||
* Returns the list of setting entries of a certain kind (such as include paths) for the given
|
* Returns the list of setting entries of a certain kind (such as include paths)
|
||||||
* configuration description, resource and language. This is a combined list for all providers
|
* for the given configuration description, resource and language. This is a
|
||||||
* taking into account settings of parent folder if settings for the given resource are not
|
* combined list for all providers taking into account settings of parent folder
|
||||||
* defined. For include paths both local (#include "...") and system (#include <...>) entries
|
* if settings for the given resource are not defined. For include paths both
|
||||||
* are returned.
|
* local (#include "...") and system (#include <...>) entries are returned.
|
||||||
*
|
*
|
||||||
* @param config
|
* @param cfgDescription - configuration description.
|
||||||
* - configuration.
|
* @param rc - resource such as file or folder.
|
||||||
* @param rc
|
* @param languageId - language id.
|
||||||
* - resource such as file or folder.
|
* @param kind - kind of language settings entries, such as
|
||||||
* @param languageId
|
* {@link ICSettingEntry#INCLUDE_PATH} etc. This is a binary flag
|
||||||
* - language id.
|
* and it is possible to specify composite kind.
|
||||||
* @param kind
|
* Use {@link ICSettingEntry#ALL} to get all kinds.
|
||||||
* - kind of language settings entries, such as {@link ICSettingEntry#INCLUDE_PATH}
|
|
||||||
* etc. This is a binary flag and it is possible to specify composite kind. Use
|
|
||||||
* {@link ICSettingEntry#ALL} to get all kinds.
|
|
||||||
*
|
*
|
||||||
* @return the list of setting entries.
|
* @return the list of setting entries.
|
||||||
*
|
*
|
||||||
* @since 6.0
|
* @since 5.5
|
||||||
*/
|
*/
|
||||||
public static List<ICLanguageSettingEntry> getSettingEntriesByKind(IBuildConfiguration config,
|
public static List<ICLanguageSettingEntry> getSettingEntriesByKind(ICConfigurationDescription cfgDescription, IResource rc, String languageId, int kind) {
|
||||||
IResource rc, String languageId, int kind) {
|
return LanguageSettingsProvidersSerializer.getSettingEntriesByKind(cfgDescription, rc, languageId, kind);
|
||||||
return LanguageSettingsProvidersSerializer.getSettingEntriesByKind(config, rc, languageId, kind);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the list of setting entries of the given provider for the given configuration
|
* Returns the list of setting entries of the given provider
|
||||||
* description, resource and language. This method reaches to the parent folder of the resource
|
* for the given configuration description, resource and language.
|
||||||
* recursively if the resource does not define the entries for the given provider.
|
* This method reaches to the parent folder of the resource recursively
|
||||||
|
* if the resource does not define the entries for the given provider.
|
||||||
*
|
*
|
||||||
* @param provider
|
* @param provider - language settings provider.
|
||||||
* - language settings provider.
|
* @param cfgDescription - configuration description.
|
||||||
* @param config
|
* @param rc - resource such as file or folder.
|
||||||
* - configuration.
|
* @param languageId - language id.
|
||||||
* @param rc
|
|
||||||
* - resource such as file or folder.
|
|
||||||
* @param languageId
|
|
||||||
* - language id.
|
|
||||||
*
|
*
|
||||||
* @return the list of setting entries. Never returns {@code null} although individual providers
|
* @return the list of setting entries. Never returns {@code null}
|
||||||
* return {@code null} if no settings defined.
|
* although individual providers return {@code null} if no settings defined.
|
||||||
* @since 6.0
|
|
||||||
*/
|
*/
|
||||||
public static List<ICLanguageSettingEntry> getSettingEntriesUpResourceTree(
|
public static List<ICLanguageSettingEntry> getSettingEntriesUpResourceTree(ILanguageSettingsProvider provider, ICConfigurationDescription cfgDescription, IResource rc, String languageId) {
|
||||||
ILanguageSettingsProvider provider, IBuildConfiguration config, IResource rc, String languageId) {
|
return LanguageSettingsProvidersSerializer.getSettingEntriesUpResourceTree(provider, cfgDescription, rc, languageId);
|
||||||
return LanguageSettingsProvidersSerializer.getSettingEntriesUpResourceTree(provider, config, rc,
|
|
||||||
languageId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Language Settings Provider from the list of workspace providers, see
|
* Get Language Settings Provider from the list of workspace providers,
|
||||||
* {@link #getWorkspaceProviders()}.
|
* see {@link #getWorkspaceProviders()}.
|
||||||
*
|
*
|
||||||
* @param id
|
* @param id - id of provider to find.
|
||||||
* - id of provider to find.
|
* @return the workspace provider. If workspace provider is not defined
|
||||||
* @return the workspace provider. If workspace provider is not defined a new instance is
|
* a new instance is created and returned.
|
||||||
* created and returned.
|
|
||||||
*/
|
*/
|
||||||
public static ILanguageSettingsProvider getWorkspaceProvider(String id) {
|
public static ILanguageSettingsProvider getWorkspaceProvider(String id) {
|
||||||
return LanguageSettingsProvidersSerializer.getWorkspaceProvider(id);
|
return LanguageSettingsProvidersSerializer.getWorkspaceProvider(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Language Settings Providers defined in the workspace. That includes user-defined
|
* Get Language Settings Providers defined in the workspace. That includes
|
||||||
* providers and after that providers defined as extensions via
|
* user-defined providers and after that providers defined as extensions via
|
||||||
* {@code org.eclipse.cdt.core.LanguageSettingsProvider} extension point. Note that this returns
|
* {@code org.eclipse.cdt.core.LanguageSettingsProvider} extension point.
|
||||||
* wrappers around workspace provider so underlying provider could be replaced internally
|
* Note that this returns wrappers around workspace provider so underlying
|
||||||
* without need to change configuration. See also
|
* provider could be replaced internally without need to change configuration.
|
||||||
* {@link #getRawProvider(ILanguageSettingsProvider)}.
|
* See also {@link #getRawProvider(ILanguageSettingsProvider)}.
|
||||||
*
|
*
|
||||||
* @return list of workspace providers.
|
* @return list of workspace providers.
|
||||||
*/
|
*/
|
||||||
|
@ -120,12 +108,12 @@ public class LanguageSettingsManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the provider is a workspace level provider. This method is intended to check
|
* Checks if the provider is a workspace level provider.
|
||||||
* providers retrieved from a configuration. Raw providers from
|
* This method is intended to check providers retrieved from a configuration.
|
||||||
* {@link #getRawProvider(ILanguageSettingsProvider)} are not considered as workspace providers.
|
* Raw providers from {@link #getRawProvider(ILanguageSettingsProvider)}
|
||||||
|
* are not considered as workspace providers.
|
||||||
*
|
*
|
||||||
* @param provider
|
* @param provider - provider to check.
|
||||||
* - provider to check.
|
|
||||||
* @return {@code true} if the given provider is workspace provider, {@code false} otherwise.
|
* @return {@code true} if the given provider is workspace provider, {@code false} otherwise.
|
||||||
*/
|
*/
|
||||||
public static boolean isWorkspaceProvider(ILanguageSettingsProvider provider) {
|
public static boolean isWorkspaceProvider(ILanguageSettingsProvider provider) {
|
||||||
|
@ -135,14 +123,11 @@ public class LanguageSettingsManager {
|
||||||
/**
|
/**
|
||||||
* Helper method to get to real underlying provider collecting entries as opposed to wrapper
|
* Helper method to get to real underlying provider collecting entries as opposed to wrapper
|
||||||
* which is normally used for workspace provider.
|
* which is normally used for workspace provider.
|
||||||
*
|
|
||||||
* @see LanguageSettingsProvidersSerializer#isWorkspaceProvider(ILanguageSettingsProvider)
|
* @see LanguageSettingsProvidersSerializer#isWorkspaceProvider(ILanguageSettingsProvider)
|
||||||
*
|
*
|
||||||
* @param provider
|
* @param provider - the provider to get raw provider for. Can be either workspace provider
|
||||||
* - the provider to get raw provider for. Can be either workspace provider or
|
* or regular one.
|
||||||
* regular one.
|
* @return raw underlying provider for workspace provider or provider itself if no wrapper is used.
|
||||||
* @return raw underlying provider for workspace provider or provider itself if no wrapper is
|
|
||||||
* used.
|
|
||||||
*/
|
*/
|
||||||
public static ILanguageSettingsProvider getRawProvider(ILanguageSettingsProvider provider) {
|
public static ILanguageSettingsProvider getRawProvider(ILanguageSettingsProvider provider) {
|
||||||
if (isWorkspaceProvider(provider)) {
|
if (isWorkspaceProvider(provider)) {
|
||||||
|
@ -151,42 +136,38 @@ public class LanguageSettingsManager {
|
||||||
return provider;
|
return provider;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set and store in workspace area user defined providers.
|
* Set and store in workspace area user defined providers.
|
||||||
*
|
*
|
||||||
* @param providers
|
* @param providers - array of user defined workspace providers.
|
||||||
* - array of user defined workspace providers. Note that those providers will shadow
|
* Note that those providers will shadow extension providers with the same ID.
|
||||||
* extension providers with the same ID. All not shadowed extension providers will be
|
* All not shadowed extension providers will be added to the list to be present
|
||||||
* added to the list to be present as workspace providers. {@code null} is equivalent
|
* as workspace providers. {@code null} is equivalent to passing an empty array
|
||||||
* to passing an empty array and so will reset workspace providers to match extension
|
* and so will reset workspace providers to match extension providers.
|
||||||
* providers.
|
* @throws CoreException in case of problems (such as problems with persistence).
|
||||||
* @throws CoreException
|
|
||||||
* in case of problems (such as problems with persistence).
|
|
||||||
*/
|
*/
|
||||||
public static void setWorkspaceProviders(List<ILanguageSettingsProvider> providers) throws CoreException {
|
public static void setWorkspaceProviders(List<ILanguageSettingsProvider> providers) throws CoreException {
|
||||||
LanguageSettingsProvidersSerializer.setWorkspaceProviders(providers);
|
LanguageSettingsProvidersSerializer.setWorkspaceProviders(providers);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy language settings provider. It is different from clone() methods in that it does not
|
* Copy language settings provider. It is different from clone() methods in that
|
||||||
* throw {@code CloneNotSupportedException} but returns {@code null} instead.
|
* it does not throw {@code CloneNotSupportedException} but returns {@code null}
|
||||||
|
* instead.
|
||||||
*
|
*
|
||||||
* @param provider
|
* @param provider - language settings provider to copy.
|
||||||
* - language settings provider to copy.
|
* @param deep - {@code true} to request deep copy including copying settings entries
|
||||||
* @param deep
|
* or {@code false} to return shallow copy with no settings entries.
|
||||||
* - {@code true} to request deep copy including copying settings entries or
|
|
||||||
* {@code false} to return shallow copy with no settings entries.
|
|
||||||
*
|
*
|
||||||
* @return a copy of the provider or null if copying is not possible.
|
* @return a copy of the provider or null if copying is not possible.
|
||||||
*/
|
*/
|
||||||
public static ILanguageSettingsEditableProvider getProviderCopy(
|
public static ILanguageSettingsEditableProvider getProviderCopy(ILanguageSettingsEditableProvider provider, boolean deep) {
|
||||||
ILanguageSettingsEditableProvider provider, boolean deep) {
|
|
||||||
return LanguageSettingsExtensionManager.getProviderCopy(provider, deep);
|
return LanguageSettingsExtensionManager.getProviderCopy(provider, deep);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns list of provider id-s contributed by all extensions.
|
* Returns list of provider id-s contributed by all extensions.
|
||||||
*
|
|
||||||
* @return the provider id-s.
|
* @return the provider id-s.
|
||||||
*/
|
*/
|
||||||
public static Set<String> getExtensionProviderIds() {
|
public static Set<String> getExtensionProviderIds() {
|
||||||
|
@ -195,17 +176,14 @@ public class LanguageSettingsManager {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get language settings provider defined via extension point
|
* Get language settings provider defined via extension point
|
||||||
* {@code org.eclipse.cdt.core.LanguageSettingsProvider}. A new copy of the extension provider
|
* {@code org.eclipse.cdt.core.LanguageSettingsProvider}.
|
||||||
* is returned.
|
* A new copy of the extension provider is returned.
|
||||||
*
|
*
|
||||||
* @param id
|
* @param id - ID of the extension provider.
|
||||||
* - ID of the extension provider.
|
* @param deep - {@code true} to request deep copy including copying settings entries
|
||||||
* @param deep
|
* or {@code false} to return shallow copy with no settings entries.
|
||||||
* - {@code true} to request deep copy including copying settings entries or
|
* @return the copy of the extension provider if possible (i.e. for {@link ILanguageSettingsEditableProvider})
|
||||||
* {@code false} to return shallow copy with no settings entries.
|
* or {@code null} if provider is not copyable.
|
||||||
* @return the copy of the extension provider if possible (i.e. for
|
|
||||||
* {@link ILanguageSettingsEditableProvider}) or {@code null} if provider is not
|
|
||||||
* copyable.
|
|
||||||
*/
|
*/
|
||||||
public static ILanguageSettingsProvider getExtensionProviderCopy(String id, boolean deep) {
|
public static ILanguageSettingsProvider getExtensionProviderCopy(String id, boolean deep) {
|
||||||
return LanguageSettingsExtensionManager.getExtensionProviderCopy(id, deep);
|
return LanguageSettingsExtensionManager.getExtensionProviderCopy(id, deep);
|
||||||
|
@ -215,11 +193,9 @@ public class LanguageSettingsManager {
|
||||||
* Test if the provider is equal to the one defined via extension point
|
* Test if the provider is equal to the one defined via extension point
|
||||||
* {@code org.eclipse.cdt.core.LanguageSettingsProvider}.
|
* {@code org.eclipse.cdt.core.LanguageSettingsProvider}.
|
||||||
*
|
*
|
||||||
* @param provider
|
* @param provider - the provider to test.
|
||||||
* - the provider to test.
|
* @param deep - {@code true} to check for deep equality testing also settings entries
|
||||||
* @param deep
|
* or {@code false} to test shallow copy with no settings entries.
|
||||||
* - {@code true} to check for deep equality testing also settings entries or
|
|
||||||
* {@code false} to test shallow copy with no settings entries.
|
|
||||||
* @return - {@code true} if the provider matches the extension or {@code false} otherwise.
|
* @return - {@code true} if the provider matches the extension or {@code false} otherwise.
|
||||||
*/
|
*/
|
||||||
public static boolean isEqualExtensionProvider(ILanguageSettingsProvider provider, boolean deep) {
|
public static boolean isEqualExtensionProvider(ILanguageSettingsProvider provider, boolean deep) {
|
||||||
|
@ -227,13 +203,13 @@ public class LanguageSettingsManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find language IDs for the resource represented by resource description. Under the hood build
|
* Find language IDs for the resource represented by resource description.
|
||||||
* component is inquired and the language IDs would commonly come from the input type(s).
|
* Under the hood build component is inquired and the language IDs would
|
||||||
|
* commonly come from the input type(s).
|
||||||
*
|
*
|
||||||
* @param rcDescription
|
* @param rcDescription - resource description
|
||||||
* - resource description
|
* @return list of language IDs for the resource. The list can contain {@code null} ID.
|
||||||
* @return list of language IDs for the resource. The list can contain {@code null} ID. Never
|
* Never returns {@code null} but empty list if no languages can be found.
|
||||||
* returns {@code null} but empty list if no languages can be found.
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static List<String> getLanguages(ICResourceDescription rcDescription) {
|
public static List<String> getLanguages(ICResourceDescription rcDescription) {
|
||||||
|
@ -263,14 +239,14 @@ public class LanguageSettingsManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find language IDs for the resource in given build configuration. Under the hood build
|
* Find language IDs for the resource in given build configuration.
|
||||||
* component is inquired and the language IDs would commonly come from the input type(s).
|
* Under the hood build component is inquired and the language IDs would
|
||||||
|
* commonly come from the input type(s).
|
||||||
*
|
*
|
||||||
* @param resource
|
* @param resource - the resource to find languages for.
|
||||||
* - the resource to find languages for.
|
|
||||||
* @param cfgDescription
|
* @param cfgDescription
|
||||||
* @return list of language IDs for the resource. Never returns {@code null} but empty list if
|
* @return list of language IDs for the resource.
|
||||||
* no languages can be found.
|
* Never returns {@code null} but empty list if no languages can be found.
|
||||||
*/
|
*/
|
||||||
public static List<String> getLanguages(IResource resource, ICConfigurationDescription cfgDescription) {
|
public static List<String> getLanguages(IResource resource, ICConfigurationDescription cfgDescription) {
|
||||||
List<String> languageIds = new ArrayList<String>();
|
List<String> languageIds = new ArrayList<String>();
|
||||||
|
@ -287,8 +263,7 @@ public class LanguageSettingsManager {
|
||||||
if (langId == null) {
|
if (langId == null) {
|
||||||
// Try getting language from content types
|
// Try getting language from content types
|
||||||
try {
|
try {
|
||||||
ILanguage lang = LanguageManager.getInstance().getLanguageForFile((IFile) resource,
|
ILanguage lang = LanguageManager.getInstance().getLanguageForFile((IFile) resource, cfgDescription);
|
||||||
cfgDescription);
|
|
||||||
if (lang != null) {
|
if (lang != null) {
|
||||||
langId = lang.getId();
|
langId = lang.getId();
|
||||||
}
|
}
|
||||||
|
@ -313,8 +288,7 @@ public class LanguageSettingsManager {
|
||||||
/**
|
/**
|
||||||
* Adds a listener that will be notified of changes in language settings.
|
* Adds a listener that will be notified of changes in language settings.
|
||||||
*
|
*
|
||||||
* @param listener
|
* @param listener the listener to add
|
||||||
* the listener to add
|
|
||||||
*/
|
*/
|
||||||
public static void registerLanguageSettingsChangeListener(ILanguageSettingsChangeListener listener) {
|
public static void registerLanguageSettingsChangeListener(ILanguageSettingsChangeListener listener) {
|
||||||
LanguageSettingsProvidersSerializer.registerLanguageSettingsChangeListener(listener);
|
LanguageSettingsProvidersSerializer.registerLanguageSettingsChangeListener(listener);
|
||||||
|
@ -323,35 +297,33 @@ public class LanguageSettingsManager {
|
||||||
/**
|
/**
|
||||||
* Removes a language settings change listener.
|
* Removes a language settings change listener.
|
||||||
*
|
*
|
||||||
* @param listener
|
* @param listener the listener to remove.
|
||||||
* the listener to remove.
|
|
||||||
*/
|
*/
|
||||||
public static void unregisterLanguageSettingsChangeListener(ILanguageSettingsChangeListener listener) {
|
public static void unregisterLanguageSettingsChangeListener(ILanguageSettingsChangeListener listener) {
|
||||||
LanguageSettingsProvidersSerializer.unregisterLanguageSettingsChangeListener(listener);
|
LanguageSettingsProvidersSerializer.unregisterLanguageSettingsChangeListener(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tells if the provider is meant to be shared between projects in workspace or belong to a
|
* Tells if the provider is meant to be shared between projects in workspace
|
||||||
* specific configuration. This attribute is defined in
|
* or belong to a specific configuration. This attribute is defined in
|
||||||
* {@code org.eclipse.cdt.core.LanguageSettingsProvider} extension point. <br>
|
* {@code org.eclipse.cdt.core.LanguageSettingsProvider} extension point.
|
||||||
* Note that only {@link ILanguageSettingsEditableProvider} can be owned by a configuration.
|
* <br>Note that only {@link ILanguageSettingsEditableProvider} can be owned by
|
||||||
|
* a configuration.
|
||||||
*
|
*
|
||||||
* @param id
|
* @param id - ID of the provider to inquire.
|
||||||
* - ID of the provider to inquire.
|
* @return {@code true} if the provider is designed to be shared,
|
||||||
* @return {@code true} if the provider is designed to be shared, {@code false} if
|
* {@code false} if configuration-owned.
|
||||||
* configuration-owned.
|
|
||||||
*/
|
*/
|
||||||
public static boolean isPreferShared(String id) {
|
public static boolean isPreferShared(String id) {
|
||||||
return LanguageSettingsExtensionManager.isPreferShared(id);
|
return LanguageSettingsExtensionManager.isPreferShared(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tells if language settings entries of the provider are persisted with the project (under
|
* Tells if language settings entries of the provider are persisted with the project
|
||||||
* .settings/ folder) or in workspace area. Persistence in the project area lets the entries
|
* (under .settings/ folder) or in workspace area. Persistence in the project area lets
|
||||||
* migrate with the project.
|
* the entries migrate with the project.
|
||||||
*
|
*
|
||||||
* @param provider
|
* @param provider - provider to check the persistence mode.
|
||||||
* - provider to check the persistence mode.
|
|
||||||
* @return {@code true} if LSE persisted with the project or {@code false} if in the workspace.
|
* @return {@code true} if LSE persisted with the project or {@code false} if in the workspace.
|
||||||
*/
|
*/
|
||||||
public static boolean isStoringEntriesInProjectArea(LanguageSettingsSerializableProvider provider) {
|
public static boolean isStoringEntriesInProjectArea(LanguageSettingsSerializableProvider provider) {
|
||||||
|
@ -361,23 +333,19 @@ public class LanguageSettingsManager {
|
||||||
/**
|
/**
|
||||||
* Define where language settings are persisted for the provider.
|
* Define where language settings are persisted for the provider.
|
||||||
*
|
*
|
||||||
* @param provider
|
* @param provider - provider to set the persistence mode.
|
||||||
* - provider to set the persistence mode.
|
* @param storeEntriesWithProject - {@code true} if with the project,
|
||||||
* @param storeEntriesWithProject
|
* {@code false} if in workspace area.
|
||||||
* - {@code true} if with the project, {@code false} if in workspace area.
|
|
||||||
*/
|
*/
|
||||||
public static void setStoringEntriesInProjectArea(LanguageSettingsSerializableProvider provider,
|
public static void setStoringEntriesInProjectArea(LanguageSettingsSerializableProvider provider, boolean storeEntriesWithProject) {
|
||||||
boolean storeEntriesWithProject) {
|
|
||||||
LanguageSettingsProvidersSerializer.setStoringEntriesInProjectArea(provider, storeEntriesWithProject);
|
LanguageSettingsProvidersSerializer.setStoringEntriesInProjectArea(provider, storeEntriesWithProject);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save language settings providers of a project to persistent storage.
|
* Save language settings providers of a project to persistent storage.
|
||||||
*
|
*
|
||||||
* @param prjDescription
|
* @param prjDescription - project description of the project.
|
||||||
* - project description of the project.
|
* @throws CoreException if something goes wrong.
|
||||||
* @throws CoreException
|
|
||||||
* if something goes wrong.
|
|
||||||
*/
|
*/
|
||||||
public static void serializeLanguageSettings(ICProjectDescription prjDescription) throws CoreException {
|
public static void serializeLanguageSettings(ICProjectDescription prjDescription) throws CoreException {
|
||||||
LanguageSettingsProvidersSerializer.serializeLanguageSettings(prjDescription);
|
LanguageSettingsProvidersSerializer.serializeLanguageSettings(prjDescription);
|
||||||
|
@ -386,8 +354,7 @@ public class LanguageSettingsManager {
|
||||||
/**
|
/**
|
||||||
* Save language settings providers of the workspace (global providers) to persistent storage.
|
* Save language settings providers of the workspace (global providers) to persistent storage.
|
||||||
*
|
*
|
||||||
* @throws CoreException
|
* @throws CoreException if something goes wrong.
|
||||||
* if something goes wrong.
|
|
||||||
*/
|
*/
|
||||||
public static void serializeLanguageSettingsWorkspace() throws CoreException {
|
public static void serializeLanguageSettingsWorkspace() throws CoreException {
|
||||||
LanguageSettingsProvidersSerializer.serializeLanguageSettingsWorkspace();
|
LanguageSettingsProvidersSerializer.serializeLanguageSettingsWorkspace();
|
||||||
|
@ -396,16 +363,15 @@ public class LanguageSettingsManager {
|
||||||
/**
|
/**
|
||||||
* Save language settings providers of a project to persistent storage in a background job.
|
* Save language settings providers of a project to persistent storage in a background job.
|
||||||
*
|
*
|
||||||
* @param prjDescription
|
* @param prjDescription - project description of the project.
|
||||||
* - project description of the project.
|
|
||||||
*/
|
*/
|
||||||
public static void serializeLanguageSettingsInBackground(ICProjectDescription prjDescription) {
|
public static void serializeLanguageSettingsInBackground(ICProjectDescription prjDescription) {
|
||||||
LanguageSettingsProvidersSerializer.serializeLanguageSettingsInBackground(prjDescription);
|
LanguageSettingsProvidersSerializer.serializeLanguageSettingsInBackground(prjDescription);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save language settings providers of the workspace (global providers) to persistent storage in
|
* Save language settings providers of the workspace (global providers) to persistent storage
|
||||||
* a background job.
|
* in a background job.
|
||||||
*/
|
*/
|
||||||
public static void serializeLanguageSettingsWorkspaceInBackground() {
|
public static void serializeLanguageSettingsWorkspaceInBackground() {
|
||||||
LanguageSettingsProvidersSerializer.serializeLanguageSettingsWorkspaceInBackground();
|
LanguageSettingsProvidersSerializer.serializeLanguageSettingsWorkspaceInBackground();
|
||||||
|
@ -414,13 +380,11 @@ public class LanguageSettingsManager {
|
||||||
/**
|
/**
|
||||||
* Create a list of providers with intention to assign to a configuration description.
|
* Create a list of providers with intention to assign to a configuration description.
|
||||||
*
|
*
|
||||||
* The list will contain global providers for ones where attribute "prefer-non-shared" is
|
* The list will contain global providers for ones where attribute "prefer-non-shared" is {@code true}
|
||||||
* {@code true} and a new copy for those where attribute "prefer-non-shared" is {@code false}.
|
* and a new copy for those where attribute "prefer-non-shared" is {@code false}. Attribute "prefer-non-shared"
|
||||||
* Attribute "prefer-non-shared" is defined in extension point
|
* is defined in extension point {@code org.eclipse.cdt.core.LanguageSettingsProvider}.
|
||||||
* {@code org.eclipse.cdt.core.LanguageSettingsProvider}.
|
|
||||||
*
|
*
|
||||||
* @param ids
|
* @param ids - list of providers id which cannot be {@code null}.
|
||||||
* - list of providers id which cannot be {@code null}.
|
|
||||||
* @return a list of language settings providers with given ids.
|
* @return a list of language settings providers with given ids.
|
||||||
*
|
*
|
||||||
* @since 5.5
|
* @since 5.5
|
||||||
|
|
|
@ -24,7 +24,6 @@ import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSetting
|
||||||
import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsSerializableStorage;
|
import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsSerializableStorage;
|
||||||
import org.eclipse.cdt.internal.core.settings.model.CConfigurationSpecSettings;
|
import org.eclipse.cdt.internal.core.settings.model.CConfigurationSpecSettings;
|
||||||
import org.eclipse.cdt.internal.core.settings.model.IInternalCCfgInfo;
|
import org.eclipse.cdt.internal.core.settings.model.IInternalCCfgInfo;
|
||||||
import org.eclipse.core.resources.IBuildConfiguration;
|
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
@ -35,21 +34,19 @@ import org.w3c.dom.Node;
|
||||||
import org.w3c.dom.NodeList;
|
import org.w3c.dom.NodeList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is the base class for language settings providers able to
|
* This class is the base class for language settings providers able to serialize
|
||||||
* serialize into XML storage. Although this class has setter methods, by design
|
* into XML storage.
|
||||||
* its instances are not editable in UI nor instances can be assigned to a
|
* Although this class has setter methods, by design its instances are not editable in UI
|
||||||
* configuration (cannot be global or non-shared). Implement
|
* nor instances can be assigned to a configuration (cannot be global or non-shared).
|
||||||
* {@link ILanguageSettingsEditableProvider} interface for that. There is a
|
* Implement {@link ILanguageSettingsEditableProvider} interface for that. There is a generic
|
||||||
* generic implementation of this interface available to be used, see
|
* implementation of this interface available to be used, see {@link LanguageSettingsGenericProvider}.
|
||||||
* {@link LanguageSettingsGenericProvider}.
|
|
||||||
*
|
*
|
||||||
* For more on the suggested way of extending this class see the description of
|
* For more on the suggested way of extending this class see the description of
|
||||||
* {@link ILanguageSettingsProvider}.
|
* {@link ILanguageSettingsProvider}.
|
||||||
*
|
*
|
||||||
* @since 5.4
|
* @since 5.4
|
||||||
*/
|
*/
|
||||||
public class LanguageSettingsSerializableProvider extends LanguageSettingsBaseProvider
|
public class LanguageSettingsSerializableProvider extends LanguageSettingsBaseProvider implements ILanguageSettingsBroadcastingProvider {
|
||||||
implements ILanguageSettingsBroadcastingProvider {
|
|
||||||
protected static final String ATTR_ID = LanguageSettingsProvidersSerializer.ATTR_ID;
|
protected static final String ATTR_ID = LanguageSettingsProvidersSerializer.ATTR_ID;
|
||||||
protected static final String ATTR_NAME = LanguageSettingsProvidersSerializer.ATTR_NAME;
|
protected static final String ATTR_NAME = LanguageSettingsProvidersSerializer.ATTR_NAME;
|
||||||
protected static final String ATTR_CLASS = LanguageSettingsProvidersSerializer.ATTR_CLASS;
|
protected static final String ATTR_CLASS = LanguageSettingsProvidersSerializer.ATTR_CLASS;
|
||||||
|
@ -59,9 +56,8 @@ public class LanguageSettingsSerializableProvider extends LanguageSettingsBasePr
|
||||||
private LanguageSettingsSerializableStorage fStorage = new LanguageSettingsSerializableStorage();
|
private LanguageSettingsSerializableStorage fStorage = new LanguageSettingsSerializableStorage();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor. This constructor has to be always followed with
|
* Default constructor. This constructor has to be always followed with setting id and name of the provider.
|
||||||
* setting id and name of the provider. This constructor is necessary to
|
* This constructor is necessary to instantiate the class via the extension point in plugin.xml.
|
||||||
* instantiate the class via the extension point in plugin.xml.
|
|
||||||
*/
|
*/
|
||||||
public LanguageSettingsSerializableProvider() {
|
public LanguageSettingsSerializableProvider() {
|
||||||
super();
|
super();
|
||||||
|
@ -70,10 +66,8 @@ public class LanguageSettingsSerializableProvider extends LanguageSettingsBasePr
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
* @param id
|
* @param id - id of the provider.
|
||||||
* - id of the provider.
|
* @param name - name of the provider. Note that this name shows up in UI.
|
||||||
* @param name
|
|
||||||
* - name of the provider. Note that this name shows up in UI.
|
|
||||||
*/
|
*/
|
||||||
public LanguageSettingsSerializableProvider(String id, String name) {
|
public LanguageSettingsSerializableProvider(String id, String name) {
|
||||||
super(id, name);
|
super(id, name);
|
||||||
|
@ -90,24 +84,21 @@ public class LanguageSettingsSerializableProvider extends LanguageSettingsBasePr
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void configureProvider(String id, String name, List<String> languages,
|
public void configureProvider(String id, String name, List<String> languages, List<ICLanguageSettingEntry> entries, Map<String, String> properties) {
|
||||||
List<ICLanguageSettingEntry> entries, Map<String, String> properties) {
|
|
||||||
// do not pass entries to super, keep them in local storage
|
// do not pass entries to super, keep them in local storage
|
||||||
super.configureProvider(id, name, languages, null, properties);
|
super.configureProvider(id, name, languages, null, properties);
|
||||||
|
|
||||||
fStorage.clear();
|
fStorage.clear();
|
||||||
|
|
||||||
if (entries!=null) {
|
if (entries!=null) {
|
||||||
// note that these entries are intended to be retrieved by
|
// note that these entries are intended to be retrieved by LanguageSettingsManager.getSettingEntriesUpResourceTree()
|
||||||
// LanguageSettingsManager.getSettingEntriesUpResourceTree()
|
|
||||||
// when the whole resource hierarchy has been traversed up
|
// when the whole resource hierarchy has been traversed up
|
||||||
setSettingEntries((IBuildConfiguration) null, null, null, entries);
|
setSettingEntries(null, null, null, entries);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {@code true} if the provider does not keep any settings yet or
|
* @return {@code true} if the provider does not keep any settings yet or {@code false} if there are some.
|
||||||
* {@code false} if there are some.
|
|
||||||
*/
|
*/
|
||||||
public boolean isEmpty() {
|
public boolean isEmpty() {
|
||||||
return fStorage.isEmpty();
|
return fStorage.isEmpty();
|
||||||
|
@ -116,9 +107,8 @@ public class LanguageSettingsSerializableProvider extends LanguageSettingsBasePr
|
||||||
/**
|
/**
|
||||||
* Sets the language scope of the provider.
|
* Sets the language scope of the provider.
|
||||||
*
|
*
|
||||||
* @param languages
|
* @param languages - the list of languages this provider provides for.
|
||||||
* - the list of languages this provider provides for. If
|
* If {@code null}, the provider provides for any language.
|
||||||
* {@code null}, the provider provides for any language.
|
|
||||||
*
|
*
|
||||||
* @see #getLanguageScope()
|
* @see #getLanguageScope()
|
||||||
*/
|
*/
|
||||||
|
@ -131,65 +121,45 @@ public class LanguageSettingsSerializableProvider extends LanguageSettingsBasePr
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears all the entries for all configurations, all resources and all
|
* Clears all the entries for all configurations, all resources and all languages.
|
||||||
* languages.
|
|
||||||
*/
|
*/
|
||||||
public void clear() {
|
public void clear() {
|
||||||
fStorage.clear();
|
fStorage.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets language settings entries for the provider. Note that the entries
|
* Sets language settings entries for the provider.
|
||||||
* are not persisted at that point. Use this method to set the entries for
|
* Note that the entries are not persisted at that point. Use this method to set
|
||||||
* all resources one by one and after all done persist in one shot using
|
* the entries for all resources one by one and after all done persist in one shot
|
||||||
* {@link #serializeLanguageSettings(ICConfigurationDescription)}. See for
|
* using {@link #serializeLanguageSettings(ICConfigurationDescription)}.
|
||||||
* example {@code AbstractBuildCommandParser} and
|
* See for example {@code AbstractBuildCommandParser} and {@code AbstractBuiltinSpecsDetector}
|
||||||
* {@code AbstractBuiltinSpecsDetector} in build plugins.
|
* in build plugins.
|
||||||
*
|
*
|
||||||
* @param config
|
* @param cfgDescription - configuration description.
|
||||||
* - configuration.
|
* @param rc - resource such as file or folder. If {@code null} the entries are
|
||||||
* @param rc
|
* considered to be being defined as default entries for resources.
|
||||||
* - resource such as file or folder. If {@code null} the entries
|
* @param languageId - language id. If {@code null}, then entries are considered
|
||||||
* are considered to be being defined as default entries for
|
* to be defined for the language scope. See {@link #getLanguageScope()}
|
||||||
* resources.
|
* @param entries - language settings entries to set.
|
||||||
* @param languageId
|
|
||||||
* - language id. If {@code null}, then entries are considered to
|
|
||||||
* be defined for the language scope. See
|
|
||||||
* {@link #getLanguageScope()}
|
|
||||||
* @param entries
|
|
||||||
* - language settings entries to set.
|
|
||||||
* @since 6.0
|
|
||||||
*/
|
*/
|
||||||
public void setSettingEntries(IBuildConfiguration config, IResource rc, String languageId,
|
public void setSettingEntries(ICConfigurationDescription cfgDescription, IResource rc, String languageId,
|
||||||
List<? extends ICLanguageSettingEntry> entries) {
|
List<? extends ICLanguageSettingEntry> entries) {
|
||||||
String rcProjectPath = rc!=null ? rc.getProjectRelativePath().toString() : null;
|
String rcProjectPath = rc!=null ? rc.getProjectRelativePath().toString() : null;
|
||||||
fStorage.setSettingEntries(rcProjectPath, languageId, entries);
|
fStorage.setSettingEntries(rcProjectPath, languageId, entries);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated Use {@link #setSettingEntries(IBuildConfiguration, IResource, String, List)}.
|
* {@inheritDoc}
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public void setSettingEntries(ICConfigurationDescription config, IResource rc, String languageId,
|
|
||||||
List<? extends ICLanguageSettingEntry> entries) {
|
|
||||||
setSettingEntries((IBuildConfiguration) null, rc, languageId, entries);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc} <br>
|
|
||||||
* Note that this list is <b>unmodifiable</b>. To modify the list copy it,
|
|
||||||
* change and use
|
|
||||||
* {@link #setSettingEntries(IBuildConfiguration, IResource, String, List)}
|
|
||||||
* . <br>
|
|
||||||
* <br>
|
* <br>
|
||||||
* Note also that <b>you can compare these lists with simple equality
|
* Note that this list is <b>unmodifiable</b>. To modify the list copy it, change and use
|
||||||
* operator ==</b>, as the lists themselves are backed by
|
* {@link #setSettingEntries(ICConfigurationDescription, IResource, String, List)}.
|
||||||
* WeakHashSet<List<ICLanguageSettingEntry>> where identical copies (deep
|
* <br><br>
|
||||||
* comparison is used) are replaced with the same one instance.
|
* Note also that <b>you can compare these lists with simple equality operator ==</b>,
|
||||||
|
* as the lists themselves are backed by WeakHashSet<List<ICLanguageSettingEntry>> where
|
||||||
|
* identical copies (deep comparison is used) are replaced with the same one instance.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<ICLanguageSettingEntry> getSettingEntries(IBuildConfiguration config, IResource rc,
|
public List<ICLanguageSettingEntry> getSettingEntries(ICConfigurationDescription cfgDescription, IResource rc, String languageId) {
|
||||||
String languageId) {
|
|
||||||
String rcProjectPath = rc!=null ? rc.getProjectRelativePath().toString() : null;
|
String rcProjectPath = rc!=null ? rc.getProjectRelativePath().toString() : null;
|
||||||
List<ICLanguageSettingEntry> entries = fStorage.getSettingEntries(rcProjectPath, languageId);
|
List<ICLanguageSettingEntry> entries = fStorage.getSettingEntries(rcProjectPath, languageId);
|
||||||
if (entries == null) {
|
if (entries == null) {
|
||||||
|
@ -202,32 +172,25 @@ public class LanguageSettingsSerializableProvider extends LanguageSettingsBasePr
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated Use {@link #getSettingEntries(IBuildConfiguration, IResource, String)}.
|
* Serialize the provider under parent XML element.
|
||||||
*/
|
* This is convenience method not intended to be overridden on purpose.
|
||||||
@Deprecated
|
* Override {@link #serializeAttributes(Element)} or
|
||||||
@Override
|
|
||||||
public List<ICLanguageSettingEntry> getSettingEntries(ICConfigurationDescription config, IResource rc,
|
|
||||||
String languageId) {
|
|
||||||
return getSettingEntries((IBuildConfiguration) null, rc, languageId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Serialize the provider under parent XML element. This is convenience
|
|
||||||
* method not intended to be overridden on purpose. Override
|
|
||||||
* {@link #serializeAttributes(Element)} or
|
|
||||||
* {@link #serializeEntries(Element)} instead.
|
* {@link #serializeEntries(Element)} instead.
|
||||||
*
|
*
|
||||||
* @param parentElement
|
* @param parentElement - element where to serialize.
|
||||||
* - element where to serialize.
|
|
||||||
* @return - newly created "provider" element. That element will already be
|
* @return - newly created "provider" element. That element will already be
|
||||||
* attached to the parent element.
|
* attached to the parent element.
|
||||||
*/
|
*/
|
||||||
final public Element serialize(Element parentElement) {
|
final public Element serialize(Element parentElement) {
|
||||||
/*
|
/*
|
||||||
* <provider id="provider.id" ...> <language-scope id="lang.id"/>
|
<provider id="provider.id" ...>
|
||||||
* <language id="lang.id"> <resource project-relative-path="/"> <entry
|
<language-scope id="lang.id"/>
|
||||||
* flags="" kind="includePath" name="path"/> </resource> </language>
|
<language id="lang.id">
|
||||||
* </provider>
|
<resource project-relative-path="/">
|
||||||
|
<entry flags="" kind="includePath" name="path"/>
|
||||||
|
</resource>
|
||||||
|
</language>
|
||||||
|
</provider>
|
||||||
*/
|
*/
|
||||||
Element elementProvider = serializeAttributes(parentElement);
|
Element elementProvider = serializeAttributes(parentElement);
|
||||||
serializeEntries(elementProvider);
|
serializeEntries(elementProvider);
|
||||||
|
@ -236,17 +199,14 @@ public class LanguageSettingsSerializableProvider extends LanguageSettingsBasePr
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Serialize the provider attributes under parent XML element. That is
|
* Serialize the provider attributes under parent XML element. That is
|
||||||
* equivalent to serializing everything (including language scope) except
|
* equivalent to serializing everything (including language scope) except entries.
|
||||||
* entries.
|
|
||||||
*
|
*
|
||||||
* @param parentElement
|
* @param parentElement - element where to serialize.
|
||||||
* - element where to serialize.
|
|
||||||
* @return - newly created "provider" element. That element will already be
|
* @return - newly created "provider" element. That element will already be
|
||||||
* attached to the parent element.
|
* attached to the parent element.
|
||||||
*/
|
*/
|
||||||
public Element serializeAttributes(Element parentElement) {
|
public Element serializeAttributes(Element parentElement) {
|
||||||
// Keeps pairs: key, value. See JavaDoc XmlUtil.appendElement(Node,
|
// Keeps pairs: key, value. See JavaDoc XmlUtil.appendElement(Node, String, String[]).
|
||||||
// String, String[]).
|
|
||||||
List<String> attributes = new ArrayList<String>();
|
List<String> attributes = new ArrayList<String>();
|
||||||
|
|
||||||
attributes.add(ATTR_ID);
|
attributes.add(ATTR_ID);
|
||||||
|
@ -260,8 +220,7 @@ public class LanguageSettingsSerializableProvider extends LanguageSettingsBasePr
|
||||||
attributes.add(entry.getValue());
|
attributes.add(entry.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
Element elementProvider = XmlUtil.appendElement(parentElement, ELEM_PROVIDER,
|
Element elementProvider = XmlUtil.appendElement(parentElement, ELEM_PROVIDER, attributes.toArray(new String[0]));
|
||||||
attributes.toArray(new String[0]));
|
|
||||||
|
|
||||||
if (languageScope!=null) {
|
if (languageScope!=null) {
|
||||||
for (String langId : languageScope) {
|
for (String langId : languageScope) {
|
||||||
|
@ -273,24 +232,21 @@ public class LanguageSettingsSerializableProvider extends LanguageSettingsBasePr
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Serialize the provider entries under parent XML element.
|
* Serialize the provider entries under parent XML element.
|
||||||
*
|
* @param elementProvider - element where to serialize the entries.
|
||||||
* @param elementProvider
|
|
||||||
* - element where to serialize the entries.
|
|
||||||
*/
|
*/
|
||||||
public void serializeEntries(Element elementProvider) {
|
public void serializeEntries(Element elementProvider) {
|
||||||
fStorage.serializeEntries(elementProvider);
|
fStorage.serializeEntries(elementProvider);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convenience method to persist language settings entries for the project
|
* Convenience method to persist language settings entries for the project or
|
||||||
* or workspace as often-used operation. Note that configuration description
|
* workspace as often-used operation.
|
||||||
* is passed as an argument but the current implementation saves all
|
* Note that configuration description is passed as an argument but the
|
||||||
* configurations.
|
* current implementation saves all configurations.
|
||||||
*
|
*
|
||||||
* @param cfgDescription
|
* @param cfgDescription - configuration description.
|
||||||
* - configuration description. If not {@code null}, all
|
* If not {@code null}, all providers of the project are serialized.
|
||||||
* providers of the project are serialized. If {@code null},
|
* If {@code null}, global workspace providers are serialized.
|
||||||
* global workspace providers are serialized.
|
|
||||||
*
|
*
|
||||||
* @return - status of operation.
|
* @return - status of operation.
|
||||||
*/
|
*/
|
||||||
|
@ -303,29 +259,26 @@ public class LanguageSettingsSerializableProvider extends LanguageSettingsBasePr
|
||||||
LanguageSettingsManager.serializeLanguageSettingsWorkspace();
|
LanguageSettingsManager.serializeLanguageSettingsWorkspace();
|
||||||
}
|
}
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
status = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, IStatus.ERROR,
|
status = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, IStatus.ERROR, "Error serializing language settings", e); //$NON-NLS-1$
|
||||||
"Error serializing language settings", e); //$NON-NLS-1$
|
|
||||||
CCorePlugin.log(status);
|
CCorePlugin.log(status);
|
||||||
}
|
}
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convenience method to persist language settings entries in background for
|
* Convenience method to persist language settings entries in background for the project or
|
||||||
* the project or workspace as often-used operation. Note that configuration
|
* workspace as often-used operation.
|
||||||
* description is passed as an argument but the current implementation saves
|
* Note that configuration description is passed as an argument but the
|
||||||
* all configurations.
|
* current implementation saves all configurations.
|
||||||
*
|
*
|
||||||
* @param cfgDescription
|
* @param cfgDescription - configuration description.
|
||||||
* - configuration description. If not {@code null}, all
|
* If not {@code null}, all providers of the project are serialized.
|
||||||
* providers of the project are serialized. If {@code null},
|
* If {@code null}, global workspace providers are serialized.
|
||||||
* global workspace providers are serialized.
|
|
||||||
*/
|
*/
|
||||||
public void serializeLanguageSettingsInBackground(ICConfigurationDescription cfgDescription) {
|
public void serializeLanguageSettingsInBackground(ICConfigurationDescription cfgDescription) {
|
||||||
if (cfgDescription != null) {
|
if (cfgDescription != null) {
|
||||||
if (isLanguageSettingsProviderStoreChanged(cfgDescription)) {
|
if (isLanguageSettingsProviderStoreChanged(cfgDescription)) {
|
||||||
LanguageSettingsManager
|
LanguageSettingsManager.serializeLanguageSettingsInBackground(cfgDescription.getProjectDescription());
|
||||||
.serializeLanguageSettingsInBackground(cfgDescription.getProjectDescription());
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LanguageSettingsManager.serializeLanguageSettingsWorkspaceInBackground();
|
LanguageSettingsManager.serializeLanguageSettingsWorkspaceInBackground();
|
||||||
|
@ -333,8 +286,7 @@ public class LanguageSettingsSerializableProvider extends LanguageSettingsBasePr
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compare provider store with cached persistent store used to calculate
|
* Compare provider store with cached persistent store used to calculate delta.
|
||||||
* delta.
|
|
||||||
*/
|
*/
|
||||||
private boolean isLanguageSettingsProviderStoreChanged(ICConfigurationDescription cfgDescription) {
|
private boolean isLanguageSettingsProviderStoreChanged(ICConfigurationDescription cfgDescription) {
|
||||||
if (cfgDescription instanceof IInternalCCfgInfo) {
|
if (cfgDescription instanceof IInternalCCfgInfo) {
|
||||||
|
@ -353,13 +305,12 @@ public class LanguageSettingsSerializableProvider extends LanguageSettingsBasePr
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load provider from XML provider element. This is convenience method not
|
* Load provider from XML provider element.
|
||||||
* intended to be overridden on purpose. Override
|
* This is convenience method not intended to be overridden on purpose.
|
||||||
* {@link #loadAttributes(Element)} or {@link #loadEntries(Element)}
|
* Override {@link #loadAttributes(Element)} or
|
||||||
* instead.
|
* {@link #loadEntries(Element)} instead.
|
||||||
*
|
*
|
||||||
* @param providerNode
|
* @param providerNode - XML element "provider" to load provider from.
|
||||||
* - XML element "provider" to load provider from.
|
|
||||||
*/
|
*/
|
||||||
final public void load(Element providerNode) {
|
final public void load(Element providerNode) {
|
||||||
fStorage.clear();
|
fStorage.clear();
|
||||||
|
@ -386,9 +337,7 @@ public class LanguageSettingsSerializableProvider extends LanguageSettingsBasePr
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load attributes from XML provider element.
|
* Load attributes from XML provider element.
|
||||||
*
|
* @param providerNode - XML element "provider" to load attributes from.
|
||||||
* @param providerNode
|
|
||||||
* - XML element "provider" to load attributes from.
|
|
||||||
*/
|
*/
|
||||||
public void loadAttributes(Element providerNode) {
|
public void loadAttributes(Element providerNode) {
|
||||||
String providerId = XmlUtil.determineAttributeValue(providerNode, ATTR_ID);
|
String providerId = XmlUtil.determineAttributeValue(providerNode, ATTR_ID);
|
||||||
|
@ -425,44 +374,37 @@ public class LanguageSettingsSerializableProvider extends LanguageSettingsBasePr
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load provider entries from XML provider element.
|
* Load provider entries from XML provider element.
|
||||||
*
|
* @param providerNode - parent XML element "provider" where entries are defined.
|
||||||
* @param providerNode
|
|
||||||
* - parent XML element "provider" where entries are defined.
|
|
||||||
*/
|
*/
|
||||||
public void loadEntries(Element providerNode) {
|
public void loadEntries(Element providerNode) {
|
||||||
fStorage.loadEntries(providerNode);
|
fStorage.loadEntries(providerNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a custom property of the provider. <br>
|
* Set a custom property of the provider.
|
||||||
* <br>
|
* <br><br>
|
||||||
* A note of caution - do not use default values for a provider which are
|
* A note of caution - do not use default values for a provider which are different
|
||||||
* different from empty or {@code null} value. When providers are checked
|
* from empty or {@code null} value. When providers are checked for equality
|
||||||
* for equality (during internal operations in core) the missing properties
|
* (during internal operations in core) the missing properties are evaluated as
|
||||||
* are evaluated as empty ones.
|
* empty ones.
|
||||||
*
|
*
|
||||||
* @see LanguageSettingsBaseProvider#getProperty(String)
|
* @see LanguageSettingsBaseProvider#getProperty(String)
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key - name of the property.
|
||||||
* - name of the property.
|
* @param value - value of the property.
|
||||||
* @param value
|
* If value is {@code null} the property is removed from the list.
|
||||||
* - value of the property. If value is {@code null} the property
|
|
||||||
* is removed from the list.
|
|
||||||
*/
|
*/
|
||||||
public void setProperty(String key, String value) {
|
public void setProperty(String key, String value) {
|
||||||
properties.put(key, value);
|
properties.put(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a custom boolean property of the provider. <br>
|
* Set a custom boolean property of the provider.
|
||||||
* Please, note that default value is always {@code false}.
|
* <br>Please, note that default value is always {@code false}.
|
||||||
*
|
|
||||||
* @see LanguageSettingsBaseProvider#getProperty(String)
|
* @see LanguageSettingsBaseProvider#getProperty(String)
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key - name of the property.
|
||||||
* - name of the property.
|
* @param value - {@code boolean} value of the property.
|
||||||
* @param value
|
|
||||||
* - {@code boolean} value of the property.
|
|
||||||
*/
|
*/
|
||||||
public void setPropertyBool(String key, boolean value) {
|
public void setPropertyBool(String key, boolean value) {
|
||||||
properties.put(key, Boolean.toString(value));
|
properties.put(key, Boolean.toString(value));
|
||||||
|
@ -470,8 +412,7 @@ public class LanguageSettingsSerializableProvider extends LanguageSettingsBasePr
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See {@link #cloneShallow()}. This method is extracted to avoid expressing
|
* See {@link #cloneShallow()}. This method is extracted to avoid expressing
|
||||||
* {@link #clone()} via {@link #cloneShallow()}. Do not inline to
|
* {@link #clone()} via {@link #cloneShallow()}. Do not inline to "optimize"!
|
||||||
* "optimize"!
|
|
||||||
*/
|
*/
|
||||||
private LanguageSettingsSerializableProvider cloneShallowInternal() throws CloneNotSupportedException {
|
private LanguageSettingsSerializableProvider cloneShallowInternal() throws CloneNotSupportedException {
|
||||||
LanguageSettingsSerializableProvider clone = (LanguageSettingsSerializableProvider)super.clone();
|
LanguageSettingsSerializableProvider clone = (LanguageSettingsSerializableProvider)super.clone();
|
||||||
|
@ -484,12 +425,11 @@ public class LanguageSettingsSerializableProvider extends LanguageSettingsBasePr
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shallow clone of the provider. "Shallow" is defined here as the exact
|
* Shallow clone of the provider. "Shallow" is defined here as the exact copy except that
|
||||||
* copy except that the copy will have zero language settings entries.
|
* the copy will have zero language settings entries.
|
||||||
*
|
*
|
||||||
* @return shallow copy of the provider.
|
* @return shallow copy of the provider.
|
||||||
* @throws CloneNotSupportedException
|
* @throws CloneNotSupportedException in case {@link #clone()} throws the exception.
|
||||||
* in case {@link #clone()} throws the exception.
|
|
||||||
*/
|
*/
|
||||||
protected LanguageSettingsSerializableProvider cloneShallow() throws CloneNotSupportedException {
|
protected LanguageSettingsSerializableProvider cloneShallow() throws CloneNotSupportedException {
|
||||||
return cloneShallowInternal();
|
return cloneShallowInternal();
|
||||||
|
|
|
@ -34,14 +34,14 @@ public class LanguageSettingsStorage implements Cloneable {
|
||||||
/** Storage to keep settings entries. */
|
/** Storage to keep settings entries. */
|
||||||
protected Map<String, // languageId
|
protected Map<String, // languageId
|
||||||
Map<String, // resource project path
|
Map<String, // resource project path
|
||||||
List<ICLanguageSettingEntry>>> fStorage = new HashMap<>();
|
List<ICLanguageSettingEntry>>> fStorage = new HashMap<String, Map<String, List<ICLanguageSettingEntry>>>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pool of LSE lists implemented as WeakHashSet. That allows to gain memory savings
|
* Pool of LSE lists implemented as WeakHashSet. That allows to gain memory savings
|
||||||
* at the expense of CPU time. WeakHashSet handles garbage collection when a list is not
|
* at the expense of CPU time. WeakHashSet handles garbage collection when a list is not
|
||||||
* referenced anywhere else. See JavaDoc {@link java.lang.ref.WeakReference} about weak reference objects.
|
* referenced anywhere else. See JavaDoc {@link java.lang.ref.WeakReference} about weak reference objects.
|
||||||
*/
|
*/
|
||||||
private static WeakHashSet<List<ICLanguageSettingEntry>> listPool = new WeakHashSetSynchronized<>();
|
private static WeakHashSet<List<ICLanguageSettingEntry>> listPool = new WeakHashSetSynchronized<List<ICLanguageSettingEntry>>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the list of setting entries for the given resource and language.
|
* Returns the list of setting entries for the given resource and language.
|
||||||
|
@ -218,13 +218,13 @@ public class LanguageSettingsStorage implements Cloneable {
|
||||||
@Override
|
@Override
|
||||||
public LanguageSettingsStorage clone() throws CloneNotSupportedException {
|
public LanguageSettingsStorage clone() throws CloneNotSupportedException {
|
||||||
LanguageSettingsStorage storageClone = (LanguageSettingsStorage) super.clone();
|
LanguageSettingsStorage storageClone = (LanguageSettingsStorage) super.clone();
|
||||||
storageClone.fStorage = new HashMap<>();
|
storageClone.fStorage = new HashMap<String, Map<String, List<ICLanguageSettingEntry>>>();
|
||||||
synchronized (fStorage) {
|
synchronized (fStorage) {
|
||||||
Set<Entry<String, Map<String, List<ICLanguageSettingEntry>>>> entrySetLang = fStorage.entrySet();
|
Set<Entry<String, Map<String, List<ICLanguageSettingEntry>>>> entrySetLang = fStorage.entrySet();
|
||||||
for (Entry<String, Map<String, List<ICLanguageSettingEntry>>> entryLang : entrySetLang) {
|
for (Entry<String, Map<String, List<ICLanguageSettingEntry>>> entryLang : entrySetLang) {
|
||||||
String langId = entryLang.getKey();
|
String langId = entryLang.getKey();
|
||||||
Map<String, List<ICLanguageSettingEntry>> mapRc = entryLang.getValue();
|
Map<String, List<ICLanguageSettingEntry>> mapRc = entryLang.getValue();
|
||||||
Map<String, List<ICLanguageSettingEntry>> mapRcClone = new HashMap<>();
|
Map<String, List<ICLanguageSettingEntry>> mapRcClone = new HashMap<String, List<ICLanguageSettingEntry>>();
|
||||||
Set<Entry<String, List<ICLanguageSettingEntry>>> entrySetRc = mapRc.entrySet();
|
Set<Entry<String, List<ICLanguageSettingEntry>>> entrySetRc = mapRc.entrySet();
|
||||||
for (Entry<String, List<ICLanguageSettingEntry>> entryRc : entrySetRc) {
|
for (Entry<String, List<ICLanguageSettingEntry>> entryRc : entrySetRc) {
|
||||||
String rcProjectPath = entryRc.getKey();
|
String rcProjectPath = entryRc.getKey();
|
||||||
|
@ -262,4 +262,5 @@ public class LanguageSettingsStorage implements Cloneable {
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -71,14 +71,12 @@ import org.eclipse.cdt.internal.core.model.PathEntry;
|
||||||
import org.eclipse.cdt.internal.core.settings.model.CConfigurationDescriptionCache;
|
import org.eclipse.cdt.internal.core.settings.model.CConfigurationDescriptionCache;
|
||||||
import org.eclipse.cdt.internal.core.settings.model.IInternalCCfgInfo;
|
import org.eclipse.cdt.internal.core.settings.model.IInternalCCfgInfo;
|
||||||
import org.eclipse.cdt.utils.cdtvariables.CdtVariableResolver;
|
import org.eclipse.cdt.utils.cdtvariables.CdtVariableResolver;
|
||||||
import org.eclipse.core.resources.IBuildConfiguration;
|
|
||||||
import org.eclipse.core.resources.IContainer;
|
import org.eclipse.core.resources.IContainer;
|
||||||
import org.eclipse.core.resources.IFolder;
|
import org.eclipse.core.resources.IFolder;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.resources.IWorkspaceRoot;
|
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||||
import org.eclipse.core.resources.ResourcesPlugin;
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
import org.eclipse.core.runtime.Adapters;
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
@ -128,17 +126,16 @@ public class PathEntryTranslator {
|
||||||
ICdtVariableManager fMngr = CCorePlugin.getDefault().getCdtVariableManager();
|
ICdtVariableManager fMngr = CCorePlugin.getDefault().getCdtVariableManager();
|
||||||
|
|
||||||
public VarSubstitutor(ICConfigurationDescription cfgDescription) {
|
public VarSubstitutor(ICConfigurationDescription cfgDescription) {
|
||||||
super(new DefaultVariableContextInfo(ICoreVariableContextInfo.CONTEXT_CONFIGURATION,
|
super(new DefaultVariableContextInfo(ICoreVariableContextInfo.CONTEXT_CONFIGURATION, cfgDescription), "", " "); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
cfgDescription), "", " "); //$NON-NLS-1$ //$NON-NLS-2$
|
|
||||||
fCfg = cfgDescription;
|
fCfg = cfgDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ResolvedMacro resolveMacro(ICdtVariable macro) throws CdtVariableException {
|
protected ResolvedMacro resolveMacro(ICdtVariable macro)
|
||||||
|
throws CdtVariableException {
|
||||||
if (!CdtVarPathEntryVariableManager.isPathEntryVariable(macro, fCfg, fMngr))
|
if (!CdtVarPathEntryVariableManager.isPathEntryVariable(macro, fCfg, fMngr))
|
||||||
return super.resolveMacro(macro);
|
return super.resolveMacro(macro);
|
||||||
return new ResolvedMacro(macro.getName(),
|
return new ResolvedMacro(macro.getName(), CdtVariableResolver.createVariableReference(macro.getName()));
|
||||||
CdtVariableResolver.createVariableReference(macro.getName()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,6 +293,7 @@ public class PathEntryTranslator {
|
||||||
}
|
}
|
||||||
return new ICLanguageSettingEntry[0];
|
return new ICLanguageSettingEntry[0];
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,9 +319,10 @@ public class PathEntryTranslator {
|
||||||
case IPathEntry.CDT_LIBRARY:{
|
case IPathEntry.CDT_LIBRARY:{
|
||||||
if (path != null) {
|
if (path != null) {
|
||||||
ILibraryEntry libEntry = (ILibraryEntry)entry.fEntry;
|
ILibraryEntry libEntry = (ILibraryEntry)entry.fEntry;
|
||||||
return (ICLanguageSettingEntry) CDataUtil.createEntry(ICSettingEntry.LIBRARY_FILE, name, null,
|
return (ICLanguageSettingEntry) CDataUtil.createEntry(ICSettingEntry.LIBRARY_FILE, name, null, null, flags,
|
||||||
null, flags, libEntry.getSourceAttachmentPath(),
|
libEntry.getSourceAttachmentPath(),
|
||||||
libEntry.getSourceAttachmentRootPath(), libEntry.getSourceAttachmentPrefixMapping());
|
libEntry.getSourceAttachmentRootPath(),
|
||||||
|
libEntry.getSourceAttachmentPrefixMapping());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -467,8 +466,7 @@ public class PathEntryTranslator {
|
||||||
basePath = mngr.resolvePath(basePath);
|
basePath = mngr.resolvePath(basePath);
|
||||||
valuePath = mngr.resolvePath(valuePath);
|
valuePath = mngr.resolvePath(valuePath);
|
||||||
|
|
||||||
fName = unresolvedBase.isEmpty() ? unresolvedValue.toString()
|
fName = unresolvedBase.isEmpty() ? unresolvedValue.toString() : unresolvedBase.append(unresolvedValue).toString();
|
||||||
: unresolvedBase.append(unresolvedValue).toString();
|
|
||||||
fValue = fName;
|
fValue = fName;
|
||||||
|
|
||||||
if (!basePath.isEmpty()) {
|
if (!basePath.isEmpty()) {
|
||||||
|
@ -490,8 +488,7 @@ public class PathEntryTranslator {
|
||||||
ResourceInfo rcInfo = fResolvedEntry.getResourceInfo();
|
ResourceInfo rcInfo = fResolvedEntry.getResourceInfo();
|
||||||
if (rcInfo.fExists) {
|
if (rcInfo.fExists) {
|
||||||
if (rcInfo.fRc.getType() == IResource.FILE) {
|
if (rcInfo.fRc.getType() == IResource.FILE) {
|
||||||
rcInfo = findResourceInfo(fRoot,
|
rcInfo = findResourceInfo(fRoot, rcInfo.fRc.getFullPath().removeLastSegments(1), true);
|
||||||
rcInfo.fRc.getFullPath().removeLastSegments(1), true);
|
|
||||||
}
|
}
|
||||||
IPath location = rcInfo.fRc.getLocation();
|
IPath location = rcInfo.fRc.getLocation();
|
||||||
if (location != null && rcInfo.fRc.getType() != IResource.FILE) {
|
if (location != null && rcInfo.fRc.getType() != IResource.FILE) {
|
||||||
|
@ -565,8 +562,7 @@ public class PathEntryTranslator {
|
||||||
} else {
|
} else {
|
||||||
fFilterInfos = new ResourceInfo[paths.length];
|
fFilterInfos = new ResourceInfo[paths.length];
|
||||||
for (int i = 0; i < paths.length; i++) {
|
for (int i = 0; i < paths.length; i++) {
|
||||||
fFilterInfos[i] = processInexistingResourceFilter((IContainer) rcInfo.fRc,
|
fFilterInfos[i] = processInexistingResourceFilter((IContainer)rcInfo.fRc, paths[i]);
|
||||||
paths[i]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -598,6 +594,7 @@ public class PathEntryTranslator {
|
||||||
return fResolvedValue;
|
return fResolvedValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class PathEntryComposer {
|
private static class PathEntryComposer {
|
||||||
|
@ -607,10 +604,7 @@ public class PathEntryTranslator {
|
||||||
private boolean fIsExported;
|
private boolean fIsExported;
|
||||||
private IProject fProject;
|
private IProject fProject;
|
||||||
|
|
||||||
PathEntryComposer(IPath path,
|
PathEntryComposer(IPath path, IProject project/*, ICConfigurationDescription cfgDescription*/) {
|
||||||
IProject project/*
|
|
||||||
* , ICConfigurationDescription cfgDescription
|
|
||||||
*/) {
|
|
||||||
fPath = toProjectPath(path);
|
fPath = toProjectPath(path);
|
||||||
fProject = project;
|
fProject = project;
|
||||||
}
|
}
|
||||||
|
@ -622,10 +616,7 @@ public class PathEntryTranslator {
|
||||||
return path.makeAbsolute();
|
return path.makeAbsolute();
|
||||||
}
|
}
|
||||||
|
|
||||||
PathEntryComposer(ICExclusionPatternPathEntry entry,
|
PathEntryComposer(ICExclusionPatternPathEntry entry, IProject project/*, ICConfigurationDescription cfgDescription*/) {
|
||||||
IProject project/*
|
|
||||||
* , ICConfigurationDescription cfgDescription
|
|
||||||
*/) {
|
|
||||||
fPath = new Path(entry.getValue());
|
fPath = new Path(entry.getValue());
|
||||||
fLangEntry = entry;
|
fLangEntry = entry;
|
||||||
fProject = project;
|
fProject = project;
|
||||||
|
@ -636,10 +627,7 @@ public class PathEntryTranslator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PathEntryComposer(IPath path, ICLanguageSettingEntry entry, boolean exported,
|
PathEntryComposer(IPath path, ICLanguageSettingEntry entry, boolean exported, IProject project/*, ICConfigurationDescription cfgDescription*/) {
|
||||||
IProject project/*
|
|
||||||
* , ICConfigurationDescription cfgDescription
|
|
||||||
*/) {
|
|
||||||
fPath = path;
|
fPath = path;
|
||||||
fLangEntry = entry;
|
fLangEntry = entry;
|
||||||
fIsExported = exported;
|
fIsExported = exported;
|
||||||
|
@ -668,12 +656,10 @@ public class PathEntryTranslator {
|
||||||
}
|
}
|
||||||
|
|
||||||
private IPath[][] getEntryPath(ICSettingEntry entry, ICConfigurationDescription cfgDescription) {
|
private IPath[][] getEntryPath(ICSettingEntry entry, ICConfigurationDescription cfgDescription) {
|
||||||
return valueToEntryPath(entry.getName(),
|
return valueToEntryPath(entry.getName(), (entry.getFlags() & ICSettingEntry.VALUE_WORKSPACE_PATH) != 0, cfgDescription);
|
||||||
(entry.getFlags() & ICSettingEntry.VALUE_WORKSPACE_PATH) != 0, cfgDescription);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private IPath[][] valueToEntryPath(String value, boolean isWsp,
|
private IPath[][] valueToEntryPath(String value, boolean isWsp, ICConfigurationDescription cfgDescription) {
|
||||||
ICConfigurationDescription cfgDescription) {
|
|
||||||
String[] pathVarValues = resolveKeepingPathEntryFars(value, cfgDescription);
|
String[] pathVarValues = resolveKeepingPathEntryFars(value, cfgDescription);
|
||||||
IPath result[][] = new IPath[2][pathVarValues.length];
|
IPath result[][] = new IPath[2][pathVarValues.length];
|
||||||
for (int i = 0; i < pathVarValues.length; i++) {
|
for (int i = 0; i < pathVarValues.length; i++) {
|
||||||
|
@ -691,10 +677,8 @@ public class PathEntryTranslator {
|
||||||
if (pathVarPath.segmentCount() != 0) {
|
if (pathVarPath.segmentCount() != 0) {
|
||||||
String resolvedProjName = projName;
|
String resolvedProjName = projName;
|
||||||
String varProjName = pathVarPath.segment(0);
|
String varProjName = pathVarPath.segment(0);
|
||||||
IPath resolvedProjPath = CCorePlugin.getDefault()
|
IPath resolvedProjPath = CCorePlugin.getDefault().getPathEntryVariableManager().resolvePath(new Path(varProjName));
|
||||||
.getPathEntryVariableManager().resolvePath(new Path(varProjName));
|
if (resolvedProjPath.segmentCount() == 1 && resolvedProjName.equals(resolvedProjPath.segment(0))) {
|
||||||
if (resolvedProjPath.segmentCount() == 1
|
|
||||||
&& resolvedProjName.equals(resolvedProjPath.segment(0))) {
|
|
||||||
projName = varProjName;
|
projName = varProjName;
|
||||||
valuePath = pathVarPath.removeFirstSegments(1).makeRelative();
|
valuePath = pathVarPath.removeFirstSegments(1).makeRelative();
|
||||||
}
|
}
|
||||||
|
@ -728,8 +712,7 @@ public class PathEntryTranslator {
|
||||||
IPath paths[][] = getEntryPath(fLangEntry, cfgDescription);
|
IPath paths[][] = getEntryPath(fLangEntry, cfgDescription);
|
||||||
result = new IPathEntry[paths[0].length];
|
result = new IPathEntry[paths[0].length];
|
||||||
for (int i = 0; i < result.length; i++)
|
for (int i = 0; i < result.length; i++)
|
||||||
result[i] = CoreModel.newIncludeFileEntry(path, null, paths[0][i], paths[1][i],
|
result[i] = CoreModel.newIncludeFileEntry(path, null, paths[0][i], paths[1][i], getExclusionPatterns(), fIsExported);
|
||||||
getExclusionPatterns(), fIsExported);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
case ICSettingEntry.INCLUDE_PATH:{
|
case ICSettingEntry.INCLUDE_PATH:{
|
||||||
|
@ -738,21 +721,18 @@ public class PathEntryTranslator {
|
||||||
|
|
||||||
result = new IPathEntry[paths[0].length];
|
result = new IPathEntry[paths[0].length];
|
||||||
for (int i = 0; i < result.length; i++)
|
for (int i = 0; i < result.length; i++)
|
||||||
result[i] = CoreModel.newIncludeEntry(path, paths[0][i], paths[1][i], !ipe.isLocal(),
|
result[i] = CoreModel.newIncludeEntry(path, paths[0][i], paths[1][i], !ipe.isLocal(), getExclusionPatterns(), fIsExported);
|
||||||
getExclusionPatterns(), fIsExported);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
case ICSettingEntry.MACRO:
|
case ICSettingEntry.MACRO:
|
||||||
result = new IPathEntry[1];
|
result = new IPathEntry[1];
|
||||||
result[0] = CoreModel.newMacroEntry(path, fLangEntry.getName(), fLangEntry.getValue(),
|
result[0] = CoreModel.newMacroEntry(path, fLangEntry.getName(), fLangEntry.getValue(), getExclusionPatterns(), fIsExported);
|
||||||
getExclusionPatterns(), fIsExported);
|
|
||||||
return result;
|
return result;
|
||||||
case ICSettingEntry.MACRO_FILE:{
|
case ICSettingEntry.MACRO_FILE:{
|
||||||
IPath paths[][] = getEntryPath(fLangEntry, cfgDescription);
|
IPath paths[][] = getEntryPath(fLangEntry, cfgDescription);
|
||||||
result = new IPathEntry[paths[0].length];
|
result = new IPathEntry[paths[0].length];
|
||||||
for (int i = 0; i < result.length; i++)
|
for (int i = 0; i < result.length; i++)
|
||||||
result[i] = CoreModel.newMacroFileEntry(path, paths[0][i], null, paths[1][i],
|
result[i] = CoreModel.newMacroFileEntry(path, paths[0][i], null, paths[1][i], getExclusionPatterns(), fIsExported);
|
||||||
getExclusionPatterns(), fIsExported);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
case ICSettingEntry.LIBRARY_PATH:
|
case ICSettingEntry.LIBRARY_PATH:
|
||||||
|
@ -764,8 +744,7 @@ public class PathEntryTranslator {
|
||||||
// IPath paths[][] = getEntryPath(fLangEntry, cfgDescription);
|
// IPath paths[][] = getEntryPath(fLangEntry, cfgDescription);
|
||||||
// result = new IPathEntry[paths[0].length];
|
// result = new IPathEntry[paths[0].length];
|
||||||
// for (int i = 0; i < result.length; i++)
|
// for (int i = 0; i < result.length; i++)
|
||||||
// result[i] = CoreModel.newLibraryEntry(path, paths[0][i],
|
// result[i] = CoreModel.newLibraryEntry(path, paths[0][i], paths[1][i], null, null, null, fIsExported);
|
||||||
// paths[1][i], null, null, null, fIsExported);
|
|
||||||
// return result;
|
// return result;
|
||||||
// }
|
// }
|
||||||
case ICSettingEntry.OUTPUT_PATH:
|
case ICSettingEntry.OUTPUT_PATH:
|
||||||
|
@ -790,16 +769,14 @@ public class PathEntryTranslator {
|
||||||
|
|
||||||
private static String resolveAll(String value, ICConfigurationDescription cfgDescription) {
|
private static String resolveAll(String value, ICConfigurationDescription cfgDescription) {
|
||||||
try {
|
try {
|
||||||
return CCorePlugin.getDefault().getCdtVariableManager().resolveValue(value, "", " ", //$NON-NLS-1$ //$NON-NLS-2$
|
return CCorePlugin.getDefault().getCdtVariableManager().resolveValue(value, "", " ", cfgDescription); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
cfgDescription);
|
|
||||||
} catch (CdtVariableException e) {
|
} catch (CdtVariableException e) {
|
||||||
CCorePlugin.log(e);
|
CCorePlugin.log(e);
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String[] resolveKeepingPathEntryFars(String value,
|
private static String[] resolveKeepingPathEntryFars(String value, ICConfigurationDescription cfgDescription) {
|
||||||
ICConfigurationDescription cfgDescription) {
|
|
||||||
String[] result = new String[] { value }; // default value;
|
String[] result = new String[] { value }; // default value;
|
||||||
try {
|
try {
|
||||||
VarSubstitutor substitutor = new VarSubstitutor(cfgDescription);
|
VarSubstitutor substitutor = new VarSubstitutor(cfgDescription);
|
||||||
|
@ -820,10 +797,7 @@ public class PathEntryTranslator {
|
||||||
private LinkedHashMap<IPath, PathEntryComposer> fRefProjMap;
|
private LinkedHashMap<IPath, PathEntryComposer> fRefProjMap;
|
||||||
private IProject fProject;
|
private IProject fProject;
|
||||||
|
|
||||||
private PathEntryCollector(
|
private PathEntryCollector(IProject project/*, ICConfigurationDescription cfgDescription*/) {
|
||||||
IProject project/*
|
|
||||||
* , ICConfigurationDescription cfgDescription
|
|
||||||
*/) {
|
|
||||||
fStorage = PathSettingsContainer.createRootContainer();
|
fStorage = PathSettingsContainer.createRootContainer();
|
||||||
fStorage.setValue(this);
|
fStorage.setValue(this);
|
||||||
fStore = new KindBasedStore<LinkedHashMap<ICSettingEntry, PathEntryComposer>>(false);
|
fStore = new KindBasedStore<LinkedHashMap<ICSettingEntry, PathEntryComposer>>(false);
|
||||||
|
@ -831,11 +805,7 @@ public class PathEntryTranslator {
|
||||||
fProject = project;
|
fProject = project;
|
||||||
}
|
}
|
||||||
|
|
||||||
private PathEntryCollector(PathSettingsContainer container,
|
private PathEntryCollector(PathSettingsContainer container, KindBasedStore<LinkedHashMap<ICSettingEntry, PathEntryComposer>> store, IProject project/*, ICConfigurationDescription cfgDescription*/) {
|
||||||
KindBasedStore<LinkedHashMap<ICSettingEntry, PathEntryComposer>> store,
|
|
||||||
IProject project/*
|
|
||||||
* , ICConfigurationDescription cfgDescription
|
|
||||||
*/) {
|
|
||||||
fStorage = container;
|
fStorage = container;
|
||||||
fStore = store;
|
fStore = store;
|
||||||
fNameKeyMapStore = new KindBasedStore<LinkedHashMap<EntryNameKey, PathEntryComposer>>(false);
|
fNameKeyMapStore = new KindBasedStore<LinkedHashMap<EntryNameKey, PathEntryComposer>>(false);
|
||||||
|
@ -851,7 +821,8 @@ public class PathEntryTranslator {
|
||||||
PathEntryComposer old = nameKeyMap.get(nameKey);
|
PathEntryComposer old = nameKeyMap.get(nameKey);
|
||||||
if (old != null) {
|
if (old != null) {
|
||||||
entry = CDataUtil.addRemoveExclusionsToEntry(entry,
|
entry = CDataUtil.addRemoveExclusionsToEntry(entry,
|
||||||
((ICExclusionPatternPathEntry) old.fLangEntry).getExclusionPatterns(), true);
|
((ICExclusionPatternPathEntry)old.fLangEntry).getExclusionPatterns(),
|
||||||
|
true);
|
||||||
}
|
}
|
||||||
PathEntryComposer newComposer = new PathEntryComposer(entry, fProject/*, fCfg*/);
|
PathEntryComposer newComposer = new PathEntryComposer(entry, fProject/*, fCfg*/);
|
||||||
map.put(entry, newComposer);
|
map.put(entry, newComposer);
|
||||||
|
@ -865,8 +836,7 @@ public class PathEntryTranslator {
|
||||||
} else {
|
} else {
|
||||||
fRefProjMap = new LinkedHashMap<IPath, PathEntryComposer>();
|
fRefProjMap = new LinkedHashMap<IPath, PathEntryComposer>();
|
||||||
for (IPath path : paths) {
|
for (IPath path : paths) {
|
||||||
PathEntryComposer cs = new PathEntryComposer(path,
|
PathEntryComposer cs = new PathEntryComposer(path, fProject/*, fCfg*/);
|
||||||
fProject/* , fCfg */);
|
|
||||||
IPath composerPath = cs.getPath();
|
IPath composerPath = cs.getPath();
|
||||||
fRefProjMap.put(composerPath, cs);
|
fRefProjMap.put(composerPath, cs);
|
||||||
}
|
}
|
||||||
|
@ -877,8 +847,7 @@ public class PathEntryTranslator {
|
||||||
if (path.segmentCount() == 0)
|
if (path.segmentCount() == 0)
|
||||||
return this;
|
return this;
|
||||||
|
|
||||||
PathEntryCollector cr = (PathEntryCollector) fStorage.getChildContainer(path, false, false)
|
PathEntryCollector cr = (PathEntryCollector)fStorage.getChildContainer(path, false, false).getValue();
|
||||||
.getValue();
|
|
||||||
if (cr != this) {
|
if (cr != this) {
|
||||||
IPath basePath = cr.getPath();
|
IPath basePath = cr.getPath();
|
||||||
path = path.removeFirstSegments(basePath.segmentCount());
|
path = path.removeFirstSegments(basePath.segmentCount());
|
||||||
|
@ -887,21 +856,18 @@ public class PathEntryTranslator {
|
||||||
|
|
||||||
PathSettingsContainer newContainer = fStorage.getChildContainer(path, true, true);
|
PathSettingsContainer newContainer = fStorage.getChildContainer(path, true, true);
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
KindBasedStore<LinkedHashMap<ICSettingEntry, PathEntryComposer>> cloneStore = (KindBasedStore<LinkedHashMap<ICSettingEntry, PathEntryComposer>>) fStore
|
KindBasedStore<LinkedHashMap<ICSettingEntry, PathEntryComposer>> cloneStore =
|
||||||
.clone();
|
(KindBasedStore<LinkedHashMap<ICSettingEntry, PathEntryComposer>>)fStore.clone();
|
||||||
IKindBasedInfo<LinkedHashMap<ICSettingEntry, PathEntryComposer>> info[] = cloneStore
|
IKindBasedInfo<LinkedHashMap<ICSettingEntry, PathEntryComposer>> info[] = cloneStore.getContents();
|
||||||
.getContents();
|
|
||||||
for (IKindBasedInfo<LinkedHashMap<ICSettingEntry, PathEntryComposer>> kindInfo : info) {
|
for (IKindBasedInfo<LinkedHashMap<ICSettingEntry, PathEntryComposer>> kindInfo : info) {
|
||||||
LinkedHashMap<ICSettingEntry, PathEntryComposer> map = kindInfo.getInfo();
|
LinkedHashMap<ICSettingEntry, PathEntryComposer> map = kindInfo.getInfo();
|
||||||
if (map != null) {
|
if (map != null) {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
LinkedHashMap<ICSettingEntry, PathEntryComposer> clone = (LinkedHashMap<ICSettingEntry, PathEntryComposer>) map
|
LinkedHashMap<ICSettingEntry, PathEntryComposer> clone = (LinkedHashMap<ICSettingEntry, PathEntryComposer>)map.clone();
|
||||||
.clone();
|
|
||||||
kindInfo.setInfo(clone);
|
kindInfo.setInfo(clone);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PathEntryCollector newCr = new PathEntryCollector(newContainer, cloneStore,
|
PathEntryCollector newCr = new PathEntryCollector(newContainer, cloneStore, fProject/*, fCfg*/);
|
||||||
fProject/* , fCfg */);
|
|
||||||
newContainer.setValue(newCr);
|
newContainer.setValue(newCr);
|
||||||
return newCr;
|
return newCr;
|
||||||
}
|
}
|
||||||
|
@ -910,17 +876,16 @@ public class PathEntryTranslator {
|
||||||
return fStorage.getPath();
|
return fStorage.getPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEntries(int kind, ICLanguageSettingEntry entries[],
|
public void setEntries(int kind, ICLanguageSettingEntry entries[], Set<ICSettingEntry> exportedEntries) {
|
||||||
Set<ICSettingEntry> exportedEntries) {
|
|
||||||
IPath path = getPath();
|
IPath path = getPath();
|
||||||
HashSet<ICSettingEntry> parentSet = getEntriesSetCopy(kind);
|
HashSet<ICSettingEntry> parentSet = getEntriesSetCopy(kind);
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
HashSet<ICSettingEntry> removedParentSet = (HashSet<ICSettingEntry>)parentSet.clone();
|
HashSet<ICSettingEntry> removedParentSet = (HashSet<ICSettingEntry>)parentSet.clone();
|
||||||
HashSet<ICLanguageSettingEntry> addedThisSet = new HashSet<ICLanguageSettingEntry>(
|
HashSet<ICLanguageSettingEntry> addedThisSet = new HashSet<ICLanguageSettingEntry>(Arrays.asList(entries));
|
||||||
Arrays.asList(entries));
|
|
||||||
removedParentSet.removeAll(addedThisSet);
|
removedParentSet.removeAll(addedThisSet);
|
||||||
addedThisSet.removeAll(parentSet);
|
addedThisSet.removeAll(parentSet);
|
||||||
|
|
||||||
|
|
||||||
if (removedParentSet.size() != 0) {
|
if (removedParentSet.size() != 0) {
|
||||||
PathEntryCollector parent = getParent();
|
PathEntryCollector parent = getParent();
|
||||||
IPath parentPath = parent.getPath();
|
IPath parentPath = parent.getPath();
|
||||||
|
@ -949,8 +914,7 @@ public class PathEntryTranslator {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ICLanguageSettingEntry entry = entries[i];
|
ICLanguageSettingEntry entry = entries[i];
|
||||||
map.put(entry, new PathEntryComposer(fullPath, entry, exportedEntries.contains(entry),
|
map.put(entry, new PathEntryComposer(fullPath, entry, exportedEntries.contains(entry), fProject/*, fCfg*/));
|
||||||
fProject/* , fCfg */));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -964,8 +928,7 @@ public class PathEntryTranslator {
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
private LinkedHashMap<EntryNameKey, PathEntryComposer> getEntriesNameKeyMap(int kind,
|
private LinkedHashMap<EntryNameKey, PathEntryComposer> getEntriesNameKeyMap(int kind, boolean create) {
|
||||||
boolean create) {
|
|
||||||
LinkedHashMap<EntryNameKey, PathEntryComposer> map = fNameKeyMapStore.get(kind);
|
LinkedHashMap<EntryNameKey, PathEntryComposer> map = fNameKeyMapStore.get(kind);
|
||||||
if (map == null && create) {
|
if (map == null && create) {
|
||||||
map = new LinkedHashMap<EntryNameKey, PathEntryComposer>();
|
map = new LinkedHashMap<EntryNameKey, PathEntryComposer>();
|
||||||
|
@ -1017,8 +980,7 @@ public class PathEntryTranslator {
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getLocalCollectedEntries(int kind, List<PathEntryComposer> list,
|
private void getLocalCollectedEntries(int kind, List<PathEntryComposer> list, Set<PathEntryComposer> addedEntries) {
|
||||||
Set<PathEntryComposer> addedEntries) {
|
|
||||||
Map<ICSettingEntry, PathEntryComposer> map = getEntriesMap(kind, false);
|
Map<ICSettingEntry, PathEntryComposer> map = getEntriesMap(kind, false);
|
||||||
if (map == null)
|
if (map == null)
|
||||||
return;
|
return;
|
||||||
|
@ -1030,8 +992,7 @@ public class PathEntryTranslator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<IPathEntry> getEntries(int peKind, List<IPathEntry> list, int flags,
|
public List<IPathEntry> getEntries(int peKind, List<IPathEntry> list, int flags, ICConfigurationDescription cfgDescription) {
|
||||||
ICConfigurationDescription cfgDescription) {
|
|
||||||
Set<IPathEntry> set = new LinkedHashSet<IPathEntry>();
|
Set<IPathEntry> set = new LinkedHashSet<IPathEntry>();
|
||||||
|
|
||||||
int sKind = peKindToSettingKind(peKind);
|
int sKind = peKindToSettingKind(peKind);
|
||||||
|
@ -1098,8 +1059,7 @@ public class PathEntryTranslator {
|
||||||
return entry != null && (entry.isBuiltIn() || entry.isReadOnly());
|
return entry != null && (entry.isBuiltIn() || entry.isReadOnly());
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<IPathEntry> getEntries(List<IPathEntry> list, int flags,
|
public List<IPathEntry> getEntries(List<IPathEntry> list, int flags, ICConfigurationDescription cfgDescription) {
|
||||||
ICConfigurationDescription cfgDescription) {
|
|
||||||
if (list == null)
|
if (list == null)
|
||||||
list = new ArrayList<IPathEntry>();
|
list = new ArrayList<IPathEntry>();
|
||||||
int peKinds[] = PathEntryKyndStore.getSupportedKinds();
|
int peKinds[] = PathEntryKyndStore.getSupportedKinds();
|
||||||
|
@ -1125,6 +1085,7 @@ public class PathEntryTranslator {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static boolean areEntriesReadOnly(PathEntryResolveInfoElement el) {
|
private static boolean areEntriesReadOnly(PathEntryResolveInfoElement el) {
|
||||||
switch (el.getRawEntry().getEntryKind()) {
|
switch (el.getRawEntry().getEntryKind()) {
|
||||||
case IPathEntry.CDT_LIBRARY:
|
case IPathEntry.CDT_LIBRARY:
|
||||||
|
@ -1141,6 +1102,7 @@ public class PathEntryTranslator {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private IPath getEntryFullPath(IPathEntry entry) {
|
private IPath getEntryFullPath(IPathEntry entry) {
|
||||||
IPath path = entry.getPath();
|
IPath path = entry.getPath();
|
||||||
if (path == null)
|
if (path == null)
|
||||||
|
@ -1257,8 +1219,7 @@ public class PathEntryTranslator {
|
||||||
ICExternalSetting extSettings[];
|
ICExternalSetting extSettings[];
|
||||||
if (exportSettingsList.size() != 0) {
|
if (exportSettingsList.size() != 0) {
|
||||||
extSettings = new ICExternalSetting[1];
|
extSettings = new ICExternalSetting[1];
|
||||||
List<ICLanguageSettingEntry> list = new ArrayList<ICLanguageSettingEntry>(
|
List<ICLanguageSettingEntry> list = new ArrayList<ICLanguageSettingEntry>(exportSettingsList.size());
|
||||||
exportSettingsList.size());
|
|
||||||
for (int i = 0; i < exportSettingsList.size(); i++) {
|
for (int i = 0; i < exportSettingsList.size(); i++) {
|
||||||
ResolvedEntry re = exportSettingsList.get(i);
|
ResolvedEntry re = exportSettingsList.get(i);
|
||||||
ICLanguageSettingEntry le = createLangEntry(re);
|
ICLanguageSettingEntry le = createLangEntry(re);
|
||||||
|
@ -1290,11 +1251,13 @@ public class PathEntryTranslator {
|
||||||
return entries;
|
return entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static ICSourceEntry toCSourceEntry(ISourceEntry entry, boolean makeProjRelative) {
|
private static ICSourceEntry toCSourceEntry(ISourceEntry entry, boolean makeProjRelative) {
|
||||||
IPath path = entry.getPath();
|
IPath path = entry.getPath();
|
||||||
if (makeProjRelative && path.isAbsolute())
|
if (makeProjRelative && path.isAbsolute())
|
||||||
path = path.removeFirstSegments(1);
|
path = path.removeFirstSegments(1);
|
||||||
return new CSourceEntry(path, entry.getExclusionPatterns(),
|
return new CSourceEntry(path,
|
||||||
|
entry.getExclusionPatterns(),
|
||||||
ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED);
|
ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1302,12 +1265,12 @@ public class PathEntryTranslator {
|
||||||
IPath path = entry.getPath();
|
IPath path = entry.getPath();
|
||||||
if (makeProjRelative && path.isAbsolute())
|
if (makeProjRelative && path.isAbsolute())
|
||||||
path = path.removeFirstSegments(1);
|
path = path.removeFirstSegments(1);
|
||||||
return new COutputEntry(path, entry.getExclusionPatterns(),
|
return new COutputEntry(path,
|
||||||
|
entry.getExclusionPatterns(),
|
||||||
ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED);
|
ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ICSettingEntry[] replaceUserEntries(ICSettingEntry[] oldEntries,
|
private static ICSettingEntry[] replaceUserEntries(ICSettingEntry[] oldEntries, ICSettingEntry[] newUsrEntries) {
|
||||||
ICSettingEntry[] newUsrEntries) {
|
|
||||||
Set<ICSettingEntry> set = new LinkedHashSet<ICSettingEntry>();
|
Set<ICSettingEntry> set = new LinkedHashSet<ICSettingEntry>();
|
||||||
Class<?> componentType = null;
|
Class<?> componentType = null;
|
||||||
|
|
||||||
|
@ -1444,8 +1407,7 @@ public class PathEntryTranslator {
|
||||||
return list.toArray(new CResourceData[list.size()]);
|
return list.toArray(new CResourceData[list.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private CResourceData getResourceData(IPath path, boolean create, boolean exactPath)
|
private CResourceData getResourceData(IPath path, boolean create, boolean exactPath) throws CoreException{
|
||||||
throws CoreException {
|
|
||||||
PathSettingsContainer rcDataH = fRcDataHolder.getChildContainer(path, false, exactPath);
|
PathSettingsContainer rcDataH = fRcDataHolder.getChildContainer(path, false, exactPath);
|
||||||
if (rcDataH != null) {
|
if (rcDataH != null) {
|
||||||
return (CResourceData)rcDataH.getValue();
|
return (CResourceData)rcDataH.getValue();
|
||||||
|
@ -1460,8 +1422,7 @@ public class PathEntryTranslator {
|
||||||
} else {
|
} else {
|
||||||
CFolderData folderData = (CFolderData)base;
|
CFolderData folderData = (CFolderData)base;
|
||||||
CLanguageData lDatas[] = folderData.getLanguageDatas();
|
CLanguageData lDatas[] = folderData.getLanguageDatas();
|
||||||
CLanguageData baseLData = CDataUtil
|
CLanguageData baseLData = CDataUtil.findLanguagDataForFile(rcInfo.fRc.getFullPath().lastSegment(), fProject, lDatas);
|
||||||
.findLanguagDataForFile(rcInfo.fRc.getFullPath().lastSegment(), fProject, lDatas);
|
|
||||||
newRcData = fCfgData.createFileData(path, folderData, baseLData);
|
newRcData = fCfgData.createFileData(path, folderData, baseLData);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1479,9 +1440,9 @@ public class PathEntryTranslator {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyEntries(CResourceData rcData, RcDesInfo info, int op) {
|
private void applyEntries(CResourceData rcData, RcDesInfo info, int op) {
|
||||||
CLanguageData lDatas[] = rcData.getType() == ICSettingBase.SETTING_FILE
|
CLanguageData lDatas[] = rcData.getType() == ICSettingBase.SETTING_FILE ?
|
||||||
? new CLanguageData[] { ((CFileData) rcData).getLanguageData() }
|
new CLanguageData[] { ((CFileData)rcData).getLanguageData() } :
|
||||||
: ((CFolderData) rcData).getLanguageDatas();
|
((CFolderData) rcData).getLanguageDatas();
|
||||||
|
|
||||||
for (CLanguageData lData : lDatas) {
|
for (CLanguageData lData : lDatas) {
|
||||||
if (lData == null)
|
if (lData == null)
|
||||||
|
@ -1491,6 +1452,7 @@ public class PathEntryTranslator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void applyEntries(CLanguageData lData, RcDesInfo info, int op) {
|
private void applyEntries(CLanguageData lData, RcDesInfo info, int op) {
|
||||||
int kinds[] = KindBasedStore.getLanguageEntryKinds();
|
int kinds[] = KindBasedStore.getLanguageEntryKinds();
|
||||||
int supported = lData.getSupportedEntryKinds();
|
int supported = lData.getSupportedEntryKinds();
|
||||||
|
@ -1510,14 +1472,13 @@ public class PathEntryTranslator {
|
||||||
}
|
}
|
||||||
|
|
||||||
private ICLanguageSettingEntry[] composeNewEntries(ICLanguageSettingEntry oldEntries[],
|
private ICLanguageSettingEntry[] composeNewEntries(ICLanguageSettingEntry oldEntries[],
|
||||||
ICLanguageSettingEntry newEntries[], int op) {
|
ICLanguageSettingEntry newEntries[],
|
||||||
|
int op) {
|
||||||
ICLanguageSettingEntry result[];
|
ICLanguageSettingEntry result[];
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case OP_ADD:{
|
case OP_ADD:{
|
||||||
Set<ICLanguageSettingEntry> oldSet = new HashSet<ICLanguageSettingEntry>(
|
Set<ICLanguageSettingEntry> oldSet = new HashSet<ICLanguageSettingEntry>(Arrays.asList(oldEntries));
|
||||||
Arrays.asList(oldEntries));
|
Set<ICLanguageSettingEntry> newSet = new HashSet<ICLanguageSettingEntry>(Arrays.asList(newEntries));
|
||||||
Set<ICLanguageSettingEntry> newSet = new HashSet<ICLanguageSettingEntry>(
|
|
||||||
Arrays.asList(newEntries));
|
|
||||||
newSet.removeAll(oldSet);
|
newSet.removeAll(oldSet);
|
||||||
if (newSet.size() == 0) {
|
if (newSet.size() == 0) {
|
||||||
result = oldEntries;
|
result = oldEntries;
|
||||||
|
@ -1529,10 +1490,8 @@ public class PathEntryTranslator {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case OP_REMOVE:{
|
case OP_REMOVE:{
|
||||||
Set<ICLanguageSettingEntry> oldSet = new HashSet<ICLanguageSettingEntry>(
|
Set<ICLanguageSettingEntry> oldSet = new HashSet<ICLanguageSettingEntry>(Arrays.asList(oldEntries));
|
||||||
Arrays.asList(oldEntries));
|
Set<ICLanguageSettingEntry> newSet = new HashSet<ICLanguageSettingEntry>(Arrays.asList(newEntries));
|
||||||
Set<ICLanguageSettingEntry> newSet = new HashSet<ICLanguageSettingEntry>(
|
|
||||||
Arrays.asList(newEntries));
|
|
||||||
oldSet.removeAll(newSet);
|
oldSet.removeAll(newSet);
|
||||||
if (oldSet.size() == 0) {
|
if (oldSet.size() == 0) {
|
||||||
result = new ICLanguageSettingEntry[0];
|
result = new ICLanguageSettingEntry[0];
|
||||||
|
@ -1561,8 +1520,7 @@ public class PathEntryTranslator {
|
||||||
RcDesInfo rcDes = (RcDesInfo)cr.getValue();
|
RcDesInfo rcDes = (RcDesInfo)cr.getValue();
|
||||||
if (rcDes != null) {
|
if (rcDes != null) {
|
||||||
List<ResolvedEntry> rEntries = rcDes.fResolvedEntries;
|
List<ResolvedEntry> rEntries = rcDes.fResolvedEntries;
|
||||||
List<LangEntryInfo> curLanfInfos = new ArrayList<LangEntryInfo>(
|
List<LangEntryInfo> curLanfInfos = new ArrayList<LangEntryInfo>(rEntries.size() + langEntryInfoList.size());
|
||||||
rEntries.size() + langEntryInfoList.size());
|
|
||||||
for (ResolvedEntry re : rEntries) {
|
for (ResolvedEntry re : rEntries) {
|
||||||
LangEntryInfo li = createLangEntryInfo(re);
|
LangEntryInfo li = createLangEntryInfo(re);
|
||||||
if (li != null) {
|
if (li != null) {
|
||||||
|
@ -1692,6 +1650,7 @@ public class PathEntryTranslator {
|
||||||
return new ResolvedEntry(entry, el);
|
return new ResolvedEntry(entry, el);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private ResolvedEntry[] getResolvedEntries(IPathEntry[] usrEntries, IPathEntry[] sysEntries) {
|
private ResolvedEntry[] getResolvedEntries(IPathEntry[] usrEntries, IPathEntry[] sysEntries) {
|
||||||
int length = usrEntries != null ? usrEntries.length : 0;
|
int length = usrEntries != null ? usrEntries.length : 0;
|
||||||
if (sysEntries != null)
|
if (sysEntries != null)
|
||||||
|
@ -1719,8 +1678,7 @@ public class PathEntryTranslator {
|
||||||
ResourceInfo[] baseInfos = (ResourceInfo[])cr.getValue();
|
ResourceInfo[] baseInfos = (ResourceInfo[])cr.getValue();
|
||||||
ResourceInfo[] result;
|
ResourceInfo[] result;
|
||||||
if (!baseInfos[0].fExists) {
|
if (!baseInfos[0].fExists) {
|
||||||
// resource does not exist, always create new rc info and not add it
|
// resource does not exist, always create new rc info and not add it to map
|
||||||
// to map
|
|
||||||
ResourceInfo inexistent = new ResourceInfo(container.getFolder(path), false);
|
ResourceInfo inexistent = new ResourceInfo(container.getFolder(path), false);
|
||||||
result = new ResourceInfo[]{inexistent};
|
result = new ResourceInfo[]{inexistent};
|
||||||
} else {
|
} else {
|
||||||
|
@ -1944,18 +1902,18 @@ public class PathEntryTranslator {
|
||||||
case IPathEntry.CDT_LIBRARY: {
|
case IPathEntry.CDT_LIBRARY: {
|
||||||
IPath libraryPath = new Path(getAttribute(element, ATTRIBUTE_LIBRARY));
|
IPath libraryPath = new Path(getAttribute(element, ATTRIBUTE_LIBRARY));
|
||||||
// source attachment info (optional)
|
// source attachment info (optional)
|
||||||
IPath sourceAttachmentPath = element.getAttribute(ATTRIBUTE_SOURCEPATH) != null
|
IPath sourceAttachmentPath = element.getAttribute(ATTRIBUTE_SOURCEPATH) != null ? new Path(
|
||||||
? new Path(element.getAttribute(ATTRIBUTE_SOURCEPATH)) : null;
|
element.getAttribute(ATTRIBUTE_SOURCEPATH)) : null;
|
||||||
IPath sourceAttachmentRootPath = element.getAttribute(ATTRIBUTE_ROOTPATH) != null
|
IPath sourceAttachmentRootPath = element.getAttribute(ATTRIBUTE_ROOTPATH) != null ? new Path(
|
||||||
? new Path(element.getAttribute(ATTRIBUTE_ROOTPATH)) : null;
|
element.getAttribute(ATTRIBUTE_ROOTPATH)) : null;
|
||||||
IPath sourceAttachmentPrefixMapping = element.getAttribute(ATTRIBUTE_PREFIXMAPPING) != null
|
IPath sourceAttachmentPrefixMapping = element.getAttribute(ATTRIBUTE_PREFIXMAPPING) != null ? new Path(
|
||||||
? new Path(element.getAttribute(ATTRIBUTE_PREFIXMAPPING)) : null;
|
element.getAttribute(ATTRIBUTE_PREFIXMAPPING)) : null;
|
||||||
|
|
||||||
if (!baseRef.isEmpty()) {
|
if (!baseRef.isEmpty()) {
|
||||||
return CoreModel.newLibraryRefEntry(path, baseRef, libraryPath);
|
return CoreModel.newLibraryRefEntry(path, baseRef, libraryPath);
|
||||||
}
|
}
|
||||||
return CoreModel.newLibraryEntry(path, basePath, libraryPath, sourceAttachmentPath,
|
return CoreModel.newLibraryEntry(path, basePath, libraryPath, sourceAttachmentPath, sourceAttachmentRootPath,
|
||||||
sourceAttachmentRootPath, sourceAttachmentPrefixMapping, isExported);
|
sourceAttachmentPrefixMapping, isExported);
|
||||||
}
|
}
|
||||||
case IPathEntry.CDT_SOURCE: {
|
case IPathEntry.CDT_SOURCE: {
|
||||||
// must be an entry in this project or specify another
|
// must be an entry in this project or specify another
|
||||||
|
@ -1981,14 +1939,12 @@ public class PathEntryTranslator {
|
||||||
if (!baseRef.isEmpty()) {
|
if (!baseRef.isEmpty()) {
|
||||||
return CoreModel.newIncludeRefEntry(path, baseRef, includePath);
|
return CoreModel.newIncludeRefEntry(path, baseRef, includePath);
|
||||||
}
|
}
|
||||||
return CoreModel.newIncludeEntry(path, basePath, includePath, isSystemInclude, exclusionPatterns,
|
return CoreModel.newIncludeEntry(path, basePath, includePath, isSystemInclude, exclusionPatterns, isExported);
|
||||||
isExported);
|
|
||||||
}
|
}
|
||||||
case IPathEntry.CDT_INCLUDE_FILE: {
|
case IPathEntry.CDT_INCLUDE_FILE: {
|
||||||
// include path info
|
// include path info
|
||||||
IPath includeFilePath = new Path(getAttribute(element, ATTRIBUTE_INCLUDE_FILE));
|
IPath includeFilePath = new Path(getAttribute(element, ATTRIBUTE_INCLUDE_FILE));
|
||||||
return CoreModel.newIncludeFileEntry(path, basePath, baseRef, includeFilePath, exclusionPatterns,
|
return CoreModel.newIncludeFileEntry(path, basePath, baseRef, includeFilePath, exclusionPatterns, isExported);
|
||||||
isExported);
|
|
||||||
}
|
}
|
||||||
case IPathEntry.CDT_MACRO: {
|
case IPathEntry.CDT_MACRO: {
|
||||||
String macroName = getAttribute(element, ATTRIBUTE_NAME);
|
String macroName = getAttribute(element, ATTRIBUTE_NAME);
|
||||||
|
@ -2000,24 +1956,22 @@ public class PathEntryTranslator {
|
||||||
}
|
}
|
||||||
case IPathEntry.CDT_MACRO_FILE: {
|
case IPathEntry.CDT_MACRO_FILE: {
|
||||||
IPath macroFilePath = new Path(getAttribute(element, ATTRIBUTE_MACRO_FILE));
|
IPath macroFilePath = new Path(getAttribute(element, ATTRIBUTE_MACRO_FILE));
|
||||||
return CoreModel.newMacroFileEntry(path, basePath, baseRef, macroFilePath, exclusionPatterns,
|
return CoreModel.newMacroFileEntry(path, basePath, baseRef, macroFilePath, exclusionPatterns, isExported);
|
||||||
isExported);
|
|
||||||
}
|
}
|
||||||
case IPathEntry.CDT_CONTAINER: {
|
case IPathEntry.CDT_CONTAINER: {
|
||||||
IPath id = new Path(getAttribute(element, ATTRIBUTE_PATH));
|
IPath id = new Path(getAttribute(element, ATTRIBUTE_PATH));
|
||||||
return CoreModel.newContainerEntry(id, isExported);
|
return CoreModel.newContainerEntry(id, isExported);
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
ICModelStatus status = new CModelStatus(IStatus.ERROR,
|
ICModelStatus status = new CModelStatus(IStatus.ERROR, "PathEntry: unknown kind (" + kindAttr + ")"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
"PathEntry: unknown kind (" + kindAttr + ")"); //$NON-NLS-1$ //$NON-NLS-2$
|
|
||||||
throw new CModelException(status);
|
throw new CModelException(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static CConfigurationData getCfgData(ICConfigurationDescription cfgDescription) {
|
private static CConfigurationData getCfgData(ICConfigurationDescription cfgDescription) {
|
||||||
return cfgDescription instanceof CConfigurationDescriptionCache ? (CConfigurationData) cfgDescription
|
return cfgDescription instanceof CConfigurationDescriptionCache ?
|
||||||
: ((IInternalCCfgInfo) cfgDescription).getConfigurationData(false);
|
(CConfigurationData)cfgDescription : ((IInternalCCfgInfo)cfgDescription).getConfigurationData(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void addOutputEntries(PathEntryCollector cr, CConfigurationData cfgData) {
|
private static void addOutputEntries(PathEntryCollector cr, CConfigurationData cfgData) {
|
||||||
|
@ -2030,22 +1984,20 @@ public class PathEntryTranslator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PathEntryCollector collectEntries(IProject project,
|
public static PathEntryCollector collectEntries(IProject project, final ICConfigurationDescription cfgDescription) {
|
||||||
final ICConfigurationDescription cfgDescription) {
|
|
||||||
CConfigurationData cfgData = getCfgData(cfgDescription);
|
CConfigurationData cfgData = getCfgData(cfgDescription);
|
||||||
|
|
||||||
ReferenceSettingsInfo refInfo = new ReferenceSettingsInfo(cfgDescription);
|
ReferenceSettingsInfo refInfo = new ReferenceSettingsInfo(cfgDescription);
|
||||||
ICConfigurationDescription[] allCfgDescriptions = cfgDescription.isPreferenceConfiguration()
|
ICConfigurationDescription[] allCfgDescriptions = cfgDescription.isPreferenceConfiguration() ?
|
||||||
? new ICConfigurationDescription[] { cfgDescription }
|
new ICConfigurationDescription[] { cfgDescription } :
|
||||||
: cfgDescription.getProjectDescription().getConfigurations();
|
cfgDescription.getProjectDescription().getConfigurations();
|
||||||
|
|
||||||
CConfigurationData[] allDatas = new CConfigurationData[allCfgDescriptions.length];
|
CConfigurationData[] allDatas = new CConfigurationData[allCfgDescriptions.length];
|
||||||
for (int i = 0; i < allCfgDescriptions.length; i++) {
|
for (int i = 0; i < allCfgDescriptions.length; i++) {
|
||||||
allDatas[i] = getCfgData(allCfgDescriptions[i]);
|
allDatas[i] = getCfgData(allCfgDescriptions[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
final PathEntryCollector collector = new PathEntryCollector(
|
final PathEntryCollector collector = new PathEntryCollector(project/*, cfgDescription*/);
|
||||||
project/* , cfgDescription */);
|
|
||||||
PathSettingsContainer rcDatas = createRcDataHolder(cfgData);
|
PathSettingsContainer rcDatas = createRcDataHolder(cfgData);
|
||||||
ICSourceEntry sEntries[] = cfgData.getSourceEntries();
|
ICSourceEntry sEntries[] = cfgData.getSourceEntries();
|
||||||
if (sEntries != null && sEntries.length != 0) {
|
if (sEntries != null && sEntries.length != 0) {
|
||||||
|
@ -2071,8 +2023,7 @@ public class PathEntryTranslator {
|
||||||
for (int kind : kinds) {
|
for (int kind : kinds) {
|
||||||
Set<ICLanguageSettingEntry> set = new LinkedHashSet<ICLanguageSettingEntry>();
|
Set<ICLanguageSettingEntry> set = new LinkedHashSet<ICLanguageSettingEntry>();
|
||||||
if (collectResourceDataEntries(cfgDescription, kind, rcData, set)) {
|
if (collectResourceDataEntries(cfgDescription, kind, rcData, set)) {
|
||||||
ICLanguageSettingEntry[] entries = set
|
ICLanguageSettingEntry[] entries = set.toArray(new ICLanguageSettingEntry[set.size()]);
|
||||||
.toArray(new ICLanguageSettingEntry[set.size()]);
|
|
||||||
child.setEntries(kind, entries, exportedSettings);
|
child.setEntries(kind, entries, exportedSettings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2083,8 +2034,7 @@ public class PathEntryTranslator {
|
||||||
return collector;
|
return collector;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean collectResourceDataEntries(ICConfigurationDescription cfgDescription, int kind,
|
private static boolean collectResourceDataEntries(ICConfigurationDescription cfgDescription, int kind, CResourceData rcData, Set<ICLanguageSettingEntry> list) {
|
||||||
CResourceData rcData, Set<ICLanguageSettingEntry> list) {
|
|
||||||
CLanguageData[] lDatas = null;
|
CLanguageData[] lDatas = null;
|
||||||
if (rcData instanceof CFolderData) {
|
if (rcData instanceof CFolderData) {
|
||||||
lDatas = ((CFolderData)rcData).getLanguageDatas();
|
lDatas = ((CFolderData)rcData).getLanguageDatas();
|
||||||
|
@ -2093,8 +2043,7 @@ public class PathEntryTranslator {
|
||||||
if (lData != null)
|
if (lData != null)
|
||||||
lDatas = new CLanguageData[] {lData};
|
lDatas = new CLanguageData[] {lData};
|
||||||
} else {
|
} else {
|
||||||
Exception e = new Exception(
|
Exception e = new Exception(UtilMessages.getString("PathEntryTranslator.1") + rcData.getClass().getName()); //$NON-NLS-1$
|
||||||
UtilMessages.getString("PathEntryTranslator.1") + rcData.getClass().getName()); //$NON-NLS-1$
|
|
||||||
IStatus status = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, e.getMessage(), e);
|
IStatus status = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, e.getMessage(), e);
|
||||||
CCorePlugin.log(status);
|
CCorePlugin.log(status);
|
||||||
}
|
}
|
||||||
|
@ -2106,19 +2055,13 @@ public class PathEntryTranslator {
|
||||||
if (ScannerDiscoveryLegacySupport.isLanguageSettingsProvidersFunctionalityEnabled(project)) {
|
if (ScannerDiscoveryLegacySupport.isLanguageSettingsProvidersFunctionalityEnabled(project)) {
|
||||||
IResource rc = findResourceInWorkspace(project, rcData.getPath());
|
IResource rc = findResourceInWorkspace(project, rcData.getPath());
|
||||||
if (rc == null) {
|
if (rc == null) {
|
||||||
// If resource does not exist make a handle to be able to supply
|
// If resource does not exist make a handle to be able to supply the path.
|
||||||
// the path.
|
|
||||||
// This does not create actual resource.
|
// This does not create actual resource.
|
||||||
// Gotta be a folder so language settings provider won't filter
|
// Gotta be a folder so language settings provider won't filter out languages.
|
||||||
// out languages.
|
|
||||||
rc = project.getFolder(rcData.getPath());
|
rc = project.getFolder(rcData.getPath());
|
||||||
}
|
}
|
||||||
IBuildConfiguration config = Adapters.adapt(cfgDescription, IBuildConfiguration.class);
|
|
||||||
if (config != null) {
|
|
||||||
for (CLanguageData lData : lDatas) {
|
for (CLanguageData lData : lDatas) {
|
||||||
list.addAll(LanguageSettingsProvidersSerializer.getSettingEntriesByKind(config, rc,
|
list.addAll(LanguageSettingsProvidersSerializer.getSettingEntriesByKind(cfgDescription, rc, lData.getLanguageId(), kind));
|
||||||
lData.getLanguageId(), kind));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return list.size() > 0;
|
return list.size() > 0;
|
||||||
|
|
||||||
|
@ -2132,8 +2075,7 @@ public class PathEntryTranslator {
|
||||||
return supported;
|
return supported;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean collectLanguageDataEntries(int kind, CLanguageData lData,
|
private static boolean collectLanguageDataEntries(int kind, CLanguageData lData, Set<ICLanguageSettingEntry> list) {
|
||||||
Set<ICLanguageSettingEntry> list) {
|
|
||||||
if ((kind & lData.getSupportedEntryKinds()) != 0) {
|
if ((kind & lData.getSupportedEntryKinds()) != 0) {
|
||||||
ICLanguageSettingEntry[] entries = lData.getEntries(kind);
|
ICLanguageSettingEntry[] entries = lData.getEntries(kind);
|
||||||
if (entries != null && entries.length != 0) {
|
if (entries != null && entries.length != 0) {
|
||||||
|
@ -2145,8 +2087,7 @@ public class PathEntryTranslator {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IPathEntry[] getPathEntries(IProject project, ICConfigurationDescription cfgDescription,
|
public static IPathEntry[] getPathEntries(IProject project, ICConfigurationDescription cfgDescription, int flags) {
|
||||||
int flags) {
|
|
||||||
PathEntryCollector cr = collectEntries(project, cfgDescription);
|
PathEntryCollector cr = collectEntries(project, cfgDescription);
|
||||||
return cr.getEntries(flags, cfgDescription);
|
return cr.getEntries(flags, cfgDescription);
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -42,11 +42,9 @@ import org.eclipse.cdt.internal.core.parser.ParserSettings2;
|
||||||
import org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager;
|
import org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager;
|
||||||
import org.eclipse.cdt.internal.core.settings.model.SettingsModelMessages;
|
import org.eclipse.cdt.internal.core.settings.model.SettingsModelMessages;
|
||||||
import org.eclipse.cdt.utils.EFSExtensionManager;
|
import org.eclipse.cdt.utils.EFSExtensionManager;
|
||||||
import org.eclipse.core.resources.IBuildConfiguration;
|
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.resources.ResourcesPlugin;
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
import org.eclipse.core.runtime.Adapters;
|
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
|
@ -54,15 +52,14 @@ import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.osgi.util.NLS;
|
import org.eclipse.osgi.util.NLS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of {@link IScannerInfoProvider} backed by the list of language settings providers
|
* Implementation of {@link IScannerInfoProvider} backed by the list of
|
||||||
* of "default settings configuration" (see
|
* language settings providers of "default settings configuration"
|
||||||
* {@link ICProjectDescription#getDefaultSettingConfiguration()}).
|
* (see {@link ICProjectDescription#getDefaultSettingConfiguration()}).
|
||||||
*
|
*
|
||||||
* @see IScannerInfo#getIncludePaths()
|
* @see IScannerInfo#getIncludePaths()
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class LanguageSettingsScannerInfoProvider
|
public class LanguageSettingsScannerInfoProvider implements IScannerInfoProvider, ILanguageSettingsChangeListener {
|
||||||
implements IScannerInfoProvider, ILanguageSettingsChangeListener {
|
|
||||||
private static final String FRAMEWORK_PRIVATE_HEADERS_INCLUDE = "/__framework__.framework/PrivateHeaders/__header__"; //$NON-NLS-1$
|
private static final String FRAMEWORK_PRIVATE_HEADERS_INCLUDE = "/__framework__.framework/PrivateHeaders/__header__"; //$NON-NLS-1$
|
||||||
private static final String FRAMEWORK_HEADERS_INCLUDE = "/__framework__.framework/Headers/__header__"; //$NON-NLS-1$
|
private static final String FRAMEWORK_HEADERS_INCLUDE = "/__framework__.framework/Headers/__header__"; //$NON-NLS-1$
|
||||||
private static final ExtendedScannerInfo DUMMY_SCANNER_INFO = new ExtendedScannerInfo();
|
private static final ExtendedScannerInfo DUMMY_SCANNER_INFO = new ExtendedScannerInfo();
|
||||||
|
@ -75,8 +72,7 @@ public class LanguageSettingsScannerInfoProvider
|
||||||
if (project==null)
|
if (project==null)
|
||||||
return DUMMY_SCANNER_INFO;
|
return DUMMY_SCANNER_INFO;
|
||||||
|
|
||||||
ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance()
|
ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project, false);
|
||||||
.getProjectDescription(project, false);
|
|
||||||
if (prjDescription==null)
|
if (prjDescription==null)
|
||||||
return DUMMY_SCANNER_INFO;
|
return DUMMY_SCANNER_INFO;
|
||||||
|
|
||||||
|
@ -84,14 +80,9 @@ public class LanguageSettingsScannerInfoProvider
|
||||||
if (cfgDescription==null)
|
if (cfgDescription==null)
|
||||||
return DUMMY_SCANNER_INFO;
|
return DUMMY_SCANNER_INFO;
|
||||||
|
|
||||||
IBuildConfiguration config = Adapters.adapt(cfgDescription, IBuildConfiguration.class);
|
|
||||||
if (config == null)
|
|
||||||
return DUMMY_SCANNER_INFO;
|
|
||||||
|
|
||||||
List<String> languageIds = LanguageSettingsManager.getLanguages(rc, cfgDescription);
|
List<String> languageIds = LanguageSettingsManager.getLanguages(rc, cfgDescription);
|
||||||
if (languageIds.isEmpty()) {
|
if (languageIds.isEmpty()) {
|
||||||
String msg = NLS.bind(SettingsModelMessages.getString(
|
String msg = NLS.bind(SettingsModelMessages.getString("LanguageSettingsScannerInfoProvider.UnableToDetermineLanguage"), rc.toString()); //$NON-NLS-1$
|
||||||
"LanguageSettingsScannerInfoProvider.UnableToDetermineLanguage"), rc.toString()); //$NON-NLS-1$
|
|
||||||
IStatus status = new Status(IStatus.WARNING, CCorePlugin.PLUGIN_ID, msg, new Exception());
|
IStatus status = new Status(IStatus.WARNING, CCorePlugin.PLUGIN_ID, msg, new Exception());
|
||||||
CCorePlugin.log(status);
|
CCorePlugin.log(status);
|
||||||
return DUMMY_SCANNER_INFO;
|
return DUMMY_SCANNER_INFO;
|
||||||
|
@ -104,24 +95,24 @@ public class LanguageSettingsScannerInfoProvider
|
||||||
LinkedHashSet<ICLanguageSettingEntry> macroEntries = new LinkedHashSet<ICLanguageSettingEntry>();
|
LinkedHashSet<ICLanguageSettingEntry> macroEntries = new LinkedHashSet<ICLanguageSettingEntry>();
|
||||||
|
|
||||||
for (String langId : languageIds) {
|
for (String langId : languageIds) {
|
||||||
List<ICLanguageSettingEntry> incSys = LanguageSettingsProvidersSerializer
|
List<ICLanguageSettingEntry> incSys = LanguageSettingsProvidersSerializer.getSystemSettingEntriesByKind(cfgDescription, rc, langId,
|
||||||
.getSystemSettingEntriesByKind(config, rc, langId, ICSettingEntry.INCLUDE_PATH);
|
ICSettingEntry.INCLUDE_PATH);
|
||||||
includePathEntries.addAll(incSys);
|
includePathEntries.addAll(incSys);
|
||||||
|
|
||||||
List<ICLanguageSettingEntry> incLocal = LanguageSettingsProvidersSerializer
|
List<ICLanguageSettingEntry> incLocal = LanguageSettingsProvidersSerializer.getLocalSettingEntriesByKind(cfgDescription, rc, langId,
|
||||||
.getLocalSettingEntriesByKind(config, rc, langId, ICSettingEntry.INCLUDE_PATH);
|
ICSettingEntry.INCLUDE_PATH);
|
||||||
includePathLocalEntries.addAll(incLocal);
|
includePathLocalEntries.addAll(incLocal);
|
||||||
|
|
||||||
List<ICLanguageSettingEntry> incFiles = LanguageSettingsProvidersSerializer
|
List<ICLanguageSettingEntry> incFiles = LanguageSettingsProvidersSerializer.getSettingEntriesByKind(cfgDescription, rc, langId,
|
||||||
.getSettingEntriesByKind(config, rc, langId, ICSettingEntry.INCLUDE_FILE);
|
ICSettingEntry.INCLUDE_FILE);
|
||||||
includeFileEntries.addAll(incFiles);
|
includeFileEntries.addAll(incFiles);
|
||||||
|
|
||||||
List<ICLanguageSettingEntry> macroFiles = LanguageSettingsProvidersSerializer
|
List<ICLanguageSettingEntry> macroFiles = LanguageSettingsProvidersSerializer.getSettingEntriesByKind(cfgDescription, rc, langId,
|
||||||
.getSettingEntriesByKind(config, rc, langId, ICSettingEntry.MACRO_FILE);
|
ICSettingEntry.MACRO_FILE);
|
||||||
macroFileEntries.addAll(macroFiles);
|
macroFileEntries.addAll(macroFiles);
|
||||||
|
|
||||||
List<ICLanguageSettingEntry> macros = LanguageSettingsProvidersSerializer
|
List<ICLanguageSettingEntry> macros = LanguageSettingsProvidersSerializer.getSettingEntriesByKind(cfgDescription, rc, langId,
|
||||||
.getSettingEntriesByKind(config, rc, langId, ICSettingEntry.MACRO);
|
ICSettingEntry.MACRO);
|
||||||
macroEntries.addAll(macros);
|
macroEntries.addAll(macros);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,8 +129,7 @@ public class LanguageSettingsScannerInfoProvider
|
||||||
definedMacros.put(name, value);
|
definedMacros.put(name, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
ExtendedScannerInfo extendedScannerInfo = new ExtendedScannerInfo(definedMacros, includePaths,
|
ExtendedScannerInfo extendedScannerInfo = new ExtendedScannerInfo(definedMacros, includePaths, macroFiles, includeFiles, includePathsLocal);
|
||||||
macroFiles, includeFiles, includePathsLocal);
|
|
||||||
extendedScannerInfo.setParserSettings(new ParserSettings2(project));
|
extendedScannerInfo.setParserSettings(new ParserSettings2(project));
|
||||||
return extendedScannerInfo;
|
return extendedScannerInfo;
|
||||||
}
|
}
|
||||||
|
@ -156,8 +146,8 @@ public class LanguageSettingsScannerInfoProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get build working directory for the provided configuration. Returns project location if none
|
* Get build working directory for the provided configuration. Returns
|
||||||
* defined.
|
* project location if none defined.
|
||||||
*/
|
*/
|
||||||
private static IPath getBuildCWD(ICConfigurationDescription cfgDescription) {
|
private static IPath getBuildCWD(ICConfigurationDescription cfgDescription) {
|
||||||
IPath buildCWD = cfgDescription.getBuildSetting().getBuilderCWD();
|
IPath buildCWD = cfgDescription.getBuildSetting().getBuilderCWD();
|
||||||
|
@ -190,14 +180,11 @@ public class LanguageSettingsScannerInfoProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolve location to file system location in a configuration context. Resolving includes
|
* Resolve location to file system location in a configuration context.
|
||||||
* replacing build/environment variables with values, making relative path absolute etc.
|
* Resolving includes replacing build/environment variables with values, making relative path absolute etc.
|
||||||
*
|
*
|
||||||
* @param location
|
* @param location - location to resolve. If relative, it is taken to be rooted in build working directory.
|
||||||
* - location to resolve. If relative, it is taken to be rooted in build working
|
* @param cfgDescription - the configuration context.
|
||||||
* directory.
|
|
||||||
* @param cfgDescription
|
|
||||||
* - the configuration context.
|
|
||||||
* @return resolved file system location.
|
* @return resolved file system location.
|
||||||
*/
|
*/
|
||||||
private static String resolveEntry(String location, ICConfigurationDescription cfgDescription) {
|
private static String resolveEntry(String location, ICConfigurationDescription cfgDescription) {
|
||||||
|
@ -238,8 +225,7 @@ public class LanguageSettingsScannerInfoProvider
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert path delimiters to OS representation avoiding using org.eclipse.core.runtime.Path
|
* Convert path delimiters to OS representation avoiding using org.eclipse.core.runtime.Path
|
||||||
* being careful to preserve "../" segments and not let collapsing them which is not correct for
|
* being careful to preserve "../" segments and not let collapsing them which is not correct for symbolic links.
|
||||||
* symbolic links.
|
|
||||||
*/
|
*/
|
||||||
private String toOSString(String loc) {
|
private String toOSString(String loc) {
|
||||||
// use OS file separators (i.e. '\' on Windows)
|
// use OS file separators (i.e. '\' on Windows)
|
||||||
|
@ -253,14 +239,11 @@ public class LanguageSettingsScannerInfoProvider
|
||||||
* Convert the path entries to absolute file system locations represented as String array.
|
* Convert the path entries to absolute file system locations represented as String array.
|
||||||
* Resolve the entries which are not resolved.
|
* Resolve the entries which are not resolved.
|
||||||
*
|
*
|
||||||
* @param entriesPath
|
* @param entriesPath - language settings path entries.
|
||||||
* - language settings path entries.
|
* @param cfgDescription - configuration description for resolving entries.
|
||||||
* @param cfgDescription
|
|
||||||
* - configuration description for resolving entries.
|
|
||||||
* @return array of the locations.
|
* @return array of the locations.
|
||||||
*/
|
*/
|
||||||
private String[] convertToLocations(LinkedHashSet<ICLanguageSettingEntry> entriesPath,
|
private String[] convertToLocations(LinkedHashSet<ICLanguageSettingEntry> entriesPath, ICConfigurationDescription cfgDescription) {
|
||||||
ICConfigurationDescription cfgDescription) {
|
|
||||||
List<String> locations = new ArrayList<String>(entriesPath.size());
|
List<String> locations = new ArrayList<String>(entriesPath.size());
|
||||||
for (ICLanguageSettingEntry entry : entriesPath) {
|
for (ICLanguageSettingEntry entry : entriesPath) {
|
||||||
ICPathEntry entryPath = (ICPathEntry)entry;
|
ICPathEntry entryPath = (ICPathEntry)entry;
|
||||||
|
@ -324,8 +307,7 @@ public class LanguageSettingsScannerInfoProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
if (listenersMap == null) {
|
if (listenersMap == null) {
|
||||||
listenersMap = Collections
|
listenersMap = Collections.synchronizedMap(new HashMap<IResource, List<IScannerInfoChangeListener>>());
|
||||||
.synchronizedMap(new HashMap<IResource, List<IScannerInfoChangeListener>>());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IProject project = resource.getProject();
|
IProject project = resource.getProject();
|
||||||
|
@ -364,14 +346,12 @@ public class LanguageSettingsScannerInfoProvider
|
||||||
if (project != null) {
|
if (project != null) {
|
||||||
ICProjectDescription prjDescription = CCorePlugin.getDefault().getProjectDescription(project);
|
ICProjectDescription prjDescription = CCorePlugin.getDefault().getProjectDescription(project);
|
||||||
if (prjDescription != null) {
|
if (prjDescription != null) {
|
||||||
ICConfigurationDescription indexedCfgDescription = prjDescription
|
ICConfigurationDescription indexedCfgDescription = prjDescription.getDefaultSettingConfiguration();
|
||||||
.getDefaultSettingConfiguration();
|
|
||||||
String indexedCfgId = indexedCfgDescription.getId();
|
String indexedCfgId = indexedCfgDescription.getId();
|
||||||
|
|
||||||
for (String cfgId : event.getConfigurationDescriptionIds()) {
|
for (String cfgId : event.getConfigurationDescriptionIds()) {
|
||||||
if (cfgId.equals(indexedCfgId)) {
|
if (cfgId.equals(indexedCfgId)) {
|
||||||
for (Entry<IResource, List<IScannerInfoChangeListener>> entry : listenersMap
|
for (Entry<IResource, List<IScannerInfoChangeListener>> entry : listenersMap.entrySet()) {
|
||||||
.entrySet()) {
|
|
||||||
IResource rc = entry.getKey();
|
IResource rc = entry.getKey();
|
||||||
List<IScannerInfoChangeListener> listeners = listenersMap.get(rc);
|
List<IScannerInfoChangeListener> listeners = listenersMap.get(rc);
|
||||||
if (listeners != null && !listeners.isEmpty()) {
|
if (listeners != null && !listeners.isEmpty()) {
|
||||||
|
|
|
@ -41,29 +41,20 @@ import org.eclipse.cdt.internal.core.model.CModelManager;
|
||||||
import org.eclipse.cdt.internal.core.model.DefaultPathEntryStore;
|
import org.eclipse.cdt.internal.core.model.DefaultPathEntryStore;
|
||||||
import org.eclipse.cdt.internal.core.model.PathEntryManager;
|
import org.eclipse.cdt.internal.core.model.PathEntryManager;
|
||||||
import org.eclipse.cdt.internal.core.model.PathEntryUtil;
|
import org.eclipse.cdt.internal.core.model.PathEntryUtil;
|
||||||
import org.eclipse.core.resources.IBuildConfiguration;
|
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrapper class intended to provide backward compatibility with ScannerInfo
|
* Wrapper class intended to provide backward compatibility with ScannerInfo supplied by {@link PathEntryManager}.
|
||||||
* supplied by {@link PathEntryManager}.
|
|
||||||
*/
|
*/
|
||||||
public class PathEntryScannerInfoLanguageSettingsProvider extends LanguageSettingsBaseProvider {
|
public class PathEntryScannerInfoLanguageSettingsProvider extends LanguageSettingsBaseProvider {
|
||||||
@Override
|
@Override
|
||||||
public List<ICLanguageSettingEntry> getSettingEntries(IBuildConfiguration config, IResource rc,
|
public List<ICLanguageSettingEntry> getSettingEntries(ICConfigurationDescription cfgDescription, IResource rc, String languageId) {
|
||||||
String languageId) {
|
|
||||||
if (config == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
ICConfigurationDescription cfgDescription = config.getAdapter(ICConfigurationDescription.class);
|
|
||||||
if (cfgDescription == null) {
|
if (cfgDescription == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
ICProjectDescription prjDescription = cfgDescription.getProjectDescription();
|
ICProjectDescription prjDescription = cfgDescription.getProjectDescription();
|
||||||
if (prjDescription == null) {
|
if (prjDescription == null) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -81,8 +72,7 @@ public class PathEntryScannerInfoLanguageSettingsProvider extends LanguageSettin
|
||||||
@Override
|
@Override
|
||||||
public int compare(IPathEntry macro1, IPathEntry macro2) {
|
public int compare(IPathEntry macro1, IPathEntry macro2) {
|
||||||
if (macro1 instanceof IMacroEntry && macro2 instanceof IMacroEntry) {
|
if (macro1 instanceof IMacroEntry && macro2 instanceof IMacroEntry) {
|
||||||
return ((IMacroEntry) macro1).getMacroName()
|
return ((IMacroEntry)macro1).getMacroName().compareTo(((IMacroEntry)macro2).getMacroName());
|
||||||
.compareTo(((IMacroEntry) macro2).getMacroName());
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -92,20 +82,17 @@ public class PathEntryScannerInfoLanguageSettingsProvider extends LanguageSettin
|
||||||
pathEntriesMap.put(IPathEntry.CDT_LIBRARY, new LinkedHashSet<IPathEntry>());
|
pathEntriesMap.put(IPathEntry.CDT_LIBRARY, new LinkedHashSet<IPathEntry>());
|
||||||
|
|
||||||
IPathEntryStore pathEntryStore = new DefaultPathEntryStore(project);
|
IPathEntryStore pathEntryStore = new DefaultPathEntryStore(project);
|
||||||
int typesMask = IPathEntry.CDT_INCLUDE | IPathEntry.CDT_MACRO | IPathEntry.CDT_INCLUDE_FILE
|
int typesMask = IPathEntry.CDT_INCLUDE | IPathEntry.CDT_MACRO | IPathEntry.CDT_INCLUDE_FILE | IPathEntry.CDT_MACRO_FILE | IPathEntry.CDT_LIBRARY;
|
||||||
| IPathEntry.CDT_MACRO_FILE | IPathEntry.CDT_LIBRARY;
|
|
||||||
try {
|
try {
|
||||||
IPathEntry[] storePathEntries = pathEntryStore.getRawPathEntries();
|
IPathEntry[] storePathEntries = pathEntryStore.getRawPathEntries();
|
||||||
for (IPathEntry storePathEntry : storePathEntries) {
|
for (IPathEntry storePathEntry : storePathEntries) {
|
||||||
if (storePathEntry instanceof IContainerEntry) {
|
if (storePathEntry instanceof IContainerEntry) {
|
||||||
try {
|
try {
|
||||||
IPathEntryContainer container = PathEntryManager.getDefault()
|
IPathEntryContainer container = PathEntryManager.getDefault().getPathEntryContainer((IContainerEntry) storePathEntry, cproject);
|
||||||
.getPathEntryContainer((IContainerEntry) storePathEntry, cproject);
|
|
||||||
if (container != null) {
|
if (container != null) {
|
||||||
IPathEntry[] pathEntries = null;
|
IPathEntry[] pathEntries = null;
|
||||||
if (container instanceof IPathEntryContainerExtension) {
|
if (container instanceof IPathEntryContainerExtension) {
|
||||||
pathEntries = ((IPathEntryContainerExtension) container)
|
pathEntries = ((IPathEntryContainerExtension)container).getPathEntries(rc.getFullPath(), typesMask);
|
||||||
.getPathEntries(rc.getFullPath(), typesMask);
|
|
||||||
} else {
|
} else {
|
||||||
pathEntries = container.getPathEntries();
|
pathEntries = container.getPathEntries();
|
||||||
}
|
}
|
||||||
|
@ -137,12 +124,10 @@ public class PathEntryScannerInfoLanguageSettingsProvider extends LanguageSettin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return LanguageSettingsSerializableStorage
|
return LanguageSettingsSerializableStorage.getPooledList(new ArrayList<ICLanguageSettingEntry>(lsEntries));
|
||||||
.getPooledList(new ArrayList<ICLanguageSettingEntry>(lsEntries));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void collectPathEntry(LinkedHashMap<Integer, Set<IPathEntry>> pathEntriesMap, IPath projectPath,
|
private void collectPathEntry(LinkedHashMap<Integer, Set<IPathEntry>> pathEntriesMap, IPath projectPath, IPathEntry pathEntry) {
|
||||||
IPathEntry pathEntry) {
|
|
||||||
switch (pathEntry.getEntryKind()) {
|
switch (pathEntry.getEntryKind()) {
|
||||||
case IPathEntry.CDT_INCLUDE:
|
case IPathEntry.CDT_INCLUDE:
|
||||||
case IPathEntry.CDT_MACRO:
|
case IPathEntry.CDT_MACRO:
|
||||||
|
@ -161,15 +146,13 @@ public class PathEntryScannerInfoLanguageSettingsProvider extends LanguageSettin
|
||||||
switch (pathEntry.getEntryKind()) {
|
switch (pathEntry.getEntryKind()) {
|
||||||
case IPathEntry.CDT_INCLUDE:
|
case IPathEntry.CDT_INCLUDE:
|
||||||
IIncludeEntry includeEntry = (IIncludeEntry)pathEntry;
|
IIncludeEntry includeEntry = (IIncludeEntry)pathEntry;
|
||||||
return CDataUtil.createCIncludePathEntry(includeEntry.getFullIncludePath().toOSString(),
|
return CDataUtil.createCIncludePathEntry(includeEntry.getFullIncludePath().toOSString(), includeEntry.isSystemInclude() ? 0 : ICSettingEntry.LOCAL);
|
||||||
includeEntry.isSystemInclude() ? 0 : ICSettingEntry.LOCAL);
|
|
||||||
case IPathEntry.CDT_MACRO:
|
case IPathEntry.CDT_MACRO:
|
||||||
IMacroEntry macroEntry = (IMacroEntry) pathEntry;
|
IMacroEntry macroEntry = (IMacroEntry) pathEntry;
|
||||||
return CDataUtil.createCMacroEntry(macroEntry.getMacroName(), macroEntry.getMacroValue(), 0);
|
return CDataUtil.createCMacroEntry(macroEntry.getMacroName(), macroEntry.getMacroValue(), 0);
|
||||||
case IPathEntry.CDT_INCLUDE_FILE:
|
case IPathEntry.CDT_INCLUDE_FILE:
|
||||||
IIncludeFileEntry includeFileEntry = (IIncludeFileEntry) pathEntry;
|
IIncludeFileEntry includeFileEntry = (IIncludeFileEntry) pathEntry;
|
||||||
return CDataUtil.createCIncludeFileEntry(includeFileEntry.getFullIncludeFilePath().toOSString(),
|
return CDataUtil.createCIncludeFileEntry(includeFileEntry.getFullIncludeFilePath().toOSString(), 0);
|
||||||
0);
|
|
||||||
case IPathEntry.CDT_MACRO_FILE:
|
case IPathEntry.CDT_MACRO_FILE:
|
||||||
IMacroFileEntry macroFileEntry = (IMacroFileEntry) pathEntry;
|
IMacroFileEntry macroFileEntry = (IMacroFileEntry) pathEntry;
|
||||||
return CDataUtil.createCMacroFileEntry(macroFileEntry.getFullMacroFilePath().toOSString(), 0);
|
return CDataUtil.createCMacroFileEntry(macroFileEntry.getFullMacroFilePath().toOSString(), 0);
|
||||||
|
|
|
@ -22,9 +22,7 @@ import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
||||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
||||||
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
|
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
|
||||||
import org.eclipse.core.resources.IBuildConfiguration;
|
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.Adapters;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Language settings provider to provide entries exported from referenced projects.
|
* Language settings provider to provide entries exported from referenced projects.
|
||||||
|
@ -41,8 +39,7 @@ public class ReferencedProjectsLanguageSettingsProvider extends LanguageSettings
|
||||||
};
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ICLanguageSettingEntry> getSettingEntries(IBuildConfiguration config, IResource rc,
|
public List<ICLanguageSettingEntry> getSettingEntries(ICConfigurationDescription cfgDescription, IResource rc, String languageId) {
|
||||||
String languageId) {
|
|
||||||
if (recursiveCallIndicator.get()) {
|
if (recursiveCallIndicator.get()) {
|
||||||
// Recursive call indicates that the provider of a referenced project is called.
|
// Recursive call indicates that the provider of a referenced project is called.
|
||||||
// Only exported entries of the original configuration should be considered,
|
// Only exported entries of the original configuration should be considered,
|
||||||
|
@ -50,11 +47,6 @@ public class ReferencedProjectsLanguageSettingsProvider extends LanguageSettings
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
ICConfigurationDescription cfgDescription = config.getAdapter(ICConfigurationDescription.class);
|
|
||||||
if (cfgDescription == null) {
|
if (cfgDescription == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -66,18 +58,14 @@ public class ReferencedProjectsLanguageSettingsProvider extends LanguageSettings
|
||||||
try {
|
try {
|
||||||
recursiveCallIndicator.set(true);
|
recursiveCallIndicator.set(true);
|
||||||
List<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>();
|
List<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>();
|
||||||
ICConfigurationDescription[] refCfgDescriptions = CoreModelUtil
|
ICConfigurationDescription[] refCfgDescriptions = CoreModelUtil.getReferencedConfigurationDescriptions(cfgDescription, false);
|
||||||
.getReferencedConfigurationDescriptions(cfgDescription, false);
|
|
||||||
for (ICConfigurationDescription refCfgDescription : refCfgDescriptions) {
|
for (ICConfigurationDescription refCfgDescription : refCfgDescriptions) {
|
||||||
IBuildConfiguration refConfig = Adapters.adapt(refCfgDescription, IBuildConfiguration.class);
|
List<ICLanguageSettingEntry> refEntries = LanguageSettingsManager.getSettingEntriesByKind(refCfgDescription, rc, languageId, ICSettingEntry.ALL);
|
||||||
List<ICLanguageSettingEntry> refEntries = LanguageSettingsManager
|
|
||||||
.getSettingEntriesByKind(refConfig, rc, languageId, ICSettingEntry.ALL);
|
|
||||||
for (ICLanguageSettingEntry refEntry : refEntries) {
|
for (ICLanguageSettingEntry refEntry : refEntries) {
|
||||||
int flags = refEntry.getFlags();
|
int flags = refEntry.getFlags();
|
||||||
if ((flags & ICSettingEntry.EXPORTED) == ICSettingEntry.EXPORTED) {
|
if ((flags & ICSettingEntry.EXPORTED) == ICSettingEntry.EXPORTED) {
|
||||||
// create a new entry with EXPORTED flag cleared
|
// create a new entry with EXPORTED flag cleared
|
||||||
ICLanguageSettingEntry entry = CDataUtil.createEntry(refEntry,
|
ICLanguageSettingEntry entry = CDataUtil.createEntry(refEntry, flags & ~ICSettingEntry.EXPORTED);
|
||||||
flags & ~ICSettingEntry.EXPORTED);
|
|
||||||
entries.add(entry);
|
entries.add(entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,29 +28,16 @@ import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
||||||
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
||||||
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
|
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
|
||||||
import org.eclipse.cdt.core.settings.model.util.CExtensionUtil;
|
import org.eclipse.cdt.core.settings.model.util.CExtensionUtil;
|
||||||
import org.eclipse.core.resources.IBuildConfiguration;
|
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IConfigurationElement;
|
import org.eclipse.core.runtime.IConfigurationElement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrapper class intended to provide backward compatibility with
|
* Wrapper class intended to provide backward compatibility with ScannerInfoProvider defined by org.eclipse.cdt.core.ScannerInfoProvider extension point
|
||||||
* ScannerInfoProvider defined by org.eclipse.cdt.core.ScannerInfoProvider
|
|
||||||
* extension point
|
|
||||||
*/
|
*/
|
||||||
public class ScannerInfoExtensionLanguageSettingsProvider extends LanguageSettingsBaseProvider {
|
public class ScannerInfoExtensionLanguageSettingsProvider extends LanguageSettingsBaseProvider {
|
||||||
@Override
|
@Override
|
||||||
public List<ICLanguageSettingEntry> getSettingEntries(IBuildConfiguration config, IResource rc,
|
public List<ICLanguageSettingEntry> getSettingEntries(ICConfigurationDescription cfgDescription, IResource rc, String languageId) {
|
||||||
String languageId) {
|
|
||||||
if (config == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
ICConfigurationDescription cfgDescription = config.getAdapter(ICConfigurationDescription.class);
|
|
||||||
if (cfgDescription == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>();
|
List<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>();
|
||||||
IScannerInfoProvider scannerInfoProvider = getScannerInfoProvider(cfgDescription);
|
IScannerInfoProvider scannerInfoProvider = getScannerInfoProvider(cfgDescription);
|
||||||
if (scannerInfoProvider != null) {
|
if (scannerInfoProvider != null) {
|
||||||
|
@ -77,11 +64,9 @@ public class ScannerInfoExtensionLanguageSettingsProvider extends LanguageSettin
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return ScannerInfoProvider defined in configuration metadata in
|
* Return ScannerInfoProvider defined in configuration metadata in .cproject.
|
||||||
* .cproject.
|
|
||||||
*
|
*
|
||||||
* @param cfgDescription
|
* @param cfgDescription - configuration description.
|
||||||
* - configuration description.
|
|
||||||
* @return an instance of ScannerInfoProvider or {@code null}.
|
* @return an instance of ScannerInfoProvider or {@code null}.
|
||||||
*/
|
*/
|
||||||
public IScannerInfoProvider getScannerInfoProvider(ICConfigurationDescription cfgDescription) {
|
public IScannerInfoProvider getScannerInfoProvider(ICConfigurationDescription cfgDescription) {
|
||||||
|
@ -95,8 +80,7 @@ public class ScannerInfoExtensionLanguageSettingsProvider extends LanguageSettin
|
||||||
ICConfigExtensionReference ref = refs[0];
|
ICConfigExtensionReference ref = refs[0];
|
||||||
try {
|
try {
|
||||||
AbstractCExtension cExtension = null;
|
AbstractCExtension cExtension = null;
|
||||||
IConfigurationElement el = CExtensionUtil.getFirstConfigurationElement(ref, "cextension", //$NON-NLS-1$
|
IConfigurationElement el = CExtensionUtil.getFirstConfigurationElement(ref, "cextension", false); //$NON-NLS-1$
|
||||||
false);
|
|
||||||
cExtension = (AbstractCExtension)el.createExecutableExtension("run"); //$NON-NLS-1$
|
cExtension = (AbstractCExtension)el.createExecutableExtension("run"); //$NON-NLS-1$
|
||||||
cExtension.setExtensionReference(ref);
|
cExtension.setExtensionReference(ref);
|
||||||
cExtension.setProject(ref.getConfiguration().getProjectDescription().getProject());
|
cExtension.setProject(ref.getConfiguration().getProjectDescription().getProject());
|
||||||
|
|
|
@ -1,38 +0,0 @@
|
||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2016 QNX Software Systems 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
|
|
||||||
*******************************************************************************/
|
|
||||||
package org.eclipse.cdt.internal.core.settings.model;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
|
||||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
|
||||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
|
||||||
import org.eclipse.core.resources.IBuildConfiguration;
|
|
||||||
import org.eclipse.core.runtime.IAdapterFactory;
|
|
||||||
|
|
||||||
public class BuildConfigAdapterFactory implements IAdapterFactory {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
|
|
||||||
if (adaptableObject instanceof IBuildConfiguration
|
|
||||||
&& adapterType.equals(ICConfigurationDescription.class)) {
|
|
||||||
IBuildConfiguration buildConfig = (IBuildConfiguration) adaptableObject;
|
|
||||||
ICProjectDescription prjDesc = CCorePlugin.getDefault()
|
|
||||||
.getProjectDescription(buildConfig.getProject());
|
|
||||||
if (prjDesc != null) {
|
|
||||||
return (T) prjDesc.getConfigurationById(buildConfig.getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Class<?>[] getAdapterList() {
|
|
||||||
return new Class<?>[] { ICConfigurationDescription.class };
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,73 +0,0 @@
|
||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2016 QNX Software Systems 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
|
|
||||||
*******************************************************************************/
|
|
||||||
package org.eclipse.cdt.internal.core.settings.model;
|
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
|
||||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
|
||||||
import org.eclipse.core.resources.IBuildConfiguration;
|
|
||||||
import org.eclipse.core.resources.IProject;
|
|
||||||
import org.eclipse.core.resources.IProjectDescription;
|
|
||||||
import org.eclipse.core.resources.IResourceStatus;
|
|
||||||
import org.eclipse.core.resources.ResourcesPlugin;
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
|
||||||
import org.eclipse.core.runtime.IAdapterFactory;
|
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
|
||||||
|
|
||||||
public class CConfigurationAdapterFactory implements IAdapterFactory {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
|
|
||||||
if (adaptableObject instanceof ICConfigurationDescription
|
|
||||||
&& adapterType.equals(IBuildConfiguration.class)) {
|
|
||||||
ICConfigurationDescription cfgDesc = (ICConfigurationDescription) adaptableObject;
|
|
||||||
IProject project = cfgDesc.getProjectDescription().getProject();
|
|
||||||
if (project != null) {
|
|
||||||
String configId = cfgDesc.getId();
|
|
||||||
try {
|
|
||||||
IBuildConfiguration config = project.getBuildConfig(configId);
|
|
||||||
if (config == null) {
|
|
||||||
CCorePlugin.log(String.format("null config %s: %s", project.getName(), configId)); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
return (T) config;
|
|
||||||
} catch (CoreException e) {
|
|
||||||
if (!ResourcesPlugin.getWorkspace().isTreeLocked() &&
|
|
||||||
e.getStatus().getCode() == IResourceStatus.BUILD_CONFIGURATION_NOT_FOUND) {
|
|
||||||
try {
|
|
||||||
Set<String> configNames = new HashSet<>();
|
|
||||||
for (IBuildConfiguration config : project.getBuildConfigs()) {
|
|
||||||
configNames.add(config.getName());
|
|
||||||
}
|
|
||||||
configNames.add(configId);
|
|
||||||
|
|
||||||
IProjectDescription projectDesc = project.getDescription();
|
|
||||||
projectDesc.setBuildConfigs(
|
|
||||||
configNames.toArray(new String[configNames.size()]));
|
|
||||||
project.setDescription(projectDesc, new NullProgressMonitor());
|
|
||||||
return (T) project.getBuildConfig(configId);
|
|
||||||
} catch (CoreException e2) {
|
|
||||||
CCorePlugin.log(e2.getStatus());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
CCorePlugin.log(e.getStatus());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Class<?>[] getAdapterList() {
|
|
||||||
return new Class<?>[] { IBuildConfiguration.class };
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -35,11 +35,9 @@ import org.eclipse.core.runtime.QualifiedName;
|
||||||
|
|
||||||
public class CProjectDescription implements ICProjectDescription, ICDataProxyContainer {
|
public class CProjectDescription implements ICProjectDescription, ICDataProxyContainer {
|
||||||
private static final String ACTIVE_CFG = "activeConfiguration"; //$NON-NLS-1$
|
private static final String ACTIVE_CFG = "activeConfiguration"; //$NON-NLS-1$
|
||||||
private static final QualifiedName ACTIVE_CFG_PROPERTY = new QualifiedName(CCorePlugin.PLUGIN_ID,
|
private static final QualifiedName ACTIVE_CFG_PROPERTY = new QualifiedName(CCorePlugin.PLUGIN_ID, ACTIVE_CFG);
|
||||||
ACTIVE_CFG);
|
|
||||||
private static final String SETTING_CFG = "settingConfiguration"; //$NON-NLS-1$
|
private static final String SETTING_CFG = "settingConfiguration"; //$NON-NLS-1$
|
||||||
private static final QualifiedName SETTING_CFG_PROPERTY = new QualifiedName(CCorePlugin.PLUGIN_ID,
|
private static final QualifiedName SETTING_CFG_PROPERTY = new QualifiedName(CCorePlugin.PLUGIN_ID, SETTING_CFG);
|
||||||
SETTING_CFG);
|
|
||||||
|
|
||||||
private CfgIdPair fActiveCfgInfo;
|
private CfgIdPair fActiveCfgInfo;
|
||||||
private CfgIdPair fSettingCfgInfo;
|
private CfgIdPair fSettingCfgInfo;
|
||||||
|
@ -155,8 +153,7 @@ public class CProjectDescription implements ICProjectDescription, ICDataProxyCon
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public CProjectDescription(IProject project, ICSettingsStorage storage, ICStorageElement element,
|
public CProjectDescription(IProject project, ICSettingsStorage storage, ICStorageElement element, boolean loading, boolean isCreating) throws CoreException {
|
||||||
boolean loading, boolean isCreating) throws CoreException {
|
|
||||||
fProject = project;
|
fProject = project;
|
||||||
fStorage = storage;
|
fStorage = storage;
|
||||||
fRootStorageElement = element;
|
fRootStorageElement = element;
|
||||||
|
@ -233,8 +230,10 @@ public class CProjectDescription implements ICProjectDescription, ICDataProxyCon
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the read-only project description has / is being set fIsApplying => false
|
* Called when the read-only project description has / is being set
|
||||||
* setModified (false) set the ICSettingsStorage to readonly
|
* fIsApplying => false
|
||||||
|
* setModified (false)
|
||||||
|
* set the ICSettingsStorage to readonly
|
||||||
*/
|
*/
|
||||||
public void doneApplying() {
|
public void doneApplying() {
|
||||||
doneInitializing();
|
doneInitializing();
|
||||||
|
@ -260,8 +259,7 @@ public class CProjectDescription implements ICProjectDescription, ICDataProxyCon
|
||||||
|
|
||||||
private void doneInitializing() {
|
private void doneInitializing() {
|
||||||
for (ICConfigurationDescription cfg : fCfgMap.values()) {
|
for (ICConfigurationDescription cfg : fCfgMap.values()) {
|
||||||
// FIXME How and why are we down casting to a
|
// FIXME How and why are we down casting to a CConfigurationDescriptionCache. Comments, please!
|
||||||
// CConfigurationDescriptionCache. Comments, please!
|
|
||||||
CConfigurationDescriptionCache cache = (CConfigurationDescriptionCache) cfg;
|
CConfigurationDescriptionCache cache = (CConfigurationDescriptionCache) cfg;
|
||||||
cache.doneInitialization();
|
cache.doneInitialization();
|
||||||
}
|
}
|
||||||
|
@ -287,8 +285,7 @@ public class CProjectDescription implements ICProjectDescription, ICDataProxyCon
|
||||||
* @param el
|
* @param el
|
||||||
* @param isCreating
|
* @param isCreating
|
||||||
*/
|
*/
|
||||||
public CProjectDescription(CProjectDescription base, boolean saving, ICSettingsStorage storage,
|
public CProjectDescription(CProjectDescription base, boolean saving, ICSettingsStorage storage, ICStorageElement el, boolean isCreating) {
|
||||||
ICStorageElement el, boolean isCreating) {
|
|
||||||
fActiveCfgInfo = new CfgIdPair(base.fActiveCfgInfo);
|
fActiveCfgInfo = new CfgIdPair(base.fActiveCfgInfo);
|
||||||
fSettingCfgInfo = new CfgIdPair(base.fSettingCfgInfo);
|
fSettingCfgInfo = new CfgIdPair(base.fSettingCfgInfo);
|
||||||
fProject = base.fProject;
|
fProject = base.fProject;
|
||||||
|
@ -299,10 +296,7 @@ public class CProjectDescription implements ICProjectDescription, ICDataProxyCon
|
||||||
fIsApplying = saving || base.fIsApplying;
|
fIsApplying = saving || base.fIsApplying;
|
||||||
fIsCreating = isCreating;
|
fIsCreating = isCreating;
|
||||||
|
|
||||||
fPrefs = new CProjectDescriptionPreferences(base.fPrefs,
|
fPrefs = new CProjectDescriptionPreferences(base.fPrefs, (CProjectDescriptionPreferences)CProjectDescriptionManager.getInstance().getProjectDescriptionWorkspacePreferences(false), false);
|
||||||
(CProjectDescriptionPreferences) CProjectDescriptionManager.getInstance()
|
|
||||||
.getProjectDescriptionWorkspacePreferences(false),
|
|
||||||
false);
|
|
||||||
|
|
||||||
for (Iterator<ICConfigurationDescription> iter = base.fCfgMap.values().iterator(); iter.hasNext();) {
|
for (Iterator<ICConfigurationDescription> iter = base.fCfgMap.values().iterator(); iter.hasNext();) {
|
||||||
try {
|
try {
|
||||||
|
@ -314,9 +308,7 @@ public class CProjectDescription implements ICProjectDescription, ICDataProxyCon
|
||||||
baseCache = (CConfigurationDescriptionCache) baseData;
|
baseCache = (CConfigurationDescriptionCache) baseData;
|
||||||
baseData = baseCache.getConfigurationData();
|
baseData = baseCache.getConfigurationData();
|
||||||
}
|
}
|
||||||
CConfigurationDescriptionCache cache = new CConfigurationDescriptionCache(
|
CConfigurationDescriptionCache cache = new CConfigurationDescriptionCache((ICConfigurationDescription) cfgDes, baseData, baseCache, cfgDes.getSpecSettings(), this, null);
|
||||||
(ICConfigurationDescription) cfgDes, baseData, baseCache,
|
|
||||||
cfgDes.getSpecSettings(), this, null);
|
|
||||||
configurationCreated(cache);
|
configurationCreated(cache);
|
||||||
} else {
|
} else {
|
||||||
CConfigurationData baseData = cfgDes.getConfigurationData(false);
|
CConfigurationData baseData = cfgDes.getConfigurationData(false);
|
||||||
|
@ -329,8 +321,7 @@ public class CProjectDescription implements ICProjectDescription, ICDataProxyCon
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shallow cloning the base map
|
// Shallow cloning the base map
|
||||||
Map<QualifiedName, Object> cloneMap = Collections
|
Map<QualifiedName, Object> cloneMap = Collections.synchronizedMap(new HashMap<QualifiedName, Object>());
|
||||||
.synchronizedMap(new HashMap<QualifiedName, Object>());
|
|
||||||
synchronized(base.fPropertiesMap) {
|
synchronized(base.fPropertiesMap) {
|
||||||
cloneMap.putAll(base.fPropertiesMap);
|
cloneMap.putAll(base.fPropertiesMap);
|
||||||
}
|
}
|
||||||
|
@ -338,8 +329,8 @@ public class CProjectDescription implements ICProjectDescription, ICDataProxyCon
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert the current CConfigurationDescriptions to cached versions This occurs during the
|
* Convert the current CConfigurationDescriptions to cached versions
|
||||||
* SetCProjectDescription Operation
|
* This occurs during the SetCProjectDescription Operation
|
||||||
*/
|
*/
|
||||||
void switchToCachedConfigurationDescriptions() throws CoreException {
|
void switchToCachedConfigurationDescriptions() throws CoreException {
|
||||||
for (Map.Entry<String, ICConfigurationDescription> e : fCfgMap.entrySet()) {
|
for (Map.Entry<String, ICConfigurationDescription> e : fCfgMap.entrySet()) {
|
||||||
|
@ -351,8 +342,8 @@ public class CProjectDescription implements ICProjectDescription, ICDataProxyCon
|
||||||
baseCache = (CConfigurationDescriptionCache) baseData;
|
baseCache = (CConfigurationDescriptionCache) baseData;
|
||||||
baseData = baseCache.getConfigurationData();
|
baseData = baseCache.getConfigurationData();
|
||||||
}
|
}
|
||||||
CConfigurationDescriptionCache cache = new CConfigurationDescriptionCache(cfgDes, baseData,
|
CConfigurationDescriptionCache cache = new CConfigurationDescriptionCache(cfgDes, baseData, baseCache,
|
||||||
baseCache, cfgDes.getSpecSettings(), this, null);
|
cfgDes.getSpecSettings(), this, null);
|
||||||
e.setValue(cache);
|
e.setValue(cache);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -409,6 +400,7 @@ public class CProjectDescription implements ICProjectDescription, ICDataProxyCon
|
||||||
if (fIsReadOnly)
|
if (fIsReadOnly)
|
||||||
throw ExceptionFactory.createIsReadOnlyException();
|
throw ExceptionFactory.createIsReadOnlyException();
|
||||||
|
|
||||||
|
|
||||||
CConfigurationDescription cfgDes = (CConfigurationDescription) getConfigurationByName(name);
|
CConfigurationDescription cfgDes = (CConfigurationDescription) getConfigurationByName(name);
|
||||||
if (cfgDes != null) {
|
if (cfgDes != null) {
|
||||||
cfgDes.removeConfiguration();
|
cfgDes.removeConfiguration();
|
||||||
|
@ -432,7 +424,8 @@ public class CProjectDescription implements ICProjectDescription, ICDataProxyCon
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setActiveConfiguration(ICConfigurationDescription cfg) throws WriteAccessException {
|
public void setActiveConfiguration(
|
||||||
|
ICConfigurationDescription cfg) throws WriteAccessException {
|
||||||
if (fIsReadOnly)
|
if (fIsReadOnly)
|
||||||
throw ExceptionFactory.createIsReadOnlyException();
|
throw ExceptionFactory.createIsReadOnlyException();
|
||||||
if (cfg == null)
|
if (cfg == null)
|
||||||
|
@ -455,8 +448,7 @@ public class CProjectDescription implements ICProjectDescription, ICDataProxyCon
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICStorageElement importStorage(String id, ICStorageElement el)
|
public ICStorageElement importStorage(String id, ICStorageElement el) throws UnsupportedOperationException, CoreException {
|
||||||
throws UnsupportedOperationException, CoreException {
|
|
||||||
return getStorageBase().importStorage(id, el);
|
return getStorageBase().importStorage(id, el);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -526,8 +518,7 @@ public class CProjectDescription implements ICProjectDescription, ICDataProxyCon
|
||||||
throw ExceptionFactory.createCoreException("CProjectDescription ICStorageElement == null"); //$NON-NLS-1$
|
throw ExceptionFactory.createCoreException("CProjectDescription ICStorageElement == null"); //$NON-NLS-1$
|
||||||
|
|
||||||
// if (fRootStorageElement == null) {
|
// if (fRootStorageElement == null) {
|
||||||
// fRootStorageElement = CProjectDescriptionManager.getInstance().createStorage(fProject,
|
// fRootStorageElement = CProjectDescriptionManager.getInstance().createStorage(fProject, true, true, isReadOnly());
|
||||||
// true, true, isReadOnly());
|
|
||||||
// }
|
// }
|
||||||
return fRootStorageElement;
|
return fRootStorageElement;
|
||||||
}
|
}
|
||||||
|
@ -544,8 +535,7 @@ public class CProjectDescription implements ICProjectDescription, ICDataProxyCon
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICConfigurationDescription createConfiguration(String buildSystemId, CConfigurationData data)
|
public ICConfigurationDescription createConfiguration(String buildSystemId, CConfigurationData data) throws CoreException {
|
||||||
throws CoreException {
|
|
||||||
if (fIsReadOnly)
|
if (fIsReadOnly)
|
||||||
throw ExceptionFactory.createIsReadOnlyException();
|
throw ExceptionFactory.createIsReadOnlyException();
|
||||||
CConfigurationDescription cfg = new CConfigurationDescription(data, buildSystemId, this);
|
CConfigurationDescription cfg = new CConfigurationDescription(data, buildSystemId, this);
|
||||||
|
@ -553,8 +543,7 @@ public class CProjectDescription implements ICProjectDescription, ICDataProxyCon
|
||||||
return cfg;
|
return cfg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CConfigurationDescription createConvertedConfiguration(String id, String name, ICStorageElement el)
|
public CConfigurationDescription createConvertedConfiguration(String id, String name, ICStorageElement el) throws CoreException{
|
||||||
throws CoreException {
|
|
||||||
if (fIsReadOnly)
|
if (fIsReadOnly)
|
||||||
throw ExceptionFactory.createIsReadOnlyException();
|
throw ExceptionFactory.createIsReadOnlyException();
|
||||||
CConfigurationDescription cfg = new CConfigurationDescription(id, name, el, this);
|
CConfigurationDescription cfg = new CConfigurationDescription(id, name, el, this);
|
||||||
|
|
|
@ -98,12 +98,10 @@ import org.eclipse.cdt.internal.core.settings.model.xml.InternalXmlStorageElemen
|
||||||
import org.eclipse.cdt.internal.core.settings.model.xml.XmlStorage;
|
import org.eclipse.cdt.internal.core.settings.model.xml.XmlStorage;
|
||||||
import org.eclipse.core.filesystem.EFS;
|
import org.eclipse.core.filesystem.EFS;
|
||||||
import org.eclipse.core.filesystem.IFileStore;
|
import org.eclipse.core.filesystem.IFileStore;
|
||||||
import org.eclipse.core.resources.IBuildConfiguration;
|
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IProjectDescription;
|
import org.eclipse.core.resources.IProjectDescription;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.resources.IResourceChangeEvent;
|
import org.eclipse.core.resources.IResourceChangeEvent;
|
||||||
import org.eclipse.core.resources.IResourceStatus;
|
|
||||||
import org.eclipse.core.resources.ISavedState;
|
import org.eclipse.core.resources.ISavedState;
|
||||||
import org.eclipse.core.resources.IWorkspace;
|
import org.eclipse.core.resources.IWorkspace;
|
||||||
import org.eclipse.core.resources.IWorkspaceRoot;
|
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||||
|
@ -136,30 +134,27 @@ import org.xml.sax.SAXException;
|
||||||
import com.ibm.icu.text.MessageFormat;
|
import com.ibm.icu.text.MessageFormat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The CProjectDescriptionManager is to marshall the loading and storing of CDT Project
|
* The CProjectDescriptionManager is to marshall the loading and storing
|
||||||
* Descriptions.
|
* of CDT Project Descriptions.
|
||||||
*
|
*
|
||||||
* This class delegates loading and store of the project model to the appropriate
|
* This class delegates loading and store of the project model to the appropriate
|
||||||
* AbstractCProjectDescriptionStorage for the Project Description. [ Discovered at Project load
|
* AbstractCProjectDescriptionStorage for the Project Description. [ Discovered at Project load
|
||||||
* time.]
|
* time.]
|
||||||
*
|
*
|
||||||
* Users should not synchronize on the singleton instance of this class. It is the job of the
|
* Users should not synchronize on the singleton instance of this class. It is the job of
|
||||||
* AbstractCProjectDescriptionStorage to ensure thread safe access to the backing store as described
|
* the AbstractCProjectDescriptionStorage to ensure thread safe access to the backing store
|
||||||
* in that interface.
|
* as described in that interface.
|
||||||
*
|
*
|
||||||
* Previously this class created and persisted
|
* Previously this class created and persisted
|
||||||
*
|
|
||||||
* @see ICProjectDescriptionManager
|
* @see ICProjectDescriptionManager
|
||||||
*/
|
*/
|
||||||
public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
public static final int INTERNAL_GET_IGNORE_CLOSE = 1 << 31 ;
|
public static final int INTERNAL_GET_IGNORE_CLOSE = 1 << 31 ;
|
||||||
|
|
||||||
private static final String VERSION_ELEMENT_NAME = "fileVersion"; //$NON-NLS-1$
|
private static final String VERSION_ELEMENT_NAME = "fileVersion"; //$NON-NLS-1$
|
||||||
/**
|
/** Preference Version 4.0 & 5.0 are equivalent for us. Version was inadvertently bumped
|
||||||
* Preference Version 4.0 & 5.0 are equivalent for us. Version was inadvertently bumped when
|
* when during project description storage work.
|
||||||
* during project description storage work. This is the minimum preference version we support
|
* This is the minimum preference version we support loading.*/
|
||||||
* loading.
|
|
||||||
*/
|
|
||||||
public static final Version MIN_DESCRIPTION_VERSION = new Version("4.0"); //$NON-NLS-1$
|
public static final Version MIN_DESCRIPTION_VERSION = new Version("4.0"); //$NON-NLS-1$
|
||||||
/** Current preference file storage version */
|
/** Current preference file storage version */
|
||||||
public static final Version DESCRIPTION_VERSION = new Version("5.0"); //$NON-NLS-1$
|
public static final Version DESCRIPTION_VERSION = new Version("5.0"); //$NON-NLS-1$
|
||||||
|
@ -178,8 +173,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
private static final String DEFAULT_CFG_ID_PREFIX = CCorePlugin.PLUGIN_ID + ".default.config"; //$NON-NLS-1$
|
private static final String DEFAULT_CFG_ID_PREFIX = CCorePlugin.PLUGIN_ID + ".default.config"; //$NON-NLS-1$
|
||||||
private static final String DEFAULT_CFG_NAME = "Configuration"; //$NON-NLS-1$
|
private static final String DEFAULT_CFG_NAME = "Configuration"; //$NON-NLS-1$
|
||||||
|
|
||||||
private static final QualifiedName SCANNER_INFO_PROVIDER_PROPERTY = new QualifiedName(CCorePlugin.PLUGIN_ID,
|
private static final QualifiedName SCANNER_INFO_PROVIDER_PROPERTY = new QualifiedName(CCorePlugin.PLUGIN_ID, "scannerInfoProvider"); //$NON-NLS-1$
|
||||||
"scannerInfoProvider"); //$NON-NLS-1$
|
|
||||||
|
|
||||||
static class CompositeWorkspaceRunnable implements IWorkspaceRunnable {
|
static class CompositeWorkspaceRunnable implements IWorkspaceRunnable {
|
||||||
private List<IWorkspaceRunnable> fRunnables = new ArrayList<IWorkspaceRunnable>();
|
private List<IWorkspaceRunnable> fRunnables = new ArrayList<IWorkspaceRunnable>();
|
||||||
|
@ -274,8 +268,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
/** The CProjectDescriptionManager instance */
|
/** The CProjectDescriptionManager instance */
|
||||||
private static volatile CProjectDescriptionManager fInstance;
|
private static volatile CProjectDescriptionManager fInstance;
|
||||||
|
|
||||||
private CProjectDescriptionManager() {
|
private CProjectDescriptionManager(){}
|
||||||
}
|
|
||||||
|
|
||||||
public static CProjectDescriptionManager getInstance(){
|
public static CProjectDescriptionManager getInstance(){
|
||||||
if(fInstance == null)
|
if(fInstance == null)
|
||||||
|
@ -308,12 +301,10 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param from
|
* @param from Project to move the description from
|
||||||
* Project to move the description from
|
* @param to Project where the description is moved to
|
||||||
* @param to
|
* @return <b>ICProjectDescription</b> - non serialized, modified, writable
|
||||||
* Project where the description is moved to
|
* project description. To serialize, call <code>setProjectDescription()</code>
|
||||||
* @return <b>ICProjectDescription</b> - non serialized, modified, writable project description.
|
|
||||||
* To serialize, call <code>setProjectDescription()</code>
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public ICProjectDescription projectMove(IProject from, IProject to) {
|
public ICProjectDescription projectMove(IProject from, IProject to) {
|
||||||
|
@ -331,6 +322,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
return des;
|
return des;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Job startup(){
|
public Job startup(){
|
||||||
if(fRcChangeHandler == null){
|
if(fRcChangeHandler == null){
|
||||||
fRcChangeHandler = new ResourceChangeHandler();
|
fRcChangeHandler = new ResourceChangeHandler();
|
||||||
|
@ -359,43 +351,6 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
protected IStatus run(IProgressMonitor monitor) {
|
protected IStatus run(IProgressMonitor monitor) {
|
||||||
try{
|
try{
|
||||||
startSaveParticipant();
|
startSaveParticipant();
|
||||||
// startup mapping of ICConfigurationDescriptors to IBuildConfigurations
|
|
||||||
CProjectDescriptionManager manager = CProjectDescriptionManager.getInstance();
|
|
||||||
manager.addCProjectDescriptionListener(new ICProjectDescriptionListener() {
|
|
||||||
@Override
|
|
||||||
public void handleEvent(CProjectDescriptionEvent event) {
|
|
||||||
ICProjectDescription projDesc = event.getNewCProjectDescription();
|
|
||||||
IProject project = projDesc.getProject();
|
|
||||||
for (ICConfigurationDescription desc : projDesc.getConfigurations()) {
|
|
||||||
String id = desc.getId();
|
|
||||||
try {
|
|
||||||
project.getBuildConfig(id);
|
|
||||||
} catch (CoreException e) {
|
|
||||||
if (e.getStatus().getCode() == IResourceStatus.BUILD_CONFIGURATION_NOT_FOUND) {
|
|
||||||
try {
|
|
||||||
Set<String> configNames = new HashSet<>();
|
|
||||||
for (IBuildConfiguration config : project.getBuildConfigs()) {
|
|
||||||
configNames.add(config.getName());
|
|
||||||
}
|
|
||||||
configNames.add(id);
|
|
||||||
|
|
||||||
// CCorePlugin.log(String.format("adding %s: %s", project.getName(), id)); //$NON-NLS-1$
|
|
||||||
IProjectDescription projectDesc = project.getDescription();
|
|
||||||
projectDesc.setBuildConfigs(
|
|
||||||
configNames.toArray(new String[configNames.size()]));
|
|
||||||
project.setDescription(projectDesc, new NullProgressMonitor());
|
|
||||||
// CCorePlugin.log(
|
|
||||||
// String.format("Config added %s: %s", project.getName(), id)); //$NON-NLS-1$
|
|
||||||
} catch (CoreException e2) {
|
|
||||||
CCorePlugin.log(e2.getStatus());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
CCorePlugin.log(e.getStatus());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, CProjectDescriptionEvent.LOADED | CProjectDescriptionEvent.ABOUT_TO_APPLY);
|
|
||||||
} catch (CoreException e){
|
} catch (CoreException e){
|
||||||
CCorePlugin.log(e);
|
CCorePlugin.log(e);
|
||||||
return e.getStatus();
|
return e.getStatus();
|
||||||
|
@ -413,18 +368,17 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
rcJob.setPriority(Job.INTERACTIVE);
|
rcJob.setPriority(Job.INTERACTIVE);
|
||||||
rcJob.setSystem(true);
|
rcJob.setSystem(true);
|
||||||
return rcJob;
|
return rcJob;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This method adds a save participant and resource change listener Throws CoreException if the
|
* This method adds a save participant and resource change listener
|
||||||
* methods fails to add a save participant. The resource change listener in not added in this
|
* Throws CoreException if the methods fails to add a save participant.
|
||||||
* case either.
|
* The resource change listener in not added in this case either.
|
||||||
*/
|
*/
|
||||||
private void startSaveParticipant() throws CoreException{
|
private void startSaveParticipant() throws CoreException{
|
||||||
// Set up a listener for resource change events
|
// Set up a listener for resource change events
|
||||||
ISavedState lastState = ResourcesPlugin.getWorkspace().addSaveParticipant(CCorePlugin.PLUGIN_ID,
|
ISavedState lastState =
|
||||||
fRcChangeHandler);
|
ResourcesPlugin.getWorkspace().addSaveParticipant(CCorePlugin.PLUGIN_ID, fRcChangeHandler);
|
||||||
|
|
||||||
if (lastState != null) {
|
if (lastState != null) {
|
||||||
lastState.processResourceChangeEvents(fRcChangeHandler);
|
lastState.processResourceChangeEvents(fRcChangeHandler);
|
||||||
|
@ -473,12 +427,10 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base method for getting a Project's Description
|
* Base method for getting a Project's Description
|
||||||
*
|
|
||||||
* @param project
|
* @param project
|
||||||
* @param flags
|
* @param flags
|
||||||
* @return ICProjectDescription
|
* @return ICProjectDescription
|
||||||
* @throws CoreException
|
* @throws CoreException if project description isn't available
|
||||||
* if project description isn't available
|
|
||||||
*/
|
*/
|
||||||
private ICProjectDescription getProjectDescriptionInternal(IProject project, int flags) throws CoreException {
|
private ICProjectDescription getProjectDescriptionInternal(IProject project, int flags) throws CoreException {
|
||||||
AbstractCProjectDescriptionStorage storage = getProjectDescriptionStorage(project);
|
AbstractCProjectDescriptionStorage storage = getProjectDescriptionStorage(project);
|
||||||
|
@ -487,17 +439,14 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run the workspace modification in the current thread using the workspace scheduling rule
|
* Run the workspace modification in the current thread using the workspace scheduling rule
|
||||||
* Equivalent to:
|
* Equivalent to: <code>runWspModification(IWorkspaceRunnable, ResourcecPlugin.getWorkspace().getRoot(), IProgressMonitor)</code>
|
||||||
* <code>runWspModification(IWorkspaceRunnable, ResourcecPlugin.getWorkspace().getRoot(), IProgressMonitor)</code>
|
*<br/><br/>
|
||||||
* <br/>
|
* Note that if the workspace is locked, or the current job / thread doesn't contain the workspace
|
||||||
* <br/>
|
* scheduling rule, then we schedule a job to run the {@link IWorkspaceRunnable}
|
||||||
* Note that if the workspace is locked, or the current job / thread doesn't contain the
|
*<br/><br/>
|
||||||
* workspace scheduling rule, then we schedule a job to run the {@link IWorkspaceRunnable} <br/>
|
|
||||||
* <br/>
|
|
||||||
* The scheduled job is returned, or null if the operation was run immediately.
|
* The scheduled job is returned, or null if the operation was run immediately.
|
||||||
*
|
*
|
||||||
* @param runnable
|
* @param runnable the IWorkspaceRunnable to run
|
||||||
* the IWorkspaceRunnable to run
|
|
||||||
* @param monitor
|
* @param monitor
|
||||||
* @return scheduled job or null if the operation was run immediately
|
* @return scheduled job or null if the operation was run immediately
|
||||||
*/
|
*/
|
||||||
|
@ -506,15 +455,13 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Either runs the modification in the current thread (if the workspace is not locked) or
|
* Either runs the modification in the current thread (if the workspace is not locked)
|
||||||
* schedules a runnable to perform the operation
|
* or schedules a runnable to perform the operation
|
||||||
*
|
|
||||||
* @param runnable
|
* @param runnable
|
||||||
* @param monitor
|
* @param monitor
|
||||||
* @return scheduled job or null if the operation was run immediately
|
* @return scheduled job or null if the operation was run immediately
|
||||||
*/
|
*/
|
||||||
public static Job runWspModification(final IWorkspaceRunnable runnable, final ISchedulingRule rule,
|
public static Job runWspModification(final IWorkspaceRunnable runnable, final ISchedulingRule rule, IProgressMonitor monitor){
|
||||||
IProgressMonitor monitor) {
|
|
||||||
if(monitor == null)
|
if(monitor == null)
|
||||||
monitor = new NullProgressMonitor();
|
monitor = new NullProgressMonitor();
|
||||||
|
|
||||||
|
@ -567,8 +514,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void runAtomic(final IWorkspaceRunnable r, ISchedulingRule rule, IProgressMonitor monitor)
|
private static void runAtomic(final IWorkspaceRunnable r, ISchedulingRule rule, IProgressMonitor monitor) throws CoreException{
|
||||||
throws CoreException {
|
|
||||||
IWorkspace wsp = ResourcesPlugin.getWorkspace();
|
IWorkspace wsp = ResourcesPlugin.getWorkspace();
|
||||||
wsp.run(new IWorkspaceRunnable(){
|
wsp.run(new IWorkspaceRunnable(){
|
||||||
@Override
|
@Override
|
||||||
|
@ -669,8 +615,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
if(fConverters != null)
|
if(fConverters != null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
IExtensionPoint extensionPoint = Platform.getExtensionRegistry()
|
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(CProjectConverterDesciptor.PROJECT_CONVERTER_EXTPOINT_ID);
|
||||||
.getExtensionPoint(CProjectConverterDesciptor.PROJECT_CONVERTER_EXTPOINT_ID);
|
|
||||||
IExtension exts[] = extensionPoint.getExtensions();
|
IExtension exts[] = extensionPoint.getExtensions();
|
||||||
CProjectConverterDesciptor[] dess = new CProjectConverterDesciptor[exts.length];
|
CProjectConverterDesciptor[] dess = new CProjectConverterDesciptor[exts.length];
|
||||||
|
|
||||||
|
@ -687,8 +632,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICProjectDescription createProjectDescription(IProject project, boolean loadIfExists, boolean creating)
|
public ICProjectDescription createProjectDescription(IProject project, boolean loadIfExists, boolean creating) throws CoreException{
|
||||||
throws CoreException {
|
|
||||||
int flags = ICProjectDescriptionManager.GET_WRITABLE | ICProjectDescriptionManager.GET_CREATE_DESCRIPTION;
|
int flags = ICProjectDescriptionManager.GET_WRITABLE | ICProjectDescriptionManager.GET_CREATE_DESCRIPTION;
|
||||||
flags |= loadIfExists ? 0 : ICProjectDescriptionManager.GET_EMPTY_PROJECT_DESCRIPTION;
|
flags |= loadIfExists ? 0 : ICProjectDescriptionManager.GET_EMPTY_PROJECT_DESCRIPTION;
|
||||||
flags |= creating ? ICProjectDescriptionManager.PROJECT_CREATING : 0;
|
flags |= creating ? ICProjectDescriptionManager.PROJECT_CREATING : 0;
|
||||||
|
@ -702,8 +646,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
return new ScannerInfoProviderProxy(project);
|
return new ScannerInfoProviderProxy(project);
|
||||||
}
|
}
|
||||||
|
|
||||||
ScannerInfoProviderProxy provider = (ScannerInfoProviderProxy) des
|
ScannerInfoProviderProxy provider = (ScannerInfoProviderProxy)des.getSessionProperty(SCANNER_INFO_PROVIDER_PROPERTY);
|
||||||
.getSessionProperty(SCANNER_INFO_PROVIDER_PROPERTY);
|
|
||||||
if(provider == null){
|
if(provider == null){
|
||||||
provider = new ScannerInfoProviderProxy(project);
|
provider = new ScannerInfoProviderProxy(project);
|
||||||
des.setSessionProperty(SCANNER_INFO_PROVIDER_PROPERTY, provider);
|
des.setSessionProperty(SCANNER_INFO_PROVIDER_PROPERTY, provider);
|
||||||
|
@ -722,8 +665,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
/*
|
/*
|
||||||
* returns true if the project description was modified false - otherwise
|
* returns true if the project description was modified false - otherwise
|
||||||
*/
|
*/
|
||||||
public boolean checkHandleActiveCfgChange(CProjectDescription newDes, ICProjectDescription oldDes,
|
public boolean checkHandleActiveCfgChange(CProjectDescription newDes, ICProjectDescription oldDes, IProjectDescription eDes, IProgressMonitor monitor){
|
||||||
IProjectDescription eDes, IProgressMonitor monitor) {
|
|
||||||
if(newDes == null)
|
if(newDes == null)
|
||||||
return false;
|
return false;
|
||||||
ICConfigurationDescription newCfg = newDes.getActiveConfiguration();
|
ICConfigurationDescription newCfg = newDes.getActiveConfiguration();
|
||||||
|
@ -780,9 +722,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
* Fix up platform references having changed CDT configuration references
|
* Fix up platform references having changed CDT configuration references
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private boolean checkProjectRefChange(IProjectDescription des, ICProjectDescription newCDesc,
|
private boolean checkProjectRefChange(IProjectDescription des, ICProjectDescription newCDesc, ICConfigurationDescription newCfg, ICConfigurationDescription oldCfg, IProgressMonitor monitor) throws CoreException{
|
||||||
ICConfigurationDescription newCfg, ICConfigurationDescription oldCfg, IProgressMonitor monitor)
|
|
||||||
throws CoreException {
|
|
||||||
if(newCfg == null)
|
if(newCfg == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -824,6 +764,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// private void checkBuildSystemChange(IProject project, String newBsId, String oldBsId, IProgressMonitor monitor) throws CoreException{
|
// private void checkBuildSystemChange(IProject project, String newBsId, String oldBsId, IProgressMonitor monitor) throws CoreException{
|
||||||
// checkBuildSystemChange(project, null, newBsId, oldBsId, monitor);
|
// checkBuildSystemChange(project, null, newBsId, oldBsId, monitor);
|
||||||
// }
|
// }
|
||||||
|
@ -837,6 +778,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
// String newId = newCfg.getId();
|
// String newId = newCfg.getId();
|
||||||
String oldId = oldCfg != null ? oldCfg.getId() : null;
|
String oldId = oldCfg != null ? oldCfg.getId() : null;
|
||||||
|
|
||||||
|
|
||||||
return des.checkPersistActiveCfg(oldId, false);
|
return des.checkPersistActiveCfg(oldId, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -849,6 +791,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
// String newId = newCfg.getId();
|
// String newId = newCfg.getId();
|
||||||
String oldId = oldCfg != null ? oldCfg.getId() : null;
|
String oldId = oldCfg != null ? oldCfg.getId() : null;
|
||||||
|
|
||||||
|
|
||||||
return des.checkPersistSettingCfg(oldId, false);
|
return des.checkPersistSettingCfg(oldId, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -898,8 +841,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setProjectDescription(IProject project, ICProjectDescription des, boolean force,
|
public void setProjectDescription(IProject project, ICProjectDescription des, boolean force, IProgressMonitor monitor) throws CoreException {
|
||||||
IProgressMonitor monitor) throws CoreException {
|
|
||||||
int flags = force ? SET_FORCE : 0;
|
int flags = force ? SET_FORCE : 0;
|
||||||
setProjectDescription(project, des, flags, monitor);
|
setProjectDescription(project, des, flags, monitor);
|
||||||
}
|
}
|
||||||
|
@ -909,16 +851,9 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** ThreadLocal flag to let CDescriptor know whether already in a setProjectDescription */
|
/** ThreadLocal flag to let CDescriptor know whether already in a setProjectDescription */
|
||||||
ThreadLocal<Boolean> settingProjectDescription = new ThreadLocal<Boolean>() {
|
ThreadLocal<Boolean> settingProjectDescription = new ThreadLocal<Boolean>(){@Override protected Boolean initialValue() {return false;}};
|
||||||
@Override
|
@Override
|
||||||
protected Boolean initialValue() {
|
public void setProjectDescription(IProject project, ICProjectDescription des, int flags, IProgressMonitor monitor) throws CoreException {
|
||||||
return false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setProjectDescription(IProject project, ICProjectDescription des, int flags, IProgressMonitor monitor)
|
|
||||||
throws CoreException {
|
|
||||||
boolean originalState = isCurrentThreadSetProjectDescription();
|
boolean originalState = isCurrentThreadSetProjectDescription();
|
||||||
try {
|
try {
|
||||||
if (originalState) {
|
if (originalState) {
|
||||||
|
@ -926,19 +861,15 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
// But it is quite likely to be an error on part of the caller unaware that their listener can be called from inside setProjectDescription().
|
// But it is quite likely to be an error on part of the caller unaware that their listener can be called from inside setProjectDescription().
|
||||||
// To avoid the log entry the callers should check CProjectDescriptionManager.isCurrentThreadSetProjectDescription()
|
// To avoid the log entry the callers should check CProjectDescriptionManager.isCurrentThreadSetProjectDescription()
|
||||||
// and schedule the update in background thread themselves.
|
// and schedule the update in background thread themselves.
|
||||||
CCorePlugin.logStackTrace(IStatus.INFO,
|
CCorePlugin.logStackTrace(IStatus.INFO, "Recursive setProjectDescription from event listener, project=" + project); //$NON-NLS-1$
|
||||||
"Recursive setProjectDescription from event listener, project=" + project); //$NON-NLS-1$
|
|
||||||
}
|
}
|
||||||
settingProjectDescription.set(true);
|
settingProjectDescription.set(true);
|
||||||
if(des != null){
|
if(des != null){
|
||||||
if (!project.isAccessible())
|
if (!project.isAccessible())
|
||||||
throw ExceptionFactory.createCoreException(MessageFormat.format(
|
throw ExceptionFactory.createCoreException(MessageFormat.format(CCorePlugin.getResourceString("ProjectDescription.ProjectNotAccessible"), new Object[] {project.getName()})); //$NON-NLS-1$
|
||||||
CCorePlugin.getResourceString("ProjectDescription.ProjectNotAccessible"), //$NON-NLS-1$
|
|
||||||
new Object[] { project.getName() }));
|
|
||||||
|
|
||||||
if(!des.isValid() && (!fAllowEmptyCreatingDescription || !des.isCdtProjectCreating()))
|
if(!des.isValid() && (!fAllowEmptyCreatingDescription || !des.isCdtProjectCreating()))
|
||||||
throw ExceptionFactory.createCoreException(
|
throw ExceptionFactory.createCoreException(SettingsModelMessages.getString("CProjectDescriptionManager.17") + project.getName()); //$NON-NLS-1$
|
||||||
SettingsModelMessages.getString("CProjectDescriptionManager.17") + project.getName()); //$NON-NLS-1$
|
|
||||||
|
|
||||||
if(!checkFlags(flags, SET_FORCE) && !des.isModified())
|
if(!checkFlags(flags, SET_FORCE) && !des.isModified())
|
||||||
return;
|
return;
|
||||||
|
@ -958,9 +889,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates that a setProjectDescription is currently in progress to prevent recursive
|
* Indicates that a setProjectDescription is currently in progress to prevent recursive setProjectDescription
|
||||||
* setProjectDescription
|
|
||||||
*
|
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public boolean isCurrentThreadSetProjectDescription() {
|
public boolean isCurrentThreadSetProjectDescription() {
|
||||||
|
@ -969,29 +898,22 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base for getting a project desc's storage. project must be accessible.
|
* Base for getting a project desc's storage. project must be accessible.
|
||||||
*
|
|
||||||
* @param project
|
* @param project
|
||||||
* @return ProjectDescription storage
|
* @return ProjectDescription storage
|
||||||
* @throws CoreException
|
* @throws CoreException if Project isn't accessible
|
||||||
* if Project isn't accessible
|
|
||||||
*/
|
*/
|
||||||
private AbstractCProjectDescriptionStorage getProjectDescriptionStorage(IProject project) throws CoreException {
|
private AbstractCProjectDescriptionStorage getProjectDescriptionStorage(IProject project) throws CoreException {
|
||||||
if (project == null || !project.isAccessible())
|
if (project == null || !project.isAccessible())
|
||||||
throw ExceptionFactory.createCoreException(
|
throw ExceptionFactory.createCoreException(MessageFormat.format(CCorePlugin.getResourceString("ProjectDescription.ProjectNotAccessible"), new Object[] {project != null ? project.getName() : "<null>"})); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
MessageFormat.format(CCorePlugin.getResourceString("ProjectDescription.ProjectNotAccessible"), //$NON-NLS-1$
|
AbstractCProjectDescriptionStorage storage = CProjectDescriptionStorageManager.getInstance().getProjectDescriptionStorage(project);
|
||||||
new Object[] { project != null ? project.getName() : "<null>" })); //$NON-NLS-1$
|
|
||||||
AbstractCProjectDescriptionStorage storage = CProjectDescriptionStorageManager.getInstance()
|
|
||||||
.getProjectDescriptionStorage(project);
|
|
||||||
if (storage == null)
|
if (storage == null)
|
||||||
throw ExceptionFactory.createCoreException(
|
throw ExceptionFactory.createCoreException(SettingsModelMessages.getString("CProjectDescriptionManager.FailedToGetStorage") + project.getName()); //$NON-NLS-1$
|
||||||
SettingsModelMessages.getString("CProjectDescriptionManager.FailedToGetStorage") //$NON-NLS-1$
|
|
||||||
+ project.getName());
|
|
||||||
return storage;
|
return storage;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return an ICSettingsStorage based on the provided ICStorageElement in the given IProject
|
* Return an ICSettingsStorage based on the provided ICStorageElement
|
||||||
*
|
* in the given IProject
|
||||||
* @param project
|
* @param project
|
||||||
* @return ICSettingsStorages
|
* @return ICSettingsStorages
|
||||||
*/
|
*/
|
||||||
|
@ -1085,11 +1007,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
return setting;
|
return setting;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICLanguageSetting findLanguageSettingForContentTypeId(String id, ICLanguageSetting settings[]/*
|
public ICLanguageSetting findLanguageSettingForContentTypeId(String id, ICLanguageSetting settings[]/*, boolean src*/){
|
||||||
* ,
|
|
||||||
* boolean
|
|
||||||
* src
|
|
||||||
*/) {
|
|
||||||
for (ICLanguageSetting setting : settings) {
|
for (ICLanguageSetting setting : settings) {
|
||||||
String ids[] = setting.getSourceContentTypeIds();
|
String ids[] = setting.getSourceContentTypeIds();
|
||||||
if(ListComparator.indexOf(id, ids) != -1)
|
if(ListComparator.indexOf(id, ids) != -1)
|
||||||
|
@ -1098,11 +1016,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICLanguageSetting[] findCompatibleSettingsForContentTypeId(String id, ICLanguageSetting[] settings/*
|
public ICLanguageSetting[] findCompatibleSettingsForContentTypeId(String id, ICLanguageSetting[] settings/*, boolean src*/){
|
||||||
* ,
|
|
||||||
* boolean
|
|
||||||
* src
|
|
||||||
*/) {
|
|
||||||
IContentTypeManager manager = Platform.getContentTypeManager();
|
IContentTypeManager manager = Platform.getContentTypeManager();
|
||||||
IContentType cType = manager.getContentType(id);
|
IContentType cType = manager.getContentType(id);
|
||||||
if(cType != null){
|
if(cType != null){
|
||||||
|
@ -1121,17 +1035,18 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
return EMPTY_LANGUAGE_SETTINGS_ARRAY;
|
return EMPTY_LANGUAGE_SETTINGS_ARRAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICLanguageSetting findLanguageSettingForExtension(String ext, ICLanguageSetting settings[]/*
|
public ICLanguageSetting findLanguageSettingForExtension(String ext, ICLanguageSetting settings[]/*, boolean src*/){
|
||||||
* ,
|
|
||||||
* boolean
|
|
||||||
* src
|
|
||||||
*/) {
|
|
||||||
for (ICLanguageSetting setting : settings) {
|
for (ICLanguageSetting setting : settings) {
|
||||||
String exts[] = setting.getSourceExtensions();
|
String exts[] = setting.getSourceExtensions();
|
||||||
/*
|
/* if(src){
|
||||||
* if(src){ if(setting.getSourceContentType() == null){ exts =
|
if(setting.getSourceContentType() == null){
|
||||||
* setting.getSourceExtensions(); } } else { if(setting.getHeaderContentType() == null){
|
exts = setting.getSourceExtensions();
|
||||||
* exts = setting.getHeaderExtensions(); } }
|
}
|
||||||
|
} else {
|
||||||
|
if(setting.getHeaderContentType() == null){
|
||||||
|
exts = setting.getHeaderExtensions();
|
||||||
|
}
|
||||||
|
}
|
||||||
*/
|
*/
|
||||||
if(exts != null && exts.length != 0){
|
if(exts != null && exts.length != 0){
|
||||||
for (String ex: exts) {
|
for (String ex: exts) {
|
||||||
|
@ -1144,8 +1059,8 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a map of configurations elements as discovered from the supplied project description
|
* Returns a map of configurations elements as discovered from the supplied project
|
||||||
*
|
* description
|
||||||
* @param des
|
* @param des
|
||||||
* @return Map String -> ICStorageElement: configuration name -> configuration ICStorageElement
|
* @return Map String -> ICStorageElement: configuration name -> configuration ICStorageElement
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
|
@ -1169,15 +1084,10 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the configuration storage cfgId in the project description
|
* Create the configuration storage cfgId in the project description
|
||||||
*
|
* @param storage the root settingsStorage of the project
|
||||||
* @param storage
|
* @param cfgId the configuration Id desire
|
||||||
* the root settingsStorage of the project
|
* @return the cfgId as discovered in the project description or a new ICStorageElement with that Id
|
||||||
* @param cfgId
|
* @throws CoreException on failure to create storage
|
||||||
* the configuration Id desire
|
|
||||||
* @return the cfgId as discovered in the project description or a new ICStorageElement with
|
|
||||||
* that Id
|
|
||||||
* @throws CoreException
|
|
||||||
* on failure to create storage
|
|
||||||
*/
|
*/
|
||||||
ICStorageElement createStorage(ICSettingsStorage storage, String cfgId) throws CoreException {
|
ICStorageElement createStorage(ICSettingsStorage storage, String cfgId) throws CoreException {
|
||||||
ICStorageElement rootElement = storage.getStorage(MODULE_ID, true); // throws CoreException
|
ICStorageElement rootElement = storage.getStorage(MODULE_ID, true); // throws CoreException
|
||||||
|
@ -1201,21 +1111,16 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new configuration storage based on an existing 'base' storage. If a configuration
|
* Creates a new configuration storage based on an existing 'base' storage.
|
||||||
* with the new ID already exists in the passed in project storage a CoreException is thrown.
|
* If a configuration with the new ID already exists in the passed in project storage
|
||||||
*
|
* a CoreException is thrown.
|
||||||
* @param storage
|
* @param storage the setting storage of the current project description
|
||||||
* the setting storage of the current project description
|
* @param cfgId configID of the new configuration - must be unique in
|
||||||
* @param cfgId
|
* @param base the base (spec settings) storage element from which settings should be copied.
|
||||||
* configID of the new configuration - must be unique in
|
|
||||||
* @param base
|
|
||||||
* the base (spec settings) storage element from which settings should be copied.
|
|
||||||
* @return ICStorageElement representing the new configuration
|
* @return ICStorageElement representing the new configuration
|
||||||
* @throws CoreException
|
* @throws CoreException on failure
|
||||||
* on failure
|
|
||||||
*/
|
*/
|
||||||
ICStorageElement createStorage(ICSettingsStorage storage, String cfgId, ICStorageElement base)
|
ICStorageElement createStorage(ICSettingsStorage storage, String cfgId, ICStorageElement base) throws CoreException{
|
||||||
throws CoreException {
|
|
||||||
ICStorageElement rootElement = storage.getStorage(MODULE_ID, true);
|
ICStorageElement rootElement = storage.getStorage(MODULE_ID, true);
|
||||||
ICStorageElement children[] = rootElement.getChildren();
|
ICStorageElement children[] = rootElement.getChildren();
|
||||||
for (ICStorageElement child : children) {
|
for (ICStorageElement child : children) {
|
||||||
|
@ -1232,11 +1137,8 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the storage with the supplied configuration Id from the project
|
* Remove the storage with the supplied configuration Id from the project
|
||||||
*
|
* @param storage The root settingsStorage of the project
|
||||||
* @param storage
|
* @param cfgId the configuration ID which would be
|
||||||
* The root settingsStorage of the project
|
|
||||||
* @param cfgId
|
|
||||||
* the configuration ID which would be
|
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
void removeStorage(ICSettingsStorage storage, String cfgId) throws CoreException{
|
void removeStorage(ICSettingsStorage storage, String cfgId) throws CoreException{
|
||||||
|
@ -1266,8 +1168,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void removeData(ICConfigurationDescription des, CConfigurationData data, IProgressMonitor monitor)
|
void removeData(ICConfigurationDescription des, CConfigurationData data, IProgressMonitor monitor) throws CoreException{
|
||||||
throws CoreException {
|
|
||||||
if(monitor == null)
|
if(monitor == null)
|
||||||
monitor = new NullProgressMonitor();
|
monitor = new NullProgressMonitor();
|
||||||
|
|
||||||
|
@ -1275,8 +1176,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
provider.removeConfiguration(des, data, monitor);
|
provider.removeConfiguration(des, data, monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
CConfigurationData createData(ICConfigurationDescription des, ICConfigurationDescription baseDescription,
|
CConfigurationData createData(ICConfigurationDescription des, ICConfigurationDescription baseDescription, CConfigurationData base, boolean clone, IProgressMonitor monitor) throws CoreException{
|
||||||
CConfigurationData base, boolean clone, IProgressMonitor monitor) throws CoreException {
|
|
||||||
if(monitor == null)
|
if(monitor == null)
|
||||||
monitor = new NullProgressMonitor();
|
monitor = new NullProgressMonitor();
|
||||||
|
|
||||||
|
@ -1309,8 +1209,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
if(fProviderMap != null)
|
if(fProviderMap != null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
IExtensionPoint extensionPoint = Platform.getExtensionRegistry()
|
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(CConfigurationDataProviderDescriptor.DATA_PROVIDER_EXTPOINT_ID);
|
||||||
.getExtensionPoint(CConfigurationDataProviderDescriptor.DATA_PROVIDER_EXTPOINT_ID);
|
|
||||||
IExtension exts[] = extensionPoint.getExtensions();
|
IExtension exts[] = extensionPoint.getExtensions();
|
||||||
fProviderMap = new HashMap<String, CConfigurationDataProviderDescriptor>(exts.length);
|
fProviderMap = new HashMap<String, CConfigurationDataProviderDescriptor>(exts.length);
|
||||||
|
|
||||||
|
@ -1321,21 +1220,24 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* CConfigurationSpecSettings createConfigurationSpecSettings(ICConfigurationDescription cfg) throws CoreException{
|
||||||
* CConfigurationSpecSettings createConfigurationSpecSettings(ICConfigurationDescription cfg)
|
CConfigurationSpecSettings settings = null;
|
||||||
* throws CoreException{ CConfigurationSpecSettings settings = null; if(cfg instanceof
|
if(cfg instanceof CConfigurationDescriptionCache){
|
||||||
* CConfigurationDescriptionCache){ settings = new CConfigurationSpecSettings(cfg,
|
settings = new CConfigurationSpecSettings(cfg, createStorage(cfg.getProjectDescription(), cfg.getId()));
|
||||||
* createStorage(cfg.getProjectDescription(), cfg.getId())); } else { ICProjectDescription des =
|
} else {
|
||||||
* getProjecDescription(cfg.getProjectDescription().getProject(), false);
|
ICProjectDescription des = getProjecDescription(cfg.getProjectDescription().getProject(), false);
|
||||||
* CConfigurationDescriptionCache cache =
|
CConfigurationDescriptionCache cache = (CConfigurationDescriptionCache)des.getConfigurationById(cfg.getId());
|
||||||
* (CConfigurationDescriptionCache)des.getConfigurationById(cfg.getId()); if(cache != null){
|
if(cache != null){
|
||||||
* settings = new CConfigurationSpecSettings(cfg, cache.getSpecSettings()); } else { settings =
|
settings = new CConfigurationSpecSettings(cfg, cache.getSpecSettings());
|
||||||
* new CConfigurationSpecSettings(cfg, createStorage(cfg.getProjectDescription(), cfg.getId()));
|
} else {
|
||||||
* } } return settings; }
|
settings = new CConfigurationSpecSettings(cfg, createStorage(cfg.getProjectDescription(), cfg.getId()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return settings;
|
||||||
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public ICStorageElement createPreferenceStorage(String key, boolean createEmptyIfNotFound, boolean readOnly)
|
public ICStorageElement createPreferenceStorage(String key, boolean createEmptyIfNotFound, boolean readOnly) throws CoreException{
|
||||||
throws CoreException {
|
|
||||||
try {
|
try {
|
||||||
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
|
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
|
||||||
Document doc = null;
|
Document doc = null;
|
||||||
|
@ -1351,33 +1253,27 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
Node rootElement = doc.getFirstChild();
|
Node rootElement = doc.getFirstChild();
|
||||||
|
|
||||||
if (rootElement.getNodeType() != Node.PROCESSING_INSTRUCTION_NODE) {
|
if (rootElement.getNodeType() != Node.PROCESSING_INSTRUCTION_NODE) {
|
||||||
throw ExceptionFactory
|
throw ExceptionFactory.createCoreException(SettingsModelMessages.getString("CProjectDescriptionManager.2")); //$NON-NLS-1$
|
||||||
.createCoreException(SettingsModelMessages.getString("CProjectDescriptionManager.2")); //$NON-NLS-1$
|
|
||||||
} else {
|
} else {
|
||||||
String fileVersion = rootElement.getNodeValue();
|
String fileVersion = rootElement.getNodeValue();
|
||||||
Version version = new Version(fileVersion);
|
Version version = new Version(fileVersion);
|
||||||
// Make sure that the version is compatible with the manager
|
// Make sure that the version is compatible with the manager
|
||||||
// Version must between min version and current version inclusive
|
// Version must between min version and current version inclusive
|
||||||
if (MIN_DESCRIPTION_VERSION.compareTo(version) > 0
|
if (MIN_DESCRIPTION_VERSION.compareTo(version) > 0 || DESCRIPTION_VERSION.compareTo(version) < 0) {
|
||||||
|| DESCRIPTION_VERSION.compareTo(version) < 0) {
|
throw ExceptionFactory.createCoreException(SettingsModelMessages.getString("CProjectDescriptionManager.3")); //$NON-NLS-1$
|
||||||
throw ExceptionFactory.createCoreException(
|
|
||||||
SettingsModelMessages.getString("CProjectDescriptionManager.3")); //$NON-NLS-1$
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now get the project root element (there should be only one)
|
// Now get the project root element (there should be only one)
|
||||||
NodeList nodes = doc.getElementsByTagName(ROOT_PREFERENCE_ELEMENT);
|
NodeList nodes = doc.getElementsByTagName(ROOT_PREFERENCE_ELEMENT);
|
||||||
if (nodes.getLength() == 0)
|
if (nodes.getLength() == 0)
|
||||||
throw ExceptionFactory
|
throw ExceptionFactory.createCoreException(SettingsModelMessages.getString("CProjectDescriptionManager.4")); //$NON-NLS-1$
|
||||||
.createCoreException(SettingsModelMessages.getString("CProjectDescriptionManager.4")); //$NON-NLS-1$
|
|
||||||
Node node = nodes.item(0);
|
Node node = nodes.item(0);
|
||||||
if(node.getNodeType() != Node.ELEMENT_NODE)
|
if(node.getNodeType() != Node.ELEMENT_NODE)
|
||||||
throw ExceptionFactory
|
throw ExceptionFactory.createCoreException(SettingsModelMessages.getString("CProjectDescriptionManager.5")); //$NON-NLS-1$
|
||||||
.createCoreException(SettingsModelMessages.getString("CProjectDescriptionManager.5")); //$NON-NLS-1$
|
|
||||||
element = (Element)node;
|
element = (Element)node;
|
||||||
} else if(!createEmptyIfNotFound){
|
} else if(!createEmptyIfNotFound){
|
||||||
throw ExceptionFactory
|
throw ExceptionFactory.createCoreException(SettingsModelMessages.getString("CProjectDescriptionManager.6")); //$NON-NLS-1$
|
||||||
.createCoreException(SettingsModelMessages.getString("CProjectDescriptionManager.6")); //$NON-NLS-1$
|
|
||||||
}
|
}
|
||||||
} catch (FactoryConfigurationError e) {
|
} catch (FactoryConfigurationError e) {
|
||||||
if(!createEmptyIfNotFound)
|
if(!createEmptyIfNotFound)
|
||||||
|
@ -1399,8 +1295,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
|
|
||||||
if(element == null) {
|
if(element == null) {
|
||||||
doc = builder.newDocument();
|
doc = builder.newDocument();
|
||||||
ProcessingInstruction instruction = doc.createProcessingInstruction(VERSION_ELEMENT_NAME,
|
ProcessingInstruction instruction = doc.createProcessingInstruction(VERSION_ELEMENT_NAME, DESCRIPTION_VERSION.toString());
|
||||||
DESCRIPTION_VERSION.toString());
|
|
||||||
doc.appendChild(instruction);
|
doc.appendChild(instruction);
|
||||||
element = doc.createElement(ROOT_PREFERENCE_ELEMENT);
|
element = doc.createElement(ROOT_PREFERENCE_ELEMENT);
|
||||||
doc.appendChild(element);
|
doc.appendChild(element);
|
||||||
|
@ -1490,19 +1385,22 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
return !newCfg.getId().equals(oldCfg.getId());
|
return !newCfg.getId().equals(oldCfg.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* void postProcessNewDescriptionCache(CProjectDescription des, ICProjectDescriptionDelta delta){
|
||||||
* void postProcessNewDescriptionCache(CProjectDescription des, ICProjectDescriptionDelta
|
if(delta == null && delta.getDeltaKind() != ICProjectDescriptionDelta.CHANGED)
|
||||||
* delta){ if(delta == null && delta.getDeltaKind() != ICProjectDescriptionDelta.CHANGED)
|
return;
|
||||||
* return;
|
|
||||||
*
|
ICConfigurationDescription indexCfg = des.getIndexConfiguration();
|
||||||
* ICConfigurationDescription indexCfg = des.getIndexConfiguration(); ICConfigurationDescription
|
ICConfigurationDescription activeCfg = des.getActiveConfiguration();
|
||||||
* activeCfg = des.getActiveConfiguration(); ICProjectDescriptionDelta activeCfgDelta =
|
ICProjectDescriptionDelta activeCfgDelta = findDelta(activeCfg.getId(), delta);
|
||||||
* findDelta(activeCfg.getId(), delta); if(indexCfg != activeCfg){
|
if(indexCfg != activeCfg){
|
||||||
* switch(activeCfgDelta.getDeltaKind()){ case ICProjectDescriptionDelta.CHANGED:
|
switch(activeCfgDelta.getDeltaKind()){
|
||||||
* des.setIndexConfiguration(activeCfg); } }
|
case ICProjectDescriptionDelta.CHANGED:
|
||||||
*
|
des.setIndexConfiguration(activeCfg);
|
||||||
*
|
}
|
||||||
* }
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
*/
|
*/
|
||||||
private ICDescriptionDelta findDelta(String id, ICDescriptionDelta delta){
|
private ICDescriptionDelta findDelta(String id, ICDescriptionDelta delta){
|
||||||
ICDescriptionDelta children[] = delta.getChildren();
|
ICDescriptionDelta children[] = delta.getChildren();
|
||||||
|
@ -1614,8 +1512,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
if(bsDelta != null)
|
if(bsDelta != null)
|
||||||
delta.addChild(bsDelta);
|
delta.addChild(bsDelta);
|
||||||
|
|
||||||
CProjectDescriptionDelta tpsDelta = createDelta(newCfg.getTargetPlatformSetting(),
|
CProjectDescriptionDelta tpsDelta = createDelta(newCfg.getTargetPlatformSetting(), oldCfg.getTargetPlatformSetting());
|
||||||
oldCfg.getTargetPlatformSetting());
|
|
||||||
if(tpsDelta != null)
|
if(tpsDelta != null)
|
||||||
delta.addChild(tpsDelta);
|
delta.addChild(tpsDelta);
|
||||||
|
|
||||||
|
@ -1760,6 +1657,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
return flags;
|
return flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private ExtSettingsDelta[] getSettingChange(ICConfigurationDescription newDes, ICConfigurationDescription oldDes){
|
private ExtSettingsDelta[] getSettingChange(ICConfigurationDescription newDes, ICConfigurationDescription oldDes){
|
||||||
CExternalSetting[] newSettings = newDes != null ? (CExternalSetting[])newDes.getExternalSettings() : null;
|
CExternalSetting[] newSettings = newDes != null ? (CExternalSetting[])newDes.getExternalSettings() : null;
|
||||||
CExternalSetting[] oldSettings = oldDes != null ? (CExternalSetting[])oldDes.getExternalSettings() : null;
|
CExternalSetting[] oldSettings = oldDes != null ? (CExternalSetting[])oldDes.getExternalSettings() : null;
|
||||||
|
@ -1955,11 +1853,13 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
if(!Arrays.equals(newCtIds, oldCtIds))
|
if(!Arrays.equals(newCtIds, oldCtIds))
|
||||||
delta.addChangeFlags(ICDescriptionDelta.SOURCE_CONTENT_TYPE);
|
delta.addChangeFlags(ICDescriptionDelta.SOURCE_CONTENT_TYPE);
|
||||||
|
|
||||||
|
|
||||||
String[] newExts = newLs.getSourceExtensions();
|
String[] newExts = newLs.getSourceExtensions();
|
||||||
String[] oldExts = oldLs.getSourceExtensions();
|
String[] oldExts = oldLs.getSourceExtensions();
|
||||||
if(!Arrays.equals(newExts, oldExts))
|
if(!Arrays.equals(newExts, oldExts))
|
||||||
delta.addChangeFlags(ICDescriptionDelta.SOURCE_EXTENSIONS);
|
delta.addChangeFlags(ICDescriptionDelta.SOURCE_EXTENSIONS);
|
||||||
|
|
||||||
|
|
||||||
// newCt = newLs.getHeaderContentType();
|
// newCt = newLs.getHeaderContentType();
|
||||||
// oldCt = oldLs.getHeaderContentType();
|
// oldCt = oldLs.getHeaderContentType();
|
||||||
|
|
||||||
|
@ -1975,8 +1875,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
return delta.isEmpty() ? null : delta;
|
return delta.isEmpty() ? null : delta;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean[] calculateSettingsChanges(ICLanguageSettingEntry newEntries[],
|
private boolean[] calculateSettingsChanges(ICLanguageSettingEntry newEntries[], ICLanguageSettingEntry oldEntries[]) {
|
||||||
ICLanguageSettingEntry oldEntries[]) {
|
|
||||||
boolean result[] = new boolean[3];
|
boolean result[] = new boolean[3];
|
||||||
|
|
||||||
// if nothing was known before do not generate any deltas.
|
// if nothing was known before do not generate any deltas.
|
||||||
|
@ -2034,14 +1933,17 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* public boolean entriesEqual(ICLanguageSettingEntry entries1[], ICLanguageSettingEntry entries2[]){
|
||||||
* public boolean entriesEqual(ICLanguageSettingEntry entries1[], ICLanguageSettingEntry
|
if(entries1.length != entries2.length)
|
||||||
* entries2[]){ if(entries1.length != entries2.length) return false;
|
return false;
|
||||||
*
|
|
||||||
* for(int i = 0; i < entries1.length; i++){ if(!entries1[i].equals(entries2[i])) return false;
|
for(int i = 0; i < entries1.length; i++){
|
||||||
* }
|
if(!entries1[i].equals(entries2[i]))
|
||||||
*
|
return false;
|
||||||
* return true; }
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
*/
|
*/
|
||||||
private CProjectDescriptionDelta createDelta(ICBuildSetting newBuildSetting, ICBuildSetting oldBuildSetting){
|
private CProjectDescriptionDelta createDelta(ICBuildSetting newBuildSetting, ICBuildSetting oldBuildSetting){
|
||||||
CProjectDescriptionDelta delta = new CProjectDescriptionDelta(newBuildSetting, oldBuildSetting);
|
CProjectDescriptionDelta delta = new CProjectDescriptionDelta(newBuildSetting, oldBuildSetting);
|
||||||
|
@ -2098,8 +2000,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
return EMPTY_CELEMENT_DELTA;
|
return EMPTY_CELEMENT_DELTA;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<CElementDelta> generateCElementDeltasFromCfgDelta(ICProject cProject, ICDescriptionDelta cfgDelta,
|
private List<CElementDelta> generateCElementDeltasFromCfgDelta(ICProject cProject, ICDescriptionDelta cfgDelta, List<CElementDelta> list){
|
||||||
List<CElementDelta> list) {
|
|
||||||
int kind = cfgDelta.getDeltaKind();
|
int kind = cfgDelta.getDeltaKind();
|
||||||
switch(kind){
|
switch(kind){
|
||||||
case ICDescriptionDelta.CHANGED:
|
case ICDescriptionDelta.CHANGED:
|
||||||
|
@ -2133,13 +2034,11 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The method maps {@link ICDescriptionDelta} to {@link CElementDelta} which are added to the
|
* The method maps {@link ICDescriptionDelta} to {@link CElementDelta} which are added to the {@code list}.
|
||||||
* {@code list}. The delta will indicate modification of CElement for a given resource plus
|
* The delta will indicate modification of CElement for a given resource plus language settings
|
||||||
* language settings if they changed (relative to parent resource description if the resource
|
* if they changed (relative to parent resource description if the resource has no its own).
|
||||||
* has no its own).
|
|
||||||
*/
|
*/
|
||||||
private void generateCElementDeltasFromResourceDelta(ICProject cProject, ICDescriptionDelta delta,
|
private void generateCElementDeltasFromResourceDelta(ICProject cProject, ICDescriptionDelta delta, List<CElementDelta> list){
|
||||||
List<CElementDelta> list) {
|
|
||||||
int kind = delta.getDeltaKind();
|
int kind = delta.getDeltaKind();
|
||||||
ICDescriptionDelta parentDelta = delta.getParent();
|
ICDescriptionDelta parentDelta = delta.getParent();
|
||||||
|
|
||||||
|
@ -2164,8 +2063,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// Not possible
|
// Not possible
|
||||||
CCorePlugin.log(new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID,
|
CCorePlugin.log(new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, SettingsModelMessages.getString("CProjectDescriptionManager.illegalDeltaKind")+kind)); //$NON-NLS-1$
|
||||||
SettingsModelMessages.getString("CProjectDescriptionManager.illegalDeltaKind") + kind)); //$NON-NLS-1$
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
path = path.makeRelative();
|
path = path.makeRelative();
|
||||||
|
@ -2191,17 +2089,13 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
generateCElementDeltasFromLanguageDelta(el, ld, list);
|
generateCElementDeltasFromLanguageDelta(el, ld, list);
|
||||||
} else {
|
} else {
|
||||||
if(newRcDes.getType() != ICSettingBase.SETTING_FOLDER){
|
if(newRcDes.getType() != ICSettingBase.SETTING_FOLDER){
|
||||||
CCorePlugin.log(new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID,
|
CCorePlugin.log(new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, SettingsModelMessages.getString("CProjectDescriptionManager.wrongTypeOfResourceDescription")+newRcDes)); //$NON-NLS-1$
|
||||||
SettingsModelMessages.getString("CProjectDescriptionManager.wrongTypeOfResourceDescription") //$NON-NLS-1$
|
|
||||||
+ newRcDes));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ICFolderDescription newFoDes = (ICFolderDescription)newRcDes;
|
ICFolderDescription newFoDes = (ICFolderDescription)newRcDes;
|
||||||
|
|
||||||
if(oldRcDes.getType() != ICSettingBase.SETTING_FOLDER){
|
if(oldRcDes.getType() != ICSettingBase.SETTING_FOLDER){
|
||||||
CCorePlugin.log(new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID,
|
CCorePlugin.log(new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, SettingsModelMessages.getString("CProjectDescriptionManager.wrongTypeOfResourceDescription")+oldRcDes)); //$NON-NLS-1$
|
||||||
SettingsModelMessages.getString("CProjectDescriptionManager.wrongTypeOfResourceDescription") //$NON-NLS-1$
|
|
||||||
+ oldRcDes));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ICFolderDescription oldFoDes = (ICFolderDescription)oldRcDes;
|
ICFolderDescription oldFoDes = (ICFolderDescription)oldRcDes;
|
||||||
|
@ -2226,8 +2120,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
return ((ICFolderDescription)rcDes).getLanguageSettingForFile(fileName);
|
return ((ICFolderDescription)rcDes).getLanguageSettingForFile(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<CElementDelta> generateCElementDeltasFromLanguageDelta(ICElement el, ICDescriptionDelta delta,
|
private List<CElementDelta> generateCElementDeltasFromLanguageDelta(ICElement el, ICDescriptionDelta delta, List<CElementDelta> list){
|
||||||
List<CElementDelta> list) {
|
|
||||||
if(delta == null)
|
if(delta == null)
|
||||||
return list;
|
return list;
|
||||||
|
|
||||||
|
@ -2352,8 +2245,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICConfigurationDescription getPreferenceConfiguration(String buildSystemId, boolean write)
|
public ICConfigurationDescription getPreferenceConfiguration(String buildSystemId, boolean write) throws CoreException {
|
||||||
throws CoreException {
|
|
||||||
ICConfigurationDescription des = getLoaddedPreference(buildSystemId);
|
ICConfigurationDescription des = getLoaddedPreference(buildSystemId);
|
||||||
if(des == null){
|
if(des == null){
|
||||||
try {
|
try {
|
||||||
|
@ -2394,14 +2286,12 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
setLoaddedPreference(buildSystemId, cache);
|
setLoaddedPreference(buildSystemId, cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void savePreferenceConfiguration(String buildStystemId, CConfigurationDescriptionCache cache)
|
private void savePreferenceConfiguration(String buildStystemId, CConfigurationDescriptionCache cache) throws CoreException{
|
||||||
throws CoreException {
|
|
||||||
ICStorageElement el = cache.getSpecSettings().getRootStorageElement();
|
ICStorageElement el = cache.getSpecSettings().getRootStorageElement();
|
||||||
saveBuildSystemConfigPreferenceStorage(buildStystemId, el);
|
saveBuildSystemConfigPreferenceStorage(buildStystemId, el);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveBuildSystemConfigPreferenceStorage(String buildSystemId, ICStorageElement el)
|
private void saveBuildSystemConfigPreferenceStorage(String buildSystemId, ICStorageElement el) throws CoreException{
|
||||||
throws CoreException {
|
|
||||||
ICStorageElement cur = getBuildSystemConfigPreferenceStorage(buildSystemId);
|
ICStorageElement cur = getBuildSystemConfigPreferenceStorage(buildSystemId);
|
||||||
ICStorageElement parent = cur.getParent();
|
ICStorageElement parent = cur.getParent();
|
||||||
parent.removeChild(cur);
|
parent.removeChild(cur);
|
||||||
|
@ -2418,8 +2308,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ICConfigurationDescription createWritablePreference(CConfigurationDescriptionCache cache)
|
private ICConfigurationDescription createWritablePreference(CConfigurationDescriptionCache cache) throws CoreException{
|
||||||
throws CoreException {
|
|
||||||
return new CConfigurationDescription(cache, fPrefUpdater);
|
return new CConfigurationDescription(cache, fPrefUpdater);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2437,8 +2326,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
rootParent.removeChild(rootEl);
|
rootParent.removeChild(rootEl);
|
||||||
ICStorageElement baseRootEl = settings.getRootStorageElement();
|
ICStorageElement baseRootEl = settings.getRootStorageElement();
|
||||||
rootEl = rootParent.importChild(baseRootEl);
|
rootEl = rootParent.importChild(baseRootEl);
|
||||||
CConfigurationDescriptionCache cache = new CConfigurationDescriptionCache(des, baseData, baseCache,
|
CConfigurationDescriptionCache cache = new CConfigurationDescriptionCache(des, baseData, baseCache, cfgDes.getSpecSettings(), null, rootEl);
|
||||||
cfgDes.getSpecSettings(), null, rootEl);
|
|
||||||
SettingsContext context = new SettingsContext(null);
|
SettingsContext context = new SettingsContext(null);
|
||||||
cache.applyData(context);
|
cache.applyData(context);
|
||||||
cache.doneInitialization();
|
cache.doneInitialization();
|
||||||
|
@ -2450,8 +2338,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
ICStorageElement cfgEl = getBuildSystemConfigPreferenceStorage(buildSystemId, true, false);
|
ICStorageElement cfgEl = getBuildSystemConfigPreferenceStorage(buildSystemId, true, false);
|
||||||
|
|
||||||
String id = PREFERENCE_CFG_ID_PREFIX + buildSystemId;
|
String id = PREFERENCE_CFG_ID_PREFIX + buildSystemId;
|
||||||
CConfigurationDescription des = new CConfigurationDescription(id, PREFERENCE_CFG_NAME, buildSystemId, cfgEl,
|
CConfigurationDescription des = new CConfigurationDescription(id, PREFERENCE_CFG_NAME, buildSystemId, cfgEl, fPrefUpdater);
|
||||||
fPrefUpdater);
|
|
||||||
|
|
||||||
return createPreferenceCache(des);
|
return createPreferenceCache(des);
|
||||||
}
|
}
|
||||||
|
@ -2476,8 +2363,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
return getBuildSystemConfigPreferenceStorage(buildSystemId, true, false);
|
return getBuildSystemConfigPreferenceStorage(buildSystemId, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ICStorageElement getBuildSystemConfigPreferenceStorage(String buildSystemId, boolean createIfNotDound,
|
private ICStorageElement getBuildSystemConfigPreferenceStorage(String buildSystemId, boolean createIfNotDound, boolean readOnly) throws CoreException{
|
||||||
boolean readOnly) throws CoreException {
|
|
||||||
ICStorageElement el = getPreferenceStorage(PREFERENCES_STORAGE, MODULE_ID, createIfNotDound, readOnly);
|
ICStorageElement el = getPreferenceStorage(PREFERENCES_STORAGE, MODULE_ID, createIfNotDound, readOnly);
|
||||||
ICStorageElement cfgEl = null;
|
ICStorageElement cfgEl = null;
|
||||||
|
|
||||||
|
@ -2523,15 +2409,13 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
return cache;
|
return cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICStorageElement getPreferenceStorage(String prefKey, String storageId, boolean createIfNotDound,
|
public ICStorageElement getPreferenceStorage(String prefKey, String storageId, boolean createIfNotDound, boolean readOnly) throws CoreException{
|
||||||
boolean readOnly) throws CoreException {
|
|
||||||
XmlStorage store = getPreferenceStore(prefKey, createIfNotDound, readOnly);
|
XmlStorage store = getPreferenceStore(prefKey, createIfNotDound, readOnly);
|
||||||
|
|
||||||
return store.getStorage(storageId, createIfNotDound);
|
return store.getStorage(storageId, createIfNotDound);
|
||||||
}
|
}
|
||||||
|
|
||||||
private XmlStorage getPreferenceStore(String prefKey, boolean createIfNotDound, boolean readOnly)
|
private XmlStorage getPreferenceStore(String prefKey, boolean createIfNotDound, boolean readOnly) throws CoreException{
|
||||||
throws CoreException {
|
|
||||||
ICStorageElement el = createPreferenceStorage(prefKey, createIfNotDound, readOnly);
|
ICStorageElement el = createPreferenceStorage(prefKey, createIfNotDound, readOnly);
|
||||||
|
|
||||||
XmlStorage store = new XmlStorage((InternalXmlStorageElement)el);
|
XmlStorage store = new XmlStorage((InternalXmlStorageElement)el);
|
||||||
|
@ -2563,8 +2447,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
return createDefaultConfigData(project, CDataUtil.genId(DEFAULT_CFG_ID_PREFIX), DEFAULT_CFG_NAME, factory);
|
return createDefaultConfigData(project, CDataUtil.genId(DEFAULT_CFG_ID_PREFIX), DEFAULT_CFG_NAME, factory);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CConfigurationData createDefaultConfigData(IProject project, String id, String name, CDataFactory factory)
|
public CConfigurationData createDefaultConfigData(IProject project, String id, String name, CDataFactory factory) throws CoreException{
|
||||||
throws CoreException {
|
|
||||||
if(factory == null)
|
if(factory == null)
|
||||||
factory = new CDataFactory();
|
factory = new CDataFactory();
|
||||||
|
|
||||||
|
@ -2650,8 +2533,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
// return CDataUtil.getExtensionsFromContentTypes(project, typeIds);
|
// return CDataUtil.getExtensionsFromContentTypes(project, typeIds);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
static ICLanguageSetting getLanguageSettingForFile(ICConfigurationDescription cfgDes, IPath path,
|
static ICLanguageSetting getLanguageSettingForFile(ICConfigurationDescription cfgDes, IPath path, boolean ignoreExcludeStatus){
|
||||||
boolean ignoreExcludeStatus) {
|
|
||||||
int segCount = path.segmentCount();
|
int segCount = path.segmentCount();
|
||||||
if(segCount == 0)
|
if(segCount == 0)
|
||||||
return null;
|
return null;
|
||||||
|
@ -2666,8 +2548,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
return ((ICFileDescription)rcDes).getLanguageSetting();
|
return ((ICFileDescription)rcDes).getLanguageSetting();
|
||||||
}
|
}
|
||||||
|
|
||||||
static private HashMap<HashSet<String>, CLanguageData> createExtSetToLDataMap(IProject project,
|
static private HashMap<HashSet<String>, CLanguageData> createExtSetToLDataMap(IProject project, CLanguageData[] lDatas){
|
||||||
CLanguageData[] lDatas) {
|
|
||||||
HashMap<HashSet<String>, CLanguageData> map = new HashMap<HashSet<String>, CLanguageData>();
|
HashMap<HashSet<String>, CLanguageData> map = new HashMap<HashSet<String>, CLanguageData>();
|
||||||
|
|
||||||
for (CLanguageData lData : lDatas) {
|
for (CLanguageData lData : lDatas) {
|
||||||
|
@ -2689,12 +2570,12 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
childRcData = (CResourceData)child.getValue();
|
childRcData = (CResourceData)child.getValue();
|
||||||
if(childRcData.getType() == ICSettingBase.SETTING_FOLDER){
|
if(childRcData.getType() == ICSettingBase.SETTING_FOLDER){
|
||||||
CResourceData parentRcData = null;
|
CResourceData parentRcData = null;
|
||||||
for (parent = child.getParentContainer(); (parentRcData = (CResourceData) parent.getValue())
|
for(parent = child.getParentContainer();
|
||||||
.getType() != ICSettingBase.SETTING_FOLDER; parent = parent.getParentContainer()) {
|
(parentRcData = (CResourceData)parent.getValue()).getType() != ICSettingBase.SETTING_FOLDER;
|
||||||
|
parent = parent.getParentContainer()) {
|
||||||
// no body, this loop is to find the parent
|
// no body, this loop is to find the parent
|
||||||
}
|
}
|
||||||
if (!settingsCustomized(project, (CFolderData) parentRcData, (CFolderData) childRcData,
|
if(!settingsCustomized(project, (CFolderData)parentRcData, (CFolderData)childRcData, parent.isRoot())){
|
||||||
parent.isRoot())) {
|
|
||||||
try {
|
try {
|
||||||
data.removeResourceData(childRcData);
|
data.removeResourceData(childRcData);
|
||||||
child.remove();
|
child.remove();
|
||||||
|
@ -2720,8 +2601,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
return modified;
|
return modified;
|
||||||
}
|
}
|
||||||
|
|
||||||
static private boolean settingsCustomized(IProject project, CFolderData parent, CFolderData child,
|
static private boolean settingsCustomized(IProject project, CFolderData parent, CFolderData child, boolean isParentRoot){
|
||||||
boolean isParentRoot) {
|
|
||||||
if(baseSettingsCustomized(parent, child))
|
if(baseSettingsCustomized(parent, child))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -2799,6 +2679,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICProjectDescriptionWorkspacePreferences getProjectDescriptionWorkspacePreferences(
|
public ICProjectDescriptionWorkspacePreferences getProjectDescriptionWorkspacePreferences(
|
||||||
boolean write) {
|
boolean write) {
|
||||||
|
@ -2879,8 +2760,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
return new CProjectDescriptionWorkspacePreferences(el, null, true);
|
return new CProjectDescriptionWorkspacePreferences(el, null, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ICStorageElement getCProjectDescriptionPreferencesElement(boolean createIfNotFound, boolean readOnly)
|
private ICStorageElement getCProjectDescriptionPreferencesElement(boolean createIfNotFound, boolean readOnly) throws CoreException{
|
||||||
throws CoreException {
|
|
||||||
ICStorageElement el = getPreferenceStorage(PREFERENCES_STORAGE, MODULE_ID, createIfNotFound, readOnly);
|
ICStorageElement el = getPreferenceStorage(PREFERENCES_STORAGE, MODULE_ID, createIfNotFound, readOnly);
|
||||||
ICStorageElement[] children = el.getChildren();
|
ICStorageElement[] children = el.getChildren();
|
||||||
for (ICStorageElement child : children) {
|
for (ICStorageElement child : children) {
|
||||||
|
|
|
@ -856,22 +856,5 @@
|
||||||
ordering="first">
|
ordering="first">
|
||||||
</filterMatcher>
|
</filterMatcher>
|
||||||
</extension>
|
</extension>
|
||||||
<extension
|
|
||||||
point="org.eclipse.core.runtime.adapters">
|
|
||||||
<factory
|
|
||||||
adaptableType="org.eclipse.cdt.core.settings.model.ICConfigurationDescription"
|
|
||||||
class="org.eclipse.cdt.internal.core.settings.model.CConfigurationAdapterFactory">
|
|
||||||
<adapter
|
|
||||||
type="org.eclipse.core.resources.IBuildConfiguration">
|
|
||||||
</adapter>
|
|
||||||
</factory>
|
|
||||||
<factory
|
|
||||||
adaptableType="org.eclipse.core.resources.IBuildConfiguration"
|
|
||||||
class="org.eclipse.cdt.internal.core.settings.model.BuildConfigAdapterFactory">
|
|
||||||
<adapter
|
|
||||||
type="org.eclipse.cdt.core.settings.model.ICConfigurationDescription">
|
|
||||||
</adapter>
|
|
||||||
</factory>
|
|
||||||
</extension>
|
|
||||||
|
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
|
@ -92,8 +92,8 @@ import org.osgi.framework.BundleContext;
|
||||||
import com.ibm.icu.text.MessageFormat;
|
import com.ibm.icu.text.MessageFormat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CCorePlugin is the life-cycle owner of the core plug-in, and starting point for access to many
|
* CCorePlugin is the life-cycle owner of the core plug-in, and starting point
|
||||||
* core APIs.
|
* for access to many core APIs.
|
||||||
*
|
*
|
||||||
* @noextend This class is not intended to be subclassed by clients.
|
* @noextend This class is not intended to be subclassed by clients.
|
||||||
* @noinstantiate This class is not intended to be instantiated by clients.
|
* @noinstantiate This class is not intended to be instantiated by clients.
|
||||||
|
@ -103,7 +103,8 @@ public class CCorePlugin extends Plugin {
|
||||||
public static final int STATUS_CDTPROJECT_MISMATCH = 2;
|
public static final int STATUS_CDTPROJECT_MISMATCH = 2;
|
||||||
public static final int CDT_PROJECT_NATURE_ID_MISMATCH = 3;
|
public static final int CDT_PROJECT_NATURE_ID_MISMATCH = 3;
|
||||||
/**
|
/**
|
||||||
* Status code for core exception that is thrown if a pdom grew larger than the supported limit.
|
* Status code for core exception that is thrown if a pdom grew larger than
|
||||||
|
* the supported limit.
|
||||||
*
|
*
|
||||||
* @since 5.2
|
* @since 5.2
|
||||||
*/
|
*/
|
||||||
|
@ -275,7 +276,8 @@ public class CCorePlugin extends Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the shared working copies currently registered for the default buffer factory.
|
* Returns the shared working copies currently registered for the default
|
||||||
|
* buffer factory.
|
||||||
*
|
*
|
||||||
* @since 5.1
|
* @since 5.1
|
||||||
*/
|
*/
|
||||||
|
@ -380,21 +382,25 @@ public class CCorePlugin extends Plugin {
|
||||||
pdomManager = new PDOMManager();
|
pdomManager = new PDOMManager();
|
||||||
final Job post2 = pdomManager.startup();
|
final Job post2 = pdomManager.startup();
|
||||||
|
|
||||||
// bug 186755, when started after the platform has been started the job manager
|
// bug 186755, when started after the platform has been started the job
|
||||||
// is no longer suspended. So we have to start a job at the very end to make
|
// manager
|
||||||
// sure we don't trigger a concurrent plug-in activation from within the job.
|
// is no longer suspended. So we have to start a job at the very end to
|
||||||
|
// make
|
||||||
|
// sure we don't trigger a concurrent plug-in activation from within the
|
||||||
|
// job.
|
||||||
post1.schedule();
|
post1.schedule();
|
||||||
post2.schedule();
|
post2.schedule();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: Add all options here Returns a table of all known configurable options with their
|
* TODO: Add all options here Returns a table of all known configurable
|
||||||
* default values. These options allow to configure the behavior of the underlying components.
|
* options with their default values. These options allow to configure the
|
||||||
* The client may safely use the result as a template that they can modify and then pass to
|
* behavior of the underlying components. The client may safely use the
|
||||||
|
* result as a template that they can modify and then pass to
|
||||||
* <code>setOptions</code>.
|
* <code>setOptions</code>.
|
||||||
*
|
*
|
||||||
* Helper constants have been defined on CCorePlugin for each of the option ID and their
|
* Helper constants have been defined on CCorePlugin for each of the option
|
||||||
* possible constant values.
|
* ID and their possible constant values.
|
||||||
*
|
*
|
||||||
* Note: more options might be added in further releases.
|
* Note: more options might be added in further releases.
|
||||||
*
|
*
|
||||||
|
@ -409,8 +415,9 @@ public class CCorePlugin extends Plugin {
|
||||||
* - default: <platform default>
|
* - default: <platform default>
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @return a mutable map containing the default settings of all known options (key type:
|
* @return a mutable map containing the default settings of all known
|
||||||
* <code>String</code>; value type: <code>String</code>)
|
* options (key type: <code>String</code>; value type:
|
||||||
|
* <code>String</code>)
|
||||||
* @see #setOptions
|
* @see #setOptions
|
||||||
*/
|
*/
|
||||||
public static HashMap<String, String> getDefaultOptions() {
|
public static HashMap<String, String> getDefaultOptions() {
|
||||||
|
@ -439,10 +446,11 @@ public class CCorePlugin extends Plugin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method for returning one option value only. Equivalent to
|
* Helper method for returning one option value only. Equivalent to
|
||||||
* <code>(String)CCorePlugin.getOptions().get(optionName)</code> Note that it may answer
|
* <code>(String)CCorePlugin.getOptions().get(optionName)</code> Note that
|
||||||
* <code>null</code> if this option does not exist.
|
* it may answer <code>null</code> if this option does not exist.
|
||||||
* <p>
|
* <p>
|
||||||
* For a complete description of the configurable options, see <code>getDefaultOptions</code>.
|
* For a complete description of the configurable options, see
|
||||||
|
* <code>getDefaultOptions</code>.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param optionName
|
* @param optionName
|
||||||
|
@ -463,14 +471,16 @@ public class CCorePlugin extends Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the table of the current options. Initially, all options have their default values,
|
* Returns the table of the current options. Initially, all options have
|
||||||
* and this method returns a table that includes all known options.
|
* their default values, and this method returns a table that includes all
|
||||||
|
* known options.
|
||||||
* <p>
|
* <p>
|
||||||
* For a complete description of the configurable options, see <code>getDefaultOptions</code>.
|
* For a complete description of the configurable options, see
|
||||||
|
* <code>getDefaultOptions</code>.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @return table of current settings of all options (key type: <code>String</code>; value type:
|
* @return table of current settings of all options (key type:
|
||||||
* <code>String</code>)
|
* <code>String</code>; value type: <code>String</code>)
|
||||||
* @see CCorePlugin#getDefaultOptions
|
* @see CCorePlugin#getDefaultOptions
|
||||||
*/
|
*/
|
||||||
public static HashMap<String, String> getOptions() {
|
public static HashMap<String, String> getOptions() {
|
||||||
|
@ -502,16 +512,18 @@ public class CCorePlugin extends Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the current table of options. All and only the options explicitly included in the given
|
* Sets the current table of options. All and only the options explicitly
|
||||||
* table are remembered; all previous option settings are forgotten, including ones not
|
* included in the given table are remembered; all previous option settings
|
||||||
* explicitly mentioned.
|
* are forgotten, including ones not explicitly mentioned.
|
||||||
* <p>
|
* <p>
|
||||||
* For a complete description of the configurable options, see <code>getDefaultOptions</code>.
|
* For a complete description of the configurable options, see
|
||||||
|
* <code>getDefaultOptions</code>.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param newOptions
|
* @param newOptions
|
||||||
* the new options (key type: <code>String</code>; value type: <code>String</code>),
|
* the new options (key type: <code>String</code>; value type:
|
||||||
* or <code>null</code> to reset all options to their default values
|
* <code>String</code>), or <code>null</code> to reset all
|
||||||
|
* options to their default values
|
||||||
* @see CCorePlugin#getDefaultOptions
|
* @see CCorePlugin#getDefaultOptions
|
||||||
*/
|
*/
|
||||||
public static void setOptions(HashMap<String, String> newOptions) {
|
public static void setOptions(HashMap<String, String> newOptions) {
|
||||||
|
@ -538,22 +550,24 @@ public class CCorePlugin extends Plugin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create CDT console adapter for build console defined as an extension. See
|
* Create CDT console adapter for build console defined as an extension. See
|
||||||
* {@code org.eclipse.cdt.core.CBuildConsole} extension point. If the console class is instance
|
* {@code org.eclipse.cdt.core.CBuildConsole} extension point. If the
|
||||||
* of {@link ICConsole} it is initialized with context id, name and icon to be shown in the list
|
* console class is instance of {@link ICConsole} it is initialized with
|
||||||
* of consoles in the Console view.
|
* context id, name and icon to be shown in the list of consoles in the
|
||||||
|
* Console view.
|
||||||
*
|
*
|
||||||
* @param extConsoleId
|
* @param extConsoleId
|
||||||
* - console id defined in the extension point.
|
* - console id defined in the extension point.
|
||||||
* @param contextId
|
* @param contextId
|
||||||
* - context menu id in the Console view. A caller needs to define a distinct one for
|
* - context menu id in the Console view. A caller needs to
|
||||||
* own use.
|
* define a distinct one for own use.
|
||||||
* @param name
|
* @param name
|
||||||
* - name of console to appear in the list of consoles in context menu in the Console
|
* - name of console to appear in the list of consoles in context
|
||||||
* view.
|
* menu in the Console view.
|
||||||
* @param iconUrl
|
* @param iconUrl
|
||||||
* - a {@link URL} of the icon for the context menu of the Console view. The url is
|
* - a {@link URL} of the icon for the context menu of the
|
||||||
* expected to point to an image in eclipse OSGi bundle. Here is an example how to
|
* Console view. The url is expected to point to an image in
|
||||||
* retrieve URL: <br/>
|
* eclipse OSGi bundle. Here is an example how to retrieve URL:
|
||||||
|
* <br/>
|
||||||
* <code>
|
* <code>
|
||||||
* URL iconUrl = CUIPlugin.getDefault().getBundle().getEntry("icons/obj16/flask.png");
|
* URL iconUrl = CUIPlugin.getDefault().getBundle().getEntry("icons/obj16/flask.png");
|
||||||
* </code>
|
* </code>
|
||||||
|
@ -590,11 +604,13 @@ public class CCorePlugin extends Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create CDT console adapter. The adapter serves as a bridge between core plugin and UI console
|
* Create CDT console adapter. The adapter serves as a bridge between core
|
||||||
* API in a way that a user can create a UI console from plugins having no dependencies to UI.
|
* plugin and UI console API in a way that a user can create a UI console
|
||||||
|
* from plugins having no dependencies to UI.
|
||||||
*
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* - id of the console specified in extension point to instantiate console adapter.
|
* - id of the console specified in extension point to
|
||||||
|
* instantiate console adapter.
|
||||||
* @return CDT console adapter.
|
* @return CDT console adapter.
|
||||||
*/
|
*/
|
||||||
public IConsole getConsole(String id) {
|
public IConsole getConsole(String id) {
|
||||||
|
@ -603,23 +619,25 @@ public class CCorePlugin extends Plugin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create CDT console adapter for build console. A new instance of class
|
* Create CDT console adapter for build console. A new instance of class
|
||||||
* {@code org.eclipse.cdt.internal.ui.buildconsole.CBuildConsole} is created and initialized
|
* {@code org.eclipse.cdt.internal.ui.buildconsole.CBuildConsole} is created
|
||||||
* with the parameters.
|
* and initialized with the parameters.
|
||||||
*
|
*
|
||||||
* @param contextId
|
* @param contextId
|
||||||
* - context menu id in the Console view. A caller needs to define a distinct one for
|
* - context menu id in the Console view. A caller needs to
|
||||||
* own use.
|
* define a distinct one for own use.
|
||||||
* @param name
|
* @param name
|
||||||
* - name of console to appear in the list of consoles in context menu in the Console
|
* - name of console to appear in the list of consoles in context
|
||||||
* view.
|
* menu in the Console view.
|
||||||
* @param iconUrl
|
* @param iconUrl
|
||||||
* - a {@link URL} of the icon for the context menu of the Console view. The url is
|
* - a {@link URL} of the icon for the context menu of the
|
||||||
* expected to point to an image in eclipse OSGi bundle. Here is an example how to
|
* Console view. The url is expected to point to an image in
|
||||||
* retrieve URL: <br/>
|
* eclipse OSGi bundle. Here is an example how to retrieve URL:
|
||||||
|
* <br/>
|
||||||
* <code>
|
* <code>
|
||||||
* URL iconUrl = CUIPlugin.getDefault().getBundle().getResource("icons/obj16/flask.png");
|
* URL iconUrl = CUIPlugin.getDefault().getBundle().getResource("icons/obj16/flask.png");
|
||||||
* </code> <br/>
|
* </code> <br/>
|
||||||
* {@code iconUrl} can be <b>null</b>, in that case the default image is used. See
|
* {@code iconUrl} can be <b>null</b>, in that case the default
|
||||||
|
* image is used. See
|
||||||
* {@code org.eclipse.cdt.internal.ui.buildconsole.BuildConsole(IBuildConsoleManager, String, String, URL)}
|
* {@code org.eclipse.cdt.internal.ui.buildconsole.BuildConsole(IBuildConsoleManager, String, String, URL)}
|
||||||
*
|
*
|
||||||
* @return CDT console adapter.
|
* @return CDT console adapter.
|
||||||
|
@ -639,7 +657,8 @@ public class CCorePlugin extends Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated Use {@link #getDefaultBinaryParserExtensions(IProject)} instead.
|
* @deprecated Use {@link #getDefaultBinaryParserExtensions(IProject)}
|
||||||
|
* instead.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public ICExtensionReference[] getBinaryParserExtensions(IProject project) throws CoreException {
|
public ICExtensionReference[] getBinaryParserExtensions(IProject project) throws CoreException {
|
||||||
|
@ -660,7 +679,8 @@ public class CCorePlugin extends Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the binary parser extensions for the default settings configuration.
|
* Returns the binary parser extensions for the default settings
|
||||||
|
* configuration.
|
||||||
*
|
*
|
||||||
* @since 5.2
|
* @since 5.2
|
||||||
*/
|
*/
|
||||||
|
@ -774,14 +794,14 @@ public class CCorePlugin extends Plugin {
|
||||||
* Please use {@link #getProjectDescription(IProject, boolean)} to fetch the
|
* Please use {@link #getProjectDescription(IProject, boolean)} to fetch the
|
||||||
* ICProjectDescription for the project. And use
|
* ICProjectDescription for the project. And use
|
||||||
* {@link ICProjectDescription#getConfigurations()} to get an array of
|
* {@link ICProjectDescription#getConfigurations()} to get an array of
|
||||||
* ICConfigurationDescriptions, which have similar API to ICDescriptor, allowing you to store
|
* ICConfigurationDescriptions, which have similar API to ICDescriptor,
|
||||||
* settings and configure extensions at the Configuration level rather than at the project
|
* allowing you to store settings and configure extensions at the
|
||||||
* level.
|
* Configuration level rather than at the project level.
|
||||||
*
|
*
|
||||||
* @param project
|
* @param project
|
||||||
* @param create
|
* @param create
|
||||||
* @return ICDescriptor or <b>null</b> if <b>create</b> is <b>false</b> and no .cdtproject file
|
* @return ICDescriptor or <b>null</b> if <b>create</b> is <b>false</b> and
|
||||||
* exists on disk.
|
* no .cdtproject file exists on disk.
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
|
@ -803,13 +823,15 @@ public class CCorePlugin extends Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated Settings should be set per ICConfigurationDescription rather than global to the
|
* @deprecated Settings should be set per ICConfigurationDescription rather
|
||||||
* project. Please use {@link #getProjectDescription(IProject, boolean)} to fetch
|
* than global to the project. Please use
|
||||||
|
* {@link #getProjectDescription(IProject, boolean)} to fetch
|
||||||
* the ICProjectDescription for the project. And use
|
* the ICProjectDescription for the project. And use
|
||||||
* {@link ICProjectDescription#getConfigurations()} to get an array of
|
* {@link ICProjectDescription#getConfigurations()} to get an
|
||||||
* ICConfigurationDescriptions, which have similar API to ICDescriptor, allowing you
|
* array of ICConfigurationDescriptions, which have similar API
|
||||||
* to store settings and configure extensions at the Configuration level rather than
|
* to ICDescriptor, allowing you to store settings and configure
|
||||||
* at the project level.
|
* extensions at the Configuration level rather than at the
|
||||||
|
* project level.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public ICDescriptorManager getCDescriptorManager() {
|
public ICDescriptorManager getCDescriptorManager() {
|
||||||
|
@ -932,8 +954,9 @@ public class CCorePlugin extends Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method convertProjectFromCtoCC converts a C Project to a C++ Project The newProject MUST, not
|
* Method convertProjectFromCtoCC converts a C Project to a C++ Project The
|
||||||
* be null, already have a C Nature && must NOT already have a C++ Nature
|
* newProject MUST, not be null, already have a C Nature && must NOT already
|
||||||
|
* have a C++ Nature
|
||||||
*
|
*
|
||||||
* @param projectHandle
|
* @param projectHandle
|
||||||
* @param monitor
|
* @param monitor
|
||||||
|
@ -949,8 +972,9 @@ public class CCorePlugin extends Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method to convert a project to a C nature All checks should have been done externally (as in
|
* Method to convert a project to a C nature All checks should have been
|
||||||
* the Conversion Wizards). This method blindly does the conversion.
|
* done externally (as in the Conversion Wizards). This method blindly does
|
||||||
|
* the conversion.
|
||||||
*/
|
*/
|
||||||
public void convertProjectToC(IProject projectHandle, IProgressMonitor monitor, String projectID)
|
public void convertProjectToC(IProject projectHandle, IProgressMonitor monitor, String projectID)
|
||||||
throws CoreException {
|
throws CoreException {
|
||||||
|
@ -1033,7 +1057,8 @@ public class CCorePlugin extends Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated since CDT 6.1. Use {@link ErrorParserManager#getErrorParserAvailableIds()}
|
* @deprecated since CDT 6.1. Use
|
||||||
|
* {@link ErrorParserManager#getErrorParserAvailableIds()}
|
||||||
* instead
|
* instead
|
||||||
* @return array of error parsers ids
|
* @return array of error parsers ids
|
||||||
*/
|
*/
|
||||||
|
@ -1045,7 +1070,8 @@ public class CCorePlugin extends Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated since CDT 6.1. Use {@link ErrorParserManager#getErrorParserCopy(String)} instead
|
* @deprecated since CDT 6.1. Use
|
||||||
|
* {@link ErrorParserManager#getErrorParserCopy(String)} instead
|
||||||
* @param id
|
* @param id
|
||||||
* - id of error parser
|
* - id of error parser
|
||||||
* @return array of error parsers
|
* @return array of error parsers
|
||||||
|
@ -1097,8 +1123,9 @@ public class CCorePlugin extends Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears cached scanner info provider for the given project so that the next call to
|
* Clears cached scanner info provider for the given project so that the
|
||||||
* {@link #getScannerInfoProvider(IProject)} would return an up to date scanner info provider.
|
* next call to {@link #getScannerInfoProvider(IProject)} would return an up
|
||||||
|
* to date scanner info provider.
|
||||||
*
|
*
|
||||||
* @noreference This method is not intended to be referenced by clients.
|
* @noreference This method is not intended to be referenced by clients.
|
||||||
*/
|
*/
|
||||||
|
@ -1114,8 +1141,8 @@ public class CCorePlugin extends Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find {@link IScannerInfoProvider} registered as extension via extension point
|
* Find {@link IScannerInfoProvider} registered as extension via extension
|
||||||
* org.eclipse.cdt.core.ScannerInfoProvider2.
|
* point org.eclipse.cdt.core.ScannerInfoProvider2.
|
||||||
*/
|
*/
|
||||||
private IScannerInfoProvider getExtensionScannerInfoProvider2(IProject project) throws CoreException {
|
private IScannerInfoProvider getExtensionScannerInfoProvider2(IProject project) throws CoreException {
|
||||||
IScannerInfoProvider provider = null;
|
IScannerInfoProvider provider = null;
|
||||||
|
@ -1155,11 +1182,13 @@ public class CCorePlugin extends Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the content type for a filename. The method respects project specific content type
|
* Returns the content type for a filename. The method respects project
|
||||||
* definitions. The lookup prefers case- sensitive matches over the others.
|
* specific content type definitions. The lookup prefers case- sensitive
|
||||||
|
* matches over the others.
|
||||||
*
|
*
|
||||||
* @param project
|
* @param project
|
||||||
* a project with possible project specific settings. Can be <code>null</code>
|
* a project with possible project specific settings. Can be
|
||||||
|
* <code>null</code>
|
||||||
* @param filename
|
* @param filename
|
||||||
* a filename to compute the content type for
|
* a filename to compute the content type for
|
||||||
* @return the content type found or <code>null</code>
|
* @return the content type found or <code>null</code>
|
||||||
|
@ -1189,7 +1218,8 @@ public class CCorePlugin extends Plugin {
|
||||||
private static final String DELTA = CCorePlugin.PLUGIN_ID + "/debug/deltaprocessor"; //$NON-NLS-1$
|
private static final String DELTA = CCorePlugin.PLUGIN_ID + "/debug/deltaprocessor"; //$NON-NLS-1$
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configure the plug-in with respect to option settings defined in ".options" file
|
* Configure the plug-in with respect to option settings defined in
|
||||||
|
* ".options" file
|
||||||
*/
|
*/
|
||||||
public void configurePluginDebugOptions() {
|
public void configurePluginDebugOptions() {
|
||||||
if (CCorePlugin.getDefault().isDebugging()) {
|
if (CCorePlugin.getDefault().isDebugging()) {
|
||||||
|
@ -1227,7 +1257,8 @@ public class CCorePlugin extends Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated use {@link ITranslationUnit} or {@link ILanguage} to construct ASTs, instead.
|
* @deprecated use {@link ITranslationUnit} or {@link ILanguage} to
|
||||||
|
* construct ASTs, instead.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public org.eclipse.cdt.core.dom.CDOM getDOM() {
|
public org.eclipse.cdt.core.dom.CDOM getDOM() {
|
||||||
|
@ -1257,7 +1288,8 @@ public class CCorePlugin extends Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Equivalent to <code>createProjectDescription(IProject, boolean, false)</code>.
|
* Equivalent to
|
||||||
|
* <code>createProjectDescription(IProject, boolean, false)</code>.
|
||||||
*
|
*
|
||||||
* @see #createProjectDescription(IProject, boolean, boolean)
|
* @see #createProjectDescription(IProject, boolean, boolean)
|
||||||
*/
|
*/
|
||||||
|
@ -1272,19 +1304,23 @@ public class CCorePlugin extends Plugin {
|
||||||
* @param project
|
* @param project
|
||||||
* project for which the project description is requested
|
* project for which the project description is requested
|
||||||
* @param loadIfExists
|
* @param loadIfExists
|
||||||
* if true the method first tries to load and return the project description from the
|
* if true the method first tries to load and return the project
|
||||||
* settings file (.cproject), if false, the stored settings are ignored and the new
|
* description from the settings file (.cproject), if false, the
|
||||||
* (empty) project description is created
|
* stored settings are ignored and the new (empty) project
|
||||||
|
* description is created
|
||||||
* @param creating
|
* @param creating
|
||||||
* if true the created project description will be contain the true
|
* if true the created project description will be contain the
|
||||||
* "isCdtProjectCreating" state. <br>
|
* true "isCdtProjectCreating" state. <br>
|
||||||
* NOTE: in case the project already contains the project description AND its
|
* NOTE: in case the project already contains the project
|
||||||
* "isCdtProjectCreating" is false the resulting description will be created with the
|
* description AND its "isCdtProjectCreating" is false the
|
||||||
* false "isCdtProjectCreating" state.
|
* resulting description will be created with the false
|
||||||
|
* "isCdtProjectCreating" state.
|
||||||
*
|
*
|
||||||
* <br>
|
* <br>
|
||||||
* NOTE: changes made to the returned project description will not be applied until
|
* NOTE: changes made to the returned project description will
|
||||||
* the {@link #setProjectDescription(IProject, ICProjectDescription)} is called.
|
* not be applied until the
|
||||||
|
* {@link #setProjectDescription(IProject, ICProjectDescription)}
|
||||||
|
* is called.
|
||||||
* @return {@link ICProjectDescription}
|
* @return {@link ICProjectDescription}
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
|
@ -1294,17 +1330,20 @@ public class CCorePlugin extends Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the project description associated with this project or null if the project does not
|
* Returns the project description associated with this project or null if
|
||||||
* contain the CDT data associated with it.
|
* the project does not contain the CDT data associated with it.
|
||||||
*
|
*
|
||||||
* This is a convenience method fully equivalent to getProjectDescription(project, true) see
|
* This is a convenience method fully equivalent to
|
||||||
|
* getProjectDescription(project, true) see
|
||||||
* {@link #getProjectDescription(IProject, boolean)} for more detail.
|
* {@link #getProjectDescription(IProject, boolean)} for more detail.
|
||||||
*
|
*
|
||||||
* @param project
|
* @param project
|
||||||
* @return a writable copy of the ICProjectDescription or null if the project does not contain
|
* @return a writable copy of the ICProjectDescription or null if the
|
||||||
* the CDT data associated with it. <br>
|
* project does not contain the CDT data associated with it. <br>
|
||||||
* Note: changes to the project description will not be reflected/used by the core until
|
* Note: changes to the project description will not be
|
||||||
* the {@link #setProjectDescription(IProject, ICProjectDescription)} is called.
|
* reflected/used by the core until the
|
||||||
|
* {@link #setProjectDescription(IProject, ICProjectDescription)} is
|
||||||
|
* called.
|
||||||
*
|
*
|
||||||
* @see #getProjectDescription(IProject, boolean)
|
* @see #getProjectDescription(IProject, boolean)
|
||||||
*/
|
*/
|
||||||
|
@ -1313,8 +1352,8 @@ public class CCorePlugin extends Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called to save/apply the project description. The method should be called to apply changes
|
* Called to save/apply the project description. The method should be called
|
||||||
* made to the project description returned by the
|
* to apply changes made to the project description returned by the
|
||||||
* {@link #getProjectDescription(IProject, boolean)} or
|
* {@link #getProjectDescription(IProject, boolean)} or
|
||||||
* {@link #createProjectDescription(IProject, boolean)}
|
* {@link #createProjectDescription(IProject, boolean)}
|
||||||
*
|
*
|
||||||
|
@ -1335,37 +1374,40 @@ public class CCorePlugin extends Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the project description associated with this project or null if the project does not
|
* Returns the project description associated with this project or null if
|
||||||
* contain the CDT data associated with it.
|
* the project does not contain the CDT data associated with it.
|
||||||
*
|
*
|
||||||
* @param project
|
* @param project
|
||||||
* project for which the description is requested
|
* project for which the description is requested
|
||||||
* @param write
|
* @param write
|
||||||
* if true, the writable description copy is returned. If false the cached read-only
|
* if true, the writable description copy is returned. If false
|
||||||
* description is returned.
|
* the cached read-only description is returned.
|
||||||
*
|
*
|
||||||
* <br>
|
* <br>
|
||||||
* CDT core maintains the cached project description settings. If only read access is
|
* CDT core maintains the cached project description settings. If
|
||||||
* needed to description, then the read-only project description should be obtained.
|
* only read access is needed to description, then the read-only
|
||||||
* This description always operates with cached data and thus it is better to use it
|
* project description should be obtained. This description
|
||||||
* for performance reasons. All set* calls to the read-only description result in the
|
* always operates with cached data and thus it is better to use
|
||||||
* {@link WriteAccessException}.
|
* it for performance reasons. All set* calls to the read-only
|
||||||
|
* description result in the {@link WriteAccessException}.
|
||||||
*
|
*
|
||||||
* When the writable description is requested, the description copy is created.
|
* When the writable description is requested, the description
|
||||||
* Changes to this description will not be reflected/used by the core and the Build
|
* copy is created. Changes to this description will not be
|
||||||
* System until the {@link #setProjectDescription(IProject, ICProjectDescription)} is
|
* reflected/used by the core and the Build System until the
|
||||||
* called.
|
* {@link #setProjectDescription(IProject, ICProjectDescription)}
|
||||||
|
* is called.
|
||||||
*
|
*
|
||||||
* Each getProjectDescription(project, true) returns a new copy of the project
|
* Each getProjectDescription(project, true) returns a new copy
|
||||||
* description.
|
* of the project description.
|
||||||
*
|
*
|
||||||
* The writable description uses the cached data until the first set call after that
|
* The writable description uses the cached data until the first
|
||||||
* the description communicates directly to the Build System i.e. the implementer of
|
* set call after that the description communicates directly to
|
||||||
* the org.eclipse.cdt.core.CConfigurationDataProvider extension This ensures the
|
* the Build System i.e. the implementer of the
|
||||||
* Core<->Build System settings integrity.
|
* org.eclipse.cdt.core.CConfigurationDataProvider extension This
|
||||||
|
* ensures the Core<->Build System settings integrity.
|
||||||
*
|
*
|
||||||
* @return {@link ICProjectDescription} or null if the project does not contain the CDT data
|
* @return {@link ICProjectDescription} or null if the project does not
|
||||||
* associated with it.
|
* contain the CDT data associated with it.
|
||||||
*/
|
*/
|
||||||
public ICProjectDescription getProjectDescription(IProject project, boolean write) {
|
public ICProjectDescription getProjectDescription(IProject project, boolean write) {
|
||||||
return fNewCProjectDescriptionManager.getProjectDescription(project, write);
|
return fNewCProjectDescriptionManager.getProjectDescription(project, write);
|
||||||
|
@ -1375,7 +1417,8 @@ public class CCorePlugin extends Plugin {
|
||||||
* Forces the cached data of the specified projects to be re-calculated.
|
* Forces the cached data of the specified projects to be re-calculated.
|
||||||
*
|
*
|
||||||
* @param projects
|
* @param projects
|
||||||
* if <code>null</code>, all projects within the workspace are updated
|
* if <code>null</code>, all projects within the workspace are
|
||||||
|
* updated
|
||||||
* @param monitor
|
* @param monitor
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
|
@ -1414,7 +1457,8 @@ public class CCorePlugin extends Plugin {
|
||||||
// NON-API
|
// NON-API
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @noreference This constructor is not intended to be referenced by clients.
|
* @noreference This constructor is not intended to be referenced by
|
||||||
|
* clients.
|
||||||
*/
|
*/
|
||||||
public CCorePlugin() {
|
public CCorePlugin() {
|
||||||
super();
|
super();
|
||||||
|
@ -1432,8 +1476,9 @@ public class CCorePlugin extends Plugin {
|
||||||
* Prints a message in the log
|
* Prints a message in the log
|
||||||
*
|
*
|
||||||
* @param severity
|
* @param severity
|
||||||
* - desired severity of the message in the log, one of {@link IStatus#INFO},
|
* - desired severity of the message in the log, one of
|
||||||
* {@link IStatus#WARNING} or {@link IStatus#ERROR}
|
* {@link IStatus#INFO}, {@link IStatus#WARNING} or
|
||||||
|
* {@link IStatus#ERROR}
|
||||||
* @param msg
|
* @param msg
|
||||||
* - message
|
* - message
|
||||||
*
|
*
|
||||||
|
@ -1448,8 +1493,9 @@ public class CCorePlugin extends Plugin {
|
||||||
* Prints a message in the log accompanied by stack trace
|
* Prints a message in the log accompanied by stack trace
|
||||||
*
|
*
|
||||||
* @param severity
|
* @param severity
|
||||||
* - desired severity of the message in the log, one of {@link IStatus#INFO},
|
* - desired severity of the message in the log, one of
|
||||||
* {@link IStatus#WARNING} or {@link IStatus#ERROR}
|
* {@link IStatus#INFO}, {@link IStatus#WARNING} or
|
||||||
|
* {@link IStatus#ERROR}
|
||||||
* @param msg
|
* @param msg
|
||||||
* - message
|
* - message
|
||||||
*
|
*
|
||||||
|
@ -1515,8 +1561,9 @@ public class CCorePlugin extends Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the preference controlling whether source roots are shown at the top of projects or
|
* Returns the preference controlling whether source roots are shown at the
|
||||||
* embedded within the resource tree of projects when they are not top level folders.
|
* top of projects or embedded within the resource tree of projects when
|
||||||
|
* they are not top level folders.
|
||||||
*
|
*
|
||||||
* @return boolean preference value
|
* @return boolean preference value
|
||||||
* @since 5.2
|
* @since 5.2
|
||||||
|
|
|
@ -79,4 +79,287 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
|
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
||||||
org.eclipse.jdt.core.compiler.source=1.7
|
org.eclipse.jdt.core.compiler.source=1.7
|
||||||
org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter
|
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
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
|
||||||
|
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_expressions_in_array_initializer=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
|
||||||
|
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
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
|
||||||
|
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_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
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_field=0
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_method=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_package=0
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
|
||||||
|
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.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.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.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.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
|
||||||
|
org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
|
||||||
|
org.eclipse.jdt.core.formatter.compact_else_if=true
|
||||||
|
org.eclipse.jdt.core.formatter.continuation_indentation=2
|
||||||
|
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.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
|
||||||
|
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
|
||||||
|
org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
|
||||||
|
org.eclipse.jdt.core.formatter.indent_empty_lines=false
|
||||||
|
org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
|
||||||
|
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_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
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
|
||||||
|
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_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
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.join_lines_in_comments=true
|
||||||
|
org.eclipse.jdt.core.formatter.join_wrapped_lines=true
|
||||||
|
org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
|
||||||
|
org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
|
||||||
|
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
|
||||||
|
org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
|
||||||
|
org.eclipse.jdt.core.formatter.lineSplit=110
|
||||||
|
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.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_binary_operator=true
|
||||||
|
org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
|
||||||
|
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
|
formatter_profile=_CDT
|
||||||
formatter_settings_version=12
|
formatter_settings_version=12
|
||||||
org.eclipse.jdt.ui.ignorelowercasenames=true
|
org.eclipse.jdt.ui.ignorelowercasenames=true
|
||||||
org.eclipse.jdt.ui.importorder=java;javax;org;com;org.eclipse.cdt;org.eclipse.cdt.internal;org.eclipse.cdt.internal.ui;
|
org.eclipse.jdt.ui.importorder=java;javax;org;com;org.eclipse.cdt;org.eclipse.cdt.internal;org.eclipse.cdt.internal.ui;
|
||||||
|
|
|
@ -21,12 +21,10 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
import org.eclipse.core.resources.IBuildConfiguration;
|
|
||||||
import org.eclipse.core.resources.IContainer;
|
import org.eclipse.core.resources.IContainer;
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.Adapters;
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
|
@ -71,7 +69,8 @@ import org.eclipse.cdt.internal.ui.newui.Messages;
|
||||||
import org.eclipse.cdt.internal.ui.newui.StatusMessageLine;
|
import org.eclipse.cdt.internal.ui.newui.StatusMessageLine;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This tab presents language settings entries categorized by language settings providers.
|
* This tab presents language settings entries categorized by language
|
||||||
|
* settings providers.
|
||||||
*
|
*
|
||||||
* @noinstantiate This class is not intended to be instantiated by clients.
|
* @noinstantiate This class is not intended to be instantiated by clients.
|
||||||
* @noextend This class is not intended to be subclassed by clients.
|
* @noextend This class is not intended to be subclassed by clients.
|
||||||
|
@ -134,23 +133,17 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
|
||||||
if (entriesParent != null) {
|
if (entriesParent != null) {
|
||||||
overlayKeys[IDecoration.TOP_RIGHT] = CDTSharedImages.IMG_OVR_PARENT;
|
overlayKeys[IDecoration.TOP_RIGHT] = CDTSharedImages.IMG_OVR_PARENT;
|
||||||
}
|
}
|
||||||
} else if (provider instanceof ILanguageSettingsBroadcastingProvider
|
} else if (provider instanceof ILanguageSettingsBroadcastingProvider && (page.isForFile() || page.isForFolder())) {
|
||||||
&& (page.isForFile() || page.isForFolder())) {
|
|
||||||
// Assuming that the default entries for a resource are always null.
|
// Assuming that the default entries for a resource are always null.
|
||||||
// Using that for performance reasons. See note in performDefaults().
|
// Using that for performance reasons. See note in performDefaults().
|
||||||
List<ICLanguageSettingEntry> entriesParent = provider
|
List<ICLanguageSettingEntry> entriesParent = provider.getSettingEntries(null, null, currentLanguageId);
|
||||||
.getSettingEntries((ICConfigurationDescription) null, null, currentLanguageId);
|
|
||||||
if (entriesParent == null) {
|
|
||||||
entriesParent = provider.getSettingEntries((IBuildConfiguration) null, null, currentLanguageId);
|
|
||||||
}
|
|
||||||
if (entries != null && !entries.equals(entriesParent)) {
|
if (entries != null && !entries.equals(entriesParent)) {
|
||||||
overlayKeys[IDecoration.TOP_RIGHT] = CDTSharedImages.IMG_OVR_SETTING;
|
overlayKeys[IDecoration.TOP_RIGHT] = CDTSharedImages.IMG_OVR_SETTING;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ICConfigurationDescription cfgDescription = getConfigurationDescription();
|
ICConfigurationDescription cfgDescription = getConfigurationDescription();
|
||||||
List<ILanguageSettingsProvider> initialProviders = initialProvidersMap
|
List<ILanguageSettingsProvider> initialProviders = initialProvidersMap.get(cfgDescription.getId());
|
||||||
.get(cfgDescription.getId());
|
|
||||||
if (initialProviders != null && !initialProviders.contains(provider)) {
|
if (initialProviders != null && !initialProviders.contains(provider)) {
|
||||||
overlayKeys[IDecoration.TOP_RIGHT] = CDTSharedImages.IMG_OVR_EDITED;
|
overlayKeys[IDecoration.TOP_RIGHT] = CDTSharedImages.IMG_OVR_EDITED;
|
||||||
}
|
}
|
||||||
|
@ -309,28 +302,19 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
|
||||||
*/
|
*/
|
||||||
private List<ICLanguageSettingEntry> getSettingEntriesUpResourceTree(ILanguageSettingsProvider provider) {
|
private List<ICLanguageSettingEntry> getSettingEntriesUpResourceTree(ILanguageSettingsProvider provider) {
|
||||||
ICConfigurationDescription cfgDescription = getConfigurationDescription();
|
ICConfigurationDescription cfgDescription = getConfigurationDescription();
|
||||||
IBuildConfiguration config = Adapters.adapt(cfgDescription, IBuildConfiguration.class);
|
|
||||||
IResource rc = getResource();
|
IResource rc = getResource();
|
||||||
List<ICLanguageSettingEntry> entries = LanguageSettingsManager
|
List<ICLanguageSettingEntry> entries = LanguageSettingsManager.getSettingEntriesUpResourceTree(provider, cfgDescription, rc, currentLanguageId);
|
||||||
.getSettingEntriesUpResourceTree(provider, config, rc, currentLanguageId);
|
|
||||||
return entries;
|
return entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shortcut for getting setting entries for current context without checking the parent
|
* Shortcut for getting setting entries for current context without checking the parent resource.
|
||||||
* resource.
|
|
||||||
*
|
|
||||||
* @return list of setting entries for the current context.
|
* @return list of setting entries for the current context.
|
||||||
*/
|
*/
|
||||||
private List<ICLanguageSettingEntry> getSettingEntries(ILanguageSettingsProvider provider) {
|
private List<ICLanguageSettingEntry> getSettingEntries(ILanguageSettingsProvider provider) {
|
||||||
IResource rc = getResource();
|
|
||||||
ICConfigurationDescription cfgDescription = getConfigurationDescription();
|
ICConfigurationDescription cfgDescription = getConfigurationDescription();
|
||||||
List<ICLanguageSettingEntry> entries = provider.getSettingEntries(cfgDescription, rc, currentLanguageId);
|
IResource rc = getResource();
|
||||||
if (entries == null) {
|
return provider.getSettingEntries(cfgDescription, rc, currentLanguageId);
|
||||||
IBuildConfiguration config = Adapters.adapt(cfgDescription, IBuildConfiguration.class);
|
|
||||||
entries = provider.getSettingEntries(config, rc, currentLanguageId);
|
|
||||||
}
|
|
||||||
return entries;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -342,8 +326,7 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
|
||||||
for (ICConfigurationDescription cfgDescription : cfgDescriptions) {
|
for (ICConfigurationDescription cfgDescription : cfgDescriptions) {
|
||||||
if (cfgDescription instanceof ILanguageSettingsProvidersKeeper) {
|
if (cfgDescription instanceof ILanguageSettingsProvidersKeeper) {
|
||||||
String cfgId = cfgDescription.getId();
|
String cfgId = cfgDescription.getId();
|
||||||
List<ILanguageSettingsProvider> initialProviders = ((ILanguageSettingsProvidersKeeper) cfgDescription)
|
List<ILanguageSettingsProvider> initialProviders = ((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders();
|
||||||
.getLanguageSettingProviders();
|
|
||||||
initialProvidersMap.put(cfgId, initialProviders);
|
initialProvidersMap.put(cfgId, initialProviders);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -460,8 +443,7 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
|
||||||
* Create check-box to control whether to show built-in entries or not.
|
* Create check-box to control whether to show built-in entries or not.
|
||||||
*/
|
*/
|
||||||
private void createBuiltInsCheckBox() {
|
private void createBuiltInsCheckBox() {
|
||||||
builtInCheckBox = setupCheck(usercomp, Messages.AbstractLangsListTab_ShowBuiltin, 1,
|
builtInCheckBox = setupCheck(usercomp, Messages.AbstractLangsListTab_ShowBuiltin, 1, GridData.FILL_HORIZONTAL);
|
||||||
GridData.FILL_HORIZONTAL);
|
|
||||||
builtInCheckBox.addSelectionListener(new SelectionAdapter() {
|
builtInCheckBox.addSelectionListener(new SelectionAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
@ -612,14 +594,12 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
|
||||||
boolean isAllowedEditing = provider instanceof ILanguageSettingsEditableProvider
|
boolean isAllowedEditing = provider instanceof ILanguageSettingsEditableProvider
|
||||||
&& LanguageSettingsProviderAssociationManager.isAllowedToEditEntries(provider);
|
&& LanguageSettingsProviderAssociationManager.isAllowedToEditEntries(provider);
|
||||||
if (provider != null && !isAllowedEditing) {
|
if (provider != null && !isAllowedEditing) {
|
||||||
status = new Status(IStatus.INFO, CUIPlugin.PLUGIN_ID,
|
status = new Status(IStatus.INFO, CUIPlugin.PLUGIN_ID, Messages.LanguageSettingsEntriesTab_Entries_Not_Editable);
|
||||||
Messages.LanguageSettingsEntriesTab_Entries_Not_Editable);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (status == null || status == Status.OK_STATUS) {
|
if (status == null || status == Status.OK_STATUS) {
|
||||||
if (treeLanguages.getItemCount() <= 0) {
|
if (treeLanguages.getItemCount() <= 0) {
|
||||||
status = new Status(IStatus.ERROR, CUIPlugin.PLUGIN_ID,
|
status = new Status(IStatus.ERROR, CUIPlugin.PLUGIN_ID, Messages.LanguageSettingsEntriesTab_Cannot_Determine_Languages);
|
||||||
Messages.LanguageSettingsEntriesTab_Cannot_Determine_Languages);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fStatusLine.setErrorStatus(status);
|
fStatusLine.setErrorStatus(status);
|
||||||
|
@ -658,9 +638,9 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* That method returns exact position of an element in the list. Note that
|
* That method returns exact position of an element in the list.
|
||||||
* {@link List#indexOf(Object)} returns position of the first element equals to the given one,
|
* Note that {@link List#indexOf(Object)} returns position of the first element
|
||||||
* not exact element.
|
* equals to the given one, not exact element.
|
||||||
*
|
*
|
||||||
* @param entries
|
* @param entries
|
||||||
* @param entry
|
* @param entry
|
||||||
|
@ -757,34 +737,27 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
|
||||||
private void saveEntries(ILanguageSettingsProvider provider, List<ICLanguageSettingEntry> entries) {
|
private void saveEntries(ILanguageSettingsProvider provider, List<ICLanguageSettingEntry> entries) {
|
||||||
if (provider instanceof ILanguageSettingsEditableProvider) {
|
if (provider instanceof ILanguageSettingsEditableProvider) {
|
||||||
ICConfigurationDescription cfgDescription = getConfigurationDescription();
|
ICConfigurationDescription cfgDescription = getConfigurationDescription();
|
||||||
IBuildConfiguration config = Adapters.adapt(cfgDescription, IBuildConfiguration.class);
|
|
||||||
IResource rc = getResource();
|
IResource rc = getResource();
|
||||||
if (entries != null && rc != null) {
|
if (entries != null && rc != null) {
|
||||||
IContainer parent = rc instanceof IProject ? null : rc.getParent();
|
IContainer parent = rc instanceof IProject ? null : rc.getParent();
|
||||||
List<ICLanguageSettingEntry> parentEntries = LanguageSettingsManager
|
List<ICLanguageSettingEntry> parentEntries = LanguageSettingsManager.getSettingEntriesUpResourceTree(provider, cfgDescription, parent, currentLanguageId);
|
||||||
.getSettingEntriesUpResourceTree(provider, config, parent, currentLanguageId);
|
|
||||||
if (entries.equals(parentEntries)) {
|
if (entries.equals(parentEntries)) {
|
||||||
// to use parent entries instead
|
// to use parent entries instead
|
||||||
entries = null;
|
entries = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
((ILanguageSettingsEditableProvider) provider).setSettingEntries(config, rc, currentLanguageId,
|
((ILanguageSettingsEditableProvider)provider).setSettingEntries(cfgDescription, rc, currentLanguageId, entries);
|
||||||
entries);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get list of setting entries shown to user. If current resource has no entries assigned the
|
* Get list of setting entries shown to user. If current resource has no entries assigned the parent
|
||||||
* parent resource is inspected.
|
* resource is inspected.
|
||||||
*/
|
*/
|
||||||
private List<ICLanguageSettingEntry> getEntriesShownToUser(ILanguageSettingsProvider provider) {
|
private List<ICLanguageSettingEntry> getEntriesShownToUser(ILanguageSettingsProvider provider) {
|
||||||
IResource rc = getResource();
|
|
||||||
ICConfigurationDescription cfgDescription = getConfigurationDescription();
|
ICConfigurationDescription cfgDescription = getConfigurationDescription();
|
||||||
|
IResource rc = getResource();
|
||||||
List<ICLanguageSettingEntry> entries = provider.getSettingEntries(cfgDescription, rc, currentLanguageId);
|
List<ICLanguageSettingEntry> entries = provider.getSettingEntries(cfgDescription, rc, currentLanguageId);
|
||||||
if (entries == null) {
|
|
||||||
IBuildConfiguration config = Adapters.adapt(cfgDescription, IBuildConfiguration.class);
|
|
||||||
entries = provider.getSettingEntries(config, rc, currentLanguageId);
|
|
||||||
}
|
|
||||||
if (entries == null) {
|
if (entries == null) {
|
||||||
entries = getSettingEntriesUpResourceTree(provider);
|
entries = getSettingEntriesUpResourceTree(provider);
|
||||||
}
|
}
|
||||||
|
@ -799,8 +772,7 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
|
||||||
if (selectedProvider instanceof ILanguageSettingsEditableProvider) {
|
if (selectedProvider instanceof ILanguageSettingsEditableProvider) {
|
||||||
ICConfigurationDescription cfgDescription = getConfigurationDescription();
|
ICConfigurationDescription cfgDescription = getConfigurationDescription();
|
||||||
ICLanguageSettingEntry selectedEntry = getSelectedEntry();
|
ICLanguageSettingEntry selectedEntry = getSelectedEntry();
|
||||||
LanguageSettingEntryDialog addDialog = new LanguageSettingEntryDialog(usercomp.getShell(),
|
LanguageSettingEntryDialog addDialog = new LanguageSettingEntryDialog(usercomp.getShell(), cfgDescription, selectedEntry, true);
|
||||||
cfgDescription, selectedEntry, true);
|
|
||||||
if (addDialog.open()) {
|
if (addDialog.open()) {
|
||||||
ICLanguageSettingEntry settingEntry = addDialog.getEntries()[0];
|
ICLanguageSettingEntry settingEntry = addDialog.getEntries()[0];
|
||||||
if (settingEntry != null) {
|
if (settingEntry != null) {
|
||||||
|
@ -812,22 +784,20 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return working copy of the provider to edit in current session. If the supplied provider is
|
* Return working copy of the provider to edit in current session. If the supplied provider is already
|
||||||
* already the working copy return it. If not, create a copy to be edited.
|
* the working copy return it. If not, create a copy to be edited.
|
||||||
*/
|
*/
|
||||||
private ILanguageSettingsEditableProvider getWorkingCopy(ILanguageSettingsEditableProvider provider) {
|
private ILanguageSettingsEditableProvider getWorkingCopy(ILanguageSettingsEditableProvider provider) {
|
||||||
ICConfigurationDescription cfgDescription = getConfigurationDescription();
|
ICConfigurationDescription cfgDescription = getConfigurationDescription();
|
||||||
List<ILanguageSettingsProvider> initialProviders = initialProvidersMap.get(cfgDescription.getId());
|
List<ILanguageSettingsProvider> initialProviders = initialProvidersMap.get(cfgDescription.getId());
|
||||||
if (initialProviders.contains(provider)) {
|
if (initialProviders.contains(provider)) {
|
||||||
List<ILanguageSettingsProvider> providers = new ArrayList<ILanguageSettingsProvider>(
|
List<ILanguageSettingsProvider> providers = new ArrayList<ILanguageSettingsProvider>(((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders());
|
||||||
((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders());
|
|
||||||
int pos = providers.indexOf(provider);
|
int pos = providers.indexOf(provider);
|
||||||
if (pos >= 0) {
|
if (pos >= 0) {
|
||||||
try {
|
try {
|
||||||
provider = provider.clone();
|
provider = provider.clone();
|
||||||
providers.set(pos, provider);
|
providers.set(pos, provider);
|
||||||
((ILanguageSettingsProvidersKeeper) cfgDescription)
|
((ILanguageSettingsProvidersKeeper) cfgDescription).setLanguageSettingProviders(providers);
|
||||||
.setLanguageSettingProviders(providers);
|
|
||||||
} catch (CloneNotSupportedException e) {
|
} catch (CloneNotSupportedException e) {
|
||||||
CUIPlugin.log("Internal Error: cannot clone provider "+provider.getId(), e); //$NON-NLS-1$
|
CUIPlugin.log("Internal Error: cannot clone provider "+provider.getId(), e); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
@ -841,12 +811,10 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
|
||||||
/**
|
/**
|
||||||
* Call dialog to edit settings entry.
|
* Call dialog to edit settings entry.
|
||||||
*/
|
*/
|
||||||
private void performEdit(ILanguageSettingsProvider selectedProvider,
|
private void performEdit(ILanguageSettingsProvider selectedProvider, ICLanguageSettingEntry selectedEntry) {
|
||||||
ICLanguageSettingEntry selectedEntry) {
|
|
||||||
if (selectedProvider instanceof ILanguageSettingsEditableProvider && selectedEntry != null) {
|
if (selectedProvider instanceof ILanguageSettingsEditableProvider && selectedEntry != null) {
|
||||||
ICConfigurationDescription cfgDecsription = getConfigurationDescription();
|
ICConfigurationDescription cfgDecsription = getConfigurationDescription();
|
||||||
LanguageSettingEntryDialog editDialog = new LanguageSettingEntryDialog(usercomp.getShell(),
|
LanguageSettingEntryDialog editDialog = new LanguageSettingEntryDialog(usercomp.getShell(), cfgDecsription, selectedEntry);
|
||||||
cfgDecsription, selectedEntry);
|
|
||||||
if (editDialog.open()) {
|
if (editDialog.open()) {
|
||||||
ICLanguageSettingEntry newEntry = editDialog.getEntries()[0];
|
ICLanguageSettingEntry newEntry = editDialog.getEntries()[0];
|
||||||
if (newEntry != null) {
|
if (newEntry != null) {
|
||||||
|
@ -882,8 +850,7 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
|
||||||
/**
|
/**
|
||||||
* Replace provider's entry and update UI.
|
* Replace provider's entry and update UI.
|
||||||
*/
|
*/
|
||||||
private void replaceEntry(ILanguageSettingsProvider provider, ICLanguageSettingEntry oldEntry,
|
private void replaceEntry(ILanguageSettingsProvider provider, ICLanguageSettingEntry oldEntry, ICLanguageSettingEntry newEntry) {
|
||||||
ICLanguageSettingEntry newEntry) {
|
|
||||||
if (provider != null && oldEntry != null && newEntry != null) {
|
if (provider != null && oldEntry != null && newEntry != null) {
|
||||||
String providerId = provider.getId();
|
String providerId = provider.getId();
|
||||||
|
|
||||||
|
@ -911,8 +878,7 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
|
||||||
/**
|
/**
|
||||||
* Clear provider's entries for the given resource or remove one entry depending on selection.
|
* Clear provider's entries for the given resource or remove one entry depending on selection.
|
||||||
*/
|
*/
|
||||||
private void performDelete(ILanguageSettingsProvider selectedProvider,
|
private void performDelete(ILanguageSettingsProvider selectedProvider, ICLanguageSettingEntry selectedEntry) {
|
||||||
ICLanguageSettingEntry selectedEntry) {
|
|
||||||
if (selectedProvider instanceof ILanguageSettingsEditableProvider) {
|
if (selectedProvider instanceof ILanguageSettingsEditableProvider) {
|
||||||
selectedProvider = getWorkingCopy((ILanguageSettingsEditableProvider)selectedProvider);
|
selectedProvider = getWorkingCopy((ILanguageSettingsEditableProvider)selectedProvider);
|
||||||
if (selectedEntry != null) {
|
if (selectedEntry != null) {
|
||||||
|
@ -926,8 +892,7 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
|
||||||
/**
|
/**
|
||||||
* Change "Export" flag of provider's entry and update UI.
|
* Change "Export" flag of provider's entry and update UI.
|
||||||
*/
|
*/
|
||||||
private void exportEntry(ILanguageSettingsProvider provider, ICLanguageSettingEntry entry,
|
private void exportEntry(ILanguageSettingsProvider provider, ICLanguageSettingEntry entry, boolean isExport) {
|
||||||
boolean isExport) {
|
|
||||||
if (provider instanceof ILanguageSettingsEditableProvider && entry != null) {
|
if (provider instanceof ILanguageSettingsEditableProvider && entry != null) {
|
||||||
int flags = entry.getFlags();
|
int flags = entry.getFlags();
|
||||||
if (isExport) {
|
if (isExport) {
|
||||||
|
@ -971,8 +936,7 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
|
||||||
/**
|
/**
|
||||||
* Export or un-export provider's entry or entries.
|
* Export or un-export provider's entry or entries.
|
||||||
*/
|
*/
|
||||||
private void performExport(ILanguageSettingsProvider selectedProvider,
|
private void performExport(ILanguageSettingsProvider selectedProvider, ICLanguageSettingEntry selectedEntry) {
|
||||||
ICLanguageSettingEntry selectedEntry) {
|
|
||||||
if (selectedProvider instanceof ILanguageSettingsEditableProvider) {
|
if (selectedProvider instanceof ILanguageSettingsEditableProvider) {
|
||||||
boolean isExport = isExportMode(selectedProvider, selectedEntry);
|
boolean isExport = isExportMode(selectedProvider, selectedEntry);
|
||||||
if (selectedEntry != null) {
|
if (selectedEntry != null) {
|
||||||
|
@ -1003,8 +967,7 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
|
||||||
/**
|
/**
|
||||||
* Move provider's entry up.
|
* Move provider's entry up.
|
||||||
*/
|
*/
|
||||||
private void performMoveUp(ILanguageSettingsProvider selectedProvider,
|
private void performMoveUp(ILanguageSettingsProvider selectedProvider, ICLanguageSettingEntry selectedEntry) {
|
||||||
ICLanguageSettingEntry selectedEntry) {
|
|
||||||
if (selectedEntry != null && (selectedProvider instanceof ILanguageSettingsEditableProvider)) {
|
if (selectedEntry != null && (selectedProvider instanceof ILanguageSettingsEditableProvider)) {
|
||||||
selectedProvider = getWorkingCopy((ILanguageSettingsEditableProvider)selectedProvider);
|
selectedProvider = getWorkingCopy((ILanguageSettingsEditableProvider)selectedProvider);
|
||||||
moveEntry(selectedProvider, selectedEntry, true);
|
moveEntry(selectedProvider, selectedEntry, true);
|
||||||
|
@ -1014,8 +977,7 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
|
||||||
/**
|
/**
|
||||||
* Move provider's entry down.
|
* Move provider's entry down.
|
||||||
*/
|
*/
|
||||||
private void performMoveDown(ILanguageSettingsProvider selectedProvider,
|
private void performMoveDown(ILanguageSettingsProvider selectedProvider, ICLanguageSettingEntry selectedEntry) {
|
||||||
ICLanguageSettingEntry selectedEntry) {
|
|
||||||
if (selectedEntry != null && (selectedProvider instanceof ILanguageSettingsEditableProvider)) {
|
if (selectedEntry != null && (selectedProvider instanceof ILanguageSettingsEditableProvider)) {
|
||||||
selectedProvider = getWorkingCopy((ILanguageSettingsEditableProvider)selectedProvider);
|
selectedProvider = getWorkingCopy((ILanguageSettingsEditableProvider)selectedProvider);
|
||||||
moveEntry(selectedProvider, selectedEntry, false);
|
moveEntry(selectedProvider, selectedEntry, false);
|
||||||
|
@ -1030,14 +992,12 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
|
||||||
IResource rc = getResource();
|
IResource rc = getResource();
|
||||||
ICConfigurationDescription cfgDescription = getConfigurationDescription();
|
ICConfigurationDescription cfgDescription = getConfigurationDescription();
|
||||||
if (rc != null && cfgDescription instanceof ILanguageSettingsProvidersKeeper) {
|
if (rc != null && cfgDescription instanceof ILanguageSettingsProvidersKeeper) {
|
||||||
List<ILanguageSettingsProvider> cfgProviders = ((ILanguageSettingsProvidersKeeper) cfgDescription)
|
List<ILanguageSettingsProvider> cfgProviders = ((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders();
|
||||||
.getLanguageSettingProviders();
|
|
||||||
for (ILanguageSettingsProvider cfgProvider : cfgProviders) {
|
for (ILanguageSettingsProvider cfgProvider : cfgProviders) {
|
||||||
ILanguageSettingsProvider rawProvider = LanguageSettingsManager.getRawProvider(cfgProvider);
|
ILanguageSettingsProvider rawProvider = LanguageSettingsManager.getRawProvider(cfgProvider);
|
||||||
if (rawProvider instanceof LanguageSettingsBaseProvider) {
|
if (rawProvider instanceof LanguageSettingsBaseProvider) {
|
||||||
// filter out providers incapable of providing entries for this language
|
// filter out providers incapable of providing entries for this language
|
||||||
List<String> languageIds = ((LanguageSettingsBaseProvider) rawProvider)
|
List<String> languageIds = ((LanguageSettingsBaseProvider)rawProvider).getLanguageScope();
|
||||||
.getLanguageScope();
|
|
||||||
if (languageIds != null && !languageIds.contains(currentLanguageId)) {
|
if (languageIds != null && !languageIds.contains(currentLanguageId)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1051,11 +1011,9 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
|
||||||
/**
|
/**
|
||||||
* Re-reads and refreshes the entries tree.
|
* Re-reads and refreshes the entries tree.
|
||||||
*
|
*
|
||||||
* @param selectedProviderId
|
* @param selectedProviderId - provider of the entry to select after update.
|
||||||
* - provider of the entry to select after update. If the entry is {@code null} the
|
* If the entry is {@code null} the provider itself will be selected.
|
||||||
* provider itself will be selected.
|
* @param selectedEntry - entry to select in the tree after update.
|
||||||
* @param selectedEntry
|
|
||||||
* - entry to select in the tree after update.
|
|
||||||
*/
|
*/
|
||||||
private void updateTreeForEntries(String selectedProviderId, ICLanguageSettingEntry selectedEntry) {
|
private void updateTreeForEntries(String selectedProviderId, ICLanguageSettingEntry selectedEntry) {
|
||||||
Object[] expandedElements = treeEntriesViewer.getExpandedElements();
|
Object[] expandedElements = treeEntriesViewer.getExpandedElements();
|
||||||
|
@ -1073,8 +1031,7 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
|
||||||
if (provider.getId().equals(selectedProviderId)) {
|
if (provider.getId().equals(selectedProviderId)) {
|
||||||
for (int i = 0; i < expandedElements.length; i++) {
|
for (int i = 0; i < expandedElements.length; i++) {
|
||||||
if (expandedElements[i] instanceof ILanguageSettingsProvider) {
|
if (expandedElements[i] instanceof ILanguageSettingsProvider) {
|
||||||
if (((ILanguageSettingsProvider) expandedElements[i]).getId()
|
if (((ILanguageSettingsProvider) expandedElements[i]).getId().equals(selectedProviderId)) {
|
||||||
.equals(selectedProviderId)) {
|
|
||||||
expandedElements[i] = provider;
|
expandedElements[i] = provider;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1105,8 +1062,7 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
|
||||||
// remove null language when some real ones are defined
|
// remove null language when some real ones are defined
|
||||||
languageIds.remove(null);
|
languageIds.remove(null);
|
||||||
} else if (languageIds.isEmpty()) {
|
} else if (languageIds.isEmpty()) {
|
||||||
// if no languages are defined keep null language as "Unspecified
|
// if no languages are defined keep null language as "Unspecified language"
|
||||||
// language"
|
|
||||||
languageIds.add(null);
|
languageIds.add(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1116,8 +1072,7 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
|
||||||
for (String langId : languageIds) {
|
for (String langId : languageIds) {
|
||||||
ILanguage language = LanguageManager.getInstance().getLanguage(langId);
|
ILanguage language = LanguageManager.getInstance().getLanguage(langId);
|
||||||
|
|
||||||
String langName = language != null ? language.getName()
|
String langName = language != null ? language.getName() : Messages.LanguageSettingsEntriesTab_UnspecifiedLanguage;
|
||||||
: Messages.LanguageSettingsEntriesTab_UnspecifiedLanguage;
|
|
||||||
if (langName == null || langName.length() == 0)
|
if (langName == null || langName.length() == 0)
|
||||||
continue;
|
continue;
|
||||||
List<String> langIds = map.get(langName);
|
List<String> langIds = map.get(langName);
|
||||||
|
@ -1215,33 +1170,26 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
IBuildConfiguration config = Adapters.adapt(cfgDescription, IBuildConfiguration.class);
|
|
||||||
|
|
||||||
boolean changed = false;
|
boolean changed = false;
|
||||||
IResource rc = getResource();
|
IResource rc = getResource();
|
||||||
List<ILanguageSettingsProvider> oldProviders = ((ILanguageSettingsProvidersKeeper) cfgDescription)
|
List<ILanguageSettingsProvider> oldProviders = ((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders();
|
||||||
.getLanguageSettingProviders();
|
List<ILanguageSettingsProvider> newProviders = new ArrayList<ILanguageSettingsProvider>(oldProviders.size());
|
||||||
List<ILanguageSettingsProvider> newProviders = new ArrayList<ILanguageSettingsProvider>(
|
|
||||||
oldProviders.size());
|
|
||||||
|
|
||||||
// clear entries for a given resource for all languages where
|
// clear entries for a given resource for all languages where applicable
|
||||||
// applicable
|
|
||||||
providers: for (ILanguageSettingsProvider provider : oldProviders) {
|
providers: for (ILanguageSettingsProvider provider : oldProviders) {
|
||||||
ILanguageSettingsEditableProvider providerCopy = null;
|
ILanguageSettingsEditableProvider providerCopy = null;
|
||||||
if (provider instanceof ILanguageSettingsEditableProvider) {
|
if (provider instanceof ILanguageSettingsEditableProvider) {
|
||||||
for (TreeItem langItems : treeLanguages.getItems()) {
|
for (TreeItem langItems : treeLanguages.getItems()) {
|
||||||
String langId = (String)langItems.getData();
|
String langId = (String)langItems.getData();
|
||||||
if (provider.getSettingEntries(cfgDescription, rc, langId) != null
|
if (provider.getSettingEntries(cfgDescription, rc, langId) != null) {
|
||||||
|| provider.getSettingEntries(config, rc, langId) != null) {
|
|
||||||
if (providerCopy == null) {
|
if (providerCopy == null) {
|
||||||
// copy providers to be able to "Cancel" in UI
|
// copy providers to be able to "Cancel" in UI
|
||||||
providerCopy = LanguageSettingsManager
|
providerCopy = LanguageSettingsManager.getProviderCopy((ILanguageSettingsEditableProvider) provider, true);
|
||||||
.getProviderCopy((ILanguageSettingsEditableProvider) provider, true);
|
|
||||||
if (providerCopy == null) {
|
if (providerCopy == null) {
|
||||||
continue providers;
|
continue providers;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
providerCopy.setSettingEntries(config, rc, langId, null);
|
providerCopy.setSettingEntries(cfgDescription, rc, langId, null);
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1260,15 +1208,12 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void performApply(ICResourceDescription srcRcDescription,
|
protected void performApply(ICResourceDescription srcRcDescription, ICResourceDescription destRcDescription) {
|
||||||
ICResourceDescription destRcDescription) {
|
|
||||||
if (!page.isForPrefs()) {
|
if (!page.isForPrefs()) {
|
||||||
ICConfigurationDescription sd = srcRcDescription.getConfiguration();
|
ICConfigurationDescription sd = srcRcDescription.getConfiguration();
|
||||||
ICConfigurationDescription dd = destRcDescription.getConfiguration();
|
ICConfigurationDescription dd = destRcDescription.getConfiguration();
|
||||||
if (sd instanceof ILanguageSettingsProvidersKeeper
|
if (sd instanceof ILanguageSettingsProvidersKeeper && dd instanceof ILanguageSettingsProvidersKeeper) {
|
||||||
&& dd instanceof ILanguageSettingsProvidersKeeper) {
|
List<ILanguageSettingsProvider> newProviders = ((ILanguageSettingsProvidersKeeper) sd).getLanguageSettingProviders();
|
||||||
List<ILanguageSettingsProvider> newProviders = ((ILanguageSettingsProvidersKeeper) sd)
|
|
||||||
.getLanguageSettingProviders();
|
|
||||||
((ILanguageSettingsProvidersKeeper) dd).setLanguageSettingProviders(newProviders);
|
((ILanguageSettingsProvidersKeeper) dd).setLanguageSettingProviders(newProviders);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1300,8 +1245,7 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
|
||||||
IResource rc = getResource();
|
IResource rc = getResource();
|
||||||
if (rc instanceof IFile) {
|
if (rc instanceof IFile) {
|
||||||
try {
|
try {
|
||||||
ILanguage language = LanguageManager.getInstance().getLanguageForFile((IFile) rc,
|
ILanguage language = LanguageManager.getInstance().getLanguageForFile((IFile)rc, null);
|
||||||
null);
|
|
||||||
return language != null;
|
return language != null;
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
// who cares, not even logging
|
// who cares, not even logging
|
||||||
|
|
|
@ -12,12 +12,10 @@ package org.eclipse.cdt.internal.ui.viewsupport;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.core.resources.IBuildConfiguration;
|
|
||||||
import org.eclipse.core.resources.IContainer;
|
import org.eclipse.core.resources.IContainer;
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IFolder;
|
import org.eclipse.core.resources.IFolder;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.Adapters;
|
|
||||||
import org.eclipse.jface.viewers.IDecoration;
|
import org.eclipse.jface.viewers.IDecoration;
|
||||||
import org.eclipse.jface.viewers.ILabelProviderListener;
|
import org.eclipse.jface.viewers.ILabelProviderListener;
|
||||||
import org.eclipse.jface.viewers.ILightweightLabelDecorator;
|
import org.eclipse.jface.viewers.ILightweightLabelDecorator;
|
||||||
|
@ -36,18 +34,15 @@ import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
||||||
import org.eclipse.cdt.internal.ui.CPluginImages;
|
import org.eclipse.cdt.internal.ui.CPluginImages;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines if a file or folder got customized build settings and if so decorates with the
|
* Determines if a file or folder got customized build settings and if so decorates with the "wrench" overlay.
|
||||||
* "wrench" overlay.
|
|
||||||
*/
|
*/
|
||||||
public class CustomBuildSettingsDecorator implements ILightweightLabelDecorator {
|
public class CustomBuildSettingsDecorator implements ILightweightLabelDecorator {
|
||||||
@Override
|
@Override
|
||||||
public void decorate(Object element, IDecoration decoration) {
|
public void decorate(Object element, IDecoration decoration) {
|
||||||
if (element instanceof IFile || element instanceof IFolder) {
|
if (element instanceof IFile || element instanceof IFolder) {
|
||||||
IResource rc = (IResource) element;
|
IResource rc = (IResource) element;
|
||||||
ICProjectDescriptionManager projectDescriptionManager = CoreModel.getDefault()
|
ICProjectDescriptionManager projectDescriptionManager = CoreModel.getDefault().getProjectDescriptionManager();
|
||||||
.getProjectDescriptionManager();
|
ICProjectDescription prjDescription = projectDescriptionManager.getProjectDescription(rc.getProject(), ICProjectDescriptionManager.GET_IF_LOADDED);
|
||||||
ICProjectDescription prjDescription = projectDescriptionManager
|
|
||||||
.getProjectDescription(rc.getProject(), ICProjectDescriptionManager.GET_IF_LOADDED);
|
|
||||||
if (prjDescription != null) {
|
if (prjDescription != null) {
|
||||||
ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
|
ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
|
||||||
if (cfgDescription != null) {
|
if (cfgDescription != null) {
|
||||||
|
@ -59,23 +54,14 @@ public class CustomBuildSettingsDecorator implements ILightweightLabelDecorator
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isCustomizedResource(ICConfigurationDescription cfgDescription, IResource rc) {
|
private static boolean isCustomizedResource(ICConfigurationDescription cfgDescription, IResource rc) {
|
||||||
IBuildConfiguration config = Adapters.adapt(cfgDescription, IBuildConfiguration.class);
|
if (ScannerDiscoveryLegacySupport.isLanguageSettingsProvidersFunctionalityEnabled(rc.getProject()) && cfgDescription instanceof ILanguageSettingsProvidersKeeper) {
|
||||||
if (config != null
|
|
||||||
&& ScannerDiscoveryLegacySupport
|
|
||||||
.isLanguageSettingsProvidersFunctionalityEnabled(rc.getProject())
|
|
||||||
&& cfgDescription instanceof ILanguageSettingsProvidersKeeper) {
|
|
||||||
IContainer parent = rc.getParent();
|
IContainer parent = rc.getParent();
|
||||||
List<String> languages = LanguageSettingsManager.getLanguages(rc, cfgDescription);
|
List<String> languages = LanguageSettingsManager.getLanguages(rc, cfgDescription);
|
||||||
for (ILanguageSettingsProvider provider : ((ILanguageSettingsProvidersKeeper) cfgDescription)
|
for (ILanguageSettingsProvider provider: ((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders()) {
|
||||||
.getLanguageSettingProviders()) {
|
|
||||||
for (String languageId : languages) {
|
for (String languageId : languages) {
|
||||||
List<ICLanguageSettingEntry> list = provider.getSettingEntries(cfgDescription, rc, languageId);
|
List<ICLanguageSettingEntry> list = provider.getSettingEntries(cfgDescription, rc, languageId);
|
||||||
if (list == null) {
|
|
||||||
list = provider.getSettingEntries(config, rc, languageId);
|
|
||||||
}
|
|
||||||
if (list != null) {
|
if (list != null) {
|
||||||
List<ICLanguageSettingEntry> listDefault = provider.getSettingEntries(config, parent,
|
List<ICLanguageSettingEntry> listDefault = provider.getSettingEntries(cfgDescription, parent, languageId);
|
||||||
languageId);
|
|
||||||
// != is OK here due as the equal lists will have the same reference in WeakHashSet
|
// != is OK here due as the equal lists will have the same reference in WeakHashSet
|
||||||
if (list != listDefault)
|
if (list != listDefault)
|
||||||
return true;
|
return true;
|
||||||
|
@ -84,8 +70,7 @@ public class CustomBuildSettingsDecorator implements ILightweightLabelDecorator
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ICResourceDescription rcDescription = cfgDescription
|
ICResourceDescription rcDescription = cfgDescription.getResourceDescription(rc.getProjectRelativePath(), true);
|
||||||
.getResourceDescription(rc.getProjectRelativePath(), true);
|
|
||||||
return rcDescription != null;
|
return rcDescription != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,25 +18,24 @@ import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsSerializableProvider;
|
import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsSerializableProvider;
|
||||||
import org.eclipse.cdt.core.settings.model.CIncludePathEntry;
|
import org.eclipse.cdt.core.settings.model.CIncludePathEntry;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
||||||
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
||||||
import org.eclipse.cdt.utils.spawner.ProcessFactory;
|
import org.eclipse.cdt.utils.spawner.ProcessFactory;
|
||||||
import org.eclipse.core.resources.IBuildConfiguration;
|
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
import org.w3c.dom.Node;
|
import org.w3c.dom.Node;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Discovers and persists the list of Qt include paths for a particular
|
* Discovers and persists the list of Qt include paths for a particular installation of
|
||||||
* installation of Qt. The Qt installation is described by the path to qmake.
|
* Qt. The Qt installation is described by the path to qmake.
|
||||||
* <p>
|
* <p>
|
||||||
* Qt uses a tool called qmake to generate makefiles for Qt projects. The tool
|
* Qt uses a tool called qmake to generate makefiles for Qt projects. The tool has a
|
||||||
* has a query mode that can be used to discover information about the Qt
|
* query mode that can be used to discover information about the Qt installation. Here
|
||||||
* installation. Here qmake is used to build a list of all installed Qt include
|
* qmake is used to build a list of all installed Qt include paths.
|
||||||
* paths.
|
|
||||||
* <p>
|
* <p>
|
||||||
* These paths are persisted into a file called language-settings.xml in the
|
* These paths are persisted into a file called language-settings.xml in the workspace
|
||||||
* workspace metadata area.
|
* metadata area.
|
||||||
*
|
*
|
||||||
* @see QtIncludePathsProvider
|
* @see QtIncludePathsProvider
|
||||||
*/
|
*/
|
||||||
|
@ -53,34 +52,34 @@ public class QtIncludePaths extends LanguageSettingsSerializableProvider {
|
||||||
private long qmakeModTime;
|
private long qmakeModTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The cached data is reloaded when the folder holding the include paths is
|
* The cached data is reloaded when the folder holding the include paths
|
||||||
* removed.
|
* is removed.
|
||||||
*/
|
*/
|
||||||
private String qtInstallHeadersPath;
|
private String qtInstallHeadersPath;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The cached data is reloaded when the folder containing the include
|
* The cached data is reloaded when the folder containing the include folders is
|
||||||
* folders is modified.
|
* modified.
|
||||||
*/
|
*/
|
||||||
private long qtInstallHeadersModTime;
|
private long qtInstallHeadersModTime;
|
||||||
|
|
||||||
private static final String ATTR_QMAKE = "qmake"; //$NON-NLS-1$
|
private static final String ATTR_QMAKE = "qmake";
|
||||||
private static final String ATTR_QMAKE_MOD = "qmakeModification"; //$NON-NLS-1$
|
private static final String ATTR_QMAKE_MOD = "qmakeModification";
|
||||||
private static final String ATTR_QT_INSTALL_HEADERS = "QT_INSTALL_HEADERS"; //$NON-NLS-1$
|
private static final String ATTR_QT_INSTALL_HEADERS = "QT_INSTALL_HEADERS";
|
||||||
private static final String ATTR_QT_INSTALL_HEADERS_MOD = "qtInstallHeadersModification"; //$NON-NLS-1$
|
private static final String ATTR_QT_INSTALL_HEADERS_MOD = "qtInstallHeadersModification";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new instance of the include path wrapper for the Qt installation
|
* Create a new instance of the include path wrapper for the Qt installation for
|
||||||
* for the given qmake binary.
|
* the given qmake binary.
|
||||||
*/
|
*/
|
||||||
public QtIncludePaths(String qmakePath) {
|
public QtIncludePaths(String qmakePath) {
|
||||||
this.qmakePath = qmakePath;
|
this.qmakePath = qmakePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create and load an instance of QtIncludePaths from data that was
|
* Create and load an instance of QtIncludePaths from data that was serialized into the
|
||||||
* serialized into the given XML element. Return null if an instance cannot
|
* given XML element. Return null if an instance cannot be loaded or if the installation
|
||||||
* be loaded or if the installation is no longer valid.
|
* is no longer valid.
|
||||||
*/
|
*/
|
||||||
public static QtIncludePaths loadFrom(Node node) {
|
public static QtIncludePaths loadFrom(Node node) {
|
||||||
if (node.getNodeType() != Node.ELEMENT_NODE)
|
if (node.getNodeType() != Node.ELEMENT_NODE)
|
||||||
|
@ -88,7 +87,8 @@ public class QtIncludePaths extends LanguageSettingsSerializableProvider {
|
||||||
|
|
||||||
Element element = (Element) node;
|
Element element = (Element) node;
|
||||||
String qmakePath = element.getAttribute(ATTR_QMAKE);
|
String qmakePath = element.getAttribute(ATTR_QMAKE);
|
||||||
if (qmakePath == null || qmakePath.isEmpty())
|
if (qmakePath == null
|
||||||
|
|| qmakePath.isEmpty())
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
QtIncludePaths qtIncludePaths = new QtIncludePaths(qmakePath);
|
QtIncludePaths qtIncludePaths = new QtIncludePaths(qmakePath);
|
||||||
|
@ -101,16 +101,18 @@ public class QtIncludePaths extends LanguageSettingsSerializableProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return true if the receiver points to a valid Qt installation and false
|
* Return true if the receiver points to a valid Qt installation and false otherwise.
|
||||||
* otherwise. The installation is considered valid if an executable qmake
|
* The installation is considered valid if an executable qmake binary exists at the
|
||||||
* binary exists at the expected location.
|
* expected location.
|
||||||
*/
|
*/
|
||||||
public boolean isValid() {
|
public boolean isValid() {
|
||||||
if (qmakePath == null || qmakePath.isEmpty())
|
if (qmakePath == null
|
||||||
|
|| qmakePath.isEmpty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
File qmake = new File(qmakePath);
|
File qmake = new File(qmakePath);
|
||||||
return qmake.exists() && qmake.canExecute();
|
return qmake.exists()
|
||||||
|
&& qmake.canExecute();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -118,10 +120,8 @@ public class QtIncludePaths extends LanguageSettingsSerializableProvider {
|
||||||
if (!(obj instanceof QtIncludePaths))
|
if (!(obj instanceof QtIncludePaths))
|
||||||
return super.equals(obj);
|
return super.equals(obj);
|
||||||
|
|
||||||
// Include paths are equivalent when they point to the same qmake
|
// Include paths are equivalent when they point to the same qmake binary. All other
|
||||||
// binary. All other
|
// values are reloaded from that binary and do not need to be directly compared.
|
||||||
// values are reloaded from that binary and do not need to be directly
|
|
||||||
// compared.
|
|
||||||
QtIncludePaths other = (QtIncludePaths) obj;
|
QtIncludePaths other = (QtIncludePaths) obj;
|
||||||
return qmakePath == null ? other.qmakePath == null : qmakePath.equals(other.qmakePath);
|
return qmakePath == null ? other.qmakePath == null : qmakePath.equals(other.qmakePath);
|
||||||
}
|
}
|
||||||
|
@ -132,32 +132,33 @@ public class QtIncludePaths extends LanguageSettingsSerializableProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a current list of the include paths for this Qt installation.
|
* Return a current list of the include paths for this Qt installation. Return null if
|
||||||
* Return null if no such paths can be found.
|
* no such paths can be found.
|
||||||
* <p>
|
* <p>
|
||||||
* Updates the cached results if needed. If the settings are updated then
|
* Updates the cached results if needed. If the settings are updated then the new list
|
||||||
* the new list will be serialized into the workspace metadata area.
|
* will be serialized into the workspace metadata area.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<ICLanguageSettingEntry> getSettingEntries(IBuildConfiguration config, IResource rc, String languageId) {
|
public List<ICLanguageSettingEntry> getSettingEntries(ICConfigurationDescription configDesc, IResource rc, String languageId) {
|
||||||
List<ICLanguageSettingEntry> entries = null;
|
List<ICLanguageSettingEntry> entries = null;
|
||||||
|
|
||||||
File qmake = new File(qmakePath);
|
File qmake = new File(qmakePath);
|
||||||
if (!qmake.exists() || qmakeModTime != qmake.lastModified())
|
if (!qmake.exists()
|
||||||
|
|| qmakeModTime != qmake.lastModified())
|
||||||
entries = reload();
|
entries = reload();
|
||||||
else {
|
else {
|
||||||
File qtInstallHeadersDir = new File(qtInstallHeadersPath);
|
File qtInstallHeadersDir = new File(qtInstallHeadersPath);
|
||||||
if (!qtInstallHeadersDir.exists() || qtInstallHeadersModTime != qtInstallHeadersDir.lastModified())
|
if (!qtInstallHeadersDir.exists()
|
||||||
|
|| qtInstallHeadersModTime != qtInstallHeadersDir.lastModified())
|
||||||
entries = reload();
|
entries = reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the cache was not reloaded, then return the previously discovered
|
// If the cache was not reloaded, then return the previously discovered entries.
|
||||||
// entries.
|
|
||||||
if (entries == null)
|
if (entries == null)
|
||||||
return super.getSettingEntries(config, rc, languageId);
|
return super.getSettingEntries(configDesc, rc, languageId);
|
||||||
|
|
||||||
// Otherwise store, persist, and return the newly discovered values.
|
// Otherwise store, persist, and return the newly discovered values.
|
||||||
setSettingEntries(config, rc, languageId, entries);
|
setSettingEntries(configDesc, rc, languageId, entries);
|
||||||
serializeLanguageSettingsInBackground(null);
|
serializeLanguageSettingsInBackground(null);
|
||||||
return entries;
|
return entries;
|
||||||
}
|
}
|
||||||
|
@ -169,10 +170,8 @@ public class QtIncludePaths extends LanguageSettingsSerializableProvider {
|
||||||
parentElement.setAttribute(ATTR_QT_INSTALL_HEADERS, qtInstallHeadersPath);
|
parentElement.setAttribute(ATTR_QT_INSTALL_HEADERS, qtInstallHeadersPath);
|
||||||
parentElement.setAttribute(ATTR_QT_INSTALL_HEADERS_MOD, Long.toString(qtInstallHeadersModTime));
|
parentElement.setAttribute(ATTR_QT_INSTALL_HEADERS_MOD, Long.toString(qtInstallHeadersModTime));
|
||||||
|
|
||||||
// The parent implementation tries to create a new child node (provider)
|
// The parent implementation tries to create a new child node (provider) that is used
|
||||||
// that is used
|
// as the part for later entries. This isn't needed in this case, we just want to
|
||||||
// as the part for later entries. This isn't needed in this case, we
|
|
||||||
// just want to
|
|
||||||
// use the part that serializes the languages.
|
// use the part that serializes the languages.
|
||||||
return parentElement;
|
return parentElement;
|
||||||
}
|
}
|
||||||
|
@ -183,26 +182,25 @@ public class QtIncludePaths extends LanguageSettingsSerializableProvider {
|
||||||
qtInstallHeadersPath = element.getAttribute(ATTR_QT_INSTALL_HEADERS);
|
qtInstallHeadersPath = element.getAttribute(ATTR_QT_INSTALL_HEADERS);
|
||||||
qtInstallHeadersModTime = getLongAttribute(element, ATTR_QT_INSTALL_HEADERS_MOD);
|
qtInstallHeadersModTime = getLongAttribute(element, ATTR_QT_INSTALL_HEADERS_MOD);
|
||||||
|
|
||||||
// The parent implementation tries to create a new child node (provider)
|
// The parent implementation tries to create a new child node (provider) that is used
|
||||||
// that is used
|
// as the part for later entries. This isn't needed in this case, we just want to
|
||||||
// as the part for later entries. This isn't needed in this case, we
|
|
||||||
// just want to
|
|
||||||
// use the part that serializes the languages.
|
// use the part that serializes the languages.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse and return the given attribute as a long. Return 0 if the attribute
|
* Parse and return the given attribute as a long. Return 0 if the attribute does
|
||||||
* does not have a valid value.
|
* not have a valid value.
|
||||||
*/
|
*/
|
||||||
private static long getLongAttribute(Element element, String attr) {
|
private static long getLongAttribute(Element element, String attr) {
|
||||||
String value = element.getAttribute(attr);
|
String value = element.getAttribute(attr);
|
||||||
if (value == null || value.isEmpty())
|
if (value == null
|
||||||
|
|| value.isEmpty())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return Long.parseLong(value);
|
return Long.parseLong(value);
|
||||||
} catch(NumberFormatException e) {
|
} catch(NumberFormatException e) {
|
||||||
Activator.log("attribute name:" + attr + " value:" + value, e); //$NON-NLS-1$ //$NON-NLS-2$
|
Activator.log("attribute name:" + attr + " value:" + value, e);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -211,25 +209,24 @@ public class QtIncludePaths extends LanguageSettingsSerializableProvider {
|
||||||
* Reload and return the entries if possible, return null otherwise.
|
* Reload and return the entries if possible, return null otherwise.
|
||||||
*/
|
*/
|
||||||
private List<ICLanguageSettingEntry> reload() {
|
private List<ICLanguageSettingEntry> reload() {
|
||||||
// All keys are reset and then updated as their values are discovered.
|
// All keys are reset and then updated as their values are discovered. This allows partial
|
||||||
// This allows partial
|
|
||||||
// success to skip over previously calculated values.
|
// success to skip over previously calculated values.
|
||||||
qmakeModTime = 0;
|
qmakeModTime = 0;
|
||||||
qtInstallHeadersPath = null;
|
qtInstallHeadersPath = null;
|
||||||
qtInstallHeadersModTime = 0;
|
qtInstallHeadersModTime = 0;
|
||||||
|
|
||||||
File qmake = new File(qmakePath);
|
File qmake = new File(qmakePath);
|
||||||
if (!qmake.exists() || !qmake.canExecute())
|
if (!qmake.exists()
|
||||||
|
|| !qmake.canExecute())
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
|
|
||||||
qmakeModTime = qmake.lastModified();
|
qmakeModTime = qmake.lastModified();
|
||||||
|
|
||||||
// Run `qmake -query QT_INSTALL_HEADERS` to get output like
|
// Run `qmake -query QT_INSTALL_HEADERS` to get output like "/opt/qt-5.0.0/include".
|
||||||
// "/opt/qt-5.0.0/include".
|
|
||||||
BufferedReader reader = null;
|
BufferedReader reader = null;
|
||||||
Process process = null;
|
Process process = null;
|
||||||
try {
|
try {
|
||||||
process = ProcessFactory.getFactory().exec(new String[] { qmakePath, "-query", "QT_INSTALL_HEADERS" }); //$NON-NLS-1$ //$NON-NLS-2$
|
process = ProcessFactory.getFactory().exec(new String[]{ qmakePath, "-query", "QT_INSTALL_HEADERS" });
|
||||||
reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
|
reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
|
||||||
qtInstallHeadersPath = reader.readLine();
|
qtInstallHeadersPath = reader.readLine();
|
||||||
} catch(IOException e) {
|
} catch(IOException e) {
|
||||||
|
@ -252,11 +249,12 @@ public class QtIncludePaths extends LanguageSettingsSerializableProvider {
|
||||||
File qtInstallHeadersDir = new File(qtInstallHeadersPath);
|
File qtInstallHeadersDir = new File(qtInstallHeadersPath);
|
||||||
|
|
||||||
qtInstallHeadersModTime = qtInstallHeadersDir.lastModified();
|
qtInstallHeadersModTime = qtInstallHeadersDir.lastModified();
|
||||||
if (!qtInstallHeadersDir.exists() || !qtInstallHeadersDir.canRead() || !qtInstallHeadersDir.isDirectory())
|
if (!qtInstallHeadersDir.exists()
|
||||||
|
|| !qtInstallHeadersDir.canRead()
|
||||||
|
|| !qtInstallHeadersDir.isDirectory())
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
|
|
||||||
// Create an include path entry for all sub-folders in the
|
// Create an include path entry for all sub-folders in the QT_INSTALL_HEADERS location, including
|
||||||
// QT_INSTALL_HEADERS location, including
|
|
||||||
// the QT_INSTALL_HEADERS folder itself.
|
// the QT_INSTALL_HEADERS folder itself.
|
||||||
File[] files = qtInstallHeadersDir.listFiles(new FileFilter() {
|
File[] files = qtInstallHeadersDir.listFiles(new FileFilter() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -275,8 +273,7 @@ public class QtIncludePaths extends LanguageSettingsSerializableProvider {
|
||||||
|
|
||||||
private static void safeAdd(List<ICLanguageSettingEntry> entries, File file) {
|
private static void safeAdd(List<ICLanguageSettingEntry> entries, File file) {
|
||||||
try {
|
try {
|
||||||
entries.add(
|
entries.add(new CIncludePathEntry(file.getCanonicalPath(), ICSettingEntry.READONLY | ICSettingEntry.RESOLVED));
|
||||||
new CIncludePathEntry(file.getCanonicalPath(), ICSettingEntry.READONLY | ICSettingEntry.RESOLVED));
|
|
||||||
} catch(IOException e) {
|
} catch(IOException e) {
|
||||||
Activator.log(e);
|
Activator.log(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@ import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
|
||||||
import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsSerializableProvider;
|
import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsSerializableProvider;
|
||||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
||||||
import org.eclipse.core.resources.IBuildConfiguration;
|
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
@ -25,8 +24,8 @@ import org.w3c.dom.NodeList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This provider uses persistent cache to store the include paths for different
|
* This provider uses persistent cache to store the include paths for different
|
||||||
* Qt installations. A Qt installation is uniquely identified by the path to the
|
* Qt installations. A Qt installation is uniquely identified by the path to
|
||||||
* qmake binary within the installation.
|
* the qmake binary within the installation.
|
||||||
* <p>
|
* <p>
|
||||||
* This result is shared among all Build Configurations that use the provider
|
* This result is shared among all Build Configurations that use the provider
|
||||||
* with the same value for the QMAKE environment variable.
|
* with the same value for the QMAKE environment variable.
|
||||||
|
@ -34,19 +33,17 @@ import org.w3c.dom.NodeList;
|
||||||
public class QtIncludePathsProvider extends LanguageSettingsSerializableProvider {
|
public class QtIncludePathsProvider extends LanguageSettingsSerializableProvider {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The provider identifies Qt installations by the absolute path to the
|
* The provider identifies Qt installations by the absolute path to the qmake binary. The
|
||||||
* qmake binary. The include paths relevant to the installations are
|
* include paths relevant to the installations are computed and persisted in {@link QtIncludePaths}.
|
||||||
* computed and persisted in {@link QtIncludePaths}.
|
|
||||||
*/
|
*/
|
||||||
private final Map<String, QtIncludePaths> qtInstallHeaders = new HashMap<String, QtIncludePaths>();
|
private final Map<String, QtIncludePaths> qtInstallHeaders = new HashMap<String, QtIncludePaths>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The build configuration stores the path to the qmake binary as an
|
* The build configuration stores the path to the qmake binary as an environment variable.
|
||||||
* environment variable.
|
|
||||||
*/
|
*/
|
||||||
private static final String ENVVAR_QMAKE = "QMAKE"; //$NON-NLS-1$
|
private static final String ENVVAR_QMAKE = "QMAKE";
|
||||||
|
|
||||||
private static final String ELEMENT_QMAKE = "qmake"; //$NON-NLS-1$
|
private static final String ELEMENT_QMAKE = "qmake";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
|
@ -71,19 +68,17 @@ public class QtIncludePathsProvider extends LanguageSettingsSerializableProvider
|
||||||
public void loadEntries(Element providerNode) {
|
public void loadEntries(Element providerNode) {
|
||||||
super.loadEntries(providerNode);
|
super.loadEntries(providerNode);
|
||||||
|
|
||||||
// Find and load all qmake child nodes. There will be one node for each
|
// Find and load all qmake child nodes. There will be one node for each Qt
|
||||||
// Qt
|
// installation that has been used. Qt installations that are no longer valid
|
||||||
// installation that has been used. Qt installations that are no longer
|
// are not loaded. This means they will be removed from the file the next time
|
||||||
// valid
|
|
||||||
// are not loaded. This means they will be removed from the file the
|
|
||||||
// next time
|
|
||||||
// that the language setting providers are serialized.
|
// that the language setting providers are serialized.
|
||||||
NodeList children = providerNode.getChildNodes();
|
NodeList children = providerNode.getChildNodes();
|
||||||
for (int i = 0; i < children.getLength(); ++i) {
|
for (int i = 0; i < children.getLength(); ++i) {
|
||||||
Node child = children.item(i);
|
Node child = children.item(i);
|
||||||
if (ELEMENT_QMAKE.equals(child.getNodeName())) {
|
if (ELEMENT_QMAKE.equals(child.getNodeName())) {
|
||||||
QtIncludePaths qtIncludePaths = QtIncludePaths.loadFrom(child);
|
QtIncludePaths qtIncludePaths = QtIncludePaths.loadFrom(child);
|
||||||
if (qtIncludePaths != null && qtIncludePaths.isValid())
|
if (qtIncludePaths != null
|
||||||
|
&& qtIncludePaths.isValid())
|
||||||
qtInstallHeaders.put(qtIncludePaths.getQMakePath(), qtIncludePaths);
|
qtInstallHeaders.put(qtIncludePaths.getQMakePath(), qtIncludePaths);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -91,12 +86,9 @@ public class QtIncludePathsProvider extends LanguageSettingsSerializableProvider
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void serializeEntries(Element parent) {
|
public void serializeEntries(Element parent) {
|
||||||
// NOTE: This creates its own XML structure where children of the
|
// NOTE: This creates its own XML structure where children of the provider node are qmake nodes.
|
||||||
// provider node are qmake nodes.
|
// Within each qmake node is a list of include paths for that installation. Calling the
|
||||||
// Within each qmake node is a list of include paths for that
|
// base #serializeEntries here would try to write this instance's (empty) list of settings
|
||||||
// installation. Calling the
|
|
||||||
// base #serializeEntries here would try to write this instance's
|
|
||||||
// (empty) list of settings
|
|
||||||
// to the file.
|
// to the file.
|
||||||
|
|
||||||
// Each value is serialized into a new element in the XML document.
|
// Each value is serialized into a new element in the XML document.
|
||||||
|
@ -109,24 +101,19 @@ public class QtIncludePathsProvider extends LanguageSettingsSerializableProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The given build configuration's QMAKE environment variable is used to
|
* The given build configuration's QMAKE environment variable is used to identify the appropriate
|
||||||
* identify the appropriate Qt installation. The language settings are then
|
* Qt installation. The language settings are then either returned from the previously persisted
|
||||||
* either returned from the previously persisted data or loaded, serialized,
|
* data or loaded, serialized, and returned.
|
||||||
* and returned.
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public synchronized List<ICLanguageSettingEntry> getSettingEntries(IBuildConfiguration config, IResource rc,
|
public synchronized List<ICLanguageSettingEntry> getSettingEntries(ICConfigurationDescription configDesc, IResource rc, String languageId) {
|
||||||
String languageId) {
|
|
||||||
// Make sure the requested language is in scope for this provider.
|
// Make sure the requested language is in scope for this provider.
|
||||||
if (!getLanguageScope().contains(languageId))
|
if (!getLanguageScope().contains(languageId))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
// The value of the build configuration's QMAKE environment variable is
|
// The value of the build configuration's QMAKE environment variable is used to select the
|
||||||
// used to select the
|
|
||||||
// right version of qmake.
|
// right version of qmake.
|
||||||
ICConfigurationDescription configDesc = config.getAdapter(ICConfigurationDescription.class);
|
IEnvironmentVariable qmake_var = CCorePlugin.getDefault().getBuildEnvironmentManager().getVariable(ENVVAR_QMAKE, configDesc, true);
|
||||||
IEnvironmentVariable qmake_var = CCorePlugin.getDefault().getBuildEnvironmentManager().getVariable(ENVVAR_QMAKE,
|
|
||||||
configDesc, true);
|
|
||||||
if (qmake_var == null)
|
if (qmake_var == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
@ -134,14 +121,13 @@ public class QtIncludePathsProvider extends LanguageSettingsSerializableProvider
|
||||||
if (qmake == null)
|
if (qmake == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
// The path to qmake is used as the key into the in-memory cache of
|
// The path to qmake is used as the key into the in-memory cache of header paths.
|
||||||
// header paths.
|
|
||||||
QtIncludePaths paths = qtInstallHeaders.get(qmake);
|
QtIncludePaths paths = qtInstallHeaders.get(qmake);
|
||||||
if (paths == null) {
|
if (paths == null) {
|
||||||
paths = new QtIncludePaths(qmake);
|
paths = new QtIncludePaths(qmake);
|
||||||
qtInstallHeaders.put(qmake, paths);
|
qtInstallHeaders.put(qmake, paths);
|
||||||
}
|
}
|
||||||
|
|
||||||
return paths.getSettingEntries(config, null, languageId);
|
return paths.getSettingEntries(configDesc, null, languageId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue