diff options
| author | jonas | 2015-01-19 22:16:12 +0000 |
|---|---|---|
| committer | jonas | 2015-01-19 22:16:13 +0000 |
| commit | 524c5de05c5249a5a608132180eb47fb0b47a2e5 (patch) | |
| tree | c3f1e31aeb4832890f17e18706478b03d0670c63 | |
| parent | 5f24f8312dc132155f6ebc58d3ab192d20250a21 (diff) | |
| download | org.eclipse.e4.tools-524c5de05c5249a5a608132180eb47fb0b47a2e5.tar.gz org.eclipse.e4.tools-524c5de05c5249a5a608132180eb47fb0b47a2e5.tar.xz org.eclipse.e4.tools-524c5de05c5249a5a608132180eb47fb0b47a2e5.zip | |
Bug 455725 - Split core bundles into new repository - Removed the moved bundles
622 files changed, 0 insertions, 61309 deletions
diff --git a/bundles/org.eclipse.e4.tools.compat/.classpath b/bundles/org.eclipse.e4.tools.compat/.classpath deleted file mode 100644 index ad32c83a..00000000 --- a/bundles/org.eclipse.e4.tools.compat/.classpath +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="src" path="src"/> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/bundles/org.eclipse.e4.tools.compat/.project b/bundles/org.eclipse.e4.tools.compat/.project deleted file mode 100644 index e5e9a152..00000000 --- a/bundles/org.eclipse.e4.tools.compat/.project +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.e4.tools.compat</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ManifestBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.SchemaBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ds.core.builder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.pde.PluginNature</nature> - <nature>org.eclipse.jdt.core.javanature</nature> - </natures> -</projectDescription> diff --git a/bundles/org.eclipse.e4.tools.compat/.settings/org.eclipse.core.resources.prefs b/bundles/org.eclipse.e4.tools.compat/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index f548abbf..00000000 --- a/bundles/org.eclipse.e4.tools.compat/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,6 +0,0 @@ -eclipse.preferences.version=1 - -encoding//model/etypes.ecore=UTF-8 - - -encoding/<project>=UTF-8 diff --git a/bundles/org.eclipse.e4.tools.compat/.settings/org.eclipse.core.runtime.prefs b/bundles/org.eclipse.e4.tools.compat/.settings/org.eclipse.core.runtime.prefs deleted file mode 100644 index 5a0ad22d..00000000 --- a/bundles/org.eclipse.e4.tools.compat/.settings/org.eclipse.core.runtime.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -line.separator=\n diff --git a/bundles/org.eclipse.e4.tools.compat/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.e4.tools.compat/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index c9482977..00000000 --- a/bundles/org.eclipse.e4.tools.compat/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,418 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.builder.cleanOutputFolder=clean -org.eclipse.jdt.core.builder.duplicateResourceTask=warning -org.eclipse.jdt.core.builder.invalidClasspath=abort -org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore -org.eclipse.jdt.core.builder.resourceCopyExclusionFilter= -org.eclipse.jdt.core.circularClasspath=error -org.eclipse.jdt.core.classpath.exclusionPatterns=enabled -org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled -org.eclipse.jdt.core.classpath.outputOverlappingAnotherSource=error -org.eclipse.jdt.core.codeComplete.argumentPrefixes= -org.eclipse.jdt.core.codeComplete.argumentSuffixes= -org.eclipse.jdt.core.codeComplete.fieldPrefixes= -org.eclipse.jdt.core.codeComplete.fieldSuffixes= -org.eclipse.jdt.core.codeComplete.localPrefixes= -org.eclipse.jdt.core.codeComplete.localSuffixes= -org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= -org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= -org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= -org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= -org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled -org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore -org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull -org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault -org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable -org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.doc.comment.support=enabled -org.eclipse.jdt.core.compiler.maxProblemPerUnit=100 -org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.autoboxing=ignore -org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning -org.eclipse.jdt.core.compiler.problem.deadCode=warning -org.eclipse.jdt.core.compiler.problem.deprecation=warning -org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled -org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled -org.eclipse.jdt.core.compiler.problem.discouragedReference=warning -org.eclipse.jdt.core.compiler.problem.emptyStatement=warning -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore -org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning -org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled -org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore -org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning -org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning -org.eclipse.jdt.core.compiler.problem.forbiddenReference=error -org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning -org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled -org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning -org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore -org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning -org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=disabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=public -org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning -org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning -org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled -org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning -org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore -org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled -org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public -org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag -org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled -org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning -org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning -org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning -org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning -org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning -org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error -org.eclipse.jdt.core.compiler.problem.nullReference=warning -org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error -org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning -org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning -org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning -org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore -org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore -org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning -org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning -org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning -org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore -org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning -org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore -org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore -org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled -org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning -org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled -org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled -org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled -org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore -org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning -org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning -org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning -org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore -org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning -org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning -org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled -org.eclipse.jdt.core.compiler.problem.unusedImport=warning -org.eclipse.jdt.core.compiler.problem.unusedLabel=warning -org.eclipse.jdt.core.compiler.problem.unusedLocal=warning -org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled -org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning -org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning -org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.6 -org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled -org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,HIGH,LOW,LOW,LOW,LOW,LOW,NORMAL -org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX,PERF,MEM,POLISH,@generated NOT,@ADDED,APITODO -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_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=true -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=true -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=do not insert -org.eclipse.jdt.core.formatter.comment.line_length=120 -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=1 -org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=1 -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_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_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_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=false -org.eclipse.jdt.core.formatter.join_wrapped_lines=false -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=true -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 -org.eclipse.jdt.core.incompatibleJDKLevel=ignore -org.eclipse.jdt.core.incompleteClasspath=error diff --git a/bundles/org.eclipse.e4.tools.compat/.settings/org.eclipse.jdt.launching.prefs b/bundles/org.eclipse.e4.tools.compat/.settings/org.eclipse.jdt.launching.prefs deleted file mode 100644 index 3bb23527..00000000 --- a/bundles/org.eclipse.e4.tools.compat/.settings/org.eclipse.jdt.launching.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.launching.PREF_STRICTLY_COMPATIBLE_JRE_NOT_AVAILABLE=ignore diff --git a/bundles/org.eclipse.e4.tools.compat/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.e4.tools.compat/.settings/org.eclipse.jdt.ui.prefs deleted file mode 100644 index 791508d1..00000000 --- a/bundles/org.eclipse.e4.tools.compat/.settings/org.eclipse.jdt.ui.prefs +++ /dev/null @@ -1,115 +0,0 @@ -cleanup.add_default_serial_version_id=true -cleanup.add_generated_serial_version_id=false -cleanup.add_missing_annotations=true -cleanup.add_missing_deprecated_annotations=true -cleanup.add_missing_methods=false -cleanup.add_missing_nls_tags=false -cleanup.add_missing_override_annotations=true -cleanup.add_missing_override_annotations_interface_methods=true -cleanup.add_serial_version_id=false -cleanup.always_use_blocks=true -cleanup.always_use_parentheses_in_expressions=false -cleanup.always_use_this_for_non_static_field_access=false -cleanup.always_use_this_for_non_static_method_access=false -cleanup.convert_to_enhanced_for_loop=false -cleanup.correct_indentation=true -cleanup.format_source_code=true -cleanup.format_source_code_changes_only=false -cleanup.make_local_variable_final=true -cleanup.make_parameters_final=false -cleanup.make_private_fields_final=true -cleanup.make_type_abstract_if_missing_method=false -cleanup.make_variable_declarations_final=true -cleanup.never_use_blocks=false -cleanup.never_use_parentheses_in_expressions=true -cleanup.organize_imports=true -cleanup.qualify_static_field_accesses_with_declaring_class=false -cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true -cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -cleanup.qualify_static_member_accesses_with_declaring_class=true -cleanup.qualify_static_method_accesses_with_declaring_class=false -cleanup.remove_private_constructors=true -cleanup.remove_trailing_whitespaces=true -cleanup.remove_trailing_whitespaces_all=true -cleanup.remove_trailing_whitespaces_ignore_empty=false -cleanup.remove_unnecessary_casts=false -cleanup.remove_unnecessary_nls_tags=false -cleanup.remove_unused_imports=true -cleanup.remove_unused_local_variables=false -cleanup.remove_unused_private_fields=true -cleanup.remove_unused_private_members=false -cleanup.remove_unused_private_methods=true -cleanup.remove_unused_private_types=true -cleanup.sort_members=false -cleanup.sort_members_all=false -cleanup.use_blocks=true -cleanup.use_blocks_only_for_return_and_throw=false -cleanup.use_parentheses_in_expressions=true -cleanup.use_this_for_non_static_field_access=true -cleanup.use_this_for_non_static_field_access_only_if_necessary=true -cleanup.use_this_for_non_static_method_access=true -cleanup.use_this_for_non_static_method_access_only_if_necessary=true -cleanup_profile=_esmCleanUp -cleanup_settings_version=2 -eclipse.preferences.version=1 -editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true -formatter_profile=_esmFormatter -formatter_settings_version=12 -org.eclipse.jdt.ui.exception.name=ex -org.eclipse.jdt.ui.gettersetter.use.is=true -org.eclipse.jdt.ui.javadoc=true -org.eclipse.jdt.ui.keywordthis=false -org.eclipse.jdt.ui.overrideannotation=true -org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*******************************************************************************\r\n * Copyright (c) 2011-${year} EclipseSource Muenchen GmbH and others.\r\n * \r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n * \r\n * Contributors\:\r\n * ${user} - initial API and implementation\r\n ******************************************************************************/</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n *\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment"/><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/**\r\n * {@inheritDoc}\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="false" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">\t\t\t// TODO Auto-generated catch block\r\n\t\t\t// Do NOT catch all Exceptions ("catch (Exception e)")\r\n\t\t\t// Log AND handle Exceptions if possible \r\n //\r\n // You can just uncomment one of the lines below to log an exception\:\r\n\t\t\t// logException will show the logged excpetion to the user\r\n\t\t\t// ModelUtil.logException(${exception_var});\r\n\t\t\t// ModelUtil.logException("YOUR MESSAGE HERE", ${exception_var});\r\n\t\t\t// logWarning will only add the message to the error log\r\n\t\t\t// ModelUtil.logWarning("YOUR MESSAGE HERE", ${exception_var});\r\n\t\t\t// ModelUtil.logWarning("YOUR MESSAGE HERE");\r\n\t\t\t//\t\t\t\r\n\t\t\t// If handling is not possible declare and rethrow Exception</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates> -sp_cleanup.add_default_serial_version_id=true -sp_cleanup.add_generated_serial_version_id=false -sp_cleanup.add_missing_annotations=true -sp_cleanup.add_missing_deprecated_annotations=true -sp_cleanup.add_missing_methods=false -sp_cleanup.add_missing_nls_tags=false -sp_cleanup.add_missing_override_annotations=true -sp_cleanup.add_missing_override_annotations_interface_methods=true -sp_cleanup.add_serial_version_id=false -sp_cleanup.always_use_blocks=true -sp_cleanup.always_use_parentheses_in_expressions=false -sp_cleanup.always_use_this_for_non_static_field_access=false -sp_cleanup.always_use_this_for_non_static_method_access=false -sp_cleanup.convert_to_enhanced_for_loop=false -sp_cleanup.correct_indentation=true -sp_cleanup.format_source_code=true -sp_cleanup.format_source_code_changes_only=false -sp_cleanup.make_local_variable_final=true -sp_cleanup.make_parameters_final=false -sp_cleanup.make_private_fields_final=true -sp_cleanup.make_type_abstract_if_missing_method=false -sp_cleanup.make_variable_declarations_final=true -sp_cleanup.never_use_blocks=false -sp_cleanup.never_use_parentheses_in_expressions=true -sp_cleanup.on_save_use_additional_actions=true -sp_cleanup.organize_imports=true -sp_cleanup.qualify_static_field_accesses_with_declaring_class=false -sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_with_declaring_class=true -sp_cleanup.qualify_static_method_accesses_with_declaring_class=false -sp_cleanup.remove_private_constructors=true -sp_cleanup.remove_trailing_whitespaces=true -sp_cleanup.remove_trailing_whitespaces_all=true -sp_cleanup.remove_trailing_whitespaces_ignore_empty=false -sp_cleanup.remove_unnecessary_casts=false -sp_cleanup.remove_unnecessary_nls_tags=true -sp_cleanup.remove_unused_imports=true -sp_cleanup.remove_unused_local_variables=false -sp_cleanup.remove_unused_private_fields=true -sp_cleanup.remove_unused_private_members=false -sp_cleanup.remove_unused_private_methods=true -sp_cleanup.remove_unused_private_types=true -sp_cleanup.sort_members=false -sp_cleanup.sort_members_all=false -sp_cleanup.use_blocks=true -sp_cleanup.use_blocks_only_for_return_and_throw=false -sp_cleanup.use_parentheses_in_expressions=true -sp_cleanup.use_this_for_non_static_field_access=true -sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true -sp_cleanup.use_this_for_non_static_method_access=true -sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/bundles/org.eclipse.e4.tools.compat/.settings/org.eclipse.pde.api.tools.prefs b/bundles/org.eclipse.e4.tools.compat/.settings/org.eclipse.pde.api.tools.prefs deleted file mode 100644 index e4e3c007..00000000 --- a/bundles/org.eclipse.e4.tools.compat/.settings/org.eclipse.pde.api.tools.prefs +++ /dev/null @@ -1,97 +0,0 @@ -ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Error -ANNOTATION_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error -ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Error -ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD=Error -ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error -API_COMPONENT_ELEMENT_TYPE_REMOVED_API_TYPE=Error -API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_API_TYPE=Error -API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_TYPE=Error -API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Error -API_USE_SCAN_FIELD_SEVERITY=Error -API_USE_SCAN_METHOD_SEVERITY=Error -API_USE_SCAN_TYPE_SEVERITY=Error -CLASS_ELEMENT_TYPE_ADDED_METHOD=Error -CLASS_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error -CLASS_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error -CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error -CLASS_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error -CLASS_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error -CLASS_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error -CLASS_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error -CLASS_ELEMENT_TYPE_REMOVED_CONSTRUCTOR=Error -CLASS_ELEMENT_TYPE_REMOVED_FIELD=Error -CLASS_ELEMENT_TYPE_REMOVED_METHOD=Error -CLASS_ELEMENT_TYPE_REMOVED_SUPERCLASS=Error -CLASS_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error -CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error -CONSTRUCTOR_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error -CONSTRUCTOR_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error -CONSTRUCTOR_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error -CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error -ENUM_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error -ENUM_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error -ENUM_ELEMENT_TYPE_REMOVED_ENUM_CONSTANT=Error -ENUM_ELEMENT_TYPE_REMOVED_FIELD=Error -ENUM_ELEMENT_TYPE_REMOVED_METHOD=Error -ENUM_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error -FIELD_ELEMENT_TYPE_ADDED_VALUE=Error -FIELD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error -FIELD_ELEMENT_TYPE_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT=Error -FIELD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error -FIELD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error -FIELD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error -FIELD_ELEMENT_TYPE_CHANGED_TYPE=Error -FIELD_ELEMENT_TYPE_CHANGED_VALUE=Error -FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENT=Error -FIELD_ELEMENT_TYPE_REMOVED_VALUE=Error -ILLEGAL_EXTEND=Warning -ILLEGAL_IMPLEMENT=Warning -ILLEGAL_INSTANTIATE=Warning -ILLEGAL_OVERRIDE=Warning -ILLEGAL_REFERENCE=Warning -INTERFACE_ELEMENT_TYPE_ADDED_FIELD=Error -INTERFACE_ELEMENT_TYPE_ADDED_METHOD=Error -INTERFACE_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error -INTERFACE_ELEMENT_TYPE_ADDED_SUPER_INTERFACE_WITH_METHODS=Error -INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error -INTERFACE_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error -INTERFACE_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error -INTERFACE_ELEMENT_TYPE_REMOVED_FIELD=Error -INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Error -INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error -INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error -INVALID_JAVADOC_TAG=Warning -INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Error -LEAK_EXTEND=Warning -LEAK_FIELD_DECL=Warning -LEAK_IMPLEMENT=Warning -LEAK_METHOD_PARAM=Warning -LEAK_METHOD_RETURN_TYPE=Warning -METHOD_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error -METHOD_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error -METHOD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error -METHOD_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error -METHOD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error -METHOD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error -METHOD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error -METHOD_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error -METHOD_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Error -METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error -MISSING_EE_DESCRIPTIONS=Error -TYPE_PARAMETER_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error -TYPE_PARAMETER_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error -TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error -TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error -TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error -TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error -UNUSED_PROBLEM_FILTERS=Ignore -automatically_removed_unused_problem_filters=Disabled -eclipse.preferences.version=1 -incompatible_api_component_version=Error -incompatible_api_component_version_include_major_without_breaking_change=Disabled -incompatible_api_component_version_include_minor_without_api_change=Disabled -invalid_since_tag_version=Error -malformed_since_tag=Error -missing_since_tag=Error -report_api_breakage_when_major_version_incremented=Disabled -report_resolution_errors_api_component=Warning diff --git a/bundles/org.eclipse.e4.tools.compat/.settings/org.eclipse.pde.prefs b/bundles/org.eclipse.e4.tools.compat/.settings/org.eclipse.pde.prefs deleted file mode 100644 index 0bbee3c4..00000000 --- a/bundles/org.eclipse.e4.tools.compat/.settings/org.eclipse.pde.prefs +++ /dev/null @@ -1,32 +0,0 @@ -compilers.f.unresolved-features=1 -compilers.f.unresolved-plugins=1 -compilers.incompatible-environment=1 -compilers.p.build=1 -compilers.p.build.bin.includes=1 -compilers.p.build.encodings=2 -compilers.p.build.java.compiler=2 -compilers.p.build.java.compliance=1 -compilers.p.build.missing.output=2 -compilers.p.build.output.library=1 -compilers.p.build.source.library=1 -compilers.p.build.src.includes=1 -compilers.p.deprecated=1 -compilers.p.discouraged-class=1 -compilers.p.internal=1 -compilers.p.missing-packages=1 -compilers.p.missing-version-export-package=1 -compilers.p.missing-version-import-package=1 -compilers.p.missing-version-require-bundle=1 -compilers.p.no-required-att=0 -compilers.p.not-externalized-att=2 -compilers.p.unknown-attribute=1 -compilers.p.unknown-class=1 -compilers.p.unknown-element=1 -compilers.p.unknown-identifier=1 -compilers.p.unknown-resource=1 -compilers.p.unresolved-ex-points=0 -compilers.p.unresolved-import=0 -compilers.s.create-docs=false -compilers.s.doc-folder=doc -compilers.s.open-tags=1 -eclipse.preferences.version=1 diff --git a/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF deleted file mode 100644 index c1c3677d..00000000 --- a/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF +++ /dev/null @@ -1,21 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %Bundle-Name -Bundle-SymbolicName: org.eclipse.e4.tools.compat;singleton:=true -Bundle-Version: 0.12.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 -Require-Bundle: org.eclipse.ui;bundle-version="3.6.0", - org.eclipse.core.runtime;bundle-version="3.6.0", - org.eclipse.e4.core.contexts;bundle-version="0.9.0", - org.eclipse.e4.core.services;bundle-version="0.9.1", - org.eclipse.e4.ui.services;bundle-version="0.9.1", - org.eclipse.e4.core.di;bundle-version="0.9.0", - org.eclipse.e4.tools.services;bundle-version="0.11.0", - org.eclipse.e4.ui.css.swt.theme;bundle-version="0.9.0", - org.eclipse.e4.ui.di;bundle-version="0.9.0", - org.eclipse.core.databinding;bundle-version="1.4.0" -Export-Package: org.eclipse.e4.tools.compat.internal;version="0.12.0.qualifier";x-internal:=true, - org.eclipse.e4.tools.compat.parts;version="0.12.0.qualifier";x-internal:=true -Bundle-ActivationPolicy: lazy -Bundle-Vendor: %Bundle-Vendor -Import-Package: javax.inject;version="1.0.0" diff --git a/bundles/org.eclipse.e4.tools.compat/OSGI-INF/l10n/bundle.properties b/bundles/org.eclipse.e4.tools.compat/OSGI-INF/l10n/bundle.properties deleted file mode 100644 index 767d1e6f..00000000 --- a/bundles/org.eclipse.e4.tools.compat/OSGI-INF/l10n/bundle.properties +++ /dev/null @@ -1,3 +0,0 @@ -#Properties file for org.eclipse.e4.tools.compat -Bundle-Name = Compat -Bundle-Vendor = Eclipse.org
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.compat/about.html b/bundles/org.eclipse.e4.tools.compat/about.html deleted file mode 100644 index 82494867..00000000 --- a/bundles/org.eclipse.e4.tools.compat/about.html +++ /dev/null @@ -1,28 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> -<title>About</title> -</head> -<body lang="EN-US"> -<h2>About This Content</h2> - -<p>December 3, 2009</p> -<h3>License</h3> - -<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise -indicated below, the Content is provided to you under the terms and conditions of the -Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available -at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. -For purposes of the EPL, "Program" will mean the Content.</p> - -<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is -being redistributed by another party ("Redistributor") and different terms and conditions may -apply to your use of any object code in the Content. Check the Redistributor's license that was -provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise -indicated below, the terms and conditions of the EPL still apply to any source code in the Content -and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p> - -</body> -</html>
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.compat/build.properties b/bundles/org.eclipse.e4.tools.compat/build.properties deleted file mode 100644 index aac269a4..00000000 --- a/bundles/org.eclipse.e4.tools.compat/build.properties +++ /dev/null @@ -1,7 +0,0 @@ -output.. = bin/ -bin.includes = META-INF/,\ - .,\ - plugin.xml,\ - about.html,\ - OSGI-INF/ -source.. = src/ diff --git a/bundles/org.eclipse.e4.tools.compat/forceQualifierUpdate.txt b/bundles/org.eclipse.e4.tools.compat/forceQualifierUpdate.txt deleted file mode 100644 index 396f0875..00000000 --- a/bundles/org.eclipse.e4.tools.compat/forceQualifierUpdate.txt +++ /dev/null @@ -1,2 +0,0 @@ -# To force a version qualifier update add the bug here -Bug 403237 - o.e.e4.tools cannot be build with "mvn clean install" diff --git a/bundles/org.eclipse.e4.tools.compat/plugin.xml b/bundles/org.eclipse.e4.tools.compat/plugin.xml deleted file mode 100644 index a8396863..00000000 --- a/bundles/org.eclipse.e4.tools.compat/plugin.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.4"?> -<plugin> - <extension - point="org.eclipse.ui.services"> - <serviceFactory - factoryClass="org.eclipse.e4.tools.compat.internal.ContextServiceFactory"> - <service - serviceClass="org.eclipse.e4.core.contexts.IEclipseContext"></service> - </serviceFactory> - </extension> - -</plugin> diff --git a/bundles/org.eclipse.e4.tools.compat/pom.xml b/bundles/org.eclipse.e4.tools.compat/pom.xml deleted file mode 100644 index c6196d36..00000000 --- a/bundles/org.eclipse.e4.tools.compat/pom.xml +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.eclipse.e4.tools</groupId> - <artifactId>e4-tools-aggregator</artifactId> - <version>0.17.0-SNAPSHOT</version> - <relativePath>../../</relativePath> - </parent> - - <groupId>org.eclipse.e4</groupId> - <artifactId>org.eclipse.e4.tools.compat</artifactId> - <version>0.12.0.qualifier</version> - <packaging>eclipse-plugin</packaging> - -</project> diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ClipboardServiceImpl.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ClipboardServiceImpl.java deleted file mode 100644 index 74b21309..00000000 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ClipboardServiceImpl.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2014 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Lars Vogel <Lars.Vogel@gmail.com> - Bug 421453 - ******************************************************************************/ -package org.eclipse.e4.tools.compat.internal; - -import org.eclipse.e4.tools.services.IClipboardService; - -public class ClipboardServiceImpl implements IClipboardService { - private Handler handler; - - @Override - public void copy() { - if( handler != null ) { - handler.copy(); - } - } - - @Override - public void paste() { - if( handler != null ) { - handler.paste(); - } - } - - @Override - public void setHandler(Handler handler) { - this.handler = handler; - } - - @Override - public void cut() { - this.handler.cut(); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java deleted file mode 100644 index bb54e563..00000000 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java +++ /dev/null @@ -1,163 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2014 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Lars Vogel <Lars.Vogel@gmail.com> - Bug 421453 - ******************************************************************************/ -package org.eclipse.e4.tools.compat.internal; - -import org.eclipse.core.databinding.observable.Realm; -import org.eclipse.e4.core.contexts.ContextInjectionFactory; -import org.eclipse.e4.core.contexts.EclipseContextFactory; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.core.services.contributions.IContributionFactory; -import org.eclipse.e4.core.services.log.ILoggerProvider; -import org.eclipse.e4.core.services.log.Logger; -import org.eclipse.e4.tools.services.IClipboardService; -import org.eclipse.e4.ui.css.swt.theme.IThemeEngine; -import org.eclipse.e4.ui.css.swt.theme.IThemeManager; -import org.eclipse.e4.ui.di.UISynchronize; -import org.eclipse.e4.ui.services.IServiceConstants; -import org.eclipse.e4.ui.services.IStylingEngine; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Widget; -import org.eclipse.ui.ISelectionListener; -import org.eclipse.ui.ISelectionService; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchPartSite; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.internal.services.IWorkbenchLocationService; -import org.eclipse.ui.services.AbstractServiceFactory; -import org.eclipse.ui.services.IServiceLocator; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.FrameworkUtil; -import org.w3c.dom.css.CSSStyleDeclaration; - -@SuppressWarnings("restriction") -public class ContextServiceFactory extends AbstractServiceFactory { - - @Override - public Object create(@SuppressWarnings("rawtypes") Class serviceInterface, IServiceLocator parentLocator, - IServiceLocator locator) { - if (!IEclipseContext.class.equals(serviceInterface)) { - return null; - } - - final IWorkbenchLocationService wls = (IWorkbenchLocationService) locator - .getService(IWorkbenchLocationService.class); - final IWorkbenchWindow window = wls.getWorkbenchWindow(); - final IWorkbenchPartSite site = wls.getPartSite(); - - final Object o = parentLocator.getService(serviceInterface); - - // This happens when we run in plain 3.x - // We need to create a parent service context - if (window == null && site == null) { - final Bundle bundle = FrameworkUtil.getBundle(ContextServiceFactory.class); - final BundleContext bundleContext = bundle.getBundleContext(); - final IEclipseContext serviceContext = EclipseContextFactory.getServiceContext(bundleContext); - - final IEclipseContext appContext = serviceContext.createChild("WorkbenchContext"); //$NON-NLS-1$ - appContext.set(Display.class, Display.getCurrent()); - appContext.set(Logger.class, new WorkbenchLogger()); - appContext.set(IClipboardService.class, new ClipboardServiceImpl()); - appContext.set(Realm.class, Realm.getDefault()); - - final Display d = Display.getCurrent(); - appContext.set(UISynchronize.class, new UISynchronize() { - - @Override - public void syncExec(Runnable runnable) { - d.syncExec(runnable); - } - - @Override - public void asyncExec(Runnable runnable) { - d.asyncExec(runnable); - } - }); - - final IContributionFactory contributionFactory = ContextInjectionFactory.make( - ReflectionContributionFactory.class, appContext); - appContext.set(IContributionFactory.class.getName(), contributionFactory); - - final IThemeManager manager = serviceContext.get(IThemeManager.class); - final IThemeEngine engine = manager.getEngineForDisplay(Display.getCurrent()); - appContext.set(IThemeEngine.class, engine); - - appContext.set(IStylingEngine.class, new IStylingEngine() { - - @Override - public void setClassname(Object widget, String classname) { - ((Widget) widget).setData("org.eclipse.e4.ui.css.CssClassName", classname); //$NON-NLS-1$ - engine.applyStyles(widget, true); - } - - @Override - public void setId(Object widget, String id) { - ((Widget) widget).setData("org.eclipse.e4.ui.css.id", id); //$NON-NLS-1$ - engine.applyStyles(widget, true); - } - - @Override - public void style(Object widget) { - engine.applyStyles(widget, true); - } - - @Override - public CSSStyleDeclaration getStyle(Object widget) { - return engine.getStyle(widget); - } - - @Override - public void setClassnameAndId(Object widget, String classname, - String id) { - ((Widget) widget).setData("org.eclipse.e4.ui.css.CssClassName", classname); //$NON-NLS-1$ - ((Widget) widget).setData("org.eclipse.e4.ui.css.id", id); //$NON-NLS-1$ - engine.applyStyles(widget, true); - } - }); - - if (appContext.get(ILoggerProvider.class) == null) { - appContext.set(ILoggerProvider.class, - ContextInjectionFactory.make(DefaultLoggerProvider.class, appContext)); - } - - return appContext; - } else if (o != null && site == null) { - final IEclipseContext windowContext = ((IEclipseContext) o).createChild("WindowContext(" + window + ")"); //$NON-NLS-1$ //$NON-NLS-2$ - windowContext.set(ISelectionService.class, window.getSelectionService()); - - windowContext.declareModifiable(IServiceConstants.ACTIVE_SELECTION); - window.getSelectionService().addSelectionListener(new ISelectionListener() { - - @Override - public void selectionChanged(IWorkbenchPart part, ISelection selection) { - if (!selection.isEmpty()) { - if (selection instanceof IStructuredSelection) { - final IStructuredSelection s = (IStructuredSelection) selection; - if (s.size() == 1) { - windowContext.set(IServiceConstants.ACTIVE_SELECTION, s.getFirstElement()); - } else { - windowContext.set(IServiceConstants.ACTIVE_SELECTION, s.toList()); - } - } else { - windowContext.set(IServiceConstants.ACTIVE_SELECTION, selection); - } - } - } - }); - return windowContext; - } - - return o; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/CopyAction.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/CopyAction.java deleted file mode 100644 index 153fc5b4..00000000 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/CopyAction.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.compat.internal; - -import org.eclipse.e4.tools.services.IClipboardService; -import org.eclipse.jface.action.Action; - -public class CopyAction extends Action { - private final IClipboardService service; - - public CopyAction(IClipboardService service) { - super(Messages.CopyAction); - this.service = service; - } - - @Override - public void run() { - service.copy(); - } -} diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/CutAction.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/CutAction.java deleted file mode 100644 index 88f8fbb7..00000000 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/CutAction.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.compat.internal; - -import org.eclipse.e4.tools.services.IClipboardService; -import org.eclipse.jface.action.Action; - -public class CutAction extends Action { - private IClipboardService service; - - public CutAction(IClipboardService service) { - super(Messages.CutAction); - this.service = service; - } - - @Override - public void run() { - service.cut(); - } -} diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/DefaultLoggerProvider.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/DefaultLoggerProvider.java deleted file mode 100644 index cfa745ba..00000000 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/DefaultLoggerProvider.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.eclipse.e4.tools.compat.internal; - -import javax.inject.Inject; - -import org.eclipse.e4.core.contexts.ContextInjectionFactory; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.core.services.log.ILoggerProvider; -import org.eclipse.e4.core.services.log.Logger; -import org.osgi.framework.FrameworkUtil; - -@SuppressWarnings("restriction") -public class DefaultLoggerProvider implements ILoggerProvider { - @Inject - private IEclipseContext context; - - @Override - public Logger getClassLogger(Class<?> clazz) { - final IEclipseContext childContext = context.createChild(); - childContext.set("logger.bundlename", FrameworkUtil.getBundle(clazz).getSymbolicName()); //$NON-NLS-1$ - return ContextInjectionFactory.make(WorkbenchLogger.class, childContext); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/Messages.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/Messages.java deleted file mode 100644 index c1fe7f67..00000000 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/Messages.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011-2014 EclipseSource Muenchen GmbH and others. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Jonas - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.compat.internal; - -import org.eclipse.osgi.util.NLS; - -/** - * @author Jonas - * - */ -public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.e4.tools.compat.internal.messages"; //$NON-NLS-1$ - public static String CopyAction; - public static String CutAction; - public static String PasteAction; - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - private Messages() { - } -} diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/PartHelper.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/PartHelper.java deleted file mode 100644 index 996cbad8..00000000 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/PartHelper.java +++ /dev/null @@ -1,128 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.compat.internal; - -import java.lang.reflect.Method; - -import org.eclipse.core.runtime.ListenerList; -import org.eclipse.e4.core.contexts.ContextInjectionFactory; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.tools.services.IClipboardService; -import org.eclipse.e4.ui.services.IStylingEngine; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.IWorkbenchPartSite; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.part.WorkbenchPart; - -public class PartHelper { - private static final String ORG_ECLIPSE_E4_UI_WORKBENCH_I_PRESENTATION_ENGINE = "org.eclipse.e4.ui.workbench.IPresentationEngine"; //$NON-NLS-1$ - - public static IEclipseContext createPartContext(WorkbenchPart part) throws PartInitException { - final IWorkbenchPartSite site = part.getSite(); - final IEclipseContext parentContext = (IEclipseContext) site.getService(IEclipseContext.class); - - // Check if running in 4.x - if (parentContext.get(ORG_ECLIPSE_E4_UI_WORKBENCH_I_PRESENTATION_ENGINE) != null) { - // Hack to get the MPart-Context - try { - final Class<?> clazz = Util.getBundle("org.eclipse.e4.ui.model.workbench").loadClass( //$NON-NLS-1$ - "org.eclipse.e4.ui.model.application.ui.basic.MPart"); //$NON-NLS-1$ - final Object instance = site.getService(clazz); - final Method m = clazz.getMethod("getContext", new Class[0]); //$NON-NLS-1$ - IEclipseContext ctx = (IEclipseContext) m.invoke(instance); - final IEclipseContext rv = ctx; - while (ctx.getParent() != null) { - ctx = ctx.getParent(); - } - ctx.set(IClipboardService.class, new ClipboardServiceImpl()); - return rv; - } catch (final Exception e) { - throw new PartInitException("Could not create context", e); //$NON-NLS-1$ - } - } - return parentContext.createChild("EditPart('" + part.getPartName() + "')"); //$NON-NLS-1$ //$NON-NLS-2$ - - } - - public static <C> C createComponent(Composite parent, IEclipseContext context, Class<C> clazz, WorkbenchPart part) { - final ISelectionProvider s = new SelectionProviderImpl(); - context.set(ISelectionProvider.class, s); - part.getSite().setSelectionProvider(s); - - final IStylingEngine styleEngine = context.get(IStylingEngine.class); - final Composite comp = new Composite(parent, SWT.NONE); - comp.setBackgroundMode(SWT.INHERIT_DEFAULT); - - // FIXME This should be read from the CSS - final FillLayout layout = new FillLayout(); - layout.marginWidth = 10; - layout.marginHeight = 10; - comp.setLayout(layout); - - context.set(Composite.class.getName(), comp); - final C component = ContextInjectionFactory.make(clazz, context); - - styleEngine.setClassname(comp, part.getClass().getSimpleName()); - - return component; - } - - static class SelectionProviderImpl implements ISelectionProvider { - private ISelection currentSelection = StructuredSelection.EMPTY; - - private final ListenerList listeners = new ListenerList(); - - @Override - public void setSelection(ISelection selection) { - currentSelection = selection; - final SelectionChangedEvent evt = new SelectionChangedEvent(this, selection); - - for (final Object l : listeners.getListeners()) { - ((ISelectionChangedListener) l).selectionChanged(evt); - } - } - - @Override - public void removeSelectionChangedListener( - ISelectionChangedListener listener) { - listeners.remove(listener); - } - - @Override - public ISelection getSelection() { - return currentSelection; - } - - @Override - public void addSelectionChangedListener(ISelectionChangedListener listener) { - listeners.add(listener); - } - } - - public static void disposeContextIfE3(IEclipseContext parentContext, - IEclipseContext context) { - // Check if running in 3.x, otherwise there was no dedicated context - // created - if (parentContext - .get(ORG_ECLIPSE_E4_UI_WORKBENCH_I_PRESENTATION_ENGINE) == null) { - context.dispose(); - context = null; - } - - } -} diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/PasteAction.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/PasteAction.java deleted file mode 100644 index cb2cbbc2..00000000 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/PasteAction.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.compat.internal; - -import org.eclipse.e4.tools.services.IClipboardService; -import org.eclipse.jface.action.Action; - -public class PasteAction extends Action { - private IClipboardService service; - public PasteAction(IClipboardService service) { - super(Messages.PasteAction); - this.service = service; - } - - @Override - public void run() { - service.paste(); - } -} diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ReflectionContributionFactory.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ReflectionContributionFactory.java deleted file mode 100644 index c473d725..00000000 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ReflectionContributionFactory.java +++ /dev/null @@ -1,225 +0,0 @@ -package org.eclipse.e4.tools.compat.internal; - -import java.util.HashMap; -import java.util.Map; - -import javax.inject.Inject; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.InvalidRegistryObjectException; -import org.eclipse.e4.core.contexts.ContextInjectionFactory; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.core.di.InjectionException; -import org.eclipse.e4.core.services.contributions.IContributionFactory; -import org.eclipse.e4.core.services.contributions.IContributionFactorySpi; -import org.eclipse.e4.core.services.log.Logger; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.FrameworkUtil; -import org.osgi.framework.ServiceReference; -import org.osgi.service.packageadmin.PackageAdmin; - -/** - * Create the contribution factory. - */ -@SuppressWarnings({ "restriction", "deprecation" }) -public class ReflectionContributionFactory implements IContributionFactory { - - private final IExtensionRegistry registry; - private Map<String, Object> languages; - - @Inject - private PackageAdmin packageAdmin; - - @Inject - private Logger logger; - - /** - * Create a reflection factory. - * - * @param registry - * to read languages. - */ - @Inject - public ReflectionContributionFactory(IExtensionRegistry registry) { - this.registry = registry; - processLanguages(); - } - - @Override - public Object create(String uriString, IEclipseContext context, IEclipseContext staticContext) { - return doCreate(uriString, context, staticContext); - } - - @Override - public Object create(String uriString, IEclipseContext context) { - return doCreate(uriString, context, null); - } - - private Object doCreate(String uriString, IEclipseContext context, IEclipseContext staticContext) { - if (uriString == null) { - return null; - } - // translate old-style platform:/plugin/ class specifiers into new-style - // bundleclass:// URIs - if (uriString.startsWith("platform:/plugin/")) { //$NON-NLS-1$ - logger.error("platform-style URIs deprecated for referencing types: " + uriString); //$NON-NLS-1$ - uriString = uriString - .replace("platform:/plugin/", "bundleclass://"); //$NON-NLS-1$ //$NON-NLS-2$ - logger.error("URI rewritten as: " + uriString); //$NON-NLS-1$ - } - - final URI uri = URI.createURI(uriString); - final Bundle bundle = getBundle(uri); - Object contribution; - if (bundle != null) { - contribution = createFromBundle(bundle, context, staticContext, uri); - } else { - contribution = null; - logger.error("Unable to retrive the bundle from the URI: " //$NON-NLS-1$ - + uriString); - } - return contribution; - } - - protected Object createFromBundle(Bundle bundle, IEclipseContext context, - IEclipseContext staticContext, URI uri) { - Object contribution; - if (uri.segmentCount() > 1) { - final String prefix = uri.segment(0); - final IContributionFactorySpi factory = (IContributionFactorySpi) languages.get(prefix); - if (factory == null) { - final String message = "Unsupported contribution factory type '" + prefix + "'"; //$NON-NLS-1$ //$NON-NLS-2$ - logger.error(message); - return null; - } - final StringBuffer resource = new StringBuffer(uri.segment(1)); - for (int i = 2; i < uri.segmentCount(); i++) { - resource.append('/'); - resource.append(uri.segment(i)); - } - contribution = factory.create(bundle, resource.toString(), context); - } else { - final String clazz = uri.segment(0); - try { - final Class<?> targetClass = bundle.loadClass(clazz); - if (staticContext == null) { - contribution = ContextInjectionFactory.make(targetClass, context); - } else { - contribution = ContextInjectionFactory - .make(targetClass, context, staticContext); - } - - if (contribution == null) { - final String message = "Unable to load class '" + clazz + "' from bundle '" //$NON-NLS-1$ //$NON-NLS-2$ - + bundle.getBundleId() + "'"; //$NON-NLS-1$ - logger.error(message); - } - } catch (final ClassNotFoundException e) { - contribution = null; - final String message = "Unable to load class '" + clazz + "' from bundle '" //$NON-NLS-1$ //$NON-NLS-2$ - + bundle.getBundleId() + "'"; //$NON-NLS-1$ - logger.error(e, message); - } catch (final InjectionException e) { - contribution = null; - final String message = "Unable to create class '" + clazz + "' from bundle '" //$NON-NLS-1$ //$NON-NLS-2$ - + bundle.getBundleId() + "'"; //$NON-NLS-1$ - logger.error(e, message); - } - } - return contribution; - } - - protected void processLanguages() { - languages = new HashMap<String, Object>(); - final String extId = "org.eclipse.e4.languages"; //$NON-NLS-1$ - final IConfigurationElement[] languageElements = registry.getConfigurationElementsFor(extId); - for (int i = 0; i < languageElements.length; i++) { - final IConfigurationElement languageElement = languageElements[i]; - try { - languages.put(languageElement.getAttribute("name"), //$NON-NLS-1$ - languageElement.createExecutableExtension("contributionFactory")); //$NON-NLS-1$ - } catch (final InvalidRegistryObjectException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (final CoreException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - - protected Bundle getBundle(URI platformURI) { - return getBundleForName(platformURI.authority()); - } - - @Override - public Bundle getBundle(String uriString) { - return getBundle(new URI(uriString)); - } - - public Bundle getBundleForName(String bundlename) { - if (packageAdmin == null) { - final Bundle bundle = FrameworkUtil.getBundle(getClass()); - final BundleContext context = bundle.getBundleContext(); - final ServiceReference<?> reference = context.getServiceReference(PackageAdmin.class.getName()); - packageAdmin = (PackageAdmin) context.getService(reference); - } - - final Bundle[] bundles = packageAdmin.getBundles(bundlename, null); - if (bundles == null) { - return null; - } - // Return the first bundle that is not installed or uninstalled - for (int i = 0; i < bundles.length; i++) { - if ((bundles[i].getState() & (Bundle.INSTALLED | Bundle.UNINSTALLED)) == 0) { - return bundles[i]; - } - } - return null; - } - - static class URI { - String scheme; - String authority; - String[] segments = new String[0]; - - URI(String uriString) { - final int colon = uriString.indexOf(':'); - if (colon < 0) { - throw new IllegalArgumentException("invalid URI"); //$NON-NLS-1$ - } - scheme = uriString.substring(0, colon); - uriString = uriString.substring(colon + 1); - if (uriString.startsWith("//")) { //$NON-NLS-1$ - final int authEnd = uriString.indexOf('/', 2); - if (authEnd < 0) { - authority = uriString.substring(2); - } else { - authority = uriString.substring(2, authEnd); - segments = uriString.substring(authEnd + 1).split("/"); //$NON-NLS-1$ - } - } else { - segments = uriString.substring(uriString.indexOf('/') + 1).split("/"); //$NON-NLS-1$ - } - } - - public String authority() { - return authority; - } - - public String segment(int i) { - return segments[i]; - } - - public int segmentCount() { - return segments.length; - } - - static URI createURI(String uriString) { - return new URI(uriString); - } - } -} diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/Util.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/Util.java deleted file mode 100644 index a72f261a..00000000 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/Util.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.eclipse.e4.tools.compat.internal; - -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.FrameworkUtil; -import org.osgi.framework.ServiceReference; -import org.osgi.service.packageadmin.PackageAdmin; - -@SuppressWarnings("deprecation") -public class Util { - public static Bundle getBundle(String bundleName) { - final Bundle bundle = FrameworkUtil.getBundle(Util.class); - final BundleContext ctx = bundle.getBundleContext(); - final ServiceReference<PackageAdmin> ref = bundle.getBundleContext().getServiceReference( - PackageAdmin.class); - final PackageAdmin bundleAdmin = ctx.getService(ref); - final Bundle[] bundles = bundleAdmin.getBundles(bundleName, null); - if (bundles == null) { - return null; - } - // Return the first bundle that is not installed or uninstalled - for (int i = 0; i < bundles.length; i++) { - if ((bundles[i].getState() & (Bundle.INSTALLED | Bundle.UNINSTALLED)) == 0) { - return bundles[i]; - } - } - return null; - } -} diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/WorkbenchLogger.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/WorkbenchLogger.java deleted file mode 100644 index 3806c8d0..00000000 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/WorkbenchLogger.java +++ /dev/null @@ -1,158 +0,0 @@ -package org.eclipse.e4.tools.compat.internal; - -import java.util.ArrayList; - -import javax.inject.Inject; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.e4.core.services.log.Logger; -import org.eclipse.osgi.framework.log.FrameworkLog; -import org.eclipse.osgi.framework.log.FrameworkLogEntry; -import org.eclipse.osgi.service.debug.DebugOptions; -import org.eclipse.osgi.service.debug.DebugTrace; -import org.osgi.framework.Bundle; -import org.osgi.framework.FrameworkUtil; - -/** - * The workbench implementation of the logger service. - */ -@SuppressWarnings("restriction") -public final class WorkbenchLogger extends Logger { - protected DebugTrace trace; - protected FrameworkLog log; - private final Bundle bundle = FrameworkUtil.getBundle(WorkbenchLogger.class); - - /** - * Creates a new workbench logger - */ - public WorkbenchLogger() { - super(); - } - - @Override - public void debug(Throwable t) { - debug(t, null); - } - - @Override - public void debug(Throwable t, String message) { - trace(t, message); - } - - @Override - public void error(Throwable t, String message) { - log(new Status(IStatus.ERROR, bundle.getSymbolicName(), - message, t)); - } - - /** - * Copied from PlatformLogWriter in core runtime. - */ - private static FrameworkLogEntry getLog(IStatus status) { - final Throwable t = status.getException(); - final ArrayList<FrameworkLogEntry> childlist = new ArrayList<FrameworkLogEntry>(); - - final int stackCode = t instanceof CoreException ? 1 : 0; - // ensure a substatus inside a CoreException is properly logged - if (stackCode == 1) { - final IStatus coreStatus = ((CoreException) t).getStatus(); - if (coreStatus != null) { - childlist.add(getLog(coreStatus)); - } - } - - if (status.isMultiStatus()) { - final IStatus[] children = status.getChildren(); - for (int i = 0; i < children.length; i++) { - childlist.add(getLog(children[i])); - } - } - - final FrameworkLogEntry[] children = childlist.size() == 0 ? null - : childlist.toArray(new FrameworkLogEntry[childlist.size()]); - - return new FrameworkLogEntry(status.getPlugin(), status.getSeverity(), status.getCode(), - status.getMessage(), stackCode, t, children); - } - - @Override - public void info(Throwable t, String message) { - log(new Status(IStatus.INFO, bundle.getSymbolicName(), message, - t)); - } - - @Override - public boolean isDebugEnabled() { - return false; - } - - @Override - public boolean isErrorEnabled() { - return true; - } - - @Override - public boolean isInfoEnabled() { - return true; - } - - @Override - public boolean isTraceEnabled() { - return false; - } - - @Override - public boolean isWarnEnabled() { - return true; - } - - private void log(IStatus status) { - if (log != null) { - log.log(getLog(status)); - } else { - System.out.println(status.getMessage()); - if (status.getException() != null) { - status.getException().printStackTrace(); - } - } - } - - /** - * Sets the debug options service for this logger. - * - * @param options - * The debug options to be used by this logger - */ - @Inject - public void setDebugOptions(DebugOptions options) { - if (options != null) { - trace = options.newDebugTrace(bundle.getSymbolicName(), WorkbenchLogger.class); - } - } - - /** - * @param log - */ - @Inject - public void setFrameworkLog(FrameworkLog log) { - this.log = log; - } - - @Override - public void trace(Throwable t, String message) { - if (trace != null) { - trace.trace(null, message, t); - } else { - System.out.println(message); - t.printStackTrace(); - } - } - - @Override - public void warn(Throwable t, String message) { - log(new Status(IStatus.WARNING, bundle.getSymbolicName(), - message, t)); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/messages.properties b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/messages.properties deleted file mode 100644 index d60d7bac..00000000 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/messages.properties +++ /dev/null @@ -1,3 +0,0 @@ -CopyAction=Copy -CutAction=Cut -PasteAction=Paste diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIEditorPart.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIEditorPart.java deleted file mode 100644 index f247c89e..00000000 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIEditorPart.java +++ /dev/null @@ -1,166 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2014 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Jonas Helming <jhelming@eclipsesource.com> - * Lars Vogel <Lars.Vogel@gmail.com> - Bug 421453 - * Steven Spungin <steven@spungin.tv> - Bug 436889 - ******************************************************************************/ -package org.eclipse.e4.tools.compat.parts; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.e4.core.contexts.ContextInjectionFactory; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.tools.compat.internal.CopyAction; -import org.eclipse.e4.tools.compat.internal.CutAction; -import org.eclipse.e4.tools.compat.internal.PartHelper; -import org.eclipse.e4.tools.compat.internal.PasteAction; -import org.eclipse.e4.tools.services.IClipboardService; -import org.eclipse.e4.tools.services.IDirtyProviderService; -import org.eclipse.e4.ui.di.Focus; -import org.eclipse.e4.ui.di.Persist; -import org.eclipse.e4.ui.di.PersistState; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IEditorSite; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.actions.ActionFactory; -import org.eclipse.ui.part.EditorPart; - -/** - * This class provides an adapter enabling to plug editors, which are - * implemented following the e4 programming model into a 3.x workbench. This - * class is supposed to be sub classed by clients. - * - * @author Jonas - * - * @param <C> - */ -public abstract class DIEditorPart<C> extends EditorPart implements - IDirtyProviderService { - private IEclipseContext context; - private C component; - private Class<C> clazz; - private boolean dirtyState; - - private int features; - - protected static final int COPY = 1; - protected static final int PASTE = 1 << 1; - protected static final int CUT = 1 << 2; - - public DIEditorPart(Class<C> clazz) { - this(clazz, SWT.NONE); - } - - public DIEditorPart(Class<C> clazz, int features) { - this.clazz = clazz; - this.features = features; - } - - @Override - public void doSave(IProgressMonitor monitor) { - IEclipseContext saveContext = context.createChild(); - ContextInjectionFactory.invoke(component, Persist.class, saveContext); - saveContext.dispose(); - } - - @Override - public void doSaveAs() { - - } - - @Override - public boolean isSaveAsAllowed() { - return false; - } - - @Override - public void init(IEditorSite site, IEditorInput input) - throws PartInitException { - setSite(site); - setInput(input); - - context = PartHelper.createPartContext(this); - context.declareModifiable(IEditorInput.class); - context.declareModifiable(IEditorPart.class); - context.declareModifiable(IDirtyProviderService.class); - - context.set(IEditorPart.class, this); - context.set(IDirtyProviderService.class, this); - context.set(IEditorInput.class, input); - } - - @Override - public void createPartControl(Composite parent) { - component = PartHelper.createComponent(parent, context, clazz, this); - makeActions(); - } - - @PersistState - public void persistState() { - ContextInjectionFactory.invoke(component, PersistState.class, context); - } - - protected IEclipseContext getContext() { - return context; - } - - public C getComponent() { - return component; - } - - protected void makeActions() { - if ((features & COPY) == COPY) { - IClipboardService clipboard = context.get(IClipboardService.class); - getEditorSite().getActionBars().setGlobalActionHandler( - ActionFactory.COPY.getId(), new CopyAction(clipboard)); - } - - if ((features & PASTE) == PASTE) { - IClipboardService clipboard = context.get(IClipboardService.class); - getEditorSite().getActionBars().setGlobalActionHandler( - ActionFactory.PASTE.getId(), new PasteAction(clipboard)); - } - - if ((features & CUT) == CUT) { - IClipboardService clipboard = context.get(IClipboardService.class); - getEditorSite().getActionBars().setGlobalActionHandler( - ActionFactory.CUT.getId(), new CutAction(clipboard)); - } - } - - @Override - public void setDirtyState(boolean dirtyState) { - if (dirtyState != this.dirtyState) { - this.dirtyState = dirtyState; - firePropertyChange(PROP_DIRTY); - } - } - - @Override - public boolean isDirty() { - return dirtyState; - } - - @Override - public void setFocus() { - ContextInjectionFactory.invoke(component, Focus.class, context); - } - - @Override - public void dispose() { - PartHelper.disposeContextIfE3((IEclipseContext) getSite().getService( - IEclipseContext.class), context); - super.dispose(); - } - - -} diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIHandler.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIHandler.java deleted file mode 100644 index ede67b2d..00000000 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIHandler.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 EclipseSource München GmbH and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Jonas Helming <jhelming@eclipsesource.com> - initial API and implementation - * Lars Vogel <Lars.Vogel@gmail.com> - Bug 421453 - ******************************************************************************/ -package org.eclipse.e4.tools.compat.parts; - -import org.eclipse.core.commands.AbstractHandler; -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.e4.core.contexts.ContextInjectionFactory; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.core.di.annotations.Execute; -import org.eclipse.ui.PlatformUI; - -/** - * This is a preliminary implementation of a Handler wrapper. It does not support @CanExecute yet - * - * @author Jonas - * - * @param <C> - */ -public class DIHandler<C> extends AbstractHandler { - - private final C component; - - public DIHandler(Class<C> clazz) { - final IEclipseContext context = getActiveContext(); - component = ContextInjectionFactory.make(clazz, context); - } - - private static IEclipseContext getActiveContext() { - final IEclipseContext parentContext = getParentContext(); - return parentContext.getActiveLeaf(); - } - - private static IEclipseContext getParentContext() { - return (IEclipseContext) PlatformUI.getWorkbench().getService( - IEclipseContext.class); - } - - @Override - public Object execute(ExecutionEvent event) throws ExecutionException { - return ContextInjectionFactory.invoke(component, Execute.class, - getActiveContext()); - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIMultiPageEditorPart.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIMultiPageEditorPart.java deleted file mode 100644 index 494b9dda..00000000 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIMultiPageEditorPart.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 EclipseSource and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Jonas Helming <jhelming@eclipsesource.com> - ******************************************************************************/ - -package org.eclipse.e4.tools.compat.parts; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.e4.tools.services.IDirtyProviderService; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.part.MultiPageEditorPart; - -public abstract class DIMultiPageEditorPart extends MultiPageEditorPart - implements IDirtyProviderService { - - public <T> int addPage(Class<T> clazz) throws PartInitException { - DIEditorPart<T> part = new DIEditorPart<T>(clazz) {}; - return addPage(part, getEditorInput()); - - } - - public DIMultiPageEditorPart() { - } - - @Override - public void doSave(IProgressMonitor monitor) { - for (int i = 0; i < getPageCount(); i++) { - IEditorPart e = getEditor(i); - e.doSave(monitor); - } - } - -} diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DISaveableViewPart.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DISaveableViewPart.java deleted file mode 100644 index ded22cb6..00000000 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DISaveableViewPart.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2014 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Lars Vogel <Lars.Vogel@gmail.com> - Bug 421453 - ******************************************************************************/ -package org.eclipse.e4.tools.compat.parts; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.e4.core.contexts.ContextInjectionFactory; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.tools.services.IDirtyProviderService; -import org.eclipse.e4.ui.di.Persist; -import org.eclipse.ui.ISaveablePart2; -import org.eclipse.ui.IViewSite; -import org.eclipse.ui.PartInitException; - -public abstract class DISaveableViewPart<C> extends DIViewPart<C> implements ISaveablePart2, IDirtyProviderService { - private boolean dirtyState; - - public DISaveableViewPart(Class<C> clazz) { - super(clazz); - } - - @Override - public void doSave(IProgressMonitor monitor) { - IEclipseContext saveContext = getContext().createChild(); - ContextInjectionFactory.invoke(getComponent(), Persist.class, saveContext); - saveContext.dispose(); - } - - @Override - public void doSaveAs() { - - } - - @Override - public boolean isSaveAsAllowed() { - return false; - } - - @Override - public void setDirtyState(boolean dirtyState) { - if( dirtyState != this.dirtyState ) { - this.dirtyState = dirtyState; - firePropertyChange(PROP_DIRTY); - } - } - - @Override - public boolean isDirty() { - return dirtyState; - } - - @Override - public void init(IViewSite site) throws PartInitException { - super.init(site); - - getContext().declareModifiable(IDirtyProviderService.class); - getContext().set(IDirtyProviderService.class, this); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIViewPart.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIViewPart.java deleted file mode 100644 index edabb810..00000000 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIViewPart.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.compat.parts; - -import org.eclipse.e4.core.contexts.ContextInjectionFactory; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.tools.compat.internal.PartHelper; -import org.eclipse.e4.ui.di.Focus; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.IViewPart; -import org.eclipse.ui.IViewSite; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.part.ViewPart; - -public abstract class DIViewPart<C> extends ViewPart { - private IEclipseContext context; - private Class<C> clazz; - private C component; - - public DIViewPart(Class<C> clazz) { - this.clazz = clazz; - } - - @Override - public void init(IViewSite site) throws PartInitException { - super.init(site); - context = PartHelper.createPartContext(this); - - context.declareModifiable(IViewPart.class); - - context.set(IViewPart.class, this); - } - - @Override - public void createPartControl(Composite parent) { - component = PartHelper.createComponent(parent, context, clazz, this); - } - - protected IEclipseContext getContext() { - return context; - } - - public C getComponent() { - return component; - } - - @Override - public void setFocus() { - ContextInjectionFactory.invoke(component, Focus.class, context); - } - - @Override - public void dispose() { - PartHelper.disposeContextIfE3((IEclipseContext) getSite().getService( - IEclipseContext.class), context); - super.dispose(); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/.classpath b/bundles/org.eclipse.e4.tools.emf.editor3x/.classpath deleted file mode 100644 index ad32c83a..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/.classpath +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="src" path="src"/> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/.project b/bundles/org.eclipse.e4.tools.emf.editor3x/.project deleted file mode 100644 index 6682b79a..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/.project +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.e4.tools.emf.editor3x</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ManifestBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.SchemaBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ds.core.builder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.pde.PluginNature</nature> - <nature>org.eclipse.jdt.core.javanature</nature> - </natures> -</projectDescription> diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/.settings/org.eclipse.core.resources.prefs b/bundles/org.eclipse.e4.tools.emf.editor3x/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index f548abbf..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,6 +0,0 @@ -eclipse.preferences.version=1 - -encoding//model/etypes.ecore=UTF-8 - - -encoding/<project>=UTF-8 diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/.settings/org.eclipse.core.runtime.prefs b/bundles/org.eclipse.e4.tools.emf.editor3x/.settings/org.eclipse.core.runtime.prefs deleted file mode 100644 index 5a0ad22d..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/.settings/org.eclipse.core.runtime.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -line.separator=\n diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.e4.tools.emf.editor3x/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index c9482977..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,418 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.builder.cleanOutputFolder=clean -org.eclipse.jdt.core.builder.duplicateResourceTask=warning -org.eclipse.jdt.core.builder.invalidClasspath=abort -org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore -org.eclipse.jdt.core.builder.resourceCopyExclusionFilter= -org.eclipse.jdt.core.circularClasspath=error -org.eclipse.jdt.core.classpath.exclusionPatterns=enabled -org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled -org.eclipse.jdt.core.classpath.outputOverlappingAnotherSource=error -org.eclipse.jdt.core.codeComplete.argumentPrefixes= -org.eclipse.jdt.core.codeComplete.argumentSuffixes= -org.eclipse.jdt.core.codeComplete.fieldPrefixes= -org.eclipse.jdt.core.codeComplete.fieldSuffixes= -org.eclipse.jdt.core.codeComplete.localPrefixes= -org.eclipse.jdt.core.codeComplete.localSuffixes= -org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= -org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= -org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= -org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= -org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled -org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore -org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull -org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault -org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable -org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.doc.comment.support=enabled -org.eclipse.jdt.core.compiler.maxProblemPerUnit=100 -org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.autoboxing=ignore -org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning -org.eclipse.jdt.core.compiler.problem.deadCode=warning -org.eclipse.jdt.core.compiler.problem.deprecation=warning -org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled -org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled -org.eclipse.jdt.core.compiler.problem.discouragedReference=warning -org.eclipse.jdt.core.compiler.problem.emptyStatement=warning -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore -org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning -org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled -org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore -org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning -org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning -org.eclipse.jdt.core.compiler.problem.forbiddenReference=error -org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning -org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled -org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning -org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore -org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning -org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=disabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=public -org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning -org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning -org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled -org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning -org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore -org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled -org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public -org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag -org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled -org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning -org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning -org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning -org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning -org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning -org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error -org.eclipse.jdt.core.compiler.problem.nullReference=warning -org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error -org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning -org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning -org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning -org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore -org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore -org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning -org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning -org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning -org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore -org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning -org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore -org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore -org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled -org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning -org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled -org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled -org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled -org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore -org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning -org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning -org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning -org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore -org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning -org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning -org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled -org.eclipse.jdt.core.compiler.problem.unusedImport=warning -org.eclipse.jdt.core.compiler.problem.unusedLabel=warning -org.eclipse.jdt.core.compiler.problem.unusedLocal=warning -org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled -org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning -org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning -org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.6 -org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled -org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,HIGH,LOW,LOW,LOW,LOW,LOW,NORMAL -org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX,PERF,MEM,POLISH,@generated NOT,@ADDED,APITODO -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_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=true -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=true -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=do not insert -org.eclipse.jdt.core.formatter.comment.line_length=120 -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=1 -org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=1 -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_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_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_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=false -org.eclipse.jdt.core.formatter.join_wrapped_lines=false -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=true -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 -org.eclipse.jdt.core.incompatibleJDKLevel=ignore -org.eclipse.jdt.core.incompleteClasspath=error diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/.settings/org.eclipse.jdt.launching.prefs b/bundles/org.eclipse.e4.tools.emf.editor3x/.settings/org.eclipse.jdt.launching.prefs deleted file mode 100644 index 3bb23527..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/.settings/org.eclipse.jdt.launching.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.launching.PREF_STRICTLY_COMPATIBLE_JRE_NOT_AVAILABLE=ignore diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.e4.tools.emf.editor3x/.settings/org.eclipse.jdt.ui.prefs deleted file mode 100644 index 791508d1..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/.settings/org.eclipse.jdt.ui.prefs +++ /dev/null @@ -1,115 +0,0 @@ -cleanup.add_default_serial_version_id=true -cleanup.add_generated_serial_version_id=false -cleanup.add_missing_annotations=true -cleanup.add_missing_deprecated_annotations=true -cleanup.add_missing_methods=false -cleanup.add_missing_nls_tags=false -cleanup.add_missing_override_annotations=true -cleanup.add_missing_override_annotations_interface_methods=true -cleanup.add_serial_version_id=false -cleanup.always_use_blocks=true -cleanup.always_use_parentheses_in_expressions=false -cleanup.always_use_this_for_non_static_field_access=false -cleanup.always_use_this_for_non_static_method_access=false -cleanup.convert_to_enhanced_for_loop=false -cleanup.correct_indentation=true -cleanup.format_source_code=true -cleanup.format_source_code_changes_only=false -cleanup.make_local_variable_final=true -cleanup.make_parameters_final=false -cleanup.make_private_fields_final=true -cleanup.make_type_abstract_if_missing_method=false -cleanup.make_variable_declarations_final=true -cleanup.never_use_blocks=false -cleanup.never_use_parentheses_in_expressions=true -cleanup.organize_imports=true -cleanup.qualify_static_field_accesses_with_declaring_class=false -cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true -cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -cleanup.qualify_static_member_accesses_with_declaring_class=true -cleanup.qualify_static_method_accesses_with_declaring_class=false -cleanup.remove_private_constructors=true -cleanup.remove_trailing_whitespaces=true -cleanup.remove_trailing_whitespaces_all=true -cleanup.remove_trailing_whitespaces_ignore_empty=false -cleanup.remove_unnecessary_casts=false -cleanup.remove_unnecessary_nls_tags=false -cleanup.remove_unused_imports=true -cleanup.remove_unused_local_variables=false -cleanup.remove_unused_private_fields=true -cleanup.remove_unused_private_members=false -cleanup.remove_unused_private_methods=true -cleanup.remove_unused_private_types=true -cleanup.sort_members=false -cleanup.sort_members_all=false -cleanup.use_blocks=true -cleanup.use_blocks_only_for_return_and_throw=false -cleanup.use_parentheses_in_expressions=true -cleanup.use_this_for_non_static_field_access=true -cleanup.use_this_for_non_static_field_access_only_if_necessary=true -cleanup.use_this_for_non_static_method_access=true -cleanup.use_this_for_non_static_method_access_only_if_necessary=true -cleanup_profile=_esmCleanUp -cleanup_settings_version=2 -eclipse.preferences.version=1 -editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true -formatter_profile=_esmFormatter -formatter_settings_version=12 -org.eclipse.jdt.ui.exception.name=ex -org.eclipse.jdt.ui.gettersetter.use.is=true -org.eclipse.jdt.ui.javadoc=true -org.eclipse.jdt.ui.keywordthis=false -org.eclipse.jdt.ui.overrideannotation=true -org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*******************************************************************************\r\n * Copyright (c) 2011-${year} EclipseSource Muenchen GmbH and others.\r\n * \r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n * \r\n * Contributors\:\r\n * ${user} - initial API and implementation\r\n ******************************************************************************/</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n *\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment"/><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/**\r\n * {@inheritDoc}\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="false" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">\t\t\t// TODO Auto-generated catch block\r\n\t\t\t// Do NOT catch all Exceptions ("catch (Exception e)")\r\n\t\t\t// Log AND handle Exceptions if possible \r\n //\r\n // You can just uncomment one of the lines below to log an exception\:\r\n\t\t\t// logException will show the logged excpetion to the user\r\n\t\t\t// ModelUtil.logException(${exception_var});\r\n\t\t\t// ModelUtil.logException("YOUR MESSAGE HERE", ${exception_var});\r\n\t\t\t// logWarning will only add the message to the error log\r\n\t\t\t// ModelUtil.logWarning("YOUR MESSAGE HERE", ${exception_var});\r\n\t\t\t// ModelUtil.logWarning("YOUR MESSAGE HERE");\r\n\t\t\t//\t\t\t\r\n\t\t\t// If handling is not possible declare and rethrow Exception</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates> -sp_cleanup.add_default_serial_version_id=true -sp_cleanup.add_generated_serial_version_id=false -sp_cleanup.add_missing_annotations=true -sp_cleanup.add_missing_deprecated_annotations=true -sp_cleanup.add_missing_methods=false -sp_cleanup.add_missing_nls_tags=false -sp_cleanup.add_missing_override_annotations=true -sp_cleanup.add_missing_override_annotations_interface_methods=true -sp_cleanup.add_serial_version_id=false -sp_cleanup.always_use_blocks=true -sp_cleanup.always_use_parentheses_in_expressions=false -sp_cleanup.always_use_this_for_non_static_field_access=false -sp_cleanup.always_use_this_for_non_static_method_access=false -sp_cleanup.convert_to_enhanced_for_loop=false -sp_cleanup.correct_indentation=true -sp_cleanup.format_source_code=true -sp_cleanup.format_source_code_changes_only=false -sp_cleanup.make_local_variable_final=true -sp_cleanup.make_parameters_final=false -sp_cleanup.make_private_fields_final=true -sp_cleanup.make_type_abstract_if_missing_method=false -sp_cleanup.make_variable_declarations_final=true -sp_cleanup.never_use_blocks=false -sp_cleanup.never_use_parentheses_in_expressions=true -sp_cleanup.on_save_use_additional_actions=true -sp_cleanup.organize_imports=true -sp_cleanup.qualify_static_field_accesses_with_declaring_class=false -sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_with_declaring_class=true -sp_cleanup.qualify_static_method_accesses_with_declaring_class=false -sp_cleanup.remove_private_constructors=true -sp_cleanup.remove_trailing_whitespaces=true -sp_cleanup.remove_trailing_whitespaces_all=true -sp_cleanup.remove_trailing_whitespaces_ignore_empty=false -sp_cleanup.remove_unnecessary_casts=false -sp_cleanup.remove_unnecessary_nls_tags=true -sp_cleanup.remove_unused_imports=true -sp_cleanup.remove_unused_local_variables=false -sp_cleanup.remove_unused_private_fields=true -sp_cleanup.remove_unused_private_members=false -sp_cleanup.remove_unused_private_methods=true -sp_cleanup.remove_unused_private_types=true -sp_cleanup.sort_members=false -sp_cleanup.sort_members_all=false -sp_cleanup.use_blocks=true -sp_cleanup.use_blocks_only_for_return_and_throw=false -sp_cleanup.use_parentheses_in_expressions=true -sp_cleanup.use_this_for_non_static_field_access=true -sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true -sp_cleanup.use_this_for_non_static_method_access=true -sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/.settings/org.eclipse.pde.api.tools.prefs b/bundles/org.eclipse.e4.tools.emf.editor3x/.settings/org.eclipse.pde.api.tools.prefs deleted file mode 100644 index e4e3c007..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/.settings/org.eclipse.pde.api.tools.prefs +++ /dev/null @@ -1,97 +0,0 @@ -ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Error -ANNOTATION_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error -ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Error -ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD=Error -ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error -API_COMPONENT_ELEMENT_TYPE_REMOVED_API_TYPE=Error -API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_API_TYPE=Error -API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_TYPE=Error -API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Error -API_USE_SCAN_FIELD_SEVERITY=Error -API_USE_SCAN_METHOD_SEVERITY=Error -API_USE_SCAN_TYPE_SEVERITY=Error -CLASS_ELEMENT_TYPE_ADDED_METHOD=Error -CLASS_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error -CLASS_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error -CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error -CLASS_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error -CLASS_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error -CLASS_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error -CLASS_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error -CLASS_ELEMENT_TYPE_REMOVED_CONSTRUCTOR=Error -CLASS_ELEMENT_TYPE_REMOVED_FIELD=Error -CLASS_ELEMENT_TYPE_REMOVED_METHOD=Error -CLASS_ELEMENT_TYPE_REMOVED_SUPERCLASS=Error -CLASS_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error -CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error -CONSTRUCTOR_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error -CONSTRUCTOR_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error -CONSTRUCTOR_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error -CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error -ENUM_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error -ENUM_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error -ENUM_ELEMENT_TYPE_REMOVED_ENUM_CONSTANT=Error -ENUM_ELEMENT_TYPE_REMOVED_FIELD=Error -ENUM_ELEMENT_TYPE_REMOVED_METHOD=Error -ENUM_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error -FIELD_ELEMENT_TYPE_ADDED_VALUE=Error -FIELD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error -FIELD_ELEMENT_TYPE_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT=Error -FIELD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error -FIELD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error -FIELD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error -FIELD_ELEMENT_TYPE_CHANGED_TYPE=Error -FIELD_ELEMENT_TYPE_CHANGED_VALUE=Error -FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENT=Error -FIELD_ELEMENT_TYPE_REMOVED_VALUE=Error -ILLEGAL_EXTEND=Warning -ILLEGAL_IMPLEMENT=Warning -ILLEGAL_INSTANTIATE=Warning -ILLEGAL_OVERRIDE=Warning -ILLEGAL_REFERENCE=Warning -INTERFACE_ELEMENT_TYPE_ADDED_FIELD=Error -INTERFACE_ELEMENT_TYPE_ADDED_METHOD=Error -INTERFACE_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error -INTERFACE_ELEMENT_TYPE_ADDED_SUPER_INTERFACE_WITH_METHODS=Error -INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error -INTERFACE_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error -INTERFACE_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error -INTERFACE_ELEMENT_TYPE_REMOVED_FIELD=Error -INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Error -INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error -INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error -INVALID_JAVADOC_TAG=Warning -INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Error -LEAK_EXTEND=Warning -LEAK_FIELD_DECL=Warning -LEAK_IMPLEMENT=Warning -LEAK_METHOD_PARAM=Warning -LEAK_METHOD_RETURN_TYPE=Warning -METHOD_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error -METHOD_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error -METHOD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error -METHOD_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error -METHOD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error -METHOD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error -METHOD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error -METHOD_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error -METHOD_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Error -METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error -MISSING_EE_DESCRIPTIONS=Error -TYPE_PARAMETER_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error -TYPE_PARAMETER_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error -TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error -TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error -TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error -TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error -UNUSED_PROBLEM_FILTERS=Ignore -automatically_removed_unused_problem_filters=Disabled -eclipse.preferences.version=1 -incompatible_api_component_version=Error -incompatible_api_component_version_include_major_without_breaking_change=Disabled -incompatible_api_component_version_include_minor_without_api_change=Disabled -invalid_since_tag_version=Error -malformed_since_tag=Error -missing_since_tag=Error -report_api_breakage_when_major_version_incremented=Disabled -report_resolution_errors_api_component=Warning diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/.settings/org.eclipse.pde.prefs b/bundles/org.eclipse.e4.tools.emf.editor3x/.settings/org.eclipse.pde.prefs deleted file mode 100644 index 0bbee3c4..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/.settings/org.eclipse.pde.prefs +++ /dev/null @@ -1,32 +0,0 @@ -compilers.f.unresolved-features=1 -compilers.f.unresolved-plugins=1 -compilers.incompatible-environment=1 -compilers.p.build=1 -compilers.p.build.bin.includes=1 -compilers.p.build.encodings=2 -compilers.p.build.java.compiler=2 -compilers.p.build.java.compliance=1 -compilers.p.build.missing.output=2 -compilers.p.build.output.library=1 -compilers.p.build.source.library=1 -compilers.p.build.src.includes=1 -compilers.p.deprecated=1 -compilers.p.discouraged-class=1 -compilers.p.internal=1 -compilers.p.missing-packages=1 -compilers.p.missing-version-export-package=1 -compilers.p.missing-version-import-package=1 -compilers.p.missing-version-require-bundle=1 -compilers.p.no-required-att=0 -compilers.p.not-externalized-att=2 -compilers.p.unknown-attribute=1 -compilers.p.unknown-class=1 -compilers.p.unknown-element=1 -compilers.p.unknown-identifier=1 -compilers.p.unknown-resource=1 -compilers.p.unresolved-ex-points=0 -compilers.p.unresolved-import=0 -compilers.s.create-docs=false -compilers.s.doc-folder=doc -compilers.s.open-tags=1 -eclipse.preferences.version=1 diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF deleted file mode 100644 index 761277f8..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF +++ /dev/null @@ -1,40 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %Bundle-Name -Bundle-SymbolicName: org.eclipse.e4.tools.emf.editor3x;singleton:=true -Bundle-Version: 0.12.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 -Require-Bundle: org.eclipse.ui;bundle-version="3.6.0", - org.eclipse.core.runtime;bundle-version="3.6.0", - org.eclipse.emf.common;bundle-version="2.6.0", - org.eclipse.core.databinding.observable;bundle-version="1.3.0", - org.eclipse.e4.tools.emf.ui;bundle-version="0.9.0", - org.eclipse.e4.ui.workbench;bundle-version="0.9.1", - org.eclipse.e4.ui.css.core;bundle-version="0.9.0", - org.eclipse.e4.ui.css.swt;bundle-version="0.9.1", - org.w3c.css.sac;bundle-version="1.3.0", - org.eclipse.pde.core;bundle-version="3.6.0", - org.eclipse.core.resources;bundle-version="3.6.0", - org.eclipse.jdt.core;bundle-version="3.6.0", - org.eclipse.ui.ide;bundle-version="3.6.0", - org.eclipse.e4.ui.css.swt.theme;bundle-version="0.9.0", - org.eclipse.e4.core.contexts;bundle-version="0.9.0", - org.eclipse.e4.core.di;bundle-version="0.9.0", - org.eclipse.e4.core.services;bundle-version="0.9.1", - org.eclipse.emf.edit;bundle-version="2.6.0", - org.eclipse.e4.ui.services;bundle-version="0.9.1", - org.eclipse.e4.tools.compat;bundle-version="0.11.0", - org.eclipse.e4.tools.services;bundle-version="0.11.0", - org.eclipse.e4.tools;bundle-version="0.9.0", - org.eclipse.jdt.ui;bundle-version="3.6.0", - org.eclipse.ltk.core.refactoring;bundle-version="3.5.200", - org.eclipse.search;bundle-version="3.7.0", - org.eclipse.text;bundle-version="3.5.100", - org.eclipse.e4.ui.model.workbench;bundle-version="1.0.0", - org.eclipse.pde.ui;bundle-version="3.8.0" -Service-Component: OSGI-INF/pdecontributionprovider.xml, OSGI-INF/xmiresourcecontextfunction.xml, OSGI-INF/projectfunction.xml, OSGI-INF/pdee4xmiprovider.xml, OSGI-INF/pdeextensionlookup.xml, OSGI-INF/modelextractor.xml -Bundle-ActivationPolicy: lazy -Bundle-Vendor: %Bundle-Vendor -Export-Package: org.eclipse.e4.tools.emf.editor3x;version="0.12.0.qualifier";x-internal:=true, - org.eclipse.e4.tools.emf.editor3x.emf;version="0.12.0.qualifier";x-internal:=true, - org.eclipse.e4.tools.emf.editor3x.extension;version="0.12.0.qualifier";x-internal:=true diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/l10n/bundle.properties b/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/l10n/bundle.properties deleted file mode 100644 index 482fea1f..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/l10n/bundle.properties +++ /dev/null @@ -1,5 +0,0 @@ -#Properties file for org.eclipse.e4.tools.emf.editor3x -editor.name = Eclipse 4 model editor -page.name = Model Editor -Bundle-Name = Editor3x -Bundle-Vendor = Eclipse.org
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/modelextractor.xml b/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/modelextractor.xml deleted file mode 100644 index c2dbd85c..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/modelextractor.xml +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.e4.tools.emf.editor3x.modelextractor"> - <implementation class="org.eclipse.e4.tools.emf.editor3x.ModelExtractor"/> - <service> - <provide interface="org.eclipse.e4.tools.emf.ui.common.IModelExtractor"/> - </service> -</scr:component> diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/pdecontributionprovider.xml b/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/pdecontributionprovider.xml deleted file mode 100644 index ce78958e..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/pdecontributionprovider.xml +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.e4.tools.emf.editor3x.pdecontrib"> - <implementation class="org.eclipse.e4.tools.emf.editor3x.PDEClassContributionProvider"/> - <service> - <provide interface="org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider"/> - </service> -</scr:component> diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/pdee4xmiprovider.xml b/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/pdee4xmiprovider.xml deleted file mode 100644 index f1e7b737..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/pdee4xmiprovider.xml +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="false" name="org.eclipse.e4.tools.emf.editor3x.pdee4xmiprovider"> - <implementation class="org.eclipse.e4.tools.emf.editor3x.TargetElementProviders"/> - <service> - <provide interface="org.eclipse.e4.tools.emf.ui.common.IModelElementProvider"/> - </service> -</scr:component> diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/pdeextensionlookup.xml b/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/pdeextensionlookup.xml deleted file mode 100644 index cad2595f..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/pdeextensionlookup.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.e4.tools.emf.editor3x"> - <implementation class="org.eclipse.e4.tools.emf.editor3x.PDEExtensionLookup"/> - <service> - <provide interface="org.eclipse.e4.tools.emf.ui.common.IExtensionLookup"/> - </service> - <property name="service.ranking" type="Integer" value="1000"/> -</scr:component> diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/projectfunction.xml b/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/projectfunction.xml deleted file mode 100644 index ed7571e8..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/projectfunction.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.e4.tools.emf.editor3x.projectfunction"> - <implementation class="org.eclipse.e4.tools.emf.editor3x.EditorProjectFunction"/> - <service> - <provide interface="org.eclipse.e4.core.contexts.IContextFunction"/> - </service> - <property name="service.context.key" type="String" value="org.eclipse.e4.tools.emf.ui.editorproject"/> -</scr:component>
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/xmiresourcecontextfunction.xml b/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/xmiresourcecontextfunction.xml deleted file mode 100644 index 07c42709..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/xmiresourcecontextfunction.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.e4.tools.emf.editor3x.contextfunction"> - <implementation class="org.eclipse.e4.tools.emf.editor3x.XMIResourceFunction"/> - <service> - <provide interface="org.eclipse.e4.core.contexts.IContextFunction"/> - </service> - <property name="service.context.key" type="String" value="org.eclipse.e4.tools.emf.ui.common.IModelResource"/> -</scr:component>
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/about.html b/bundles/org.eclipse.e4.tools.emf.editor3x/about.html deleted file mode 100644 index c1343aa3..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/about.html +++ /dev/null @@ -1,45 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> -<title>About</title> -</head> -<body lang="EN-US"> -<h2>About This Content</h2> - -<p>December 3, 2009</p> -<h3>License</h3> - -<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise -indicated below, the Content is provided to you under the terms and conditions of the -Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available -at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. -For purposes of the EPL, "Program" will mean the Content.</p> - -<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is -being redistributed by another party ("Redistributor") and different terms and conditions may -apply to your use of any object code in the Content. Check the Redistributor's license that was -provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise -indicated below, the terms and conditions of the EPL still apply to any source code in the Content -and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p> - -<h3>Third Party Content</h3> - -<p>The Content includes items from third parties as set out below. If you did not -receive this Content directly from the Eclipse Foundation, the following is provided for informational -purposes only, and you should look to the Redistributor’s license for terms and conditions of use.</p> - -<h4>Silk icon set Version 1.3</h4> -<p> -This plugin contains icons from the Silk icon set created by Mark James. The original files can -be found at: -<ul> -<a href="http://www.famfamfam.com/lab/icons/silk/">http://www.famfamfam.com/lab/icons/silk/</a></ul> -<p>The license can be found at:</p> -<ul> - <li><a href="http://creativecommons.org/licenses/by/2.5/">http://creativecommons.org/licenses/by/2.5/</a></li> -</ul> - -</body> -</html>
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties b/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties deleted file mode 100644 index 9fb99e10..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties +++ /dev/null @@ -1,8 +0,0 @@ -output.. = bin/ -source.. = src/ -bin.includes = META-INF/,\ - .,\ - plugin.xml,\ - icons/,\ - about.html,\ - OSGI-INF/ diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/forceQualifierUpdate.txt b/bundles/org.eclipse.e4.tools.emf.editor3x/forceQualifierUpdate.txt deleted file mode 100644 index 396f0875..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/forceQualifierUpdate.txt +++ /dev/null @@ -1,2 +0,0 @@ -# To force a version qualifier update add the bug here -Bug 403237 - o.e.e4.tools cannot be build with "mvn clean install" diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/icons/full/obj16/application_view_tile.png b/bundles/org.eclipse.e4.tools.emf.editor3x/icons/full/obj16/application_view_tile.png Binary files differdeleted file mode 100644 index 3bc0bd32..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/icons/full/obj16/application_view_tile.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml b/bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml deleted file mode 100644 index d4c03455..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml +++ /dev/null @@ -1,107 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.4"?> -<plugin> - <extension - point="org.eclipse.ui.editors"> - <editor - class="org.eclipse.e4.tools.emf.editor3x.E4WorkbenchModelEditor" - default="true" - extensions="e4xmi" - icon="icons/full/obj16/application_view_tile.png" - id="org.eclipse.e4.tools.emf.editor3x.e4wbm" - name="%editor.name"> - </editor> - </extension> - <extension - point="org.eclipse.e4.tools.emf.ui.editors"> - <contributionClassCreator - class="org.eclipse.e4.tools.emf.editor3x.extension.HandlerContributionEditor"> - </contributionClassCreator> - <contributionClassCreator - class="org.eclipse.e4.tools.emf.editor3x.extension.PartContributionEditor"> - </contributionClassCreator> - <contributionClassCreator - class="org.eclipse.e4.tools.emf.editor3x.extension.AddonContributionEditor"> - </contributionClassCreator> - <contributionClassCreator - class="org.eclipse.e4.tools.emf.editor3x.extension.DynamicMenuContributionContributionEditor"> - </contributionClassCreator> - <contributionClassCreator - class="org.eclipse.e4.tools.emf.editor3x.extension.ToolControlContributionEditor"> - </contributionClassCreator> - </extension> - <extension - point="org.eclipse.ui.preferencePages"> - <page - class="org.eclipse.e4.tools.emf.editor3x.ModelEditorPreferencePage" - id="org.eclipse.e4.tools.emf.editor3x.modeleditor" - name="%page.name"> - </page> - </extension> - <extension - point="org.eclipse.ltk.core.refactoring.renameParticipants"> - <renameParticipant - class="org.eclipse.e4.tools.emf.editor3x.ModelRenameParticipant" - id="org.eclipse.e4.tools.emf.editor3x.renameParticipant" - name="Workbench Model Contribution Participant"> - <enablement> - <with variable="affectedNatures"> - <iterate operator="or"> - <equals value="org.eclipse.pde.PluginNature"/> - </iterate> - </with> - <with variable="element"> - <or> - <instanceof - value="org.eclipse.jdt.core.IType"> - </instanceof> - <instanceof - value="org.eclipse.jdt.core.IPackageFragment"> - </instanceof> - <instanceof - value="org.eclipse.core.resources.IFile"> - </instanceof> - <instanceof - value="org.eclipse.core.resources.IFolder"> - </instanceof> - <instanceof - value="org.eclipse.core.resources.IProject"> - </instanceof> - </or> - </with> - </enablement> - </renameParticipant> - </extension> - <extension - point="org.eclipse.ltk.core.refactoring.moveParticipants"> - <moveParticipant - class="org.eclipse.e4.tools.emf.editor3x.ModelMoveParticipant" - id="org.eclipse.e4.tools.emf.editor3x.moveParticipant" - name="Workbench Model Contribution Participant"> - <enablement> - <with variable="affectedNatures"> - <iterate operator="or"> - <equals value="org.eclipse.pde.PluginNature"/> - </iterate> - </with> - <with variable="element"> - <or> - <instanceof - value="org.eclipse.jdt.core.IType"> - </instanceof> - <instanceof - value="org.eclipse.jdt.core.IPackageFragment"> - </instanceof> - <instanceof - value="org.eclipse.core.resources.IFile"> - </instanceof> - <instanceof - value="org.eclipse.core.resources.IFolder"> - </instanceof> - </or> - </with> - </enablement> - </moveParticipant> - </extension> - -</plugin> diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/pom.xml b/bundles/org.eclipse.e4.tools.emf.editor3x/pom.xml deleted file mode 100644 index 211129c0..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/pom.xml +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.eclipse.e4.tools</groupId> - <artifactId>e4-tools-aggregator</artifactId> - <version>0.17.0-SNAPSHOT</version> - <relativePath>../../</relativePath> - </parent> - - <groupId>org.eclipse.e4</groupId> - <artifactId>org.eclipse.e4.tools.emf.editor3x</artifactId> - <version>0.12.0.qualifier</version> - <packaging>eclipse-plugin</packaging> - -</project> diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java deleted file mode 100644 index 781dd7ed..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java +++ /dev/null @@ -1,80 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.editor3x; - -import org.eclipse.e4.tools.compat.parts.DIEditorPart; -import org.eclipse.e4.tools.emf.ui.common.IModelResource.ModelListener; -import org.eclipse.e4.tools.emf.ui.internal.wbm.ApplicationModelEditor; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.IWorkbenchCommandConstants; -import org.eclipse.ui.actions.ActionFactory; - -@SuppressWarnings("restriction") -public class E4WorkbenchModelEditor extends - DIEditorPart<ApplicationModelEditor> { - private UndoAction undoAction; - private RedoAction redoAction; - - private final ModelListener listener = new ModelListener() { - - @Override - public void dirtyChanged() { - firePropertyChange(PROP_DIRTY); - } - - @Override - public void commandStackChanged() { - - } - }; - - public E4WorkbenchModelEditor() { - super(ApplicationModelEditor.class, COPY | CUT | PASTE); - } - - @Override - public void createPartControl(Composite parent) { - super.createPartControl(parent); - setPartName(getEditorInput().getName()); - } - - @Override - protected void makeActions() { - super.makeActions(); - undoAction = new UndoAction(getComponent().getModelProvider()); - undoAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_UNDO); - - redoAction = new RedoAction(getComponent().getModelProvider()); - redoAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_REDO); - - getEditorSite().getActionBars().setGlobalActionHandler( - ActionFactory.UNDO.getId(), undoAction); - getEditorSite().getActionBars().setGlobalActionHandler( - ActionFactory.REDO.getId(), redoAction); - } - - @Override - public void dispose() { - if (undoAction != null) { - undoAction.dispose(); - } - - if (redoAction != null) { - redoAction.dispose(); - } - - if (listener != null && getComponent() != null && getComponent().getModelProvider() != null) { - getComponent().getModelProvider().removeModelListener(listener); - } - - super.dispose(); - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/EditorProjectFunction.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/EditorProjectFunction.java deleted file mode 100644 index 70c0970a..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/EditorProjectFunction.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.eclipse.e4.tools.emf.editor3x; - -import org.eclipse.e4.core.contexts.ContextFunction; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IFileEditorInput; - -public class EditorProjectFunction extends ContextFunction { - - @Override - public Object compute(IEclipseContext context, String contextKex) { - final IEditorInput input = context.get(IEditorInput.class); - if (input != null && input instanceof IFileEditorInput) { - return ((IFileEditorInput) input).getFile().getProject(); - } - return null; - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/Messages.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/Messages.java deleted file mode 100644 index 3e967532..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/Messages.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011-2014 EclipseSource Muenchen GmbH and others. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Jonas - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.editor3x; - -import org.eclipse.osgi.util.NLS; - -/** - * @author Jonas - * - */ -public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.e4.tools.emf.editor3x.messages"; //$NON-NLS-1$ - public static String ContributionEditor_CurrentURLIsInvalid; - public static String ContributionEditor_FailedToOpenEditor; - public static String ContributionEditor_InvalidURL; - public static String ModelEditorPreferencePage_Color; - public static String ModelEditorPreferencePage_ForcesReadOnlyXMITab; - public static String ModelEditorPreferencePage_FormTab; - public static String ModelEditorPreferencePage_GeneratedID; - public static String ModelEditorPreferencePage_ListTabe; - public static String ModelEditorPreferencePage_NotRenderedColor; - public static String ModelEditorPreferencePage_NotVisibleAndNotRenderedColor; - public static String ModelEditorPreferencePage_NotVisibleColor; - public static String ModelEditorPreferencePage_RememberColumnSettings; - public static String ModelEditorPreferencePage_RememberFilterSettings; - public static String ModelEditorPreferencePage_RequiresReopeningModel; - public static String ModelEditorPreferencePage_SearchableTree; - public static String ModelEditorPreferencePage_ShowID; - public static String ModelMoveParticipant_CreatingChange; - public static String RedoAction_Redo; - public static String UndoAction_Undo; - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - private Messages() { - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ModelEditorPreferencePage.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ModelEditorPreferencePage.java deleted file mode 100644 index 4512b79e..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ModelEditorPreferencePage.java +++ /dev/null @@ -1,184 +0,0 @@ -/******************************************************************************* - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - Bug 431735, Bug 437890, Bug 440469 - ******************************************************************************/ - -package org.eclipse.e4.tools.emf.editor3x; - -import org.eclipse.core.runtime.preferences.InstanceScope; -import org.eclipse.e4.tools.emf.ui.common.ModelEditorPreferences; -import org.eclipse.e4.tools.emf.ui.common.Plugin; -import org.eclipse.jface.preference.BooleanFieldEditor; -import org.eclipse.jface.preference.ColorFieldEditor; -import org.eclipse.jface.preference.PreferencePage; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Group; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPreferencePage; -import org.eclipse.ui.preferences.ScopedPreferenceStore; - -public class ModelEditorPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { - private BooleanFieldEditor fAutoGeneratedId; - private BooleanFieldEditor fShowXMIId; - private ColorFieldEditor fColorValueNotRendered; - private ColorFieldEditor fColorValueNotVisible; - private ColorFieldEditor fColorValueNotVisibleAndRendered; - private BooleanFieldEditor fShowSearch; - private BooleanFieldEditor fRememberColumns; - private BooleanFieldEditor fRememberFilters; - - public ModelEditorPreferencePage() { - } - - public ModelEditorPreferencePage(String title) { - super(title); - } - - public ModelEditorPreferencePage(String title, ImageDescriptor image) { - super(title, image); - } - - @Override - public void init(IWorkbench workbench) { - setPreferenceStore(new ScopedPreferenceStore(InstanceScope.INSTANCE, Plugin.ID)); - } - - @Override - protected Control createContents(Composite parent) { - final Composite result = new Composite(parent, SWT.NONE); - result.setLayout(new GridLayout()); - - { - final Group group = new Group(result, SWT.NONE); - group.setText(Messages.ModelEditorPreferencePage_Color); - group.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false, 2, 1)); - group.setLayout(new GridLayout(2, false)); - - { - fColorValueNotRendered = new ColorFieldEditor(ModelEditorPreferences.NOT_RENDERED_COLOR, - Messages.ModelEditorPreferencePage_NotRenderedColor, group); - fColorValueNotRendered.setPage(this); - fColorValueNotRendered.setPreferenceStore(getPreferenceStore()); - fColorValueNotRendered.load(); - } - - { - fColorValueNotVisible = new ColorFieldEditor(ModelEditorPreferences.NOT_VISIBLE_COLOR, - Messages.ModelEditorPreferencePage_NotVisibleColor, group); - fColorValueNotVisible.setPage(this); - fColorValueNotVisible.setPreferenceStore(getPreferenceStore()); - fColorValueNotVisible.load(); - } - - { - fColorValueNotVisibleAndRendered = new ColorFieldEditor( - ModelEditorPreferences.NOT_VISIBLE_AND_RENDERED_COLOR, - Messages.ModelEditorPreferencePage_NotVisibleAndNotRenderedColor, group); - fColorValueNotVisibleAndRendered.setPage(this); - fColorValueNotVisibleAndRendered.setPreferenceStore(getPreferenceStore()); - fColorValueNotVisibleAndRendered.load(); - } - } - - { - final Group group = new Group(result, SWT.NONE); - group.setText(Messages.ModelEditorPreferencePage_FormTab); - group.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false, 2, 1)); - group.setLayout(new GridLayout(2, false)); - - { - final Composite container = new Composite(group, SWT.NONE); - container.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false, 2, 1)); - fAutoGeneratedId = new BooleanFieldEditor(ModelEditorPreferences.AUTO_CREATE_ELEMENT_ID, - Messages.ModelEditorPreferencePage_GeneratedID, container); - fAutoGeneratedId.setPage(this); - fAutoGeneratedId.setPreferenceStore(getPreferenceStore()); - fAutoGeneratedId.load(); - } - - { - final Composite container = new Composite(group, SWT.NONE); - container.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false, 2, 1)); - fShowXMIId = new BooleanFieldEditor(ModelEditorPreferences.SHOW_XMI_ID, Messages.ModelEditorPreferencePage_ShowID, container); - fShowXMIId.setPage(this); - fShowXMIId.setPreferenceStore(getPreferenceStore()); - fShowXMIId.load(); - } - - { - final Composite container = new Composite(group, SWT.NONE); - container.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false, 2, 1)); - fShowSearch = new BooleanFieldEditor(ModelEditorPreferences.TAB_FORM_SEARCH_SHOW, - Messages.ModelEditorPreferencePage_SearchableTree - + Messages.ModelEditorPreferencePage_ForcesReadOnlyXMITab + Messages.ModelEditorPreferencePage_RequiresReopeningModel, container); - fShowSearch.setPage(this); - fShowSearch.setPreferenceStore(getPreferenceStore()); - fShowSearch.load(); - } - - } - - { - final Group group = new Group(result, SWT.NONE); - group.setText(Messages.ModelEditorPreferencePage_ListTabe); - group.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false, 2, 1)); - group.setLayout(new GridLayout(2, false)); - - { - final Composite container = new Composite(group, SWT.NONE); - container.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false, 2, 1)); - - fRememberColumns = new BooleanFieldEditor(ModelEditorPreferences.LIST_TAB_REMEMBER_COLUMNS, - Messages.ModelEditorPreferencePage_RememberColumnSettings, container); - fRememberColumns.setPage(this); - fRememberColumns.setPreferenceStore(getPreferenceStore()); - fRememberColumns.load(); - - fRememberFilters = new BooleanFieldEditor(ModelEditorPreferences.LIST_TAB_REMEMBER_FILTERS, - Messages.ModelEditorPreferencePage_RememberFilterSettings, container); - fRememberFilters.setPage(this); - fRememberFilters.setPreferenceStore(getPreferenceStore()); - fRememberFilters.load(); - } - } - - return result; - } - - @Override - public boolean performOk() { - fAutoGeneratedId.store(); - fShowXMIId.store(); - fColorValueNotRendered.store(); - fColorValueNotVisible.store(); - fColorValueNotVisibleAndRendered.store(); - fShowSearch.store(); - fRememberColumns.store(); - fRememberFilters.store(); - return super.performOk(); - } - - @Override - protected void performDefaults() { - fAutoGeneratedId.loadDefault(); - fShowXMIId.loadDefault(); - fColorValueNotRendered.loadDefault(); - fColorValueNotVisible.loadDefault(); - fColorValueNotVisibleAndRendered.loadDefault(); - fShowSearch.loadDefault(); - fRememberColumns.loadDefault(); - fRememberFilters.loadDefault(); - super.performDefaults(); - } - - @Override - public void dispose() { - super.dispose(); - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ModelExtractor.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ModelExtractor.java deleted file mode 100644 index 2b488922..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ModelExtractor.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.eclipse.e4.tools.emf.editor3x; - -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.internal.tools.wizards.model.ExtractContributionModelWizard; -import org.eclipse.e4.tools.emf.ui.common.IModelExtractor; -import org.eclipse.e4.ui.model.application.MApplicationElement; -import org.eclipse.jface.window.Window; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.swt.widgets.Shell; - -@SuppressWarnings("restriction") -public class ModelExtractor implements IModelExtractor { - - @Override - public boolean extract(Shell shell, IProject project, - List<MApplicationElement> maes) { - final ExtractContributionModelWizard extractContributionModelWizard = new ExtractContributionModelWizard(maes); - extractContributionModelWizard.setup(project); - final WizardDialog wizardDialog = new WizardDialog(shell, extractContributionModelWizard); - return wizardDialog.open() == Window.OK; - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ModelMoveParticipant.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ModelMoveParticipant.java deleted file mode 100644 index 2b7fbc2f..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ModelMoveParticipant.java +++ /dev/null @@ -1,159 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Remain Software, Industrial-TSI and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Wim Jongman <wim.jongman@remainsoftware.com> - Bug 395174: e4xmi should participate in package renaming - * Bug 432892: Eclipse 4 Application does not work after renaming the project name - ******************************************************************************/ -package org.eclipse.e4.tools.emf.editor3x; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.e4.tools.emf.editor3x.extension.Util; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jdt.core.IType; -import org.eclipse.ltk.core.refactoring.Change; -import org.eclipse.ltk.core.refactoring.RefactoringStatus; -import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext; -import org.eclipse.ltk.core.refactoring.participants.MoveParticipant; - -public class ModelMoveParticipant extends MoveParticipant { - private IType fType; - private IPackageFragment fPckage; - private IFile fFile; - private RefactorModel fModel; - - @Override - protected boolean initialize(Object pElement) { - - fModel = RefactorModel.getModel(this); - - if (pElement instanceof IType) { - fType = (IType) pElement; - return true; - } - - if (pElement instanceof IPackageFragment) { - fPckage = (IPackageFragment) pElement; - return true; - } - - if (pElement instanceof IFile) { - fFile = (IFile) pElement; - return true; - } - - return false; - } - - @Override - public String getName() { - return "Workbench Model Contribution Participant"; //$NON-NLS-1$ - } - - @Override - public RefactoringStatus checkConditions(IProgressMonitor pMonitor, - CheckConditionsContext pContext) throws OperationCanceledException { - return new RefactoringStatus(); - } - - @Override - public Change createChange(IProgressMonitor pMonitor) throws CoreException, - OperationCanceledException { - - pMonitor.beginTask(Messages.ModelMoveParticipant_CreatingChange, IProgressMonitor.UNKNOWN); - - Change change = null; - - if (fType != null) { - change = createClassChange(pMonitor, fType); - } - - else if (fPckage != null) { - change = createPackageChange(pMonitor, fPckage); - } - - else if (fFile != null) { - change = createFileChange(pMonitor, fFile); - } - - pMonitor.done(); - - return change; - } - - private Change createFileChange(IProgressMonitor pMonitor, IFile file) - throws CoreException { - - String newUrl = "platform:/plugin/"; //$NON-NLS-1$ - if (getArguments().getDestination() instanceof IFolder) { - final IFolder folder = (IFolder) getArguments().getDestination(); - newUrl += folder.getProject().getName() + "/" //$NON-NLS-1$ - + folder.getProjectRelativePath().toString() + "/" //$NON-NLS-1$ - + file.getName(); - } else { - final IProject project = (IProject) getArguments().getDestination(); - newUrl += project.getName() + "/" + file.getName(); //$NON-NLS-1$ - - } - - final String oldUrl = "platform:/plugin" + file.getFullPath(); //$NON-NLS-1$ - - fModel.addTextRename(oldUrl, newUrl); - - return RefactorParticipantDelegate.createChange(pMonitor, fModel); - } - - private Change createPackageChange(IProgressMonitor pMonitor, - IPackageFragment pPckage) throws CoreException, - OperationCanceledException { - final String fromBundle = Util.getBundleSymbolicName(pPckage.getJavaProject() - .getProject()); - - final IPackageFragmentRoot fragmentRoot = (IPackageFragmentRoot) getArguments() - .getDestination(); - final String toBundle = Util.getBundleSymbolicName(fragmentRoot - .getJavaProject().getProject()); - - final String newUrl = "bundleclass://" + toBundle + "/" //$NON-NLS-1$ //$NON-NLS-2$ - + pPckage.getElementName(); - - final String oldUrl = "bundleclass://" + fromBundle + "/" //$NON-NLS-1$ //$NON-NLS-2$ - + pPckage.getElementName(); - - fModel.addTextRename(oldUrl, newUrl); - - return RefactorParticipantDelegate.createChange(pMonitor, fModel); - } - - private Change createClassChange(IProgressMonitor pMonitor, IType pType) - throws CoreException, OperationCanceledException { - final String fromBundle = Util.getBundleSymbolicName(fType.getJavaProject() - .getProject()); - final String fromClassname = pType.getFullyQualifiedName(); - - final IPackageFragment fragment = (IPackageFragment) getArguments() - .getDestination(); - final String toBundle = Util.getBundleSymbolicName(fragment.getJavaProject() - .getProject()); - final String toClassName = fragment.getElementName().length() == 0 ? pType - .getElementName() : fragment.getElementName() + "." //$NON-NLS-1$ - + pType.getElementName(); - - return RefactorParticipantDelegate.createChange( - pMonitor, - fModel.addTextRename("bundleclass://" + fromBundle + "/" //$NON-NLS-1$ //$NON-NLS-2$ - + fromClassname, "bundleclass://" + toBundle + "/" //$NON-NLS-1$ //$NON-NLS-2$ - + toClassName)); - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ModelRenameParticipant.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ModelRenameParticipant.java deleted file mode 100644 index 6a2952e6..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ModelRenameParticipant.java +++ /dev/null @@ -1,196 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Wim Jongman <wim.jongman@remainsoftware.com> - Bug 395174: e4xmi should participate in package renaming - * Bug 432892: Eclipse 4 Application does not work after renaming the project name - ******************************************************************************/ -package org.eclipse.e4.tools.emf.editor3x; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.e4.tools.emf.editor3x.extension.Util; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.ltk.core.refactoring.Change; -import org.eclipse.ltk.core.refactoring.RefactoringStatus; -import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext; - -public class ModelRenameParticipant extends -org.eclipse.ltk.core.refactoring.participants.RenameParticipant { - private IType fType; - private IPackageFragment fPckage; - private IFile fFile; - private IFolder fFolder; - private IProject fProject; - private RefactorModel fModel; - - @Override - protected boolean initialize(Object element) { - - if (element instanceof IType) { - fType = (IType) element; - return true; - } - - if (element instanceof IPackageFragment) { - fPckage = (IPackageFragment) element; - return true; - } - - if (element instanceof IFile) { - fFile = (IFile) element; - return true; - } - - if (element instanceof IFolder) { - fFolder = (IFolder) element; - return true; - } - - if (element instanceof IProject) { - fProject = (IProject) element; - return true; - } - - return false; - } - - @Override - public String getName() { - return "Workbench Model Contribution Participant"; //$NON-NLS-1$ - } - - @Override - public RefactoringStatus checkConditions(IProgressMonitor pm, - CheckConditionsContext context) throws OperationCanceledException { - return new RefactoringStatus(); - } - - @Override - public Change createChange(IProgressMonitor pm) throws CoreException, - OperationCanceledException { - - fModel = RefactorModel.getModel(this); - - if (fType != null) { - return createClassChange(pm, fType); - } - - if (fPckage != null) { - return createPackageChange(pm, fPckage); - } - - if (fFile != null) { - return createFileChange(pm, fFile); - } - - if (fFolder != null) { - return createFolderChange(pm, fFolder); - } - - if (fProject != null) { - return createProjectChange(pm, fProject); - } - - return null; - } - - private Change createProjectChange(IProgressMonitor pm, IProject project) - throws CoreException { - - if (!getArguments().getUpdateReferences()) { - return null; - } - - fModel.addTextRename("platform:/plugin/" + project.getName() + "/", //$NON-NLS-1$ //$NON-NLS-2$ - "platform:/plugin/" + getArguments().getNewName() + "/"); //$NON-NLS-1$ //$NON-NLS-2$ - fModel.addTextRename("bundleclass://" + project.getName() + "/", //$NON-NLS-1$ //$NON-NLS-2$ - "bundleclass://" + getArguments().getNewName() + "/"); //$NON-NLS-1$ //$NON-NLS-2$ - - fModel.setProjectRename(project, ((IWorkspaceRoot) project.getParent()) - .getProject(getArguments().getNewName())); - - return RefactorParticipantDelegate.createChange(pm, fModel); - - } - - private Change createFolderChange(IProgressMonitor pm, IFolder folder) - throws CoreException { - - String SPLIT = "/"; //$NON-NLS-1$ - if (folder.getParent().getFullPath().segmentCount() == 1) { - SPLIT = ""; //$NON-NLS-1$ - } - - final String newUrl = "platform:/plugin/" + folder.getProject().getName() //$NON-NLS-1$ - + "/" + folder.getParent().getProjectRelativePath().toString() //$NON-NLS-1$ - + SPLIT + getArguments().getNewName(); - - final String oldUrl = "platform:/plugin" + folder.getFullPath(); //$NON-NLS-1$ - - fModel.addTextRename(oldUrl, newUrl); - - return RefactorParticipantDelegate.createChange(pm, fModel); - } - - private Change createFileChange(IProgressMonitor pm, IFile file) - throws CoreException { - - String SPLIT = "/"; //$NON-NLS-1$ - if (file.getParent().getFullPath().segmentCount() == 1) { - SPLIT = ""; //$NON-NLS-1$ - } - final String newUrl = "platform:/plugin/" + file.getProject().getName() + "/" //$NON-NLS-1$ //$NON-NLS-2$ - + file.getParent().getProjectRelativePath().toString() + SPLIT - + getArguments().getNewName(); - final String oldUrl = "platform:/plugin" + file.getFullPath(); //$NON-NLS-1$ - fModel.addTextRename(oldUrl, newUrl); - - return RefactorParticipantDelegate.createChange(pm, fModel); - } - - private Change createPackageChange(IProgressMonitor pm, - IPackageFragment pckage) throws CoreException { - final String bundle = Util.getBundleSymbolicName(pckage.getJavaProject() - .getProject()); - - final String newUrl = "bundleclass://" + bundle + "/" //$NON-NLS-1$ //$NON-NLS-2$ - + getArguments().getNewName(); - - final String oldUrl = "bundleclass://" + bundle + "/" //$NON-NLS-1$ //$NON-NLS-2$ - + pckage.getElementName(); - fModel.addTextRename(oldUrl, newUrl); - - return RefactorParticipantDelegate.createChange(pm, fModel); - } - - private Change createClassChange(IProgressMonitor pm, IType type) - throws CoreException { - final String bundle = Util.getBundleSymbolicName(type.getJavaProject() - .getProject()); - - final String newUrl = "bundleclass://" //$NON-NLS-1$ - + bundle - + "/" //$NON-NLS-1$ - + (type.getPackageFragment().getElementName().length() == 0 ? getArguments() - .getNewName() : type.getPackageFragment() - .getElementName() + "." + getArguments().getNewName()); //$NON-NLS-1$ - final String oldUrl = "bundleclass://" + bundle + "/" //$NON-NLS-1$ //$NON-NLS-2$ - + type.getFullyQualifiedName().replace(".", "\\."); //$NON-NLS-1$//$NON-NLS-2$ - fModel.addTextRename(oldUrl, newUrl); - - return RefactorParticipantDelegate.createChange(pm, fModel); - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java deleted file mode 100644 index 9c42f01d..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java +++ /dev/null @@ -1,188 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Steven Spungin <steven@spungin.tv> - Bug 424730, Bug 436281, Bug 436280 - ******************************************************************************/ -package org.eclipse.e4.tools.emf.editor3x; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider; -import org.eclipse.e4.tools.emf.ui.common.ResourceSearchScope; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.core.search.IJavaSearchConstants; -import org.eclipse.jdt.core.search.IJavaSearchScope; -import org.eclipse.jdt.core.search.SearchEngine; -import org.eclipse.jdt.core.search.SearchPattern; -import org.eclipse.jdt.core.search.TypeNameRequestor; -import org.eclipse.pde.internal.core.util.PDEJavaHelper; - -@SuppressWarnings("restriction") -public class PDEClassContributionProvider implements IClassContributionProvider { - private final SearchEngine searchEngine; - - public PDEClassContributionProvider() { - searchEngine = new SearchEngine(); - } - - @Override - public void findContribution(final Filter filter, final ContributionResultHandler handler) { - boolean followReferences = true; - if (filter.getSearchScope().contains(ResourceSearchScope.PROJECT) - && !filter.getSearchScope().contains(ResourceSearchScope.REFERENCES)) { - followReferences = false; - } - - IJavaSearchScope scope = null; - if (followReferences == false) { - final IJavaProject javaProject = JavaCore.create(filter.project); - IPackageFragmentRoot[] roots; - try { - roots = javaProject.getPackageFragmentRoots(); - scope = SearchEngine.createJavaSearchScope(roots, false); - } catch (final JavaModelException e) { - e.printStackTrace(); - } - } else { - // filter.project may be null in the live editor - scope = filter.project != null ? PDEJavaHelper - .getSearchScope(filter.project) : SearchEngine - .createWorkspaceScope(); - } - char[] packageName = null; - char[] typeName = null; - String currentContent = filter.namePattern; - final int index = currentContent.lastIndexOf('.'); - - if (index == -1) { - // There is no package qualification - // Perform the search only on the type name - typeName = currentContent.toCharArray(); - if (currentContent.startsWith("*")) { //$NON-NLS-1$ - if (!currentContent.endsWith("*")) { //$NON-NLS-1$ - currentContent += "*"; //$NON-NLS-1$ - } - typeName = currentContent.toCharArray(); - packageName = "*".toCharArray(); //$NON-NLS-1$ - } - - } else if (index + 1 == currentContent.length()) { - // There is a package qualification and the last character is a - // dot - // Perform the search for all types under the given package - // Pattern for all types - typeName = "".toCharArray(); //$NON-NLS-1$ - // Package name without the trailing dot - packageName = currentContent.substring(0, index).toCharArray(); - } else { - // There is a package qualification, followed by a dot, and - // a type fragment - // Type name without the package qualification - typeName = currentContent.substring(index + 1).toCharArray(); - // Package name without the trailing dot - packageName = currentContent.substring(0, index).toCharArray(); - } - - // char[] packageName = "at.bestsolution.e4.handlers".toCharArray(); - // char[] typeName = "*".toCharArray(); - - final TypeNameRequestor req = new TypeNameRequestor() { - @Override - public void acceptType(int modifiers, char[] packageName, char[] simpleTypeName, - char[][] enclosingTypeNames, String path) { - // Accept search results from the JDT SearchEngine - final String cName = new String(simpleTypeName); - final String pName = new String(packageName); - // String label = cName + " - " + pName; //$NON-NLS-1$ - final String content = pName.length() == 0 ? cName : pName + "." + cName; //$NON-NLS-1$ - - // System.err.println("Found: " + label + " => " + pName + " => " + path); - - final IResource resource = ResourcesPlugin.getWorkspace().getRoot().findMember(path); - - if (resource != null) { - final IProject project = resource.getProject(); - final IFile f = project.getFile("/META-INF/MANIFEST.MF"); //$NON-NLS-1$ - - if (f != null && f.exists()) { - BufferedReader r = null; - try { - final InputStream s = f.getContents(); - r = new BufferedReader(new InputStreamReader(s)); - String line; - while ((line = r.readLine()) != null) { - if (line.startsWith("Bundle-SymbolicName:")) { //$NON-NLS-1$ - final int start = line.indexOf(':'); - int end = line.indexOf(';'); - if (end == -1) { - end = line.length(); - } - final ContributionData data = new ContributionData(line.substring(start + 1, end) - .trim(), content, "Java", null); //$NON-NLS-1$ - handler.result(data); - break; - } - } - - } catch (final CoreException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (final IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } finally { - if (r != null) { - try { - r.close(); - } catch (final IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - } - } - - // Image image = (Flags.isInterface(modifiers)) ? - // PDEPluginImages.get(PDEPluginImages.OBJ_DESC_GENERATE_INTERFACE) : - // PDEPluginImages.get(PDEPluginImages.OBJ_DESC_GENERATE_CLASS); - // addProposalToCollection(c, startOffset, length, label, content, image); - } - }; - - try { - searchEngine.searchAllTypeNames( - packageName, - SearchPattern.R_PATTERN_MATCH, - typeName, - SearchPattern.R_PATTERN_MATCH | SearchPattern.R_CAMELCASE_MATCH, - IJavaSearchConstants.CLASS, - scope, - req, - IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, null); - } catch (final JavaModelException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - handler.moreResults(0, filter); - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEExtensionLookup.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEExtensionLookup.java deleted file mode 100644 index 0bb1ad18..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEExtensionLookup.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.editor3x; - -import org.eclipse.core.runtime.IExtension; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.RegistryFactory; -import org.eclipse.e4.tools.emf.ui.common.IExtensionLookup; -import org.eclipse.pde.internal.core.PDEExtensionRegistry; - -@SuppressWarnings("restriction") -public class PDEExtensionLookup implements IExtensionLookup { - - @Override - public IExtension[] findExtensions(String extensionPointId, boolean liveModel) { - if (liveModel) { - final IExtensionRegistry registry = RegistryFactory.getRegistry(); - return registry.getExtensionPoint(extensionPointId).getExtensions(); - } - final PDEExtensionRegistry reg = new PDEExtensionRegistry(); - return reg.findExtensions(extensionPointId, true); - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/RedoAction.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/RedoAction.java deleted file mode 100644 index 4a1a5f57..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/RedoAction.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.editor3x; - -import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.jface.action.Action; - -public class RedoAction extends Action { - private final IModelResource resource; - private final IModelResource.ModelListener listener; - - public RedoAction(IModelResource resource) { - this.resource = resource; - listener = new IModelResource.ModelListener() { - - @Override - public void commandStackChanged() { - update(); - } - - @Override - public void dirtyChanged() { - - } - - }; - resource.addModelListener(listener); - update(); - } - - @Override - public void run() { - if (resource.getEditingDomain().getCommandStack().canRedo()) { - resource.getEditingDomain().getCommandStack().redo(); - } - } - - private void update() { - if (resource.getEditingDomain().getCommandStack().canRedo()) { - setText(Messages.RedoAction_Redo + " " //$NON-NLS-1$ - + resource.getEditingDomain().getCommandStack() - .getRedoCommand().getLabel()); - setEnabled(true); - } else { - setText(Messages.RedoAction_Redo); - setEnabled(false); - } - } - - /** - * Clean up - */ - public void dispose() { - resource.removeModelListener(listener); - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/RefactorModel.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/RefactorModel.java deleted file mode 100644 index 05cfa68f..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/RefactorModel.java +++ /dev/null @@ -1,215 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 Remain Software, Industrial-TSI and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Wim Jongman <wim.jongman@remainsoftware.com> - Bug 432892: Eclipse 4 Application does not work after renaming the - * project name - ******************************************************************************/ -package org.eclipse.e4.tools.emf.editor3x; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.Assert; -import org.eclipse.ltk.core.refactoring.TextChange; -import org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant; - -/** - * A temporary data storage for Ecipse 4 model refactoring. Use the static - * methods to get hold of an instance. - * - * @author Remain Software - Wim Jongman - * - */ -public class RefactorModel { - - int fIndex = 0; - IProject fNewProject; - List<String> fNewTexts = new ArrayList<String>(); - - IProject fOldProject; - - List<String> fOldTexts = new ArrayList<String>(); - - private RefactoringParticipant fParticipant; - - /** - * Factory for an empty model. Use the {@link #addTextRename(String, String)} method to add one or more text - * renames. - * - * @param pParticipant - * @return the model - */ - public static RefactorModel getModel(RefactoringParticipant pParticipant) { - return new RefactorModel().setRefactorParticipant(pParticipant); - } - - /** - * Factory for a model with one rename. Use the {@link #addTextRename(String, String)} method to add one or more - * text - * renames. - * - * @param pParticipant - * @param pOldText - * @param pNewText - * @return the model. - */ - public static RefactorModel getModel(RefactoringParticipant pParticipant, - String pOldText, String pNewText) { - return new RefactorModel().addTextRename(pOldText, pNewText); - } - - /** - * Factory for a model with one rename and a project rename. The project - * rename uses the old and new project because the refactoring framework - * expects the already renamed filenames. Use the {@link #addTextRename(String, String)} method to add one or more - * text - * renames and the old and the new project. - * - * @param pParticipant - * @param pOldText - * @param pNewText - * @param pOldProject - * @param pNewProject - * @return the model. - */ - public static RefactorModel getModel(RefactoringParticipant pParticipant, - String pOldText, String pNewText, IProject pOldProject, - IProject pNewProject) { - return new RefactorModel().addTextRename(pOldText, pNewText) - .setProjectRename(pOldProject, pNewProject) - .setRefactorParticipant(pParticipant); - } - - /** - * Adds a text rename to be processed later. For example, if the project - * name changes there can be <code>bundlclass://</code> and <code>platform:/plugin</code> changes. - * - * @param oldText - * @param newText - * @return the model - */ - public RefactorModel addTextRename(String oldText, String newText) { - Assert.isNotNull(oldText); - Assert.isNotNull(newText); - fOldTexts.add(oldText); - fNewTexts.add(newText); - return this; - } - - /** - * When project renaming this returns the new project. This project does not - * necessarily exist yet. - * - * @return the new project or null if it was not set - * @see RefactorModel#setProjectRename(IProject, IProject) - */ - public IProject getNewProject() { - return fNewProject; - } - - /** - * @return the current index set by {@link #setIndex(int)} - */ - public String getNewTextCurrentIndex() { - return fNewTexts.get(fIndex); - } - - /** - * When project renaming this returns the old project. - * - * @return the new project or null if it was not set - * @see RefactorModel#setProjectRename(IProject, IProject) - */ - public IProject getOldProject() { - return fOldProject; - } - - /** - * - * @return the old text in the current index. - */ - public String getOldTextCurrentIndex() { - return fOldTexts.get(fIndex); - } - - /** - * @return the refactoring participant - */ - public RefactoringParticipant getRefactoringParticipant() { - return fParticipant; - } - - /** - * @return the number of text renames in this model - */ - public int getRenameCount() { - return fOldTexts.size(); - } - - /** - * Delegates to the same method of the embedded RefactoringParticipant. - * - * @param file - * @return a TextChange object - * @see RefactoringParticipant#getTextChange(Object) - */ - public TextChange getTextChange(IFile file) { - return fParticipant.getTextChange(file); - } - - /** - * @return true if this is a projec rename (old and new project are set) - */ - public boolean isProjectRename() { - return fOldProject != null; - } - - /** - * Sets the current 0-based index. May not be out of bounds. - * - * @param index - * @return the model - */ - public RefactorModel setIndex(int index) { - Assert.isTrue(index >= 0); - Assert.isTrue(index < fOldTexts.size()); - fIndex = index; - return this; - } - - /** - * Sets the old and the new project in case of project renaming. - * - * @param oldProject - * @param newProject - * @return the model - */ - public RefactorModel setProjectRename(IProject oldProject, - IProject newProject) { - Assert.isNotNull(oldProject); - Assert.isNotNull(newProject); - fOldProject = oldProject; - fNewProject = newProject; - return this; - } - - /** - * Sets the RefactoringParticipant. - * - * @param pParticipant - * @return the model - * @see RefactoringParticipant - */ - public RefactorModel setRefactorParticipant( - RefactoringParticipant pParticipant) { - fParticipant = pParticipant; - return this; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/RefactorParticipantDelegate.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/RefactorParticipantDelegate.java deleted file mode 100644 index faab30eb..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/RefactorParticipantDelegate.java +++ /dev/null @@ -1,134 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Wim Jongman <wim.jongman@remainsoftware.com> Bug 432892: Eclipse 4 Application does not work after renaming the - * project name - ******************************************************************************/ -package org.eclipse.e4.tools.emf.editor3x; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.ltk.core.refactoring.CompositeChange; -import org.eclipse.ltk.core.refactoring.TextChange; -import org.eclipse.ltk.core.refactoring.TextFileChange; -import org.eclipse.pde.internal.ui.refactoring.MovedTextFileChange; -import org.eclipse.search.core.text.TextSearchEngine; -import org.eclipse.search.core.text.TextSearchMatchAccess; -import org.eclipse.search.core.text.TextSearchRequestor; -import org.eclipse.search.ui.text.FileTextSearchScope; -import org.eclipse.text.edits.MultiTextEdit; -import org.eclipse.text.edits.ReplaceEdit; -import org.eclipse.text.edits.TextEditGroup; - -@SuppressWarnings("restriction") -class RefactorParticipantDelegate { - - private static final String E4_MODEL_CHANGES = "Eclipse 4 Application Model Changes"; //$NON-NLS-1$ - - /** - * Creates a set of changes and returns a new {@link CompositeChange} or - * adds the changes to the passed {@link CompositeChange}. - * - * @param pProgressMonitor - * @param pModel - * - * @return a set of changes in a {@link CompositeChange} - * @throws CoreException - * @throws OperationCanceledException - */ - public static CompositeChange createChange( - IProgressMonitor pProgressMonitor, final RefactorModel pModel) - throws CoreException, OperationCanceledException { - - final String[] filenames = { "*.e4xmi", "plugin.xml" }; //$NON-NLS-1$ //$NON-NLS-2$ - final FileTextSearchScope scope = FileTextSearchScope.newWorkspaceScope( - filenames, false); - - final Map<IFile, TextFileChange> changes = new HashMap<IFile, TextFileChange>(); - final TextSearchRequestor searchRequestor = new TextSearchRequestor() { - - @Override - public boolean acceptPatternMatch(TextSearchMatchAccess matchAccess) - throws CoreException { - final IFile file = matchAccess.getFile(); - TextFileChange change = changes.get(file); - - if (change == null) { - final TextChange textChange = pModel.getTextChange(file); - if (textChange != null) { - return false; - } - - if (pModel.isProjectRename() - && file.getProject().equals(pModel.getOldProject())) { - // The project/resources get refactored before the - // TextChange is applied, therefore we need their - // future locations - final IProject newProject = pModel.getNewProject(); - - // If the model is in a non-standard location the - // new project will keep that location, only the project - // will be changed - final IPath oldFile = file.getFullPath().removeFirstSegments( - 1); - final IFile newFile = newProject.getFile(oldFile); - - change = new MovedTextFileChange(file.getName(), - newFile, file); - change.setEdit(new MultiTextEdit()); - changes.put(file, change); - - } else { - change = new TextFileChange(file.getName(), file); - change.setEdit(new MultiTextEdit()); - changes.put(file, change); - } - } - - final ReplaceEdit edit = new ReplaceEdit( - matchAccess.getMatchOffset(), - matchAccess.getMatchLength(), - pModel.getNewTextCurrentIndex()); - change.addEdit(edit); - change.addTextEditGroup(new TextEditGroup(E4_MODEL_CHANGES, - edit)); - return true; - } - }; - - CompositeChange result; - final TextSearchEngine searchEngine = TextSearchEngine.create(); - for (int count = pModel.getRenameCount(); count > 0; count--) { - pModel.setIndex(count - 1); - searchEngine.search( - scope, - searchRequestor, - TextSearchEngine.createPattern( - pModel.getOldTextCurrentIndex(), true, false), - pProgressMonitor); - } - - if (changes.isEmpty()) { - return null; - } - - result = new CompositeChange(E4_MODEL_CHANGES); - for (final TextFileChange c : changes.values()) { - result.add(c); - } - return result; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/TargetElementProviders.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/TargetElementProviders.java deleted file mode 100644 index ff99aa5f..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/TargetElementProviders.java +++ /dev/null @@ -1,132 +0,0 @@ -package org.eclipse.e4.tools.emf.editor3x; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtension; -import org.eclipse.e4.tools.emf.ui.common.IModelElementProvider; -import org.eclipse.e4.ui.model.fragment.impl.FragmentPackageImpl; -import org.eclipse.emf.common.util.TreeIterator; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.pde.internal.core.PDEExtensionRegistry; - -@SuppressWarnings("restriction") -public class TargetElementProviders implements IModelElementProvider { - private static final String APP_E4XMI_DEFAULT = "Application.e4xmi"; //$NON-NLS-1$ - private ResourceSet resourceSet; - - @Override - public void getModelElements(Filter filter, ModelResultHandler handler) { - if (resourceSet == null) { - resourceSet = new ResourceSetImpl(); - final PDEExtensionRegistry reg = new PDEExtensionRegistry(); - IExtension[] extensions = reg.findExtensions("org.eclipse.e4.workbench.model", true); //$NON-NLS-1$ - final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); - - for (final IExtension ext : extensions) { - for (final IConfigurationElement el : ext.getConfigurationElements()) { - if (el.getName().equals("fragment")) { //$NON-NLS-1$ - URI uri; - // System.err.println("Model-Ext: Checking: " + ext.getContributor().getName()); - final IProject p = root.getProject(ext.getContributor().getName()); - if (p.exists() && p.isOpen()) { - uri = URI.createPlatformResourceURI( - ext.getContributor().getName() + "/" + el.getAttribute("uri"), true); //$NON-NLS-1$ //$NON-NLS-2$ - } else { - uri = URI.createURI("platform:/plugin/" + ext.getContributor().getName() + "/" //$NON-NLS-1$ //$NON-NLS-2$ - + el.getAttribute("uri")); //$NON-NLS-1$ - } - // System.err.println(uri); - try { - resourceSet.getResource(uri, true); - } catch (final Exception e) { - e.printStackTrace(); - // System.err.println("=============> Failing"); - } - - } - } - } - - extensions = reg.findExtensions("org.eclipse.core.runtime.products", true); //$NON-NLS-1$ - for (final IExtension ext : extensions) { - for (final IConfigurationElement el : ext.getConfigurationElements()) { - if (el.getName().equals("product")) { //$NON-NLS-1$ - boolean xmiPropertyPresent = false; - for (final IConfigurationElement prop : el.getChildren("property")) { //$NON-NLS-1$ - if (prop.getAttribute("name").equals("applicationXMI")) { //$NON-NLS-1$//$NON-NLS-2$ - final String v = prop.getAttribute("value"); //$NON-NLS-1$ - setUpResourceSet(root, v); - xmiPropertyPresent = true; - break; - } - } - if (!xmiPropertyPresent) { - setUpResourceSet(root, ext.getNamespaceIdentifier() + "/" + APP_E4XMI_DEFAULT); //$NON-NLS-1$ - break; - } - } - } - } - } - - applyFilter(filter, handler); - } - - private void setUpResourceSet(IWorkspaceRoot root, String v) { - final String[] s = v.split("/"); //$NON-NLS-1$ - URI uri; - // System.err.println("Product-Ext: Checking: " + v + " => P:" + s[0] + ""); - final IProject p = root.getProject(s[0]); - if (p.exists() && p.isOpen()) { - uri = URI.createPlatformResourceURI(v, true); - } else { - uri = URI.createURI("platform:/plugin/" + v); //$NON-NLS-1$ - } - - // System.err.println(uri); - try { - // prevent some unnecessary calls by checking the uri - if (resourceSet.getURIConverter().exists(uri, null)) { - resourceSet.getResource(uri, true); - } - } catch (final Exception e) { - e.printStackTrace(); - // System.err.println("=============> Failing"); - } - } - - private void applyFilter(Filter filter, ModelResultHandler handler) { - for (final Resource res : resourceSet.getResources()) { - final TreeIterator<EObject> it = EcoreUtil.getAllContents(res, - true); - while (it.hasNext()) { - final EObject o = it.next(); - if (o.eContainingFeature() != FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS) { - if (o.eClass().equals(filter.eClass)) { - // System.err.println("Found: " + o); - handler.result(o); - } - } - } - } - } - - @Override - public void clearCache() { - if (resourceSet == null) { - return; - } - for (final Resource r : resourceSet.getResources()) { - r.unload(); - } - resourceSet = null; - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/UndoAction.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/UndoAction.java deleted file mode 100644 index 28eebf0f..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/UndoAction.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.editor3x; - -import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.jface.action.Action; - -public class UndoAction extends Action { - private final IModelResource resource; - private final IModelResource.ModelListener listener; - - public UndoAction(IModelResource resource) { - this.resource = resource; - listener = new IModelResource.ModelListener() { - - @Override - public void commandStackChanged() { - update(); - } - - @Override - public void dirtyChanged() { - } - }; - resource.addModelListener(listener); - update(); - } - - @Override - public void run() { - if (resource.getEditingDomain().getCommandStack().canUndo()) { - resource.getEditingDomain().getCommandStack().undo(); - } - } - - private void update() { - if (resource.getEditingDomain().getCommandStack().canUndo()) { - setText(Messages.UndoAction_Undo + " " //$NON-NLS-1$ - + resource.getEditingDomain().getCommandStack() - .getUndoCommand().getLabel()); - setEnabled(true); - } else { - setText(Messages.UndoAction_Undo); - setEnabled(false); - } - } - - /** - * Clean up - */ - public void dispose() { - resource.removeModelListener(listener); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIResourceFunction.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIResourceFunction.java deleted file mode 100644 index 8517bca0..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIResourceFunction.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.eclipse.e4.tools.emf.editor3x; - -import org.eclipse.e4.core.contexts.ContextFunction; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.tools.emf.editor3x.emf.EditUIUtil; -import org.eclipse.e4.tools.emf.ui.common.IModelResource.ModelListener; -import org.eclipse.e4.tools.emf.ui.common.XMIModelResource; -import org.eclipse.e4.tools.services.IDirtyProviderService; -import org.eclipse.emf.common.util.URI; -import org.eclipse.ui.IEditorInput; - -public class XMIResourceFunction extends ContextFunction { - - @Override - public Object compute(final IEclipseContext context, String contextKey) { - final IEditorInput input = context.get(IEditorInput.class); - final IDirtyProviderService dirtyProvider = context.get(IDirtyProviderService.class); - - if (input != null) { - final URI resourceURI = EditUIUtil.getURI(input); - final XMIModelResource resource = new XMIModelResource(resourceURI); - resource.addModelListener(new ModelListener() { - - @Override - public void dirtyChanged() { - dirtyProvider.setDirtyState(resource.isDirty()); - } - - @Override - public void commandStackChanged() { - - } - }); - return resource; - } - - return null; - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/emf/EditUIUtil.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/emf/EditUIUtil.java deleted file mode 100644 index 9ec1db74..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/emf/EditUIUtil.java +++ /dev/null @@ -1,87 +0,0 @@ -package org.eclipse.e4.tools.emf.editor3x.emf; - -import java.lang.reflect.Method; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.Platform; -import org.eclipse.emf.common.util.URI; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IURIEditorInput; -import org.osgi.framework.Bundle; - -public class EditUIUtil { - static final Class<?> FILE_CLASS; - static { - Class<?> fileClass = null; - try { - fileClass = IFile.class; - } catch (final Exception exception) { - // Ignore any exceptions and assume the class isn't available. - } - FILE_CLASS = fileClass; - } - - static final Class<?> FILE_REVISION_CLASS; - static final Method FILE_REVISION_GET_URI_METHOD; - static { - Class<?> fileRevisionClass = null; - Method fileRevisionGetURIMethod = null; - final Bundle bundle = Platform.getBundle("org.eclipse.team.core"); //$NON-NLS-1$ - if (bundle != null - && (bundle.getState() & (Bundle.ACTIVE | Bundle.STARTING | Bundle.RESOLVED)) != 0) { - try { - fileRevisionClass = bundle - .loadClass("org.eclipse.team.core.history.IFileRevision"); //$NON-NLS-1$ - fileRevisionGetURIMethod = fileRevisionClass - .getMethod("getURI"); //$NON-NLS-1$ - } catch (final Exception exeption) { - // Ignore any exceptions and assume the class isn't available. - } - } - FILE_REVISION_CLASS = fileRevisionClass; - FILE_REVISION_GET_URI_METHOD = fileRevisionGetURIMethod; - } - - static final Class<?> URI_EDITOR_INPUT_CLASS; - static { - Class<?> uriEditorInputClass = null; - try { - uriEditorInputClass = IURIEditorInput.class; - } catch (final Exception exception) { - // The class is not available. - } - URI_EDITOR_INPUT_CLASS = uriEditorInputClass; - } - - public static URI getURI(IEditorInput editorInput) { - - if (FILE_CLASS != null) { - final IFile file = (IFile) editorInput.getAdapter(FILE_CLASS); - if (file != null) { - return URI.createPlatformResourceURI(file.getFullPath() - .toString(), true); - } - } - if (FILE_REVISION_CLASS != null) { - final Object fileRevision = editorInput.getAdapter(FILE_REVISION_CLASS); - if (fileRevision != null) { - try { - return URI - .createURI(((java.net.URI) FILE_REVISION_GET_URI_METHOD - .invoke(fileRevision)).toString()); - } catch (final Exception exception) { - // TODO Log error - } - } - } - if (URI_EDITOR_INPUT_CLASS != null) { - if (editorInput instanceof IURIEditorInput) { - return URI.createURI( - ((IURIEditorInput) editorInput).getURI().toString()) - .trimFragment(); - } - } - - return null; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/AddonContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/AddonContributionEditor.java deleted file mode 100644 index 56aa6f1f..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/AddonContributionEditor.java +++ /dev/null @@ -1,140 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Sopot Cela <sopotcela@gmail.com> - ******************************************************************************/ -package org.eclipse.e4.tools.emf.editor3x.extension; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.e4.internal.tools.wizards.classes.NewAddonClassWizard; -import org.eclipse.e4.tools.emf.editor3x.Messages; -import org.eclipse.e4.tools.emf.ui.common.IContributionClassCreator; -import org.eclipse.e4.ui.model.application.MContribution; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.ui.JavaUI; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.window.Window; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.PartInitException; - -@SuppressWarnings("restriction") -public class AddonContributionEditor implements IContributionClassCreator { - - @Override - public boolean isSupported(EClass element) { - return Util.isTypeOrSuper(ApplicationPackageImpl.Literals.ADDON, element); - } - - @Override - public void createOpen(MContribution contribution, EditingDomain domain, - IProject project, Shell shell) { - createOpen(contribution, domain, project, shell, false); - } - - private void createOpen(MContribution contribution, EditingDomain domain, - IProject project, Shell shell, boolean forceNew) { - if (forceNew || contribution.getContributionURI() == null - || contribution.getContributionURI().trim().length() == 0 - || !contribution.getContributionURI().startsWith("bundleclass:")) { //$NON-NLS-1$ - final NewAddonClassWizard wizard = new NewAddonClassWizard(contribution.getContributionURI()); - wizard.init(null, new StructuredSelection(project)); - final WizardDialog dialog = new WizardDialog(shell, wizard); - if (dialog.open() == Window.OK) { - final IFile f = wizard.getFile(); - final ICompilationUnit el = JavaCore.createCompilationUnitFrom(f); - try { - String fullyQualified; - if (el.getPackageDeclarations() != null && el.getPackageDeclarations().length > 0) { - final String packageName = el.getPackageDeclarations()[0].getElementName(); - final String className = wizard.getDomainClass().getName(); - if (packageName.trim().length() > 0) { - fullyQualified = packageName + "." + className; //$NON-NLS-1$ - } else { - fullyQualified = className; - } - } else { - fullyQualified = wizard.getDomainClass().getName(); - } - - final Command cmd = SetCommand.create(domain, contribution, - ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI, - "bundleclass://" + Util.getBundleSymbolicName(f.getProject()) + "/" + fullyQualified); //$NON-NLS-1$ //$NON-NLS-2$ - if (cmd.canExecute()) { - domain.getCommandStack().execute(cmd); - } - } catch (final JavaModelException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } else { - final URI uri = URI.createURI(contribution.getContributionURI()); - if (uri.hasAuthority() && uri.segmentCount() == 1) { - final String symbolicName = uri.authority(); - final String fullyQualified = uri.segment(0); - IProject p = ResourcesPlugin.getWorkspace().getRoot() - .getProject(symbolicName); - - if (!p.exists()) { - for (final IProject check : ResourcesPlugin.getWorkspace().getRoot().getProjects()) { - final String name = Util.getBundleSymbolicName(check); - if (symbolicName.equals(name)) { - p = check; - break; - } - } - } - - // TODO If this is not a WS-Resource we need to open differently - if (p != null) { - final IJavaProject jp = JavaCore.create(p); - IType t = null; - try { - if (p.exists()) { - t = jp.findType(fullyQualified); - } - else - { - final IJavaProject pprim = JavaCore.create(project); - t = pprim.findType(fullyQualified); - } - if (t != null) { - JavaUI.openInEditor(t); - } else { - createOpen(contribution, domain, project, shell, true); - } - } catch (final JavaModelException e) { - createOpen(contribution, domain, project, shell, true); - } catch (final PartInitException e) { - MessageDialog.openError(shell, Messages.ContributionEditor_FailedToOpenEditor, e.getMessage()); - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } else { - MessageDialog.openError(shell, Messages.ContributionEditor_InvalidURL, - Messages.ContributionEditor_CurrentURLIsInvalid); - } - } - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/DynamicMenuContributionContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/DynamicMenuContributionContributionEditor.java deleted file mode 100644 index 0b441cb3..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/DynamicMenuContributionContributionEditor.java +++ /dev/null @@ -1,142 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 MEDEVIT, FHV and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Marco Descher <marco@descher.at> - initial API and implementation - *******************************************************************************/ -package org.eclipse.e4.tools.emf.editor3x.extension; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.e4.internal.tools.wizards.classes.NewDynamicMenuContributionClassWizard; -import org.eclipse.e4.tools.emf.editor3x.Messages; -import org.eclipse.e4.tools.emf.ui.common.IContributionClassCreator; -import org.eclipse.e4.ui.model.application.MContribution; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.ui.JavaUI; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.window.Window; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.PartInitException; - -@SuppressWarnings("restriction") -public class DynamicMenuContributionContributionEditor implements - IContributionClassCreator { - - @Override - public void createOpen(MContribution contribution, EditingDomain domain, IProject project, Shell shell) { - createOpen(contribution, domain, project, shell, false); - } - - public void createOpen(MContribution contribution, EditingDomain domain, - IProject project, Shell shell, boolean forceNew) { - if (forceNew || contribution.getContributionURI() == null - || contribution.getContributionURI().trim().length() == 0 - || !contribution.getContributionURI().startsWith("bundleclass:")) { //$NON-NLS-1$ - final NewDynamicMenuContributionClassWizard wizard = new NewDynamicMenuContributionClassWizard( - contribution.getContributionURI()); - wizard.init(null, new StructuredSelection(project)); - final WizardDialog dialog = new WizardDialog(shell, wizard); - if (dialog.open() == Window.OK) { - final IFile f = wizard.getFile(); - final ICompilationUnit el = JavaCore.createCompilationUnitFrom(f); - try { - String fullyQualified; - if (el.getPackageDeclarations() != null && el.getPackageDeclarations().length > 0) { - final String packageName = el.getPackageDeclarations()[0].getElementName(); - final String className = wizard.getDomainClass().getName(); - if (packageName.trim().length() > 0) { - fullyQualified = packageName + "." + className; //$NON-NLS-1$ - } else { - fullyQualified = className; - } - } else { - fullyQualified = wizard.getDomainClass().getName(); - } - - final Command cmd = SetCommand.create(domain, contribution, - ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI, - "bundleclass://" + Util.getBundleSymbolicName(f.getProject()) + "/" + fullyQualified); //$NON-NLS-1$ //$NON-NLS-2$ - if (cmd.canExecute()) { - domain.getCommandStack().execute(cmd); - } - } catch (final JavaModelException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } else { - final URI uri = URI.createURI(contribution.getContributionURI()); - if (uri.hasAuthority() && uri.segmentCount() == 1) { - final String symbolicName = uri.authority(); - final String fullyQualified = uri.segment(0); - IProject p = ResourcesPlugin.getWorkspace().getRoot() - .getProject(symbolicName); - - if (!p.exists()) { - for (final IProject check : ResourcesPlugin.getWorkspace().getRoot().getProjects()) { - final String name = Util.getBundleSymbolicName(check); - if (symbolicName.equals(name)) { - p = check; - break; - } - } - } - - // TODO If this is not a WS-Resource we need to open differently - if (p != null) { - final IJavaProject jp = JavaCore.create(p); - IType t = null; - try { - if (p.exists()) { - t = jp.findType(fullyQualified); - } - else - { - final IJavaProject pprim = JavaCore.create(project); - t = pprim.findType(fullyQualified); - } - if (t != null) { - JavaUI.openInEditor(t); - } else { - createOpen(contribution, domain, project, shell, true); - } - } catch (final JavaModelException e) { - createOpen(contribution, domain, project, shell, true); - } catch (final PartInitException e) { - MessageDialog.openError(shell, Messages.ContributionEditor_FailedToOpenEditor, e.getMessage()); - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } else { - MessageDialog.openError(shell, Messages.ContributionEditor_InvalidURL, - Messages.ContributionEditor_CurrentURLIsInvalid); - } - } - } - - @Override - public boolean isSupported(EClass element) { - return Util.isTypeOrSuper(MenuPackageImpl.Literals.DYNAMIC_MENU_CONTRIBUTION, element); - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/HandlerContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/HandlerContributionEditor.java deleted file mode 100644 index cb9d5874..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/HandlerContributionEditor.java +++ /dev/null @@ -1,145 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Sopot Cela <sopotcela@gmail.com> - ******************************************************************************/ -package org.eclipse.e4.tools.emf.editor3x.extension; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.e4.internal.tools.wizards.classes.NewHandlerClassWizard; -import org.eclipse.e4.tools.emf.editor3x.Messages; -import org.eclipse.e4.tools.emf.ui.common.IContributionClassCreator; -import org.eclipse.e4.ui.model.application.MContribution; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.ui.JavaUI; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.window.Window; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.PartInitException; - -@SuppressWarnings("restriction") -public class HandlerContributionEditor implements IContributionClassCreator { - @Override - public void createOpen(MContribution contribution, EditingDomain domain, IProject project, Shell shell) { - createOpen(contribution, domain, project, shell, false); - } - - private void createOpen(MContribution contribution, EditingDomain domain, IProject project, Shell shell, - boolean forceNew) { - if (forceNew || contribution.getContributionURI() == null - || contribution.getContributionURI().trim().length() == 0 - || !contribution.getContributionURI().startsWith("bundleclass:")) { //$NON-NLS-1$ - final NewHandlerClassWizard wizard = new NewHandlerClassWizard(contribution.getContributionURI()); - wizard.init(null, new StructuredSelection(project)); - final WizardDialog dialog = new WizardDialog(shell, wizard); - if (dialog.open() == Window.OK) { - final IFile f = wizard.getFile(); - final ICompilationUnit el = JavaCore.createCompilationUnitFrom(f); - try { - String fullyQualified; - if (el.getPackageDeclarations() != null && el.getPackageDeclarations().length > 0) { - final String packageName = el.getPackageDeclarations()[0].getElementName(); - final String className = wizard.getDomainClass().getName(); - if (packageName.trim().length() > 0) { - fullyQualified = packageName + "." + className; //$NON-NLS-1$ - } else { - fullyQualified = className; - } - } else { - fullyQualified = wizard.getDomainClass().getName(); - } - - final Command cmd = SetCommand.create(domain, contribution, - ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI, - "bundleclass://" + Util.getBundleSymbolicName(f.getProject()) + "/" + fullyQualified); //$NON-NLS-1$//$NON-NLS-2$ - if (cmd.canExecute()) { - domain.getCommandStack().execute(cmd); - } - } catch (final JavaModelException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } else { - final URI uri = URI.createURI(contribution.getContributionURI()); - if (uri.hasAuthority() && uri.segmentCount() == 1) { - final String symbolicName = uri.authority(); - final String fullyQualified = uri.segment(0); - IProject p = ResourcesPlugin.getWorkspace().getRoot() - .getProject(symbolicName); - - if (!p.exists()) { - for (final IProject check : ResourcesPlugin.getWorkspace().getRoot().getProjects()) { - final String name = Util.getBundleSymbolicName(check); - if (symbolicName.equals(name)) { - p = check; - break; - } - } - } - - // TODO If this is not a WS-Resource we need to open differently - if (p != null) { - final IJavaProject jp = JavaCore.create(p); - IType t = null; - try { - if (p.exists()) { - t = jp.findType(fullyQualified); - } - else - { - final IJavaProject pprim = JavaCore.create(project); - t = pprim.findType(fullyQualified); - } - if (t != null) { - JavaUI.openInEditor(t); - } else { - createOpen(contribution, domain, project, shell, true); - } - } catch (final JavaModelException e) { - createOpen(contribution, domain, project, shell, true); - } catch (final PartInitException e) { - MessageDialog.openError(shell, Messages.ContributionEditor_FailedToOpenEditor, e.getMessage()); - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } else { - MessageDialog.openError(shell, Messages.ContributionEditor_InvalidURL, - Messages.ContributionEditor_CurrentURLIsInvalid); - } - } - } - - @Override - public boolean isSupported(EClass element) { - return Util.isTypeOrSuper(CommandsPackageImpl.Literals.HANDLER, element) - || - Util.isTypeOrSuper(MenuPackageImpl.Literals.DIRECT_MENU_ITEM, element) - || - Util.isTypeOrSuper(MenuPackageImpl.Literals.DIRECT_TOOL_ITEM, element); - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/PartContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/PartContributionEditor.java deleted file mode 100644 index 574ada9a..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/PartContributionEditor.java +++ /dev/null @@ -1,141 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Sopot Cela <sopotcela@gmail.com> - ******************************************************************************/ -package org.eclipse.e4.tools.emf.editor3x.extension; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.e4.internal.tools.wizards.classes.NewPartClassWizard; -import org.eclipse.e4.tools.emf.editor3x.Messages; -import org.eclipse.e4.tools.emf.ui.common.IContributionClassCreator; -import org.eclipse.e4.ui.model.application.MContribution; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.ui.JavaUI; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.window.Window; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.PartInitException; - -@SuppressWarnings("restriction") -public class PartContributionEditor implements IContributionClassCreator { - @Override - public void createOpen(MContribution contribution, EditingDomain domain, - IProject project, Shell shell) { - createOpen(contribution, domain, project, shell, false); - } - - private void createOpen(MContribution contribution, EditingDomain domain, - IProject project, Shell shell, boolean forceNew) { - if (forceNew || contribution.getContributionURI() == null - || contribution.getContributionURI().trim().length() == 0 - || !contribution.getContributionURI().startsWith("bundleclass:")) { //$NON-NLS-1$ - final NewPartClassWizard wizard = new NewPartClassWizard(contribution.getContributionURI()); - wizard.init(null, new StructuredSelection(project)); - final WizardDialog dialog = new WizardDialog(shell, wizard); - if (dialog.open() == Window.OK) { - final IFile f = wizard.getFile(); - final ICompilationUnit el = JavaCore.createCompilationUnitFrom(f); - try { - String fullyQualified; - if (el.getPackageDeclarations() != null && el.getPackageDeclarations().length > 0) { - final String packageName = el.getPackageDeclarations()[0].getElementName(); - final String className = wizard.getDomainClass().getName(); - if (packageName.trim().length() > 0) { - fullyQualified = packageName + "." + className; //$NON-NLS-1$ - } else { - fullyQualified = className; - } - } else { - fullyQualified = wizard.getDomainClass().getName(); - } - - final Command cmd = SetCommand.create(domain, contribution, - ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI, - "bundleclass://" + Util.getBundleSymbolicName(f.getProject()) + "/" + fullyQualified); //$NON-NLS-1$ //$NON-NLS-2$ - if (cmd.canExecute()) { - domain.getCommandStack().execute(cmd); - } - } catch (final JavaModelException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } else { - final URI uri = URI.createURI(contribution.getContributionURI()); - if (uri.hasAuthority() && uri.segmentCount() == 1) { - final String symbolicName = uri.authority(); - final String fullyQualified = uri.segment(0); - IProject p = ResourcesPlugin.getWorkspace().getRoot() - .getProject(symbolicName); - - if (!p.exists()) { - for (final IProject check : ResourcesPlugin.getWorkspace().getRoot().getProjects()) { - final String name = Util.getBundleSymbolicName(check); - if (symbolicName.equals(name)) { - p = check; - break; - } - } - } - - // TODO If this is not a WS-Resource we need to open differently - if (p != null) { - final IJavaProject jp = JavaCore.create(p); - IType t = null; - try { - if (p.exists()) { - t = jp.findType(fullyQualified); - } - else - { - final IJavaProject pprim = JavaCore.create(project); - t = pprim.findType(fullyQualified); - } - if (t != null) { - JavaUI.openInEditor(t); - } else { - createOpen(contribution, domain, project, shell, true); - } - } catch (final JavaModelException e) { - createOpen(contribution, domain, project, shell, true); - } catch (final PartInitException e) { - MessageDialog.openError(shell, Messages.ContributionEditor_FailedToOpenEditor, e.getMessage()); - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } else { - MessageDialog.openError(shell, Messages.ContributionEditor_InvalidURL, - Messages.ContributionEditor_CurrentURLIsInvalid); - } - } - } - - @Override - public boolean isSupported(EClass element) { - return Util.isTypeOrSuper(BasicPackageImpl.Literals.PART, element); - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/ToolControlContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/ToolControlContributionEditor.java deleted file mode 100644 index 4fbc09b8..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/ToolControlContributionEditor.java +++ /dev/null @@ -1,137 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Dmitry Spiridenok <d.spiridenok@gmail.com> - Bug 412672 - ******************************************************************************/ -package org.eclipse.e4.tools.emf.editor3x.extension; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.e4.internal.tools.wizards.classes.NewToolControlClassWizard; -import org.eclipse.e4.tools.emf.editor3x.Messages; -import org.eclipse.e4.tools.emf.ui.common.IContributionClassCreator; -import org.eclipse.e4.ui.model.application.MContribution; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.ui.JavaUI; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.window.Window; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.PartInitException; - -@SuppressWarnings("restriction") -public class ToolControlContributionEditor implements IContributionClassCreator { - @Override - public void createOpen(MContribution contribution, EditingDomain domain, IProject project, Shell shell) { - createOpen(contribution, domain, project, shell, false); - } - - private void createOpen(MContribution contribution, EditingDomain domain, IProject project, Shell shell, - boolean forceNew) { - if (forceNew || contribution.getContributionURI() == null - || contribution.getContributionURI().trim().length() == 0 - || !contribution.getContributionURI().startsWith("bundleclass:")) { //$NON-NLS-1$ - final NewToolControlClassWizard wizard = new NewToolControlClassWizard(contribution.getContributionURI()); - wizard.init(null, new StructuredSelection(project)); - final WizardDialog dialog = new WizardDialog(shell, wizard); - if (dialog.open() == Window.OK) { - final IFile f = wizard.getFile(); - final ICompilationUnit el = JavaCore.createCompilationUnitFrom(f); - try { - String fullyQualified; - if (el.getPackageDeclarations() != null && el.getPackageDeclarations().length > 0) { - final String packageName = el.getPackageDeclarations()[0].getElementName(); - final String className = wizard.getDomainClass().getName(); - if (packageName.trim().length() > 0) { - fullyQualified = packageName + "." + className; //$NON-NLS-1$ - } else { - fullyQualified = className; - } - } else { - fullyQualified = wizard.getDomainClass().getName(); - } - - final Command cmd = SetCommand.create(domain, contribution, - ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI, - "bundleclass://" + Util.getBundleSymbolicName(f.getProject()) + "/" + fullyQualified); //$NON-NLS-1$ //$NON-NLS-2$ - if (cmd.canExecute()) { - domain.getCommandStack().execute(cmd); - } - } catch (final JavaModelException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } else { - final URI uri = URI.createURI(contribution.getContributionURI()); - if (uri.hasAuthority() && uri.segmentCount() == 1) { - final String symbolicName = uri.authority(); - final String fullyQualified = uri.segment(0); - IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject(symbolicName); - - if (!p.exists()) { - for (final IProject check : ResourcesPlugin.getWorkspace().getRoot().getProjects()) { - final String name = Util.getBundleSymbolicName(check); - if (symbolicName.equals(name)) { - p = check; - break; - } - } - } - - // TODO If this is not a WS-Resource we need to open differently - if (p != null) { - final IJavaProject jp = JavaCore.create(p); - IType t = null; - try { - if (p.exists()) { - t = jp.findType(fullyQualified); - } - else - { - final IJavaProject pprim = JavaCore.create(project); - t = pprim.findType(fullyQualified); - } - if (t != null) { - JavaUI.openInEditor(t); - } else { - createOpen(contribution, domain, project, shell, true); - } - } catch (final JavaModelException e) { - createOpen(contribution, domain, project, shell, true); - } catch (final PartInitException e) { - MessageDialog.openError(shell, Messages.ContributionEditor_FailedToOpenEditor, e.getMessage()); - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } else { - MessageDialog.openError(shell, Messages.ContributionEditor_InvalidURL, - Messages.ContributionEditor_CurrentURLIsInvalid); - } - } - } - - @Override - public boolean isSupported(EClass element) { - return Util.isTypeOrSuper(MenuPackageImpl.Literals.TOOL_CONTROL, element); - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/Util.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/Util.java deleted file mode 100644 index 23d5bb0b..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/extension/Util.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.editor3x.extension; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.pde.core.project.IBundleProjectDescription; -import org.eclipse.pde.core.project.IBundleProjectService; -import org.osgi.framework.BundleContext; -import org.osgi.framework.FrameworkUtil; -import org.osgi.framework.ServiceReference; - -public class Util { - public static boolean isTypeOrSuper(EClass eClass, EClass element) { - return eClass.equals(element) || element.getEAllSuperTypes().contains(eClass); - } - - public static String getBundleSymbolicName(IProject project) { - BundleContext context = FrameworkUtil.getBundle(AddonContributionEditor.class).getBundleContext(); - ServiceReference<IBundleProjectService> ref = context.getServiceReference(IBundleProjectService.class); - IBundleProjectService service = context.getService(ref); - try { - IBundleProjectDescription description = service.getDescription(project); - return description.getSymbolicName(); - } catch (CoreException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - return null; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/messages.properties b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/messages.properties deleted file mode 100644 index c711b366..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/messages.properties +++ /dev/null @@ -1,19 +0,0 @@ -ContributionEditor_CurrentURLIsInvalid=The current url is invalid -ContributionEditor_FailedToOpenEditor=Failed to open editor -ContributionEditor_InvalidURL=Invalid URL -ModelEditorPreferencePage_Color=Color -ModelEditorPreferencePage_ForcesReadOnlyXMITab=(forces read only XMI tab)\n -ModelEditorPreferencePage_FormTab=Form Tab -ModelEditorPreferencePage_GeneratedID=Autogenerate Element-Id -ModelEditorPreferencePage_ListTabe=List Tab -ModelEditorPreferencePage_NotRenderedColor=Not rendered color -ModelEditorPreferencePage_NotVisibleAndNotRenderedColor=Not visible and not rendered color -ModelEditorPreferencePage_NotVisibleColor=Not visible color -ModelEditorPreferencePage_RememberColumnSettings=Remember column settings when reopening editor -ModelEditorPreferencePage_RememberFilterSettings=Remember filter settings when reopening editor -ModelEditorPreferencePage_RequiresReopeningModel=(requires reopening model) -ModelEditorPreferencePage_SearchableTree=Searchable tree on form tab\n -ModelEditorPreferencePage_ShowID=Show XMI:ID -ModelMoveParticipant_CreatingChange=Creating Change .. -RedoAction_Redo=Redo -UndoAction_Undo=Undo diff --git a/bundles/org.eclipse.e4.tools.emf.ui/.classpath b/bundles/org.eclipse.e4.tools.emf.ui/.classpath deleted file mode 100644 index 64449070..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/.classpath +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"> - <accessrules> - <accessrule kind="accessible" pattern="org/eclipse/e4/**"/> - </accessrules> - </classpathentry> - <classpathentry kind="src" path="src"/> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/bundles/org.eclipse.e4.tools.emf.ui/.project b/bundles/org.eclipse.e4.tools.emf.ui/.project deleted file mode 100644 index b7697e08..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/.project +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.e4.tools.emf.ui</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ManifestBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.SchemaBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ds.core.builder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.pde.PluginNature</nature> - <nature>org.eclipse.jdt.core.javanature</nature> - </natures> -</projectDescription> diff --git a/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.core.resources.prefs b/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index f548abbf..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,6 +0,0 @@ -eclipse.preferences.version=1 - -encoding//model/etypes.ecore=UTF-8 - - -encoding/<project>=UTF-8 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.core.runtime.prefs b/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.core.runtime.prefs deleted file mode 100644 index 5a0ad22d..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.core.runtime.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -line.separator=\n diff --git a/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index c9482977..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,418 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.builder.cleanOutputFolder=clean -org.eclipse.jdt.core.builder.duplicateResourceTask=warning -org.eclipse.jdt.core.builder.invalidClasspath=abort -org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore -org.eclipse.jdt.core.builder.resourceCopyExclusionFilter= -org.eclipse.jdt.core.circularClasspath=error -org.eclipse.jdt.core.classpath.exclusionPatterns=enabled -org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled -org.eclipse.jdt.core.classpath.outputOverlappingAnotherSource=error -org.eclipse.jdt.core.codeComplete.argumentPrefixes= -org.eclipse.jdt.core.codeComplete.argumentSuffixes= -org.eclipse.jdt.core.codeComplete.fieldPrefixes= -org.eclipse.jdt.core.codeComplete.fieldSuffixes= -org.eclipse.jdt.core.codeComplete.localPrefixes= -org.eclipse.jdt.core.codeComplete.localSuffixes= -org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= -org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= -org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= -org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= -org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled -org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore -org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull -org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault -org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable -org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.doc.comment.support=enabled -org.eclipse.jdt.core.compiler.maxProblemPerUnit=100 -org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.autoboxing=ignore -org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning -org.eclipse.jdt.core.compiler.problem.deadCode=warning -org.eclipse.jdt.core.compiler.problem.deprecation=warning -org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled -org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled -org.eclipse.jdt.core.compiler.problem.discouragedReference=warning -org.eclipse.jdt.core.compiler.problem.emptyStatement=warning -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore -org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning -org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled -org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore -org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning -org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning -org.eclipse.jdt.core.compiler.problem.forbiddenReference=error -org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning -org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled -org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning -org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore -org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning -org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=disabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=public -org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning -org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning -org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled -org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning -org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore -org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled -org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public -org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag -org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled -org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning -org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning -org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning -org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning -org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning -org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error -org.eclipse.jdt.core.compiler.problem.nullReference=warning -org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error -org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning -org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning -org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning -org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore -org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore -org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning -org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning -org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning -org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore -org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning -org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore -org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore -org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled -org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning -org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled -org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled -org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled -org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore -org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning -org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning -org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning -org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore -org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning -org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning -org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled -org.eclipse.jdt.core.compiler.problem.unusedImport=warning -org.eclipse.jdt.core.compiler.problem.unusedLabel=warning -org.eclipse.jdt.core.compiler.problem.unusedLocal=warning -org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled -org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning -org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning -org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.6 -org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled -org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,HIGH,LOW,LOW,LOW,LOW,LOW,NORMAL -org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX,PERF,MEM,POLISH,@generated NOT,@ADDED,APITODO -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_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=true -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=true -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=do not insert -org.eclipse.jdt.core.formatter.comment.line_length=120 -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=1 -org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=1 -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_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_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_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=false -org.eclipse.jdt.core.formatter.join_wrapped_lines=false -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=true -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 -org.eclipse.jdt.core.incompatibleJDKLevel=ignore -org.eclipse.jdt.core.incompleteClasspath=error diff --git a/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.jdt.launching.prefs b/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.jdt.launching.prefs deleted file mode 100644 index 3bb23527..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.jdt.launching.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.launching.PREF_STRICTLY_COMPATIBLE_JRE_NOT_AVAILABLE=ignore diff --git a/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.jdt.ui.prefs deleted file mode 100644 index 791508d1..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.jdt.ui.prefs +++ /dev/null @@ -1,115 +0,0 @@ -cleanup.add_default_serial_version_id=true -cleanup.add_generated_serial_version_id=false -cleanup.add_missing_annotations=true -cleanup.add_missing_deprecated_annotations=true -cleanup.add_missing_methods=false -cleanup.add_missing_nls_tags=false -cleanup.add_missing_override_annotations=true -cleanup.add_missing_override_annotations_interface_methods=true -cleanup.add_serial_version_id=false -cleanup.always_use_blocks=true -cleanup.always_use_parentheses_in_expressions=false -cleanup.always_use_this_for_non_static_field_access=false -cleanup.always_use_this_for_non_static_method_access=false -cleanup.convert_to_enhanced_for_loop=false -cleanup.correct_indentation=true -cleanup.format_source_code=true -cleanup.format_source_code_changes_only=false -cleanup.make_local_variable_final=true -cleanup.make_parameters_final=false -cleanup.make_private_fields_final=true -cleanup.make_type_abstract_if_missing_method=false -cleanup.make_variable_declarations_final=true -cleanup.never_use_blocks=false -cleanup.never_use_parentheses_in_expressions=true -cleanup.organize_imports=true -cleanup.qualify_static_field_accesses_with_declaring_class=false -cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true -cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -cleanup.qualify_static_member_accesses_with_declaring_class=true -cleanup.qualify_static_method_accesses_with_declaring_class=false -cleanup.remove_private_constructors=true -cleanup.remove_trailing_whitespaces=true -cleanup.remove_trailing_whitespaces_all=true -cleanup.remove_trailing_whitespaces_ignore_empty=false -cleanup.remove_unnecessary_casts=false -cleanup.remove_unnecessary_nls_tags=false -cleanup.remove_unused_imports=true -cleanup.remove_unused_local_variables=false -cleanup.remove_unused_private_fields=true -cleanup.remove_unused_private_members=false -cleanup.remove_unused_private_methods=true -cleanup.remove_unused_private_types=true -cleanup.sort_members=false -cleanup.sort_members_all=false -cleanup.use_blocks=true -cleanup.use_blocks_only_for_return_and_throw=false -cleanup.use_parentheses_in_expressions=true -cleanup.use_this_for_non_static_field_access=true -cleanup.use_this_for_non_static_field_access_only_if_necessary=true -cleanup.use_this_for_non_static_method_access=true -cleanup.use_this_for_non_static_method_access_only_if_necessary=true -cleanup_profile=_esmCleanUp -cleanup_settings_version=2 -eclipse.preferences.version=1 -editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true -formatter_profile=_esmFormatter -formatter_settings_version=12 -org.eclipse.jdt.ui.exception.name=ex -org.eclipse.jdt.ui.gettersetter.use.is=true -org.eclipse.jdt.ui.javadoc=true -org.eclipse.jdt.ui.keywordthis=false -org.eclipse.jdt.ui.overrideannotation=true -org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*******************************************************************************\r\n * Copyright (c) 2011-${year} EclipseSource Muenchen GmbH and others.\r\n * \r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n * \r\n * Contributors\:\r\n * ${user} - initial API and implementation\r\n ******************************************************************************/</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n *\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment"/><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/**\r\n * {@inheritDoc}\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="false" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">\t\t\t// TODO Auto-generated catch block\r\n\t\t\t// Do NOT catch all Exceptions ("catch (Exception e)")\r\n\t\t\t// Log AND handle Exceptions if possible \r\n //\r\n // You can just uncomment one of the lines below to log an exception\:\r\n\t\t\t// logException will show the logged excpetion to the user\r\n\t\t\t// ModelUtil.logException(${exception_var});\r\n\t\t\t// ModelUtil.logException("YOUR MESSAGE HERE", ${exception_var});\r\n\t\t\t// logWarning will only add the message to the error log\r\n\t\t\t// ModelUtil.logWarning("YOUR MESSAGE HERE", ${exception_var});\r\n\t\t\t// ModelUtil.logWarning("YOUR MESSAGE HERE");\r\n\t\t\t//\t\t\t\r\n\t\t\t// If handling is not possible declare and rethrow Exception</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates> -sp_cleanup.add_default_serial_version_id=true -sp_cleanup.add_generated_serial_version_id=false -sp_cleanup.add_missing_annotations=true -sp_cleanup.add_missing_deprecated_annotations=true -sp_cleanup.add_missing_methods=false -sp_cleanup.add_missing_nls_tags=false -sp_cleanup.add_missing_override_annotations=true -sp_cleanup.add_missing_override_annotations_interface_methods=true -sp_cleanup.add_serial_version_id=false -sp_cleanup.always_use_blocks=true -sp_cleanup.always_use_parentheses_in_expressions=false -sp_cleanup.always_use_this_for_non_static_field_access=false -sp_cleanup.always_use_this_for_non_static_method_access=false -sp_cleanup.convert_to_enhanced_for_loop=false -sp_cleanup.correct_indentation=true -sp_cleanup.format_source_code=true -sp_cleanup.format_source_code_changes_only=false -sp_cleanup.make_local_variable_final=true -sp_cleanup.make_parameters_final=false -sp_cleanup.make_private_fields_final=true -sp_cleanup.make_type_abstract_if_missing_method=false -sp_cleanup.make_variable_declarations_final=true -sp_cleanup.never_use_blocks=false -sp_cleanup.never_use_parentheses_in_expressions=true -sp_cleanup.on_save_use_additional_actions=true -sp_cleanup.organize_imports=true -sp_cleanup.qualify_static_field_accesses_with_declaring_class=false -sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_with_declaring_class=true -sp_cleanup.qualify_static_method_accesses_with_declaring_class=false -sp_cleanup.remove_private_constructors=true -sp_cleanup.remove_trailing_whitespaces=true -sp_cleanup.remove_trailing_whitespaces_all=true -sp_cleanup.remove_trailing_whitespaces_ignore_empty=false -sp_cleanup.remove_unnecessary_casts=false -sp_cleanup.remove_unnecessary_nls_tags=true -sp_cleanup.remove_unused_imports=true -sp_cleanup.remove_unused_local_variables=false -sp_cleanup.remove_unused_private_fields=true -sp_cleanup.remove_unused_private_members=false -sp_cleanup.remove_unused_private_methods=true -sp_cleanup.remove_unused_private_types=true -sp_cleanup.sort_members=false -sp_cleanup.sort_members_all=false -sp_cleanup.use_blocks=true -sp_cleanup.use_blocks_only_for_return_and_throw=false -sp_cleanup.use_parentheses_in_expressions=true -sp_cleanup.use_this_for_non_static_field_access=true -sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true -sp_cleanup.use_this_for_non_static_method_access=true -sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.pde.api.tools.prefs b/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.pde.api.tools.prefs deleted file mode 100644 index e4e3c007..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.pde.api.tools.prefs +++ /dev/null @@ -1,97 +0,0 @@ -ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Error -ANNOTATION_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error -ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Error -ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD=Error -ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error -API_COMPONENT_ELEMENT_TYPE_REMOVED_API_TYPE=Error -API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_API_TYPE=Error -API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_TYPE=Error -API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Error -API_USE_SCAN_FIELD_SEVERITY=Error -API_USE_SCAN_METHOD_SEVERITY=Error -API_USE_SCAN_TYPE_SEVERITY=Error -CLASS_ELEMENT_TYPE_ADDED_METHOD=Error -CLASS_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error -CLASS_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error -CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error -CLASS_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error -CLASS_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error -CLASS_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error -CLASS_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error -CLASS_ELEMENT_TYPE_REMOVED_CONSTRUCTOR=Error -CLASS_ELEMENT_TYPE_REMOVED_FIELD=Error -CLASS_ELEMENT_TYPE_REMOVED_METHOD=Error -CLASS_ELEMENT_TYPE_REMOVED_SUPERCLASS=Error -CLASS_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error -CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error -CONSTRUCTOR_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error -CONSTRUCTOR_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error -CONSTRUCTOR_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error -CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error -ENUM_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error -ENUM_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error -ENUM_ELEMENT_TYPE_REMOVED_ENUM_CONSTANT=Error -ENUM_ELEMENT_TYPE_REMOVED_FIELD=Error -ENUM_ELEMENT_TYPE_REMOVED_METHOD=Error -ENUM_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error -FIELD_ELEMENT_TYPE_ADDED_VALUE=Error -FIELD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error -FIELD_ELEMENT_TYPE_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT=Error -FIELD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error -FIELD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error -FIELD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error -FIELD_ELEMENT_TYPE_CHANGED_TYPE=Error -FIELD_ELEMENT_TYPE_CHANGED_VALUE=Error -FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENT=Error -FIELD_ELEMENT_TYPE_REMOVED_VALUE=Error -ILLEGAL_EXTEND=Warning -ILLEGAL_IMPLEMENT=Warning -ILLEGAL_INSTANTIATE=Warning -ILLEGAL_OVERRIDE=Warning -ILLEGAL_REFERENCE=Warning -INTERFACE_ELEMENT_TYPE_ADDED_FIELD=Error -INTERFACE_ELEMENT_TYPE_ADDED_METHOD=Error -INTERFACE_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error -INTERFACE_ELEMENT_TYPE_ADDED_SUPER_INTERFACE_WITH_METHODS=Error -INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error -INTERFACE_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error -INTERFACE_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error -INTERFACE_ELEMENT_TYPE_REMOVED_FIELD=Error -INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Error -INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error -INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error -INVALID_JAVADOC_TAG=Warning -INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Error -LEAK_EXTEND=Warning -LEAK_FIELD_DECL=Warning -LEAK_IMPLEMENT=Warning -LEAK_METHOD_PARAM=Warning -LEAK_METHOD_RETURN_TYPE=Warning -METHOD_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error -METHOD_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error -METHOD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error -METHOD_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error -METHOD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error -METHOD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error -METHOD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error -METHOD_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error -METHOD_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Error -METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error -MISSING_EE_DESCRIPTIONS=Error -TYPE_PARAMETER_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error -TYPE_PARAMETER_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error -TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error -TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error -TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error -TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error -UNUSED_PROBLEM_FILTERS=Ignore -automatically_removed_unused_problem_filters=Disabled -eclipse.preferences.version=1 -incompatible_api_component_version=Error -incompatible_api_component_version_include_major_without_breaking_change=Disabled -incompatible_api_component_version_include_minor_without_api_change=Disabled -invalid_since_tag_version=Error -malformed_since_tag=Error -missing_since_tag=Error -report_api_breakage_when_major_version_incremented=Disabled -report_resolution_errors_api_component=Warning diff --git a/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.pde.core.prefs b/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.pde.core.prefs deleted file mode 100644 index 497f55a6..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.pde.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -#Sun Apr 18 16:26:38 CEST 2010 -eclipse.preferences.version=1 -pluginProject.extensions=true -resolve.requirebundle=false diff --git a/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.pde.prefs b/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.pde.prefs deleted file mode 100644 index 0bbee3c4..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.pde.prefs +++ /dev/null @@ -1,32 +0,0 @@ -compilers.f.unresolved-features=1 -compilers.f.unresolved-plugins=1 -compilers.incompatible-environment=1 -compilers.p.build=1 -compilers.p.build.bin.includes=1 -compilers.p.build.encodings=2 -compilers.p.build.java.compiler=2 -compilers.p.build.java.compliance=1 -compilers.p.build.missing.output=2 -compilers.p.build.output.library=1 -compilers.p.build.source.library=1 -compilers.p.build.src.includes=1 -compilers.p.deprecated=1 -compilers.p.discouraged-class=1 -compilers.p.internal=1 -compilers.p.missing-packages=1 -compilers.p.missing-version-export-package=1 -compilers.p.missing-version-import-package=1 -compilers.p.missing-version-require-bundle=1 -compilers.p.no-required-att=0 -compilers.p.not-externalized-att=2 -compilers.p.unknown-attribute=1 -compilers.p.unknown-class=1 -compilers.p.unknown-element=1 -compilers.p.unknown-identifier=1 -compilers.p.unknown-resource=1 -compilers.p.unresolved-ex-points=0 -compilers.p.unresolved-import=0 -compilers.s.create-docs=false -compilers.s.doc-folder=doc -compilers.s.open-tags=1 -eclipse.preferences.version=1 diff --git a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF deleted file mode 100644 index 786510c9..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF +++ /dev/null @@ -1,62 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-SymbolicName: org.eclipse.e4.tools.emf.ui;singleton:=true -Bundle-Version: 0.12.0.qualifier -Bundle-ClassPath: . -Bundle-Vendor: %providerName -Bundle-Localization: plugin -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 -Require-Bundle: org.eclipse.core.runtime;bundle-version="3.9.0", - org.eclipse.core.databinding;bundle-version="1.3.0", - org.eclipse.core.databinding.property;bundle-version="1.2.100", - org.eclipse.e4.ui.model.workbench;bundle-version="0.9.1", - org.eclipse.emf.databinding;bundle-version="1.2.0", - org.eclipse.jface.databinding;bundle-version="1.4.0", - org.eclipse.jface;bundle-version="3.6.0", - org.eclipse.emf.edit;bundle-version="2.6.0", - org.eclipse.equinox.common;bundle-version="3.6.0", - org.eclipse.emf.databinding.edit;bundle-version="1.2.0", - org.eclipse.core.resources;bundle-version="3.6.0", - org.eclipse.e4.core.services;bundle-version="0.9.1", - org.eclipse.osgi;bundle-version="3.6.0", - org.eclipse.e4.ui.css.swt.theme;bundle-version="0.9.0", - org.eclipse.e4.core.di;bundle-version="0.9.0", - org.eclipse.e4.ui.workbench;bundle-version="0.9.1", - org.eclipse.e4.ui.services;bundle-version="0.9.1", - org.eclipse.equinox.registry;bundle-version="3.5.0", - org.eclipse.e4.core.contexts;bundle-version="0.9.0", - org.eclipse.e4.ui.di;bundle-version="0.9.0", - org.eclipse.e4.tools.services;bundle-version="0.11.0", - org.eclipse.e4.core.di.extensions;bundle-version="0.9.0", - org.eclipse.jface.text;bundle-version="3.7.0", - org.eclipse.e4.ui.widgets;bundle-version="0.11.0", - org.eclipse.equinox.preferences;bundle-version="3.4.0", - org.eclipse.e4.ui.workbench.swt;bundle-version="0.10.0", - org.eclipse.emf.ecore.xmi;bundle-version="2.9.0", - org.eclipse.jdt.core, - org.eclipse.pde.core, - org.eclipse.e4.core.commands;bundle-version="0.10.0" -Bundle-ActivationPolicy: lazy -Import-Package: javax.annotation;version="1.0.0", - javax.inject;version="1.0.0", - org.osgi.framework;version="1.5.0" -Export-Package: org.eclipse.e4.tools.emf.ui.common;version="0.12.0.qualifier";x-friends:="org.eclipse.e4.tools.emf.liveeditor,org.eclipse.e4.tools.emf.editor3x", - org.eclipse.e4.tools.emf.ui.common.component;version="0.12.0.qualifier";x-internal:=true, - org.eclipse.e4.tools.emf.ui.internal;version="0.12.0.qualifier";x-internal:=true, - org.eclipse.e4.tools.emf.ui.internal.common;version="0.12.0.qualifier";x-internal:=true, - org.eclipse.e4.tools.emf.ui.internal.common.component;version="0.12.0.qualifier";x-internal:=true, - org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs;version="0.12.0.qualifier";x-internal:=true, - org.eclipse.e4.tools.emf.ui.internal.common.component.tabs;version="0.12.0.qualifier";x-internal:=true, - org.eclipse.e4.tools.emf.ui.internal.common.component.tabs.empty;version="0.12.0.qualifier";x-internal:=true, - org.eclipse.e4.tools.emf.ui.internal.common.component.virtual;version="0.12.0.qualifier";x-internal:=true, - org.eclipse.e4.tools.emf.ui.internal.common.objectdata;version="0.12.0.qualifier";x-internal:=true, - org.eclipse.e4.tools.emf.ui.internal.common.properties;version="0.12.0.qualifier";x-internal:=true, - org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator;version="0.12.0.qualifier";x-internal:=true, - org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.dialogs;version="0.12.0.qualifier";x-internal:=true, - org.eclipse.e4.tools.emf.ui.internal.common.uistructure;version="0.12.0.qualifier";x-internal:=true, - org.eclipse.e4.tools.emf.ui.internal.common.xml;version="0.12.0.qualifier";x-internal:=true, - org.eclipse.e4.tools.emf.ui.internal.handlers;version="0.12.0.qualifier";x-internal:=true, - org.eclipse.e4.tools.emf.ui.internal.imp;version="0.12.0.qualifier";x-internal:=true, - org.eclipse.e4.tools.emf.ui.internal.wbm;version="0.12.0.qualifier";x-friends:="org.eclipse.e4.tools.emf.editor,org.eclipse.e4.tools.emf.liveeditor" -Service-Component: OSGI-INF/contributioncollector.xml, OSGI-INF/resourceprovider.xml diff --git a/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/contributioncollector.xml b/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/contributioncollector.xml deleted file mode 100644 index fca98c87..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/contributioncollector.xml +++ /dev/null @@ -1,9 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.e4.tools.emf.ui"> - <implementation class="org.eclipse.e4.tools.emf.ui.internal.common.ClassContributionCollector"/> - <reference bind="addContributor" cardinality="0..n" interface="org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider" name="IClassContributionProvider" policy="dynamic" unbind="removeContributor"/> - <service> - <provide interface="org.eclipse.e4.tools.emf.ui.internal.common.ClassContributionCollector"/> - </service> - <reference bind="addModelElementContributor" cardinality="0..n" interface="org.eclipse.e4.tools.emf.ui.common.IModelElementProvider" name="IModelElementProvider" policy="dynamic" unbind="removeModelElementContributor"/> -</scr:component> diff --git a/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/resourceprovider.xml b/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/resourceprovider.xml deleted file mode 100644 index 4f18498c..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/resourceprovider.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.e4.tools.emf.ui.resourceprovider"> - <implementation class="org.eclipse.e4.tools.emf.ui.internal.ResourceProvider"/> - <service> - <provide interface="org.eclipse.e4.tools.services.IResourceProviderService"/> - </service> - <properties entry="OSGI-INF/resources.properties"/> -</scr:component> diff --git a/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/resources.properties b/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/resources.properties deleted file mode 100644 index cd369c37..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/resources.properties +++ /dev/null @@ -1,144 +0,0 @@ -IMG_org.eclipse.e4.tools.emf.ui.modelelements.Addons=/icons/full/modelelements/Addons.png -IMG_org.eclipse.e4.tools.emf.ui.modelelements.Application=/icons/full/modelelements/Application.png -IMG_org.eclipse.e4.tools.emf.ui.modelelements.Area_vertical=/icons/full/modelelements/Area_vertical.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.Area=/icons/full/modelelements/Area.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.BindingContext=/icons/full/modelelements/BindingContext.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.BindingTable=/icons/full/modelelements/BindingTable.png -IMG_org.eclipse.e4.tools.emf.ui.modelelements.Category=/icons/full/modelelements/Category.png -IMG_org.eclipse.e4.tools.emf.ui.modelelements.Command=/icons/full/modelelements/Command.png -IMG_org.eclipse.e4.tools.emf.ui.modelelements.CommandParameter=/icons/full/modelelements/CommandParameter.png -IMG_org.eclipse.e4.tools.emf.ui.modelelements.CoreExpression=/icons/full/modelelements/CoreExpression.png -IMG_org.eclipse.e4.tools.emf.ui.modelelements.Dialog=/icons/full/modelelements/Dialog.png -IMG_org.eclipse.e4.tools.emf.ui.modelelements.DirectMenuItem=/icons/full/modelelements/DirectMenuItem.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.DirectToolItem=/icons/full/modelelements/DirectToolItem.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.HandledMenuItem=/icons/full/modelelements/HandledMenuItem.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.HandledToolItem=/icons/full/modelelements/HandledToolItem.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.Handler=/icons/full/modelelements/Handler.png -IMG_org.eclipse.e4.tools.emf.ui.modelelements.KeyBinding=/icons/full/modelelements/KeyBinding.png -IMG_org.eclipse.e4.tools.emf.ui.modelelements.Menu=/icons/full/modelelements/Menu.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.MenuContribution=/icons/full/modelelements/MenuContribution.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.MenuItem=/icons/full/modelelements/MenuItem.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.DynamicMenuContribution=/icons/full/modelelements/DynamicMenuContribution.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.MenuSeparator=/icons/full/modelelements/MenuSeparator.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.ModelFragments=/icons/full/modelelements/ModelFragments.png -IMG_org.eclipse.e4.tools.emf.ui.modelelements.Parameter=/icons/full/modelelements/Parameter.png -IMG_org.eclipse.e4.tools.emf.ui.modelelements.Part=/icons/full/modelelements/Part.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.PartDescriptor=/icons/full/modelelements/PartDescriptor.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.PartSashContainer_vertical=/icons/full/modelelements/PartSashContainer_vertical.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.PartSashContainer=/icons/full/modelelements/PartSashContainer.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.PartStack=/icons/full/modelelements/PartStack.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.Perspective=/icons/full/modelelements/Perspective.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.PerspectiveStack=/icons/full/modelelements/PerspectiveStack.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.Placeholder=/icons/full/modelelements/Placeholder.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.StringModelFragment=/icons/full/modelelements/StringModelFragment.png -IMG_org.eclipse.e4.tools.emf.ui.modelelements.ToolBar=/icons/full/modelelements/ToolBar.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.ToolBarContribution=/icons/full/modelelements/ToolBarContribution.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.ToolBarSeparator=/icons/full/modelelements/ToolBarSeparator.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.ToolControl=/icons/full/modelelements/ToolControl.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.TrimContribution=/icons/full/modelelements/TrimContribution.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.Window=/icons/full/modelelements/Window.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.WindowTrim=/icons/full/modelelements/WindowTrim.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.WizardDialog=/icons/full/modelelements/WizardDialog.png - -IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.Addons=/icons/full/modelelements/tbr/Addons.png -IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.Application=/icons/full/modelelements/tbr/Application.png -IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.Area_vertical=/icons/full/modelelements/tbr/Area_vertical.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.Area=/icons/full/modelelements/tbr/Area.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.BindingContext=/icons/full/modelelements/tbr/BindingContext.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.BindingTable=/icons/full/modelelements/tbr/BindingTable.png -IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.CommandParameter=/icons/full/modelelements/tbr/CommandParameter.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.Dialog=/icons/full/modelelements/tbr/Dialog.png -IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.DirectMenuItem=/icons/full/modelelements/tbr/DirectMenuItem.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.DirectToolItem=/icons/full/modelelements/tbr/DirectToolItem.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.HandledMenuItem=/icons/full/modelelements/tbr/HandledMenuItem.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.HandledToolItem=/icons/full/modelelements/tbr/HandledToolItem.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.Menu=/icons/full/modelelements/tbr/Menu.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.MenuContribution=/icons/full/modelelements/tbr/MenuContribution.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.MenuItem=/icons/full/modelelements/tbr/MenuItem.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.DynamicMenuContribution=/icons/full/modelelements/tbr/DynamicMenuContribution.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.MenuSeparator=/icons/full/modelelements/tbr/MenuSeparator.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.ModelFragments=/icons/full/modelelements/tbr/ModelFragments.png -IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.Parameter=/icons/full/modelelements/tbr/Parameter.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.Part=/icons/full/modelelements/tbr/Part.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.PartDescriptor=/icons/full/modelelements/tbr/PartDescriptor.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.PartSashContainer_vertical=/icons/full/modelelements/tbr/PartSashContainer_vertical.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.PartSashContainer=/icons/full/modelelements/tbr/PartSashContainer.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.PartStack=/icons/full/modelelements/tbr/PartStack.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.Perspective=/icons/full/modelelements/tbr/Perspective.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.PerspectiveStack=/icons/full/modelelements/tbr/PerspectiveStack.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.Placeholder=/icons/full/modelelements/tbr/Placeholder.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.StringModelFragment=/icons/full/modelelements/tbr/StringModelFragment.png -IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.ToolBar=/icons/full/modelelements/tbr/ToolBar.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.ToolBarContribution=/icons/full/modelelements/tbr/ToolBarContribution.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.ToolBarSeparator=/icons/full/modelelements/tbr/ToolBarSeparator.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.ToolControl=/icons/full/modelelements/tbr/ToolControl.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.TrimContribution=/icons/full/modelelements/tbr/TrimContribution.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.Window=/icons/full/modelelements/tbr/Window.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.WindowTrim=/icons/full/modelelements/tbr/WindowTrim.gif -IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.WizardDialog=/icons/full/modelelements/tbr/WizardDialog.png - - -IMG_org.eclipse.e4.tools.emf.ui.obj16.arrow_down=/icons/full/obj16/arrow_down.png -IMG_org.eclipse.e4.tools.emf.ui.obj16.arrow_up=/icons/full/obj16/arrow_up.png -IMG_org.eclipse.e4.tools.emf.ui.obj16.class_obj=/icons/full/obj16/class_obj.gif -IMG_org.eclipse.e4.tools.emf.ui.obj16.class_default_obj=/icons/full/obj16/class_default_obj.gif -IMG_org.eclipse.e4.tools.emf.ui.obj16.cross=/icons/full/obj16/cross.png -IMG_org.eclipse.e4.tools.emf.ui.obj16.EPackage=/icons/full/obj16/EPackage.gif -IMG_org.eclipse.e4.tools.emf.ui.obj16.field_public_obj=/icons/full/obj16/field_public_obj.gif -IMG_org.eclipse.e4.tools.emf.ui.obj16.field_default_obj=/icons/full/obj16/field_default_obj.gif -IMG_org.eclipse.e4.tools.emf.ui.obj16.field_private_obj=/icons/full/obj16/field_private_obj.gif -IMG_org.eclipse.e4.tools.emf.ui.obj16.field_protected_obj=/icons/full/obj16/field_protected_obj.gif -IMG_org.eclipse.e4.tools.emf.ui.obj16.headermenu=/icons/full/obj16/headermenu.png -IMG_org.eclipse.e4.tools.emf.ui.obj16.table_add=/icons/full/obj16/table_add.png -IMG_org.eclipse.e4.tools.emf.ui.obj16.table_delete=/icons/full/obj16/table_delete.png -IMG_org.eclipse.e4.tools.emf.ui.obj16.zoom=/icons/full/obj16/zoom.png -IMG_org.eclipse.e4.tools.emf.ui.obj16.application_form=/icons/full/obj16/application_form.png -IMG_org.eclipse.e4.tools.emf.ui.obj16.chart_organisation=/icons/full/obj16/chart_organisation.png -IMG_org.eclipse.e4.tools.emf.ui.obj16.error_obj=/icons/full/obj16/error_obj.gif -IMG_org.eclipse.e4.tools.emf.ui.obj16.world_edit=/icons/full/obj16/world_edit.png -IMG_org.eclipse.e4.tools.emf.ui.obj16.bullet_go=/icons/full/obj16/bullet_go.png -IMG_org.eclipse.e4.tools.emf.ui.obj16.bundle = /icons/full/obj16/bundle.png - -IMG_org.eclipse.e4.tools.emf.ui.wizban.fieldrefact_wiz=/icons/full/wizban/fieldrefact_wiz.png -IMG_org.eclipse.e4.tools.emf.ui.wizban.import_wiz=/icons/full/wizban/import_wiz.png -IMG_org.eclipse.e4.tools.emf.ui.wizban.newclass_wiz=/icons/full/wizban/newclass_wiz.png -IMG_org.eclipse.e4.tools.emf.ui.wizban.newexp_wiz=/icons/full/wizban/newexp_wiz.png -IMG_org.eclipse.e4.tools.emf.ui.wizban.typerefact_wiz=/icons/full/wizban/typerefact_wiz.png -IMG_org.eclipse.e4.tools.emf.ui.wizban.extstr_wiz=/icons/full/wizban/extstr_wiz.png -IMG_org.eclipse.e4.tools.emf.ui.wizban.imp3x_wiz=/icons/full/wizban/imp3x_wiz.png - -IMG_org.eclipse.e4.tools.emf.ui.widgets.ctabfolder_obj = /icons/full/widgets/ctabfolder_obj.gif -IMG_org.eclipse.e4.tools.emf.ui.widgets.tabfolder_obj = /icons/full/widgets/tabfolder_obj.gif -IMG_org.eclipse.e4.tools.emf.ui.widgets.shell_obj = /icons/full/widgets/shell_obj.gif -IMG_org.eclipse.e4.tools.emf.ui.widgets.group_obj = /icons/full/widgets/group_obj.gif -IMG_org.eclipse.e4.tools.emf.ui.widgets.ccombo_obj = /icons/full/widgets/ccombo_obj.gif -IMG_org.eclipse.e4.tools.emf.ui.widgets.comboviewer_obj = /icons/full/widgets/comboviewer_obj.gif -IMG_org.eclipse.e4.tools.emf.ui.widgets.table_obj = /icons/full/widgets/table_obj.gif -IMG_org.eclipse.e4.tools.emf.ui.widgets.tree_obj = /icons/full/widgets/tree_obj.gif -IMG_org.eclipse.e4.tools.emf.ui.widgets.sashform_obj = /icons/full/widgets/sashform_obj.gif -IMG_org.eclipse.e4.tools.emf.ui.widgets.text_obj = /icons/full/widgets/text_obj.gif -IMG_org.eclipse.e4.tools.emf.ui.widgets.label_obj = /icons/full/widgets/label_obj.gif -IMG_org.eclipse.e4.tools.emf.ui.widgets.button_obj = /icons/full/widgets/button_obj.gif -IMG_org.eclipse.e4.tools.emf.ui.widgets.composite_obj = /icons/full/widgets/composite_obj.gif -IMG_org.eclipse.e4.tools.emf.ui.widgets.progressbar_obj = /icons/full/widgets/progressbar_obj.gif -IMG_org.eclipse.e4.tools.emf.ui.widgets.separator_obj = /icons/full/widgets/separator_obj.gif -IMG_org.eclipse.e4.tools.emf.ui.widgets.clabel_obj = /icons/full/widgets/clabel_obj.gif -IMG_org.eclipse.e4.tools.emf.ui.widgets.coolbar_obj = /icons/full/widgets/coolbar_obj.gif -IMG_org.eclipse.e4.tools.emf.ui.widgets.toolbar_obj = /icons/full/widgets/toolbar_obj.gif -IMG_org.eclipse.e4.tools.emf.ui.widgets.toolitemcheck_obj = /icons/full/widgets/toolitemcheck_obj.gif -IMG_org.eclipse.e4.tools.emf.ui.widgets.toolitemdrop_obj = /icons/full/widgets/toolitemdrop_obj.gif -IMG_org.eclipse.e4.tools.emf.ui.widgets.toolitempush_obj = /icons/full/widgets/toolitempush_obj.gif -IMG_org.eclipse.e4.tools.emf.ui.widgets.toolitemradio_obj = /icons/full/widgets/toolitemradio_obj.gif -IMG_org.eclipse.e4.tools.emf.ui.widgets.toolitemseparator_obj = /icons/full/widgets/toolitemseparator_obj.gif -IMG_org.eclipse.e4.tools.emf.ui.widgets.checkbox_obj = /icons/full/widgets/checkbox_obj.gif -IMG_org.eclipse.e4.tools.emf.ui.widgets.group_obj = /icons/full/widgets/group_obj.gif -IMG_org.eclipse.e4.tools.emf.ui.widgets.menu_obj = /icons/full/widgets/menu_obj.gif -IMG_org.eclipse.e4.tools.emf.ui.widgets.menubar_obj = /icons/full/widgets/menubar_obj.gif -IMG_org.eclipse.e4.tools.emf.ui.widgets.menuitem_obj = /icons/full/widgets/menuitem_obj.gif -IMG_org.eclipse.e4.tools.emf.ui.widgets.menuseparator_obj = /icons/full/widgets/menuseparator_obj.gif - -COLOR_org.eclipse.e4.tools.emf.ui.XML_COMMENT=rgb(128, 0, 0) -COLOR_org.eclipse.e4.tools.emf.ui.PROC_INSTR=rgb(128, 128, 128) -COLOR_org.eclipse.e4.tools.emf.ui.STRING=rgb(0, 128, 0) -COLOR_org.eclipse.e4.tools.emf.ui.DEFAULT=rgb(0, 0, 0) -COLOR_org.eclipse.e4.tools.emf.ui.TAG=rgb(0, 0, 128)
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/README.md b/bundles/org.eclipse.e4.tools.emf.ui/README.md deleted file mode 100644 index a467bc3f..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/README.md +++ /dev/null @@ -1,16 +0,0 @@ -org.eclipse.e4.tools.emf.ui -=========================== - -Provides the e4 model editor and the org.eclipse.e4.tools.emf.ui.editors extension point which can be used to add editor pages for custom model elements. - -The ModelEditor class is the main wiring point for the model editor. - -For more information, refer to the [Eclipse e4 wiki page] [1]. - -License -------- - -[Eclipse Public License (EPL) v1.0][2] - -[1]: http://www.eclipse.org/e4/ -[2]: http://wiki.eclipse.org/EPL diff --git a/bundles/org.eclipse.e4.tools.emf.ui/about.html b/bundles/org.eclipse.e4.tools.emf.ui/about.html deleted file mode 100644 index c1343aa3..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/about.html +++ /dev/null @@ -1,45 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> -<title>About</title> -</head> -<body lang="EN-US"> -<h2>About This Content</h2> - -<p>December 3, 2009</p> -<h3>License</h3> - -<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise -indicated below, the Content is provided to you under the terms and conditions of the -Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available -at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. -For purposes of the EPL, "Program" will mean the Content.</p> - -<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is -being redistributed by another party ("Redistributor") and different terms and conditions may -apply to your use of any object code in the Content. Check the Redistributor's license that was -provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise -indicated below, the terms and conditions of the EPL still apply to any source code in the Content -and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p> - -<h3>Third Party Content</h3> - -<p>The Content includes items from third parties as set out below. If you did not -receive this Content directly from the Eclipse Foundation, the following is provided for informational -purposes only, and you should look to the Redistributor’s license for terms and conditions of use.</p> - -<h4>Silk icon set Version 1.3</h4> -<p> -This plugin contains icons from the Silk icon set created by Mark James. The original files can -be found at: -<ul> -<a href="http://www.famfamfam.com/lab/icons/silk/">http://www.famfamfam.com/lab/icons/silk/</a></ul> -<p>The license can be found at:</p> -<ul> - <li><a href="http://creativecommons.org/licenses/by/2.5/">http://creativecommons.org/licenses/by/2.5/</a></li> -</ul> - -</body> -</html>
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/build.properties b/bundles/org.eclipse.e4.tools.emf.ui/build.properties deleted file mode 100644 index 11fb1086..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/build.properties +++ /dev/null @@ -1,13 +0,0 @@ -bin.includes = .,\ - META-INF/,\ - plugin.properties,\ - icons/,\ - about.html,\ - plugin.xml,\ - css/,\ - OSGI-INF/,\ - schema/,\ - fragment.e4xmi -output.. = bin/ -jars.compile.order = . -source.. = src/ diff --git a/bundles/org.eclipse.e4.tools.emf.ui/css/default.css b/bundles/org.eclipse.e4.tools.emf.ui/css/default.css deleted file mode 100644 index 2117aec7..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/css/default.css +++ /dev/null @@ -1,27 +0,0 @@ -.headerSectionContainer { - background-color: gradient #575757 #101010 100%; -} - -.sectionHeader { - font-weight: bold; - font-size: 15pt; - color: white; -} - -.subSectionHeader { - background-color: gradient #575757 #101010 100%; -} - - -.contentContainer { - background-color: #fff #fff #cccccc 20% 80%; -} - -.formContainer { - background-color: #fff; -} - -/* SingleSourcing Container */ -.E4WorkbenchModelEditor { - background-color: #fff; -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/forceQualifierUpdate.txt b/bundles/org.eclipse.e4.tools.emf.ui/forceQualifierUpdate.txt deleted file mode 100644 index 396f0875..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/forceQualifierUpdate.txt +++ /dev/null @@ -1,2 +0,0 @@ -# To force a version qualifier update add the bug here -Bug 403237 - o.e.e4.tools cannot be build with "mvn clean install" diff --git a/bundles/org.eclipse.e4.tools.emf.ui/fragment.e4xmi b/bundles/org.eclipse.e4.tools.emf.ui/fragment.e4xmi deleted file mode 100644 index 9c5b109b..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/fragment.e4xmi +++ /dev/null @@ -1,39 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?> -<fragment:ModelFragments xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:commands="http://www.eclipse.org/ui/2010/UIModel/application/commands" xmlns:fragment="http://www.eclipse.org/ui/2010/UIModel/fragment" xmi:id="_GxnD8Ly2EeOxWJvPH-7sUQ"> - <fragments xsi:type="fragment:StringModelFragment" xmi:id="_Kmj8QLy2EeOxWJvPH-7sUQ" featurename="commands" parentElementId="org.eclipse.e4.legacy.ide.application"> - <elements xsi:type="commands:Command" xmi:id="_RRp7QLy2EeOxWJvPH-7sUQ" elementId="org.eclipse.e4.tools.emf.ui.command.mark_duplicate_ids" commandName="Mark Duplicate Model Element Ids" description="Marks Duplicate Model Element Ids"/> - <elements xsi:type="commands:Command" xmi:id="_9ITpgL2IEeOqSr2XZwfnmA" elementId="org.eclipse.e4.tools.emf.ui.command.mark_duplicate_labels" commandName="Mark Duplicate Model Labels" description="Marks Duplicate Model Labels"/> - <elements xsi:type="commands:Command" xmi:id="_RObi4L2MEeOqSr2XZwfnmA" elementId="org.eclipse.e4.tools.emf.ui.command.mark_duplicate_attributes" commandName="Mark Duplicate Model Attributes..." description="Marks Duplicate Model Attributes"/> - <elements xsi:type="commands:Command" xmi:id="_dySeYLzDEeO8eO1Rpb-rFA" elementId="org.eclipse.e4.tools.emf.ui.command.repair_duplicate_ids" commandName="Repair Duplicate Model Element IDs" description="Repairs Duplicate Model Element IDs"/> - <elements xsi:type="commands:Command" xmi:id="_CFlw8L2LEeOqSr2XZwfnmA" elementId="org.eclipse.e4.tools.emf.ui.command.unmark" commandName="Unmark Model Items" description="Unmarks All Model Items"/> - <elements xsi:type="commands:Command" xmi:id="_jd7xgO5mEeOQXaYP-M2JBA" elementId="org.eclipse.e4.tools.emf.ui.command.autosizeColumns" commandName="Autosize Columns" description="Autosizes all columns to their content"/> - <elements xsi:type="commands:Command" xmi:id="_vsQXAPFwEeOSJuCPb-hb7A" elementId="org.eclipse.e4.tools.emf.ui.command.resetToDefault" commandName="Reset To Default" description="Resets the table to default values"/> - </fragments> - <fragments xsi:type="fragment:StringModelFragment" xmi:id="_jtmcsLy3EeOxWJvPH-7sUQ" featurename="handlers" parentElementId="org.eclipse.e4.legacy.ide.application"> - <elements xsi:type="commands:Handler" xmi:id="_p45hULy3EeOxWJvPH-7sUQ" elementId="org.eclipse.e4.tools.emf.ui.handler.mark_duplicate_ids" contributionURI="bundleclass://org.eclipse.e4.tools.emf.ui/org.eclipse.e4.tools.emf.ui.internal.handlers.MarkDuplicateElementIdsHandler" command="_RRp7QLy2EeOxWJvPH-7sUQ"/> - <elements xsi:type="commands:Handler" xmi:id="_AOEgkL2JEeOqSr2XZwfnmA" elementId="org.eclipse.e4.tools.emf.ui.handler.mark_duplicate_labels" contributionURI="bundleclass://org.eclipse.e4.tools.emf.ui/org.eclipse.e4.tools.emf.ui.internal.handlers.MarkDuplicateLabelsHandler" command="_9ITpgL2IEeOqSr2XZwfnmA"/> - <elements xsi:type="commands:Handler" xmi:id="_TgJt4L2MEeOqSr2XZwfnmA" elementId="org.eclipse.e4.tools.emf.ui.handler.mark_duplicate_attributes" contributionURI="bundleclass://org.eclipse.e4.tools.emf.ui/org.eclipse.e4.tools.emf.ui.internal.handlers.MarkDuplicateAttributesHandler" command="_RObi4L2MEeOqSr2XZwfnmA"/> - <elements xsi:type="commands:Handler" xmi:id="_smaaALzDEeO8eO1Rpb-rFA" elementId="org.eclipse.e4.tools.emf.ui.handler.repair_duplicate_ids" contributionURI="bundleclass://org.eclipse.e4.tools.emf.ui/org.eclipse.e4.tools.emf.ui.internal.handlers.RepairDuplicateItemsHandler" command="_dySeYLzDEeO8eO1Rpb-rFA"/> - <elements xsi:type="commands:Handler" xmi:id="_Fin4gL2LEeOqSr2XZwfnmA" elementId="org.eclipse.e4.tools.emf.ui.handler.unmark" contributionURI="bundleclass://org.eclipse.e4.tools.emf.ui/org.eclipse.e4.tools.emf.ui.internal.handlers.UnmarkItemsHandler" command="_CFlw8L2LEeOqSr2XZwfnmA"/> - <elements xsi:type="commands:Handler" xmi:id="_hZcKMO5mEeOQXaYP-M2JBA" elementId="org.eclipse.e4.tools.emf.ui.handler.autosizeColumns" contributionURI="bundleclass://org.eclipse.e4.tools.emf.ui/org.eclipse.e4.tools.emf.ui.internal.handlers.AutosizeColumnsHandler" command="_jd7xgO5mEeOQXaYP-M2JBA"/> - <elements xsi:type="commands:Handler" xmi:id="_8AHVUPFwEeOSJuCPb-hb7A" elementId="org.eclipse.e4.tools.emf.ui.handler.resetToDefault" contributionURI="bundleclass://org.eclipse.e4.tools.emf.ui/org.eclipse.e4.tools.emf.ui.internal.handlers.ResetToDefaultHandler" command="_vsQXAPFwEeOSJuCPb-hb7A"/> - </fragments> - <fragments xsi:type="fragment:StringModelFragment" xmi:id="_ph2FwAykEeS6HrzpXti93Q" featurename="commands" parentElementId="org.eclipse.e4.ide.application"> - <elements xsi:type="commands:Command" xmi:id="_ph2FwQykEeS6HrzpXti93Q" elementId="org.eclipse.e4.tools.emf.ui.command.mark_duplicate_ids" commandName="Mark Duplicate Model Element Ids" description="Marks Duplicate Model Element Ids"/> - <elements xsi:type="commands:Command" xmi:id="_ph2FwgykEeS6HrzpXti93Q" elementId="org.eclipse.e4.tools.emf.ui.command.mark_duplicate_labels" commandName="Mark Duplicate Model Labels" description="Marks Duplicate Model Labels"/> - <elements xsi:type="commands:Command" xmi:id="_ph2FwwykEeS6HrzpXti93Q" elementId="org.eclipse.e4.tools.emf.ui.command.mark_duplicate_attributes" commandName="Mark Duplicate Model Attributes..." description="Marks Duplicate Model Attributes"/> - <elements xsi:type="commands:Command" xmi:id="_ph2FxAykEeS6HrzpXti93Q" elementId="org.eclipse.e4.tools.emf.ui.command.repair_duplicate_ids" commandName="Repair Duplicate Model Element IDs" description="Repairs Duplicate Model Element IDs"/> - <elements xsi:type="commands:Command" xmi:id="_ph2FxQykEeS6HrzpXti93Q" elementId="org.eclipse.e4.tools.emf.ui.command.unmark" commandName="Unmark Model Items" description="Unmarks All Model Items"/> - <elements xsi:type="commands:Command" xmi:id="_ph2FxgykEeS6HrzpXti93Q" elementId="org.eclipse.e4.tools.emf.ui.command.autosizeColumns" commandName="Autosize Columns" description="Autosizes all columns to their content"/> - <elements xsi:type="commands:Command" xmi:id="_ph2FxwykEeS6HrzpXti93Q" elementId="org.eclipse.e4.tools.emf.ui.command.resetToDefault" commandName="Reset To Default" description="Resets the table to default values"/> - </fragments> - <fragments xsi:type="fragment:StringModelFragment" xmi:id="_rSPFUAykEeS6HrzpXti93Q" featurename="handlers" parentElementId="org.eclipse.e4.ide.application"> - <elements xsi:type="commands:Handler" xmi:id="_rSPFUQykEeS6HrzpXti93Q" elementId="org.eclipse.e4.tools.emf.ui.handler.mark_duplicate_ids" contributionURI="bundleclass://org.eclipse.e4.tools.emf.ui/org.eclipse.e4.tools.emf.ui.internal.handlers.MarkDuplicateElementIdsHandler" command="_RRp7QLy2EeOxWJvPH-7sUQ"/> - <elements xsi:type="commands:Handler" xmi:id="_rSPFUgykEeS6HrzpXti93Q" elementId="org.eclipse.e4.tools.emf.ui.handler.mark_duplicate_labels" contributionURI="bundleclass://org.eclipse.e4.tools.emf.ui/org.eclipse.e4.tools.emf.ui.internal.handlers.MarkDuplicateLabelsHandler" command="_9ITpgL2IEeOqSr2XZwfnmA"/> - <elements xsi:type="commands:Handler" xmi:id="_rSPFUwykEeS6HrzpXti93Q" elementId="org.eclipse.e4.tools.emf.ui.handler.mark_duplicate_attributes" contributionURI="bundleclass://org.eclipse.e4.tools.emf.ui/org.eclipse.e4.tools.emf.ui.internal.handlers.MarkDuplicateAttributesHandler" command="_RObi4L2MEeOqSr2XZwfnmA"/> - <elements xsi:type="commands:Handler" xmi:id="_rSPFVAykEeS6HrzpXti93Q" elementId="org.eclipse.e4.tools.emf.ui.handler.repair_duplicate_ids" contributionURI="bundleclass://org.eclipse.e4.tools.emf.ui/org.eclipse.e4.tools.emf.ui.internal.handlers.RepairDuplicateItemsHandler" command="_dySeYLzDEeO8eO1Rpb-rFA"/> - <elements xsi:type="commands:Handler" xmi:id="_rSPFVQykEeS6HrzpXti93Q" elementId="org.eclipse.e4.tools.emf.ui.handler.unmark" contributionURI="bundleclass://org.eclipse.e4.tools.emf.ui/org.eclipse.e4.tools.emf.ui.internal.handlers.UnmarkItemsHandler" command="_CFlw8L2LEeOqSr2XZwfnmA"/> - <elements xsi:type="commands:Handler" xmi:id="_rSPFVgykEeS6HrzpXti93Q" elementId="org.eclipse.e4.tools.emf.ui.handler.autosizeColumns" contributionURI="bundleclass://org.eclipse.e4.tools.emf.ui/org.eclipse.e4.tools.emf.ui.internal.handlers.AutosizeColumnsHandler" command="_jd7xgO5mEeOQXaYP-M2JBA"/> - <elements xsi:type="commands:Handler" xmi:id="_rSPFVwykEeS6HrzpXti93Q" elementId="org.eclipse.e4.tools.emf.ui.handler.resetToDefault" contributionURI="bundleclass://org.eclipse.e4.tools.emf.ui/org.eclipse.e4.tools.emf.ui.internal.handlers.ResetToDefaultHandler" command="_vsQXAPFwEeOSJuCPb-hb7A"/> - </fragments> -</fragment:ModelFragments> diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Addons.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Addons.png Binary files differdeleted file mode 100644 index 3262767c..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Addons.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Application.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Application.png Binary files differdeleted file mode 100644 index 3bc0bd32..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Application.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Area.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Area.gif Binary files differdeleted file mode 100644 index bbbdd559..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Area.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Area_vertical.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Area_vertical.gif Binary files differdeleted file mode 100644 index 013e818e..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Area_vertical.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/BindingContext.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/BindingContext.gif Binary files differdeleted file mode 100644 index 50445d99..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/BindingContext.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/BindingTable.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/BindingTable.png Binary files differdeleted file mode 100644 index decac8a6..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/BindingTable.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Category.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Category.png Binary files differdeleted file mode 100644 index d04dd7f5..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Category.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Command.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Command.png Binary files differdeleted file mode 100644 index b89bb343..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Command.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/CommandParameter.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/CommandParameter.png Binary files differdeleted file mode 100644 index 9757fc6e..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/CommandParameter.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/CoreExpression.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/CoreExpression.png Binary files differdeleted file mode 100644 index 0c76bd12..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/CoreExpression.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Dialog.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Dialog.png Binary files differdeleted file mode 100644 index 681c0a0f..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Dialog.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/DirectMenuItem.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/DirectMenuItem.gif Binary files differdeleted file mode 100644 index 30dbf6b0..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/DirectMenuItem.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/DirectToolItem.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/DirectToolItem.gif Binary files differdeleted file mode 100644 index b225cd5e..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/DirectToolItem.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/DynamicMenuContribution.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/DynamicMenuContribution.gif Binary files differdeleted file mode 100644 index 29f08863..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/DynamicMenuContribution.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/HandledMenuItem.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/HandledMenuItem.gif Binary files differdeleted file mode 100644 index 710188a9..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/HandledMenuItem.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/HandledToolItem.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/HandledToolItem.gif Binary files differdeleted file mode 100644 index ac4ff211..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/HandledToolItem.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Handler.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Handler.png Binary files differdeleted file mode 100644 index b8c64af1..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Handler.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/KeyBinding.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/KeyBinding.png Binary files differdeleted file mode 100644 index 25eacb7c..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/KeyBinding.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Menu.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Menu.gif Binary files differdeleted file mode 100644 index 64173281..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Menu.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/MenuContribution.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/MenuContribution.gif Binary files differdeleted file mode 100644 index 2b692560..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/MenuContribution.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/MenuItem.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/MenuItem.gif Binary files differdeleted file mode 100644 index b7c3c562..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/MenuItem.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/MenuSeparator.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/MenuSeparator.gif Binary files differdeleted file mode 100644 index 16d63ff2..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/MenuSeparator.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ModelFragments.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ModelFragments.png Binary files differdeleted file mode 100644 index 6187b15a..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ModelFragments.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Parameter.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Parameter.png Binary files differdeleted file mode 100644 index 9757fc6e..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Parameter.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Part.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Part.gif Binary files differdeleted file mode 100644 index 610f5844..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Part.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartDescriptor.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartDescriptor.gif Binary files differdeleted file mode 100644 index 7a31c506..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartDescriptor.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartSashContainer.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartSashContainer.gif Binary files differdeleted file mode 100644 index bbbdd559..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartSashContainer.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartSashContainer_vertical.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartSashContainer_vertical.gif Binary files differdeleted file mode 100644 index 013e818e..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartSashContainer_vertical.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartStack.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartStack.gif Binary files differdeleted file mode 100644 index edd6060d..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartStack.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Perspective.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Perspective.gif Binary files differdeleted file mode 100644 index ba1a1998..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Perspective.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PerspectiveStack.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PerspectiveStack.gif Binary files differdeleted file mode 100644 index 0624021b..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PerspectiveStack.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Placeholder.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Placeholder.gif Binary files differdeleted file mode 100644 index 25c66a18..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Placeholder.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/StringModelFragment.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/StringModelFragment.png Binary files differdeleted file mode 100644 index b6cb0ecf..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/StringModelFragment.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBar.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBar.gif Binary files differdeleted file mode 100644 index 64173281..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBar.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBarContribution.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBarContribution.gif Binary files differdeleted file mode 100644 index 59155918..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBarContribution.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBarSeparator.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBarSeparator.gif Binary files differdeleted file mode 100644 index 81d54f31..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBarSeparator.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolControl.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolControl.gif Binary files differdeleted file mode 100644 index 3e53cbdc..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolControl.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/TrimContribution.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/TrimContribution.gif Binary files differdeleted file mode 100644 index 59155918..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/TrimContribution.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Window.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Window.gif Binary files differdeleted file mode 100644 index 37aad784..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Window.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/WindowTrim.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/WindowTrim.gif Binary files differdeleted file mode 100644 index 37aad784..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/WindowTrim.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/WizardDialog.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/WizardDialog.png Binary files differdeleted file mode 100644 index 0889b901..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/WizardDialog.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Addons.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Addons.png Binary files differdeleted file mode 100644 index 907e837f..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Addons.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Application.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Application.png Binary files differdeleted file mode 100644 index f4665b36..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Application.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Area.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Area.gif Binary files differdeleted file mode 100644 index 94bdda3e..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Area.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Area_vertical.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Area_vertical.gif Binary files differdeleted file mode 100644 index f6da4c7a..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Area_vertical.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/BindingContext.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/BindingContext.gif Binary files differdeleted file mode 100644 index 1d6aefeb..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/BindingContext.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/BindingTable.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/BindingTable.png Binary files differdeleted file mode 100644 index d572b27c..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/BindingTable.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/CommandParameter.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/CommandParameter.gif Binary files differdeleted file mode 100644 index 486f0251..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/CommandParameter.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Dialog.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Dialog.png Binary files differdeleted file mode 100644 index 4a4cbfe0..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Dialog.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/DirectMenuItem.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/DirectMenuItem.gif Binary files differdeleted file mode 100644 index ad4c980d..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/DirectMenuItem.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/DirectToolItem.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/DirectToolItem.gif Binary files differdeleted file mode 100644 index 3e30ae05..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/DirectToolItem.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/DynamicMenuContribution.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/DynamicMenuContribution.gif Binary files differdeleted file mode 100644 index b2caa8a1..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/DynamicMenuContribution.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/HandledMenuItem.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/HandledMenuItem.gif Binary files differdeleted file mode 100644 index 6465845d..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/HandledMenuItem.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/HandledToolItem.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/HandledToolItem.gif Binary files differdeleted file mode 100644 index 1a4a7436..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/HandledToolItem.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Menu.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Menu.gif Binary files differdeleted file mode 100644 index 0153af73..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Menu.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/MenuContribution.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/MenuContribution.gif Binary files differdeleted file mode 100644 index d2470194..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/MenuContribution.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/MenuItem.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/MenuItem.gif Binary files differdeleted file mode 100644 index 790a5017..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/MenuItem.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/MenuSeparator.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/MenuSeparator.gif Binary files differdeleted file mode 100644 index 52408e3e..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/MenuSeparator.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/ModelFragments.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/ModelFragments.png Binary files differdeleted file mode 100644 index ebf5a85e..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/ModelFragments.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Parameter.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Parameter.gif Binary files differdeleted file mode 100644 index 044d786b..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Parameter.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Part.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Part.gif Binary files differdeleted file mode 100644 index 6f86ad5b..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Part.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/PartDescriptor.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/PartDescriptor.gif Binary files differdeleted file mode 100644 index cf28a00e..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/PartDescriptor.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/PartSashContainer.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/PartSashContainer.gif Binary files differdeleted file mode 100644 index 94bdda3e..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/PartSashContainer.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/PartSashContainer_vertical.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/PartSashContainer_vertical.gif Binary files differdeleted file mode 100644 index f6da4c7a..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/PartSashContainer_vertical.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/PartStack.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/PartStack.gif Binary files differdeleted file mode 100644 index 5d94ef32..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/PartStack.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Perspective.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Perspective.gif Binary files differdeleted file mode 100644 index 6cc4e837..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Perspective.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/PerspectiveStack.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/PerspectiveStack.gif Binary files differdeleted file mode 100644 index c9dc7d45..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/PerspectiveStack.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Placeholder.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Placeholder.gif Binary files differdeleted file mode 100644 index 36c1a4b3..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Placeholder.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/StringModelFragment.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/StringModelFragment.png Binary files differdeleted file mode 100644 index 7a2780ba..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/StringModelFragment.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/ToolBar.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/ToolBar.gif Binary files differdeleted file mode 100644 index 0153af73..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/ToolBar.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/ToolBarContribution.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/ToolBarContribution.gif Binary files differdeleted file mode 100644 index 81e35f1c..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/ToolBarContribution.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/ToolBarSeparator.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/ToolBarSeparator.gif Binary files differdeleted file mode 100644 index 92c10a98..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/ToolBarSeparator.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/ToolControl.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/ToolControl.gif Binary files differdeleted file mode 100644 index 2c309493..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/ToolControl.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/TrimContribution.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/TrimContribution.gif Binary files differdeleted file mode 100644 index 81e35f1c..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/TrimContribution.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Window.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Window.gif Binary files differdeleted file mode 100644 index ca9858df..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Window.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/WindowTrim.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/WindowTrim.gif Binary files differdeleted file mode 100644 index ca9858df..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/WindowTrim.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/WizardDialog.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/WizardDialog.png Binary files differdeleted file mode 100644 index 2ad3435e..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/WizardDialog.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/EPackage.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/EPackage.gif Binary files differdeleted file mode 100644 index 30c5c10c..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/EPackage.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/add_column.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/add_column.gif Binary files differdeleted file mode 100644 index b8715247..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/add_column.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/application_form.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/application_form.png Binary files differdeleted file mode 100644 index 807b862c..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/application_form.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/arrow_down.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/arrow_down.png Binary files differdeleted file mode 100644 index 2c4e2793..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/arrow_down.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/arrow_up.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/arrow_up.png Binary files differdeleted file mode 100644 index 1ebb1932..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/arrow_up.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/bullet_go.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/bullet_go.png Binary files differdeleted file mode 100644 index bc4faa70..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/bullet_go.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/bundle.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/bundle.png Binary files differdeleted file mode 100644 index dd9003b1..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/bundle.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/chart_organisation.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/chart_organisation.png Binary files differdeleted file mode 100644 index c32d25c1..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/chart_organisation.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/class_default_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/class_default_obj.gif Binary files differdeleted file mode 100644 index 4244a7f3..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/class_default_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/class_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/class_obj.gif Binary files differdeleted file mode 100644 index e4c2a836..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/class_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/command.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/command.gif Binary files differdeleted file mode 100644 index d6b3bdcc..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/command.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/copy_to_project.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/copy_to_project.png Binary files differdeleted file mode 100644 index c21bd732..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/copy_to_project.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/cross.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/cross.png Binary files differdeleted file mode 100644 index 1514d51a..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/cross.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/error_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/error_obj.gif Binary files differdeleted file mode 100644 index 0bc60689..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/error_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/field_default_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/field_default_obj.gif Binary files differdeleted file mode 100644 index 6929d3d1..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/field_default_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/field_private_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/field_private_obj.gif Binary files differdeleted file mode 100644 index 1fe064e6..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/field_private_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/field_protected_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/field_protected_obj.gif Binary files differdeleted file mode 100644 index 3377b1eb..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/field_protected_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/field_public_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/field_public_obj.gif Binary files differdeleted file mode 100644 index d4cb4254..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/field_public_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/filter_by_attribute.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/filter_by_attribute.gif Binary files differdeleted file mode 100644 index cfb58e43..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/filter_by_attribute.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/filter_by_item.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/filter_by_item.gif Binary files differdeleted file mode 100644 index b9f9aaa4..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/filter_by_item.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/find.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/find.png Binary files differdeleted file mode 100644 index 611189d6..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/find.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/headermenu.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/headermenu.png Binary files differdeleted file mode 100644 index 45c29000..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/headermenu.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/mark_occurrences.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/mark_occurrences.png Binary files differdeleted file mode 100644 index 8bb23610..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/mark_occurrences.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/missing_image_placeholder.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/missing_image_placeholder.png Binary files differdeleted file mode 100644 index 78a436c0..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/missing_image_placeholder.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/package_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/package_obj.gif Binary files differdeleted file mode 100644 index 131c28da..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/package_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/projects.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/projects.png Binary files differdeleted file mode 100644 index 13e0451b..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/projects.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/remove_filter.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/remove_filter.png Binary files differdeleted file mode 100644 index ea14834f..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/remove_filter.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/reset_columns.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/reset_columns.gif Binary files differdeleted file mode 100644 index ea14834f..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/reset_columns.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/table_add.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/table_add.png Binary files differdeleted file mode 100644 index 2a3e5c4d..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/table_add.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/table_delete.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/table_delete.png Binary files differdeleted file mode 100644 index b85916d9..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/table_delete.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/use_anyway.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/use_anyway.gif Binary files differdeleted file mode 100644 index 2f1c5a8f..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/use_anyway.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/world_edit.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/world_edit.png Binary files differdeleted file mode 100644 index 00794d40..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/world_edit.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/zoom.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/zoom.png Binary files differdeleted file mode 100644 index 908612e3..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/zoom.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/button_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/button_obj.gif Binary files differdeleted file mode 100644 index d143fcf6..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/button_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/ccombo_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/ccombo_obj.gif Binary files differdeleted file mode 100644 index 6bd017e8..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/ccombo_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/checkbox_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/checkbox_obj.gif Binary files differdeleted file mode 100644 index 9cacb96d..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/checkbox_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/clabel_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/clabel_obj.gif Binary files differdeleted file mode 100644 index 8588b69e..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/clabel_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/comboviewer_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/comboviewer_obj.gif Binary files differdeleted file mode 100644 index 9ac63fc1..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/comboviewer_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/composite_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/composite_obj.gif Binary files differdeleted file mode 100644 index 3e53cbdc..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/composite_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/coolbar_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/coolbar_obj.gif Binary files differdeleted file mode 100644 index d71af7a6..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/coolbar_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/ctabfolder_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/ctabfolder_obj.gif Binary files differdeleted file mode 100644 index 7a93c669..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/ctabfolder_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/group_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/group_obj.gif Binary files differdeleted file mode 100644 index d91ebdf8..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/group_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/label_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/label_obj.gif Binary files differdeleted file mode 100644 index cf00ad26..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/label_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/menu_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/menu_obj.gif Binary files differdeleted file mode 100644 index 9235de52..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/menu_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/menubar_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/menubar_obj.gif Binary files differdeleted file mode 100644 index 64173281..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/menubar_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/menuitem_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/menuitem_obj.gif Binary files differdeleted file mode 100644 index b7c3c562..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/menuitem_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/menuseparator_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/menuseparator_obj.gif Binary files differdeleted file mode 100644 index 16d63ff2..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/menuseparator_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/progressbar_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/progressbar_obj.gif Binary files differdeleted file mode 100644 index af41a172..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/progressbar_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/radiobutton_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/radiobutton_obj.gif Binary files differdeleted file mode 100644 index 3901d055..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/radiobutton_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/sashform_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/sashform_obj.gif Binary files differdeleted file mode 100644 index bbbdd559..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/sashform_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/separator_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/separator_obj.gif Binary files differdeleted file mode 100644 index 579587dc..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/separator_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/shell_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/shell_obj.gif Binary files differdeleted file mode 100644 index 37aad784..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/shell_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/tabfolder_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/tabfolder_obj.gif Binary files differdeleted file mode 100644 index edd6060d..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/tabfolder_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/table_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/table_obj.gif Binary files differdeleted file mode 100644 index b99b45ca..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/table_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/text_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/text_obj.gif Binary files differdeleted file mode 100644 index cf20952b..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/text_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/toolbar_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/toolbar_obj.gif Binary files differdeleted file mode 100644 index 64173281..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/toolbar_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/toolitemcheck_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/toolitemcheck_obj.gif Binary files differdeleted file mode 100644 index 9421f563..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/toolitemcheck_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/toolitemdrop_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/toolitemdrop_obj.gif Binary files differdeleted file mode 100644 index c03f91d8..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/toolitemdrop_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/toolitempush_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/toolitempush_obj.gif Binary files differdeleted file mode 100644 index 619f79d6..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/toolitempush_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/toolitemradio_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/toolitemradio_obj.gif Binary files differdeleted file mode 100644 index 3cf12264..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/toolitemradio_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/toolitemseparator_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/toolitemseparator_obj.gif Binary files differdeleted file mode 100644 index 81d54f31..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/toolitemseparator_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/tree_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/tree_obj.gif Binary files differdeleted file mode 100644 index 82b3bed1..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/widgets/tree_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/add_to_dir_wiz.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/add_to_dir_wiz.png Binary files differdeleted file mode 100644 index 684431cd..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/add_to_dir_wiz.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/attribute_wiz.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/attribute_wiz.gif Binary files differdeleted file mode 100644 index 8a70e59b..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/attribute_wiz.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/error_wiz.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/error_wiz.gif Binary files differdeleted file mode 100644 index 2eb9efee..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/error_wiz.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/extstr_wiz.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/extstr_wiz.png Binary files differdeleted file mode 100644 index 74ff2458..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/extstr_wiz.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/fieldrefact_wiz.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/fieldrefact_wiz.png Binary files differdeleted file mode 100644 index ff2dae47..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/fieldrefact_wiz.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/imp3x_wiz.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/imp3x_wiz.png Binary files differdeleted file mode 100644 index 660e384b..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/imp3x_wiz.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/import_wiz.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/import_wiz.png Binary files differdeleted file mode 100644 index 732631c0..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/import_wiz.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/location_wiz.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/location_wiz.png Binary files differdeleted file mode 100644 index d79281c2..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/location_wiz.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/newclass_wiz.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/newclass_wiz.png Binary files differdeleted file mode 100644 index cc123864..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/newclass_wiz.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/newefix_wizban.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/newefix_wizban.png Binary files differdeleted file mode 100644 index 5d02d1cb..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/newefix_wizban.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/newexp_wiz.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/newexp_wiz.png Binary files differdeleted file mode 100644 index a473ea86..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/newexp_wiz.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/newfolder_wiz.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/newfolder_wiz.png Binary files differdeleted file mode 100644 index f4861b1c..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/newfolder_wiz.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/newsearch_wiz.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/newsearch_wiz.gif Binary files differdeleted file mode 100644 index a585f294..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/newsearch_wiz.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/package_wiz.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/package_wiz.png Binary files differdeleted file mode 100644 index 07efd3e0..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/package_wiz.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/plugin_wiz.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/plugin_wiz.gif Binary files differdeleted file mode 100644 index 5457eafa..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/plugin_wiz.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/typerefact_wiz.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/typerefact_wiz.png Binary files differdeleted file mode 100644 index 6cd52a58..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/typerefact_wiz.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/plugin.properties b/bundles/org.eclipse.e4.tools.emf.ui/plugin.properties deleted file mode 100644 index a43449c0..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/plugin.properties +++ /dev/null @@ -1,10 +0,0 @@ - -# <copyright> -# </copyright> -# -# $Id: plugin.properties,v 1.2 2010/07/20 21:48:42 tschindl Exp $ - -pluginName = EMF ModelTooling UI -providerName = Eclipse.org - -extension-point.name = Editors
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/plugin.xml b/bundles/org.eclipse.e4.tools.emf.ui/plugin.xml deleted file mode 100644 index aabe5383..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/plugin.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.4"?> -<plugin> - <extension-point id="org.eclipse.e4.tools.emf.ui.editors" name="%extension-point.name" schema="schema/org.eclipse.e4.tools.emf.ui.editors.exsd"/> - <extension-point id="org.eclipse.e4.tools.emf.ui.scripting" name="Scripting" schema="schema/org.eclipse.e4.tools.emf.ui.scripting.exsd"/> - <extension - point="org.eclipse.e4.ui.css.swt.theme"> - <stylesheet - uri="css/default.css"> - </stylesheet> - </extension> - <extension - point="org.eclipse.equinox.preferences.preferences"> - <initializer - class="org.eclipse.e4.tools.emf.ui.internal.PreferenceInitializer"> - </initializer> - </extension> - <extension - id="id1" - point="org.eclipse.e4.workbench.model"> - <fragment - uri="fragment.e4xmi"> - </fragment> - </extension> - -</plugin> diff --git a/bundles/org.eclipse.e4.tools.emf.ui/pom.xml b/bundles/org.eclipse.e4.tools.emf.ui/pom.xml deleted file mode 100644 index 25973f9c..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/pom.xml +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.eclipse.e4.tools</groupId> - <artifactId>e4-tools-aggregator</artifactId> - <version>0.17.0-SNAPSHOT</version> - <relativePath>../../</relativePath> - </parent> - - <groupId>org.eclipse.e4</groupId> - <artifactId>org.eclipse.e4.tools.emf.ui</artifactId> - <version>0.12.0.qualifier</version> - <packaging>eclipse-plugin</packaging> - -</project> diff --git a/bundles/org.eclipse.e4.tools.emf.ui/schema/org.eclipse.e4.tools.emf.ui.editors.exsd b/bundles/org.eclipse.e4.tools.emf.ui/schema/org.eclipse.e4.tools.emf.ui.editors.exsd deleted file mode 100644 index c6127d97..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/schema/org.eclipse.e4.tools.emf.ui.editors.exsd +++ /dev/null @@ -1,215 +0,0 @@ -<?xml version='1.0' encoding='UTF-8'?> -<!-- Schema file written by PDE --> -<schema targetNamespace="org.eclipse.e4.tools.emf.ui" xmlns="http://www.w3.org/2001/XMLSchema"> -<annotation> - <appinfo> - <meta.schema plugin="org.eclipse.e4.tools.emf.ui" id="org.eclipse.e4.tools.emf.ui.editors" name="Editors"/> - </appinfo> - <documentation> - Contribute editor(s), creation assistants and features for application model element(s). -<br><br> -This extension point allows three distinct extensions: -<ul> -<li>Definition of (virtual) element editors</li> -<li>Contribution of model element creation assistants</li> -<li>Contribution of features for reference by existing model elements</li> -<li>Contribution of additional tabs to existing element editors</li> -</ul> - </documentation> - </annotation> - - <element name="extension"> - <annotation> - <appinfo> - <meta.element /> - </appinfo> - </annotation> - <complexType> - <sequence> - <element ref="editor" minOccurs="0" maxOccurs="unbounded"/> - <element ref="virtualeditor" minOccurs="0" maxOccurs="unbounded"/> - <element ref="editorfeature" minOccurs="0" maxOccurs="unbounded"/> - <element ref="contributionClassCreator" minOccurs="0" maxOccurs="unbounded"/> - <element ref="editorTab" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - <attribute name="point" type="string" use="required"> - <annotation> - <documentation> - - </documentation> - </annotation> - </attribute> - <attribute name="id" type="string"> - <annotation> - <documentation> - - </documentation> - </annotation> - </attribute> - <attribute name="name" type="string"> - <annotation> - <documentation> - - </documentation> - <appinfo> - <meta.attribute translatable="true"/> - </appinfo> - </annotation> - </attribute> - </complexType> - </element> - - <element name="editor"> - <annotation> - <documentation> - Contribute an editor for a model element. Used to support editing new model elements not yet covered by the tooling. -<br><br> -Editors contributed using this extension point override default editors. - </documentation> - </annotation> - <complexType> - <attribute name="descriptorClass" type="string" use="required"> - <annotation> - <documentation> - Defines the supported model element and returns a class capable of editing it. - </documentation> - <appinfo> - <meta.attribute kind="java" basedOn=":org.eclipse.e4.tools.emf.ui.common.IEditorDescriptor"/> - </appinfo> - </annotation> - </attribute> - </complexType> - </element> - - <element name="virtualeditor"> - <annotation> - <documentation> - Contribute an editor for a virtual model element. -<br><br> -A virtual model element is an element not backed by a real object. This is for example the case for editors defining the logical tree structure. These virtual editors may containireal model element objects. A concrete example is the virtual <i>Command Categories</i> editor managing <i>MCategory</i> objects. - </documentation> - </annotation> - <complexType> - <attribute name="id" type="string" use="required"> - <annotation> - <documentation> - The element id this virtual editor is used for. - </documentation> - </annotation> - </attribute> - <attribute name="class" type="string" use="required"> - <annotation> - <documentation> - An abstract visual editor class for the virtual model element. Use as basis to realize a virtual element editor. - </documentation> - <appinfo> - <meta.attribute kind="java" basedOn="org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor:"/> - </appinfo> - </annotation> - </attribute> - </complexType> - </element> - - <element name="editorfeature"> - <annotation> - <documentation> - Contribute features castable to <i>class</i> for reference by the application model. -<br><br> -This is currently used to contribute <i>MExpression#visibleWhen</i> and -<i>ModelFragment#imports</i> elements. So, for example, a custom <i>MExpression</i> class could be contributed in order to provide a specific <i>visibleWhen</i> rule. - </documentation> - </annotation> - <complexType> - <attribute name="class" type="string" use="required"> - <annotation> - <documentation> - Contributes the list of FeatureClass elements. - </documentation> - <appinfo> - <meta.attribute kind="java" basedOn=":org.eclipse.e4.tools.emf.ui.common.IEditorFeature"/> - </appinfo> - </annotation> - </attribute> - </complexType> - </element> - - <element name="contributionClassCreator"> - <annotation> - <documentation> - Contribute an assistant for a model elements contribution class creation. -<br> -This assistant will be called by the element editor when instantiating a new contribution of the respective EClass. - </documentation> - </annotation> - <complexType> - <attribute name="class" type="string" use="required"> - <annotation> - <documentation> - Specifies the supported types and implements the creation and subsequent presentation of the newly created object in an editor. - </documentation> - <appinfo> - <meta.attribute kind="java" basedOn=":org.eclipse.e4.tools.emf.ui.common.IContributionClassCreator"/> - </appinfo> - </annotation> - </attribute> - </complexType> - </element> - - <element name="editorTab"> - <annotation> - <documentation> - Register additional editor tabs to elements in the editor. For each contribution to this extension point, a respective tab item is shown for elements the contribution opts for. - </documentation> - </annotation> - <complexType> - <attribute name="contribution" type="string" use="required"> - <annotation> - <documentation> - Defines the types the editorTab is contributed to, the tab label to present and the contributed editor tab itself. - </documentation> - <appinfo> - <meta.attribute kind="java" basedOn="org.eclipse.e4.tools.emf.ui.common.AbstractElementEditorContribution:"/> - </appinfo> - </annotation> - </attribute> - </complexType> - </element> - - <annotation> - <appinfo> - <meta.section type="since"/> - </appinfo> - <documentation> - [Enter the first release in which this extension point appears.] - </documentation> - </annotation> - - <annotation> - <appinfo> - <meta.section type="examples"/> - </appinfo> - <documentation> - [Enter extension point usage example here.] - </documentation> - </annotation> - - <annotation> - <appinfo> - <meta.section type="apiinfo"/> - </appinfo> - <documentation> - [Enter API information here.] - </documentation> - </annotation> - - <annotation> - <appinfo> - <meta.section type="implementation"/> - </appinfo> - <documentation> - [Enter information about supplied implementation of this extension point.] - </documentation> - </annotation> - - -</schema> diff --git a/bundles/org.eclipse.e4.tools.emf.ui/schema/org.eclipse.e4.tools.emf.ui.scripting.exsd b/bundles/org.eclipse.e4.tools.emf.ui/schema/org.eclipse.e4.tools.emf.ui.scripting.exsd deleted file mode 100644 index 9d8b4e5a..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/schema/org.eclipse.e4.tools.emf.ui.scripting.exsd +++ /dev/null @@ -1,112 +0,0 @@ -<?xml version='1.0' encoding='UTF-8'?> -<!-- Schema file written by PDE --> -<schema targetNamespace="org.eclipse.e4.tools.emf.ui" xmlns="http://www.w3.org/2001/XMLSchema"> -<annotation> - <appinfo> - <meta.schema plugin="org.eclipse.e4.tools.emf.ui" id="org.eclipse.e4.tools.emf.ui.scripting" name="Scripting"/> - </appinfo> - <documentation> - [Enter description of this extension point.] - </documentation> - </annotation> - - <element name="extension"> - <annotation> - <appinfo> - <meta.element /> - </appinfo> - </annotation> - <complexType> - <sequence> - <element ref="scripting" minOccurs="1" maxOccurs="unbounded"/> - </sequence> - <attribute name="point" type="string" use="required"> - <annotation> - <documentation> - - </documentation> - </annotation> - </attribute> - <attribute name="id" type="string"> - <annotation> - <documentation> - - </documentation> - </annotation> - </attribute> - <attribute name="name" type="string"> - <annotation> - <documentation> - - </documentation> - <appinfo> - <meta.attribute translatable="true"/> - </appinfo> - </annotation> - </attribute> - </complexType> - </element> - - <element name="scripting"> - <complexType> - <attribute name="label" type="string" use="required"> - <annotation> - <documentation> - - </documentation> - <appinfo> - <meta.attribute translatable="true"/> - </appinfo> - </annotation> - </attribute> - <attribute name="class" type="string" use="required"> - <annotation> - <documentation> - - </documentation> - <appinfo> - <meta.attribute kind="java" basedOn=":org.eclipse.e4.tools.emf.ui.common.IScriptingSupport"/> - </appinfo> - </annotation> - </attribute> - </complexType> - </element> - - <annotation> - <appinfo> - <meta.section type="since"/> - </appinfo> - <documentation> - [Enter the first release in which this extension point appears.] - </documentation> - </annotation> - - <annotation> - <appinfo> - <meta.section type="examples"/> - </appinfo> - <documentation> - [Enter extension point usage example here.] - </documentation> - </annotation> - - <annotation> - <appinfo> - <meta.section type="apiinfo"/> - </appinfo> - <documentation> - [Enter API information here.] - </documentation> - </annotation> - - <annotation> - <appinfo> - <meta.section type="implementation"/> - </appinfo> - <documentation> - [Enter information about supplied implementation of this extension point.] - </documentation> - </annotation> - - -</schema> diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/AbstractElementEditorContribution.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/AbstractElementEditorContribution.java deleted file mode 100644 index 3c2434e9..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/AbstractElementEditorContribution.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 MEDEVIT, FHV and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Marco Descher <marco@descher.at> - initial API and implementation - *******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.common; - -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.ui.model.application.ui.MUIElement; -import org.eclipse.e4.ui.model.application.ui.basic.MPart; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.widgets.Composite; - -/** - * This class is extended by plug-ins contributing to the - * <code>elementEditorTab</code> extension point. - */ -public abstract class AbstractElementEditorContribution { - - /** - * Filters the elements this extension point contribution is visible on. The - * returned class will be compared using - * {@link Class#isAssignableFrom(Class)}. So if for example an element of - * type {@link MPart} is returned, it is only contributed to the part - * editor. If {@link MUIElement} is returned, the contribution is presented - * on all elements of this type. - * - * @return the class the contributed editor extension is assignable to - */ - public abstract Class<?> getContributableTo(); - - /** - * @return the label to be shown in the {@link CTabItem} contributed - */ - public abstract String getTabLabel(); - - /** - * @param parent - * the {@link Composite} within a {@link CTabItem} created for - * this contribution, added to the elements {@link CTabFolder} - * @param context - * the data-binding context of the enclosing editor - * @param master - * @param editingDomain - * @param project - */ - public abstract void createContributedEditorTab(Composite parent, EMFDataBindingContext context, WritableValue master, EditingDomain editingDomain, IProject project); - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ComboViewerAutoComplete.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ComboViewerAutoComplete.java deleted file mode 100644 index 5468385f..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ComboViewerAutoComplete.java +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation - *******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.common; - -import java.util.Arrays; -import java.util.concurrent.ScheduledThreadPoolExecutor; -import java.util.concurrent.TimeUnit; -import org.eclipse.jface.fieldassist.ComboContentAdapter; -import org.eclipse.jface.fieldassist.ContentProposalAdapter; -import org.eclipse.jface.fieldassist.IContentProposal; -import org.eclipse.jface.fieldassist.SimpleContentProposalProvider; -import org.eclipse.jface.viewers.ComboViewer; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.swt.events.FocusEvent; -import org.eclipse.swt.events.FocusListener; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.widgets.Control; - -/** - * Adds auto complete functionality to a combo viewer. It is assumed that the - * viewer is created with SWT.SIMPLE and SWT.READONLY flags. The proposals will - * be dynamically generated from the viewers current contents. - * - * @author Steven Spungin - * - */ -public class ComboViewerAutoComplete { - - private ContentProposalAdapter adapter; - - public ComboViewerAutoComplete(final ComboViewer dropDown) { - // use all items in the wrapped combo as proposals to filter instead of - // static String[] - SimpleContentProposalProvider proposalProvider = new SimpleContentProposalProvider(new String[0]) { - @Override - public IContentProposal[] getProposals(String contents, int position) { - String[] proposals = dropDown.getCombo().getItems(); - setProposals(proposals); - return super.getProposals(contents, position); - } - }; - // set the viewer instead of the wrapped combo - ComboContentAdapter contentAdapter = new ComboContentAdapter() { - @Override - public void setControlContents(Control control, String text1, int cursorPosition) { - super.setControlContents(control, text1, cursorPosition); - int index = Arrays.asList(dropDown.getCombo().getItems()).indexOf(text1); - Object object = dropDown.getElementAt(index); - dropDown.setSelection(new StructuredSelection(object)); - } - }; - proposalProvider.setFiltering(true); - adapter = new ContentProposalAdapter(dropDown.getCombo(), contentAdapter, proposalProvider, null, null); - adapter.setPropagateKeys(true); - adapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE); - - // Focus the entire field after tab or click - dropDown.getCombo().addFocusListener(new FocusListener() { - - private Object valueWhenFocused; - - @Override - public void focusLost(FocusEvent e) { - // Do not allow a null value (e.g. the user clicks with - // autocomplete text not set - Object object = (((IStructuredSelection) dropDown.getSelection())).getFirstElement(); - if (object == null) { - dropDown.setSelection(new StructuredSelection(valueWhenFocused)); - } - } - - @Override - public void focusGained(FocusEvent e) { - valueWhenFocused = (((IStructuredSelection) dropDown.getSelection())).getFirstElement(); - - // If the user clicks the text field (versus tab), the - // text will be unselected after we set the selection, so we - // need to delay the call - // THIS IS A WORKAROUND - final ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(1); - executor.schedule(new Runnable() { - @Override - public void run() { - dropDown.getCombo().getDisplay().syncExec(new Runnable() { - - @Override - public void run() { - dropDown.getCombo().setSelection(new Point(0, dropDown.getCombo().getText().length())); - } - }); - } - }, 200, TimeUnit.MILLISECONDS); - } - }); - } - - public boolean isProposalPopupOpen() { - return adapter.isProposalPopupOpen(); - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/CommandToStringConverter.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/CommandToStringConverter.java deleted file mode 100644 index 1372aa5b..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/CommandToStringConverter.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.common; - -import org.eclipse.core.databinding.conversion.Converter; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.ui.internal.workbench.E4XMIResource; -import org.eclipse.e4.ui.model.application.commands.MCommand; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; - -public class CommandToStringConverter extends Converter { - private final Messages Messages; - - public CommandToStringConverter(Messages Messages) { - super(MCommand.class, String.class); - this.Messages = Messages; - } - - @Override - public Object convert(Object fromObject) { - final MCommand cmd = (MCommand) fromObject; - String elementId = null; - if (cmd != null && cmd.getElementId() != null && cmd.getElementId().trim().length() > 0) { - elementId = cmd.getElementId(); - } - if (cmd == null) { - return Messages.CommandToStringConverter_None; - } else if (cmd.getCommandName() != null && cmd.getCommandName().trim().length() > 0) { - return cmd.getCommandName() + (elementId != null ? " - " + elementId : ""); //$NON-NLS-1$//$NON-NLS-2$ - } else if (elementId != null) { - return elementId; - } else { - final Resource res = ((EObject) cmd).eResource(); - if (res instanceof E4XMIResource) { - final String v = ((E4XMIResource) res).getID((EObject) cmd); - if (v != null && v.trim().length() > 0) { - return v; - } - } - return cmd.getClass().getSimpleName() + "@" + cmd.hashCode(); //$NON-NLS-1$ - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ContributionURIValidator.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ContributionURIValidator.java deleted file mode 100644 index 449f39a9..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ContributionURIValidator.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.common; - -import org.eclipse.core.databinding.validation.IValidator; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.emf.common.util.URI; - -public class ContributionURIValidator implements IValidator { - - @Override - public IStatus validate(Object value) { - if (value == null) { - return new Status(IStatus.ERROR, Plugin.ID, Messages.ContributionURIValidator_No_Empty_URI); - } else if (!value.toString().startsWith("bundleclass:")) { //$NON-NLS-1$ - return new Status(IStatus.ERROR, Plugin.ID, Messages.ContributionURIValidator_URI_starts_with_platform); - } else { - try { - URI uri = URI.createURI(value.toString()); - if (uri.authority() == null || uri.authority().length() == 0 || uri.segmentCount() != 1) { - return new Status(IStatus.ERROR, Plugin.ID, Messages.ContributionURIValidator_Malformed_URI); - } - } catch (Exception e) { - return new Status(IStatus.ERROR, Plugin.ID, e.getMessage()); - } - - } - - return Status.OK_STATUS; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IClassContributionProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IClassContributionProvider.java deleted file mode 100644 index 059be463..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IClassContributionProvider.java +++ /dev/null @@ -1,175 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Steven Spungin <steven@spungin.tv> - Bug 424730, Bug 436281 - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.common; - -import java.util.EnumSet; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IProgressMonitor; - -public interface IClassContributionProvider { - public class ContributionData { - public final String bundleName; - public final String className; - public final String sourceType; - public final String iconPath; - - /** - * This is used if the resource is not contained in a referenced bundle, - * not a bundle, or not a project. It can be a jar file or a folder. - */ - public String installLocation; - /** - * Path to the resource relative to the installLocation - */ - public String resourceRelativePath; - - public ContributionData(String bundleName, String className, String sourceType, String iconPath) { - this.bundleName = bundleName; - this.className = className; - this.sourceType = sourceType; - this.iconPath = iconPath; - } - } - - public class Filter { - public final IProject project; - public final String namePattern; - public int maxResults; - public Object userData; - - // These items were added for extended filter functionality - private List<String> bundles; - private List<String> packages; - private List<String> locations; - private EnumSet<ResourceSearchScope> searchScope = EnumSet.noneOf(ResourceSearchScope.class); - private boolean includeNonBundles; - private IProgressMonitor progressMonitor; - /** - * This member can be null. It provides a way for the provider to signal - * various state changes. - */ - private IProviderStatusCallback providerStatusCallback; - - public Filter(IProject project, String namePattern) { - this.project = project; - this.namePattern = namePattern; - } - - /** - * Sets the bundles to filter on - * - * @param filterBundles - */ - public void setBundles(List<String> filterBundles) { - bundles = filterBundles; - } - - public void setPackages(List<String> filterPackages) { - packages = filterPackages; - } - - public List<String> getBundles() { - return bundles; - } - - public List<String> getPackages() { - return packages; - } - - public List<String> getLocations() { - return locations; - } - - /** - * Sets the installed project locations to filter on - * - * @param locations - */ - public void setLocations(List<String> locations) { - this.locations = locations; - } - - public EnumSet<ResourceSearchScope> getSearchScope() { - return searchScope; - } - - /** - * Sets the scope for the search. - * - * @param searchScope - */ - public void setSearchScope(EnumSet<ResourceSearchScope> searchScope) { - this.searchScope = searchScope; - } - - /** - * Include plain old java projects, resource projects, and others in - * searches. No manifest required. - * - * @param includeNonBundles - */ - public void setIncludeNonBundles(boolean includeNonBundles) { - this.includeNonBundles = includeNonBundles; - } - - public boolean isIncludeNonBundles() { - return includeNonBundles; - } - - public IProgressMonitor getProgressMonitor() { - return progressMonitor; - } - - public void setProgressMonitor(IProgressMonitor progressMonitor) { - this.progressMonitor = progressMonitor; - } - - public IProviderStatusCallback getProviderStatusCallback() { - return providerStatusCallback; - } - - public void setProviderStatusCallback(IProviderStatusCallback providerStatusCallback) { - this.providerStatusCallback = providerStatusCallback; - } - - } - - public interface ContributionResultHandler { - // hints for flags parameter - /** - * There are more results to display, but the amount is not known - */ - static public final int MORE_UNKNOWN = -1; - /** - * The operation was canceled. There may be additional results. - */ - static public final int MORE_CANCELED = -2; - - public void result(ContributionData data); - - /** - * This method is called at the end of a search. If the search - * terminated because maxResults was exceeded, the hint parameter will - * contain the number of additional results, or MORE_UNKNOWN if there - * are an unspecified number of additional results. - * - * If the search was cancelled, the hint will be MORE_CANCELED - * - * If there are no additional results, hint will be 0 - */ - public void moreResults(int hint, Filter filter); - } - - public void findContribution(Filter filter, ContributionResultHandler handler); -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IContributionClassCreator.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IContributionClassCreator.java deleted file mode 100644 index a10da50d..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IContributionClassCreator.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010-2014 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Marco Descher <marco@descher.at> - Bug 424986 (Documentation) - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.common; - -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.ui.model.application.MContribution; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.swt.widgets.Shell; - -/** - * Contribute a creator for a certain type of {@link EClass}. The types - * supported by this creator are determined by querying - * {@link #isSupported(EClass)}. - */ -public interface IContributionClassCreator { - /** - * Called to determine if the EClass is supported by the contribution - * - * @param element - * @return <code>true</code> if supported - */ - public boolean isSupported(EClass element); - - /** - * Create and open editor for the model element. Called on the supported - * creation of a new model element. - * - * @param contribution - * the {@link MContribution} element to be created and - * subsequently opened in the editor - * @param domain - * @param project - * @param shell - */ - public void createOpen(MContribution contribution, EditingDomain domain, IProject project, Shell shell); -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IEditorDescriptor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IEditorDescriptor.java deleted file mode 100644 index e56685d6..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IEditorDescriptor.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010-2014 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Marco Descher <marco@descher.at> - Bug 424986 (Documentation) - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.common; - -import org.eclipse.emf.ecore.EClass; - -/** - * Contribute an editor for an application model element - */ -public interface IEditorDescriptor { - /** - * @return supported model element - */ - public EClass getEClass(); - - /** - * @return a class extending - * {@link org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor} - * capable of editing class returned in {@link #getEClass()} - */ - public Class<?> getEditorClass(); -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IEditorFeature.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IEditorFeature.java deleted file mode 100644 index 21a8f120..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IEditorFeature.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010-2014 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Marco Descher <marco@descher.at> - Bug 424986 (Documentation) - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.common; - -import java.util.List; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EStructuralFeature; - -/** - * Contribute features for reference in the application model. - */ -public interface IEditorFeature { - public class FeatureClass { - public final String label; - public final String iconId; - public final EClass eClass; - - public FeatureClass(String label, EClass eClass) { - this.label = label; - this.iconId = null; - this.eClass = eClass; - } - - public FeatureClass(String label, String iconId, EClass eClass) { - this.label = label; - this.iconId = iconId; - this.eClass = eClass; - } - } - - /** - * Return a list of {@link FeatureClass} elements, where - * {@link FeatureClass#eClass} must be castable to <b>eClass</b> and will be - * stored in <b>feature</b>. - * - * @param eClass - * your contribution must be castable to - * @param feature - * your contributions storage - * {@link org.eclipse.emf.ecore.EReference} target - * @return the list of selectable alternatives for storage in <b>feature</b> - */ - public List<FeatureClass> getFeatureClasses(EClass eClass, EStructuralFeature feature); -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IExtensionLookup.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IExtensionLookup.java deleted file mode 100644 index 24a2ebb1..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IExtensionLookup.java +++ /dev/null @@ -1,17 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.common; - -import org.eclipse.core.runtime.IExtension; - -public interface IExtensionLookup { - public IExtension[] findExtensions(String extensionPointId, boolean liveModel); -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelElementProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelElementProvider.java deleted file mode 100644 index a276bdc8..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelElementProvider.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.common; - -import java.util.regex.Pattern; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; - -public interface IModelElementProvider { - public class Filter { - public final EClass eClass; - public final String elementId; - public final Pattern elementIdPattern; - - public Filter(EClass eClass, String elementId) { - this.eClass = eClass; - this.elementId = elementId; - this.elementIdPattern = Pattern.compile(".*" + elementId.replaceAll("\\.", "\\\\.").replaceAll("\\*", ".*") + ".*"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ - } - } - - public interface ModelResultHandler { - public void result(EObject data); - } - - public void getModelElements(Filter filter, ModelResultHandler handler); - - public void clearCache(); -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelExtractor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelExtractor.java deleted file mode 100644 index c5b840e1..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelExtractor.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.eclipse.e4.tools.emf.ui.common; - -import java.util.List; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.ui.model.application.MApplicationElement; -import org.eclipse.swt.widgets.Shell; - -public interface IModelExtractor { - - boolean extract(Shell shell, IProject project, List<MApplicationElement> maes); - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelResource.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelResource.java deleted file mode 100644 index 0aead91e..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelResource.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.common; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.domain.EditingDomain; - -public interface IModelResource { - public IObservableList getRoot(); - - public boolean isSaveable(); - - public IStatus save(); - - public EditingDomain getEditingDomain(); - - public boolean isDirty(); - - public void replaceRoot(EObject eobject); - - public void addModelListener(ModelListener listener); - - public void removeModelListener(ModelListener listener); - - public interface ModelListener { - public void dirtyChanged(); - - public void commandStackChanged(); - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IProviderStatusCallback.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IProviderStatusCallback.java deleted file mode 100644 index 9128c86d..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IProviderStatusCallback.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 436283 - *******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.common; - -/** - * A callback used for a provider to notify a client of status changes - * - * @author Steven Spungin - * - */ -public interface IProviderStatusCallback { - void onStatusChanged(ProviderStatus status); -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IScriptingSupport.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IScriptingSupport.java deleted file mode 100644 index b9690d4d..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IScriptingSupport.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.eclipse.e4.tools.emf.ui.common; - -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.swt.widgets.Shell; - -public interface IScriptingSupport { - public void openEditor(Shell shell, Object scope, IEclipseContext context); -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ISelectionProviderService.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ISelectionProviderService.java deleted file mode 100644 index f4769f13..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ISelectionProviderService.java +++ /dev/null @@ -1,15 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.common; - -public interface ISelectionProviderService { - public void setSelection(Object selection); -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ImageTooltip.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ImageTooltip.java deleted file mode 100644 index b4940886..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ImageTooltip.java +++ /dev/null @@ -1,201 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.common; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.net.MalformedURLException; -import java.net.URL; -import java.text.DecimalFormat; -import java.text.MessageFormat; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.emf.common.util.URI; -import org.eclipse.jface.resource.JFaceResources; -import org.eclipse.jface.window.ToolTip; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Label; - -public abstract class ImageTooltip extends ToolTip { - private Image image; - private Messages Messages; - - public ImageTooltip(Control control, Messages Messages) { - super(control); - this.Messages = Messages; - } - - @Override - protected boolean shouldCreateToolTip(Event event) { - if (getImageURI() != null) { - return super.shouldCreateToolTip(event); - } - return false; - } - - @Override - protected Composite createToolTipContentArea(Event event, Composite parent) { - clearResources(); - parent = new Composite(parent, SWT.NONE); - parent.setBackground(event.widget.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND)); - parent.setBackgroundMode(SWT.INHERIT_DEFAULT); - parent.setLayout(new GridLayout(2, false)); - - URI uri = getImageURI(); - - if (uri != null) { - int fileSize = -1; - ByteArrayOutputStream out = null; - InputStream stream = null; - InputStream bStream = null; - String errorMessage = "<" + Messages.ImageTooltip_UnknownError + ">"; //$NON-NLS-1$ //$NON-NLS-2$ - try { - URL url; - try { - url = new URL(uri.toString()); - stream = url.openStream(); - } catch (Exception e) { - // FIXME Temporary fix to show icon - // If not found in runtime search in workspace - if (stream == null) { - String[] segments = uri.segments(); - URI tmpUri = URI.createPlatformResourceURI(segments[1], true); - for (int i = 2; i < segments.length; i++) { - tmpUri = tmpUri.appendSegment(segments[i]); - } - - url = new URL(tmpUri.toString()); - stream = url.openStream(); - } - } - - if (stream != null) { - out = new ByteArrayOutputStream(); - byte[] buf = new byte[1024]; - int length; - while ((length = stream.read(buf)) != -1) { - out.write(buf, 0, length); - } - fileSize = out.size(); - bStream = new ByteArrayInputStream(out.toByteArray()); - image = new Image(parent.getDisplay(), bStream); - } - } catch (MalformedURLException e) { - errorMessage = e.getMessage(); - } catch (FileNotFoundException e) { - if (uri.isPlatform()) { - errorMessage = MessageFormat.format(Messages.ImageTooltip_FileNotFound, e.getMessage(), uri.segment(1)); - } else { - errorMessage = e.getMessage(); - } - } catch (IOException e) { - errorMessage = e.getMessage(); - } catch (Exception e) { - errorMessage = e.getMessage(); - } finally { - if (out != null) { - try { - out.close(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - if (bStream != null) { - try { - bStream.close(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - if (stream != null) { - try { - stream.close(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - - // --------------------------------- - Label l = new Label(parent, SWT.NONE); - l.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); - l.setText(Messages.ImageTooltip_Icon + ":"); //$NON-NLS-1$ - - l = new Label(parent, SWT.NONE); - if (image == null) { - System.err.println(errorMessage); - l.setText(errorMessage); - } else { - l.setImage(image); - } - - // --------------------------------- - - l = new Label(parent, SWT.NONE); - l.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); - l.setText(Messages.ImageTooltip_Name + ":"); //$NON-NLS-1$ - - l = new Label(parent, SWT.NONE); - l.setText(uri.lastSegment()); - - // --------------------------------- - - l = new Label(parent, SWT.NONE); - l.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); - l.setText(Messages.ImageTooltip_Dimension + ":"); //$NON-NLS-1$ - - l = new Label(parent, SWT.NONE); - if (image != null) { - l.setText(image.getBounds().width + "x" + image.getBounds().height + " px"); //$NON-NLS-1$ //$NON-NLS-2$ - } else { - l.setText("0x0 px"); //$NON-NLS-1$ - } - - // --------------------------------- - - l = new Label(parent, SWT.NONE); - l.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); - l.setText(Messages.ImageTooltip_FileSize + ":"); //$NON-NLS-1$ - - l = new Label(parent, SWT.NONE); - l.setText(new DecimalFormat("#,##0.00").format((fileSize / 1024.0)) + "KB"); //$NON-NLS-1$ //$NON-NLS-2$ - } - - return parent; - } - - @Override - protected void afterHideToolTip(Event event) { - super.afterHideToolTip(event); - clearResources(); - } - - protected abstract URI getImageURI(); - - private void clearResources() { - if (image != null) { - image.dispose(); - image = null; - } - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/MemoryTransfer.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/MemoryTransfer.java deleted file mode 100644 index 2ee24af4..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/MemoryTransfer.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.common; - -import java.util.UUID; -import org.eclipse.swt.dnd.ByteArrayTransfer; -import org.eclipse.swt.dnd.TransferData; - -public class MemoryTransfer extends ByteArrayTransfer { - private static final String NAME = MemoryTransfer.class.getName() + ".tranfername"; //$NON-NLS-1$ - - private static final int ID = registerType(NAME); - - private static MemoryTransfer INSTANCE; - - private String uid; - - private Object object; - - public static MemoryTransfer getInstance() { - if (INSTANCE == null) { - INSTANCE = new MemoryTransfer(); - } - return INSTANCE; - } - - @Override - protected int[] getTypeIds() { - return new int[] { ID }; - } - - @Override - protected String[] getTypeNames() { - return new String[] { NAME }; - } - - @Override - public void javaToNative(Object object, TransferData transferData) { - this.uid = UUID.randomUUID().toString(); - this.object = object; - if (transferData != null) { - super.javaToNative(uid.getBytes(), transferData); - } - } - - @Override - public Object nativeToJava(TransferData transferData) { - byte[] bytes = (byte[]) super.nativeToJava(transferData); - if (bytes == null) - return null; - - if (new String(bytes).equals(uid)) { - return object; - } - return null; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ModelEditorPreferences.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ModelEditorPreferences.java deleted file mode 100644 index 74dc1d8e..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ModelEditorPreferences.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.eclipse.e4.tools.emf.ui.common; - -public interface ModelEditorPreferences { - - public static final String LIST_TAB_REMEMBER_COLUMNS = "list-tab-remember-columns"; //$NON-NLS-1$ - public static final String LIST_TAB_REMEMBER_FILTERS = "list-tab-remember-filters"; //$NON-NLS-1$ - public static final String TAB_FORM_SEARCH_SHOW = "tab-form-search-show"; //$NON-NLS-1$ - public static final String AUTO_CREATE_ELEMENT_ID = "autoCreateElementId"; //$NON-NLS-1$ - public static final String NOT_VISIBLE_AND_RENDERED_COLOR = "notVisibleAndRenderedColor"; //$NON-NLS-1$ - public static final String NOT_VISIBLE_COLOR = "notVisibleColor"; //$NON-NLS-1$ - public static final String NOT_RENDERED_COLOR = "notRenderedColor"; //$NON-NLS-1$ - public static final String SHOW_XMI_ID = "showXMIId"; //$NON-NLS-1$ - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Plugin.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Plugin.java deleted file mode 100644 index bdb46217..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Plugin.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.eclipse.e4.tools.emf.ui.common; - -public interface Plugin { - - public static final String ID = "org.eclipse.e4.tools.emf.ui"; //$NON-NLS-1$ -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ProviderStatus.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ProviderStatus.java deleted file mode 100644 index e882b7aa..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ProviderStatus.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 436283 - *******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.common; - -/** - * Provider status used in IProviderStatusCallback - * - * @author Steven Spungin - * - */ -public enum ProviderStatus { - INITIALIZING, READY, CANCELLED -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ResourceSearchScope.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ResourceSearchScope.java deleted file mode 100644 index 229b4299..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ResourceSearchScope.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 404136, 424730 - *******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.common; - -/** - * Specifies the scope when searching for a resource. This differs from the PDE - * search functions in that <li>more than just java objects can be queried. <li> - * Searches can specify the current project only, current workspace, non bundle - * projects, and target platform. - * - * @author Steven Spungin - * - */ -public enum ResourceSearchScope { - /** - * The current project only - */ - PROJECT, - /** - * Projects in the current workspace - */ - WORKSPACE, - /** - * All plugins in target platform - */ - TARGET_PLATFORM, - /** - * Eclipse Plugins and OSGi Bundles - */ - // BUNDLES, - /** - * Eclipse Plugins - */ - // PLUGINS, - /** - * Include resources in packages not exported by their bundles. Only applies - * to SearchScope.TargetPlatform and SearchScope.Workspace - */ - NOT_EXPORTED, - /** - * Follow references to dependent projects and bundles. Only applies to - * SearchScope.Project - */ - REFERENCES -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java deleted file mode 100644 index 939337a2..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java +++ /dev/null @@ -1,280 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.common; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map.Entry; -import java.util.SortedSet; -import java.util.TreeSet; - -import org.eclipse.core.databinding.Binding; -import org.eclipse.core.databinding.observable.value.IValueChangeListener; -import org.eclipse.core.databinding.observable.value.ValueChangeEvent; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.e4.tools.emf.ui.common.IEditorFeature.FeatureClass; -import org.eclipse.e4.ui.model.application.MApplicationElement; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.MElementContainer; -import org.eclipse.e4.ui.model.application.ui.MUIElement; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.e4.ui.model.fragment.impl.FragmentPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.util.TreeIterator; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.fieldassist.ControlDecoration; -import org.eclipse.jface.fieldassist.FieldDecoration; -import org.eclipse.jface.fieldassist.FieldDecorationRegistry; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Control; - -public class Util { - public static final boolean isNullOrEmpty(String element) { - return element == null || element.trim().length() == 0; - } - - public static final boolean isImport(EObject object) { - return object.eContainingFeature() == FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS; - } - - public static final void addClasses(EPackage ePackage, List<FeatureClass> list) { - for (final EClassifier c : ePackage.getEClassifiers()) { - if (c instanceof EClass) { - final EClass eclass = (EClass) c; - if (eclass != ApplicationPackageImpl.Literals.APPLICATION && !eclass.isAbstract() - && !eclass.isInterface() - && eclass.getEAllSuperTypes().contains(ApplicationPackageImpl.Literals.APPLICATION_ELEMENT)) { - list.add(new FeatureClass(eclass.getName(), eclass)); - } - } - } - - for (final EPackage eSubPackage : ePackage.getESubpackages()) { - addClasses(eSubPackage, list); - } - } - - // TODO In future support different name formats something like - // ${project}.${classname}.${counter} - public static final String getDefaultElementId(Resource resource, MApplicationElement element, IProject project) { - try { - final EObject o = (EObject) element; - final String className = o.eClass().getName(); - final String projectName = project.getName(); - - final String prefix = (projectName + "." + className).toLowerCase(); //$NON-NLS-1$ - - final TreeIterator<EObject> it = resource.getAllContents(); - final SortedSet<Integer> numbers = new TreeSet<Integer>(); - - while (it.hasNext()) { - final EObject tmp = it.next(); - if (tmp instanceof MApplicationElement) { - final String elementId = ((MApplicationElement) tmp).getElementId(); - if (elementId != null && elementId.length() > prefix.length() && elementId.startsWith(prefix)) { - final String suffix = elementId.substring(prefix.length()); - if (suffix.startsWith(".") && suffix.length() > 1) { //$NON-NLS-1$ - try { - numbers.add(Integer.parseInt(suffix.substring(1))); - } catch (final Exception e) { - // TODO: handle exception - } - } - } - } - } - - int lastNumber = -1; - for (final Integer number : numbers) { - if (lastNumber + 1 != number) { - break; - } - lastNumber = number; - } - - return (prefix + "." + ++lastNumber).toLowerCase(); //$NON-NLS-1$ - } catch (final Exception e) { - // TODO: handle exception - e.printStackTrace(); - } - return null; - } - - public static List<InternalPackage> loadPackages() { - final List<InternalPackage> packs = new ArrayList<InternalPackage>(); - - for (final Entry<String, Object> regEntry : EPackage.Registry.INSTANCE.entrySet()) { - if (regEntry.getValue() instanceof EPackage) { - final EPackage ePackage = (EPackage) regEntry.getValue(); - final InternalPackage iePackage = new InternalPackage(ePackage); - boolean found = false; - for (final EClassifier cl : ePackage.getEClassifiers()) { - if (cl instanceof EClass) { - final EClass eClass = (EClass) cl; - if (eClass.getEAllSuperTypes().contains(ApplicationPackageImpl.Literals.APPLICATION_ELEMENT)) { - if (!eClass.isInterface() && !eClass.isAbstract()) { - found = true; - final InternalClass ieClass = new InternalClass(iePackage, eClass); - iePackage.classes.add(ieClass); - for (final EReference f : eClass.getEAllReferences()) { - ieClass.features.add(new InternalFeature(ieClass, f)); - } - } - } - } - } - if (found) { - packs.add(iePackage); - } - } - } - - return packs; - } - - public static boolean moveElementByIndex(EditingDomain editingDomain, MUIElement element, boolean liveModel, - int index, EStructuralFeature feature) { - if (liveModel) { - final EObject container = ((EObject) element).eContainer(); - final List<Object> l = (List<Object>) container.eGet(feature); - l.remove(element); - - if (index >= 0) { - l.add(index, element); - } else { - l.add(element); - } - - return true; - } - final EObject container = ((EObject) element).eContainer(); - final Command cmd = MoveCommand.create(editingDomain, container, feature, element, index); - - if (cmd.canExecute()) { - editingDomain.getCommandStack().execute(cmd); - return true; - } - return false; - } - - public static boolean moveElementByIndex(EditingDomain editingDomain, MUIElement element, boolean liveModel, - int index) { - if (liveModel) { - final MElementContainer<MUIElement> container = element.getParent(); - container.getChildren().remove(element); - - if (index >= 0) { - container.getChildren().add(index, element); - } else { - container.getChildren().add(element); - } - - container.setSelectedElement(element); - return true; - } - final MElementContainer<MUIElement> container = element.getParent(); - final Command cmd = MoveCommand.create(editingDomain, container, - UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, element, index); - - if (cmd.canExecute()) { - editingDomain.getCommandStack().execute(cmd); - return true; - } - return false; - } - - public static final void addDecoration(Control control, Binding binding) { - final ControlDecoration dec = new ControlDecoration(control, SWT.BOTTOM); - binding.getValidationStatus().addValueChangeListener(new IValueChangeListener() { - - @Override - public void handleValueChange(ValueChangeEvent event) { - final IStatus s = (IStatus) event.getObservableValue().getValue(); - if (s.isOK()) { - dec.setDescriptionText(null); - dec.setImage(null); - } else { - dec.setDescriptionText(s.getMessage()); - - String fieldDecorationID = null; - switch (s.getSeverity()) { - case IStatus.INFO: - fieldDecorationID = FieldDecorationRegistry.DEC_INFORMATION; - break; - case IStatus.WARNING: - fieldDecorationID = FieldDecorationRegistry.DEC_WARNING; - break; - case IStatus.ERROR: - case IStatus.CANCEL: - fieldDecorationID = FieldDecorationRegistry.DEC_ERROR; - break; - } - final FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault().getFieldDecoration( - fieldDecorationID); - dec.setImage(fieldDecoration == null ? null : fieldDecoration.getImage()); - } - } - }); - } - - public static class InternalPackage { - public final EPackage ePackage; - public List<InternalClass> classes = new ArrayList<InternalClass>(); - - public InternalPackage(EPackage ePackage) { - this.ePackage = ePackage; - } - - @Override - public String toString() { - return ePackage.toString(); - } - - public List<EClass> getAllClasses() { - final ArrayList<EClass> rv = new ArrayList<EClass>(classes.size()); - for (final InternalClass c : classes) { - rv.add(c.eClass); - } - return rv; - } - } - - public static class InternalClass { - public final InternalPackage pack; - public final EClass eClass; - public List<InternalFeature> features = new ArrayList<InternalFeature>(); - - public InternalClass(InternalPackage pack, EClass eClass) { - this.eClass = eClass; - this.pack = pack; - } - } - - public static class InternalFeature { - public final InternalClass clazz; - public final EStructuralFeature feature; - - public InternalFeature(InternalClass clazz, EStructuralFeature feature) { - this.clazz = clazz; - this.feature = feature; - } - - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java deleted file mode 100644 index caf35ad2..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java +++ /dev/null @@ -1,165 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.common; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.EventObject; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.e4.ui.internal.workbench.E4XMIResource; -import org.eclipse.e4.ui.internal.workbench.E4XMIResourceFactory; -import org.eclipse.emf.common.command.BasicCommandStack; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.command.CommandStackListener; -import org.eclipse.emf.common.command.CompoundCommand; -import org.eclipse.emf.common.util.TreeIterator; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.edit.provider.ComposedAdapterFactory; -import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory; - -public class XMIModelResource implements IModelResource { - private final EditingDomain editingDomain; - private final Resource resource; - private final List<ModelListener> listeners = new ArrayList<IModelResource.ModelListener>(); - - private IObservableList list; - - public XMIModelResource(URI uri) { - final ComposedAdapterFactory adapterFactory = new ComposedAdapterFactory( - ComposedAdapterFactory.Descriptor.Registry.INSTANCE); - adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory()); - - final ResourceSet resourceSet = new ResourceSetImpl(); - final BasicCommandStack commandStack = new BasicCommandStack(); - commandStack.addCommandStackListener(new CommandStackListener() { - - @Override - public void commandStackChanged(EventObject event) { - fireDirtyChanged(); - fireCommandStackChanged(); - } - }); - editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, resourceSet); - resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap() - .put(Resource.Factory.Registry.DEFAULT_EXTENSION, new E4XMIResourceFactory()); - resource = resourceSet.getResource(uri, true); - } - - @Override - public IObservableList getRoot() { - if (list != null) { - return list; - } - - list = EMFEditProperties.resource(getEditingDomain()).observe(resource); - - return list; - } - - @Override - public void replaceRoot(EObject eObject) { - E4XMIResource resource = (E4XMIResource) eObject.eResource(); - final Map<EObject, String> idMap = new HashMap<EObject, String>(); - idMap.put(eObject, resource.getID(eObject)); - - final TreeIterator<EObject> it = EcoreUtil.getAllContents(eObject, true); - while (it.hasNext()) { - final EObject o = it.next(); - resource = (E4XMIResource) o.eResource(); - idMap.put(o, resource.getID(o)); - } - - resource = (E4XMIResource) ((EObject) list.get(0)).eResource(); - - final Command cmdRemove = new RemoveCommand(getEditingDomain(), resource.getContents(), list.get(0)); - final Command cmdAdd = new AddCommand(getEditingDomain(), resource.getContents(), eObject); - final CompoundCommand cmd = new CompoundCommand(Arrays.asList(cmdRemove, cmdAdd)); - getEditingDomain().getCommandStack().execute(cmd); - - for (final Entry<EObject, String> e : idMap.entrySet()) { - resource.setID(e.getKey(), e.getValue()); - } - } - - @Override - public EditingDomain getEditingDomain() { - return editingDomain; - } - - @Override - public boolean isSaveable() { - return true; - } - - @Override - public void addModelListener(ModelListener listener) { - listeners.add(listener); - } - - @Override - public void removeModelListener(ModelListener listener) { - listeners.remove(listener); - } - - @Override - public boolean isDirty() { - return ((BasicCommandStack) getEditingDomain().getCommandStack()).isSaveNeeded(); - } - - private void fireDirtyChanged() { - for (final ModelListener listener : listeners) { - listener.dirtyChanged(); - } - } - - private void fireCommandStackChanged() { - for (final ModelListener listener : listeners) { - listener.commandStackChanged(); - } - } - - @Override - public IStatus save() { - final Map<String, String> map = new HashMap<String, String>(); - try { - resource.save(map); - - final BasicCommandStack commandStack = (BasicCommandStack) getEditingDomain().getCommandStack(); - commandStack.saveIsDone(); - - fireDirtyChanged(); - fireCommandStackChanged(); - - } catch (final Exception e) { - // TODO: handle exception - e.printStackTrace(); - } - - return Status.OK_STATUS; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java deleted file mode 100644 index eea1dd0d..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java +++ /dev/null @@ -1,285 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010-2014 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Marco Descher <marco@descher.at> - Bug 422465 - * Steven Spungin <steven@spungin.tv> - Bug 437951, Bug 439709 - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.common.component; - -import java.util.Collections; -import java.util.List; -import javax.inject.Inject; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.core.di.annotations.Optional; -import org.eclipse.e4.core.services.nls.Translation; -import org.eclipse.e4.core.services.translation.TranslationService; -import org.eclipse.e4.tools.emf.ui.common.AbstractElementEditorContribution; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory; -import org.eclipse.e4.tools.emf.ui.internal.common.properties.ProjectOSGiTranslationProvider; -import org.eclipse.e4.tools.services.IClipboardService.Handler; -import org.eclipse.e4.tools.services.IResourcePool; -import org.eclipse.e4.tools.services.impl.ResourceBundleTranslationProvider; -import org.eclipse.e4.ui.model.application.MApplicationElement; -import org.eclipse.e4.ui.model.application.ui.MUILabel; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.custom.ScrolledComposite; -import org.eclipse.swt.events.ControlAdapter; -import org.eclipse.swt.events.ControlEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.Rectangle; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; - -public abstract class AbstractComponentEditor { - private static final String CSS_CLASS_KEY = "org.eclipse.e4.ui.css.CssClassName"; //$NON-NLS-1$ - - private WritableValue master = new WritableValue(); - - public static final int SEARCH_IMAGE = 0; - public static final int TABLE_ADD_IMAGE = 1; - public static final int TABLE_DELETE_IMAGE = 2; - public static final int ARROW_UP = 3; - public static final int ARROW_DOWN = 4; - - protected static final int VERTICAL_LIST_WIDGET_INDENT = 10; - - @Inject - private EditingDomain editingDomain; - @Inject - private ModelEditor editor; - @Inject - protected IResourcePool resourcePool; - - @Inject - @Optional - protected IProject project; - - @Inject - @Translation - protected Messages Messages; - - @Inject - @Optional - private ProjectOSGiTranslationProvider translationProvider; - - private Composite editorControl; - - private IdGenerator generator; - - public EditingDomain getEditingDomain() { - return editingDomain; - } - - public ModelEditor getEditor() { - return editor; - } - - public WritableValue getMaster() { - return master; - } - - protected void setElementId(Object element) { - if (getEditor().isAutoCreateElementId() && element instanceof MApplicationElement) { - MApplicationElement el = (MApplicationElement) element; - if (el.getElementId() == null || el.getElementId().trim().length() == 0) { - el.setElementId(Util.getDefaultElementId(((EObject) getMaster().getValue()).eResource(), el, getEditor().getProject())); - } - } - } - - public Image createImage(String key) { - return resourcePool.getImageUnchecked(key); - } - - public ImageDescriptor createImageDescriptor(String key) { - if (key == null) { - return null; - } - return ImageDescriptor.createFromImage(createImage(key)); - } - - public abstract Image getImage(Object element, Display display); - - public abstract String getLabel(Object element); - - public abstract String getDetailLabel(Object element); - - public abstract String getDescription(Object element); - - public Composite getEditor(Composite parent, Object object) { - if (generator != null) { - generator.stopGenerating(); - generator = null; - } - editorControl = doGetEditor(parent, object); - return editorControl; - } - - protected abstract Composite doGetEditor(Composite parent, Object object); - - public abstract IObservableList getChildList(Object element); - - public FeaturePath[] getLabelProperties() { - return new FeaturePath[] {}; - } - - public List<Action> getActions(Object element) { - return Collections.emptyList(); - } - - /** - * Translates an input <code>String</code> using the current - * {@link ResourceBundleTranslationProvider} and <code>locale</code> from - * the {@link TranslationService}. - * - * @param string - * the string to translate, may not be null. - * @return the translated string or the input string if it could not be - * translated. - */ - public String translate(String string) { - return ControlFactory.tr(translationProvider, string); - } - - /** - * @param element - * @return the list of actions that are populated in the import menu. Can be - * empty but is never null. - */ - public List<Action> getActionsImport(Object element) { - return Collections.emptyList(); - } - - protected String getLocalizedLabel(MUILabel element) { - return ControlFactory.getLocalizedLabel(translationProvider, element); - } - - private boolean isFocusChild(Control control) { - Control c = control; - while (c != null && c != editorControl) { - c = c.getParent(); - } - return c != null; - } - - public void handleCopy() { - if (editorControl != null) { - Control focusControl = editorControl.getDisplay().getFocusControl(); - - if (isFocusChild(focusControl) && focusControl.getData(ControlFactory.COPY_HANDLER) != null) { - ((Handler) focusControl.getData(ControlFactory.COPY_HANDLER)).copy(); - } - } - } - - public void handlePaste() { - if (editorControl != null) { - Control focusControl = editorControl.getDisplay().getFocusControl(); - - if (isFocusChild(focusControl) && focusControl.getData(ControlFactory.COPY_HANDLER) != null) { - ((Handler) focusControl.getData(ControlFactory.COPY_HANDLER)).paste(); - } - } - } - - public void handleCut() { - if (editorControl != null) { - Control focusControl = editorControl.getDisplay().getFocusControl(); - - if (isFocusChild(focusControl) && focusControl.getData(ControlFactory.COPY_HANDLER) != null) { - ((Handler) focusControl.getData(ControlFactory.COPY_HANDLER)).cut(); - } - } - } - - protected Composite createScrollableContainer(Composite parent) { - final ScrolledComposite scrolling = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL); - scrolling.setBackgroundMode(SWT.INHERIT_DEFAULT); - scrolling.setData(CSS_CLASS_KEY, "formContainer"); //$NON-NLS-1$ - - final Composite contentContainer = new Composite(scrolling, SWT.NONE); - - contentContainer.setData(CSS_CLASS_KEY, "formContainer"); //$NON-NLS-1$ - scrolling.setExpandHorizontal(true); - scrolling.setExpandVertical(true); - scrolling.setContent(contentContainer); - - scrolling.addControlListener(new ControlAdapter() { - @Override - public void controlResized(ControlEvent e) { - Rectangle r = scrolling.getClientArea(); - scrolling.setMinSize(contentContainer.computeSize(r.width, SWT.DEFAULT)); - } - }); - - scrolling.setLayoutData(new GridData(GridData.FILL_BOTH)); - - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - contentContainer.setLayout(gl); - - return contentContainer; - } - - protected void createContributedEditorTabs(CTabFolder folder, EMFDataBindingContext context, WritableValue master, Class<?> clazz) { - List<AbstractElementEditorContribution> contributionList = editor.getTabContributionsForClass(clazz); - - for (AbstractElementEditorContribution eec : contributionList) { - CTabItem item = new CTabItem(folder, SWT.BORDER); - item.setText(eec.getTabLabel()); - - Composite parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - eec.createContributedEditorTab(parent, context, master, getEditingDomain(), project); - } - - } - - /** - * Generates an ID when the another field changes. Must be called after - * master is set with the objects value. - * - * @param attSource - * The source attribute - * @param attId - * The id attribute to generate - * @param control - * optional control to disable generator after losing focus or - * disposing - */ - protected void enableIdGenerator(EAttribute attSource, EAttribute attId, Control control) { - if (generator != null) { - generator.stopGenerating(); - generator = null; - } - if (getEditor().isAutoCreateElementId()) { - generator = new IdGenerator(); - generator.bind(getMaster(), EMFEditProperties.value(getEditingDomain(), attSource), EMFEditProperties.value(getEditingDomain(), attId), control); - } - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/IdGenerator.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/IdGenerator.java deleted file mode 100644 index f9342c5a..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/IdGenerator.java +++ /dev/null @@ -1,163 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 437951 - *******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.common.component; - -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.eclipse.core.databinding.observable.value.IObservableValue; -import org.eclipse.core.databinding.observable.value.IValueChangeListener; -import org.eclipse.core.databinding.observable.value.ValueChangeEvent; -import org.eclipse.e4.tools.emf.ui.internal.common.component.tabs.empty.E; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.events.FocusAdapter; -import org.eclipse.swt.widgets.Control; - -/** - * Auto generates an id based on another field's current value. - * - * @author Steven Spungin - * - */ -public class IdGenerator { - - private IValueChangeListener listener; - private IObservableValue observableValue; - protected boolean ignore; - private IValueChangeListener listener2; - private IObservableValue observableValue2; - static Pattern patternId = Pattern.compile("^(.*\\.)\\d+$"); //$NON-NLS-1$ - - /** - * Bind must be called AFTER the master observable value is set in order to - * properly initialize. - * - * @param master - * @param ebpLabel - * @param evpId - * @param control - * Optional control. - */ - public void bind(final IObservableValue master, final IEMFEditValueProperty ebpLabel, - final IEMFEditValueProperty evpId, Control control) { - - // RULES - // Only start generating if the label is initially empty and the id ends - // with a '.' - // followed by an integer - // If the id is manually changed, stop generating - // If the control loses focus, stop generating - - final String origLabel = (String) ebpLabel.getValue(master.getValue()); - if (E.notEmpty(origLabel)) { - stopGenerating(); - return; - } - String origId = (String) evpId.getValue(master.getValue()); - if (origId == null) { - origId = "id.0"; //$NON-NLS-1$ - } - final Matcher m = patternId.matcher(origId); - if (!m.matches()) { - stopGenerating(); - return; - } - final String baseId = m.group(1); - - if (control != null) { - control.addFocusListener(new FocusAdapter() { - @Override - public void focusLost(org.eclipse.swt.events.FocusEvent e) { - stopGenerating(); - } - }); - - control.addDisposeListener(new DisposeListener() { - - @Override - public void widgetDisposed(DisposeEvent e) { - stopGenerating(); - } - }); - } - - observableValue2 = evpId.observe(master.getValue()); - observableValue2.addValueChangeListener(listener2 = new IValueChangeListener() { - - @Override - public void handleValueChange(ValueChangeEvent event) { - if (!ignore) { - stopGenerating(); - } - } - }); - - observableValue = ebpLabel.observe(master.getValue()); - observableValue.addValueChangeListener(listener = new IValueChangeListener() { - - @Override - public void handleValueChange(ValueChangeEvent event) { - String labelValue = (String) ebpLabel.getValue(master.getValue()); - if (labelValue == null) { - labelValue = ""; //$NON-NLS-1$ - } - final String camelCase = camelCase(labelValue); - ignore = true; - evpId.setValue(master.getValue(), baseId + camelCase); - ignore = false; - } - }); - - } - - /** - * Strips all illegal id characters, and camel cases each word. - * - * @param value - * @return - */ - protected static String camelCase(String value) { - final String[] parts = value.split("\\s+"); //$NON-NLS-1$ - String ret = ""; //$NON-NLS-1$ - boolean first = true; - for (String part : parts) { - part = part.replaceAll("[^0-9a-zA-Z_-]", ""); //$NON-NLS-1$ //$NON-NLS-2$ - if (first) { - first = false; - ret = part.toLowerCase(); - } else { - part = part.substring(0, 1).toUpperCase() + part.substring(1).toLowerCase(); - ret += part; - } - } - return ret; - } - - /** - * Removes all listeners and prevents the id from changing - */ - public void stopGenerating() { - if (observableValue != null) { - observableValue.removeValueChangeListener(listener); - listener = null; - observableValue = null; - } - if (observableValue2 != null) { - observableValue2.removeValueChangeListener(listener2); - listener2 = null; - observableValue2 = null; - } - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java deleted file mode 100644 index 360ab30f..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ /dev/null @@ -1,798 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010-2014 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Marco Descher <marco@descher.at> - Bug 395982, 396975, 426653 - * Steven Spungin <steven@spungin.tv> - Bug 431735, 430717 - * Jonas Helming <jhelming@eclipsesource.com - Bug 444340 - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal; - -public class Messages { - - public String PartEditor_InputPart; - public String XmiTab_TypeTextToSearch; - public String ModelEditor_Import3x; - public String E4StringPickList_Replace; - public String MarkDuplicateAttributesHandler_MarkDuplicates; - public String MarkDuplicateAttributesHandler_SelectAnAttributeToMarkeDuplicate; - public String VCommandEditor_ImportCommands; - public String VPartDescriptor_Editors; - public String VPartDescriptor_ViewAsCompatibilityView; - public String VPartDescriptor_Views; - public String VWindowSharedElementsEditor_Editors; - public String VWindowSharedElementsEditor_ViewAsCompatibilityView; - public String VWindowSharedElementsEditor_Views; - - public String ApplicationEditor_BindingTable; - public String ApplicationEditor_Class; - public String ApplicationEditor_Command_Slash_Handler; - public String ApplicationEditor_HandledMenuItem; - public String ApplicationEditor_HandledToolbarItem; - public String ApplicationEditor_HandlerAndCommand; - public String ApplicationEditor_Icon; - public String ApplicationEditor_Id; - public String ApplicationEditor_InertInfosForAHandledMenuItem; - public String ApplicationEditor_InsertInfosForAToolbarItem; - public String ApplicationEditor_InsertInfosForCommandAndHandler; - public String ApplicationEditor_InsertInfosForKeybinding; - public String ApplicationEditor_Keybinding; - public String ApplicationEditor_Menu; - public String ApplicationEditor_Name; - public String ApplicationEditor_Parent; - public String ApplicationEditor_Sequence; - public String ApplicationEditor_Toolbar; - public String ApplicationEditor_Type; - public String PartStackEditor_CompositePart; - public String PartStackEditor_Editors; - public String PartStackEditor_Part; - public String PartStackEditor_Placeholder; - public String PartStackEditor_Views; - - public static String FilteredContributionDialog_SearchWasCancelled; - public static String FilteredContributionDialog_MoreThan; - public static String FilteredContributionDialog_itemsWereFound; - public static String FilteredContributionDialog_ProviderInitializing; - public static String FilteredContributionDialog_ProviderWasCancelled; - public static String FilteredContributionDialog_ClearCache; - public static String FilteredContributionDialog_ContributionSearch; - public static String FilteredContributionDialog_Scope; - public static String FilteredContributionDialog_ProjectOnly; - public static String FilteredContributionDialog_ProjectAndReferences; - public static String FilteredContributionDialog_Workspace; - public static String FilteredContributionDialog_TargetPlatform; - public static String FilteredContributionDialog_ScopeFilter; - public static String FilteredContributionDialog_None; - public static String FilteredContributionDialog_Package; - public static String FilteredContributionDialog_Location; - public static String FilteredContributionDialog_NonBundles; - public static String FilteredContributionDialog_SelectTheBundle; - public static String FilteredContributionDialog_SelectThePackage; - public static String FilteredContributionDialog_PackageFilter; - public static String FilteredContributionDialog_SelectTheLocation; - public static String FilteredContributionDialog_LocationFilter; - public static String FilteredContributionDialog_Java; - public static String FilteredContributionDialog_ResourceIsNotContainedInABundle; - public static String FilteredContributionDialog_ResourceIsNotReferencedByThisBundle; - public static String FilteredContributionDialog_Bundle; - public static String FilteredContributionDialog_BundleFilter; - public static String FilteredContributionDialog_Searching; - public String AreaIconDialogEditor_Icon; - public String AreaIconDialogEditor_Enter_Text; - public String AbstractIconDialogWithHardcodedScope_Project; - public String AbstractIconDialogWithHardcodedScope_Workspace; - public String AbstractIconDialog_Icon_Name; - public String AbstractIconDialog_Type_To_Start_Search; - public static String ContributionURIValidator_Malformed_URI; - public static String ContributionURIValidator_No_Empty_URI; - public static String ContributionURIValidator_URI_starts_with_platform; - - public String ModelTooling_Empty_Warning; - public String ModelTooling_Common_Up; - public String ModelTooling_Common_Down; - public String ModelTooling_Common_AddEllipsis; - public String ModelTooling_Common_Add; - public String ModelTooling_Common_Remove; - public String ModelTooling_Common_Replace; - public String ModelTooling_Common_Id; - public String ModelTooling_Common_RefId; - public String ModelTooling_Common_FindEllipsis; - public String ModelTooling_Common_TabDefault; - public String ModelTooling_Common_TabSupplementary; - public String ModelEditor_AddChild; - public String ModelTooling_Common_RuntimeContributionInstance; - public String ModelTooling_Common_RuntimeWidgetTree; - - public String ModelTooling_UIElement_ToBeRendered; - public String ModelTooling_UIElement_Visible; - public String ModelTooling_UIElement_VisibleWhen; - public String ModelTooling_UIElement_AccessibilityPhrase; - - public String ModelTooling_Context_Variables; - public String ModelTooling_Context_Variables_Tooltip; - public String ModelTooling_Context_Properties; - - public String ModelTooling_ApplicationElement_Tags; - public String ModelTooling_Contribution_PersistedState; - - public String AbstractCommandSelectionDialog_Label_CommandId; - - public String ApplicationEditor_Label; - public String ApplicationEditor_Description; - public String ApplicationEditor_Handlers; - public String ApplicationEditor_PartDescriptors; - public String ApplicationEditor_BindingTables; - public String ApplicationEditor_Commands; - public String ApplicationEditor_Windows; - public String ApplicationEditor_Addons; - public String ApplicationEditor_MenuContributions; - public String ApplicationEditor_Snippets; - public String ApplicationEditor_ToolBarContributions; - public String ApplicationEditor_TrimContributions; - public String ApplicationEditor_RootContexts; - public String ApplicationEditor_BindingContexts; - public String ApplicationEditor_Categories; - - public String BindingTableEditor_Label; - public String BindingTableEditor_Description; - public String BindingTableEditor_ContextId; - public String BindingTableEditor_Keybindings; - public String BindingTableEditor_KeySequence; - public String BindingTableEditor_Command; - public String BindingTableEditor_AddKeyBinding; - - public String CommandEditor_Label; - public String CommandEditor_Description; - public String CommandEditor_Name; - public String CommandEditor_LabelDescription; - public String CommandEditor_Parameters; - public String CommandEditor_ParameterName; - public String CommandEditor_ParameterTypeId; - public String CommandEditor_ParameterOptional; - public String CommandEditor_ParameterOptional_No; - public String CommandEditor_ParameterOptional_Yes; - public String CommandEditor_ParameterId; - public String CommandEditor_Category; - public String CommandEditor_AddCommandParameter; - public String CommandEditor_NewCommandParameter; - - public String DirectMenuItemEditor_Label; - public String DirectMenuItemEditor_Description; - public String DirectMenuItemEditor_ClassURI; - - public String ControlFactory_Key; - public String ControlFactory_Value; - public String ControlFactory_KeyValueShellTitle; - - public String DirectToolItemEditor_ClassURI; - public String DirectToolItemEditor_Label; - public String DirectToolItemEditor_Description; - - public String HandledMenuItemEditor_Label; - public String HandledMenuItemEditor_Description; - public String HandledMenuItemEditor_Command; - public String HandledMenuItemEditor_Parameters; - public String HandledMenuItemEditor_Tag; - public String HandledMenuItemEditor_Value; - - public String DynamicMenuContributionEditor_Label; - public String DynamicMenuContributionEditor_Description; - - public String DynamicMenuContributionEditor_ClassURI; - public String DynamicMenuContributionEditor_LabelLabel; - - public String HandledToolItemEditor_Command; - public String HandledToolItemEditor_Parameters; - public String HandledToolItemEditor_ParametersName; - public String HandledToolItemEditor_ParametersValue; - public String HandledToolItemEditor_Label; - public String HandledToolItemEditor_Description; - - public String HandlerEditor_Label; - public String HandlerEditor_Description; - public String HandlerEditor_Command; - public String HandlerEditor_ClassURI; - - public String KeyBindingEditor_Label; - public String KeyBindingEditor_Description; - public String KeyBindingEditor_Sequence; - public String KeyBindingEditor_Command; - public String KeyBindingEditor_Parameters; - public String KeyBindingEditor_SequenceNotComplete; - public String KeyBindingEditor_SequenceEmpty; - public String KeyBindingEditor_AddParameter; - - public String MenuEditor_Label; - public String MenuEditor_Label_ViewMenu; - public String MenuEditor_Description; - public String MenuEditor_MenuItems; - public String MenuEditor_MenuItemType; - public String MenuEditor_MenuItemItemType; - public String MenuEditor_HandledMenuItem; - public String MenuEditor_DynamicMenuContribution; - public String MenuEditor_Separator; - public String MenuEditor_Menu; - public String MenuEditor_DirectMenuItem; - public String MenuEditor_LabelLabel; - public String MenuEditor_Tooltip; - public String MenuEditor_IconURI; - public String MenuEditor_Children; - public String MenuEditor_Mnemonics; - public String MenuEditor_AddHandledMenuItem; - public String MenuEditor_AddMenu; - public String MenuEditor_AddDirectMenuItem; - public String MenuEditor_AddSeparator; - public String MenuEditor_AddDynamicMenuContribution; - public String MenuEditor_AddCoreExpression; - - public String MenuItemEditor_Type; - public String MenuItemEditor_Label; - public String MenuItemEditor_Tooltip; - public String MenuItemEditor_IconURI; - public String MenuEditor_MainMenu; - public String MenuItemEditor_Enabled; - public String MenuItemEditor_Selected; - public String MenuItemEditor_Mnemonics; - public String MenuItemEditor_NoExpression; - public String MenuItemEditor_AddCoreExpression; - - public String MenuSeparatorEditor_Label; - - public String PartDescriptorEditor_Label; - public String PartDescriptorEditor_Descriptor; - public String PartDescriptorEditor_LabelLabel; - public String PartDescriptorEditor_Tooltip; - public String PartDescriptorEditor_IconURI; - public String PartDescriptorEditor_ClassURI; - public String PartDescriptorEditor_Dirtyable; - public String PartDescriptorEditor_Closeable; - public String PartDescriptorEditor_Multiple; - public String PartDescriptorEditor_Category; - public String PartDescriptorEditor_Variables; - public String PartDescriptorEditor_Properties; - public String PartDescriptorEditor_PropertiesKey; - public String PartDescriptorEditor_PropertiesValue; - public String PartDescriptorEditor_Menus; - public String PartDescriptorEditor_Handlers; - public String PartDescriptorEditor_ContainerData; - - public String PartEditor_Label; - public String PartEditor_Description; - public String PartEditor_LabelLabel; - public String PartEditor_Tooltip; - public String PartEditor_IconURI; - public String PartEditor_IconURI_Tooltip; - public String PartEditor_ClassURI; - public String PartEditor_Closeable; - public String PartEditor_Closeable_Tooltip; - public String PartEditor_Menus; - public String PartEditor_Handlers; - public String PartEditor_ContainerData; - public String PartEditor_ToolBar; - public String PartEditor_BindingContexts; - - public String PartSashContainerEditor_Label; - public String PartSashContainerEditor_Description; - public String PartSashContainerEditor_Orientation; - public String PartSashContainerEditor_Vertical; - public String PartSashContainerEditor_Horizontal; - public String PartSashContainerEditor_SelectedElement; - public String PartSashContainerEditor_Controls; - public String PartSashContainerEditor_ContainerData; - public String PartSashContainerEditor_AddPartSashContainer; - public String PartSashContainerEditor_AddPartStack; - public String PartSashContainerEditor_AddPart; - public String PartSashContainerEditor_AddArea; - public String PartSashContainerEditor_AddPlaceholder; - - public String PartStackEditor_Label; - public String PartStackEditor_Description; - public String PartStackEditor_SelectedElement; - public String PartStackEditor_Parts; - public String PartStackEditor_ContainerData; - public String PartStackEditor_AddPart; - public String PartStackEditor_AddPlaceholder; - public String PartStackEditor_AddCompositePart; - - public String PerspectiveEditor_Label; - public String PerspectiveEditor_Description; - public String PerspectiveEditor_LabelLabel; - public String PerspectiveEditor_SelectedElement; - public String PerspectiveEditor_Tooltip; - public String PerspectiveEditor_IconURI; - public String PerspectiveEditor_Controls; - public String PerspectiveEditor_AddPartSashContainer; - public String PerspectiveEditor_AddPartStack; - public String PerspectiveEditor_AddPart; - public String PerspectiveEditor_AddArea; - public String PerspectiveEditor_AddPlaceholder; - - public String PerspectiveStackEditor_Perspectives; - public String PerspectiveStackEditor_Label; - public String PerspectiveStackEditor_Description; - public String PerspectiveStackEditor_SelectedElement; - public String PerspectiveStackEditor_AddPerspective; - - public String PlaceholderEditor_Label; - public String PlaceholderEditor_Descriptor; - public String PlaceholderEditor_Reference; - public String PlaceholderEditor_Closeable; - public String PlaceholderEditor_ContainerData; - - public String ToolBarEditor_Label; - public String ToolBarEditor_Description; - public String ToolBarEditor_ToolbarItems; - public String ToolBarEditor_ToolbarItemsType; - public String ToolBarEditor_ToolbarItemsItemType; - public String ToolBarEditor_HandledToolItem; - public String ToolBarEditor_DirectToolItem; - public String ToolBarEditor_ToolControl; - public String ToolBarEditor_Separator; - public String ToolBarEditor_AddHandledToolItem; - public String ToolBarEditor_AddDirectToolItem; - public String ToolBarEditor_AddToolControl; - public String ToolBarEditor_AddToolBarSeparator; - - public String ToolBarSeparatorEditor_Label; - - public String ToolControlEditor_Label; - public String ToolControlEditor_Description; - public String ToolControlEditor_ClassURI; - - public String DialogEditor_Label; - - public String WizardDialogEditor_Label; - - public String VBindingTableEditor_Label; - public String VBindingTableEditor_Description; - public String VBindingTableEditor_Contexts; - public String VBindingTableEditor_Name; - public String VBindingTableEditor_LabelDescription; - public String VBindingTableEditor_BindingTables; - public String VBindingTableEditor_AddBindingTable; - - public String AddonsEditor_ClassURI; - public String AddonsEditor_TreeLabel; - public String AddonsEditor_TreeLabelDescription; - public String AddonsEditor_Tags; - - public String ContributionClassDialog_DialogMessage; - public String ContributionClassDialog_DialogTitle; - public String ContributionClassDialog_Label_Classname; - public String ContributionClassDialog_FilterText_Message; - public String ContributionClassDialog_ShellTitle; - - public String MenuContributionEditor_MenuItems; - public String MenuContributionEditor_MenuItemType; - public String MenuContributionEditor_MenuItemItemType; - public String MenuContributionEditor_HandledMenuItem; - public String MenuContributionEditor_DynamicMenuContribution; - public String MenuContributionEditor_Separator; - public String MenuContributionEditor_Menu; - public String MenuContributionEditor_DirectMenuItem; - public String MenuContributionEditor_ParentId; - public String MenuContributionEditor_Position; - public String MenuContributionEditor_TreeLabel; - public String MenuContributionEditor_TreeLabelDescription; - - public String ModelFragmentsEditor_ModelFragments; - public String ModelFragmentsEditor_Label; - public String ModelFragmentsEditor_Description; - public String ModelFragmentsEditor_Imports; - - public String StringModelFragment_Label; - public String StringModelFragment_Description; - public String StringModelFragment_Featurename; - public String StringModelFragment_ParentId; - public String StringModelFragment_PositionInList; - public String StringModelFragment_Elements; - - public String FeatureSelectionDialog_Filter; - public String FeatureSelectionDialog_ShellTitle; - public String FeatureSelectionDialog_DialogTitle; - public String FeatureSelectionDialog_DialogMessage; - - public String CategoryEditor_TreeLabel; - public String CategoryEditor_TreeLabelDescriptor; - public String CategoryEditor_Name; - public String CategoryEditor_Description; - public String CategoryEditor_Tags; - - public String CommandCategorySelectionDialog_LabelCategoryId; - - public String BindingContextSelectionDialog_LabelContextId; - - public String ComponentLabelProvider_invisible; - public String ComponentLabelProvider_notrendered; - - public String BindingContextEditor_TreeLabel; - public String BindingContextEditor_TreeLabelDescription; - public String BindingContextEditor_Name; - public String BindingContextEditor_Description; - public String BindingContextEditor_Subcontexts; - public String BindingContextEditor_AddContext; - public String BindingContextEditor_NameWarning; - - public String CommandParameterEditor_TreeLabel; - public String CommandParameterEditor_TreeLabelDescritpion; - public String CommandParameterEditor_Name; - public String CommandParameterEditor_TypeId; - public String CommandParameterEditor_Optional; - - public String ParameterEditor_TreeLabel; - public String ParameterEditor_TreeLabelDescription; - public String ParameterEditor_Command_Parameter_ID; - public String ParameterEditor_Value; - - public String ParameterIdSelectionDialog_ShellTitle; - public String ParameterIdSelectionDialog_DialogTitle; - public String ParameterIdSelectionDialog_DialogMessage; - public String ParameterIdSelectionDialog_LabelText; - - public String PopupMenuEditor_TreeLabel; - public String PopupMenuEditor_TreeLabelDescription; - - public String ToolBarContributionEditor_TreeLabel; - public String ToolBarContributionEditor_TreeLabelDescription; - - public String ToolItemEditor_Type; - public String ToolItemEditor_Label; - public String ToolItemEditor_ToolTip; - public String ToolItemEditor_IconURI; - public String ToolItemEditor_Enabled; - public String ToolItemEditor_Selected; - public String ToolItemEditor_NoExpression; - public String ToolItemEditor_Menu; - - public String TrimBarEditor_TreeLabel; - public String TrimBarEditor_TreeLabelDescription; - public String TrimBarEditor_Side; - public String TrimBarEditor_Controls; - public String TrimBarEditor_AddToolBar; - public String TrimBarEditor_AddToolControl; - - public String TrimContributionEditor_TreeLabel; - public String TrimContributionEditor_TreeLabelDescription; - public String TrimContributionEditor_ParentId; - public String TrimContributionEditor_Position; - public String TrimContributionEditor_Controls; - - public String TrimmedWindowEditor_TrimBars; - public String TrimmedWindowEditor_TreeLabel; - - public String WindowEditor_AddMainMenu; - public String WindowEditor_TreeLabel; - public String WindowEditor_TreeLabelDescription; - - public String WindowEditor_Bounds; - public String WindowEditor_Label; - public String WindowEditor_Tooltip; - public String WindowEditor_IconURI; - public String WindowEditor_MainMenu; - public String WindowEditor_SelectedElement; - public String WindowEditor_BindingContexts; - public String WindowEditor_Handlers; - public String WindowEditor_Windows; - public String WindowEditor_Controls; - public String WindowEditor_SharedElements; - - public String VApplicationAddons_AddAddon; - public String VApplicationAddons_TreeLabel; - public String VApplicationAddons_TreeLabelDescription; - public String VApplicationAddons_Commands; - - public String VApplicationCategoriesEditor_TreeLabel; - public String VApplicationCategoriesEditor_TreeLabelDescription; - public String VApplicationCategoriesEditor_Categories; - public String VApplicationCategoriesEditor_AddCategory; - - public String VCommandEditor_TreeLabel; - public String VCommandEditor_TreeLabelDescription; - public String VCommandEditor_Commands; - public String VCommandEditor_AddCommand; - - public String VHandlerEditor_TreeLabel; - public String VHandlerEditor_TreeLabelDescription; - public String VHandlerEditor_Handlers; - public String VHandlerEditor_AddHandler; - - public String VMenuContributionsEditor_TreeLabel; - public String VMenuContributionsEditor_TreeLabelDescription; - public String VMenuContributionsEditor_MenuContributions; - public String VMenuContributionsEditor_AddMenuContribution; - - public String VMenuEditor_TreeLabel; - public String VMenuEditor_TreeLabelDescription; - public String VMenuEditor_Menus; - public String VMenuEditor_AddMenuContribution; - public String VMenuEditor_AddPopupMenuContribution; - - public String VModelFragmentsEditor_TreeLabel; - public String VModelFragmentsEditor_TreeLabelDescription; - public String VModelFragmentsEditor_Fragments; - public String VModelFragmentsEditor_AddFragment; - - public String VModelImportsEditor_TreeLabel; - public String VModelImportsEditor_TreeLabelDescription; - public String VModelImportsEditor_Imports; - - public String VPartDescriptor_TreeLabel; - public String VPartDescriptor_TreeLabelDescription; - public String VPartDescriptor_Descriptors; - public String VPartDescriptor_AddPartDescriptor; - - public String VSnippetsEditor_Snippets; - - public String VToolBarContributionsEditor_Contributions; - public String VToolBarContributionsEditor_TreeLabelDescription; - public String VToolBarContributionsEditor_TreeLabel; - public String VToolBarContributionsEditor_AddToolBarContribution; - - public String VTrimContributionsEditor_TreeLabel; - public String VTrimContributionsEditor_TreeLabelDescription; - public String VTrimContributionsEditor_Contributions; - public String VTrimContributionsEditor_AddTrimContribution; - - public String VWindowControlEditor_TreeLabel; - public String VWindowControlEditor_TreeLabelDescription; - public String VWindowControlEditor_Controls; - public String VWindowControlEditor_AddPerspectiveStack; - public String VWindowControlEditor_AddPartSashContainer; - public String VWindowControlEditor_AddPartStack; - public String VWindowControlEditor_AddPart; - public String VWindowControlEditor_AddArea; - - public String VWindowEditor_TreeLabel; - public String VWindowEditor_TreeLabelDescription; - public String VWindowEditor_Windows; - public String VWindowEditor_AddTrimmedWindow; - public String VWindowEditor_AddWindow; - public String VWindowEditor_AddDialog; - public String VWindowEditor_AddWizardDialog; - - public String VWindowSharedElementsEditor_TreeLabel; - public String VWindowSharedElementsEditor_TreeLabelDescription; - public String VWindowSharedElementsEditor_Controls; - public String VWindowSharedElementsEditor_AddPartSashContainer; - public String VWindowSharedElementsEditor_AddPart; - - public String VWindowTrimEditor_TreeLabel; - public String VWindowTrimEditor_TreeLabelDescription; - public String VWindowTrimEditor_Controls; - public String VWindowTrimEditor_AddWindowTrim; - - public String AbstractIconDialog_IconName; - public String AbstractIconDialog_all_workspace_bundles; - public String AbstractIconDialog_current_project; - public String AbstractIconDialog_scope; - - public static String AbstractIconDialogWithScopeAndFilter_details; - public static String AbstractIconDialogWithScopeAndFilter_icon; - public static String AbstractIconDialogWithScopeAndFilter_iconName; - public static String AbstractIconDialogWithScopeAndFilter_maxDisplayedImageSize; - public static String AbstractIconDialogWithScopeAndFilter_typeToStartSearch; - - public String BindingContextSelectionDialog_ShellTitle; - public String BindingContextSelectionDialog_Title; - public String BindingContextSelectionDialog_Message; - public String BindingContextSelectionDialog_NoIdReference; - - public String CommandCategorySelectionDialog_ShellTitle; - public String CommandCategorySelectionDialog_Title; - public String CommandCategorySelectionDialog_Message; - - public String FindImportElementDialog_ShellTitle; - public String FindImportElementDialog_Title; - public String FindImportElementDialog_Message; - public String FindImportElementDialog_Search; - public String FindImportElementDialog_ClearCache; - public String FindImportElementDialog_NoIdReference; - public String FindImportElementDialog_noId; - - public String FindParentReferenceElementDialog_ShellTitle; - public String FindParentReferenceElementDialog_Title; - public String FindParentReferenceElementDialog_Message; - public String FindParentReferenceElementDialog_ContainerType; - public String FindParentReferenceElementDialog_Search; - public String FindParentReferenceElementDialog_NoId; - public String FindParentReferenceElementDialog_ClearCache; - public String FindParentReferenceElementDialog_NoReferenceId; - - public String HandledMenuItemCommandSelectionDialog_ShellTitle; - public String HandledMenuItemCommandSelectionDialog_DialogTitle; - public String HandledMenuItemCommandSelectionDialog_DialogMessage; - - public String HandledToolItemCommandSelectionDialog_ShellTitle; - public String HandledToolItemCommandSelectionDialog_DialogTitle; - public String HandledToolItemCommandSelectionDialog_DialogMessage; - - public String HandlerCommandSelectionDialog_ShellTitle; - public String HandlerCommandSelectionDialog_DialogTitle; - public String HandlerCommandSelectionDialog_DialogMessage; - - public String KeyBindingCommandSelectionDialog_ShellTitle; - public String KeyBindingCommandSelectionDialog_DialogTitle; - public String KeyBindingCommandSelectionDialog_DialogMessage; - - public String MenuIconDialogEditor_ShellTitle; - public String MenuIconDialogEditor_DialogTitle; - public String MenuIconDialogEditor_DialogMessage; - - public String MenuItemIconDialogEditor_ShellTitle; - public String MenuItemIconDialogEditor_DialogTitle; - public String MenuItemIconDialogEditor_DialogMessage; - - public String PartDescriptorIconDialogEditor_ShellTitle; - public String PartDescriptorIconDialogEditor_DialogTitle; - public String PartDescriptorIconDialogEditor_DialogMessage; - - public String PartIconDialogEditor_ShellTitle; - public String PartIconDialogEditor_DialogTitle; - public String PartIconDialogEditor_DialogMessage; - - public String PerspectiveIconDialogEditor_ShellTitle; - public String PerspectiveIconDialogEditor_DialogTitle; - public String PerspectiveIconDialogEditor_DialogMessage; - - public String SharedElementsDialog_ShellTitle; - public String SharedElementsDialog_Title; - public String SharedElementsDialog_Message; - public String SharedElementsDialog_Name; - - public String ToolItemIconDialogEditor_ShellTitle; - public String ToolItemIconDialogEditor_DialogTitle; - public String ToolItemIconDialogEditor_DialogMessage; - - public String WindowIconDialogEditor_ShellTitle; - public String WindowIconDialogEditor_DialogTitle; - public String WindowIconDialogEditor_DialogMessage; - - public String ImageTooltip_UnknownError; - public String ImageTooltip_FileNotFound; - public String ImageTooltip_Icon; - public String ImageTooltip_Name; - public String ImageTooltip_Dimension; - public String ImageTooltip_FileSize; - - public String VItemParametersEditor_TreeLabel; - public String VItemParametersEditor_TreeLabelDescription; - public String VItemParametersEditor_Parameters; - public String VItemParametersEditor_AddParameter; - - public String CoreExpressionEditor_TreeLabel; - public String CoreExpressionEditor_TreeLabelDescription; - public String CoreExpressionEditor_ExpressionId; - - public String ExpressionIdDialog_ShellTitle; - public String ExpressionIdDialog_DialogTitle; - public String ExpressionIdDialog_DialogMessage; - public String ExpressionIdDialog_Id; - - public String MenuIdDialog_ShellTitle; - public String MenuIdDialog_DialogTitle; - public String MenuIdDialog_DialogMessage; - public String MenuIdDialog_Id; - - public String ToolBarIdDialog_ShellTitle; - public String ToolBarIdDialog_DialogTitle; - public String ToolBarIdDialog_DialogMessage; - public String ToolBarIdDialog_Id; - - public String TrimBarIdDialog_ShellTitle; - public String TrimBarIdDialog_DialogTitle; - public String TrimBarIdDialog_DialogMessage; - public String TrimBarIdDialog_Id; - - public String CommandToStringConverter_None; - - public String VRootBindingContexts_AddContext; - public String VRootBindingContexts_TreeLabel; - public String VRootBindingContexts_TreeLabelDescription; - public String VRootBindingContexts_Contexts; - - public String AreaEditor_Label; - public String AreaEditor_Description; - public String AreaEditor_Orientation; - public String AreaEditor_Horizontal; - public String AreaEditor_SelectedElement; - public String AreaEditor_ContainerData; - public String AreaEditor_Controls; - public String AreaEditor_Vertical; - public String AreaEditor_LabelLabel; - public String AreaEditor_Tooltip; - public String AreaEditor_IconURI; - - public String AreaIconDialogEditor_ShellTitle; - public String AreaIconDialogEditor_DialogTitle; - public String AreaIconDialogEditor_DialogMessage; - - public String ModelEditor_Delete; - public String ModelEditor_ExpandSubtree; - public String ModelEditor_Form; - public String ModelEditor_XMI; - public String ModelEditor_ExternalizeStrings; - public String ModelEditor_ExportIds; - public String ModelEditor_Script; - public String ModelEditor_ShowControl; - - public String ExternalizeStringHandler_Dialog_ElementName; - public String ExternalizeStringHandler_Dialog_AttributeName; - public String ExternalizeStringHandler_Dialog_Key; - public String ExternalizeStringHandler_Dialog_Value; - public String ExternalizeStringHandler_Dialog_ShellTitle; - public String ExternalizeStringHandler_Dialog_DialogTitle; - public String ExternalizeStringHandler_Dialog_DialogMessage; - - public String ExportIdsHandler_Dialog_ElementName; - public String ExportIdsHandler_Dialog_Key; - public String ExportIdsHandler_Dialog_Id_Value; - public String ExportIdsHandler_Dialog_ShellTitle; - public String ExportIdsHandler_Dialog_DialogTitle; - public String ExportIdsHandler_Dialog_DialogMessage; - public String ExportIdsHandler_Dialog_SelectProject; - - public String ObjectViewer_Tooltip_Value; - public String ObjectViewer_Tooltip_InjectionKey; - public String ObjectViewer_Script; - - public String CommandWizard_ShellTitle; - public String VWindowSharedElementsEditor_AddPartStack; - public String Special_UnknownElement; - public String Special_UnknownElement_Detail; - public String VWindowSharedElementsEditor_Area; - public String ModelEditor_ExtractFragment; - public String ModelEditor_ExtractFragment_NoParentId; - public String KeyBindingEditor_SequenceLowercase; - public String ModelTooling_CommandId_tooltip; - - public String ModelEditor_goto_list; - public String ModelEditor_goto_xmi; - public String ListTab_0; - public String ListTab_1; - public String ListTab_2; - public String ListTab_3; - public String ListTab_4; - public String ListTab_5; - public String ListTab_6; - public String ListTab_7; - public String ListTab_8; - public String ListTab_9; - public String ListTab_col_id; - public String ListTab_col_item; - public String ListTab_col_label; - public String ListTab_col_go; - - public String ListTab_addColumn; - public String ListTab_filterByAttribute; - public String ListTab_filterByItem; - public String ListTab_mark; - public String ListTab_markAttribute; - public String ListTab_removeFilter; - public String ListTab_resetColumns; - public String ListTab_selectAnAttribute; - public String ListTab_selectAType; - - public String CompositePartEditor_AddPartSashContainer; - public String CompositePartEditor_AddPartStack; - public String CompositePartEditor_AddPart; - public String CompositePartEditor_AddArea; - public String CompositePartEditor_AddPlaceholder; - public String CompositePartEditor_Label; - public String CompositePartEditor_Description; - public String CompositePartEditor_Orientation; - public String CompositePartEditor_Horizontal; - public String CompositePartEditor_Vertical; - public String CompositePartEditor_SelectedElement; - public String CompositePartEditor_ContainerData; - public String CompositePartEditor_Controls; - public String CompositePartEditor_LabelLabel; - public String CompositePartEditor_Tooltip; - public String CompositePartEditor_IconURI; - public String CompositePartEditor_IconURI_Tooltip; - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties deleted file mode 100644 index 85a19005..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ /dev/null @@ -1,806 +0,0 @@ -# ****************************************************************************** -# * Copyright (c) 2010-2014 BestSolution.at and others. -# * All rights reserved. This program and the accompanying materials -# * are made available under the terms of the Eclipse Public License v1.0 -# * which accompanies this distribution, and is available at -# * http://www.eclipse.org/legal/epl-v10.html -# * -# * Contributors: -# * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation -# * Sopot Cela <sopotcela@gmail.com> - enhancements -# * Marco Descher <marco@descher.at> - Bug 395982, 396975, 426653 -# * Steven Spungin <steven@spungin.tv> - Bug 431735, 430717, Ongoing Maintenance -# * Lars Vogel <Lars.Vogel@gmail.com> - Bug 440159 -# ****************************************************************************** - -PartEditor_InputPart=Input Part -XmiTab_TypeTextToSearch0=type text to search (press <ENTER> to search for next instance) -ModelEditor_Import3x=Import 3x -E4StringPickList_Replace=Replace -MarkDuplicateAttributesHandler_MarkDuplicates=Mark Duplicates -MarkDuplicateAttributesHandler_SelectAnAttributeToMarkeDuplicate=Select an attribute to mark duplicate values -VCommandEditor_ImportCommands=Import Commands -VPartDescriptor_Editors=Editors -VPartDescriptor_ViewAsCompatibilityView=View as CompatibilityView -VPartDescriptor_Views=Views -VWindowSharedElementsEditor_Editors=Editors -VWindowSharedElementsEditor_ViewAsCompatibilityView=View as CompatibilityView -VWindowSharedElementsEditor_Views=Views - - -ModelTooling_Common_Up=Up -ModelTooling_Common_Down=Down -ModelTooling_Common_AddEllipsis=Add -ModelTooling_Common_Add=Add -ModelTooling_Common_Remove=Remove -ModelTooling_Common_Replace=Replace -ModelTooling_Common_Id=ID -ModelTooling_Common_RefId=Reference-ID -ModelTooling_Common_FindEllipsis=Find ... -ModelTooling_Common_TabDefault=Default -ModelTooling_Common_TabSupplementary=Supplementary -ModelEditor_AddChild=Add child -ModelTooling_Common_RuntimeContributionInstance=Contrib. Instance -ModelTooling_Common_RuntimeWidgetTree=Widget Tree - -ModelTooling_UIElement_ToBeRendered=To Be Rendered -ModelTooling_UIElement_Visible=Visible -ModelTooling_UIElement_VisibleWhen=Visible-When Expression -ModelTooling_UIElement_AccessibilityPhrase=Accessibility Phrase - -ModelTooling_Context_Variables=Variables -ModelTooling_Context_Variables_Tooltip=Declares the following variables to be modifiable in the local IEclipseContext (non-modifiable context variables will cause an IllegalArgumentException to be thrown if a modification attempt by a descendant context is made). -ModelTooling_Context_Properties=Context Properties - -ModelTooling_ApplicationElement_Tags=Tags - -ModelTooling_Contribution_PersistedState=Persisted State - -ModelTooling_Empty_Warning=Value must not be empty - -AbstractCommandSelectionDialog_Label_CommandId=Command-ID - -ApplicationEditor_Label=Application -ApplicationEditor_Description=Application bla, bla, bla -ApplicationEditor_Handlers=Handlers -ApplicationEditor_PartDescriptors=Part Descriptors -ApplicationEditor_BindingTables=BindingTables -ApplicationEditor_Commands=Commands -ApplicationEditor_Windows=Windows and Dialogs -ApplicationEditor_Addons=Add-ons -ApplicationEditor_MenuContributions=Menu Contributions -ApplicationEditor_Snippets=Snippets -ApplicationEditor_ToolBarContributions=Toolbar Contributions -ApplicationEditor_TrimContributions=Trim Contributions -ApplicationEditor_RootContexts=Binding Contexts -ApplicationEditor_BindingContexts=Binding Contexts -ApplicationEditor_Categories=Command Categories -ApplicationEditor_BindingTable=Binding Table -ApplicationEditor_Class=Class -ApplicationEditor_Command_Slash_Handler=Command/Handler -ApplicationEditor_HandledMenuItem=Handled Menu Item -ApplicationEditor_HandledToolbarItem=Handled Toolbar Item -ApplicationEditor_HandlerAndCommand=Handler and Command -ApplicationEditor_Icon=Icon -ApplicationEditor_Id=Id -ApplicationEditor_InertInfosForAHandledMenuItem=Insert informations for a Handled Menu Item -ApplicationEditor_InsertInfosForAToolbarItem=Insert informations for a Toolbar Item -ApplicationEditor_InsertInfosForCommandAndHandler=Insert informations for Command and Handler -ApplicationEditor_InsertInfosForKeybinding=Insert informations for a keybinding -ApplicationEditor_Keybinding=Keybinding -ApplicationEditor_Menu=Menu -ApplicationEditor_Name=Name -ApplicationEditor_Parent=Parent -ApplicationEditor_Sequence=Sequence -ApplicationEditor_Toolbar=Toolbar -ApplicationEditor_Type=Type - -BindingTableEditor_Label=BindingTable -BindingTableEditor_Description=BindingTable bla bla bla -BindingTableEditor_ContextId=Context ID -BindingTableEditor_Keybindings=Keybindings -BindingTableEditor_KeySequence=KeySequence -BindingTableEditor_Command=Command -BindingTableEditor_AddKeyBinding=Keybinding - -CommandEditor_Label=Command -CommandEditor_Description=Command bla bla bla -CommandEditor_Name=Name -CommandEditor_LabelDescription=Description -CommandEditor_Parameters=Parameters -CommandEditor_ParameterName=Name -CommandEditor_ParameterTypeId=Type-ID -CommandEditor_ParameterOptional=Optional -CommandEditor_ParameterOptional_Yes=yes -CommandEditor_ParameterOptional_No=no -CommandEditor_ParameterId=ID -CommandEditor_Category=Category -CommandEditor_AddCommandParameter=Command Parameter -CommandEditor_NewCommandParameter=Command Parameter {0} - -DialogEditor_Label=Dialog - -WizardDialogEditor_Label=Wizard - -DirectMenuItemEditor_Label=Direct Menu Item -DirectMenuItemEditor_Description=Direct Menu Item bla bla bla -DirectMenuItemEditor_ClassURI=Class URI - -ControlFactory_Key=Key -ControlFactory_Value=Value -ControlFactory_KeyValueShellTitle=Key/Value Pair - -DirectToolItemEditor_ClassURI=Class URI -DirectToolItemEditor_Label=Direct Tool Item -DirectToolItemEditor_Description=Direct Tool Item bla bla bla - -HandledMenuItemEditor_Label=Handled Menu Item -HandledMenuItemEditor_Description=Handled Menu Item bla bla bla -HandledMenuItemEditor_Command=Command -HandledMenuItemEditor_Parameters=Parameters -HandledMenuItemEditor_Tag=Name -HandledMenuItemEditor_Value=Value - -DynamicMenuContributionEditor_Label=Dynamic Menu Contribution -DynamicMenuContributionEditor_Description=Dynamic Menu Contribution blablabla - -DynamicMenuContributionEditor_ClassURI=Class URI -DynamicMenuContributionEditor_LabelLabel=Label - -HandledToolItemEditor_Command=Command -HandledToolItemEditor_Parameters=Parameters -HandledToolItemEditor_ParametersName=Name -HandledToolItemEditor_ParametersValue=Value -HandledToolItemEditor_Label=Handled Tool Item -HandledToolItemEditor_Description=Handled Tool Item bla bla bla - -HandlerEditor_Label=Handler -HandlerEditor_Description=Handler bla bla bla -HandlerEditor_Command=Command -HandlerEditor_ClassURI=Class URI - -InputPartEditor_Label=InputPart -InputPartEditor_InputURI=Input URI - -KeyBindingEditor_Label=KeyBinding -KeyBindingEditor_Description=Binding bla bla bla -KeyBindingEditor_Sequence=Sequence -KeyBindingEditor_Command=Command -KeyBindingEditor_Parameters=Parameters -KeyBindingEditor_SequenceNotComplete=Keysequence is not complete -KeyBindingEditor_SequenceEmpty=Keysequence must not be empty! -KeyBindingEditor_AddParameter=Parameter - -MenuEditor_Label=Menu -MenuEditor_Label_ViewMenu=View Menu -MenuEditor_Description=Menu bla bla bla -MenuEditor_MenuItems=MenuItems -MenuEditor_MenuItemType=Type -MenuEditor_MenuItemItemType=Item Type -MenuEditor_HandledMenuItem=Handled Menu Item -MenuEditor_DynamicMenuContribution=Dynamic Menu Contribution -MenuEditor_Separator=Separator -MenuEditor_Menu=Menu -MenuEditor_DirectMenuItem=Direct Menu Item -MenuEditor_LabelLabel=Label -MenuEditor_Tooltip=Tooltip -MenuEditor_IconURI=Icon URI -MenuEditor_MainMenu=Main Menu -MenuEditor_Children=Children -MenuEditor_Mnemonics=Mnemonics -MenuEditor_AddHandledMenuItem=Handled Menu Item -MenuEditor_AddMenu=Menu -MenuEditor_AddDirectMenuItem=Direct Menu Item -MenuEditor_AddSeparator=Separator -MenuEditor_AddDynamicMenuContribution=Dynamic Menu Contribution -MenuEditor_AddCoreExpression=VisibleWhen Core Expression - - -MenuItemEditor_Type=Type -MenuItemEditor_Label=Label -MenuItemEditor_Tooltip=Tooltip -MenuItemEditor_IconURI=Icon URI -MenuItemEditor_Enabled=Enabled -MenuItemEditor_Selected=Selected -MenuItemEditor_Mnemonics=Mnemonics -MenuItemEditor_NoExpression=<None> -MenuItemEditor_AddCoreExpression=VisibleWhen Core Expression - -MenuSeparatorEditor_Label=Separator - -PartDescriptorEditor_Label=Part Descriptor -PartDescriptorEditor_Descriptor=Part Descriptor Bla Bla Bla Bla -PartDescriptorEditor_LabelLabel=Label -PartDescriptorEditor_Tooltip=Tooltip -PartDescriptorEditor_IconURI=Icon URI -PartDescriptorEditor_ClassURI=Class URI -PartDescriptorEditor_Dirtyable=Dirtyable -PartDescriptorEditor_Closeable=Closeable -PartDescriptorEditor_Multiple=Multiple -PartDescriptorEditor_Category=Category -PartDescriptorEditor_Variables=Variables -PartDescriptorEditor_Properties=Properties -PartDescriptorEditor_PropertiesKey=Key -PartDescriptorEditor_PropertiesValue=Value -PartDescriptorEditor_Menus=Menus -PartDescriptorEditor_Handlers=Handlers -PartDescriptorEditor_ContainerData=Container Data - -PartEditor_Label=Part -PartEditor_Description=Part Bla Bla Bla Bla -PartEditor_LabelLabel=Label -PartEditor_Tooltip=Tooltip -PartEditor_IconURI=Icon URI -PartEditor_IconURI_Tooltip=Choose the icon of your part here -PartEditor_ClassURI=Class URI -PartEditor_Closeable=Closeable -PartEditor_Closeable_Tooltip=If checked, the part can be closed by the user -PartEditor_Menus=Menus -PartEditor_Handlers=Handlers -PartEditor_ContainerData=Container Data -PartEditor_ToolBar=ToolBar -PartEditor_BindingContexts=Binding Contexts - -PartSashContainerEditor_Label=Part Sash Container -PartSashContainerEditor_Description=Sash bla bla bla -PartSashContainerEditor_Orientation=Orientation -PartSashContainerEditor_Vertical=Vertical -PartSashContainerEditor_Horizontal=Horizontal -PartSashContainerEditor_SelectedElement=Selected Element -PartSashContainerEditor_Controls=Controls -PartSashContainerEditor_ContainerData=Container Data -PartSashContainerEditor_AddPartSashContainer=Part Sash Container -PartSashContainerEditor_AddPartStack=Part Stack -PartSashContainerEditor_AddPart=Part -PartSashContainerEditor_AddArea=Area -PartSashContainerEditor_AddPlaceholder=Placeholder - -PartStackEditor_Label=Part Stack -PartStackEditor_Description=Stack bla bla bla -PartStackEditor_SelectedElement=Selected Element -PartStackEditor_Parts=Parts -PartStackEditor_ContainerData=Container Data -PartStackEditor_AddPart=Part -PartStackEditor_AddPlaceholder=Placeholder -PartStackEditor_AddCompositePart=Composite Part -PartStackEditor_CompositePart=CompositePart -PartStackEditor_Editors=Editors -PartStackEditor_Part=Part -PartStackEditor_Placeholder=Placeholder -PartStackEditor_Views=Views - -PerspectiveEditor_Label=Perspective -PerspectiveEditor_Description=Perspective Bla Bla Bla -PerspectiveEditor_LabelLabel=Label -PerspectiveEditor_SelectedElement=Selected Element -PerspectiveEditor_Label=Perspective -PerspectiveEditor_Tooltip=Tooltip -PerspectiveEditor_IconURI=Icon URI -PerspectiveEditor_Controls=Controls -PerspectiveEditor_AddPartSashContainer=Part Sash Container -PerspectiveEditor_AddPartStack=Part Stack -PerspectiveEditor_AddPart=Part -PerspectiveEditor_AddInputPart=InputPart -PerspectiveEditor_AddArea=Area -PerspectiveEditor_AddPlaceholder=Placeholder - - -PerspectiveStackEditor_Label=Perspective Stack -PerspectiveStackEditor_Description=Perspective Stack Bla Bla Bla -PerspectiveStackEditor_SelectedElement=Selected Element -PerspectiveStackEditor_Perspectives=Perspectives -PerspectiveStackEditor_AddPerspective=Perspective - -PlaceholderEditor_Label=Placeholder -PlaceholderEditor_Descriptor=Placeholder Bla Bla Bla Bla -PlaceholderEditor_Reference=Reference -PlaceholderEditor_Closeable=Closeable -PlaceholderEditor_ContainerData=Container Data - -ToolBarEditor_Label=Toolbar -ToolBarEditor_Description=Toolbar bla bla bla -ToolBarEditor_ToolbarItems=Toolbar Items -ToolBarEditor_ToolbarItemsType=Type -ToolBarEditor_ToolbarItemsItemType=Item-Type -ToolBarEditor_HandledToolItem=Handled ToolItem -ToolBarEditor_DirectToolItem=Direct ToolItem -ToolBarEditor_ToolControl=Tool Control -ToolBarEditor_Separator=Separator -ToolBarEditor_AddHandledToolItem=Handled ToolItem -ToolBarEditor_AddDirectToolItem=Direct ToolItem -ToolBarEditor_AddToolControl=Toolcontrol -ToolBarEditor_AddToolBarSeparator=Separator - -ToolBarSeparatorEditor_Label=Separator - -ToolControlEditor_Label=Tool Control -ToolControlEditor_Description=ToolControl bla bla bla -ToolControlEditor_ClassURI=Class URI - -VBindingTableEditor_Label=Binding Configuration -VBindingTableEditor_Description=Binding Configuration Bla Bla Bla Bla -VBindingTableEditor_Contexts=Contexts -VBindingTableEditor_Name=Name -VBindingTableEditor_LabelDescription=Description -VBindingTableEditor_BindingTables=Binding Tables -VBindingTableEditor_AddBindingTable=Binding Table - -AddonsEditor_ClassURI=Class URI -AddonsEditor_TreeLabel=Add-on -AddonsEditor_TreeLabelDescription=Add-on Bla Bla Bla -AddonsEditor_Tags=Tags - -ContributionClassDialog_DialogMessage=Enter the name of the contributing class -ContributionClassDialog_DialogTitle=Find Contribution Class -ContributionClassDialog_Label_Classname=Class Name -ContributionClassDialog_FilterText_Message=Type to start search -ContributionClassDialog_ShellTitle=Find Contribution Class -ContributionURIValidator_Malformed_URI=The uri has to have the format 'bundleclass://$$bundleId$$/$$className$$' -ContributionURIValidator_No_Empty_URI=The URI must not be empty\! -ContributionURIValidator_URI_starts_with_platform=The URI has to start with 'bundleclass://' - -MenuContributionEditor_MenuItems=Menu Items -MenuContributionEditor_MenuItemType=Type -MenuContributionEditor_MenuItemItemType=Item Type -MenuContributionEditor_HandledMenuItem=Handled Menu Item -MenuContributionEditor_DynamicMenuContribution=Dynamic Menu Contribution -MenuContributionEditor_Separator=Separator -MenuContributionEditor_Menu=Menu -MenuContributionEditor_DirectMenuItem=Direct Menu Item -MenuContributionEditor_ParentId=Parent-ID -MenuContributionEditor_Position=Position -MenuContributionEditor_TreeLabel=Menu Contribution -MenuContributionEditor_TreeLabelDescription=Menu Contribution Bla Bla Bla Bla - -ModelFragmentsEditor_ModelFragments=Model Fragments -ModelFragmentsEditor_Label=Model Fragment Definition -ModelFragmentsEditor_Description=Description -ModelFragmentsEditor_Imports=Imports - -StringModelFragment_Label=Model Fragment -StringModelFragment_Description=Model Fragment Bla Bla Bla -StringModelFragment_Featurename=Featurename -StringModelFragment_ParentId=Element ID -StringModelFragment_PositionInList=Position in list -StringModelFragment_Elements=Elements - -FeatureSelectionDialog_Filter=Filter -FeatureSelectionDialog_ShellTitle=Find Featurename -FeatureSelectionDialog_DialogTitle=Featurename -FeatureSelectionDialog_DialogMessage=Find the name of the feature you want to contribute to - -CategoryEditor_TreeLabel=Command Category -CategoryEditor_TreeLabelDescriptor=Command Category Bla Bla Bla -CategoryEditor_Name=Name -CategoryEditor_Description=Description -CategoryEditor_Tags=Tags - -CommandCategorySelectionDialog_LabelCategoryId=Category ID -BindingContextSelectionDialog_LabelContextId=Context ID - -ComponentLabelProvider_invisible=invisible -ComponentLabelProvider_notrendered=not rendered - -BindingContextEditor_TreeLabel=Binding Context -BindingContextEditor_TreeLabelDescription=Binding Context Bla Bla Bla -BindingContextEditor_Name=Name -BindingContextEditor_Description=Description -BindingContextEditor_Subcontexts=Subcontexts -BindingContextEditor_AddContext=Binding Context -BindingContextEditor_NameWarning=Binding Context name should not be empty - -CommandParameterEditor_TreeLabel=Command Parameter -CommandParameterEditor_TreeLabelDescritpion=Command Parameter Bla Bla Bla -CommandParameterEditor_Name=Name -CommandParameterEditor_TypeId=TypeID -CommandParameterEditor_Optional=Optional - -ParameterEditor_TreeLabel=Parameter -ParameterEditor_TreeLabelDescription=Parameter Bla Bla Bla Bla -ParameterEditor_Command_Parameter_ID=Command Parameter ID -ParameterEditor_Value=Value - -ParameterIdSelectionDialog_ShellTitle=Find command parameter id -ParameterIdSelectionDialog_DialogTitle=Find command parameter id -ParameterIdSelectionDialog_DialogMessage=Find the command parameter id to be referenced by this parameter. -ParameterIdSelectionDialog_LabelText=Command Parameter Id - -PopupMenuEditor_TreeLabel=Popup Menu -PopupMenuEditor_TreeLabelDescription=Popup Menu Bla Bla Bla Bla - -RenderedMenuEditor_TreeLabel=Rendered Menu - -RenderedMenuItem_TreeLabel=Rendered Menu Item -RenderedMenuItem_TreeLabelDescription=Rendered Menu Item Bla Bla Bla Bla - -RenderedToolBarEditor_TreeLabel=Rendered ToolBar - -ToolBarContributionEditor_TreeLabel=ToolBar Contribution -ToolBarContributionEditor_TreeLabelDescription=ToolBar Contribution Bla Bla Bla Bla - -ToolItemEditor_Type=Type -ToolItemEditor_Label=Label -ToolItemEditor_ToolTip=Tooltip -ToolItemEditor_IconURI=Icon URI -ToolItemEditor_Enabled=Enabled -ToolItemEditor_Selected=Selected -ToolItemEditor_NoExpression=<None> -ToolItemEditor_Menu=Menu - -TrimBarEditor_TreeLabel=Window Trim -TrimBarEditor_TreeLabelDescription=Window Trim bla bla bla -TrimBarEditor_Side=Side -TrimBarEditor_Controls=Controls -TrimBarEditor_AddToolBar=Toolbar -TrimBarEditor_AddToolControl=Toolcontrol - - -TrimContributionEditor_TreeLabel=Trim Contribution -TrimContributionEditor_TreeLabelDescription=Trim Contribution Bla Bla Bla Bla -TrimContributionEditor_ParentId=Parent ID -TrimContributionEditor_Position=Position -TrimContributionEditor_Controls=Controls - -TrimmedWindowEditor_TrimBars=TrimBars -TrimmedWindowEditor_TreeLabel=Trimmed Window - -WindowEditor_AddMainMenu=Main Menu -WindowEditor_TreeLabel=Window -WindowEditor_TreeLabelDescription=Window bla bla bla -WindowEditor_Bounds=Bounds(x,y,w,h) -WindowEditor_Label=Label -WindowEditor_Tooltip=Tooltip -WindowEditor_IconURI=Icon URI -WindowEditor_MainMenu=Main Menu -WindowEditor_SelectedElement=Selected Element -WindowEditor_BindingContexts=Binding Contexts -WindowEditor_Handlers=Handlers -WindowEditor_Windows=Windows and Dialogs -WindowEditor_Controls=Controls -WindowEditor_SharedElements=Shared Elements - -VApplicationAddons_AddAddon=Add-on -VApplicationAddons_TreeLabel=Add-ons -VApplicationAddons_TreeLabelDescription=Add-ons bla bla bla bla -VApplicationAddons_Commands=Commands - -VApplicationCategoriesEditor_TreeLabel=Command Categories -VApplicationCategoriesEditor_TreeLabelDescription=Command Categories bla bla bla bla -VApplicationCategoriesEditor_Categories=Categories -VApplicationCategoriesEditor_AddCategory=Category - -VCommandEditor_TreeLabel=Commands -VCommandEditor_TreeLabelDescription=Commands Bla Bla Bla Bla Bla -VCommandEditor_Commands=Commands -VCommandEditor_AddCommand=Command - -VHandlerEditor_TreeLabel=Handlers -VHandlerEditor_TreeLabelDescription=Handlers Bla Bla Bla Bla Bla -VHandlerEditor_Handlers=Handlers -VHandlerEditor_AddHandler=Handler - -VMenuContributionsEditor_TreeLabel=Menu Contributions -VMenuContributionsEditor_TreeLabelDescription=Menu Contributions Bla Bla Bla Bla Bla -VMenuContributionsEditor_MenuContributions=Menu Contributions -VMenuContributionsEditor_AddMenuContribution=Menu Contribution - -VMenuEditor_TreeLabel=Menus -VMenuEditor_TreeLabelDescription=Menus Bla Bla Bla Bla Bla -VMenuEditor_Menus=Menus -VMenuEditor_AddMenuContribution=Menu -VMenuEditor_AddPopupMenuContribution=Popup Menu - -VModelFragmentsEditor_TreeLabel=Fragments -VModelFragmentsEditor_TreeLabelDescription=Fragments Bla Bla Bla Bla Bla -VModelFragmentsEditor_Fragments=Fragments -VModelFragmentsEditor_AddFragment=Model Fragment - -VModelImportsEditor_TreeLabel=Imports -VModelImportsEditor_TreeLabelDescription=Imports Bla Bla Bla Bla Bla -VModelImportsEditor_Imports=Imports - -VPartDescriptor_TreeLabel=Part Descriptors -VPartDescriptor_TreeLabelDescription=Part Descriptors Bla Bla Bla Bla Bla -VPartDescriptor_Descriptors= Part Descriptors -VPartDescriptor_AddPartDescriptor=Part Descriptor - -VSnippetsEditor_Snippets=Snippets; - -VToolBarContributionsEditor_TreeLabel=ToolBar Contributions -VToolBarContributionsEditor_TreeLabelDescription=ToolBar Contributions Bla Bla Bla Bla Bla -VToolBarContributionsEditor_Contributions=ToolBar Contributions -VToolBarContributionsEditor_AddToolBarContribution=ToolBar Contribution - -VTrimContributionsEditor_TreeLabel=Trim Contributions -VTrimContributionsEditor_TreeLabelDescription=Trim Contributions Bla Bla Bla Bla Bla -VTrimContributionsEditor_Contributions=Trim Contributions -VTrimContributionsEditor_AddTrimContribution=Trim Contribution - -VWindowControlEditor_TreeLabel=Controls -VWindowControlEditor_TreeLabelDescription=Controls Bla Bla Bla Bla Bla -VWindowControlEditor_Controls=Controls -VWindowControlEditor_AddPerspectiveStack=Perspective Stack -VWindowControlEditor_AddPartSashContainer=Part Sash Container -VWindowControlEditor_AddPartStack=Part Stack -VWindowControlEditor_AddPart=Part -VWindowControlEditor_AddArea=Area - -VWindowEditor_TreeLabel=Windows and Dialogs -VWindowEditor_TreeLabelDescription=Windows Bla Bla Bla Bla Bla -VWindowEditor_Windows=Windows -VWindowEditor_AddTrimmedWindow=Trimmed Window -VWindowEditor_AddWindow=Window -VWindowEditor_AddDialog=Dialog -VWindowEditor_AddWizardDialog=Wizard - -VWindowSharedElementsEditor_TreeLabel=Shared Elements -VWindowSharedElementsEditor_TreeLabelDescription=Shared Elements Bla Bla Bla Bla -VWindowSharedElementsEditor_Controls=Controls -VWindowSharedElementsEditor_AddPartSashContainer=Part Sash Container -VWindowSharedElementsEditor_AddPart=Part -VWindowSharedElementsEditor_AddPartStack=Part Stack - -VWindowTrimEditor_TreeLabel=Window Trims -VWindowTrimEditor_TreeLabelDescription=Window Trims Bla Bla Bla Bla Bla -VWindowTrimEditor_Controls=Controls -VWindowTrimEditor_AddWindowTrim=Window Trim - -AbstractIconDialog_Icon_Name=Icon Name -AbstractIconDialog_IconName=IconName -AbstractIconDialog_Type_To_Start_Search=Type to start search - -AbstractIconDialogWithHardcodedScope_Project=Project -AbstractIconDialogWithHardcodedScope_Workspace=Workspace -AbstractIconDialogWithScopeAndFilter_details=Details -AbstractIconDialogWithScopeAndFilter_icon=Icon -AbstractIconDialogWithScopeAndFilter_iconName=Icon Name -AbstractIconDialogWithScopeAndFilter_maxDisplayedImageSize=Max Displayed Image Size -AbstractIconDialogWithScopeAndFilter_typeToStartSearch=Type to start search - -BindingContextSelectionDialog_ShellTitle=BindingContext Dialog -BindingContextSelectionDialog_Title=BindingContext -BindingContextSelectionDialog_Message=Search for a BindingContext -BindingContextSelectionDialog_NoIdReference=You can not reference an element without an ID - -CommandCategorySelectionDialog_ShellTitle=Command Category Dialog -CommandCategorySelectionDialog_Title=Command Category -CommandCategorySelectionDialog_Message=Search for a Command Category - -FilteredContributionDialog_Bundle=Bundle -FilteredContributionDialog_BundleFilter=Bundle Filter -FilteredContributionDialog_ClearCache=Clear Model Cache -FilteredContributionDialog_ContributionSearch=Contribution Search -FilteredContributionDialog_itemsWereFound=\ items were found. Not all results have been displayed.\n -FilteredContributionDialog_Java=Java -FilteredContributionDialog_Location=Location -FilteredContributionDialog_LocationFilter=Location Filter -FilteredContributionDialog_MoreThan=More than -FilteredContributionDialog_NonBundles=Non Bundles -FilteredContributionDialog_None=None -FilteredContributionDialog_Package=Package -FilteredContributionDialog_PackageFilter=Package Filter -FilteredContributionDialog_ProjectAndReferences=Project and References -FilteredContributionDialog_ProjectOnly=Project Only -FilteredContributionDialog_ProviderInitializing=The provider is initializing. Results will refresh when complete. -FilteredContributionDialog_ProviderWasCancelled=The provider was cancelled while initializing. Results may be incomplete. -FilteredContributionDialog_ResourceIsNotContainedInABundle=The selected resource is not contained in a bundle. -FilteredContributionDialog_ResourceIsNotReferencedByThisBundle=The selected resource's bundle is not referenced by this bundle. -FilteredContributionDialog_Scope=Scope -FilteredContributionDialog_ScopeFilter=Scope Filter -FilteredContributionDialog_Searching=Searching...\n -FilteredContributionDialog_SearchWasCancelled=The search was cancelled. Not all results may have been displayed.\n -FilteredContributionDialog_SelectTheBundle=Select the bundle to filter on. -FilteredContributionDialog_SelectTheLocation=Select the location to filter on. -FilteredContributionDialog_SelectThePackage=Select the package to filter on. -FilteredContributionDialog_TargetPlatform=Target Platform -FilteredContributionDialog_Workspace=Workspace -FindImportElementDialog_ShellTitle=Find Import Elements -FindImportElementDialog_Title=Find Import Elements -FindImportElementDialog_Message=Search for an elements whose ID you'd like to import -FindImportElementDialog_Search=Search -FindImportElementDialog_noId=no ID -FindImportElementDialog_ClearCache=Clear Cache -FindImportElementDialog_NoIdReference=You can not import an element without an ID - -FindParentReferenceElementDialog_ShellTitle=Find Parent Elements -FindParentReferenceElementDialog_Title=Find Parent Elements -FindParentReferenceElementDialog_Message=Search for an elements who you like to references as parent -FindParentReferenceElementDialog_ContainerType=Container-Type -FindParentReferenceElementDialog_Search=Search -FindParentReferenceElementDialog_ClearCache=Clear Cache -FindParentReferenceElementDialog_NoReferenceId=You can not reference an element without an ID -FindParentReferenceElementDialog_NoId=no ID - -HandledMenuItemCommandSelectionDialog_ShellTitle=MenuItem Command -HandledMenuItemCommandSelectionDialog_DialogTitle=MenuItem-Command -HandledMenuItemCommandSelectionDialog_DialogMessage=Connect the MenuItem to a command - -HandledToolItemCommandSelectionDialog_ShellTitle=ToolItem Command -HandledToolItemCommandSelectionDialog_DialogTitle=ToolItem-Command -HandledToolItemCommandSelectionDialog_DialogMessage=Connect the ToolItem to a command - -HandlerCommandSelectionDialog_ShellTitle=Handler Command -HandlerCommandSelectionDialog_DialogTitle=Handler-Command -HandlerCommandSelectionDialog_DialogMessage=Connect the handler to a command - -KeyBindingCommandSelectionDialog_ShellTitle=Keybinding Command -KeyBindingCommandSelectionDialog_DialogTitle=Keybinding-Command -KeyBindingCommandSelectionDialog_DialogMessage=Connect the keybinding to a command - -MenuIconDialogEditor_ShellTitle=Menu Icon Search -MenuIconDialogEditor_DialogTitle=Menu Icon Search -MenuIconDialogEditor_DialogMessage=Search for GIF, PNG and JPG icons in the current project - -MenuItemIconDialogEditor_ShellTitle=Menu Item Icon Search -MenuItemIconDialogEditor_DialogTitle=Menu Item Icon Search -MenuItemIconDialogEditor_DialogMessage=Search for GIF, PNG and JPG icons in the current project - -PartDescriptorIconDialogEditor_ShellTitle=Part Descriptor Icon Search -PartDescriptorIconDialogEditor_DialogTitle=Part Descriptor Icon Search -PartDescriptorIconDialogEditor_DialogMessage=Search for GIF, PNG and JPG icons in the current project - -PartIconDialogEditor_ShellTitle=Part Icon Search -PartIconDialogEditor_DialogTitle=Part Icon Search -PartIconDialogEditor_DialogMessage=Search for GIF, PNG and JPG icons in the current project - -PerspectiveIconDialogEditor_ShellTitle=Perspective Icon Search -PerspectiveIconDialogEditor_DialogTitle=Perspective Icon Search -PerspectiveIconDialogEditor_DialogMessage=Search for GIF, PNG and JPG icons in the current project - -SharedElementsDialog_ShellTitle=Find Shared Elements -SharedElementsDialog_Title=Find Shared Elements -SharedElementsDialog_Message=Find Shared Elements of an Window -SharedElementsDialog_Name=Name - -ToolItemIconDialogEditor_ShellTitle=ToolItem Icon Search -ToolItemIconDialogEditor_DialogTitle=ToolItem Icon Search -ToolItemIconDialogEditor_DialogMessage=Search for GIF, PNG and JPG icons in the current project - -WindowIconDialogEditor_ShellTitle=Menu Icon Search -WindowIconDialogEditor_DialogTitle=Menu Icon Search -WindowIconDialogEditor_DialogMessage=Search for GIF, PNG and JPG icons in the current project - -ImageTooltip_UnknownError=Unknown Error -ImageTooltip_FileNotFound=File ''{0}'' not found in bundle ''{1}'' -ImageTooltip_Icon=Icon -ImageTooltip_Name=Name -ImageTooltip_Dimension=Dimensions -ImageTooltip_FileSize=File-Size - -VItemParametersEditor_TreeLabel=Parameters -VItemParametersEditor_TreeLabelDescription=Parameters Bla Bla Bla -VItemParametersEditor_Parameters=Parameters -VItemParametersEditor_AddParameter=Parameter - -CoreExpressionEditor_TreeLabel=Core Expression -CoreExpressionEditor_TreeLabelDescription=Core Expression Bla Bla Bla -CoreExpressionEditor_ExpressionId=Expression ID - -ExpressionIdDialog_ShellTitle=Find Expression ID -ExpressionIdDialog_DialogTitle=Find Expression ID -ExpressionIdDialog_DialogMessage=Find the expression ID defined through the 'org.eclipse.core.expressions.definitions' extension point -ExpressionIdDialog_Id=ID -CommandToStringConverter_None=<None> - -MenuIdDialog_ShellTitle=Find Parent Menu Id -MenuIdDialog_DialogTitle=Find Parent Menu Id -MenuIdDialog_DialogMessage=Find the menu id to be used as parent (in fragment finds the imported menus only) -MenuIdDialog_Id=Parent Id - -ToolBarIdDialog_ShellTitle=Find Parent Toolbar Id -ToolBarIdDialog_DialogTitle=Find Parent Toolbar Id -ToolBarIdDialog_DialogMessage=Find the toolbar id to be used as parent -ToolBarIdDialog_Id=Parent Id - -TrimBarIdDialog_ShellTitle=Find Parent Trimbar Id -TrimBarIdDialog_DialogTitle=Find Parent Trimbar Id -TrimBarIdDialog_DialogMessage=Find the trimbar id to be used as parent -TrimBarIdDialog_Id=Parent Id - -VRootBindingContexts_AddContext=Binding Context -VRootBindingContexts_TreeLabel=Binding Context -VRootBindingContexts_TreeLabelDescription=Binding Context Bla Bla Bla -VRootBindingContexts_Contexts=Binding Contexts - -AreaEditor_Label=Area -AreaEditor_Description=Area Bla Bla Bla -AreaEditor_Orientation=Orientation -AreaEditor_Horizontal=Horizontal -AreaEditor_SelectedElement=Selected Element -AreaEditor_ContainerData=Container Data -AreaEditor_Controls=Controls -AreaEditor_Vertical=Vertical -AreaEditor_LabelLabel=Label -AreaEditor_Tooltip=Tooltip -AreaEditor_IconURI=Icon URI - -AreaIconDialogEditor_ShellTitle=Area Icon Search -AreaIconDialogEditor_DialogTitle=Area Icon Search -AreaIconDialogEditor_DialogMessage=Search for GIF, PNG and JPG icons in the current project -AreaIconDialogEditor_Enter_Text=Enter text -AreaIconDialogEditor_Icon=Icon - -ModelEditor_Delete=Remove -ModelEditor_ExpandSubtree=Expand/Collapse (CTRL + Mouse) -ModelEditor_Form=Form -ModelEditor_XMI=XMI -ModelEditor_ExternalizeStrings=Externalize Strings -ModelEditor_ExportIds=Export Element Ids -ModelEditor_Script=Execute Script -ModelEditor_ShowControl=Show control - -ExternalizeStringHandler_Dialog_ElementName=Element -ExternalizeStringHandler_Dialog_AttributeName=Attribute -ExternalizeStringHandler_Dialog_Key=Key -ExternalizeStringHandler_Dialog_Value=Value -ExternalizeStringHandler_Dialog_ShellTitle=Externalize Strings -ExternalizeStringHandler_Dialog_DialogTitle=Externalize Strings -ExternalizeStringHandler_Dialog_DialogMessage=Externalizing manifest files extracts translatable strings and stores them in a properties file for multi-language support. - -ExportIdsHandler_Dialog_ElementName=Element -ExportIdsHandler_Dialog_Key=Key -ExportIdsHandler_Dialog_Id_Value=Id Value -ExportIdsHandler_Dialog_ShellTitle=Export Element Ids -ExportIdsHandler_Dialog_DialogTitle=Export Element Ids -ExportIdsHandler_Dialog_DialogMessage=Export application model element Ids into a java file for static reference -ExportIdsHandler_Dialog_SelectProject=Please select a Java project to continue - -ObjectViewer_Tooltip_Value=Value -ObjectViewer_Tooltip_InjectionKey=Injection key -ObjectViewer_Script=Execute Script - - -CommandWizard_ShellTitle=Command/Handler wizard -Special_UnknownElement=(unknown model element) -Special_UnknownElement_Detail= Use an extension point! -VWindowSharedElementsEditor_Area=Area -ModelEditor_ExtractFragment=Extract into a fragment -ModelEditor_ExtractFragment_NoParentId=Can not extract because parent container has no ID. \nAdd an ID and try again. -ModelEditor_goto_list=Goto List -ModelEditor_goto_xmi=Goto XMI -KeyBindingEditor_SequenceLowercase=Key sequences should be specified in uppercase characters -ModelTooling_CommandId_tooltip=Command identifier. Must be defined for a command to work properly. - - -ListTab_0=List -ListTab_1=Mark Duplicate IDs -ListTab_2=Duplicate IDs will be highlighted -ListTab_3=Repair Duplicate IDs -ListTab_4=Duplicate IDs will be replaced using a unique suffix -ListTab_5=Delete Selected Items -ListTab_6=Selected items will be deleted -ListTab_7=Showing items with attribute: -ListTab_8=xmi -ListTab_9=form -ListTab_col_id=ID -ListTab_col_item=Item -ListTab_col_label=Label -ListTab_col_go=Go - -ListTab_addColumn=Add Column -ListTab_filterByAttribute=Filter By Attribute -ListTab_filterByItem=Filter By Item -ListTab_mark=Mark -ListTab_markAttribute=Filter By Attribute -ListTab_removeFilter=Remove Filter -ListTab_resetColumns=Reset Columns -ListTab_selectAnAttribute=Select an attribute -ListTab_selectAType=Select a type - -CompositePartEditor_AddPartSashContainer=Part Sash Container -CompositePartEditor_AddPartStack=Part Stack -CompositePartEditor_AddPart=Part -CompositePartEditor_AddArea=Area -CompositePartEditor_AddPlaceholder=Placeholder -CompositePartEditor_Label=Composite Part -CompositePartEditor_Description=Composite Part -CompositePartEditor_Orientation=Orientation -CompositePartEditor_Horizontal=Horizontal -CompositePartEditor_Vertical=Vertical -CompositePartEditor_SelectedElement=Selected Element -CompositePartEditor_ContainerData=Container Data -CompositePartEditor_Controls=Controls -CompositePartEditor_LabelLabel=Label -CompositePartEditor_Tooltip=Tooltip -CompositePartEditor_IconURI=Icon URI -CompositePartEditor_IconURI_Tooltip=Choose the icon of your part here diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ObservableColumnLabelProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ObservableColumnLabelProvider.java deleted file mode 100644 index 22a8d2bd..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ObservableColumnLabelProvider.java +++ /dev/null @@ -1,101 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal; - -import java.util.Set; -import org.eclipse.core.databinding.observable.map.IMapChangeListener; -import org.eclipse.core.databinding.observable.map.IObservableMap; -import org.eclipse.core.databinding.observable.map.MapChangeEvent; -import org.eclipse.jface.viewers.CellLabelProvider; -import org.eclipse.jface.viewers.LabelProviderChangedEvent; -import org.eclipse.jface.viewers.ViewerCell; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.Image; - -public class ObservableColumnLabelProvider<M> extends CellLabelProvider { - private IObservableMap[] attributeMaps; - - private IMapChangeListener mapChangeListener = new IMapChangeListener() { - @Override - public void handleMapChange(MapChangeEvent event) { - Set<?> affectedElements = event.diff.getChangedKeys(); - LabelProviderChangedEvent newEvent = new LabelProviderChangedEvent(ObservableColumnLabelProvider.this, affectedElements.toArray()); - fireLabelProviderChanged(newEvent); - } - }; - - /** - * Creates a new label provider that tracks changes to one attribute. - * - * @param attributeMap - */ - public ObservableColumnLabelProvider(IObservableMap attributeMap) { - this(new IObservableMap[] { attributeMap }); - } - - /** - * Creates a new label provider that tracks changes to more than one - * attribute. This constructor should be used by subclasses that override - * {@link #update(ViewerCell)} and make use of more than one attribute. - * - * @param attributeMaps - */ - protected ObservableColumnLabelProvider(IObservableMap[] attributeMaps) { - System.arraycopy(attributeMaps, 0, this.attributeMaps = new IObservableMap[attributeMaps.length], 0, attributeMaps.length); - for (int i = 0; i < attributeMaps.length; i++) { - attributeMaps[i].addMapChangeListener(mapChangeListener); - } - } - - @Override - public void dispose() { - for (int i = 0; i < attributeMaps.length; i++) { - attributeMaps[i].removeMapChangeListener(mapChangeListener); - } - super.dispose(); - this.attributeMaps = null; - this.mapChangeListener = null; - } - - @Override - @SuppressWarnings("unchecked") - public void update(ViewerCell cell) { - M element = (M) cell.getElement(); - cell.setText(getText(element)); - cell.setImage(getImage(element)); - cell.setBackground(getBackground(element)); - cell.setForeground(getForeground(element)); - cell.setFont(getFont(element)); - } - - public String getText(M element) { - Object value = attributeMaps[0].get(element); - return value == null ? "" : value.toString(); //$NON-NLS-1$ - } - - public Font getFont(M element) { - return null; - } - - public Color getBackground(M element) { - return null; - } - - public Color getForeground(M element) { - return null; - } - - public Image getImage(M element) { - return null; - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/PatternFilter.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/PatternFilter.java deleted file mode 100644 index 9da394cf..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/PatternFilter.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * Wim Jongman - Maintenance (391086) - *******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal; - -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.StructuredViewer; -import org.eclipse.jface.viewers.Viewer; - -public class PatternFilter extends org.eclipse.e4.ui.workbench.swt.internal.copy.PatternFilter { - - /** - * This constructor will call {@link #setIncludeLeadingWildcard(boolean)} with boolean=true. - */ - public PatternFilter() { - setIncludeLeadingWildcard(true); - } - - /** - * Check if the current (leaf) element is a match with the filter text. The - * default behavior checks that the label of the element is a match. - * - * Subclasses should override this method. - * - * @param viewer - * the viewer that contains the element - * @param element - * the tree element to check - * @return true if the given element's label matches the filter text - */ - @Override - protected boolean isLeafMatch(Viewer viewer, Object element) { - - final Object labelProvider = ((StructuredViewer) viewer).getLabelProvider(); - String labelText = null; - - if (labelProvider instanceof ILabelProvider) { - labelText = ((ILabelProvider) labelProvider).getText(element); - } else { - if (element != null) { - labelText = element.toString(); - } - } - - if (labelText == null) { - return false; - } - return wordMatches(labelText); - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/PreferenceInitializer.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/PreferenceInitializer.java deleted file mode 100644 index 571e523b..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/PreferenceInitializer.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - Bug 431735, Bug 437890, Bug 440469 - ******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.internal; - -import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; -import org.eclipse.core.runtime.preferences.IEclipsePreferences; -import org.eclipse.core.runtime.preferences.InstanceScope; -import org.eclipse.e4.tools.emf.ui.common.ModelEditorPreferences; -import org.eclipse.e4.tools.emf.ui.common.Plugin; -import org.eclipse.jface.resource.StringConverter; -import org.eclipse.swt.graphics.RGB; - -public class PreferenceInitializer extends AbstractPreferenceInitializer { - - @Override - public void initializeDefaultPreferences() { - IEclipsePreferences pref = InstanceScope.INSTANCE.getNode(Plugin.ID); - - if (pref.get(ModelEditorPreferences.NOT_RENDERED_COLOR, null) == null) { - String val = StringConverter.asString(new RGB(200, 200, 200)); - pref.put(ModelEditorPreferences.NOT_RENDERED_COLOR, val); - } - - if (pref.get(ModelEditorPreferences.NOT_VISIBLE_COLOR, null) == null) { - String val = StringConverter.asString(new RGB(200, 200, 200)); - pref.put(ModelEditorPreferences.NOT_VISIBLE_COLOR, val); - } - - if (pref.get(ModelEditorPreferences.NOT_VISIBLE_AND_RENDERED_COLOR, null) == null) { - String val = StringConverter.asString(new RGB(200, 200, 200)); - pref.put(ModelEditorPreferences.NOT_VISIBLE_AND_RENDERED_COLOR, val); - } - - if (pref.get(ModelEditorPreferences.AUTO_CREATE_ELEMENT_ID, null) == null) { - pref.putBoolean(ModelEditorPreferences.AUTO_CREATE_ELEMENT_ID, true); - } - - // TODO: After XMI tab is not forced disabled, this should default to - // true - if (pref.get(ModelEditorPreferences.TAB_FORM_SEARCH_SHOW, null) == null) { - pref.putBoolean(ModelEditorPreferences.TAB_FORM_SEARCH_SHOW, false); - } - - if (pref.get(ModelEditorPreferences.LIST_TAB_REMEMBER_FILTERS, null) == null) { - pref.putBoolean(ModelEditorPreferences.LIST_TAB_REMEMBER_FILTERS, false); - } - - if (pref.get(ModelEditorPreferences.LIST_TAB_REMEMBER_COLUMNS, null) == null) { - pref.putBoolean(ModelEditorPreferences.LIST_TAB_REMEMBER_COLUMNS, false); - } - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ResourceProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ResourceProvider.java deleted file mode 100644 index dffdc5d0..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ResourceProvider.java +++ /dev/null @@ -1,160 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011-2013 BestSolution.at - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Marco Descher <marco@descher.at> - Bug 395982 - *******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal; - -import org.eclipse.e4.tools.services.BasicResourceProvider; - -public class ResourceProvider extends BasicResourceProvider { - public static final String IMG_Addons = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.Addons"; //$NON-NLS-1$ - public static final String IMG_Application = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.Application"; //$NON-NLS-1$ - public static final String IMG_Area_vertical = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.Area_vertical"; //$NON-NLS-1$ - public static final String IMG_Area = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.Area"; //$NON-NLS-1$ - public static final String IMG_BindingContext = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.BindingContext"; //$NON-NLS-1$ - public static final String IMG_BindingTable = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.BindingTable"; //$NON-NLS-1$ - public static final String IMG_Category = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.Category"; //$NON-NLS-1$ - public static final String IMG_Command = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.Command"; //$NON-NLS-1$ - public static final String IMG_CommandParameter = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.CommandParameter"; //$NON-NLS-1$ - public static final String IMG_CoreExpression = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.CoreExpression"; //$NON-NLS-1$ - public static final String IMG_Dialog = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.Dialog"; //$NON-NLS-1$ - public static final String IMG_DirectMenuItem = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.DirectMenuItem"; //$NON-NLS-1$ - public static final String IMG_DirectToolItem = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.DirectToolItem"; //$NON-NLS-1$ - public static final String IMG_HandledMenuItem = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.HandledMenuItem"; //$NON-NLS-1$ - public static final String IMG_HandledToolItem = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.HandledToolItem"; //$NON-NLS-1$ - public static final String IMG_Handler = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.Handler"; //$NON-NLS-1$ - public static final String IMG_KeyBinding = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.KeyBinding"; //$NON-NLS-1$ - public static final String IMG_Menu = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.Menu"; //$NON-NLS-1$ - public static final String IMG_MenuContribution = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.MenuContribution"; //$NON-NLS-1$ - public static final String IMG_MenuItem = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.MenuItem"; //$NON-NLS-1$ - public static final String IMG_DynamicMenuContribution = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.DynamicMenuContribution"; //$NON-NLS-1$ - public static final String IMG_MenuSeparator = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.MenuSeparator"; //$NON-NLS-1$ - public static final String IMG_ModelFragments = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.ModelFragments"; //$NON-NLS-1$ - public static final String IMG_Parameter = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.Parameter"; //$NON-NLS-1$ - public static final String IMG_Part = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.Part"; //$NON-NLS-1$ - public static final String IMG_PartDescriptor = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.PartDescriptor"; //$NON-NLS-1$ - public static final String IMG_PartSashContainer_vertical = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.PartSashContainer_vertical"; //$NON-NLS-1$ - public static final String IMG_PartSashContainer = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.PartSashContainer"; //$NON-NLS-1$ - public static final String IMG_PartStack = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.PartStack"; //$NON-NLS-1$ - public static final String IMG_Perspective = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.Perspective"; //$NON-NLS-1$ - public static final String IMG_PerspectiveStack = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.PerspectiveStack"; //$NON-NLS-1$ - public static final String IMG_Placeholder = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.Placeholder"; //$NON-NLS-1$ - public static final String IMG_StringModelFragment = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.StringModelFragment"; //$NON-NLS-1$ - public static final String IMG_ToolBar = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.ToolBar"; //$NON-NLS-1$ - public static final String IMG_ToolBarContribution = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.ToolBarContribution"; //$NON-NLS-1$ - public static final String IMG_ToolBarSeparator = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.ToolBarSeparator"; //$NON-NLS-1$ - public static final String IMG_ToolControl = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.ToolControl"; //$NON-NLS-1$ - public static final String IMG_TrimContribution = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.TrimContribution"; //$NON-NLS-1$ - public static final String IMG_Window = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.Window"; //$NON-NLS-1$ - public static final String IMG_WindowTrim = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.WindowTrim"; //$NON-NLS-1$ - public static final String IMG_WizardDialog = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.WizardDialog"; //$NON-NLS-1$ - - public static final String IMG_Tbr_Addons = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.Addons"; //$NON-NLS-1$ - public static final String IMG_Tbr_Application = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.Application"; //$NON-NLS-1$ - public static final String IMG_Tbr_Area_vertical = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.Area_vertical"; //$NON-NLS-1$ - public static final String IMG_Tbr_Area = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.Area"; //$NON-NLS-1$ - public static final String IMG_Tbr_BindingContext = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.BindingContext"; //$NON-NLS-1$ - public static final String IMG_Tbr_BindingTable = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.BindingTable"; //$NON-NLS-1$ - public static final String IMG_Tbr_CommandParameter = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.CommandParameter"; //$NON-NLS-1$ - public static final String IMG_Tbr_Dialog = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.Dialog"; //$NON-NLS-1$ - public static final String IMG_Tbr_DirectMenuItem = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.DirectMenuItem"; //$NON-NLS-1$ - public static final String IMG_Tbr_DirectToolItem = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.DirectToolItem"; //$NON-NLS-1$ - public static final String IMG_Tbr_HandledMenuItem = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.HandledMenuItem"; //$NON-NLS-1$ - public static final String IMG_Tbr_HandledToolItem = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.HandledToolItem"; //$NON-NLS-1$ - public static final String IMG_Tbr_Menu = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.Menu"; //$NON-NLS-1$ - public static final String IMG_Tbr_MenuContribution = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.MenuContribution"; //$NON-NLS-1$ - public static final String IMG_Tbr_MenuItem = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.MenuItem"; //$NON-NLS-1$ - public static final String IMG_Tbr_DynamicMenuContribution = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.DynamicMenuContribution"; //$NON-NLS-1$ - public static final String IMG_Tbr_MenuSeparator = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.MenuSeparator"; //$NON-NLS-1$ - public static final String IMG_Tbr_ModelFragments = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.ModelFragments"; //$NON-NLS-1$ - public static final String IMG_Tbr_Parameter = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.Parameter"; //$NON-NLS-1$ - public static final String IMG_Tbr_Part = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.Part"; //$NON-NLS-1$ - public static final String IMG_Tbr_PartDescriptor = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.PartDescriptor"; //$NON-NLS-1$ - public static final String IMG_Tbr_PartSashContainer_vertical = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.PartSashContainer_vertical"; //$NON-NLS-1$ - public static final String IMG_Tbr_PartSashContainer = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.PartSashContainer"; //$NON-NLS-1$ - public static final String IMG_Tbr_PartStack = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.PartStack"; //$NON-NLS-1$ - public static final String IMG_Tbr_Perspective = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.Perspective"; //$NON-NLS-1$ - public static final String IMG_Tbr_PerspectiveStack = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.PerspectiveStack"; //$NON-NLS-1$ - public static final String IMG_Tbr_Placeholder = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.Placeholder"; //$NON-NLS-1$ - public static final String IMG_Tbr_StringModelFragment = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.StringModelFragment"; //$NON-NLS-1$ - public static final String IMG_Tbr_ToolBar = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.ToolBar"; //$NON-NLS-1$ - public static final String IMG_Tbr_ToolBarContribution = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.ToolBarContribution"; //$NON-NLS-1$ - public static final String IMG_Tbr_ToolBarSeparator = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.ToolBarSeparator"; //$NON-NLS-1$ - public static final String IMG_Tbr_ToolControl = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.ToolControl"; //$NON-NLS-1$ - public static final String IMG_Tbr_TrimContribution = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.TrimContribution"; //$NON-NLS-1$ - public static final String IMG_Tbr_Window = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.Window"; //$NON-NLS-1$ - public static final String IMG_Tbr_WindowTrim = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.WindowTrim"; //$NON-NLS-1$ - public static final String IMG_Tbr_WizardDialog = "IMG_org.eclipse.e4.tools.emf.ui.modelelements.tbr.WizardDialog"; //$NON-NLS-1$ - - public static final String IMG_Obj16_arrow_down = "IMG_org.eclipse.e4.tools.emf.ui.obj16.arrow_down"; //$NON-NLS-1$ - public static final String IMG_Obj16_arrow_up = "IMG_org.eclipse.e4.tools.emf.ui.obj16.arrow_up"; //$NON-NLS-1$ - public static final String IMG_Obj16_class_obj = "IMG_org.eclipse.e4.tools.emf.ui.obj16.class_obj"; //$NON-NLS-1$ - public static final String IMG_Obj16_class_default_obj = "IMG_org.eclipse.e4.tools.emf.ui.obj16.class_default_obj"; //$NON-NLS-1$ - public static final String IMG_Obj16_cross = "IMG_org.eclipse.e4.tools.emf.ui.obj16.cross"; //$NON-NLS-1$ - public static final String IMG_Obj16_EPackage = "IMG_org.eclipse.e4.tools.emf.ui.obj16.EPackage"; //$NON-NLS-1$ - public static final String IMG_Obj16_field_public_obj = "IMG_org.eclipse.e4.tools.emf.ui.obj16.field_public_obj"; //$NON-NLS-1$ - public static final String IMG_Obj16_field_default_obj = "IMG_org.eclipse.e4.tools.emf.ui.obj16.field_default_obj"; //$NON-NLS-1$ - public static final String IMG_Obj16_field_private_obj = "IMG_org.eclipse.e4.tools.emf.ui.obj16.field_private_obj"; //$NON-NLS-1$ - public static final String IMG_Obj16_field_protected_obj = "IMG_org.eclipse.e4.tools.emf.ui.obj16.field_protected_obj"; //$NON-NLS-1$ - public static final String IMG_Obj16_headermenu = "IMG_org.eclipse.e4.tools.emf.ui.obj16.headermenu"; //$NON-NLS-1$ - public static final String IMG_Obj16_table_add = "IMG_org.eclipse.e4.tools.emf.ui.obj16.table_add"; //$NON-NLS-1$ - public static final String IMG_Obj16_table_delete = "IMG_org.eclipse.e4.tools.emf.ui.obj16.table_delete"; //$NON-NLS-1$ - public static final String IMG_Obj16_zoom = "IMG_org.eclipse.e4.tools.emf.ui.obj16.zoom"; //$NON-NLS-1$ - public static final String IMG_Obj16_application_form = "IMG_org.eclipse.e4.tools.emf.ui.obj16.application_form"; //$NON-NLS-1$ - public static final String IMG_Obj16_chart_organisation = "IMG_org.eclipse.e4.tools.emf.ui.obj16.chart_organisation"; //$NON-NLS-1$ - public static final String IMG_Obj16_error_obj = "IMG_org.eclipse.e4.tools.emf.ui.obj16.error_obj"; //$NON-NLS-1$ - public static final String IMG_Obj16_world_edit = "IMG_org.eclipse.e4.tools.emf.ui.obj16.world_edit"; //$NON-NLS-1$ - public static final String IMG_Obj16_bullet_go = "IMG_org.eclipse.e4.tools.emf.ui.obj16.bullet_go"; //$NON-NLS-1$ - public static final String IMG_Obj16_bundle = "IMG_org.eclipse.e4.tools.emf.ui.obj16.bundle"; //$NON-NLS-1$ - - public static final String IMG_Wizban16_fieldrefact_wiz = "IMG_org.eclipse.e4.tools.emf.ui.wizban.fieldrefact_wiz"; //$NON-NLS-1$ - public static final String IMG_Wizban16_import_wiz = "IMG_org.eclipse.e4.tools.emf.ui.wizban.import_wiz"; //$NON-NLS-1$ - public static final String IMG_Wizban16_newclass_wiz = "IMG_org.eclipse.e4.tools.emf.ui.wizban.newclass_wiz"; //$NON-NLS-1$ - public static final String IMG_Wizban16_newexp_wiz = "IMG_org.eclipse.e4.tools.emf.ui.wizban.newexp_wiz"; //$NON-NLS-1$ - public static final String IMG_Wizban16_typerefact_wiz = "IMG_org.eclipse.e4.tools.emf.ui.wizban.typerefact_wiz"; //$NON-NLS-1$ - public static final String IMG_Wizban16_extstr_wiz = "IMG_org.eclipse.e4.tools.emf.ui.wizban.extstr_wiz"; //$NON-NLS-1$ - public static final String IMG_Wizban16_imp3x_wiz = "IMG_org.eclipse.e4.tools.emf.ui.wizban.imp3x_wiz"; //$NON-NLS-1$ - - public static final String IMG_Widgets_ctabfolder_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.ctabfolder_obj"; //$NON-NLS-1$ - public static final String IMG_Widgets_tabfolder_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.tabfolder_obj"; //$NON-NLS-1$ - public static final String IMG_Widgets_shell_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.shell_obj"; //$NON-NLS-1$ - public static final String IMG_Widgets_group_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.group_obj"; //$NON-NLS-1$ - public static final String IMG_Widgets_ccombo_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.ccombo_obj"; //$NON-NLS-1$ - public static final String IMG_Widgets_comboviewer_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.comboviewer_obj"; //$NON-NLS-1$ - public static final String IMG_Widgets_table_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.table_obj"; //$NON-NLS-1$ - public static final String IMG_Widgets_tree_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.tree_obj"; //$NON-NLS-1$ - public static final String IMG_Widgets_sashform_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.sashform_obj"; //$NON-NLS-1$ - public static final String IMG_Widgets_text_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.text_obj"; //$NON-NLS-1$ - public static final String IMG_Widgets_label_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.label_obj"; //$NON-NLS-1$ - public static final String IMG_Widgets_button_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.button_obj"; //$NON-NLS-1$ - public static final String IMG_Widgets_composite_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.composite_obj"; //$NON-NLS-1$ - public static final String IMG_Widgets_progressbar_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.progressbar_obj"; //$NON-NLS-1$ - public static final String IMG_Widgets_separator_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.separator_obj"; //$NON-NLS-1$ - public static final String IMG_Widgets_clabel_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.clabel_obj"; //$NON-NLS-1$ - public static final String IMG_Widgets_coolbar_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.coolbar_obj"; //$NON-NLS-1$ - public static final String IMG_Widgets_toolbar_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.toolbar_obj"; //$NON-NLS-1$ - public static final String IMG_Widgets_toolitemcheck_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.toolitemcheck_obj"; //$NON-NLS-1$ - public static final String IMG_Widgets_toolitemdrop_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.toolitemdrop_obj"; //$NON-NLS-1$ - public static final String IMG_Widgets_toolitempush_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.toolitempush_obj"; //$NON-NLS-1$ - public static final String IMG_Widgets_toolitemradio_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.toolitemradio_obj"; //$NON-NLS-1$ - public static final String IMG_Widgets_toolitemseparator_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.toolitemseparator_obj"; //$NON-NLS-1$ - public static final String IMG_Widgets_checkbox_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.checkbox_obj"; //$NON-NLS-1$ - public static final String IMG_Widgets_radiobutton_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.radiobutton_obj"; //$NON-NLS-1$ - public static final String IMG_Widgets_menu_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.menu_obj"; //$NON-NLS-1$ - public static final String IMG_Widgets_menubar_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.menubar_obj"; //$NON-NLS-1$ - public static final String IMG_Widgets_menuitem_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.menuitem_obj"; //$NON-NLS-1$ - public static final String IMG_Widgets_menuseparator_obj = "IMG_org.eclipse.e4.tools.emf.ui.widgets.menuseparator_obj"; //$NON-NLS-1$ - - public static final String COLOR_XML_COMMENT = "COLOR_org.eclipse.e4.tools.emf.ui.XML_COMMENT"; //$NON-NLS-1$ - public static final String COLOR_PROC_INSTR = "COLOR_org.eclipse.e4.tools.emf.ui.PROC_INSTR"; //$NON-NLS-1$ - public static final String COLOR_STRING = "COLOR_org.eclipse.e4.tools.emf.ui.STRING"; //$NON-NLS-1$ - public static final String COLOR_DEFAULT = "COLOR_org.eclipse.e4.tools.emf.ui.DEFAULT"; //$NON-NLS-1$ - public static final String COLOR_TAG = "COLOR_org.eclipse.e4.tools.emf.ui.TAG"; //$NON-NLS-1$ -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/StringMatcher.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/StringMatcher.java deleted file mode 100644 index 4187c649..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/StringMatcher.java +++ /dev/null @@ -1,487 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal; - -import java.util.Vector; - -/** - * A string pattern matcher, suppporting "*" and "?" wildcards. - */ -public class StringMatcher { - protected String fPattern; - - protected int fLength; // pattern length - - protected boolean fIgnoreWildCards; - - protected boolean fIgnoreCase; - - protected boolean fHasLeadingStar; - - protected boolean fHasTrailingStar; - - protected String fSegments[]; // the given pattern is split into * separated - // segments - - /* boundary value beyond which we don't need to search in the text */ - protected int fBound = 0; - - protected static final char fSingleWildCard = '\u0000'; - - public static class Position { - int start; // inclusive - - int end; // exclusive - - public Position(int start, int end) { - this.start = start; - this.end = end; - } - - public int getStart() { - return start; - } - - public int getEnd() { - return end; - } - } - - /** - * StringMatcher constructor takes in a String object that is a simple - * pattern which may contain '*' for 0 and many characters and '?' for - * exactly one character. - * - * Literal '*' and '?' characters must be escaped in the pattern e.g., - * "\*" means literal "*", etc. - * - * Escaping any other character (including the escape character itself), - * just results in that character in the pattern. e.g., "\a" means "a" and - * "\\" means "\" - * - * If invoking the StringMatcher with string literals in Java, don't forget - * escape characters are represented by "\\". - * - * @param pattern - * the pattern to match text against - * @param ignoreCase - * if true, case is ignored - * @param ignoreWildCards - * if true, wild cards and their escape sequences are ignored - * (everything is taken literally). - */ - public StringMatcher(String pattern, boolean ignoreCase, boolean ignoreWildCards) { - if (pattern == null) { - throw new IllegalArgumentException(); - } - fIgnoreCase = ignoreCase; - fIgnoreWildCards = ignoreWildCards; - fPattern = pattern; - fLength = pattern.length(); - - if (fIgnoreWildCards) { - parseNoWildCards(); - } else { - parseWildCards(); - } - } - - /** - * Find the first occurrence of the pattern between <code>start</code )(inclusive) and <code>end</code>(exclusive). - * - * @param text - * the String object to search in - * @param start - * the starting index of the search range, inclusive - * @param end - * the ending index of the search range, exclusive - * @return an <code>StringMatcher.Position</code> object that keeps the - * starting (inclusive) and ending positions (exclusive) of the - * first occurrence of the pattern in the specified range of the - * text; return null if not found or subtext is empty (start==end). - * A pair of zeros is returned if pattern is empty string Note that - * for pattern like "*abc*" with leading and trailing stars, - * position of "abc" is returned. For a pattern like"*??*" in text - * "abcdf", (1,3) is returned - */ - public StringMatcher.Position find(String text, int start, int end) { - if (text == null) { - throw new IllegalArgumentException(); - } - - final int tlen = text.length(); - if (start < 0) { - start = 0; - } - if (end > tlen) { - end = tlen; - } - if (end < 0 || start >= end) { - return null; - } - if (fLength == 0) { - return new Position(start, start); - } - if (fIgnoreWildCards) { - final int x = posIn(text, start, end); - if (x < 0) { - return null; - } - return new Position(x, x + fLength); - } - - final int segCount = fSegments.length; - if (segCount == 0) { - return new Position(start, end); - } - - int curPos = start; - int matchStart = -1; - int i; - for (i = 0; i < segCount && curPos < end; ++i) { - final String current = fSegments[i]; - final int nextMatch = regExpPosIn(text, curPos, end, current); - if (nextMatch < 0) { - return null; - } - if (i == 0) { - matchStart = nextMatch; - } - curPos = nextMatch + current.length(); - } - if (i < segCount) { - return null; - } - return new Position(matchStart, curPos); - } - - /** - * match the given <code>text</code> with the pattern - * - * @return true if matched otherwise false - * @param text - * a String object - */ - public boolean match(String text) { - if (text == null) { - return false; - } - return match(text, 0, text.length()); - } - - /** - * Given the starting (inclusive) and the ending (exclusive) positions in - * the <code>text</code>, determine if the given substring matches with - * aPattern - * - * @return true if the specified portion of the text matches the pattern - * @param text - * a String object that contains the substring to match - * @param start - * marks the starting position (inclusive) of the substring - * @param end - * marks the ending index (exclusive) of the substring - */ - public boolean match(String text, int start, int end) { - if (null == text) { - throw new IllegalArgumentException(); - } - - if (start > end) { - return false; - } - - if (fIgnoreWildCards) { - return end - start == fLength && fPattern.regionMatches(fIgnoreCase, 0, text, start, fLength); - } - final int segCount = fSegments.length; - if (segCount == 0 && (fHasLeadingStar || fHasTrailingStar)) { - return true; - } - if (start == end) { - return fLength == 0; - } - if (fLength == 0) { - return start == end; - } - - final int tlen = text.length(); - if (start < 0) { - start = 0; - } - if (end > tlen) { - end = tlen; - } - - int tCurPos = start; - final int bound = end - fBound; - if (bound < 0) { - return false; - } - int i = 0; - String current = fSegments[i]; - final int segLength = current.length(); - - /* process first segment */ - if (!fHasLeadingStar) { - if (!regExpRegionMatches(text, start, current, 0, segLength)) { - return false; - } - ++i; - tCurPos = tCurPos + segLength; - } - if (fSegments.length == 1 && !fHasLeadingStar && !fHasTrailingStar) { - // only one segment to match, no wildcards specified - return tCurPos == end; - } - /* process middle segments */ - while (i < segCount) { - current = fSegments[i]; - int currentMatch; - final int k = current.indexOf(fSingleWildCard); - if (k < 0) { - currentMatch = textPosIn(text, tCurPos, end, current); - if (currentMatch < 0) { - return false; - } - } else { - currentMatch = regExpPosIn(text, tCurPos, end, current); - if (currentMatch < 0) { - return false; - } - } - tCurPos = currentMatch + current.length(); - i++; - } - - /* process final segment */ - if (!fHasTrailingStar && tCurPos != end) { - final int clen = current.length(); - return regExpRegionMatches(text, end - clen, current, 0, clen); - } - return i == segCount; - } - - /** - * This method parses the given pattern into segments seperated by wildcard - * '*' characters. Since wildcards are not being used in this case, the - * pattern consists of a single segment. - */ - private void parseNoWildCards() { - fSegments = new String[1]; - fSegments[0] = fPattern; - fBound = fLength; - } - - /** - * Parses the given pattern into segments seperated by wildcard '*' - * characters. - * - * @param p - * , a String object that is a simple regular expression with '*' - * and/or '?' - */ - private void parseWildCards() { - if (fPattern.startsWith("*")) { //$NON-NLS-1$ - fHasLeadingStar = true; - } - if (fPattern.endsWith("*")) {//$NON-NLS-1$ - /* make sure it's not an escaped wildcard */ - if (fLength > 1 && fPattern.charAt(fLength - 2) != '\\') { - fHasTrailingStar = true; - } - } - - final Vector<String> temp = new Vector<String>(); - - int pos = 0; - final StringBuffer buf = new StringBuffer(); - while (pos < fLength) { - final char c = fPattern.charAt(pos++); - switch (c) { - case '\\': - if (pos >= fLength) { - buf.append(c); - } else { - final char next = fPattern.charAt(pos++); - /* if it's an escape sequence */ - if (next == '*' || next == '?' || next == '\\') { - buf.append(next); - } else { - /* not an escape sequence, just insert literally */ - buf.append(c); - buf.append(next); - } - } - break; - case '*': - if (buf.length() > 0) { - /* new segment */ - temp.addElement(buf.toString()); - fBound += buf.length(); - buf.setLength(0); - } - break; - case '?': - /* append special character representing single match wildcard */ - buf.append(fSingleWildCard); - break; - default: - buf.append(c); - } - } - - /* add last buffer to segment list */ - if (buf.length() > 0) { - temp.addElement(buf.toString()); - fBound += buf.length(); - } - - fSegments = new String[temp.size()]; - temp.copyInto(fSegments); - } - - /** - * @param text - * a string which contains no wildcard - * @param start - * the starting index in the text for search, inclusive - * @param end - * the stopping point of search, exclusive - * @return the starting index in the text of the pattern , or -1 if not - * found - */ - protected int posIn(String text, int start, int end) {// no wild card in - // pattern - final int max = end - fLength; - - if (!fIgnoreCase) { - final int i = text.indexOf(fPattern, start); - if (i == -1 || i > max) { - return -1; - } - return i; - } - - for (int i = start; i <= max; ++i) { - if (text.regionMatches(true, i, fPattern, 0, fLength)) { - return i; - } - } - - return -1; - } - - /** - * @param text - * a simple regular expression that may only contain '?'(s) - * @param start - * the starting index in the text for search, inclusive - * @param end - * the stopping point of search, exclusive - * @param p - * a simple regular expression that may contains '?' - * @return the starting index in the text of the pattern , or -1 if not - * found - */ - protected int regExpPosIn(String text, int start, int end, String p) { - final int plen = p.length(); - - final int max = end - plen; - for (int i = start; i <= max; ++i) { - if (regExpRegionMatches(text, i, p, 0, plen)) { - return i; - } - } - return -1; - } - - /** - * - * @return boolean - * @param text - * a String to match - * @param start - * int that indicates the starting index of match, inclusive - * @param end - * </code> int that indicates the ending index of match, - * exclusive - * @param p - * String, String, a simple regular expression that may contain - * '?' - * @param ignoreCase - * boolean indicating wether code>p</code> is case sensitive - */ - protected boolean regExpRegionMatches(String text, int tStart, String p, int pStart, int plen) { - while (plen-- > 0) { - final char tchar = text.charAt(tStart++); - final char pchar = p.charAt(pStart++); - - /* process wild cards */ - if (!fIgnoreWildCards) { - /* skip single wild cards */ - if (pchar == fSingleWildCard) { - continue; - } - } - if (pchar == tchar) { - continue; - } - if (fIgnoreCase) { - if (Character.toUpperCase(tchar) == Character.toUpperCase(pchar)) { - continue; - } - // comparing after converting to upper case doesn't handle all - // cases; - // also compare after converting to lower case - if (Character.toLowerCase(tchar) == Character.toLowerCase(pchar)) { - continue; - } - } - return false; - } - return true; - } - - /** - * @param text - * the string to match - * @param start - * the starting index in the text for search, inclusive - * @param end - * the stopping point of search, exclusive - * @param p - * a pattern string that has no wildcard - * @return the starting index in the text of the pattern , or -1 if not - * found - */ - protected int textPosIn(String text, int start, int end, String p) { - - final int plen = p.length(); - final int max = end - plen; - - if (!fIgnoreCase) { - final int i = text.indexOf(p, start); - if (i == -1 || i > max) { - return -1; - } - return i; - } - - for (int i = start; i <= max; ++i) { - if (text.regionMatches(true, i, p, 0, plen)) { - return i; - } - } - - return -1; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/AbstractPickList.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/AbstractPickList.java deleted file mode 100644 index a0907770..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/AbstractPickList.java +++ /dev/null @@ -1,289 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation - *******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.internal.common; - -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.TreeMap; - -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.jface.viewers.ComboViewer; -import org.eclipse.jface.viewers.IContentProvider; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.IOpenListener; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.OpenEvent; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.ViewerComparator; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Group; - -/** - * <p> - * A composite widget containing a combo for picking items, a list with selectable items, and action buttons for - * modifying the list. - * </p> - * - * @author Steven Spungin - * - */ -public abstract class AbstractPickList extends Composite { - - public static enum PickListFeatures { - NO_ORDER, NO_PICKER - } - - protected ComboViewer picker; - protected TableViewer viewer; - - private final Group group; - private final Composite toolBar; - private final Button tiRemove; - private final Button tiUp; - private final Button tiDown; - private final Button tiAdd; - // private final AutoCompleteField autoCompleteField; - private Map<String, Object> proposals; - - public AbstractPickList(Composite parent, int style, List<PickListFeatures> listFeatures, Messages messages, - AbstractComponentEditor componentEditor) { - super(parent, style); - - // TODO remove dependency to Messages and AbstractComponentEditor. They - // are only needed for labels and icons. - - setLayout(new FillLayout()); - - group = new Group(this, SWT.NONE); - // gridData.horizontalIndent = 30; - group.setLayout(new GridLayout(1, false)); - - final Composite comp = new Composite(group, SWT.NONE); - - GridLayout layout = new GridLayout(2, false); - layout.marginHeight = 0; - layout.marginWidth = 0; - comp.setLayout(layout); - comp.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false)); - - picker = new ComboViewer(comp, SWT.DROP_DOWN | SWT.BORDER | SWT.READ_ONLY); - final Combo control = picker.getCombo(); - control.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); - - // ComboContentAdapter controlContentAdapter = new ComboContentAdapter() - // { - // @Override - // public void setControlContents(Control control, String text1, int - // cursorPosition) { - // super.setControlContents(control, text1, cursorPosition); - // Object valueInModel = proposals.get(text1); - // if (valueInModel != null) { - // getPicker().setSelection(new StructuredSelection(valueInModel)); - // } - // } - // }; - // autoCompleteField = new AutoCompleteField(control, - // controlContentAdapter, new String[0]); - - toolBar = new Composite(comp, SWT.NONE); - layout = new GridLayout(5, true); - layout.marginHeight = 0; - layout.marginWidth = 0; - toolBar.setLayout(layout); - toolBar.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false)); - - picker.addOpenListener(new IOpenListener() { - - @Override - public void open(OpenEvent event) { - addPressed(); - } - }); - - tiAdd = new Button(toolBar, SWT.PUSH); - tiAdd.setText(messages.ModelTooling_Common_AddEllipsis); - tiAdd.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false)); - tiAdd.setImage(componentEditor.createImage(ResourceProvider.IMG_Obj16_table_add)); - tiAdd.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - addPressed(); - } - }); - - tiRemove = new Button(toolBar, SWT.PUSH); - tiRemove.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false)); - tiRemove.setText(messages.ModelTooling_Common_Remove); - tiRemove.setImage(componentEditor.createImage(ResourceProvider.IMG_Obj16_table_delete)); - tiRemove.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - removePressed(); - } - }); - - tiDown = new Button(toolBar, SWT.PUSH); - tiDown.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false)); - tiDown.setText(messages.ModelTooling_Common_Down); - tiDown.setImage(componentEditor.createImage(ResourceProvider.IMG_Obj16_arrow_down)); - tiDown.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - moveDownPressed(); - } - }); - - tiUp = new Button(toolBar, SWT.PUSH); - tiUp.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false)); - tiUp.setText(messages.ModelTooling_Common_Up); - tiUp.setImage(componentEditor.createImage(ResourceProvider.IMG_Obj16_arrow_up)); - tiUp.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - moveUpPressed(); - } - }); - - viewer = new TableViewer(group); - final GridData gd = new GridData(GridData.FILL, GridData.FILL, true, true, 1, 1); - viewer.getControl().setLayoutData(gd); - - viewer.addSelectionChangedListener(new ISelectionChangedListener() { - - @Override - public void selectionChanged(SelectionChangedEvent event) { - updateUiState(); - } - }); - - updateUiState(); - - if (listFeatures != null) { - if (listFeatures.contains(PickListFeatures.NO_ORDER)) { - tiDown.dispose(); - tiUp.dispose(); - } - if (listFeatures.contains(PickListFeatures.NO_PICKER)) { - ((GridData) picker.getControl().getLayoutData()).exclude = true; - picker.getControl().setVisible(false); - pack(); - } - } - - } - - protected void addPressed() { - } - - abstract protected int getItemCount(); - - public TableViewer getList() { - return viewer; - } - - public void setInput(Object input) { - getPicker().setInput(input); - - // proposals = toProposals(input); - // final Set<String> keySet = proposals.keySet(); - // autoCompleteField.setProposals(keySet.toArray(new String[keySet.size()])); - } - - public ISelection getSelection() { - return getPicker().getSelection(); - } - - public void setSelection(ISelection selection) { - getPicker().setSelection(selection); - } - - private Map<String, Object> toProposals(Object inputElement) { - - final Map<String, Object> props = new TreeMap<String, Object>(); - - if (inputElement instanceof Object[]) { - for (final Object value : (Object[]) inputElement) { - props.put(getTextualValue(value), value); - } - } - if (inputElement instanceof Collection) { - for (final Object value : (Collection<Object>) inputElement) { - props.put(getTextualValue(value), value); - } - - } - - return props; - } - - private String getTextualValue(Object value) { - return ((ILabelProvider) getPicker().getLabelProvider()).getText(value); - } - - public void setContentProvider(IContentProvider contentProvider) { - getPicker().setContentProvider(contentProvider); - } - - public void setLabelProvider(ILabelProvider labelProvider) { - getPicker().setLabelProvider(labelProvider); - } - - private ComboViewer getPicker() { - return picker; - } - - public void setComparator(ViewerComparator comparator) { - getPicker().setComparator(comparator); - } - - protected Composite getToolBar() { - return toolBar; - } - - protected void moveDownPressed() { - } - - protected void moveUpPressed() { - } - - protected void removePressed() { - } - - public void setText(String text) { - group.setText(text); - } - - public void updateUiState() { - final IStructuredSelection selection = (IStructuredSelection) getList().getSelection(); - final boolean selected = selection.size() > 0; - final int count = getItemCount(); - if (tiDown.isDisposed() == false) { - tiDown.setEnabled(selected && count > 1); - tiUp.setEnabled(selected && count > 1); - } - tiRemove.setEnabled(selected); - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/Autocomplete.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/Autocomplete.java deleted file mode 100644 index 884a9293..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/Autocomplete.java +++ /dev/null @@ -1,104 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation - *******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.internal.common; - -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import org.eclipse.jface.viewers.ComboViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.FocusAdapter; -import org.eclipse.swt.events.FocusEvent; -import org.eclipse.swt.events.KeyAdapter; -import org.eclipse.swt.events.KeyEvent; -import org.eclipse.swt.events.MouseAdapter; -import org.eclipse.swt.events.MouseEvent; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.widgets.Combo; - -/** - * - * @author Steven Spungin - * - */ -public class Autocomplete { - - public static void installOn(ComboViewer comboViewer) { - final Combo combo = comboViewer.getCombo(); - - combo.addKeyListener(new KeyAdapter() { - @Override - public void keyReleased(KeyEvent keyEvent) { - setClosestMatch(combo); - } - - @Override - public void keyPressed(KeyEvent keyEvent) { - if (keyEvent.keyCode == SWT.BS) { - Point pt = combo.getSelection(); - combo.setSelection(new Point(Math.max(0, pt.x - 1), pt.y)); - } - } - }); - - combo.addFocusListener(new FocusAdapter() { - @Override - public void focusLost(FocusEvent e) { - combo.setSelection(new Point(0, combo.getText().length())); - } - - @Override - public void focusGained(FocusEvent e) { - combo.setSelection(new Point(0, combo.getText().length())); - } - }); - - combo.addMouseListener(new MouseAdapter() { - @Override - public void mouseUp(MouseEvent e) { - combo.setSelection(new Point(0, combo.getText().length())); - } - }); - } - - private static void setClosestMatch(Combo combo) { - String[] items = combo.getItems(); - if (items.length == 0) { - return; - } - - // TODO this would be faster using binary search if we could insure that - // the items are sorted in natural order. - - String str = combo.getText(); - Pattern pattern = Pattern.compile(str + ".*", Pattern.CASE_INSENSITIVE); //$NON-NLS-1$ - - int index = -1; - int length = 0; - for (int i = 0; i < items.length; i++) { - Matcher m = pattern.matcher(items[i]); - if (m.matches()) { - if (index == -1 || items[i].length() < length) { - length = items[i].length(); - index = i; - } - } - } - if (index == -1) { - index = 0; - } - Point pt = combo.getSelection(); - String selectedText = items[index]; - combo.select(index); - combo.setText(selectedText); - combo.setSelection(new Point(pt.x, selectedText.length())); - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ClassContributionCollector.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ClassContributionCollector.java deleted file mode 100644 index 6862765b..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ClassContributionCollector.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common; - -import java.util.concurrent.CopyOnWriteArrayList; -import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider; -import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider.ContributionResultHandler; -import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider.Filter; -import org.eclipse.e4.tools.emf.ui.common.IModelElementProvider; -import org.eclipse.e4.tools.emf.ui.common.IModelElementProvider.ModelResultHandler; - -public class ClassContributionCollector { - private CopyOnWriteArrayList<IClassContributionProvider> providers = new CopyOnWriteArrayList<IClassContributionProvider>(); - private CopyOnWriteArrayList<IModelElementProvider> modelElementProviders = new CopyOnWriteArrayList<IModelElementProvider>(); - - public void addContributor(IClassContributionProvider contributor) { - providers.add(contributor); - } - - public void removeContributor(IClassContributionProvider contributor) { - providers.remove(contributor); - } - - public void addModelElementContributor(IModelElementProvider provider) { - modelElementProviders.add(provider); - } - - public void removeModelElementContributor(IModelElementProvider provider) { - modelElementProviders.remove(provider); - } - - public void findContributions(Filter filter, ContributionResultHandler resultHandler) { - - for (IClassContributionProvider contributor : providers) { - contributor.findContribution(filter, resultHandler); - } - } - - public void findModelElements(org.eclipse.e4.tools.emf.ui.common.IModelElementProvider.Filter filter, ModelResultHandler resultHandler) { - - for (IModelElementProvider contributor : modelElementProviders) { - contributor.getModelElements(filter, resultHandler); - } - } - - public void clearModelCache() { - for (IModelElementProvider contributor : modelElementProviders) { - contributor.clearCache(); - } - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java deleted file mode 100644 index 187d5d08..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java +++ /dev/null @@ -1,129 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common; - -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.ui.model.application.ui.MUIElement; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jface.resource.JFaceResources; -import org.eclipse.jface.viewers.StyledCellLabelProvider; -import org.eclipse.jface.viewers.StyledString; -import org.eclipse.jface.viewers.StyledString.Styler; -import org.eclipse.jface.viewers.ViewerCell; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.FontData; -import org.eclipse.swt.graphics.TextStyle; - -public class ComponentLabelProvider extends StyledCellLabelProvider { - - private ModelEditor editor; - - public static final String NOT_RENDERED_KEY = "NOT_RENDERED_STYLER";//$NON-NLS-1$ - - public static final String NOT_VISIBLE_KEY = "NOT_VISIBLE_KEY";//$NON-NLS-1$ - - public static final String NOT_VISIBLE_AND_RENDERED_KEY = "NOT_VISIBLE_AND_RENDERED_KEY";//$NON-NLS-1$ - - private Font font; - - private Messages Messages; - - private static Styler BOTH_STYLER = new Styler() { - @Override - public void applyStyles(TextStyle textStyle) { - textStyle.foreground = JFaceResources.getColorRegistry().get(NOT_VISIBLE_AND_RENDERED_KEY); - textStyle.strikeout = true; - } - }; - - private static Styler NOT_RENDERED_STYLER = new Styler() { - @Override - public void applyStyles(TextStyle textStyle) { - textStyle.foreground = JFaceResources.getColorRegistry().get(NOT_RENDERED_KEY); - textStyle.strikeout = true; - } - }; - - private static Styler NOT_VISIBLE_STYLER = new Styler() { - @Override - public void applyStyles(TextStyle textStyle) { - textStyle.foreground = JFaceResources.getColorRegistry().get(NOT_VISIBLE_KEY); - } - }; - - public ComponentLabelProvider(ModelEditor editor, Messages Messages) { - this.editor = editor; - this.Messages = Messages; - } - - @Override - public void update(final ViewerCell cell) { - if (cell.getElement() instanceof EObject) { - - EObject o = (EObject) cell.getElement(); - AbstractComponentEditor elementEditor = editor.getEditor(o.eClass()); - if (elementEditor != null) { - String label = elementEditor.getLabel(o); - String detailText = elementEditor.getDetailLabel(o); - Styler styler = null; - - if (o instanceof MUIElement) { - - if (!((MUIElement) o).isVisible() && !((MUIElement) o).isToBeRendered()) { - label += "<" + Messages.ComponentLabelProvider_invisible + "/" + Messages.ComponentLabelProvider_notrendered + ">"; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ - styler = BOTH_STYLER; - } else if (!((MUIElement) o).isVisible()) { - label += "<" + Messages.ComponentLabelProvider_invisible + ">"; //$NON-NLS-1$//$NON-NLS-2$ - styler = NOT_VISIBLE_STYLER; - } else if (!((MUIElement) o).isToBeRendered()) { - label += "<" + Messages.ComponentLabelProvider_notrendered + ">"; //$NON-NLS-1$ //$NON-NLS-2$ - styler = NOT_RENDERED_STYLER; - } - } - - if (detailText == null) { - StyledString styledString = new StyledString(label, styler); - cell.setText(styledString.getString()); - cell.setStyleRanges(styledString.getStyleRanges()); - } else { - StyledString styledString = new StyledString(label, styler); - styledString.append(" - " + detailText, StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ - cell.setText(styledString.getString()); - cell.setStyleRanges(styledString.getStyleRanges()); - } - cell.setImage(elementEditor.getImage(o, cell.getControl().getDisplay())); - } else { - cell.setText(cell.getElement().toString()); - } - } else if (cell.getElement() instanceof VirtualEntry<?>) { - String s = cell.getElement().toString(); - if (font == null) { - FontData[] data = cell.getControl().getFont().getFontData(); - font = new Font(cell.getControl().getDisplay(), new FontData(data[0].getName(), data[0].getHeight(), SWT.ITALIC)); - } - cell.setFont(font); - cell.setText(s); - } else { - cell.setText(cell.getElement().toString()); - } - } - - @Override - public void dispose() { - if (font != null) { - font.dispose(); - font = null; - } - super.dispose(); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ControlHighlighter.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ControlHighlighter.java deleted file mode 100644 index 018080f3..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ControlHighlighter.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.eclipse.e4.tools.emf.ui.internal.common; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Shell; - -public class ControlHighlighter { - private static Shell s; - - public static void show(Control control) { - if (s != null && !s.isDisposed()) { - s.dispose(); - } - s = new Shell(control.getShell(), SWT.NO_TRIM); - Point p1 = control.toDisplay(0, 0); - Point p2 = control.getSize(); - s.setBounds(p1.x, p1.y, p2.x, p2.y); - s.setBackground(s.getDisplay().getSystemColor(SWT.COLOR_RED)); - s.setAlpha(100); - s.open(); - s.addListener(SWT.MouseDown, new Listener() { - - @Override - public void handleEvent(Event event) { - hide(); - } - }); - } - - public static void hide() { - if (s != null) { - s.dispose(); - s = null; - } - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/E4PickList.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/E4PickList.java deleted file mode 100644 index edad4587..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/E4PickList.java +++ /dev/null @@ -1,244 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation - *******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.internal.common; - -import java.util.List; - -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.ui.model.application.MApplicationElement; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.MElementContainer; -import org.eclipse.e4.ui.model.application.ui.MUIElement; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.MMenuElement; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.swt.widgets.Composite; - -/** - * <p> - * Pressing CR in the combo will execute the ADD command. - * </p> - * <p> - * <em>E4 specific:</em> The default feature is UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN. Other features must - * override appropriate methods. The picker uses an Array Content Provider. The list uses an - * ObservableListContentProvider and a Struct class to contain the object and label. - * </p> - * - * @author Steven Spungin - * - */ -public class E4PickList extends AbstractPickList { - - AbstractComponentEditor componentEditor; - EStructuralFeature feature; - - public static class Struct { - final public String label; - final public EClass eClass; - final public boolean separator; - - public Struct(String label, EClass eClass, boolean separator) { - this.label = label; - this.eClass = eClass; - this.separator = separator; - } - } - - public E4PickList(Composite parent, int style, List<PickListFeatures> listFeatures, final Messages messages, - final AbstractComponentEditor componentEditor, final EStructuralFeature feature) { - super(parent, style, listFeatures, messages, componentEditor); - - this.componentEditor = componentEditor; - this.feature = feature; - - picker.setContentProvider(new ArrayContentProvider()); - picker.setLabelProvider(new LabelProvider() { - @Override - public String getText(Object element) { - final Struct struct = (Struct) element; - return struct.label; - } - }); - - viewer.setLabelProvider(new ComponentLabelProvider(componentEditor.getEditor(), messages)); - final ObservableListContentProvider cp = new ObservableListContentProvider(); - viewer.setContentProvider(cp); - } - - /** - * Used for StringToString maps - * - * @param obj - * @param container - * @param i - */ - protected void tryEObjectMove(Object obj, EObject container, int delta) { - final List<?> l = (List<?>) container.eGet(feature); - final int idx = l.indexOf(obj) + delta; - if (delta > 0 && idx < l.size() || delta < 0 && idx >= 0) { - final Command cmd = MoveCommand.create(componentEditor.getEditingDomain(), componentEditor.getMaster() - .getValue(), feature, obj, idx); - - if (cmd.canExecute()) { - componentEditor.getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - } - - @Override - protected void addPressed() { - if (!picker.getSelection().isEmpty()) { - final Struct struct = (Struct) ((IStructuredSelection) picker.getSelection()).getFirstElement(); - final EClass eClass = struct.eClass; - _handleAdd(eClass, struct.separator); - } - } - - protected void _handleAdd(EClass eClass, boolean separator) { - final MMenuElement eObject = (MMenuElement) EcoreUtil.create(eClass); - setElementId(eObject); - final Command cmd = AddCommand.create(componentEditor.getEditingDomain(), componentEditor.getMaster() - .getValue(), feature, eObject); - - if (cmd.canExecute()) { - componentEditor.getEditingDomain().getCommandStack().execute(cmd); - if (!separator) { - componentEditor.getEditor().setSelection(eObject); - } - } - } - - protected void setElementId(Object element) { - if (componentEditor.getEditor().isAutoCreateElementId() && element instanceof MApplicationElement) { - final MApplicationElement el = (MApplicationElement) element; - if (el.getElementId() == null || el.getElementId().trim().length() == 0) { - el.setElementId(Util.getDefaultElementId( - ((EObject) componentEditor.getMaster().getValue()).eResource(), el, componentEditor.getEditor() - .getProject())); - } - } - } - - protected List<?> getContainerChildren(Object master) { - if (master instanceof MElementContainer<?>) { - return ((MElementContainer<?>) master).getChildren(); - } - return null; - } - - @Override - protected void moveUpPressed() { - if (!viewer.getSelection().isEmpty()) { - final IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - final Object obj = s.getFirstElement(); - final Object container = componentEditor.getMaster().getValue(); - if (feature == ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE) { - tryEObjectMove(obj, (EObject) container, -1); - return; - } - final List<?> children = getContainerChildren(container); - if (children == null) { - return; - } - final int idx = children.indexOf(obj) - 1; - if (idx >= 0) { - if (obj instanceof MUIElement && feature == UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN) { - if (Util.moveElementByIndex(componentEditor.getEditingDomain(), (MUIElement) obj, - componentEditor.getEditor().isLiveModel(), idx)) { - viewer.setSelection(new StructuredSelection(obj)); - } - } else if (obj instanceof MApplicationElement - || obj instanceof org.eclipse.emf.ecore.impl.MinimalEObjectImpl.Container) { - final Command cmd = MoveCommand.create(componentEditor.getEditingDomain(), componentEditor - .getMaster().getValue(), feature, obj, idx); - if (cmd.canExecute()) { - componentEditor.getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - } - } - } - } - - @Override - protected void moveDownPressed() { - if (!viewer.getSelection().isEmpty()) { - final IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - final Object obj = s.getFirstElement(); - final Object container = componentEditor.getMaster().getValue(); - if (feature == ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE) { - tryEObjectMove(obj, (EObject) container, 1); - return; - } - final List<?> children = getContainerChildren(container); - if (children == null) { - return; - } - final int idx = children.indexOf(obj) + 1; - if (idx < children.size()) { - if (obj instanceof MUIElement && feature == UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN) { - if (Util.moveElementByIndex(componentEditor.getEditingDomain(), (MUIElement) obj, - componentEditor.getEditor().isLiveModel(), idx)) { - viewer.setSelection(new StructuredSelection(obj)); - } - } else if (obj instanceof MApplicationElement - || obj instanceof org.eclipse.emf.ecore.impl.MinimalEObjectImpl.Container) { - final Command cmd = MoveCommand.create(componentEditor.getEditingDomain(), componentEditor - .getMaster().getValue(), feature, obj, idx); - if (cmd.canExecute()) { - componentEditor.getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - } - } - } - } - - @Override - protected void removePressed() { - if (!viewer.getSelection().isEmpty()) { - final List<?> keybinding = ((IStructuredSelection) viewer.getSelection()).toList(); - final Command cmd = RemoveCommand.create(componentEditor.getEditingDomain(), componentEditor.getMaster() - .getValue(), feature, keybinding); - if (cmd.canExecute()) { - componentEditor.getEditingDomain().getCommandStack().execute(cmd); - } - } - } - - @Override - protected int getItemCount() { - if (viewer.getContentProvider() == null || viewer.getInput() == null) { - return 0; - } - return ((ObservableListContentProvider) viewer.getContentProvider()).getElements(viewer.getInput()).length; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/E4StringPickList.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/E4StringPickList.java deleted file mode 100644 index aa9c06e9..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/E4StringPickList.java +++ /dev/null @@ -1,192 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation, Ongoing Maintenance - *******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.internal.common; - -import java.util.Arrays; -import java.util.List; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.ui.model.application.MApplicationElement; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Text; - -/** - * A PickList for creating a string list. Action include ordering, adding, - * removing, and replacing. - * - * @author Steven Spungin - * - */ -public class E4StringPickList extends AbstractPickList { - - private Text text; - private Button tiReplace; - private AbstractComponentEditor editor; - private EStructuralFeature feature; - - public E4StringPickList(Composite parent, int flags, List<PickListFeatures> list, Messages messages, AbstractComponentEditor editor, EStructuralFeature feature) { - super(parent, flags, Arrays.asList(PickListFeatures.NO_PICKER), messages, editor); - - this.editor = editor; - this.feature = feature; - - // TODO does not respect NO_ORDER yet - - tiReplace = new Button(getToolBar(), SWT.PUSH); - tiReplace.setText(messages.E4StringPickList_Replace); - tiReplace.setImage(editor.createImage(ResourceProvider.IMG_Obj16_world_edit)); - - text = new Text(getToolBar().getParent(), SWT.SINGLE | SWT.LEAD | SWT.BORDER); - text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1)); - - tiReplace.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - handleReplaceText(); - } - }); - - getList().setContentProvider(new ObservableListContentProvider()); - - text.addModifyListener(new ModifyListener() { - - @Override - public void modifyText(ModifyEvent e) { - updateUiState(); - } - }); - - updateUiState(); - - } - - @Override - protected void moveUpPressed() { - if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - Object container = editor.getMaster().getValue(); - tryEObjectMove(obj, (EObject) container, -1); - } - } - } - - @Override - protected void moveDownPressed() { - if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - Object container = editor.getMaster().getValue(); - tryEObjectMove(obj, (EObject) container, 1); - } - } - } - - @Override - protected void removePressed() { - if (!viewer.getSelection().isEmpty()) { - List<?> keybinding = ((IStructuredSelection) viewer.getSelection()).toList(); - Command cmd = RemoveCommand.create(editor.getEditingDomain(), editor.getMaster().getValue(), feature, keybinding); - if (cmd.canExecute()) { - editor.getEditingDomain().getCommandStack().execute(cmd); - } - } - } - - protected void handleReplaceText() { - if (getTextWidget().getText().trim().length() > 0) { - if (!viewer.getSelection().isEmpty()) { - String[] tags = getTextWidget().getText().split(";"); //$NON-NLS-1$ - for (int i = 0; i < tags.length; i++) { - tags[i] = tags[i].trim(); - } - - MApplicationElement appEl = (MApplicationElement) editor.getMaster().getValue(); - EObject el = (EObject) editor.getMaster().getValue(); - List<?> ids = ((IStructuredSelection) viewer.getSelection()).toList(); - Object curVal = ((IStructuredSelection) viewer.getSelection()).getFirstElement(); - EObject container = (EObject) editor.getMaster().getValue(); - List<?> l = (List<?>) container.eGet(feature); - int idx = l.indexOf(curVal); - if (idx >= 0) { - Command cmdRemove = RemoveCommand.create(editor.getEditingDomain(), el, feature, ids); - Command cmdInsert = AddCommand.create(editor.getEditingDomain(), appEl, feature, Arrays.asList(tags), idx); - if (cmdRemove.canExecute() && cmdInsert.canExecute()) { - editor.getEditingDomain().getCommandStack().execute(cmdRemove); - editor.getEditingDomain().getCommandStack().execute(cmdInsert); - } - getTextWidget().setText(""); //$NON-NLS-1$ - } - } - } - } - - @Override - public void updateUiState() { - super.updateUiState(); - - if (getTextWidget() != null) { - IStructuredSelection sel = (IStructuredSelection) viewer.getSelection(); - Object firstViewerElement = sel.getFirstElement(); - boolean diff = !getTextWidget().getText().equals(firstViewerElement); - tiReplace.setEnabled(firstViewerElement != null && !getTextWidget().getText().isEmpty() && diff); - } - } - - @Override - protected int getItemCount() { - if (viewer.getContentProvider() == null || viewer.getInput() == null) { - return 0; - } - return ((ObservableListContentProvider) viewer.getContentProvider()).getElements(viewer.getInput()).length; - } - - protected Button getReplaceWidget() { - return tiReplace; - } - - public Text getTextWidget() { - return text; - } - - protected void tryEObjectMove(Object obj, EObject container, int delta) { - List<?> l = (List<?>) container.eGet(feature); - int idx = l.indexOf(obj) + delta; - if ((delta > 0 && idx < l.size()) || (delta < 0 && idx >= 0)) { - Command cmd = MoveCommand.create(editor.getEditingDomain(), editor.getMaster().getValue(), feature, obj, idx); - - if (cmd.canExecute()) { - editor.getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/EClassLabelProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/EClassLabelProvider.java deleted file mode 100644 index 9ec9da8f..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/EClassLabelProvider.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation - *******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.internal.common; - -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.jface.viewers.LabelProvider; - -/** - * Uses the default editor for the EClass to calculate the label - * - * @author Steven Spungin - * - */ -public class EClassLabelProvider extends LabelProvider { - private final ModelEditor editor; - - public EClassLabelProvider(ModelEditor editor) { - this.editor = editor; - } - - @Override - public String getText(Object element) { - final EClass eclass = (EClass) element; - final AbstractComponentEditor elementEditor = editor.getEditor(eclass); - if (elementEditor != null) { - return elementEditor.getLabel(element); - } - return eclass.getName(); - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/FeatureClassLabelProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/FeatureClassLabelProvider.java deleted file mode 100644 index 64900bd9..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/FeatureClassLabelProvider.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation - *******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.internal.common; - -import org.eclipse.e4.tools.emf.ui.common.IEditorFeature.FeatureClass; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.jface.viewers.LabelProvider; - -/** - * Uses the default editor for the FeatureClass EClass to calculate the label - * - * @author Steven Spungin - * - */ -public class FeatureClassLabelProvider extends LabelProvider { - private final ModelEditor editor; - - public FeatureClassLabelProvider(ModelEditor editor) { - this.editor = editor; - } - - @Override - public String getText(Object element) { - final FeatureClass eFeatureClass = (FeatureClass) element; - final EClass eclass = eFeatureClass.eClass; - final AbstractComponentEditor elementEditor = editor.getEditor(eclass); - if (elementEditor != null) { - return elementEditor.getLabel(null); - } - return eclass.getName(); - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java deleted file mode 100644 index 8d95a548..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ /dev/null @@ -1,1963 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2014 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Wim Jongman <wim.jongman@remainsoftware.com> - Maintenance - * Marco Descher <marco@descher.at> - Bug395982, 426653, 422465, 429674 - * Lars Vogel <Lars.Vogel@gmail.com> - Ongoing maintenance - * Steven Spungin <steven@spungin.tv> - Bug 396902, 431755, 431735, 424730, 424730, 391089, 437236, 437552, Ongoing - * Maintenance - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import javax.annotation.PostConstruct; -import javax.annotation.PreDestroy; -import javax.inject.Inject; - -import org.eclipse.core.databinding.ObservablesManager; -import org.eclipse.core.databinding.observable.IObservable; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.map.IMapChangeListener; -import org.eclipse.core.databinding.observable.map.IObservableMap; -import org.eclipse.core.databinding.observable.map.MapChangeEvent; -import org.eclipse.core.databinding.observable.masterdetail.IObservableFactory; -import org.eclipse.core.databinding.observable.set.ISetChangeListener; -import org.eclipse.core.databinding.observable.set.SetChangeEvent; -import org.eclipse.core.databinding.observable.set.WritableSet; -import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.RegistryFactory; -import org.eclipse.core.runtime.preferences.IEclipsePreferences; -import org.eclipse.e4.core.contexts.ContextInjectionFactory; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.core.di.annotations.Execute; -import org.eclipse.e4.core.di.annotations.Optional; -import org.eclipse.e4.core.di.extensions.Preference; -import org.eclipse.e4.core.services.contributions.IContributionFactory; -import org.eclipse.e4.core.services.nls.Translation; -import org.eclipse.e4.core.services.translation.TranslationService; -import org.eclipse.e4.tools.emf.ui.common.AbstractElementEditorContribution; -import org.eclipse.e4.tools.emf.ui.common.IContributionClassCreator; -import org.eclipse.e4.tools.emf.ui.common.IEditorDescriptor; -import org.eclipse.e4.tools.emf.ui.common.IEditorFeature; -import org.eclipse.e4.tools.emf.ui.common.IEditorFeature.FeatureClass; -import org.eclipse.e4.tools.emf.ui.common.IExtensionLookup; -import org.eclipse.e4.tools.emf.ui.common.IModelExtractor; -import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.e4.tools.emf.ui.common.IScriptingSupport; -import org.eclipse.e4.tools.emf.ui.common.MemoryTransfer; -import org.eclipse.e4.tools.emf.ui.common.ModelEditorPreferences; -import org.eclipse.e4.tools.emf.ui.common.Plugin; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.PatternFilter; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.component.AddonsEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.ApplicationEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.AreaEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.BindingContextEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.BindingTableEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.CategoryEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.CommandEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.CommandParameterEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.CompositePartEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.CoreExpressionEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.DefaultEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.DialogEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.DirectMenuItemEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.DirectToolItemEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.DynamicMenuContributionEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.HandledMenuItemEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.HandledToolItemEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.HandlerEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.KeyBindingEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.MenuContributionEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.MenuEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.MenuSeparatorEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.ModelFragmentsEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.ParameterEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.PartDescriptorEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.PartEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.PartSashContainerEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.PartStackEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.PerspectiveEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.PerspectiveStackEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.PlaceholderEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.PopupMenuEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.StringModelFragment; -import org.eclipse.e4.tools.emf.ui.internal.common.component.ToolBarContributionEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.ToolBarEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.ToolBarSeparatorEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.ToolControlEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.TrimBarEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.TrimContributionEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.TrimmedWindowEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.WindowEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.WizardDialogEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.tabs.EmfUtil; -import org.eclipse.e4.tools.emf.ui.internal.common.component.tabs.IGotoObject; -import org.eclipse.e4.tools.emf.ui.internal.common.component.tabs.ListTab; -import org.eclipse.e4.tools.emf.ui.internal.common.component.tabs.XmiTab; -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VApplicationAddons; -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VApplicationCategoriesEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VApplicationWindowEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VBindingTableEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VCommandEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VHandlerEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VItemParametersEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VMenuContributionsEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VModelFragmentsEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VModelImportsEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VPartDescriptor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VPartDescriptorMenuEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VPartMenuEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VPerspectiveControlEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VPerspectiveWindowsEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VRootBindingContexts; -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VSnippetsEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VToolBarContributionsEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VTrimContributionsEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowControlEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowSharedElementsEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowTrimEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowWindowsEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.properties.ExportIdsHandler; -import org.eclipse.e4.tools.emf.ui.internal.common.properties.ExternalizeStringHandler; -import org.eclipse.e4.tools.emf.ui.internal.common.properties.ProjectOSGiTranslationProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.xml.EMFDocumentResourceMediator; -import org.eclipse.e4.tools.services.IClipboardService; -import org.eclipse.e4.tools.services.IClipboardService.Handler; -import org.eclipse.e4.tools.services.IResourcePool; -import org.eclipse.e4.ui.di.Focus; -import org.eclipse.e4.ui.di.Persist; -import org.eclipse.e4.ui.di.PersistState; -import org.eclipse.e4.ui.model.application.MApplication; -import org.eclipse.e4.ui.model.application.MApplicationElement; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.MContext; -import org.eclipse.e4.ui.model.application.ui.MElementContainer; -import org.eclipse.e4.ui.model.application.ui.MUIElement; -import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; -import org.eclipse.e4.ui.model.application.ui.basic.MPart; -import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.e4.ui.model.fragment.MModelFragments; -import org.eclipse.e4.ui.model.fragment.impl.FragmentPackageImpl; -import org.eclipse.e4.ui.model.internal.ModelUtils; -import org.eclipse.e4.ui.workbench.modeling.ESelectionService; -import org.eclipse.e4.ui.workbench.swt.internal.copy.FilteredTree; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.IEMFProperty; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.CommandParameter; -import org.eclipse.emf.edit.command.DeleteCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.IMenuListener; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.action.Separator; -import org.eclipse.jface.databinding.viewers.ObservableListTreeContentProvider; -import org.eclipse.jface.databinding.viewers.TreeStructureAdvisor; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.resource.JFaceResources; -import org.eclipse.jface.resource.StringConverter; -import org.eclipse.jface.viewers.AbstractTreeViewer; -import org.eclipse.jface.viewers.DoubleClickEvent; -import org.eclipse.jface.viewers.IDoubleClickListener; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ITreeViewerListener; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TreeExpansionEvent; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerDropAdapter; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.custom.SashForm; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.dnd.Clipboard; -import org.eclipse.swt.dnd.DND; -import org.eclipse.swt.dnd.DragSourceAdapter; -import org.eclipse.swt.dnd.DragSourceEvent; -import org.eclipse.swt.dnd.Transfer; -import org.eclipse.swt.dnd.TransferData; -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.events.KeyAdapter; -import org.eclipse.swt.events.KeyEvent; -import org.eclipse.swt.events.KeyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.TreeAdapter; -import org.eclipse.swt.events.TreeEvent; -import org.eclipse.swt.graphics.RGB; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.TreeItem; - -public class ModelEditor implements IGotoObject { - private static final String ORG_ECLIPSE_E4_TOOLS_MODELEDITOR_FILTEREDTREE_ENABLED_XMITAB_DISABLED = "org.eclipse.e4.tools.modeleditor.filteredtree.enabled.xmitab.disabled";//$NON-NLS-1$ - - public static final String CSS_CLASS_KEY = "org.eclipse.e4.ui.css.CssClassName"; //$NON-NLS-1$ - - public static final String VIRTUAL_PART_MENU = ModelEditor.class.getName() + ".VIRTUAL_PART_MENU"; //$NON-NLS-1$ - public static final String VIRTUAL_HANDLER = ModelEditor.class.getName() + ".VIRTUAL_HANDLER"; //$NON-NLS-1$ - public static final String VIRTUAL_BINDING_TABLE = ModelEditor.class.getName() + ".VIRTUAL_BINDING_TABLE"; //$NON-NLS-1$ - public static final String VIRTUAL_COMMAND = ModelEditor.class.getName() + ".VIRTUAL_COMMAND"; //$NON-NLS-1$ - public static final String VIRTUAL_APPLICATION_WINDOWS = ModelEditor.class.getName() - + ".VIRTUAL_APPLICATION_WINDOWS"; //$NON-NLS-1$ - public static final String VIRTUAL_PERSPECTIVE_WINDOWS = ModelEditor.class.getName() - + ".VIRTUAL_PERSPECTIVE_WINDOWS"; //$NON-NLS-1$ - public static final String VIRTUAL_WINDOW_WINDOWS = ModelEditor.class.getName() + ".VIRTUAL_WINDOW_WINDOWS"; //$NON-NLS-1$ - public static final String VIRTUAL_WINDOW_CONTROLS = ModelEditor.class.getName() + ".VIRTUAL_WINDOW_CONTROLS"; //$NON-NLS-1$ - public static final String VIRTUAL_PART_DESCRIPTORS = ModelEditor.class.getName() + ".VIRTUAL_PART_DESCRIPTORS"; //$NON-NLS-1$ - public static final String VIRTUAL_PARTDESCRIPTOR_MENU = ModelEditor.class.getName() - + ".VIRTUAL_PARTDESCRIPTOR_MENU"; //$NON-NLS-1$ - public static final String VIRTUAL_TRIMMED_WINDOW_TRIMS = ModelEditor.class.getName() - + ".VIRTUAL_TRIMMED_WINDOW_TRIMS"; //$NON-NLS-1$ - public static final String VIRTUAL_ADDONS = ModelEditor.class.getName() + ".VIRTUAL_ADDONS"; //$NON-NLS-1$ - public static final String VIRTUAL_MENU_CONTRIBUTIONS = ModelEditor.class.getName() + ".VIRTUAL_MENU_CONTRIBUTIONS"; //$NON-NLS-1$ - public static final String VIRTUAL_TOOLBAR_CONTRIBUTIONS = ModelEditor.class.getName() - + ".VIRTUAL_TOOLBAR_CONTRIBUTIONS"; //$NON-NLS-1$ - public static final String VIRTUAL_TRIM_CONTRIBUTIONS = ModelEditor.class.getName() + ".VIRTUAL_TRIM_CONTRIBUTIONS"; //$NON-NLS-1$ - public static final String VIRTUAL_WINDOW_SHARED_ELEMENTS = ModelEditor.class.getName() - + ".VIRTUAL_WINDOW_SHARED_ELEMENTS"; //$NON-NLS-1$ - public static final String VIRTUAL_MODEL_FRAGEMENTS = ModelEditor.class.getName() + ".VIRTUAL_MODEL_FRAGEMENTS"; //$NON-NLS-1$ - public static final String VIRTUAL_MODEL_IMPORTS = ModelEditor.class.getName() + ".VIRTUAL_MODEL_IMPORTS"; //$NON-NLS-1$ - public static final String VIRTUAL_CATEGORIES = ModelEditor.class.getName() + ".VIRTUAL_CATEGORIES"; //$NON-NLS-1$ - public static final String VIRTUAL_PARAMETERS = ModelEditor.class.getName() + ".VIRTUAL_PARAMETERS"; //$NON-NLS-1$ - public static final String VIRTUAL_MENUELEMENTS = ModelEditor.class.getName() + ".VIRTUAL_MENUELEMENTS"; //$NON-NLS-1$ - public static final String VIRTUAL_ROOT_CONTEXTS = ModelEditor.class.getName() + ".VIRTUAL_ROOT_CONTEXTS"; //$NON-NLS-1$ - public static final String VIRTUAL_PERSPECTIVE_CONTROLS = ModelEditor.class.getName() - + "VIRTUAL_PERSPECTIVE_CONTROLS"; //$NON-NLS-1$ - public static final String VIRTUAL_SNIPPETS = ModelEditor.class.getName() + "VIRTUAL_SNIPPETS"; //$NON-NLS-1$ - - public static final int TAB_FORM = 0; - public static final int TAB_XMI = 1; - public static final int TAB_LIST = 2; - - private final Map<EClass, AbstractComponentEditor> editorMap = new HashMap<EClass, AbstractComponentEditor>(); - private final Map<String, AbstractComponentEditor> virtualEditors = new HashMap<String, AbstractComponentEditor>(); - private final Map<Class<?>, List<AbstractElementEditorContribution>> tabContributions = new HashMap<Class<?>, List<AbstractElementEditorContribution>>(); - private final List<FeaturePath> labelFeaturePaths = new ArrayList<FeaturePath>(); - private final List<IEditorFeature> editorFeatures = new ArrayList<IEditorFeature>(); - private final List<IContributionClassCreator> contributionCreator = new ArrayList<IContributionClassCreator>(); - - private TreeViewer viewer; - private final IModelResource modelProvider; - private final IProject project; - - @Inject - ESelectionService selectionService; - - @Inject - MApplication app; - - private final IEclipseContext context; - private boolean fragment; - private Handler clipboardHandler; - - @Inject - @Optional - private IClipboardService clipboardService; - - @Inject - @Preference(nodePath = Plugin.ID, value = ModelEditorPreferences.AUTO_CREATE_ELEMENT_ID) - private boolean autoCreateElementId; - - @Inject - @Preference(nodePath = Plugin.ID, value = ModelEditorPreferences.SHOW_XMI_ID) - private boolean showXMIId; - - @Inject - @Preference(nodePath = Plugin.ID) - IEclipsePreferences preferences; - - @Inject - @Optional - private IExtensionLookup extensionLookup; - - @Inject - @Translation - private Messages messages; - - @Inject - @Optional - private IModelExtractor modelExtractor; - - private final ObservablesManager obsManager; - - private final IResourcePool resourcePool; - - private EMFDocumentResourceMediator emfDocumentProvider; - - private AbstractComponentEditor currentEditor; - - private Listener keyListener; - - private CTabFolder editorTabFolder; - - private boolean mod1Down = false; - - private boolean saving; - - private ListTab listTab; - - private CTabItem tabItemXmi; - - private CTabItem tabItemList; - - private CTabItem tabItemTree; - - private XmiTab xmiTab; - - public ModelEditor(Composite composite, IEclipseContext context, IModelResource modelProvider, IProject project, - final IResourcePool resourcePool) { - this.resourcePool = resourcePool; - this.modelProvider = modelProvider; - this.project = project; - this.context = context; - this.context.set(ModelEditor.class, this); - obsManager = new ObservablesManager(); - if (project != null) { - String localeString = ""; //$NON-NLS-1$ - final Object object = this.context.get(TranslationService.LOCALE); - // TODO simplify once we break e4 tools - // compatibility with Luna, in Luna we representation has changed to - // be Locale instead of String - if (object != null) { - localeString = object.toString(); - } - final ProjectOSGiTranslationProvider translationProvider = new ProjectOSGiTranslationProvider(project, - localeString) { - @Override - protected void updateResourceBundle() { - super.updateResourceBundle(); - if (viewer != null) { - viewer.getControl().getDisplay().asyncExec(new Runnable() { - - @Override - public void run() { - viewer.refresh(); - } - }); - } - } - }; - context.set(ProjectOSGiTranslationProvider.class, translationProvider); - } - labelFeaturePaths.add(FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); - labelFeaturePaths.add(FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - - // This is a workaround until Bug 437207 is merged. - // @PersistState will not be invoked. - composite.addDisposeListener(new DisposeListener() { - - @Override - public void widgetDisposed(DisposeEvent arg0) { - persistState(); - } - }); - } - - @PersistState - protected void persistState() { - if (listTab != null) { - listTab.saveSettings(); - } - } - - @PostConstruct - void postCreate(Composite composite) { - if (project == null) { - keyListener = new Listener() { - - @Override - public void handleEvent(Event event) { - if ((event.stateMask & SWT.ALT) == SWT.ALT) { - findAndHighlight(context.get(Display.class).getFocusControl()); - } - } - }; - context.get(Display.class).addFilter(SWT.MouseUp, keyListener); - } - - context.set(ModelEditor.class, this); - context.set(IResourcePool.class, resourcePool); - context.set(EditingDomain.class, modelProvider.getEditingDomain()); - context.set(IModelResource.class, modelProvider); - - if (project != null) { - context.set(IProject.class, project); - } - - loadEditorFeatures(); - registerDefaultEditors(); - registerVirtualEditors(); - - registerContributedEditors(); - registerContributedVirtualEditors(); - registerContributedEditorTabs(); - loadContributionCreators(); - - fragment = modelProvider.getRoot().get(0) instanceof MModelFragments; - - // For Bug 396902, create this before creating the Form tab - emfDocumentProvider = new EMFDocumentResourceMediator(modelProvider); - - editorTabFolder = new CTabFolder(composite, SWT.BOTTOM); - tabItemTree = new CTabItem(editorTabFolder, SWT.NONE); - tabItemTree.setText(messages.ModelEditor_Form); - tabItemTree.setControl(createFormTab(editorTabFolder)); - tabItemTree.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Obj16_application_form)); - - tab_list_show(true); - - tabItemXmi = new CTabItem(editorTabFolder, SWT.NONE); - tabItemXmi.setText(messages.ModelEditor_XMI); - xmiTab = createXMITab(editorTabFolder); - tabItemXmi.setControl(xmiTab); - tabItemXmi.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Obj16_chart_organisation)); - editorTabFolder.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (editorTabFolder.getSelectionIndex() == getTabIndex(tabItemXmi)) { - emfDocumentProvider.updateFromEMF(); - } - } - }); - - editorTabFolder.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - // When the list tab is visible, register the IViewEObjects - // interface - // This allows external commands to interact with the view. - // Eventually, all 3 tabs, or even the ModelEditor itself, could - // implement the interface. - final String key = "org.eclipse.e4.tools.active-object-viewer"; //$NON-NLS-1$ - if (listTab != null && editorTabFolder.getSelectionIndex() == getTabIndex(listTab.getTabItem())) { - app.getContext().set(key, listTab); - } else { - app.getContext().set(key, null); - } - } - }); - - editorTabFolder.setSelection(0); - } - - /** - * @param tabItem - * @return The index of the tab item. Should never return -1. - */ - static public int getTabIndex(CTabItem tabItem) { - return Arrays.asList(tabItem.getParent().getItems()).indexOf(tabItem); - } - - private void findAndHighlight(Control control) { - if (control != null) { - MApplicationElement m = findModelElement(control); - final MApplicationElement o = m; - if (m != null) { - final List<MApplicationElement> l = new ArrayList<MApplicationElement>(); - do { - l.add(m); - m = (MApplicationElement) ((EObject) m).eContainer(); - } while (m != null); - - if (o instanceof MPart) { - System.err.println(getClass().getName() + ".findAndHighLight: " + o); //$NON-NLS-1$ - System.err.println(getClass().getName() - + ".findAndHighLight: " + ((EObject) o).eContainingFeature()); //$NON-NLS-1$ - } - - viewer.setSelection(new StructuredSelection(o)); - } - } - } - - private MApplicationElement findModelElement(Control control) { - do { - if (control.getData("modelElement") != null) { //$NON-NLS-1$ - return (MApplicationElement) control.getData("modelElement"); //$NON-NLS-1$ - } - control = control.getParent(); - } while (control != null); - - return null; - } - - private XmiTab createXMITab(Composite composite) { - final IEclipseContext childContext = context.createChild(); - childContext.set(Composite.class, composite); - childContext.set(EMFDocumentResourceMediator.class, emfDocumentProvider); - childContext.set(IEclipsePreferences.class, preferences); - childContext.set(IResourcePool.class, resourcePool); - final XmiTab ret = ContextInjectionFactory.make(XmiTab.class, childContext); - return ret; - } - - private Composite createFormTab(Composite composite) { - final SashForm form = new SashForm(composite, SWT.HORIZONTAL); - form.setBackground(form.getDisplay().getSystemColor(SWT.COLOR_WHITE)); - - viewer = createTreeViewerArea(form); - - final Composite parent = new Composite(form, SWT.NONE); - final FillLayout l = new FillLayout(); - parent.setLayout(l); - - final Composite editingArea = new Composite(parent, SWT.BORDER); - final GridLayout gl = new GridLayout(); - editingArea.setLayout(gl); - - final Composite headerContainer = new Composite(editingArea, SWT.NONE); - headerContainer.setLayout(new GridLayout(3, false)); - headerContainer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - final Label iconLabel = new Label(headerContainer, SWT.NONE); - iconLabel.setLayoutData(new GridData(20, 20)); - - final Label sectionHeaderLabel = new Label(headerContainer, SWT.NONE); - sectionHeaderLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - final Label separatorLabel = new Label(headerContainer, SWT.SEPARATOR | SWT.HORIZONTAL); - final GridData gridData = new GridData(GridData.FILL_HORIZONTAL); - gridData.horizontalSpan = 2; - separatorLabel.setLayoutData(gridData); - - final StackLayout layout = new StackLayout(); - final Composite contentContainer = new Composite(editingArea, SWT.NONE); - contentContainer.setLayoutData(new GridData(GridData.FILL_BOTH)); - - contentContainer.setLayout(layout); - - viewer.getTree().addKeyListener(new KeyAdapter() { - @Override - public void keyReleased(final KeyEvent e) { - if (e.keyCode == SWT.DEL) { - final List<EObject> list = new ArrayList<EObject>(); - final IStructuredSelection selection = (IStructuredSelection) viewer.getSelection(); - for (final Object o : ((StructuredSelection) selection).toList()) { - if (o instanceof EObject) { - list.add((EObject) o); - } - } - if (list.isEmpty() == false) { - final Command cmd = DeleteCommand.create(modelProvider.getEditingDomain(), list); - if (cmd.canExecute()) { - modelProvider.getEditingDomain().getCommandStack().execute(cmd); - } - } - } - } - }); - viewer.addSelectionChangedListener(new ISelectionChangedListener() { - - @Override - public void selectionChanged(SelectionChangedEvent event) { - if (!event.getSelection().isEmpty()) { - final IStructuredSelection s = (IStructuredSelection) event.getSelection(); - if (s.getFirstElement() instanceof EObject) { - final EObject obj = (EObject) s.getFirstElement(); - final AbstractComponentEditor editor = getEditor(obj.eClass()); - if (editor != null) { - currentEditor = editor; - sectionHeaderLabel.setText(editor.getLabel(obj)); - iconLabel.setImage(editor.getImage(obj, iconLabel.getDisplay())); - obsManager.runAndCollect(new Runnable() { - - @Override - public void run() { - final Composite comp = editor.getEditor(contentContainer, s.getFirstElement()); - comp.setBackgroundMode(SWT.INHERIT_DEFAULT); - layout.topControl = comp; - contentContainer.layout(true); - } - }); - } - } else { - final VirtualEntry<?> entry = (VirtualEntry<?>) s.getFirstElement(); - final AbstractComponentEditor editor = virtualEditors.get(entry.getId()); - if (editor != null) { - currentEditor = editor; - sectionHeaderLabel.setText(editor.getLabel(entry)); - iconLabel.setImage(editor.getImage(entry, iconLabel.getDisplay())); - obsManager.runAndCollect(new Runnable() { - - @Override - public void run() { - final Composite comp = editor.getEditor(contentContainer, s.getFirstElement()); - comp.setBackgroundMode(SWT.INHERIT_DEFAULT); - layout.topControl = comp; - contentContainer.layout(true); - } - - }); - } - } - - // Rectangle r = scrolling.getClientArea(); - // scrolling.setMinSize(contentContainer.computeSize(r.width, - // SWT.DEFAULT)); - // scrolling.setOrigin(0, 0); - // scrolling.layout(true, true); - - if (selectionService != null) { - selectionService.setSelection(s.getFirstElement()); - } - - } - } - }); - - form.setWeights(new int[] { 3, 4 }); - - final MenuManager mgr = new MenuManager(); - mgr.setRemoveAllWhenShown(true); - mgr.addMenuListener(new IMenuListener() { - - @Override - public void menuAboutToShow(IMenuManager manager) { - final IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - final List<?> listOfSelections = s.toList(); - final int noSelected = listOfSelections.size(); - - boolean addSeparator = false; - if (!s.isEmpty() && noSelected == 1) { - List<Action> actions; - if (s.getFirstElement() instanceof VirtualEntry<?>) { - actions = virtualEditors.get(((VirtualEntry<?>) s.getFirstElement()).getId()).getActions( - s.getFirstElement()); - if (actions.size() > 0) { - final MenuManager addMenu = new MenuManager(messages.ModelEditor_AddChild); - for (final Action a : actions) { - addSeparator = true; - addMenu.add(a); - } - manager.add(addMenu); - } - - actions = virtualEditors.get(((VirtualEntry<?>) s.getFirstElement()).getId()).getActionsImport( - s.getFirstElement()); - if (actions.size() > 0) { - final MenuManager menu = new MenuManager(messages.ModelEditor_Import3x); - for (final Action a : actions) { - addSeparator = true; - menu.add(a); - } - manager.add(menu); - } - - if (addSeparator) { - manager.add(new Separator()); - } - - } else { - - final EObject o = (EObject) s.getFirstElement(); - final AbstractComponentEditor editor = getEditor(o.eClass()); - - // Build Add Child menu - if (editor != null) { - actions = new ArrayList<Action>(editor.getActions(s.getFirstElement())); - } else { - actions = new ArrayList<Action>(); - } - - if (actions.size() > 0) { - final MenuManager addMenu = new MenuManager(messages.ModelEditor_AddChild); - for (final Action a : actions) { - addSeparator = true; - addMenu.add(a); - } - manager.add(addMenu); - } - - // Build import menu - if (editor != null) { - actions = new ArrayList<Action>(editor.getActionsImport(s.getFirstElement())); - } else { - actions = new ArrayList<Action>(); - } - - if (actions.size() > 0) { - // TODO WIM - extract nls - final MenuManager menu = new MenuManager(messages.ModelEditor_Import3x); - for (final Action a : actions) { - addSeparator = true; - menu.add(a); - } - manager.add(menu); - } - - if (o.eContainer() != null) { - addSeparator = true; - manager.add(new Action(messages.ModelEditor_Delete, ImageDescriptor - .createFromImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Obj16_cross))) { - @Override - public void run() { - final Command cmd = DeleteCommand.create(modelProvider.getEditingDomain(), o); - if (cmd.canExecute()) { - modelProvider.getEditingDomain().getCommandStack().execute(cmd); - } - } - }); - } - } - } - // multi selection - if (noSelected > 0) { - if (!isModelFragment() && modelExtractor != null) { - manager.add(new Action(messages.ModelEditor_ExtractFragment, ImageDescriptor - .createFromImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_ModelFragments))) { - @Override - public void run() { - final ArrayList<MApplicationElement> maes = new ArrayList<MApplicationElement>(); - for (final Object objSelect : listOfSelections) { - EObject container = null; - if (objSelect instanceof VirtualEntry<?>) { - - final VirtualEntry<?> ve = (VirtualEntry<?>) objSelect; - container = (EObject) ve.getOriginalParent(); - final IObservableList list = ve.getList(); - final Iterator<?> iterator = list.iterator(); - while (iterator.hasNext()) { - maes.add((MApplicationElement) iterator.next()); - } - - } else { - container = ((EObject) objSelect).eContainer(); - final MApplicationElement objSelect2 = (MApplicationElement) objSelect; - if (!(objSelect2 instanceof MApplication)) { - maes.add(objSelect2); - } else { - // can't extract application - return; - } - - } - - final String containerId = ((MApplicationElement) container).getElementId(); - if (containerId == null || containerId.length() == 0) { - MessageDialog.openError(viewer.getControl().getShell(), null, - messages.ModelEditor_ExtractFragment_NoParentId); - - return; - } - - } - - if (modelExtractor.extract(viewer.getControl().getShell(), project, maes)) { - final Command cmd = DeleteCommand.create(modelProvider.getEditingDomain(), maes); - if (cmd.canExecute()) { - modelProvider.getEditingDomain().getCommandStack().execute(cmd); - } - } - - } - }); - } - - } - - final IExtensionRegistry registry = RegistryFactory.getRegistry(); - final IExtensionPoint extPoint = registry.getExtensionPoint("org.eclipse.e4.tools.emf.ui.scripting"); //$NON-NLS-1$ - final IConfigurationElement[] elements = extPoint.getConfigurationElements(); - - if (elements.length > 0 && !s.isEmpty() && s.getFirstElement() instanceof MApplicationElement - && noSelected == 1) { - if (addSeparator) { - manager.add(new Separator()); - } - - addSeparator = false; - - final MenuManager scriptExecute = new MenuManager(messages.ModelEditor_Script); - manager.add(scriptExecute); - for (final IConfigurationElement e : elements) { - final IConfigurationElement le = e; - scriptExecute.add(new Action(e.getAttribute("label")) { //$NON-NLS-1$ - @Override - public void run() { - try { - final MApplicationElement o = (MApplicationElement) s.getFirstElement(); - final IScriptingSupport support = (IScriptingSupport) le - .createExecutableExtension("class"); //$NON-NLS-1$ - IEclipseContext ctx = null; - if (project == null) { - if (o instanceof MContext) { - ctx = ((MContext) o).getContext(); - } else { - ctx = ModelUtils.getContainingContext(o); - } - } - - support.openEditor(viewer.getControl().getShell(), s.getFirstElement(), ctx); - } catch (final CoreException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - }); - } - } - - if (project != null) { - - if (addSeparator) { - manager.add(new Separator()); - } - - final Action nlsAction = new Action(messages.ModelEditor_ExternalizeStrings) { - @Override - public void run() { - final ExternalizeStringHandler h = ContextInjectionFactory.make( - ExternalizeStringHandler.class, context); - ContextInjectionFactory.invoke(h, Execute.class, context); - } - }; - - final Action extIdAction = new Action(messages.ModelEditor_ExportIds) { - @Override - public void run() { - final ExportIdsHandler h = ContextInjectionFactory.make(ExportIdsHandler.class, context); - ContextInjectionFactory.invoke(h, Execute.class, context); - } - }; - - manager.add(nlsAction); - manager.add(extIdAction); - } else { - if (addSeparator) { - manager.add(new Separator()); - } - - if (s.getFirstElement() instanceof MUIElement) { - final MUIElement el = (MUIElement) s.getFirstElement(); - if (el.getWidget() instanceof Control) { - manager.add(new Action(messages.ModelEditor_ShowControl) { - - @Override - public void run() { - ControlHighlighter.show((Control) el.getWidget()); - } - }); - - } - } - - } - - if (addSeparator) { - manager.add(new Separator()); - } - - final Action expandAction = new Action(messages.ModelEditor_ExpandSubtree) { - @Override - public void run() { - if (!s.isEmpty()) { - if (viewer.getExpandedState(s.getFirstElement())) { - viewer.collapseToLevel(s.getFirstElement(), AbstractTreeViewer.ALL_LEVELS); - } else { - viewer.expandToLevel(s.getFirstElement(), AbstractTreeViewer.ALL_LEVELS); - } - } - } - }; - - manager.add(expandAction); - - if (s.getFirstElement() instanceof EObject) { - manager.add(new Separator()); - final EObject el = (EObject) s.getFirstElement(); - final Action gotoXmiAction = new Action(messages.ModelEditor_goto_xmi) { - @Override - public void run() { - gotoEObject(TAB_XMI, el); - } - }; - manager.add(gotoXmiAction); - - if (listTab != null) { - if (EmfUtil.getAttribute(el, "elementId") != null) { //$NON-NLS-1$ - final Action gotoListAction = new Action(messages.ModelEditor_goto_list) { - @Override - public void run() { - gotoEObject(TAB_LIST, el); - } - }; - manager.add(gotoListAction); - } - } - - } - } - }); - - // Save the stateMask - viewer.getTree().addKeyListener(new KeyListener() { - @Override - public void keyReleased(KeyEvent e) { - if (mod1Down && (e.keyCode & SWT.MOD1) == SWT.MOD1) { - mod1Down = false; - } - } - - @Override - public void keyPressed(KeyEvent e) { - if (!mod1Down && (e.keyCode & SWT.MOD1) == SWT.MOD1) { - mod1Down = true; - } - } - }); - - viewer.addTreeListener(new ITreeViewerListener() { - @Override - public void treeExpanded(final TreeExpansionEvent event) { - if (mod1Down) { - viewer.getTree().getDisplay().asyncExec(new Runnable() { - @Override - public void run() { - viewer.expandToLevel(event.getElement(), AbstractTreeViewer.ALL_LEVELS); - } - }); - } - } - - @Override - public void treeCollapsed(final TreeExpansionEvent event) { - if (mod1Down) { - viewer.getTree().getDisplay().asyncExec(new Runnable() { - @Override - public void run() { - viewer.collapseToLevel(event.getElement(), AbstractTreeViewer.ALL_LEVELS); - } - }); - } - } - }); - - viewer.getControl().setMenu(mgr.createContextMenu(viewer.getControl())); - viewer.setSelection(new StructuredSelection(modelProvider.getRoot())); - - return form; - } - - public IExtensionLookup getExtensionLookup() { - return extensionLookup; - } - - public boolean isAutoCreateElementId() { - return autoCreateElementId && project != null; - } - - public IProject getProject() { - return project; - } - - public boolean isShowXMIId() { - return showXMIId; - } - - private void loadContributionCreators() { - final IExtensionRegistry registry = RegistryFactory.getRegistry(); - final IExtensionPoint extPoint = registry.getExtensionPoint("org.eclipse.e4.tools.emf.ui.editors"); //$NON-NLS-1$ - - for (final IConfigurationElement el : extPoint.getConfigurationElements()) { - if (!"contributionClassCreator".equals(el.getName())) { //$NON-NLS-1$ - continue; - } - - try { - contributionCreator.add((IContributionClassCreator) el.createExecutableExtension("class")); //$NON-NLS-1$ - } catch (final CoreException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - - public IContributionClassCreator getContributionCreator(EClass eClass) { - for (final IContributionClassCreator c : contributionCreator) { - if (c.isSupported(eClass)) { - return c; - } - } - return null; - } - - private void loadEditorFeatures() { - final IExtensionRegistry registry = RegistryFactory.getRegistry(); - final IExtensionPoint extPoint = registry.getExtensionPoint("org.eclipse.e4.tools.emf.ui.editors"); //$NON-NLS-1$ - - for (final IConfigurationElement el : extPoint.getConfigurationElements()) { - if (!"editorfeature".equals(el.getName())) { //$NON-NLS-1$ - continue; - } - - try { - editorFeatures.add((IEditorFeature) el.createExecutableExtension("class")); //$NON-NLS-1$ - } catch (final CoreException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - - public boolean isModelFragment() { - return fragment; - } - - public boolean isLiveModel() { - return !modelProvider.isSaveable(); - } - - public List<FeatureClass> getFeatureClasses(EClass eClass, EStructuralFeature feature) { - final List<FeatureClass> list = new ArrayList<IEditorFeature.FeatureClass>(); - - for (final IEditorFeature f : editorFeatures) { - list.addAll(f.getFeatureClasses(eClass, feature)); - } - - return list; - } - - private TreeViewer createTreeViewerArea(Composite parent) { - - final Composite treeArea = new Composite(parent, SWT.BORDER); - - treeArea.setLayout(new FillLayout()); - treeArea.setData(CSS_CLASS_KEY, "formContainer"); //$NON-NLS-1$ - treeArea.setBackgroundMode(SWT.INHERIT_DEFAULT); - - TreeViewer tempViewer = null; - final String property = System - .getProperty(ORG_ECLIPSE_E4_TOOLS_MODELEDITOR_FILTEREDTREE_ENABLED_XMITAB_DISABLED); - if (property != null || preferences.getBoolean(ModelEditorPreferences.TAB_FORM_SEARCH_SHOW, false)) { - final FilteredTree viewParent = new FilteredTree(treeArea, SWT.MULTI | SWT.FULL_SELECTION | SWT.H_SCROLL - | SWT.V_SCROLL, new PatternFilter(), false); - tempViewer = viewParent.getViewer(); - } else { - tempViewer = new TreeViewerEx(treeArea, SWT.MULTI | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL, - emfDocumentProvider, modelProvider); - } - final TreeViewer viewer = tempViewer; - - viewer.setLabelProvider(new ComponentLabelProvider(this, messages)); - final ObservableListTreeContentProvider contentProvider = new ObservableListTreeContentProvider( - new ObservableFactoryImpl(), new TreeStructureAdvisor() { - }); - viewer.setContentProvider(contentProvider); - - final WritableSet clearedSet = new WritableSet(); - - contentProvider.getKnownElements().addSetChangeListener(new ISetChangeListener() { - - @Override - public void handleSetChange(SetChangeEvent event) { - for (final Object o : event.diff.getAdditions()) { - if (o instanceof EObject) { - clearedSet.add(o); - } - } - - for (final Object o : event.diff.getRemovals()) { - if (o instanceof EObject) { - clearedSet.remove(o); - } - } - } - }); - - for (final FeaturePath p : labelFeaturePaths) { - final IObservableMap map = EMFProperties.value(p).observeDetail(clearedSet); - map.addMapChangeListener(new IMapChangeListener() { - - @Override - public void handleMapChange(MapChangeEvent event) { - viewer.update(event.diff.getChangedKeys().toArray(), null); - } - }); - } - - viewer.setInput(modelProvider.getRoot()); - viewer.setAutoExpandLevel(2); - viewer.expandToLevel(viewer.getAutoExpandLevel()); - viewer.addDoubleClickListener(new IDoubleClickListener() { - - @Override - public void doubleClick(DoubleClickEvent event) { - final TreeViewer viewer = (TreeViewer) event.getViewer(); - final IStructuredSelection thisSelection = (IStructuredSelection) event.getSelection(); - final Object selectedNode = thisSelection.getFirstElement(); - if (mod1Down) { - if (viewer.getExpandedState(selectedNode)) { - viewer.setExpandedState(selectedNode, false); - } else { - viewer.expandToLevel(selectedNode, AbstractTreeViewer.ALL_LEVELS); - } - } else { - viewer.setExpandedState(selectedNode, !viewer.getExpandedState(selectedNode)); - } - - } - }); - - // Effect of filtered tree implementation (bug 391086) - viewer.getTree().addTreeListener(new TreeAdapter() { - @Override - public void treeCollapsed(TreeEvent e) { - viewer.expandToLevel(viewer.getAutoExpandLevel()); - } - }); - - final int ops = DND.DROP_MOVE; - viewer.addDragSupport(ops, new Transfer[] { MemoryTransfer.getInstance() }, new DragListener(viewer)); - viewer.addDropSupport(ops, new Transfer[] { MemoryTransfer.getInstance() }, new DropListener(viewer, - modelProvider.getEditingDomain())); - - return viewer; - } - - private void registerContributedVirtualEditors() { - final IExtensionRegistry registry = RegistryFactory.getRegistry(); - final IExtensionPoint extPoint = registry.getExtensionPoint("org.eclipse.e4.tools.emf.ui.editors"); //$NON-NLS-1$ - - for (final IConfigurationElement el : extPoint.getConfigurationElements()) { - if (!"virtualeditor".equals(el.getName())) { //$NON-NLS-1$ - continue; - } - - final IContributionFactory fact = context.get(IContributionFactory.class); - final AbstractComponentEditor editor = (AbstractComponentEditor) fact.create( - "bundleclass://" + el.getContributor().getName() + "/" + el.getAttribute("class"), context); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - registerVirtualEditor(el.getAttribute("id"), editor); //$NON-NLS-1$ - } - } - - private void registerVirtualEditors() { - registerVirtualEditor(VIRTUAL_PART_MENU, ContextInjectionFactory.make(VPartMenuEditor.class, context)); - registerVirtualEditor(VIRTUAL_HANDLER, ContextInjectionFactory.make(VHandlerEditor.class, context)); - registerVirtualEditor(VIRTUAL_BINDING_TABLE, ContextInjectionFactory.make(VBindingTableEditor.class, context)); - registerVirtualEditor(VIRTUAL_COMMAND, ContextInjectionFactory.make(VCommandEditor.class, context)); - registerVirtualEditor(VIRTUAL_APPLICATION_WINDOWS, - ContextInjectionFactory.make(VApplicationWindowEditor.class, context)); - registerVirtualEditor(VIRTUAL_WINDOW_WINDOWS, ContextInjectionFactory.make(VWindowWindowsEditor.class, context)); - registerVirtualEditor(VIRTUAL_PERSPECTIVE_WINDOWS, - ContextInjectionFactory.make(VPerspectiveWindowsEditor.class, context)); - registerVirtualEditor(VIRTUAL_WINDOW_CONTROLS, - ContextInjectionFactory.make(VWindowControlEditor.class, context)); - registerVirtualEditor(VIRTUAL_PART_DESCRIPTORS, ContextInjectionFactory.make(VPartDescriptor.class, context)); - registerVirtualEditor(VIRTUAL_PARTDESCRIPTOR_MENU, - ContextInjectionFactory.make(VPartDescriptorMenuEditor.class, context)); - registerVirtualEditor(VIRTUAL_TRIMMED_WINDOW_TRIMS, - ContextInjectionFactory.make(VWindowTrimEditor.class, context)); - registerVirtualEditor(VIRTUAL_ADDONS, ContextInjectionFactory.make(VApplicationAddons.class, context)); - registerVirtualEditor(VIRTUAL_MENU_CONTRIBUTIONS, - ContextInjectionFactory.make(VMenuContributionsEditor.class, context)); - registerVirtualEditor(VIRTUAL_TOOLBAR_CONTRIBUTIONS, - ContextInjectionFactory.make(VToolBarContributionsEditor.class, context)); - registerVirtualEditor(VIRTUAL_TRIM_CONTRIBUTIONS, - ContextInjectionFactory.make(VTrimContributionsEditor.class, context)); - registerVirtualEditor(VIRTUAL_WINDOW_SHARED_ELEMENTS, - ContextInjectionFactory.make(VWindowSharedElementsEditor.class, context)); - registerVirtualEditor(VIRTUAL_MODEL_FRAGEMENTS, - ContextInjectionFactory.make(VModelFragmentsEditor.class, context)); - registerVirtualEditor(VIRTUAL_MODEL_IMPORTS, ContextInjectionFactory.make(VModelImportsEditor.class, context)); - registerVirtualEditor(VIRTUAL_CATEGORIES, - ContextInjectionFactory.make(VApplicationCategoriesEditor.class, context)); - registerVirtualEditor(VIRTUAL_PARAMETERS, ContextInjectionFactory.make(VItemParametersEditor.class, context)); - registerVirtualEditor(VIRTUAL_ROOT_CONTEXTS, ContextInjectionFactory.make(VRootBindingContexts.class, context)); - registerVirtualEditor(VIRTUAL_PERSPECTIVE_CONTROLS, - ContextInjectionFactory.make(VPerspectiveControlEditor.class, context)); - registerVirtualEditor(VIRTUAL_SNIPPETS, ContextInjectionFactory.make(VSnippetsEditor.class, context)); - } - - private void registerVirtualEditor(String id, AbstractComponentEditor editor) { - virtualEditors.put(id, editor); - } - - public void setSelection(Object element) { - viewer.setSelection(new StructuredSelection(element)); - } - - private void registerContributedEditors() { - final IExtensionRegistry registry = RegistryFactory.getRegistry(); - final IExtensionPoint extPoint = registry.getExtensionPoint("org.eclipse.e4.tools.emf.ui.editors"); //$NON-NLS-1$ - - for (final IConfigurationElement el : extPoint.getConfigurationElements()) { - if (!"editor".equals(el.getName())) { //$NON-NLS-1$ - continue; - } - - try { - final IEditorDescriptor desc = (IEditorDescriptor) el.createExecutableExtension("descriptorClass"); //$NON-NLS-1$ - final EClass eClass = desc.getEClass(); - final IContributionFactory fact = context.get(IContributionFactory.class); - final AbstractComponentEditor editor = (AbstractComponentEditor) fact.create( - "bundleclass://" + el.getContributor().getName() + "/" + desc.getEditorClass().getName(), context); //$NON-NLS-1$ //$NON-NLS-2$ - registerEditor(eClass, editor); - } catch (final CoreException e) { - e.printStackTrace(); - } - } - } - - private void registerContributedEditorTabs() { - final IExtensionRegistry registry = RegistryFactory.getRegistry(); - final IExtensionPoint extPoint = registry.getExtensionPoint("org.eclipse.e4.tools.emf.ui.editors"); //$NON-NLS-1$ - for (final IConfigurationElement el : extPoint.getConfigurationElements()) { - if (!"editorTab".equals(el.getName())) { //$NON-NLS-1$ - continue; - } - - try { - final Object o = el.createExecutableExtension("contribution"); //$NON-NLS-1$ - if (o instanceof AbstractElementEditorContribution) { - final AbstractElementEditorContribution contribution = (AbstractElementEditorContribution) o; - ContextInjectionFactory.inject(contribution, context); - final Class<?> contribElem = contribution.getContributableTo(); - if (contribElem == null) { - continue; - } - if (!tabContributions.containsKey(contribElem)) { - tabContributions.put(contribElem, new ArrayList<AbstractElementEditorContribution>()); - } - final List<AbstractElementEditorContribution> res = tabContributions.get(contribElem); - res.add(contribution); - } - } catch (final CoreException e) { - e.printStackTrace(); - } - } - } - - public List<AbstractElementEditorContribution> getTabContributionsForClass(Class<?> clazz) { - final List<AbstractElementEditorContribution> ret = new ArrayList<AbstractElementEditorContribution>(); - for (final Class<?> clasz : tabContributions.keySet()) { - if (clasz.isAssignableFrom(clazz)) { - ret.addAll(tabContributions.get(clasz)); - } - } - return ret; - } - - private void registerDefaultEditors() { - System.err.println(getClass().getName() + ".registerDefaultEditors: " + resourcePool); //$NON-NLS-1$ - - registerEditor(ApplicationPackageImpl.Literals.APPLICATION, - ContextInjectionFactory.make(ApplicationEditor.class, context)); - registerEditor(ApplicationPackageImpl.Literals.ADDON, ContextInjectionFactory.make(AddonsEditor.class, context)); - - registerEditor(CommandsPackageImpl.Literals.KEY_BINDING, - ContextInjectionFactory.make(KeyBindingEditor.class, context)); - registerEditor(CommandsPackageImpl.Literals.HANDLER, ContextInjectionFactory.make(HandlerEditor.class, context)); - registerEditor(CommandsPackageImpl.Literals.COMMAND, ContextInjectionFactory.make(CommandEditor.class, context)); - registerEditor(CommandsPackageImpl.Literals.COMMAND_PARAMETER, - ContextInjectionFactory.make(CommandParameterEditor.class, context)); - registerEditor(CommandsPackageImpl.Literals.PARAMETER, - ContextInjectionFactory.make(ParameterEditor.class, context)); - registerEditor(CommandsPackageImpl.Literals.BINDING_TABLE, - ContextInjectionFactory.make(BindingTableEditor.class, context)); - registerEditor(CommandsPackageImpl.Literals.BINDING_CONTEXT, - ContextInjectionFactory.make(BindingContextEditor.class, context)); - registerEditor(CommandsPackageImpl.Literals.CATEGORY, - ContextInjectionFactory.make(CategoryEditor.class, context)); - - registerEditor(MenuPackageImpl.Literals.TOOL_BAR, ContextInjectionFactory.make(ToolBarEditor.class, context)); - registerEditor(MenuPackageImpl.Literals.DIRECT_TOOL_ITEM, - ContextInjectionFactory.make(DirectToolItemEditor.class, context)); - registerEditor(MenuPackageImpl.Literals.HANDLED_TOOL_ITEM, - ContextInjectionFactory.make(HandledToolItemEditor.class, context)); - registerEditor(MenuPackageImpl.Literals.TOOL_BAR_SEPARATOR, - ContextInjectionFactory.make(ToolBarSeparatorEditor.class, context)); - registerEditor(MenuPackageImpl.Literals.TOOL_CONTROL, - ContextInjectionFactory.make(ToolControlEditor.class, context)); - - registerEditor(MenuPackageImpl.Literals.MENU, ContextInjectionFactory.make(MenuEditor.class, context)); - registerEditor(MenuPackageImpl.Literals.POPUP_MENU, - ContextInjectionFactory.make(PopupMenuEditor.class, context)); - registerEditor(MenuPackageImpl.Literals.MENU_SEPARATOR, - ContextInjectionFactory.make(MenuSeparatorEditor.class, context)); - registerEditor(MenuPackageImpl.Literals.HANDLED_MENU_ITEM, - ContextInjectionFactory.make(HandledMenuItemEditor.class, context)); - registerEditor(MenuPackageImpl.Literals.DIRECT_MENU_ITEM, - ContextInjectionFactory.make(DirectMenuItemEditor.class, context)); - registerEditor(MenuPackageImpl.Literals.MENU_CONTRIBUTION, - ContextInjectionFactory.make(MenuContributionEditor.class, context)); - registerEditor(MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTION, - ContextInjectionFactory.make(ToolBarContributionEditor.class, context)); - registerEditor(MenuPackageImpl.Literals.TRIM_CONTRIBUTION, - ContextInjectionFactory.make(TrimContributionEditor.class, context)); - registerEditor(MenuPackageImpl.Literals.DYNAMIC_MENU_CONTRIBUTION, - ContextInjectionFactory.make(DynamicMenuContributionEditor.class, context)); - - registerEditor(UiPackageImpl.Literals.CORE_EXPRESSION, - ContextInjectionFactory.make(CoreExpressionEditor.class, context)); - - registerEditor(BasicPackageImpl.Literals.COMPOSITE_PART, - ContextInjectionFactory.make(CompositePartEditor.class, context)); - registerEditor(BasicPackageImpl.Literals.PART, ContextInjectionFactory.make(PartEditor.class, context)); - registerEditor(BasicPackageImpl.Literals.WINDOW, ContextInjectionFactory.make(WindowEditor.class, context)); - registerEditor(BasicPackageImpl.Literals.TRIMMED_WINDOW, - ContextInjectionFactory.make(TrimmedWindowEditor.class, context)); - registerEditor(BasicPackageImpl.Literals.PART_SASH_CONTAINER, - ContextInjectionFactory.make(PartSashContainerEditor.class, context)); - registerEditor(AdvancedPackageImpl.Literals.AREA, ContextInjectionFactory.make(AreaEditor.class, context)); - registerEditor(BasicPackageImpl.Literals.PART_STACK, - ContextInjectionFactory.make(PartStackEditor.class, context)); - registerEditor(BasicPackageImpl.Literals.TRIM_BAR, ContextInjectionFactory.make(TrimBarEditor.class, context)); - registerEditor(BasicPackageImpl.Literals.DIALOG, ContextInjectionFactory.make(DialogEditor.class, context)); - registerEditor(BasicPackageImpl.Literals.WIZARD_DIALOG, - ContextInjectionFactory.make(WizardDialogEditor.class, context)); - - registerEditor( - org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl.Literals.PART_DESCRIPTOR, - ContextInjectionFactory.make(PartDescriptorEditor.class, context)); - - registerEditor(AdvancedPackageImpl.Literals.PERSPECTIVE_STACK, - ContextInjectionFactory.make(PerspectiveStackEditor.class, context)); - registerEditor(AdvancedPackageImpl.Literals.PERSPECTIVE, - ContextInjectionFactory.make(PerspectiveEditor.class, context)); - registerEditor(AdvancedPackageImpl.Literals.PLACEHOLDER, - ContextInjectionFactory.make(PlaceholderEditor.class, context)); - - registerEditor(FragmentPackageImpl.Literals.MODEL_FRAGMENTS, - ContextInjectionFactory.make(ModelFragmentsEditor.class, context)); - registerEditor(FragmentPackageImpl.Literals.STRING_MODEL_FRAGMENT, - ContextInjectionFactory.make(StringModelFragment.class, context)); - } - - public void tab_list_show(Boolean show) { - if (editorTabFolder == null) { - return; - } - if (show == false) { - if (listTab != null) { - // remove the tab from the folder - listTab.getTabItem().dispose(); - ContextInjectionFactory.uninject(listTab, listTab.getContext()); - listTab = null; - } - } else { - if (listTab == null) { - final IEclipseContext child = context.createChild(); - child.set(CTabFolder.class, editorTabFolder); - child.set(EMFDocumentResourceMediator.class, emfDocumentProvider); - child.set(IGotoObject.class, this); - child.set(Messages.class, messages); - listTab = ContextInjectionFactory.make(ListTab.class, child); - tabItemList = listTab.getTabItem(); - } - } - } - - @Inject - public void setNotVisibleColor(@Preference(ModelEditorPreferences.NOT_VISIBLE_COLOR) String color) { - final RGB current = JFaceResources.getColorRegistry().getRGB(ComponentLabelProvider.NOT_VISIBLE_KEY); - - if (current == null || !current.equals(color)) { - JFaceResources.getColorRegistry().put(ComponentLabelProvider.NOT_VISIBLE_KEY, - StringConverter.asRGB(color, new RGB(200, 200, 200))); - } - - if (viewer != null) { - viewer.refresh(); - viewer.getControl().redraw(); - } - } - - @Inject - public void setNotRenderedColor(@Preference(ModelEditorPreferences.NOT_RENDERED_COLOR) String color) { - final RGB current = JFaceResources.getColorRegistry().getRGB(ComponentLabelProvider.NOT_RENDERED_KEY); - - if (current == null || !current.equals(color)) { - JFaceResources.getColorRegistry().put(ComponentLabelProvider.NOT_RENDERED_KEY, - StringConverter.asRGB(color, new RGB(200, 200, 200))); - } - - if (viewer != null) { - viewer.refresh(); - viewer.getControl().redraw(); - } - } - - @Inject - public void setNotVisibleRenderedColor( - @Preference(ModelEditorPreferences.NOT_VISIBLE_AND_RENDERED_COLOR) String color) { - final RGB current = JFaceResources.getColorRegistry().getRGB( - ComponentLabelProvider.NOT_VISIBLE_AND_RENDERED_KEY); - - if (current == null || !current.equals(color)) { - JFaceResources.getColorRegistry().put(ComponentLabelProvider.NOT_VISIBLE_AND_RENDERED_KEY, - StringConverter.asRGB(color, new RGB(200, 200, 200))); - } - - if (viewer != null) { - viewer.refresh(); - viewer.getControl().redraw(); - } - } - - public void registerEditor(EClass eClass, AbstractComponentEditor editor) { - editorMap.put(eClass, editor); - - for (final FeaturePath p : editor.getLabelProperties()) { - boolean found = false; - for (final FeaturePath tmp : labelFeaturePaths) { - if (equalsPaths(p, tmp)) { - found = true; - break; - } - } - - if (!found) { - labelFeaturePaths.add(p); - } - } - } - - private boolean equalsPaths(FeaturePath p1, FeaturePath p2) { - if (p1.getFeaturePath().length == p2.getFeaturePath().length) { - for (int i = 0; i < p1.getFeaturePath().length; i++) { - if (!p1.getFeaturePath()[i].equals(p2.getFeaturePath()[i])) { - return false; - } - } - - return true; - } - - return false; - } - - public AbstractComponentEditor getEditor(EClass eClass) { - AbstractComponentEditor editor = editorMap.get(eClass); - if (editor == null) { - for (final EClass cl : eClass.getESuperTypes()) { - editor = getEditor(cl); - if (editor != null) { - return editor; - } - } - - editor = ContextInjectionFactory.make(DefaultEditor.class, context); - } - return editor; - } - - @Persist - public void doSave(@Optional IProgressMonitor monitor) { - - try { - setSaving(true); - if (modelProvider.isSaveable()) { - modelProvider.save(); - } - } finally { - setSaving(false); - } - } - - private void setSaving(boolean saving) { - this.saving = saving; - } - - /** - * @return true if the editor is currently in the progress of saving. - */ - protected boolean isSaving() { - return saving; - } - - @Focus - public void setFocus() { - if (clipboardHandler == null) { - clipboardHandler = new ClipboardHandler(); - } - if (clipboardService != null) { - clipboardService.setHandler(clipboardHandler); - } - // See bug 432095. - // viewer.getControl().setFocus(); - } - - @PreDestroy - void dispose() { - try { - obsManager.dispose(); - } catch (final Exception e) { - e.printStackTrace(); - } - - if (project == null) { - context.get(Display.class).removeFilter(SWT.MouseUp, keyListener); - } - ContextInjectionFactory.uninject(xmiTab, xmiTab.getContext()); - } - - public IModelResource getModelProvider() { - return modelProvider; - } - - class ClipboardHandler implements Handler { - - @Override - public void paste() { - if (editorTabFolder.getSelectionIndex() == 0) { - if (viewer.getControl().getDisplay().getFocusControl() == viewer.getControl()) { - handleStructurePaste(); - } else if (currentEditor != null) { - currentEditor.handlePaste(); - } - } else { - xmiTab.paste(); - } - } - - @SuppressWarnings("unchecked") - private void handleStructurePaste() { - final Clipboard clip = new Clipboard(viewer.getControl().getDisplay()); - Object o = clip.getContents(MemoryTransfer.getInstance()); - clip.dispose(); - if (o == null) { - return; - } - - o = EcoreUtil.copy((EObject) o); - - final Object parent = ((IStructuredSelection) viewer.getSelection()).getFirstElement(); - - EStructuralFeature feature = null; - EObject container = null; - if (parent instanceof VirtualEntry<?>) { - final VirtualEntry<?> v = (VirtualEntry<?>) parent; - feature = ((IEMFProperty) v.getProperty()).getStructuralFeature(); - container = (EObject) v.getOriginalParent(); - } else { - if (parent instanceof MElementContainer<?>) { - feature = UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN; - container = (EObject) parent; - } else if (parent instanceof EObject) { - container = (EObject) parent; - final EClass eClass = container.eClass(); - - for (final EStructuralFeature f : eClass.getEAllStructuralFeatures()) { - if (ModelUtils.getTypeArgument(eClass, f.getEGenericType()).isInstance(o)) { - feature = f; - break; - } - } - } - } - - if (feature == FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS && container != null) { - final MApplicationElement el = (MApplicationElement) EcoreUtil.create(((EObject) o).eClass()); - el.setElementId(((MApplicationElement) o).getElementId()); - final Command cmd = AddCommand.create(getModelProvider().getEditingDomain(), container, feature, el); - if (cmd.canExecute()) { - getModelProvider().getEditingDomain().getCommandStack().execute(cmd); - } - return; - } - - if (feature != null && container != null) { - final Command cmd = AddCommand.create(getModelProvider().getEditingDomain(), container, feature, o); - if (cmd.canExecute()) { - getModelProvider().getEditingDomain().getCommandStack().execute(cmd); - if (isLiveModel()) { - if (container instanceof MElementContainer<?> && o instanceof MUIElement) { - ((MElementContainer<MUIElement>) container).setSelectedElement((MUIElement) o); - } - } - } - } - } - - @Override - public void copy() { - if (editorTabFolder.getSelectionIndex() == 0) { - if (viewer.getControl().getDisplay().getFocusControl() == viewer.getControl()) { - handleStructureCopy(); - } else if (currentEditor != null) { - currentEditor.handleCopy(); - } - } else { - xmiTab.copy(); - } - } - - private void handleStructureCopy() { - final Object o = ((IStructuredSelection) viewer.getSelection()).getFirstElement(); - if (o != null && o instanceof EObject) { - final Clipboard clip = new Clipboard(viewer.getControl().getDisplay()); - clip.setContents(new Object[] { EcoreUtil.copy((EObject) o) }, - new Transfer[] { MemoryTransfer.getInstance() }); - clip.dispose(); - } - } - - @Override - public void cut() { - if (editorTabFolder.getSelectionIndex() == 0) { - if (viewer.getControl().getDisplay().getFocusControl() == viewer.getControl()) { - handleStructureCut(); - } else if (currentEditor != null) { - currentEditor.handleCut(); - } - } else { - xmiTab.cut(); - } - } - - private void handleStructureCut() { - final Object o = ((IStructuredSelection) viewer.getSelection()).getFirstElement(); - if (o != null && o instanceof EObject) { - final Clipboard clip = new Clipboard(viewer.getControl().getDisplay()); - clip.setContents(new Object[] { o }, new Transfer[] { MemoryTransfer.getInstance() }); - clip.dispose(); - final EObject eObj = (EObject) o; - final Command cmd = RemoveCommand.create(getModelProvider().getEditingDomain(), eObj.eContainer(), - eObj.eContainingFeature(), eObj); - if (cmd.canExecute()) { - getModelProvider().getEditingDomain().getCommandStack().execute(cmd); - } - } - } - } - - class ObservableFactoryImpl implements IObservableFactory { - - @Override - public IObservable createObservable(Object target) { - if (target instanceof IObservableList) { - return (IObservable) target; - } else if (target instanceof VirtualEntry<?>) { - return ((VirtualEntry<?>) target).getList(); - } else { - final AbstractComponentEditor editor = getEditor(((EObject) target).eClass()); - if (editor != null) { - return editor.getChildList(target); - } - } - - return null; - } - } - - static class DragListener extends DragSourceAdapter { - private final TreeViewer viewer; - - public DragListener(TreeViewer viewer) { - this.viewer = viewer; - } - - @Override - public void dragStart(DragSourceEvent event) { - final IStructuredSelection selection = (IStructuredSelection) viewer.getSelection(); - event.doit = !selection.isEmpty() && selection.getFirstElement() instanceof MApplicationElement; - } - - @Override - public void dragSetData(DragSourceEvent event) { - final IStructuredSelection selection = (IStructuredSelection) viewer.getSelection(); - event.data = selection.toArray(); - } - } - - class DropListener extends ViewerDropAdapter { - private final EditingDomain domain; - - protected DropListener(Viewer viewer, EditingDomain domain) { - super(viewer); - this.domain = domain; - } - - @Override - public boolean performDrop(Object data) { - final Object[] dropDataArray = (Object[]) data; - for (final Object object : dropDataArray) { - final boolean result = performSingleDrop(object); - if (!result) { - return false; - } - } - return true; - } - - @SuppressWarnings("unchecked") - public boolean performSingleDrop(Object data) { - if (getCurrentLocation() == LOCATION_ON) { - EStructuralFeature feature = null; - EObject parent = null; - if (getCurrentTarget() instanceof MElementContainer<?>) { - feature = UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN; - parent = (EObject) getCurrentTarget(); - } else if (getCurrentTarget() instanceof VirtualEntry<?>) { - final VirtualEntry<?> entry = (VirtualEntry<?>) getCurrentTarget(); - final IListProperty prop = entry.getProperty(); - if (prop instanceof IEMFProperty) { - feature = ((IEMFProperty) prop).getStructuralFeature(); - parent = (EObject) entry.getOriginalParent(); - - } - } else if (getCurrentTarget() instanceof EObject) { - parent = (EObject) getCurrentTarget(); - for (final EStructuralFeature f : parent.eClass().getEAllStructuralFeatures()) { - final EClassifier cl = ModelUtils.getTypeArgument(parent.eClass(), f.getEGenericType()); - if (cl.isInstance(data)) { - feature = f; - break; - } - } - } - - if (feature != null && parent != null) { - final Command cmd = AddCommand.create(domain, parent, feature, data); - if (cmd.canExecute()) { - domain.getCommandStack().execute(cmd); - if (isLiveModel()) { - if (parent instanceof MElementContainer<?> && data instanceof MUIElement) { - ((MElementContainer<MUIElement>) parent).setSelectedElement((MUIElement) data); - } - } - return true; - } - } - } else if (getCurrentLocation() == LOCATION_AFTER || getCurrentLocation() == LOCATION_BEFORE) { - EStructuralFeature feature = null; - EObject parent = null; - - final TreeItem item = (TreeItem) getCurrentEvent().item; - if (item != null) { - final TreeItem parentItem = item.getParentItem(); - if (parentItem != null) { - if (parentItem.getData() instanceof VirtualEntry<?>) { - final VirtualEntry<?> vE = (VirtualEntry<?>) parentItem.getData(); - parent = (EObject) vE.getOriginalParent(); - feature = ((IEMFProperty) vE.getProperty()).getStructuralFeature(); - } else if (parentItem.getData() instanceof MElementContainer<?>) { - parent = (EObject) parentItem.getData(); - feature = UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN; - } else if (parentItem.getData() instanceof EObject) { - parent = (EObject) parentItem.getData(); - for (final EStructuralFeature f : parent.eClass().getEAllStructuralFeatures()) { - final EClassifier cl = ModelUtils.getTypeArgument(parent.eClass(), f.getEGenericType()); - if (cl.isInstance(data)) { - feature = f; - break; - } - } - } - } - } - - if (feature == FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS && parent != null) { - final MApplicationElement el = (MApplicationElement) EcoreUtil.create(((EObject) data).eClass()); - el.setElementId(((MApplicationElement) data).getElementId()); - final Command cmd = AddCommand.create(domain, parent, feature, el); - if (cmd.canExecute()) { - domain.getCommandStack().execute(cmd); - } - return true; - } - - if (feature != null && parent != null && parent.eGet(feature) instanceof List<?>) { - final List<Object> list = (List<Object>) parent.eGet(feature); - int index = list.indexOf(getCurrentTarget()); - - if (index >= list.size()) { - index = CommandParameter.NO_INDEX; - } - - if (parent == ((EObject) data).eContainer()) { - if (parent instanceof MElementContainer<?> && data instanceof MUIElement) { - Util.moveElementByIndex(domain, (MUIElement) data, isLiveModel(), index); - } else { - final Command cmd = MoveCommand.create(domain, parent, feature, data, index); - if (cmd.canExecute()) { - domain.getCommandStack().execute(cmd); - return true; - } - } - } else { - // Moving between different sources is always a copy - if (parent.eResource() != ((EObject) data).eResource()) { - data = EcoreUtil.copy((EObject) data); - } - - final Command cmd = AddCommand.create(domain, parent, feature, data, index); - if (cmd.canExecute()) { - domain.getCommandStack().execute(cmd); - if (isLiveModel()) { - if (parent instanceof MElementContainer<?> && data instanceof MUIElement) { - ((MElementContainer<MUIElement>) parent).setSelectedElement((MUIElement) data); - } - } - - return true; - } - } - } - } - - return false; - } - - @Override - public boolean validateDrop(Object target, int operation, TransferData transferType) { - boolean rv = false; - if (getSelectedObject() instanceof MApplicationElement) { - if (getCurrentLocation() == LOCATION_ON) { - rv = isValidDrop(target, (MApplicationElement) getSelectedObject(), false); - } else if (getCurrentLocation() == LOCATION_AFTER || getCurrentLocation() == LOCATION_BEFORE) { - TreeItem item = (TreeItem) getCurrentEvent().item; - if (item != null) { - item = item.getParentItem(); - if (item != null) { - rv = isValidDrop(item.getData(), (MApplicationElement) getSelectedObject(), true); - } - } - } - } - - return rv; - } - - private boolean isValidDrop(Object target, MApplicationElement instance, boolean isIndex) { - if (target instanceof MElementContainer<?>) { - @SuppressWarnings("unchecked") - final MElementContainer<MUIElement> container = (MElementContainer<MUIElement>) target; - - if (isIndex || !container.getChildren().contains(instance)) { - final EClassifier classifier = ModelUtils.getTypeArgument(((EObject) container).eClass(), - UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN.getEGenericType()); - return classifier.isInstance(instance); - } - } else if (target instanceof VirtualEntry<?>) { - @SuppressWarnings("unchecked") - final VirtualEntry<Object> vTarget = (VirtualEntry<Object>) target; - if (isIndex || !vTarget.getList().contains(instance)) { - if (vTarget.getProperty() instanceof IEMFProperty) { - final EStructuralFeature feature = ((IEMFProperty) vTarget.getProperty()) - .getStructuralFeature(); - final EObject parent = (EObject) vTarget.getOriginalParent(); - final EClassifier classifier = ModelUtils.getTypeArgument(parent.eClass(), - feature.getEGenericType()); - return classifier.isInstance(instance); - } - - } - } else if (target instanceof EObject) { - final EObject eObj = (EObject) target; - for (final EStructuralFeature f : eObj.eClass().getEAllStructuralFeatures()) { - final EClassifier cl = ModelUtils.getTypeArgument(eObj.eClass(), f.getEGenericType()); - if (cl.isInstance(instance)) { - return true; - } - } - } - - return false; - } - } - - @Override - public void gotoEObject(int targetHint, EObject object) { - if (object == null) { - // do nothing - } else { - switch (targetHint) { - case TAB_FORM: - // make sure tree node has been instantiated - final ObservableListTreeContentProvider provider = (ObservableListTreeContentProvider) viewer - .getContentProvider(); - getFirstMatchingItem(object, provider, provider.getChildren(viewer.getInput())); - - viewer.reveal(object); - viewer.setSelection(new StructuredSelection(object)); - editorTabFolder.setSelection(getTabIndex(tabItemTree)); - break; - case TAB_XMI: - editorTabFolder.setSelection(getTabIndex(tabItemXmi)); - // model was not updating in XMI document (selection listener - // was not firing from programmatic setSelection() - emfDocumentProvider.updateFromEMF(); - - try { - xmiTab.gotoEObject(object); - } catch (final Exception e) { - e.printStackTrace(); - } - break; - case TAB_LIST: - if (tabItemList != null && listTab != null) { - editorTabFolder.setSelection(getTabIndex(tabItemList)); - listTab.getViewer().setSelection(new StructuredSelection(object), true); - } - break; - default: - break; - } - // } - } - } - - // This will ensure the provider has created the tree node (so we can reveal - // it). - private Object getFirstMatchingItem(EObject target, ObservableListTreeContentProvider provider, Object[] items) { - for (int i = 0; i < items.length; i++) { - if (items[i] == target) { - return items[i]; - } - final Object found = getFirstMatchingItem(target, provider, provider.getChildren(items[i])); - if (found != null) { - return found; - } - } - return null; - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/TreeViewerEx.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/TreeViewerEx.java deleted file mode 100644 index e05c4acd..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/TreeViewerEx.java +++ /dev/null @@ -1,124 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 396902, Bug 431847 - ******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.internal.common; - -import java.util.ArrayList; -import java.util.List; -import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.e4.tools.emf.ui.internal.common.xml.EMFDocumentResourceMediator; -import org.eclipse.e4.ui.internal.workbench.E4XMIResource; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jface.databinding.viewers.ObservableListTreeContentProvider; -import org.eclipse.jface.text.DocumentEvent; -import org.eclipse.jface.text.IDocumentListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.swt.widgets.Composite; - -/** - * Adds additional functionality to TreeViewer - * - * @author Steven Spungin - * - */ -public class TreeViewerEx extends TreeViewer { - - private ArrayList<String> elementsIds; - private ArrayList<String> selectedIds; - - public TreeViewerEx(Composite parent, int style, EMFDocumentResourceMediator emfDocumentProvider, final IModelResource modelProvider) { - super(parent, style); - - emfDocumentProvider.getDocument().addDocumentListener(new IDocumentListener() { - - @Override - public void documentChanged(DocumentEvent event) { - try { - // restore Nodes from XmiIds - E4XMIResource xmiResource = (E4XMIResource) ((EObject) modelProvider.getRoot().get(0)).eResource(); - ArrayList<Object> newElements = new ArrayList<Object>(); - ObservableListTreeContentProvider provider = (ObservableListTreeContentProvider) getContentProvider(); - Object[] children = new Object[] { modelProvider.getRoot().get(0) }; - for (String id : elementsIds) { - EObject eObject = xmiResource.getEObject(id); - if (eObject != null) { - newElements.add(eObject); - // force tree node creation - getFirstMatchingItem(eObject, provider, children); - } - } - ArrayList<Object> newSelected = new ArrayList<Object>(); - for (String id : selectedIds) { - EObject eObject = xmiResource.getEObject(id); - if (eObject != null) { - newSelected.add(eObject); - // force tree node creation - getFirstMatchingItem(eObject, provider, children); - } - } - setExpandedElements(newElements.toArray(new Object[0])); - setSelection(new StructuredSelection(newSelected)); - - // update our stored id values - reloadIds(modelProvider); - } catch (Exception e) { - e.printStackTrace(); - } - - } - - @Override - public void documentAboutToBeChanged(DocumentEvent event) { - reloadIds(modelProvider); - } - - private void reloadIds(final IModelResource modelProvider) { - try { - // Stash XmiIds - Object[] elements = getExpandedElements(); - List<?> selected = ((IStructuredSelection) getSelection()).toList(); - E4XMIResource xmiResource = (E4XMIResource) ((EObject) modelProvider.getRoot().get(0)).eResource(); - elementsIds = new ArrayList<String>(); - selectedIds = new ArrayList<String>(); - for (Object obj : elements) { - if (obj instanceof EObject) { - elementsIds.add(xmiResource.getID((EObject) obj)); - } - } - for (Object obj : selected) { - if (obj instanceof EObject) { - selectedIds.add(xmiResource.getID((EObject) obj)); - } - } - } catch (Exception e) { - e.printStackTrace(); - } - } - }); - } - - // This will ensure the provider has created the tree node (so we can reveal - // it). - static public Object getFirstMatchingItem(EObject target, ObservableListTreeContentProvider provider, Object[] items) { - for (int i = 0; i < items.length; i++) { - if (items[i] == target) { - return items[i]; - } - Object found = getFirstMatchingItem(target, provider, provider.getChildren(items[i])); - if (found != null) { - return found; - } - } - return null; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/VirtualEntry.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/VirtualEntry.java deleted file mode 100644 index 2c03f832..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/VirtualEntry.java +++ /dev/null @@ -1,89 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common; - -import java.util.ArrayList; -import java.util.List; -import org.eclipse.core.databinding.observable.Diffs; -import org.eclipse.core.databinding.observable.list.IListChangeListener; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.list.ListChangeEvent; -import org.eclipse.core.databinding.observable.list.ListDiff; -import org.eclipse.core.databinding.observable.list.WritableList; -import org.eclipse.core.databinding.property.list.IListProperty; - -public abstract class VirtualEntry<M> { - private String id; - private Object originalParent; - private String label; - private IObservableList list; - private IListProperty property; - - public VirtualEntry(String id, IListProperty property, Object originalParent, String label) { - this.id = id; - this.originalParent = originalParent; - this.label = label; - this.property = property; - this.list = new WritableList(); - final IObservableList origList = property.observe(originalParent); - list.addAll(cleanedList(origList)); - - final IListChangeListener listener = new IListChangeListener() { - - @Override - public void handleListChange(ListChangeEvent event) { - if (!VirtualEntry.this.list.isDisposed()) { - List<Object> clean = cleanedList(event.getObservableList()); - ListDiff diff = Diffs.computeListDiff(VirtualEntry.this.list, clean); - diff.applyTo(VirtualEntry.this.list); - } - } - }; - - origList.addListChangeListener(listener); - } - - public IListProperty getProperty() { - return property; - } - - @SuppressWarnings("unchecked") - private List<Object> cleanedList(IObservableList list) { - List<Object> l = new ArrayList<Object>(list.size()); - - for (Object o : list) { - if (accepted((M) o)) { - l.add(o); - } - } - - return l; - } - - protected abstract boolean accepted(M o); - - public IObservableList getList() { - return list; - } - - public Object getOriginalParent() { - return originalParent; - } - - public String getId() { - return id; - } - - @Override - public String toString() { - return label; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java deleted file mode 100644 index a4168da6..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java +++ /dev/null @@ -1,264 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2014 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Lars Vogel <Lars.Vogel@gmail.com> - Ongoing maintenance - * Steven Spungin <steven@spungin.tv> - Bug 424730 - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import javax.inject.Inject; - -import org.eclipse.core.databinding.Binding; -import org.eclipse.core.databinding.UpdateValueStrategy; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.IObservableValue; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.core.di.annotations.Optional; -import org.eclipse.e4.tools.emf.ui.common.ContributionURIValidator; -import org.eclipse.e4.tools.emf.ui.common.IContributionClassCreator; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; -import org.eclipse.e4.tools.emf.ui.internal.common.objectdata.ObjectViewer; -import org.eclipse.e4.ui.model.application.MAddon; -import org.eclipse.e4.ui.model.application.MContribution; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Link; -import org.eclipse.swt.widgets.Text; - -public class AddonsEditor extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - - @Inject - @Optional - private IProject project; - - @Inject - IEclipseContext eclipseContext; - - private StackLayout stackLayout; - - @Inject - public AddonsEditor() { - super(); - } - - @Override - public Image getImage(Object element, Display display) { - return createImage(ResourceProvider.IMG_Addons); - } - - @Override - public String getLabel(Object element) { - return Messages.AddonsEditor_TreeLabel; - } - - @Override - public String getDetailLabel(Object element) { - final MContribution contrib = (MContribution) element; - if (contrib.getContributionURI() != null && contrib.getContributionURI().trim().length() > 0) { - return contrib.getContributionURI().substring(contrib.getContributionURI().lastIndexOf('/') + 1); - } - return null; - } - - @Override - public String getDescription(Object element) { - return Messages.AddonsEditor_TreeLabelDescription; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - getMaster().setValue(object); - return composite; - } - - protected Composite createForm(Composite parent, EMFDataBindingContext context, IObservableValue master, - boolean isImport) { - final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { - ControlFactory.createXMIId(parent, this); - } - - if (getEditor().isModelFragment() && isImport) { - ControlFactory.createFindImport(parent, Messages, this, context); - folder.setSelection(0); - return folder; - } - - ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, - EMFEditProperties - .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); - final Link lnk; - // ------------------------------------------------------------ - { - final IContributionClassCreator c = getEditor().getContributionCreator( - ApplicationPackageImpl.Literals.ADDON); - if (project != null && c != null) { - lnk = new Link(parent, SWT.NONE); - lnk.setText("<A>" + Messages.PartEditor_ClassURI + "</A>"); //$NON-NLS-1$//$NON-NLS-2$ - lnk.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - lnk.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - c.createOpen((MContribution) getMaster().getValue(), getEditingDomain(), project, - lnk.getShell()); - } - }); - } else { - lnk = null; - final Label l = new Label(parent, SWT.NONE); - l.setText(Messages.AddonsEditor_ClassURI); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - } - - final Text t = new Text(parent, SWT.BORDER); - TextPasteHandler.createFor(t); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - t.addModifyListener(new ModifyListener() { - - @Override - public void modifyText(ModifyEvent e) { - if (lnk != null) { - lnk.setToolTipText(((Text) e.getSource()).getText()); - } - } - }); - final Binding binding = context.bindValue( - textProp.observeDelayed(200, t), - EMFEditProperties.value(getEditingDomain(), - ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(getMaster()), - new UpdateValueStrategy().setAfterConvertValidator(new ContributionURIValidator()), - new UpdateValueStrategy()); - Util.addDecoration(t, binding); - - final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); - b.setText(Messages.ModelTooling_Common_FindEllipsis); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - final ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(), eclipseContext, - getEditingDomain(), (MContribution) getMaster().getValue(), - ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI, Messages); - dialog.open(); - } - }); - } - - ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); - - item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabSupplementary); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - ControlFactory.createStringListWidget(parent, Messages, this, Messages.AddonsEditor_Tags, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - - if (project == null) { - createInstanceInspection(folder); - } - - createContributedEditorTabs(folder, context, getMaster(), MAddon.class); - - folder.setSelection(0); - - return folder; - } - - private void createInstanceInspection(CTabFolder folder) { - final CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_RuntimeContributionInstance); - final Composite container = new Composite(folder, SWT.NONE); - container.setLayout(new GridLayout()); - item.setControl(container); - - final ObjectViewer objectViewer = new ObjectViewer(); - final TreeViewer viewer = objectViewer.createViewer(container, - ApplicationPackageImpl.Literals.CONTRIBUTION__OBJECT, getMaster(), resourcePool, Messages); - viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); - - } - - @Override - public IObservableList getChildList(Object element) { - return null; - } - - @Override - public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { FeaturePath.fromList(ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI) }; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java deleted file mode 100644 index 7ec370f3..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java +++ /dev/null @@ -1,828 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2014 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Lars Vogel <Lars.Vogel@gmail.com> - Ongoing maintenance - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - -import javax.annotation.PostConstruct; -import javax.inject.Inject; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.list.WritableList; -import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.core.di.annotations.Optional; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.tools.emf.ui.internal.common.uistructure.UIViewer; -import org.eclipse.e4.ui.model.application.MApplication; -import org.eclipse.e4.ui.model.application.commands.MCommand; -import org.eclipse.e4.ui.model.application.commands.MHandler; -import org.eclipse.e4.ui.model.application.commands.MKeyBinding; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsFactoryImpl; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; -import org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.MUIElement; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.ItemType; -import org.eclipse.e4.ui.model.application.ui.menu.MMenu; -import org.eclipse.e4.ui.model.application.ui.menu.MToolBar; -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.emf.common.command.CompoundCommand; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.ComboViewer; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.StyledCellLabelProvider; -import org.eclipse.jface.viewers.StyledString; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.ViewerCell; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class ApplicationEditor extends AbstractComponentEditor { - - private Composite composite; - private EMFDataBindingContext context; - - private final IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties - .list(CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS); - private final IListProperty BINDING_CONTAINER__BINDINGS = EMFProperties - .list(CommandsPackageImpl.Literals.BINDING_TABLE_CONTAINER__BINDING_TABLES); - private final IListProperty APPLICATION__COMMANDS = EMFProperties - .list(ApplicationPackageImpl.Literals.APPLICATION__COMMANDS); - // private IListProperty APPLICATION__DIALOGS = - // EMFProperties.list(ApplicationPackageImpl.Literals.APPLICATION__DIALOGS); - private final IListProperty PART_DESCRIPTOR_CONTAINER__DESCRIPTORS = EMFProperties - .list(BasicPackageImpl.Literals.PART_DESCRIPTOR_CONTAINER__DESCRIPTORS); - private final IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties - .list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - private final IListProperty APPLICATION__ADDONS = EMFProperties - .list(ApplicationPackageImpl.Literals.APPLICATION__ADDONS); - private final IListProperty MENU_CONTRIBUTIONS = EMFProperties - .list(MenuPackageImpl.Literals.MENU_CONTRIBUTIONS__MENU_CONTRIBUTIONS); - private final IListProperty TOOLBAR_CONTRIBUTIONS = EMFProperties - .list(MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTIONS__TOOL_BAR_CONTRIBUTIONS); - private final IListProperty TRIM_CONTRIBUTIONS = EMFProperties - .list(MenuPackageImpl.Literals.TRIM_CONTRIBUTIONS__TRIM_CONTRIBUTIONS); - private final IListProperty APPLICATION__SNIPPETS = EMFProperties - .list(UiPackageImpl.Literals.SNIPPET_CONTAINER__SNIPPETS); - private final IListProperty APPLICATION__CATEGORIES = EMFProperties - .list(ApplicationPackageImpl.Literals.APPLICATION__CATEGORIES); - - private final IListProperty BINDING_TABLE_CONTAINER__ROOT_CONTEXT = EMFProperties - .list(CommandsPackageImpl.Literals.BINDING_TABLE_CONTAINER__ROOT_CONTEXT); - - @Inject - @Optional - private IProject project; - - private final List<Action> actions = new ArrayList<Action>(); - - @Inject - public ApplicationEditor() { - super(); - } - - @PostConstruct - void init() { - // actions.add(new Action("Command Wizard ...") { - // @Override - // public void run() { - // doCreateCommandWizard(); - // } - // }); - } - - @Override - public List<Action> getActions(Object element) { - return actions; - } - - void doCreateCommandWizard() { - final WizardDialog dialog = new WizardDialog(composite.getShell(), new CommandWizard((MApplication) getMaster() - .getValue())); - dialog.open(); - } - - @Override - public Image getImage(Object element, Display display) { - if (element instanceof MUIElement) { - if (((MUIElement) element).isToBeRendered()) { - return createImage(ResourceProvider.IMG_Application); - } - return createImage(ResourceProvider.IMG_Tbr_Application); - } - return null; - } - - @Override - public String getLabel(Object element) { - return Messages.ApplicationEditor_Label; - } - - @Override - public String getDescription(Object element) { - return Messages.ApplicationEditor_Description; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - composite = createForm(parent, context); - } - getMaster().setValue(object); - - return composite; - } - - protected Composite createForm(Composite parent, EMFDataBindingContext context) { - final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { - ControlFactory.createXMIId(parent, this); - } - - ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, getMaster(), context, textProp, - EMFEditProperties - .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); - - ControlFactory.createBindingContextWiget(parent, Messages, this, Messages.ApplicationEditor_BindingContexts); - - ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, - WidgetProperties.selection(), - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); - ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, - WidgetProperties.selection(), - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - - item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabSupplementary); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), - context, textProp, - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); - ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_Context_Variables, - UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createStringListWidget(parent, Messages, this, Messages.AddonsEditor_Tags, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); - - if (project == null) { - createUITreeInspection(folder); - } - - createContributedEditorTabs(folder, context, getMaster(), MApplication.class); - - folder.setSelection(0); - - return folder; - } - - private void createUITreeInspection(CTabFolder folder) { - final CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_RuntimeWidgetTree); - final Composite container = new Composite(folder, SWT.NONE); - container.setLayout(new GridLayout()); - item.setControl(container); - - final UIViewer objectViewer = new UIViewer(); - final TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET, - getMaster(), resourcePool, Messages); - viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); - } - - @Override - public IObservableList getChildList(final Object element) { - final WritableList list = new WritableList(); - list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_ADDONS, APPLICATION__ADDONS, element, - Messages.ApplicationEditor_Addons) { - - @Override - protected boolean accepted(Object o) { - return true; - } - - }); - - list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_ROOT_CONTEXTS, BINDING_TABLE_CONTAINER__ROOT_CONTEXT, - element, Messages.ApplicationEditor_RootContexts) { - - @Override - protected boolean accepted(Object o) { - return true; - } - - }); - - list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_BINDING_TABLE, BINDING_CONTAINER__BINDINGS, element, - Messages.ApplicationEditor_BindingTables) { - - @Override - protected boolean accepted(Object o) { - return true; - } - - }); - - list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_HANDLER, HANDLER_CONTAINER__HANDLERS, element, - Messages.ApplicationEditor_Handlers) { - - @Override - protected boolean accepted(Object o) { - return true; - } - - }); - - list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_COMMAND, APPLICATION__COMMANDS, element, - Messages.ApplicationEditor_Commands) { - - @Override - protected boolean accepted(Object o) { - return true; - } - }); - - list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_CATEGORIES, APPLICATION__CATEGORIES, element, - Messages.ApplicationEditor_Categories) { - - @Override - protected boolean accepted(Object o) { - return true; - } - }); - - list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_APPLICATION_WINDOWS, ELEMENT_CONTAINER__CHILDREN, - element, Messages.ApplicationEditor_Windows) { - - @Override - protected boolean accepted(Object o) { - return true; - } - - }); - - list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_PART_DESCRIPTORS, PART_DESCRIPTOR_CONTAINER__DESCRIPTORS, - element, Messages.ApplicationEditor_PartDescriptors) { - - @Override - protected boolean accepted(Object o) { - return true; - } - - }); - - list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_MENU_CONTRIBUTIONS, MENU_CONTRIBUTIONS, element, - Messages.ApplicationEditor_MenuContributions) { - @Override - protected boolean accepted(Object o) { - return true; - } - }); - - list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_TOOLBAR_CONTRIBUTIONS, TOOLBAR_CONTRIBUTIONS, element, - Messages.ApplicationEditor_ToolBarContributions) { - @Override - protected boolean accepted(Object o) { - return true; - } - }); - - list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_TRIM_CONTRIBUTIONS, TRIM_CONTRIBUTIONS, element, - Messages.ApplicationEditor_TrimContributions) { - @Override - protected boolean accepted(Object o) { - return true; - } - }); - list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_SNIPPETS, APPLICATION__SNIPPETS, element, - Messages.ApplicationEditor_Snippets) { - @Override - protected boolean accepted(Object o) { - return true; - } - }); - // - // MApplication application = (MApplication) element; - // if (application.getRootContext() != null) { - // list.add(0, application.getRootContext()); - // } - - // BINDING_TABLE_CONTAINER__ROOT_CONTEXT.observe(element).addValueChangeListener(new - // IValueChangeListener() { - // - // public void handleValueChange(ValueChangeEvent event) { - // if (event.diff.getOldValue() != null) { - // list.remove(event.diff.getOldValue()); - // if (getMaster().getValue() == element) { - // createRemoveRootContext.setSelection(false); - // } - // } - // - // if (event.diff.getNewValue() != null) { - // list.add(0, event.diff.getNewValue()); - // if (getMaster().getValue() == element) { - // createRemoveRootContext.setSelection(true); - // } - // } - // } - // }); - - return list; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) }; - } - - class CommandWizard extends Wizard { - private final MApplication application; - - private HandlerCommandPage handlerPage; - private KeybindingPage keyPage; - private MenuWizardPage menuPage; - private ToolbarWizardPage toolbarPage; - - public CommandWizard(MApplication application) { - this.application = application; - } - - @Override - public void addPages() { - getShell().setText(Messages.CommandWizard_ShellTitle); - setDefaultPageImageDescriptor(ImageDescriptor.createFromImage(resourcePool - .getImageUnchecked(ResourceProvider.IMG_Wizban16_newexp_wiz))); - handlerPage = new HandlerCommandPage(Messages.ApplicationEditor_HandlerAndCommand); - addPage(handlerPage); - - keyPage = new KeybindingPage(Messages.ApplicationEditor_Keybinding, application); - addPage(keyPage); - - menuPage = new MenuWizardPage(Messages.ApplicationEditor_Menu, application); - addPage(menuPage); - - toolbarPage = new ToolbarWizardPage(Messages.ApplicationEditor_Toolbar, application); - addPage(toolbarPage); - } - - @Override - public boolean performFinish() { - - final MCommand command = CommandsFactoryImpl.eINSTANCE.createCommand(); - final MHandler handler = CommandsFactoryImpl.eINSTANCE.createHandler(); - MKeyBinding keyBinding = null; - - final String parentId = application.getElementId(); - - final String prefix = parentId != null && parentId.trim().length() > 0 ? parentId + "." : ""; //$NON-NLS-1$ //$NON-NLS-2$ - - if (handlerPage.idField.getText().trim().length() > 0) { - command.setElementId(prefix + "commands." + handlerPage.idField.getText().trim()); //$NON-NLS-1$ - handler.setElementId(prefix + "handlers." + handlerPage.idField.getText().trim()); //$NON-NLS-1$ - } - - if (application.getBindingTables().size() != 0) { - if (keyPage.keyField.getText().trim().length() > 0 && !keyPage.bindtableViewer.getSelection().isEmpty()) { - keyBinding = CommandsFactoryImpl.eINSTANCE.createKeyBinding(); - keyBinding.setKeySequence(keyPage.keyField.getText().trim()); - keyBinding.setCommand(command); - - } - } - - command.setCommandName(handlerPage.nameField.getText()); - handler.setCommand(command); - - final CompoundCommand cmd = new CompoundCommand(); - cmd.append(AddCommand.create(getEditingDomain(), application, - ApplicationPackageImpl.Literals.APPLICATION__COMMANDS, command)); - cmd.append(AddCommand.create(getEditingDomain(), application, - CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS, handler)); - - if (keyBinding != null) { - cmd.append(AddCommand.create(getEditingDomain(), - ((IStructuredSelection) keyPage.bindtableViewer.getSelection()).getFirstElement(), - CommandsPackageImpl.Literals.BINDING_TABLE__BINDINGS, keyBinding)); - } - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - return true; - } - - return false; - } - } - - class HandlerCommandPage extends WizardPage { - public Text idField; - public Text nameField; - - public HandlerCommandPage(String pageName) { - super(pageName); - } - - @Override - public void createControl(Composite parent) { - setTitle(Messages.ApplicationEditor_Command_Slash_Handler); - setMessage(Messages.ApplicationEditor_InsertInfosForCommandAndHandler); - - final Composite group = new Composite(parent, SWT.NONE); - group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - group.setLayout(new GridLayout(3, false)); - - { - final Label l = new Label(group, SWT.NONE); - l.setText(Messages.ApplicationEditor_Id); - - idField = new Text(group, SWT.BORDER); - idField.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - } - - { - final Label l = new Label(group, SWT.NONE); - l.setText(Messages.ApplicationEditor_Name + "*"); //$NON-NLS-1$ - - nameField = new Text(group, SWT.BORDER); - nameField.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - nameField.addModifyListener(new ModifyListener() { - - @Override - public void modifyText(ModifyEvent e) { - setPageComplete(nameField.getText().trim().length() > 0); - } - }); - } - - { - final Label l = new Label(group, SWT.NONE); - l.setText(Messages.ApplicationEditor_Class); - - final Text t = new Text(group, SWT.BORDER); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - final Button b = new Button(group, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelTooling_Common_FindEllipsis); - } - - setControl(group); - } - - @Override - public boolean isPageComplete() { - return nameField.getText().trim().length() > 0; - } - } - - class KeybindingPage extends WizardPage { - - private Text keyField; - private TableViewer bindtableViewer; - private final MApplication application; - - public KeybindingPage(String pageName, MApplication application) { - super(pageName); - this.application = application; - } - - @Override - public void createControl(Composite parent) { - setTitle(Messages.ApplicationEditor_Keybinding); - setMessage(Messages.ApplicationEditor_InsertInfosForKeybinding); - - final Composite group = new Composite(parent, SWT.NONE); - group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - group.setLayout(new GridLayout(2, false)); - - { - final Label l = new Label(group, SWT.NONE); - l.setText(Messages.ApplicationEditor_Sequence); - - keyField = new Text(group, SWT.BORDER); - keyField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - keyField.addModifyListener(new ModifyListener() { - - @Override - public void modifyText(ModifyEvent e) { - bindtableViewer.getControl().setEnabled(isPageComplete()); - setPageComplete(isPageComplete()); - } - }); - } - - { - final Label l = new Label(group, SWT.NONE); - l.setText(Messages.ApplicationEditor_BindingTable); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - - bindtableViewer = new TableViewer(group); - bindtableViewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); - bindtableViewer.setContentProvider(new ArrayContentProvider()); - bindtableViewer.setInput(application.getBindingTables()); - bindtableViewer.addSelectionChangedListener(new ISelectionChangedListener() { - - @Override - public void selectionChanged(SelectionChangedEvent event) { - setPageComplete(isPageComplete()); - } - }); - bindtableViewer.setSelection(new StructuredSelection(application.getBindingTables().get(0))); - final GridData gd = new GridData(GridData.FILL_BOTH); - gd.heightHint = bindtableViewer.getTable().getItemHeight() * 5; - bindtableViewer.getControl().setLayoutData(gd); - bindtableViewer.getControl().setEnabled(false); - } - - setControl(group); - } - - @Override - public boolean isPageComplete() { - if (keyField.getText().trim().length() == 0) { - return true; - } - return !bindtableViewer.getSelection().isEmpty(); - } - } - - class MenuWizardPage extends WizardPage { - private final MApplication application; - private Text labelField; - private Text iconField; - private ComboViewer typeViewer; - private TableViewer menuViewer; - - public MenuWizardPage(String pageName, MApplication application) { - super(pageName); - this.application = application; - } - - @Override - public void createControl(Composite parent) { - setTitle(Messages.ApplicationEditor_HandledMenuItem); - setMessage(Messages.ApplicationEditor_InertInfosForAHandledMenuItem); - - final Composite group = new Composite(parent, SWT.NONE); - group.setLayout(new GridLayout(2, false)); - group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - { - final Label l = new Label(group, SWT.NONE); - l.setText(Messages.ApplicationEditor_Label); - - labelField = new Text(group, SWT.BORDER); - labelField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - } - - { - final Label l = new Label(group, SWT.NONE); - l.setText(Messages.ApplicationEditor_Icon); - - iconField = new Text(group, SWT.BORDER); - iconField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - } - - { - final Label l = new Label(group, SWT.NONE); - l.setText(Messages.ApplicationEditor_Type); - - typeViewer = new ComboViewer(group, SWT.READ_ONLY); - typeViewer.setContentProvider(new ArrayContentProvider()); - typeViewer.setInput(ItemType.values()); - typeViewer.setSelection(new StructuredSelection(ItemType.PUSH)); - } - - { - final Label l = new Label(group, SWT.NONE); - l.setText(Messages.ApplicationEditor_Parent); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - - menuViewer = new TableViewer(group); - menuViewer.setLabelProvider(new HiearchyLabelProvider()); - menuViewer.setContentProvider(new ArrayContentProvider()); - - final List<MMenu> menuList = new ArrayList<MMenu>(); - final Iterator<EObject> it = EcoreUtil.getAllContents(Collections.singleton(application)); - while (it.hasNext()) { - final EObject o = it.next(); - if (MenuPackageImpl.Literals.MENU.isSuperTypeOf(o.eClass())) { - menuList.add((MMenu) o); - } - } - menuViewer.setInput(menuList); - menuViewer.addSelectionChangedListener(new ISelectionChangedListener() { - - @Override - public void selectionChanged(SelectionChangedEvent event) { - setPageComplete(isPageComplete()); - } - }); - final GridData gd = new GridData(GridData.FILL_BOTH); - gd.heightHint = menuViewer.getTable().getItemHeight() * 5; - menuViewer.getControl().setLayoutData(gd); - menuViewer.setSelection(new StructuredSelection(menuList.get(0))); - } - - setControl(group); - } - - @Override - public boolean isPageComplete() { - if (labelField.getText().trim().length() == 0 && iconField.getText().trim().length() == 0) { - return true; - } - return !menuViewer.getSelection().isEmpty(); - } - } - - class ToolbarWizardPage extends WizardPage { - private final MApplication application; - private Text labelField; - private Text iconField; - private ComboViewer typeViewer; - private TableViewer toolbarViewer; - - public ToolbarWizardPage(String pageName, MApplication application) { - super(pageName); - this.application = application; - } - - @Override - public void createControl(Composite parent) { - setTitle(Messages.ApplicationEditor_HandledToolbarItem); - setMessage(Messages.ApplicationEditor_InsertInfosForAToolbarItem); - - final Composite group = new Composite(parent, SWT.NONE); - group.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, false, 2, 1)); - group.setLayout(new GridLayout(2, false)); - - { - final Label l = new Label(group, SWT.NONE); - l.setText(Messages.ApplicationEditor_Label); - - labelField = new Text(group, SWT.BORDER); - labelField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - } - - { - final Label l = new Label(group, SWT.NONE); - l.setText(Messages.ApplicationEditor_Icon); - - iconField = new Text(group, SWT.BORDER); - iconField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - } - - { - final Label l = new Label(group, SWT.NONE); - l.setText(Messages.ApplicationEditor_Type); - - typeViewer = new ComboViewer(group, SWT.READ_ONLY); - // viewer.setLabelProvider(labelProvider) - typeViewer.setContentProvider(new ArrayContentProvider()); - typeViewer.setInput(ItemType.values()); - } - - { - final Label l = new Label(group, SWT.NONE); - l.setText(Messages.ApplicationEditor_Parent); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - - toolbarViewer = new TableViewer(group); - toolbarViewer.setLabelProvider(new HiearchyLabelProvider()); - toolbarViewer.setContentProvider(new ArrayContentProvider()); - - final List<MToolBar> toolbarList = new ArrayList<MToolBar>(); - final Iterator<EObject> it = EcoreUtil.getAllContents(Collections.singleton(application)); - while (it.hasNext()) { - final EObject o = it.next(); - if (MenuPackageImpl.Literals.TOOL_BAR.isSuperTypeOf(o.eClass())) { - toolbarList.add((MToolBar) o); - } - } - toolbarViewer.setInput(toolbarList); - toolbarViewer.addSelectionChangedListener(new ISelectionChangedListener() { - - @Override - public void selectionChanged(SelectionChangedEvent event) { - setPageComplete(isPageComplete()); - } - }); - final GridData gd = new GridData(GridData.FILL_BOTH); - gd.heightHint = toolbarViewer.getTable().getItemHeight() * 5; - toolbarViewer.getControl().setLayoutData(gd); - toolbarViewer.setSelection(new StructuredSelection(toolbarList.get(0))); - } - - setControl(group); - } - - @Override - public boolean isPageComplete() { - if (labelField.getText().trim().length() == 0 && iconField.getText().trim().length() == 0) { - return true; - } - return !toolbarViewer.getSelection().isEmpty(); - } - } - - class HiearchyLabelProvider extends StyledCellLabelProvider { - - @Override - public void update(ViewerCell cell) { - EObject o = (EObject) cell.getElement(); - - String label = ""; //$NON-NLS-1$ - Image img = null; - AbstractComponentEditor elementEditor = getEditor().getEditor(o.eClass()); - if (elementEditor != null) { - label = elementEditor.getDetailLabel(o); - label = label == null ? elementEditor.getLabel(o) : label; - img = elementEditor.getImage(o, composite.getDisplay()); - } - - final List<String> parentPath = new ArrayList<String>(); - while (o.eContainer() != null) { - o = o.eContainer(); - elementEditor = getEditor().getEditor(o.eClass()); - if (elementEditor != null) { - parentPath.add(0, elementEditor.getLabel(o)); - } - } - - String parentString = ""; //$NON-NLS-1$ - for (final String p : parentPath) { - parentString += "/" + p; //$NON-NLS-1$ - } - - final StyledString s = new StyledString(label); - s.append(" - " + parentString, StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ - cell.setStyleRanges(s.getStyleRanges()); - cell.setText(s.getString()); - cell.setImage(img); - } - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AreaEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AreaEditor.java deleted file mode 100644 index dea1d51b..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AreaEditor.java +++ /dev/null @@ -1,417 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2014 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Lars Vogel <Lars.Vogel@gmail.com> - Ongoing maintenance - * Steven Spungin <steven@spungin.tv> - Bug 433408, 424730 - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.util.ArrayList; -import java.util.List; - -import javax.annotation.PostConstruct; -import javax.inject.Inject; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.core.di.annotations.Optional; -import org.eclipse.e4.tools.emf.ui.common.ImageTooltip; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.E4PickList; -import org.eclipse.e4.tools.emf.ui.internal.common.EClassLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.AreaIconDialogEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.uistructure.UIViewer; -import org.eclipse.e4.ui.model.application.MApplicationElement; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.MUIElement; -import org.eclipse.e4.ui.model.application.ui.MUILabel; -import org.eclipse.e4.ui.model.application.ui.advanced.MArea; -import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; -import org.eclipse.e4.ui.model.application.ui.basic.MPartSashContainer; -import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.IEMFListProperty; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.databinding.viewers.IViewerValueProperty; -import org.eclipse.jface.databinding.viewers.ViewerProperties; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.ComboViewer; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class AreaEditor extends AbstractComponentEditor { - - private Composite composite; - private EMFDataBindingContext context; - - private final IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties - .list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - private StackLayout stackLayout; - - private final List<Action> actions = new ArrayList<Action>(); - - @Inject - @Optional - private IProject project; - - @Inject - IEclipseContext eclipseContext; - - @Inject - public AreaEditor() { - super(); - } - - @PostConstruct - void init() { - actions.add(new Action(Messages.PartSashContainerEditor_AddPartSashContainer, - createImageDescriptor(ResourceProvider.IMG_PartSashContainer)) { - @Override - public void run() { - handleAddChild(BasicPackageImpl.Literals.PART_SASH_CONTAINER); - } - }); - actions.add(new Action(Messages.PartSashContainerEditor_AddPartStack, - createImageDescriptor(ResourceProvider.IMG_PartStack)) { - @Override - public void run() { - handleAddChild(BasicPackageImpl.Literals.PART_STACK); - } - }); - actions.add(new Action(Messages.PartSashContainerEditor_AddPart, - createImageDescriptor(ResourceProvider.IMG_Part)) { - @Override - public void run() { - handleAddChild(BasicPackageImpl.Literals.PART); - } - }); - actions.add(new Action(Messages.PartSashContainerEditor_AddArea, - createImageDescriptor(ResourceProvider.IMG_Area)) { - @Override - public void run() { - handleAddChild(AdvancedPackageImpl.Literals.AREA); - } - }); - actions.add(new Action(Messages.PartSashContainerEditor_AddPlaceholder, - createImageDescriptor(ResourceProvider.IMG_Placeholder)) { - @Override - public void run() { - handleAddChild(AdvancedPackageImpl.Literals.PLACEHOLDER); - } - }); - } - - @Override - public Image getImage(Object element, Display display) { - final boolean horizontal = ((MPartSashContainer) element).isHorizontal(); - - if (!horizontal) { - final MUIElement uiElement = (MUIElement) element; - if (uiElement.isToBeRendered() && uiElement.isVisible()) { - return createImage(ResourceProvider.IMG_Area_vertical); - } - return createImage(ResourceProvider.IMG_Tbr_Area_vertical); - } - - if (horizontal) { - final MUIElement uiElement = (MUIElement) element; - if (uiElement.isToBeRendered() && uiElement.isVisible()) { - return createImage(ResourceProvider.IMG_Area); - } - return createImage(ResourceProvider.IMG_Tbr_Area); - } - return null; - } - - @Override - public String getLabel(Object element) { - return Messages.AreaEditor_Label; - } - - @Override - public String getDescription(Object element) { - return Messages.AreaEditor_Description; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - getMaster().setValue(object); - return composite; - } - - private Composite createForm(Composite parent, final EMFDataBindingContext context, WritableValue master, - boolean isImport) { - final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { - ControlFactory.createXMIId(parent, this); - } - - final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (isImport) { - ControlFactory.createFindImport(parent, Messages, this, context); - folder.setSelection(0); - return folder; - } - - ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, getMaster(), context, textProp, - EMFEditProperties - .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); - ControlFactory.createTextField(parent, Messages.AreaEditor_LabelLabel, master, context, textProp, - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL)); - ControlFactory.createTextField(parent, Messages.AreaEditor_Tooltip, master, context, textProp, - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP)); - - // ------------------------------------------------------------ - { - final Label l = new Label(parent, SWT.NONE); - l.setText(Messages.AreaEditor_IconURI); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - final Text t = new Text(parent, SWT.BORDER); - TextPasteHandler.createFor(t); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue( - textProp.observeDelayed(200, t), - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail( - master)); - - new ImageTooltip(t, Messages) { - - @Override - protected URI getImageURI() { - final MUILabel part = (MUILabel) getMaster().getValue(); - final String uri = part.getIconURI(); - if (uri == null || uri.trim().length() == 0) { - return null; - } - return URI.createURI(part.getIconURI()); - } - }; - - final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); - b.setText(Messages.ModelTooling_Common_FindEllipsis); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - final AreaIconDialogEditor dialog = new AreaIconDialogEditor(b.getShell(), eclipseContext, project, - getEditingDomain(), (MApplicationElement) getMaster().getValue(), Messages); - dialog.open(); - } - }); - } - - // ------------------------------------------------------------ - { - final Label l = new Label(parent, SWT.NONE); - l.setText(Messages.AreaEditor_Orientation); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - final ComboViewer viewer = new ComboViewer(parent); - final GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - viewer.getControl().setLayoutData(gd); - viewer.setContentProvider(new ArrayContentProvider()); - viewer.setLabelProvider(new LabelProvider() { - @Override - public String getText(Object element) { - return ((Boolean) element).booleanValue() ? Messages.AreaEditor_Horizontal - : Messages.AreaEditor_Vertical; - } - }); - viewer.setInput(new Boolean[] { Boolean.TRUE, Boolean.FALSE }); - final IViewerValueProperty vProp = ViewerProperties.singleSelection(); - context.bindValue(vProp.observe(viewer), - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.GENERIC_TILE__HORIZONTAL) - .observeDetail(getMaster())); - } - - ControlFactory.createSelectedElement(parent, this, context, Messages.AreaEditor_SelectedElement); - ControlFactory.createTextField(parent, Messages.AreaEditor_ContainerData, getMaster(), context, textProp, - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__CONTAINER_DATA)); - - { - final E4PickList pickList = new E4PickList(parent, SWT.NONE, null, Messages, this, - UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN) { - @Override - protected void addPressed() { - final EClass eClass = (EClass) ((IStructuredSelection) getSelection()).getFirstElement(); - handleAddChild(eClass); - } - }; - pickList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1)); - pickList.setText(Messages.AreaEditor_Controls); - - final TableViewer viewer = pickList.getList(); - - final IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - viewer.setInput(prop.observeDetail(getMaster())); - - pickList.setLabelProvider(new EClassLabelProvider(getEditor())); - pickList.setInput(new EClass[] { BasicPackageImpl.Literals.PART_SASH_CONTAINER, - BasicPackageImpl.Literals.PART_STACK, BasicPackageImpl.Literals.PART, - BasicPackageImpl.Literals.INPUT_PART, AdvancedPackageImpl.Literals.AREA, - AdvancedPackageImpl.Literals.PLACEHOLDER }); - pickList.setSelection(new StructuredSelection(BasicPackageImpl.Literals.PART_SASH_CONTAINER)); - } - - ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, - WidgetProperties.selection(), - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); - ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, - WidgetProperties.selection(), - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - - item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabSupplementary); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), - context, textProp, - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); - ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); - - if (project == null) { - createUITreeInspection(folder); - } - - createContributedEditorTabs(folder, context, getMaster(), MArea.class); - - folder.setSelection(0); - - return folder; - } - - private void createUITreeInspection(CTabFolder folder) { - final CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_RuntimeWidgetTree); - final Composite container = new Composite(folder, SWT.NONE); - container.setLayout(new GridLayout()); - item.setControl(container); - - final UIViewer objectViewer = new UIViewer(); - final TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET, - getMaster(), resourcePool, Messages); - viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); - } - - protected void handleAddChild(EClass eClass) { - final EObject eObject = EcoreUtil.create(eClass); - setElementId(eObject); - - final Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), - UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(eObject); - } - } - - @Override - public IObservableList getChildList(Object element) { - return ELEMENT_CONTAINER__CHILDREN.observe(element); - } - - @Override - public String getDetailLabel(Object element) { - return getLocalizedLabel((MUILabel) element); - } - - @Override - public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__LABEL), - FeaturePath.fromList(UiPackageImpl.Literals.GENERIC_TILE__HORIZONTAL), - FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) }; - } - - @Override - public List<Action> getActions(Object element) { - final ArrayList<Action> l = new ArrayList<Action>(super.getActions(element)); - l.addAll(actions); - return l; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java deleted file mode 100644 index b036df18..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java +++ /dev/null @@ -1,242 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2014 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Lars Vogel <Lars.Vogel@gmail.com> - Ongoing maintenance - * Steven Spungin <steven@spungin.tv> - Bug 437951 - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import javax.annotation.PostConstruct; -import javax.inject.Inject; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.AbstractPickList.PickListFeatures; -import org.eclipse.e4.tools.emf.ui.internal.common.E4PickList; -import org.eclipse.e4.ui.model.application.commands.MBindingContext; -import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.IEMFListProperty; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; - -public class BindingContextEditor extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - - private StackLayout stackLayout; - private final IListProperty BINDING_CONTEXT__CHILDREN = EMFProperties - .list(CommandsPackageImpl.Literals.BINDING_CONTEXT__CHILDREN); - - private final List<Action> actions = new ArrayList<Action>(); - - @Inject - public BindingContextEditor() { - super(); - } - - @PostConstruct - void init() { - actions.add(new Action(Messages.BindingContextEditor_AddContext, - createImageDescriptor(ResourceProvider.IMG_BindingContext)) { - @Override - public void run() { - handleAddContext(); - } - }); - } - - @Override - public Image getImage(Object element, Display display) { - return createImage(ResourceProvider.IMG_BindingContext); - } - - @Override - public String getLabel(Object element) { - return Messages.BindingContextEditor_TreeLabel; - } - - @Override - public String getDetailLabel(Object element) { - final MBindingContext context = (MBindingContext) element; - if (context.getName() != null && context.getName().trim().length() > 0) { - return context.getName().trim(); - } else if (context.getElementId() != null && context.getElementId().trim().length() > 0) { - return context.getElementId().trim(); - } - return null; - } - - @Override - public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { FeaturePath.fromList(CommandsPackageImpl.Literals.BINDING_CONTEXT__NAME), - FeaturePath.fromList(ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID) }; - } - - @Override - public String getDescription(Object element) { - return Messages.BindingContextEditor_TreeLabelDescription; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - getMaster().setValue(object); - enableIdGenerator(CommandsPackageImpl.Literals.BINDING_CONTEXT__NAME, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID, null); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { - final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { - ControlFactory.createXMIId(parent, this); - } - - if (isImport) { - ControlFactory.createFindImport(parent, Messages, this, context); - folder.setSelection(0); - return folder; - } - - ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, - EMFEditProperties - .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); - ControlFactory.createTextField(parent, Messages.BindingContextEditor_Name, master, context, textProp, - EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.BINDING_CONTEXT__NAME), - Messages.BindingContextEditor_NameWarning); - ControlFactory.createTextField(parent, Messages.BindingContextEditor_Description, master, context, textProp, - EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.BINDING_CONTEXT__DESCRIPTION)); - - final E4PickList pickList = new E4PickList(parent, SWT.NONE, Arrays.asList(PickListFeatures.NO_PICKER), - Messages, this, CommandsPackageImpl.Literals.BINDING_CONTEXT__CHILDREN) { - @Override - protected void addPressed() { - handleAddContext(); - } - - @Override - protected List<?> getContainerChildren(Object master) { - return ((MBindingContext) master).getChildren(); - } - }; - pickList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1)); - pickList.setText(Messages.BindingContextEditor_Subcontexts); - - final TableViewer viewer = pickList.getList(); - final IEMFListProperty prop = EMFEditProperties.list(getEditingDomain(), - CommandsPackageImpl.Literals.BINDING_CONTEXT__CHILDREN); - viewer.setInput(prop.observeDetail(master)); - - item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabSupplementary); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); - - createContributedEditorTabs(folder, context, getMaster(), MBindingContext.class); - - folder.setSelection(0); - - return folder; - } - - @Override - public IObservableList getChildList(Object element) { - return BINDING_CONTEXT__CHILDREN.observe(element); - } - - protected void handleAddContext() { - final MBindingContext eObject = MCommandsFactory.INSTANCE.createBindingContext(); - setElementId(eObject); - - final Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), - CommandsPackageImpl.Literals.BINDING_CONTEXT__CHILDREN, eObject); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(eObject); - - } - } - - @Override - public List<Action> getActions(Object element) { - final ArrayList<Action> l = new ArrayList<Action>(super.getActions(element)); - l.addAll(actions); - return l; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java deleted file mode 100644 index 68f99664..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java +++ /dev/null @@ -1,290 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2014 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Lars Vogel <Lars.Vogel@gmail.com> - Ongoing maintenance - * Steven Spungin <steven@spungin.tv> - Ongoing maintenance - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import javax.annotation.PostConstruct; -import javax.inject.Inject; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.IObservableValue; -import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.AbstractPickList.PickListFeatures; -import org.eclipse.e4.tools.emf.ui.internal.common.E4PickList; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.BindingContextSelectionDialog; -import org.eclipse.e4.ui.model.application.commands.MBindingTable; -import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; -import org.eclipse.e4.ui.model.application.commands.MKeyBinding; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.IEMFListProperty; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.window.Window; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class BindingTableEditor extends AbstractComponentEditor { - - private Composite composite; - private EMFDataBindingContext context; - - private final IListProperty BINDING_TABLE__BINDINGS = EMFProperties - .list(CommandsPackageImpl.Literals.BINDING_TABLE__BINDINGS); - private StackLayout stackLayout; - private final List<Action> actions = new ArrayList<Action>(); - - @Inject - public BindingTableEditor() { - super(); - } - - @PostConstruct - void init() { - actions.add(new Action(Messages.BindingTableEditor_AddKeyBinding, - createImageDescriptor(ResourceProvider.IMG_KeyBinding)) { - @Override - public void run() { - handleAddKeyBinding(); - } - }); - } - - @Override - public Image getImage(Object element, Display display) { - return createImage(ResourceProvider.IMG_BindingTable); - } - - @Override - public String getLabel(Object element) { - return Messages.BindingTableEditor_Label; - } - - @Override - public String getDescription(Object element) { - return Messages.BindingTableEditor_Description; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - getMaster().setValue(object); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, IObservableValue master, - boolean isImport) { - final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { - ControlFactory.createXMIId(parent, this); - } - - if (isImport) { - ControlFactory.createFindImport(parent, Messages, this, context); - folder.setSelection(0); - return folder; - } - - { - final Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ModelTooling_Common_Id); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - final Text t = new Text(parent, SWT.BORDER); - final GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue( - textProp.observeDelayed(200, t), - EMFEditProperties.value(getEditingDomain(), - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); - } - - { - final Label l = new Label(parent, SWT.NONE); - l.setText(Messages.BindingTableEditor_ContextId); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - final Text t = new Text(parent, SWT.BORDER); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - t.setEditable(false); - context.bindValue( - textProp.observeDelayed(200, t), - EMFEditProperties.value( - getEditingDomain(), - FeaturePath.fromList(CommandsPackageImpl.Literals.BINDING_TABLE__BINDING_CONTEXT, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)).observeDetail(getMaster())); - - final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); - b.setText(Messages.ModelTooling_Common_FindEllipsis); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - final BindingContextSelectionDialog dialog = new BindingContextSelectionDialog(b.getShell(), - getEditor().getModelProvider(), Messages); - if (dialog.open() == Window.OK) { - final Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), - CommandsPackageImpl.Literals.BINDING_TABLE__BINDING_CONTEXT, dialog.getSelectedContext()); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - } - }); - } - - { - final E4PickList pickList = new E4PickList(parent, SWT.NONE, Arrays.asList(PickListFeatures.NO_PICKER), - Messages, this, CommandsPackageImpl.Literals.BINDING_TABLE__BINDINGS) { - @Override - protected void addPressed() { - handleAddKeyBinding(); - } - - @Override - protected List<?> getContainerChildren(Object master) { - return ((MBindingTable) master).getBindings(); - } - }; - pickList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1)); - pickList.setText(Messages.BindingTableEditor_Keybindings); - - final TableViewer viewer = pickList.getList(); - - final IEMFListProperty prop = EMFProperties.list(CommandsPackageImpl.Literals.BINDING_TABLE__BINDINGS); - viewer.setInput(prop.observeDetail(getMaster())); - } - - item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabSupplementary); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); - - createContributedEditorTabs(folder, context, getMaster(), MBindingTable.class); - - folder.setSelection(0); - - return folder; - } - - @Override - public IObservableList getChildList(Object element) { - return BINDING_TABLE__BINDINGS.observe(element); - } - - @Override - public String getDetailLabel(Object element) { - final MBindingTable cmd = (MBindingTable) element; - if (cmd.getBindingContext() != null && cmd.getBindingContext().getName() != null - && cmd.getBindingContext().getName().trim().length() > 0) { - return cmd.getBindingContext().getName(); - } - - return null; - } - - @Override - public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { FeaturePath.fromList(CommandsPackageImpl.Literals.BINDING_TABLE__BINDING_CONTEXT, - CommandsPackageImpl.Literals.BINDING_CONTEXT__NAME) }; - } - - @Override - public List<Action> getActions(Object element) { - final ArrayList<Action> l = new ArrayList<Action>(super.getActions(element)); - l.addAll(actions); - return l; - } - - protected void handleAddKeyBinding() { - final MKeyBinding handler = MCommandsFactory.INSTANCE.createKeyBinding(); - final Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), - CommandsPackageImpl.Literals.BINDING_TABLE__BINDINGS, handler); - setElementId(handler); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(handler); - } - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CategoryEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CategoryEditor.java deleted file mode 100644 index 147b1d21..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CategoryEditor.java +++ /dev/null @@ -1,158 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2014 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Lars Vogel <Lars.Vogel@gmail.com> - Ongoing maintenance - * Steven Spungin <steven@spungin.tv> - Bug 437951 - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import javax.inject.Inject; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.IObservableValue; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.ui.model.application.commands.MCategory; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; - -public class CategoryEditor extends AbstractComponentEditor { - - private Composite composite; - private EMFDataBindingContext context; - private StackLayout stackLayout; - - @Inject - public CategoryEditor() { - super(); - } - - @Override - public Image getImage(Object element, Display display) { - return createImage(ResourceProvider.IMG_Category); - } - - @Override - public String getLabel(Object element) { - return Messages.CategoryEditor_TreeLabel; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return Messages.CategoryEditor_TreeLabelDescriptor; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - getMaster().setValue(object); - enableIdGenerator(CommandsPackageImpl.Literals.CATEGORY__NAME, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID, null); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, IObservableValue master, - boolean isImport) { - final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { - ControlFactory.createXMIId(parent, this); - } - - if (isImport) { - ControlFactory.createFindImport(parent, Messages, this, context); - folder.setSelection(0); - return folder; - } - - ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, - EMFEditProperties - .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); - ControlFactory.createTextField(parent, Messages.CategoryEditor_Name, master, context, textProp, - EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.CATEGORY__NAME)); - ControlFactory.createTextField(parent, Messages.CategoryEditor_Description, master, context, textProp, - EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.CATEGORY__DESCRIPTION)); - - item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabSupplementary); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); - - createContributedEditorTabs(folder, context, getMaster(), MCategory.class); - - folder.setSelection(0); - - return folder; - } - - @Override - public IObservableList getChildList(Object element) { - return null; - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java deleted file mode 100644 index c5645349..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java +++ /dev/null @@ -1,300 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2014 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Lars Vogel <Lars.Vogel@gmail.com> - Ongoing maintenance - * Steven Spungin <steven@spungin.tv> - Bug 437951 - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import javax.annotation.PostConstruct; -import javax.inject.Inject; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.IObservableValue; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.AbstractPickList.PickListFeatures; -import org.eclipse.e4.tools.emf.ui.internal.common.E4PickList; -import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.CommandCategorySelectionDialog; -import org.eclipse.e4.ui.model.application.commands.MCommand; -import org.eclipse.e4.ui.model.application.commands.MCommandParameter; -import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditListProperty; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class CommandEditor extends AbstractComponentEditor { - - private Composite composite; - private EMFDataBindingContext context; - private StackLayout stackLayout; - private final List<Action> actions = new ArrayList<Action>(); - private MessageFormat newCommandParameterName; - - private final IEMFEditListProperty COMMAND__PARAMETERS = EMFEditProperties.list(getEditingDomain(), - CommandsPackageImpl.Literals.COMMAND__PARAMETERS); - - @Inject - public CommandEditor() { - super(); - } - - @PostConstruct - void init() { - actions.add(new Action(Messages.CommandEditor_AddCommandParameter, - createImageDescriptor(ResourceProvider.IMG_CommandParameter)) { - @Override - public void run() { - handleAddCommandParameter(); - } - }); - - newCommandParameterName = new MessageFormat(Messages.CommandEditor_NewCommandParameter); - } - - @Override - public Image getImage(Object element, Display display) { - return createImage(ResourceProvider.IMG_Command); - } - - @Override - public String getLabel(Object element) { - return Messages.CommandEditor_Label; - } - - @Override - public String getDescription(Object element) { - return Messages.CommandEditor_Description; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - getMaster().setValue(object); - enableIdGenerator(CommandsPackageImpl.Literals.COMMAND__COMMAND_NAME, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID, null); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, IObservableValue master, - boolean isImport) { - final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { - ControlFactory.createXMIId(parent, this); - } - - if (isImport) { - ControlFactory.createFindImport(parent, Messages, this, context); - folder.setSelection(0); - return folder; - } - - ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, - Messages.ModelTooling_CommandId_tooltip, master, context, textProp, EMFEditProperties.value( - getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID), - Messages.ModelTooling_Empty_Warning); - ControlFactory.createTextField(parent, Messages.CommandEditor_Name, master, context, textProp, - EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND__COMMAND_NAME)); - ControlFactory.createTextField(parent, Messages.CommandEditor_LabelDescription, master, context, textProp, - EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND__DESCRIPTION)); - - // ------------------------------------------------------------ - { - final Label l = new Label(parent, SWT.NONE); - l.setText(Messages.CommandEditor_Category); - l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); - - final Text t = new Text(parent, SWT.BORDER); - TextPasteHandler.createFor(t); - final GridData gd = new GridData(GridData.FILL_HORIZONTAL); - t.setLayoutData(gd); - t.setEditable(false); - context.bindValue( - textProp.observeDelayed(200, t), - EMFEditProperties.value( - getEditingDomain(), - FeaturePath.fromList(CommandsPackageImpl.Literals.COMMAND__CATEGORY, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)).observeDetail(getMaster())); - - final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelTooling_Common_FindEllipsis); - b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - final CommandCategorySelectionDialog dialog = new CommandCategorySelectionDialog(b.getShell(), - getEditor().getModelProvider(), (MCommand) getMaster().getValue(), Messages); - dialog.open(); - } - }); - } - - // ------------------------------------------------------------ - { - final E4PickList pickList = new E4PickList(parent, SWT.NONE, Arrays.asList(PickListFeatures.NO_PICKER), - Messages, this, CommandsPackageImpl.Literals.COMMAND__PARAMETERS) { - @Override - protected void addPressed() { - handleAddCommandParameter(); - } - - @Override - protected List<?> getContainerChildren(Object master) { - return ((MCommand) master).getParameters(); - } - }; - pickList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1)); - - pickList.setText(Messages.CommandEditor_Parameters); - - final TableViewer viewer = pickList.getList(); - - final IEMFEditListProperty mProp = EMFEditProperties.list(getEditingDomain(), - CommandsPackageImpl.Literals.COMMAND__PARAMETERS); - viewer.setInput(mProp.observeDetail(getMaster())); - } - - item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabSupplementary); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); - - createContributedEditorTabs(folder, context, getMaster(), MCommand.class); - - folder.setSelection(0); - - return folder; - } - - @Override - public IObservableList getChildList(Object element) { - return COMMAND__PARAMETERS.observe(element); - } - - @Override - public String getDetailLabel(Object element) { - final MCommand cmd = (MCommand) element; - if (cmd.getCommandName() != null && cmd.getCommandName().trim().length() > 0) { - return translate(cmd.getCommandName()); - } - return null; - } - - @Override - public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { FeaturePath.fromList(CommandsPackageImpl.Literals.COMMAND__COMMAND_NAME) }; - } - - protected void handleAddCommandParameter() { - final MCommandParameter param = MCommandsFactory.INSTANCE.createCommandParameter(); - setElementId(param); - param.setName(newCommandParameterName.format(new Object[] { getParameterCount() })); - - final Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), - CommandsPackageImpl.Literals.COMMAND__PARAMETERS, param); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(param); - } - } - - @Override - public List<Action> getActions(Object element) { - final ArrayList<Action> l = new ArrayList<Action>(super.getActions(element)); - l.addAll(actions); - return l; - } - - /** - * Returns the current amount of {@link MCommandParameter}s the edited {@link MCommand} has. - * - * @return the amount of {@link MCommandParameter}s of the edited {@link MCommand} - */ - private int getParameterCount() { - // getChildList() will always create a new IObservableList and - // this method uses the normal EMF way to retrieve the count manually. - final EObject command = (EObject) getMaster().getValue(); - final List<?> commandParameters = (List<?>) command.eGet(CommandsPackageImpl.Literals.COMMAND__PARAMETERS); - return commandParameters.size(); - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java deleted file mode 100644 index 3db9f0a8..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java +++ /dev/null @@ -1,188 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2014 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Lars Vogel <Lars.Vogel@gmail.com> - Ongoing maintenance - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import javax.inject.Inject; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.ui.model.application.commands.MCommandParameter; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; - -public class CommandParameterEditor extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - - private StackLayout stackLayout; - - @Inject - public CommandParameterEditor() { - super(); - } - - @Override - public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { FeaturePath.fromList(CommandsPackageImpl.Literals.COMMAND_PARAMETER__NAME), - FeaturePath.fromList(ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID) }; - } - - @Override - public Image getImage(Object element, Display display) { - return createImage(ResourceProvider.IMG_CommandParameter); - } - - @Override - public String getLabel(Object element) { - return Messages.CommandParameterEditor_TreeLabel; - } - - @Override - public String getDetailLabel(Object element) { - final MCommandParameter param = (MCommandParameter) element; - if (param.getName() != null && param.getName().trim().length() > 0) { - return param.getName().trim(); - } else if (param.getElementId() != null && param.getElementId().trim().length() > 0) { - return param.getElementId().trim(); - } - return null; - } - - @Override - public String getDescription(Object element) { - return Messages.CommandParameterEditor_TreeLabelDescritpion; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - getMaster().setValue(object); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { - final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { - ControlFactory.createXMIId(parent, this); - } - - if (isImport) { - ControlFactory.createFindImport(parent, Messages, this, context); - folder.setSelection(0); - return folder; - } - - ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, - EMFEditProperties - .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID), - Messages.ModelTooling_Empty_Warning); - ControlFactory.createTextField(parent, Messages.CommandParameterEditor_Name, master, context, textProp, - EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND_PARAMETER__NAME), - Messages.ModelTooling_Empty_Warning); - ControlFactory.createTextField(parent, Messages.CommandParameterEditor_TypeId, master, context, textProp, - EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND_PARAMETER__TYPE_ID)); - - { - final Label l = new Label(parent, SWT.NONE); - l.setText(Messages.CommandParameterEditor_Optional); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - final Button checkbox = new Button(parent, SWT.CHECK); - checkbox.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false, 2, 1)); - - final IEMFEditValueProperty mprop = EMFEditProperties.value(getEditingDomain(), - CommandsPackageImpl.Literals.COMMAND_PARAMETER__OPTIONAL); - final IWidgetValueProperty uiProp = WidgetProperties.selection(); - - context.bindValue(uiProp.observe(checkbox), mprop.observeDetail(master)); - } - - item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabSupplementary); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); - - createContributedEditorTabs(folder, context, getMaster(), MCommandParameter.class); - - folder.setSelection(0); - - return folder; - } - - @Override - public IObservableList getChildList(Object element) { - return null; - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CompositePartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CompositePartEditor.java deleted file mode 100644 index ca2c9060..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CompositePartEditor.java +++ /dev/null @@ -1,572 +0,0 @@ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.util.ArrayList; -import java.util.List; - -import javax.annotation.PostConstruct; -import javax.inject.Inject; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.core.di.annotations.Optional; -import org.eclipse.e4.tools.emf.ui.common.IEditorFeature.FeatureClass; -import org.eclipse.e4.tools.emf.ui.common.ImageTooltip; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.FeatureClassLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.PartIconDialogEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.uistructure.UIViewer; -import org.eclipse.e4.tools.emf.ui.internal.imp.ModelImportWizard; -import org.eclipse.e4.tools.emf.ui.internal.imp.RegistryUtil; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.MElementContainer; -import org.eclipse.e4.ui.model.application.ui.MUIElement; -import org.eclipse.e4.ui.model.application.ui.MUILabel; -import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; -import org.eclipse.e4.ui.model.application.ui.basic.MCompositePart; -import org.eclipse.e4.ui.model.application.ui.basic.MPart; -import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.IEMFListProperty; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.databinding.viewers.IViewerValueProperty; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.databinding.viewers.ViewerProperties; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.ComboViewer; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.window.Window; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; - -public class CompositePartEditor extends AbstractComponentEditor { - - private Composite composite; - private EMFDataBindingContext context; - - private final IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties - .list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - private StackLayout stackLayout; - private final List<Action> actions = new ArrayList<Action>(); - private final List<Action> actionsImport = new ArrayList<Action>(); - - @Inject - @Optional - private IProject project; - - @Inject - private Shell shell; - - @Inject - IEclipseContext eclipseContext; - - @Inject - public CompositePartEditor() { - super(); - } - - @PostConstruct - void init() { - actions.add(new Action(Messages.CompositePartEditor_AddPartSashContainer, - createImageDescriptor(ResourceProvider.IMG_PartSashContainer)) { - @Override - public void run() { - handleAddChild(BasicPackageImpl.Literals.COMPOSITE_PART); - } - }); - actions.add(new Action(Messages.CompositePartEditor_AddPartStack, - createImageDescriptor(ResourceProvider.IMG_PartStack)) { - @Override - public void run() { - handleAddChild(BasicPackageImpl.Literals.PART_STACK); - } - }); - actions.add(new Action(Messages.CompositePartEditor_AddPart, createImageDescriptor(ResourceProvider.IMG_Part)) { - @Override - public void run() { - handleAddChild(BasicPackageImpl.Literals.PART); - } - }); - - actions.add(new Action(Messages.CompositePartEditor_AddArea, createImageDescriptor(ResourceProvider.IMG_Area)) { - @Override - public void run() { - handleAddChild(AdvancedPackageImpl.Literals.AREA); - } - }); - actions.add(new Action(Messages.CompositePartEditor_AddPlaceholder, - createImageDescriptor(ResourceProvider.IMG_Placeholder)) { - @Override - public void run() { - handleAddChild(AdvancedPackageImpl.Literals.PLACEHOLDER); - } - }); - for (final FeatureClass c : getEditor().getFeatureClasses(BasicPackageImpl.Literals.PART_STACK, - UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN)) { - final EClass ec = c.eClass; - actions.add(new Action(c.label, createImageDescriptor(c.iconId)) { - @Override - public void run() { - handleAddChild(ec); - } - }); - } - - // --- Import Actions --- - actionsImport.add(new Action("Views", createImageDescriptor(ResourceProvider.IMG_Part)) { //$NON-NLS-1$ - @Override - public void run() { - handleImportChild(BasicPackageImpl.Literals.PART, RegistryUtil.HINT_VIEW); - } - }); - actionsImport.add(new Action("Editors", createImageDescriptor(ResourceProvider.IMG_Part)) { //$NON-NLS-1$ - @Override - public void run() { - handleImportChild(BasicPackageImpl.Literals.INPUT_PART, RegistryUtil.HINT_EDITOR); - } - }); - - } - - @Override - public Image getImage(Object element, Display display) { - final boolean horizontal = ((MCompositePart) element).isHorizontal(); - - if (!horizontal) { - final MUIElement uiElement = (MUIElement) element; - if (uiElement.isToBeRendered() && uiElement.isVisible()) { - return createImage(ResourceProvider.IMG_PartSashContainer_vertical); - } - return createImage(ResourceProvider.IMG_Tbr_PartSashContainer_vertical); - } - - if (horizontal) { - final MUIElement uiElement = (MUIElement) element; - if (uiElement.isToBeRendered() && uiElement.isVisible()) { - return createImage(ResourceProvider.IMG_PartSashContainer); - } - return createImage(ResourceProvider.IMG_Tbr_PartSashContainer); - } - return null; - } - - @Override - public String getLabel(Object element) { - return Messages.CompositePartEditor_Label; - } - - @Override - public String getDescription(Object element) { - return Messages.CompositePartEditor_Description; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - getMaster().setValue(object); - return composite; - } - - private Composite createForm(Composite parent, final EMFDataBindingContext context, WritableValue master, - boolean isImport) { - final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { - ControlFactory.createXMIId(parent, this); - } - - final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (isImport) { - ControlFactory.createFindImport(parent, Messages, this, context); - folder.setSelection(0); - return folder; - } - - ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, - EMFEditProperties - .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); - ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), - context, textProp, - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); - ControlFactory.createTextField(parent, Messages.CompositePartEditor_LabelLabel, master, context, textProp, - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL)); - ControlFactory.createTextField(parent, Messages.CompositePartEditor_Tooltip, master, context, textProp, - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP)); - - // ------------------------------------------------------------ - { - final Label l = new Label(parent, SWT.NONE); - l.setText(Messages.CompositePartEditor_IconURI); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - l.setToolTipText(Messages.CompositePartEditor_IconURI_Tooltip); - - final Text t = new Text(parent, SWT.BORDER); - TextPasteHandler.createFor(t); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue( - textProp.observeDelayed(200, t), - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail( - master)); - - new ImageTooltip(t, Messages) { - - @Override - protected URI getImageURI() { - final MUILabel part = (MUILabel) getMaster().getValue(); - final String uri = part.getIconURI(); - if (uri == null || uri.trim().length() == 0) { - return null; - } - return URI.createURI(part.getIconURI()); - } - }; - - final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); - b.setText(Messages.ModelTooling_Common_FindEllipsis); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - final PartIconDialogEditor dialog = new PartIconDialogEditor(b.getShell(), eclipseContext, project, - getEditingDomain(), (MPart) getMaster().getValue(), Messages); - dialog.open(); - } - }); - } - - // ------------------------------------------------------------ - { - final Label l = new Label(parent, SWT.NONE); - l.setText(Messages.CompositePartEditor_Orientation); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - final ComboViewer viewer = new ComboViewer(parent); - final GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - viewer.getControl().setLayoutData(gd); - viewer.setContentProvider(new ArrayContentProvider()); - viewer.setLabelProvider(new LabelProvider() { - @Override - public String getText(Object element) { - return ((Boolean) element).booleanValue() ? Messages.CompositePartEditor_Horizontal - : Messages.CompositePartEditor_Vertical; - } - }); - viewer.setInput(new Boolean[] { Boolean.TRUE, Boolean.FALSE }); - final IViewerValueProperty vProp = ViewerProperties.singleSelection(); - context.bindValue(vProp.observe(viewer), - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.GENERIC_TILE__HORIZONTAL) - .observeDetail(getMaster())); - } - - ControlFactory.createSelectedElement(parent, this, context, Messages.CompositePartEditor_SelectedElement); - ControlFactory.createTextField(parent, Messages.CompositePartEditor_ContainerData, master, context, textProp, - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__CONTAINER_DATA)); - - { - - final Label l = new Label(parent, SWT.NONE); - l.setText(Messages.CompositePartEditor_Controls); - l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); - - final Composite buttonCompTop = new Composite(parent, SWT.NONE); - final GridData span2 = new GridData(GridData.FILL, GridData.BEGINNING, false, false, 2, 1); - buttonCompTop.setLayoutData(span2); - final GridLayout gl = new GridLayout(2, false); - gl.marginLeft = 0; - gl.marginRight = 0; - gl.marginWidth = 0; - gl.marginHeight = 0; - buttonCompTop.setLayout(gl); - - final ComboViewer childrenDropDown = new ComboViewer(buttonCompTop); - childrenDropDown.setLabelProvider(new FeatureClassLabelProvider(getEditor())); - - final List<FeatureClass> eClassList = new ArrayList<FeatureClass>(); - eClassList.add(new FeatureClass("PartSashContainer", BasicPackageImpl.Literals.PART_SASH_CONTAINER)); //$NON-NLS-1$ - eClassList.add(new FeatureClass("PartStack", BasicPackageImpl.Literals.PART_STACK)); //$NON-NLS-1$ - eClassList.add(new FeatureClass("Part", BasicPackageImpl.Literals.PART)); //$NON-NLS-1$ - eClassList.add(new FeatureClass("InputPart", BasicPackageImpl.Literals.INPUT_PART)); //$NON-NLS-1$ - eClassList.add(new FeatureClass("Area", AdvancedPackageImpl.Literals.AREA)); //$NON-NLS-1$ - eClassList.add(new FeatureClass("Placeholder", AdvancedPackageImpl.Literals.PLACEHOLDER)); //$NON-NLS-1$ - eClassList.addAll(getEditor().getFeatureClasses(BasicPackageImpl.Literals.COMPOSITE_PART, - UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN)); - childrenDropDown.setInput(eClassList); - childrenDropDown.setSelection(new StructuredSelection(eClassList.get(0))); - - Button b = new Button(buttonCompTop, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelTooling_Common_AddEllipsis); - b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!childrenDropDown.getSelection().isEmpty()) { - final EClass eClass = ((FeatureClass) ((IStructuredSelection) childrenDropDown.getSelection()) - .getFirstElement()).eClass; - handleAddChild(eClass); - } - } - }); - - new Label(parent, SWT.NONE); - - final TableViewer viewer = new TableViewer(parent); - final GridData gd = new GridData(GridData.FILL, GridData.FILL, true, true, 2, 1); - viewer.getControl().setLayoutData(gd); - final ObservableListContentProvider cp = new ObservableListContentProvider(); - viewer.setContentProvider(cp); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); - - final IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - viewer.setInput(prop.observeDetail(getMaster())); - - new Label(parent, SWT.NONE); - - final Composite buttonCompBot = new Composite(parent, SWT.NONE); - buttonCompBot.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false, 2, 1)); - buttonCompBot.setLayout(new FillLayout()); - - b = new Button(buttonCompBot, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelTooling_Common_Up); - b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_up)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - final IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - final Object obj = s.getFirstElement(); - final MElementContainer<?> container = (MElementContainer<?>) getMaster().getValue(); - final int idx = container.getChildren().indexOf(obj) - 1; - if (idx >= 0) { - if (Util.moveElementByIndex(getEditingDomain(), (MUIElement) obj, getEditor() - .isLiveModel(), idx)) { - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonCompBot, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelTooling_Common_Down); - b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_down)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - final IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - final Object obj = s.getFirstElement(); - final MElementContainer<?> container = (MElementContainer<?>) getMaster().getValue(); - final int idx = container.getChildren().indexOf(obj) + 1; - if (idx < container.getChildren().size()) { - if (Util.moveElementByIndex(getEditingDomain(), (MUIElement) obj, getEditor() - .isLiveModel(), idx)) { - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonCompBot, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelTooling_Common_Remove); - b.setImage(createImage(ResourceProvider.IMG_Obj16_table_delete)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - final List<?> elements = ((IStructuredSelection) viewer.getSelection()).toList(); - - final Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), - UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, elements); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - } - }); - } - - ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, - WidgetProperties.selection(), - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); - ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, - WidgetProperties.selection(), - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - - item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabSupplementary); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); - - if (project == null) { - createUITreeInspection(folder); - } - - createContributedEditorTabs(folder, context, getMaster(), MCompositePart.class); - - folder.setSelection(0); - - return folder; - } - - private void createUITreeInspection(CTabFolder folder) { - final CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_RuntimeWidgetTree); - final Composite container = new Composite(folder, SWT.NONE); - container.setLayout(new GridLayout()); - item.setControl(container); - - final UIViewer objectViewer = new UIViewer(); - final TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET, - getMaster(), resourcePool, Messages); - viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); - } - - @Override - public IObservableList getChildList(Object element) { - return ELEMENT_CONTAINER__CHILDREN.observe(element); - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.GENERIC_TILE__HORIZONTAL), - FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) }; - } - - protected void handleAddChild(EClass eClass) { - final EObject eObject = EcoreUtil.create(eClass); - addToModel(eObject); - } - - private void addToModel(EObject eObject) { - setElementId(eObject); - - final Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), - UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(eObject); - } - } - - protected void handleImportChild(EClass eClass, String hint) { - - if (eClass == BasicPackageImpl.Literals.PART) { - final ModelImportWizard wizard = new ModelImportWizard(MPart.class, this, hint, resourcePool); - final WizardDialog wizardDialog = new WizardDialog(shell, wizard); - if (wizardDialog.open() == Window.OK) { - final MPart[] parts = (MPart[]) wizard.getElements(MPart.class); - for (final MPart part : parts) { - addToModel((EObject) part); - } - } - } - } - - @Override - public List<Action> getActions(Object element) { - final ArrayList<Action> l = new ArrayList<Action>(super.getActions(element)); - l.addAll(actions); - return l; - } - - @Override - public List<Action> getActionsImport(Object element) { - final ArrayList<Action> l = new ArrayList<Action>(super.getActionsImport(element)); - l.addAll(actionsImport); - return l; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java deleted file mode 100644 index d7766c13..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java +++ /dev/null @@ -1,818 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2014 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Dirk Fauth <dirk.fauth@googlemail.com> - Bug 426986 - * Steven Spungin <steven@spungin.tv> - Bug 430660, 430664, Bug 430809, 430717 - * Steven Spungin <steven@spungin.tv> - Ongoing maintenance - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.util.Arrays; -import java.util.List; -import java.util.Map.Entry; - -import org.eclipse.core.databinding.Binding; -import org.eclipse.core.databinding.UpdateValueStrategy; -import org.eclipse.core.databinding.observable.list.IListChangeListener; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.list.ListChangeEvent; -import org.eclipse.core.databinding.observable.map.IObservableMap; -import org.eclipse.core.databinding.observable.value.IObservableValue; -import org.eclipse.core.databinding.observable.value.IValueChangeListener; -import org.eclipse.core.databinding.observable.value.ValueChangeEvent; -import org.eclipse.core.databinding.validation.IValidator; -import org.eclipse.core.databinding.validation.ValidationStatus; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.PatternFilter; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.AbstractPickList.PickListFeatures; -import org.eclipse.e4.tools.emf.ui.internal.common.E4PickList; -import org.eclipse.e4.tools.emf.ui.internal.common.E4StringPickList; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.BindingContextSelectionDialog; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; -import org.eclipse.e4.tools.emf.ui.internal.common.properties.ProjectOSGiTranslationProvider; -import org.eclipse.e4.tools.services.IClipboardService.Handler; -import org.eclipse.e4.tools.services.IResourcePool; -import org.eclipse.e4.ui.internal.workbench.E4XMIResource; -import org.eclipse.e4.ui.model.application.MApplicationElement; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; -import org.eclipse.e4.ui.model.application.impl.ApplicationFactoryImpl; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.MUILabel; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.util.BasicEMap; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.IEMFListProperty; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditListProperty; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.databinding.viewers.IViewerValueProperty; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.databinding.viewers.ObservableMapLabelProvider; -import org.eclipse.jface.databinding.viewers.ViewerProperties; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.fieldassist.ControlDecoration; -import org.eclipse.jface.fieldassist.FieldDecoration; -import org.eclipse.jface.fieldassist.FieldDecorationRegistry; -import org.eclipse.jface.viewers.CellEditor; -import org.eclipse.jface.viewers.ColumnLabelProvider; -import org.eclipse.jface.viewers.ComboViewer; -import org.eclipse.jface.viewers.EditingSupport; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; -import org.eclipse.jface.viewers.TextCellEditor; -import org.eclipse.swt.SWT; -import org.eclipse.swt.dnd.Clipboard; -import org.eclipse.swt.dnd.TextTransfer; -import org.eclipse.swt.events.KeyAdapter; -import org.eclipse.swt.events.KeyEvent; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.TraverseEvent; -import org.eclipse.swt.events.TraverseListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class ControlFactory { - public static final String COPY_HANDLER = ControlFactory.class.getName() + ".COPY_HANDLER"; //$NON-NLS-1$ - - public static class TextPasteHandler implements Handler { - private final Text t; - - public TextPasteHandler(Text t) { - this.t = t; - } - - public static void createFor(Text t) { - t.setData(COPY_HANDLER, new TextPasteHandler(t)); - } - - @Override - public void paste() { - final Clipboard cp = new Clipboard(t.getDisplay()); - final Object o = cp.getContents(TextTransfer.getInstance()); - cp.dispose(); - if (o == null) { - return; - } - - if (validate(o.toString())) { - t.paste(); - } - } - - @Override - public void cut() { - t.cut(); - } - - @Override - public void copy() { - t.copy(); - } - - public boolean validate(String text) { - return true; - } - } - - public static void createXMIId(Composite parent, AbstractComponentEditor editor) { - final Label l = new Label(parent, SWT.NONE); - l.setText("XMI:ID"); //$NON-NLS-1$ - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - final Text t = new Text(parent, SWT.BORDER); - t.setEditable(false); - final GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - - TextPasteHandler.createFor(t); - - editor.getMaster().addValueChangeListener(new IValueChangeListener() { - - @Override - public void handleValueChange(ValueChangeEvent event) { - final Object val = event.diff.getNewValue(); - if (val != null && val instanceof EObject && !t.isDisposed()) { - final Resource res = ((EObject) val).eResource(); - if (res instanceof E4XMIResource) { - final String v = ((E4XMIResource) res).getID((EObject) val); - if (v != null && v.trim().length() > 0) { - t.setText(v); - } - } - } - } - }); - } - - public static Composite createMapProperties(Composite parent, final Messages Messages, - final AbstractComponentEditor editor, String label, final EStructuralFeature feature, int vIndent) { - return createMapProperties(parent, Messages, editor, label, null, feature, vIndent); - } - - public static Composite createMapProperties(Composite parent, final Messages Messages, - final AbstractComponentEditor editor, String label, String tooltip, final EStructuralFeature feature, - int vIndent) { - - final E4PickList pickList = new E4PickList(parent, SWT.NONE, Arrays.asList(PickListFeatures.NO_PICKER), - Messages, editor, feature) { - @Override - protected List<?> getContainerChildren(Object master) { - return null; - } - - @Override - protected void addPressed() { - final Dialog dialog = new Dialog(getShell()) { - private Text key; - private Text value; - - @Override - protected Control createDialogArea(Composite parent) { - getShell().setText(Messages.ControlFactory_KeyValueShellTitle); - final Composite comp = (Composite) super.createDialogArea(parent); - final Composite container = new Composite(comp, SWT.NONE); - container.setLayout(new GridLayout(2, false)); - container.setLayoutData(new GridData(GridData.FILL_BOTH)); - - Label l = new Label(container, SWT.NONE); - l.setText(Messages.ControlFactory_Key); - - key = new Text(container, SWT.BORDER); - key.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - l = new Label(container, SWT.NONE); - l.setText(Messages.ControlFactory_Value); - - value = new Text(container, SWT.BORDER); - value.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - return comp; - } - - @Override - protected void okPressed() { - if (key.getText().trim().length() > 0) { - final BasicEMap.Entry<String, String> entry = (org.eclipse.emf.common.util.BasicEMap.Entry<String, String>) ApplicationFactoryImpl.eINSTANCE - .createStringToStringMap(); - entry.setHash(key.hashCode()); - entry.setKey(key.getText()); - entry.setValue(value.getText().trim().length() > 0 ? value.getText() : null); - final Command cmd = AddCommand.create(editor.getEditingDomain(), editor.getMaster() - .getValue(), feature, entry); - if (cmd.canExecute()) { - editor.getEditingDomain().getCommandStack().execute(cmd); - super.okPressed(); - } - } - } - }; - dialog.open(); - } - }; - pickList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1)); - pickList.setText(label); - if (tooltip != null) { - pickList.setToolTipText(tooltip); - } - - final TableViewer tableviewer = pickList.getList(); - tableviewer.getTable().setHeaderVisible(true); - final ObservableListContentProvider cp = new ObservableListContentProvider(); - tableviewer.setContentProvider(cp); - - final GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 80; - gd.verticalIndent = vIndent; - tableviewer.getControl().setLayoutData(gd); - - TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText(Messages.ControlFactory_Key); - column.getColumn().setWidth(200); - column.setLabelProvider(new ColumnLabelProvider() { - @SuppressWarnings("unchecked") - @Override - public String getText(Object element) { - final Entry<String, String> entry = (Entry<String, String>) element; - return entry.getKey(); - } - }); - - final TextCellEditor keyEditor = new TextCellEditor(tableviewer.getTable()); - column.setEditingSupport(new EditingSupport(tableviewer) { - - @Override - protected void setValue(Object element, Object value) { - final Command cmd = SetCommand.create(editor.getEditingDomain(), element, - ApplicationPackageImpl.Literals.STRING_TO_STRING_MAP__KEY, - value.toString().trim().length() == 0 ? null : value.toString()); - if (cmd.canExecute()) { - editor.getEditingDomain().getCommandStack().execute(cmd); - tableviewer.refresh(); - tableviewer.getTable().getColumn(0).pack(); - } - } - - @Override - protected Object getValue(Object element) { - @SuppressWarnings("unchecked") - final Entry<String, String> entry = (Entry<String, String>) element; - return entry.getKey(); - } - - @Override - protected CellEditor getCellEditor(Object element) { - return keyEditor; - } - - @Override - protected boolean canEdit(Object element) { - return true; - } - }); - - // FIXME How can we react upon changes in the Map-Value? - column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText(Messages.ControlFactory_Value); - column.getColumn().setWidth(200); - column.setLabelProvider(new ColumnLabelProvider() { - @Override - public String getText(Object element) { - @SuppressWarnings("unchecked") - final Entry<String, String> entry = (Entry<String, String>) element; - return entry.getValue(); - } - }); - - final TextCellEditor cellEditor = new TextCellEditor(tableviewer.getTable()); - column.setEditingSupport(new EditingSupport(tableviewer) { - - @Override - protected void setValue(Object element, Object value) { - final Command cmd = SetCommand.create(editor.getEditingDomain(), element, - ApplicationPackageImpl.Literals.STRING_TO_STRING_MAP__VALUE, - value.toString().trim().length() == 0 ? null : value.toString()); - if (cmd.canExecute()) { - editor.getEditingDomain().getCommandStack().execute(cmd); - tableviewer.refresh(); - } - } - - @SuppressWarnings("unchecked") - @Override - protected Object getValue(Object element) { - final Entry<String, String> entry = (Entry<String, String>) element; - return entry.getValue() == null ? "" : entry.getValue(); //$NON-NLS-1$ - } - - @Override - protected CellEditor getCellEditor(Object element) { - return cellEditor; - } - - @Override - protected boolean canEdit(Object element) { - return true; - } - }); - - final IEMFEditListProperty prop = EMFEditProperties.list(editor.getEditingDomain(), feature); - final IObservableList observableList = prop.observeDetail(editor.getMaster()); - tableviewer.setInput(observableList); - observableList.addListChangeListener(new IListChangeListener() { - - @Override - public void handleListChange(ListChangeEvent event) { - tableviewer.getTable().getColumn(0).pack(); - } - }); - - return pickList; - } - - public static void createTextField(Composite parent, String label, IObservableValue master, - EMFDataBindingContext context, IWidgetValueProperty textProp, IEMFEditValueProperty modelProp) { - createTextField(parent, label, null, master, context, textProp, modelProp, null); - } - - public static void createTextField(Composite parent, String label, String tooltip, IObservableValue master, - EMFDataBindingContext context, IWidgetValueProperty textProp, IEMFEditValueProperty modelProp) { - createTextField(parent, label, tooltip, master, context, textProp, modelProp, null); - } - - public static void createTextField(Composite parent, String label, IObservableValue master, - EMFDataBindingContext context, IWidgetValueProperty textProp, IEMFEditValueProperty modelProp, - final String warningText) { - createTextField(parent, label, null, master, context, textProp, modelProp, warningText); - } - - /** - * - * @param parent - * @param label - * @param master - * @param context - * @param textProp - * @param modelProp - * @param warningText - * Non null warningText means that a warning with this non-null - * text will be shown when the field is left empty - */ - public static void createTextField(Composite parent, String label, String tooltip, IObservableValue master, - EMFDataBindingContext context, IWidgetValueProperty textProp, IEMFEditValueProperty modelProp, - final String warningText) { - final Label l = new Label(parent, SWT.NONE); - l.setText(label); - if (tooltip != null) { - l.setToolTipText(tooltip); - } - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - final Text t = new Text(parent, SWT.BORDER); - final GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - TextPasteHandler.createFor(t); - if (warningText != null) { - final ControlDecoration controlDecoration = new ControlDecoration(t, SWT.LEFT | SWT.TOP); - controlDecoration.setDescriptionText(warningText); - final FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault().getFieldDecoration( - FieldDecorationRegistry.DEC_WARNING); - controlDecoration.setImage(fieldDecoration.getImage()); - final IValidator iv = new IValidator() { - - @Override - public IStatus validate(Object value) { - if (value == null) { - controlDecoration.show(); - return ValidationStatus.warning(warningText); - } - if (value instanceof String) { - final String text = (String) value; - if (text.trim().length() == 0) { - controlDecoration.show(); - return ValidationStatus.warning(warningText); - } - } - controlDecoration.hide(); - return Status.OK_STATUS; - } - }; - final UpdateValueStrategy acv = new UpdateValueStrategy().setAfterConvertValidator(iv); - context.bindValue(textProp.observeDelayed(200, t), modelProp.observeDetail(master), acv, acv); - } else { - context.bindValue(textProp.observeDelayed(200, t), modelProp.observeDetail(master)); - } - } - - public static void createTranslatedTextField(Composite parent, String label, IObservableValue master, - EMFDataBindingContext context, IWidgetValueProperty textProp, IEMFEditValueProperty modelProp, - IResourcePool resourcePool, IProject project) { - createTranslatedTextField(parent, label, null, master, context, textProp, modelProp, resourcePool, project); - } - - public static void createTranslatedTextField(Composite parent, String label, String tooltip, - IObservableValue master, EMFDataBindingContext context, IWidgetValueProperty textProp, - IEMFEditValueProperty modelProp, IResourcePool resourcePool, IProject project) { - final Label l = new Label(parent, SWT.NONE); - l.setText(label); - if (tooltip != null) { - l.setToolTipText(tooltip); - } - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - final Text t = new Text(parent, SWT.BORDER); - final GridData gd = new GridData(GridData.FILL_HORIZONTAL); - if (project == null) { - gd.horizontalSpan = 2; - } else { - gd.horizontalSpan = 2; - } - - t.setLayoutData(gd); - - TextPasteHandler.createFor(t); - context.bindValue(textProp.observeDelayed(200, t), modelProp.observeDetail(master)); - - // if (project != null) { - // Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - // b.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Obj16_world_edit)); - // } - } - - public static void createFindImport(Composite parent, final Messages Messages, - final AbstractComponentEditor editor, EMFDataBindingContext context) { - final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - final Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ModelTooling_Common_RefId); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - final Text t = new Text(parent, SWT.BORDER); - final GridData gd = new GridData(GridData.FILL_HORIZONTAL); - t.setLayoutData(gd); - - TextPasteHandler.createFor(t); - - context.bindValue( - textProp.observeDelayed(200, t), - EMFEditProperties.value(editor.getEditingDomain(), - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(editor.getMaster())); - - final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelTooling_Common_FindEllipsis); - b.setImage(editor.createImage(ResourceProvider.IMG_Obj16_zoom)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - final FindImportElementDialog dialog = new FindImportElementDialog(b.getShell(), editor, - (EObject) editor.getMaster().getValue(), Messages); - dialog.open(); - } - }); - } - - public static void createSelectedElement(Composite parent, final AbstractComponentEditor editor, - final EMFDataBindingContext context, String label) { - final Label l = new Label(parent, SWT.NONE); - l.setText(label); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - final ComboViewer viewer = new ComboViewer(parent); - final GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - viewer.getControl().setLayoutData(gd); - final IEMFEditListProperty listProp = EMFEditProperties.list(editor.getEditingDomain(), - UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - final IEMFEditValueProperty labelProp = EMFEditProperties.value(editor.getEditingDomain(), - UiPackageImpl.Literals.UI_LABEL__LABEL); - final IEMFEditValueProperty idProp = EMFEditProperties.value(editor.getEditingDomain(), - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID); - - final IViewerValueProperty vProp = ViewerProperties.singleSelection(); - - final Binding[] binding = new Binding[1]; - final IObservableValue uiObs = vProp.observe(viewer); - final IObservableValue mObs = EMFEditProperties.value(editor.getEditingDomain(), - UiPackageImpl.Literals.ELEMENT_CONTAINER__SELECTED_ELEMENT).observeDetail(editor.getMaster()); - editor.getMaster().addValueChangeListener(new IValueChangeListener() { - - @Override - public void handleValueChange(ValueChangeEvent event) { - if (binding[0] != null) { - binding[0].dispose(); - } - - } - }); - - final IObservableList list = listProp.observeDetail(editor.getMaster()); - final ObservableListContentProvider cp = new ObservableListContentProvider(); - viewer.setContentProvider(cp); - final IObservableMap[] attributeMaps = { labelProp.observeDetail(cp.getKnownElements()), - idProp.observeDetail(cp.getKnownElements()) }; - viewer.setLabelProvider(new ObservableMapLabelProvider(attributeMaps) { - @Override - public String getText(Object element) { - final EObject o = (EObject) element; - final String rv = o.eClass().getName(); - - if (element instanceof MUILabel) { - final MUILabel label = (MUILabel) element; - if (!Util.isNullOrEmpty(label.getLabel())) { - return rv + " - " + label.getLabel().trim(); //$NON-NLS-1$ - } - - } - - if (element instanceof MApplicationElement) { - final MApplicationElement appEl = (MApplicationElement) element; - if (!Util.isNullOrEmpty(appEl.getElementId())) { - return rv + " - " + appEl.getElementId(); //$NON-NLS-1$ - } - } - - return rv + "[" + list.indexOf(element) + "]"; //$NON-NLS-1$//$NON-NLS-2$ - } - }); - viewer.setInput(list); - - editor.getMaster().addValueChangeListener(new IValueChangeListener() { - - @Override - public void handleValueChange(ValueChangeEvent event) { - binding[0] = context.bindValue(uiObs, mObs); - } - }); - } - - public static void createBindingContextWiget(Composite parent, final Messages Messages, - final AbstractComponentEditor editor, String label) { - createBindingContextWiget(parent, Messages, editor, label, null); - } - - public static void createBindingContextWiget(Composite parent, final Messages Messages, - final AbstractComponentEditor editor, String label, String tooltip) { - { - final E4PickList pickList = new E4PickList(parent, SWT.NONE, Arrays.asList(PickListFeatures.NO_ORDER, - PickListFeatures.NO_PICKER), Messages, editor, CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS) { - @Override - protected void addPressed() { - final BindingContextSelectionDialog dialog = new BindingContextSelectionDialog(getShell(), editor - .getEditor().getModelProvider(), Messages); - if (dialog.open() == IDialogConstants.OK_ID) { - final Command cmd = AddCommand.create(editor.getEditingDomain(), editor.getMaster().getValue(), - CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, dialog.getSelectedContext()); - if (cmd.canExecute()) { - editor.getEditingDomain().getCommandStack().execute(cmd); - } - } - } - }; - pickList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1)); - - pickList.setText(label); - pickList.getList().setInput( - EMFProperties.list(CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS).observeDetail( - editor.getMaster())); - } - } - - public static Composite createStringListWidget(Composite parent, Messages Messages, - final AbstractComponentEditor editor, String label, final EStructuralFeature feature, int vIndent) { - return createStringListWidget(parent, Messages, editor, label, null, feature, vIndent); - } - - public static Composite createStringListWidget(Composite parent, Messages Messages, - final AbstractComponentEditor editor, String label, String tooltip, final EStructuralFeature feature, - int vIndent) { - - final E4StringPickList pickList = new E4StringPickList(parent, SWT.NONE, null, Messages, editor, feature) { - @Override - protected void addPressed() { - handleAddText(editor, feature, getTextWidget()); - } - }; - - pickList.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 2, 1)); - pickList.setText(label); - if (tooltip != null) { - pickList.setToolTipText(tooltip); - } - - final Text t = pickList.getTextWidget(); - t.addKeyListener(new KeyAdapter() { - @Override - public void keyPressed(KeyEvent e) { - if (e.keyCode == SWT.CR || e.keyCode == SWT.LF) { - handleAddText(editor, feature, t); - } - } - }); - - TextPasteHandler.createFor(t); - - final TableViewer viewer = pickList.getList(); - viewer.setLabelProvider(new LabelProvider()); - final GridData gd = (GridData) viewer.getTable().getLayoutData(); - gd.heightHint = 150; - - final IEMFListProperty prop = EMFProperties.list(feature); - viewer.setInput(prop.observeDetail(editor.getMaster())); - - viewer.addSelectionChangedListener(new ISelectionChangedListener() { - - @Override - public void selectionChanged(SelectionChangedEvent event) { - final String strSelected = (String) ((StructuredSelection) event.getSelection()).getFirstElement(); - t.setText(strSelected != null ? strSelected : ""); //$NON-NLS-1$ - } - }); - - // - // final Button btnDelete = new Button(compButton, SWT.PUSH | SWT.FLAT); - // btnDelete.setText(Messages.ModelTooling_Common_Remove); - // btnDelete.setImage(editor.createImage(ResourceProvider.IMG_Obj16_table_delete)); - // btnDelete.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, - // true, false)); - // btnDelete.addSelectionListener(new SelectionAdapter() { - // @Override - // public void widgetSelected(SelectionEvent e) { - // if (!viewer.getSelection().isEmpty()) { - // EObject el = (EObject) editor.getMaster().getValue(); - // List<?> ids = ((IStructuredSelection) - // viewer.getSelection()).toList(); - // Command cmd = RemoveCommand.create(editor.getEditingDomain(), el, - // feature, ids); - // if (cmd.canExecute()) { - // editor.getEditingDomain().getCommandStack().execute(cmd); - // if (ids.size() > 0) { - // viewer.setSelection(new StructuredSelection(ids.get(0))); - // } - // } - // } - // } - // }); - - return pickList; - } - - private static void handleAddText(AbstractComponentEditor editor, EStructuralFeature feature, Text tagText) { - if (tagText.getText().trim().length() > 0) { - final String[] tags = tagText.getText().split(";"); //$NON-NLS-1$ - for (int i = 0; i < tags.length; i++) { - tags[i] = tags[i].trim(); - } - - final MApplicationElement appEl = (MApplicationElement) editor.getMaster().getValue(); - final Command cmd = AddCommand.create(editor.getEditingDomain(), appEl, feature, Arrays.asList(tags)); - if (cmd.canExecute()) { - editor.getEditingDomain().getCommandStack().execute(cmd); - } - tagText.setText(""); //$NON-NLS-1$ - } - } - - // This method is left in for reference purposes - @SuppressWarnings("unused") - private static void handleReplaceText(AbstractComponentEditor editor, EStructuralFeature feature, Text tagText, - TableViewer viewer) { - if (tagText.getText().trim().length() > 0) { - if (!viewer.getSelection().isEmpty()) { - final String[] tags = tagText.getText().split(";"); //$NON-NLS-1$ - for (int i = 0; i < tags.length; i++) { - tags[i] = tags[i].trim(); - } - - final MApplicationElement appEl = (MApplicationElement) editor.getMaster().getValue(); - final EObject el = (EObject) editor.getMaster().getValue(); - final List<?> ids = ((IStructuredSelection) viewer.getSelection()).toList(); - final Object curVal = ((IStructuredSelection) viewer.getSelection()).getFirstElement(); - final EObject container = (EObject) editor.getMaster().getValue(); - final List<?> l = (List<?>) container.eGet(feature); - final int idx = l.indexOf(curVal); - if (idx >= 0) { - final Command cmdRemove = RemoveCommand.create(editor.getEditingDomain(), el, feature, ids); - final Command cmdInsert = AddCommand.create(editor.getEditingDomain(), appEl, feature, - Arrays.asList(tags), idx); - if (cmdRemove.canExecute() && cmdInsert.canExecute()) { - editor.getEditingDomain().getCommandStack().execute(cmdRemove); - editor.getEditingDomain().getCommandStack().execute(cmdInsert); - } - tagText.setText(""); //$NON-NLS-1$ - } - } - } - } - - public static void createCheckBox(Composite parent, String label, IObservableValue master, - EMFDataBindingContext context, IWidgetValueProperty selectionProp, IEMFEditValueProperty modelProp) { - createCheckBox(parent, label, null, master, context, selectionProp, modelProp); - } - - public static void createCheckBox(Composite parent, String label, String tooltip, IObservableValue master, - EMFDataBindingContext context, IWidgetValueProperty selectionProp, IEMFEditValueProperty modelProp) { - final Label l = new Label(parent, SWT.NONE); - l.setText(label); - if (tooltip != null) { - l.setToolTipText(tooltip); - } - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - final Button t = new Button(parent, SWT.CHECK); - t.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 2, 1)); - context.bindValue(selectionProp.observe(t), modelProp.observeDetail(master)); - - } - - public static String getLocalizedLabel(ProjectOSGiTranslationProvider translationProvider, MUILabel element) { - return getLocalizedValue(translationProvider, (MApplicationElement) element, - UiPackageImpl.Literals.UI_LABEL__LABEL, UiPackageImpl.Literals.UI_LABEL__LOCALIZED_LABEL); - } - - public static String getLocalizedValue(ProjectOSGiTranslationProvider translationProvider, - MApplicationElement element, EStructuralFeature feature, EStructuralFeature localizedFeature) { - final EObject eo = (EObject) element; - if (translationProvider == null) { - final String value = (String) eo.eGet(localizedFeature); - if (value != null && value.trim().length() > 0) { - return value; - } - } - - final String value = (String) eo.eGet(feature); - if (value != null && value.trim().length() > 0) { - return tr(translationProvider, value); - } - return null; - - } - - public static String tr(ProjectOSGiTranslationProvider translationProvider, String label) { - if (label.startsWith("%") && translationProvider != null) { //$NON-NLS-1$ - final String key = label.substring(1); - final String translation = translationProvider.translate(key); - return translation == key ? label : translation; - } - return label; - } - - public static void attachFiltering(Text searchText, final TableViewer viewer, final PatternFilter filter) { - searchText.addModifyListener(new ModifyListener() { - @Override - public void modifyText(ModifyEvent e) { - filter.setPattern(((Text) e.widget).getText()); - viewer.refresh(); - if (viewer.getTable().getItemCount() > 0) { - final Object data = viewer.getTable().getItem(0).getData(); - viewer.setSelection(new StructuredSelection(data)); - } - } - }); - searchText.addTraverseListener(new TraverseListener() { - - @Override - public void keyTraversed(TraverseEvent e) { - if (e.keyCode == SWT.ARROW_DOWN && viewer.getTable().getItemCount() > 0) { - viewer.getControl().setFocus(); - } - } - }); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CoreExpressionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CoreExpressionEditor.java deleted file mode 100644 index 0c81147f..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CoreExpressionEditor.java +++ /dev/null @@ -1,156 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import javax.inject.Inject; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ExpressionIdDialog; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.MCoreExpression; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class CoreExpressionEditor extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - - @Inject - public CoreExpressionEditor() { - super(); - } - - @Override - public Image getImage(Object element, Display display) { - return createImage(ResourceProvider.IMG_CoreExpression); - } - - @Override - public String getLabel(Object element) { - return Messages.CoreExpressionEditor_TreeLabel; - } - - @Override - public String getDetailLabel(Object element) { - if (((MCoreExpression) element).getCoreExpressionId() != null - && ((MCoreExpression) element).getCoreExpressionId().trim().length() > 0) { - return ((MCoreExpression) element).getCoreExpressionId(); - } - return null; - } - - @Override - public String getDescription(Object element) { - return Messages.CoreExpressionEditor_TreeLabelDescription; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - composite = new Composite(parent, SWT.NONE); - composite.setLayout(new FillLayout()); - createForm(composite, context, getMaster()); - } - getMaster().setValue(object); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { - final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { - ControlFactory.createXMIId(parent, this); - } - - final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - { - final Label l = new Label(parent, SWT.NONE); - l.setText(Messages.CoreExpressionEditor_ExpressionId); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - final Text t = new Text(parent, SWT.BORDER); - TextPasteHandler.createFor(t); - final GridData gd = new GridData(GridData.FILL_HORIZONTAL); - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.CORE_EXPRESSION__CORE_EXPRESSION_ID) - .observeDetail(getMaster())); - - if (getEditor().getExtensionLookup() == null) { - gd.horizontalSpan = 2; - } else { - final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelTooling_Common_FindEllipsis); - b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - final ExpressionIdDialog dialog = new ExpressionIdDialog(t.getShell(), getEditor() - .getExtensionLookup(), (MCoreExpression) getMaster().getValue(), getEditingDomain(), - getEditor().isLiveModel(), Messages); - dialog.open(); - } - }); - } - } - - item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabSupplementary); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); - - createContributedEditorTabs(folder, context, getMaster(), MCoreExpression.class); - - folder.setSelection(0); - - return folder; - } - - @Override - public IObservableList getChildList(Object element) { - return null; - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DefaultEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DefaultEditor.java deleted file mode 100644 index 78485075..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DefaultEditor.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; - -public class DefaultEditor extends AbstractComponentEditor { - - @Override - public Image getImage(Object element, Display display) { - // no image - return null; - } - - @Override - public String getLabel(Object element) { - return element.getClass().getInterfaces()[0].getSimpleName() + " " + Messages.Special_UnknownElement; //$NON-NLS-1$ - } - - @Override - public String getDetailLabel(Object element) { - return Messages.Special_UnknownElement_Detail; - } - - @Override - public String getDescription(Object element) { - return null; - } - - @Override - protected Composite doGetEditor(Composite parent, Object object) { - return new Composite(parent, SWT.NONE); - } - - @Override - public IObservableList getChildList(Object element) { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DialogEditor.java deleted file mode 100644 index 5985a49a..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DialogEditor.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.ui.model.application.ui.MUIElement; -import org.eclipse.e4.ui.model.application.ui.basic.MDialog; -import org.eclipse.jface.action.Action; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Display; - -public class DialogEditor extends WindowEditor { - - @Override - public Image getImage(Object element, Display display) { - if (element instanceof MUIElement) { - final MUIElement uiElement = (MUIElement) element; - if (uiElement.isToBeRendered() && uiElement.isVisible()) { - return createImage(ResourceProvider.IMG_Dialog); - } - return createImage(ResourceProvider.IMG_Tbr_Dialog); - } - - return null; - } - - @Override - public String getLabel(Object element) { - return Messages.DialogEditor_Label; - } - - @Override - public List<Action> getActions(Object element) { - final List<Action> actions = new ArrayList<Action>(); - - final MDialog dialog = (MDialog) element; - if (dialog.getMainMenu() == null) { - actions.add(getActionAddMainMenu()); - } - - return actions; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java deleted file mode 100644 index 4298b057..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java +++ /dev/null @@ -1,208 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Steven Spungin <steven@spungin.tv> - Bug 424730 - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import javax.inject.Inject; - -import org.eclipse.core.databinding.Binding; -import org.eclipse.core.databinding.UpdateValueStrategy; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.list.WritableList; -import org.eclipse.core.databinding.observable.value.IValueChangeListener; -import org.eclipse.core.databinding.observable.value.ValueChangeEvent; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.tools.emf.ui.common.ContributionURIValidator; -import org.eclipse.e4.tools.emf.ui.common.IContributionClassCreator; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; -import org.eclipse.e4.tools.emf.ui.internal.common.objectdata.ObjectViewer; -import org.eclipse.e4.ui.model.application.MContribution; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.MUIElement; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.MDirectMenuItem; -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.IEMFValueProperty; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Link; -import org.eclipse.swt.widgets.Text; - -public class DirectMenuItemEditor extends MenuItemEditor { - private final IEMFValueProperty UI_ELEMENT__VISIBLE_WHEN = EMFProperties - .value(UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN); - - @Inject - IEclipseContext eclipseContext; - - @Inject - public DirectMenuItemEditor() { - super(); - } - - @Override - public Image getImage(Object element, Display display) { - if (element instanceof MUIElement) { - final MUIElement uiElement = (MUIElement) element; - if (uiElement.isToBeRendered() && uiElement.isVisible()) { - return createImage(ResourceProvider.IMG_DirectMenuItem); - } - return createImage(ResourceProvider.IMG_Tbr_DirectMenuItem); - } - - return null; - } - - @Override - protected CTabFolder createForm(Composite parent, EMFDataBindingContext context, WritableValue master, - boolean isImport) { - if (!isImport) { - final CTabFolder folder = super.createForm(parent, context, master, isImport); - createInstanceInspection(folder); - return folder; - } - return super.createForm(parent, context, master, isImport); - } - - private void createInstanceInspection(CTabFolder folder) { - final CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_RuntimeContributionInstance); - final Composite container = new Composite(folder, SWT.NONE); - container.setLayout(new GridLayout()); - item.setControl(container); - - final ObjectViewer objectViewer = new ObjectViewer(); - final TreeViewer viewer = objectViewer.createViewer(container, - ApplicationPackageImpl.Literals.CONTRIBUTION__OBJECT, getMaster(), resourcePool, Messages); - viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); - - } - - @Override - public String getLabel(Object element) { - return Messages.DirectMenuItemEditor_Label; - } - - @Override - public String getDescription(Object element) { - return Messages.DirectMenuItemEditor_Description; - } - - @Override - protected void createFormSubTypeForm(Composite parent, EMFDataBindingContext context, WritableValue master) { - final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - // ------------------------------------------------------------ - final Link lnk; - { - final IContributionClassCreator c = getEditor().getContributionCreator( - MenuPackageImpl.Literals.DIRECT_MENU_ITEM); - if (project != null && c != null) { - lnk = new Link(parent, SWT.NONE); - lnk.setText("<A>" + Messages.DirectMenuItemEditor_ClassURI + "</A>"); //$NON-NLS-1$//$NON-NLS-2$ - lnk.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - lnk.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - c.createOpen((MContribution) getMaster().getValue(), getEditingDomain(), project, - lnk.getShell()); - } - }); - } else { - lnk = null; - final Label l = new Label(parent, SWT.NONE); - l.setText(Messages.DirectMenuItemEditor_ClassURI); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - } - - final Text t = new Text(parent, SWT.BORDER); - TextPasteHandler.createFor(t); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - t.addModifyListener(new ModifyListener() { - - @Override - public void modifyText(ModifyEvent e) { - if (lnk != null) { - lnk.setToolTipText(((Text) e.getSource()).getText()); - } - } - }); - final Binding binding = context.bindValue( - textProp.observeDelayed(200, t), - EMFEditProperties.value(getEditingDomain(), - ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(master), - new UpdateValueStrategy().setAfterConvertValidator(new ContributionURIValidator()), - new UpdateValueStrategy()); - Util.addDecoration(t, binding); - - final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); - b.setText(Messages.ModelTooling_Common_FindEllipsis); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - final ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(), eclipseContext, - getEditingDomain(), (MContribution) getMaster().getValue(), - ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI, Messages); - dialog.open(); - } - }); - } - } - - @Override - public IObservableList getChildList(Object element) { - final WritableList list = new WritableList(); - - if (((MDirectMenuItem) element).getVisibleWhen() != null) { - list.add(0, ((MDirectMenuItem) element).getVisibleWhen()); - } - - UI_ELEMENT__VISIBLE_WHEN.observe(element).addValueChangeListener(new IValueChangeListener() { - - @Override - public void handleValueChange(ValueChangeEvent event) { - if (event.diff.getOldValue() != null) { - list.remove(event.diff.getOldValue()); - } - - if (event.diff.getNewValue() != null) { - list.add(0, event.diff.getNewValue()); - } - } - }); - - return list; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java deleted file mode 100644 index ffe3a7eb..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java +++ /dev/null @@ -1,202 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Steven Spungin <steven@spungin.tv> - Bug 424730 - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import javax.inject.Inject; - -import org.eclipse.core.databinding.Binding; -import org.eclipse.core.databinding.UpdateValueStrategy; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.IValueChangeListener; -import org.eclipse.core.databinding.observable.value.ValueChangeEvent; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.tools.emf.ui.common.ContributionURIValidator; -import org.eclipse.e4.tools.emf.ui.common.IContributionClassCreator; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; -import org.eclipse.e4.tools.emf.ui.internal.common.objectdata.ObjectViewer; -import org.eclipse.e4.ui.model.application.MContribution; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.MUIElement; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.MDirectToolItem; -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.IEMFValueProperty; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Link; -import org.eclipse.swt.widgets.Text; - -public class DirectToolItemEditor extends ToolItemEditor { - private final IEMFValueProperty UI_ELEMENT__VISIBLE_WHEN = EMFProperties - .value(UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN); - - @Inject - IEclipseContext eclipseContext; - - @Inject - public DirectToolItemEditor() { - super(); - } - - @Override - public Image getImage(Object element, Display display) { - if (element instanceof MUIElement) { - final MUIElement uiElement = (MUIElement) element; - if (uiElement.isToBeRendered() && uiElement.isVisible()) { - return createImage(ResourceProvider.IMG_DirectToolItem); - } - return createImage(ResourceProvider.IMG_Tbr_DirectToolItem); - } - - return null; - } - - @Override - protected void createSubTypeFormElements(Composite parent, EMFDataBindingContext context, WritableValue master) { - final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - final IContributionClassCreator c = getEditor().getContributionCreator( - MenuPackageImpl.Literals.DIRECT_TOOL_ITEM); - final Link lnk; - if (project != null && c != null) { - lnk = new Link(parent, SWT.NONE); - lnk.setText("<A>" + Messages.DirectMenuItemEditor_ClassURI + "</A>"); //$NON-NLS-1$//$NON-NLS-2$ - lnk.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - lnk.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - c.createOpen((MContribution) getMaster().getValue(), getEditingDomain(), project, lnk.getShell()); - } - }); - } else { - lnk = null; - final Label l = new Label(parent, SWT.NONE); - l.setText(Messages.DirectToolItemEditor_ClassURI); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - } - - final Text t = new Text(parent, SWT.BORDER); - TextPasteHandler.createFor(t); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - t.addModifyListener(new ModifyListener() { - - @Override - public void modifyText(ModifyEvent e) { - if (lnk != null) { - lnk.setToolTipText(((Text) e.getSource()).getText()); - } - } - }); - final Binding binding = context.bindValue(textProp.observeDelayed(200, t), - EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI) - .observeDetail(master), new UpdateValueStrategy() - .setAfterConvertValidator(new ContributionURIValidator()), new UpdateValueStrategy()); - Util.addDecoration(t, binding); - - final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelTooling_Common_FindEllipsis); - b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - final ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(), eclipseContext, - getEditingDomain(), (MContribution) getMaster().getValue(), - ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI, Messages); - dialog.open(); - } - }); - } - - @Override - protected CTabFolder createForm(Composite parent, EMFDataBindingContext context, WritableValue master, - boolean isImport) { - if (!isImport) { - final CTabFolder folder = super.createForm(parent, context, master, isImport); - createInstanceInspection(folder); - return folder; - } - return super.createForm(parent, context, master, isImport); - } - - private void createInstanceInspection(CTabFolder folder) { - final CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_RuntimeContributionInstance); - final Composite container = new Composite(folder, SWT.NONE); - container.setLayout(new GridLayout()); - item.setControl(container); - - final ObjectViewer objectViewer = new ObjectViewer(); - final TreeViewer viewer = objectViewer.createViewer(container, - ApplicationPackageImpl.Literals.CONTRIBUTION__OBJECT, getMaster(), resourcePool, Messages); - viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); - - } - - @Override - public String getLabel(Object element) { - return Messages.DirectToolItemEditor_Label; - } - - @Override - public String getDescription(Object element) { - return Messages.DirectToolItemEditor_Description; - } - - @SuppressWarnings("unchecked") - @Override - public IObservableList getChildList(Object element) { - final IObservableList list = super.getChildList(element); - - if (((MDirectToolItem) element).getVisibleWhen() != null) { - list.add(0, ((MDirectToolItem) element).getVisibleWhen()); - } - - UI_ELEMENT__VISIBLE_WHEN.observe(element).addValueChangeListener(new IValueChangeListener() { - - @Override - public void handleValueChange(ValueChangeEvent event) { - if (event.diff.getOldValue() != null) { - list.remove(event.diff.getOldValue()); - } - - if (event.diff.getNewValue() != null) { - list.add(0, event.diff.getNewValue()); - } - } - }); - - return list; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DynamicMenuContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DynamicMenuContributionEditor.java deleted file mode 100644 index 216c817d..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DynamicMenuContributionEditor.java +++ /dev/null @@ -1,238 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013, 2014 MEDEVIT, FHV and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Marco Descher <marco@descher.at> - initial API and implementation - * Lars Vogel <Lars.Vogel@gmail.com> - Ongoing maintenance - * Steven Spungin <steven@spungin.tv> - Bug 424730 - *******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import javax.inject.Inject; - -import org.eclipse.core.databinding.Binding; -import org.eclipse.core.databinding.UpdateValueStrategy; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.core.di.annotations.Optional; -import org.eclipse.e4.tools.emf.ui.common.ContributionURIValidator; -import org.eclipse.e4.tools.emf.ui.common.IContributionClassCreator; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; -import org.eclipse.e4.ui.model.application.MContribution; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.MUIElement; -import org.eclipse.e4.ui.model.application.ui.MUILabel; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.MDynamicMenuContribution; -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Link; -import org.eclipse.swt.widgets.Text; - -public class DynamicMenuContributionEditor extends AbstractComponentEditor { - - private Composite composite; - private EMFDataBindingContext context; - - private StackLayout stackLayout; - - @Inject - @Optional - private IProject project; - - @Inject - IEclipseContext eclipseContext; - - public DynamicMenuContributionEditor() { - super(); - } - - @Override - public String getLabel(Object element) { - return Messages.DynamicMenuContributionEditor_Label; - } - - @Override - public String getDescription(Object element) { - return Messages.DynamicMenuContributionEditor_Description; - } - - @Override - public Image getImage(Object element, Display display) { - if (element instanceof MUIElement) { - if (((MUIElement) element).isToBeRendered()) { - return createImage(ResourceProvider.IMG_DynamicMenuContribution); - } - return createImage(ResourceProvider.IMG_Tbr_DynamicMenuContribution); - } - - return null; - } - - @Override - public String getDetailLabel(Object element) { - return getLocalizedLabel((MUILabel) element); - } - - @Override - protected Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - getMaster().setValue(object); - return composite; - } - - private Composite createForm(Composite parent, final EMFDataBindingContext context, WritableValue master, - boolean isImport) { - final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - final CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { - ControlFactory.createXMIId(parent, this); - } - - final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (isImport) { - ControlFactory.createFindImport(parent, Messages, this, context); - folder.setSelection(0); - return folder; - } - - ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, - EMFEditProperties - .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); - ControlFactory.createTranslatedTextField(parent, Messages.DynamicMenuContributionEditor_LabelLabel, - getMaster(), context, textProp, - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL), resourcePool, project); - - // ------------------------------------------------------------ - final Link lnk; - { - final IContributionClassCreator c = getEditor().getContributionCreator( - MenuPackageImpl.Literals.DYNAMIC_MENU_CONTRIBUTION); - if (project != null && c != null) { - lnk = new Link(parent, SWT.NONE); - lnk.setText("<A>" + Messages.DynamicMenuContributionEditor_ClassURI + "</A>"); //$NON-NLS-1$//$NON-NLS-2$ - lnk.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - lnk.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - c.createOpen((MContribution) getMaster().getValue(), getEditingDomain(), project, - lnk.getShell()); - } - }); - } else { - lnk = null; - final Label l = new Label(parent, SWT.NONE); - l.setText(Messages.DynamicMenuContributionEditor_ClassURI); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - } - - final Text t = new Text(parent, SWT.BORDER); - TextPasteHandler.createFor(t); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - t.addModifyListener(new ModifyListener() { - - @Override - public void modifyText(ModifyEvent e) { - if (lnk != null) { - lnk.setToolTipText(((Text) e.getSource()).getText()); - } - } - }); - final Binding binding = context.bindValue( - textProp.observeDelayed(200, t), - EMFEditProperties.value(getEditingDomain(), - ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(getMaster()), - new UpdateValueStrategy().setAfterConvertValidator(new ContributionURIValidator()), - new UpdateValueStrategy()); - Util.addDecoration(t, binding); - - final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); - b.setText(Messages.ModelTooling_Common_FindEllipsis); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - final ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(), eclipseContext, - getEditingDomain(), (MContribution) getMaster().getValue(), - ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI, Messages); - dialog.open(); - } - }); - } - - createContributedEditorTabs(folder, context, getMaster(), MDynamicMenuContribution.class); - - folder.setSelection(0); - - return folder; - } - - @Override - public IObservableList getChildList(Object element) { - return null; - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java deleted file mode 100644 index c60364c1..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java +++ /dev/null @@ -1,156 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import javax.inject.Inject; - -import org.eclipse.core.databinding.UpdateValueStrategy; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.list.WritableList; -import org.eclipse.core.databinding.observable.value.IValueChangeListener; -import org.eclipse.core.databinding.observable.value.ValueChangeEvent; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.e4.tools.emf.ui.common.CommandToStringConverter; -import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.HandledMenuItemCommandSelectionDialog; -import org.eclipse.e4.ui.model.application.commands.MParameter; -import org.eclipse.e4.ui.model.application.ui.MUIElement; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem; -import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem; -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.IEMFValueProperty; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditListProperty; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class HandledMenuItemEditor extends MenuItemEditor { - - private final IEMFEditListProperty HANDLED_ITEM__PARAMETERS = EMFEditProperties.list(getEditingDomain(), - MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS); - private final IEMFValueProperty UI_ELEMENT__VISIBLE_WHEN = EMFProperties - .value(UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN); - - @Inject - private IModelResource resource; - - @Inject - public HandledMenuItemEditor() { - super(); - } - - @Override - public Image getImage(Object element, Display display) { - if (element instanceof MUIElement) { - final MUIElement uiElement = (MUIElement) element; - if (uiElement.isToBeRendered() && uiElement.isVisible()) { - return createImage(ResourceProvider.IMG_HandledMenuItem); - } - return createImage(ResourceProvider.IMG_Tbr_HandledMenuItem); - } - - return null; - } - - @Override - public String getLabel(Object element) { - return Messages.HandledMenuItemEditor_Label; - } - - @Override - public String getDescription(Object element) { - return Messages.HandledMenuItemEditor_Description; - } - - @Override - protected void createFormSubTypeForm(Composite parent, EMFDataBindingContext context, final WritableValue master) { - final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - // ------------------------------------------------------------ - { - final Label l = new Label(parent, SWT.NONE); - l.setText(Messages.HandledMenuItemEditor_Command); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - final Text t = new Text(parent, SWT.BORDER); - TextPasteHandler.createFor(t); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - t.setEditable(false); - context.bindValue(textProp.observeDelayed(200, t), - EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.HANDLED_ITEM__COMMAND) - .observeDetail(master), new UpdateValueStrategy(), new UpdateValueStrategy() - .setConverter(new CommandToStringConverter(Messages))); - - final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelTooling_Common_FindEllipsis); - b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - final HandledMenuItemCommandSelectionDialog dialog = new HandledMenuItemCommandSelectionDialog(b - .getShell(), (MHandledItem) getMaster().getValue(), resource, Messages); - dialog.open(); - } - }); - } - } - - @Override - public IObservableList getChildList(Object element) { - final WritableList list = new WritableList(); - - if (((MHandledMenuItem) element).getVisibleWhen() != null) { - list.add(0, ((MHandledMenuItem) element).getVisibleWhen()); - } - - UI_ELEMENT__VISIBLE_WHEN.observe(element).addValueChangeListener(new IValueChangeListener() { - - @Override - public void handleValueChange(ValueChangeEvent event) { - if (event.diff.getOldValue() != null) { - list.remove(event.diff.getOldValue()); - } - - if (event.diff.getNewValue() != null) { - list.add(0, event.diff.getNewValue()); - } - } - }); - - list.add(new VirtualEntry<MParameter>(ModelEditor.VIRTUAL_PARAMETERS, HANDLED_ITEM__PARAMETERS, element, - Messages.HandledMenuItemEditor_Parameters) { - @Override - protected boolean accepted(MParameter o) { - return true; - } - }); - - return list; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java deleted file mode 100644 index 0110964f..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java +++ /dev/null @@ -1,156 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import javax.inject.Inject; - -import org.eclipse.core.databinding.UpdateValueStrategy; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.IValueChangeListener; -import org.eclipse.core.databinding.observable.value.ValueChangeEvent; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.e4.tools.emf.ui.common.CommandToStringConverter; -import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.HandledToolItemCommandSelectionDialog; -import org.eclipse.e4.ui.model.application.commands.MParameter; -import org.eclipse.e4.ui.model.application.ui.MUIElement; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem; -import org.eclipse.e4.ui.model.application.ui.menu.MHandledToolItem; -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.IEMFValueProperty; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditListProperty; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class HandledToolItemEditor extends ToolItemEditor { - - private final IEMFEditListProperty HANDLED_ITEM__PARAMETERS = EMFEditProperties.list(getEditingDomain(), - MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS); - private final IEMFValueProperty UI_ELEMENT__VISIBLE_WHEN = EMFProperties - .value(UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN); - - @Inject - private IModelResource resource; - - @Inject - public HandledToolItemEditor() { - super(); - } - - @Override - public Image getImage(Object element, Display display) { - if (element instanceof MUIElement) { - final MUIElement uiElement = (MUIElement) element; - if (uiElement.isToBeRendered() && uiElement.isVisible()) { - return createImage(ResourceProvider.IMG_HandledToolItem); - } - return createImage(ResourceProvider.IMG_Tbr_HandledToolItem); - } - - return null; - } - - @Override - protected void createSubTypeFormElements(Composite parent, EMFDataBindingContext context, final WritableValue master) { - final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - { - final Label l = new Label(parent, SWT.NONE); - l.setText(Messages.HandledToolItemEditor_Command); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - final Text t = new Text(parent, SWT.BORDER); - TextPasteHandler.createFor(t); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - t.setEditable(false); - context.bindValue(textProp.observeDelayed(200, t), - EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.HANDLED_ITEM__COMMAND) - .observeDetail(master), new UpdateValueStrategy(), new UpdateValueStrategy() - .setConverter(new CommandToStringConverter(Messages))); - - final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelTooling_Common_FindEllipsis); - b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - final HandledToolItemCommandSelectionDialog dialog = new HandledToolItemCommandSelectionDialog(b - .getShell(), (MHandledItem) getMaster().getValue(), resource, Messages); - dialog.open(); - } - }); - } - } - - @Override - public String getLabel(Object element) { - return Messages.HandledToolItemEditor_Label; - } - - @Override - public String getDescription(Object element) { - return Messages.HandledToolItemEditor_Description; - } - - @SuppressWarnings("unchecked") - @Override - public IObservableList getChildList(Object element) { - final IObservableList list = super.getChildList(element); - - if (((MHandledToolItem) element).getVisibleWhen() != null) { - list.add(0, ((MHandledToolItem) element).getVisibleWhen()); - } - - UI_ELEMENT__VISIBLE_WHEN.observe(element).addValueChangeListener(new IValueChangeListener() { - - @Override - public void handleValueChange(ValueChangeEvent event) { - if (event.diff.getOldValue() != null) { - list.remove(event.diff.getOldValue()); - } - - if (event.diff.getNewValue() != null) { - list.add(0, event.diff.getNewValue()); - } - } - }); - - list.add(new VirtualEntry<MParameter>(ModelEditor.VIRTUAL_PARAMETERS, HANDLED_ITEM__PARAMETERS, element, - Messages.HandledToolItemEditor_Parameters) { - @Override - protected boolean accepted(MParameter o) { - return true; - } - }); - - return list; - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java deleted file mode 100644 index 02482734..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java +++ /dev/null @@ -1,280 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2014 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Lars Vogel <Lars.Vogel@gmail.com> - Ongoing maintenance - * Steven Spungin <steven@spungin.tv> - Bug 424730 - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import javax.inject.Inject; -import org.eclipse.core.databinding.Binding; -import org.eclipse.core.databinding.UpdateValueStrategy; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.IObservableValue; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.core.di.annotations.Optional; -import org.eclipse.e4.tools.emf.ui.common.CommandToStringConverter; -import org.eclipse.e4.tools.emf.ui.common.ContributionURIValidator; -import org.eclipse.e4.tools.emf.ui.common.IContributionClassCreator; -import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.HandlerCommandSelectionDialog; -import org.eclipse.e4.tools.emf.ui.internal.common.objectdata.ObjectViewer; -import org.eclipse.e4.ui.model.application.MContribution; -import org.eclipse.e4.ui.model.application.commands.MHandler; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Link; -import org.eclipse.swt.widgets.Text; - -public class HandlerEditor extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - private StackLayout stackLayout; - - @Inject - private IModelResource resource; - - @Inject - @Optional - private IProject project; - - @Inject - IEclipseContext eclipseContext; - - @Inject - public HandlerEditor() { - super(); - } - - @Override - public Image getImage(Object element, Display display) { - return createImage(ResourceProvider.IMG_Handler); - } - - @Override - public String getLabel(Object element) { - return Messages.HandlerEditor_Label; - } - - @Override - public String getDescription(Object element) { - return Messages.HandlerEditor_Description; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - getMaster().setValue(object); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, IObservableValue master, boolean isImport) { - CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { - ControlFactory.createXMIId(parent, this); - } - - if (isImport) { - ControlFactory.createFindImport(parent, Messages, this, context); - folder.setSelection(0); - return folder; - } - - ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.HandlerEditor_Command); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - TextPasteHandler.createFor(t); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - t.setEditable(false); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.HANDLER__COMMAND).observeDetail(getMaster()), new UpdateValueStrategy(), new UpdateValueStrategy().setConverter(new CommandToStringConverter(Messages))); - - final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelTooling_Common_FindEllipsis); - b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - HandlerCommandSelectionDialog dialog = new HandlerCommandSelectionDialog(b.getShell(), (MHandler) getMaster().getValue(), resource, Messages); - dialog.open(); - } - }); - } - - // ------------------------------------------------------------ - final Link lnk; - { - final IContributionClassCreator c = getEditor().getContributionCreator(CommandsPackageImpl.Literals.HANDLER); - if (project != null && c != null) { - lnk = new Link(parent, SWT.NONE); - lnk.setText("<A>" + Messages.HandlerEditor_ClassURI + "</A>"); //$NON-NLS-1$//$NON-NLS-2$ - lnk.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - lnk.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - c.createOpen((MContribution) getMaster().getValue(), getEditingDomain(), project, lnk.getShell()); - } - }); - } else { - lnk = null; - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.HandlerEditor_ClassURI); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - } - - Text t = new Text(parent, SWT.BORDER); - TextPasteHandler.createFor(t); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - t.addModifyListener(new ModifyListener() { - - @Override - public void modifyText(ModifyEvent e) { - if (lnk != null) { - lnk.setToolTipText(((Text) (e.getSource())).getText()); - } - } - }); - Binding binding = context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(getMaster()), new UpdateValueStrategy().setAfterConvertValidator(new ContributionURIValidator()), new UpdateValueStrategy()); - Util.addDecoration(t, binding); - - final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); - b.setText(Messages.ModelTooling_Common_FindEllipsis); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(), eclipseContext, getEditingDomain(), (MContribution) getMaster().getValue(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI, Messages); - dialog.open(); - } - }); - } - ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); - - item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabSupplementary); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); - - createInstanceInspection(folder); - - createContributedEditorTabs(folder, context, getMaster(), MHandler.class); - - folder.setSelection(0); - - return folder; - } - - private void createInstanceInspection(CTabFolder folder) { - CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_RuntimeContributionInstance); - Composite container = new Composite(folder, SWT.NONE); - container.setLayout(new GridLayout()); - item.setControl(container); - - ObjectViewer objectViewer = new ObjectViewer(); - TreeViewer viewer = objectViewer.createViewer(container, ApplicationPackageImpl.Literals.CONTRIBUTION__OBJECT, getMaster(), resourcePool, Messages); - viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); - - } - - @Override - public IObservableList getChildList(Object element) { - return null; - } - - @Override - public String getDetailLabel(Object element) { - MHandler handler = (MHandler) element; - if (handler.getCommand() != null && handler.getCommand().getCommandName() != null && handler.getCommand().getCommandName().trim().length() > 0) { - return handler.getCommand().getCommandName(); - } - - return null; - } - - @Override - public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { FeaturePath.fromList(CommandsPackageImpl.Literals.HANDLER__COMMAND, CommandsPackageImpl.Literals.COMMAND__COMMAND_NAME) }; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java deleted file mode 100644 index 79c3ec80..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java +++ /dev/null @@ -1,311 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2014 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Lars Vogel <Lars.Vogel@gmail.com> - Ongoing maintenance - * Steven Spungin <steven@spungin.tv> - Ongoing maintenance - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import org.eclipse.e4.tools.emf.ui.common.Plugin; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import javax.annotation.PostConstruct; -import javax.inject.Inject; -import org.eclipse.core.databinding.Binding; -import org.eclipse.core.databinding.UpdateValueStrategy; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.IObservableValue; -import org.eclipse.core.databinding.validation.IValidator; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.e4.tools.emf.ui.common.CommandToStringConverter; -import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.AbstractPickList.PickListFeatures; -import org.eclipse.e4.tools.emf.ui.internal.common.E4PickList; -import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.KeyBindingCommandSelectionDialog; -import org.eclipse.e4.ui.model.application.commands.MCommand; -import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; -import org.eclipse.e4.ui.model.application.commands.MKeyBinding; -import org.eclipse.e4.ui.model.application.commands.MKeySequence; -import org.eclipse.e4.ui.model.application.commands.MParameter; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditListProperty; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.bindings.keys.KeySequence; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class KeyBindingEditor extends AbstractComponentEditor { - - private Composite composite; - private EMFDataBindingContext context; - private StackLayout stackLayout; - private List<Action> actions = new ArrayList<Action>(); - - private IEMFEditListProperty KEY_BINDING__PARAMETERS = EMFEditProperties.list(getEditingDomain(), CommandsPackageImpl.Literals.KEY_BINDING__PARAMETERS); - - @Inject - private IModelResource resource; - - @Inject - public KeyBindingEditor() { - super(); - } - - @PostConstruct - void init() { - actions.add(new Action(Messages.KeyBindingEditor_AddParameter, createImageDescriptor(ResourceProvider.IMG_Parameter)) { - @Override - public void run() { - handleAddParameter(); - } - }); - } - - @Override - public Image getImage(Object element, Display display) { - return createImage(ResourceProvider.IMG_KeyBinding); - } - - @Override - public String getLabel(Object element) { - return Messages.KeyBindingEditor_Label; - } - - @Override - public String getDescription(Object element) { - return Messages.KeyBindingEditor_Description; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - getMaster().setValue(object); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, IObservableValue master, boolean isImport) { - CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { - ControlFactory.createXMIId(parent, this); - } - - IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (isImport) { - ControlFactory.createFindImport(parent, Messages, this, context); - folder.setSelection(0); - return folder; - } - - ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.KeyBindingEditor_Sequence); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - final Text t = new Text(parent, SWT.BORDER); - TextPasteHandler.createFor(t); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - Binding binding = context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.KEY_SEQUENCE__KEY_SEQUENCE).observeDetail(getMaster()), new UpdateValueStrategy().setBeforeSetValidator(new BindingValidator()), new UpdateValueStrategy()); - Util.addDecoration(t, binding); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.KeyBindingEditor_Command); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - TextPasteHandler.createFor(t); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - t.setEditable(false); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.KEY_BINDING__COMMAND).observeDetail(getMaster()), new UpdateValueStrategy(), new UpdateValueStrategy().setConverter(new CommandToStringConverter(Messages))); - - final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelTooling_Common_FindEllipsis); - b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - KeyBindingCommandSelectionDialog dialog = new KeyBindingCommandSelectionDialog(b.getShell(), (MKeyBinding) getMaster().getValue(), resource, Messages); - dialog.open(); - } - }); - } - - { - E4PickList pickList = new E4PickList(parent, SWT.NONE, Arrays.asList(PickListFeatures.NO_PICKER), Messages, this, CommandsPackageImpl.Literals.KEY_BINDING__PARAMETERS) { - @Override - protected void addPressed() { - handleAddParameter(); - } - - @Override - protected List<?> getContainerChildren(Object master) { - return ((MCommand) master).getParameters(); - } - }; - pickList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1)); - pickList.setText(Messages.KeyBindingEditor_Parameters); - - final TableViewer viewer = pickList.getList(); - - viewer.setInput(KEY_BINDING__PARAMETERS.observeDetail(getMaster())); - } - // - - item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabSupplementary); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); - - createContributedEditorTabs(folder, context, getMaster(), MKeyBinding.class); - - folder.setSelection(0); - - return folder; - } - - @Override - public IObservableList getChildList(Object element) { - return KEY_BINDING__PARAMETERS.observe(element); - } - - @Override - public String getDetailLabel(Object element) { - MKeySequence seq = (MKeySequence) element; - if (seq.getKeySequence() != null && seq.getKeySequence().trim().length() > 0) { - return seq.getKeySequence(); - } - return null; - } - - @Override - public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { FeaturePath.fromList(CommandsPackageImpl.Literals.KEY_SEQUENCE__KEY_SEQUENCE) }; - } - - class BindingValidator implements IValidator { - - @Override - public IStatus validate(Object value) { - int statusCode = getEditor().isLiveModel() ? IStatus.ERROR : IStatus.WARNING; - if (value != null && value.toString().trim().length() > 0) { - try { - KeySequence keySequence = KeySequence.getInstance(value.toString()); - if (!keySequence.isComplete()) { - return new Status(statusCode, Plugin.ID, Messages.KeyBindingEditor_SequenceNotComplete); - } - if (keySequence.isEmpty()) { - return new Status(statusCode, Plugin.ID, Messages.KeyBindingEditor_SequenceEmpty); - } - if (!value.toString().toUpperCase().equals(value.toString())) { - return new Status(IStatus.ERROR, Plugin.ID, Messages.KeyBindingEditor_SequenceLowercase); - } - - return Status.OK_STATUS; - } catch (Exception e) { - return new Status(statusCode, Plugin.ID, e.getMessage(), e); - } - } - - return new Status(statusCode, Plugin.ID, Messages.KeyBindingEditor_SequenceEmpty); - } - } - - protected void handleAddParameter() { - MKeyBinding item = (MKeyBinding) getMaster().getValue(); - MParameter param = MCommandsFactory.INSTANCE.createParameter(); - setElementId(param); - - Command cmd = AddCommand.create(getEditingDomain(), item, CommandsPackageImpl.Literals.KEY_BINDING__PARAMETERS, param); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - - @Override - public List<Action> getActions(Object element) { - ArrayList<Action> l = new ArrayList<Action>(super.getActions(element)); - l.addAll(actions); - return l; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java deleted file mode 100644 index 2f16ac52..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java +++ /dev/null @@ -1,351 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2014 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Marco Descher <marco@descher.at> - Bug 397650, Bug 395982, Bug 396975 - * Lars Vogel <Lars.Vogel@gmail.com> - Ongoing maintenance - * Nicolaj Hoess <nicohoess@gmail.com> - Bug 396975 - * Steven Spungin <steven@spungin.tv> - Ongoing maintenance - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.util.ArrayList; -import java.util.List; - -import javax.annotation.PostConstruct; -import javax.inject.Inject; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.E4PickList; -import org.eclipse.e4.tools.emf.ui.internal.common.E4PickList.Struct; -import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.MenuIdDialog; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.MUIElement; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.MMenuContribution; -import org.eclipse.e4.ui.model.application.ui.menu.MMenuElement; -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.e4.ui.workbench.modeling.EModelService; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.IEMFListProperty; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class MenuContributionEditor extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - - private final IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties - .list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - private StackLayout stackLayout; - private final List<Action> actions = new ArrayList<Action>(); - - @Inject - private IModelResource resource; - - @Inject - private EModelService modelService; - - @Inject - public MenuContributionEditor() { - super(); - } - - @PostConstruct - void init() { - actions.add(new Action(Messages.MenuEditor_AddHandledMenuItem, - createImageDescriptor(ResourceProvider.IMG_HandledMenuItem)) { - @Override - public void run() { - handleAdd(MenuPackageImpl.Literals.HANDLED_MENU_ITEM, false); - } - }); - actions.add(new Action(Messages.MenuEditor_AddMenu, createImageDescriptor(ResourceProvider.IMG_Menu)) { - @Override - public void run() { - handleAdd(MenuPackageImpl.Literals.MENU, false); - } - }); - actions.add(new Action(Messages.MenuEditor_AddDirectMenuItem, - createImageDescriptor(ResourceProvider.IMG_DirectMenuItem)) { - @Override - public void run() { - handleAdd(MenuPackageImpl.Literals.DIRECT_MENU_ITEM, false); - } - }); - actions.add(new Action(Messages.MenuEditor_AddSeparator, - createImageDescriptor(ResourceProvider.IMG_MenuSeparator)) { - @Override - public void run() { - handleAdd(MenuPackageImpl.Literals.MENU_SEPARATOR, true); - } - }); - actions.add(new Action(Messages.MenuEditor_AddDynamicMenuContribution, - createImageDescriptor(ResourceProvider.IMG_DynamicMenuContribution)) { - @Override - public void run() { - handleAdd(MenuPackageImpl.Literals.DYNAMIC_MENU_CONTRIBUTION, false); - } - }); - } - - @Override - public Image getImage(Object element, Display display) { - if (element instanceof MUIElement) { - if (((MUIElement) element).isToBeRendered()) { - return createImage(ResourceProvider.IMG_MenuContribution); - } - return createImage(ResourceProvider.IMG_Tbr_MenuContribution); - } - - return null; - } - - @Override - public String getLabel(Object element) { - return Messages.MenuContributionEditor_TreeLabel; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return Messages.MenuContributionEditor_TreeLabelDescription; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - getMaster().setValue(object); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { - final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { - ControlFactory.createXMIId(parent, this); - } - - final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (isImport) { - ControlFactory.createFindImport(parent, Messages, this, context); - folder.setSelection(0); - return folder; - } - - ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, - EMFEditProperties - .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); - ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), - context, textProp, - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); - - { - final Label l = new Label(parent, SWT.NONE); - l.setText(Messages.MenuContributionEditor_ParentId); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - final Text t = new Text(parent, SWT.BORDER); - TextPasteHandler.createFor(t); - final GridData gd = new GridData(GridData.FILL_HORIZONTAL); - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), - EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.MENU_CONTRIBUTION__PARENT_ID) - .observeDetail(getMaster())); - - final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelTooling_Common_FindEllipsis); - b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - final MenuIdDialog dialog = new MenuIdDialog(t.getShell(), resource, - (MMenuContribution) getMaster().getValue(), getEditingDomain(), modelService, Messages); - dialog.open(); - } - }); - - } - - ControlFactory - .createTextField(parent, Messages.MenuContributionEditor_Position, master, context, textProp, - EMFEditProperties.value(getEditingDomain(), - MenuPackageImpl.Literals.MENU_CONTRIBUTION__POSITION_IN_PARENT)); - - // ------------------------------------------------------------ - { - final E4PickList pickList = new E4PickList(parent, SWT.NONE, null, Messages, this, - UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN) { - @Override - protected void addPressed() { - final Struct struct = (Struct) ((IStructuredSelection) getSelection()).getFirstElement(); - final EClass eClass = struct.eClass; - final MMenuElement eObject = (MMenuElement) EcoreUtil.create(eClass); - - final Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), - UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - if (!struct.separator) { - getEditor().setSelection(eObject); - } - } - } - }; - pickList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1)); - pickList.setText(Messages.MenuContributionEditor_MenuItems); - - final TableViewer viewer = pickList.getList(); - final IEMFListProperty prop = EMFEditProperties.list(getEditingDomain(), - UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - viewer.setInput(prop.observeDetail(master)); - - final Struct defaultStruct = new Struct(Messages.MenuContributionEditor_HandledMenuItem, - MenuPackageImpl.Literals.HANDLED_MENU_ITEM, false); - pickList.setInput(new Struct[] { - new Struct(Messages.MenuContributionEditor_Separator, MenuPackageImpl.Literals.MENU_SEPARATOR, true), - new Struct(Messages.MenuContributionEditor_Menu, MenuPackageImpl.Literals.MENU, false), - defaultStruct, - new Struct(Messages.MenuContributionEditor_DirectMenuItem, MenuPackageImpl.Literals.DIRECT_MENU_ITEM, - false), - new Struct(Messages.MenuContributionEditor_DynamicMenuContribution, - MenuPackageImpl.Literals.DYNAMIC_MENU_CONTRIBUTION, false) }); - pickList.setSelection(new StructuredSelection(defaultStruct)); - - } - - ControlFactory - .createCheckBox( - parent, - "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$ - ControlFactory - .createCheckBox( - parent, - "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$ - - item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabSupplementary); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); - - createContributedEditorTabs(folder, context, getMaster(), MMenuContribution.class); - - folder.setSelection(0); - - return folder; - } - - @Override - public IObservableList getChildList(Object element) { - return ELEMENT_CONTAINER__CHILDREN.observe(element); - } - - @Override - public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) }; - } - - protected void handleAdd(EClass eClass, boolean separator) { - final MMenuElement eObject = (MMenuElement) EcoreUtil.create(eClass); - setElementId(eObject); - final Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), - UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - if (!separator) { - getEditor().setSelection(eObject); - } - } - } - - @Override - public List<Action> getActions(Object element) { - final ArrayList<Action> l = new ArrayList<Action>(super.getActions(element)); - l.addAll(actions); - return l; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java deleted file mode 100644 index e70ee3e1..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java +++ /dev/null @@ -1,520 +0,0 @@ -/******************************************************************************* - * f * Copyright (c) 2010, 2014 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Marco Descher <marco@descher.at> - Bug 395982 - * Lars Vogel <Lars.Vogel@gmail.com> - Ongoing maintenance - * Steven Spungin <steven@spungin.tv> - Bug 424730, Bug 437951 - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.util.ArrayList; -import java.util.List; - -import javax.annotation.PostConstruct; -import javax.inject.Inject; - -import org.eclipse.core.databinding.UpdateValueStrategy; -import org.eclipse.core.databinding.observable.list.IListChangeListener; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.list.ListChangeEvent; -import org.eclipse.core.databinding.observable.list.ListDiffVisitor; -import org.eclipse.core.databinding.observable.list.WritableList; -import org.eclipse.core.databinding.observable.value.IValueChangeListener; -import org.eclipse.core.databinding.observable.value.ValueChangeEvent; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.core.di.annotations.Optional; -import org.eclipse.e4.tools.emf.ui.common.ImageTooltip; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.E4PickList; -import org.eclipse.e4.tools.emf.ui.internal.common.E4PickList.Struct; -import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; -import org.eclipse.e4.tools.emf.ui.internal.common.component.MenuItemEditor.EClass2EObject; -import org.eclipse.e4.tools.emf.ui.internal.common.component.MenuItemEditor.EObject2EClass; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.MenuIconDialogEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VMenuEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.uistructure.UIViewer; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.MExpression; -import org.eclipse.e4.ui.model.application.ui.MUIElement; -import org.eclipse.e4.ui.model.application.ui.MUILabel; -import org.eclipse.e4.ui.model.application.ui.MUiFactory; -import org.eclipse.e4.ui.model.application.ui.basic.MWindow; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.MMenu; -import org.eclipse.e4.ui.model.application.ui.menu.MMenuElement; -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.IEMFListProperty; -import org.eclipse.emf.databinding.IEMFValueProperty; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.databinding.viewers.ViewerProperties; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.ComboViewer; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class MenuEditor extends AbstractComponentEditor { - - private Composite composite; - private EMFDataBindingContext context; - - private final IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties - .list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - private final IEMFValueProperty UI_ELEMENT__VISIBLE_WHEN = EMFProperties - .value(UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN); - private StackLayout stackLayout; - private final List<Action> actions = new ArrayList<Action>(); - - @Inject - @Optional - private IProject project; - - @Inject - IEclipseContext eclipseContext; - - private Action addExpression; - - @Inject - public MenuEditor() { - super(); - } - - @PostConstruct - void init() { - actions.add(new Action(Messages.MenuEditor_AddHandledMenuItem, - createImageDescriptor(ResourceProvider.IMG_HandledMenuItem)) { - @Override - public void run() { - handleAdd(MenuPackageImpl.Literals.HANDLED_MENU_ITEM, false); - } - }); - actions.add(new Action(Messages.MenuEditor_AddMenu, createImageDescriptor(ResourceProvider.IMG_Menu)) { - @Override - public void run() { - handleAdd(MenuPackageImpl.Literals.MENU, false); - } - }); - actions.add(new Action(Messages.MenuEditor_AddDirectMenuItem, - createImageDescriptor(ResourceProvider.IMG_DirectMenuItem)) { - @Override - public void run() { - handleAdd(MenuPackageImpl.Literals.DIRECT_MENU_ITEM, false); - } - }); - actions.add(new Action(Messages.MenuEditor_AddSeparator, - createImageDescriptor(ResourceProvider.IMG_MenuSeparator)) { - @Override - public void run() { - handleAdd(MenuPackageImpl.Literals.MENU_SEPARATOR, true); - } - }); - actions.add(new Action(Messages.MenuEditor_AddDynamicMenuContribution, - createImageDescriptor(ResourceProvider.IMG_DynamicMenuContribution)) { - @Override - public void run() { - handleAdd(MenuPackageImpl.Literals.DYNAMIC_MENU_CONTRIBUTION, false); - } - }); - addExpression = new Action(Messages.MenuEditor_AddCoreExpression, - createImageDescriptor(ResourceProvider.IMG_CoreExpression)) { - @Override - public void run() { - final MUIElement e = (MUIElement) getMaster().getValue(); - final Command cmd = SetCommand.create(getEditingDomain(), e, - UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN, MUiFactory.INSTANCE.createCoreExpression()); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - }; - } - - @Override - public Image getImage(Object element, Display display) { - if (element instanceof MUIElement) { - final MUIElement uiElement = (MUIElement) element; - if (uiElement.isToBeRendered() && uiElement.isVisible()) { - return createImage(ResourceProvider.IMG_Menu); - } - return createImage(ResourceProvider.IMG_Tbr_Menu); - } - - return null; - } - - @Override - public String getDescription(Object element) { - return Messages.MenuEditor_Description; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); - composite.setLayout(stackLayout); - - createForm(composite, context, getMaster(), false, false); - createForm(composite, context, getMaster(), true, false); - if (getEditor().isModelFragment()) { - createForm(composite, context, getMaster(), false, true); - } - } - final EObject o = (EObject) object; - Control topControl; - if (Util.isImport(o) && getEditor().isModelFragment()) { - topControl = composite.getChildren()[2]; - } else if (o.eContainer() instanceof MWindow || o.eContainer() == null) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - - getMaster().setValue(object); - enableIdGenerator(UiPackageImpl.Literals.UI_LABEL__LABEL, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID, null); - return composite; - } - - protected Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, - boolean rootMenu, boolean isImport) { - final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { - ControlFactory.createXMIId(parent, this); - } - - final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (isImport) { - ControlFactory.createFindImport(parent, Messages, this, context); - folder.setSelection(0); - return folder; - } - - ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, - EMFEditProperties - .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); - - // ------------------------------------------------------------ - if (!rootMenu) { - ControlFactory.createTranslatedTextField(parent, Messages.MenuEditor_LabelLabel, master, context, textProp, - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL), resourcePool, - project); - } - - ControlFactory.createTextField(parent, Messages.MenuEditor_Mnemonics, master, context, textProp, - EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.MENU_ELEMENT__MNEMONICS)); - - { - - // Label l = new Label(parent, SWT.NONE); - // l.setText(Messages.MenuEditor_Children); - // l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, - // false, false)); - // - // new Label(parent, SWT.NONE); - // new Label(parent, SWT.NONE); - - final E4PickList pickList = new E4PickList(parent, SWT.NONE, null, Messages, this, - UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - pickList.setText(Messages.MenuEditor_Children); - pickList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1)); - - final Struct defaultStruct = new Struct(Messages.MenuEditor_HandledMenuItem, - MenuPackageImpl.Literals.HANDLED_MENU_ITEM, false); - pickList.setInput(new Struct[] { - new Struct(Messages.MenuEditor_Separator, MenuPackageImpl.Literals.MENU_SEPARATOR, true), - new Struct(Messages.MenuEditor_Menu, MenuPackageImpl.Literals.MENU, false), - defaultStruct, - new Struct(Messages.MenuEditor_DirectMenuItem, MenuPackageImpl.Literals.DIRECT_MENU_ITEM, false), - new Struct(Messages.MenuEditor_DynamicMenuContribution, - MenuPackageImpl.Literals.DYNAMIC_MENU_CONTRIBUTION, false) }); - pickList.setSelection(new StructuredSelection(defaultStruct)); - - final IEMFListProperty prop = EMFEditProperties.list(getEditingDomain(), - UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - pickList.getList().setInput(prop.observeDetail(master)); - - } - - // ------------------------------------------------------------ - if (!rootMenu) { - ControlFactory.createTranslatedTextField(parent, Messages.MenuEditor_Tooltip, master, context, textProp, - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP), resourcePool, - project); - } - - // ------------------------------------------------------------ - if (!rootMenu) { - final Label l = new Label(parent, SWT.NONE); - l.setText(Messages.MenuEditor_IconURI); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - final Text t = new Text(parent, SWT.BORDER); - TextPasteHandler.createFor(t); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue( - textProp.observeDelayed(200, t), - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail( - master)); - - new ImageTooltip(t, Messages) { - - @Override - protected URI getImageURI() { - final MUILabel part = (MUILabel) getMaster().getValue(); - final String uri = part.getIconURI(); - if (uri == null || uri.trim().length() == 0) { - return null; - } - return URI.createURI(part.getIconURI()); - } - }; - - final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); - b.setText(Messages.ModelTooling_Common_FindEllipsis); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - final MenuIconDialogEditor dialog = new MenuIconDialogEditor(b.getShell(), eclipseContext, project, - getEditingDomain(), (MMenu) getMaster().getValue(), Messages); - dialog.open(); - } - }); - } - - { - final Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ModelTooling_UIElement_VisibleWhen); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - final ComboViewer combo = new ComboViewer(parent); - combo.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - combo.setContentProvider(new ArrayContentProvider()); - combo.setLabelProvider(new LabelProvider() { - @Override - public String getText(Object element) { - if (element instanceof EClass) { - final EClass eClass = (EClass) element; - return eClass.getName(); - } - - return super.getText(element); - } - }); - final List<Object> list = new ArrayList<Object>(); - list.add(Messages.MenuItemEditor_NoExpression); - list.add(UiPackageImpl.Literals.CORE_EXPRESSION); - list.addAll(getEditor().getFeatureClasses(UiPackageImpl.Literals.EXPRESSION, - UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN)); - combo.setInput(list); - context.bindValue(ViewerProperties.singleSelection().observe(combo), - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN) - .observeDetail(getMaster()), new UpdateValueStrategy().setConverter(new EClass2EObject(Messages)), - new UpdateValueStrategy().setConverter(new EObject2EClass(Messages))); - } - - ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, - WidgetProperties.selection(), - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); - ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, - WidgetProperties.selection(), - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - - item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabSupplementary); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), - context, textProp, - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); - ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); - - if (project == null) { - createUITreeInspection(folder); - } - - createContributedEditorTabs(folder, context, getMaster(), MMenu.class); - - folder.setSelection(0); - - return folder; - } - - private void createUITreeInspection(CTabFolder folder) { - final CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_RuntimeWidgetTree); - final Composite container = new Composite(folder, SWT.NONE); - container.setLayout(new GridLayout()); - item.setControl(container); - - final UIViewer objectViewer = new UIViewer(); - final TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET, - getMaster(), resourcePool, Messages); - viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); - } - - @Override - public IObservableList getChildList(Object element) { - final WritableList list = new WritableList(); - - if (((MUIElement) element).getVisibleWhen() != null) { - list.add(0, ((MUIElement) element).getVisibleWhen()); - } - - UI_ELEMENT__VISIBLE_WHEN.observe(element).addValueChangeListener(new IValueChangeListener() { - - @Override - public void handleValueChange(ValueChangeEvent event) { - if (event.diff.getOldValue() != null) { - list.remove(event.diff.getOldValue()); - } - - if (event.diff.getNewValue() != null) { - list.add(0, event.diff.getNewValue()); - } - } - }); - - final IObservableList l = ELEMENT_CONTAINER__CHILDREN.observe(element); - l.addListChangeListener(new IListChangeListener() { - - @Override - public void handleListChange(ListChangeEvent event) { - event.diff.accept(new ListDiffVisitor() { - - @Override - public void handleRemove(int index, Object element) { - list.remove(element); - } - - @Override - public void handleMove(int oldIndex, int newIndex, Object element) { - if (list.get(0) instanceof MExpression) { - oldIndex += 1; - newIndex += 1; - } - list.move(oldIndex, newIndex); - } - - @Override - public void handleAdd(int index, Object element) { - list.add(element); - } - }); - } - }); - list.addAll(l); - - return list; - } - - @Override - public String getLabel(Object element) { - final MMenu menu = (MMenu) element; - if (menu.getParent() == null) { - final EObject o = (EObject) element; - if (o.eContainer() instanceof MWindow) { - return Messages.MenuEditor_MainMenu; - } else if (menu.getTags().contains(VMenuEditor.VIEW_MENU_TAG)) { - return Messages.MenuEditor_Label_ViewMenu; - } - } else if (menu.getTags().contains(VMenuEditor.VIEW_MENU_TAG)) { - return Messages.MenuEditor_Label_ViewMenu; - } - return Messages.MenuEditor_Label; - } - - @Override - public String getDetailLabel(Object element) { - return getLocalizedLabel((MUILabel) element); - } - - @Override - public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) }; - } - - protected void handleAdd(EClass eClass, boolean separator) { - final MMenuElement eObject = (MMenuElement) EcoreUtil.create(eClass); - setElementId(eObject); - final Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), - UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - if (!separator) { - getEditor().setSelection(eObject); - } - } - } - - @Override - public List<Action> getActions(Object element) { - final ArrayList<Action> l = new ArrayList<Action>(super.getActions(element)); - l.addAll(actions); - if (((MUIElement) getMaster().getValue()).getVisibleWhen() == null) { - l.add(addExpression); - } - return l; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java deleted file mode 100644 index 8c455a26..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java +++ /dev/null @@ -1,445 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2014 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Lars Vogel <Lars.Vogel@gmail.com> - Ongoing maintenance - * Steven Spungin <steven@spungin.tv> - Bug 424730, Bug 437951 - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.util.ArrayList; -import java.util.List; - -import javax.annotation.PostConstruct; -import javax.inject.Inject; - -import org.eclipse.core.databinding.UpdateValueStrategy; -import org.eclipse.core.databinding.conversion.Converter; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.IObservableValue; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.core.di.annotations.Optional; -import org.eclipse.e4.tools.emf.ui.common.ImageTooltip; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.MenuItemIconDialogEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.uistructure.UIViewer; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.MUIElement; -import org.eclipse.e4.ui.model.application.ui.MUILabel; -import org.eclipse.e4.ui.model.application.ui.MUiFactory; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.ItemType; -import org.eclipse.e4.ui.model.application.ui.menu.MMenuItem; -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.databinding.viewers.ViewerProperties; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.ComboViewer; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public abstract class MenuItemEditor extends AbstractComponentEditor { - - private Composite composite; - private EMFDataBindingContext context; - - private StackLayout stackLayout; - - @Inject - @Optional - protected IProject project; - - @Inject - IEclipseContext eclipseContext; - - private Action addExpression; - - public MenuItemEditor() { - super(); - } - - @PostConstruct - void init() { - addExpression = new Action(Messages.MenuItemEditor_AddCoreExpression, - createImageDescriptor(ResourceProvider.IMG_CoreExpression)) { - @Override - public void run() { - final MUIElement e = (MUIElement) getMaster().getValue(); - final Command cmd = SetCommand.create(getEditingDomain(), e, - UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN, MUiFactory.INSTANCE.createCoreExpression()); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - }; - } - - @Override - public Image getImage(Object element, Display display) { - if (element instanceof MUIElement) { - if (((MUIElement) element).isToBeRendered()) { - return createImage(ResourceProvider.IMG_MenuItem); - } - return createImage(ResourceProvider.IMG_Tbr_MenuItem); - } - - return null; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - getMaster().setValue(object); - enableIdGenerator(UiPackageImpl.Literals.UI_LABEL__LABEL, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID, null); - return composite; - } - - protected CTabFolder createForm(Composite parent, EMFDataBindingContext context, WritableValue master, - boolean isImport) { - final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - final IWidgetValueProperty checkProp = WidgetProperties.selection(); - final IWidgetValueProperty enabled = WidgetProperties.enabled(); - - if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { - ControlFactory.createXMIId(parent, this); - } - - if (isImport) { - ControlFactory.createFindImport(parent, Messages, this, context); - folder.setSelection(0); - return folder; - } - - ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, - EMFEditProperties - .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); - - if (this.getClass() != MenuItemEditor.class) { - // ------------------------------------------------------------ - { - final Label l = new Label(parent, SWT.NONE); - l.setText(Messages.MenuItemEditor_Type); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - final ComboViewer viewer = new ComboViewer(parent); - viewer.setContentProvider(new ArrayContentProvider()); - viewer.setInput(new ItemType[] { ItemType.CHECK, ItemType.PUSH, ItemType.RADIO }); - final GridData gd = new GridData(); - gd.horizontalSpan = 2; - viewer.getControl().setLayoutData(gd); - final IObservableValue itemTypeObs = EMFEditProperties.value(getEditingDomain(), - MenuPackageImpl.Literals.ITEM__TYPE).observeDetail(master); - context.bindValue(ViewerProperties.singleSelection().observe(viewer), itemTypeObs); - } - } - - ControlFactory.createTranslatedTextField(parent, Messages.MenuItemEditor_Label, master, context, textProp, - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL), resourcePool, project); - ControlFactory.createTextField(parent, Messages.MenuItemEditor_Mnemonics, getMaster(), context, textProp, - EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.MENU_ELEMENT__MNEMONICS)); - ControlFactory.createTranslatedTextField(parent, Messages.MenuItemEditor_Tooltip, master, context, textProp, - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP), resourcePool, - project); - - // ------------------------------------------------------------ - { - final Label l = new Label(parent, SWT.NONE); - l.setText(Messages.MenuItemEditor_IconURI); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - final Text t = new Text(parent, SWT.BORDER); - TextPasteHandler.createFor(t); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue( - textProp.observeDelayed(200, t), - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail( - master)); - - new ImageTooltip(t, Messages) { - - @Override - protected URI getImageURI() { - final MUILabel part = (MUILabel) getMaster().getValue(); - final String uri = part.getIconURI(); - if (uri == null || uri.trim().length() == 0) { - return null; - } - return URI.createURI(part.getIconURI()); - } - }; - - final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.setText(Messages.ModelTooling_Common_FindEllipsis); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - final MenuItemIconDialogEditor dialog = new MenuItemIconDialogEditor(b.getShell(), eclipseContext, - project, getEditingDomain(), (MMenuItem) getMaster().getValue(), Messages); - dialog.open(); - } - }); - } - - { - final Label l = new Label(parent, SWT.NONE); - l.setText(Messages.MenuItemEditor_Enabled); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - final Button b = new Button(parent, SWT.CHECK); - b.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 2, 1)); - context.bindValue( - checkProp.observe(b), - EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.ITEM__ENABLED).observeDetail( - getMaster())); - } - - { - final Label l = new Label(parent, SWT.NONE); - l.setText(Messages.MenuItemEditor_Selected); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - final Button b = new Button(parent, SWT.CHECK); - b.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 2, 1)); - context.bindValue( - checkProp.observe(b), - EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.ITEM__SELECTED).observeDetail( - getMaster())); - - final UpdateValueStrategy t2m = new UpdateValueStrategy(); - t2m.setConverter(new Converter(boolean.class, ItemType.class) { - - @Override - public Object convert(Object fromObject) { - return null; - } - }); - final UpdateValueStrategy m2t = new UpdateValueStrategy(); - m2t.setConverter(new Converter(ItemType.class, boolean.class) { - - @Override - public Object convert(Object fromObject) { - return fromObject == ItemType.CHECK || fromObject == ItemType.RADIO; - } - }); - - context.bindValue( - enabled.observe(b), - EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.ITEM__TYPE).observeDetail( - getMaster()), t2m, m2t); - - } - - { - final Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ModelTooling_UIElement_VisibleWhen); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - final ComboViewer combo = new ComboViewer(parent); - combo.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - combo.setContentProvider(new ArrayContentProvider()); - combo.setLabelProvider(new LabelProvider() { - @Override - public String getText(Object element) { - if (element instanceof EClass) { - final EClass eClass = (EClass) element; - return eClass.getName(); - } - - return super.getText(element); - } - }); - final List<Object> list = new ArrayList<Object>(); - list.add(Messages.MenuItemEditor_NoExpression); - list.add(UiPackageImpl.Literals.CORE_EXPRESSION); - list.addAll(getEditor().getFeatureClasses(UiPackageImpl.Literals.EXPRESSION, - UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN)); - combo.setInput(list); - context.bindValue(ViewerProperties.singleSelection().observe(combo), - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN) - .observeDetail(getMaster()), new UpdateValueStrategy().setConverter(new EClass2EObject(Messages)), - new UpdateValueStrategy().setConverter(new EObject2EClass(Messages))); - } - - createFormSubTypeForm(parent, context, master); - - ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, - WidgetProperties.selection(), - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); - ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, - WidgetProperties.selection(), - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - - item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabSupplementary); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), - context, textProp, - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); - - ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); - - if (project == null) { - createUITreeInspection(folder); - } - - createContributedEditorTabs(folder, context, getMaster(), MMenuItem.class); - - folder.setSelection(0); - - return folder; - } - - protected abstract void createFormSubTypeForm(Composite parent, EMFDataBindingContext context, WritableValue master); - - private void createUITreeInspection(CTabFolder folder) { - final CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_RuntimeWidgetTree); - final Composite container = new Composite(folder, SWT.NONE); - container.setLayout(new GridLayout()); - item.setControl(container); - - final UIViewer objectViewer = new UIViewer(); - final TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET, - getMaster(), resourcePool, Messages); - viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); - } - - @Override - public IObservableList getChildList(Object element) { - return null; - } - - @Override - public String getDetailLabel(Object element) { - return getLocalizedLabel((MUILabel) element); - } - - @Override - public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__LABEL), - FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) }; - } - - @Override - public List<Action> getActions(Object element) { - final ArrayList<Action> l = new ArrayList<Action>(super.getActions(element)); - if (((MUIElement) getMaster().getValue()).getVisibleWhen() == null) { - l.add(addExpression); - } - return l; - } - - static class EObject2EClass extends Converter { - Messages Messages; - - public EObject2EClass(Messages Messages) { - super(EObject.class, EClass.class); - this.Messages = Messages; - } - - @Override - public Object convert(Object fromObject) { - if (fromObject == null) { - return Messages.MenuItemEditor_NoExpression; - } - return ((EObject) fromObject).eClass(); - } - } - - static class EClass2EObject extends Converter { - Messages Messages; - - public EClass2EObject(Messages Messages) { - super(EClass.class, EObject.class); - this.Messages = Messages; - } - - @Override - public Object convert(Object fromObject) { - if (fromObject == null || fromObject.toString().equals(Messages.MenuItemEditor_NoExpression)) { - return null; - } - return EcoreUtil.create((EClass) fromObject); - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java deleted file mode 100644 index 8afaa3a7..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java +++ /dev/null @@ -1,173 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2014 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Lars Vogel <Lars.Vogel@gmail.com> - Ongoing maintenance - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import javax.inject.Inject; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.core.di.annotations.Optional; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.uistructure.UIViewer; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.MMenuSeparator; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; - -public class MenuSeparatorEditor extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - private StackLayout stackLayout; - - @Inject - @Optional - private IProject project; - - @Inject - public MenuSeparatorEditor() { - super(); - } - - @Override - public Image getImage(Object element, Display display) { - return createImage(ResourceProvider.IMG_MenuSeparator); - } - - @Override - public String getLabel(Object element) { - return Messages.MenuSeparatorEditor_Label; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return null; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - getMaster().setValue(object); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { - CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { - ControlFactory.createXMIId(parent, this); - } - - IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (isImport) { - ControlFactory.createFindImport(parent, Messages, this, context); - folder.setSelection(0); - return folder; - } - - ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); - ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); - ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); - ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - - item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabSupplementary); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); - - if (project == null) { - createUITreeInspection(folder); - } - - createContributedEditorTabs(folder, context, getMaster(), MMenuSeparator.class); - - folder.setSelection(0); - - return folder; - } - - private void createUITreeInspection(CTabFolder folder) { - CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_RuntimeWidgetTree); - Composite container = new Composite(folder, SWT.NONE); - container.setLayout(new GridLayout()); - item.setControl(container); - - UIViewer objectViewer = new UIViewer(); - TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET, getMaster(), resourcePool, Messages); - viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); - } - - @Override - public IObservableList getChildList(Object element) { - return null; - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java deleted file mode 100644 index 413f698a..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java +++ /dev/null @@ -1,268 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Steven Spungin <steven@spungin.tv> - Ongoing maintenance, Bug 443945 - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import javax.inject.Inject; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.list.WritableList; -import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.tools.emf.ui.common.IEditorFeature.FeatureClass; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.AbstractPickList; -import org.eclipse.e4.tools.emf.ui.internal.common.AbstractPickList.PickListFeatures; -import org.eclipse.e4.tools.emf.ui.internal.common.E4PickList; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.fragment.MFragmentFactory; -import org.eclipse.e4.ui.model.fragment.MModelFragment; -import org.eclipse.e4.ui.model.fragment.MModelFragments; -import org.eclipse.e4.ui.model.fragment.impl.FragmentPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.IEMFListProperty; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerComparator; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; - -public class ModelFragmentsEditor extends AbstractComponentEditor { - - private final IListProperty MODEL_FRAGMENTS__FRAGMENTS = EMFProperties - .list(FragmentPackageImpl.Literals.MODEL_FRAGMENTS__FRAGMENTS); - private final IListProperty MODEL_FRAGMENTS__IMPORTS = EMFProperties - .list(FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS); - - private Composite composite; - - @Inject - IEclipseContext context; - - @Inject - public ModelFragmentsEditor() { - super(); - } - - @Override - public Image getImage(Object element, Display display) { - return createImage(ResourceProvider.IMG_ModelFragments); - } - - @Override - public String getLabel(Object element) { - return Messages.ModelFragmentsEditor_Label; - } - - @Override - public String getDescription(Object element) { - return Messages.ModelFragmentsEditor_Description; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - composite = createForm(parent); - } - getMaster().setValue(object); - return composite; - } - - private Composite createForm(Composite parent) { - final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - createFragmentsTab(folder); - createImportsTab(folder); - folder.setSelection(0); - return folder; - } - - private void createFragmentsTab(CTabFolder folder) { - - final CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelFragmentsEditor_ModelFragments); - - final Composite parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - { - - final AbstractPickList pickList = new E4PickList(parent, SWT.NONE, - Arrays.asList(PickListFeatures.NO_PICKER), Messages, this, - FragmentPackageImpl.Literals.MODEL_FRAGMENTS__FRAGMENTS) { - @Override - protected void addPressed() { - final MModelFragment component = MFragmentFactory.INSTANCE.createStringModelFragment(); - - final Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), - FragmentPackageImpl.Literals.MODEL_FRAGMENTS__FRAGMENTS, component); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(component); - } - } - - @Override - protected List<?> getContainerChildren(Object container) { - if (container instanceof MModelFragments) { - return ((MModelFragments) container).getFragments(); - } - return null; - } - }; - pickList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1)); - final TableViewer viewer = pickList.getList(); - - final IEMFListProperty prop = EMFProperties.list(FragmentPackageImpl.Literals.MODEL_FRAGMENTS__FRAGMENTS); - viewer.setInput(prop.observeDetail(getMaster())); - } - - } - - private void createImportsTab(CTabFolder folder) { - - final CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelFragmentsEditor_Imports); - - final Composite parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { - ControlFactory.createXMIId(parent, this); - } - - final E4PickList pickList = new E4PickList(parent, SWT.NONE, null, Messages, this, - FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS) { - @Override - protected void addPressed() { - final EClass eClass = ((FeatureClass) ((IStructuredSelection) getSelection()).getFirstElement()).eClass; - final EObject eObject = EcoreUtil.create(eClass); - - final Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), - FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS, eObject); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(eObject); - } - } - - @Override - protected List<?> getContainerChildren(Object master) { - // TODO What object is master? We need to cast. - return super.getContainerChildren(master); - } - }; - - pickList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1)); - pickList.setText(Messages.PartSashContainerEditor_Controls); - - final TableViewer viewer = pickList.getList(); - - pickList.setLabelProvider(new LabelProvider() { - @Override - public String getText(Object element) { - final FeatureClass eclass = (FeatureClass) element; - return eclass.label; - } - }); - - pickList.setComparator(new ViewerComparator() { - @Override - public int compare(Viewer viewer, Object e1, Object e2) { - final FeatureClass eClass1 = (FeatureClass) e1; - final FeatureClass eClass2 = (FeatureClass) e2; - return eClass1.label.compareTo(eClass2.label); - } - }); - - final List<FeatureClass> list = new ArrayList<FeatureClass>(); - Util.addClasses(ApplicationPackageImpl.eINSTANCE, list); - list.addAll(getEditor().getFeatureClasses(FragmentPackageImpl.Literals.MODEL_FRAGMENT, - FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS)); - - pickList.setInput(list); - if (list.size() > 0) { - pickList.setSelection(new StructuredSelection(list.get(0))); - } - - final IEMFListProperty prop = EMFProperties.list(FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS); - viewer.setInput(prop.observeDetail(getMaster())); - } - - public void addClasses(EPackage ePackage, List<FeatureClass> list) { - for (final EClassifier c : ePackage.getEClassifiers()) { - if (c instanceof EClass) { - final EClass eclass = (EClass) c; - if (eclass != ApplicationPackageImpl.Literals.APPLICATION && !eclass.isAbstract() - && !eclass.isInterface() - && eclass.getEAllSuperTypes().contains(ApplicationPackageImpl.Literals.APPLICATION_ELEMENT)) { - list.add(new FeatureClass(eclass.getName(), eclass)); - } - } - } - - for (final EPackage eSubPackage : ePackage.getESubpackages()) { - addClasses(eSubPackage, list); - } - } - - @Override - public IObservableList getChildList(Object element) { - final WritableList list = new WritableList(); - list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_MODEL_IMPORTS, MODEL_FRAGMENTS__IMPORTS, element, - Messages.ModelFragmentsEditor_Imports) { - @Override - protected boolean accepted(Object o) { - return true; - } - }); - list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_MODEL_FRAGEMENTS, MODEL_FRAGMENTS__FRAGMENTS, element, - Messages.ModelFragmentsEditor_ModelFragments) { - @Override - protected boolean accepted(Object o) { - return true; - } - }); - - return list; - } - - @Override - public String getDetailLabel(Object element) { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ParameterEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ParameterEditor.java deleted file mode 100644 index d198fe1c..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ParameterEditor.java +++ /dev/null @@ -1,204 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2014 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Lars Vogel <Lars.Vogel@gmail.com> - Ongoing maintenance - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import javax.inject.Inject; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.e4.core.contexts.ContextInjectionFactory; -import org.eclipse.e4.core.contexts.EclipseContextFactory; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ParameterIdSelectionDialog; -import org.eclipse.e4.ui.model.application.commands.MParameter; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class ParameterEditor extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - - private StackLayout stackLayout; - - @Inject - private IEclipseContext eclipseContext; - - @Inject - public ParameterEditor() { - super(); - } - - @Override - public Image getImage(Object element, Display display) { - return createImage(ResourceProvider.IMG_Parameter); - } - - @Override - public String getLabel(Object element) { - return Messages.ParameterEditor_TreeLabel; - } - - @Override - public String getDetailLabel(Object element) { - MParameter param = (MParameter) element; - if (param.getName() != null && param.getName().trim().length() > 0) { - return param.getName().trim(); - } else if (param.getElementId() != null && param.getElementId().trim().length() > 0) { - return param.getElementId().trim(); - } - return null; - } - - @Override - public String getDescription(Object element) { - return Messages.ParameterEditor_TreeLabelDescription; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - getMaster().setValue(object); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { - CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { - ControlFactory.createXMIId(parent, this); - } - - IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (isImport) { - ControlFactory.createFindImport(parent, Messages, this, context); - folder.setSelection(0); - return folder; - } - - ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); - createParameterNameRow(parent, textProp); - ControlFactory.createTextField(parent, Messages.ParameterEditor_Value, master, context, textProp, EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.PARAMETER__VALUE)); - - item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabSupplementary); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); - - createContributedEditorTabs(folder, context, getMaster(), MParameter.class); - - folder.setSelection(0); - - return folder; - } - - @Override - public IObservableList getChildList(Object element) { - return null; - } - - private void createParameterNameRow(Composite parent, IWidgetValueProperty textProp) { - { - Label commandParameterIdLabel = new Label(parent, SWT.NONE); - commandParameterIdLabel.setText(Messages.ParameterEditor_Command_Parameter_ID); - commandParameterIdLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text commandParameterIdValue = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - commandParameterIdValue.setLayoutData(gd); - TextPasteHandler.createFor(commandParameterIdValue); - IEMFEditValueProperty modelProp = EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.PARAMETER__NAME); - context.bindValue(textProp.observeDelayed(200, commandParameterIdValue), modelProp.observeDetail(getMaster())); - } - - Button chooseParameterButton = new Button(parent, SWT.PUSH | SWT.FLAT); - chooseParameterButton.setText(Messages.ModelTooling_Common_FindEllipsis); - chooseParameterButton.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); - chooseParameterButton.addSelectionListener(new ChooseParameterButtonSelectionListener()); - chooseParameterButton.setLayoutData(new GridData()); - } - - private final class ChooseParameterButtonSelectionListener extends SelectionAdapter { - @Override - public void widgetSelected(SelectionEvent e) { - WritableValue master = getMaster(); - if (master == null || !(master.getValue() instanceof MParameter)) { - return; - } - - IEclipseContext staticContext = EclipseContextFactory.create("ParameterIdSelectionDialog static context"); //$NON-NLS-1$ - staticContext.set(MParameter.class, (MParameter) master.getValue()); - ParameterIdSelectionDialog dialog = ContextInjectionFactory.make(ParameterIdSelectionDialog.class, eclipseContext, staticContext); - dialog.open(); - } - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java deleted file mode 100644 index 6e26e0f3..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java +++ /dev/null @@ -1,451 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Steven Spungin <steven@spungin.tv> - Bug 404166, 424730, 437951 - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import javax.inject.Inject; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.list.WritableList; -import org.eclipse.core.databinding.observable.value.IObservableValue; -import org.eclipse.core.databinding.observable.value.IValueChangeListener; -import org.eclipse.core.databinding.observable.value.ValueChangeEvent; -import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.core.databinding.property.value.IValueProperty; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.core.di.annotations.Optional; -import org.eclipse.e4.tools.emf.ui.common.IContributionClassCreator; -import org.eclipse.e4.tools.emf.ui.common.ImageTooltip; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.PartDescriptorIconDialogEditor; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; -import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptor; -import org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.MUILabel; -import org.eclipse.e4.ui.model.application.ui.basic.MBasicFactory; -import org.eclipse.e4.ui.model.application.ui.basic.MPart; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; -import org.eclipse.e4.ui.model.application.ui.menu.MToolBar; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Link; -import org.eclipse.swt.widgets.Text; - -public class PartDescriptorEditor extends AbstractComponentEditor { - - private Composite composite; - private EMFDataBindingContext context; - - @Inject - @Optional - private IProject project; - - @Inject - IEclipseContext eclipseContext; - - private IListProperty PART__MENUS = EMFProperties.list(BasicPackageImpl.Literals.PART_DESCRIPTOR__MENUS); - private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS); - private IValueProperty PART__TOOLBAR = EMFProperties.value(BasicPackageImpl.Literals.PART_DESCRIPTOR__TOOLBAR); - private Button createRemoveToolBar; - private StackLayout stackLayout; - - @Inject - public PartDescriptorEditor() { - super(); - } - - @Override - public Image getImage(Object element, Display display) { - return createImage(ResourceProvider.IMG_PartDescriptor); - } - - @Override - public String getLabel(Object element) { - return Messages.PartDescriptorEditor_Label; - } - - @Override - public String getDescription(Object element) { - return Messages.PartDescriptorEditor_Descriptor; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - if (createRemoveToolBar != null) { - createRemoveToolBar.setSelection(((MPartDescriptor) object).getToolbar() != null); - } - - getMaster().setValue(object); - enableIdGenerator(UiPackageImpl.Literals.UI_LABEL__LABEL, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID, null); - return composite; - } - - protected Composite createForm(Composite parent, EMFDataBindingContext context, IObservableValue master, boolean isImport) { - CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { - ControlFactory.createXMIId(parent, this); - } - - IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (isImport) { - ControlFactory.createFindImport(parent, Messages, this, context); - folder.setSelection(0); - return folder; - } - - ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); - ControlFactory.createTranslatedTextField(parent, Messages.PartDescriptorEditor_LabelLabel, master, context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL), resourcePool, project); - ControlFactory.createTranslatedTextField(parent, Messages.PartDescriptorEditor_Tooltip, master, context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP), resourcePool, project); - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartDescriptorEditor_IconURI); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - TextPasteHandler.createFor(t); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); - - new ImageTooltip(t, Messages) { - - @Override - protected URI getImageURI() { - MUILabel part = (MUILabel) getMaster().getValue(); - String uri = part.getIconURI(); - if (uri == null || uri.trim().length() == 0) { - return null; - } - return URI.createURI(part.getIconURI()); - } - }; - - final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); - b.setText(Messages.ModelTooling_Common_FindEllipsis); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - PartDescriptorIconDialogEditor dialog = new PartDescriptorIconDialogEditor(b.getShell(), eclipseContext, project, getEditingDomain(), (MPartDescriptor) getMaster().getValue(), Messages); - dialog.open(); - } - }); - } - - // ------------------------------------------------------------ - final Link lnk; - { - /* - * IContributionClassCreator accepts MContribitions but - * MPartDescriptor does not implement, so we need to be a bit - * creative here - */ - // - final IContributionClassCreator c = getEditor().getContributionCreator(org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl.Literals.PART); - if (project != null && c != null) { - lnk = new Link(parent, SWT.NONE); - lnk.setText("<A>" + Messages.PartEditor_ClassURI + "</A>"); //$NON-NLS-1$//$NON-NLS-2$ - lnk.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - final IObservableValue masterFinal = master; - lnk.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - MPart dummyPart = MBasicFactory.INSTANCE.createPart(); - String contributionURI = ((MPartDescriptor) getMaster().getValue()).getContributionURI(); - dummyPart.setContributionURI(contributionURI); - c.createOpen(dummyPart, getEditingDomain(), project, lnk.getShell()); - ((MPartDescriptor) masterFinal.getValue()).setContributionURI(dummyPart.getContributionURI()); - } - }); - } else { - // Dispose the lnk widget, which is unused in this else branch - // and screws up the layout: see https://bugs.eclipse.org/421369 - lnk = null; - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartDescriptorEditor_ClassURI); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - } - - Text t = new Text(parent, SWT.BORDER); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.PART_DESCRIPTOR__CONTRIBUTION_URI).observeDetail(master)); - TextPasteHandler.createFor(t); - - final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); - b.setText(Messages.ModelTooling_Common_FindEllipsis); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(), eclipseContext, getEditingDomain(), (MPartDescriptor) getMaster().getValue(), BasicPackageImpl.Literals.PART_DESCRIPTOR__CONTRIBUTION_URI, Messages); - dialog.open(); - } - }); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartEditor_ToolBar); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - createRemoveToolBar = new Button(parent, SWT.CHECK); - createRemoveToolBar.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - MPartDescriptor window = (MPartDescriptor) getMaster().getValue(); - if (window.getToolbar() == null) { - addToolBar(); - } else { - removeToolBar(); - } - } - }); - createRemoveToolBar.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 2, 1)); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartDescriptorEditor_ContainerData); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__CONTAINER_DATA).observeDetail(master)); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartDescriptorEditor_Dirtyable); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Button checkbox = new Button(parent, SWT.CHECK); - checkbox.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false, 2, 1)); - - IEMFEditValueProperty mprop = EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.PART_DESCRIPTOR__DIRTYABLE); - IWidgetValueProperty uiProp = WidgetProperties.selection(); - - context.bindValue(uiProp.observe(checkbox), mprop.observeDetail(master)); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartDescriptorEditor_Closeable); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Button checkbox = new Button(parent, SWT.CHECK); - checkbox.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false, 2, 1)); - - IEMFEditValueProperty mprop = EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.PART_DESCRIPTOR__CLOSEABLE); - IWidgetValueProperty uiProp = WidgetProperties.selection(); - - context.bindValue(uiProp.observe(checkbox), mprop.observeDetail(master)); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartDescriptorEditor_Multiple); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Button checkbox = new Button(parent, SWT.CHECK); - checkbox.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false, 2, 1)); - - IEMFEditValueProperty mprop = EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.PART_DESCRIPTOR__ALLOW_MULTIPLE); - IWidgetValueProperty uiProp = WidgetProperties.selection(); - - context.bindValue(uiProp.observe(checkbox), mprop.observeDetail(master)); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartDescriptorEditor_Category); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - t.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, false, 2, 1)); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.PART_DESCRIPTOR__CATEGORY).observeDetail(master)); - } - - ControlFactory.createBindingContextWiget(parent, Messages, this, Messages.PartEditor_BindingContexts); - - item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabSupplementary); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); - - createContributedEditorTabs(folder, context, getMaster(), MPartDescriptor.class); - - folder.setSelection(0); - - return folder; - } - - private void addToolBar() { - MToolBar menu = MMenuFactory.INSTANCE.createToolBar(); - setElementId(menu); - - Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.PART_DESCRIPTOR__TOOLBAR, menu); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - - private void removeToolBar() { - Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.PART_DESCRIPTOR__TOOLBAR, null); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - - @Override - public IObservableList getChildList(final Object element) { - final WritableList list = new WritableList(); - - if (getEditor().isModelFragment() && Util.isImport((EObject) element)) { - return list; - } - - list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_PARTDESCRIPTOR_MENU, PART__MENUS, element, Messages.PartDescriptorEditor_Menus) { - - @Override - protected boolean accepted(Object o) { - return true; - } - - }); - - list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_HANDLER, HANDLER_CONTAINER__HANDLERS, element, Messages.PartDescriptorEditor_Handlers) { - - @Override - protected boolean accepted(Object o) { - return true; - } - - }); - - MPartDescriptor window = (MPartDescriptor) element; - if (window.getToolbar() != null) { - list.add(0, window.getToolbar()); - } - - PART__TOOLBAR.observe(element).addValueChangeListener(new IValueChangeListener() { - - @Override - public void handleValueChange(ValueChangeEvent event) { - if (event.diff.getOldValue() != null) { - list.remove(event.diff.getOldValue()); - if (getMaster().getValue() == element && !createRemoveToolBar.isDisposed()) { - createRemoveToolBar.setSelection(false); - } - - } - - if (event.diff.getNewValue() != null) { - list.add(0, event.diff.getNewValue()); - if (getMaster().getValue() == element && !createRemoveToolBar.isDisposed()) { - createRemoveToolBar.setSelection(true); - } - } - } - }); - - return list; - } - - @Override - public String getDetailLabel(Object element) { - return getLocalizedLabel((MUILabel) element); - } - - @Override - public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__LABEL) }; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java deleted file mode 100644 index 609304a3..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ /dev/null @@ -1,490 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2014 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Steven Spungin <steven@spungin.tv> - Bug 424730, Bug 437951, Ongoing Maintenance - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import javax.inject.Inject; - -import org.eclipse.core.databinding.Binding; -import org.eclipse.core.databinding.UpdateValueStrategy; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.list.WritableList; -import org.eclipse.core.databinding.observable.value.IObservableValue; -import org.eclipse.core.databinding.observable.value.IValueChangeListener; -import org.eclipse.core.databinding.observable.value.ValueChangeEvent; -import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.core.databinding.property.value.IValueProperty; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.core.di.annotations.Optional; -import org.eclipse.e4.tools.emf.ui.common.ContributionURIValidator; -import org.eclipse.e4.tools.emf.ui.common.IContributionClassCreator; -import org.eclipse.e4.tools.emf.ui.common.ImageTooltip; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.PartIconDialogEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.objectdata.ObjectViewer; -import org.eclipse.e4.tools.emf.ui.internal.common.uistructure.UIViewer; -import org.eclipse.e4.ui.model.application.MContribution; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.MUIElement; -import org.eclipse.e4.ui.model.application.ui.MUILabel; -import org.eclipse.e4.ui.model.application.ui.basic.MPart; -import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; -import org.eclipse.e4.ui.model.application.ui.menu.MToolBar; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Link; -import org.eclipse.swt.widgets.Text; - -public class PartEditor extends AbstractComponentEditor { - - private Composite composite; - private EMFDataBindingContext context; - - private final IListProperty PART__MENUS = EMFProperties.list(BasicPackageImpl.Literals.PART__MENUS); - private final IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties - .list(CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS); - private final IValueProperty PART__TOOLBAR = EMFProperties.value(BasicPackageImpl.Literals.PART__TOOLBAR); - private Button createRemoveToolBar; - private StackLayout stackLayout; - - @Inject - @Optional - private IProject project; - - @Inject - IEclipseContext eclipseContext; - - @Inject - public PartEditor() { - super(); - } - - @Override - public Image getImage(Object element, Display display) { - if (element instanceof MUIElement) { - if (((MUIElement) element).isToBeRendered()) { - return createImage(ResourceProvider.IMG_Part); - } - return createImage(ResourceProvider.IMG_Tbr_Part); - } - - return null; - } - - @Override - public String getLabel(Object element) { - if (element == BasicPackageImpl.Literals.INPUT_PART) { - return Messages.PartEditor_InputPart; - } - return Messages.PartEditor_Label; - } - - @Override - public String getDescription(Object element) { - return Messages.PartEditor_Description; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - if (createRemoveToolBar != null) { - createRemoveToolBar.setSelection(((MPart) object).getToolbar() != null); - } - - getMaster().setValue(object); - enableIdGenerator(UiPackageImpl.Literals.UI_LABEL__LABEL, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID, null); - - return composite; - } - - protected Composite createForm(Composite parent, EMFDataBindingContext context, IObservableValue master, - boolean isImport) { - final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - CTabItem item = new CTabItem(folder, SWT.BORDER); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { - ControlFactory.createXMIId(parent, this); - } - - final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (isImport) { - ControlFactory.createFindImport(parent, Messages, this, context); - folder.setSelection(0); - return folder; - } - - ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, - EMFEditProperties - .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); - ControlFactory.createTextField(parent, Messages.PartEditor_LabelLabel, master, context, textProp, - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL)); - ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, master, context, - textProp, - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); - ControlFactory.createTextField(parent, Messages.PartEditor_Tooltip, master, context, textProp, - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP)); - - // ------------------------------------------------------------ - { - final Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartEditor_IconURI); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - l.setToolTipText(Messages.PartEditor_IconURI_Tooltip); - - final Text t = new Text(parent, SWT.BORDER); - TextPasteHandler.createFor(t); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue( - textProp.observeDelayed(200, t), - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail( - master)); - - new ImageTooltip(t, Messages) { - - @Override - protected URI getImageURI() { - final MUILabel part = (MUILabel) getMaster().getValue(); - final String uri = part.getIconURI(); - if (uri == null || uri.trim().length() == 0) { - return null; - } - return URI.createURI(part.getIconURI()); - } - }; - - final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); - b.setText(Messages.ModelTooling_Common_FindEllipsis); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - final PartIconDialogEditor dialog = new PartIconDialogEditor(b.getShell(), eclipseContext, project, - getEditingDomain(), (MPart) getMaster().getValue(), Messages); - dialog.open(); - } - }); - } - - // ------------------------------------------------------------ - final Link lnk; - { - final IContributionClassCreator c = getEditor().getContributionCreator(BasicPackageImpl.Literals.PART); - if (project != null && c != null) { - lnk = new Link(parent, SWT.NONE); - lnk.setText("<A>" + Messages.PartEditor_ClassURI + "</A>"); //$NON-NLS-1$//$NON-NLS-2$ - lnk.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - lnk.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - c.createOpen((MContribution) getMaster().getValue(), getEditingDomain(), project, - lnk.getShell()); - } - }); - } else { - // Dispose the lnk widget, which is unused in this else branch - // and screws up the layout: see https://bugs.eclipse.org/421369 - lnk = null; - - final Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartEditor_ClassURI); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - } - - final Text t = new Text(parent, SWT.BORDER); - TextPasteHandler.createFor(t); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - t.addModifyListener(new ModifyListener() { - - @Override - public void modifyText(ModifyEvent e) { - // lnk might be disposed if else branch above taken - if (lnk != null) { - lnk.setToolTipText(((Text) e.getSource()).getText()); - } - } - }); - final Binding binding = context.bindValue( - textProp.observeDelayed(200, t), - EMFEditProperties.value(getEditingDomain(), - ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(master), - new UpdateValueStrategy().setAfterConvertValidator(new ContributionURIValidator()), - new UpdateValueStrategy()); - Util.addDecoration(t, binding); - - final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); - b.setText(Messages.ModelTooling_Common_FindEllipsis); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - final ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(), eclipseContext, - getEditingDomain(), (MContribution) getMaster().getValue(), - ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI, Messages); - dialog.open(); - } - }); - } - - // ------------------------------------------------------------ - ControlFactory.createTextField(parent, Messages.PartEditor_ContainerData, master, context, textProp, - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__CONTAINER_DATA)); - - createSubformElements(parent, context, master); - - { - final Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartEditor_ToolBar); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - createRemoveToolBar = new Button(parent, SWT.CHECK); - createRemoveToolBar.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - final MPart window = (MPart) getMaster().getValue(); - if (window.getToolbar() == null) { - addToolBar(); - } else { - removeToolBar(); - } - } - }); - createRemoveToolBar.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 2, 1)); - } - - ControlFactory.createCheckBox(parent, Messages.PartEditor_Closeable, Messages.PartEditor_Closeable_Tooltip, - getMaster(), context, WidgetProperties.selection(), - EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.PART__CLOSEABLE)); - - // ------------------------------------------------------------ - ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, - WidgetProperties.selection(), - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); - ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, - WidgetProperties.selection(), - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - - ControlFactory.createBindingContextWiget(parent, Messages, this, Messages.PartEditor_BindingContexts); - ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Context_Properties, - UiPackageImpl.Literals.CONTEXT__PROPERTIES, VERTICAL_LIST_WIDGET_INDENT); - - item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabSupplementary); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_Context_Variables, - Messages.ModelTooling_Context_Variables_Tooltip, UiPackageImpl.Literals.CONTEXT__VARIABLES, - VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - - if (project == null) { - createInstanceInspection(folder); - createUITreeInspection(folder); - } - - createContributedEditorTabs(folder, context, getMaster(), MPart.class); - - folder.setSelection(0); - - return folder; - } - - private void createInstanceInspection(CTabFolder folder) { - final CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_RuntimeContributionInstance); - final Composite container = new Composite(folder, SWT.NONE); - container.setLayout(new GridLayout()); - item.setControl(container); - - final ObjectViewer objectViewer = new ObjectViewer(); - final TreeViewer viewer = objectViewer.createViewer(container, - ApplicationPackageImpl.Literals.CONTRIBUTION__OBJECT, getMaster(), resourcePool, Messages); - viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); - } - - private void createUITreeInspection(CTabFolder folder) { - final CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_RuntimeWidgetTree); - final Composite container = new Composite(folder, SWT.NONE); - container.setLayout(new GridLayout()); - item.setControl(container); - - final UIViewer objectViewer = new UIViewer(); - final TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET, - getMaster(), resourcePool, Messages); - viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); - } - - private void addToolBar() { - final MToolBar menu = MMenuFactory.INSTANCE.createToolBar(); - setElementId(menu); - - final Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), - BasicPackageImpl.Literals.PART__TOOLBAR, menu); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - - private void removeToolBar() { - final Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), - BasicPackageImpl.Literals.PART__TOOLBAR, null); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - - protected void createSubformElements(Composite parent, EMFDataBindingContext context, IObservableValue master) { - - } - - @Override - public IObservableList getChildList(final Object element) { - final WritableList list = new WritableList(); - - if (getEditor().isModelFragment() && Util.isImport((EObject) element)) { - return list; - } - - list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_PART_MENU, PART__MENUS, element, - Messages.PartEditor_Menus) { - - @Override - protected boolean accepted(Object o) { - return true; - } - - }); - - list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_HANDLER, HANDLER_CONTAINER__HANDLERS, element, - Messages.PartEditor_Handlers) { - - @Override - protected boolean accepted(Object o) { - return true; - } - - }); - - final MPart window = (MPart) element; - if (window.getToolbar() != null) { - list.add(0, window.getToolbar()); - } - - PART__TOOLBAR.observe(element).addValueChangeListener(new IValueChangeListener() { - - @Override - public void handleValueChange(ValueChangeEvent event) { - if (event.diff.getOldValue() != null) { - list.remove(event.diff.getOldValue()); - if (getMaster().getValue() == element && !createRemoveToolBar.isDisposed()) { - createRemoveToolBar.setSelection(false); - } - - } - - if (event.diff.getNewValue() != null) { - list.add(0, event.diff.getNewValue()); - if (getMaster().getValue() == element && !createRemoveToolBar.isDisposed()) { - createRemoveToolBar.setSelection(true); - } - } - } - }); - - return list; - } - - @Override - public String getDetailLabel(Object element) { - return getLocalizedLabel((MUILabel) element); - } - - @Override - public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__LABEL), - FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) }; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java deleted file mode 100644 index 275dc823..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java +++ /dev/null @@ -1,422 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Steven Spungin <steven@spungin.tv> - Ongoing maintenance - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.util.ArrayList; -import java.util.List; - -import javax.annotation.PostConstruct; -import javax.inject.Inject; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.core.di.annotations.Optional; -import org.eclipse.e4.tools.emf.ui.common.IEditorFeature.FeatureClass; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.E4PickList; -import org.eclipse.e4.tools.emf.ui.internal.common.FeatureClassLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.uistructure.UIViewer; -import org.eclipse.e4.tools.emf.ui.internal.imp.ModelImportWizard; -import org.eclipse.e4.tools.emf.ui.internal.imp.RegistryUtil; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.MUIElement; -import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; -import org.eclipse.e4.ui.model.application.ui.basic.MPart; -import org.eclipse.e4.ui.model.application.ui.basic.MPartSashContainer; -import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.IEMFListProperty; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.databinding.viewers.IViewerValueProperty; -import org.eclipse.jface.databinding.viewers.ViewerProperties; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.ComboViewer; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.window.Window; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; - -public class PartSashContainerEditor extends AbstractComponentEditor { - - private Composite composite; - private EMFDataBindingContext context; - - private final IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties - .list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - private StackLayout stackLayout; - private final List<Action> actions = new ArrayList<Action>(); - private final List<Action> actionsImport = new ArrayList<Action>(); - - @Inject - @Optional - private IProject project; - - @Inject - private Shell shell; - - @Inject - public PartSashContainerEditor() { - super(); - } - - @PostConstruct - void init() { - actions.add(new Action(Messages.PartSashContainerEditor_AddPartSashContainer, - createImageDescriptor(ResourceProvider.IMG_PartSashContainer)) { - @Override - public void run() { - handleAddChild(BasicPackageImpl.Literals.PART_SASH_CONTAINER); - } - }); - actions.add(new Action(Messages.PartSashContainerEditor_AddPartStack, - createImageDescriptor(ResourceProvider.IMG_PartStack)) { - @Override - public void run() { - handleAddChild(BasicPackageImpl.Literals.PART_STACK); - } - }); - actions.add(new Action(Messages.PartSashContainerEditor_AddPart, - createImageDescriptor(ResourceProvider.IMG_Part)) { - @Override - public void run() { - handleAddChild(BasicPackageImpl.Literals.PART); - } - }); - - actions.add(new Action(Messages.PartSashContainerEditor_AddArea, - createImageDescriptor(ResourceProvider.IMG_Area)) { - @Override - public void run() { - handleAddChild(AdvancedPackageImpl.Literals.AREA); - } - }); - actions.add(new Action(Messages.PartSashContainerEditor_AddPlaceholder, - createImageDescriptor(ResourceProvider.IMG_Placeholder)) { - @Override - public void run() { - handleAddChild(AdvancedPackageImpl.Literals.PLACEHOLDER); - } - }); - for (final FeatureClass c : getEditor().getFeatureClasses(BasicPackageImpl.Literals.PART_STACK, - UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN)) { - final EClass ec = c.eClass; - actions.add(new Action(c.label, createImageDescriptor(c.iconId)) { - @Override - public void run() { - handleAddChild(ec); - } - }); - } - - // --- Import Actions --- - actionsImport.add(new Action("Views", createImageDescriptor(ResourceProvider.IMG_Part)) { //$NON-NLS-1$ - @Override - public void run() { - handleImportChild(BasicPackageImpl.Literals.PART, RegistryUtil.HINT_VIEW); - } - }); - actionsImport.add(new Action("Editors", createImageDescriptor(ResourceProvider.IMG_Part)) { //$NON-NLS-1$ - @Override - public void run() { - handleImportChild(BasicPackageImpl.Literals.INPUT_PART, RegistryUtil.HINT_EDITOR); - } - }); - - } - - @Override - public Image getImage(Object element, Display display) { - final boolean horizontal = ((MPartSashContainer) element).isHorizontal(); - - if (!horizontal) { - final MUIElement uiElement = (MUIElement) element; - if (uiElement.isToBeRendered() && uiElement.isVisible()) { - return createImage(ResourceProvider.IMG_PartSashContainer_vertical); - } - return createImage(ResourceProvider.IMG_Tbr_PartSashContainer_vertical); - } - - if (horizontal) { - final MUIElement uiElement = (MUIElement) element; - if (uiElement.isToBeRendered() && uiElement.isVisible()) { - return createImage(ResourceProvider.IMG_PartSashContainer); - } - return createImage(ResourceProvider.IMG_Tbr_PartSashContainer); - } - return null; - } - - @Override - public String getLabel(Object element) { - return Messages.PartSashContainerEditor_Label; - } - - @Override - public String getDescription(Object element) { - return Messages.PartSashContainerEditor_Description; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - getMaster().setValue(object); - return composite; - } - - private Composite createForm(Composite parent, final EMFDataBindingContext context, WritableValue master, - boolean isImport) { - final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { - ControlFactory.createXMIId(parent, this); - } - - final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (isImport) { - ControlFactory.createFindImport(parent, Messages, this, context); - folder.setSelection(0); - return folder; - } - - ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, - EMFEditProperties - .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); - ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), - context, textProp, - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); - - // ------------------------------------------------------------ - { - final Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartSashContainerEditor_Orientation); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - final ComboViewer viewer = new ComboViewer(parent); - final GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - viewer.getControl().setLayoutData(gd); - viewer.setContentProvider(new ArrayContentProvider()); - viewer.setLabelProvider(new LabelProvider() { - @Override - public String getText(Object element) { - return ((Boolean) element).booleanValue() ? Messages.PartSashContainerEditor_Horizontal - : Messages.PartSashContainerEditor_Vertical; - } - }); - viewer.setInput(new Boolean[] { Boolean.TRUE, Boolean.FALSE }); - final IViewerValueProperty vProp = ViewerProperties.singleSelection(); - context.bindValue(vProp.observe(viewer), - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.GENERIC_TILE__HORIZONTAL) - .observeDetail(getMaster())); - } - - ControlFactory.createSelectedElement(parent, this, context, Messages.PartSashContainerEditor_SelectedElement); - ControlFactory.createTextField(parent, Messages.PartSashContainerEditor_ContainerData, master, context, - textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__CONTAINER_DATA)); - - { - final E4PickList pickList = new E4PickList(parent, SWT.NONE, null, Messages, this, - UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN) { - @Override - protected void addPressed() { - final EClass eClass = ((FeatureClass) ((IStructuredSelection) getSelection()).getFirstElement()).eClass; - handleAddChild(eClass); - } - }; - pickList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1)); - pickList.setText(Messages.PartSashContainerEditor_Controls); - - pickList.setLabelProvider(new FeatureClassLabelProvider(getEditor())); - - final List<FeatureClass> eClassList = new ArrayList<FeatureClass>(); - eClassList.add(new FeatureClass("PartSashContainer", BasicPackageImpl.Literals.PART_SASH_CONTAINER)); //$NON-NLS-1$ - eClassList.add(new FeatureClass("PartStack", BasicPackageImpl.Literals.PART_STACK)); //$NON-NLS-1$ - eClassList.add(new FeatureClass("Part", BasicPackageImpl.Literals.PART)); //$NON-NLS-1$ - eClassList.add(new FeatureClass("InputPart", BasicPackageImpl.Literals.INPUT_PART)); //$NON-NLS-1$ - eClassList.add(new FeatureClass("Area", AdvancedPackageImpl.Literals.AREA)); //$NON-NLS-1$ - eClassList.add(new FeatureClass("Placeholder", AdvancedPackageImpl.Literals.PLACEHOLDER)); //$NON-NLS-1$ - eClassList.addAll(getEditor().getFeatureClasses(BasicPackageImpl.Literals.PART_SASH_CONTAINER, - UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN)); - pickList.setInput(eClassList); - pickList.setSelection(new StructuredSelection(eClassList.get(0))); - - final TableViewer viewer = pickList.getList(); - final IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - viewer.setInput(prop.observeDetail(getMaster())); - } - - ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, - WidgetProperties.selection(), - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); - ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, - WidgetProperties.selection(), - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - - item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabSupplementary); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); - - if (project == null) { - createUITreeInspection(folder); - } - - createContributedEditorTabs(folder, context, getMaster(), MPartSashContainer.class); - - folder.setSelection(0); - - return folder; - } - - private void createUITreeInspection(CTabFolder folder) { - final CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_RuntimeWidgetTree); - final Composite container = new Composite(folder, SWT.NONE); - container.setLayout(new GridLayout()); - item.setControl(container); - - final UIViewer objectViewer = new UIViewer(); - final TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET, - getMaster(), resourcePool, Messages); - viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); - } - - @Override - public IObservableList getChildList(Object element) { - return ELEMENT_CONTAINER__CHILDREN.observe(element); - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.GENERIC_TILE__HORIZONTAL), - FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) }; - } - - protected void handleAddChild(EClass eClass) { - final EObject eObject = EcoreUtil.create(eClass); - addToModel(eObject); - } - - private void addToModel(EObject eObject) { - setElementId(eObject); - - final Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), - UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(eObject); - } - } - - protected void handleImportChild(EClass eClass, String hint) { - - if (eClass == BasicPackageImpl.Literals.PART) { - final ModelImportWizard wizard = new ModelImportWizard(MPart.class, this, hint, resourcePool); - final WizardDialog wizardDialog = new WizardDialog(shell, wizard); - if (wizardDialog.open() == Window.OK) { - final MPart[] parts = (MPart[]) wizard.getElements(MPart.class); - for (final MPart part : parts) { - addToModel((EObject) part); - } - } - } - } - - @Override - public List<Action> getActions(Object element) { - final ArrayList<Action> l = new ArrayList<Action>(super.getActions(element)); - l.addAll(actions); - return l; - } - - @Override - public List<Action> getActionsImport(Object element) { - final ArrayList<Action> l = new ArrayList<Action>(super.getActionsImport(element)); - l.addAll(actionsImport); - return l; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java deleted file mode 100644 index aa35b8d0..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java +++ /dev/null @@ -1,381 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Steven Spungin <steven@spungin.tv> - Ongoing maintenance - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.util.ArrayList; -import java.util.List; - -import javax.annotation.PostConstruct; -import javax.inject.Inject; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.core.di.annotations.Optional; -import org.eclipse.e4.tools.emf.ui.common.IEditorFeature.FeatureClass; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.E4PickList; -import org.eclipse.e4.tools.emf.ui.internal.common.FeatureClassLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.uistructure.UIViewer; -import org.eclipse.e4.tools.emf.ui.internal.imp.ModelImportWizard; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.MUIElement; -import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; -import org.eclipse.e4.ui.model.application.ui.basic.MInputPart; -import org.eclipse.e4.ui.model.application.ui.basic.MPart; -import org.eclipse.e4.ui.model.application.ui.basic.MPartStack; -import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.IEMFListProperty; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.window.Window; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; - -@SuppressWarnings("deprecation") -public class PartStackEditor extends AbstractComponentEditor { - - private Composite composite; - private EMFDataBindingContext context; - - private final IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties - .list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - private StackLayout stackLayout; - private final List<Action> actions = new ArrayList<Action>(); - private final List<Action> actionsImport = new ArrayList<Action>(); - - @Inject - @Optional - private IProject project; - private TableViewer viewer; - - @Inject - public PartStackEditor() { - super(); - } - - @PostConstruct - void init() { - actions.add(new Action(Messages.PartStackEditor_AddPart, createImageDescriptor(ResourceProvider.IMG_Part)) { - @Override - public void run() { - handleAddChild(BasicPackageImpl.Literals.PART); - } - }); - actions.add(new Action(Messages.PartStackEditor_AddCompositePart, - createImageDescriptor(ResourceProvider.IMG_PartSashContainer)) { - @Override - public void run() { - handleAddChild(BasicPackageImpl.Literals.COMPOSITE_PART); - } - }); - actions.add(new Action(Messages.PartStackEditor_AddPlaceholder, - createImageDescriptor(ResourceProvider.IMG_Placeholder)) { - @Override - public void run() { - handleAddChild(AdvancedPackageImpl.Literals.PLACEHOLDER); - } - }); - - final List<FeatureClass> list = getEditor().getFeatureClasses(BasicPackageImpl.Literals.PART_STACK, - UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - - if (!list.isEmpty()) { - for (final FeatureClass c : list) { - final EClass ec = c.eClass; - actions.add(new Action(c.label, createImageDescriptor(c.iconId)) { - @Override - public void run() { - handleAddChild(ec); - } - }); - } - } - - // --- Import Actions --- - actionsImport.add(new Action(Messages.PartStackEditor_Views, createImageDescriptor(ResourceProvider.IMG_Part)) { - @Override - public void run() { - handleImportChild(BasicPackageImpl.Literals.PART); - } - }); - actionsImport - .add(new Action(Messages.PartStackEditor_Editors, createImageDescriptor(ResourceProvider.IMG_Part)) { - @Override - public void run() { - handleImportChild(BasicPackageImpl.Literals.INPUT_PART); - } - }); - - } - - @Override - public Image getImage(Object element, Display display) { - if (element instanceof MUIElement) { - if (((MUIElement) element).isToBeRendered()) { - return createImage(ResourceProvider.IMG_Part); - } - return createImage(ResourceProvider.IMG_Tbr_Part); - } - - return null; - } - - @Override - public String getLabel(Object element) { - return Messages.PartStackEditor_Label; - } - - @Override - public String getDescription(Object element) { - return Messages.PartStackEditor_Description; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - final IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - viewer.setInput(prop.observeDetail(getMaster())); - getMaster().setValue(object); - return composite; - } - - private Composite createForm(Composite parent, final EMFDataBindingContext context, WritableValue master, - boolean isImport) { - final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { - ControlFactory.createXMIId(parent, this); - } - - final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (isImport) { - ControlFactory.createFindImport(parent, Messages, this, context); - folder.setSelection(0); - return folder; - } - - ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, - EMFEditProperties - .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); - ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), - context, textProp, - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); - ControlFactory.createSelectedElement(parent, this, context, Messages.PartStackEditor_SelectedElement); - ControlFactory.createTextField(parent, Messages.PartStackEditor_ContainerData, master, context, textProp, - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__CONTAINER_DATA)); - - // ------------------------------------------------------------ - { - - final E4PickList pickList = new E4PickList(parent, SWT.NONE, null, Messages, this, - UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN) { - @Override - protected void addPressed() { - final EClass eClass = ((FeatureClass) ((IStructuredSelection) getSelection()).getFirstElement()).eClass; - handleAddChild(eClass); - } - }; - pickList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1)); - pickList.setText(Messages.PartStackEditor_Parts); - - viewer = pickList.getList(); - final IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - viewer.setInput(prop.observeDetail(getMaster())); - - pickList.setLabelProvider(new FeatureClassLabelProvider(getEditor())); - - final List<FeatureClass> eClassList = new ArrayList<FeatureClass>(); - eClassList.add(new FeatureClass(Messages.PartStackEditor_Part, BasicPackageImpl.Literals.PART)); - eClassList.add(new FeatureClass(Messages.PartStackEditor_CompositePart, - BasicPackageImpl.Literals.COMPOSITE_PART)); - eClassList.add(new FeatureClass(Messages.PartStackEditor_Placeholder, - AdvancedPackageImpl.Literals.PLACEHOLDER)); - eClassList.addAll(getEditor().getFeatureClasses(BasicPackageImpl.Literals.PART_STACK, - UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN)); - pickList.setInput(eClassList); - pickList.setSelection(new StructuredSelection(eClassList.get(0))); - - } - - ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, - WidgetProperties.selection(), - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); - ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, - WidgetProperties.selection(), - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - - item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabSupplementary); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); - - if (project == null) { - createUITreeInspection(folder); - } - - createContributedEditorTabs(folder, context, getMaster(), MPartStack.class); - - folder.setSelection(0); - - return folder; - } - - private void createUITreeInspection(CTabFolder folder) { - final CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_RuntimeWidgetTree); - final Composite container = new Composite(folder, SWT.NONE); - container.setLayout(new GridLayout()); - item.setControl(container); - - final UIViewer objectViewer = new UIViewer(); - final TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET, - getMaster(), resourcePool, Messages); - viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); - } - - @Override - public IObservableList getChildList(Object element) { - return ELEMENT_CONTAINER__CHILDREN.observe(element); - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) }; - } - - protected void handleAddChild(EClass eClass) { - final EObject eObject = EcoreUtil.create(eClass); - addToModel(eObject); - } - - private void addToModel(EObject eObject) { - setElementId(eObject); - - final Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), - UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(eObject); - } - } - - protected void handleImportChild(EClass eClass) { - - if (eClass == BasicPackageImpl.Literals.PART) { - final ModelImportWizard wizard = new ModelImportWizard(MPart.class, this, resourcePool); - final WizardDialog wizardDialog = new WizardDialog(viewer.getControl().getShell(), wizard); - if (wizardDialog.open() == Window.OK) { - final MPart[] parts = (MPart[]) wizard.getElements(MPart.class); - for (final MPart part : parts) { - addToModel((EObject) part); - } - } - } - - if (eClass == BasicPackageImpl.Literals.INPUT_PART) { - final ModelImportWizard wizard = new ModelImportWizard(MInputPart.class, this, resourcePool); - final WizardDialog wizardDialog = new WizardDialog(viewer.getControl().getShell(), wizard); - if (wizardDialog.open() == Window.OK) { - final MPart[] parts = (MPart[]) wizard.getElements(MInputPart.class); - for (final MPart part : parts) { - addToModel((EObject) part); - } - } - } - } - - @Override - public List<Action> getActions(Object element) { - final ArrayList<Action> l = new ArrayList<Action>(super.getActions(element)); - l.addAll(actions); - return l; - } - - @Override - public List<Action> getActionsImport(Object element) { - final ArrayList<Action> l = new ArrayList<Action>(super.getActionsImport(element)); - l.addAll(actionsImport); - return l; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java deleted file mode 100644 index e19b6565..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java +++ /dev/null @@ -1,373 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Steven Spungin <steven@spungin.tv> - Bug 424730, Bug 437951 - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.util.ArrayList; -import java.util.List; - -import javax.annotation.PostConstruct; -import javax.inject.Inject; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.list.WritableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.core.di.annotations.Optional; -import org.eclipse.e4.tools.emf.ui.common.ImageTooltip; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.PerspectiveIconDialogEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.uistructure.UIViewer; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.MUIElement; -import org.eclipse.e4.ui.model.application.ui.MUILabel; -import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective; -import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; -import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class PerspectiveEditor extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - - private final IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties - .list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - private final IListProperty PERSPECTIVE__WINDOWS = EMFProperties - .list(AdvancedPackageImpl.Literals.PERSPECTIVE__WINDOWS); - private StackLayout stackLayout; - private final List<Action> actions = new ArrayList<Action>(); - - @Inject - @Optional - private IProject project; - - @Inject - IEclipseContext eclipseContext; - - @Inject - public PerspectiveEditor() { - super(); - } - - @PostConstruct - void init() { - actions.add(new Action(Messages.PerspectiveEditor_AddPartSashContainer, - createImageDescriptor(ResourceProvider.IMG_Perspective)) { - @Override - public void run() { - handleAddChild(BasicPackageImpl.Literals.PART_SASH_CONTAINER); - } - }); - actions.add(new Action(Messages.PerspectiveEditor_AddPartStack, - createImageDescriptor(ResourceProvider.IMG_PartStack)) { - @Override - public void run() { - handleAddChild(BasicPackageImpl.Literals.PART_STACK); - } - }); - actions.add(new Action(Messages.PerspectiveEditor_AddPart, createImageDescriptor(ResourceProvider.IMG_Part)) { - @Override - public void run() { - handleAddChild(BasicPackageImpl.Literals.PART); - } - }); - actions.add(new Action(Messages.PerspectiveEditor_AddArea, createImageDescriptor(ResourceProvider.IMG_Area)) { - @Override - public void run() { - handleAddChild(AdvancedPackageImpl.Literals.AREA); - } - }); - actions.add(new Action(Messages.PerspectiveEditor_AddPlaceholder, - createImageDescriptor(ResourceProvider.IMG_Placeholder)) { - @Override - public void run() { - handleAddChild(AdvancedPackageImpl.Literals.PLACEHOLDER); - } - }); - } - - @Override - public Image getImage(Object element, Display display) { - if (element instanceof MUIElement) { - final MUIElement uiElement = (MUIElement) element; - if (uiElement.isToBeRendered() && uiElement.isVisible()) { - return createImage(ResourceProvider.IMG_Perspective); - } - return createImage(ResourceProvider.IMG_Tbr_Perspective); - } - - return null; - } - - @Override - public String getLabel(Object element) { - return Messages.PerspectiveEditor_Label; - } - - @Override - public String getDetailLabel(Object element) { - return getLocalizedLabel((MUILabel) element); - } - - @Override - public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__LABEL), - FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) }; - } - - @Override - public String getDescription(Object element) { - return Messages.PerspectiveEditor_Description; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - getMaster().setValue(object); - enableIdGenerator(UiPackageImpl.Literals.UI_LABEL__LABEL, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID, null); - return composite; - } - - private Composite createForm(Composite parent, final EMFDataBindingContext context, WritableValue master, - boolean isImport) { - final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { - ControlFactory.createXMIId(parent, this); - } - - final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (isImport) { - ControlFactory.createFindImport(parent, Messages, this, context); - folder.setSelection(0); - return folder; - } - - ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, - EMFEditProperties - .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); - ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), - context, textProp, - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); - ControlFactory.createSelectedElement(parent, this, context, Messages.PerspectiveEditor_SelectedElement); - ControlFactory.createTranslatedTextField(parent, Messages.PerspectiveEditor_LabelLabel, getMaster(), context, - textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL), - resourcePool, project); - ControlFactory.createTranslatedTextField(parent, Messages.PerspectiveEditor_Tooltip, getMaster(), context, - textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP), - resourcePool, project); - - // ------------------------------------------------------------ - { - final Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PerspectiveEditor_IconURI); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - final Text t = new Text(parent, SWT.BORDER); - TextPasteHandler.createFor(t); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue( - textProp.observeDelayed(200, t), - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail( - master)); - - new ImageTooltip(t, Messages) { - - @Override - protected URI getImageURI() { - final MUILabel part = (MUILabel) getMaster().getValue(); - final String uri = part.getIconURI(); - if (uri == null || uri.trim().length() == 0) { - return null; - } - return URI.createURI(part.getIconURI()); - } - }; - - final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelTooling_Common_FindEllipsis); - b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - final PerspectiveIconDialogEditor dialog = new PerspectiveIconDialogEditor(b.getShell(), - eclipseContext, project, getEditingDomain(), (MPerspective) getMaster().getValue(), Messages); - dialog.open(); - } - }); - } - - ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, - WidgetProperties.selection(), - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); - ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, - WidgetProperties.selection(), - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - - final Composite comp0 = ControlFactory.createMapProperties(parent, Messages, this, - Messages.ModelTooling_Context_Properties, UiPackageImpl.Literals.CONTEXT__PROPERTIES, - VERTICAL_LIST_WIDGET_INDENT); - comp0.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 3, 1)); - - final Composite comp = ControlFactory.createStringListWidget(parent, Messages, this, - Messages.ModelTooling_Context_Variables, UiPackageImpl.Literals.CONTEXT__VARIABLES, - VERTICAL_LIST_WIDGET_INDENT); - comp.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 3, 1)); - - item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabSupplementary); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); - - if (project == null) { - createUITreeInspection(folder); - } - - createContributedEditorTabs(folder, context, getMaster(), MPerspective.class); - - folder.setSelection(0); - - return folder; - } - - private void createUITreeInspection(CTabFolder folder) { - final CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_RuntimeWidgetTree); - final Composite container = new Composite(folder, SWT.NONE); - container.setLayout(new GridLayout()); - item.setControl(container); - - final UIViewer objectViewer = new UIViewer(); - final TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET, - getMaster(), resourcePool, Messages); - viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); - } - - @Override - public IObservableList getChildList(Object element) { - final WritableList list = new WritableList(); - list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_PERSPECTIVE_WINDOWS, PERSPECTIVE__WINDOWS, element, - Messages.WindowEditor_Windows) { - - @Override - protected boolean accepted(Object o) { - return true; - } - }); - - list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_PERSPECTIVE_CONTROLS, ELEMENT_CONTAINER__CHILDREN, - element, Messages.PerspectiveEditor_Controls) { - - @Override - protected boolean accepted(Object o) { - return true; - } - }); - - return list; - } - - protected void handleAddChild(EClass eClass) { - final EObject eObject = EcoreUtil.create(eClass); - setElementId(eObject); - - final Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), - UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(eObject); - } - } - - @Override - public List<Action> getActions(Object element) { - final ArrayList<Action> l = new ArrayList<Action>(super.getActions(element)); - l.addAll(actions); - return l; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java deleted file mode 100644 index 5c316be2..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java +++ /dev/null @@ -1,312 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Steven Spungin <steven@spungin.tv> - Ongoing maintenance - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import javax.annotation.PostConstruct; -import javax.inject.Inject; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.core.di.annotations.Optional; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.AbstractPickList.PickListFeatures; -import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.E4PickList; -import org.eclipse.e4.tools.emf.ui.internal.common.uistructure.UIViewer; -import org.eclipse.e4.tools.emf.ui.internal.imp.ModelImportWizard; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.MUIElement; -import org.eclipse.e4.ui.model.application.ui.advanced.MAdvancedFactory; -import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective; -import org.eclipse.e4.ui.model.application.ui.advanced.MPerspectiveStack; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.IEMFListProperty; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.window.Window; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; - -public class PerspectiveStackEditor extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - - private final IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties - .list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - private StackLayout stackLayout; - private final List<Action> actions = new ArrayList<Action>(); - private final List<Action> actionsImport = new ArrayList<Action>(); - - @Inject - @Optional - private IProject project; - - @Inject - public PerspectiveStackEditor() { - super(); - } - - @Inject - Shell shell; - - @PostConstruct - void init() { - actions.add(new Action(Messages.PerspectiveStackEditor_AddPerspective, - createImageDescriptor(ResourceProvider.IMG_Perspective)) { - @Override - public void run() { - handleAddPerspective(); - } - }); - - // --- import --- - actionsImport.add(new Action(Messages.PerspectiveStackEditor_AddPerspective, - createImageDescriptor(ResourceProvider.IMG_Perspective)) { - @Override - public void run() { - handleImportPerspective(); - } - }); - } - - @Override - public Image getImage(Object element, Display display) { - if (element instanceof MUIElement) { - final MUIElement uiElement = (MUIElement) element; - if (uiElement.isToBeRendered() && uiElement.isVisible()) { - return createImage(ResourceProvider.IMG_PerspectiveStack); - } - return createImage(ResourceProvider.IMG_Tbr_PerspectiveStack); - } - - return null; - } - - @Override - public String getLabel(Object element) { - return Messages.PerspectiveStackEditor_Label; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return Messages.PerspectiveStackEditor_Description; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - getMaster().setValue(object); - return composite; - } - - private Composite createForm(Composite parent, final EMFDataBindingContext context, WritableValue master, - boolean isImport) { - final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { - ControlFactory.createXMIId(parent, this); - } - - final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (isImport) { - ControlFactory.createFindImport(parent, Messages, this, context); - folder.setSelection(0); - return folder; - } - - ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, - EMFEditProperties - .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); - ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), - context, textProp, - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); - ControlFactory.createSelectedElement(parent, this, context, Messages.PerspectiveStackEditor_SelectedElement); - - // ------------------------------------------------------------ - { - - final E4PickList pickList = new E4PickList(parent, SWT.NONE, Arrays.asList(PickListFeatures.NO_PICKER), - Messages, this, UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN) { - @Override - protected void addPressed() { - handleAddPerspective(); - } - }; - pickList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1)); - pickList.setText(Messages.PerspectiveStackEditor_Perspectives); - - final TableViewer viewer = pickList.getList(); - viewer.setContentProvider(new ObservableListContentProvider()); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); - final IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - viewer.setInput(prop.observeDetail(getMaster())); - } - - ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, - WidgetProperties.selection(), - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); - ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, - WidgetProperties.selection(), - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - - item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabSupplementary); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); - - if (project == null) { - createUITreeInspection(folder); - } - - createContributedEditorTabs(folder, context, getMaster(), MPerspectiveStack.class); - - folder.setSelection(0); - - return folder; - } - - private void createUITreeInspection(CTabFolder folder) { - final CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_RuntimeWidgetTree); - final Composite container = new Composite(folder, SWT.NONE); - container.setLayout(new GridLayout()); - item.setControl(container); - - final UIViewer objectViewer = new UIViewer(); - final TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET, - getMaster(), resourcePool, Messages); - viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); - } - - @Override - public IObservableList getChildList(Object element) { - return ELEMENT_CONTAINER__CHILDREN.observe(element); - } - - @Override - public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) }; - } - - protected void handleAddPerspective() { - final MPerspective eObject = MAdvancedFactory.INSTANCE.createPerspective(); - addToModel(eObject); - } - - protected void handleImportPerspective() { - final ModelImportWizard wizard = new ModelImportWizard(MPerspective.class, this, resourcePool); - final WizardDialog wizardDialog = new WizardDialog(shell, wizard); - if (wizardDialog.open() == Window.OK) { - final MPerspective[] elements = (MPerspective[]) wizard.getElements(MPerspective.class); - for (final MPerspective category : elements) { - addToModel(category); - } - } - } - - private void addToModel(MPerspective perspective) { - setElementId(perspective); - final Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), - UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, perspective); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(perspective); - } - } - - @Override - public List<Action> getActions(Object element) { - final ArrayList<Action> l = new ArrayList<Action>(super.getActions(element)); - l.addAll(actions); - return l; - } - - @Override - public List<Action> getActionsImport(Object element) { - final ArrayList<Action> l = new ArrayList<Action>(super.getActionsImport(element)); - l.addAll(actionsImport); - return l; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java deleted file mode 100644 index e76ee33f..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java +++ /dev/null @@ -1,273 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import javax.inject.Inject; -import org.eclipse.core.databinding.UpdateValueStrategy; -import org.eclipse.core.databinding.conversion.Converter; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.core.di.annotations.Optional; -import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.SharedElementsDialog; -import org.eclipse.e4.tools.emf.ui.internal.common.uistructure.UIViewer; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.MUIElement; -import org.eclipse.e4.ui.model.application.ui.MUILabel; -import org.eclipse.e4.ui.model.application.ui.advanced.MPlaceholder; -import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class PlaceholderEditor extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - private StackLayout stackLayout; - - @Inject - @Optional - private IProject project; - - @Inject - private IModelResource resource; - - @Inject - public PlaceholderEditor() { - super(); - } - - @Override - public Image getImage(Object element, Display display) { - return createImage(ResourceProvider.IMG_Placeholder); - } - - @Override - public String getLabel(Object element) { - return Messages.PlaceholderEditor_Label; - } - - @Override - public String getDetailLabel(Object element) { - MPlaceholder pl = (MPlaceholder) element; - if (pl.getRef() != null) { - StringBuilder b = new StringBuilder(); - - b.append(((EObject) pl.getRef()).eClass().getName()); - if (pl.getRef() instanceof MUILabel) { - MUILabel label = (MUILabel) pl.getRef(); - String l = getLocalizedLabel(label); - - if (l != null && l.trim().length() > 0) { - b.append(" (" + l + ")"); //$NON-NLS-1$//$NON-NLS-2$ - } else if (label.getTooltip() != null && label.getTooltip().trim().length() > 0) { - b.append(" (" + label.getTooltip() + ")"); //$NON-NLS-1$ //$NON-NLS-2$ - } else { - if (pl.getRef().getElementId() != null && pl.getRef().getElementId().trim().length() > 0) { - b.append(" (" + pl.getRef().getElementId() + ")"); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - } else { - if (pl.getRef().getElementId() != null && pl.getRef().getElementId().trim().length() > 0) { - b.append(" (" + pl.getRef().getElementId() + ")"); //$NON-NLS-1$//$NON-NLS-2$ - } - } - - return b.toString(); - } - - return null; - } - - @Override - public String getDescription(Object element) { - return Messages.PlaceholderEditor_Descriptor; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - getMaster().setValue(object); - return composite; - } - - private Composite createForm(Composite parent, final EMFDataBindingContext context, WritableValue master, boolean isImport) { - CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { - ControlFactory.createXMIId(parent, this); - } - - IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (isImport) { - ControlFactory.createFindImport(parent, Messages, this, context); - folder.setSelection(0); - return folder; - } - - ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); - ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); - ControlFactory.createTextField(parent, Messages.PlaceholderEditor_ContainerData, master, context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__CONTAINER_DATA)); - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PlaceholderEditor_Reference); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - TextPasteHandler.createFor(t); - t.setEditable(false); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - t.setLayoutData(gd); - - UpdateValueStrategy t2m = new UpdateValueStrategy(); - t2m.setConverter(new Converter(String.class, MUIElement.class) { - - @Override - public Object convert(Object fromObject) { - return null; - } - }); - UpdateValueStrategy m2t = new UpdateValueStrategy(); - m2t.setConverter(new Converter(MUIElement.class, String.class) { - - @Override - public Object convert(Object fromObject) { - if (fromObject != null) { - EObject o = (EObject) fromObject; - if (o instanceof MUILabel) { - MUILabel label = (MUILabel) o; - String l = getLocalizedLabel(label); - if (!Util.isNullOrEmpty(l)) { - return o.eClass().getName() + " - " + l; //$NON-NLS-1$ - } - } - - return o.eClass().getName() + " - " + ((MUIElement) fromObject).getElementId(); //$NON-NLS-1$ - } - return null; - } - }); - - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), AdvancedPackageImpl.Literals.PLACEHOLDER__REF).observeDetail(getMaster()), t2m, m2t); - - final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); - b.setText(Messages.ModelTooling_Common_FindEllipsis); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - SharedElementsDialog dialog = new SharedElementsDialog(b.getShell(), getEditor(), (MPlaceholder) getMaster().getValue(), resource, Messages); - dialog.open(); - } - }); - } - - ControlFactory.createCheckBox(parent, Messages.PlaceholderEditor_Closeable, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), AdvancedPackageImpl.Literals.PLACEHOLDER__CLOSEABLE)); - - ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); - ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - - item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabSupplementary); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); - - if (project == null) { - createUITreeInspection(folder); - } - - createContributedEditorTabs(folder, context, getMaster(), MPlaceholder.class); - - folder.setSelection(0); - - return folder; - } - - private void createUITreeInspection(CTabFolder folder) { - CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_RuntimeWidgetTree); - Composite container = new Composite(folder, SWT.NONE); - container.setLayout(new GridLayout()); - item.setControl(container); - - UIViewer objectViewer = new UIViewer(); - TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET, getMaster(), resourcePool, Messages); - viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); - } - - @Override - public IObservableList getChildList(Object element) { - return null; - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PopupMenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PopupMenuEditor.java deleted file mode 100644 index 799ea94c..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PopupMenuEditor.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import javax.inject.Inject; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.swt.widgets.Composite; - -public class PopupMenuEditor extends MenuEditor { - - @Inject - public PopupMenuEditor() { - super(); - } - - @Override - protected Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean rootMenu, boolean isImport) { - Composite comp = super.createForm(parent, context, master, rootMenu, isImport); - if (!isImport) { - ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Context_Properties, UiPackageImpl.Literals.CONTEXT__PROPERTIES, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createStringListWidget(comp, Messages, this, Messages.ModelTooling_Context_Variables, UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); - } - - return comp; - } - - @Override - public String getLabel(Object element) { - return Messages.PopupMenuEditor_TreeLabel; - } - - @Override - public String getDescription(Object element) { - return Messages.PopupMenuEditor_TreeLabelDescription; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java deleted file mode 100644 index fcfd9c0c..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java +++ /dev/null @@ -1,346 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Steven Spungin <steve@spungin.tv> - Ongoing Maintenance, Bug 439532, Bug 443945 - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; - -import javax.annotation.PostConstruct; -import javax.inject.Inject; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.tools.emf.ui.common.IEditorFeature.FeatureClass; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.E4PickList; -import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FeatureSelectionDialog; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindParentReferenceElementDialog; -import org.eclipse.e4.tools.emf.ui.internal.common.component.tabs.empty.E; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.fragment.MStringModelFragment; -import org.eclipse.e4.ui.model.fragment.impl.FragmentPackageImpl; -import org.eclipse.e4.ui.model.fragment.impl.StringModelFragmentImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.IEMFListProperty; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerComparator; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class StringModelFragment extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - - private final IListProperty MODEL_FRAGMENT__ELEMENTS = EMFProperties - .list(FragmentPackageImpl.Literals.MODEL_FRAGMENT__ELEMENTS); - - private final List<Action> actions = new ArrayList<Action>(); - - @Inject - IEclipseContext eclipseContext; - - @Inject - public StringModelFragment() { - super(); - } - - @PostConstruct - public void init() { - final List<FeatureClass> list = new ArrayList<FeatureClass>(); - Util.addClasses(ApplicationPackageImpl.eINSTANCE, list); - list.addAll(getEditor().getFeatureClasses(FragmentPackageImpl.Literals.MODEL_FRAGMENT, - FragmentPackageImpl.Literals.MODEL_FRAGMENT__ELEMENTS)); - for (final FeatureClass featureClass : list) { - actions.add(new Action(featureClass.label) { - - @Override - public void run() { - handleAdd(featureClass.eClass, false); - } - }); - } - } - - @Override - public Image getImage(Object element, Display display) { - return createImage(ResourceProvider.IMG_StringModelFragment); - } - - @Override - public String getLabel(Object element) { - return Messages.StringModelFragment_Label; - } - - @Override - public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { - FeaturePath.fromList(FragmentPackageImpl.Literals.STRING_MODEL_FRAGMENT__FEATURENAME), - FeaturePath.fromList(FragmentPackageImpl.Literals.STRING_MODEL_FRAGMENT__PARENT_ELEMENT_ID) }; - } - - @Override - public String getDetailLabel(Object element) { - if (element instanceof StringModelFragmentImpl) { - final StringModelFragmentImpl fragment = (StringModelFragmentImpl) element; - String ret = ""; //$NON-NLS-1$ - if (E.notEmpty(fragment.getFeaturename())) { - ret += fragment.getFeaturename(); - } - if (E.notEmpty(fragment.getParentElementId())) { - ret += " (" + fragment.getParentElementId() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ - } - return ret; - } - return null; - } - - @Override - public String getDescription(Object element) { - return Messages.StringModelFragment_Description; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - composite = createForm(parent); - } - getMaster().setValue(object); - return composite; - } - - private Composite createForm(Composite parent) { - final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - final CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { - ControlFactory.createXMIId(parent, this); - } - - final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - { - final Label l = new Label(parent, SWT.NONE); - l.setText(Messages.StringModelFragment_ParentId); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - final Composite comp = new Composite(parent, SWT.NONE); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - comp.setLayoutData(gd); - final GridLayout gl = new GridLayout(2, false); - gl.marginWidth = gl.marginHeight = 0; - gl.verticalSpacing = 0; - gl.marginLeft = gl.marginBottom = gl.marginRight = gl.marginTop = 0; - comp.setLayout(gl); - - final Text t = new Text(comp, SWT.BORDER); - TextPasteHandler.createFor(t); - // t.setEditable(false); - gd = new GridData(GridData.FILL_HORIZONTAL); - t.setLayoutData(gd); - context.bindValue( - textProp.observeDelayed(200, t), - EMFEditProperties.value(getEditingDomain(), - FragmentPackageImpl.Literals.STRING_MODEL_FRAGMENT__PARENT_ELEMENT_ID).observeDetail(getMaster())); - - final Button b = new Button(comp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelTooling_Common_FindEllipsis); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - final FindParentReferenceElementDialog dialog = new FindParentReferenceElementDialog(b.getShell(), - StringModelFragment.this, (MStringModelFragment) getMaster().getValue(), Messages); - dialog.open(); - } - }); - } - - { - final Label l = new Label(parent, SWT.NONE); - l.setText(Messages.StringModelFragment_Featurename); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - final Composite comp = new Composite(parent, SWT.NONE); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - comp.setLayoutData(gd); - final GridLayout gl = new GridLayout(2, false); - gl.marginWidth = gl.marginHeight = 0; - gl.verticalSpacing = 0; - gl.marginLeft = gl.marginBottom = gl.marginRight = gl.marginTop = 0; - comp.setLayout(gl); - - final Text t = new Text(comp, SWT.BORDER); - TextPasteHandler.createFor(t); - gd = new GridData(GridData.FILL_HORIZONTAL); - t.setLayoutData(gd); - context.bindValue( - textProp.observeDelayed(200, t), - EMFEditProperties.value(getEditingDomain(), - FragmentPackageImpl.Literals.STRING_MODEL_FRAGMENT__FEATURENAME).observeDetail(getMaster())); - - final Button button = new Button(comp, SWT.PUSH | SWT.FLAT); - button.setText(Messages.ModelTooling_Common_FindEllipsis); - button.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - final FeatureSelectionDialog dialog = new FeatureSelectionDialog(button.getShell(), - getEditingDomain(), (MStringModelFragment) getMaster().getValue(), Messages); - dialog.open(); - } - }); - - } - - ControlFactory.createTextField(parent, Messages.StringModelFragment_PositionInList, getMaster(), context, - textProp, EMFEditProperties.value(getEditingDomain(), - FragmentPackageImpl.Literals.STRING_MODEL_FRAGMENT__POSITION_IN_LIST)); - - // ------------------------------------------------------------ - { - - final E4PickList pickList = new E4PickList(parent, SWT.NONE, null, Messages, this, - FragmentPackageImpl.Literals.MODEL_FRAGMENT__ELEMENTS) { - @Override - protected void addPressed() { - final EClass eClass = ((FeatureClass) ((IStructuredSelection) getSelection()).getFirstElement()).eClass; - handleAdd(eClass, false); - } - - @Override - protected List<?> getContainerChildren(Object master) { - return ((StringModelFragmentImpl) master).getElements(); - } - }; - - pickList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1)); - pickList.setText(""); //$NON-NLS-1$ - - pickList.setLabelProvider(new LabelProvider() { - @Override - public String getText(Object element) { - final FeatureClass eclass = (FeatureClass) element; - return eclass.label; - } - }); - - pickList.setComparator(new ViewerComparator() { - @Override - public int compare(Viewer viewer, Object e1, Object e2) { - final FeatureClass eClass1 = (FeatureClass) e1; - final FeatureClass eClass2 = (FeatureClass) e2; - return eClass1.label.compareTo(eClass2.label); - } - }); - - final List<FeatureClass> list = new ArrayList<FeatureClass>(); - Util.addClasses(ApplicationPackageImpl.eINSTANCE, list); - list.addAll(getEditor().getFeatureClasses(FragmentPackageImpl.Literals.MODEL_FRAGMENT, - FragmentPackageImpl.Literals.MODEL_FRAGMENT__ELEMENTS)); - - pickList.setInput(list); - if (list.size() > 0) { - pickList.setSelection(new StructuredSelection(list.get(0))); - } - - final IEMFListProperty prop = EMFProperties.list(FragmentPackageImpl.Literals.MODEL_FRAGMENT__ELEMENTS); - pickList.getList().setInput(prop.observeDetail(getMaster())); - - } - - createContributedEditorTabs(folder, context, getMaster(), MStringModelFragment.class); - - folder.setSelection(0); - - return folder; - } - - public void dispose() { - if (composite != null) { - composite.dispose(); - composite = null; - } - - if (context != null) { - context.dispose(); - context = null; - } - } - - @Override - public IObservableList getChildList(Object element) { - return MODEL_FRAGMENT__ELEMENTS.observe(element); - } - - protected void handleAdd(EClass eClass, boolean separator) { - final EObject eObject = EcoreUtil.create(eClass); - setElementId(eObject); - final Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), - FragmentPackageImpl.Literals.MODEL_FRAGMENT__ELEMENTS, eObject); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(eObject); - } - } - - @Override - public List<Action> getActions(Object element) { - final ArrayList<Action> l = new ArrayList<Action>(super.getActions(element)); - l.addAll(actions); - Collections.sort(l, new Comparator<Action>() { - @Override - public int compare(Action o1, Action o2) { - - return o1.getText().compareTo(o2.getText()); - } - }); - return l; - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java deleted file mode 100644 index 57072d7c..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java +++ /dev/null @@ -1,365 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2014 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Marco Descher <marco@descher.at> - Bug 397650 - * Lars Vogel <Lars.Vogel@gmail.com> - Ongoing maintenance - * Nicolaj Hoess <nicohoess@gmail.com> - Bug 396975 - * Steven Spungin <steven@spungin.tv> - Ongoing maintenance - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.util.ArrayList; -import java.util.List; - -import javax.annotation.PostConstruct; -import javax.inject.Inject; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.core.di.annotations.Optional; -import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.E4PickList; -import org.eclipse.e4.tools.emf.ui.internal.common.E4PickList.Struct; -import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ToolBarIdDialog; -import org.eclipse.e4.tools.emf.ui.internal.common.uistructure.UIViewer; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.MUIElement; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.MToolBarContribution; -import org.eclipse.e4.ui.model.application.ui.menu.MToolBarElement; -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.e4.ui.workbench.modeling.EModelService; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.IEMFListProperty; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class ToolBarContributionEditor extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - - private final IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties - .list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - private StackLayout stackLayout; - private final List<Action> actions = new ArrayList<Action>(); - - @Inject - @Optional - private IProject project; - - @Inject - private IModelResource resource; - - @Inject - private EModelService modelService; - - @Inject - public ToolBarContributionEditor() { - super(); - } - - @PostConstruct - void init() { - actions.add(new Action(Messages.ToolBarEditor_AddHandledToolItem, - createImageDescriptor(ResourceProvider.IMG_HandledToolItem)) { - @Override - public void run() { - handleAddChild(MenuPackageImpl.Literals.HANDLED_TOOL_ITEM, false); - } - }); - actions.add(new Action(Messages.ToolBarEditor_AddDirectToolItem, - createImageDescriptor(ResourceProvider.IMG_DirectToolItem)) { - @Override - public void run() { - handleAddChild(MenuPackageImpl.Literals.DIRECT_TOOL_ITEM, false); - } - }); - actions.add(new Action(Messages.ToolBarEditor_AddToolControl, - createImageDescriptor(ResourceProvider.IMG_ToolControl)) { - @Override - public void run() { - handleAddChild(MenuPackageImpl.Literals.TOOL_CONTROL, false); - } - }); - actions.add(new Action(Messages.ToolBarEditor_AddToolBarSeparator, - createImageDescriptor(ResourceProvider.IMG_ToolBarSeparator)) { - @Override - public void run() { - handleAddChild(MenuPackageImpl.Literals.TOOL_BAR_SEPARATOR, true); - } - }); - } - - @Override - public Image getImage(Object element, Display display) { - if (element instanceof MUIElement) { - final MUIElement uiElement = (MUIElement) element; - if (uiElement.isToBeRendered() && uiElement.isVisible()) { - return createImage(ResourceProvider.IMG_ToolBarContribution); - } - return createImage(ResourceProvider.IMG_Tbr_ToolBarContribution); - } - - return null; - } - - @Override - public String getLabel(Object element) { - return Messages.ToolBarContributionEditor_TreeLabel; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return Messages.ToolBarContributionEditor_TreeLabelDescription; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - getMaster().setValue(object); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { - final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { - ControlFactory.createXMIId(parent, this); - } - - final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (isImport) { - ControlFactory.createFindImport(parent, Messages, this, context); - folder.setSelection(0); - return folder; - } - - ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, - EMFEditProperties - .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); - ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), - context, textProp, - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); - - { - final Label l = new Label(parent, SWT.NONE); - l.setText(Messages.MenuContributionEditor_ParentId); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - final Text t = new Text(parent, SWT.BORDER); - TextPasteHandler.createFor(t); - final GridData gd = new GridData(GridData.FILL_HORIZONTAL); - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), - EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTION__PARENT_ID) - .observeDetail(getMaster())); - - final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelTooling_Common_FindEllipsis); - b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - final ToolBarIdDialog dialog = new ToolBarIdDialog(t.getShell(), resource, - (MToolBarContribution) getMaster().getValue(), getEditingDomain(), modelService, Messages); - dialog.open(); - } - }); - } - - ControlFactory.createTextField(parent, Messages.MenuContributionEditor_Position, master, context, textProp, - EMFEditProperties.value(getEditingDomain(), - MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTION__POSITION_IN_PARENT)); - - // ------------------------------------------------------------ - { - final E4PickList pickList = new E4PickList(parent, SWT.NONE, null, Messages, this, - UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN) { - @Override - protected void addPressed() { - final Struct struct = (Struct) ((IStructuredSelection) getSelection()).getFirstElement(); - final EClass eClass = struct.eClass; - final MToolBarElement eObject = (MToolBarElement) EcoreUtil.create(eClass); - setElementId(eObject); - - final Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), - UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - if (!struct.separator) { - getEditor().setSelection(eObject); - } - } - } - }; - pickList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1)); - pickList.setText(Messages.ToolBarEditor_ToolbarItems); - final TableViewer viewer = pickList.getList(); - - final IEMFListProperty prop = EMFEditProperties.list(getEditingDomain(), - UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - viewer.setInput(prop.observeDetail(master)); - - final Struct defaultStruct = new Struct(Messages.ToolBarEditor_HandledToolItem, - MenuPackageImpl.Literals.HANDLED_TOOL_ITEM, false); - pickList.setInput(new Struct[] { defaultStruct, - new Struct(Messages.ToolBarEditor_DirectToolItem, MenuPackageImpl.Literals.DIRECT_TOOL_ITEM, false), - new Struct(Messages.ToolBarEditor_ToolControl, MenuPackageImpl.Literals.TOOL_CONTROL, false), - new Struct(Messages.ToolBarEditor_Separator, MenuPackageImpl.Literals.TOOL_BAR_SEPARATOR, true) }); - pickList.setSelection(new StructuredSelection(defaultStruct)); - } - - ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, - WidgetProperties.selection(), - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); - ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, - WidgetProperties.selection(), - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - - item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabSupplementary); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); - - if (project == null) { - createUITreeInspection(folder); - } - - createContributedEditorTabs(folder, context, getMaster(), MToolBarContribution.class); - - folder.setSelection(0); - - return folder; - } - - private void createUITreeInspection(CTabFolder folder) { - final CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_RuntimeWidgetTree); - final Composite container = new Composite(folder, SWT.NONE); - container.setLayout(new GridLayout()); - item.setControl(container); - - final UIViewer objectViewer = new UIViewer(); - final TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET, - getMaster(), resourcePool, Messages); - viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); - } - - @Override - public IObservableList getChildList(Object element) { - return ELEMENT_CONTAINER__CHILDREN.observe(element); - } - - @Override - public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) }; - } - - @Override - public List<Action> getActions(Object element) { - final ArrayList<Action> l = new ArrayList<Action>(super.getActions(element)); - l.addAll(actions); - return l; - } - - protected void handleAddChild(EClass eClass, boolean separator) { - final MToolBarElement eObject = (MToolBarElement) EcoreUtil.create(eClass); - setElementId(eObject); - - final Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), - UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - if (!separator) { - getEditor().setSelection(eObject); - } - } - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java deleted file mode 100644 index 82e887f7..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java +++ /dev/null @@ -1,283 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2014 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Lars Vogel <Lars.Vogel@gmail.com> - Ongoing maintenance - * Steven Spungin <steven@spungin.tv> - Ongoing maintenance - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.util.ArrayList; -import java.util.List; - -import javax.annotation.PostConstruct; -import javax.inject.Inject; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.E4PickList; -import org.eclipse.e4.tools.emf.ui.internal.common.E4PickList.Struct; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.MUIElement; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.MToolBar; -import org.eclipse.e4.ui.model.application.ui.menu.MToolBarElement; -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.IEMFListProperty; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; - -public class ToolBarEditor extends AbstractComponentEditor { - - private Composite composite; - private EMFDataBindingContext context; - - private final IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties - .list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - private StackLayout stackLayout; - private final List<Action> actions = new ArrayList<Action>(); - - @Inject - public ToolBarEditor() { - super(); - } - - @PostConstruct - void init() { - actions.add(new Action(Messages.ToolBarEditor_AddHandledToolItem, - createImageDescriptor(ResourceProvider.IMG_HandledToolItem)) { - @Override - public void run() { - handleAddChild(MenuPackageImpl.Literals.HANDLED_TOOL_ITEM, false); - } - }); - actions.add(new Action(Messages.ToolBarEditor_AddDirectToolItem, - createImageDescriptor(ResourceProvider.IMG_DirectToolItem)) { - @Override - public void run() { - handleAddChild(MenuPackageImpl.Literals.DIRECT_TOOL_ITEM, false); - } - }); - actions.add(new Action(Messages.ToolBarEditor_AddToolControl, - createImageDescriptor(ResourceProvider.IMG_ToolControl)) { - @Override - public void run() { - handleAddChild(MenuPackageImpl.Literals.TOOL_CONTROL, false); - } - }); - actions.add(new Action(Messages.ToolBarEditor_AddToolBarSeparator, - createImageDescriptor(ResourceProvider.IMG_ToolBarSeparator)) { - @Override - public void run() { - handleAddChild(MenuPackageImpl.Literals.TOOL_BAR_SEPARATOR, true); - } - }); - } - - @Override - public Image getImage(Object element, Display display) { - if (element instanceof MUIElement) { - final MUIElement uiElement = (MUIElement) element; - if (uiElement.isToBeRendered() && uiElement.isVisible()) { - return createImage(ResourceProvider.IMG_ToolBar); - } - return createImage(ResourceProvider.IMG_Tbr_ToolBar); - } - - return null; - } - - @Override - public String getLabel(Object element) { - return Messages.ToolBarEditor_Label; - } - - @Override - public String getDescription(Object element) { - return Messages.ToolBarEditor_Description; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - getMaster().setValue(object); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { - final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { - ControlFactory.createXMIId(parent, this); - } - - final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (isImport) { - ControlFactory.createFindImport(parent, Messages, this, context); - folder.setSelection(0); - return folder; - } - - ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, - EMFEditProperties - .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); - ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), - context, textProp, - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); - - // ------------------------------------------------------------ - { - final E4PickList pickList = new E4PickList(parent, SWT.NONE, null, Messages, this, - UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN) { - @Override - protected void addPressed() { - final Struct struct = (Struct) ((IStructuredSelection) getSelection()).getFirstElement(); - final EClass eClass = struct.eClass; - handleAddChild(eClass, struct.separator); - } - }; - pickList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1)); - pickList.setText(Messages.ToolBarEditor_ToolbarItems); - - final TableViewer viewer = pickList.getList(); - final IEMFListProperty prop = EMFEditProperties.list(getEditingDomain(), - UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - viewer.setInput(prop.observeDetail(master)); - - final Struct defaultStruct = new Struct(Messages.ToolBarEditor_HandledToolItem, - MenuPackageImpl.Literals.HANDLED_TOOL_ITEM, false); - pickList.setInput(new Struct[] { defaultStruct, - new Struct(Messages.ToolBarEditor_DirectToolItem, MenuPackageImpl.Literals.DIRECT_TOOL_ITEM, false), - new Struct(Messages.ToolBarEditor_ToolControl, MenuPackageImpl.Literals.TOOL_CONTROL, false), - new Struct(Messages.ToolBarEditor_Separator, MenuPackageImpl.Literals.TOOL_BAR_SEPARATOR, true) }); - pickList.setSelection(new StructuredSelection(defaultStruct)); - } - - ControlFactory - .createCheckBox( - parent, - "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$ - ControlFactory - .createCheckBox( - parent, - "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$ - - item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabSupplementary); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); - - createContributedEditorTabs(folder, context, getMaster(), MToolBar.class); - - folder.setSelection(0); - - return folder; - } - - @Override - public IObservableList getChildList(Object element) { - return ELEMENT_CONTAINER__CHILDREN.observe(element); - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) }; - } - - @Override - public List<Action> getActions(Object element) { - final ArrayList<Action> l = new ArrayList<Action>(super.getActions(element)); - l.addAll(actions); - return l; - } - - protected void handleAddChild(EClass eClass, boolean separator) { - final MToolBarElement eObject = (MToolBarElement) EcoreUtil.create(eClass); - setElementId(eObject); - - final Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), - UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - if (!separator) { - getEditor().setSelection(eObject); - } - } - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java deleted file mode 100644 index 7e91c337..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java +++ /dev/null @@ -1,199 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2014 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Lars Vogel <Lars.Vogel@gmail.com> - Ongoing maintenance - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import javax.inject.Inject; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.core.di.annotations.Optional; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.uistructure.UIViewer; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.MUIElement; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.MToolBarSeparator; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; - -public class ToolBarSeparatorEditor extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - private StackLayout stackLayout; - - @Inject - @Optional - private IProject project; - - @Inject - public ToolBarSeparatorEditor() { - super(); - } - - @Override - public Image getImage(Object element, Display display) { - if (element instanceof MUIElement) { - final MUIElement uiElement = (MUIElement) element; - if (uiElement.isToBeRendered() && uiElement.isVisible()) { - return createImage(ResourceProvider.IMG_ToolBarSeparator); - } - return createImage(ResourceProvider.IMG_Tbr_ToolBarSeparator); - } - - return null; - } - - @Override - public String getLabel(Object element) { - return Messages.ToolBarSeparatorEditor_Label; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return null; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - getMaster().setValue(object); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { - final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { - ControlFactory.createXMIId(parent, this); - } - - final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (isImport) { - ControlFactory.createFindImport(parent, Messages, this, context); - folder.setSelection(0); - return folder; - } - - ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, - EMFEditProperties - .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); - ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), - context, textProp, - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); - ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, - WidgetProperties.selection(), - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); - ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, - WidgetProperties.selection(), - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - - item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabSupplementary); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); - - if (project == null) { - createUITreeInspection(folder); - } - - createContributedEditorTabs(folder, context, getMaster(), MToolBarSeparator.class); - - folder.setSelection(0); - - return folder; - } - - private void createUITreeInspection(CTabFolder folder) { - final CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_RuntimeWidgetTree); - final Composite container = new Composite(folder, SWT.NONE); - container.setLayout(new GridLayout()); - item.setControl(container); - - final UIViewer objectViewer = new UIViewer(); - final TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET, - getMaster(), resourcePool, Messages); - viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); - } - - @Override - public IObservableList getChildList(Object element) { - return null; - } - - @Override - public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) }; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java deleted file mode 100644 index 89bd7f14..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java +++ /dev/null @@ -1,282 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2014 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Lars Vogel <Lars.Vogel@gmail.com> - Ongoing maintenance - * Dmitry Spiridenok <d.spiridenok@gmail.com> - Bug 412672 - * Steven Spungin <steven@spungin.tv> - Bug 424730 - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import javax.inject.Inject; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.core.di.annotations.Optional; -import org.eclipse.e4.tools.emf.ui.common.IContributionClassCreator; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; -import org.eclipse.e4.tools.emf.ui.internal.common.objectdata.ObjectViewer; -import org.eclipse.e4.tools.emf.ui.internal.common.uistructure.UIViewer; -import org.eclipse.e4.ui.model.application.MContribution; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.MUIElement; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.MToolControl; -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Link; -import org.eclipse.swt.widgets.Text; - -public class ToolControlEditor extends AbstractComponentEditor { - private EMFDataBindingContext context; - private Composite composite; - private StackLayout stackLayout; - - @Inject - @Optional - private IProject project; - - @Inject - IEclipseContext eclipseContext; - - @Inject - public ToolControlEditor() { - super(); - } - - @Override - public String getLabel(Object element) { - return Messages.ToolControlEditor_Label; - } - - @Override - public String getDescription(Object element) { - return Messages.ToolControlEditor_Description; - } - - @Override - public Image getImage(Object element, Display display) { - if (element instanceof MUIElement) { - final MUIElement uiElement = (MUIElement) element; - if (uiElement.isToBeRendered() && uiElement.isVisible()) { - return createImage(ResourceProvider.IMG_ToolControl); - } - return createImage(ResourceProvider.IMG_Tbr_ToolControl); - } - - return null; - } - - @Override - public String getDetailLabel(Object element) { - // TODO Auto-generated method stub - return null; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - getMaster().setValue(object); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { - final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { - ControlFactory.createXMIId(parent, this); - } - - final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (isImport) { - ControlFactory.createFindImport(parent, Messages, this, context); - folder.setSelection(0); - return folder; - } - - ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, - EMFEditProperties - .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); - ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), - context, textProp, - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); - - // ------------------------------------------------------------ - { - final IContributionClassCreator c = getEditor().getContributionCreator( - MenuPackageImpl.Literals.TOOL_CONTROL); - if (project != null && c != null) { - final Link lnk = new Link(parent, SWT.NONE); - lnk.setText("<A>" + Messages.ToolControlEditor_ClassURI + "</A>"); //$NON-NLS-1$//$NON-NLS-2$ - lnk.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - lnk.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - c.createOpen((MContribution) getMaster().getValue(), getEditingDomain(), project, - lnk.getShell()); - } - }); - } else { - final Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ToolControlEditor_ClassURI); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - } - - final Text t = new Text(parent, SWT.BORDER); - TextPasteHandler.createFor(t); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue( - textProp.observeDelayed(200, t), - EMFEditProperties.value(getEditingDomain(), - ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(master)); - - final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); - b.setText(Messages.ModelTooling_Common_FindEllipsis); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - final ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(), eclipseContext, - getEditingDomain(), (MContribution) getMaster().getValue(), - ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI, Messages); - dialog.open(); - } - }); - } - - ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, - WidgetProperties.selection(), - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); - ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, - WidgetProperties.selection(), - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - - ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); - - item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabSupplementary); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); - - if (project == null) { - createInstanceInspection(folder); - createUITreeInspection(folder); - } - - createContributedEditorTabs(folder, context, getMaster(), MToolControl.class); - - folder.setSelection(0); - - return folder; - } - - private void createInstanceInspection(CTabFolder folder) { - final CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_RuntimeContributionInstance); - final Composite container = new Composite(folder, SWT.NONE); - container.setLayout(new GridLayout()); - item.setControl(container); - - final ObjectViewer objectViewer = new ObjectViewer(); - final TreeViewer viewer = objectViewer.createViewer(container, - ApplicationPackageImpl.Literals.CONTRIBUTION__OBJECT, getMaster(), resourcePool, Messages); - viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); - - } - - private void createUITreeInspection(CTabFolder folder) { - final CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_RuntimeWidgetTree); - final Composite container = new Composite(folder, SWT.NONE); - container.setLayout(new GridLayout()); - item.setControl(container); - - final UIViewer objectViewer = new UIViewer(); - final TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET, - getMaster(), resourcePool, Messages); - viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); - } - - @Override - public IObservableList getChildList(Object element) { - // TODO Auto-generated method stub - return null; - } - - @Override - public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) }; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java deleted file mode 100644 index 7e967324..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java +++ /dev/null @@ -1,453 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2014 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Lars Vogel <Lars.Vogel@gmail.com> - Ongoing maintenance - * Steven Spungin <steven@spungin.tv> - Bug 424730, Bug 437951 - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.util.ArrayList; -import java.util.List; -import javax.inject.Inject; -import org.eclipse.core.databinding.UpdateValueStrategy; -import org.eclipse.core.databinding.conversion.Converter; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.list.WritableList; -import org.eclipse.core.databinding.observable.value.IObservableValue; -import org.eclipse.core.databinding.observable.value.IValueChangeListener; -import org.eclipse.core.databinding.observable.value.ValueChangeEvent; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.databinding.property.value.IValueProperty; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.core.di.annotations.Optional; -import org.eclipse.e4.tools.emf.ui.common.ImageTooltip; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ToolItemIconDialogEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.uistructure.UIViewer; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.MUILabel; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.ItemType; -import org.eclipse.e4.ui.model.application.ui.menu.MMenu; -import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; -import org.eclipse.e4.ui.model.application.ui.menu.MToolItem; -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.databinding.viewers.ViewerProperties; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.ComboViewer; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public abstract class ToolItemEditor extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - - private StackLayout stackLayout; - - private IValueProperty TOOL_ITEM__MENU = EMFProperties.value(MenuPackageImpl.Literals.TOOL_ITEM__MENU); - - @Inject - @Optional - protected IProject project; - - @Inject - IEclipseContext eclipseContext; - - private Button createRemoveMenu; - - public ToolItemEditor() { - super(); - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - if (createRemoveMenu != null) { - createRemoveMenu.setSelection(((MToolItem) object).getMenu() != null); - } - - getMaster().setValue(object); - enableIdGenerator(UiPackageImpl.Literals.UI_LABEL__LABEL, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID, null); - return composite; - } - - protected CTabFolder createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { - CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { - ControlFactory.createXMIId(parent, this); - } - - IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (isImport) { - ControlFactory.createFindImport(parent, Messages, this, context); - folder.setSelection(0); - return folder; - } - - ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); - - createFormSubTypeForm(parent, folder, context, master); - - if (project == null) { - createUITreeInspection(folder); - } - - createContributedEditorTabs(folder, context, getMaster(), MToolItem.class); - - folder.setSelection(0); - - return folder; - } - - private void createUITreeInspection(CTabFolder folder) { - CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_RuntimeWidgetTree); - Composite container = new Composite(folder, SWT.NONE); - container.setLayout(new GridLayout()); - item.setControl(container); - - UIViewer objectViewer = new UIViewer(); - TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET, getMaster(), resourcePool, Messages); - viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); - } - - protected void createFormSubTypeForm(Composite parent, CTabFolder folder, EMFDataBindingContext context, final WritableValue master) { - IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - IWidgetValueProperty checkProp = WidgetProperties.selection(); - IWidgetValueProperty enabled = WidgetProperties.enabled(); - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ToolItemEditor_Type); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - ComboViewer viewer = new ComboViewer(parent); - viewer.setContentProvider(new ArrayContentProvider()); - viewer.setInput(new ItemType[] { ItemType.CHECK, ItemType.PUSH, ItemType.RADIO }); - GridData gd = new GridData(); - gd.horizontalSpan = 2; - viewer.getControl().setLayoutData(gd); - IObservableValue itemTypeObs = EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.ITEM__TYPE).observeDetail(master); - context.bindValue(ViewerProperties.singleSelection().observe(viewer), itemTypeObs); - } - - ControlFactory.createTextField(parent, Messages.ToolItemEditor_Label, master, context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL)); - ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); - ControlFactory.createTextField(parent, Messages.ToolItemEditor_ToolTip, master, context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP)); - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ToolItemEditor_IconURI); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - TextPasteHandler.createFor(t); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); - - new ImageTooltip(t, Messages) { - - @Override - protected URI getImageURI() { - MUILabel part = (MUILabel) getMaster().getValue(); - String uri = part.getIconURI(); - if (uri == null || uri.trim().length() == 0) { - return null; - } - return URI.createURI(part.getIconURI()); - } - }; - - final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelTooling_Common_FindEllipsis); - b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - ToolItemIconDialogEditor dialog = new ToolItemIconDialogEditor(b.getShell(), eclipseContext, project, getEditingDomain(), (MToolItem) getMaster().getValue(), Messages); - dialog.open(); - } - }); - } - - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ToolItemEditor_Menu); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - createRemoveMenu = new Button(parent, SWT.CHECK); - createRemoveMenu.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - MToolItem item = (MToolItem) getMaster().getValue(); - if (item.getMenu() == null) { - addMenu(); - } else { - removeMenu(); - } - } - }); - createRemoveMenu.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 2, 1)); - } - - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ToolItemEditor_Enabled); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Button b = new Button(parent, SWT.CHECK); - b.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 2, 1)); - context.bindValue(checkProp.observe(b), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.ITEM__ENABLED).observeDetail(getMaster())); - } - - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ToolItemEditor_Selected); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Button b = new Button(parent, SWT.CHECK); - b.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 2, 1)); - context.bindValue(checkProp.observe(b), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.ITEM__SELECTED).observeDetail(getMaster())); - - UpdateValueStrategy t2m = new UpdateValueStrategy(); - t2m.setConverter(new Converter(boolean.class, ItemType.class) { - - @Override - public Object convert(Object fromObject) { - return null; - } - }); - UpdateValueStrategy m2t = new UpdateValueStrategy(); - m2t.setConverter(new Converter(ItemType.class, boolean.class) { - - @Override - public Object convert(Object fromObject) { - return fromObject == ItemType.CHECK || fromObject == ItemType.RADIO; - } - }); - - context.bindValue(enabled.observe(b), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.ITEM__TYPE).observeDetail(getMaster()), t2m, m2t); - - } - - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ModelTooling_UIElement_VisibleWhen); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - ComboViewer combo = new ComboViewer(parent); - combo.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - combo.setContentProvider(new ArrayContentProvider()); - combo.setLabelProvider(new LabelProvider() { - @Override - public String getText(Object element) { - if (element instanceof EClass) { - EClass eClass = (EClass) element; - return eClass.getName(); - } - - return super.getText(element); - } - }); - List<Object> list = new ArrayList<Object>(); - list.add(Messages.ToolItemEditor_NoExpression); - list.add(UiPackageImpl.Literals.CORE_EXPRESSION); - list.addAll(getEditor().getFeatureClasses(UiPackageImpl.Literals.EXPRESSION, UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN)); - combo.setInput(list); - context.bindValue(ViewerProperties.singleSelection().observe(combo), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN).observeDetail(getMaster()), new UpdateValueStrategy().setConverter(new EClass2EObject(Messages)), new UpdateValueStrategy().setConverter(new EObject2EClass(Messages))); - } - // ------------------------------------------------------------ - - createSubTypeFormElements(parent, context, master); - - ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); - ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - - CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabSupplementary); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_ApplicationElement_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); - } - - protected void createSubTypeFormElements(Composite parent, EMFDataBindingContext context, WritableValue master) { - - } - - void removeMenu() { - Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.TOOL_ITEM__MENU, null); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - - void addMenu() { - MMenu menu = MMenuFactory.INSTANCE.createMenu(); - setElementId(menu); - - Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.TOOL_ITEM__MENU, menu); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - - @Override - public IObservableList getChildList(final Object element) { - final WritableList list = new WritableList(); - - MToolItem item = (MToolItem) element; - if (item.getMenu() != null) { - list.add(0, item.getMenu()); - } - - TOOL_ITEM__MENU.observe(element).addValueChangeListener(new IValueChangeListener() { - - @Override - public void handleValueChange(ValueChangeEvent event) { - if (event.diff.getOldValue() != null) { - list.remove(event.diff.getOldValue()); - if (getMaster().getValue() == element && !createRemoveMenu.isDisposed()) { - createRemoveMenu.setSelection(false); - } - } - - if (event.diff.getNewValue() != null) { - list.add(0, event.diff.getNewValue()); - if (getMaster().getValue() == element && !createRemoveMenu.isDisposed()) { - createRemoveMenu.setSelection(true); - } - } - } - }); - - return list; - } - - @Override - public String getDetailLabel(Object element) { - MToolItem item = (MToolItem) element; - String l = getLocalizedLabel(item); - - if (l != null && l.trim().length() > 0) { - return l; - } else if (item.getTooltip() != null && item.getTooltip().trim().length() > 0) { - return item.getTooltip(); - } - return null; - } - - @Override - public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__LABEL), FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__TOOLTIP), FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) }; - } - - static class EObject2EClass extends Converter { - private Messages Messages; - - public EObject2EClass(Messages Messages) { - super(EObject.class, EClass.class); - this.Messages = Messages; - } - - @Override - public Object convert(Object fromObject) { - if (fromObject == null) { - return Messages.MenuItemEditor_NoExpression; - } - return ((EObject) fromObject).eClass(); - } - } - - static class EClass2EObject extends Converter { - private Messages Messages; - - public EClass2EObject(Messages Messages) { - super(EClass.class, EObject.class); - this.Messages = Messages; - } - - @Override - public Object convert(Object fromObject) { - if (fromObject == null || fromObject.toString().equals(Messages.MenuItemEditor_NoExpression)) { - return null; - } - return EcoreUtil.create((EClass) fromObject); - } - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java deleted file mode 100644 index f1988b47..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java +++ /dev/null @@ -1,328 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2014 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Lars Vogel <Lars.Vogel@gmail.com> - Ongoing maintenance - * Steven Spungin <steven@spungin.tv> - Ongoing maintenance - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import javax.annotation.PostConstruct; -import javax.inject.Inject; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.IObservableValue; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.core.di.annotations.Optional; -import org.eclipse.e4.core.services.nls.Translation; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.AbstractPickList.PickListFeatures; -import org.eclipse.e4.tools.emf.ui.internal.common.E4PickList; -import org.eclipse.e4.tools.emf.ui.internal.common.EClassLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.uistructure.UIViewer; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.MGenericTrimContainer; -import org.eclipse.e4.ui.model.application.ui.MUIElement; -import org.eclipse.e4.ui.model.application.ui.SideValue; -import org.eclipse.e4.ui.model.application.ui.basic.MTrimBar; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.IEMFListProperty; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.databinding.viewers.ViewerProperties; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.ComboViewer; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; - -public class TrimBarEditor extends AbstractComponentEditor { - - private Composite composite; - private EMFDataBindingContext context; - - private final IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties - .list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - private StackLayout stackLayout; - private final List<Action> actions = new ArrayList<Action>(); - - @Inject - @Optional - protected IProject project; - - @Inject - private ModelEditor editor; - - @Inject - @Translation - protected Messages Messages; - - @Inject - public TrimBarEditor() { - super(); - } - - @PostConstruct - void init() { - actions.add(new Action(Messages.TrimBarEditor_AddToolBar, createImageDescriptor(ResourceProvider.IMG_ToolBar)) { - @Override - public void run() { - handleAddChild(MenuPackageImpl.Literals.TOOL_BAR); - } - }); - actions.add(new Action(Messages.TrimBarEditor_AddToolControl, - createImageDescriptor(ResourceProvider.IMG_ToolControl)) { - @Override - public void run() { - handleAddChild(MenuPackageImpl.Literals.TOOL_CONTROL); - } - }); - } - - @Override - public Image getImage(Object element, Display display) { - if (element instanceof MUIElement) { - final MUIElement uiElement = (MUIElement) element; - if (uiElement.isToBeRendered() && uiElement.isVisible()) { - return createImage(ResourceProvider.IMG_WindowTrim); - } - return createImage(ResourceProvider.IMG_Tbr_WindowTrim); - } - - return null; - } - - @Override - public String getLabel(Object element) { - return Messages.TrimBarEditor_TreeLabel; - } - - @Override - public String getDescription(Object element) { - return Messages.TrimBarEditor_TreeLabelDescription; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - getMaster().setValue(object); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { - final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { - ControlFactory.createXMIId(parent, this); - } - - final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (isImport) { - ControlFactory.createFindImport(parent, Messages, this, context); - folder.setSelection(0); - return folder; - } - - ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, - EMFEditProperties - .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); - ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), - context, textProp, - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); - - // ------------------------------------------------------------ - { - final Label l = new Label(parent, SWT.NONE); - l.setText(Messages.TrimBarEditor_Side); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - final ComboViewer viewer = new ComboViewer(parent); - viewer.setContentProvider(new ArrayContentProvider()); - viewer.setInput(SideValue.values()); - final GridData gd = new GridData(); - gd.horizontalSpan = 2; - viewer.getControl().setLayoutData(gd); - final IObservableValue sideValueObs = EMFEditProperties.value(getEditingDomain(), - UiPackageImpl.Literals.GENERIC_TRIM_CONTAINER__SIDE).observeDetail(master); - context.bindValue(ViewerProperties.singleSelection().observe(viewer), sideValueObs); - } - - // ------------------------------------------------------------ - { - final E4PickList pickList = new E4PickList(parent, SWT.NONE, Arrays.asList(PickListFeatures.NO_PICKER), - Messages, this, UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN) { - @Override - protected void addPressed() { - final EClass eClass = (EClass) ((IStructuredSelection) getSelection()).getFirstElement(); - handleAddChild(eClass); - } - }; - pickList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1)); - pickList.setText(Messages.TrimBarEditor_Controls); - - final TableViewer viewer = pickList.getList(); - - pickList.setLabelProvider(new EClassLabelProvider(getEditor())); - pickList - .setInput(new Object[] { MenuPackageImpl.Literals.TOOL_BAR, MenuPackageImpl.Literals.TOOL_CONTROL }); - pickList.setSelection(new StructuredSelection(MenuPackageImpl.Literals.TOOL_BAR)); - - final IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - viewer.setInput(prop.observeDetail(getMaster())); - } - - ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, - WidgetProperties.selection(), - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); - ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, - WidgetProperties.selection(), - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - - item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabSupplementary); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); - - if (project == null) { - createUITreeInspection(folder); - } - - createContributedEditorTabs(folder, context, getMaster(), MTrimBar.class); - - folder.setSelection(0); - - return folder; - } - - private void createUITreeInspection(CTabFolder folder) { - final CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_RuntimeWidgetTree); - final Composite container = new Composite(folder, SWT.NONE); - container.setLayout(new GridLayout()); - item.setControl(container); - - final UIViewer objectViewer = new UIViewer(); - final TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET, - getMaster(), resourcePool, Messages); - viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); - } - - @Override - public IObservableList getChildList(Object element) { - return ELEMENT_CONTAINER__CHILDREN.observe(element); - } - - @Override - public String getDetailLabel(Object element) { - final MGenericTrimContainer<?> trim = (MGenericTrimContainer<?>) element; - - if (trim.getSide() != null) { - return trim.getSide().toString(); - } - - return null; - } - - @Override - public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.GENERIC_TRIM_CONTAINER__SIDE), - FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) }; - } - - protected void handleAddChild(EClass eClass) { - final EObject toolbar = EcoreUtil.create(eClass); - setElementId(toolbar); - - final Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), - UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, toolbar); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - editor.setSelection(toolbar); - } - } - - @Override - public List<Action> getActions(Object element) { - final ArrayList<Action> l = new ArrayList<Action>(super.getActions(element)); - l.addAll(actions); - return l; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java deleted file mode 100644 index 7c238752..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java +++ /dev/null @@ -1,343 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2014 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Marco Descher <marco@descher.at> - Bug 397650 - * Lars Vogel <Lars.Vogel@gmail.com> - Ongoing maintenance - * Nicolaj Hoess <nicohoess@gmail.com> - Bug 396975 - * Steven Spungin <steven@spungin.tv> - Ongoing maintenance - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.util.ArrayList; -import java.util.List; - -import javax.annotation.PostConstruct; -import javax.inject.Inject; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.core.di.annotations.Optional; -import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.E4PickList; -import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory.TextPasteHandler; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.TrimIdDialog; -import org.eclipse.e4.tools.emf.ui.internal.common.uistructure.UIViewer; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.MUIElement; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.MTrimContribution; -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.e4.ui.workbench.modeling.EModelService; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.IEMFListProperty; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class TrimContributionEditor extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - - private final IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties - .list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - private StackLayout stackLayout; - private final List<Action> actions = new ArrayList<Action>(); - - @Inject - @Optional - protected IProject project; - - @Inject - private IModelResource resource; - - @Inject - private EModelService modelService; - - @Inject - public TrimContributionEditor() { - super(); - } - - @PostConstruct - void init() { - actions.add(new Action(Messages.TrimBarEditor_AddToolBar, createImageDescriptor(ResourceProvider.IMG_ToolBar)) { - @Override - public void run() { - handleAddChild(MenuPackageImpl.Literals.TOOL_BAR); - } - }); - actions.add(new Action(Messages.TrimBarEditor_AddToolControl, - createImageDescriptor(ResourceProvider.IMG_ToolControl)) { - @Override - public void run() { - handleAddChild(MenuPackageImpl.Literals.TOOL_CONTROL); - } - }); - } - - @Override - public Image getImage(Object element, Display display) { - if (element instanceof MUIElement) { - final MUIElement uiElement = (MUIElement) element; - if (uiElement.isToBeRendered() && uiElement.isVisible()) { - return createImage(ResourceProvider.IMG_TrimContribution); - } - return createImage(ResourceProvider.IMG_Tbr_TrimContribution); - } - - return null; - } - - @Override - public String getLabel(Object element) { - return Messages.TrimContributionEditor_TreeLabel; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return Messages.TrimContributionEditor_TreeLabelDescription; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - getMaster().setValue(object); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { - final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { - ControlFactory.createXMIId(parent, this); - } - - final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (isImport) { - ControlFactory.createFindImport(parent, Messages, this, context); - folder.setSelection(0); - return folder; - } - - ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, - EMFEditProperties - .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); - ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), - context, textProp, - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); - { - final Label l = new Label(parent, SWT.NONE); - l.setText(Messages.MenuContributionEditor_ParentId); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - final Text t = new Text(parent, SWT.BORDER); - TextPasteHandler.createFor(t); - final GridData gd = new GridData(GridData.FILL_HORIZONTAL); - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), - EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.MENU_CONTRIBUTION__PARENT_ID) - .observeDetail(getMaster())); - - final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelTooling_Common_FindEllipsis); - b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - final TrimIdDialog dialog = new TrimIdDialog(t.getShell(), resource, - (MTrimContribution) getMaster().getValue(), getEditingDomain(), modelService, Messages); - dialog.open(); - } - }); - - } - - ControlFactory - .createTextField(parent, Messages.TrimContributionEditor_Position, master, context, textProp, - EMFEditProperties.value(getEditingDomain(), - MenuPackageImpl.Literals.TRIM_CONTRIBUTION__POSITION_IN_PARENT)); - - // ------------------------------------------------------------ - { - final E4PickList pickList = new E4PickList(parent, SWT.NONE, null, Messages, this, - UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN) { - @Override - protected void addPressed() { - final EClass eClass = (EClass) ((IStructuredSelection) getSelection()).getFirstElement(); - handleAddChild(eClass); - } - }; - pickList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1)); - pickList.setText(Messages.TrimContributionEditor_Controls); - - final TableViewer viewer = pickList.getList(); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); - viewer.setContentProvider(new ObservableListContentProvider()); - final IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - viewer.setInput(prop.observeDetail(getMaster())); - - pickList.setContentProvider(new ArrayContentProvider()); - pickList.setLabelProvider(new LabelProvider() { - @Override - public String getText(Object element) { - return ((EClass) element).getName(); - } - }); - pickList - .setInput(new Object[] { MenuPackageImpl.Literals.TOOL_BAR, MenuPackageImpl.Literals.TOOL_CONTROL }); - pickList.setSelection(new StructuredSelection(MenuPackageImpl.Literals.TOOL_BAR)); - } - - ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, - WidgetProperties.selection(), - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); - ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, - WidgetProperties.selection(), - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); - - item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabSupplementary); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); - - if (project == null) { - createUITreeInspection(folder); - } - - createContributedEditorTabs(folder, context, getMaster(), MTrimContribution.class); - - folder.setSelection(0); - - return folder; - } - - private void createUITreeInspection(CTabFolder folder) { - final CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_RuntimeWidgetTree); - final Composite container = new Composite(folder, SWT.NONE); - container.setLayout(new GridLayout()); - item.setControl(container); - - final UIViewer objectViewer = new UIViewer(); - final TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET, - getMaster(), resourcePool, Messages); - viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); - } - - @Override - public IObservableList getChildList(Object element) { - return ELEMENT_CONTAINER__CHILDREN.observe(element); - } - - @Override - public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) }; - } - - protected void handleAddChild(EClass eClass) { - final EObject toolbar = EcoreUtil.create(eClass); - setElementId(toolbar); - - final Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), - UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, toolbar); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(toolbar); - } - } - - @Override - public List<Action> getActions(Object element) { - final ArrayList<Action> l = new ArrayList<Action>(super.getActions(element)); - l.addAll(actions); - return l; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java deleted file mode 100644 index 8a2c35f7..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import javax.inject.Inject; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.ecore.EObject; - -public class TrimmedWindowEditor extends WindowEditor { - private IListProperty TRIMMED_WINDOW__TRIM_BARS = EMFProperties.list(BasicPackageImpl.Literals.TRIMMED_WINDOW__TRIM_BARS); - - @Inject - public TrimmedWindowEditor() { - super(); - } - - @Override - public IObservableList getChildList(Object element) { - IObservableList list = super.getChildList(element); - - if (getEditor().isModelFragment() && Util.isImport((EObject) element)) { - return list; - } - - list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_TRIMMED_WINDOW_TRIMS, TRIMMED_WINDOW__TRIM_BARS, element, Messages.TrimmedWindowEditor_TrimBars) { - - @Override - protected boolean accepted(Object o) { - return true; - } - - }); - return list; - } - - @Override - public String getLabel(Object element) { - return Messages.TrimmedWindowEditor_TreeLabel; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/UnsettableUpdateValueStrategy.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/UnsettableUpdateValueStrategy.java deleted file mode 100644 index e942474d..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/UnsettableUpdateValueStrategy.java +++ /dev/null @@ -1,114 +0,0 @@ -/******************************************************************************* - * Steven Spungin <steven@spungin.tv> - Ongoing maintenance - ******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.databinding.conversion.Converter; -import org.eclipse.core.databinding.conversion.IConverter; -import org.eclipse.core.databinding.observable.value.IObservableValue; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.emf.databinding.EMFUpdateValueStrategy; -import org.eclipse.emf.databinding.internal.EMFValueProperty; -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.emf.ecore.EFactory; -import org.eclipse.emf.edit.command.SetCommand; - -/** - * An updater to deal with unsettable primitive attributes on EMF objects. EMF's {@link EMFEditValueProperty}/ - * {@link EMFValueProperty} does an eGet to - * retrieve the attribute value, with no regard as to whether the attribute is - * unset. If the attribute is unset, then eGet() will return the default value. - * - * This implementation makes several assumptions: - * <ul> - * <li>Assumes that these unsettable attributes have a nonsensical default value that can be used to detect an eGet of - * an unset attribute.</li> - * <li>Assumes that we are using EMFEditObservables so that changes are described using {@link SetCommand}, such that we - * can provide {@link SetCommand#UNSET_VALUE} to remove a value.</li> - * </ul> - * See the following discussions for background details: - * <ul> - * <li><a href="http://www.eclipse.org/forums/index.php?t=msg&th=165026/">Dynamic eGet for unsettable attributes</a></li> - * <li><a href="http://www.eclipsezone.com/eclipse/forums/t114431.html?start=15"> Creating a ComboViewer for an - * EReference</a> particularly the later postings from Tom Schindl on handling null values</li> - * <li><a href="http://www.eclipse.org/forums/index.php?t=msg&th=174967/"> ObservableMapCellLabelProvider doesn't work - * well with unsettable features</a></li> - * </ul> - */ -public class UnsettableUpdateValueStrategy extends EMFUpdateValueStrategy { - @Override - protected IConverter createConverter(Object fromType, Object toType) { - if (fromType == String.class) { - if (toType instanceof EAttribute) { - final EAttribute eAttribute = (EAttribute) toType; - final EDataType eDataType = eAttribute.getEAttributeType(); - final EFactory eFactory = eDataType.getEPackage().getEFactoryInstance(); - return new Converter(fromType, toType) { - @Override - public Object convert(Object fromObject) { - final String value = fromObject == null ? null : fromObject.toString(); - if (value == null || value.length() == 0) { - return SetCommand.UNSET_VALUE; - } - if (eAttribute.isMany()) { - final List<Object> result = new ArrayList<Object>(); - - for (final String element : value.split(" ")) { //$NON-NLS-1$ - result.add(eFactory.createFromString(eDataType, element)); - - } - return result; - } - return eFactory.createFromString(eDataType, value); - } - }; - } - } else if (toType == String.class) { - if (fromType instanceof EAttribute) { - final EAttribute eAttribute = (EAttribute) fromType; - final EDataType eDataType = eAttribute.getEAttributeType(); - final EFactory eFactory = eDataType.getEPackage().getEFactoryInstance(); - return new Converter(fromType, toType) { - @Override - public Object convert(Object fromObject) { - if (eAttribute.isMany()) { - final StringBuilder result = new StringBuilder(); - for (final Object value : (List<?>) fromObject) { - if (result.length() == 0) { - result.append(' '); - } - result.append(eFactory.convertToString(eDataType, value)); - } - return result.toString(); - } - // If the value - if (fromObject == SetCommand.UNSET_VALUE || fromObject == null - || fromObject.equals(eAttribute.getDefaultValue())) { - return ""; //$NON-NLS-1$ - } - return eFactory.convertToString(eDataType, fromObject); - } - }; - } - } - return super.createConverter(fromType, toType); - } - - /* - * (non-Javadoc) - * @see - * org.eclipse.core.databinding.UpdateValueStrategy#doSet(org.eclipse.core - * .databinding.observable.value.IObservableValue, java.lang.Object) - */ - @Override - protected IStatus doSet(IObservableValue observableValue, Object value) { - // TODO Auto-generated method stub - return super.doSet(observableValue, value); - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java deleted file mode 100644 index b25ad1e5..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java +++ /dev/null @@ -1,486 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2014 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Lars Vogel <Lars.Vogel@gmail.com> - Ongoing maintenance - * Steven Spungin <steven@spungin.tv> - Bug 424730, Bug 437951 - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.util.ArrayList; -import java.util.List; - -import javax.annotation.PostConstruct; -import javax.inject.Inject; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.list.WritableList; -import org.eclipse.core.databinding.observable.value.IValueChangeListener; -import org.eclipse.core.databinding.observable.value.ValueChangeEvent; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.core.databinding.property.value.IValueProperty; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.core.di.annotations.Optional; -import org.eclipse.e4.tools.emf.ui.common.ImageTooltip; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.WindowIconDialogEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.uistructure.UIViewer; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.MUIElement; -import org.eclipse.e4.ui.model.application.ui.MUILabel; -import org.eclipse.e4.ui.model.application.ui.basic.MWindow; -import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.MMenu; -import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class WindowEditor extends AbstractComponentEditor { - - private Composite composite; - private EMFDataBindingContext context; - - private final IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties - .list(CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS); - private final IListProperty WINDOW__WINDOWS = EMFProperties.list(BasicPackageImpl.Literals.WINDOW__WINDOWS); - private final IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties - .list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - private final IListProperty SHARED_ELEMENTS = EMFProperties.list(BasicPackageImpl.Literals.WINDOW__SHARED_ELEMENTS); - private final IValueProperty WINDOW__MAIN_MENU = EMFProperties.value(BasicPackageImpl.Literals.WINDOW__MAIN_MENU); - - private Action addMainMenu; - private Button createRemoveMainMenu; - private StackLayout stackLayout; - - @Inject - @Optional - private IProject project; - - @Inject - IEclipseContext eclipseContext; - - @Inject - public WindowEditor() { - super(); - } - - @PostConstruct - void init() { - addMainMenu = new Action(Messages.WindowEditor_AddMainMenu) { - @Override - public void run() { - addMenu(); - } - }; - } - - @Override - public Image getImage(Object element, Display display) { - if (element instanceof MUIElement) { - final MUIElement uiElement = (MUIElement) element; - if (uiElement.isToBeRendered() && uiElement.isVisible()) { - return createImage(ResourceProvider.IMG_Window); - } - return createImage(ResourceProvider.IMG_Tbr_Window); - } - - return null; - } - - @Override - public String getLabel(Object element) { - return Messages.WindowEditor_TreeLabel; - } - - @Override - public String getDescription(Object element) { - return Messages.WindowEditor_TreeLabelDescription; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - if (createRemoveMainMenu != null) { - createRemoveMainMenu.setSelection(((MWindow) object).getMainMenu() != null); - } - - getMaster().setValue(object); - enableIdGenerator(UiPackageImpl.Literals.UI_LABEL__LABEL, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID, null); - - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { - final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { - ControlFactory.createXMIId(parent, this); - } - - final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (isImport) { - ControlFactory.createFindImport(parent, Messages, this, context); - folder.setSelection(0); - return folder; - } - - ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, getMaster(), context, textProp, - EMFEditProperties - .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); - - // ------------------------------------------------------------ - { - final Label l = new Label(parent, SWT.NONE); - l.setText(Messages.WindowEditor_Bounds); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - final Composite comp = new Composite(parent, SWT.NONE); - final GridLayout layout = new GridLayout(4, true); - layout.marginWidth = 0; - layout.marginHeight = 0; - comp.setLayout(layout); - final GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - comp.setLayoutData(gd); - - Text t = new Text(comp, SWT.BORDER | SWT.TRAIL); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue( - textProp.observeDelayed(200, t), - EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__X).observeDetail( - getMaster()), new UnsettableUpdateValueStrategy(), new UnsettableUpdateValueStrategy()); - - t = new Text(comp, SWT.BORDER | SWT.TRAIL); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue( - textProp.observeDelayed(200, t), - EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__Y).observeDetail( - getMaster()), new UnsettableUpdateValueStrategy(), new UnsettableUpdateValueStrategy()); - - t = new Text(comp, SWT.BORDER | SWT.TRAIL); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue( - textProp.observeDelayed(200, t), - EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__WIDTH).observeDetail( - getMaster()), new UnsettableUpdateValueStrategy(), new UnsettableUpdateValueStrategy()); - - t = new Text(comp, SWT.BORDER | SWT.TRAIL); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue( - textProp.observeDelayed(200, t), - EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__HEIGHT).observeDetail( - getMaster()), new UnsettableUpdateValueStrategy(), new UnsettableUpdateValueStrategy()); - } - - ControlFactory.createTranslatedTextField(parent, Messages.WindowEditor_Label, getMaster(), context, textProp, - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL), resourcePool, project); - ControlFactory.createTranslatedTextField(parent, Messages.WindowEditor_Tooltip, getMaster(), context, textProp, - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP), resourcePool, - project); - - // ------------------------------------------------------------ - { - final Label l = new Label(parent, SWT.NONE); - l.setText(Messages.WindowEditor_IconURI); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - final Text t = new Text(parent, SWT.BORDER); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue( - textProp.observeDelayed(200, t), - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail( - master)); - - new ImageTooltip(t, Messages) { - - @Override - protected URI getImageURI() { - final MUILabel part = (MUILabel) getMaster().getValue(); - final String uri = part.getIconURI(); - if (uri == null || uri.trim().length() == 0) { - return null; - } - return URI.createURI(part.getIconURI()); - } - }; - - final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelTooling_Common_FindEllipsis); - b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - final WindowIconDialogEditor dialog = new WindowIconDialogEditor(b.getShell(), eclipseContext, - project, getEditingDomain(), (MWindow) getMaster().getValue(), Messages); - dialog.open(); - } - }); - } - - { - final Label l = new Label(parent, SWT.NONE); - l.setText(Messages.WindowEditor_MainMenu); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - createRemoveMainMenu = new Button(parent, SWT.CHECK); - createRemoveMainMenu.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - final MWindow window = (MWindow) getMaster().getValue(); - if (window.getMainMenu() == null) { - addMenu(); - } else { - removeMenu(); - } - } - }); - createRemoveMainMenu.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 2, 1)); - } - - ControlFactory - .createCheckBox( - parent, - "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$ - ControlFactory - .createCheckBox( - parent, - "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$ - - ControlFactory.createSelectedElement(parent, this, context, Messages.WindowEditor_SelectedElement); - ControlFactory.createBindingContextWiget(parent, Messages, this, Messages.WindowEditor_BindingContexts); - ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Context_Properties, - UiPackageImpl.Literals.CONTEXT__PROPERTIES, VERTICAL_LIST_WIDGET_INDENT); - - item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabSupplementary); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - ControlFactory.createTranslatedTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, - getMaster(), context, textProp, - EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE), - resourcePool, project); - ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_Context_Variables, - UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); - - if (project == null) { - createUITreeInspection(folder); - } - - createContributedEditorTabs(folder, context, getMaster(), MWindow.class); - - folder.setSelection(0); - - return folder; - } - - private void createUITreeInspection(CTabFolder folder) { - final CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_RuntimeWidgetTree); - final Composite container = new Composite(folder, SWT.NONE); - container.setLayout(new GridLayout()); - item.setControl(container); - - final UIViewer objectViewer = new UIViewer(); - final TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET, - getMaster(), resourcePool, Messages); - viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); - } - - void removeMenu() { - final Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), - BasicPackageImpl.Literals.WINDOW__MAIN_MENU, null); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - - void addMenu() { - final MMenu menu = MMenuFactory.INSTANCE.createMenu(); - setElementId(menu); - - final Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), - BasicPackageImpl.Literals.WINDOW__MAIN_MENU, menu); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - - @Override - public IObservableList getChildList(final Object element) { - final WritableList list = new WritableList(); - if (getEditor().isModelFragment() && Util.isImport((EObject) element)) { - return list; - } - - list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_HANDLER, HANDLER_CONTAINER__HANDLERS, element, - Messages.WindowEditor_Handlers) { - - @Override - protected boolean accepted(Object o) { - return true; - } - - }); - - list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_WINDOW_WINDOWS, WINDOW__WINDOWS, element, - Messages.WindowEditor_Windows) { - - @Override - protected boolean accepted(Object o) { - return true; - } - - }); - - list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_WINDOW_CONTROLS, ELEMENT_CONTAINER__CHILDREN, element, - Messages.WindowEditor_Controls) { - - @Override - protected boolean accepted(Object o) { - return true; - } - - }); - - list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_WINDOW_SHARED_ELEMENTS, SHARED_ELEMENTS, element, - Messages.WindowEditor_SharedElements) { - @Override - protected boolean accepted(Object o) { - return true; - } - }); - - final MWindow window = (MWindow) element; - if (window.getMainMenu() != null) { - list.add(0, window.getMainMenu()); - } - - WINDOW__MAIN_MENU.observe(element).addValueChangeListener(new IValueChangeListener() { - - @Override - public void handleValueChange(ValueChangeEvent event) { - if (event.diff.getOldValue() != null) { - list.remove(event.diff.getOldValue()); - if (getMaster().getValue() == element && !createRemoveMainMenu.isDisposed()) { - createRemoveMainMenu.setSelection(false); - } - } - - if (event.diff.getNewValue() != null) { - list.add(0, event.diff.getNewValue()); - if (getMaster().getValue() == element && !createRemoveMainMenu.isDisposed()) { - createRemoveMainMenu.setSelection(true); - } - } - } - }); - - return list; - } - - @Override - public String getDetailLabel(Object element) { - return getLocalizedLabel((MUILabel) element); - } - - @Override - public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__LABEL), - FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) }; - } - - @Override - public List<Action> getActions(Object element) { - final List<Action> actions = new ArrayList<Action>(); - - final MWindow window = (MWindow) element; - if (window.getMainMenu() == null) { - actions.add(getActionAddMainMenu()); - } - - return actions; - } - - protected Action getActionAddMainMenu() { - return addMainMenu; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WizardDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WizardDialogEditor.java deleted file mode 100644 index ebabc7ae..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WizardDialogEditor.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.ui.model.application.ui.MUIElement; -import org.eclipse.e4.ui.model.application.ui.basic.MWizardDialog; -import org.eclipse.jface.action.Action; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Display; - -public class WizardDialogEditor extends WindowEditor { - - @Override - public Image getImage(Object element, Display display) { - if (element instanceof MUIElement) { - final MUIElement uiElement = (MUIElement) element; - if (uiElement.isToBeRendered() && uiElement.isVisible()) { - return createImage(ResourceProvider.IMG_WizardDialog); - } - return createImage(ResourceProvider.IMG_Tbr_WizardDialog); - } - - return null; - } - - @Override - public String getLabel(Object element) { - return Messages.WizardDialogEditor_Label; - } - - @Override - public List<Action> getActions(Object element) { - final List<Action> actions = new ArrayList<Action>(); - - final MWizardDialog dialog = (MWizardDialog) element; - if (dialog.getMainMenu() == null) { - actions.add(getActionAddMainMenu()); - } - - return actions; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java deleted file mode 100644 index 66ccc252..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java +++ /dev/null @@ -1,195 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Andrej ten Brummelhuis <andrejbrummelhuis@gmail.com> - Bug 395283 - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.PatternFilter; -import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory; -import org.eclipse.e4.ui.model.application.commands.MCommand; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.util.TreeIterator; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.viewers.AbstractTreeViewer; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.DoubleClickEvent; -import org.eclipse.jface.viewers.IDoubleClickListener; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StyledCellLabelProvider; -import org.eclipse.jface.viewers.StyledString; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerCell; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; - -public abstract class AbstractCommandSelectionDialog extends SaveDialogBoundsSettingsDialog { - private final IModelResource resource; - private TableViewer viewer; - protected Messages Messages; - - public AbstractCommandSelectionDialog(Shell parentShell, IModelResource resource, Messages Messages) { - super(parentShell); - this.resource = resource; - this.Messages = Messages; - } - - protected abstract String getShellTitle(); - - protected abstract String getDialogTitle(); - - protected abstract String getDialogMessage(); - - @Override - protected Control createDialogArea(Composite parent) { - final Composite composite = (Composite) super.createDialogArea(parent); - getShell().setText(getShellTitle()); - setTitle(getDialogTitle()); - setMessage(getDialogMessage()); - - final Image titleImage = new Image(composite.getDisplay(), getClass().getClassLoader().getResourceAsStream( - "/icons/full/wizban/newexp_wiz.png")); //$NON-NLS-1$ - setTitleImage(titleImage); - getShell().addDisposeListener(new DisposeListener() { - - @Override - public void widgetDisposed(DisposeEvent e) { - titleImage.dispose(); - } - }); - - final Composite container = new Composite(composite, SWT.NONE); - container.setLayoutData(new GridData(GridData.FILL_BOTH)); - container.setLayout(new GridLayout(2, false)); - - final Label l = new Label(container, SWT.NONE); - l.setText(Messages.AbstractCommandSelectionDialog_Label_CommandId); - - final Text searchText = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH); - searchText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - new Label(container, SWT.NONE); - viewer = new TableViewer(container); - viewer.setContentProvider(new ArrayContentProvider()); - viewer.setLabelProvider(new LabelProviderImpl()); - viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); - viewer.addDoubleClickListener(new IDoubleClickListener() { - - @Override - public void doubleClick(DoubleClickEvent event) { - okPressed(); - } - }); - - final List<EObject> commands = new ArrayList<EObject>(); - final TreeIterator<EObject> it = EcoreUtil.getAllContents((EObject) resource.getRoot().get(0), true); - while (it.hasNext()) { - final EObject o = it.next(); - if (o.eClass() == CommandsPackageImpl.Literals.COMMAND) { - commands.add(o); - } - } - viewer.setInput(commands); - - final PatternFilter filter = new PatternFilter() { - @Override - protected boolean isParentMatch(Viewer viewer, Object element) { - return viewer instanceof AbstractTreeViewer && super.isParentMatch(viewer, element); - } - }; - viewer.addFilter(filter); - - ControlFactory.attachFiltering(searchText, viewer, filter); - - return composite; - } - - @Override - protected void okPressed() { - final IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (!s.isEmpty()) { - final Command cmd = createStoreCommand(resource.getEditingDomain(), (MCommand) s.getFirstElement()); - if (cmd.canExecute()) { - resource.getEditingDomain().getCommandStack().execute(cmd); - super.okPressed(); - } - } - } - - @Override - protected boolean isResizable() { - return true; - } - - protected abstract Command createStoreCommand(EditingDomain editingDomain, MCommand command); - - private static class LabelProviderImpl extends StyledCellLabelProvider implements ILabelProvider { - - @Override - public void update(final ViewerCell cell) { - final MCommand cmd = (MCommand) cell.getElement(); - - final StyledString styledString = new StyledString(); - if (cmd.getCommandName() != null) { - styledString.append(cmd.getCommandName()); - } - if (cmd.getDescription() != null) { - styledString.append(" - " + cmd.getDescription(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ - } - if (cmd.getElementId() != null) { - styledString.append(" - " + cmd.getElementId(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ - } - cell.setText(styledString.getString()); - cell.setStyleRanges(styledString.getStyleRanges()); - } - - @Override - public Image getImage(Object element) { - return null; - } - - @Override - public String getText(Object element) { - final MCommand command = (MCommand) element; - String s = ""; //$NON-NLS-1$ - if (command.getCommandName() != null) { - s += command.getCommandName(); - } - - if (command.getDescription() != null) { - s += " " + command.getDescription(); //$NON-NLS-1$ - } - - if (command.getElementId() != null) { - s += " " + command.getElementId(); //$NON-NLS-1$ - } - - return s; - } - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractIconDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractIconDialog.java deleted file mode 100644 index b6e9aef6..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractIconDialog.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Steven Spungin <steven@spungin.tv> - Bug 404136, Bug 424730 - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; - -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.ui.model.application.MApplicationElement; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.swt.widgets.Shell; - -public abstract class AbstractIconDialog extends AbstractIconDialogWithScopeAndFilter { - private MApplicationElement element; - private EStructuralFeature feature; - private EditingDomain editingDomain; - // private Map<IFile, Image> icons = Collections.synchronizedMap(new - // HashMap<IFile, Image>()); - - protected Messages Messages; - - public AbstractIconDialog(Shell parentShell, IEclipseContext context, IProject project, EditingDomain editingDomain, MApplicationElement element, EStructuralFeature feature, Messages Messages) { - super(parentShell, context); - this.editingDomain = editingDomain; - this.element = element; - this.feature = feature; - this.Messages = Messages; - context.set(Messages.class, Messages); - } - - @Override - protected String getFilterTextMessage() { - return Messages.AbstractIconDialog_Type_To_Start_Search; - } - - @Override - protected String getResourceNameText() { - return Messages.AbstractIconDialog_Icon_Name; - } - - @Override - protected void okPressed() { - super.okPressed(); - String uri = getValue(); - if (uri != null) { - Command cmd = SetCommand.create(editingDomain, element, feature, uri); - if (cmd.canExecute()) { - editingDomain.getCommandStack().execute(cmd); - } - } - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractIconDialogWithHardcodedScope.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractIconDialogWithHardcodedScope.java deleted file mode 100644 index 28bebe90..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractIconDialogWithHardcodedScope.java +++ /dev/null @@ -1,425 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Steven Spungin <steven@spungin.tv> - Bug 404136, 424730 - * Andrej ten Brummelhuis <andrejbrummelhuis@gmail.com> - Bug 395283 - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.Timer; -import java.util.TimerTask; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.list.WritableList; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceVisitor; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.tools.emf.ui.common.ResourceSearchScope; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.StringMatcher; -import org.eclipse.e4.tools.emf.ui.internal.common.component.tabs.empty.E; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.viewers.DoubleClickEvent; -import org.eclipse.jface.viewers.IDoubleClickListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StyledCellLabelProvider; -import org.eclipse.jface.viewers.StyledString; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.ViewerCell; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.layout.RowLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; - -/** - * Based of of AbstractIconDialog, but passively returns selection instead of - * modifying model. - * - * @author Steven Spungin - * - */ -public abstract class AbstractIconDialogWithHardcodedScope extends SaveDialogBoundsSettingsDialog { - private TableViewer viewer; - private IProject project; - private Map<IFile, Image> icons = Collections.synchronizedMap(new HashMap<IFile, Image>()); - private ResourceSearchScope searchScope = ResourceSearchScope.PROJECT; - - protected Messages Messages; - private Text textSearch; - private String value; - private IEclipseContext context; - - public AbstractIconDialogWithHardcodedScope(Shell parentShell, IEclipseContext context) { - super(parentShell); - this.context = context; - this.project = context.get(IProject.class); - Messages = context.get(Messages.class); - } - - protected IEclipseContext getContext() { - return context; - } - - protected abstract String getShellTitle(); - - protected abstract String getDialogTitle(); - - protected abstract String getDialogMessage(); - - @Override - protected Control createDialogArea(Composite parent) { - Composite comp = (Composite) super.createDialogArea(parent); - - getShell().setText(getShellTitle()); - setTitle(getDialogTitle()); - setMessage(getDialogMessage()); - String bundleFilter = (String) context.get("bundle"); //$NON-NLS-1$ - if (E.notEmpty(bundleFilter)) { - setMessage("Filtering by bundle " + bundleFilter); //$NON-NLS-1$ - } - - Composite container = new Composite(comp, SWT.NONE); - container.setLayoutData(new GridData(GridData.FILL_BOTH)); - container.setLayout(new GridLayout(2, false)); - - Composite compOptions = new Composite(container, SWT.NONE); - compOptions.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1)); - compOptions.setLayout(new RowLayout()); - - if (E.isEmpty(bundleFilter)) { - Button btnProject = new Button(compOptions, SWT.RADIO); - btnProject.setText(Messages.AbstractIconDialogWithHardcodedScope_Project); - btnProject.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - searchScope = ResourceSearchScope.PROJECT; - textSearch.notifyListeners(SWT.Modify, new Event()); - - } - }); - btnProject.setSelection(true); - - Button btnWorkspace = new Button(compOptions, SWT.RADIO); - btnWorkspace.setText(Messages.AbstractIconDialogWithHardcodedScope_Workspace); - btnWorkspace.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - searchScope = ResourceSearchScope.WORKSPACE; - textSearch.notifyListeners(SWT.Modify, new Event()); - } - }); - - btnWorkspace.setSelection(searchScope == ResourceSearchScope.WORKSPACE); - btnProject.setSelection(searchScope == ResourceSearchScope.PROJECT); - } else { - searchScope = ResourceSearchScope.WORKSPACE; - } - - Label l = new Label(container, SWT.NONE); - l.setText(Messages.AbstractIconDialog_IconName); - - textSearch = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH); - textSearch.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - new Label(container, SWT.NONE); - - viewer = new TableViewer(container, SWT.FULL_SELECTION | SWT.BORDER); - GridData gd = new GridData(GridData.FILL_BOTH); - viewer.getControl().setLayoutData(gd); - viewer.setContentProvider(new ObservableListContentProvider()); - viewer.setLabelProvider(new StyledCellLabelProvider() { - @Override - public void update(ViewerCell cell) { - IFile file = (IFile) cell.getElement(); - StyledString styledString = new StyledString(file.getProjectRelativePath().toString(), null); - - Image img = icons.get(file); - if (img == null) { - InputStream in = null; - try { - in = file.getContents(); - img = new Image(cell.getControl().getDisplay(), in); - icons.put(file, img); - } catch (CoreException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } finally { - if (in != null) { - try { - in.close(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - } - - String bundle = getBundle(file); - if (bundle != null) { - styledString.append(" - " + bundle, StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ - } - - cell.setImage(img); - cell.setText(styledString.getString()); - cell.setStyleRanges(styledString.getStyleRanges()); - } - }); - - final WritableList list = new WritableList(); - viewer.setInput(list); - viewer.addDoubleClickListener(new IDoubleClickListener() { - - @Override - public void doubleClick(DoubleClickEvent event) { - okPressed(); - } - }); - - textSearch.addModifyListener(new ModifyListener() { - private IconMatchCallback callback; - private Timer timer = new Timer(true); - private TimerTask task; - - @Override - public void modifyText(ModifyEvent e) { - if (callback != null) { - callback.cancel = true; - } - if (task != null) { - task.cancel(); - } - list.clear(); - - clearImages(); - - callback = new IconMatchCallback(list); - task = new SearchThread(callback, textSearch.getText(), project, context, searchScope); - timer.schedule(task, 500); - } - }); - - getShell().addDisposeListener(new DisposeListener() { - - @Override - public void widgetDisposed(DisposeEvent e) { - clearImages(); - } - }); - - textSearch.notifyListeners(SWT.Modify, new Event()); - - return comp; - } - - private void clearImages() { - for (Image img : icons.values()) { - img.dispose(); - } - icons.clear(); - } - - @Override - protected boolean isResizable() { - return true; - } - - @Override - protected void okPressed() { - value = null; - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (!s.isEmpty()) { - IFile file = (IFile) s.getFirstElement(); - String bundle = getBundle(file); - value = "platform:/plugin/" + bundle + "/" + file.getProjectRelativePath().toString(); //$NON-NLS-1$//$NON-NLS-2$ - - } - super.okPressed(); - } - - private String getBundle(IFile file) { - IProject project = file.getProject(); - IFile f = project.getFile("/META-INF/MANIFEST.MF"); //$NON-NLS-1$ - - if (f != null && f.exists()) { - BufferedReader r = null; - try { - InputStream s = f.getContents(); - r = new BufferedReader(new InputStreamReader(s)); - String line; - while ((line = r.readLine()) != null) { - if (line.startsWith("Bundle-SymbolicName:")) { //$NON-NLS-1$ - int start = line.indexOf(':'); - int end = line.indexOf(';'); - if (end == -1) { - end = line.length(); - } - return line.substring(start + 1, end).trim(); - } - } - } catch (CoreException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } finally { - if (r != null) { - try { - r.close(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - } - return null; - } - - public String getValue() { - return value; - } - - private class IconMatchCallback { - private volatile boolean cancel; - private IObservableList list; - - private IconMatchCallback(IObservableList list) { - this.list = list; - } - - public void match(final IFile file) { - if (!cancel) { - list.getRealm().exec(new Runnable() { - - @Override - public void run() { - list.add(file); - } - }); - } - } - } - - private static class SearchThread extends TimerTask { - private final IconMatchCallback callback; - private final IProject project; - private final StringMatcher matcherGif; - private final StringMatcher matcherJpg; - private final StringMatcher matcherPng; - private IEclipseContext context; - private ResourceSearchScope searchScope; - - public SearchThread(IconMatchCallback callback, String pattern, IProject project, IEclipseContext context, ResourceSearchScope searchScope) { - this.context = context; - this.matcherGif = new StringMatcher("*" + pattern + "*.gif", true, false); //$NON-NLS-1$//$NON-NLS-2$ - this.matcherJpg = new StringMatcher("*" + pattern + "*.jpg", true, false); //$NON-NLS-1$//$NON-NLS-2$ - this.matcherPng = new StringMatcher("*" + pattern + "*.png", true, false); //$NON-NLS-1$//$NON-NLS-2$ - this.callback = callback; - this.project = project; - this.searchScope = searchScope; - } - - @Override - public void run() { - List<IProject> projects; - switch (searchScope) { - case WORKSPACE: - projects = Arrays.asList(project.getWorkspace().getRoot().getProjects()); - break; - case PROJECT: - default: - projects = Arrays.asList(project); - break; - } - try { - for (IProject project : projects) { - // Only search bundles - IFile iFile = project.getFile("/META-INF/MANIFEST.MF"); //$NON-NLS-1$ - if (iFile.exists() == false) { - continue; - } - // Only search target bundle if specified - String bundle = (String) context.get("bundle"); //$NON-NLS-1$ - if (E.notEmpty(bundle)) { - InputStream inputStream = null; - try { - inputStream = iFile.getContents(); - Properties props = new Properties(); - props.load(inputStream); - String name = props.getProperty("Bundle-SymbolicName"); //$NON-NLS-1$ - String[] parts = name.split(";"); //$NON-NLS-1$ - if (parts[0].equals(bundle) == false) { - continue; - } - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } finally { - try { - inputStream.close(); - } catch (Exception ex) { - } - } - } - project.accept(new IResourceVisitor() { - - @Override - public boolean visit(IResource resource) throws CoreException { - if (callback.cancel) { - return false; - } - - if (resource.getType() == IResource.FOLDER || resource.getType() == IResource.PROJECT) { - return true; - } else if (resource.getType() == IResource.FILE && !resource.isLinked()) { - String path = resource.getProjectRelativePath().toString(); - if (matcherGif.match(path) || matcherPng.match(path) || matcherJpg.match(path)) { - callback.match((IFile) resource); - } - } - return false; - } - - }); - } - } catch (CoreException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractIconDialogWithScopeAndFilter.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractIconDialogWithScopeAndFilter.java deleted file mode 100644 index 8647a028..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractIconDialogWithScopeAndFilter.java +++ /dev/null @@ -1,477 +0,0 @@ -/******************************************************************************* - * - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Steven Spungin <steven@spungin.tv> - Bug 404136, Bug 424730, Bug 436281 - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; - -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Timer; -import java.util.TimerTask; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceVisitor; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider.ContributionData; -import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider.Filter; -import org.eclipse.e4.tools.emf.ui.common.ResourceSearchScope; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.StringMatcher; -import org.eclipse.e4.tools.emf.ui.internal.common.ClassContributionCollector; -import org.eclipse.e4.tools.emf.ui.internal.common.component.tabs.empty.E; -import org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.TargetPlatformIconContributionCollector; -import org.eclipse.jface.viewers.ComboViewer; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.StyledCellLabelProvider; -import org.eclipse.jface.viewers.StyledString; -import org.eclipse.jface.viewers.TableViewerColumn; -import org.eclipse.jface.viewers.ViewerCell; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Shell; - -/** - * A FilteredContributionDialog with additional options for icon resources. - * Features in include - * <ul> - * <li>Rebuilding the viewer when row height decreases. (Workaround for an SWT limitation) - * <li>Icon previews are displace in the first column. - * <li>Limited the maximum image size. - * </ul> - * - * @author "Steven Spungin" - * - * @see FilteredContributionDialog - */ -public abstract class AbstractIconDialogWithScopeAndFilter extends FilteredContributionDialog { - private final IProject project; - private final Map<IFile, Image> icons = Collections.synchronizedMap(new HashMap<IFile, Image>()); - - static public class Entry { - IFile file; - String installLocation; - } - - protected Integer maxDisplayedImageSize; - protected int maxImageHeight; - public static TargetPlatformIconContributionCollector collector; - - public AbstractIconDialogWithScopeAndFilter(Shell parentShell, IEclipseContext context) { - super(parentShell, context); - project = context.get(IProject.class); - } - - @Override - protected String getFilterTextMessage() { - return Messages.AbstractIconDialogWithScopeAndFilter_typeToStartSearch; - } - - @Override - protected String getResourceNameText() { - return Messages.AbstractIconDialogWithScopeAndFilter_iconName; - } - - @Override - protected ClassContributionCollector getCollector() { - if (collector == null) { - collector = TargetPlatformIconContributionCollector.getInstance(); - } - return collector; - } - - @Override - protected void createOptions(Composite compOptions) { - super.createOptions(compOptions); - - final Label lblMaxSize = new Label(compOptions, SWT.NONE); - lblMaxSize.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); - lblMaxSize.setText(Messages.AbstractIconDialogWithScopeAndFilter_maxDisplayedImageSize); - - final ComboViewer cv = new ComboViewer(compOptions); - cv.getCombo().setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false, 1, 1)); - cv.add(10); - cv.add(20); - cv.add(30); - cv.add(50); - cv.add(100); - cv.add(150); - cv.add(200); - maxDisplayedImageSize = 30; - cv.setSelection(new StructuredSelection(maxDisplayedImageSize)); - - cv.addSelectionChangedListener(new ISelectionChangedListener() { - - @Override - public void selectionChanged(SelectionChangedEvent event) { - maxDisplayedImageSize = (Integer) ((IStructuredSelection) cv.getSelection()).getFirstElement(); - rebuildViewer(); - refreshSearch(); - // combo viewer cannot make rows smaller, so we will need to - // rebuild it in that case. - } - }); - } - - @Override - protected void rebuildViewer() { - super.rebuildViewer(); - getViewer().getTable().setHeaderVisible(true); - - ((GridData) getViewer().getTable().getLayoutData()).minimumHeight = 100; - - final TableViewerColumn colIcon = new TableViewerColumn(getViewer(), SWT.NONE); - colIcon.getColumn().setText(Messages.AbstractIconDialogWithScopeAndFilter_icon); - final TableViewerColumn colText = new TableViewerColumn(getViewer(), SWT.NONE); - colText.getColumn().setText(Messages.AbstractIconDialogWithScopeAndFilter_details); - - // resize the row height using a MeasureItem listener - getViewer().getTable().addListener(SWT.MeasureItem, new Listener() { - @Override - public void handleEvent(Event event) { - // height cannot be per row so simply set - event.height = maxDisplayedImageSize; - } - }); - - colIcon.setLabelProvider(new StyledCellLabelProvider() { - @Override - public void update(ViewerCell cell) { - IFile file; - if (cell.getElement() instanceof ContributionData) { - file = new ContributionDataFile((ContributionData) cell.getElement()); - } else if (cell.getElement() instanceof Entry) { - file = ((Entry) cell.getElement()).file; - } else { - file = (IFile) cell.getElement(); - } - - Image img = icons.get(file); - if (img == null) { - InputStream in = null; - try { - in = file.getContents(); - img = new Image(cell.getControl().getDisplay(), in); - icons.put(file, img); - } catch (final Exception e) { - // e.printStackTrace(); - return; - } finally { - if (in != null) { - try { - in.close(); - } catch (final IOException e) { - // TODO Auto-generated catch block - // e.printStackTrace(); - } - } - } - } - - // scale image if larger then max height - // also remember max width for column resizing - - double scale1 = (double) maxDisplayedImageSize / img.getImageData().height; - final double scale2 = (double) maxDisplayedImageSize / img.getImageData().width; - if (scale2 < scale1) { - scale1 = scale2; - } - if (scale1 < 1) { - int width = (int) (img.getImageData().width * scale1); - if (width == 0) { - width = 1; - } - int height = (int) (img.getImageData().height * scale1); - if (height == 0) { - height = 1; - } - final Image img2 = new Image(img.getDevice(), img.getImageData().scaledTo(width, height)); - img.dispose(); - img = img2; - icons.put(file, img); - } - final int width = AbstractIconDialogWithScopeAndFilter.this.getViewer().getTable().getColumn(0) - .getWidth(); - if (img.getImageData().width > width) { - AbstractIconDialogWithScopeAndFilter.this.getViewer().getTable().getColumn(0) - .setWidth(img.getImageData().width); - } - final int height = img.getImageData().height; - if (height > maxImageHeight) { - maxImageHeight = height; - } - - cell.setImage(img); - } - }); - colIcon.getColumn().setWidth(30); - - colText.setLabelProvider(new StyledCellLabelProvider() { - @Override - public void update(ViewerCell cell) { - IFile file; - String installLocation = null; - if (cell.getElement() instanceof ContributionData) { - final ContributionData contributionData = (ContributionData) cell.getElement(); - file = new ContributionDataFile(contributionData); - installLocation = contributionData.installLocation; - } else if (cell.getElement() instanceof Entry) { - file = ((Entry) cell.getElement()).file; - installLocation = ((Entry) cell.getElement()).installLocation; - } else { - file = (IFile) cell.getElement(); - } - final StyledString styledString = new StyledString(file.getProjectRelativePath().toString(), null); - final String bundle = FilteredContributionDialog.getBundle(file); - if (bundle != null) { - styledString.append(" - " + bundle, StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ - } else if (installLocation != null) { - styledString.append(" - " + installLocation, StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ - } - - cell.setText(styledString.getString()); - cell.setStyleRanges(styledString.getStyleRanges()); - } - }); - colText.getColumn().setWidth(400); - - getShell().addDisposeListener(new DisposeListener() { - - @Override - public void widgetDisposed(DisposeEvent e) { - clearImages(); - } - }); - } - - @Override - protected Control createDialogArea(Composite parent) { - final Composite comp = (Composite) super.createDialogArea(parent); - maxDisplayedImageSize = 20; - rebuildViewer(); - - return comp; - } - - private IconMatchCallback callback; - private String returnValue; - private SearchThread task; - - @Override - protected boolean doSearch() { - - // if (getSearchScopes().contains(SearchScope.TARGET_PLATFORM) || - // getSearchScopes().contains(SearchScope.WORKSPACE)) { - if (getSearchScopes().contains(ResourceSearchScope.TARGET_PLATFORM)) { - return false; - } - final Timer timer = new Timer(true); - - if (callback != null) { - callback.cancel = true; - } - if (task != null) { - task.cancel(); - } - task = null; - - clearImages(); - - callback = new IconMatchCallback((IObservableList) getViewer().getInput()); - final Filter filter = new Filter(project, getFilterTextBox().getText()); - filter.setSearchScope(getSearchScopes()); - filter.setBundles(getFilterBundles()); - filter.setLocations(getFilterLocations()); - filter.setPackages(getFilterPackages()); - filter.setIncludeNonBundles(includeNonBundles); - task = new SearchThread(callback, filter); - timer.schedule(task, 500); - // } - return true; - } - - private void clearImages() { - for (final Image img : icons.values()) { - img.dispose(); - } - icons.clear(); - } - - @Override - protected void okPressed() { - returnValue = null; - IFile file = getSelectedIfile(); - if (file != null) { - String installLocation = null; - if (file instanceof ContributionDataFile) { - final ContributionDataFile cdf = (ContributionDataFile) file; - installLocation = cdf.getContributionData().installLocation; - - } - file = checkResourceAccessible(file, installLocation); - if (file != null) { - final String bundle = getBundle(file); - String uri; - uri = "platform:/plugin/" + bundle + "/" + file.getProjectRelativePath().toString(); //$NON-NLS-1$ //$NON-NLS-2$ - returnValue = uri; - super.okPressed(); - } - } - } - - private class IconMatchCallback { - private volatile boolean cancel; - private final IObservableList list; - - private IconMatchCallback(IObservableList list) { - this.list = list; - } - - public void match(final IFile file, final String installLocation) { - if (!cancel) { - list.getRealm().exec(new Runnable() { - - @Override - public void run() { - final Entry entry = new Entry(); - entry.file = file; - entry.installLocation = installLocation; - list.add(entry); - } - }); - } - } - } - - private static class SearchThread extends TimerTask { - private final IconMatchCallback callback; - private final StringMatcher matcherGif; - private final StringMatcher matcherJpg; - private final StringMatcher matcherPng; - private final Filter filter; - private boolean includeNonBundles; - - public SearchThread(IconMatchCallback callback, Filter filter) { - matcherGif = new StringMatcher("*" + filter.namePattern + "*.gif", true, false); //$NON-NLS-1$//$NON-NLS-2$ - matcherJpg = new StringMatcher("*" + filter.namePattern + "*.jpg", true, false); //$NON-NLS-1$//$NON-NLS-2$ - matcherPng = new StringMatcher("*" + filter.namePattern + "*.png", true, false); //$NON-NLS-1$//$NON-NLS-2$ - this.callback = callback; - this.filter = filter; - } - - @Override - public void run() { - List<IProject> projects; - if (filter.getSearchScope().contains(ResourceSearchScope.TARGET_PLATFORM)) { - // never should be here because it is cached and not run as - // thread - return; - } else if (filter.getSearchScope().contains(ResourceSearchScope.WORKSPACE)) { - projects = Arrays.asList(filter.project.getWorkspace().getRoot().getProjects()); - } else if (filter.getSearchScope().contains(ResourceSearchScope.PROJECT)) { - if (filter.getSearchScope().contains(ResourceSearchScope.REFERENCES)) { - projects = new ArrayList<IProject>(); - projects.add(filter.project); - try { - for (final IProject ref : filter.project.getReferencedProjects()) { - projects.add(ref); - } - } catch (final CoreException e) { - e.printStackTrace(); - } - } else { - projects = Arrays.asList(filter.project); - } - } else { - return; - } - - try { - for (final IProject project : projects) { - // Only search bundles unless requested - if (includeNonBundles == false && filter.project.getFile("/META-INF/MANIFEST.MF").exists() == false) { //$NON-NLS-1$ - continue; - } - project.accept(new IResourceVisitor() { - - @Override - public boolean visit(IResource resource) throws CoreException { - if (callback.cancel) { - return false; - } - - if (resource.getType() == IResource.FOLDER || resource.getType() == IResource.PROJECT) { - return true; - } else if (resource.getType() == IResource.FILE && !resource.isLinked()) { - final String path = resource.getProjectRelativePath().toString(); - if (matcherGif.match(path) || matcherPng.match(path) || matcherJpg.match(path)) { - if (E.notEmpty(filter.getPackages())) { - if (!filter.getPackages().contains( - resource.getProjectRelativePath().removeLastSegments(1).toOSString())) { - return false; - } - } - if (E.notEmpty(filter.getLocations())) { - if (!filter.getLocations().contains(project.getLocation().toOSString())) { - return false; - } - } - if (E.notEmpty(filter.getBundles())) { - final String bundle = getBundle(project); - if (bundle == null || !filter.getBundles().contains(bundle)) { - return false; - } - } - if (!filter.isIncludeNonBundles()) { - final String bundle = getBundle(project); - if (bundle == null) { - return false; - } - - } - callback.match((IFile) resource, project.getLocation().toOSString()); - } - } - return false; - } - - }); - } - } catch (final CoreException e) { - e.printStackTrace(); - } - } - } - - public String getValue() { - return returnValue; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractIdDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractIdDialog.java deleted file mode 100644 index 5299094b..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractIdDialog.java +++ /dev/null @@ -1,164 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 - 2014 fhv.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolaj Hoess <nicohoess@gmail.com> - initial implementation (Bug 396975) - * Andrej Brummelhuis <andrejbrummelhuis@gmail.com> - Bug 396975, 395283 - * Adrian Alcaide - initial implementation (Bug 396975) - *******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; - -import java.util.List; - -import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.PatternFilter; -import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory; -import org.eclipse.e4.ui.model.application.MApplicationElement; -import org.eclipse.e4.ui.workbench.modeling.EModelService; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.viewers.AbstractTreeViewer; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.DoubleClickEvent; -import org.eclipse.jface.viewers.IBaseLabelProvider; -import org.eclipse.jface.viewers.IDoubleClickListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StyledCellLabelProvider; -import org.eclipse.jface.viewers.StyledString; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerCell; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; - -public abstract class AbstractIdDialog<ContributionClass, ElementClass extends MApplicationElement> extends -SaveDialogBoundsSettingsDialog { - - protected EModelService modelService; - - protected TableViewer viewer; - protected EditingDomain domain; - protected IModelResource resource; - protected ContributionClass contribution; - protected Messages messages; - - public AbstractIdDialog(Shell parentShell, IModelResource resource, ContributionClass toolbarContribution, - EditingDomain domain, EModelService modelService, Messages Messages) { - super(parentShell); - this.resource = resource; - this.modelService = modelService; - this.messages = Messages; - this.domain = domain; - this.contribution = toolbarContribution; - } - - protected abstract String getShellTitle(); - - protected abstract String getDialogTitle(); - - protected abstract String getDialogMessage(); - - protected abstract String getLabelText(); - - protected abstract List<ElementClass> getViewerInput(); - - protected abstract EAttribute getFeatureLiteral(); - - protected abstract String getListItemInformation(ElementClass listItem); - - @Override - protected boolean isResizable() { - return true; - } - - protected IBaseLabelProvider getLabelProvider() { - return new StyledCellLabelProvider() { - - @Override - public void update(ViewerCell cell) { - final ElementClass el = (ElementClass) cell.getElement(); - final String elementId = el.getElementId() != null && el.getElementId().trim().length() > 0 ? el - .getElementId() : "(Id missing)"; //$NON-NLS-1$ - final StyledString str = new StyledString(elementId); - - final String infoString = getListItemInformation(el); - if (infoString != null && infoString.trim().length() > 0) - { - str.append(" - " + getListItemInformation(el), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ - } - - cell.setText(str.getString()); - cell.setStyleRanges(str.getStyleRanges()); - } - }; - } - - @Override - protected Control createDialogArea(Composite parent) { - getShell().setText(getShellTitle()); - setTitle(getDialogTitle()); - setMessage(getDialogMessage()); - final Composite comp = (Composite) super.createDialogArea(parent); - final Composite container = new Composite(comp, SWT.NONE); - container.setLayoutData(new GridData(GridData.FILL_BOTH)); - container.setLayout(new GridLayout(2, false)); - - Label l = new Label(container, SWT.NONE); - l.setText(getLabelText()); - - final Text idField = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH); - idField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - final PatternFilter filter = new PatternFilter() { - @Override - protected boolean isParentMatch(Viewer viewer, Object element) { - return viewer instanceof AbstractTreeViewer && super.isParentMatch(viewer, element); - } - }; - - l = new Label(container, SWT.NONE); - viewer = new TableViewer(container); - viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); - viewer.setContentProvider(new ArrayContentProvider()); - viewer.setLabelProvider(getLabelProvider()); - viewer.addFilter(filter); - viewer.addDoubleClickListener(new IDoubleClickListener() { - @Override - public void doubleClick(DoubleClickEvent event) { - okPressed(); - } - }); - - ControlFactory.attachFiltering(idField, viewer, filter); - - viewer.setInput(getViewerInput()); - - return comp; - } - - @Override - protected void okPressed() { - if (!viewer.getSelection().isEmpty()) { - final ElementClass el = (ElementClass) ((IStructuredSelection) viewer.getSelection()).getFirstElement(); - final Command cmd = SetCommand.create(domain, contribution, getFeatureLiteral(), el.getElementId()); - if (cmd.canExecute()) { - domain.getCommandStack().execute(cmd); - super.okPressed(); - } - } - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AreaIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AreaIconDialogEditor.java deleted file mode 100644 index 0d1a5391..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AreaIconDialogEditor.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Steven Spungin <steven@spungin.tv> - Bug 433408, 424730 - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; - -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.ui.model.application.MApplicationElement; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.swt.widgets.Shell; - -public class AreaIconDialogEditor extends AbstractIconDialog { - - public AreaIconDialogEditor(Shell parentShell, IEclipseContext context, IProject project, - EditingDomain editingDomain, MApplicationElement element, Messages Messages) { - super(parentShell, context, project, editingDomain, element, UiPackageImpl.Literals.UI_LABEL__ICON_URI, - Messages); - } - - @Override - protected String getShellTitle() { - return Messages.AreaIconDialogEditor_ShellTitle; - } - - @Override - protected String getDialogTitle() { - return Messages.AreaIconDialogEditor_DialogTitle; - } - - @Override - protected String getDialogMessage() { - return Messages.AreaIconDialogEditor_DialogMessage; - } - - @Override - protected String getFilterTextMessage() { - return Messages.AreaIconDialogEditor_Enter_Text; - } - - @Override - protected String getResourceNameText() { - return Messages.AreaIconDialogEditor_Icon; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/BindingContextSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/BindingContextSelectionDialog.java deleted file mode 100644 index 37fdb263..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/BindingContextSelectionDialog.java +++ /dev/null @@ -1,191 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010-2014 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Andrej ten Brummelhuis <andrejbrummelhuis@gmail.com> - Bug 395283 - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.PatternFilter; -import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory; -import org.eclipse.e4.ui.model.application.commands.MBindingContext; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; -import org.eclipse.emf.common.util.TreeIterator; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.jface.viewers.AbstractTreeViewer; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.DoubleClickEvent; -import org.eclipse.jface.viewers.IDoubleClickListener; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StyledCellLabelProvider; -import org.eclipse.jface.viewers.StyledString; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerCell; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; - -public class BindingContextSelectionDialog extends SaveDialogBoundsSettingsDialog { - private final IModelResource resource; - private TableViewer viewer; - private MBindingContext selectedContext; - private final Messages Messages; - - public BindingContextSelectionDialog(Shell parentShell, IModelResource resource, Messages Messages) { - super(parentShell); - this.resource = resource; - this.Messages = Messages; - } - - public MBindingContext getSelectedContext() { - return selectedContext; - } - - @Override - protected Control createDialogArea(Composite parent) { - final Composite composite = (Composite) super.createDialogArea(parent); - getShell().setText(Messages.BindingContextSelectionDialog_ShellTitle); - setTitle(Messages.BindingContextSelectionDialog_Title); - setMessage(Messages.BindingContextSelectionDialog_Message); - - final Image titleImage = new Image(composite.getDisplay(), getClass().getClassLoader().getResourceAsStream( - "/icons/full/wizban/newexp_wiz.png")); //$NON-NLS-1$ - setTitleImage(titleImage); - getShell().addDisposeListener(new DisposeListener() { - - @Override - public void widgetDisposed(DisposeEvent e) { - titleImage.dispose(); - } - }); - - final Composite container = new Composite(composite, SWT.NONE); - container.setLayoutData(new GridData(GridData.FILL_BOTH)); - container.setLayout(new GridLayout(2, false)); - - final Label l = new Label(container, SWT.NONE); - l.setText(Messages.BindingContextSelectionDialog_LabelContextId); - - final Text searchText = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH); - searchText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - new Label(container, SWT.NONE); - viewer = new TableViewer(container); - viewer.setContentProvider(new ArrayContentProvider()); - viewer.setLabelProvider(new LabelProviderImpl()); - viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); - viewer.addDoubleClickListener(new IDoubleClickListener() { - - @Override - public void doubleClick(DoubleClickEvent event) { - okPressed(); - } - }); - - final List<EObject> categories = new ArrayList<EObject>(); - final TreeIterator<EObject> it = EcoreUtil.getAllContents((EObject) resource.getRoot().get(0), true); - while (it.hasNext()) { - final EObject o = it.next(); - if (o.eClass() == CommandsPackageImpl.Literals.BINDING_CONTEXT) { - categories.add(o); - } - } - viewer.setInput(categories); - - final PatternFilter filter = new PatternFilter() { - @Override - protected boolean isParentMatch(Viewer viewer, Object element) { - return viewer instanceof AbstractTreeViewer && super.isParentMatch(viewer, element); - } - }; - viewer.addFilter(filter); - - ControlFactory.attachFiltering(searchText, viewer, filter); - - return composite; - } - - @Override - protected void okPressed() { - final IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (!s.isEmpty()) { - selectedContext = (MBindingContext) s.getFirstElement(); - if (selectedContext != null) { - super.okPressed(); - } else { - setErrorMessage(Messages.BindingContextSelectionDialog_NoIdReference); - } - } - } - - private static class LabelProviderImpl extends StyledCellLabelProvider implements ILabelProvider { - - @Override - public void update(final ViewerCell cell) { - final MBindingContext cmd = (MBindingContext) cell.getElement(); - - final StyledString styledString = new StyledString(); - if (cmd.getName() != null) { - styledString.append(cmd.getName()); - } - - if (cmd.getElementId() != null) { - styledString.append(" (" + cmd.getElementId() + ")", StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ //$NON-NLS-2$ - } else { - styledString.append(" (<no id>)", StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ - } - - if (cmd.getDescription() != null) { - styledString.append(" - " + cmd.getDescription(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ - } - - cell.setText(styledString.getString()); - cell.setStyleRanges(styledString.getStyleRanges()); - } - - @Override - public Image getImage(Object element) { - return null; - } - - @Override - public String getText(Object element) { - final MBindingContext command = (MBindingContext) element; - String s = ""; //$NON-NLS-1$ - if (command.getName() != null) { - s += command.getName(); - } - - if (command.getDescription() != null) { - s += " " + command.getDescription(); //$NON-NLS-1$ - } - - if (command.getElementId() != null) { - s += " " + command.getElementId(); //$NON-NLS-1$ - } - - return s; - } - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/BundleImageCache.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/BundleImageCache.java deleted file mode 100644 index 45f014b9..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/BundleImageCache.java +++ /dev/null @@ -1,132 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation - *******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; - -import java.net.URL; -import java.util.ArrayList; -import java.util.Iterator; - -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.tools.services.IResourcePool; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Display; - -/** - * A manager for images. Features include: - * <ul> - * <li>Eliminates the need to pass in Display when creating images - * <li>Loading an image from a bundle - * <li>Cleanup of cache - * </ul> - * - * Images returned by this method must never be disposed of outside of this - * class, as placeholders are used. - * - * @author "Steven Spungin" - * - */ -public class BundleImageCache { - - private final Display display; - private final ClassLoader classloader; - ArrayList<Image> images; - static private Image imgPlaceholder; - private final IEclipseContext context; - - public BundleImageCache(Display display, ClassLoader classloader) { - this(display, classloader, null); - } - - public BundleImageCache(Display display, ClassLoader classloader, IEclipseContext context) { - this.display = display; - this.classloader = classloader; - this.context = context; - images = new ArrayList<Image>(); - } - - /** - * Creates the image, and tracks it for a bulk dispose operation. - * - * @param path - * @return the {@link Image} - */ - public Image create(String path) { - Image img; - try { - img = new Image(display, classloader.getResourceAsStream(path)); - images.add(img); - } catch (final Exception e) { - e.printStackTrace(); - img = getPlaceholder(); - } - return img; - } - - /** - * Uses IResourcePool to obtain image. Does not track object. - * - * @param key - * @return The {@link Image} - */ - public Image loadFromKey(String key) { - Image ret = null; - try { - ret = context.get(IResourcePool.class).getImageUnchecked(key); - } catch (final Exception ex) { - ex.printStackTrace(); - } - if (ret == null) { - ret = getPlaceholder(); - } - return ret; - } - - protected Image getPlaceholder() { - if (imgPlaceholder == null) { - imgPlaceholder = new Image(Display.getDefault(), - classloader.getResourceAsStream("/icons/full/obj16/missing_image_placeholder.png")); //$NON-NLS-1$ - } - return imgPlaceholder; - } - - @Override - protected void finalize() throws Throwable { - if (imgPlaceholder != null && imgPlaceholder.isDisposed() == false) { - imgPlaceholder.dispose(); - } - } - - public void dispose() { - for (final Iterator<Image> it = images.iterator(); it.hasNext();) { - final Image image = it.next(); - if (image.isDisposed() == false) { - image.dispose(); - } - it.remove(); - } - } - - public Image create(String bundleId, String path) { - if (path.startsWith("/") == false) { //$NON-NLS-1$ - path = "/" + path; //$NON-NLS-1$ - } - Image img; - try { - img = new Image(display, new URL("platform:/plugin/" + bundleId + path).openStream()); //$NON-NLS-1$ - images.add(img); - } catch (final Exception e) { - e.printStackTrace(); - img = getPlaceholder(); - } - return img; - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/CommandCategorySelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/CommandCategorySelectionDialog.java deleted file mode 100644 index c78e9907..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/CommandCategorySelectionDialog.java +++ /dev/null @@ -1,189 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010-2014 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Andrej ten Brummelhuis <andrejbrummelhuis@gmail.com> - Bug 395283 - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.PatternFilter; -import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory; -import org.eclipse.e4.ui.model.application.commands.MCategory; -import org.eclipse.e4.ui.model.application.commands.MCommand; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.util.TreeIterator; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.jface.viewers.AbstractTreeViewer; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.DoubleClickEvent; -import org.eclipse.jface.viewers.IDoubleClickListener; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StyledCellLabelProvider; -import org.eclipse.jface.viewers.StyledString; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerCell; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; - -public class CommandCategorySelectionDialog extends SaveDialogBoundsSettingsDialog { - private final IModelResource resource; - private TableViewer viewer; - private final MCommand command; - private final Messages Messages; - - public CommandCategorySelectionDialog(Shell parentShell, IModelResource resource, MCommand command, - Messages Messages) { - super(parentShell); - this.resource = resource; - this.command = command; - this.Messages = Messages; - } - - @Override - protected Control createDialogArea(Composite parent) { - final Composite composite = (Composite) super.createDialogArea(parent); - getShell().setText(Messages.CommandCategorySelectionDialog_ShellTitle); - setTitle(Messages.CommandCategorySelectionDialog_Title); - setMessage(Messages.CommandCategorySelectionDialog_Message); - - final Image titleImage = new Image(composite.getDisplay(), getClass().getClassLoader().getResourceAsStream( - "/icons/full/wizban/newexp_wiz.png")); //$NON-NLS-1$ - setTitleImage(titleImage); - getShell().addDisposeListener(new DisposeListener() { - - @Override - public void widgetDisposed(DisposeEvent e) { - titleImage.dispose(); - } - }); - - final Composite container = new Composite(composite, SWT.NONE); - container.setLayoutData(new GridData(GridData.FILL_BOTH)); - container.setLayout(new GridLayout(2, false)); - - final Label l = new Label(container, SWT.NONE); - l.setText(Messages.CommandCategorySelectionDialog_LabelCategoryId); - - final Text searchText = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH); - searchText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - new Label(container, SWT.NONE); - viewer = new TableViewer(container); - viewer.setContentProvider(new ArrayContentProvider()); - viewer.setLabelProvider(new LabelProviderImpl()); - viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); - viewer.addDoubleClickListener(new IDoubleClickListener() { - - @Override - public void doubleClick(DoubleClickEvent event) { - okPressed(); - } - }); - - final List<EObject> categories = new ArrayList<EObject>(); - final TreeIterator<EObject> it = EcoreUtil.getAllContents((EObject) resource.getRoot().get(0), true); - while (it.hasNext()) { - final EObject o = it.next(); - if (o.eClass() == CommandsPackageImpl.Literals.CATEGORY) { - categories.add(o); - } - } - viewer.setInput(categories); - - final PatternFilter filter = new PatternFilter() { - @Override - protected boolean isParentMatch(Viewer viewer, Object element) { - return viewer instanceof AbstractTreeViewer && super.isParentMatch(viewer, element); - } - }; - viewer.addFilter(filter); - - ControlFactory.attachFiltering(searchText, viewer, filter); - - return composite; - } - - @Override - protected void okPressed() { - final IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (!s.isEmpty()) { - final Command cmd = SetCommand.create(resource.getEditingDomain(), command, - CommandsPackageImpl.Literals.COMMAND__CATEGORY, s.getFirstElement()); - if (cmd.canExecute()) { - resource.getEditingDomain().getCommandStack().execute(cmd); - super.okPressed(); - } - } - } - - private static class LabelProviderImpl extends StyledCellLabelProvider implements ILabelProvider { - - @Override - public void update(final ViewerCell cell) { - final MCategory cmd = (MCategory) cell.getElement(); - - final StyledString styledString = new StyledString(); - if (cmd.getName() != null) { - styledString.append(cmd.getName()); - } - if (cmd.getElementId() != null) { - styledString.append(" (" + cmd.getElementId() + ")", StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ //$NON-NLS-2$ - } else { - styledString.append(" (<no id>)", StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ - } - if (cmd.getDescription() != null) { - styledString.append(" - " + cmd.getDescription(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ - } - cell.setText(styledString.getString()); - cell.setStyleRanges(styledString.getStyleRanges()); - } - - @Override - public Image getImage(Object element) { - return null; - } - - @Override - public String getText(Object element) { - final MCategory command = (MCategory) element; - String s = ""; //$NON-NLS-1$ - if (command.getName() != null) { - s += command.getName(); - } - - if (command.getDescription() != null) { - s += " " + command.getDescription(); //$NON-NLS-1$ - } - - if (command.getElementId() != null) { - s += " " + command.getElementId(); //$NON-NLS-1$ - } - - return s; - } - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java deleted file mode 100644 index 27580b7a..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java +++ /dev/null @@ -1,127 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Lars Vogel <lars.vogel@gmail.com> - Enhancements - * Steven Spungin <steven@spungin.tv> - Bug 424730, Bug 436847 - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; - -import org.eclipse.core.resources.IFile; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider.ContributionData; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.common.ClassContributionCollector; -import org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.TargetPlatformClassContributionCollector; -import org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.TargetPlatformContributionCollector; -import org.eclipse.e4.ui.model.application.MApplicationElement; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Shell; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.FrameworkUtil; -import org.osgi.framework.ServiceReference; - -public class ContributionClassDialog extends FilteredContributionDialog { - - private MApplicationElement contribution; - private EditingDomain editingDomain; - private EStructuralFeature feature; - private Messages Messages; - - public ContributionClassDialog(Shell parentShell, IEclipseContext context, EditingDomain editingDomain, MApplicationElement contribution, EStructuralFeature feature, Messages Messages) { - super(parentShell, context); - this.contribution = contribution; - this.editingDomain = editingDomain; - this.feature = feature; - this.Messages = Messages; - } - - @Override - protected Image getTitleImage() { - return new Image(getShell().getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/full/wizban/newclass_wiz.png")); //$NON-NLS-1$ - } - - @Override - protected void okPressed() { - IStructuredSelection s = (IStructuredSelection) getViewer().getSelection(); - if (!s.isEmpty()) { - ContributionData cd = (ContributionData) s.getFirstElement(); - ContributionDataFile cdf = new ContributionDataFile(cd); - IFile file = checkResourceAccessible(cdf, cd.installLocation); - if (file != null) { - if (file instanceof ContributionDataFile) { - cdf = (ContributionDataFile) file; - cd = cdf.getContributionData(); - } - String uri = "bundleclass://" + cd.bundleName + "/" + cd.className; //$NON-NLS-1$ //$NON-NLS-2$ - Command cmd = SetCommand.create(editingDomain, contribution, feature, uri); - if (cmd.canExecute()) { - editingDomain.getCommandStack().execute(cmd); - super.okPressed(); - } - } - } - } - - @Override - protected ClassContributionCollector getCollector() { - switch (getScope()) { - case TARGET_PLATFORM: - case WORKSPACE: - if (collector instanceof TargetPlatformContributionCollector == false) { - collector = TargetPlatformClassContributionCollector.getInstance(); - } - break; - case PROJECT: - Bundle bundle = FrameworkUtil.getBundle(ContributionClassDialog.class); - BundleContext context = bundle.getBundleContext(); - ServiceReference<?> ref = context.getServiceReference(ClassContributionCollector.class.getName()); - if (ref != null) { - collector = (ClassContributionCollector) context.getService(ref); - } else { - collector = null; - } - break; - default: - collector = null; - break; - } - return collector; - } - - @Override - protected String getShellTitle() { - return Messages.ContributionClassDialog_DialogTitle; - } - - @Override - protected String getDialogTitle() { - return Messages.ContributionClassDialog_DialogTitle; - } - - @Override - protected String getDialogMessage() { - return Messages.ContributionClassDialog_DialogMessage; - } - - @Override - protected String getResourceNameText() { - return Messages.ContributionClassDialog_Label_Classname; - } - - @Override - protected String getFilterTextMessage() { - return Messages.ContributionClassDialog_FilterText_Message; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionDataFile.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionDataFile.java deleted file mode 100644 index 82461709..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionDataFile.java +++ /dev/null @@ -1,696 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 424730 - *******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; - -import java.io.BufferedInputStream; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.Reader; -import java.net.MalformedURLException; -import java.net.URI; -import java.net.URL; -import java.util.Map; -import java.util.zip.ZipEntry; -import java.util.zip.ZipFile; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFileState; -import org.eclipse.core.resources.IMarker; -import org.eclipse.core.resources.IPathVariableManager; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IProjectDescription; -import org.eclipse.core.resources.IResourceProxy; -import org.eclipse.core.resources.IResourceProxyVisitor; -import org.eclipse.core.resources.IResourceVisitor; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.ResourceAttributes; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.QualifiedName; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.content.IContentDescription; -import org.eclipse.core.runtime.jobs.ISchedulingRule; -import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider.ContributionData; - -/** - * An IFile wrapper for ContributionData. This is only partially implemented for - * the icon search dialog. - * - * @author Steven Spungin - * - */ -public class ContributionDataFile implements IFile { - - private final ContributionData data; - private IPath path; - - public ContributionDataFile(ContributionData data) { - this.data = data; - if (data.iconPath != null) { - path = Path.fromOSString(data.iconPath); - } - } - - public String getBundle() { - return data.bundleName; - } - - public ContributionData getContributionData() { - return data; - } - - @Override - public IPath getProjectRelativePath() { - if (getContributionData().installLocation != null) { - return new Path(data.resourceRelativePath); - } - return new Path(data.iconPath); - } - - @Override - public void accept(IResourceProxyVisitor visitor, int memberFlags) throws CoreException { - // TODO Auto-generated method stub - - } - - @Override - public void accept(IResourceProxyVisitor visitor, int depth, int memberFlags) throws CoreException { - // TODO Auto-generated method stub - - } - - @Override - public void accept(IResourceVisitor visitor) throws CoreException { - // TODO Auto-generated method stub - - } - - @Override - public void accept(IResourceVisitor visitor, int depth, boolean includePhantoms) throws CoreException { - // TODO Auto-generated method stub - - } - - @Override - public void accept(IResourceVisitor visitor, int depth, int memberFlags) throws CoreException { - // TODO Auto-generated method stub - - } - - @Override - public void clearHistory(IProgressMonitor monitor) throws CoreException { - // TODO Auto-generated method stub - - } - - @Override - public void copy(IPath destination, boolean force, IProgressMonitor monitor) throws CoreException { - // TODO Auto-generated method stub - - } - - @Override - public void copy(IPath destination, int updateFlags, IProgressMonitor monitor) throws CoreException { - // TODO Auto-generated method stub - - } - - @Override - public void copy(IProjectDescription description, boolean force, IProgressMonitor monitor) throws CoreException { - // TODO Auto-generated method stub - - } - - @Override - public void copy(IProjectDescription description, int updateFlags, IProgressMonitor monitor) throws CoreException { - // TODO Auto-generated method stub - - } - - @Override - public IMarker createMarker(String type) throws CoreException { - // TODO Auto-generated method stub - return null; - } - - @Override - public IResourceProxy createProxy() { - // TODO Auto-generated method stub - return null; - } - - @Override - public void delete(boolean force, IProgressMonitor monitor) throws CoreException { - // TODO Auto-generated method stub - - } - - @Override - public void delete(int updateFlags, IProgressMonitor monitor) throws CoreException { - // TODO Auto-generated method stub - - } - - @Override - public void deleteMarkers(String type, boolean includeSubtypes, int depth) throws CoreException { - // TODO Auto-generated method stub - - } - - @Override - public boolean exists() { - // TODO Auto-generated method stub - return false; - } - - @Override - public IMarker findMarker(long id) throws CoreException { - // TODO Auto-generated method stub - return null; - } - - @Override - public IMarker[] findMarkers(String type, boolean includeSubtypes, int depth) throws CoreException { - // TODO Auto-generated method stub - return null; - } - - @Override - public int findMaxProblemSeverity(String type, boolean includeSubtypes, int depth) throws CoreException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public String getFileExtension() { - return path.getFileExtension(); - } - - @Override - public long getLocalTimeStamp() { - // TODO Auto-generated method stub - return 0; - } - - @Override - public IPath getLocation() { - // TODO Auto-generated method stub - return null; - } - - @Override - public URI getLocationURI() { - // TODO Auto-generated method stub - return null; - } - - @Override - public IMarker getMarker(long id) { - // TODO Auto-generated method stub - return null; - } - - @Override - public long getModificationStamp() { - // TODO Auto-generated method stub - return 0; - } - - @Override - public IPathVariableManager getPathVariableManager() { - // TODO Auto-generated method stub - return null; - } - - @Override - public IContainer getParent() { - // TODO Auto-generated method stub - return null; - } - - @Override - public Map<QualifiedName, String> getPersistentProperties() throws CoreException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getPersistentProperty(QualifiedName key) throws CoreException { - // TODO Auto-generated method stub - return null; - } - - @Override - public IProject getProject() { - // TODO Auto-generated method stub - return null; - } - - @Override - public IPath getRawLocation() { - // TODO Auto-generated method stub - return null; - } - - @Override - public URI getRawLocationURI() { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResourceAttributes getResourceAttributes() { - // TODO Auto-generated method stub - return null; - } - - @Override - public Map<QualifiedName, Object> getSessionProperties() throws CoreException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Object getSessionProperty(QualifiedName key) throws CoreException { - // TODO Auto-generated method stub - return null; - } - - @Override - public int getType() { - // TODO Auto-generated method stub - return 0; - } - - @Override - public IWorkspace getWorkspace() { - // TODO Auto-generated method stub - return null; - } - - @Override - public boolean isAccessible() { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isDerived() { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isDerived(int options) { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isHidden() { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isHidden(int options) { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isLinked() { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isVirtual() { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isLinked(int options) { - // TODO Auto-generated method stub - return false; - } - - @Deprecated - @Override - public boolean isLocal(int depth) { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isPhantom() { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isSynchronized(int depth) { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isTeamPrivateMember() { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isTeamPrivateMember(int options) { - // TODO Auto-generated method stub - return false; - } - - @Override - public void move(IPath destination, boolean force, IProgressMonitor monitor) throws CoreException { - // TODO Auto-generated method stub - - } - - @Override - public void move(IPath destination, int updateFlags, IProgressMonitor monitor) throws CoreException { - // TODO Auto-generated method stub - - } - - @Override - public void move(IProjectDescription description, boolean force, boolean keepHistory, IProgressMonitor monitor) - throws CoreException { - // TODO Auto-generated method stub - - } - - @Override - public void move(IProjectDescription description, int updateFlags, IProgressMonitor monitor) throws CoreException { - // TODO Auto-generated method stub - - } - - @Override - public void refreshLocal(int depth, IProgressMonitor monitor) throws CoreException { - // TODO Auto-generated method stub - - } - - @Override - public void revertModificationStamp(long value) throws CoreException { - // TODO Auto-generated method stub - - } - - @Deprecated - @Override - public void setDerived(boolean isDerived) throws CoreException { - // TODO Auto-generated method stub - - } - - @Override - public void setDerived(boolean isDerived, IProgressMonitor monitor) throws CoreException { - // TODO Auto-generated method stub - - } - - @Override - public void setHidden(boolean isHidden) throws CoreException { - // TODO Auto-generated method stub - - } - - @Deprecated - @Override - public void setLocal(boolean flag, int depth, IProgressMonitor monitor) throws CoreException { - // TODO Auto-generated method stub - - } - - @Override - public long setLocalTimeStamp(long value) throws CoreException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public void setPersistentProperty(QualifiedName key, String value) throws CoreException { - // TODO Auto-generated method stub - - } - - @Deprecated - @Override - public void setReadOnly(boolean readOnly) { - // TODO Auto-generated method stub - - } - - @Override - public void setResourceAttributes(ResourceAttributes attributes) throws CoreException { - // TODO Auto-generated method stub - - } - - @Override - public void setSessionProperty(QualifiedName key, Object value) throws CoreException { - // TODO Auto-generated method stub - - } - - @Override - public void setTeamPrivateMember(boolean isTeamPrivate) throws CoreException { - // TODO Auto-generated method stub - - } - - @Override - public void touch(IProgressMonitor monitor) throws CoreException { - // TODO Auto-generated method stub - - } - - @Override - public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) { - // TODO Auto-generated method stub - return null; - } - - @Override - public boolean contains(ISchedulingRule rule) { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isConflicting(ISchedulingRule rule) { - // TODO Auto-generated method stub - return false; - } - - @Override - public void appendContents(InputStream source, boolean force, boolean keepHistory, IProgressMonitor monitor) - throws CoreException { - // TODO Auto-generated method stub - - } - - @Override - public void appendContents(InputStream source, int updateFlags, IProgressMonitor monitor) throws CoreException { - // TODO Auto-generated method stub - - } - - @Override - public void create(InputStream source, boolean force, IProgressMonitor monitor) throws CoreException { - // TODO Auto-generated method stub - - } - - @Override - public void create(InputStream source, int updateFlags, IProgressMonitor monitor) throws CoreException { - // TODO Auto-generated method stub - - } - - @Override - public void createLink(IPath localLocation, int updateFlags, IProgressMonitor monitor) throws CoreException { - // TODO Auto-generated method stub - - } - - @Override - public void createLink(URI location, int updateFlags, IProgressMonitor monitor) throws CoreException { - // TODO Auto-generated method stub - - } - - @Override - public void delete(boolean force, boolean keepHistory, IProgressMonitor monitor) throws CoreException { - // TODO Auto-generated method stub - - } - - @Override - public String getCharset() throws CoreException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getCharset(boolean checkImplicit) throws CoreException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getCharsetFor(Reader reader) throws CoreException { - // TODO Auto-generated method stub - return null; - } - - @Override - public IContentDescription getContentDescription() throws CoreException { - // TODO Auto-generated method stub - return null; - } - - @Override - public InputStream getContents() throws CoreException { - URL url; - ZipFile zip = null; - try { - if (path.getFileExtension().equals("jar")) { //$NON-NLS-1$ - zip = new ZipFile(path.toOSString()); - ZipEntry entry; - if (getContributionData().className != null) { - entry = zip.getEntry(getContributionData().className.replace('.', '/') + ".class"); //$NON-NLS-1$ - } else { - entry = zip.getEntry(data.iconPath); - } - return zip.getInputStream(entry); - } - url = new URL("platform:/plugin/" + data.bundleName + "/" + data.iconPath); //$NON-NLS-1$ //$NON-NLS-2$ - InputStream ret; - try { - ret = url.openStream(); - } catch (final Exception e) { - return new BufferedInputStream(new FileInputStream(data.installLocation - + "/" + data.resourceRelativePath)); //$NON-NLS-1$ - } - return ret; - } catch (final MalformedURLException e) { - e.printStackTrace(); - throw new CoreException(Status.CANCEL_STATUS); - } catch (final IOException e) { - // perhaps not a bundle - // e.printStackTrace(); - throw new CoreException(Status.CANCEL_STATUS); - } finally { - if (zip != null) { - try { - zip.close(); - } catch (final IOException e) { - } - } - } - } - - @Override - public InputStream getContents(boolean force) throws CoreException { - // TODO Auto-generated method stub - return null; - } - - @Deprecated - @Override - public int getEncoding() throws CoreException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public IPath getFullPath() { - return path; - } - - @Override - public IFileState[] getHistory(IProgressMonitor monitor) throws CoreException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getName() { - // TODO Auto-generated method stub - return null; - } - - @Override - public boolean isReadOnly() { - // TODO Auto-generated method stub - return false; - } - - @Override - public void move(IPath destination, boolean force, boolean keepHistory, IProgressMonitor monitor) - throws CoreException { - // TODO Auto-generated method stub - - } - - @Deprecated - @Override - public void setCharset(String newCharset) throws CoreException { - // TODO Auto-generated method stub - - } - - @Override - public void setCharset(String newCharset, IProgressMonitor monitor) throws CoreException { - // TODO Auto-generated method stub - - } - - @Override - public void setContents(InputStream source, boolean force, boolean keepHistory, IProgressMonitor monitor) - throws CoreException { - // TODO Auto-generated method stub - - } - - @Override - public void setContents(IFileState source, boolean force, boolean keepHistory, IProgressMonitor monitor) - throws CoreException { - // TODO Auto-generated method stub - - } - - @Override - public void setContents(InputStream source, int updateFlags, IProgressMonitor monitor) throws CoreException { - // TODO Auto-generated method stub - - } - - @Override - public void setContents(IFileState source, int updateFlags, IProgressMonitor monitor) throws CoreException { - // TODO Auto-generated method stub - - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ExpressionIdDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ExpressionIdDialog.java deleted file mode 100644 index 9f6ccf0f..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ExpressionIdDialog.java +++ /dev/null @@ -1,155 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010-2014 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Andrej ten Brummelhuis <andrejbrummelhuis@gmail.com> - Bug 395283 - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtension; -import org.eclipse.e4.tools.emf.ui.common.IExtensionLookup; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.PatternFilter; -import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory; -import org.eclipse.e4.ui.model.application.ui.MCoreExpression; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.viewers.AbstractTreeViewer; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.DoubleClickEvent; -import org.eclipse.jface.viewers.IDoubleClickListener; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StyledCellLabelProvider; -import org.eclipse.jface.viewers.StyledString; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerCell; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; - -public class ExpressionIdDialog extends SaveDialogBoundsSettingsDialog { - private final IExtensionLookup lookup; - private TableViewer viewer; - private final EditingDomain domain; - private final MCoreExpression expression; - private final boolean liveModel; - private final Messages Messages; - - public ExpressionIdDialog(Shell parentShell, IExtensionLookup lookup, MCoreExpression expression, - EditingDomain domain, boolean liveModel, Messages Messages) { - super(parentShell); - this.lookup = lookup; - this.expression = expression; - this.domain = domain; - this.liveModel = liveModel; - this.Messages = Messages; - } - - @Override - protected Control createDialogArea(Composite parent) { - getShell().setText(Messages.ExpressionIdDialog_ShellTitle); - setTitle(Messages.ExpressionIdDialog_DialogTitle); - setMessage(Messages.ExpressionIdDialog_DialogMessage); - final Composite comp = (Composite) super.createDialogArea(parent); - final Composite container = new Composite(comp, SWT.NONE); - container.setLayoutData(new GridData(GridData.FILL_BOTH)); - container.setLayout(new GridLayout(2, false)); - - Label l = new Label(container, SWT.NONE); - l.setText(Messages.ExpressionIdDialog_Id); - - final Text idField = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH); - idField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - final PatternFilter filter = new PatternFilter() { - @Override - protected boolean isParentMatch(Viewer viewer, Object element) { - return viewer instanceof AbstractTreeViewer && super.isParentMatch(viewer, element); - } - }; - - l = new Label(container, SWT.NONE); - viewer = new TableViewer(container); - viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); - viewer.setContentProvider(new ArrayContentProvider()); - viewer.setLabelProvider(new LabelProviderImpl()); - viewer.addFilter(filter); - viewer.setInput(getElements(lookup)); - viewer.addDoubleClickListener(new IDoubleClickListener() { - - @Override - public void doubleClick(DoubleClickEvent event) { - okPressed(); - } - }); - - ControlFactory.attachFiltering(idField, viewer, filter); - - return comp; - } - - @Override - protected void okPressed() { - if (!viewer.getSelection().isEmpty()) { - final IConfigurationElement el = (IConfigurationElement) ((IStructuredSelection) viewer.getSelection()) - .getFirstElement(); - final Command cmd = SetCommand.create(domain, expression, - UiPackageImpl.Literals.CORE_EXPRESSION__CORE_EXPRESSION_ID, el.getAttribute("id")); //$NON-NLS-1$ - if (cmd.canExecute()) { - domain.getCommandStack().execute(cmd); - super.okPressed(); - } - } - } - - private List<IConfigurationElement> getElements(IExtensionLookup lookup) { - final List<IConfigurationElement> list = new ArrayList<IConfigurationElement>(); - for (final IExtension ext : lookup.findExtensions("org.eclipse.core.expressions.definitions", liveModel)) { //$NON-NLS-1$ - for (final IConfigurationElement el : ext.getConfigurationElements()) { - list.add(el); - } - } - return list; - } - - static class LabelProviderImpl extends StyledCellLabelProvider implements ILabelProvider { - @Override - public void update(ViewerCell cell) { - final IConfigurationElement el = (IConfigurationElement) cell.getElement(); - final StyledString str = new StyledString(el.getAttribute("id")); //$NON-NLS-1$ - str.append(" - " + el.getContributor().getName(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ - cell.setText(str.getString()); - cell.setStyleRanges(str.getStyleRanges()); - } - - @Override - public Image getImage(Object element) { - return null; - } - - @Override - public String getText(Object element) { - final IConfigurationElement el = (IConfigurationElement) element; - return el.getAttribute("id") + " " + el.getContributor().getName(); //$NON-NLS-1$//$NON-NLS-2$ - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FeatureSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FeatureSelectionDialog.java deleted file mode 100644 index 43ff0299..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FeatureSelectionDialog.java +++ /dev/null @@ -1,438 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010-2014 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Andrej ten Brummelhuis <andrejbrummelhuis@gmail.com> - Bug 395283 - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; - -import java.text.BreakIterator; -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.Util.InternalClass; -import org.eclipse.e4.tools.emf.ui.common.Util.InternalFeature; -import org.eclipse.e4.tools.emf.ui.common.Util.InternalPackage; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.StringMatcher; -import org.eclipse.e4.ui.model.fragment.MStringModelFragment; -import org.eclipse.e4.ui.model.fragment.impl.FragmentPackageImpl; -import org.eclipse.e4.ui.model.internal.ModelUtils; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.viewers.DoubleClickEvent; -import org.eclipse.jface.viewers.IDoubleClickListener; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredViewer; -import org.eclipse.jface.viewers.StyledCellLabelProvider; -import org.eclipse.jface.viewers.StyledString; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerCell; -import org.eclipse.jface.viewers.ViewerComparator; -import org.eclipse.jface.viewers.ViewerFilter; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; - -public class FeatureSelectionDialog extends SaveDialogBoundsSettingsDialog { - private TreeViewer viewer; - private final MStringModelFragment fragment; - private final EditingDomain editingDomain; - private final Messages Messages; - private ViewerFilterImpl filter; - - public FeatureSelectionDialog(Shell parentShell, EditingDomain editingDomain, MStringModelFragment fragment, - Messages Messages) { - super(parentShell); - this.fragment = fragment; - this.editingDomain = editingDomain; - this.Messages = Messages; - } - - @Override - protected boolean isResizable() { - return true; - } - - @Override - protected Control createDialogArea(Composite parent) { - getShell().setText(Messages.FeatureSelectionDialog_ShellTitle); - setTitle(Messages.FeatureSelectionDialog_DialogTitle); - setMessage(Messages.FeatureSelectionDialog_DialogMessage); - - final Composite composite = (Composite) super.createDialogArea(parent); - - final Image packageImage = new Image(getShell().getDisplay(), getClass().getClassLoader().getResourceAsStream( - "/icons/full/obj16/EPackage.gif")); //$NON-NLS-1$ - final Image classImage = new Image(getShell().getDisplay(), getClass().getClassLoader().getResourceAsStream( - "/icons/full/obj16/class_obj.gif")); //$NON-NLS-1$ - final Image featureImage = new Image(getShell().getDisplay(), getClass().getClassLoader().getResourceAsStream( - "/icons/full/obj16/field_public_obj.gif")); //$NON-NLS-1$ - final Image newTitleImage = new Image(getShell().getDisplay(), getClass().getClassLoader().getResourceAsStream( - "/icons/full/wizban/fieldrefact_wiz.png")); //$NON-NLS-1$ - - setTitleImage(newTitleImage); - - composite.addDisposeListener(new DisposeListener() { - - @Override - public void widgetDisposed(DisposeEvent e) { - packageImage.dispose(); - classImage.dispose(); - featureImage.dispose(); - newTitleImage.dispose(); - } - }); - - final Composite container = new Composite(composite, SWT.NONE); - container.setLayoutData(new GridData(GridData.FILL_BOTH)); - container.setLayout(new GridLayout(2, false)); - - final Label l = new Label(container, SWT.NONE); - l.setText(Messages.FeatureSelectionDialog_Filter); - - final Text searchText = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH); - searchText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - searchText.addModifyListener(new ModifyListener() { - - @Override - public void modifyText(ModifyEvent e) { - if (filter != null) { - filter.setPattern(searchText.getText()); - if (viewer != null) { - viewer.refresh(); - if (searchText.getText().length() > 0) { - viewer.expandAll(); - } else { - viewer.collapseAll(); - } - } - } - } - }); - new Label(container, SWT.NONE); - viewer = new TreeViewer(container); - final GridData gd = new GridData(GridData.FILL_BOTH); - gd.heightHint = 200; - viewer.getControl().setLayoutData(gd); - viewer.setContentProvider(new ContentProviderImpl()); - viewer.setLabelProvider(new LabelProviderImpl(packageImage, classImage, featureImage)); - viewer.addDoubleClickListener(new IDoubleClickListener() { - - @Override - public void doubleClick(DoubleClickEvent event) { - okPressed(); - } - }); - viewer.setComparator(new ViewerComparator() { - @Override - public int compare(Viewer viewer, Object e1, Object e2) { - if (e1.getClass() == InternalPackage.class) { - return ((InternalPackage) e1).ePackage.getNsURI().compareTo( - ((InternalPackage) e2).ePackage.getNsURI()); - } else if (e1.getClass() == InternalClass.class) { - return ((InternalClass) e1).eClass.getName().compareTo(((InternalClass) e2).eClass.getName()); - } else if (e1.getClass() == InternalFeature.class) { - return ((InternalFeature) e1).feature.getName().compareTo(((InternalFeature) e2).feature.getName()); - } - return super.compare(viewer, e1, e2); - } - }); - viewer.addSelectionChangedListener(new ISelectionChangedListener() { - @Override - public void selectionChanged(SelectionChangedEvent event) { - final IStructuredSelection selection = (IStructuredSelection) event.getSelection(); - final Button buttonOk = getButton(IDialogConstants.OK_ID); - if (!selection.isEmpty() && selection.getFirstElement().getClass() == InternalFeature.class) { - buttonOk.setEnabled(true); - } else { - buttonOk.setEnabled(false); - } - } - }); - - filter = new ViewerFilterImpl(); - - viewer.addFilter(filter); - - viewer.setInput(Util.loadPackages()); - - return composite; - } - - @Override - protected void okPressed() { - final IStructuredSelection sel = (IStructuredSelection) viewer.getSelection(); - if (!sel.isEmpty() && sel.getFirstElement().getClass() == InternalFeature.class) { - final InternalFeature f = (InternalFeature) sel.getFirstElement(); - final Command cmd = SetCommand.create(editingDomain, fragment, - FragmentPackageImpl.Literals.STRING_MODEL_FRAGMENT__FEATURENAME, f.feature.getName()); - - if (cmd.canExecute()) { - editingDomain.getCommandStack().execute(cmd); - super.okPressed(); - } - } - } - - static class ContentProviderImpl implements ITreeContentProvider { - - @Override - public void dispose() { - - } - - @Override - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - - } - - @Override - public Object[] getElements(Object inputElement) { - return ((List<?>) inputElement).toArray(); - } - - @Override - public Object[] getChildren(Object parentElement) { - if (parentElement.getClass() == InternalPackage.class) { - return ((InternalPackage) parentElement).classes.toArray(); - } else if (parentElement.getClass() == InternalClass.class) { - return ((InternalClass) parentElement).features.toArray(); - } - return new Object[0]; - } - - @Override - public Object getParent(Object element) { - if (element.getClass() == InternalFeature.class) { - return ((InternalFeature) element).clazz; - } else if (element.getClass() == InternalClass.class) { - return ((InternalClass) element).pack; - } - return null; - } - - @Override - public boolean hasChildren(Object element) { - return getChildren(element).length > 0; - } - - } - - static class LabelProviderImpl extends StyledCellLabelProvider implements ILabelProvider { - private final Image packageImage; - private final Image classImage; - private final Image featureImage; - - public LabelProviderImpl(Image packageImage, Image classImage, Image featureImage) { - this.packageImage = packageImage; - this.classImage = classImage; - this.featureImage = featureImage; - } - - @Override - public void update(final ViewerCell cell) { - if (cell.getElement().getClass() == InternalPackage.class) { - final InternalPackage o = (InternalPackage) cell.getElement(); - final StyledString styledString = new StyledString(o.ePackage.getName()); - styledString.append(" - " + o.ePackage.getNsURI(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ - cell.setText(styledString.getString()); - cell.setStyleRanges(styledString.getStyleRanges()); - cell.setImage(packageImage); - } else if (cell.getElement().getClass() == InternalClass.class) { - final InternalClass o = (InternalClass) cell.getElement(); - cell.setText(o.eClass.getName()); - cell.setImage(classImage); - } else { - final InternalFeature o = (InternalFeature) cell.getElement(); - final StyledString styledString = new StyledString(o.feature.getName()); - - final EClassifier type = ModelUtils.getTypeArgument(o.clazz.eClass, o.feature.getEGenericType()); - if (o.feature.isMany()) { - styledString.append(" : List<" + type.getName() + ">", StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ //$NON-NLS-2$ - } else { - styledString.append(" : " + type.getName(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ - } - - cell.setText(styledString.getString()); - cell.setStyleRanges(styledString.getStyleRanges()); - cell.setImage(featureImage); - } - } - - @Override - public Image getImage(Object element) { - return null; - } - - @Override - public String getText(Object element) { - if (element.getClass() == InternalPackage.class) { - final InternalPackage o = (InternalPackage) element; - return o.ePackage.getName(); - } else if (element.getClass() == InternalClass.class) { - final InternalClass o = (InternalClass) element; - return o.eClass.getName(); - } else { - final InternalFeature o = (InternalFeature) element; - return o.feature.getName(); - } - } - } - - static class ViewerFilterImpl extends ViewerFilter { - private static final String WILDCARD = "*"; //$NON-NLS-1$ - private StringMatcher matcher; - - @Override - public boolean select(Viewer viewer, Object parentElement, Object element) { - final ILabelProvider pv = (ILabelProvider) ((StructuredViewer) viewer).getLabelProvider(); - - if (element.getClass() == InternalPackage.class) { - for (final InternalClass c : ((InternalPackage) element).classes) { - if (match(pv.getText(c))) { - return true; - } - for (final InternalFeature f : c.features) { - if (match(pv.getText(f))) { - return true; - } - } - } - return false; - } else if (element.getClass() == InternalClass.class) { - if (match(pv.getText(element))) { - return true; - } - for (final InternalFeature f : ((InternalClass) element).features) { - if (match(pv.getText(f))) { - return true; - } - } - return false; - } else if (element.getClass() == InternalFeature.class) { - return match(pv.getText(element)); - } - return true; - } - - protected boolean wordMatches(String text) { - if (text == null) { - return false; - } - - // If the whole text matches we are all set - if (match(text)) { - return true; - } - - // Otherwise check if any of the words of the text matches - final String[] words = getWords(text); - for (int i = 0; i < words.length; i++) { - final String word = words[i]; - if (match(word)) { - return true; - } - } - - return false; - } - - /** - * Answers whether the given String matches the pattern. - * - * @param string - * the String to test - * - * @return whether the string matches the pattern - */ - private boolean match(String string) { - if (matcher == null) { - return true; - } - return matcher.match(string); - } - - /** - * The pattern string for which this filter should select elements in - * the viewer. - * - * @param patternString - */ - public void setPattern(String patternString) { - - if (patternString == null || patternString.length() == 0) { - matcher = null; - } else { - String pattern = patternString + WILDCARD; - if (!pattern.startsWith(WILDCARD)) { - pattern = WILDCARD + pattern; - } - matcher = new StringMatcher(pattern, true, false); - } - } - - /** - * Take the given filter text and break it down into words using a - * BreakIterator. - * - * @param text - * @return an array of words - */ - private String[] getWords(String text) { - final List<String> words = new ArrayList<String>(); - // Break the text up into words, separating based on whitespace and - // common punctuation. - // Previously used String.split(..., "\\W"), where "\W" is a regular - // expression (see the Javadoc for class Pattern). - // Need to avoid both String.split and regular expressions, in order - // to - // compile against JCL Foundation (bug 80053). - // Also need to do this in an NL-sensitive way. The use of - // BreakIterator - // was suggested in bug 90579. - final BreakIterator iter = BreakIterator.getWordInstance(); - iter.setText(text); - int i = iter.first(); - while (i != java.text.BreakIterator.DONE && i < text.length()) { - int j = iter.following(i); - if (j == java.text.BreakIterator.DONE) { - j = text.length(); - } - // match the word - if (Character.isLetterOrDigit(text.charAt(i))) { - final String word = text.substring(i, j); - words.add(word); - } - i = j; - } - return words.toArray(new String[words.size()]); - } - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FilteredContributionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FilteredContributionDialog.java deleted file mode 100644 index bb9c845a..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FilteredContributionDialog.java +++ /dev/null @@ -1,1157 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 424730, Bug 435625, Bug 436281 - * Andrej ten Brummelhuis <andrejbrummelhuis@gmail.com> - Bug 395283 - * Marco Descher <marco@descher.at> - Bug 442647 - *******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.EnumSet; -import java.util.HashSet; -import java.util.List; -import java.util.Scanner; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.list.WritableList; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider.ContributionData; -import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider.ContributionResultHandler; -import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider.Filter; -import org.eclipse.e4.tools.emf.ui.common.IProviderStatusCallback; -import org.eclipse.e4.tools.emf.ui.common.ProviderStatus; -import org.eclipse.e4.tools.emf.ui.common.ResourceSearchScope; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.common.ClassContributionCollector; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.AbstractIconDialogWithScopeAndFilter.Entry; -import org.eclipse.e4.tools.emf.ui.internal.common.component.tabs.empty.E; -import org.eclipse.e4.tools.emf.ui.internal.common.component.tabs.empty.TitleAreaFilterDialog; -import org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.TargetPlatformClassContributionCollector; -import org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.TargetPlatformContributionCollector; -import org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.TargetPlatformIconContributionCollector; -import org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.dialogs.NonReferencedResourceDialog; -import org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.dialogs.NonReferencedResourceWizard; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.text.Document; -import org.eclipse.jface.viewers.ColumnLabelProvider; -import org.eclipse.jface.viewers.DoubleClickEvent; -import org.eclipse.jface.viewers.IDoubleClickListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StyledCellLabelProvider; -import org.eclipse.jface.viewers.StyledString; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.ViewerCell; -import org.eclipse.jface.window.Window; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.pde.internal.core.project.PDEProject; -import org.eclipse.pde.internal.core.text.bundle.BundleModel; -import org.eclipse.pde.internal.core.text.bundle.ImportPackageHeader; -import org.eclipse.pde.internal.core.text.bundle.ImportPackageObject; -import org.eclipse.pde.internal.core.text.bundle.RequireBundleHeader; -import org.eclipse.pde.internal.core.text.bundle.RequireBundleObject; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.events.KeyAdapter; -import org.eclipse.swt.events.KeyEvent; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.layout.RowLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; - -/** - * Abstract base class for a find contribution dialog.<br /> - * Includes a filter text box, scope options, and filter options. - * - * @author Steven Spungin - * - */ -public abstract class FilteredContributionDialog extends SaveDialogBoundsSettingsDialog { - - private static final int MAX_RESULTS = 500; - private Image contributionTypeImage; - private TableViewer viewer; - private static final String PREF_SEARCHSCOPE = "searchScope"; //$NON-NLS-1$ - private ResourceSearchScope searchScope = ResourceSearchScope.PROJECT; - private static final String PREF_SEARCHSCOPES = "searchScopes"; //$NON-NLS-1$ - private EnumSet<ResourceSearchScope> searchScopes = EnumSet.of(ResourceSearchScope.PROJECT); - // private EnumSet<SearchScope> searchScopes = - // EnumSet.of(SearchScope.PROJECT, SearchScope.REFERENCES); - protected ClassContributionCollector collector; - private Text textBox; - private Button btnFilterNone; - private Button btnFilterBundle; - private Button btnFilterPackage; - private List<String> filterBundles; - private List<String> filterPackages; - private Button btnFilterLocation; - private List<String> filterLocations; - private Button btnClearCache; - private final IEclipseContext context; - private Composite compOptions; - protected boolean includeNonBundles; - private Label lblStatus; - private Button btnIncludeNoneBundle; - private WritableList viewerList; - protected BundleImageCache imageCache; - protected Job currentSearchThread; - private ContributionResultHandlerImpl currentResultHandler; - protected ProviderStatus providerStatus; - protected int hint; - protected int maxResults; - protected boolean searching; - - abstract protected ClassContributionCollector getCollector(); - - abstract protected String getFilterTextMessage(); - - abstract protected String getResourceNameText(); - - abstract protected String getDialogMessage(); - - abstract protected String getDialogTitle(); - - abstract protected String getShellTitle(); - - private void updateStatusMessage() { - String message = ""; //$NON-NLS-1$ - if (searching) { - message += Messages.FilteredContributionDialog_Searching; - } - // dlg.setStatus("More than " + filter.maxResults + - // " items were found and have not been displayed"); - if (hint != 0) { - if (hint == ContributionResultHandler.MORE_CANCELED) { - message += Messages.FilteredContributionDialog_SearchWasCancelled; - } else { - message += Messages.FilteredContributionDialog_MoreThan + maxResults - + Messages.FilteredContributionDialog_itemsWereFound; - } - } - - if (getCollector() instanceof TargetPlatformContributionCollector) { - if (providerStatus != null) { - switch (providerStatus) { - case READY: - break; - case INITIALIZING: - message += Messages.FilteredContributionDialog_ProviderInitializing; - break; - case CANCELLED: - message += Messages.FilteredContributionDialog_ProviderWasCancelled; - break; - } - } - } - setMessage(message); - } - - private class ContributionResultHandlerImpl implements ContributionResultHandler { - private boolean cancled = false; - private final IObservableList list; - - public ContributionResultHandlerImpl(IObservableList list) { - this.list = list; - } - - @Override - public void result(final ContributionData data) { - if (!cancled) { - getShell().getDisplay().syncExec(new Runnable() { - - @Override - public void run() { - list.add(data); - } - }); - } - } - - @Override - public void moreResults(final int hint, final Filter filter) { - if (!cancled) { - getShell().getDisplay().syncExec(new Runnable() { - - @Override - public void run() { - final FilteredContributionDialog dlg = (FilteredContributionDialog) filter.userData; - dlg.hint = hint; - dlg.maxResults = filter.maxResults; - dlg.updateStatusMessage(); - } - }); - } - } - } - - @Override - public boolean close() { - stopSearchThread(true); - getPreferences().put(PREF_SEARCHSCOPE, searchScope.toString()); - getPreferences().put(PREF_SEARCHSCOPES, searchScopes.toString()); - return super.close(); - } - - @Override - protected Control createContents(Composite parent) { - final Control ret = super.createContents(parent); - textBox.notifyListeners(SWT.Modify, new Event()); - textBox.setFocus(); - return ret; - } - - public FilteredContributionDialog(Shell parentShell, IEclipseContext context) { - super(parentShell); - this.context = context; - imageCache = new BundleImageCache(context.get(Display.class), getClass().getClassLoader()); - - final String searchScopeString = getPreferences().get(PREF_SEARCHSCOPE, ResourceSearchScope.PROJECT.toString()); - searchScope = ResourceSearchScope.valueOf(searchScopeString); - - final String searchScopesString = getPreferences().get(PREF_SEARCHSCOPES, - EnumSet.of(ResourceSearchScope.PROJECT).toString()); - searchScopes = valueOf(ResourceSearchScope.class, searchScopesString); - } - - public static <TheType extends Enum<TheType>> EnumSet<TheType> valueOf(Class<TheType> eClass, String str) { - final String[] arr = str.substring(1, str.length() - 1).split(","); //$NON-NLS-1$ - final EnumSet<TheType> set = EnumSet.noneOf(eClass); - for (final String e : arr) { - set.add(Enum.valueOf(eClass, e.trim())); - } - return set; - } - - public void setStatus(final String message) { - getShell().getDisplay().asyncExec(new Runnable() { - - @Override - public void run() { - lblStatus.setText(message); - } - }); - } - - @Override - protected void createButtonsForButtonBar(Composite parent) { - super.createButtonsForButtonBar(parent); - ((GridLayout) parent.getLayout()).numColumns = 4; - - btnClearCache = new Button(parent, SWT.PUSH); - btnClearCache.setText(Messages.FilteredContributionDialog_ClearCache); - btnClearCache.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - getCollector().clearModelCache(); - } - }); - - btnClearCache.moveAbove(getButton(0)); - - lblStatus = new Label(parent, SWT.NONE); - lblStatus.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); - lblStatus.setText(""); //$NON-NLS-1$ - lblStatus.moveAbove(btnClearCache); - - // This is called here instead of create contents because btnClearCache - // is referenced in updateUiState. - updateUiState(); - } - - // TODO add results found (and/or more indicator) - @Override - protected Control createDialogArea(Composite parent) { - final Composite comp = (Composite) super.createDialogArea(parent); - getShell().addDisposeListener(new DisposeListener() { - - @Override - public void widgetDisposed(DisposeEvent e) { - imageCache.dispose(); - - if (contributionTypeImage.isDisposed() == false) { - contributionTypeImage.dispose(); - } - if (getTitleImageLabel().getImage() != null && getTitleImage().isDisposed() == false) { - getTitleImageLabel().getImage().dispose(); - } - } - }); - - getShell().setText(getShellTitle()); - setTitle(getDialogTitle()); - setMessage(getDialogMessage()); - - final Image titleImage = getTitleImage(); - setTitleImage(titleImage); - - // TODO param or context - contributionTypeImage = imageCache.create("/icons/full/obj16/class_obj.gif"); //$NON-NLS-1$ - - compOptions = new Composite(comp, SWT.NONE); - compOptions.setLayoutData(new GridData(GridData.FILL_BOTH)); - compOptions.setLayout(new GridLayout(2, false)); - - createOptions(compOptions); - - final Label l = new Label(compOptions, SWT.NONE); - l.setText(getResourceNameText()); - - textBox = new Text(compOptions, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH); - textBox.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - textBox.setMessage(getFilterTextMessage()); - - new Label(compOptions, SWT.NONE); - - rebuildViewer(); - - collector = getCollector(); - - textBox.addKeyListener(new KeyAdapter() { - @Override - public void keyPressed(KeyEvent e) { - if (e.keyCode == SWT.ARROW_DOWN) { - if (viewer.getTable().getItemCount() > 0) { - viewer.getTable().setFocus(); - viewer.getTable().select(0); - } - } - } - }); - - viewer.getTable().addKeyListener(new KeyAdapter() { - @Override - public void keyPressed(KeyEvent e) { - super.keyPressed(e); - if (e.keyCode == SWT.ARROW_UP && viewer.getTable().getSelectionIndex() == 0) { - textBox.setFocus(); - } - } - }); - - textBox.addModifyListener(new ModifyListener() { - - @Override - public void modifyText(ModifyEvent e) { - stopSearchThread(true); - setMessage(""); //$NON-NLS-1$ - - viewerList.clear(); - if (doSearch() == true) { - return; - } - searching = true; - updateStatusMessage(); - - currentSearchThread = new Job(Messages.FilteredContributionDialog_ContributionSearch) { - - Filter filter; - - @Override - protected IStatus run(IProgressMonitor monitor) { - monitor.beginTask(Messages.FilteredContributionDialog_ContributionSearch, - IProgressMonitor.UNKNOWN); - currentResultHandler = new ContributionResultHandlerImpl(viewerList); - getShell().getDisplay().syncExec(new Runnable() { - - @Override - public void run() { - if (searchScopes.contains(ResourceSearchScope.PROJECT)) { - filter = new Filter(context.get(IProject.class), textBox.getText()); - } else { - // filter = new Filter(null, - // textBox.getText()); - filter = new Filter(context.get(IProject.class), textBox.getText()); - } - } - }); - filter.maxResults = MAX_RESULTS; - filter.userData = FilteredContributionDialog.this; - filter.setBundles(filterBundles); - filter.setPackages(filterPackages); - filter.setLocations(filterLocations); - filter.setSearchScope(searchScopes); - filter.setIncludeNonBundles(includeNonBundles); - filter.setProgressMonitor(monitor); - filter.setProviderStatusCallback(new IProviderStatusCallback() { - - @Override - public void onStatusChanged(final ProviderStatus status) { - providerStatus = status; - try { - getShell().getDisplay().syncExec(new Runnable() { - - @Override - public void run() { - updateStatusMessage(); - switch (status) { - case READY: - // This will deadlock if - // currentSearchThread is not - // null - currentSearchThread = null; - if (currentResultHandler != null) { - currentResultHandler.cancled = true; - } - refreshSearch(); - break; - case CANCELLED: - case INITIALIZING: - break; - } - } - }); - } catch (final Exception e2) { - // Dialog may have been closed while - // provider was still indexing - } - } - }); - collector.findContributions(filter, currentResultHandler); - - monitor.done(); - searching = false; - currentSearchThread = null; - getShell().getDisplay().syncExec(new Runnable() { - - @Override - public void run() { - updateStatusMessage(); - } - }); - return Status.OK_STATUS; - } - - }; - currentSearchThread.schedule(); - - } - }); - - return comp; - } - - protected Image getTitleImage() { - return imageCache.create("/icons/full/wizban/newsearch_wiz.gif"); //$NON-NLS-1$ - } - - protected void createOptions(Composite compOptions) { - { - final Label lblScope = new Label(compOptions, SWT.NONE); - lblScope.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); - lblScope.setText(Messages.FilteredContributionDialog_Scope); - - final Composite compScope = new Composite(compOptions, SWT.NONE); - compScope.setLayoutData(new GridData(SWT.BEGINNING, SWT.TOP, false, false)); - compScope.setLayout(new RowLayout()); - - final Button btnScopeProject = new Button(compScope, SWT.RADIO); - btnScopeProject.setText(Messages.FilteredContributionDialog_ProjectOnly); - btnScopeProject.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (btnScopeProject.getSelection()) { - searchScope = ResourceSearchScope.PROJECT; - searchScopes = EnumSet.of(ResourceSearchScope.PROJECT); - updateUiState(); - getCollector(); - refreshSearch(); - } - } - }); - btnScopeProject.setSelection(searchScopes.contains(ResourceSearchScope.PROJECT) - && !searchScopes.contains(ResourceSearchScope.REFERENCES)); - - final Button btnProjectAndReferences = new Button(compScope, SWT.RADIO); - btnProjectAndReferences.setText(Messages.FilteredContributionDialog_ProjectAndReferences); - btnProjectAndReferences.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (btnProjectAndReferences.getSelection()) { - searchScope = ResourceSearchScope.PROJECT; - searchScopes = EnumSet.of(ResourceSearchScope.PROJECT, ResourceSearchScope.REFERENCES); - updateUiState(); - getCollector(); - refreshSearch(); - } - } - }); - btnProjectAndReferences.setSelection(searchScopes.contains(ResourceSearchScope.PROJECT) - && searchScopes.contains(ResourceSearchScope.REFERENCES)); - - final Button btnScopeWorkspace = new Button(compScope, SWT.RADIO); - btnScopeWorkspace.setText(Messages.FilteredContributionDialog_Workspace); - btnScopeWorkspace.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (btnScopeWorkspace.getSelection()) { - searchScope = ResourceSearchScope.WORKSPACE; - searchScopes = EnumSet.of(ResourceSearchScope.WORKSPACE); - updateUiState(); - getCollector(); - refreshSearch(); - } - } - }); - btnScopeWorkspace.setSelection(searchScopes.contains(ResourceSearchScope.WORKSPACE)); - - final Button btnScopeTargetPlatform = new Button(compScope, SWT.RADIO); - btnScopeTargetPlatform.setText(Messages.FilteredContributionDialog_TargetPlatform); - btnScopeTargetPlatform.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (btnScopeTargetPlatform.getSelection()) { - searchScope = ResourceSearchScope.TARGET_PLATFORM; - searchScopes = EnumSet.of(ResourceSearchScope.TARGET_PLATFORM); - updateUiState(); - getCollector(); - refreshSearch(); - } - } - }); - btnScopeTargetPlatform.setSelection(searchScopes.contains(ResourceSearchScope.TARGET_PLATFORM)); - } - - { - final Label lblFilter = new Label(compOptions, SWT.NONE); - lblFilter.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); - lblFilter.setText(Messages.FilteredContributionDialog_ScopeFilter); - - final Composite compFilter = new Composite(compOptions, SWT.NONE); - compFilter.setLayoutData(new GridData(SWT.BEGINNING, SWT.TOP, false, false)); - compFilter.setLayout(new RowLayout()); - - btnFilterNone = new Button(compFilter, SWT.CHECK); - btnFilterNone.setText(Messages.FilteredContributionDialog_None); - btnFilterNone.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (btnFilterNone.getSelection()) { - removeFilters(); - } - } - }); - - btnFilterBundle = new Button(compFilter, SWT.CHECK); - btnFilterBundle.setText(Messages.FilteredContributionDialog_Bundle); - btnFilterBundle.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (btnFilterBundle.getSelection()) { - showBundleFilter(); - } else { - filterBundles = null; - refreshSearch(); - updateUiState(); - } - } - }); - - btnFilterPackage = new Button(compFilter, SWT.CHECK); - btnFilterPackage.setText(Messages.FilteredContributionDialog_Package); - btnFilterPackage.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (btnFilterPackage.getSelection()) { - showPackageFilter(); - } else { - filterPackages = null; - refreshSearch(); - updateUiState(); - } - } - }); - - btnFilterLocation = new Button(compFilter, SWT.CHECK); - btnFilterLocation.setText(Messages.FilteredContributionDialog_Location); - btnFilterLocation.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (btnFilterLocation.getSelection()) { - showLocationFilter(); - } else { - filterLocations = null; - refreshSearch(); - updateUiState(); - } - } - }); - - } - { - final Label lblIncludeNoneBundle = new Label(compOptions, SWT.NONE); - lblIncludeNoneBundle.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); - lblIncludeNoneBundle.setText(Messages.FilteredContributionDialog_NonBundles); - - btnIncludeNoneBundle = new Button(compOptions, SWT.CHECK); - btnIncludeNoneBundle.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); - btnIncludeNoneBundle.setText(""); //$NON-NLS-1$ - btnIncludeNoneBundle.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - includeNonBundles = btnIncludeNoneBundle.getSelection(); - refreshSearch(); - } - }); - } - } - - /** - * - * @return false if default search should be performed, or true if virtual - * function will handle - */ - protected boolean doSearch() { - return false; - } - - protected void updateUiState() { - btnFilterNone.setSelection(E.isEmpty(filterBundles) && E.isEmpty(filterPackages) && E.isEmpty(filterLocations)); - btnFilterBundle.setSelection(E.notEmpty(filterBundles)); - btnFilterPackage.setSelection(E.notEmpty(filterPackages)); - btnFilterLocation.setSelection(E.notEmpty(filterLocations)); - - // original (default) contribution filter does not support this - // filtering API - final boolean enabled = !searchScopes.contains(ResourceSearchScope.PROJECT); - btnFilterNone.setEnabled(enabled); - btnFilterBundle.setEnabled(enabled); - btnFilterLocation.setEnabled(enabled); - btnFilterPackage.setEnabled(enabled); - btnClearCache.setEnabled(enabled); - btnIncludeNoneBundle.setEnabled(enabled); - } - - protected void removeFilters() { - filterBundles = null; - setFilterPackages(null); - filterLocations = null; - refreshSearch(); - updateUiState(); - } - - @Override - protected boolean isResizable() { - return true; - } - - public List<String> getFilterPackages() { - return filterPackages; - } - - public void setFilterPackages(List<String> filterPackages) { - this.filterPackages = filterPackages; - } - - public List<String> getFilterLocations() { - return filterLocations; - } - - public void setFilterLocations(List<String> filterLocations) { - this.filterLocations = filterLocations; - } - - public List<String> getFilterBundles() { - return filterBundles; - } - - public void setFilterBundles(List<String> filterBundles) { - this.filterBundles = filterBundles; - } - - protected void refreshSearch() { - textBox.notifyListeners(SWT.Modify, new Event()); - } - - protected void showBundleFilter() { - final Collection<String> bundleIds; - // TODO make HasBundles an interface so we are not tied to - // implementation - if (getCollector() instanceof TargetPlatformClassContributionCollector) { - bundleIds = TargetPlatformClassContributionCollector.getInstance().getBundleIds(); - } else if (getCollector() instanceof TargetPlatformIconContributionCollector) { - bundleIds = TargetPlatformIconContributionCollector.getInstance().getBundleIds(); - } else { - return; - } - - final ArrayList<String> sorted = new ArrayList<String>(bundleIds); - Collections.sort(sorted); - - final TitleAreaFilterDialog dlg = new TitleAreaFilterDialog(getShell(), new ColumnLabelProvider()) { - @Override - protected Control createContents(Composite parent) { - final Control ret = super.createContents(parent); - getViewer().setInput(sorted); - setMessage(Messages.FilteredContributionDialog_SelectTheBundle); - setTitle(Messages.FilteredContributionDialog_BundleFilter); - getShell().setText(Messages.FilteredContributionDialog_BundleFilter); - try { - setTitleImage(imageCache.create("/icons/full/wizban/plugin_wiz.gif")); //$NON-NLS-1$ - } catch (final Exception e) { - e.printStackTrace(); - } - return ret; - } - }; - if (dlg.open() == Window.OK) { - final ArrayList<String> result = new ArrayList<String>(); - result.add(dlg.getFirstSelection()); - setFilterBundles(result); - refreshSearch(); - } - updateUiState(); - } - - protected void showPackageFilter() { - final Collection<String> packages; - // TODO make HasPackages an interface so we are not tied to - // implementation - if (getCollector() instanceof TargetPlatformClassContributionCollector) { - packages = TargetPlatformClassContributionCollector.getInstance().getPackages(); - } else if (getCollector() instanceof TargetPlatformIconContributionCollector) { - packages = TargetPlatformIconContributionCollector.getInstance().getPackages(); - } else { - return; - } - - final ArrayList<String> sorted = new ArrayList<String>(packages); - Collections.sort(sorted); - - final TitleAreaFilterDialog dlg = new TitleAreaFilterDialog(getShell(), new ColumnLabelProvider()) { - @Override - protected Control createContents(Composite parent) { - final Control ret = super.createContents(parent); - getViewer().setInput(sorted); - setMessage(Messages.FilteredContributionDialog_SelectThePackage); - setTitle(Messages.FilteredContributionDialog_PackageFilter); - getShell().setText(Messages.FilteredContributionDialog_PackageFilter); - setTitleImage(imageCache.create("/icons/full/wizban/package_wiz.png")); //$NON-NLS-1$ - return ret; - } - }; - if (dlg.open() == Window.OK) { - final ArrayList<String> result = new ArrayList<String>(); - result.add(dlg.getFirstSelection()); - setFilterBundles(result); - refreshSearch(); - } - updateUiState(); - } - - public ResourceSearchScope getScope() { - return searchScope; - } - - public void setScope(ResourceSearchScope scope) { - searchScope = scope; - } - - public void setCollector(ClassContributionCollector collector) { - this.collector = collector; - } - - protected void showLocationFilter() { - final Collection<String> locations; - // TODO make HasLocations an interface so we are not tied to - // implementation - if (getCollector() instanceof TargetPlatformClassContributionCollector) { - locations = TargetPlatformClassContributionCollector.getInstance().getLocations(); - } else if (getCollector() instanceof TargetPlatformIconContributionCollector) { - locations = TargetPlatformIconContributionCollector.getInstance().getLocations(); - } else { - return; - } - - // add all parent paths - final HashSet<String> parentLocations = new HashSet<String>(); - for (String location : locations) { - if (location.endsWith(".jar")) { //$NON-NLS-1$ - final int index = location.lastIndexOf(File.separator); - if (index >= 0) { - location = location.substring(0, index); - parentLocations.add(location); - } - } else { - parentLocations.add(location); - } - } - - final ArrayList<String> sorted = new ArrayList<String>(parentLocations); - Collections.sort(sorted); - - final TitleAreaFilterDialog dlg = new TitleAreaFilterDialog(getShell(), new ColumnLabelProvider()) { - @Override - protected Control createContents(Composite parent) { - final Control ret = super.createContents(parent); - getViewer().setInput(sorted); - setMessage(Messages.FilteredContributionDialog_SelectTheLocation); - setTitle(Messages.FilteredContributionDialog_LocationFilter); - getShell().setText(Messages.FilteredContributionDialog_LocationFilter); - setTitleImage(imageCache.create("/icons/full/wizban/location_wiz.png")); //$NON-NLS-1$ - return ret; - } - }; - if (dlg.open() == Window.OK) { - final ArrayList<String> result = new ArrayList<String>(); - result.add(dlg.getFirstSelection()); - setFilterBundles(result); - refreshSearch(); - } - updateUiState(); - } - - protected void rebuildViewer() { - - viewerList = new WritableList(); - - final TableViewer oldViewer = viewer; - viewer = new TableViewer(compOptions, SWT.FULL_SELECTION | SWT.BORDER); - if (oldViewer != null) { - viewer.getTable().moveAbove(oldViewer.getTable()); - oldViewer.getTable().dispose(); - } - final GridData gd = new GridData(GridData.FILL_BOTH); - viewer.getControl().setLayoutData(gd); - viewer.setContentProvider(new ObservableListContentProvider()); - viewer.setLabelProvider(new StyledCellLabelProvider() { - @Override - public void update(ViewerCell cell) { - ContributionData data; - if (cell.getElement() instanceof ContributionData) { - data = (ContributionData) cell.getElement(); - } else if (cell.getElement() instanceof ContributionDataFile) { - data = ((ContributionDataFile) cell.getElement()).getContributionData(); - } else { - return; - } - - final StyledString styledString = new StyledString(); - if (data.className != null) { - styledString.append(data.className, null); - } - - if (data.bundleName != null) { - styledString.append(" - " + data.bundleName, StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ - } else if (data.installLocation != null) { - styledString.append(" - " + data.installLocation, StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ - } - - if (data.sourceType != null) { - styledString.append(" - ", StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ - styledString.append(data.sourceType + "", StyledString.COUNTER_STYLER); //$NON-NLS-1$ - } - - if (data.iconPath == null) { - cell.setImage(contributionTypeImage); - } - - cell.setText(styledString.getString()); - cell.setStyleRanges(styledString.getStyleRanges()); - } - }); - viewer.addDoubleClickListener(new IDoubleClickListener() { - - @Override - public void doubleClick(DoubleClickEvent event) { - okPressed(); - } - }); - - viewer.setInput(viewerList); - - if (oldViewer != null) { - getViewer().getTable().getParent().layout(true, true); - getViewer().getTable().getParent().redraw(); - } - } - - public TableViewer getViewer() { - return viewer; - } - - public void setViewer(TableViewer viewer) { - this.viewer = viewer; - } - - protected Text getFilterTextBox() { - return textBox; - } - - public ResourceSearchScope getSearchScope() { - return searchScope; - } - - protected IFile getSelectedIfile() { - final IStructuredSelection s = (IStructuredSelection) getViewer().getSelection(); - if (!s.isEmpty()) { - final Object selected = s.getFirstElement(); - if (selected instanceof ContributionData) { - final ContributionData contributionData = (ContributionData) selected; - return new ContributionDataFile(contributionData); - } else if (selected instanceof IFile) { - return (IFile) selected; - } else if (selected instanceof Entry) { - final Entry entry = (Entry) selected; - final ContributionData cd = new ContributionData(null, null, Messages.FilteredContributionDialog_Java, - entry.file.getFullPath().toOSString()); - cd.installLocation = entry.installLocation; - cd.resourceRelativePath = entry.file.getProjectRelativePath().toOSString(); - return new ContributionDataFile(cd); - } - } - return null; - } - - /** - * Returns non null if the selected resource is accessible from the current - * project<br /> - * Restrictions may include non-existent file, non exported class, or the - * resource is in a location that is not a bundle.<br /> - * The function, through user intervention, may find a way to resolve the - * file and return a resolution. - * - * @param file - * @param installLocation - * @return The original file, a fixed-up (copied or referred) file, or null. - */ - protected IFile checkResourceAccessible(final IFile file, String installLocation) { - - // Obviously null is not accessible - if (file == null) { - return null; - } - - // Not a bundle - final String bundle = getBundle(file); - if (bundle == null) { - final String message = Messages.FilteredContributionDialog_ResourceIsNotContainedInABundle; - final NonReferencedResourceWizard wizard = new NonReferencedResourceWizard(getShell(), - context.get(IProject.class), bundle, file, installLocation, context); - wizard.setMessage(message); - final WizardDialog wizDlg = new WizardDialog(getShell(), wizard); - wizDlg.setBlockOnOpen(true); - if (wizDlg.open() == IDialogConstants.OK_ID) { - return wizard.getResult(); - } - return null; - } - - // Reference by current project - final IProject currentProject = context.get(IProject.class); - if (currentProject != null && !getBundle(currentProject).equals(bundle)) { - boolean found = false; - // search the current project's manifest for require-bundle - try { - final BundleModel model = loadBundleModel(currentProject); - - final RequireBundleHeader rbh = (RequireBundleHeader) model.getBundle().getManifestHeader( - "Require-Bundle"); //$NON-NLS-1$ - if (rbh != null) { - for (final RequireBundleObject item : rbh.getRequiredBundles()) { - if (item.getValue().equals(bundle)) { - found = true; - break; - } - } - } - // search the current project's manifest for import-package - if (!found) { - if (file instanceof ContributionDataFile) { - final ContributionDataFile cdFile = (ContributionDataFile) file; - final String className = cdFile.getContributionData().className; - if (className != null) { - final String pakage = NonReferencedResourceDialog.getPackageFromClassName(className); - final ImportPackageHeader iph = (ImportPackageHeader) model.getBundle().getManifestHeader( - "Import-Package"); //$NON-NLS-1$ - if (iph != null) { - for (final ImportPackageObject item : iph.getPackages()) { - if (item.getValue().equals(pakage)) { - found = true; - break; - } - } - } - } - } - } - } catch (final Exception e) { - } - - if (!found) { - final String message = Messages.FilteredContributionDialog_ResourceIsNotReferencedByThisBundle; - final NonReferencedResourceWizard wizard = new NonReferencedResourceWizard(getShell(), - context.get(IProject.class), bundle, file, installLocation, context); - wizard.setMessage(message); - final WizardDialog wiz = new WizardDialog(getShell(), wizard); - wiz.setBlockOnOpen(true); - if (wiz.open() == IDialogConstants.OK_ID) { - return wizard.getResult(); - } - return null; - } - } - return file; - } - - public BundleModel loadBundleModel(IProject currentProject) throws CoreException { - final Document document = new Document(); - final Scanner scanner = new Scanner(PDEProject.getManifest(currentProject).getContents()); - try { - final String content = scanner.useDelimiter("\\Z").next(); //$NON-NLS-1$ - document.set(content); - final BundleModel model = new BundleModel(document, false); - model.load(); - return model; - } finally { - scanner.close(); - } - } - - protected EnumSet<ResourceSearchScope> getSearchScopes() { - return searchScopes; - } - - public void stopSearchThread(boolean bJoin) { - if (currentSearchThread != null) { - currentResultHandler.cancled = true; - currentSearchThread.cancel(); - if (bJoin) { - try { - currentSearchThread.join(); - } catch (final InterruptedException e) { - } finally { - currentSearchThread = null; - } - } else { - currentSearchThread = null; - } - } - } - - static public String getBundle(IFile file) { - - if (file instanceof ContributionDataFile) { - final ContributionDataFile cdFile = (ContributionDataFile) file; - final String ret = cdFile.getBundle(); - if (ret != null) { - return ret; - } else if (cdFile.getContributionData().installLocation != null) { - return getBundle(cdFile.getContributionData().installLocation); - } else { - return null; - } - } - - final IProject project = file.getProject(); - return getBundle(project); - } - - static String getBundle(IProject project) { - final IFile f = project.getFile("/META-INF/MANIFEST.MF"); //$NON-NLS-1$ - - if (f != null && f.exists()) { - BufferedReader r = null; - try { - final InputStream s = f.getContents(); - r = new BufferedReader(new InputStreamReader(s)); - String line; - while ((line = r.readLine()) != null) { - if (line.startsWith("Bundle-SymbolicName:")) { //$NON-NLS-1$ - final int start = line.indexOf(':'); - int end = line.indexOf(';'); - if (end == -1) { - end = line.length(); - } - return line.substring(start + 1, end).trim(); - } - } - } catch (final CoreException e) { - e.printStackTrace(); - } catch (final IOException e) { - e.printStackTrace(); - } finally { - if (r != null) { - try { - r.close(); - } catch (final IOException e) { - } - } - } - } - return null; - } - - /** - * Searches the directory for a manifest and parses the symbolic name. - * - * @param rootDirectory - * @return the id of the bundle if existing - */ - public static String getBundle(String rootDirectory) { - final File f = new File(new File(rootDirectory), "/META-INF/MANIFEST.MF"); //$NON-NLS-1$ - - if (f.exists()) { - BufferedReader r = null; - try { - final InputStream s = new FileInputStream(f); - r = new BufferedReader(new InputStreamReader(s)); - String line; - while ((line = r.readLine()) != null) { - if (line.startsWith("Bundle-SymbolicName:")) { //$NON-NLS-1$ - final int start = line.indexOf(':'); - int end = line.indexOf(';'); - if (end == -1) { - end = line.length(); - } - return line.substring(start + 1, end).trim(); - } - } - } catch (final IOException e) { - e.printStackTrace(); - } finally { - if (r != null) { - try { - r.close(); - } catch (final IOException e) { - } - } - } - } - return null; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindImportElementDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindImportElementDialog.java deleted file mode 100644 index e0e4c007..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindImportElementDialog.java +++ /dev/null @@ -1,239 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010-2014 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Andrej ten Brummelhuis <andrejbrummelhuis@gmail.com> - Bug 395283 - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.list.WritableList; -import org.eclipse.e4.tools.emf.ui.common.IModelElementProvider.Filter; -import org.eclipse.e4.tools.emf.ui.common.IModelElementProvider.ModelResultHandler; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.common.ClassContributionCollector; -import org.eclipse.e4.ui.model.application.MApplicationElement; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.viewers.DoubleClickEvent; -import org.eclipse.jface.viewers.IDoubleClickListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StyledCellLabelProvider; -import org.eclipse.jface.viewers.StyledString; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.ViewerCell; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.FrameworkUtil; -import org.osgi.framework.ServiceReference; - -public class FindImportElementDialog extends SaveDialogBoundsSettingsDialog { - private final EObject element; - private final AbstractComponentEditor editor; - private TableViewer viewer; - private final Messages Messages; - - public FindImportElementDialog(Shell parentShell, AbstractComponentEditor editor, EObject element, Messages Messages) { - super(parentShell); - this.element = element; - this.editor = editor; - this.Messages = Messages; - } - - @Override - protected Control createDialogArea(Composite parent) { - final Composite comp = (Composite) super.createDialogArea(parent); - - final Image titleImage = new Image(parent.getDisplay(), getClass().getClassLoader().getResourceAsStream( - "/icons/full/wizban/import_wiz.png")); //$NON-NLS-1$ - setTitleImage(titleImage); - getShell().addDisposeListener(new DisposeListener() { - - @Override - public void widgetDisposed(DisposeEvent e) { - titleImage.dispose(); - } - }); - - getShell().setText(Messages.FindImportElementDialog_ShellTitle); - setTitle(Messages.FindImportElementDialog_Title); - setMessage(Messages.FindImportElementDialog_Message); - - final Composite container = new Composite(comp, SWT.NONE); - container.setLayoutData(new GridData(GridData.FILL_BOTH)); - container.setLayout(new GridLayout(2, false)); - - Label l = new Label(container, SWT.NONE); - l.setText(Messages.FindImportElementDialog_Search); - - final Text searchText = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - searchText.setLayoutData(gd); - - l = new Label(container, SWT.PUSH); - - viewer = new TableViewer(container); - gd = new GridData(GridData.FILL_BOTH); - gd.heightHint = 200; - viewer.getControl().setLayoutData(gd); - viewer.setLabelProvider(new StyledCellLabelProvider() { - @Override - public void update(ViewerCell cell) { - final EObject o = (EObject) cell.getElement(); - cell.setImage(editor.getImage(o, searchText.getDisplay())); - - final MApplicationElement appEl = (MApplicationElement) o; - final StyledString styledString = new StyledString( - editor.getLabel(o) - + " (" + (appEl.getElementId() == null ? "<" + Messages.FindImportElementDialog_noId + ">" : appEl.getElementId()) + ")", null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - final String detailLabel = editor.getDetailLabel(o); - if (detailLabel != null && !detailLabel.equals(appEl.getElementId())) { - styledString.append(" - " + detailLabel, StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ - } - - styledString.append(" - " + o.eResource().getURI(), StyledString.COUNTER_STYLER); //$NON-NLS-1$ - cell.setStyleRanges(styledString.getStyleRanges()); - cell.setText(styledString.getString()); - } - }); - viewer.setContentProvider(new ObservableListContentProvider()); - viewer.addDoubleClickListener(new IDoubleClickListener() { - - @Override - public void doubleClick(DoubleClickEvent event) { - okPressed(); - } - }); - - final WritableList list = new WritableList(); - viewer.setInput(list); - - final ClassContributionCollector collector = getCollector(); - - searchText.addModifyListener(new ModifyListener() { - private ModelResultHandlerImpl currentResultHandler; - - @Override - public void modifyText(ModifyEvent e) { - if (currentResultHandler != null) { - currentResultHandler.cancled = true; - } - list.clear(); - final Filter filter = new Filter(element.eClass(), searchText.getText()); - currentResultHandler = new ModelResultHandlerImpl(list, filter, editor, element.eResource()); - collector.findModelElements(filter, currentResultHandler); - } - }); - - final Button button = new Button(container, SWT.PUSH); - button.setText(Messages.FindImportElementDialog_ClearCache); - button.setLayoutData(new GridData(GridData.END, GridData.CENTER, true, false, 2, 1)); - button.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - collector.clearModelCache(); - } - }); - - return comp; - } - - @Override - protected void okPressed() { - final IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (!s.isEmpty()) { - final MApplicationElement el = (MApplicationElement) s.getFirstElement(); - if (el.getElementId() != null && el.getElementId().trim().length() > 0) { - final Command cmd = SetCommand.create(editor.getEditingDomain(), element, - ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID, el.getElementId()); - if (cmd.canExecute()) { - editor.getEditingDomain().getCommandStack().execute(cmd); - super.okPressed(); - } - } else { - setErrorMessage(Messages.FindImportElementDialog_NoIdReference); - } - } - } - - private ClassContributionCollector getCollector() { - final Bundle bundle = FrameworkUtil.getBundle(FindImportElementDialog.class); - final BundleContext context = bundle.getBundleContext(); - final ServiceReference<?> ref = context.getServiceReference(ClassContributionCollector.class.getName()); - if (ref != null) { - return (ClassContributionCollector) context.getService(ref); - } - return null; - } - - private static class ModelResultHandlerImpl implements ModelResultHandler { - private boolean cancled = false; - private final IObservableList list; - private final Filter filter; - private final AbstractComponentEditor editor; - private final Resource resource; - - public ModelResultHandlerImpl(IObservableList list, Filter filter, AbstractComponentEditor editor, - Resource resource) { - this.list = list; - this.filter = filter; - this.editor = editor; - this.resource = resource; - } - - @Override - public void result(EObject data) { - if (!cancled) { - if (!resource.getURI().equals(data.eResource().getURI())) { - if (data instanceof MApplicationElement) { - final String elementId = ((MApplicationElement) data).getElementId(); - if (elementId == null) { - list.add(data); - return; - } - - if (elementId.trim().length() > 0) { - if (filter.elementIdPattern.matcher(elementId).matches()) { - list.add(data); - return; - } - } - - final String label = editor.getDetailLabel(data); - if (label != null && label.trim().length() > 0) { - if (filter.elementIdPattern.matcher(label).matches()) { - list.add(data); - } - } - } - } - } - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindParentReferenceElementDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindParentReferenceElementDialog.java deleted file mode 100644 index ddef9008..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindParentReferenceElementDialog.java +++ /dev/null @@ -1,331 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Steven Spungin <steven@spungin.tv> - Bug 437469 - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.list.WritableList; -import org.eclipse.e4.tools.emf.ui.common.IModelElementProvider.Filter; -import org.eclipse.e4.tools.emf.ui.common.IModelElementProvider.ModelResultHandler; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.Util.InternalPackage; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.common.ClassContributionCollector; -import org.eclipse.e4.ui.model.application.MApplicationElement; -import org.eclipse.e4.ui.model.fragment.MStringModelFragment; -import org.eclipse.e4.ui.model.fragment.impl.FragmentPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.dialogs.TitleAreaDialog; -import org.eclipse.jface.fieldassist.AutoCompleteField; -import org.eclipse.jface.fieldassist.ComboContentAdapter; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.ComboViewer; -import org.eclipse.jface.viewers.DoubleClickEvent; -import org.eclipse.jface.viewers.IDoubleClickListener; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.StyledCellLabelProvider; -import org.eclipse.jface.viewers.StyledString; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerCell; -import org.eclipse.jface.viewers.ViewerComparator; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.FrameworkUtil; -import org.osgi.framework.ServiceReference; - -public class FindParentReferenceElementDialog extends TitleAreaDialog { - private final MStringModelFragment fragment; - private final AbstractComponentEditor editor; - private TableViewer viewer; - private final Messages Messages; - private ModelResultHandlerImpl currentResultHandler; - private WritableList list; - private ComboViewer eClassViewer; - private Text searchText; - - public FindParentReferenceElementDialog(Shell parentShell, AbstractComponentEditor editor, - MStringModelFragment fragment, Messages Messages) { - super(parentShell); - this.fragment = fragment; - this.editor = editor; - this.Messages = Messages; - } - - @Override - protected boolean isResizable() { - return true; - } - - @Override - protected Control createDialogArea(Composite parent) { - final Composite comp = (Composite) super.createDialogArea(parent); - - final Image titleImage = new Image(parent.getDisplay(), getClass().getClassLoader().getResourceAsStream( - "/icons/full/wizban/import_wiz.png")); //$NON-NLS-1$ - setTitleImage(titleImage); - getShell().addDisposeListener(new DisposeListener() { - - @Override - public void widgetDisposed(DisposeEvent e) { - titleImage.dispose(); - } - }); - - getShell().setText(Messages.FindParentReferenceElementDialog_ShellTitle); - setTitle(Messages.FindParentReferenceElementDialog_Title); - setMessage(Messages.FindParentReferenceElementDialog_Message); - - final Composite container = new Composite(comp, SWT.NONE); - container.setLayoutData(new GridData(GridData.FILL_BOTH)); - container.setLayout(new GridLayout(2, false)); - - Label l = new Label(container, SWT.NONE); - l.setText(Messages.FindParentReferenceElementDialog_ContainerType); - - final Combo combo = new Combo(container, SWT.NONE); - eClassViewer = new ComboViewer(combo); - eClassViewer.setLabelProvider(new LabelProvider() { - @Override - public String getText(Object element) { - return ((EClass) element).getName(); - } - }); - eClassViewer.setContentProvider(new ArrayContentProvider()); - final List<EClass> eClassList = new ArrayList<EClass>(); - for (final InternalPackage p : Util.loadPackages()) { - eClassList.addAll(p.getAllClasses()); - } - eClassViewer.setComparator(new ViewerComparator() { - @Override - public int compare(Viewer viewer, Object e1, Object e2) { - final EClass ec1 = (EClass) e1; - final EClass ec2 = (EClass) e2; - return ec1.getName().compareTo(ec2.getName()); - } - }); - eClassViewer.setInput(eClassList); - eClassViewer.getCombo().select(0); - eClassViewer.getControl().setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - eClassViewer.addSelectionChangedListener(new ISelectionChangedListener() { - - @Override - public void selectionChanged(SelectionChangedEvent event) { - updateSearch(); - } - }); - - final ArrayList<String> vals = new ArrayList<String>(); - for (final EClass item : eClassList) { - vals.add(item.getName()); - } - final String[] values = vals.toArray(new String[0]); - final ComboContentAdapter textContentAdapter = new ComboContentAdapter() { - @Override - public void setControlContents(Control control, String text1, int cursorPosition) { - super.setControlContents(control, text1, cursorPosition); - final int index = Arrays.asList(values).indexOf(text1); - final EClass eClass = eClassList.get(index); - eClassViewer.setSelection(new StructuredSelection(eClass)); - } - }; - new AutoCompleteField(combo, textContentAdapter, values); - - l = new Label(container, SWT.NONE); - l.setText(Messages.FindParentReferenceElementDialog_Search); - - searchText = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - searchText.setLayoutData(gd); - - l = new Label(container, SWT.PUSH); - - viewer = new TableViewer(container); - gd = new GridData(GridData.FILL_BOTH); - gd.heightHint = 200; - viewer.getControl().setLayoutData(gd); - viewer.setLabelProvider(new StyledCellLabelProvider() { - @Override - public void update(ViewerCell cell) { - final EObject o = (EObject) cell.getElement(); - final AbstractComponentEditor editor = FindParentReferenceElementDialog.this.editor.getEditor() - .getEditor(o.eClass()); - cell.setImage(editor.getImage(o, searchText.getDisplay())); - - final MApplicationElement appEl = (MApplicationElement) o; - - final StyledString styledString = new StyledString( - editor.getLabel(o) - + " (" + (appEl.getElementId() == null ? "<" + Messages.FindParentReferenceElementDialog_NoId + ">" : appEl.getElementId()) + ")", null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - final String detailLabel = editor.getDetailLabel(o); - if (detailLabel != null && !detailLabel.equals(appEl.getElementId())) { - styledString.append(" - " + detailLabel, StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ - } - - styledString.append(" - " + o.eResource().getURI(), StyledString.COUNTER_STYLER); //$NON-NLS-1$ - cell.setStyleRanges(styledString.getStyleRanges()); - cell.setText(styledString.getString()); - } - }); - viewer.setContentProvider(new ObservableListContentProvider()); - viewer.addDoubleClickListener(new IDoubleClickListener() { - - @Override - public void doubleClick(DoubleClickEvent event) { - okPressed(); - } - }); - - list = new WritableList(); - viewer.setInput(list); - - final ClassContributionCollector collector = getCollector(); - - searchText.addModifyListener(new ModifyListener() { - - @Override - public void modifyText(ModifyEvent e) { - updateSearch(); - } - }); - - final Button button = new Button(container, SWT.PUSH); - button.setText(Messages.FindParentReferenceElementDialog_ClearCache); - button.setLayoutData(new GridData(GridData.END, GridData.CENTER, true, false, 2, 1)); - button.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - collector.clearModelCache(); - } - }); - return comp; - } - - protected void updateSearch() { - if (currentResultHandler != null) { - currentResultHandler.cancled = true; - } - list.clear(); - - final Filter filter = new Filter( - (EClass) ((IStructuredSelection) eClassViewer.getSelection()).getFirstElement(), searchText.getText()); - - currentResultHandler = new ModelResultHandlerImpl(list, filter, editor, ((EObject) fragment).eResource()); - getCollector().findModelElements(filter, currentResultHandler); - - } - - @Override - protected void okPressed() { - final IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (!s.isEmpty()) { - final MApplicationElement el = (MApplicationElement) s.getFirstElement(); - if (el.getElementId() != null && el.getElementId().trim().length() > 0) { - final Command cmd = SetCommand.create(editor.getEditingDomain(), fragment, - FragmentPackageImpl.Literals.STRING_MODEL_FRAGMENT__PARENT_ELEMENT_ID, el.getElementId()); - if (cmd.canExecute()) { - editor.getEditingDomain().getCommandStack().execute(cmd); - super.okPressed(); - } - } else { - setErrorMessage(Messages.FindParentReferenceElementDialog_NoReferenceId); - } - } - } - - private ClassContributionCollector getCollector() { - final Bundle bundle = FrameworkUtil.getBundle(FindParentReferenceElementDialog.class); - final BundleContext context = bundle.getBundleContext(); - final ServiceReference<?> ref = context.getServiceReference(ClassContributionCollector.class.getName()); - if (ref != null) { - return (ClassContributionCollector) context.getService(ref); - } - return null; - } - - private static class ModelResultHandlerImpl implements ModelResultHandler { - private boolean cancled = false; - private final IObservableList list; - private final Filter filter; - private final AbstractComponentEditor editor; - private final Resource resource; - - public ModelResultHandlerImpl(IObservableList list, Filter filter, AbstractComponentEditor editor, - Resource resource) { - this.list = list; - this.filter = filter; - this.editor = editor; - this.resource = resource; - } - - @Override - public void result(EObject data) { - if (!cancled) { - if (!resource.getURI().equals(data.eResource().getURI())) { - if (data instanceof MApplicationElement) { - final String elementId = ((MApplicationElement) data).getElementId(); - if (elementId == null) { - list.add(data); - return; - } - - if (elementId.trim().length() > 0) { - if (filter.elementIdPattern.matcher(elementId).matches()) { - list.add(data); - return; - } - } - - final String label = editor.getDetailLabel(data); - if (label != null && label.trim().length() > 0) { - if (filter.elementIdPattern.matcher(label).matches()) { - list.add(data); - return; - } - } - } - } - } - } - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledMenuItemCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledMenuItemCommandSelectionDialog.java deleted file mode 100644 index 7f0d166b..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledMenuItemCommandSelectionDialog.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; - -import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.ui.model.application.commands.MCommand; -import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem; -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.swt.widgets.Shell; - -public class HandledMenuItemCommandSelectionDialog extends AbstractCommandSelectionDialog { - private final MHandledItem handler; - - public HandledMenuItemCommandSelectionDialog(Shell parentShell, MHandledItem handler, IModelResource resource, - Messages Messages) { - super(parentShell, resource, Messages); - this.handler = handler; - } - - @Override - protected String getShellTitle() { - return Messages.HandledMenuItemCommandSelectionDialog_ShellTitle; - } - - @Override - protected String getDialogTitle() { - return Messages.HandledMenuItemCommandSelectionDialog_DialogTitle; - } - - @Override - protected String getDialogMessage() { - return Messages.HandledMenuItemCommandSelectionDialog_DialogMessage; - } - - @Override - protected Command createStoreCommand(EditingDomain editingDomain, MCommand command) { - return SetCommand.create(editingDomain, handler, MenuPackageImpl.Literals.HANDLED_ITEM__COMMAND, command); - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledToolItemCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledToolItemCommandSelectionDialog.java deleted file mode 100644 index fdb375df..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledToolItemCommandSelectionDialog.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; - -import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.ui.model.application.commands.MCommand; -import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem; -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.swt.widgets.Shell; - -public class HandledToolItemCommandSelectionDialog extends AbstractCommandSelectionDialog { - private final MHandledItem handler; - - public HandledToolItemCommandSelectionDialog(Shell parentShell, MHandledItem handler, IModelResource resource, - Messages Messages) { - super(parentShell, resource, Messages); - this.handler = handler; - } - - @Override - protected String getShellTitle() { - return Messages.HandledToolItemCommandSelectionDialog_ShellTitle; - } - - @Override - protected String getDialogTitle() { - return Messages.HandledToolItemCommandSelectionDialog_DialogTitle; - } - - @Override - protected String getDialogMessage() { - return Messages.HandledToolItemCommandSelectionDialog_DialogMessage; - } - - @Override - protected Command createStoreCommand(EditingDomain editingDomain, MCommand command) { - return SetCommand.create(editingDomain, handler, MenuPackageImpl.Literals.HANDLED_ITEM__COMMAND, command); - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandlerCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandlerCommandSelectionDialog.java deleted file mode 100644 index e566e1b1..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandlerCommandSelectionDialog.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; - -import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.ui.model.application.commands.MCommand; -import org.eclipse.e4.ui.model.application.commands.MHandler; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.swt.widgets.Shell; - -public class HandlerCommandSelectionDialog extends AbstractCommandSelectionDialog { - private final MHandler handler; - - public HandlerCommandSelectionDialog(Shell parentShell, MHandler handler, IModelResource resource, Messages Messages) { - super(parentShell, resource, Messages); - this.handler = handler; - } - - @Override - protected String getShellTitle() { - return Messages.HandlerCommandSelectionDialog_ShellTitle; - } - - @Override - protected String getDialogTitle() { - return Messages.HandlerCommandSelectionDialog_DialogTitle; - } - - @Override - protected String getDialogMessage() { - return Messages.HandlerCommandSelectionDialog_DialogMessage; - } - - @Override - protected Command createStoreCommand(EditingDomain editingDomain, MCommand command) { - return SetCommand.create(editingDomain, handler, CommandsPackageImpl.Literals.HANDLER__COMMAND, command); - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/KeyBindingCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/KeyBindingCommandSelectionDialog.java deleted file mode 100644 index 18259a9e..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/KeyBindingCommandSelectionDialog.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; - -import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.ui.model.application.commands.MCommand; -import org.eclipse.e4.ui.model.application.commands.MKeyBinding; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.swt.widgets.Shell; - -public class KeyBindingCommandSelectionDialog extends AbstractCommandSelectionDialog { - private MKeyBinding binding; - - public KeyBindingCommandSelectionDialog(Shell parentShell, MKeyBinding binding, IModelResource resource, Messages Messages) { - super(parentShell, resource, Messages); - this.binding = binding; - } - - @Override - protected String getShellTitle() { - return Messages.KeyBindingCommandSelectionDialog_ShellTitle; - } - - @Override - protected String getDialogTitle() { - return Messages.KeyBindingCommandSelectionDialog_DialogTitle; - } - - @Override - protected String getDialogMessage() { - return Messages.KeyBindingCommandSelectionDialog_DialogMessage; - } - - @Override - protected Command createStoreCommand(EditingDomain editingDomain, MCommand command) { - return SetCommand.create(editingDomain, binding, CommandsPackageImpl.Literals.KEY_BINDING__COMMAND, command); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuIconDialogEditor.java deleted file mode 100644 index cc1fb680..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuIconDialogEditor.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Steven Spungin <steven@spungin.tv> - Bug 424730 - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; - -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.MMenu; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.swt.widgets.Shell; - -public class MenuIconDialogEditor extends AbstractIconDialog { - - public MenuIconDialogEditor(Shell parentShell, IEclipseContext context, IProject project, EditingDomain editingDomain, MMenu element, Messages Messages) { - super(parentShell, context, project, editingDomain, element, UiPackageImpl.Literals.UI_LABEL__ICON_URI, Messages); - } - - @Override - protected String getShellTitle() { - return Messages.MenuIconDialogEditor_ShellTitle; - } - - @Override - protected String getDialogTitle() { - return Messages.MenuIconDialogEditor_DialogTitle; - } - - @Override - protected String getDialogMessage() { - return Messages.MenuIconDialogEditor_DialogMessage; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuIdDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuIdDialog.java deleted file mode 100644 index f17f34b6..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuIdDialog.java +++ /dev/null @@ -1,129 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 MEDEVIT, FHV and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Marco Descher <marco@descher.at> - initial implementation (Bug 396975) - * Nicolaj Hoess <nicohoess@gmail.com> - refactoring (Bug 396975) - *******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; - -import java.util.ArrayList; -import java.util.List; -import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.ui.model.application.MApplication; -import org.eclipse.e4.ui.model.application.MApplicationElement; -import org.eclipse.e4.ui.model.application.ui.basic.MPart; -import org.eclipse.e4.ui.model.application.ui.basic.MWindow; -import org.eclipse.e4.ui.model.application.ui.menu.MMenu; -import org.eclipse.e4.ui.model.application.ui.menu.MMenuContribution; -import org.eclipse.e4.ui.model.application.ui.menu.MMenuElement; -import org.eclipse.e4.ui.model.application.ui.menu.MToolItem; -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.e4.ui.model.fragment.MModelFragments; -import org.eclipse.e4.ui.workbench.modeling.EModelService; -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.swt.widgets.Shell; - -public class MenuIdDialog extends AbstractIdDialog<MMenuContribution, MMenu> { - - public MenuIdDialog(Shell parentShell, IModelResource resource, MMenuContribution toolbarContribution, EditingDomain domain, EModelService modelService, Messages Messages) { - super(parentShell, resource, toolbarContribution, domain, modelService, Messages); - } - - @Override - protected String getShellTitle() { - return messages.MenuIdDialog_ShellTitle; - } - - @Override - protected String getDialogTitle() { - return messages.MenuIdDialog_DialogTitle; - } - - @Override - protected String getDialogMessage() { - return messages.MenuIdDialog_DialogMessage; - } - - @Override - protected String getLabelText() { - return messages.MenuIdDialog_Id; - } - - @Override - protected List<MMenu> getViewerInput() { - - List<MMenu> result = new ArrayList<MMenu>(); - - if (resource.getRoot().get(0) instanceof MApplication) { - // include Window main-menu instances - MApplication ma = ((MApplication) resource.getRoot().get(0)); - for (MWindow m : ma.getChildren()) { - if (m.getMainMenu() != null) - result.add(m.getMainMenu()); - } - // include menu elements located within parts - List<MPart> mp = modelService.findElements(ma, null, MPart.class, null); - for (MPart mPart : mp) { - result.addAll(mPart.getMenus()); - } - // include menu elements carried by tool items - List<MToolItem> mt = modelService.findElements(ma, null, MToolItem.class, null); - for (MToolItem mToolItem : mt) { - if (mToolItem.getMenu() != null) - result.add(mToolItem.getMenu()); - } - - for (MMenu mMenuEntry : result.toArray(new MMenu[] {})) { - performRecursiveCheck(mMenuEntry, result); - } - - } else if (resource.getRoot().get(0) instanceof MModelFragments) { - - for (MApplicationElement f : ((MModelFragments) resource.getRoot().get(0)).getImports()) { - if (f instanceof MMenu) { - result.add((MMenu) f); - } - } - viewer.setInput(result); - - } - - return result; - } - - /** - * A menu may contain another {@link MMenu} as a child; we want them to be - * shown as an additional entry, so we recursively dive into these elements - * - * @param mMenu - * @param list - */ - private void performRecursiveCheck(MMenu mMenu, List<MMenu> list) { - List<MMenuElement> children = mMenu.getChildren(); - for (MMenuElement child : children) { - if (child instanceof MMenu) { - MMenu mMenuChild = (MMenu) child; - list.add(mMenuChild); - performRecursiveCheck(mMenuChild, list); - } - } - } - - @Override - protected EAttribute getFeatureLiteral() { - return MenuPackageImpl.Literals.MENU_CONTRIBUTION__PARENT_ID; - } - - @Override - protected String getListItemInformation(MMenu listItem) { - return (listItem.getLabel() != null) ? listItem.getLabel() : ""; //$NON-NLS-1$ - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuItemIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuItemIconDialogEditor.java deleted file mode 100644 index 0a91fe07..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuItemIconDialogEditor.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Steven Spungin <steven@spungin.tv> - Bug 424730 - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; - -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.MMenuItem; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.swt.widgets.Shell; - -public class MenuItemIconDialogEditor extends AbstractIconDialog { - - public MenuItemIconDialogEditor(Shell parentShell, IEclipseContext context, IProject project, EditingDomain editingDomain, MMenuItem element, Messages Messages) { - super(parentShell, context, project, editingDomain, element, UiPackageImpl.Literals.UI_LABEL__ICON_URI, Messages); - } - - @Override - protected String getShellTitle() { - return Messages.MenuItemIconDialogEditor_ShellTitle; - } - - @Override - protected String getDialogTitle() { - return Messages.MenuItemIconDialogEditor_DialogTitle; - } - - @Override - protected String getDialogMessage() { - return Messages.MenuItemIconDialogEditor_DialogMessage; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ParameterIdSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ParameterIdSelectionDialog.java deleted file mode 100644 index ca9ed68e..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ParameterIdSelectionDialog.java +++ /dev/null @@ -1,211 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015-2015 Veselin Markov. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Veselin Markov <veselin_m84@yahoo.com> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; - -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import javax.inject.Inject; - -import org.eclipse.e4.core.services.nls.Translation; -import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.ui.model.application.commands.MCommand; -import org.eclipse.e4.ui.model.application.commands.MCommandParameter; -import org.eclipse.e4.ui.model.application.commands.MParameter; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.e4.ui.workbench.modeling.EModelService; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.common.util.TreeIterator; -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.viewers.IBaseLabelProvider; -import org.eclipse.swt.widgets.Shell; - -/** - * This dialog presents to the user in a table the available {@link MCommandParameter}s that - * may be referenced by the specified {@link MParameter}. - * - * @author Markov - * @noinstantiate this dialog uses DI an should not be instantiated by the user. - */ -public class ParameterIdSelectionDialog extends AbstractIdDialog<MParameter, MCommandParameter> { - - @Inject - protected ModelEditor editor; - - /** The parameter, which {@link MParameter#getName() name} feature has to be modified. */ - protected MParameter parameter; - protected Set<EStructuralFeature> parametersFeatures = new HashSet<EStructuralFeature>(); - protected Set<EStructuralFeature> commandsFeatures = new HashSet<EStructuralFeature>(); - - @Inject - public ParameterIdSelectionDialog(Shell parentShell, IModelResource resource, MParameter parameter, - EditingDomain domain, EModelService modelService, @Translation Messages messages) { - super(parentShell, resource, parameter, domain, modelService, messages); - - this.parameter = parameter; - parametersFeatures.add(MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS); - commandsFeatures.add(MenuPackageImpl.Literals.HANDLED_ITEM__COMMAND); - } - - @Override - protected IBaseLabelProvider getLabelProvider() { - return new ComponentLabelProvider(editor, messages); - } - - @Override - protected String getShellTitle() { - return messages.ParameterIdSelectionDialog_ShellTitle; - } - - @Override - protected String getDialogTitle() { - return messages.ParameterIdSelectionDialog_DialogTitle; - } - - @Override - protected String getDialogMessage() { - return messages.ParameterIdSelectionDialog_DialogMessage; - } - - @Override - protected String getLabelText() { - return messages.ParameterIdSelectionDialog_LabelText; - } - - @Override - protected List<MCommandParameter> getViewerInput() { - return getParametersOfParentNodesCommand(); - } - - @Override - protected EAttribute getFeatureLiteral() { - return CommandsPackageImpl.Literals.PARAMETER__NAME; - } - - @Override - protected String getListItemInformation(MCommandParameter listItem) { - return null; - } - - /** - * Reads the parameters of the MComand in the {@link EObject} referencing the given {@link #parameter}. - * - * Searches for the parent element of {@linkplain #parameter}. Once found reads the {@link MCommandParameter}s of - * the referenced {@link MCommand}, given the found parent references a MCommand. - * - * @return all found MCommandParameters or an empty {@link List}, never a {@code null} value. - */ - protected List<MCommandParameter> getParametersOfParentNodesCommand() { - TreeIterator<EObject> it = EcoreUtil.getAllContents((EObject) resource.getRoot().get(0), true); - while (it.hasNext()) { - EObject containerObjectWithCommand = it.next(); - if (containerObjectWithCommand != null && canSupplyParameters(containerObjectWithCommand)) { - List<MCommandParameter> commandParameters = getCommandParameters(containerObjectWithCommand); - return commandParameters; - } - } - return Collections.emptyList(); - } - - /** - * Checks if the given {@code object} references a {@link MCommand} and the {@link #parameter}. - * - * @param object the object to be checked. May not be {@code null}. - * @return {@code true} if {@code object} is a model-element that references a command and a list of parameters with - * {@link #parameter}, {@code false} otherwise. - */ - protected boolean canSupplyParameters(EObject object) { - return referencesCommand(object) && referencesParameters(object) - && containsSearchedParameter(object); - } - - /** - * Checks whether the given {@code object} has a {@link EReference} to a {@link MCommand} feature. - * - * @param object that will be checked. May not be {@code null}. - * @return {@code true} if the given {@code object} can reference a MCommand, {@code false} otherwise. - */ - protected boolean referencesCommand(EObject object) { - EList<EReference> eAllReferences = object.eClass().getEAllReferences(); - for (EReference r : eAllReferences) { - if (commandsFeatures.contains(r)) { - return true; - } - } - return false; - } - - /** - * Checks whether the given {@code object} has a {@link EReference} to a list of {@link MParameter}s feature. - * - * @param object that will be checked. May not be {@code null}. - * @return {@code true} if the given {@code object} can reference a MParameters, {@code false} otherwise. - */ - protected boolean referencesParameters(EObject object) { - EList<EReference> eAllReferences = object.eClass().getEAllReferences(); - for (EReference r : eAllReferences) { - if (parametersFeatures.contains(r)) { - return true; - } - } - return false; - } - - /** - * Checks if the {@link #parameter} is contained in the {@link MParameter}s feature of the given {@code object}. - * - * @param object that may contain the {@code parameter} we look for. - * @return true if {@code object} contains the {@code parameter}, false otherwise. - */ - protected boolean containsSearchedParameter(EObject object) { - for (EStructuralFeature parametersFeature : parametersFeatures) { - Object parameters = object.eGet(parametersFeature); - if (parameters != null && parameters instanceof Collection<?>) { - return ((Collection<?>) parameters).contains(parameter); - } - } - return false; - } - - /** - * Reads the {@link MCommandParameter}s from the {@link MCommand} from the given {@code containerObjectWithCommand}. - * - * @param containerObjectWithCommand an object containing a {@link EReference} to an {@link MCommand} - * @return a {@link List} with the {@link MCommandParameter}s or an empty list but never {@code null} value. - * - * @throws IllegalArgumentException if {@code containerObjectWithCommand} contains no {@link MCommand}. See - * {@link #referencesCommand(EObject)}. - */ - protected List<MCommandParameter> getCommandParameters(EObject containerObjectWithCommand) { - Object command = containerObjectWithCommand.eGet(MenuPackageImpl.Literals.HANDLED_ITEM__COMMAND); - - if (command != null && command instanceof MCommand) { - List<MCommandParameter> parameters = ((MCommand) command).getParameters(); - if (parameters != null) - return parameters; - return Collections.emptyList(); - } - throw new IllegalArgumentException("The parameter contains no MCommand"); //$NON-NLS-1$ - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartDescriptorIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartDescriptorIconDialogEditor.java deleted file mode 100644 index 0583f215..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartDescriptorIconDialogEditor.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Steven Spungin <steven@spungin.tv> - Bug 424730 - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; - -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptor; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.swt.widgets.Shell; - -public class PartDescriptorIconDialogEditor extends AbstractIconDialog { - - public PartDescriptorIconDialogEditor(Shell parentShell, IEclipseContext context, IProject project, EditingDomain editingDomain, MPartDescriptor element, Messages Messages) { - super(parentShell, context, project, editingDomain, element, UiPackageImpl.Literals.UI_LABEL__ICON_URI, Messages); - } - - @Override - protected String getShellTitle() { - return Messages.PartDescriptorIconDialogEditor_ShellTitle; - } - - @Override - protected String getDialogTitle() { - return Messages.PartDescriptorIconDialogEditor_DialogTitle; - } - - @Override - protected String getDialogMessage() { - return Messages.PartDescriptorIconDialogEditor_DialogMessage; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartIconDialogEditor.java deleted file mode 100644 index ed311dd7..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartIconDialogEditor.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Steven Spungin <steven@spungin.tv> - Bug 424730 - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; - -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.ui.model.application.ui.basic.MPart; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.swt.widgets.Shell; - -public class PartIconDialogEditor extends AbstractIconDialog { - - public PartIconDialogEditor(Shell parentShell, IEclipseContext context, IProject project, EditingDomain editingDomain, MPart element, Messages Messages) { - super(parentShell, context, project, editingDomain, element, UiPackageImpl.Literals.UI_LABEL__ICON_URI, Messages); - } - - @Override - protected String getShellTitle() { - return Messages.PartIconDialogEditor_ShellTitle; - } - - @Override - protected String getDialogTitle() { - return Messages.PartIconDialogEditor_DialogTitle; - } - - @Override - protected String getDialogMessage() { - return Messages.PartIconDialogEditor_DialogMessage; - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PerspectiveIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PerspectiveIconDialogEditor.java deleted file mode 100644 index 81bf9fef..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PerspectiveIconDialogEditor.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Steven Spungin <steven@spungin.tv> - Bug 424730 - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; - -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.swt.widgets.Shell; - -public class PerspectiveIconDialogEditor extends AbstractIconDialog { - - public PerspectiveIconDialogEditor(Shell parentShell, IEclipseContext context, IProject project, EditingDomain editingDomain, MPerspective element, Messages Messages) { - super(parentShell, context, project, editingDomain, element, UiPackageImpl.Literals.UI_LABEL__ICON_URI, Messages); - } - - @Override - protected String getShellTitle() { - return Messages.PerspectiveIconDialogEditor_ShellTitle; - } - - @Override - protected String getDialogTitle() { - return Messages.PerspectiveIconDialogEditor_DialogTitle; - } - - @Override - protected String getDialogMessage() { - return Messages.PerspectiveIconDialogEditor_DialogMessage; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/SaveDialogBoundsSettingsDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/SaveDialogBoundsSettingsDialog.java deleted file mode 100644 index a0257e2c..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/SaveDialogBoundsSettingsDialog.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 fhv.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Andrej ten Brummelhuis <andrejbrummelhuis@gmail.com> - initial implementation (Bug 395283) - * Marco Descher <marco@descher.at> - Bug 442647 - *******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; - -import org.eclipse.e4.tools.emf.ui.common.Plugin; - -import org.eclipse.core.runtime.preferences.InstanceScope; -import org.eclipse.jface.dialogs.DialogSettings; -import org.eclipse.jface.dialogs.IDialogSettings; -import org.eclipse.jface.dialogs.TitleAreaDialog; -import org.eclipse.swt.widgets.Shell; -import org.osgi.service.prefs.BackingStoreException; -import org.osgi.service.prefs.Preferences; - -public abstract class SaveDialogBoundsSettingsDialog extends TitleAreaDialog { - - private static final String DIALOG_ORIGIN_X = "DIALOG_X_ORIGIN"; //$NON-NLS-1$ - private static final String DIALOG_ORIGIN_Y = "DIALOG_Y_ORIGIN"; //$NON-NLS-1$ - private static final String DIALOG_WIDTH = "DIALOG_WIDTH"; //$NON-NLS-1$ - private static final String DIALOG_HEIGHT = "DIALOG_HEIGHT"; //$NON-NLS-1$ - - private IDialogSettings dialogSettings = new DialogSettings(Plugin.ID); - - private Preferences preferences = InstanceScope.INSTANCE.getNode(Plugin.ID); - - public SaveDialogBoundsSettingsDialog(Shell parentShell) { - super(parentShell); - - dialogSettings.put(DIALOG_HEIGHT, preferences.getInt(DIALOG_HEIGHT, -1)); - dialogSettings.put(DIALOG_WIDTH, preferences.getInt(DIALOG_WIDTH, -1)); - dialogSettings.put(DIALOG_ORIGIN_X, preferences.getInt(DIALOG_ORIGIN_X, -1)); - dialogSettings.put(DIALOG_ORIGIN_Y, preferences.getInt(DIALOG_ORIGIN_Y, -1)); - } - - private void saveDialogSettings() { - preferences.put(DIALOG_HEIGHT, dialogSettings.get(DIALOG_HEIGHT)); - preferences.put(DIALOG_WIDTH, dialogSettings.get(DIALOG_WIDTH)); - preferences.put(DIALOG_ORIGIN_X, dialogSettings.get(DIALOG_ORIGIN_X)); - preferences.put(DIALOG_ORIGIN_Y, dialogSettings.get(DIALOG_ORIGIN_Y)); - try { - preferences.flush(); - } catch (BackingStoreException e) { - e.printStackTrace(); - } - } - - @Override - public boolean close() { - boolean returnValue = super.close(); - saveDialogSettings(); - return returnValue; - } - - @Override - protected IDialogSettings getDialogBoundsSettings() { - return dialogSettings; - } - - public Preferences getPreferences() { - return preferences; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/SharedElementsDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/SharedElementsDialog.java deleted file mode 100644 index 9ba04e58..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/SharedElementsDialog.java +++ /dev/null @@ -1,220 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010-2014 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Andrej ten Brummelhuis <andrejbrummelhuis@gmail.com> - Bug 395283 - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.PatternFilter; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory; -import org.eclipse.e4.ui.model.application.MApplication; -import org.eclipse.e4.ui.model.application.MApplicationElement; -import org.eclipse.e4.ui.model.application.ui.MUIElement; -import org.eclipse.e4.ui.model.application.ui.MUILabel; -import org.eclipse.e4.ui.model.application.ui.advanced.MArea; -import org.eclipse.e4.ui.model.application.ui.advanced.MPlaceholder; -import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; -import org.eclipse.e4.ui.model.application.ui.basic.MPart; -import org.eclipse.e4.ui.model.application.ui.basic.MPartSashContainer; -import org.eclipse.e4.ui.model.application.ui.basic.MPartStack; -import org.eclipse.e4.ui.model.application.ui.basic.MWindow; -import org.eclipse.e4.ui.model.fragment.MModelFragment; -import org.eclipse.e4.ui.model.fragment.MModelFragments; -import org.eclipse.e4.ui.model.fragment.MStringModelFragment; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.jface.viewers.AbstractTreeViewer; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.DoubleClickEvent; -import org.eclipse.jface.viewers.IDoubleClickListener; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StyledCellLabelProvider; -import org.eclipse.jface.viewers.StyledString; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerCell; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; - -public class SharedElementsDialog extends SaveDialogBoundsSettingsDialog { - private TableViewer viewer; - private final MPlaceholder placeholder; - private final IModelResource resource; - private final ModelEditor editor; - private final Messages Messages; - - public SharedElementsDialog(Shell parentShell, ModelEditor editor, MPlaceholder placeholder, - IModelResource resource, Messages Messages) { - super(parentShell); - this.editor = editor; - this.placeholder = placeholder; - this.resource = resource; - this.Messages = Messages; - } - - @Override - protected Control createDialogArea(Composite parent) { - final Composite comp = (Composite) super.createDialogArea(parent); - - getShell().setText(Messages.SharedElementsDialog_ShellTitle); - setTitle(Messages.SharedElementsDialog_Title); - setMessage(Messages.SharedElementsDialog_Message); - - final Composite container = new Composite(comp, SWT.NONE); - container.setLayout(new GridLayout(2, false)); - container.setLayoutData(new GridData(GridData.FILL_BOTH)); - - Label l = new Label(container, SWT.NONE); - l.setText(Messages.SharedElementsDialog_Name); - - final Text searchText = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH); - searchText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - l = new Label(container, SWT.NONE); - - viewer = new TableViewer(container); - viewer.setContentProvider(new ArrayContentProvider()); - viewer.setLabelProvider(new LabelProviderImpl()); - viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); - - viewer.addDoubleClickListener(new IDoubleClickListener() { - - @Override - public void doubleClick(DoubleClickEvent event) { - okPressed(); - } - }); - - if (resource.getRoot().get(0) instanceof MApplication) { - final List<MUIElement> list = new ArrayList<MUIElement>(); - for (final MWindow m : ((MApplication) resource.getRoot().get(0)).getChildren()) { - list.addAll(filter(m.getSharedElements())); - } - viewer.setInput(list); - } else if (resource.getRoot().get(0) instanceof MModelFragments) { - final List<MApplicationElement> list = new ArrayList<MApplicationElement>(); - for (final MModelFragment f : ((MModelFragments) resource.getRoot().get(0)).getFragments()) { - if (f instanceof MStringModelFragment) { - if (((MStringModelFragment) f).getFeaturename().equals("sharedElements")) { //$NON-NLS-1$ - list.addAll(filter(f.getElements())); - } - } - } - - // NEW IMPLEMENTATION: - for (final MApplicationElement f : ((MModelFragments) resource.getRoot().get(0)).getImports()) { - // let filter() do its job - list.addAll(filter(Collections.singletonList(f))); - } - viewer.setInput(list); - } - - final PatternFilter filter = new PatternFilter() { - @Override - protected boolean isParentMatch(Viewer viewer, Object element) { - return viewer instanceof AbstractTreeViewer && super.isParentMatch(viewer, element); - } - }; - viewer.addFilter(filter); - - ControlFactory.attachFiltering(searchText, viewer, filter); - - return comp; - } - - @Override - protected void okPressed() { - if (!viewer.getSelection().isEmpty()) { - final IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - final Command cmd = SetCommand.create(resource.getEditingDomain(), placeholder, - AdvancedPackageImpl.Literals.PLACEHOLDER__REF, s.getFirstElement()); - if (cmd.canExecute()) { - resource.getEditingDomain().getCommandStack().execute(cmd); - super.okPressed(); - } - } - } - - private static <T> List<T> filter(List<T> o) { - final List<T> rv = new ArrayList<T>(); - for (final T i : o) { - if (i instanceof MPart || i instanceof MPartSashContainer || i instanceof MArea || i instanceof MPartStack) { - rv.add(i); - } - } - return rv; - } - - private class LabelProviderImpl extends StyledCellLabelProvider implements ILabelProvider { - @Override - public void update(final ViewerCell cell) { - final EObject o = (EObject) cell.getElement(); - - final StyledString string = new StyledString(getTypename(o)); - - if (o instanceof MUILabel) { - string.append(" - " + ((MUILabel) o).getLabel(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ - } - - final MApplicationElement el = (MApplicationElement) o; - string.append(" - " + el.getElementId(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ - - cell.setText(string.getString()); - cell.setStyleRanges(string.getStyleRanges()); - cell.setImage(getImage(o)); - } - - @Override - public String getText(Object element) { - final EObject o = (EObject) element; - final MApplicationElement el = (MApplicationElement) o; - - if (el instanceof MUILabel) { - final MUILabel label = (MUILabel) el; - return getTypename(o) + " - " + el.getElementId() + " - " + label.getLabel(); //$NON-NLS-1$ //$NON-NLS-2$ - } - return getTypename(o) + " - " + el.getElementId() + " - "; //$NON-NLS-1$ //$NON-NLS-2$ - } - - private String getTypename(EObject o) { - final AbstractComponentEditor editor = SharedElementsDialog.this.editor.getEditor(o.eClass()); - if (editor != null) { - return editor.getLabel(o); - } - return o.eClass().getName(); - } - - @Override - public Image getImage(Object element) { - final AbstractComponentEditor editor = SharedElementsDialog.this.editor.getEditor(((EObject) element) - .eClass()); - if (editor != null) { - return editor.getImage(element, getShell().getDisplay()); - } - return null; - } - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ToolBarIdDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ToolBarIdDialog.java deleted file mode 100644 index eae3f253..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ToolBarIdDialog.java +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolaj Hoess <nicohoess@gmail.com> - initial implementation (Bug 396975) - * Andrej Brummelhuis <andrejbrummelhuis@gmail.com> - initial implementation (Bug 396975) - * Adrian Alcaide <adrian4912@gmail.com> - initial implementation (Bug 396975) - *******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; - -import java.util.ArrayList; -import java.util.List; -import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.ui.model.application.MApplication; -import org.eclipse.e4.ui.model.application.MApplicationElement; -import org.eclipse.e4.ui.model.application.ui.MElementContainer; -import org.eclipse.e4.ui.model.application.ui.basic.MTrimBar; -import org.eclipse.e4.ui.model.application.ui.menu.MToolBar; -import org.eclipse.e4.ui.model.application.ui.menu.MToolBarContribution; -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.e4.ui.model.fragment.MModelFragments; -import org.eclipse.e4.ui.workbench.modeling.EModelService; -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.swt.widgets.Shell; - -public class ToolBarIdDialog extends AbstractIdDialog<MToolBarContribution, MToolBar> { - - public ToolBarIdDialog(Shell parentShell, IModelResource resource, MToolBarContribution toolbarContribution, EditingDomain domain, EModelService modelService, Messages Messages) { - super(parentShell, resource, toolbarContribution, domain, modelService, Messages); - } - - @Override - protected String getShellTitle() { - return messages.ToolBarIdDialog_ShellTitle; - } - - @Override - protected String getDialogTitle() { - return messages.ToolBarIdDialog_DialogTitle; - } - - @Override - protected String getDialogMessage() { - return messages.ToolBarIdDialog_DialogMessage; - } - - @Override - protected String getLabelText() { - return messages.ToolBarIdDialog_Id; - } - - @Override - protected List<MToolBar> getViewerInput() { - List<MToolBar> result = new ArrayList<MToolBar>(); - if (resource.getRoot().get(0) instanceof MApplication) { - - MApplication ma = ((MApplication) resource.getRoot().get(0)); - - List<MToolBar> tbs = modelService.findElements(ma, null, MToolBar.class, null); - result.addAll(tbs); - - } else if (resource.getRoot().get(0) instanceof MModelFragments) { - - for (MApplicationElement f : ((MModelFragments) resource.getRoot().get(0)).getImports()) { - if (f instanceof MToolBar) { - result.add((MToolBar) f); - } - } - - } - return result; - } - - @Override - protected EAttribute getFeatureLiteral() { - return MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTION__PARENT_ID; - } - - @Override - protected String getListItemInformation(MToolBar listItem) { - return getAdditionalInfoForToolBar(listItem); - } - - /** - * Returns additional information for the given {@link MToolBar}. At the - * moment the position of the parent {@link MTrimBar} is returned. - * - * TODO Check which information is most relevant for the user - * - * @param toolBar - * @return String - */ - private String getAdditionalInfoForToolBar(MToolBar toolBar) { - MElementContainer<?> container = toolBar.getParent(); - if (container == null) { - // If the MToolBar is imported into a fragment getParent() will - // return null - return "imported"; //$NON-NLS-1$ - } - while (container instanceof MTrimBar == false) { - container = container.getParent(); - } - return ((MTrimBar) container).getSide().getName(); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ToolItemIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ToolItemIconDialogEditor.java deleted file mode 100644 index 9d6e1089..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ToolItemIconDialogEditor.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Steven Spungin <steven@spungin.tv> - Bug 424730 - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; - -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.MToolItem; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.swt.widgets.Shell; - -public class ToolItemIconDialogEditor extends AbstractIconDialog { - - public ToolItemIconDialogEditor(Shell parentShell, IEclipseContext context, IProject project, EditingDomain editingDomain, MToolItem element, Messages Messages) { - super(parentShell, context, project, editingDomain, element, UiPackageImpl.Literals.UI_LABEL__ICON_URI, Messages); - } - - @Override - protected String getShellTitle() { - return Messages.ToolItemIconDialogEditor_ShellTitle; - } - - @Override - protected String getDialogTitle() { - return Messages.ToolItemIconDialogEditor_DialogTitle; - } - - @Override - protected String getDialogMessage() { - return Messages.ToolItemIconDialogEditor_DialogMessage; - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/TrimIdDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/TrimIdDialog.java deleted file mode 100644 index 10faf26d..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/TrimIdDialog.java +++ /dev/null @@ -1,89 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolaj Hoess <nicohoess@gmail.com> - initial implementation (Bug 396975) - * Andrej Brummelhuis <andrejbrummelhuis@gmail.com> - initial implementation (Bug 396975) - * Adrian Alcaide <adrian4912@gmail.com> - initial implementation (Bug 396975) - *******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; - -import java.util.ArrayList; -import java.util.List; -import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.ui.model.application.MApplication; -import org.eclipse.e4.ui.model.application.MApplicationElement; -import org.eclipse.e4.ui.model.application.ui.basic.MTrimBar; -import org.eclipse.e4.ui.model.application.ui.menu.MTrimContribution; -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.e4.ui.model.fragment.MModelFragments; -import org.eclipse.e4.ui.workbench.modeling.EModelService; -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.swt.widgets.Shell; - -public class TrimIdDialog extends AbstractIdDialog<MTrimContribution, MTrimBar> { - - public TrimIdDialog(Shell parentShell, IModelResource resource, MTrimContribution toolbarContribution, EditingDomain domain, EModelService modelService, Messages Messages) { - super(parentShell, resource, toolbarContribution, domain, modelService, Messages); - } - - @Override - protected String getShellTitle() { - return messages.TrimBarIdDialog_ShellTitle; - } - - @Override - protected String getDialogTitle() { - return messages.TrimBarIdDialog_DialogTitle; - } - - @Override - protected String getDialogMessage() { - return messages.TrimBarIdDialog_DialogMessage; - } - - @Override - protected String getLabelText() { - return messages.TrimBarIdDialog_Id; - } - - @Override - protected List<MTrimBar> getViewerInput() { - List<MTrimBar> result = new ArrayList<MTrimBar>(); - - if (resource.getRoot().get(0) instanceof MApplication) { - - MApplication ma = ((MApplication) resource.getRoot().get(0)); - - List<MTrimBar> tbs = modelService.findElements(ma, null, MTrimBar.class, null); - result.addAll(tbs); - - } else if (resource.getRoot().get(0) instanceof MModelFragments) { - - for (MApplicationElement f : ((MModelFragments) resource.getRoot().get(0)).getImports()) { - if (f instanceof MTrimBar) { - result.add((MTrimBar) f); - } - } - } - - return result; - } - - @Override - protected EAttribute getFeatureLiteral() { - return MenuPackageImpl.Literals.TRIM_CONTRIBUTION__PARENT_ID; - } - - @Override - protected String getListItemInformation(MTrimBar listItem) { - return listItem.getSide().getName(); - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/WindowIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/WindowIconDialogEditor.java deleted file mode 100644 index dc22bb17..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/WindowIconDialogEditor.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Steven Spungin <steven@spungin.tv> - Bug 424730 - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; - -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.ui.model.application.ui.basic.MWindow; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.swt.widgets.Shell; - -public class WindowIconDialogEditor extends AbstractIconDialog { - - public WindowIconDialogEditor(Shell parentShell, IEclipseContext context, IProject project, EditingDomain editingDomain, MWindow element, Messages Messages) { - super(parentShell, context, project, editingDomain, element, UiPackageImpl.Literals.UI_LABEL__ICON_URI, Messages); - } - - @Override - protected String getShellTitle() { - return Messages.WindowIconDialogEditor_ShellTitle; - } - - @Override - protected String getDialogTitle() { - return Messages.WindowIconDialogEditor_DialogTitle; - } - - @Override - protected String getDialogMessage() { - return Messages.WindowIconDialogEditor_DialogMessage; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/ContributionUriCellEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/ContributionUriCellEditor.java deleted file mode 100644 index c409cfff..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/ContributionUriCellEditor.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. All rights reserved. This - * program and the accompanying materials are made available under the terms of - * the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 432555 - *******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.internal.common.component.tabs; - -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.dialogs.BundleClassDialog; -import org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.dialogs.IconDialog; -import org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.dialogs.UriDialog; -import org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.dialogs.UriDialogType; -import org.eclipse.jface.viewers.DialogCellEditor; -import org.eclipse.jface.window.Window; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; - -/** - * A cell editor that when selected offers the option to edit, view, or goto the - * item. - * - * @author Steven Spungin - * - */ -public class ContributionUriCellEditor extends DialogCellEditor { - - private UriDialog dlg; - - public ContributionUriCellEditor(Composite parent, int style, IEclipseContext context, UriDialogType dialogType) { - super(parent, style); - switch (dialogType) { - case ICON: - dlg = new IconDialog(parent.getShell(), context); - break; - case BUNDLECLASS: - default: - dlg = new BundleClassDialog(parent.getShell(), context); - break; - } - } - - @Override - protected Object openDialogBox(Control cellEditorWindow) { - dlg.setUri((String) getValue()); - if (dlg.open() == Window.OK) { - return dlg.getUri(); - } - return getValue(); - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/DocUtil.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/DocUtil.java deleted file mode 100644 index 12800b29..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/DocUtil.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation - *******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.internal.common.component.tabs; - -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -/** - * Helper functions for working with documents. - * - * @author Steven Spungin - * - */ -public class DocUtil { - - public static Element createChild(Element parent, String name) { - Element element = parent.getOwnerDocument().createElement(name); - parent.appendChild(element); - return element; - } - - public static Document createDocument(String name) throws ParserConfigurationException { - Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); - doc.appendChild(doc.createElement(name)); - return doc; - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/E4ToolItemMenu.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/E4ToolItemMenu.java deleted file mode 100644 index ca8c49c7..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/E4ToolItemMenu.java +++ /dev/null @@ -1,112 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation - *******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.internal.common.component.tabs; - -import java.util.ArrayList; -import java.util.Collection; - -import org.eclipse.core.commands.ParameterizedCommand; -import org.eclipse.core.commands.common.NotDefinedException; -import org.eclipse.e4.core.commands.ECommandService; -import org.eclipse.e4.core.commands.EHandlerService; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.graphics.Rectangle; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.MenuItem; -import org.eclipse.swt.widgets.ToolBar; -import org.eclipse.swt.widgets.ToolItem; - -/** - * A tool item that displays commands in a drop down menu. The enabled state is - * set by querying the handler when the menu is opened. - * - * @author Steven Spungin - * - */ -public class E4ToolItemMenu { - - public static final String SEPARATOR = "~separator~"; //$NON-NLS-1$ - private final IEclipseContext context; - private final ArrayList<String> commandIds = new ArrayList<String>(); - private final Menu menu; - private final ECommandService commandService; - private final EHandlerService handlerService; - private final ToolItem toolItem; - - public E4ToolItemMenu(final ToolBar parent, IEclipseContext context) { - - toolItem = new ToolItem(parent, SWT.DROP_DOWN); - this.context = context; - commandService = this.context.get(ECommandService.class); - handlerService = this.context.get(EHandlerService.class); - - menu = new Menu(parent.getShell(), SWT.POP_UP); - - toolItem.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent event) { - // if (event.detail == SWT.ARROW) { - final Rectangle rect = toolItem.getBounds(); - Point pt = new Point(rect.x, rect.y + rect.height); - pt = parent.toDisplay(pt); - menu.setLocation(pt.x, pt.y); - menu.setVisible(true); - for (final MenuItem mi : menu.getItems()) { - if (mi.getData() instanceof ParameterizedCommand) { - final ParameterizedCommand cmd = (ParameterizedCommand) mi.getData(); - mi.setEnabled(handlerService.canExecute(cmd)); - } - } - // } - } - }); - } - - public void addCommands(Collection<String> commandIds) { - this.commandIds.addAll(commandIds); - - for (final String id : commandIds) { - if (id.equals(SEPARATOR)) { - new MenuItem(menu, SWT.SEPARATOR); - } else { - final ParameterizedCommand myCommand = commandService.createCommand(id, null); - if (myCommand != null) { - final MenuItem item = new MenuItem(menu, SWT.PUSH); - try { - item.setText(myCommand.getName()); - } catch (final NotDefinedException e1) { - item.setText(id); - e1.printStackTrace(); - } - item.setData(myCommand); - item.addSelectionListener(new SelectionAdapter() { - - @Override - public void widgetSelected(SelectionEvent e) { - final ParameterizedCommand cmd = (ParameterizedCommand) item.getData(); - handlerService.executeHandler(cmd); - } - - }); - } - } - } - } - - public ToolItem getToolItem() { - return toolItem; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/EAttributeEditingSupport.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/EAttributeEditingSupport.java deleted file mode 100644 index cb66d8d1..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/EAttributeEditingSupport.java +++ /dev/null @@ -1,165 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 432555 - *******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.internal.common.component.tabs; - -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.dialogs.UriDialogType; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.util.Policy; -import org.eclipse.jface.viewers.CellEditor; -import org.eclipse.jface.viewers.CheckboxCellEditor; -import org.eclipse.jface.viewers.EditingSupport; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; -import org.eclipse.jface.viewers.TextCellEditor; -import org.eclipse.swt.SWT; - -// Restrictions: Only handles boolean and String types -class EAttributeEditingSupport extends EditingSupport { - - private final String attName; - private final TableViewer tableViewer; - private boolean wasNull; - private final IEclipseContext context; - - static public enum ATT_TYPE { - STRING, BOOLEAN, INTEGER, NOT_AN_ATTRIBUTE, OTHER; - } - - public EAttributeEditingSupport(TableViewer tableViewer, String attName, IEclipseContext context) { - super(tableViewer); - this.tableViewer = tableViewer; - this.attName = attName; - this.context = context; - } - - @Override - protected CellEditor getCellEditor(Object element) { - switch (getAttributeType(element, attName)) { - case BOOLEAN: - return new CheckboxCellEditor(tableViewer.getTable(), SWT.CHECK); - case STRING: - case INTEGER: - default: - if ("contributionURI".equals(attName)) { //$NON-NLS-1$ - return new ContributionUriCellEditor(tableViewer.getTable(), SWT.NONE, context, - UriDialogType.BUNDLECLASS); - } - if ("iconURI".equals(attName)) { //$NON-NLS-1$ - return new ContributionUriCellEditor(tableViewer.getTable(), SWT.NONE, context, UriDialogType.ICON); - } - return new TextCellEditor(tableViewer.getTable(), SWT.NONE); - } - } - - static public ATT_TYPE getAttributeType(Object element, String attName) { - final EAttribute att = EmfUtil.getAttribute((EObject) element, attName); - if (att == null) { - return ATT_TYPE.NOT_AN_ATTRIBUTE; - } - final String instanceTypeName = att.getEType().getInstanceTypeName(); - if (instanceTypeName.equals(String.class.getName())) { - return ATT_TYPE.STRING; - } else if (instanceTypeName.equals(boolean.class.getName())) { - return ATT_TYPE.BOOLEAN; - } else if (instanceTypeName.equals(int.class.getName())) { - return ATT_TYPE.INTEGER; - } else { - return ATT_TYPE.OTHER; - } - } - - @Override - protected boolean canEdit(Object element) { - final EAttribute att = EmfUtil.getAttribute((EObject) element, attName); - if (att == null) { - return false; - } - final String instanceTypeName = att.getEType().getInstanceTypeName(); - if (instanceTypeName.equals(String.class.getName())) { - return true; - } else if (instanceTypeName.equals(boolean.class.getName())) { - return true; - } else if (instanceTypeName.equals(int.class.getName())) { - return true; - } else { - return false; - } - } - - @Override - protected Object getValue(Object element) { - final EObject eObject = (EObject) element; - Object value = eObject.eGet(EmfUtil.getAttribute(eObject, attName)); - switch (getAttributeType(element, attName)) { - case BOOLEAN: - wasNull = false; - break; - case INTEGER: - if (value == null) { - value = ""; //$NON-NLS-1$ - wasNull = true; - } else { - return Integer.toString((Integer) value); - } - break; - case STRING: - default: - if (value == null) { - value = ""; //$NON-NLS-1$ - wasNull = true; - } else { - wasNull = false; - } - break; - } - return value; - } - - @Override - protected void setValue(Object element, Object value) { - final EObject eObject = (EObject) element; - switch (getAttributeType(element, attName)) { - case INTEGER: - if (value.equals("")) { //$NON-NLS-1$ - value = null; - } else { - try { - value = Integer.parseInt(value.toString()); - } catch (final Exception e) { - return; - } - } - break; - case BOOLEAN: - case STRING: - default: - if (value.equals("") && wasNull) { //$NON-NLS-1$ - value = null; - } - break; - } - final Command cmd = SetCommand.create(context.get(EditingDomain.class), eObject, - EmfUtil.getAttribute(eObject, attName), value); - context.get(EditingDomain.class).getCommandStack().execute(cmd); - TableViewerUtil.updateAndPack(tableViewer, eObject); - } - - static public TableViewerColumn getTableViewerColumn(TableViewer viewer, int index) { - return (TableViewerColumn) viewer.getTable().getColumn(index).getData(Policy.JFACE + ".columnViewer"); //$NON-NLS-1$ - - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/EAttributeTableViewerColumn.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/EAttributeTableViewerColumn.java deleted file mode 100644 index f6850a30..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/EAttributeTableViewerColumn.java +++ /dev/null @@ -1,118 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 432555, Bug 436889 - *******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.internal.common.component.tabs; - -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.services.IResourcePool; -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jface.viewers.ColumnLabelProvider; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Image; - -/** - * A table viewer column for editing an EMF EAttribute If the object does not - * have an attribute with the given ID, the field is disabled. - * - * @author Steven Spungin - * - */ -public class EAttributeTableViewerColumn { - - private TableViewerColumn tableViewerColumn; - private IResourcePool resourcePool; - private String attName; - private TableViewer tvResults; - - public EAttributeTableViewerColumn(final TableViewer tvResults, String label, final String attName, - final IEclipseContext context) { - this.tvResults = tvResults; - this.attName = attName; - tableViewerColumn = new TableViewerColumn(tvResults, SWT.NONE); - - // CAN be null. Used for checkbox icon. - resourcePool = context.get(IResourcePool.class); - - tableViewerColumn.getColumn().setText(label); - tableViewerColumn.setLabelProvider(new ColumnLabelProvider() { - @Override - public String getText(Object element) { - final EObject eObject = (EObject) element; - final EAttribute eAtt = EmfUtil.getAttribute(eObject, attName); - Object value; - if (eAtt != null) { - value = eObject.eGet(eAtt); - } else { - value = ""; //$NON-NLS-1$ - } - switch (EAttributeEditingSupport.getAttributeType(element, attName)) { - case BOOLEAN: - // if no icons provided, use text instead of checkbox - return resourcePool == null && (Boolean) value ? "X" : ""; //$NON-NLS-1$ //$NON-NLS-2$ - case STRING: - case NOT_AN_ATTRIBUTE: - case OTHER: - default: - return super.getText(value); - } - } - - @Override - public Image getImage(Object element) { - switch (EAttributeEditingSupport.getAttributeType(element, attName)) { - case BOOLEAN: - if (resourcePool != null) { - final Object value = EmfUtil.getAttributeValue((EObject) element, attName); - if (value != null && value.equals(true)) { - return resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_checkbox_obj); - } - } - // fall through - //$FALL-THROUGH$ - case STRING: - case NOT_AN_ATTRIBUTE: - case OTHER: - default: - return super.getImage(element); - } - } - - @Override - public Color getBackground(Object element) { - return EAttributeTableViewerColumn.this.getBackground(element); - } - }); - tableViewerColumn.setEditingSupport(new EAttributeEditingSupport(tvResults, attName, context)); - } - - public Color getBackground(Object element) { - final EObject eObject = (EObject) element; - final EAttribute eAtt = EmfUtil.getAttribute(eObject, attName); - if (eAtt == null) { - return tvResults.getTable().getDisplay().getSystemColor(SWT.COLOR_GRAY); - } - return null; - } - - public void dispose() { - tableViewerColumn.getColumn().dispose(); - } - - public TableViewerColumn getTableViewerColumn() { - return tableViewerColumn; - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/EmfUtil.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/EmfUtil.java deleted file mode 100644 index 8287cde6..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/EmfUtil.java +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation, Ongoing Maintenance - *******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.internal.common.component.tabs; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EObject; - -/** - * Convenience methods for accessing EMF Objects - * - * @author Steven Spungin - * - */ -public class EmfUtil { - /** - * Returns the EAttribute with the given name for the specified object, or - * null if non-existent - * - * @param eObject - * @param attName - * @return the EAttribute with the given name for the specified object, or - * null if non-existent - */ - static public EAttribute getAttribute(EObject eObject, String attName) { - if (attName == null || attName.isEmpty()) { - return null; - } - // return (EAttribute) - // eObject.eGet(eObject.eClass().getEStructuralFeature(attName)); - for (final EAttribute att : eObject.eClass().getEAllAttributes()) { - if (attName.equals(att.getName())) { - return att; - } - } - return null; - } - - /** - * Returns the EAttribute value with the given attribute name for the - * specified object. Returns null if the attribute is not define, or has - * null as the value. - * - * @param eObject - * @param attName - * @return the EAttribute value with the given attribute name for the - * specified object, Returns null if the attribute is not defined, - * or has null as the value. - */ - static public Object getAttributeValue(EObject eObject, String attName) { - final EAttribute att = getAttribute(eObject, attName); - if (att == null) { - return null; - } - return eObject.eGet(att); - } - - /** - * Returns the EAttribute value with the given attribute name for the - * specified object. Throws if the attribute is not defined. - * - * @param eObject - * @param attName - * @throws Exception - */ - static public Object getAttributeValueThrows(EObject eObject, String attName) throws Exception { - final EAttribute att = getAttribute(eObject, attName); - if (att == null) { - throw new Exception(Messages.EmfUtil_ex_attribute_not_found + " : " + attName); //$NON-NLS-1$ - } - return eObject.eGet(att); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/IGotoObject.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/IGotoObject.java deleted file mode 100644 index fecd0ee8..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/IGotoObject.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation - *******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.internal.common.component.tabs; - -import org.eclipse.emf.ecore.EObject; - -/** - * This interface allows a UI object to reveal and select an EMF object. - * - * @author Steven Spungin - * - */ -public interface IGotoObject { - /** - * - * @param targetHint - * An object specific hint used for resolution when the same - * object is available in multiple locations on the target. - * @param object - * the EObject to reveal, and select. - */ - void gotoEObject(int targetHint, EObject object); -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/IViewEObjects.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/IViewEObjects.java deleted file mode 100644 index 98730b7f..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/IViewEObjects.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 432555, Bug 436889 - *******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.internal.common.component.tabs; - -import java.util.Collection; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.domain.EditingDomain; - -/** - * This interface provides a common API for editing trees, lists, and xml - * editors that display EObjects. - * - * @author Steven Spungin - * - */ -public interface IViewEObjects { - - /** - * Highlights the indicated items. Objects that are not managed are ignored. - * All other items are un-highlighted. - * - * @param items - * Collection of objects to highlight. - */ - void highlightEObjects(Collection<EObject> items); - - /** - * All EObjects that are managed by the view. - * - * @return All EObjects that are managed by the view's provider - */ - Collection<EObject> getAllEObjects(); - - /** - * All EObjects that are selected by the view - * - * @return All EObjects that are selected by the view - */ - Collection<EObject> getSelectedEObjects(); - - /** - * Deletes the objects specified. - * - * @param list - * The list of objects to delete. Objects that are not managed - * are ignored. - */ - void deleteEObjects(Collection<EObject> list); - - /** - * - * @return The editing domain for the implementor's model. - */ - EditingDomain getEditingDomain(); - - /** - * Sizes widgets to fit their content. For example, columns will adjust - * their width. - */ - void autosizeContent(); - - /** - * Reverts the view to default settings - */ - void resetToDefault(); -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/ListTab.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/ListTab.java deleted file mode 100644 index f81eb4d7..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/ListTab.java +++ /dev/null @@ -1,986 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 432555, Bug 436889, Bug 437372, Bug 440469, - * Ongoing Maintenance - *******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.internal.common.component.tabs; - -import java.io.StringReader; -import java.io.StringWriter; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.concurrent.ConcurrentHashMap; - -import javax.annotation.PostConstruct; -import javax.annotation.PreDestroy; -import javax.inject.Inject; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.OutputKeys; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; -import javax.xml.xpath.XPath; -import javax.xml.xpath.XPathConstants; -import javax.xml.xpath.XPathFactory; - -import org.eclipse.core.runtime.preferences.IEclipsePreferences; -import org.eclipse.core.runtime.preferences.InstanceScope; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.core.services.nls.Translation; -import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.e4.tools.emf.ui.common.ModelEditorPreferences; -import org.eclipse.e4.tools.emf.ui.common.Plugin; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.BundleImageCache; -import org.eclipse.e4.tools.emf.ui.internal.common.component.tabs.EAttributeEditingSupport.ATT_TYPE; -import org.eclipse.e4.tools.emf.ui.internal.common.component.tabs.empty.E; -import org.eclipse.e4.tools.emf.ui.internal.common.component.tabs.empty.EmptyFilterOption; -import org.eclipse.e4.tools.emf.ui.internal.common.component.tabs.empty.TitleAreaFilterDialog; -import org.eclipse.e4.tools.emf.ui.internal.common.component.tabs.empty.TitleAreaFilterDialogWithEmptyOptions; -import org.eclipse.e4.tools.emf.ui.internal.common.xml.EMFDocumentResourceMediator; -import org.eclipse.e4.tools.services.IResourcePool; -import org.eclipse.e4.ui.model.application.MApplication; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.util.TreeIterator; -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.DeleteCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.text.DocumentEvent; -import org.eclipse.jface.text.IDocumentListener; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.ColumnLabelProvider; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerFilter; -import org.eclipse.jface.window.Window; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.events.MouseAdapter; -import org.eclipse.swt.events.MouseEvent; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.GC; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.swt.widgets.TableItem; -import org.eclipse.swt.widgets.ToolBar; -import org.eclipse.swt.widgets.ToolItem; -import org.osgi.service.prefs.BackingStoreException; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.NodeList; -import org.xml.sax.InputSource; - -/** - * A tab that contains a list EObjects, and provides editable columns for - * EObject features. - * - * @author Steven Spungin - * - */ -public class ListTab implements IViewEObjects { - - static final String ELIPSIS = "..."; //$NON-NLS-1$ - - ConcurrentHashMap<String, List<EObject>> mapId_Object = new ConcurrentHashMap<String, List<EObject>>(); - - @Inject - private IEclipseContext context; - - @Inject - private IModelResource modelResource; - - private TableViewer tvResults; - - @Inject - private IGotoObject gotoObjectHandler; - - @Inject - private IResourcePool resourcePool; - - @Inject - @Translation - protected Messages Messages; - - @Inject - MApplication app; - - BundleImageCache imageCache; - - private CTabItem tabItem; - - private ModelResourceContentProvider provider; - - private IDocumentListener documentListener; - - private Collection<?> highlightedItems; - - protected Image imgMarkedItem; - - LinkedHashMap<String, EAttributeTableViewerColumn> defaultColumns = new LinkedHashMap<String, EAttributeTableViewerColumn>(); - LinkedHashMap<String, EAttributeTableViewerColumn> optionalColumns = new LinkedHashMap<String, EAttributeTableViewerColumn>(); - LinkedHashMap<String, TableColumn> requiredColumns = new LinkedHashMap<String, TableColumn>(); - private TableViewerColumn colItem; - private TableViewerColumn colGo; - private TableViewerColumn colGoXmi; - private TableViewerColumn colMarked; - - private ToolItem filterByItem; - private ToolItem filterByAttribute; - private String filterByAttrName; - private String filterByItemName; - private EmptyFilterOption filterByAttrEmptyOption; - - @PreDestroy - public void preDestroy() { - // race condition issue with observables (exception is not thrown when - // break points are set) - tvResults.setContentProvider(ArrayContentProvider.getInstance()); - context.get(EMFDocumentResourceMediator.class).getDocument().removeDocumentListener(documentListener); - } - - // save custom column and filter settings - public void saveSettings() { - final IEclipsePreferences pref = InstanceScope.INSTANCE.getNode(Plugin.ID); - try { - final Document doc = DocUtil.createDocument("list-tab"); //$NON-NLS-1$ - final Element cols = DocUtil.createChild(doc.getDocumentElement(), "columns"); //$NON-NLS-1$ - - final ArrayList<TableColumn> allCols = TableViewerUtil.getColumnsInDisplayOrder(tvResults); - for (final TableColumn col : allCols) { - String id; - if (requiredColumns.containsValue(col)) { - id = getKey(requiredColumns, col); - } else { - id = col.getText(); - } - saveColumn(cols, id, col); - } - - final Element filters = DocUtil.createChild(doc.getDocumentElement(), "filters"); //$NON-NLS-1$ - if (E.notEmpty(filterByAttrName)) { - final Element filter = DocUtil.createChild(filters, "filter"); //$NON-NLS-1$ - DocUtil.createChild(filter, "type").setTextContent("attribute"); //$NON-NLS-1$//$NON-NLS-2$ - DocUtil.createChild(filter, "condition").setTextContent(filterByAttrName); //$NON-NLS-1$ - DocUtil.createChild(filter, "emptyOption").setTextContent(filterByAttrEmptyOption.name()); //$NON-NLS-1$ - } - if (E.notEmpty(filterByItemName)) { - final Element filter = DocUtil.createChild(filters, "filter"); //$NON-NLS-1$ - DocUtil.createChild(filter, "type").setTextContent("item"); //$NON-NLS-1$ //$NON-NLS-2$ - DocUtil.createChild(filter, "condition").setTextContent(filterByItemName); //$NON-NLS-1$ - } - - pref.put("list-tab-xml", docToString(doc)); //$NON-NLS-1$ - } catch (final ParserConfigurationException e1) { - e1.printStackTrace(); - } catch (final TransformerException e) { - e.printStackTrace(); - } - - try { - pref.flush(); - } catch (final BackingStoreException e) { - e.printStackTrace(); - } - } - - private String getKey(Map<String, ?> map, Object value) { - for (final Entry<String, ?> entry : map.entrySet()) { - if (entry.getValue().equals(value)) { - return entry.getKey(); - } - } - return null; - } - - private void saveColumn(Element eleCols, String columnName, TableColumn objCol) { - final Element col = DocUtil.createChild(eleCols, "column"); //$NON-NLS-1$ - - DocUtil.createChild(col, "attribute").setTextContent(columnName); //$NON-NLS-1$ - - final Integer width = objCol.getWidth(); - DocUtil.createChild(col, "width").setTextContent(width.toString()); //$NON-NLS-1$ - } - - // load custom column and filter settings - private void loadSettings() { - final IEclipsePreferences pref = InstanceScope.INSTANCE.getNode(Plugin.ID); - - final boolean restoreColumns = pref.getBoolean(ModelEditorPreferences.LIST_TAB_REMEMBER_COLUMNS, false); - final boolean restoreFilters = pref.getBoolean(ModelEditorPreferences.LIST_TAB_REMEMBER_FILTERS, false); - if (!restoreColumns && !restoreFilters) { - return; - } - - final String xml = pref.get("list-tab-xml", ""); //$NON-NLS-1$ //$NON-NLS-2$ - if (E.notEmpty(xml)) { - try { - final Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder() - .parse(new InputSource(new StringReader(xml))); - final XPath xpath = XPathFactory.newInstance().newXPath(); - NodeList list; - if (restoreColumns) { - // restore columns and column widths - list = (NodeList) xpath.evaluate("//columns/column", doc, XPathConstants.NODESET); //$NON-NLS-1$ - for (int i = 0; i < list.getLength(); i++) { - final Element ele = (Element) list.item(i); - TableColumn col; - final String colName = xpath.evaluate("attribute/text()", ele); //$NON-NLS-1$ - if (colName.isEmpty()) { - continue; - } - col = requiredColumns.get(colName); - if (col == null) { - col = addColumn(colName).getTableViewerColumn().getColumn(); - } - - // move it to the end of the list. - final int currentIndex = TableViewerUtil.getVisibleColumnIndex(tvResults, col); - final int[] order = tvResults.getTable().getColumnOrder(); - for (int idx = 0; idx < order.length; idx++) { - if (order[idx] > currentIndex) { - order[idx]--; - } else if (order[idx] == currentIndex) { - order[idx] = order.length - 1; - } - } - tvResults.getTable().setColumnOrder(order); - - // if ("Item".equals(colName)) { //$NON-NLS-1$ - // col = colItem; - // } else if ("Item".equals(colName)) { //$NON-NLS-1$ - // col = colItem; - // } - - final String sWidth = xpath.evaluate("width/text()", ele); //$NON-NLS-1$ - try { - col.setWidth(Integer.parseInt(sWidth)); - } catch (final Exception e) { - } - } - } - - if (restoreFilters) { - // restore filters - list = (NodeList) xpath.evaluate("//filters/filter", doc, XPathConstants.NODESET); //$NON-NLS-1$ - for (int i = 0; i < list.getLength(); i++) { - final Element ele = (Element) list.item(i); - final String type = xpath.evaluate("type/text()", ele); //$NON-NLS-1$ - final String condition = xpath.evaluate("condition/text()", ele); //$NON-NLS-1$ - final String emptyOption = xpath.evaluate("emptyOption/text()", ele); //$NON-NLS-1$ - if ("item".equals(type)) { //$NON-NLS-1$ - filterByItem(condition); - } else if ("attribute".equals(type)) { //$NON-NLS-1$ - EmptyFilterOption emptyFilterOption; - try { - emptyFilterOption = EmptyFilterOption.valueOf(emptyOption); - } catch (final Exception e) { - emptyFilterOption = EmptyFilterOption.INCLUDE; - } - filterByAttribute(condition, emptyFilterOption); - } - } - } - } catch (final Exception e) { - } - } - } - - // @Refactor - static private String docToString(Document doc) throws TransformerException { - final TransformerFactory tf = TransformerFactory.newInstance(); - final Transformer transformer = tf.newTransformer(); - transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); //$NON-NLS-1$ - final StringWriter writer = new StringWriter(); - transformer.transform(new DOMSource(doc), new StreamResult(writer)); - final String output = writer.getBuffer().toString().replaceAll("\n|\r", ""); //$NON-NLS-1$ //$NON-NLS-2$ - return output; - } - - // @Refactor - static String join(Collection<String> items, String separator) { - final StringBuilder sb = new StringBuilder(); - for (final String item : items) { - sb.append(item); - sb.append(separator); - } - if (sb.length() > 0) { - sb.setLength(sb.length() - separator.length()); - } - return sb.toString(); - } - - @PostConstruct - public void postConstruct(final CTabFolder tabFolder) { - imageCache = new BundleImageCache(context.get(Display.class), getClass().getClassLoader()); - tabFolder.addDisposeListener(new DisposeListener() { - - @Override - public void widgetDisposed(DisposeEvent e) { - imageCache.dispose(); - } - }); - try { - imgMarkedItem = imageCache.create(Plugin.ID, "/icons/full/obj16/mark_occurrences.png"); //$NON-NLS-1$ - } catch (final Exception e2) { - e2.printStackTrace(); - } - - documentListener = new IDocumentListener() { - - @Override - public void documentChanged(DocumentEvent event) { - reload(); - } - - @Override - public void documentAboutToBeChanged(DocumentEvent event) { - } - }; - context.get(EMFDocumentResourceMediator.class).getDocument().addDocumentListener(documentListener); - - tabItem = new CTabItem(tabFolder, SWT.NONE, 1); - - final Composite composite = new Composite(tabFolder, SWT.NONE); - composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - composite.setLayout(new GridLayout(2, false)); - tabItem.setControl(composite); - tabItem.setText(Messages.ListTab_0); - - tabItem.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_table_obj)); - - final ToolBar toolBar = new ToolBar(composite, SWT.FLAT | SWT.NO_FOCUS); - toolBar.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 2, 1)); - - { - final ToolItem button = new ToolItem(toolBar, SWT.PUSH); - button.setText(Messages.ListTab_addColumn + ELIPSIS); - button.setImage(imageCache.create("/icons/full/obj16/add_column.gif")); //$NON-NLS-1$ - - button.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - final TitleAreaFilterDialogWithEmptyOptions dlg = createEObjectAttributePicker(Messages.ListTab_addColumn); - dlg.setShowEmptyOptions(false); - if (dlg.open() == Window.OK) { - // Add Column - final String attName = dlg.getFirstElement().toString(); - final EAttributeTableViewerColumn col = addColumn(attName); - col.getTableViewerColumn().getColumn().pack(); - tvResults.refresh(); - } - } - }); - } - - { - final ToolItem button = new ToolItem(toolBar, SWT.PUSH); - button.setText(Messages.ListTab_resetColumns); - button.setImage(imageCache.create("/icons/full/obj16/reset_columns.gif")); //$NON-NLS-1$ - - button.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - for (final EAttributeTableViewerColumn col : optionalColumns.values()) { - col.dispose(); - } - optionalColumns.clear(); - } - }); - } - - new ToolItem(toolBar, SWT.SEPARATOR); - - filterByItem = new ToolItem(toolBar, SWT.NONE); - { - - filterByItem.setText(Messages.ListTab_filterByItem + ELIPSIS); - filterByItem.setImage(imageCache.create("/icons/full/obj16/filter_by_item.gif")); //$NON-NLS-1$ - - filterByItem.addSelectionListener(new SelectionAdapter() { - - @Override - public void widgetSelected(SelectionEvent e) { - final TitleAreaFilterDialog dlg = createElementTypePicker(Messages.ListTab_filterByItem); - if (dlg.open() == Window.OK) { - filterByItem(dlg.getFirstElement().toString()); - } - } - }); - } - - filterByAttribute = new ToolItem(toolBar, SWT.NONE); - { - - filterByAttribute.setText(Messages.ListTab_filterByAttribute + ELIPSIS); - filterByAttribute.setImage(imageCache.create("/icons/full/obj16/filter_by_attribute.gif")); //$NON-NLS-1$ - - filterByAttribute.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - final TitleAreaFilterDialogWithEmptyOptions dlg = createEObjectAttributePicker(Messages.ListTab_filterByAttribute); - if (dlg.open() == Window.OK) { - filterByAttribute(dlg.getFirstElement().toString(), dlg.getEmptyFilterOption()); - } - } - }); - } - - { - final ToolItem filterRemove = new ToolItem(toolBar, SWT.NONE); - filterRemove.setText(Messages.ListTab_removeFilter); - filterRemove.setImage(imageCache.create("/icons/full/obj16/remove_filter.png")); //$NON-NLS-1$ - - filterRemove.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - filterByItemName = null; - filterByAttrName = null; - tvResults.setFilters(new ViewerFilter[0]); - filterByItem.setText(Messages.ListTab_filterByItem + ELIPSIS); - filterByAttribute.setText(Messages.ListTab_markAttribute + ELIPSIS); - } - }); - } - - new ToolItem(toolBar, SWT.SEPARATOR); - - { - final E4ToolItemMenu tiCommands = new E4ToolItemMenu(toolBar, context); - tiCommands.getToolItem().setImage(imageCache.create("/icons/full/obj16/command.gif")); //$NON-NLS-1$ - - final ArrayList<String> commandIds = new ArrayList<String>(); - commandIds.add("org.eclipse.e4.tools.emf.ui.command.mark_duplicate_attributes"); //$NON-NLS-1$ - commandIds.add("org.eclipse.e4.tools.emf.ui.command.mark_duplicate_ids"); //$NON-NLS-1$ - commandIds.add("org.eclipse.e4.tools.emf.ui.command.mark_duplicate_labels"); //$NON-NLS-1$ - commandIds.add("org.eclipse.e4.tools.emf.ui.command.repair_duplicate_ids"); //$NON-NLS-1$ - commandIds.add(E4ToolItemMenu.SEPARATOR); - commandIds.add("org.eclipse.e4.tools.emf.ui.command.unmark"); //$NON-NLS-1$ - commandIds.add(E4ToolItemMenu.SEPARATOR); - commandIds.add("org.eclipse.e4.tools.emf.ui.command.autosizeColumns"); //$NON-NLS-1$ - commandIds.add("org.eclipse.e4.tools.emf.ui.command.resetToDefault"); //$NON-NLS-1$ - tiCommands.addCommands(commandIds); - } - - tvResults = new TableViewer(composite, SWT.FULL_SELECTION); - tvResults.getTable().setHeaderVisible(true); - tvResults.getTable().setLinesVisible(true); - - provider = new ModelResourceContentProvider(); - tvResults.setContentProvider(provider); - - tvResults.getTable().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - ((GridData) tvResults.getTable().getLayoutData()).horizontalSpan = 2; - - final Image imgForm = resourcePool.getImageUnchecked(ResourceProvider.IMG_Obj16_application_form); - final Image imgXmi = resourcePool.getImageUnchecked(ResourceProvider.IMG_Obj16_chart_organisation); - - colGo = new TableViewerColumn(tvResults, SWT.NONE); - colGo.getColumn().setText(Messages.ListTab_col_go); - requiredColumns.put("GoTree", colGo.getColumn()); //$NON-NLS-1$ - colGo.setLabelProvider(new ColumnLabelProvider() { - @Override - public Image getImage(Object element) { - return imgForm; - } - - @Override - public String getText(Object element) { - return ""; //$NON-NLS-1$ - } - }); - - colGoXmi = new TableViewerColumn(tvResults, SWT.NONE); - colGoXmi.getColumn().setText(Messages.ListTab_col_go); - requiredColumns.put("GoXmi", colGoXmi.getColumn()); //$NON-NLS-1$ - colGoXmi.setLabelProvider(new ColumnLabelProvider() { - @Override - public String getText(Object element) { - return ""; //$NON-NLS-1$ - } - - @Override - public Image getImage(Object element) { - return imgXmi; - } - }); - - tvResults.getTable().addMouseListener(new MouseAdapter() { - @Override - public void mouseDown(MouseEvent e) { - if (TableViewerUtil.isColumnClicked(tvResults, e, colGo)) { - gotoObjectHandler.gotoEObject(ModelEditor.TAB_FORM, (EObject) TableViewerUtil.getData(tvResults, e)); - } else if (TableViewerUtil.isColumnClicked(tvResults, e, colGoXmi)) { - gotoObjectHandler.gotoEObject(ModelEditor.TAB_XMI, (EObject) TableViewerUtil.getData(tvResults, e)); - } - } - }); - - colMarked = new TableViewerColumn(tvResults, SWT.NONE); - colMarked.getColumn().setWidth(16); - colMarked.getColumn().setText(Messages.ListTab_mark); - requiredColumns.put("Marked", colMarked.getColumn()); //$NON-NLS-1$ - colMarked.setLabelProvider(new ColumnLabelProvider() { - @Override - public Image getImage(Object element) { - Image ret = null; - if (isHighlighted(element)) { - try { - ret = imgMarkedItem; - } catch (final Exception e) { - } - } - return ret; - } - - @Override - public String getText(Object element) { - return ""; //$NON-NLS-1$ - } - }); - - colItem = new TableViewerColumn(tvResults, SWT.NONE); - colItem.getColumn().setText(Messages.ListTab_col_item); - requiredColumns.put("Item", colItem.getColumn()); //$NON-NLS-1$ - colItem.setLabelProvider(new ColumnLabelProvider_Markable() { - @Override - public String getText(Object element) { - final EObject eObject = (EObject) element; - return super.getText(eObject.eClass().getName()); - } - }); - - app.getContext().set("org.eclipse.e4.tools.active-object-viewer", this); //$NON-NLS-1$ - - final EAttributeTableViewerColumn colId = new EAttributeTableViewerColumn(tvResults, - "elementId", "elementId", context); //$NON-NLS-1$//$NON-NLS-2$ - defaultColumns.put("elementId", colId); //$NON-NLS-1$ - - final EAttributeTableViewerColumn colLabel = new EAttributeTableViewerColumn_Markable(tvResults, - "label", "label", context); //$NON-NLS-1$//$NON-NLS-2$ - defaultColumns.put("label", colLabel); //$NON-NLS-1$ - - // Custom selection for marked items - tvResults.getTable().addListener(SWT.EraseItem, new Listener() { - @Override - public void handleEvent(Event event) { - event.detail &= ~SWT.HOT; - if ((event.detail & SWT.SELECTED) == 0) - { - return; // / item not selected - } - - final TableItem item = (TableItem) event.item; - if (isHighlighted(item.getData())) { - - final Table table = (Table) event.widget; - final int clientWidth = table.getClientArea().width; - final GC gc = event.gc; - // Color oldForeground = gc.getForeground(); - // Color oldBackground = gc.getBackground(); - - // gc.setBackground(item.getDisplay().getSystemColor(SWT.COLOR_YELLOW)); - gc.setForeground(item.getDisplay().getSystemColor(SWT.COLOR_RED)); - gc.fillRectangle(0, event.y, clientWidth, event.height); - - // gc.setForeground(oldForeground); - // gc.setBackground(oldBackground); - event.detail &= ~SWT.SELECTED; - } - } - }); - - tvResults.getTable().setFocus(); - - for (final EAttributeTableViewerColumn col : defaultColumns.values()) { - col.getTableViewerColumn().getColumn().setMoveable(true); - } - for (final TableColumn col : requiredColumns.values()) { - col.setMoveable(true); - } - - makeSortable(colId.getTableViewerColumn().getColumn(), new AttributeColumnLabelSorter(colId - .getTableViewerColumn().getColumn(), "elementId")); //$NON-NLS-1$ - makeSortable(colLabel.getTableViewerColumn().getColumn(), new AttributeColumnLabelSorter(colLabel - .getTableViewerColumn().getColumn(), "label")); //$NON-NLS-1$ - makeSortable(colItem.getColumn(), new TableViewerUtil.ColumnLabelSorter(colItem.getColumn())); - makeSortable(colMarked.getColumn(), new TableViewerUtil.AbstractInvertableTableSorter() { - - @Override - public int compare(Viewer viewer, Object e1, Object e2) { - final boolean mark1 = isHighlighted(e1); - final boolean mark2 = isHighlighted(e2); - if (mark1 && !mark2) { - return -1; - } else if (mark2 && !mark1) { - return 1; - } else { - return 0; - } - } - }); - - reload(); - TableViewerUtil.refreshAndPack(tvResults); - loadSettings(); - } - - private void makeSortable(TableColumn column, TableViewerUtil.AbstractInvertableTableSorter sorter) { - new TableViewerUtil.TableSortSelectionListener(tvResults, column, sorter, SWT.UP, false); - } - - public void reload() { - tvResults.setInput(modelResource); - } - - public TableViewer getViewer() { - return tvResults; - } - - public CTabItem getTabItem() { - return tabItem; - } - - public IEclipseContext getContext() { - return context; - } - - @Override - public void highlightEObjects(Collection<EObject> items) { - highlightedItems = items; - tvResults.refresh(); - } - - @Override - public List<EObject> getAllEObjects() { - final ArrayList<EObject> list = new ArrayList<EObject>(); - final TreeIterator<Object> itTree = EcoreUtil.getAllContents(modelResource.getRoot()); - while (itTree.hasNext()) { - final Object object = itTree.next(); - final EObject eObject = (EObject) object; - final EAttribute att = EmfUtil.getAttribute(eObject, "elementId"); //$NON-NLS-1$ - if (att != null) { - list.add(eObject); - } - } - return list; - } - - @Override - public Collection<EObject> getSelectedEObjects() { - final ArrayList<EObject> selected = new ArrayList<EObject>(); - for (final Object item : ((IStructuredSelection) tvResults.getSelection()).toList()) { - if (item instanceof EObject) { - selected.add((EObject) item); - - } - } - return selected; - } - - @Override - public void deleteEObjects(Collection<EObject> list) { - if (list.isEmpty() == false) { - final Command cmd = DeleteCommand.create(modelResource.getEditingDomain(), list); - if (cmd.canExecute()) { - modelResource.getEditingDomain().getCommandStack().execute(cmd); - } - reload(); - } - } - - private TitleAreaFilterDialogWithEmptyOptions createEObjectAttributePicker(final String title) { - // Get Attribute Names - final HashSet<String> set = new HashSet<String>(); - final Collection<EObject> allEObjects = getAllEObjects(); - for (final EObject obj : allEObjects) { - for (final EAttribute attribute : obj.eClass().getEAllAttributes()) { - set.add(attribute.getName()); - } - } - final ArrayList<String> sorted = new ArrayList<String>(set); - Collections.sort(sorted); - - // Select Attribute - final ILabelProvider renderer = new LabelProvider() { - @Override - public String getText(Object element) { - return String.valueOf(element); - } - }; - final TitleAreaFilterDialogWithEmptyOptions dlg = new TitleAreaFilterDialogWithEmptyOptions( - context.get(Shell.class), renderer) { - @Override - protected Control createContents(Composite parent) { - final Control ret = super.createContents(parent); - setMessage(Messages.ListTab_selectAnAttribute); - try { - setTitleImage(imageCache.create(Plugin.ID, "/icons/full/wizban/attribute_wiz.gif")); //$NON-NLS-1$ - } catch (final Exception e) { - e.printStackTrace(); - } - setTitle(title); - setElements(sorted.toArray(new String[0])); - return ret; - } - }; - return dlg; - } - - private TitleAreaFilterDialog createElementTypePicker(final String title) { - // Get Attribute Names - final HashSet<String> set = new HashSet<String>(); - final Collection<EObject> allEObjects = getAllEObjects(); - for (final EObject obj : allEObjects) { - set.add(obj.eClass().getName()); - } - - final ArrayList<String> sorted = new ArrayList<String>(set); - Collections.sort(sorted); - - final ILabelProvider renderer = new LabelProvider() { - @Override - public String getText(Object element) { - return String.valueOf(element); - } - }; - final TitleAreaFilterDialog dlg = new TitleAreaFilterDialog(context.get(Shell.class), renderer) { - - @Override - protected Control createContents(Composite parent) { - final Control ret = super.createContents(parent); - setMessage(Messages.ListTab_selectAType); - setTitle(title); - setElements(sorted.toArray(new String[0])); - return ret; - } - }; - return dlg; - } - - /** - * Adds a column if it does not already exist - * - * @param attName - * @return The existing or newly created column - */ - private EAttributeTableViewerColumn addColumn(String attName) { - EAttributeTableViewerColumn colName = defaultColumns.get(attName); - if (colName == null) { - colName = optionalColumns.get(colName); - if (colName == null) { - colName = new EAttributeTableViewerColumn_Markable(tvResults, attName, attName, context); - optionalColumns.put(attName, colName); - colName.getTableViewerColumn().getColumn().setMoveable(true); - makeSortable(colName.getTableViewerColumn().getColumn(), new AttributeColumnLabelSorter(colName - .getTableViewerColumn().getColumn(), attName)); - tvResults.refresh(); - } - } - return colName; - } - - static private class AttributeColumnLabelSorter extends TableViewerUtil.ColumnLabelSorter { - - private final String attName; - - AttributeColumnLabelSorter(TableColumn col, String attName) { - super(col); - this.attName = attName; - } - - @Override - public int compare(Viewer viewer, Object e1, Object e2) { - // if either is boolean, use boolean value, otherwise use text value - final ATT_TYPE e1Type = EAttributeEditingSupport.getAttributeType(e1, attName); - final ATT_TYPE e2Type = EAttributeEditingSupport.getAttributeType(e2, attName); - if (e1Type == ATT_TYPE.BOOLEAN || e2Type == ATT_TYPE.BOOLEAN) { - final Boolean b1 = (Boolean) EmfUtil.getAttributeValue((EObject) e1, attName); - final Boolean b2 = (Boolean) EmfUtil.getAttributeValue((EObject) e2, attName); - if (b1 == null && b2 != null) { - return -2; - } else if (b2 == null && b1 != null) { - return 2; - } else { - return b1.compareTo(b2); - } - } - return super.compare(viewer, e1, e2); - } - } - - private class EAttributeTableViewerColumn_Markable extends EAttributeTableViewerColumn { - public EAttributeTableViewerColumn_Markable(TableViewer tvResults, String label, String attName, - IEclipseContext context) { - super(tvResults, label, attName, context); - } - - @Override - public Color getBackground(Object element) { - Color ret; - if (isHighlighted(element)) { - return ret = tvResults.getTable().getDisplay().getSystemColor(SWT.COLOR_YELLOW); - } - ret = super.getBackground(element); - return ret; - } - } - - private class ColumnLabelProvider_Markable extends ColumnLabelProvider { - @Override - public Color getBackground(Object element) { - Color ret; - if (isHighlighted(element)) { - ret = tvResults.getTable().getDisplay().getSystemColor(SWT.COLOR_YELLOW); - } else { - ret = super.getBackground(element); - } - return ret; - } - } - - @Override - public EditingDomain getEditingDomain() { - return modelResource.getEditingDomain(); - } - - public boolean isHighlighted(Object element) { - return highlightedItems != null && highlightedItems.contains(element); - } - - private void filterByItem(String name) { - filterByItemName = name; - filterByAttrName = null; - filterByAttrEmptyOption = null; - mapId_Object.clear(); - final ArrayList<EObject> filtered = new ArrayList<EObject>(); - for (final EObject object : getAllEObjects()) { - if (object.eClass().getName().equals(filterByItemName)) { - filtered.add(object); - // filter.setText(Messages.ListTab_7 + - // attFilter); - - } - - final ViewerFilter viewerFilter = new ViewerFilter() { - - @Override - public boolean select(Viewer viewer, Object parentElement, Object element) { - return filtered.contains(element); - } - - }; - tvResults.setFilters(new ViewerFilter[] { viewerFilter }); - filterByItem.setText(Messages.ListTab_filterByItem + ELIPSIS + "(" + filterByItemName + ")"); //$NON-NLS-1$//$NON-NLS-2$ - filterByAttribute.setText(Messages.ListTab_filterByAttribute + ELIPSIS); - } - } - - private void filterByAttribute(String name, final EmptyFilterOption emptyOption) { - filterByAttrName = name; - filterByAttrEmptyOption = emptyOption; - filterByItemName = null; - mapId_Object.clear(); - final ArrayList<EObject> filtered = new ArrayList<EObject>(); - for (final EObject object : getAllEObjects()) { - if (EmfUtil.getAttribute(object, filterByAttrName) != null) { - filtered.add(object); - final ViewerFilter viewerFilter = new ViewerFilter() { - - @Override - public boolean select(Viewer viewer, Object parentElement, Object element) { - // if filtering on attribute, always - // reject if not defined for model - // element - if (EmfUtil.getAttribute((EObject) element, filterByAttrName) == null) { - return false; - } - switch (emptyOption) { - case EXCLUDE: - if (E.isEmpty(EmfUtil.getAttributeValue((EObject) element, filterByAttrName))) { - return false; - } - return filtered.contains(element); - case ONLY: - if (E.notEmpty(EmfUtil.getAttributeValue((EObject) element, filterByAttrName))) { - return false; - } - return true; - default: - case INCLUDE: - if (E.isEmpty(EmfUtil.getAttributeValue((EObject) element, filterByAttrName))) { - return true; - } - return filtered.contains(element); - } - } - }; - tvResults.setFilters(new ViewerFilter[] { viewerFilter }); - filterByAttribute.setText(Messages.ListTab_filterByAttribute + ELIPSIS + "(" + filterByAttrName + ")"); //$NON-NLS-1$//$NON-NLS-2$ - filterByItem.setText(Messages.ListTab_filterByItem + ELIPSIS); - - } - } - final TableViewerColumn viewerColumn = addColumn(filterByAttrName).getTableViewerColumn(); - viewerColumn.getColumn().pack(); - } - - @Override - public void autosizeContent() { - for (final TableColumn col : tvResults.getTable().getColumns()) { - col.pack(); - if (col.getWidth() < 10) { - col.setWidth(10); - } - } - } - - @Override - public void resetToDefault() { - for (final EAttributeTableViewerColumn col : optionalColumns.values()) { - col.dispose(); - } - optionalColumns.clear(); - - TableViewerUtil.resetColumnOrder(tvResults); - TableViewerUtil.packAllColumns(tvResults); - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/Messages.java deleted file mode 100644 index 98737513..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/Messages.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.eclipse.e4.tools.emf.ui.internal.common.component.tabs; - -import org.eclipse.osgi.util.NLS; - -public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.e4.tools.emf.ui.internal.common.component.tabs.messages"; //$NON-NLS-1$ - public static String TitleAreaFilterDialog_enterFilterText; - public static String TitleAreaFilterDialogWithEmptyOptions_emptyValueDescription; - public static String TitleAreaFilterDialogWithEmptyOptions_excludeEmptyValues; - public static String TitleAreaFilterDialogWithEmptyOptions_includeEmptyValues; - public static String TitleAreaFilterDialogWithEmptyOptions_onlyEmptyValues; - public static String EmfUtil_ex_attribute_not_found; - - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - private Messages() { - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/ModelResourceContentProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/ModelResourceContentProvider.java deleted file mode 100644 index d0ccfa9c..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/ModelResourceContentProvider.java +++ /dev/null @@ -1,101 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation - *******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.internal.common.component.tabs; - -import java.util.ArrayList; -import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.emf.common.util.TreeIterator; -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.Viewer; - -public class ModelResourceContentProvider implements IStructuredContentProvider { - - private Object[] items = new Object[0]; - private Viewer viewer; - - public ModelResourceContentProvider() { - // adapter = new EContentAdapter() { - // @Override - // public void notifyChanged(Notification notification) { - // switch (notification.getEventType()) { - // case Notification.REMOVING_ADAPTER: - // return; - // } - // - // if (viewer != null && viewer.getControl().isDisposed() == false) { - // viewer.refresh(); - // } - // super.notifyChanged(notification); - // - // // boolean optimize = false; - // // switch (notification.getEventType()) { - // // - // // case Notification.SET: - // // // optimized to only update row if SET and not elementId - // // // if the id is modified, we need to reindex our id map - // // // (by forcing input) - // // if (notification.getFeature() != EmfUtil.getAttribute((EObject) notification.getFeature(), "elementId")) { //$NON-NLS-1$ - // // if (viewer instanceof TableViewer) { - // // optimize = true; - // // } - // // } - // // break; - // // default: - // // break; - // // } - // // if (optimize) { - // // EClass eClass = (EClass) ((EAttribute) - // // notification.getFeature()).eContainer(); - // // ((TableViewer) viewer).update(eClass, null); - // // } else { - // // viewer.setInput(viewer.getInput()); - // // } - // } - // }; - } - - @Override - public Object[] getElements(Object object) { - return items; - } - - @Override - public void inputChanged(final Viewer viewer, Object oldInput, Object newInput) { - this.viewer = viewer; - ArrayList<EObject> list = new ArrayList<EObject>(); - IModelResource modelProvider = (IModelResource) newInput; - if (newInput != oldInput && newInput != null) { - // ((EObject) - // modelProvider.getRoot().get(0)).eAdapters().add(adapter); - } - if (newInput != null) { - TreeIterator<Object> itTree = EcoreUtil.getAllContents(modelProvider.getRoot()); - while (itTree.hasNext()) { - Object next = itTree.next(); - EObject eObject = (EObject) next; - EAttribute att = EmfUtil.getAttribute(eObject, "elementId"); //$NON-NLS-1$ - if (att != null) { - list.add(eObject); - } - } - } - - items = list.toArray(new Object[0]); - } - - @Override - public void dispose() { - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/TableViewerUtil.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/TableViewerUtil.java deleted file mode 100644 index 1440b060..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/TableViewerUtil.java +++ /dev/null @@ -1,227 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation, ongoing maintenance - *******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.internal.common.component.tabs; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Comparator; - -import org.eclipse.jface.viewers.ColumnLabelProvider; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerCell; -import org.eclipse.jface.viewers.ViewerSorter; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.MouseEvent; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.widgets.TableColumn; - -public class TableViewerUtil { - - // Sorts the column by the provider's text value - static class ColumnLabelSorter extends TableViewerUtil.AbstractInvertableTableSorter { - private final TableColumn col; - - ColumnLabelSorter(TableColumn col) { - this.col = col; - } - - @Override - public int compare(Viewer viewer, Object e1, Object e2) { - final TableViewer tableViewer = (TableViewer) viewer; - final ColumnLabelProvider labelProvider = (ColumnLabelProvider) tableViewer.getLabelProvider(Arrays.asList( - tableViewer.getTable().getColumns()).indexOf(col)); - return labelProvider.getText(e1).compareTo(labelProvider.getText(e2)); - } - } - - static abstract class InvertableSorter extends ViewerSorter { - @Override - public abstract int compare(Viewer viewer, Object e1, Object e2); - - abstract InvertableSorter getInverseSorter(); - - public abstract int getSortDirection(); - } - - static public abstract class AbstractInvertableTableSorter extends InvertableSorter { - private final InvertableSorter inverse = new InvertableSorter() { - - @Override - public int compare(Viewer viewer, Object e1, Object e2) { - return -1 * AbstractInvertableTableSorter.this.compare(viewer, e1, e2); - } - - @Override - InvertableSorter getInverseSorter() { - return AbstractInvertableTableSorter.this; - } - - @Override - public int getSortDirection() { - return SWT.DOWN; - } - }; - - @Override - InvertableSorter getInverseSorter() { - return inverse; - } - - @Override - public int getSortDirection() { - return SWT.UP; - } - } - - static public class TableSortSelectionListener implements SelectionListener { - private final TableViewer viewer; - private final TableColumn column; - private final InvertableSorter sorter; - private final boolean keepDirection; - private InvertableSorter currentSorter; - - /** - * The constructor of this listener. - * - * @param viewer - * the tableviewer this listener belongs to - * @param column - * the column this listener is responsible for - * @param sorter - * the sorter this listener uses - * @param defaultDirection - * the default sorting direction of this Listener. Possible - * values are {@link SWT.UP} and {@link SWT.DOWN} - * @param keepDirection - * if true, the listener will remember the last sorting - * direction of the associated column and restore it when the - * column is reselected. If false, the listener will use the - * default sorting direction - */ - public TableSortSelectionListener(TableViewer viewer, TableColumn column, AbstractInvertableTableSorter sorter, - int defaultDirection, boolean keepDirection) { - this.viewer = viewer; - this.column = column; - this.keepDirection = keepDirection; - this.sorter = defaultDirection == SWT.UP ? sorter : sorter.getInverseSorter(); - currentSorter = this.sorter; - - this.column.addSelectionListener(this); - } - - /** - * Chooses the column of this listener for sorting of the table. Mainly - * used when first initializing the table. - */ - public void chooseColumnForSorting() { - viewer.getTable().setSortColumn(column); - viewer.getTable().setSortDirection(currentSorter.getSortDirection()); - viewer.setSorter(currentSorter); - } - - @Override - public void widgetSelected(SelectionEvent e) { - InvertableSorter newSorter; - if (viewer.getTable().getSortColumn() == column) { - newSorter = ((InvertableSorter) viewer.getSorter()).getInverseSorter(); - } else { - if (keepDirection) { - newSorter = currentSorter; - } else { - newSorter = sorter; - } - } - - currentSorter = newSorter; - chooseColumnForSorting(); - } - - @Override - public void widgetDefaultSelected(SelectionEvent e) { - widgetSelected(e); - } - } - - static public void refreshAndPack(TableViewer viewer) { - viewer.refresh(); - packAllColumns(viewer); - } - - static public void updateAndPack(TableViewer viewer, Object object) { - viewer.update(object, null); - packAllColumns(viewer); - } - - public static boolean isColumnClicked(TableViewer viewer, MouseEvent e, TableViewerColumn tvColumn) { - boolean ret; - final ViewerCell cell = viewer.getCell(new Point(e.x, e.y)); - if (cell == null) { - ret = false; - } else { - final int index = Arrays.asList(viewer.getTable().getColumns()).indexOf(tvColumn.getColumn()); - if (index == -1) { - ret = false; - } else { - ret = index == cell.getColumnIndex(); - } - } - return ret; - } - - public static Object getData(TableViewer viewer, MouseEvent e) { - final ViewerCell cell = viewer.getCell(new Point(e.x, e.y)); - if (cell == null) { - return null; - } - return cell.getElement(); - } - - public static void packAllColumns(TableViewer viewer) { - for (final TableColumn col : viewer.getTable().getColumns()) { - col.pack(); - } - } - - static public void resetColumnOrder(TableViewer tvResults) { - final int[] order = tvResults.getTable().getColumnOrder(); - for (int i = 0; i < order.length; i++) { - order[i] = i; - } - tvResults.getTable().setColumnOrder(order); - } - - static public ArrayList<TableColumn> getColumnsInDisplayOrder(TableViewer viewer) { - final ArrayList<TableColumn> allCols = new ArrayList<TableColumn>(Arrays.asList(viewer.getTable().getColumns())); - final int[] order = viewer.getTable().getColumnOrder(); - Collections.sort(allCols, new Comparator<TableColumn>() { - - @Override - public int compare(TableColumn o1, TableColumn o2) { - return order[allCols.indexOf(o1)] - order[allCols.indexOf(o2)]; - } - }); - return allCols; - } - - static public int getVisibleColumnIndex(TableViewer tvResults2, TableColumn col) { - final int createOrder = Arrays.asList(tvResults2.getTable().getColumns()).indexOf(col); - if (createOrder == -1) { - return -1; - } - return tvResults2.getTable().getColumnOrder()[createOrder]; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/XmiTab.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/XmiTab.java deleted file mode 100644 index 7887ffc4..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/XmiTab.java +++ /dev/null @@ -1,196 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * Copyright (c) 2010-2014 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 391089, Bug 437543, Ongoing Maintenance - *******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.internal.common.component.tabs; - -import javax.annotation.PostConstruct; -import javax.inject.Inject; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.preferences.IEclipsePreferences; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.core.di.annotations.Optional; -import org.eclipse.e4.core.services.nls.Translation; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.common.xml.AnnotationAccess; -import org.eclipse.e4.tools.emf.ui.internal.common.xml.EMFDocumentResourceMediator; -import org.eclipse.e4.tools.emf.ui.internal.common.xml.XMLConfiguration; -import org.eclipse.e4.tools.emf.ui.internal.common.xml.XMLPartitionScanner; -import org.eclipse.e4.tools.services.IResourcePool; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource.Diagnostic; -import org.eclipse.jface.resource.JFaceResources; -import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.IDocumentPartitioner; -import org.eclipse.jface.text.IRegion; -import org.eclipse.jface.text.Position; -import org.eclipse.jface.text.TextSelection; -import org.eclipse.jface.text.rules.FastPartitioner; -import org.eclipse.jface.text.source.Annotation; -import org.eclipse.jface.text.source.AnnotationModel; -import org.eclipse.jface.text.source.SourceViewer; -import org.eclipse.jface.text.source.VerticalRuler; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.KeyAdapter; -import org.eclipse.swt.events.KeyEvent; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Text; - -public class XmiTab extends Composite { - - private static final String ORG_ECLIPSE_E4_TOOLS_MODELEDITOR_FILTEREDTREE_ENABLED_XMITAB_DISABLED = "org.eclipse.e4.tools.modeleditor.filteredtree.enabled.xmitab.disabled";//$NON-NLS-1$ - private static final int VERTICAL_RULER_WIDTH = 20; - - @Inject - private IEclipseContext context; - - @Optional - @Inject - private IProject project; - @Inject - private EMFDocumentResourceMediator emfDocumentProvider; - @Inject - private IResourcePool resourcePool; - @Inject - private IEclipsePreferences preferences; - - @Inject - @Translation - protected Messages Messages; - - private Text text; - protected int offsetStart; - private SourceViewer sourceViewer; - - @Inject - public XmiTab(Composite parent) { - super(parent, SWT.NONE); - setLayout(new GridLayout(1, false)); - } - - @PostConstruct - protected void postConstruct() { - - text = new Text(this, SWT.SINGLE | SWT.LEAD | SWT.BORDER); - text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); - text.setMessage(Messages.XmiTab_TypeTextToSearch); - text.addKeyListener(new KeyAdapter() { - @Override - public void keyPressed(KeyEvent e) { - if (e.keyCode != SWT.CR) { - offsetStart = 0; - } - offsetStart = searchAndHighlight(text.getText(), offsetStart); - } - }); - - final AnnotationModel model = new AnnotationModel(); - final VerticalRuler verticalRuler = new VerticalRuler(VERTICAL_RULER_WIDTH, new AnnotationAccess(resourcePool)); - final int styles = SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION; - sourceViewer = new SourceViewer(this, verticalRuler, styles); - sourceViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - - sourceViewer.configure(new XMLConfiguration(resourcePool)); - sourceViewer.setEditable(project != null); - sourceViewer.getTextWidget().setFont(JFaceResources.getTextFont()); - - final IDocument document = emfDocumentProvider.getDocument(); - final IDocumentPartitioner partitioner = new FastPartitioner(new XMLPartitionScanner(), new String[] { - XMLPartitionScanner.XML_TAG, XMLPartitionScanner.XML_COMMENT }); - partitioner.connect(document); - document.setDocumentPartitioner(partitioner); - sourceViewer.setDocument(document); - verticalRuler.setModel(model); - - emfDocumentProvider.setValidationChangedCallback(new Runnable() { - - @Override - public void run() { - model.removeAllAnnotations(); - - for (final Diagnostic d : emfDocumentProvider.getErrorList()) { - final Annotation a = new Annotation("e4xmi.error", false, d.getMessage()); //$NON-NLS-1$ - int l; - try { - l = document.getLineOffset(d.getLine() - 1); - model.addAnnotation(a, new Position(l)); - } catch (final BadLocationException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - }); - - final String property = System - .getProperty(ORG_ECLIPSE_E4_TOOLS_MODELEDITOR_FILTEREDTREE_ENABLED_XMITAB_DISABLED); - if (property != null || preferences.getBoolean("tab-form-search-show", false)) { //$NON-NLS-1$ - sourceViewer.setEditable(false); - sourceViewer.getTextWidget().setEnabled(false); - } - } - - /** - * - * @param text - * @param startOffset - * @return The endOFfset, or -1 if not found - */ - protected int searchAndHighlight(String text, int startOffset) { - try { - // select the entire start tag - IRegion region; - region = emfDocumentProvider.findText(text, startOffset); - if (region == null && startOffset > 0) { - region = emfDocumentProvider.findText(text, 0); - } - if (region != null) { - sourceViewer.setSelection(new TextSelection(region.getOffset(), region.getLength()), true); - return region.getOffset() + region.getLength(); - } - sourceViewer.setSelection(new TextSelection(0, 0), true); - return -1; - } catch (final Exception e) { - e.printStackTrace(); - return -1; - } - } - - public IEclipseContext getContext() { - return context; - } - - public void gotoEObject(EObject object) { - // select the entire start tag - final IRegion region = emfDocumentProvider.findStartTag(object); - if (region != null) { - sourceViewer.setSelection(new TextSelection(region.getOffset(), region.getLength()), true); - } else { - sourceViewer.setSelection(new TextSelection(0, 0), true); - } - } - - public void paste() { - sourceViewer.getTextWidget().paste(); - } - - public void copy() { - sourceViewer.getTextWidget().copy(); - } - - public void cut() { - sourceViewer.getTextWidget().cut(); - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/empty/E.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/empty/E.java deleted file mode 100644 index b667d444..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/empty/E.java +++ /dev/null @@ -1,99 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 432555 - *******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.tabs.empty; - -import java.util.Collection; - -/** - * E is for empty. Very useful functions for determining empty objects. Avoids - * null checking and content checking, and makes code clearer. <br /> - * An object is empty if it is null, an empty string, or an empty collection - * - * @author Steven Spungin - * - */ -public class E { - - public static boolean notEmpty(String object) { - return !isEmpty(object); - } - - public static boolean notEmpty(Collection<?> object) { - return !isEmpty(object); - } - - public static boolean notEmpty(Object object) { - return !isEmpty(object); - } - - public static boolean isEmpty(String object) { - return object == null || object.isEmpty(); - } - - public static boolean isEmpty(Collection<?> object) { - return object == null || object.isEmpty(); - } - - public static boolean isEmpty(Object object) { - if (object == null) { - return true; - } else if (object instanceof String && ((String) object).isEmpty()) { - return true; - } else if (object instanceof Collection<?> && ((Collection<?>) object).isEmpty()) { - return true; - } else { - return false; - } - } - - /** - * - * @param obj1 - * @param obj2 - * @return true if (both objects are null) or (both objects are not null and - * equal) - */ - static public boolean equals(Object obj1, Object obj2) { - if (obj1 == null) { - if (obj2 == null) { - return true; - } - return false; - } else if (obj2 == null) { - return false; - } else { - return obj1.equals(obj2); - } - } - - /** - * Compares 2 objects. - * - * @param obj1 - * @param obj2 - * @return If both objects are null, returns 0. If only 1 object is null, it - * will return 1 or -1. Otherwise call compareTo on the first - * object. - */ - static public <T> int compareTo(Comparable<T> obj1, T obj2) { - if (obj1 == null) { - if (obj2 == null) { - return 0; - } - return -1; - } else if (obj2 == null) { - return 1; - } else { - return obj1.compareTo(obj2); - } - - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/empty/EmptyFilterOption.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/empty/EmptyFilterOption.java deleted file mode 100644 index 1bbba602..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/empty/EmptyFilterOption.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 432555 - *******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.internal.common.component.tabs.empty; - -/** - * Options for working with empty values in filters. <br /> - * An empty value is a null object, empty string, or empty collection. - * - * @author Steven Spungin - * - */ -public enum EmptyFilterOption { - /** - * Do not include empty values - */ - EXCLUDE, - /** - * Include empty values - */ - INCLUDE, - /** - * Include only empty values - */ - ONLY -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/empty/TitleAreaFilterDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/empty/TitleAreaFilterDialog.java deleted file mode 100644 index 4be36335..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/empty/TitleAreaFilterDialog.java +++ /dev/null @@ -1,158 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 432555 - *******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.internal.common.component.tabs.empty; - -import org.eclipse.e4.tools.emf.ui.internal.common.component.tabs.Messages; -import org.eclipse.jface.dialogs.TitleAreaDialog; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.DoubleClickEvent; -import org.eclipse.jface.viewers.IDoubleClickListener; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerFilter; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; - -/** - * Extends TitleAreaDialog to include a filter text box.<br /> - * If no item is selected, the dialog result is Dialog.Cancel, even if OK is - * pressed. A result of Dialog.Ok is ensured to have at least 1 selected item. - * - * @author Steven Spungin - * - */ -public class TitleAreaFilterDialog extends TitleAreaDialog { - - private ILabelProvider labelProvider; - private TableViewer viewer; - private Object result; - private Text text; - - public TitleAreaFilterDialog(Shell parentShell, ILabelProvider labelProvider) { - super(parentShell); - this.labelProvider = labelProvider; - } - - @Override - protected boolean isResizable() { - return true; - } - - @Override - protected Control createDialogArea(Composite parent) { - Composite comp = (Composite) super.createDialogArea(parent); - - comp.setLayoutData(new GridData(GridData.FILL_BOTH)); - comp.setLayout(new GridLayout(1, false)); - - text = new Text(comp, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH); - text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - text.setMessage(Messages.TitleAreaFilterDialog_enterFilterText); - - viewer = new TableViewer(comp, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER | SWT.FULL_SELECTION); - viewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH)); - viewer.setLabelProvider(labelProvider); - viewer.setContentProvider(ArrayContentProvider.getInstance()); - - viewer.setFilters(new ViewerFilter[] { new ViewerFilter() { - - @Override - public boolean select(Viewer viewer, Object parentElement, Object element) { - return isFiltered(element, text.getText()); - } - } }); - - text.addModifyListener(new ModifyListener() { - - @Override - public void modifyText(ModifyEvent e) { - viewer.refresh(); - } - }); - - viewer.addDoubleClickListener(new IDoubleClickListener() { - - @Override - public void doubleClick(DoubleClickEvent event) { - result = ((IStructuredSelection) viewer.getSelection()).getFirstElement(); - if (result != null) { - okPressed(); - } - } - }); - - return comp; - } - - /** - * Default returns true if string value contains the filterText, and it is - * case insensitive. - * - * @param element - * @param filterText - * @return - */ - protected boolean isFiltered(Object element, String filterText) { - filterText = filterText.toLowerCase(); - if (filterText.isEmpty()) { - return true; - } else if (element.toString().toLowerCase().contains(filterText)) { - return true; - } else { - return false; - } - } - - @Override - protected void okPressed() { - result = ((IStructuredSelection) viewer.getSelection()).getFirstElement(); - if (result == null) { - cancelPressed(); - } else { - super.okPressed(); - } - } - - public void setElements(Object[] array) { - viewer.setInput(array); - } - - public Object getFirstElement() { - return result; - } - - protected TableViewer getViewer() { - return viewer; - } - - protected Text getText() { - return text; - } - - public String getFirstSelection() { - Object firstElement = getFirstElement(); - if (firstElement instanceof String) { - return (String) firstElement; - } - return firstElement.toString(); - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/empty/TitleAreaFilterDialogWithEmptyOptions.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/empty/TitleAreaFilterDialogWithEmptyOptions.java deleted file mode 100644 index a417657f..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/empty/TitleAreaFilterDialogWithEmptyOptions.java +++ /dev/null @@ -1,151 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. All rights reserved. This - * program and the accompanying materials are made available under the terms of - * the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 432555 - *******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.tabs.empty; - -import org.eclipse.e4.tools.emf.ui.internal.common.component.tabs.Messages; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.RowLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Shell; - -/** - * A standard ElementListSelectionDialog with additional options for including, - * excluding, and selecting empty values. - * - * @author Steven Spungin - * - */ -public class TitleAreaFilterDialogWithEmptyOptions extends TitleAreaFilterDialog { - private Button btnExcludeEmptyValues; - private Button btnOnlyEmptyValues; - private Button btnIncludeEmptyValues; - private EmptyFilterOption emptyFilterOption; - private boolean bShowEmptyOptions = true; - private Composite compOptions; - private Composite parent; - - public TitleAreaFilterDialogWithEmptyOptions(Shell parent, ILabelProvider renderer) { - super(parent, renderer); - } - - @Override - protected org.eclipse.swt.widgets.Control createDialogArea(Composite parent) { - this.parent = parent; - Composite comp = (Composite) super.createDialogArea(parent); - - // Label labelEmptyInfo = new Label(comp, SWT.NONE); - // labelEmptyInfo.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, - // false, false)); - // labelEmptyInfo.setText("An empty value is defined as a null object, an empty string, or an empty collection."); - - compOptions = new Composite(comp, SWT.NONE); - compOptions.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false)); - compOptions.setLayout(new RowLayout()); - - // labelEmptyInfo.moveAbove(getText()); - compOptions.moveAbove(getText()); - - btnExcludeEmptyValues = new Button(compOptions, SWT.RADIO); - btnExcludeEmptyValues.setText(Messages.TitleAreaFilterDialogWithEmptyOptions_excludeEmptyValues); - btnExcludeEmptyValues.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - setEmptyFilterOption(EmptyFilterOption.EXCLUDE); - } - }); - - btnIncludeEmptyValues = new Button(compOptions, SWT.RADIO); - btnIncludeEmptyValues.setText(Messages.TitleAreaFilterDialogWithEmptyOptions_includeEmptyValues); - btnIncludeEmptyValues.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - setEmptyFilterOption(EmptyFilterOption.INCLUDE); - } - }); - - btnOnlyEmptyValues = new Button(compOptions, SWT.RADIO); - btnOnlyEmptyValues.setText(Messages.TitleAreaFilterDialogWithEmptyOptions_onlyEmptyValues); - btnOnlyEmptyValues.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - setEmptyFilterOption(EmptyFilterOption.ONLY); - } - }); - - String toolTip = Messages.TitleAreaFilterDialogWithEmptyOptions_emptyValueDescription; - btnExcludeEmptyValues.setToolTipText(toolTip); - btnIncludeEmptyValues.setToolTipText(toolTip); - btnOnlyEmptyValues.setToolTipText(toolTip); - - setEmptyFilterOption(EmptyFilterOption.EXCLUDE); - - updateEmptyOptionState(); - - parent.pack(); - return comp; - } - - @Override - public boolean close() { - return super.close(); - } - - public EmptyFilterOption getEmptyFilterOption() { - return emptyFilterOption; - } - - public void setEmptyFilterOption(EmptyFilterOption emptyFilterOption) { - this.emptyFilterOption = emptyFilterOption; - updateUi(); - } - - private void updateUi() { - if (btnExcludeEmptyValues == null) { - return; - } - switch (emptyFilterOption) { - case EXCLUDE: - btnExcludeEmptyValues.setSelection(true); - btnIncludeEmptyValues.setSelection(false); - btnOnlyEmptyValues.setSelection(false); - break; - case INCLUDE: - btnExcludeEmptyValues.setSelection(false); - btnIncludeEmptyValues.setSelection(true); - btnOnlyEmptyValues.setSelection(false); - break; - case ONLY: - btnExcludeEmptyValues.setSelection(false); - btnIncludeEmptyValues.setSelection(false); - btnOnlyEmptyValues.setSelection(true); - break; - default: - break; - } - } - - public void setShowEmptyOptions(boolean bShow) { - this.bShowEmptyOptions = bShow; - updateEmptyOptionState(); - } - - private void updateEmptyOptionState() { - if (compOptions == null) { - return; - } - compOptions.setVisible(bShowEmptyOptions); - ((GridData) compOptions.getLayoutData()).exclude = bShowEmptyOptions == false; - parent.layout(); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/messages.properties deleted file mode 100644 index 69b1b868..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/messages.properties +++ /dev/null @@ -1,6 +0,0 @@ -TitleAreaFilterDialog_enterFilterText=Enter filter text -TitleAreaFilterDialogWithEmptyOptions_emptyValueDescription=An empty value is defined as a null object, an empty string, or an empty collection. -TitleAreaFilterDialogWithEmptyOptions_excludeEmptyValues=Exclude Empty Values -TitleAreaFilterDialogWithEmptyOptions_includeEmptyValues=Include Empty Values -TitleAreaFilterDialogWithEmptyOptions_onlyEmptyValues=Only Empty Values -EmfUtil_ex_attribute_not_found=Attribute not found diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java deleted file mode 100644 index 6c67aae0..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java +++ /dev/null @@ -1,158 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2014 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Tracy Miranda <tracymiranda@yahoo.com> - bugfix for 430663 - * Steven Spungin <steven@spungin.tv> - Ongoing maintenance - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import javax.annotation.PostConstruct; -import javax.inject.Inject; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.AbstractPickList; -import org.eclipse.e4.tools.emf.ui.internal.common.AbstractPickList.PickListFeatures; -import org.eclipse.e4.tools.emf.ui.internal.common.E4PickList; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.MAddon; -import org.eclipse.e4.ui.model.application.MApplication; -import org.eclipse.e4.ui.model.application.MApplicationFactory; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; - -public class VApplicationAddons extends AbstractComponentEditor { - private Composite composite; - private TableViewer viewer; - private EMFDataBindingContext context; - - private final List<Action> actions = new ArrayList<Action>(); - - @Inject - public VApplicationAddons() { - super(); - } - - @PostConstruct - void init() { - actions - .add(new Action(Messages.VApplicationAddons_AddAddon, createImageDescriptor(ResourceProvider.IMG_Addons)) { - @Override - public void run() { - handleAddAddon(); - } - }); - } - - @Override - public Image getImage(Object element, Display display) { - return null; - } - - @Override - public String getLabel(Object element) { - return Messages.VApplicationAddons_TreeLabel; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return Messages.VApplicationAddons_TreeLabelDescription; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - composite = createForm(parent, context, getMaster()); - } - final VirtualEntry<?> o = (VirtualEntry<?>) object; - viewer.setInput(o.getList()); - getMaster().setValue(o.getOriginalParent()); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { - final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - final CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - { - final AbstractPickList pickList = new E4PickList(parent, SWT.NONE, - Arrays.asList(PickListFeatures.NO_PICKER), Messages, this, - ApplicationPackageImpl.Literals.APPLICATION__ADDONS) { - @Override - protected void addPressed() { - handleAddAddon(); - } - - @Override - protected List<?> getContainerChildren(Object container) { - return ((MApplication) container).getAddons(); - } - }; - pickList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1)); - viewer = pickList.getList(); - } - - folder.setSelection(0); - - return folder; - } - - private void handleAddAddon() { - final MAddon addon = MApplicationFactory.INSTANCE.createAddon(); - setElementId(addon); - - final Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), - ApplicationPackageImpl.Literals.APPLICATION__ADDONS, addon); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(addon); - } - } - - @Override - public IObservableList getChildList(Object element) { - return null; - } - - @Override - public List<Action> getActions(Object element) { - final ArrayList<Action> l = new ArrayList<Action>(super.getActions(element)); - l.addAll(actions); - return l; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationCategoriesEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationCategoriesEditor.java deleted file mode 100644 index 2debfdd7..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationCategoriesEditor.java +++ /dev/null @@ -1,183 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Steven Spungin <steven@spungin.tv> - Ongoing maintenance - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import javax.annotation.PostConstruct; -import javax.inject.Inject; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.AbstractPickList; -import org.eclipse.e4.tools.emf.ui.internal.common.AbstractPickList.PickListFeatures; -import org.eclipse.e4.tools.emf.ui.internal.common.E4PickList; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.tools.emf.ui.internal.imp.ModelImportWizard; -import org.eclipse.e4.ui.model.application.MApplication; -import org.eclipse.e4.ui.model.application.commands.MCategory; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsFactoryImpl; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.window.Window; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; - -public class VApplicationCategoriesEditor extends AbstractComponentEditor { - private Composite composite; - private TableViewer viewer; - private EMFDataBindingContext context; - - private List<Action> actions = new ArrayList<Action>(); - private List<Action> actionsImport = new ArrayList<Action>(); - - @Inject - public VApplicationCategoriesEditor() { - super(); - } - - @PostConstruct - void init() { - actions.add(new Action(Messages.VApplicationCategoriesEditor_AddCategory, createImageDescriptor(ResourceProvider.IMG_Category)) { - @Override - public void run() { - handleAdd(); - } - }); - actionsImport.add(new Action(Messages.VApplicationCategoriesEditor_AddCategory, createImageDescriptor(ResourceProvider.IMG_Category)) { - @Override - public void run() { - handleImport(); - } - }); - } - - protected void handleImport() { - ModelImportWizard wizard = new ModelImportWizard(MCategory.class, this, resourcePool); - WizardDialog wizardDialog = new WizardDialog(viewer.getControl().getShell(), wizard); - if (wizardDialog.open() == Window.OK) { - MCategory[] elements = (MCategory[]) wizard.getElements(MCategory.class); - for (MCategory category : elements) { - addCategory(category); - } - } - } - - @Override - public Image getImage(Object element, Display display) { - return null; - } - - @Override - public String getLabel(Object element) { - return Messages.VApplicationCategoriesEditor_TreeLabel; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return Messages.VApplicationCategoriesEditor_TreeLabelDescription; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - composite = createForm(parent, context, getMaster()); - } - VirtualEntry<?> o = (VirtualEntry<?>) object; - viewer.setInput(o.getList()); - getMaster().setValue(o.getOriginalParent()); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { - CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - { - AbstractPickList pickList = new E4PickList(parent, SWT.NONE, Arrays.asList(PickListFeatures.NO_PICKER), Messages, this, ApplicationPackageImpl.Literals.APPLICATION__CATEGORIES) { - @Override - protected void addPressed() { - handleAdd(); - } - - @Override - protected List<?> getContainerChildren(Object container) { - return ((MApplication) container).getCategories(); - } - }; - pickList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1)); - viewer = pickList.getList(); - } - - folder.setSelection(0); - - return folder; - } - - @Override - public IObservableList getChildList(Object element) { - return null; - } - - protected void handleAdd() { - MCategory category = CommandsFactoryImpl.eINSTANCE.createCategory(); - addCategory(category); - } - - private void addCategory(MCategory category) { - setElementId(category); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.APPLICATION__CATEGORIES, category); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(category); - } - } - - @Override - public List<Action> getActions(Object element) { - ArrayList<Action> l = new ArrayList<Action>(super.getActions(element)); - l.addAll(actions); - return l; - } - - @Override - public List<Action> getActionsImport(Object element) { - ArrayList<Action> l = new ArrayList<Action>(super.getActions(element)); - l.addAll(actionsImport); - return l; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationWindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationWindowEditor.java deleted file mode 100644 index 325af803..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationWindowEditor.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; - -import javax.inject.Inject; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; - -public class VApplicationWindowEditor extends VWindowEditor { - - @Inject - public VApplicationWindowEditor() { - super(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java deleted file mode 100644 index 32824bdf..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java +++ /dev/null @@ -1,151 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Steven Spungin <steven@spungin.tv> - Ongoing maintenance - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import javax.annotation.PostConstruct; -import javax.inject.Inject; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.AbstractPickList; -import org.eclipse.e4.tools.emf.ui.internal.common.AbstractPickList.PickListFeatures; -import org.eclipse.e4.tools.emf.ui.internal.common.E4PickList; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.MApplication; -import org.eclipse.e4.ui.model.application.commands.MBindingTable; -import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; - -public class VBindingTableEditor extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - private TableViewer viewer; - private List<Action> actions = new ArrayList<Action>(); - - @Inject - public VBindingTableEditor() { - super(); - } - - @PostConstruct - void init() { - actions.add(new Action(Messages.VBindingTableEditor_AddBindingTable, createImageDescriptor(ResourceProvider.IMG_BindingTable)) { - @Override - public void run() { - handleAdd(); - } - }); - } - - @Override - public Image getImage(Object element, Display display) { - return null; - } - - @Override - public String getLabel(Object element) { - return Messages.VBindingTableEditor_Label; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return Messages.VBindingTableEditor_Description; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - composite = createForm(parent, context, getMaster()); - - } - VirtualEntry<?> o = (VirtualEntry<?>) object; - viewer.setInput(o.getList()); - getMaster().setValue(o.getOriginalParent()); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { - CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - { - AbstractPickList pickList = new E4PickList(parent, SWT.NONE, Arrays.asList(PickListFeatures.NO_PICKER), Messages, this, CommandsPackageImpl.Literals.BINDING_TABLE_CONTAINER__BINDING_TABLES) { - @Override - protected void addPressed() { - handleAdd(); - } - - @Override - protected List<?> getContainerChildren(Object container) { - return ((MApplication) container).getBindingTables(); - } - }; - pickList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1)); - viewer = pickList.getList(); - } - - folder.setSelection(0); - - return folder; - } - - protected void handleAdd() { - MBindingTable command = MCommandsFactory.INSTANCE.createBindingTable(); - setElementId(command); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.BINDING_TABLE_CONTAINER__BINDING_TABLES, command); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(command); - } - } - - @Override - public IObservableList getChildList(Object element) { - return null; - } - - @Override - public List<Action> getActions(Object element) { - ArrayList<Action> l = new ArrayList<Action>(super.getActions(element)); - l.addAll(actions); - return l; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java deleted file mode 100644 index 95d4ce8c..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java +++ /dev/null @@ -1,198 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Steven Spungin <steven@spungin.tv> - Ongoing maintenance - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import javax.annotation.PostConstruct; -import javax.inject.Inject; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.e4.core.services.nls.Translation; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.AbstractPickList; -import org.eclipse.e4.tools.emf.ui.internal.common.AbstractPickList.PickListFeatures; -import org.eclipse.e4.tools.emf.ui.internal.common.E4PickList; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.tools.emf.ui.internal.imp.ModelImportWizard; -import org.eclipse.e4.ui.model.application.MApplication; -import org.eclipse.e4.ui.model.application.commands.MCommand; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsFactoryImpl; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.window.Window; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; - -public class VCommandEditor extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - private TableViewer viewer; - - private final EStructuralFeature commandsFeature; - private final List<Action> actions = new ArrayList<Action>(); - private final List<Action> actionsImport = new ArrayList<Action>(); - - @Inject - @Translation - protected Messages Messages; - - @Inject - public VCommandEditor() { - super(); - commandsFeature = ApplicationPackageImpl.Literals.APPLICATION__COMMANDS; - } - - @PostConstruct - void init() { - actions - .add(new Action(Messages.VCommandEditor_AddCommand, createImageDescriptor(ResourceProvider.IMG_Command)) { - @Override - public void run() { - handleAdd(); - } - }); - - actionsImport.add(new Action(Messages.VCommandEditor_ImportCommands, - createImageDescriptor(ResourceProvider.IMG_Command)) { - @Override - public void run() { - handleImport(); - } - }); - } - - @Override - public Image getImage(Object element, Display display) { - return null; - } - - @Override - public String getLabel(Object element) { - return Messages.VCommandEditor_TreeLabel; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return Messages.VCommandEditor_TreeLabelDescription; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - composite = createForm(parent, context, getMaster()); - } - final VirtualEntry<?> o = (VirtualEntry<?>) object; - viewer.setInput(o.getList()); - getMaster().setValue(o.getOriginalParent()); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { - final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - final CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - { - final AbstractPickList pickList = new E4PickList(parent, SWT.NONE, - Arrays.asList(PickListFeatures.NO_PICKER), Messages, this, - ApplicationPackageImpl.Literals.APPLICATION__COMMANDS) { - @Override - protected void addPressed() { - handleAdd(); - } - - @Override - protected List<?> getContainerChildren(Object container) { - return ((MApplication) container).getCommands(); - } - }; - pickList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1)); - viewer = pickList.getList(); - } - - folder.setSelection(0); - - return folder; - } - - protected void handleAdd() { - final MCommand command = CommandsFactoryImpl.eINSTANCE.createCommand(); - addCommand(command); - } - - private void addCommand(MCommand command) { - setElementId(command); - final Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), commandsFeature, command); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(command); - } - } - - protected void handleImport() { - final ModelImportWizard wizard = new ModelImportWizard(MCommand.class, this, resourcePool); - final WizardDialog wizardDialog = new WizardDialog(viewer.getControl().getShell(), wizard); - if (wizardDialog.open() == Window.OK) { - final MCommand[] elements = (MCommand[]) wizard.getElements(MCommand.class); - for (final MCommand mCommand : elements) { - addCommand(mCommand); - } - } - } - - @Override - public IObservableList getChildList(Object element) { - return null; - } - - @Override - public List<Action> getActions(Object element) { - final ArrayList<Action> l = new ArrayList<Action>(super.getActions(element)); - l.addAll(actions); - return l; - } - - @Override - public List<Action> getActionsImport(Object element) { - final ArrayList<Action> l = new ArrayList<Action>(super.getActions(element)); - l.addAll(actionsImport); - return l; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java deleted file mode 100644 index 97e6c338..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java +++ /dev/null @@ -1,192 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Steven Spungin <steven@spungin.tv> - Ongoing maintenance - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import javax.annotation.PostConstruct; -import javax.inject.Inject; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.AbstractPickList; -import org.eclipse.e4.tools.emf.ui.internal.common.AbstractPickList.PickListFeatures; -import org.eclipse.e4.tools.emf.ui.internal.common.E4PickList; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.tools.emf.ui.internal.imp.ModelImportWizard; -import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; -import org.eclipse.e4.ui.model.application.commands.MHandler; -import org.eclipse.e4.ui.model.application.commands.MHandlerContainer; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.window.Window; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; - -public class VHandlerEditor extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - private TableViewer viewer; - private final List<Action> actions = new ArrayList<Action>(); - private final List<Action> actionsImport = new ArrayList<Action>(); - - @Inject - public VHandlerEditor() { - super(); - } - - @PostConstruct - void init() { - actions - .add(new Action(Messages.VHandlerEditor_AddHandler, createImageDescriptor(ResourceProvider.IMG_Handler)) { - @Override - public void run() { - handleAdd(); - } - }); - - // -- import -- - actionsImport.add(new Action(Messages.VHandlerEditor_AddHandler, - createImageDescriptor(ResourceProvider.IMG_Handler)) { - @Override - public void run() { - handleImport(); - } - }); - } - - @Override - public Image getImage(Object element, Display display) { - return null; - } - - @Override - public String getLabel(Object element) { - return Messages.VHandlerEditor_TreeLabel; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return Messages.VHandlerEditor_TreeLabelDescription; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - composite = createForm(parent, context, getMaster()); - } - final VirtualEntry<?> o = (VirtualEntry<?>) object; - viewer.setInput(o.getList()); - getMaster().setValue(o.getOriginalParent()); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { - final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - final CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - { - final AbstractPickList pickList = new E4PickList(parent, SWT.NONE, - Arrays.asList(PickListFeatures.NO_PICKER), Messages, this, - CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS) { - @Override - protected void addPressed() { - handleAdd(); - } - - @Override - protected List<?> getContainerChildren(Object container) { - if (container instanceof MHandlerContainer) { - return ((MHandlerContainer) container).getHandlers(); - } - return null; - } - }; - pickList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1)); - viewer = pickList.getList(); - } - - folder.setSelection(0); - - return folder; - } - - @Override - public IObservableList getChildList(Object element) { - return null; - } - - protected void handleAdd() { - final MHandler handler = MCommandsFactory.INSTANCE.createHandler(); - addToModel(handler); - } - - private void addToModel(MHandler handler) { - setElementId(handler); - final Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), - CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS, handler); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(handler); - } - } - - protected void handleImport() { - final ModelImportWizard wizard = new ModelImportWizard(MHandler.class, this, resourcePool); - final WizardDialog wizardDialog = new WizardDialog(viewer.getControl().getShell(), wizard); - if (wizardDialog.open() == Window.OK) { - final MHandler[] elements = (MHandler[]) wizard.getElements(MHandler.class); - for (final MHandler handler : elements) { - addToModel(handler); - } - } - } - - @Override - public List<Action> getActions(Object element) { - final ArrayList<Action> l = new ArrayList<Action>(super.getActions(element)); - l.addAll(actions); - return l; - } - - @Override - public List<Action> getActionsImport(Object element) { - final ArrayList<Action> l = new ArrayList<Action>(super.getActionsImport(element)); - l.addAll(actionsImport); - return l; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VItemParametersEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VItemParametersEditor.java deleted file mode 100644 index f0ea6bba..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VItemParametersEditor.java +++ /dev/null @@ -1,164 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Steven Spungin <steven@spungin.tv> - Ongoing maintenance - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import javax.annotation.PostConstruct; -import javax.inject.Inject; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.AbstractPickList; -import org.eclipse.e4.tools.emf.ui.internal.common.AbstractPickList.PickListFeatures; -import org.eclipse.e4.tools.emf.ui.internal.common.E4PickList; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; -import org.eclipse.e4.ui.model.application.commands.MParameter; -import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem; -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.IEMFListProperty; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; - -public class VItemParametersEditor extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - private TableViewer viewer; - private final List<Action> actions = new ArrayList<Action>(); - - private final IEMFListProperty HANDLED_ITEM__PARAMETERS = EMFProperties - .list(MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS); - - @Inject - public VItemParametersEditor() { - super(); - } - - @PostConstruct - void init() { - actions.add(new Action(Messages.VItemParametersEditor_AddParameter, - createImageDescriptor(ResourceProvider.IMG_Parameter)) { - @Override - public void run() { - handleAdd(); - } - }); - } - - @Override - public Image getImage(Object element, Display display) { - return null; - } - - @Override - public String getLabel(Object element) { - return Messages.VItemParametersEditor_TreeLabel; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return Messages.VItemParametersEditor_TreeLabelDescription; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - composite = createForm(parent, context, getMaster()); - } - final VirtualEntry<?> o = (VirtualEntry<?>) object; - viewer.setInput(o.getList()); - getMaster().setValue(o.getOriginalParent()); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { - final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - final CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - { - final AbstractPickList pickList = new E4PickList(parent, SWT.NONE, - Arrays.asList(PickListFeatures.NO_PICKER), Messages, this, - MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS) { - @Override - protected void addPressed() { - handleAdd(); - } - - @Override - protected List<?> getContainerChildren(Object container) { - if (container instanceof MHandledItem) { - return ((MHandledItem) container).getParameters(); - } - return null; - } - }; - pickList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1)); - viewer = pickList.getList(); - } - - folder.setSelection(0); - - return folder; - } - - @Override - public IObservableList getChildList(Object element) { - return HANDLED_ITEM__PARAMETERS.observe(element); - } - - protected void handleAdd() { - final MParameter handler = MCommandsFactory.INSTANCE.createParameter(); - setElementId(handler); - - final Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), - MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS, handler); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(handler); - } - } - - @Override - public List<Action> getActions(Object element) { - final ArrayList<Action> l = new ArrayList<Action>(super.getActions(element)); - l.addAll(actions); - return l; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java deleted file mode 100644 index e66ebaa8..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java +++ /dev/null @@ -1,152 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Steven Spungin <steven@spungin.tv> - Ongoing maintenance - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import javax.annotation.PostConstruct; -import javax.inject.Inject; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.AbstractPickList; -import org.eclipse.e4.tools.emf.ui.internal.common.AbstractPickList.PickListFeatures; -import org.eclipse.e4.tools.emf.ui.internal.common.E4PickList; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.MApplication; -import org.eclipse.e4.ui.model.application.ui.menu.MMenuContribution; -import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; - -public class VMenuContributionsEditor extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - private TableViewer viewer; - - private List<Action> actions = new ArrayList<Action>(); - - @Inject - public VMenuContributionsEditor() { - super(); - } - - @PostConstruct - void init() { - actions.add(new Action(Messages.VMenuContributionsEditor_AddMenuContribution, createImageDescriptor(ResourceProvider.IMG_MenuContribution)) { - @Override - public void run() { - handleAdd(); - } - }); - } - - @Override - public Image getImage(Object element, Display display) { - return null; - } - - @Override - public String getLabel(Object element) { - return Messages.VMenuContributionsEditor_TreeLabel; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return Messages.VMenuContributionsEditor_TreeLabelDescription; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - composite = createForm(parent, context, getMaster()); - } - VirtualEntry<?> o = (VirtualEntry<?>) object; - viewer.setInput(o.getList()); - getMaster().setValue(o.getOriginalParent()); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { - CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - { - AbstractPickList pickList = new E4PickList(parent, SWT.NONE, Arrays.asList(PickListFeatures.NO_PICKER), Messages, this, MenuPackageImpl.Literals.MENU_CONTRIBUTIONS__MENU_CONTRIBUTIONS) { - @Override - protected void addPressed() { - handleAdd(); - } - - @Override - protected List<?> getContainerChildren(Object container) { - return ((MApplication) container).getMenuContributions(); - } - }; - pickList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1)); - viewer = pickList.getList(); - - } - - folder.setSelection(0); - - return folder; - } - - @Override - public IObservableList getChildList(Object element) { - return null; - } - - protected void handleAdd() { - MMenuContribution command = MMenuFactory.INSTANCE.createMenuContribution(); - setElementId(command); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.MENU_CONTRIBUTIONS__MENU_CONTRIBUTIONS, command); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(command); - } - } - - @Override - public List<Action> getActions(Object element) { - ArrayList<Action> l = new ArrayList<Action>(super.getActions(element)); - l.addAll(actions); - return l; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java deleted file mode 100644 index c0cbeefc..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java +++ /dev/null @@ -1,219 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Steven Spungin <steven@spungin.tv> - Ongoing maintenance - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; - -import java.util.ArrayList; -import java.util.List; -import javax.annotation.PostConstruct; -import javax.inject.Inject; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.AbstractPickList; -import org.eclipse.e4.tools.emf.ui.internal.common.E4PickList; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptor; -import org.eclipse.e4.ui.model.application.ui.basic.MPart; -import org.eclipse.e4.ui.model.application.ui.menu.MMenu; -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuFactoryImpl; -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.StructuredViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; - -public class VMenuEditor extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - private StructuredViewer viewer; - private List<Action> actions = new ArrayList<Action>(); - private EStructuralFeature feature; - - @Inject - IEclipseContext eclipseContext; - - public static final String VIEW_MENU_TAG = "ViewMenu"; //$NON-NLS-1$ - - enum Types { - MENU, POPUP_MENU, VIEW_MENU - } - - protected VMenuEditor(EStructuralFeature feature) { - super(); - this.feature = feature; - } - - @PostConstruct - void init() { - actions.add(new Action(Messages.VMenuEditor_AddMenuContribution, createImageDescriptor(ResourceProvider.IMG_Menu)) { - @Override - public void run() { - handleAdd(MenuPackageImpl.Literals.MENU); - } - }); - actions.add(new Action(Messages.VMenuEditor_AddPopupMenuContribution, createImageDescriptor(ResourceProvider.IMG_Menu)) { - @Override - public void run() { - handleAdd(MenuPackageImpl.Literals.POPUP_MENU); - } - }); - actions.add(new Action(Messages.MenuEditor_Label_ViewMenu, createImageDescriptor(ResourceProvider.IMG_Menu)) { - @Override - public void run() { - handleAddViewMenu(); - } - }); - } - - @Override - public Image getImage(Object element, Display display) { - return null; - } - - @Override - public String getLabel(Object element) { - return Messages.VMenuEditor_TreeLabel; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return Messages.VMenuEditor_TreeLabelDescription; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - composite = createForm(parent, context, getMaster()); - } - VirtualEntry<?> o = (VirtualEntry<?>) object; - viewer.setInput(o.getList()); - getMaster().setValue(o.getOriginalParent()); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { - CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - AbstractPickList pickList = new E4PickList(parent, SWT.NONE, null, Messages, this, feature) { - @Override - protected void addPressed() { - Types t = (Types) ((IStructuredSelection) getSelection()).getFirstElement(); - if (t == Types.MENU) { - handleAdd(MenuPackageImpl.Literals.MENU); - } else if (t == Types.POPUP_MENU) { - handleAdd(MenuPackageImpl.Literals.POPUP_MENU); - } else { - handleAddViewMenu(); - } - } - - @Override - protected List<?> getContainerChildren(Object container) { - if (container instanceof MPartDescriptor) { - return ((MPartDescriptor) container).getMenus(); - } else if (container instanceof MPart) { - return ((MPart) container).getMenus(); - } else { - return null; - } - } - }; - pickList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1)); - viewer = pickList.getList(); - - pickList.setContentProvider(ArrayContentProvider.getInstance()); - pickList.setLabelProvider(new LabelProvider() { - @Override - public String getText(Object element) { - if (element == Types.MENU) { - return Messages.MenuEditor_Label; - } else if (element == Types.POPUP_MENU) { - return Messages.PopupMenuEditor_TreeLabel; - } - return Messages.MenuEditor_Label_ViewMenu; - } - }); - pickList.setInput(Types.values()); - pickList.setSelection(new StructuredSelection(Types.MENU)); - - folder.setSelection(0); - - return folder; - } - - @Override - public IObservableList getChildList(Object element) { - return null; - } - - protected void handleAdd(EClass eClass) { - EObject handler = EcoreUtil.create(eClass); - setElementId(handler); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), feature, handler); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(handler); - } - } - - protected void handleAddViewMenu() { - MMenu menu = MenuFactoryImpl.eINSTANCE.createMenu(); - menu.getTags().add(VIEW_MENU_TAG); - setElementId(menu); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), feature, menu); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(menu); - } - } - - @Override - public List<Action> getActions(Object element) { - ArrayList<Action> l = new ArrayList<Action>(super.getActions(element)); - l.addAll(actions); - return l; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelFragmentsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelFragmentsEditor.java deleted file mode 100644 index 46a7d539..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelFragmentsEditor.java +++ /dev/null @@ -1,158 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Steven Spungin <steven@spungin.tv> - Ongoing maintenance, Bug 443945 - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import javax.annotation.PostConstruct; -import javax.inject.Inject; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.AbstractPickList; -import org.eclipse.e4.tools.emf.ui.internal.common.AbstractPickList.PickListFeatures; -import org.eclipse.e4.tools.emf.ui.internal.common.E4PickList; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.fragment.MFragmentFactory; -import org.eclipse.e4.ui.model.fragment.MModelFragments; -import org.eclipse.e4.ui.model.fragment.MStringModelFragment; -import org.eclipse.e4.ui.model.fragment.impl.FragmentPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; - -public class VModelFragmentsEditor extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - private TableViewer viewer; - private final List<Action> actions = new ArrayList<Action>(); - - @Inject - public VModelFragmentsEditor() { - super(); - } - - @PostConstruct - void init() { - actions.add(new Action(Messages.VModelFragmentsEditor_AddFragment, - createImageDescriptor(ResourceProvider.IMG_ModelFragments)) { - @Override - public void run() { - handleAdd(); - } - }); - } - - @Override - public Image getImage(Object element, Display display) { - return null; - } - - @Override - public String getLabel(Object element) { - return Messages.VModelFragmentsEditor_TreeLabel; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return Messages.VModelFragmentsEditor_TreeLabelDescription; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - composite = createForm(parent, context, getMaster()); - } - final VirtualEntry<?> o = (VirtualEntry<?>) object; - viewer.setInput(o.getList()); - getMaster().setValue(o.getOriginalParent()); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { - final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - final CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - { - final AbstractPickList pickList = new E4PickList(parent, SWT.NONE, - Arrays.asList(PickListFeatures.NO_PICKER), Messages, this, - FragmentPackageImpl.Literals.MODEL_FRAGMENTS__FRAGMENTS) { - @Override - protected void addPressed() { - handleAdd(); - } - - @Override - protected List<?> getContainerChildren(Object container) { - if (container instanceof MModelFragments) { - return ((MModelFragments) container).getFragments(); - } - return null; - } - }; - pickList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1)); - viewer = pickList.getList(); - } - - folder.setSelection(0); - - return folder; - } - - @Override - public IObservableList getChildList(Object element) { - return null; - } - - @Override - public List<Action> getActions(Object element) { - final ArrayList<Action> l = new ArrayList<Action>(super.getActions(element)); - l.addAll(actions); - return l; - } - - private void handleAdd() { - final MStringModelFragment eObject = MFragmentFactory.INSTANCE.createStringModelFragment(); - final Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), - FragmentPackageImpl.Literals.MODEL_FRAGMENTS__FRAGMENTS, eObject); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(eObject); - } - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java deleted file mode 100644 index 5b2b71c6..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java +++ /dev/null @@ -1,169 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Steven Spungin <steven@spungin.tv> - Ongoing maintenance, Bug 443945 - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; - -import java.util.ArrayList; -import java.util.List; -import javax.inject.Inject; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.tools.emf.ui.common.IEditorFeature.FeatureClass; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.E4PickList; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.fragment.impl.FragmentPackageImpl; -import org.eclipse.e4.ui.model.fragment.impl.ModelFragmentsImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerComparator; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; - -public class VModelImportsEditor extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - - @Inject - IEclipseContext eclipseContext; - private TableViewer viewer; - - @Inject - public VModelImportsEditor() { - super(); - } - - @Override - public Image getImage(Object element, Display display) { - return null; - } - - @Override - public String getLabel(Object element) { - return Messages.VModelImportsEditor_TreeLabel; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return Messages.VModelImportsEditor_TreeLabelDescription; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - composite = createForm(parent, context, getMaster()); - } - VirtualEntry<?> o = (VirtualEntry<?>) object; - viewer.setInput(o.getList()); - getMaster().setValue(o.getOriginalParent()); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { - CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - composite = folder; - - CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - E4PickList pickList = new E4PickList(parent, SWT.NONE, null, Messages, this, FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS) { - @Override - protected void addPressed() { - - Object firstElement = ((IStructuredSelection) getSelection()).getFirstElement(); - - if (firstElement != null) { - FeatureClass featureClass = (FeatureClass) firstElement; - EClass eClass = featureClass.eClass; - EObject eObject = EcoreUtil.create(eClass); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS, eObject); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(eObject); - } - } - } - - @Override - protected List<?> getContainerChildren(Object master) { - return ((ModelFragmentsImpl) master).getImports(); - } - }; - viewer = pickList.getList(); - - pickList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1)); - pickList.setText(""); //$NON-NLS-1$ - - pickList.setLabelProvider(new LabelProvider() { - @Override - public String getText(Object element) { - FeatureClass eclass = (FeatureClass) element; - return eclass.label; - } - }); - - pickList.setComparator(new ViewerComparator() { - @Override - public int compare(Viewer viewer, Object e1, Object e2) { - FeatureClass eClass1 = (FeatureClass) e1; - FeatureClass eClass2 = (FeatureClass) e2; - return eClass1.label.compareTo(eClass2.label); - } - }); - - List<FeatureClass> list = new ArrayList<FeatureClass>(); - Util.addClasses(ApplicationPackageImpl.eINSTANCE, list); - list.addAll(getEditor().getFeatureClasses(FragmentPackageImpl.Literals.MODEL_FRAGMENT, FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS)); - - pickList.setInput(list); - if (list.size() > 0) { - pickList.setSelection(new StructuredSelection(list.get(0))); - } - - folder.setSelection(0); - - return folder; - } - - @Override - public IObservableList getChildList(Object element) { - return null; - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java deleted file mode 100644 index 34478f62..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java +++ /dev/null @@ -1,203 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Steven Spungin <steven@spungin.tv> - Ongoing maintenance - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import javax.annotation.PostConstruct; -import javax.inject.Inject; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.AbstractPickList; -import org.eclipse.e4.tools.emf.ui.internal.common.AbstractPickList.PickListFeatures; -import org.eclipse.e4.tools.emf.ui.internal.common.E4PickList; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.tools.emf.ui.internal.imp.ModelImportWizard; -import org.eclipse.e4.tools.emf.ui.internal.imp.RegistryUtil; -import org.eclipse.e4.ui.model.application.descriptor.basic.MBasicFactory; -import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptor; -import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptorContainer; -import org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.window.Window; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; - -public class VPartDescriptor extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - private TableViewer viewer; - private List<Action> actions = new ArrayList<Action>(); - private List<Action> actionsImport = new ArrayList<Action>(); - - @Inject - public VPartDescriptor() { - super(); - } - - @PostConstruct - void init() { - actions.add(new Action(Messages.VPartDescriptor_AddPartDescriptor, createImageDescriptor(ResourceProvider.IMG_PartDescriptor)) { - @Override - public void run() { - handleAdd(); - } - }); - - // --- Import Actions --- - actionsImport.add(new Action(Messages.VPartDescriptor_Views, createImageDescriptor(ResourceProvider.IMG_Part)) { - @Override - public void run() { - handleImport(BasicPackageImpl.Literals.PART_DESCRIPTOR, RegistryUtil.HINT_VIEW); - } - }); - actionsImport.add(new Action(Messages.VPartDescriptor_Editors, createImageDescriptor(ResourceProvider.IMG_Part)) { - @Override - public void run() { - handleImport(BasicPackageImpl.Literals.PART_DESCRIPTOR, RegistryUtil.HINT_EDITOR); - } - }); - - actionsImport.add(new Action(Messages.VPartDescriptor_ViewAsCompatibilityView, createImageDescriptor(ResourceProvider.IMG_Part)) { - @Override - public void run() { - handleImport(BasicPackageImpl.Literals.PART_DESCRIPTOR, RegistryUtil.HINT_COMPAT_VIEW); - } - }); - } - - @Override - public Image getImage(Object element, Display display) { - return null; - } - - @Override - public String getLabel(Object element) { - return Messages.VPartDescriptor_TreeLabel; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return Messages.VPartDescriptor_TreeLabelDescription; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - composite = createForm(parent, context, getMaster()); - } - VirtualEntry<?> o = (VirtualEntry<?>) object; - viewer.setInput(o.getList()); - getMaster().setValue(o.getOriginalParent()); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { - CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - { - AbstractPickList pickList = new E4PickList(parent, SWT.NONE, Arrays.asList(PickListFeatures.NO_PICKER), Messages, this, BasicPackageImpl.Literals.PART_DESCRIPTOR_CONTAINER__DESCRIPTORS) { - @Override - protected void addPressed() { - handleAdd(); - } - - @Override - protected List<?> getContainerChildren(Object container) { - MPartDescriptorContainer c = (MPartDescriptorContainer) container; - return c.getDescriptors(); - } - }; - pickList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1)); - viewer = pickList.getList(); - } - - folder.setSelection(0); - - return folder; - } - - @Override - public IObservableList getChildList(Object element) { - return null; - } - - protected void handleAdd() { - MPartDescriptor partDescription = MBasicFactory.INSTANCE.createPartDescriptor(); - addToModel(partDescription); - } - - private void addToModel(MPartDescriptor partDescription) { - setElementId(partDescription); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.PART_DESCRIPTOR_CONTAINER__DESCRIPTORS, partDescription); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(partDescription); - } - } - - protected void handleImport(EClass eClass, String hint) { - - if (eClass == BasicPackageImpl.Literals.PART_DESCRIPTOR) { - ModelImportWizard wizard = new ModelImportWizard(MPartDescriptor.class, this, hint, resourcePool); - WizardDialog wizardDialog = new WizardDialog(viewer.getControl().getShell(), wizard); - if (wizardDialog.open() == Window.OK) { - MPartDescriptor[] parts = (MPartDescriptor[]) wizard.getElements(MPartDescriptor.class); - for (MPartDescriptor part : parts) { - addToModel(part); - } - } - } - } - - @Override - public List<Action> getActions(Object element) { - ArrayList<Action> l = new ArrayList<Action>(super.getActions(element)); - l.addAll(actions); - return l; - } - - @Override - public List<Action> getActionsImport(Object element) { - ArrayList<Action> l = new ArrayList<Action>(super.getActionsImport(element)); - l.addAll(actionsImport); - return l; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptorMenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptorMenuEditor.java deleted file mode 100644 index b14dc15b..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptorMenuEditor.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; - -import javax.inject.Inject; - -public class VPartDescriptorMenuEditor extends VMenuEditor { - @Inject - public VPartDescriptorMenuEditor() { - super(org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl.Literals.PART_DESCRIPTOR__MENUS); - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartMenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartMenuEditor.java deleted file mode 100644 index 3c5191fd..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartMenuEditor.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; - -import javax.inject.Inject; -import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; - -public class VPartMenuEditor extends VMenuEditor { - @Inject - public VPartMenuEditor() { - super(BasicPackageImpl.Literals.PART__MENUS); - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPerspectiveControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPerspectiveControlEditor.java deleted file mode 100644 index b174e765..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPerspectiveControlEditor.java +++ /dev/null @@ -1,183 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Steven Spungin <steven@spungin.tv> - Ongoing maintenance - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; - -import java.util.ArrayList; -import java.util.List; -import javax.annotation.PostConstruct; -import javax.inject.Inject; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.AbstractPickList; -import org.eclipse.e4.tools.emf.ui.internal.common.E4PickList; -import org.eclipse.e4.tools.emf.ui.internal.common.EClassLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; -import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; - -public class VPerspectiveControlEditor extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - private TableViewer viewer; - private List<Action> actions = new ArrayList<Action>(); - - @Inject - public VPerspectiveControlEditor() { - super(); - } - - @PostConstruct - void init() { - actions.add(new Action(Messages.VWindowControlEditor_AddPartSashContainer, createImageDescriptor(ResourceProvider.IMG_PartSashContainer_vertical)) { - @Override - public void run() { - handleAdd(BasicPackageImpl.Literals.PART_SASH_CONTAINER); - } - }); - - actions.add(new Action(Messages.VWindowControlEditor_AddPartStack, createImageDescriptor(ResourceProvider.IMG_PartStack)) { - @Override - public void run() { - handleAdd(BasicPackageImpl.Literals.PART_STACK); - } - }); - - actions.add(new Action(Messages.VWindowControlEditor_AddPart, createImageDescriptor(ResourceProvider.IMG_Part)) { - @Override - public void run() { - handleAdd(BasicPackageImpl.Literals.PART); - } - }); - - actions.add(new Action(Messages.VWindowControlEditor_AddArea, createImageDescriptor(ResourceProvider.IMG_Area_vertical)) { - @Override - public void run() { - handleAdd(AdvancedPackageImpl.Literals.AREA); - } - }); - actions.add(new Action(Messages.PerspectiveEditor_AddPlaceholder, createImageDescriptor(ResourceProvider.IMG_Placeholder)) { - @Override - public void run() { - handleAdd(AdvancedPackageImpl.Literals.PLACEHOLDER); - } - }); - } - - @Override - public Image getImage(Object element, Display display) { - return null; - } - - @Override - public String getLabel(Object element) { - return Messages.VWindowControlEditor_TreeLabel; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return Messages.VWindowControlEditor_TreeLabelDescription; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - composite = createForm(parent, context, getMaster()); - } - VirtualEntry<?> o = (VirtualEntry<?>) object; - viewer.setInput(o.getList()); - getMaster().setValue(o.getOriginalParent()); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { - CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - { - AbstractPickList pickList = new E4PickList(parent, SWT.NONE, null, Messages, this, UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN) { - @Override - protected void addPressed() { - EClass eClass = (EClass) ((IStructuredSelection) getSelection()).getFirstElement(); - handleAdd(eClass); - } - }; - pickList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1)); - viewer = pickList.getList(); - - pickList.setContentProvider(new ArrayContentProvider()); - pickList.setLabelProvider(new EClassLabelProvider(getEditor())); - pickList.setInput(new EClass[] { BasicPackageImpl.Literals.PART_SASH_CONTAINER, BasicPackageImpl.Literals.PART_STACK, BasicPackageImpl.Literals.PART, BasicPackageImpl.Literals.INPUT_PART, AdvancedPackageImpl.Literals.AREA, AdvancedPackageImpl.Literals.PLACEHOLDER }); - pickList.setSelection(new StructuredSelection(BasicPackageImpl.Literals.PART_SASH_CONTAINER)); - } - - folder.setSelection(0); - - return folder; - } - - @Override - public IObservableList getChildList(Object element) { - return null; - } - - private void handleAdd(EClass eClass) { - EObject eObject = EcoreUtil.create(eClass); - - setElementId(eObject); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(eObject); - } - } - - @Override - public List<Action> getActions(Object element) { - ArrayList<Action> l = new ArrayList<Action>(super.getActions(element)); - l.addAll(actions); - return l; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPerspectiveWindowsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPerspectiveWindowsEditor.java deleted file mode 100644 index 3d3865a7..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPerspectiveWindowsEditor.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; - -import javax.inject.Inject; -import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; - -public class VPerspectiveWindowsEditor extends VWindowEditor { - - @Inject - public VPerspectiveWindowsEditor() { - super(AdvancedPackageImpl.Literals.PERSPECTIVE__WINDOWS); - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VRootBindingContexts.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VRootBindingContexts.java deleted file mode 100644 index 8c75adeb..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VRootBindingContexts.java +++ /dev/null @@ -1,150 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Steven Spungin <steven@spungin.tv> - Ongoing maintenance - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import javax.annotation.PostConstruct; -import javax.inject.Inject; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.AbstractPickList; -import org.eclipse.e4.tools.emf.ui.internal.common.AbstractPickList.PickListFeatures; -import org.eclipse.e4.tools.emf.ui.internal.common.E4PickList; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.MApplication; -import org.eclipse.e4.ui.model.application.commands.MBindingContext; -import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; - -public class VRootBindingContexts extends AbstractComponentEditor { - private Composite composite; - private TableViewer viewer; - private EMFDataBindingContext context; - - private List<Action> actions = new ArrayList<Action>(); - - @Inject - public VRootBindingContexts() { - super(); - } - - @PostConstruct - void init() { - actions.add(new Action(Messages.VRootBindingContexts_AddContext, createImageDescriptor(ResourceProvider.IMG_BindingContext)) { - @Override - public void run() { - handleAddContext(); - } - }); - } - - @Override - public Image getImage(Object element, Display display) { - return null; - } - - @Override - public String getLabel(Object element) { - return Messages.VRootBindingContexts_TreeLabel; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return Messages.VRootBindingContexts_TreeLabelDescription; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - composite = createForm(parent, context, getMaster()); - } - VirtualEntry<?> o = (VirtualEntry<?>) object; - viewer.setInput(o.getList()); - getMaster().setValue(o.getOriginalParent()); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { - CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - { - AbstractPickList pickList = new E4PickList(parent, SWT.NONE, Arrays.asList(PickListFeatures.NO_PICKER), Messages, this, CommandsPackageImpl.Literals.BINDING_TABLE_CONTAINER__ROOT_CONTEXT) { - @Override - protected void addPressed() { - handleAddContext(); - } - - @Override - protected List<?> getContainerChildren(Object container) { - return ((MApplication) container).getRootContext(); - } - }; - pickList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1)); - viewer = pickList.getList(); - } - - folder.setSelection(0); - - return folder; - } - - private void handleAddContext() { - MBindingContext context = MCommandsFactory.INSTANCE.createBindingContext(); - setElementId(context); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.BINDING_TABLE_CONTAINER__ROOT_CONTEXT, context); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - - @Override - public IObservableList getChildList(Object element) { - return null; - } - - @Override - public List<Action> getActions(Object element) { - ArrayList<Action> l = new ArrayList<Action>(super.getActions(element)); - l.addAll(actions); - return l; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VSnippetsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VSnippetsEditor.java deleted file mode 100644 index 3540865c..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VSnippetsEditor.java +++ /dev/null @@ -1,250 +0,0 @@ -package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; - -/* - * Steven Spungin <steven@spungin.tv> - Ongoing maintenance - */ -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; - -import javax.annotation.PostConstruct; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.AbstractPickList; -import org.eclipse.e4.tools.emf.ui.internal.common.E4PickList; -import org.eclipse.e4.tools.emf.ui.internal.common.EClassLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.MApplication; -import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; -import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; - -public class VSnippetsEditor extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - private TableViewer viewer; - private final List<Action> actions = new ArrayList<Action>(); - private final EStructuralFeature targetFeature; - - public VSnippetsEditor() { - super(); - targetFeature = UiPackageImpl.Literals.SNIPPET_CONTAINER__SNIPPETS; - } - - @PostConstruct - void init() { - - actions.add(new Action(Messages.VWindowControlEditor_AddArea, - createImageDescriptor(ResourceProvider.IMG_Area_vertical)) { - @Override - public void run() { - handleAdd(AdvancedPackageImpl.Literals.AREA); - } - }); - - actions.add(new Action(Messages.VWindowEditor_AddDialog, createImageDescriptor(ResourceProvider.IMG_Dialog)) { - @Override - public void run() { - handleAdd(BasicPackageImpl.Literals.DIALOG); - } - }); - - actions - .add(new Action(Messages.VWindowControlEditor_AddPart, createImageDescriptor(ResourceProvider.IMG_Part)) { - @Override - public void run() { - handleAdd(BasicPackageImpl.Literals.PART); - } - }); - - actions.add(new Action(Messages.VWindowControlEditor_AddPartSashContainer, - createImageDescriptor(ResourceProvider.IMG_PartSashContainer_vertical)) { - @Override - public void run() { - handleAdd(BasicPackageImpl.Literals.PART_SASH_CONTAINER); - } - }); - - actions.add(new Action(Messages.VWindowControlEditor_AddPartStack, - createImageDescriptor(ResourceProvider.IMG_PartStack)) { - @Override - public void run() { - handleAdd(BasicPackageImpl.Literals.PART_STACK); - } - }); - - actions.add(new Action(Messages.VWindowControlEditor_AddPerspectiveStack, - createImageDescriptor(ResourceProvider.IMG_PerspectiveStack)) { - @Override - public void run() { - handleAdd(AdvancedPackageImpl.Literals.PERSPECTIVE_STACK); - } - }); - actions.add(new Action(Messages.PerspectiveStackEditor_AddPerspective, - createImageDescriptor(ResourceProvider.IMG_Perspective)) { - @Override - public void run() { - handleAdd(AdvancedPackageImpl.Literals.PERSPECTIVE); - } - }); - - actions.add(new Action(Messages.VTrimContributionsEditor_AddTrimContribution, - createImageDescriptor(ResourceProvider.IMG_TrimContribution)) { - @Override - public void run() { - handleAdd(BasicPackageImpl.Literals.TRIM_ELEMENT); - } - }); - - actions.add(new Action(Messages.VWindowEditor_AddTrimmedWindow, - createImageDescriptor(ResourceProvider.IMG_Window)) { - @Override - public void run() { - handleAdd(BasicPackageImpl.Literals.TRIMMED_WINDOW); - } - }); - actions.add(new Action(Messages.VWindowEditor_AddWindow, createImageDescriptor(ResourceProvider.IMG_Window)) { - @Override - public void run() { - handleAdd(BasicPackageImpl.Literals.WINDOW); - } - }); - actions.add(new Action(Messages.VWindowTrimEditor_AddWindowTrim, - createImageDescriptor(ResourceProvider.IMG_WindowTrim)) { - @Override - public void run() { - handleAdd(BasicPackageImpl.Literals.TRIM_BAR); - } - }); - actions.add(new Action(Messages.VWindowEditor_AddWizardDialog, - createImageDescriptor(ResourceProvider.IMG_WizardDialog)) { - @Override - public void run() { - handleAdd(BasicPackageImpl.Literals.WIZARD_DIALOG); - } - }); - - Collections.sort(actions, new Comparator<Action>() { - @Override - public int compare(Action o1, Action o2) { - return o1.getText().compareTo(o2.getText()); - } - }); - - } - - @Override - public Image getImage(Object element, Display display) { - return null; - } - - @Override - public String getLabel(Object element) { - return Messages.VWindowControlEditor_TreeLabel; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return Messages.VWindowControlEditor_TreeLabelDescription; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - composite = createForm(parent, context, getMaster()); - } - final VirtualEntry<?> o = (VirtualEntry<?>) object; - viewer.setInput(o.getList()); - getMaster().setValue(o.getOriginalParent()); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { - final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - final CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - final AbstractPickList pickList = new E4PickList(parent, SWT.NONE, null, Messages, this, targetFeature) { - @Override - protected void addPressed() { - final EClass eClass = (EClass) ((IStructuredSelection) getSelection()).getFirstElement(); - handleAdd(eClass); - } - - @Override - protected List<?> getContainerChildren(Object container) { - return ((MApplication) container).getSnippets(); - } - }; - pickList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1)); - viewer = pickList.getList(); - - pickList.setLabelProvider(new EClassLabelProvider(getEditor())); - pickList.setInput(new EClass[] { BasicPackageImpl.Literals.TRIMMED_WINDOW, BasicPackageImpl.Literals.WINDOW, - AdvancedPackageImpl.Literals.PERSPECTIVE_STACK, AdvancedPackageImpl.Literals.PERSPECTIVE, - AdvancedPackageImpl.Literals.AREA, BasicPackageImpl.Literals.PART_SASH_CONTAINER, - BasicPackageImpl.Literals.PART_STACK, BasicPackageImpl.Literals.PART, BasicPackageImpl.Literals.INPUT_PART, - BasicPackageImpl.Literals.TRIM_BAR, BasicPackageImpl.Literals.TRIM_ELEMENT, }); - pickList.setSelection(new StructuredSelection(AdvancedPackageImpl.Literals.PERSPECTIVE)); - - folder.setSelection(0); - - return folder; - } - - @Override - public IObservableList getChildList(Object element) { - return null; - } - - @Override - public List<Action> getActions(Object element) { - final ArrayList<Action> l = new ArrayList<Action>(super.getActions(element)); - l.addAll(actions); - return l; - } - - protected void handleAdd(EClass eClass) { - final EObject handler = EcoreUtil.create(eClass); - setElementId(handler); - - final Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), targetFeature, handler); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(handler); - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java deleted file mode 100644 index 39d6a578..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java +++ /dev/null @@ -1,156 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Steven Spungin <steven@spungin.tv> - Ongoing maintenance - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import javax.annotation.PostConstruct; -import javax.inject.Inject; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.AbstractPickList; -import org.eclipse.e4.tools.emf.ui.internal.common.AbstractPickList.PickListFeatures; -import org.eclipse.e4.tools.emf.ui.internal.common.E4PickList; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.MApplication; -import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; -import org.eclipse.e4.ui.model.application.ui.menu.MToolBarContribution; -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; - -public class VToolBarContributionsEditor extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - private TableViewer viewer; - private final List<Action> actions = new ArrayList<Action>(); - - @Inject - public VToolBarContributionsEditor() { - super(); - } - - @PostConstruct - void init() { - actions.add(new Action(Messages.VToolBarContributionsEditor_AddToolBarContribution, - createImageDescriptor(ResourceProvider.IMG_ToolBarContribution)) { - @Override - public void run() { - handleAdd(); - } - }); - } - - @Override - public Image getImage(Object element, Display display) { - return null; - } - - @Override - public String getLabel(Object element) { - return Messages.VToolBarContributionsEditor_TreeLabel; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return Messages.VToolBarContributionsEditor_TreeLabelDescription; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - composite = createForm(parent, context, getMaster()); - } - final VirtualEntry<?> o = (VirtualEntry<?>) object; - viewer.setInput(o.getList()); - getMaster().setValue(o.getOriginalParent()); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { - final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - final CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - { - final AbstractPickList pickList = new E4PickList(parent, SWT.NONE, - Arrays.asList(PickListFeatures.NO_PICKER), Messages, this, - MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTIONS__TOOL_BAR_CONTRIBUTIONS) { - @Override - protected void addPressed() { - handleAdd(); - } - - @Override - protected List<?> getContainerChildren(Object container) { - return ((MApplication) container).getToolBarContributions(); - } - }; - pickList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1)); - viewer = pickList.getList(); - } - - folder.setSelection(0); - - return folder; - } - - @Override - public IObservableList getChildList(Object element) { - return null; - } - - protected void handleAdd() { - final MToolBarContribution command = MMenuFactory.INSTANCE.createToolBarContribution(); - setElementId(command); - - final Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), - MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTIONS__TOOL_BAR_CONTRIBUTIONS, command); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(command); - } - } - - @Override - public List<Action> getActions(Object element) { - final ArrayList<Action> l = new ArrayList<Action>(super.getActions(element)); - l.addAll(actions); - return l; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java deleted file mode 100644 index 2588e523..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java +++ /dev/null @@ -1,156 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Steven Spungin <steven@spungin.tv> - Ongoing maintenance - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import javax.annotation.PostConstruct; -import javax.inject.Inject; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.AbstractPickList; -import org.eclipse.e4.tools.emf.ui.internal.common.AbstractPickList.PickListFeatures; -import org.eclipse.e4.tools.emf.ui.internal.common.E4PickList; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.MApplication; -import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; -import org.eclipse.e4.ui.model.application.ui.menu.MTrimContribution; -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; - -public class VTrimContributionsEditor extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - private TableViewer viewer; - private final List<Action> actions = new ArrayList<Action>(); - - @Inject - public VTrimContributionsEditor() { - super(); - } - - @PostConstruct - void init() { - actions.add(new Action(Messages.VTrimContributionsEditor_AddTrimContribution, - createImageDescriptor(ResourceProvider.IMG_TrimContribution)) { - @Override - public void run() { - handleAdd(); - } - }); - } - - @Override - public Image getImage(Object element, Display display) { - return null; - } - - @Override - public String getLabel(Object element) { - return Messages.VTrimContributionsEditor_TreeLabel; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return Messages.VTrimContributionsEditor_TreeLabelDescription; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - composite = createForm(parent, context, getMaster()); - } - final VirtualEntry<?> o = (VirtualEntry<?>) object; - viewer.setInput(o.getList()); - getMaster().setValue(o.getOriginalParent()); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { - final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - final CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - { - final AbstractPickList pickList = new E4PickList(parent, SWT.NONE, - Arrays.asList(PickListFeatures.NO_PICKER), Messages, this, - MenuPackageImpl.Literals.TRIM_CONTRIBUTIONS__TRIM_CONTRIBUTIONS) { - @Override - protected void addPressed() { - handleAdd(); - } - - @Override - protected List<?> getContainerChildren(Object container) { - return ((MApplication) container).getTrimContributions(); - } - }; - pickList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1)); - viewer = pickList.getList(); - } - - folder.setSelection(0); - - return folder; - } - - @Override - public IObservableList getChildList(Object element) { - return null; - } - - protected void handleAdd() { - final MTrimContribution command = MMenuFactory.INSTANCE.createTrimContribution(); - setElementId(command); - - final Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), - MenuPackageImpl.Literals.TRIM_CONTRIBUTIONS__TRIM_CONTRIBUTIONS, command); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(command); - } - } - - @Override - public List<Action> getActions(Object element) { - final ArrayList<Action> l = new ArrayList<Action>(super.getActions(element)); - l.addAll(actions); - return l; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java deleted file mode 100644 index 1a0753a7..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java +++ /dev/null @@ -1,215 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Steven Spungin <steven@spungin.tv> - Ongoing maintenance - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; - -import javax.annotation.PostConstruct; -import javax.inject.Inject; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.AbstractPickList; -import org.eclipse.e4.tools.emf.ui.internal.common.E4PickList; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; -import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; - -public class VWindowControlEditor extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - private final List<Action> actions = new ArrayList<Action>(); - private TableViewer viewer; - - @Inject - IEclipseContext eclipseContext; - - @Inject - public VWindowControlEditor() { - super(); - } - - @PostConstruct - void init() { - - actions.add(new Action(Messages.VWindowControlEditor_AddPerspectiveStack, - createImageDescriptor(ResourceProvider.IMG_PerspectiveStack)) { - @Override - public void run() { - handleAdd(AdvancedPackageImpl.Literals.PERSPECTIVE_STACK); - } - }); - - actions.add(new Action(Messages.VWindowControlEditor_AddPartSashContainer, - createImageDescriptor(ResourceProvider.IMG_PartSashContainer_vertical)) { - @Override - public void run() { - handleAdd(BasicPackageImpl.Literals.PART_SASH_CONTAINER); - } - }); - - actions.add(new Action(Messages.VWindowControlEditor_AddPartStack, - createImageDescriptor(ResourceProvider.IMG_PartStack)) { - @Override - public void run() { - handleAdd(BasicPackageImpl.Literals.PART_STACK); - } - }); - - actions - .add(new Action(Messages.VWindowControlEditor_AddPart, createImageDescriptor(ResourceProvider.IMG_Part)) { - @Override - public void run() { - handleAdd(BasicPackageImpl.Literals.PART); - } - }); - actions.add(new Action(Messages.VWindowControlEditor_AddArea, - createImageDescriptor(ResourceProvider.IMG_Area_vertical)) { - @Override - public void run() { - handleAdd(AdvancedPackageImpl.Literals.AREA); - } - }); - - Collections.sort(actions, new Comparator<Action>() { - @Override - public int compare(Action o1, Action o2) { - return o1.getText().compareTo(o2.getText()); - } - }); - } - - @Override - public Image getImage(Object element, Display display) { - return null; - } - - @Override - public String getLabel(Object element) { - return Messages.VWindowControlEditor_TreeLabel; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return Messages.VWindowControlEditor_TreeLabelDescription; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - composite = createForm(parent, context, getMaster()); - } - final VirtualEntry<?> o = (VirtualEntry<?>) object; - viewer.setInput(o.getList()); - getMaster().setValue(o.getOriginalParent()); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { - final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - final CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - { - final AbstractPickList pickList = new E4PickList(parent, SWT.NONE, null, Messages, this, - UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN) { - @Override - protected void addPressed() { - final EClass eClass = (EClass) ((IStructuredSelection) getSelection()).getFirstElement(); - handleAdd(eClass); - } - }; - pickList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1)); - viewer = pickList.getList(); - - pickList.setLabelProvider(new LabelProvider() { - @Override - public String getText(Object element) { - final EClass eclass = (EClass) element; - return eclass.getName(); - } - }); - - pickList - .setInput(new EClass[] { AdvancedPackageImpl.Literals.PERSPECTIVE_STACK, - BasicPackageImpl.Literals.PART_SASH_CONTAINER, BasicPackageImpl.Literals.PART_STACK, - BasicPackageImpl.Literals.PART, BasicPackageImpl.Literals.INPUT_PART, - AdvancedPackageImpl.Literals.AREA }); - pickList.setSelection(new StructuredSelection(AdvancedPackageImpl.Literals.PERSPECTIVE_STACK)); - } - - folder.setSelection(0); - - return folder; - } - - @Override - public IObservableList getChildList(Object element) { - return null; - } - - private void handleAdd(EClass eClass) { - final EObject eObject = EcoreUtil.create(eClass); - - setElementId(eObject); - - final Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), - UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(eObject); - } - } - - @Override - public List<Action> getActions(Object element) { - final ArrayList<Action> l = new ArrayList<Action>(super.getActions(element)); - l.addAll(actions); - return l; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java deleted file mode 100644 index 9a5c0bec..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java +++ /dev/null @@ -1,195 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Steven Spungin <steven@spungin.tv> - Ongoing maintenance - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; - -import java.util.ArrayList; -import java.util.List; -import javax.annotation.PostConstruct; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.AbstractPickList; -import org.eclipse.e4.tools.emf.ui.internal.common.E4PickList; -import org.eclipse.e4.tools.emf.ui.internal.common.EClassLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.MApplication; -import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; - -public abstract class VWindowEditor extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - private TableViewer viewer; - private List<Action> actions = new ArrayList<Action>(); - private EStructuralFeature targetFeature; - - public VWindowEditor(EStructuralFeature targetFeature) { - super(); - this.targetFeature = targetFeature; - } - - @PostConstruct - void init() { - actions.add(new Action(Messages.VWindowEditor_AddDialog, createImageDescriptor(ResourceProvider.IMG_Dialog)) { - @Override - public void run() { - handleAdd(BasicPackageImpl.Literals.DIALOG); - } - }); - actions.add(new Action(Messages.VWindowEditor_AddTrimmedWindow, createImageDescriptor(ResourceProvider.IMG_Window)) { - @Override - public void run() { - handleAdd(BasicPackageImpl.Literals.TRIMMED_WINDOW); - } - }); - actions.add(new Action(Messages.VWindowEditor_AddWindow, createImageDescriptor(ResourceProvider.IMG_Window)) { - @Override - public void run() { - handleAdd(BasicPackageImpl.Literals.WINDOW); - } - }); - actions.add(new Action(Messages.VWindowEditor_AddWizardDialog, createImageDescriptor(ResourceProvider.IMG_WizardDialog)) { - @Override - public void run() { - handleAdd(BasicPackageImpl.Literals.WIZARD_DIALOG); - } - }); - } - - @Override - public Image getImage(Object element, Display display) { - return null; - } - - @Override - public String getLabel(Object element) { - return Messages.VWindowEditor_TreeLabel; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return Messages.VWindowEditor_TreeLabelDescription; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - composite = createForm(parent, context, getMaster()); - } - VirtualEntry<?> o = (VirtualEntry<?>) object; - viewer.setInput(o.getList()); - getMaster().setValue(o.getOriginalParent()); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { - CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - AbstractPickList pickList = new E4PickList(parent, SWT.NONE, null, Messages, this, targetFeature) { - @Override - protected void addPressed() { - EClass eClass = (EClass) ((IStructuredSelection) getSelection()).getFirstElement(); - handleAdd(eClass); - } - - @Override - protected List<?> getContainerChildren(Object container) { - return ((MApplication) container).getChildren(); - } - }; - pickList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1)); - viewer = pickList.getList(); - - pickList.setLabelProvider(new EClassLabelProvider(getEditor())); - pickList.setInput(new EClass[] { BasicPackageImpl.Literals.DIALOG, BasicPackageImpl.Literals.TRIMMED_WINDOW, BasicPackageImpl.Literals.WINDOW, BasicPackageImpl.Literals.WIZARD_DIALOG }); - pickList.setSelection(new StructuredSelection(BasicPackageImpl.Literals.TRIMMED_WINDOW)); - - // @SuppressWarnings("unchecked") - // @Override - // public void widgetSelected(SelectionEvent e) { - // if (!viewer.getSelection().isEmpty()) { - // IStructuredSelection s = (IStructuredSelection) - // viewer.getSelection(); - // if (s.size() == 1) { - // Object obj = s.getFirstElement(); - // EObject container = (EObject) getMaster().getValue(); - // List<Object> l = (List<Object>) container.eGet(targetFeature); - // int idx = l.indexOf(obj) - 1; - // if (idx >= 0) { - // if (Util.moveElementByIndex(getEditingDomain(), (MUIElement) obj, - // getEditor().isLiveModel(), idx, targetFeature)) { - // viewer.setSelection(new StructuredSelection(obj)); - // } - // } - // - // } - // } - - folder.setSelection(0); - - return folder; - } - - @Override - public IObservableList getChildList(Object element) { - return null; - } - - @Override - public List<Action> getActions(Object element) { - ArrayList<Action> l = new ArrayList<Action>(super.getActions(element)); - l.addAll(actions); - return l; - } - - protected void handleAdd(EClass eClass) { - EObject handler = EcoreUtil.create(eClass); - setElementId(handler); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), targetFeature, handler); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(handler); - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java deleted file mode 100644 index 4d8e1ea0..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java +++ /dev/null @@ -1,242 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Wim Jongman <wim.jongman@remainsoftware.com> - bug 400804 - * Steven Spungin <steven@spungin.tv> - Ongoing maintenance - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; - -import java.util.ArrayList; -import java.util.List; -import javax.annotation.PostConstruct; -import javax.inject.Inject; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.AbstractPickList; -import org.eclipse.e4.tools.emf.ui.internal.common.E4PickList; -import org.eclipse.e4.tools.emf.ui.internal.common.EClassLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.tools.emf.ui.internal.imp.ModelImportWizard; -import org.eclipse.e4.tools.emf.ui.internal.imp.RegistryUtil; -import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; -import org.eclipse.e4.ui.model.application.ui.basic.MPart; -import org.eclipse.e4.ui.model.application.ui.basic.MWindow; -import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditListProperty; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.StructuredViewer; -import org.eclipse.jface.window.Window; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; - -public class VWindowSharedElementsEditor extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - private StructuredViewer viewer; - private List<Action> actions = new ArrayList<Action>(); - private List<Action> actionsImport = new ArrayList<Action>(); - - @Inject - IEclipseContext eclipseContext; - - @Inject - public VWindowSharedElementsEditor() { - super(); - } - - @PostConstruct - void init() { - actions.add(new Action(Messages.VWindowSharedElementsEditor_AddPartSashContainer, createImageDescriptor(ResourceProvider.IMG_PartSashContainer)) { - @Override - public void run() { - handleAdd(BasicPackageImpl.Literals.PART_SASH_CONTAINER); - } - }); - - actions.add(new Action(Messages.VWindowSharedElementsEditor_AddPart, createImageDescriptor(ResourceProvider.IMG_Part)) { - @Override - public void run() { - handleAdd(BasicPackageImpl.Literals.PART); - } - }); - - actions.add(new Action(Messages.VWindowSharedElementsEditor_AddPartStack, createImageDescriptor(ResourceProvider.IMG_PartStack)) { - @Override - public void run() { - handleAdd(BasicPackageImpl.Literals.PART_STACK); - } - }); - - actions.add(new Action(Messages.VWindowSharedElementsEditor_Area, createImageDescriptor(ResourceProvider.IMG_Area)) { - @Override - public void run() { - handleAdd(AdvancedPackageImpl.Literals.AREA); - } - }); - - // -- IMPORT ACTIONS -- - actionsImport.add(new Action(Messages.VWindowSharedElementsEditor_Views, createImageDescriptor(ResourceProvider.IMG_Part)) { - @Override - public void run() { - handleImport(BasicPackageImpl.Literals.PART, RegistryUtil.HINT_VIEW); - } - }); - - actionsImport.add(new Action(Messages.VWindowSharedElementsEditor_Editors, createImageDescriptor(ResourceProvider.IMG_Part)) { - @Override - public void run() { - handleImport(BasicPackageImpl.Literals.INPUT_PART, RegistryUtil.HINT_EDITOR); - } - }); - - actionsImport.add(new Action(Messages.VWindowSharedElementsEditor_ViewAsCompatibilityView, createImageDescriptor(ResourceProvider.IMG_Part)) { - @Override - public void run() { - handleImport(BasicPackageImpl.Literals.PART, RegistryUtil.HINT_COMPAT_VIEW); - } - }); - } - - @Override - public Image getImage(Object element, Display display) { - return null; - } - - @Override - public String getLabel(Object element) { - return Messages.VWindowSharedElementsEditor_TreeLabel; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return Messages.VWindowSharedElementsEditor_TreeLabelDescription; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - composite = createForm(parent, context, getMaster()); - } - VirtualEntry<?> o = (VirtualEntry<?>) object; - viewer.setInput(o.getList()); - getMaster().setValue(o.getOriginalParent()); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { - CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - { - - AbstractPickList pickList = new E4PickList(parent, SWT.NONE, null, Messages, this, BasicPackageImpl.Literals.WINDOW__SHARED_ELEMENTS) { - @Override - protected void addPressed() { - EClass eClass = (EClass) ((IStructuredSelection) getSelection()).getFirstElement(); - handleAdd(eClass); - } - - @Override - protected List<?> getContainerChildren(Object container) { - return ((MWindow) container).getSharedElements(); - } - }; - pickList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1)); - viewer = pickList.getList(); - - IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__SHARED_ELEMENTS); - viewer.setInput(prop.observeDetail(getMaster())); - - pickList.setLabelProvider(new EClassLabelProvider(getEditor())); - pickList.setInput(new EClass[] { BasicPackageImpl.Literals.PART_SASH_CONTAINER, BasicPackageImpl.Literals.PART, BasicPackageImpl.Literals.INPUT_PART, BasicPackageImpl.Literals.PART_STACK, AdvancedPackageImpl.Literals.AREA }); - pickList.setSelection(new StructuredSelection(BasicPackageImpl.Literals.PART)); - } - - folder.setSelection(0); - - return folder; - } - - @Override - public IObservableList getChildList(Object element) { - return null; - } - - protected void handleAdd(EClass eClass) { - EObject eObject = EcoreUtil.create(eClass); - addToModel(eObject); - } - - private void addToModel(EObject eObject) { - setElementId(eObject); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.WINDOW__SHARED_ELEMENTS, eObject); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(eObject); - } - } - - protected void handleImport(EClass eClass, String hint) { - if (eClass == BasicPackageImpl.Literals.PART) { - ModelImportWizard wizard = new ModelImportWizard(MPart.class, this, hint, resourcePool); - WizardDialog wizardDialog = new WizardDialog(viewer.getControl().getShell(), wizard); - if (wizardDialog.open() == Window.OK) { - MPart[] parts = (MPart[]) wizard.getElements(MPart.class); - for (MPart part : parts) { - addToModel((EObject) part); - } - } - } - } - - @Override - public List<Action> getActions(Object element) { - ArrayList<Action> l = new ArrayList<Action>(super.getActions(element)); - l.addAll(actions); - return l; - } - - @Override - public List<Action> getActionsImport(Object element) { - ArrayList<Action> l = new ArrayList<Action>(super.getActionsImport(element)); - l.addAll(actionsImport); - return l; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java deleted file mode 100644 index bd9f1e2d..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java +++ /dev/null @@ -1,159 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Steven Spungin <steven@spungin.tv> - Ongoing maintenance - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import javax.annotation.PostConstruct; -import javax.inject.Inject; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.AbstractPickList; -import org.eclipse.e4.tools.emf.ui.internal.common.AbstractPickList.PickListFeatures; -import org.eclipse.e4.tools.emf.ui.internal.common.E4PickList; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.ui.basic.MBasicFactory; -import org.eclipse.e4.ui.model.application.ui.basic.MTrimBar; -import org.eclipse.e4.ui.model.application.ui.basic.MTrimmedWindow; -import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; - -public class VWindowTrimEditor extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - private TableViewer viewer; - private final List<Action> actions = new ArrayList<Action>(); - - @Inject - public VWindowTrimEditor() { - super(); - } - - @PostConstruct - void init() { - actions.add(new Action(Messages.VWindowTrimEditor_AddWindowTrim, - createImageDescriptor(ResourceProvider.IMG_WindowTrim)) { - @Override - public void run() { - handleAdd(); - } - }); - } - - @Override - public Image getImage(Object element, Display display) { - return null; - } - - @Override - public String getLabel(Object element) { - return Messages.VWindowTrimEditor_TreeLabel; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return Messages.VWindowTrimEditor_TreeLabelDescription; - } - - @Override - public Composite doGetEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - composite = createForm(parent, context, getMaster()); - } - final VirtualEntry<?> o = (VirtualEntry<?>) object; - viewer.setInput(o.getList()); - getMaster().setValue(o.getOriginalParent()); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { - final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); - - final CTabItem item = new CTabItem(folder, SWT.NONE); - item.setText(Messages.ModelTooling_Common_TabDefault); - - parent = createScrollableContainer(folder); - item.setControl(parent.getParent()); - - { - final AbstractPickList pickList = new E4PickList(parent, SWT.NONE, - Arrays.asList(PickListFeatures.NO_PICKER), Messages, this, - BasicPackageImpl.Literals.TRIMMED_WINDOW__TRIM_BARS) { - @Override - protected void addPressed() { - handleAdd(); - } - - @Override - protected List<?> getContainerChildren(Object master) { - if (master instanceof MTrimmedWindow) { - return ((MTrimmedWindow) master).getTrimBars(); - } - return null; - } - }; - pickList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1)); - viewer = pickList.getList(); - } - - folder.setSelection(0); - - return folder; - } - - @Override - public IObservableList getChildList(Object element) { - return null; - } - - protected void handleAdd() { - final MTrimBar handler = MBasicFactory.INSTANCE.createTrimBar(); - setElementId(handler); - - final Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), - BasicPackageImpl.Literals.TRIMMED_WINDOW__TRIM_BARS, handler); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(handler); - } - } - - @Override - public List<Action> getActions(Object element) { - final ArrayList<Action> l = new ArrayList<Action>(super.getActions(element)); - l.addAll(actions); - return l; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowWindowsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowWindowsEditor.java deleted file mode 100644 index 7e1dd2df..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowWindowsEditor.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; - -import javax.inject.Inject; -import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; - -public class VWindowWindowsEditor extends VWindowEditor { - - @Inject - public VWindowWindowsEditor() { - super(BasicPackageImpl.Literals.WINDOW__WINDOWS); - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/AccessLevel.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/AccessLevel.java deleted file mode 100644 index fc5d6dc8..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/AccessLevel.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.eclipse.e4.tools.emf.ui.internal.common.objectdata; - -public enum AccessLevel { - PUBLIC(3), PROTECTED(2), DEFAULT(1), PRIVATE(0); - - public final int value; - - private AccessLevel(int value) { - this.value = value; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/JavaAttribute.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/JavaAttribute.java deleted file mode 100644 index da701e26..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/JavaAttribute.java +++ /dev/null @@ -1,145 +0,0 @@ -package org.eclipse.e4.tools.emf.ui.internal.common.objectdata; - -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; -import java.util.Collections; -import java.util.List; - -import javax.inject.Inject; -import javax.inject.Named; - -import org.eclipse.e4.core.di.extensions.EventTopic; -import org.eclipse.e4.core.di.extensions.Preference; -import org.eclipse.e4.core.services.nls.Translation; -import org.eclipse.e4.ui.di.UIEventTopic; -import org.osgi.framework.FrameworkUtil; - -public class JavaAttribute { - private final JavaObject object; - - private final Field field; - - public JavaAttribute(JavaObject object, Field field) { - this.object = object; - this.field = field; - this.field.setAccessible(true); - } - - public boolean isInjected() { - return field.getAnnotation(Inject.class) != null; - } - - public boolean isStatic() { - return (field.getModifiers() & Modifier.STATIC) == Modifier.STATIC; - } - - public String getValue() { - final Object value = getFieldValue(); - if (field.getType().isPrimitive()) { - return value + ""; //$NON-NLS-1$ - } - if (value == null) { - return "<null>"; //$NON-NLS-1$ - } else if (value instanceof String) { - return value.toString(); - } else { - String name; - if (value.getClass().isAnonymousClass()) { - name = value.getClass().getName().substring(value.getClass().getPackage().getName().length() + 1); - } else { - name = value.getClass().getSimpleName(); - } - - return name + " (id = " + Integer.toHexString(System.identityHashCode(value)) + ")"; //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - public List<JavaAttribute> getAttributes() { - try { - if (field.getType().isPrimitive()) { - return Collections.emptyList(); - } - return new JavaObject(field.get(object.getInstance())).getAttributes(); - - } catch (final IllegalArgumentException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (final IllegalAccessException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return Collections.emptyList(); - } - - public String getName() { - return field.getName(); - } - - public String getType() { - return field.getType().getSimpleName(); - } - - public AccessLevel getAccessLevel() { - final int m = field.getModifiers(); - if ((m & Modifier.PUBLIC) == Modifier.PUBLIC) { - return AccessLevel.PUBLIC; - } else if ((m & Modifier.PRIVATE) == Modifier.PRIVATE) { - return AccessLevel.PRIVATE; - } else if ((m & Modifier.PROTECTED) == Modifier.PROTECTED) { - return AccessLevel.PROTECTED; - } else { - return AccessLevel.DEFAULT; - } - } - - public String getContextKey() { - if (isInjected()) { - final Named named = field.getAnnotation(Named.class); - if (named != null) { - return "@Named(" + named.value() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ - } - - final Preference preference = field.getAnnotation(Preference.class); - if (preference != null) { - String path = preference.nodePath(); - if (path == null || path.trim().length() == 0) { - path = FrameworkUtil.getBundle(getFieldValue().getClass()).getSymbolicName(); - } - return "@Preference(" + preference.nodePath() + "/" + preference.value() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - } - - final EventTopic topic = field.getAnnotation(EventTopic.class); - - if (topic != null) { - return "@Topic(" + topic.value() + ")"; //$NON-NLS-1$//$NON-NLS-2$ - } - - final UIEventTopic uiTopic = field.getAnnotation(UIEventTopic.class); - if (uiTopic != null) { - return "@UITopic(" + uiTopic.value() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ - } - - final Translation translation = field.getAnnotation(Translation.class); - if (translation != null) { - return "@Translation(" + field.getType().getName() + ")"; //$NON-NLS-1$//$NON-NLS-2$ - } - - return field.getType().getName(); - } - - return ""; //$NON-NLS-1$ - } - - public Object getFieldValue() { - try { - return field.get(object.getInstance()); - } catch (final IllegalArgumentException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (final IllegalAccessException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return null; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/JavaMethod.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/JavaMethod.java deleted file mode 100644 index 09dc0ea5..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/JavaMethod.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.eclipse.e4.tools.emf.ui.internal.common.objectdata; - -public class JavaMethod { - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/JavaObject.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/JavaObject.java deleted file mode 100644 index 7bcb2c99..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/JavaObject.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.eclipse.e4.tools.emf.ui.internal.common.objectdata; - -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.List; - -public class JavaObject { - private Object instance; - private List<JavaAttribute> attributes; - - public JavaObject(Object instance) { - this.instance = instance; - } - - public Object getInstance() { - return instance; - } - - public List<JavaAttribute> getAttributes() { - if (attributes == null) { - initAttributes(); - } - return attributes; - } - - private void initAttributes() { - attributes = new ArrayList<JavaAttribute>(); - - if (instance == null) { - return; - } - - Class<?> clazz = instance.getClass(); - addDeclaredFields(clazz); - clazz = clazz.getSuperclass(); - while (clazz != null) { - addDeclaredFields(clazz); - clazz = clazz.getSuperclass(); - } - } - - private void addDeclaredFields(Class<?> clazz) { - for (Field f : clazz.getDeclaredFields()) { - attributes.add(new JavaAttribute(this, f)); - } - } - - public String getName() { - return instance.getClass().getSimpleName(); - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/ObjectViewer.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/ObjectViewer.java deleted file mode 100644 index 87691d66..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/objectdata/ObjectViewer.java +++ /dev/null @@ -1,299 +0,0 @@ -package org.eclipse.e4.tools.emf.ui.internal.common.objectdata; - -import java.util.Collection; -import java.util.Collections; - -import org.eclipse.core.databinding.observable.value.IObservableValue; -import org.eclipse.core.databinding.observable.value.IValueChangeListener; -import org.eclipse.core.databinding.observable.value.ValueChangeEvent; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.RegistryFactory; -import org.eclipse.e4.tools.emf.ui.common.IScriptingSupport; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.services.IResourcePool; -import org.eclipse.e4.ui.model.application.MApplicationElement; -import org.eclipse.e4.ui.model.internal.ModelUtils; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.IEMFValueProperty; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.IMenuListener; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.viewers.ColumnViewer; -import org.eclipse.jface.viewers.ColumnViewerToolTipSupport; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.StyledCellLabelProvider; -import org.eclipse.jface.viewers.StyledString; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerCell; -import org.eclipse.jface.viewers.ViewerComparator; -import org.eclipse.jface.window.ToolTip; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Label; - -public class ObjectViewer { - public TreeViewer createViewer(Composite parent, EStructuralFeature feature, final IObservableValue master, - IResourcePool resourcePool, final Messages messages) { - final TreeViewer viewer = new TreeViewer(parent); - viewer.setContentProvider(new ContentProviderImpl()); - viewer.setLabelProvider(new LabelProviderImpl(resourcePool)); - viewer.setComparator(new ViewerComparatorImpl()); - final IEMFValueProperty property = EMFProperties.value(feature); - final IObservableValue value = property.observeDetail(master); - value.addValueChangeListener(new IValueChangeListener() { - - @Override - public void handleValueChange(ValueChangeEvent event) { - if (event.diff.getNewValue() != null) { - viewer.setInput(Collections.singleton(new JavaObject(event.diff.getNewValue()))); - viewer.expandToLevel(2); - } else { - viewer.setInput(Collections.emptyList()); - } - } - }); - - final IExtensionRegistry registry = RegistryFactory.getRegistry(); - final IExtensionPoint extPoint = registry.getExtensionPoint("org.eclipse.e4.tools.emf.ui.scripting"); //$NON-NLS-1$ - final IConfigurationElement[] elements = extPoint.getConfigurationElements(); - - if (elements.length > 0) { - final MenuManager mgr = new MenuManager(); - mgr.setRemoveAllWhenShown(true); - mgr.addMenuListener(new IMenuListener() { - - @Override - public void menuAboutToShow(IMenuManager manager) { - if (viewer.getSelection().isEmpty()) { - return; - } - - final MenuManager scriptExecute = new MenuManager(messages.ObjectViewer_Script); - mgr.add(scriptExecute); - for (final IConfigurationElement e : elements) { - final IConfigurationElement le = e; - scriptExecute.add(new Action(e.getAttribute("label")) { //$NON-NLS-1$ - @Override - public void run() { - try { - final IScriptingSupport support = (IScriptingSupport) le - .createExecutableExtension("class"); //$NON-NLS-1$ - final Object o = ((IStructuredSelection) viewer.getSelection()) - .getFirstElement(); - Object mainObject = null; - if (o instanceof JavaObject) { - mainObject = ((JavaObject) o).getInstance(); - } else if (o instanceof JavaAttribute) { - mainObject = ((JavaAttribute) o).getFieldValue(); - } - - if (mainObject != null) { - final MApplicationElement value = (MApplicationElement) master.getValue(); - support.openEditor(viewer.getControl().getShell(), mainObject, - ModelUtils.getContainingContext(value)); - } - } catch (final CoreException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - }); - } - } - }); - - viewer.getControl().setMenu(mgr.createContextMenu(viewer.getControl())); - } - - new TooltipSupportImpl(viewer, ToolTip.NO_RECREATE, false, resourcePool, messages); - return viewer; - } - - class TooltipSupportImpl extends ColumnViewerToolTipSupport { - private final IResourcePool resourcePool; - private final Messages messages; - - protected TooltipSupportImpl(ColumnViewer viewer, int style, boolean manualActivation, - IResourcePool resourcePool, Messages messages) { - super(viewer, style, manualActivation); - this.resourcePool = resourcePool; - this.messages = messages; - } - - @Override - protected Composite createViewerToolTipContentArea(Event event, ViewerCell cell, Composite parent) { - final JavaAttribute attribute = (JavaAttribute) cell.getElement(); - - final Composite container = new Composite(parent, SWT.NONE); - container.setBackground(container.getDisplay().getSystemColor(SWT.COLOR_WHITE)); - container.setLayout(new GridLayout(2, false)); - - { - final Composite headerContainer = new Composite(container, SWT.NONE); - headerContainer.setBackgroundMode(SWT.INHERIT_DEFAULT); - headerContainer.setData(ModelEditor.CSS_CLASS_KEY, "headerSectionContainer"); //$NON-NLS-1$ - final GridLayout fl = new GridLayout(2, false); - fl.marginHeight = 5; - fl.marginWidth = 5; - headerContainer.setLayout(fl); - headerContainer.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, false, 2, 1)); - - final Label iconLabel = new Label(headerContainer, SWT.NONE); - iconLabel.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Obj16_bullet_go)); - - final Label textLabel = new Label(headerContainer, SWT.NONE); - textLabel.setText(attribute.getName()); - textLabel.setData(ModelEditor.CSS_CLASS_KEY, "sectionHeader"); //$NON-NLS-1$ - } - - { - Label l = new Label(container, SWT.NONE); - l.setText(messages.ObjectViewer_Tooltip_Value); - - l = new Label(container, SWT.NONE); - l.setText(attribute.getValue()); - } - - { - Label l = new Label(container, SWT.NONE); - l.setText(messages.ObjectViewer_Tooltip_InjectionKey); - - l = new Label(container, SWT.NONE); - l.setText(attribute.getContextKey()); - } - - return container; - } - } - - class ViewerComparatorImpl extends ViewerComparator { - @Override - public int compare(Viewer viewer, Object e1, Object e2) { - if (e1 instanceof JavaAttribute) { - if (e2 instanceof JavaAttribute) { - final JavaAttribute a1 = (JavaAttribute) e1; - final JavaAttribute a2 = (JavaAttribute) e2; - - if (a1.isStatic() && !a2.isStatic()) { - return -1; - } else if (!a1.isStatic() && a2.isStatic()) { - return 1; - } - - final int rv = Integer.valueOf(a1.getAccessLevel().value).compareTo(a2.getAccessLevel().value); - if (rv == 0) { - return a1.getName().compareTo(a2.getName()); - } - return rv; - } - return -1; - } - return super.compare(viewer, e1, e2); - } - } - - class LabelProviderImpl extends StyledCellLabelProvider { - - private final IResourcePool resourcePool; - - public LabelProviderImpl(IResourcePool resourcePool) { - this.resourcePool = resourcePool; - } - - @Override - public String getToolTipText(Object element) { - if (element instanceof JavaAttribute && ((JavaAttribute) element).isInjected()) { - return "Show Tooltip"; //$NON-NLS-1$ - } - return super.getToolTipText(element); - } - - @Override - public void update(ViewerCell cell) { - if (cell.getElement() instanceof JavaObject) { - final JavaObject o = (JavaObject) cell.getElement(); - cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Obj16_class_obj)); - cell.setText(o.getName()); - } else if (cell.getElement() instanceof JavaAttribute) { - final JavaAttribute o = (JavaAttribute) cell.getElement(); - final StyledString string = new StyledString(); - if (o.isInjected()) { - string.append("<injected> ", StyledString.COUNTER_STYLER); //$NON-NLS-1$ - } - string.append(o.getName()); - string.append(" : " + o.getType() + " - " + o.getValue(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ //$NON-NLS-2$ - cell.setText(string.getString()); - cell.setStyleRanges(string.getStyleRanges()); - switch (o.getAccessLevel()) { - case PUBLIC: - cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Obj16_field_public_obj)); - break; - case PRIVATE: - cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Obj16_field_private_obj)); - break; - case DEFAULT: - cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Obj16_field_default_obj)); - break; - default: - cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Obj16_field_protected_obj)); - break; - } - } - - super.update(cell); - } - } - - class ContentProviderImpl implements ITreeContentProvider { - - @Override - public void dispose() { - - } - - @Override - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - - } - - @Override - public Object[] getElements(Object inputElement) { - return ((Collection<?>) inputElement).toArray(); - - } - - @Override - public Object[] getChildren(Object parentElement) { - if (parentElement instanceof JavaObject) { - return ((JavaObject) parentElement).getAttributes().toArray(); - } else if (parentElement instanceof JavaAttribute) { - return ((JavaAttribute) parentElement).getAttributes().toArray(); - } - return new Object[0]; - } - - @Override - public Object getParent(Object element) { - // TODO Auto-generated method stub - return null; - } - - @Override - public boolean hasChildren(Object element) { - return getChildren(element).length > 0; - } - - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ExportIdsHandler.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ExportIdsHandler.java deleted file mode 100644 index 51c164fc..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ExportIdsHandler.java +++ /dev/null @@ -1,317 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 MEDEVIT, FHV and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Marco Descher <marco@descher.at> - initial API and implementation - *******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.properties; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import javax.inject.Named; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.e4.core.di.annotations.Execute; -import org.eclipse.e4.core.services.nls.Translation; -import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.services.IResourcePool; -import org.eclipse.e4.ui.model.application.MApplicationElement; -import org.eclipse.e4.ui.services.IServiceConstants; -import org.eclipse.emf.common.util.TreeIterator; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.internal.core.JavaProject; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.dialogs.TitleAreaDialog; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.CheckboxTableViewer; -import org.eclipse.jface.viewers.ColumnLabelProvider; -import org.eclipse.jface.viewers.TableViewerColumn; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; - -/** - * This handler exports all Id values within the application model to a file for - * static reference. Currently the location of this file is fixed to be in the - * location of the selected projects main package with name - * <code>AppModelId.java</code>. - */ -public class ExportIdsHandler { - @Execute - public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell shell, @Translation Messages messages, IModelResource resource, IResourcePool pool, IProject project) { - TitleAreaDialog dialog = new ExportIdDialog(shell, messages, resource.getRoot(), pool, project); - dialog.open(); - } - - static class ExportIdDialog extends TitleAreaDialog { - private Messages messages; - private IObservableList list; - private IResourcePool pool; - private JavaClass clazz; - private CheckboxTableViewer viewer; - - public ExportIdDialog(Shell parentShell, Messages messages, IObservableList list, IResourcePool pool, IProject project) { - super(parentShell); - this.messages = messages; - this.list = list; - this.pool = pool; - - clazz = new JavaClass(); - clazz.name = "AppModelId"; //$NON-NLS-1$ - - if (JavaProject.hasJavaNature(project)) { - try { - IJavaProject javaProject = JavaCore.create(project); - for (IPackageFragmentRoot iPackageFragmentRoot : javaProject.getAllPackageFragmentRoots()) { - if (iPackageFragmentRoot.getKind() == IPackageFragmentRoot.K_SOURCE) { - clazz.packageFragment = iPackageFragmentRoot.createPackageFragment(project.getName(), false, new NullProgressMonitor()); - break; - } - } - } catch (JavaModelException e) { - e.printStackTrace(); - } - } else { - setErrorMessage(messages.ExportIdsHandler_Dialog_SelectProject); - getButton(IDialogConstants.OK_ID).setEnabled(false); - } - } - - @Override - protected Control createDialogArea(Composite parent) { - getShell().setText(messages.ExportIdsHandler_Dialog_ShellTitle); - setTitle(messages.ExportIdsHandler_Dialog_DialogTitle); - setMessage(messages.ExportIdsHandler_Dialog_DialogMessage); - setTitleImage(pool.getImageUnchecked(ResourceProvider.IMG_Wizban16_extstr_wiz)); - - Composite container = (Composite) super.createDialogArea(parent); - container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); - Table t = new Table(container, SWT.BORDER | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CHECK); - - GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true); - gd.heightHint = t.getItemHeight() * 18; - container.setLayoutData(gd); - - GridData gd2 = new GridData(SWT.FILL, SWT.FILL, true, true); - gd2.heightHint = t.getItemHeight() * 17; - t.setHeaderVisible(true); - t.setLinesVisible(true); - t.setLayoutData(gd2); - - viewer = new CheckboxTableViewer(t); - - { - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.setLabelProvider(new ColumnLabelProvider() { - @Override - public String getText(Object element) { - return ""; //$NON-NLS-1$ - } - }); - } - - { - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText(messages.ExportIdsHandler_Dialog_ElementName); - column.setLabelProvider(new ColumnLabelProvider() { - @Override - public String getText(Object element) { - Entry e = (Entry) element; - return ((EObject) e.object).eClass().getName(); - } - }); - } - - { - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText(messages.ExportIdsHandler_Dialog_Key); - column.setLabelProvider(new ColumnLabelProvider() { - @Override - public String getText(Object element) { - Entry e = (Entry) element; - return e.idFieldKey; - } - }); - } - - { - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText(messages.ExportIdsHandler_Dialog_Id_Value); - column.setLabelProvider(new ColumnLabelProvider() { - @Override - public String getText(Object element) { - Entry e = (Entry) element; - return e.elementId; - } - }); - } - - for (int i = 1; i < viewer.getTable().getColumnCount(); i++) { - TableColumn c = viewer.getTable().getColumn(i); - c.pack(); - if (c.getWidth() < 120) { - c.setWidth(120); - } - } - - { - Label l = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL); - l.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false, 3, 1)); - } - - List<Entry> entries = new ArrayList<ExportIdsHandler.Entry>(); - TreeIterator<EObject> it = EcoreUtil.getAllContents(list); - - while (it.hasNext()) { - Object next = it.next(); - if (next instanceof MApplicationElement) { - MApplicationElement o = (MApplicationElement) next; - if (o.getElementId() != null && o.getElementId().length() > 1) { - String idFieldKey = findIdFieldKey(o); - entries.add(new Entry(o, idFieldKey, o.getElementId())); - } - } - } - - Collections.sort(entries); - - viewer.setContentProvider(new ArrayContentProvider()); - viewer.setInput(entries); - viewer.setAllChecked(true); - - for (int i = 1; i < viewer.getTable().getColumnCount(); i++) { - TableColumn c = viewer.getTable().getColumn(i); - c.pack(); - if (c.getWidth() < 120) { - c.setWidth(120); - } - } - - return container; - } - - @Override - protected void okPressed() { // See AbstractNewClassWizard - Object[] els = viewer.getCheckedElements(); - if (els.length > 0) { - try { - String content = compileFileContent(els); - - IPackageFragment fragment = clazz.packageFragment; - String cuName = clazz.name + ".java"; //$NON-NLS-1$ - ICompilationUnit unit = fragment.getCompilationUnit(cuName); - IResource resource = unit.getResource(); - IFile file = (IFile) resource; - - ByteArrayInputStream stream = new ByteArrayInputStream(content.toString().getBytes()); - if (file.exists()) { - file.delete(true, new NullProgressMonitor()); - } - - createParent(file.getParent()); - // NPE - file.create(stream, IResource.KEEP_HISTORY, new NullProgressMonitor()); - - stream.close(); - super.okPressed(); - } catch (CoreException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - } - } - - private String compileFileContent(Object[] els) { - StringBuilder b = new StringBuilder(); - b.append("package " + clazz.packageFragment.getElementName() + ";" + System.getProperty("line.separator")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - b.append(System.getProperty("line.separator")); //$NON-NLS-1$ - b.append("public class " + clazz.name + " {" + System.getProperty("line.separator")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - - for (Object o : els) { - Entry e = (Entry) o; - b.append("\tpublic static final String " + e.idFieldKey + " = \"" + e.elementId + "\";" + System.getProperty("line.separator")); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - } - - b.append("}"); //$NON-NLS-1$ - return b.toString(); - } - - private void createParent(IContainer container) throws CoreException { - if (!container.exists()) { - - createParent(container.getParent()); - - if (container instanceof IFolder) { - IFolder f = (IFolder) container; - f.create(true, true, new NullProgressMonitor()); - } - } - } - } - - private static String findIdFieldKey(MApplicationElement object) { - StringBuilder sb = new StringBuilder(); - sb.append(((EObject) object).eClass().getName()); - sb.append("_"); //$NON-NLS-1$ - sb.append(replaceInvalidChar(object.getElementId())); - return sb.toString().toUpperCase(); - } - - private static String replaceInvalidChar(String elementId) { - return elementId.replaceAll("[^A-Za-z0-9]", "_"); //$NON-NLS-1$ //$NON-NLS-2$ - } - - private static class Entry implements Comparable<Entry> { - private MApplicationElement object; - private String idFieldKey; - private String elementId; - - public Entry(MApplicationElement object, String idFieldKey, String elementId) { - this.object = object; - this.idFieldKey = idFieldKey; - this.elementId = elementId; - } - - @Override - public int compareTo(Entry o) { - return this.idFieldKey.compareTo(o.idFieldKey); - } - } - - /** - * @see org.eclipse.e4.internal.tools.wizards.classes.AbstractNewClassPage - */ - private static class JavaClass { - private IPackageFragment packageFragment; - private String name; - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ExternalizeStringHandler.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ExternalizeStringHandler.java deleted file mode 100644 index b4f8f21a..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ExternalizeStringHandler.java +++ /dev/null @@ -1,321 +0,0 @@ -package org.eclipse.e4.tools.emf.ui.internal.common.properties; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.List; -import java.util.Properties; -import javax.inject.Named; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.e4.core.di.annotations.Execute; -import org.eclipse.e4.core.services.nls.Translation; -import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.services.IResourcePool; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; -import org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.e4.ui.services.IServiceConstants; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.util.TreeIterator; -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.jface.dialogs.TitleAreaDialog; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.CheckboxTableViewer; -import org.eclipse.jface.viewers.ColumnLabelProvider; -import org.eclipse.jface.viewers.TableViewerColumn; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; - -public class ExternalizeStringHandler { - - @Execute - public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell shell, @Translation Messages messages, IModelResource resource, IResourcePool pool, IProject project) { - TitleAreaDialog dialog = new ExtractionDialog(shell, messages, resource, resource.getRoot(), pool, project); - dialog.open(); - } - - static class ExtractionDialog extends TitleAreaDialog { - private Messages messages; - private IObservableList list; - private IResourcePool pool; - private IProject project; - private CheckboxTableViewer viewer; - private IModelResource resource; - - public ExtractionDialog(Shell parentShell, Messages messages, IModelResource resource, IObservableList list, IResourcePool pool, IProject project) { - super(parentShell); - this.messages = messages; - this.list = list; - this.pool = pool; - this.project = project; - this.resource = resource; - } - - @Override - protected Control createDialogArea(Composite parent) { - getShell().setText(messages.ExternalizeStringHandler_Dialog_ShellTitle); - setTitle(messages.ExternalizeStringHandler_Dialog_DialogTitle); - setMessage(messages.ExternalizeStringHandler_Dialog_DialogMessage); - setTitleImage(pool.getImageUnchecked(ResourceProvider.IMG_Wizban16_extstr_wiz)); - - Composite container = (Composite) super.createDialogArea(parent); - Table t = new Table(container, SWT.BORDER | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CHECK); - GridData gd = new GridData(GridData.FILL_BOTH); - gd.heightHint = t.getItemHeight() * 15; - t.setLayoutData(gd); - t.setHeaderVisible(true); - t.setLinesVisible(true); - - viewer = new CheckboxTableViewer(t); - - { - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.setLabelProvider(new ColumnLabelProvider() { - @Override - public String getText(Object element) { - return ""; //$NON-NLS-1$ - } - }); - } - - { - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText(messages.ExternalizeStringHandler_Dialog_ElementName); - column.setLabelProvider(new ColumnLabelProvider() { - @Override - public String getText(Object element) { - Entry e = (Entry) element; - // FIXME We need the label provider - return e.object.eClass().getName(); - } - }); - } - - { - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText(messages.ExternalizeStringHandler_Dialog_AttributeName); - column.setLabelProvider(new ColumnLabelProvider() { - @Override - public String getText(Object element) { - Entry e = (Entry) element; - // FIXME We need the label provider - return e.feature.getName(); - } - }); - } - - { - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText(messages.ExternalizeStringHandler_Dialog_Key); - column.setLabelProvider(new ColumnLabelProvider() { - @Override - public String getText(Object element) { - Entry e = (Entry) element; - return e.key; - } - }); - } - - { - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText(messages.ExternalizeStringHandler_Dialog_Value); - column.setLabelProvider(new ColumnLabelProvider() { - @Override - public String getText(Object element) { - Entry e = (Entry) element; - return e.value; - } - }); - } - - List<Entry> entries = new ArrayList<ExternalizeStringHandler.Entry>(); - TreeIterator<EObject> it = EcoreUtil.getAllContents(list); - - List<String> ids = new ArrayList<String>(); - - List<EStructuralFeature> translatedFeatures = new ArrayList<EStructuralFeature>(); - translatedFeatures.add(UiPackageImpl.Literals.UI_LABEL__LABEL); - translatedFeatures.add(UiPackageImpl.Literals.UI_LABEL__TOOLTIP); - translatedFeatures.add(CommandsPackageImpl.Literals.COMMAND__COMMAND_NAME); - translatedFeatures.add(CommandsPackageImpl.Literals.COMMAND__DESCRIPTION); - translatedFeatures.add(CommandsPackageImpl.Literals.CATEGORY__NAME); - translatedFeatures.add(CommandsPackageImpl.Literals.CATEGORY__DESCRIPTION); - translatedFeatures.add(org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl.Literals.PART__DESCRIPTION); - translatedFeatures.add(BasicPackageImpl.Literals.PART_DESCRIPTOR__DESCRIPTION); - translatedFeatures.add(MenuPackageImpl.Literals.MENU_ELEMENT__MNEMONICS); - - while (it.hasNext()) { - EObject o = it.next(); - - for (EAttribute a : o.eClass().getEAllAttributes()) { - if (translatedFeatures.contains(a)) { - String v = (String) o.eGet(a); - - if (v != null && v.startsWith("%")) { //$NON-NLS-1$ - ids.add(v); - } - } - } - } - - Properties properties = getBaseProperties(); - for (Object o : properties.keySet()) { - ids.add(o.toString()); - } - - it = EcoreUtil.getAllContents(list); - while (it.hasNext()) { - EObject o = it.next(); - - for (EAttribute a : o.eClass().getEAllAttributes()) { - if (translatedFeatures.contains(a)) { - String v = (String) o.eGet(a); - if (v != null && v.trim().length() > 0 && !v.startsWith("%")) { //$NON-NLS-1$ - String id = findId(ids, o.eClass().getName().toLowerCase() + "." + a.getName().toLowerCase()); //$NON-NLS-1$ - entries.add(new Entry(o, a, id, v)); - ids.add(id); - } - } - } - } - viewer.setContentProvider(new ArrayContentProvider()); - viewer.setInput(entries); - viewer.setAllChecked(true); - - for (int i = 1; i < viewer.getTable().getColumnCount(); i++) { - TableColumn c = viewer.getTable().getColumn(i); - c.pack(); - if (c.getWidth() < 120) { - c.setWidth(120); - } - } - - return container; - } - - @Override - protected void okPressed() { - Object[] els = viewer.getCheckedElements(); - if (els.length > 0) { - try { - IFile f = getBasePropertyFile(); - - StringBuilder b = new StringBuilder(System.getProperty("line.separator")); //$NON-NLS-1$ - for (Object o : els) { - Entry e = (Entry) o; - b.append(e.key + " = " + e.value + System.getProperty("line.separator")); //$NON-NLS-1$//$NON-NLS-2$ - } - - ByteArrayInputStream stream = new ByteArrayInputStream(b.toString().getBytes()); - if (f.exists()) { - f.appendContents(stream, IResource.KEEP_HISTORY, new NullProgressMonitor()); - } else { - createParent(f.getParent()); - f.create(stream, IResource.KEEP_HISTORY, new NullProgressMonitor()); - } - - stream.close(); - - for (Object o : els) { - Entry e = (Entry) o; - Command cmd = SetCommand.create(resource.getEditingDomain(), e.object, e.feature, "%" + e.key); //$NON-NLS-1$ - - if (cmd.canExecute()) { - resource.getEditingDomain().getCommandStack().execute(cmd); - } - } - super.okPressed(); - } catch (CoreException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - } - - private void createParent(IContainer container) throws CoreException { - if (!container.exists()) { - - createParent(container.getParent()); - - if (container instanceof IFolder) { - IFolder f = (IFolder) container; - f.create(true, true, new NullProgressMonitor()); - } - } - } - - private IFile getBasePropertyFile() throws CoreException, IOException { - IFile file = project.getFile("META-INF/MANIFEST.MF"); //$NON-NLS-1$ - String base = ProjectOSGiTranslationProvider.extractBasenameFromManifest(file); - return project.getFile(base + ".properties"); //$NON-NLS-1$ - } - - private Properties getBaseProperties() { - Properties prop = new Properties(); - try { - IFile f = getBasePropertyFile(); - if (f.exists()) { - - InputStream in = f.getContents(); - prop.load(in); - in.close(); - } - } catch (CoreException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - return prop; - } - } - - private static String findId(List<String> ids, String prefix) { - int count = 1; - String id = prefix + "." + count; //$NON-NLS-1$ - while (ids.contains(id)) { - id = prefix + "." + ++count; //$NON-NLS-1$ - } - return id; - } - - static class Entry { - private EObject object; - private EStructuralFeature feature; - private String key; - private String value; - - public Entry(EObject object, EStructuralFeature feature, String key, String value) { - this.object = object; - this.feature = feature; - this.key = key; - this.value = value; - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ProjectOSGiTranslationProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ProjectOSGiTranslationProvider.java deleted file mode 100644 index 1a964c76..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ProjectOSGiTranslationProvider.java +++ /dev/null @@ -1,330 +0,0 @@ -package org.eclipse.e4.tools.emf.ui.internal.common.properties; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.security.AccessController; -import java.security.PrivilegedActionException; -import java.security.PrivilegedExceptionAction; -import java.util.List; -import java.util.Locale; -import java.util.PropertyResourceBundle; -import java.util.ResourceBundle; -import java.util.ResourceBundle.Control; - -import javax.inject.Inject; -import javax.inject.Named; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResourceChangeEvent; -import org.eclipse.core.resources.IResourceChangeListener; -import org.eclipse.core.resources.IResourceDelta; -import org.eclipse.core.resources.IResourceDeltaVisitor; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.e4.core.di.annotations.Optional; -import org.eclipse.e4.core.services.translation.TranslationService; -import org.eclipse.e4.tools.services.impl.ResourceBundleHelper; -import org.eclipse.e4.tools.services.impl.ResourceBundleTranslationProvider; -import org.osgi.framework.Constants; - -public class ProjectOSGiTranslationProvider extends ResourceBundleTranslationProvider { - - public static final String META_INF_DIRECTORY_NAME = "META-INF"; //$NON-NLS-1$ - public static final String MANIFEST_DEFAULT_PATH = "META-INF/MANIFEST.MF"; //$NON-NLS-1$ - - /** - * The {@link IProject} this translation provider is connected to - */ - private IProject project; - /** - * The manifest header identifying the base name of the bundle's - * localization entries. - */ - private String basename; - /** - * The Locale to use for translations. - */ - private Locale locale; - - /** - * @param project - * The {@link IProject} this translation provider should be - * connected to. - * @param locale - * The initial {@link Locale} for which this translation provider - * should be created. - */ - // TODO change parameter to Locale instead of String once we break e4 tools - // compatibility with Luna - public ProjectOSGiTranslationProvider(IProject project, String locale) { - // create the translation provider with no initial ResourceBundle as we - // need to calculate it first - super(null); - - this.project = project; - this.project.getWorkspace().addResourceChangeListener(new IResourceChangeListener() { - - @Override - public void resourceChanged(IResourceChangeEvent event) { - if (event.getType() == IResourceChangeEvent.POST_CHANGE) { - try { - event.getDelta().accept(new IResourceDeltaVisitor() { - - @Override - public boolean visit(IResourceDelta delta) throws CoreException { - return ProjectOSGiTranslationProvider.this.visit(delta); - } - }); - } catch (final CoreException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - }); - setLocale(locale, false); - - final IFile f = this.project.getFile(MANIFEST_DEFAULT_PATH); - if (f.exists()) { - handleManifestChange(f); - } else { - basename = Constants.BUNDLE_LOCALIZATION_DEFAULT_BASENAME; - } - } - - // TODO remove once we break e4 tools - // compatibility with Luna - @Inject - void setLocale(@Named(TranslationService.LOCALE) String locale, @Optional Boolean performUpdate) { - try { - this.locale = locale == null ? Locale.getDefault() : ResourceBundleHelper.toLocale(locale); - } catch (final Exception e) { - this.locale = Locale.getDefault(); - } - - if (performUpdate == null || performUpdate) { - updateResourceBundle(); - } - } - - @Inject - void setLocale(@Named(TranslationService.LOCALE) Locale locale, @Optional Boolean performUpdate) { - this.locale = locale == null ? Locale.getDefault() : locale; - - if (performUpdate == null || performUpdate) { - updateResourceBundle(); - } - } - - /** - * - * @param delta - * The resource delta that represents the changes in the state of - * a resource tree between two discrete points in time. - * @return <code>true</code> if the resource delta's children should be - * visited; <code>false</code> if they should be skipped. - */ - boolean visit(IResourceDelta delta) { - if (delta.getResource() instanceof IWorkspaceRoot) { - return true; - } else if (delta.getResource().equals(project)) { - return true; - } else if (delta.getResource().getProjectRelativePath().toString().equals(META_INF_DIRECTORY_NAME)) { - return true; - } else if (delta.getResource().getProjectRelativePath().toString().equals(MANIFEST_DEFAULT_PATH)) { - handleManifestChange((IFile) delta.getResource()); - return false; - } else if (delta.getResource() instanceof IFile) { - final String filename = ((IFile) delta.getResource()).getName(); - // extract base bundle name out of local basename - final String fileBaseName = basename.substring(basename.lastIndexOf("/") + 1, basename.length()); //$NON-NLS-1$ - if (filename.startsWith(fileBaseName)) { - updateResourceBundle(); - return false; - } - } - - if (delta.getResource().getProjectRelativePath().toString().equals(basename)) { - updateResourceBundle(); - return false; - } - - final String[] p = basename.split("/"); //$NON-NLS-1$ - int i = 0; - String path = ""; //$NON-NLS-1$ - do { - path += p[i]; - if (delta.getResource().getProjectRelativePath().toString().equals(path)) { - return true; - } - path += "/"; //$NON-NLS-1$ - } while (++i < p.length); - - return false; - } - - /** - * Will check if the manifest header identifying the base name of the - * bundle's localization entries has changed and if so it will update the - * underlying {@link ResourceBundle} and clear the caches. - * - * @param file - * The reference to the manifest file of the current project. - */ - private void handleManifestChange(IFile file) { - try { - final String newValue = extractBasenameFromManifest(file); - - if (!newValue.equals(basename)) { - basename = newValue; - if (basename != null) { - updateResourceBundle(); - } - } - - } catch (final CoreException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (final IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - /** - * Extracts the manifest header identifying the base name of the bundle's - * localization entries. - * - * @param file - * The reference to the manifest file of the current project. - * @return The manifest header identifying the base name of the bundle's - * localization entries. - * @throws CoreException - * If loading the contents of the given {@link IFile} fails - * @throws IOException - * If reading out of the given file fails. - * - * @see IFile#getContents() - */ - public static String extractBasenameFromManifest(IFile file) throws CoreException, IOException { - final InputStream in = file.getContents(); - final BufferedReader r = new BufferedReader(new InputStreamReader(in)); - String line; - String newValue = Constants.BUNDLE_LOCALIZATION_DEFAULT_BASENAME; - while ((line = r.readLine()) != null) { - if (line.startsWith(Constants.BUNDLE_LOCALIZATION)) { - newValue = line.substring(Constants.BUNDLE_LOCALIZATION.length() + 1).trim(); - break; - } - } - - r.close(); - return newValue; - } - - /** - * Reloads the underlying ResourceBundle. - */ - protected void updateResourceBundle() { - setResourceBundle(ResourceBundleHelper.getEquinoxResourceBundle(basename, locale, - new ProjectResourceBundleControl(true), new ProjectResourceBundleControl(false))); - } - - /** - * Specialization of {@link Control} which loads the {@link ResourceBundle} by using file structures of a project - * instead of using a classloader. - * - * @author Dirk Fauth - */ - class ProjectResourceBundleControl extends ResourceBundle.Control { - - /** - * Flag to determine whether the default locale should be used as - * fallback locale in case there is no {@link ResourceBundle} found for - * the specified locale. - */ - private final boolean useFallback; - - /** - * @param useFallback - * <code>true</code> if the default locale should be used as - * fallback locale in the search path or <code>false</code> if there should be no fallback. - */ - ProjectResourceBundleControl(boolean useFallback) { - this.useFallback = useFallback; - } - - @Override - public ResourceBundle newBundle(String baseName, Locale locale, String format, ClassLoader loader, - boolean reload) throws IllegalAccessException, InstantiationException, IOException { - - final String bundleName = toBundleName(baseName, locale); - ResourceBundle bundle = null; - if (format.equals("java.properties")) { //$NON-NLS-1$ - final String resourceName = toResourceName(bundleName, "properties"); //$NON-NLS-1$ - InputStream stream = null; - try { - stream = AccessController.doPrivileged(new PrivilegedExceptionAction<InputStream>() { - @Override - public InputStream run() throws IOException { - return getResourceAsStream(resourceName); - } - }); - } catch (final PrivilegedActionException e) { - throw (IOException) e.getException(); - } - if (stream != null) { - try { - bundle = new PropertyResourceBundle(stream); - } finally { - stream.close(); - } - } - } else { - throw new IllegalArgumentException("unknown format: " + format); //$NON-NLS-1$ - } - return bundle; - } - - /** - * Loads the properties file by using the {@link IProject} of the {@link ProjectOSGiTranslationProvider}. - * - * @param name - * @return The {@link InputStream} to the properties file to load - */ - protected InputStream getResourceAsStream(String name) { - final IFile f = project.getFile(name); - try { - if (f.exists()) { - return f.getContents(); - } - return null; - } catch (final CoreException e) { - return null; - } - } - - @Override - public List<String> getFormats(String baseName) { - return FORMAT_PROPERTIES; - } - - @Override - public Locale getFallbackLocale(String baseName, Locale locale) { - return useFallback ? super.getFallbackLocale(baseName, locale) : null; - } - - // this implementation simply doesn't cache the values in the - // ResourceBundle. If we recognize performance issues in the - // Application Model Editor because of this we should consider - // returning 0 here and overriding needsReload() with the information - // which bundle needs to be reloaded - @Override - public long getTimeToLive(String baseName, Locale locale) { - return TTL_DONT_CACHE; - } - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ResourceBundleEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ResourceBundleEditor.java deleted file mode 100644 index 4c8495ab..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ResourceBundleEditor.java +++ /dev/null @@ -1,15 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.properties; - -public class ResourceBundleEditor { - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ResourceBundleEntry.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ResourceBundleEntry.java deleted file mode 100644 index 63b9f415..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ResourceBundleEntry.java +++ /dev/null @@ -1,19 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.properties; - -import java.util.SortedMap; -import java.util.TreeMap; - -public class ResourceBundleEntry { - public String key; - public SortedMap<String, String> translations = new TreeMap<String, String>(); -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/BundleConverter.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/BundleConverter.java deleted file mode 100644 index 4fafe7a1..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/BundleConverter.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation - *******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator; - -import java.io.FileOutputStream; -import java.util.jar.Manifest; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; - -/** - * Converts the given install location into a bundle. - * - * @author Steven Spungin - * - */ -public class BundleConverter { - - /** - * - * @param installLocation - * @return The bundleId of the bundle, or null if not converted - * @throws Exception - */ - public static String convertProjectToBundle(String installLocation, IWorkspace workspace) throws Exception { - IPath project = Path.fromOSString(installLocation); - if (project.toFile().isDirectory() == false) { - throw new Exception(Messages.BundleConverter_installLocationNotADirectory); - } - IPath metaDir = project.append("META-INF"); //$NON-NLS-1$ - if (metaDir.toFile().isDirectory() == false) { - if (metaDir.toFile().mkdir() == false) { - throw new Exception(Messages.BundleConverter_couldNotCreateMetaInfDir); - } - } - IPath manifestPath = metaDir.append("MANIFEST.MF"); //$NON-NLS-1$ - if (manifestPath.toFile().isFile()) { - throw new Exception(Messages.BundleConverter_projectIsAlreadyABundle); - } - Manifest manifest = new Manifest(); - // TODO prompt for names - IPath path = Path.fromOSString(installLocation); - String bundleId = path.lastSegment(); - String bundleName = path.lastSegment(); - manifest.getMainAttributes().putValue("Manifest-Version", "1.0"); //$NON-NLS-1$ //$NON-NLS-2$ - manifest.getMainAttributes().putValue("Bundle-SymbolicName", bundleId); //$NON-NLS-1$ - manifest.getMainAttributes().putValue("Bundle-Name", bundleName); //$NON-NLS-1$ - manifest.getMainAttributes().putValue("Bundle-Version", "0.0.1"); //$NON-NLS-1$ //$NON-NLS-2$ - manifest.write(new FileOutputStream(manifestPath.toFile())); - IProject targetProject = workspace.getRoot().getProject(bundleId); - targetProject.refreshLocal(2, null); - return bundleId; - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/Messages.java deleted file mode 100644 index c9a800f2..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/Messages.java +++ /dev/null @@ -1,81 +0,0 @@ -package org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator; - -import org.eclipse.osgi.util.NLS; - -public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.messages"; //$NON-NLS-1$ - public static String BundleClassDialog_bundle; - public static String BundleClassDialog_bundleClassEditor; - public static String BundleClassDialog_class; - public static String BundleClassDialog_create_goto; - public static String BundleClassDialog_find; - public static String BundleClassDialog_package; - public static String BundleClassDialog_uri; - public static String BundleConverter_couldNotCreateMetaInfDir; - public static String BundleConverter_installLocationNotADirectory; - public static String BundleConverter_projectIsAlreadyABundle; - public static String FindContributionDialog_findBundle; - public static String FindContributionDialog_findClass; - public static String FindContributionDialog_findIcon; - public static String FindContributionDialog_findPackage; - public static String FindContributionDialog_inBundle; - public static String FindContributionDialog_inPackage; - public static String FindIconDialog_findIcon; - public static String FindIconDialog_searchByFilename; - public static String IconDialog_bundle; - public static String IconDialog_find; - public static String IconDialog_folder; - public static String IconDialog_icon; - public static String IconDialog_selectIcon; - public static String IconDialog_selectIcon_MESSAGE; - public static String IconDialog_selectIcon_TITLE; - public static String IconDialog_uri; - public static String IconDialog_uriEditor; - public static String NonReferencedActionPage_Action; - public static String NonReferencedActionPage_NonreferencedResourceAction; - public static String NonReferencedResourceDialog__ast_notInABundle_ast; - public static String NonReferencedResourceDialog_2; - public static String NonReferencedResourceDialog_Action; - public static String NonReferencedResourceDialog_ast_notInABundle_ast; - public static String NonReferencedResourceDialog_bundle; - public static String NonReferencedResourceDialog_class; - public static String NonReferencedResourceDialog_convertAndRequire; - public static String NonReferencedResourceDialog_copyToReferenedProject; - public static String NonReferencedResourceDialog_copyToThisProject; - public static String NonReferencedResourceDialog_directory; - public static String NonReferencedResourceDialog_error; - public static String NonReferencedResourceDialog_importPackage; - public static String NonReferencedResourceDialog_installLocation; - public static String NonReferencedResourceDialog_package; - public static String NonReferencedResourceDialog_requireBundle; - public static String NonReferencedResourceDialog_resource; - public static String NonReferencedResourceDialog_resourceNotReferenced; - public static String NonReferencedResourceDialog_resourceReferenceWarning; - public static String NonReferencedResourceDialog_selectProjectToReceiveCopy; - public static String NonReferencedResourceDialog_selectTheFolderResourceCopy; - public static String NonReferencedResourceDialog_url; - public static String NonReferencedResourceDialog_useAnyway; - public static String PickProjectFolderPage_SelectProjectFolder; - public static String PickProjectPage_SelectReferencedProject; - public static String ProjectFolderPickerDialog_0; - public static String ProjectFolderPickerDialog_6; - public static String ProjectFolderPickerDialog_sourceResourceDirectory; - public static String ProjectFolderPickerDialog_sourceResourceName; - public static String ProjectFolderPickerDialog_useSourceDirectory; - public static String ReferencedProjectPickerDialog_selectReferencedProject; - public static String TargetPlatformClassContributionCollector_classes; - public static String TargetPlatformContributionCollector_BuildTargetPlatformIndex; - public static String TargetPlatformContributionCollector_pleaseWait; - public static String TargetPlatformContributionCollector_RunInBackground; - public static String TargetPlatformContributionCollector_Searching; - public static String TargetPlatformContributionCollector_updatingTargetPlatformCache; - public static String TargetPlatformContributionCollector_WaitingForTargetPlatformIndexingToComplete; - public static String TargetPlatformIconContributionCollector_images; - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - private Messages() { - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/TargetPlatformClassContributionCollector.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/TargetPlatformClassContributionCollector.java deleted file mode 100644 index eea44f59..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/TargetPlatformClassContributionCollector.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 424730 - *******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator; - -import java.util.regex.Pattern; - -/** - * A contribution collector encompassing the current target platform.<br /> - * Uses FilterEx for bundle, package, and location filtering - * - * @author Steven Spungin - * - */ -public class TargetPlatformClassContributionCollector extends TargetPlatformContributionCollector { - - protected TargetPlatformClassContributionCollector(String cacheName) { - super(cacheName); - } - - static final private Pattern pattern = Pattern.compile("(.*/)?([^/]+)\\.class"); //$NON-NLS-1$ - protected static TargetPlatformClassContributionCollector instance; - - static public TargetPlatformClassContributionCollector getInstance() { - if (instance == null) { - instance = new TargetPlatformClassContributionCollector(Messages.TargetPlatformClassContributionCollector_classes); - } - return instance; - } - - @Override - protected boolean shouldIgnore(String name) { - return name.contains("$"); //$NON-NLS-1$ - } - - @Override - protected Pattern getFilePattern() { - return pattern; - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/TargetPlatformContributionCollector.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/TargetPlatformContributionCollector.java deleted file mode 100644 index b6b17902..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/TargetPlatformContributionCollector.java +++ /dev/null @@ -1,622 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 424730, Bug 435625, Bug 436133, Bug 436132, - * Bug 436283, Bug 436281, Bug 443510 - * Fabian Miehe - Bug 440327 - *******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.lang.reflect.InvocationTargetException; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.concurrent.CopyOnWriteArrayList; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.zip.ZipEntry; -import java.util.zip.ZipInputStream; - -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.xpath.XPath; -import javax.xml.xpath.XPathConstants; -import javax.xml.xpath.XPathFactory; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider; -import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider.ContributionData; -import org.eclipse.e4.tools.emf.ui.common.IModelElementProvider; -import org.eclipse.e4.tools.emf.ui.common.IProviderStatusCallback; -import org.eclipse.e4.tools.emf.ui.common.ProviderStatus; -import org.eclipse.e4.tools.emf.ui.common.ResourceSearchScope; -import org.eclipse.e4.tools.emf.ui.internal.common.ClassContributionCollector; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FilteredContributionDialog; -import org.eclipse.e4.tools.emf.ui.internal.common.component.tabs.empty.E; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.pde.core.plugin.IPluginBase; -import org.eclipse.pde.core.plugin.IPluginModelBase; -import org.eclipse.pde.internal.core.PDECore; -import org.eclipse.pde.internal.core.TargetPlatformHelper; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.w3c.dom.Document; -import org.w3c.dom.NodeList; - -/** - * A contribution collector encompassing the current target platform.<br /> - * Uses filter for bundle, package, and location filtering.<br /> - * This implementation finds resources based on file names, not by parsing file - * contents. - * - * @author Steven Spungin - * - */ -public abstract class TargetPlatformContributionCollector extends ClassContributionCollector { - - CopyOnWriteArrayList<Entry> cacheEntry = new CopyOnWriteArrayList<Entry>(); - HashSet<String> cacheBundleId = new HashSet<String>(); - HashSet<String> cachePackage = new HashSet<String>(); - HashSet<String> cacheLocation = new HashSet<String>(); - private Pattern patternFile; - protected String cacheName; - protected boolean stopFiltering; - - static class Entry { - String name; - String path; - String installLocation; - String relativePath; - String bundleSymName; - String pakage; - } - - @SuppressWarnings("unused") - private TargetPlatformContributionCollector() { - } - - protected TargetPlatformContributionCollector(String cacheName) { - - this.cacheName = cacheName; - patternFile = getFilePattern(); - - addContributor(new IClassContributionProvider() { - - @Override - public void findContribution(Filter filter, ContributionResultHandler handler) { - - final Pattern patternName = Pattern.compile(filter.namePattern, Pattern.CASE_INSENSITIVE); - - reloadCache(false, filter.getProviderStatusCallback()); - - int maxResults = filter.maxResults; - if (maxResults == 0) { - maxResults = 100; - } - - int found = 0; - boolean more = false; - - stopFiltering = false; - for (final Entry e : cacheEntry) { - if (stopFiltering) { - break; - } - final IProgressMonitor monitor = filter.getProgressMonitor(); - if (monitor != null) { - if (monitor.isCanceled()) { - stopFiltering = true; - break; - } - monitor.subTask(Messages.TargetPlatformContributionCollector_Searching - + " " + e.installLocation); //$NON-NLS-1$ - } - - if (E.notEmpty(filter.getBundles())) { - if (!filter.getBundles().contains(e.bundleSymName)) { - continue; - } - } - if (E.notEmpty(filter.getPackages())) { - if (!filter.getPackages().contains(e.pakage)) { - continue; - } - } - if (E.notEmpty(filter.getLocations())) { - boolean locationFound = false; - for (final String location : filter.getLocations()) { - if (e.installLocation.startsWith(location)) { - locationFound = true; - break; - } - } - if (!locationFound) { - continue; - } - } - if (filter.isIncludeNonBundles() == false) { - if (e.bundleSymName == null) { - continue; - } - } - if (filter.getSearchScope().contains(ResourceSearchScope.WORKSPACE)) { - if (filter.project != null) { - final IWorkspace workspace = filter.project.getWorkspace(); - boolean fnd = false; - for (final IProject project : workspace.getRoot().getProjects()) { - // String path = - // project.getLocationURI().getPath(); - final String path = project.getName(); - if (e.installLocation.contains(path)) { - fnd = true; - break; - } - } - if (!fnd) { - continue; - } - } - } - - final Matcher m = patternName.matcher(e.name); - if (m.find()) { - found++; - if (found > maxResults) { - more = true; - handler.moreResults(ContributionResultHandler.MORE_UNKNOWN, filter); - break; - } - handler.result(makeData(e)); - } - - } - if (!more) { - if (stopFiltering) { - handler.moreResults(ContributionResultHandler.MORE_CANCELED, filter); - } else { - handler.moreResults(0, filter); - } - } - } - }); - - addModelElementContributor(new IModelElementProvider() { - - @Override - public void getModelElements(Filter filter, ModelResultHandler handler) { - // TODO Auto-generated method stub - } - - @Override - public void clearCache() { - stopFiltering = true; - cacheEntry.clear(); - cacheBundleId.clear(); - cachePackage.clear(); - cacheLocation.clear(); - outputDirectories.clear(); - } - }); - } - - protected ContributionData makeData(Entry e) { - // If class is in a java project, strip the source directory - // String path = e.path;// .replace("/", ".") + e.name; - // path = stripSourceDirectory(path, e.installLocation); - IPath ip = Path.fromOSString(e.path); - ip = ip.addTrailingSeparator().makeRelative(); - ip = ip.append(e.name); - final String className = ip.toOSString().replace(File.separatorChar, '.'); - final ContributionData data = new ContributionData(e.bundleSymName, className, "Java", e.installLocation); //$NON-NLS-1$ - data.installLocation = e.installLocation; - data.resourceRelativePath = e.relativePath; - return data; - } - - /** - * - * @return A copy of the bundle IDs in the cache. - */ - public Collection<String> getBundleIds() { - reloadCache(false, null); - return new ArrayList<String>(cacheBundleId); - } - - /** - * - * @return A copy of the bundle IDs in the cache. - */ - public Collection<String> getPackages() { - reloadCache(false, null); - return new ArrayList<String>(cachePackage); - } - - /** - * - * @return A copy of the bundle IDs in the cache. - */ - public Collection<String> getLocations() { - reloadCache(false, null); - return new ArrayList<String>(cacheLocation); - } - - /** - * Ensures the cache is loaded. By default it is loaded on first access, and - * kept static until forced to reloaded. - * - * @param force - * true to force reload the cache - * @param providerStatusCallback - */ - private void reloadCache(boolean force, final IProviderStatusCallback providerStatusCallback) { - if (cacheEntry.isEmpty() || force) { - if (providerStatusCallback != null) { - providerStatusCallback.onStatusChanged(ProviderStatus.INITIALIZING); - } - cacheEntry.clear(); - cacheBundleId.clear(); - cachePackage.clear(); - cacheLocation.clear(); - outputDirectories.clear(); - - final Job job = new Job(Messages.TargetPlatformContributionCollector_BuildTargetPlatformIndex) { - - @Override - protected IStatus run(IProgressMonitor monitor) { - // load workspace projects - final IProject[] projects = PDECore.getWorkspace().getRoot().getProjects(); - final IPluginModelBase[] models = TargetPlatformHelper.getPDEState().getTargetModels(); - final int total = projects.length + models.length; - monitor.beginTask(Messages.TargetPlatformContributionCollector_updatingTargetPlatformCache - + cacheName + ")", total); //$NON-NLS-1$ - - for (final IProject pj : projects) { - if (monitor.isCanceled()) { - break; - } - final String rootDirectory = pj.getLocation().toOSString(); - monitor.subTask(rootDirectory); - monitor.worked(1); - TargetPlatformContributionCollector.this - .visit(monitor, FilteredContributionDialog.getBundle(rootDirectory), rootDirectory, - new File(rootDirectory)); - } - - // load target platform bundles - for (final IPluginModelBase pluginModelBase : models) { - monitor.subTask(pluginModelBase.getPluginBase().getId()); - monitor.worked(1); - if (monitor.isCanceled()) { - break; - } - - final IPluginBase pluginBase = pluginModelBase.getPluginBase(); - if (pluginBase == null) { - // bundle = getBundle(new File()) - continue; - } - URL url; - try { - final String installLocation = pluginModelBase.getInstallLocation(); - if (installLocation.endsWith(".jar")) { //$NON-NLS-1$ - url = new URL("file://" + installLocation); //$NON-NLS-1$ - final ZipInputStream zis = new ZipInputStream(url.openStream()); - while (true) { - final ZipEntry entry = zis.getNextEntry(); - if (entry == null) { - break; - } - final String name2 = entry.getName(); - if (shouldIgnore(name2)) { - continue; - } - final Matcher m = patternFile.matcher(name2); - if (m.matches()) { - final Entry e = new Entry(); - e.installLocation = installLocation; - cacheLocation.add(installLocation); - e.name = m.group(2); - e.path = m.group(1); - if (e.path != null) { - e.pakage = e.path.replace("/", "."); //$NON-NLS-1$ //$NON-NLS-2$ - if (e.pakage.startsWith(".")) { //$NON-NLS-1$ - e.pakage = e.pakage.substring(1); - } - if (e.pakage.endsWith(".")) { //$NON-NLS-1$ - e.pakage = e.pakage.substring(0, e.pakage.length() - 1); - } - } else { - e.pakage = ""; //$NON-NLS-1$ - } - cachePackage.add(e.pakage); - - e.bundleSymName = pluginBase.getId(); - if (e.path == null) { - e.path = ""; //$NON-NLS-1$ - } - cacheEntry.add(e); - cacheBundleId.add(pluginBase.getId()); - - // - // System.out.println(group - // + " -> " - // + - // m.group(2)); - } - } - } else { - // not a jar file - final String bundle = getBundle(new File(installLocation)); - if (bundle != null) { - visit(monitor, bundle, installLocation, new File(installLocation)); - } - } - } catch (final MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (final IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - monitor.done(); - if (monitor.isCanceled()) { - if (providerStatusCallback != null) { - providerStatusCallback.onStatusChanged(ProviderStatus.CANCELLED); - } - return Status.CANCEL_STATUS; - } - if (providerStatusCallback != null) { - providerStatusCallback.onStatusChanged(ProviderStatus.READY); - } - return Status.OK_STATUS; - } - }; - job.schedule(); - - // User Job will not display dialog if called from a modal dialog, - // so we wrap a plain ol' job in a ProgressMonitorDialog - Display.getDefault().syncExec(new Runnable() { - - boolean runInBackground = false; - - @Override - public void run() { - final ProgressMonitorDialog dlg = new ProgressMonitorDialog(Display.getDefault().getActiveShell()) { - - @Override - protected Control createContents(Composite parent) { - // TODO odd this is not a bean. - final Composite ret = (Composite) super.createContents(parent); - final Label label = new Label(ret, SWT.NONE); - label.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false, 2, 1)); - label.setText(Messages.TargetPlatformContributionCollector_pleaseWait); - - return ret; - } - - @Override - protected void createButtonsForButtonBar(Composite parent) { - final Button button = createButton(parent, 101, - Messages.TargetPlatformContributionCollector_RunInBackground, false); - // TODO JA - button.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - runInBackground = true; - } - }); - super.createButtonsForButtonBar(parent); - - // Do not use arrow cursor until calling super - // TODO ProgressMonitorDialog should encapsulate - // arrowCurson - button.setCursor(arrowCursor); - } - - @Override - protected void cancelPressed() { - job.cancel(); - } - }; - try { - dlg.run(true, true, new IRunnableWithProgress() { - - @Override - public void run(final IProgressMonitor monitor) throws InvocationTargetException, - InterruptedException { - monitor - .beginTask( - Messages.TargetPlatformContributionCollector_WaitingForTargetPlatformIndexingToComplete, - IProgressMonitor.UNKNOWN); - while (job.getState() == Job.RUNNING && !runInBackground) { - Thread.sleep(100); - } - monitor.done(); - } - }); - } catch (final InvocationTargetException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } catch (final InterruptedException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - } - - }); - } - } - - // @Refactor - static public String getBundle(File file) { - if (file.isDirectory() == false) { - return null; - } - - final File f = new File(file, "META-INF/MANIFEST.MF"); //$NON-NLS-1$ - - if (f.exists() && f.isFile()) { - BufferedReader r = null; - try { - final InputStream s = new FileInputStream(f); - r = new BufferedReader(new InputStreamReader(s)); - String line; - while ((line = r.readLine()) != null) { - if (line.startsWith("Bundle-SymbolicName:")) { //$NON-NLS-1$ - final int start = line.indexOf(':'); - int end = line.indexOf(';'); - if (end == -1) { - end = line.length(); - } - return line.substring(start + 1, end).trim(); - } - } - } catch (final IOException e) { - e.printStackTrace(); - } finally { - if (r != null) { - try { - r.close(); - } catch (final IOException e) { - } - } - } - } - return null; - } - - protected void visit(IProgressMonitor monitor, String bundleName, String installLocation, File file) { - for (final File fChild : file.listFiles()) { - if (monitor.isCanceled()) { - break; - } - if (fChild.isDirectory()) { - visit(monitor, bundleName, installLocation, fChild); - } else { - String name2 = fChild.getAbsolutePath().substring(installLocation.length() + 1); - name2 = stripOutputDirectory(name2, installLocation); - if (shouldIgnore(name2)) { - continue; - } - final Matcher m = patternFile.matcher(name2); - if (m.matches()) { - final Entry e = new Entry(); - e.installLocation = installLocation; - cacheLocation.add(installLocation); - e.name = m.group(2); - if (e.name.contains("$")) { //$NON-NLS-1$ - continue; - } - e.path = m.group(1); - if (e.path != null) { - e.pakage = e.path.replace("/", "."); //$NON-NLS-1$ //$NON-NLS-2$ - if (e.pakage.startsWith(".")) { //$NON-NLS-1$ - e.pakage = e.pakage.substring(1); - } - if (e.pakage.endsWith(".")) { //$NON-NLS-1$ - e.pakage = e.pakage.substring(0, e.pakage.length() - 1); - } - } else { - e.pakage = ""; //$NON-NLS-1$ - } - if (e.path == null) { - e.path = ""; //$NON-NLS-1$ - } - e.relativePath = Path - .fromOSString(file.getAbsolutePath().replace(e.installLocation, "")).makeRelative().toOSString(); //$NON-NLS-1$ - - e.bundleSymName = bundleName; - // TODO we need project to strip source paths. - // e.pakage = e.pakage.replaceAll("^bin.", ""); - cachePackage.add(e.pakage); - cacheEntry.add(e); - if (bundleName != null) { - cacheBundleId.add(bundleName); - } - } - } - } - - } - - static private String stripOutputDirectory(String path, String installLocation) { - if (installLocation.matches(".*\\.jar")) { //$NON-NLS-1$ - return path; - } - for (final String sourceDirectory : getOutputDirectories(installLocation)) { - if (path.startsWith(sourceDirectory)) { - path = path.substring(sourceDirectory.length()); - break; - } - } - return path; - } - - /** - * A cache of the output directories for install locations (if install - * location has a classpath file with appropriate output entries) - */ - static private HashMap<String, List<String>> outputDirectories = new HashMap<String, List<String>>(); - - // Returns the Eclipse output directories for an install location. The - // directories are relative to the install location. - // <classpathentry kind="output" path="bin"/> - static private List<String> getOutputDirectories(String installLocation) { - List<String> ret = outputDirectories.get(installLocation); - if (ret == null) { - ret = new ArrayList<String>(); - outputDirectories.put(installLocation, ret); - try { - final Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder() - .parse(new File(installLocation + File.separator + ".classpath")); //$NON-NLS-1$ - final XPath xp = XPathFactory.newInstance().newXPath(); - final NodeList list = (NodeList) xp.evaluate( - "//classpathentry[@kind='output']/@path", doc, XPathConstants.NODESET); //$NON-NLS-1$ - for (int i = 0; i < list.getLength(); i++) { - final String value = list.item(i).getNodeValue(); - ret.add(value); - } - } catch (final Exception e) { - } - } - return ret; - } - - protected boolean shouldIgnore(String name) { - return false; - } - - protected abstract Pattern getFilePattern(); - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/TargetPlatformIconContributionCollector.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/TargetPlatformIconContributionCollector.java deleted file mode 100644 index b50ff3b7..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/TargetPlatformIconContributionCollector.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 424730 - *******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator; - -import java.util.regex.Pattern; - -import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider.ContributionData; - -/** - * A contribution collector encompassing the current target platform.<br /> - * Uses FilterEx for bundle, package, and location filtering - * - * @author Steven Spungin - * - */ -public class TargetPlatformIconContributionCollector extends TargetPlatformContributionCollector { - - protected TargetPlatformIconContributionCollector(String cacheName) { - super(cacheName); - } - - static final Pattern pattern = Pattern.compile("(.*/)?([^/]+\\.(jpg|jpeg|png|gif))"); //$NON-NLS-1$ - protected static TargetPlatformIconContributionCollector instance; - - static public TargetPlatformIconContributionCollector getInstance() { - if (instance == null) { - instance = new TargetPlatformIconContributionCollector( - Messages.TargetPlatformIconContributionCollector_images); - } - return instance; - } - - @Override - protected Pattern getFilePattern() { - return pattern; - } - - @Override - protected ContributionData makeData(Entry e) { - final ContributionData data = new ContributionData(e.bundleSymName, null, "Java", e.path + e.name); //$NON-NLS-1$ - data.installLocation = e.installLocation; - data.resourceRelativePath = data.iconPath; - return data; - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/BundleClassDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/BundleClassDialog.java deleted file mode 100644 index e7dda071..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/BundleClassDialog.java +++ /dev/null @@ -1,328 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. All rights reserved. This - * program and the accompanying materials are made available under the terms of - * the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 424730, Ongoing Maintenance - *******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.dialogs; - -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.tools.emf.ui.common.IContributionClassCreator; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.Messages; -import org.eclipse.e4.ui.model.application.ui.basic.MBasicFactory; -import org.eclipse.e4.ui.model.application.ui.basic.MPart; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.window.Window; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Link; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; -import org.eclipse.swt.widgets.ToolBar; -import org.eclipse.swt.widgets.ToolItem; -import org.osgi.framework.Bundle; -import org.osgi.framework.FrameworkUtil; - -/** - * A dialog for creating, editing, replacing, or removing a bundleclass. - * - * @author Steven Spungin - * - */ -public class BundleClassDialog extends Dialog implements UriDialog { - private Text txtUri; - private Text txtBundle; - private Text txtClass; - private Text txtPackage; - public String uri = ""; //$NON-NLS-1$ - private String bundle = ""; //$NON-NLS-1$ - private String clazz = ""; //$NON-NLS-1$ - private String pakage = ""; //$NON-NLS-1$ - protected boolean ignoreModify; - private IEclipseContext context; - - static Pattern patternBundleClass = Pattern.compile("bundleclass:/*([^/]+)/((.*)\\.)?([^\\.]+)"); //$NON-NLS-1$ - - public BundleClassDialog(Shell parentShell, IEclipseContext context) { - super(parentShell); - this.context = context; - } - - @Override - protected void configureShell(Shell newShell) { - newShell.setText(Messages.BundleClassDialog_bundleClassEditor); - super.configureShell(newShell); - } - - @Override - protected int getShellStyle() { - return super.getShellStyle() | SWT.RESIZE; - } - - @Override - protected Control createDialogArea(final Composite parent) { - Composite composite = new Composite(parent, SWT.NONE); - composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - composite.setLayout(new GridLayout(2, false)); - - ToolBar toolBar = new ToolBar(composite, SWT.NO_FOCUS); - toolBar.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1)); - - { - Label lbl = new Label(composite, SWT.NONE); - lbl.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false)); - lbl.setText(Messages.BundleClassDialog_uri); - - txtUri = new Text(composite, SWT.SINGLE | SWT.LEAD | SWT.BORDER); - txtUri.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); - txtUri.setText("bundleclass://"); //$NON-NLS-1$ - - txtUri.addModifyListener(new ModifyListener() { - - @Override - public void modifyText(ModifyEvent e) { - if (ignoreModify) { - return; - } - ignoreModify = true; - setUri(txtUri.getText()); - txtBundle.setText(bundle); - txtPackage.setText(pakage); - txtClass.setText(clazz); - ignoreModify = false; - parent.pack(); - } - }); - } - - // common listener for text boxes - ModifyListener listener = new ModifyListener() { - - @Override - public void modifyText(ModifyEvent e) { - if (ignoreModify) { - return; - } - ignoreModify = true; - String prefix; - prefix = "bundleclass://"; //$NON-NLS-1$ - setUri(prefix + txtBundle.getText() + "/" + txtPackage.getText() + "." + txtClass.getText()); //$NON-NLS-1$//$NON-NLS-2$ - txtUri.setText(getUri()); - ignoreModify = false; - } - }; - - { - Link lbl = new Link(composite, SWT.NONE); - lbl.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false)); - lbl.setText("<A>" + Messages.BundleClassDialog_bundle + "</A>"); //$NON-NLS-1$ //$NON-NLS-2$ - - txtBundle = new Text(composite, SWT.SINGLE | SWT.LEAD | SWT.BORDER); - txtBundle.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); - txtBundle.addModifyListener(listener); - - lbl.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - IEclipseContext childCtx = context.createChild(); - childCtx.set(Bundle.class, FrameworkUtil.getBundle(FindContributionDialog.class)); - childCtx.set("bundle", getBundle()); //$NON-NLS-1$ - childCtx.set("package", getPackage()); //$NON-NLS-1$ - childCtx.set("mode", "show-bundles"); //$NON-NLS-1$ //$NON-NLS-2$ - FindContributionDialog dlg = new FindContributionDialog(childCtx); - if (dlg.open() == Dialog.OK) { - String uri = getUri(dlg); - Matcher matcher = getMatcher(uri); - if (matcher.matches()) { - txtBundle.setText(matcher.group(1)); - } - } - } - }); - } - - { - Link lbl = new Link(composite, SWT.NONE); - lbl.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false)); - lbl.setText("<A>" + Messages.BundleClassDialog_package + "</A>"); //$NON-NLS-1$ //$NON-NLS-2$ - - txtPackage = new Text(composite, SWT.SINGLE | SWT.LEAD | SWT.BORDER); - txtPackage.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); - txtPackage.addModifyListener(listener); - - lbl.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - IEclipseContext childCtx = context.createChild(); - childCtx.set(Bundle.class, FrameworkUtil.getBundle(FindContributionDialog.class)); - childCtx.set("bundle", getBundle()); //$NON-NLS-1$ - childCtx.set("package", getPackage()); //$NON-NLS-1$ - childCtx.set("mode", "show-packages"); //$NON-NLS-1$ //$NON-NLS-2$ - FindContributionDialog dlg = new FindContributionDialog(childCtx); - if (dlg.open() == Dialog.OK) { - String uri = getUri(dlg); - Matcher matcher = getMatcher(uri); - if (matcher.matches()) { - txtPackage.setText(matcher.group(3)); - } - } - } - }); - } - - { - Link lbl = new Link(composite, SWT.NONE); - lbl.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false)); - lbl.setText("<A>" + Messages.BundleClassDialog_class + "</A>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-2 - - txtClass = new Text(composite, SWT.SINGLE | SWT.LEAD | SWT.BORDER); - txtClass.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); - txtClass.addModifyListener(listener); - - lbl.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - IEclipseContext childCtx = context.createChild(); - childCtx.set(Bundle.class, FrameworkUtil.getBundle(FindContributionDialog.class)); - childCtx.set("bundle", getBundle()); //$NON-NLS-1$ - childCtx.set("package", getPackage()); //$NON-NLS-1$ - - FindContributionDialog dlg = new FindContributionDialog(childCtx); - if (dlg.open() == Window.OK) { - txtUri.setText(getUri(dlg)); - } - } - }); - } - - ToolItem btnGo = new ToolItem(toolBar, SWT.PUSH); - // btnGo.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, - // false, 2, 1)); - btnGo.setText(Messages.BundleClassDialog_create_goto); - btnGo.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - try { - MPart dummyPart = MBasicFactory.INSTANCE.createPart(); - dummyPart.setContributionURI(getUri()); - final IContributionClassCreator c = context.get(ModelEditor.class).getContributionCreator(org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl.Literals.PART); - c.createOpen(dummyPart, context.get(EditingDomain.class), context.get(IProject.class), getShell()); - setUri(dummyPart.getContributionURI()); - okPressed(); - } catch (Exception e2) { - // TODO: handle exception - } - } - }); - - ToolItem btnFind = new ToolItem(toolBar, SWT.PUSH); - // btnFind.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, - // false, 2, 1)); - btnFind.setText(Messages.BundleClassDialog_find + "..."); //$NON-NLS-1$ - btnFind.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - IEclipseContext childCtx = context.createChild(); - childCtx.set(Bundle.class, FrameworkUtil.getBundle(FindContributionDialog.class)); - FindContributionDialog dialog = new FindContributionDialog(childCtx); - if (dialog.open() == Dialog.OK) { - txtUri.setText(getUri(dialog)); - } - } - }); - - ToolItem btnRemove = new ToolItem(toolBar, SWT.PUSH); - // btnRemove.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, - // false, false, 2, 1)); - btnRemove.setText("Remove"); //$NON-NLS-1$ - btnRemove.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - txtUri.setText(""); //$NON-NLS-1$ - close(); - } - }); - - txtUri.setText(uri); - txtBundle.setText(bundle); - txtClass.setText(clazz); - return composite; - } - - protected String getUri(FindContributionDialog dlg) { - return dlg.getBundleclassUri(); - } - - @Override - public int open() { - int ret = super.open(); - return ret; - } - - @Override - public String getUri() { - return uri; - } - - @Override - public void setUri(String uri) { - this.uri = uri == null ? "" : uri.toString(); //$NON-NLS-1$ - Matcher matcher = getMatcher(this.uri); - if (matcher.matches()) { - bundle = matcher.group(1); - pakage = matcher.group(3); - if (pakage == null) { - pakage = ""; //$NON-NLS-1$ - } - clazz = matcher.group(4); - } else { - bundle = ""; //$NON-NLS-1$ - pakage = ""; //$NON-NLS-1$ - clazz = ""; //$NON-NLS-1$ - } - } - - protected String getBundle() { - return bundle; - } - - protected void setBundle(String bundle) { - this.bundle = bundle; - } - - protected String getClazz() { - return clazz; - } - - protected void setClazz(String clazz) { - this.clazz = clazz; - } - - protected String getPackage() { - return pakage; - } - - protected void setPackage(String pakage) { - this.pakage = pakage; - } - - private Matcher getMatcher(String uri) { - return patternBundleClass.matcher(uri); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/DynamicWizard.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/DynamicWizard.java deleted file mode 100644 index 467b7668..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/DynamicWizard.java +++ /dev/null @@ -1,122 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation - *******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.dialogs; - -import java.util.ArrayList; - -import org.eclipse.e4.tools.emf.ui.internal.common.component.tabs.empty.E; -import org.eclipse.jface.wizard.IWizardPage; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.jface.wizard.WizardPage; - -/** - * Adds features for wizards with dynamic pages. The <em>pages</em> member is - * private in the base class... - * - * @author Steven Spungin - * - */ -public class DynamicWizard extends Wizard { - - protected ArrayList<IWizardPage> pages = new ArrayList<IWizardPage>(); - private String message; - - public DynamicWizard() { - setForcePreviousAndNextButtons(true); - } - - @Override - public boolean performFinish() { - return true; - } - - @Override - public boolean canFinish() { - - final IWizardPage cur = getContainer().getCurrentPage(); - final IWizardPage nextPage = getNextPage(cur); - - // We need to call get next page first, as that may add or remove pages - for (final IWizardPage page : pages) { - if (page.isPageComplete() == false) { - return false; - } - } - return nextPage == null; - } - - @Override - public void addPage(IWizardPage page) { - page.setWizard(this); - pages.add(page); - - // Only add the first page to the base class - if (super.getPageCount() == 0) { - super.addPage(page); - updateMessage(); - } - - } - - /** - * Override the message on the first page if specified - * - * @param page - */ - private void updateMessage() { - if (E.notEmpty(message) && pages.size() > 0) { - // TODO file bug: IWizardPage is missing the setMessage method! - final IWizardPage page = pages.get(0); - if (page instanceof WizardPage) { - final WizardPage wizPage = (WizardPage) page; - wizPage.setMessage(message); - } - } - } - - @Override - public IWizardPage getPreviousPage(IWizardPage page) { - final IWizardPage cur = getContainer().getCurrentPage(); - final int index = pages.indexOf(cur); - if (index > 0) { - return pages.get(index - 1); - } - return null; - } - - @Override - public IWizardPage getNextPage(IWizardPage page) { - final int index = pages.indexOf(page); - if (index < pages.size() - 1) { - return pages.get(index + 1); - } - return null; - } - - public void clearDynamicPages() { - while (pages.size() > 1) { - pages.remove(pages.size() - 1); - } - - } - - /** - * Overrides the message of the first page if not <em>empty</em> - * - * @param message - */ - public void setMessage(String message) { - this.message = message; - updateMessage(); - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/FindContributionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/FindContributionDialog.java deleted file mode 100644 index a1398add..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/FindContributionDialog.java +++ /dev/null @@ -1,424 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Lars Vogel <lars.vogel@gmail.com> - Enhancements - * Steven Spungin <steven@spungin.tv> - Modified to be generic picker, Bug 424730, Ongoing Maintenance - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.dialogs; - -import java.util.Iterator; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.list.WritableList; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider.ContributionData; -import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider.ContributionResultHandler; -import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider.Filter; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.common.ClassContributionCollector; -import org.eclipse.e4.tools.emf.ui.internal.common.component.tabs.empty.E; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.dialogs.TitleAreaDialog; -import org.eclipse.jface.viewers.DoubleClickEvent; -import org.eclipse.jface.viewers.IDoubleClickListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StyledCellLabelProvider; -import org.eclipse.jface.viewers.StyledString; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerCell; -import org.eclipse.jface.viewers.ViewerFilter; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.events.KeyAdapter; -import org.eclipse.swt.events.KeyEvent; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceReference; - -/** - * A find dialog for model contributions. List can be filtered by bundle and/or - * package - * - * @author Steven Spungin - * - */ -public class FindContributionDialog extends TitleAreaDialog { - private IProject project; - private Image javaClassImage; - private TableViewer viewer; - private Messages Messages; - private String bundleclassUri; - @SuppressWarnings("unused") - private IEclipseContext context; - private String packageFilter; - private String bundleFilter; - private Bundle bundle; - private String mode; - private Image titleImage; - private String platformUri; - - public FindContributionDialog(IEclipseContext context) { - super(context.get(Shell.class)); - this.context = context; - this.project = context.get(IProject.class); - this.Messages = context.get(Messages.class); - packageFilter = (String) context.get("package"); //$NON-NLS-1$ - bundleFilter = (String) context.get("bundle"); //$NON-NLS-1$ - bundle = context.get(Bundle.class); - mode = (String) context.get("mode"); //$NON-NLS-1$ - } - - @Override - protected boolean isResizable() { - return true; - } - - @Override - protected Control createDialogArea(Composite parent) { - Composite comp = (Composite) super.createDialogArea(parent); - - // TODO param - getShell().setText(Messages.ContributionClassDialog_ShellTitle); - - if ("show-bundles".equals(mode)) { //$NON-NLS-1$ - // TODO create icon - } else if ("show-packages".equals(mode)) { //$NON-NLS-1$ - // TODO create icon - } else if ("show-icons".equals(mode)) { //$NON-NLS-1$ - // TODO create icon - } else { - titleImage = new Image(comp.getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/full/wizban/newclass_wiz.png")); //$NON-NLS-1$ - setTitleImage(titleImage); - } - - getShell().addDisposeListener(new DisposeListener() { - - @Override - public void widgetDisposed(DisposeEvent e) { - javaClassImage.dispose(); - if (titleImage != null) { - titleImage.dispose(); - } - } - }); - - javaClassImage = new Image(getShell().getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/full/obj16/class_obj.gif")); //$NON-NLS-1$ - - Composite container = new Composite(comp, SWT.NONE); - container.setLayoutData(new GridData(GridData.FILL_BOTH)); - container.setLayout(new GridLayout(2, false)); - - Label l = new Label(container, SWT.NONE); - // TODO param - l.setText(Messages.ContributionClassDialog_Label_Classname); - - final Text t = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - // TODO param - t.setMessage(Messages.ContributionClassDialog_FilterText_Message); - - new Label(container, SWT.NONE); - - viewer = new TableViewer(container, SWT.FULL_SELECTION | SWT.BORDER); - GridData gd = new GridData(GridData.FILL_BOTH); - viewer.getControl().setLayoutData(gd); - viewer.setContentProvider(new ObservableListContentProvider()); - viewer.setLabelProvider(new StyledCellLabelProvider() { - @Override - public void update(ViewerCell cell) { - ContributionData data = (ContributionData) cell.getElement(); - StyledString styledString = new StyledString(); - if ("show-bundles".equals(mode)) { //$NON-NLS-1$ - styledString.append(data.bundleName, StyledString.DECORATIONS_STYLER); - } else if ("show-packages".equals(mode)) { //$NON-NLS-1$ - int dot = data.className.lastIndexOf("."); //$NON-NLS-1$ - String packageName; - if (dot >= 0) { - packageName = data.className.substring(0, dot); - } else { - packageName = ""; //$NON-NLS-1$ - } - styledString.append(packageName, StyledString.DECORATIONS_STYLER); - } else if ("show-icons".equals(mode)) { //$NON-NLS-1$ - styledString.append(data.iconPath, null); - - if (data.bundleName != null) { - styledString.append(" - " + data.bundleName, StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ - } - - if (data.sourceType != null) { - styledString.append(" - ", StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ - styledString.append(data.sourceType + "", StyledString.COUNTER_STYLER); //$NON-NLS-1$ - } - - if (data.iconPath == null) { - cell.setImage(javaClassImage); - } - } else { - styledString.append(data.className, null); - - if (data.bundleName != null) { - styledString.append(" - " + data.bundleName, StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ - } - - if (data.sourceType != null) { - styledString.append(" - ", StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ - styledString.append(data.sourceType + "", StyledString.COUNTER_STYLER); //$NON-NLS-1$ - } - - if (data.iconPath == null) { - cell.setImage(javaClassImage); - } - } - - cell.setText(styledString.getString()); - cell.setStyleRanges(styledString.getStyleRanges()); - } - }); - viewer.addDoubleClickListener(new IDoubleClickListener() { - - @Override - public void doubleClick(DoubleClickEvent event) { - okPressed(); - } - }); - - final WritableList list = new WritableList(); - viewer.setInput(list); - - final ClassContributionCollector collector = getCollector(); - - t.addModifyListener(new ModifyListener() { - private ContributionResultHandlerImpl currentResultHandler; - - @Override - public void modifyText(ModifyEvent e) { - if (currentResultHandler != null) { - currentResultHandler.cancled = true; - } - list.clear(); - currentResultHandler = new ContributionResultHandlerImpl(list); - Filter filter = new Filter(project, t.getText()); - collector.findContributions(filter, currentResultHandler); - t.addKeyListener(new KeyAdapter() { - @Override - public void keyPressed(KeyEvent e) { - if (e.keyCode == SWT.ARROW_DOWN) { - if (viewer.getTable().getItemCount() > 0) { - viewer.getTable().setFocus(); - viewer.getTable().select(0); - } - } - } - }); - viewer.getTable().addKeyListener(new KeyAdapter() { - @Override - public void keyPressed(KeyEvent e) { - super.keyPressed(e); - if ((e.keyCode == SWT.ARROW_UP) && (viewer.getTable().getSelectionIndex() == 0)) { - t.setFocus(); - } - } - }); - } - }); - - viewer.setFilters(new ViewerFilter[] { new ViewerFilter() { - - @Override - public boolean select(Viewer viewer, Object parentElement, Object element) { - ContributionData cd = (ContributionData) element; - if ("show-bundles".equals(mode)) { //$NON-NLS-1$ - // only add first item from each bundle - boolean found = false; - for (Iterator<?> it = list.iterator(); it.hasNext();) { - ContributionData cd2 = (ContributionData) it.next(); - if (cd2.bundleName == null || cd2.bundleName.equals(cd.bundleName)) { - if (found == false) { - found = true; - } else { - return false; - } - } - } - return true; - } else if ("show-packages".equals(mode)) { //$NON-NLS-1$ - if (bundleFilter != null && bundleFilter.isEmpty() == false) { - if (!bundleFilter.equals(cd.bundleName)) { - return false; - } - } - String packageName; - int last = cd.className.lastIndexOf("."); //$NON-NLS-1$ - if (last >= 0) { - packageName = cd.className.substring(0, last); - } else { - packageName = ""; //$NON-NLS-1$ - } - // only add first item from each package - boolean found = false; - for (Iterator<?> it = list.iterator(); it.hasNext();) { - boolean matches = false; - ContributionData cd2 = (ContributionData) it.next(); - if (packageName.isEmpty() && cd2.className.contains(".") == false) { //$NON-NLS-1$ - matches = true; - } else if (cd2.className.startsWith(packageName + ".")) { //$NON-NLS-1$ - matches = true; - } - if (matches) { - if (found == false) { - found = true; - } else { - return false; - } - } - } - return true; - } else if ("show-icons".equals(mode)) { //$NON-NLS-1$ - if (cd.iconPath == null) { - return false; - } - if (bundleFilter != null && bundleFilter.isEmpty() == false) { - if (!bundleFilter.equals(cd.bundleName)) { - return false; - } - } - if (packageFilter != null && packageFilter.isEmpty() == false) { - if (!cd.className.startsWith(packageFilter + ".")) { //$NON-NLS-1$ - return false; - } - } - return true; - } else { - if (bundleFilter != null && bundleFilter.isEmpty() == false) { - if (!bundleFilter.equals(cd.bundleName)) { - return false; - } - } - if (packageFilter != null && packageFilter.isEmpty() == false) { - if (!cd.className.startsWith(packageFilter + ".")) { //$NON-NLS-1$ - return false; - } - } - - return true; - } - } - } }); - - StringBuilder sbFind = new StringBuilder(); - - if ("show-bundles".equals(mode)) { //$NON-NLS-1$ - setTitle(org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.Messages.FindContributionDialog_findBundle); - sbFind.append(org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.Messages.FindContributionDialog_findBundle); - } else if ("show-packages".equals(mode)) { //$NON-NLS-1$ - setTitle(org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.Messages.FindContributionDialog_findPackage); - sbFind.append(org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.Messages.FindContributionDialog_findPackage); - if (E.notEmpty(bundleFilter)) { - sbFind.append(" " + org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.Messages.FindContributionDialog_inBundle + " " + bundleFilter); //$NON-NLS-1$ //$NON-NLS-2$ - } - } else if ("show-icons".equals(mode)) { //$NON-NLS-1$ - setTitle(org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.Messages.FindContributionDialog_findIcon); - sbFind.append(org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.Messages.FindContributionDialog_findIcon); - if (E.notEmpty(bundleFilter)) { - sbFind.append(" " + org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.Messages.FindContributionDialog_inBundle + " " + bundleFilter); //$NON-NLS-1$ //$NON-NLS-2$ - } - if (E.notEmpty(packageFilter)) { - sbFind.append(" " + org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.Messages.FindContributionDialog_inPackage + " " + packageFilter); //$NON-NLS-1$ //$NON-NLS-2$ - } - } else { - setTitle(org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.Messages.FindContributionDialog_findClass); - sbFind.append(org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.Messages.FindContributionDialog_findClass); - if (E.notEmpty(bundleFilter)) { - sbFind.append(" " + org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.Messages.FindContributionDialog_inBundle + " " + bundleFilter); //$NON-NLS-1$ //$NON-NLS-2$ - } - if (E.notEmpty(packageFilter)) { - sbFind.append(" " + org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.Messages.FindContributionDialog_inPackage + " " + packageFilter); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - setMessage(sbFind.toString()); - - // preload list if few items - if (list.size() <= 30) { - t.notifyListeners(SWT.Modify, null); - } - return comp; - } - - @Override - protected void okPressed() { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (!s.isEmpty()) { - ContributionData cd = (ContributionData) s.getFirstElement(); - String uri = "bundleclass://" + cd.bundleName + "/" + cd.className; //$NON-NLS-1$ //$NON-NLS-2$ - platformUri = "platform:/plugin/" + cd.bundleName + "/" + cd.className; //$NON-NLS-1$ //$NON-NLS-2$ - setBundleclassUri(uri); - super.okPressed(); - } else { - super.cancelPressed(); - } - } - - private ClassContributionCollector getCollector() { - if (bundle == null) { - return null; - } - BundleContext context = bundle.getBundleContext(); - ServiceReference<?> ref = context.getServiceReference(ClassContributionCollector.class.getName()); - if (ref != null) { - return (ClassContributionCollector) context.getService(ref); - } - return null; - } - - public String getBundleclassUri() { - return bundleclassUri; - } - - public String getPlatformUri() { - return platformUri; - } - - public void setBundleclassUri(String bundleclass) { - this.bundleclassUri = bundleclass; - } - - private static class ContributionResultHandlerImpl implements ContributionResultHandler { - private boolean cancled = false; - private IObservableList list; - - public ContributionResultHandlerImpl(IObservableList list) { - this.list = list; - } - - @Override - public void result(ContributionData data) { - if (!cancled) { - list.add(data); - } - } - - @Override - public void moreResults(int hint, Filter filter) { - } - - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/FindIconDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/FindIconDialog.java deleted file mode 100644 index 4889711b..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/FindIconDialog.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 424730 - *******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.dialogs; - -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.AbstractIconDialogWithScopeAndFilter; -import org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.Messages; -import org.eclipse.swt.widgets.Shell; - -final class FindIconDialog extends AbstractIconDialogWithScopeAndFilter { - FindIconDialog(Shell parentShell, IEclipseContext context) { - super(parentShell, context); - } - - @Override - protected String getShellTitle() { - return Messages.FindIconDialog_findIcon; - } - - @Override - protected String getDialogTitle() { - return Messages.FindIconDialog_findIcon; - } - - @Override - protected String getDialogMessage() { - return Messages.FindIconDialog_searchByFilename; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/IconDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/IconDialog.java deleted file mode 100644 index 312364bc..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/IconDialog.java +++ /dev/null @@ -1,307 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. All rights reserved. This - * program and the accompanying materials are made available under the terms of - * the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 424730 - *******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.dialogs; - -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.AbstractIconDialogWithHardcodedScope; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.AbstractIconDialogWithScopeAndFilter; -import org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.Messages; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Link; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; -import org.eclipse.swt.widgets.ToolBar; -import org.eclipse.swt.widgets.ToolItem; -import org.osgi.framework.Bundle; -import org.osgi.framework.FrameworkUtil; - -/** - * A dialog for creating, editing, replacing, or removing a bundleclass. - * - * @author Steven Spungin - * - */ -public class IconDialog extends Dialog implements UriDialog { - private Text txtUri; - private Text txtBundle; - private Text txtIcon; - private Text txtPath; - public String uri = ""; //$NON-NLS-1$ - private String bundle = ""; //$NON-NLS-1$ - private String icon = ""; //$NON-NLS-1$ - private String path = ""; //$NON-NLS-1$ - protected boolean ignoreModify; - private IEclipseContext context; - - static Pattern patternIcon = Pattern.compile("platform:/plugin/*([^/]+)/((.*)/)?([^/]+)"); //$NON-NLS-1$ - - public IconDialog(Shell parentShell, IEclipseContext context) { - super(parentShell); - this.context = context; - } - - @Override - protected int getShellStyle() { - return super.getShellStyle() | SWT.RESIZE; - } - - @Override - protected void configureShell(Shell newShell) { - newShell.setText(Messages.IconDialog_uriEditor); - super.configureShell(newShell); - } - - @Override - protected Control createDialogArea(final Composite parent) { - Composite composite = new Composite(parent, SWT.NONE); - composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - composite.setLayout(new GridLayout(2, false)); - - ToolBar toolBar = new ToolBar(composite, SWT.NO_FOCUS); - toolBar.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1)); - - { - Label lbl = new Label(composite, SWT.NONE); - lbl.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false)); - lbl.setText(Messages.IconDialog_uri); - - txtUri = new Text(composite, SWT.SINGLE | SWT.LEAD | SWT.BORDER); - txtUri.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); - txtUri.setText("platform://plugin/"); //$NON-NLS-1$ - - txtUri.addModifyListener(new ModifyListener() { - - @Override - public void modifyText(ModifyEvent e) { - if (ignoreModify) { - return; - } - ignoreModify = true; - setUri(txtUri.getText()); - txtBundle.setText(bundle); - txtPath.setText(path); - txtIcon.setText(icon); - ignoreModify = false; - parent.pack(); - } - }); - } - - // common listener for text boxes - ModifyListener listener = new ModifyListener() { - - @Override - public void modifyText(ModifyEvent e) { - if (ignoreModify) { - return; - } - ignoreModify = true; - String prefix; - - prefix = "platform:/plugin/"; //$NON-NLS-1$ - setUri(prefix + txtBundle.getText() + "/" + txtPath.getText() + "/" + txtIcon.getText()); //$NON-NLS-1$//$NON-NLS-2$ - - txtUri.setText(getUri()); - ignoreModify = false; - } - }; - - { - Link lbl = new Link(composite, SWT.NONE); - lbl.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false)); - lbl.setText("<A>" + Messages.IconDialog_bundle + "</A>"); //$NON-NLS-1$ //$NON-NLS-2$ - - txtBundle = new Text(composite, SWT.SINGLE | SWT.LEAD | SWT.BORDER); - txtBundle.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); - txtBundle.addModifyListener(listener); - - lbl.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - IEclipseContext childCtx = context.createChild(); - childCtx.set(Bundle.class, FrameworkUtil.getBundle(FindContributionDialog.class)); - childCtx.set("bundle", getBundle()); //$NON-NLS-1$ - childCtx.set("package", getPath()); //$NON-NLS-1$ - childCtx.set("mode", "show-bundles"); //$NON-NLS-1$ //$NON-NLS-2$ - FindContributionDialog dlg = new FindContributionDialog(childCtx); - if (dlg.open() == Dialog.OK) { - String uri = getUri(dlg); - Matcher matcher = getMatcher(uri); - if (matcher.matches()) { - txtBundle.setText(matcher.group(1)); - } - } - } - }); - } - - { - Link lbl = new Link(composite, SWT.NONE); - lbl.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false)); - lbl.setText("path"); //$NON-NLS-1$ - - txtPath = new Text(composite, SWT.SINGLE | SWT.LEAD | SWT.BORDER); - txtPath.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); - txtPath.addModifyListener(listener); - } - - { - Link lbl = new Link(composite, SWT.NONE); - lbl.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false)); - lbl.setText("<A>" + Messages.IconDialog_icon + "</A>"); //$NON-NLS-1$ //$NON-NLS-2$ - - txtIcon = new Text(composite, SWT.SINGLE | SWT.LEAD | SWT.BORDER); - txtIcon.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); - txtIcon.addModifyListener(listener); - - lbl.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - IEclipseContext childCtx = context.createChild(); - childCtx.set(Bundle.class, FrameworkUtil.getBundle(FindContributionDialog.class)); - childCtx.set(Messages.IconDialog_bundle, getBundle()); - childCtx.set(Messages.IconDialog_folder, getPath()); - AbstractIconDialogWithHardcodedScope dlg = new AbstractIconDialogWithHardcodedScope(getParentShell(), childCtx) { - - @Override - protected String getShellTitle() { - return org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.Messages.IconDialog_selectIcon; - } - - @Override - protected String getDialogTitle() { - return org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.Messages.IconDialog_selectIcon_TITLE; - } - - @Override - protected String getDialogMessage() { - return org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.Messages.IconDialog_selectIcon_MESSAGE; - } - }; - if (dlg.open() == Dialog.OK) { - txtUri.setText(dlg.getValue()); - } - } - }); - } - - ToolItem btnFind = new ToolItem(toolBar, SWT.PUSH); - // btnFind.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, - // false, 2, 1)); - btnFind.setText(Messages.IconDialog_find + "..."); //$NON-NLS-1$ - btnFind.setImage(new Image(getShell().getDisplay(), getClass().getResourceAsStream("/icons/full/obj16/find.png"))); //$NON-NLS-1$ - btnFind.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - IEclipseContext childCtx = context.createChild(); - AbstractIconDialogWithScopeAndFilter dlg = new FindIconDialog(getParentShell(), childCtx); - if (dlg.open() == Dialog.OK) { - txtUri.setText(dlg.getValue()); - // getContents().pack(true); - getShell().pack(); - } - } - }); - - ToolItem btnRemove = new ToolItem(toolBar, SWT.PUSH); - // btnRemove.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, - // false, false, 2, 1)); - btnRemove.setText("Remove"); //$NON-NLS-1$ - btnRemove.setImage(new Image(getShell().getDisplay(), getClass().getResourceAsStream("/icons/full/obj16/remove_filter.png"))); //$NON-NLS-1$ - btnRemove.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - txtUri.setText(""); //$NON-NLS-1$ - close(); - } - }); - - txtUri.setText(uri); - txtBundle.setText(bundle); - txtIcon.setText(icon); - return composite; - } - - protected String getUri(FindContributionDialog dlg) { - return dlg.getPlatformUri(); - } - - @Override - public int open() { - int ret = super.open(); - return ret; - } - - @Override - public String getUri() { - return uri; - } - - @Override - public void setUri(String uri) { - this.uri = uri == null ? "" : uri.toString(); //$NON-NLS-1$ - Matcher matcher = getMatcher(this.uri); - if (matcher.matches()) { - bundle = matcher.group(1); - path = matcher.group(3); - if (path == null) { - path = ""; //$NON-NLS-1$ - } - icon = matcher.group(4); - } else { - bundle = ""; //$NON-NLS-1$ - path = ""; //$NON-NLS-1$ - icon = ""; //$NON-NLS-1$ - } - } - - protected String getBundle() { - return bundle; - } - - protected void setBundle(String bundle) { - this.bundle = bundle; - } - - protected String getIcon() { - return icon; - } - - protected void setIcon(String icon) { - this.icon = icon; - } - - protected String getPath() { - return path; - } - - protected void setPath(String pakage) { - this.path = pakage; - } - - private Matcher getMatcher(String uri) { - Matcher matcher; - matcher = patternIcon.matcher(uri); - return matcher; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/NonReferencedAction.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/NonReferencedAction.java deleted file mode 100644 index e3816c9f..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/NonReferencedAction.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation - *******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.dialogs; - -/** - * Actions used to resolve non referenced resource issues. - * - * @author Steven Spungin - * - */ -public enum NonReferencedAction { - REQUIRE, IMPORT, COPY, COPY_TO_OTHER, USE_ANYWAY, CONVERT_AND_REQUIRE -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/NonReferencedActionPage.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/NonReferencedActionPage.java deleted file mode 100644 index f84d3e03..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/NonReferencedActionPage.java +++ /dev/null @@ -1,502 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 437569, Ongoing Maintenance - *******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.dialogs; - -import java.io.BufferedInputStream; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.jar.Manifest; -import java.util.zip.ZipFile; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider.ContributionData; -import org.eclipse.e4.tools.emf.ui.common.Plugin; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.BundleImageCache; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionDataFile; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FilteredContributionDialog; -import org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.BundleConverter; -import org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.Messages; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.pde.internal.core.util.CoreUtility; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -/** - * This page displays information about a non-referenced resource along with - * actions to resolve issues. - * - * @author Steven Spungin - * - */ -public class NonReferencedActionPage extends WizardPage { - - private final IProject project; - private String bundle; - private final IFile file; - private final String installLocation; - private final IEclipseContext context; - private String className; - private final BundleImageCache imageCache; - - protected NonReferencedActionPage(IProject project, String bundle, IFile file, String installLocation, - IEclipseContext context) { - super(Messages.NonReferencedActionPage_NonreferencedResourceAction); - - this.project = project; - this.bundle = bundle; - this.file = file; - this.installLocation = installLocation; - this.context = context; - - imageCache = context.get(BundleImageCache.class); - - setImageDescriptor(ImageDescriptor.createFromImage(imageCache.create(Plugin.ID, - "/icons/full/wizban/newefix_wizban.png"))); //$NON-NLS-1$ - - if (bundle == null && installLocation != null) { - this.bundle = FilteredContributionDialog.getBundle(installLocation); - } - if (file instanceof ContributionDataFile) { - final ContributionDataFile cdf = (ContributionDataFile) file; - className = cdf.getContributionData().className; - } - - setTitle(Messages.NonReferencedActionPage_NonreferencedResourceAction); - setMessage(Messages.NonReferencedActionPage_NonreferencedResourceAction); - } - - @Override - public void setDescription(String description) { - super.setDescription(description); - super.setMessage(description); - } - - @Override - public void createControl(Composite compParent) { - final Composite comp = new Composite(compParent, SWT.NONE); - final GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true); - layoutData.horizontalSpan = 2; - comp.setLayoutData(layoutData); - comp.setLayout(new GridLayout(2, false)); - - final String message = ""; //$NON-NLS-1$ - Button defaultButton = null; - - if (installLocation != null) { - final Label label = new Label(comp, SWT.NONE); - label.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); - label.setText(Messages.NonReferencedResourceDialog_installLocation); - - final Text label2 = new Text(comp, SWT.SINGLE | SWT.LEAD | SWT.READ_ONLY); - label2.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); - label2.setText(installLocation); - } - - if (className != null) { - final ContributionData cd = ((ContributionDataFile) file).getContributionData(); - final Label label = new Label(comp, SWT.NONE); - label.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); - label.setText(Messages.NonReferencedResourceDialog_2); - - final Text label2 = new Text(comp, SWT.SINGLE | SWT.LEAD | SWT.READ_ONLY); - label2.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); - if (bundle != null) { - label2.setText(bundle); - } else { - label2.setText(Messages.NonReferencedResourceDialog__ast_notInABundle_ast); - } - - final Label label3 = new Label(comp, SWT.NONE); - label3.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); - label3.setText(Messages.NonReferencedResourceDialog_package); - - final Text label4 = new Text(comp, SWT.SINGLE | SWT.LEAD | SWT.READ_ONLY); - label4.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); - label4.setText(getPackageFromClassName(className)); - - final Label label5 = new Label(comp, SWT.NONE); - label5.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); - label5.setText(Messages.NonReferencedResourceDialog_class); - - final Text label6 = new Text(comp, SWT.SINGLE | SWT.LEAD | SWT.READ_ONLY); - label6.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); - label6.setText(cd.className.substring(cd.className.lastIndexOf('.') + 1)); - - if (bundle != null) { - final Label label7 = new Label(comp, SWT.NONE); - label7.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); - label7.setText(Messages.NonReferencedResourceDialog_url); - - final Text label8 = new Text(comp, SWT.SINGLE | SWT.LEAD | SWT.READ_ONLY); - label8.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); - label8.setText("bundleclass://" + bundle + "/" + className); //$NON-NLS-1$ //$NON-NLS-2$ - } - } else { - final Label label = new Label(comp, SWT.NONE); - label.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); - label.setText(Messages.NonReferencedResourceDialog_bundle); - - final Text label2 = new Text(comp, SWT.SINGLE | SWT.LEAD | SWT.READ_ONLY); - label2.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); - if (bundle != null) { - label2.setText(bundle); - } else { - label2.setText(Messages.NonReferencedResourceDialog_ast_notInABundle_ast); - } - - final Label label7 = new Label(comp, SWT.NONE); - label7.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); - label7.setText(Messages.NonReferencedResourceDialog_directory); - - final Text label8 = new Text(comp, SWT.SINGLE | SWT.LEAD | SWT.READ_ONLY); - label8.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); - label8.setText(file.getFullPath().removeFirstSegments(1).removeLastSegments(1).toOSString()); - - final Label label3 = new Label(comp, SWT.NONE); - label3.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); - label3.setText(Messages.NonReferencedResourceDialog_resource); - - final Text label4 = new Text(comp, SWT.SINGLE | SWT.LEAD | SWT.READ_ONLY); - label4.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); - label4.setText(file.getFullPath().lastSegment()); - - if (bundle != null) { - final Label label5 = new Label(comp, SWT.NONE); - label5.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); - label5.setText(Messages.NonReferencedResourceDialog_url); - - final Text label6 = new Text(comp, SWT.SINGLE | SWT.LEAD | SWT.READ_ONLY); - label6.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); - label6 - .setText("platform:/plugin/" + bundle + "/" + file.getFullPath().removeFirstSegments(1).toOSString()); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - final Label lblMessage = new Label(comp, SWT.NONE); - lblMessage.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 0)); - lblMessage.setText(message); - - final Group group = new Group(comp, SWT.NONE); - group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 0)); - group.setLayout(new GridLayout(1, false)); - group.setText(Messages.NonReferencedActionPage_Action); - - if (bundle != null) { - final Button btnRequire = new Button(group, SWT.RADIO); - btnRequire.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); - btnRequire.setText(Messages.NonReferencedResourceDialog_requireBundle); - btnRequire.setImage(imageCache.loadFromKey(ResourceProvider.IMG_Obj16_bundle)); - btnRequire.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (btnRequire.getSelection()) { - final Runnable okAction = new Runnable() { - - @Override - public void run() { - doRequireBundle(bundle, installLocation); - } - }; - setAction(NonReferencedAction.REQUIRE, okAction); - } - } - }); - defaultButton = btnRequire; - } - - // make sure className is not in the default package (contains '.') - if (className != null && bundle != null && className.contains(".")) { //$NON-NLS-1$ - final Button btnImport = new Button(group, SWT.RADIO); - btnImport.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); - btnImport.setText(Messages.NonReferencedResourceDialog_importPackage); - btnImport.setImage(imageCache.create("/icons/full/obj16/package_obj.gif")); //$NON-NLS-1$ - btnImport.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (btnImport.getSelection()) { - final Runnable okAction = new Runnable() { - @Override - public void run() { - final IFile fileManifest = project.getFile("META-INF/MANIFEST.MF"); //$NON-NLS-1$ - Manifest manifest; - try { - manifest = new Manifest(fileManifest.getContents()); - String value = manifest.getMainAttributes().getValue("Import-Package"); //$NON-NLS-1$ - - final String packageName = getPackageFromClassName(className); - // TODO ensure the packageName is not - // already in the manifest (although it - // should not be if we are here) - if (value == null) { - value = packageName; - } else { - value += "," + packageName; //$NON-NLS-1$ - } - manifest.getMainAttributes().putValue("Import-Package", value); //$NON-NLS-1$ - final ByteArrayOutputStream bos = new ByteArrayOutputStream(); - manifest.write(bos); - final ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray()); - fileManifest.setContents(bis, true, true, null); - context.set("resolvedFile", file); //$NON-NLS-1$ - } catch (final Exception e) { - e.printStackTrace(); - } - } - }; - setAction(NonReferencedAction.IMPORT, okAction); - } - } - }); - } - - if (bundle != null) { - final Button btnUseAnyway = new Button(group, SWT.RADIO); - btnUseAnyway.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); - btnUseAnyway.setText(Messages.NonReferencedResourceDialog_useAnyway); - btnUseAnyway.setImage(imageCache.create("/icons/full/obj16/use_anyway.gif")); //$NON-NLS-1$ - btnUseAnyway.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (btnUseAnyway.getSelection()) { - setAction(NonReferencedAction.USE_ANYWAY, new Runnable() { - @Override - public void run() { - context.set("resolvedFile", file); //$NON-NLS-1$ - } - }); - } - } - }); - - } else { - if (file instanceof ContributionDataFile) { - final ContributionDataFile cdf = (ContributionDataFile) file; - final Button btnConvertToBundle = new Button(group, SWT.RADIO); - defaultButton = btnConvertToBundle; - btnConvertToBundle.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); - btnConvertToBundle.setText(Messages.NonReferencedResourceDialog_convertAndRequire); - btnConvertToBundle.setImage(imageCache.create("/icons/full/obj16/bundle.png")); //$NON-NLS-1$ - btnConvertToBundle.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (btnConvertToBundle.getSelection()) { - final Runnable okAction = new Runnable() { - - @Override - public void run() { - String bundleId; - try { - final ContributionData contributionData = cdf.getContributionData(); - bundleId = BundleConverter.convertProjectToBundle( - contributionData.installLocation, project.getWorkspace()); - if (bundleId != null) { - - final ContributionData cdConverted = new ContributionData(bundleId, - contributionData.className, contributionData.sourceType, - contributionData.iconPath); - cdConverted.installLocation = installLocation; - cdConverted.resourceRelativePath = Path - .fromOSString(contributionData.iconPath).removeFirstSegments(1) - .toOSString(); - doRequireBundle(bundleId, installLocation); - context.set("resolvedFile", new ContributionDataFile(cdConverted)); //$NON-NLS-1$ - } - } catch (final Exception e1) { - MessageDialog.openError(getShell(), Messages.NonReferencedResourceDialog_error, - e1.getMessage()); - } - } - }; - setAction(NonReferencedAction.CONVERT_AND_REQUIRE, okAction); - } - } - }); - } - } - - if (className == null) { - final Button btnCopy = new Button(group, SWT.RADIO); - defaultButton = btnCopy; - btnCopy.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); - btnCopy.setText(Messages.NonReferencedResourceDialog_copyToThisProject); - btnCopy.setImage(imageCache.create("/icons/full/obj16/copy_to_project.png")); //$NON-NLS-1$ - btnCopy.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (btnCopy.getSelection()) { - final Runnable okAction = new Runnable() { - - @Override - public void run() { - copyResourceToProject(); - } - }; - context.set("projectToCopyTo", project); //$NON-NLS-1$ - setAction(NonReferencedAction.COPY, okAction); - } - } - }); - } - - if (className == null) { - final Button btnCopy2 = new Button(group, SWT.RADIO); - btnCopy2.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); - btnCopy2.setText(Messages.NonReferencedResourceDialog_copyToReferenedProject); - btnCopy2.setImage(imageCache.create("/icons/full/obj16/copy_to_project.png")); //$NON-NLS-1$ - btnCopy2.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (btnCopy2.getSelection()) { - - final Runnable okAction = new Runnable() { - - @Override - public void run() { - copyResourceToProject(); - } - }; - setAction(NonReferencedAction.COPY_TO_OTHER, okAction); - } - } - }); - } - - if (defaultButton != null) { - defaultButton.setSelection(true); - defaultButton.notifyListeners(SWT.Selection, new Event()); - } - - comp.setFocus(); - setControl(comp); - - } - - protected void setAction(NonReferencedAction action, Runnable runnable) { - context.set(NonReferencedAction.class, action); - context.set(Runnable.class, runnable); - if (getContainer().getCurrentPage() != null) { - getContainer().updateButtons(); - } - } - - public void copyResourceToProject() { - final IProject project = (IProject) context.get("projectToCopyTo"); //$NON-NLS-1$ - final String path = (String) context.get("folderToCopyTo"); //$NON-NLS-1$ - try { - // String filename = ((ContributionDataFile) - // file).getContributionData().className + ".class"; - IPath newPath = Path.fromOSString(path); - if (newPath.isEmpty() == false) { - CoreUtility.createFolder(project.getFolder(newPath)); - } - if (className != null) { - newPath.append(className + ".class"); //$NON-NLS-1$ - } else { - final String name = file.getFullPath().lastSegment(); - newPath = newPath.append(name); - } - final IFile fileClone = project.getFile(newPath); - fileClone.create(file.getContents(), false, null); - context.set("resolvedFile", fileClone); //$NON-NLS-1$ - } catch (final CoreException e1) { - e1.printStackTrace(); - MessageDialog.openError(getShell(), "Error", e1.getMessage()); //$NON-NLS-1$ - } - } - - public void doRequireBundle(String bundle, String installLocation) { - - // Get source bundle version from manifest - String version = null; - InputStream srcStream = null; - try { - Manifest manifestSource; - if (installLocation.endsWith(".jar")) { //$NON-NLS-1$ - final ZipFile zip = new ZipFile(installLocation); - srcStream = zip.getInputStream(zip.getEntry("META-INF/MANIFEST.MF")); //$NON-NLS-1$ - manifestSource = new Manifest(srcStream); - zip.close(); - } else { - srcStream = new BufferedInputStream(new FileInputStream(installLocation + "/META-INF/MANIFEST.MF")); //$NON-NLS-1$ - manifestSource = new Manifest(srcStream); - } - version = manifestSource.getMainAttributes().getValue("Bundle-Version"); //$NON-NLS-1$ - if (version != null) { - version = version.replaceFirst("\\.qualifier", ""); //$NON-NLS-1$ //$NON-NLS-2$ - } - } catch (final Exception e) { - e.printStackTrace(); - return; - } finally { - try { - srcStream.close(); - } catch (final Exception e) { - } - } - - final IFile fileManifest = project.getFile("META-INF/MANIFEST.MF"); //$NON-NLS-1$ - Manifest manifest; - try { - manifest = new Manifest(fileManifest.getContents()); - String value = manifest.getMainAttributes().getValue("Require-Bundle"); //$NON-NLS-1$ - if (value == null) { - manifest.getMainAttributes().putValue("Require-Bundle", bundle); //$NON-NLS-1$ - } else { - value += "," + bundle; //$NON-NLS-1$ - if (version != null) { - value += ";bundle-version=" + version; //$NON-NLS-1$ - } - manifest.getMainAttributes().putValue("Require-Bundle", value); //$NON-NLS-1$ - } - final ByteArrayOutputStream bos = new ByteArrayOutputStream(); - manifest.write(bos); - // StringReader reader = new - final ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray()); - fileManifest.setContents(bis, true, true, null); - context.set("resolvedFile", file); //$NON-NLS-1$ - } catch (final IOException e1) { - e1.printStackTrace(); - } catch (final CoreException e1) { - e1.printStackTrace(); - } - } - - // @Refactor - static public String getPackageFromClassName(String className) { - final int index = className.lastIndexOf('.'); - if (index >= 0) { - return className.substring(0, index); - } - return ""; //$NON-NLS-1$ - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/NonReferencedResourceDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/NonReferencedResourceDialog.java deleted file mode 100644 index 969c9260..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/NonReferencedResourceDialog.java +++ /dev/null @@ -1,531 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 424730, Ongoing Maintenance - *******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.dialogs; - -import java.io.BufferedInputStream; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.jar.Manifest; -import java.util.zip.ZipFile; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider.ContributionData; -import org.eclipse.e4.tools.emf.ui.common.Plugin; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.BundleImageCache; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionDataFile; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FilteredContributionDialog; -import org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.BundleConverter; -import org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.Messages; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.dialogs.TitleAreaDialog; -import org.eclipse.pde.internal.core.util.CoreUtility; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; - -public class NonReferencedResourceDialog extends TitleAreaDialog { - private String bundle; - private final IFile file; - private IFile result; - private final IProject project; - private String className; - private final String installLocation; - protected Runnable okAction; - private BundleImageCache imageCache; - private final IEclipseContext context; - - public NonReferencedResourceDialog(Shell parentShell, IProject project, String bundle, IFile file, - String installLocation, IEclipseContext context) { - super(parentShell); - this.project = project; - this.bundle = bundle; - this.file = file; - this.installLocation = installLocation; - this.context = context; - - if (bundle == null && installLocation != null) { - this.bundle = FilteredContributionDialog.getBundle(installLocation); - } - if (file instanceof ContributionDataFile) { - final ContributionDataFile cdf = (ContributionDataFile) file; - className = cdf.getContributionData().className; - } - } - - @Override - protected void okPressed() { - if (okAction != null) { - try { - okAction.run(); - super.okPressed(); - } catch (final Exception e) { - } - } else { - super.okPressed(); - } - } - - @Override - protected Control createDialogArea(Composite parent) { - final Composite compParent = (Composite) super.createDialogArea(parent); - - final Composite comp = new Composite(compParent, SWT.NONE); - final GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true); - layoutData.horizontalSpan = 2; - comp.setLayoutData(layoutData); - comp.setLayout(new GridLayout(2, false)); - - final String message = ""; //$NON-NLS-1$ - Button defaultButton = null; - - if (installLocation != null) { - final Label label = new Label(comp, SWT.NONE); - label.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); - label.setText(Messages.NonReferencedResourceDialog_installLocation); - - final Text label2 = new Text(comp, SWT.SINGLE | SWT.LEAD | SWT.READ_ONLY); - label2.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); - label2.setText(installLocation); - } - - if (className != null) { - final ContributionData cd = ((ContributionDataFile) file).getContributionData(); - final Label label = new Label(comp, SWT.NONE); - label.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); - label.setText(Messages.NonReferencedResourceDialog_2); - - final Text label2 = new Text(comp, SWT.SINGLE | SWT.LEAD | SWT.READ_ONLY); - label2.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); - if (bundle != null) { - label2.setText(bundle); - } else { - label2.setText(Messages.NonReferencedResourceDialog__ast_notInABundle_ast); - } - - final Label label3 = new Label(comp, SWT.NONE); - label3.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); - label3.setText(Messages.NonReferencedResourceDialog_package); - - final Text label4 = new Text(comp, SWT.SINGLE | SWT.LEAD | SWT.READ_ONLY); - label4.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); - label4.setText(getPackageFromClassName(className)); - - final Label label5 = new Label(comp, SWT.NONE); - label5.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); - label5.setText(Messages.NonReferencedResourceDialog_class); - - final Text label6 = new Text(comp, SWT.SINGLE | SWT.LEAD | SWT.READ_ONLY); - label6.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); - label6.setText(cd.className.substring(cd.className.lastIndexOf('.') + 1)); - - if (bundle != null) { - final Label label7 = new Label(comp, SWT.NONE); - label7.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); - label7.setText(Messages.NonReferencedResourceDialog_url); - - final Text label8 = new Text(comp, SWT.SINGLE | SWT.LEAD | SWT.READ_ONLY); - label8.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); - label8.setText("bundleclass://" + bundle + "/" + className); //$NON-NLS-1$ //$NON-NLS-2$ - } - } else { - final Label label = new Label(comp, SWT.NONE); - label.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); - label.setText(Messages.NonReferencedResourceDialog_bundle); - - final Text label2 = new Text(comp, SWT.SINGLE | SWT.LEAD | SWT.READ_ONLY); - label2.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); - if (bundle != null) { - label2.setText(bundle); - } else { - label2.setText(Messages.NonReferencedResourceDialog_ast_notInABundle_ast); - } - - final Label label7 = new Label(comp, SWT.NONE); - label7.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); - label7.setText(Messages.NonReferencedResourceDialog_directory); - - final Text label8 = new Text(comp, SWT.SINGLE | SWT.LEAD | SWT.READ_ONLY); - label8.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); - label8.setText(file.getFullPath().removeFirstSegments(1).removeLastSegments(1).toOSString()); - - final Label label3 = new Label(comp, SWT.NONE); - label3.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); - label3.setText(Messages.NonReferencedResourceDialog_resource); - - final Text label4 = new Text(comp, SWT.SINGLE | SWT.LEAD | SWT.READ_ONLY); - label4.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); - label4.setText(file.getFullPath().lastSegment()); - - if (bundle != null) { - final Label label5 = new Label(comp, SWT.NONE); - label5.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); - label5.setText(Messages.NonReferencedResourceDialog_url); - - final Text label6 = new Text(comp, SWT.SINGLE | SWT.LEAD | SWT.READ_ONLY); - label6.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); - label6 - .setText("platform:/plugin/" + bundle + "/" + file.getFullPath().removeFirstSegments(1).toOSString()); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - final Label lblMessage = new Label(comp, SWT.NONE); - lblMessage.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 0)); - lblMessage.setText(message); - - final Group group = new Group(comp, SWT.NONE); - group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 0)); - group.setLayout(new GridLayout(1, false)); - group.setText(Messages.NonReferencedResourceDialog_Action); - - if (bundle != null) { - final Button btnRequire = new Button(group, SWT.RADIO); - btnRequire.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); - btnRequire.setText(Messages.NonReferencedResourceDialog_requireBundle); - btnRequire.setImage(imageCache.loadFromKey(ResourceProvider.IMG_Obj16_bundle)); - btnRequire.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (btnRequire.getSelection()) { - okAction = new Runnable() { - - @Override - public void run() { - doRequireBundle(bundle, installLocation); - } - }; - } - } - }); - defaultButton = btnRequire; - } - - // make sure className is not in the default package (contains '.') - if (className != null && bundle != null && className.contains(".")) { //$NON-NLS-1$ - final Button btnImport = new Button(group, SWT.RADIO); - btnImport.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); - btnImport.setText(Messages.NonReferencedResourceDialog_importPackage); - btnImport.setImage(imageCache.create("/icons/full/obj16/package_obj.gif")); //$NON-NLS-1$ - btnImport.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (btnImport.getSelection()) { - okAction = new Runnable() { - @Override - public void run() { - final IFile fileManifest = project.getFile("META-INF/MANIFEST.MF"); //$NON-NLS-1$ - Manifest manifest; - try { - manifest = new Manifest(fileManifest.getContents()); - String value = manifest.getMainAttributes().getValue("Import-Package"); //$NON-NLS-1$ - - final String packageName = getPackageFromClassName(className); - // TODO ensure the packageName is not - // already in the manifest (although it - // should not be if we are here) - if (value == null) { - value = packageName; - } else { - value += "," + packageName; //$NON-NLS-1$ - } - manifest.getMainAttributes().putValue("Import-Package", value); //$NON-NLS-1$ - final ByteArrayOutputStream bos = new ByteArrayOutputStream(); - manifest.write(bos); - final ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray()); - fileManifest.setContents(bis, true, true, null); - result = file; - } catch (final Exception e) { - e.printStackTrace(); - } - } - }; - } - } - }); - } - - if (bundle != null) { - final Button btnUseAnyway = new Button(group, SWT.RADIO); - btnUseAnyway.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); - btnUseAnyway.setText(Messages.NonReferencedResourceDialog_useAnyway); - btnUseAnyway.setImage(imageCache.create("/icons/full/obj16/use_anyway.gif")); //$NON-NLS-1$ - btnUseAnyway.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (btnUseAnyway.getSelection()) { - result = file; - okAction = null; - } - } - }); - - } else { - if (file instanceof ContributionDataFile) { - final ContributionDataFile cdf = (ContributionDataFile) file; - final Button btnConvertToBundle = new Button(group, SWT.RADIO); - btnConvertToBundle.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); - btnConvertToBundle.setText(Messages.NonReferencedResourceDialog_convertAndRequire); - btnConvertToBundle.setImage(imageCache.create("/icons/full/obj16/bundle.png")); //$NON-NLS-1$ - btnConvertToBundle.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (btnConvertToBundle.getSelection()) { - okAction = new Runnable() { - - @Override - public void run() { - String bundleId; - try { - final ContributionData contributionData = cdf.getContributionData(); - bundleId = BundleConverter.convertProjectToBundle( - contributionData.installLocation, project.getWorkspace()); - if (bundleId != null) { - - final ContributionData cdConverted = new ContributionData(bundleId, - contributionData.className, contributionData.sourceType, - contributionData.iconPath); - cdConverted.installLocation = installLocation; - cdConverted.resourceRelativePath = Path - .fromOSString(contributionData.iconPath).removeFirstSegments(1) - .toOSString(); - doRequireBundle(bundleId, installLocation); - result = new ContributionDataFile(cdConverted); - } - } catch (final Exception e1) { - MessageDialog.openError(getShell(), Messages.NonReferencedResourceDialog_error, - e1.getMessage()); - } - } - }; - } - } - }); - } - } - - if (className == null) { - final Button btnCopy = new Button(group, SWT.RADIO); - defaultButton = btnCopy; - btnCopy.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); - btnCopy.setText(Messages.NonReferencedResourceDialog_copyToThisProject); - btnCopy.setImage(imageCache.create("/icons/full/obj16/copy_to_project.png")); //$NON-NLS-1$ - btnCopy.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (btnCopy.getSelection()) { - okAction = new Runnable() { - - @Override - public void run() { - copyResourceToProject(project); - } - }; - } - } - }); - } - - if (className == null) { - final Button btnCopy2 = new Button(group, SWT.RADIO); - btnCopy2.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); - btnCopy2.setText(Messages.NonReferencedResourceDialog_copyToReferenedProject); - btnCopy2.setImage(imageCache.create("/icons/full/obj16/copy_to_project.png")); //$NON-NLS-1$ - btnCopy2.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (btnCopy2.getSelection()) { - okAction = new Runnable() { - - @Override - public void run() { - final ReferencedProjectPickerDialog dlg = new ReferencedProjectPickerDialog(getShell(), - project) { - @Override - protected Control createContents(Composite parent) { - final Control ret = super.createContents(parent); - setMessage(Messages.NonReferencedResourceDialog_selectProjectToReceiveCopy); - setTitleImage(imageCache.create("/icons/full/wizban/plugin_wiz.gif")); //$NON-NLS-1$ - - return ret; - } - }; - if (dlg.open() == IDialogConstants.OK_ID) { - copyResourceToProject((IProject) dlg.getFirstElement()); - } - } - }; - } - } - }); - } - - if (defaultButton != null) { - defaultButton.setSelection(true); - defaultButton.notifyListeners(SWT.Selection, new Event()); - } - return comp; - } - - // @Refactor - static public String getPackageFromClassName(String className) { - final int index = className.lastIndexOf('.'); - if (index >= 0) { - return className.substring(0, index); - } - return ""; //$NON-NLS-1$ - } - - @Override - protected Control createContents(Composite parent) { - imageCache = new BundleImageCache(parent.getDisplay(), getClass().getClassLoader(), context); - getShell().addDisposeListener(new DisposeListener() { - - @Override - public void widgetDisposed(DisposeEvent e) { - imageCache.dispose(); - } - }); - - final Control ret = super.createContents(parent); - setMessage(Messages.NonReferencedResourceDialog_resourceNotReferenced); - final String message = getMessage(); - setMessage(message); - setTitle(Messages.NonReferencedResourceDialog_resourceReferenceWarning); - getShell().setText(Messages.NonReferencedResourceDialog_resourceReferenceWarning); - try { - setTitleImage(imageCache.create(Plugin.ID, "/icons/full/wizban/newefix_wizban.png")); //$NON-NLS-1$ - } catch (final Exception e) { - e.printStackTrace(); - } - return ret; - } - - public IFile getResult() { - return result; - } - - public void copyResourceToProject(IProject project) { - try { - final ProjectFolderPickerDialog dlg = new ProjectFolderPickerDialog(getShell(), project, file.getFullPath() - .toOSString()) { - @Override - protected Control createContents(Composite parent) { - final Control ret = super.createContents(parent); - setMessage(Messages.NonReferencedResourceDialog_selectTheFolderResourceCopy); - setTitleImage(imageCache.create(Plugin.ID, "/icons/full/wizban/add_to_dir_wiz.png")); //$NON-NLS-1$ - - return ret; - } - }; - - if (dlg.open() == IDialogConstants.OK_ID) { - // String filename = ((ContributionDataFile) - // file).getContributionData().className + ".class"; - IPath newPath = Path.fromOSString(dlg.getValue()); - if (newPath.isEmpty() == false) { - CoreUtility.createFolder(project.getFolder(newPath)); - } - if (className != null) { - newPath.append(className + ".class"); //$NON-NLS-1$ - } else { - final String name = file.getFullPath().lastSegment(); - newPath = newPath.append(name); - } - final IFile fileClone = project.getFile(newPath); - fileClone.create(file.getContents(), false, null); - result = fileClone; - } - } catch (final CoreException e1) { - e1.printStackTrace(); - MessageDialog.openError(getShell(), "Error", e1.getMessage()); //$NON-NLS-1$ - - } - } - - public void doRequireBundle(String bundle, String installLocation) { - - // Get source bundle version from manifest - String version = null; - InputStream srcStream = null; - try { - Manifest manifestSource; - if (installLocation.endsWith(".jar")) { //$NON-NLS-1$ - final ZipFile zip = new ZipFile(installLocation); - srcStream = zip.getInputStream(zip.getEntry("META-INF/MANIFEST.MF")); //$NON-NLS-1$ - manifestSource = new Manifest(srcStream); - zip.close(); - } else { - srcStream = new BufferedInputStream(new FileInputStream(installLocation + "/META-INF/MANIFEST.MF")); //$NON-NLS-1$ - manifestSource = new Manifest(srcStream); - } - version = manifestSource.getMainAttributes().getValue("Bundle-Version"); //$NON-NLS-1$ - if (version != null) { - version = version.replaceFirst("\\.qualifier", ""); //$NON-NLS-1$ //$NON-NLS-2$ - } - } catch (final Exception e) { - e.printStackTrace(); - return; - } finally { - try { - srcStream.close(); - } catch (final Exception e) { - } - } - - final IFile fileManifest = project.getFile("META-INF/MANIFEST.MF"); //$NON-NLS-1$ - Manifest manifest; - try { - manifest = new Manifest(fileManifest.getContents()); - String value = manifest.getMainAttributes().getValue("Require-Bundle"); //$NON-NLS-1$ - if (value == null) { - manifest.getMainAttributes().putValue("Require-Bundle", bundle); //$NON-NLS-1$ - } else { - value += "," + bundle; //$NON-NLS-1$ - if (version != null) { - value += ";bundle-version=" + version; //$NON-NLS-1$ - } - manifest.getMainAttributes().putValue("Require-Bundle", value); //$NON-NLS-1$ - } - final ByteArrayOutputStream bos = new ByteArrayOutputStream(); - manifest.write(bos); - // StringReader reader = new - final ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray()); - fileManifest.setContents(bis, true, true, null); - result = file; - } catch (final IOException e1) { - e1.printStackTrace(); - } catch (final CoreException e1) { - e1.printStackTrace(); - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/NonReferencedResourceWizard.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/NonReferencedResourceWizard.java deleted file mode 100644 index 5868da52..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/NonReferencedResourceWizard.java +++ /dev/null @@ -1,115 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 436848 - *******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.dialogs; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.BundleImageCache; -import org.eclipse.jface.wizard.IWizardPage; -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.widgets.Shell; - -/** - * A Wizard for resolving unreferenced resources - * - * @author Steven Spungin - * - */ -public class NonReferencedResourceWizard extends DynamicWizard { - - private final NonReferencedActionPage nonReferencedActionPage; - protected IProject project; - IEclipseContext wizContext; - - BundleImageCache imageCache; - - public NonReferencedResourceWizard(Shell parentShell, IProject project, String bundle, IFile file, - String installLocation, IEclipseContext context) { - this.project = project; - - wizContext = context.createChild(); - wizContext.set(IProject.class, project); - wizContext.set("srcPath", file.getFullPath().toOSString()); //$NON-NLS-1$ - wizContext.set(Runnable.class, null); - wizContext.set("resolvedFile", null); //$NON-NLS-1$ - - imageCache = new BundleImageCache(parentShell.getDisplay(), getClass().getClassLoader(), context); - parentShell.addDisposeListener(new DisposeListener() { - - @Override - public void widgetDisposed(DisposeEvent e) { - imageCache.dispose(); - } - }); - wizContext.set(BundleImageCache.class, imageCache); - - nonReferencedActionPage = new NonReferencedActionPage(project, bundle, file, installLocation, wizContext); - } - - @Override - public boolean performFinish() { - final Runnable action = wizContext.get(Runnable.class); - if (action != null) { - action.run(); - } - return true; - } - - public IFile getResult() { - return (IFile) wizContext.get("resolvedFile"); //$NON-NLS-1$ - } - - @Override - public IWizardPage getNextPage(IWizardPage page) { - if (page instanceof NonReferencedActionPage) { - clearDynamicPages(); - final NonReferencedAction action = wizContext.get(NonReferencedAction.class); - if (action == null) { - return null; - } - switch (action) { - case COPY: { - final PickProjectFolderPage pickProjectFolderPage = new PickProjectFolderPage(wizContext); - addPage(pickProjectFolderPage); - return pickProjectFolderPage; - } - case COPY_TO_OTHER: - final PickProjectPage pickProjectPage = new PickProjectPage(wizContext); - addPage(pickProjectPage); - final PickProjectFolderPage pickProjectFolderPage = new PickProjectFolderPage(wizContext); - addPage(pickProjectFolderPage); - return pickProjectPage; - case USE_ANYWAY: - return null; - case IMPORT: - // TODO Page to set version - return null; - case REQUIRE: - // TODO Page to set version - return null; - case CONVERT_AND_REQUIRE: - // TODO Page for new bundle's information - return null; - default: - return null; - } - } - return super.getNextPage(page); - } - - @Override - public void addPages() { - addPage(nonReferencedActionPage); - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/PickProjectFolderPage.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/PickProjectFolderPage.java deleted file mode 100644 index d374dc85..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/PickProjectFolderPage.java +++ /dev/null @@ -1,156 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation, Ongoing Maintenance - *******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.dialogs; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.BundleImageCache; -import org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.Messages; -import org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.dialogs.ProjectFolderPickerDialog.ProjectContentProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.dialogs.ProjectFolderPickerDialog.ProjectLabelProvider; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.DoubleClickEvent; -import org.eclipse.jface.viewers.IDoubleClickListener; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; - -/** - * Wizard page to select a project folder - * - * @author Steven Spungin - * - */ -public class PickProjectFolderPage extends WizardPage { - - private TreeViewer viewer; - private String value; - private IEclipseContext context; - private IPath path; - - private Label label2; - private Label label3; - private Label lblResourcePath; - - protected PickProjectFolderPage(IEclipseContext context) { - super(Messages.PickProjectFolderPage_SelectProjectFolder, Messages.PickProjectFolderPage_SelectProjectFolder, null); - this.context = context; - - setMessage(Messages.NonReferencedResourceDialog_selectProjectToReceiveCopy); - Image image = context.get(BundleImageCache.class).create("/icons/full/wizban/plugin_wiz.gif"); //$NON-NLS-1$ - setImageDescriptor(ImageDescriptor.createFromImage(image)); - setPageComplete(false); - } - - @Override - public void createControl(Composite parent) { - // TODO Auto-generated method stub - Composite ret = new Composite(parent, SWT.NONE); - // ret.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - ret.setLayout(new GridLayout(1, false)); - - viewer = new TreeViewer(ret); - viewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH)); - viewer.setContentProvider(new ProjectContentProvider()); - viewer.setLabelProvider(new ProjectLabelProvider()); - viewer.expandToLevel(2); - - viewer.addDoubleClickListener(new IDoubleClickListener() { - - @Override - public void doubleClick(DoubleClickEvent event) { - onChanged(); - } - }); - - viewer.addSelectionChangedListener(new ISelectionChangedListener() { - - @Override - public void selectionChanged(SelectionChangedEvent event) { - onChanged(); - } - }); - - Composite compPath = new Composite(ret, SWT.NONE); - compPath.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - compPath.setLayout(new GridLayout(2, false)); - - Label label = new Label(compPath, SWT.NONE); - label.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); - label.setText(Messages.ProjectFolderPickerDialog_sourceResourceName); - - label2 = new Label(compPath, SWT.NONE); - label2.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); - - label3 = new Label(compPath, SWT.NONE); - label3.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); - - lblResourcePath = new Label(compPath, SWT.NONE); - lblResourcePath.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); - - compPath.setVisible(false); - - String message = Messages.ProjectFolderPickerDialog_6; - - getShell().setText(message); - setTitle(message); - setMessage(message); - setControl(ret); - } - - @Override - public void setVisible(boolean visible) { - if (visible) { - IProject project = (IProject) context.get("projectToCopyTo"); //$NON-NLS-1$ - viewer.setInput(project); - - Object object = context.get("folderToCopyTo.obj"); //$NON-NLS-1$ - if (object != null) { - viewer.setSelection(new StructuredSelection(object)); - } else { - viewer.setSelection(new StructuredSelection()); - } - setPageComplete(viewer.getSelection().isEmpty() == false); - - path = new Path((String) context.get("srcPath")); //$NON-NLS-1$ - label2.setText(path.lastSegment()); - label3.setText(Messages.ProjectFolderPickerDialog_sourceResourceDirectory); - lblResourcePath.setText(path.removeLastSegments(1).toOSString()); - } - super.setVisible(visible); - } - - protected void onChanged() { - Object selected = ((IStructuredSelection) viewer.getSelection()).getFirstElement(); - if (selected == null || selected instanceof String) { - value = ""; //$NON-NLS-1$ - } else { - IResource resource = (IResource) selected; - value = resource.getFullPath().removeFirstSegments(1).toOSString(); - } - context.set("folderToCopyTo", value); //$NON-NLS-1$ - context.set("folderToCopyTo.obj", selected); //$NON-NLS-1$ - setPageComplete(selected != null); - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/PickProjectPage.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/PickProjectPage.java deleted file mode 100644 index 572054aa..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/PickProjectPage.java +++ /dev/null @@ -1,133 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation, Ongoing Maintenance - *******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.dialogs; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.BundleImageCache; -import org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.Messages; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.ColumnLabelProvider; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; - -/** - * Wizard page to select a referenced project - * - * @author Steven Spungin - * - */ -public class PickProjectPage extends WizardPage { - - private TableViewer viewer; - private BundleImageCache imageCache; - private Image imgProject; - private IProject[] projects; - private final IEclipseContext context; - - protected PickProjectPage(IEclipseContext context) { - super(Messages.PickProjectPage_SelectReferencedProject); - this.context = context; - try { - projects = context.get(IProject.class).getReferencedProjects(); - } catch (final CoreException e) { - setErrorMessage(e.getMessage()); - e.printStackTrace(); - } - setPageComplete(false); - } - - @Override - public void createControl(Composite parent) { - - imageCache = new BundleImageCache(parent.getDisplay(), getClass().getClassLoader()); - getShell().addDisposeListener(new DisposeListener() { - - @Override - public void widgetDisposed(DisposeEvent e) { - imageCache.dispose(); - imgProject = null; - } - }); - imgProject = imageCache.create("/icons/full/obj16/projects.png"); //$NON-NLS-1$ - - final Composite comp = new Composite(parent, SWT.NONE); - comp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - comp.setLayout(new GridLayout(1, false)); - - viewer = new TableViewer(comp, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER | SWT.FULL_SELECTION); - viewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH)); - viewer.setLabelProvider(new ColumnLabelProvider() { - @Override - public String getText(Object element) { - final IProject project = (IProject) element; - return project.getName(); - } - - @Override - public Image getImage(Object element) { - return imgProject; - } - }); - viewer.setContentProvider(ArrayContentProvider.getInstance()); - - viewer.setInput(projects); - - viewer.addSelectionChangedListener(new ISelectionChangedListener() { - - @Override - public void selectionChanged(SelectionChangedEvent event) { - final Object firstElement = ((StructuredSelection) event.getSelection()).getFirstElement(); - context.set("projectToCopyTo", firstElement); //$NON-NLS-1$ - setPageComplete(firstElement != null); - getContainer().updateButtons(); - } - }); - - final String message = Messages.ReferencedProjectPickerDialog_selectReferencedProject; - setMessage(message); - getShell().setText(message); - setTitle(message); - - final Image image = context.get(BundleImageCache.class).create("/icons/full/obj16/projects.png"); //$NON-NLS-1$ - setImageDescriptor(ImageDescriptor.createFromImage(image)); - - setControl(comp); - } - - @Override - public void setVisible(boolean visible) { - final Object object = context.get("projectToCopyTo"); //$NON-NLS-1$ - if (visible) { - if (object != null) { - viewer.setSelection(new StructuredSelection(object)); - } else { - viewer.setSelection(new StructuredSelection()); - } - } - setPageComplete(viewer.getSelection().isEmpty() == false); - super.setVisible(visible); - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/ProjectFolderPickerDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/ProjectFolderPickerDialog.java deleted file mode 100644 index bf4bc045..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/ProjectFolderPickerDialog.java +++ /dev/null @@ -1,256 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 424730 - *******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.dialogs; - -import java.net.URL; -import java.util.ArrayList; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceProxy; -import org.eclipse.core.resources.IResourceProxyVisitor; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.Messages; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.dialogs.TitleAreaDialog; -import org.eclipse.jface.viewers.ColumnLabelProvider; -import org.eclipse.jface.viewers.DoubleClickEvent; -import org.eclipse.jface.viewers.IDoubleClickListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; - -public class ProjectFolderPickerDialog extends TitleAreaDialog { - - private TreeViewer viewer; - private IProject project; - private String srcPath; - private String value; - - protected ProjectFolderPickerDialog(Shell parentShell, IProject project, String srcPath) { - super(parentShell); - this.project = project; - this.srcPath = srcPath; - } - - static class ProjectContentProvider implements ITreeContentProvider { - - private IProject project; - - public ProjectContentProvider() { - } - - @Override - public void dispose() { - } - - @Override - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - this.project = (IProject) newInput; - } - - @Override - public Object[] getElements(Object inputElement) { - return new Object[] { project.getName() }; - } - - @Override - public Object[] getChildren(final Object parentElement) { - if (parentElement instanceof String) { - return getChildren(project); - } - final IResource resource = (IResource) parentElement; - final ArrayList<Object> list = new ArrayList<Object>(); - IResourceProxyVisitor visitor = new IResourceProxyVisitor() { - - @Override - public boolean visit(IResourceProxy proxy) throws CoreException { - if (proxy.getType() == IResource.FOLDER && proxy.requestResource().getParent() == resource) { - if (proxy.requestResource().equals(resource) == false) { - list.add(proxy.requestResource()); - } - } - return true; - } - }; - try { - resource.accept(visitor, IResource.DEPTH_ONE); - } catch (CoreException e) { - e.printStackTrace(); - } - return list.toArray(new Object[0]); - } - - @Override - public Object getParent(Object element) { - IResource resource = (IResource) element; - return resource.getParent(); - } - - Boolean found = false; - - @Override - public boolean hasChildren(Object element) { - if (element instanceof String) { - return true; - } - final IResource resource = (IResource) element; - try { - found = false; - resource.accept(new IResourceProxyVisitor() { - - @Override - public boolean visit(IResourceProxy proxy) throws CoreException { - if (proxy.getType() == IResource.FOLDER && proxy.requestResource().equals(resource) == false) { - found = true; - return false; - } - return true; - } - }, IResource.DEPTH_ONE); - } catch (CoreException e) { - e.printStackTrace(); - } - return found; - } - } - - static class ProjectLabelProvider extends ColumnLabelProvider { - @Override - public String getText(Object element) { - if (element instanceof String) { - return element.toString(); - } - IResource resource = (IResource) element; - return resource.getName(); - } - - @Override - public Image getImage(Object element) { - try { - if (element instanceof String) { - return new Image(Display.getDefault(), new URL(Messages.ProjectFolderPickerDialog_0).openStream()); - } - return new Image(Display.getDefault(), new URL("platform:/plugin/org.eclipse.ui.ide/icons/full/obj16/folder.png").openStream()); //$NON-NLS-1$ - } catch (Exception e) { - return super.getImage(element); - } - } - } - - @Override - protected boolean isResizable() { - return true; - } - - @Override - protected void createButtonsForButtonBar(Composite parent) { - super.createButtonsForButtonBar(parent); - - Button button = new Button(parent, SWT.PUSH); - button.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); - button.setText(Messages.ProjectFolderPickerDialog_useSourceDirectory); - button.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - value = Path.fromOSString(srcPath).removeLastSegments(1).toOSString(); - ProjectFolderPickerDialog.super.okPressed(); - } - }); - button.moveAbove(getButton(IDialogConstants.CANCEL_ID)); - - ((GridLayout) parent.getLayout()).numColumns = 3; - } - - @Override - protected void okPressed() { - Object selected = ((IStructuredSelection) viewer.getSelection()).getFirstElement(); - if (selected == null || selected instanceof String) { - value = ""; //$NON-NLS-1$ - } else { - IResource resource = (IResource) selected; - value = resource.getFullPath().removeFirstSegments(1).toOSString(); - } - - super.okPressed(); - } - - @Override - protected Control createDialogArea(Composite parent) { - // TODO Auto-generated method stub - Composite ret = (Composite) super.createDialogArea(parent); - - viewer = new TreeViewer(ret); - viewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH)); - viewer.setContentProvider(new ProjectContentProvider()); - viewer.setLabelProvider(new ProjectLabelProvider()); - viewer.setInput(project); - viewer.expandToLevel(2); - - viewer.addDoubleClickListener(new IDoubleClickListener() { - - @Override - public void doubleClick(DoubleClickEvent event) { - okPressed(); - } - }); - - if (srcPath != null) { - - IPath path = Path.fromOSString(srcPath); - - Composite compPath = new Composite(ret, SWT.NONE); - compPath.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - compPath.setLayout(new GridLayout(2, false)); - - Label label = new Label(compPath, SWT.NONE); - label.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); - label.setText(Messages.ProjectFolderPickerDialog_sourceResourceName); - - Label label2 = new Label(compPath, SWT.NONE); - label2.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); - label2.setText(path.lastSegment()); - - Label label3 = new Label(compPath, SWT.NONE); - label3.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); - label3.setText(Messages.ProjectFolderPickerDialog_sourceResourceDirectory); - - Label lblResourcePath = new Label(compPath, SWT.NONE); - lblResourcePath.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); - lblResourcePath.setText(path.removeLastSegments(1).toOSString()); - } - - String message = Messages.ProjectFolderPickerDialog_6; - getShell().setText(message); - setTitle(message); - setMessage(message); - return ret; - } - - public String getValue() { - return value; - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/ReferencedProjectPickerDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/ReferencedProjectPickerDialog.java deleted file mode 100644 index cb301c2b..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/ReferencedProjectPickerDialog.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 424730 - *******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.dialogs; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.BundleImageCache; -import org.eclipse.e4.tools.emf.ui.internal.common.component.tabs.empty.TitleAreaFilterDialog; -import org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.Messages; -import org.eclipse.jface.viewers.ColumnLabelProvider; -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Shell; - -public class ReferencedProjectPickerDialog extends TitleAreaFilterDialog { - - private IProject project; - private BundleImageCache imageCache; - static protected Image imgProject; - - protected ReferencedProjectPickerDialog(final Shell parentShell, IProject project) { - super(parentShell, new ColumnLabelProvider() { - @Override - public String getText(Object element) { - IProject project = (IProject) element; - return project.getName(); - } - - @Override - public Image getImage(Object element) { - return imgProject; - } - }); - this.project = project; - } - - @Override - protected Control createContents(Composite parent) { - imageCache = new BundleImageCache(parent.getDisplay(), getClass().getClassLoader()); - getShell().addDisposeListener(new DisposeListener() { - - @Override - public void widgetDisposed(DisposeEvent e) { - imageCache.dispose(); - imgProject = null; - } - }); - imgProject = imageCache.create("/icons/full/obj16/projects.png"); //$NON-NLS-1$ - - Control ret = super.createContents(parent); - try { - setElements(project.getReferencedProjects()); - } catch (CoreException e) { - e.printStackTrace(); - } - String message = Messages.ReferencedProjectPickerDialog_selectReferencedProject; - setMessage(message); - getShell().setText(message); - setTitle(message); - return ret; - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/UriDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/UriDialog.java deleted file mode 100644 index dd945d56..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/UriDialog.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 424730 - *******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.dialogs; - -/** - * An interface for a URI Dialog - * - * @author Steven Spungin - * - */ -public interface UriDialog { - - void setUri(String uri); - - String getUri(); - - /** - * See @org.eclipse.jface.dialogs.Dialog.open - * - * @return Dialog.OK if the user submitted a response. - */ - int open(); -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/UriDialogType.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/UriDialogType.java deleted file mode 100644 index 31b180bf..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/UriDialogType.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 424730 - *******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.dialogs; - -/** - * Enum of various URI Dialog Types - * - * @author Steven Spungin - * - */ -public enum UriDialogType { - BUNDLECLASS, ICON -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/messages.properties deleted file mode 100644 index e585bf16..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/messages.properties +++ /dev/null @@ -1,67 +0,0 @@ -BundleClassDialog_bundle=bundle -BundleClassDialog_bundleClassEditor=BundleClass Editor -BundleClassDialog_class=class -BundleClassDialog_create_goto=Create/Goto -BundleClassDialog_find=Find -BundleClassDialog_package=package -BundleClassDialog_uri=URI -BundleConverter_couldNotCreateMetaInfDir=Could not create META-INF directory -BundleConverter_installLocationNotADirectory=Install location is not a directory -BundleConverter_projectIsAlreadyABundle=Project is already a bundle -FindContributionDialog_findBundle=Find Bundle -FindContributionDialog_findClass=Find Class -FindContributionDialog_findIcon=Find Icon -FindContributionDialog_findPackage=Find Package -FindContributionDialog_inBundle=In Bundle -FindContributionDialog_inPackage=In Package -FindIconDialog_findIcon=Find Icon -FindIconDialog_searchByFilename=Search By Filename -IconDialog_bundle=bundle -IconDialog_find=Find -IconDialog_folder=folder -IconDialog_icon=icon -IconDialog_selectIcon=Select Icon -IconDialog_selectIcon_MESSAGE=Select Icon -IconDialog_selectIcon_TITLE=Select Icon -IconDialog_uri=URI -IconDialog_uriEditor=URI Editor -NonReferencedActionPage_Action=Action -NonReferencedActionPage_NonreferencedResourceAction=Nonreferenced Resource Action -NonReferencedResourceDialog__ast_notInABundle_ast=*** NOT IN A BUNDLE *** -NonReferencedResourceDialog_2=Bundle -NonReferencedResourceDialog_Action=Action -NonReferencedResourceDialog_ast_notInABundle_ast=*** NOT IN A BUNDLE *** -NonReferencedResourceDialog_bundle=Bundle -NonReferencedResourceDialog_class=Class -NonReferencedResourceDialog_convertAndRequire=Convert Resource's Project To A Bundle And Require It -NonReferencedResourceDialog_copyToReferenedProject=Copy To A Referenced Project... -NonReferencedResourceDialog_copyToThisProject=Copy To This Project... -NonReferencedResourceDialog_directory=Directory -NonReferencedResourceDialog_error=Error -NonReferencedResourceDialog_importPackage=Import Package -NonReferencedResourceDialog_installLocation=Install Location -NonReferencedResourceDialog_package=Package -NonReferencedResourceDialog_requireBundle=Require Bundle -NonReferencedResourceDialog_resource=Resource -NonReferencedResourceDialog_resourceNotReferenced=The resource's bundle is not referenced by this project's bundle. -NonReferencedResourceDialog_resourceReferenceWarning=Resource Reference Warning -NonReferencedResourceDialog_selectProjectToReceiveCopy=Select the project to receive the copied resource: -NonReferencedResourceDialog_selectTheFolderResourceCopy=Select the folder where the resource will be copied to: -NonReferencedResourceDialog_url=URL -NonReferencedResourceDialog_useAnyway=Use Anyway (Resolve Later) -PickProjectFolderPage_SelectProjectFolder=Select Project Folder -PickProjectPage_SelectReferencedProject=Select Referenced Project -ProjectFolderPickerDialog_0=platform:/plugin/org.eclipse.ui.images/eclipse-png/org.eclipse.jdt.ui/icons/full/eview16/projects.png -ProjectFolderPickerDialog_6=Select Project Folder -ProjectFolderPickerDialog_sourceResourceDirectory=Source Resource Directory -ProjectFolderPickerDialog_sourceResourceName=Source Resource Name -ProjectFolderPickerDialog_useSourceDirectory=Use source resource directory -ReferencedProjectPickerDialog_selectReferencedProject=Select Referenced Project -TargetPlatformClassContributionCollector_classes=Classes -TargetPlatformContributionCollector_BuildTargetPlatformIndex=Build Target Platform Index -TargetPlatformContributionCollector_pleaseWait=Please wait while the target platform lookup cache updates... -TargetPlatformContributionCollector_RunInBackground=Run In Background -TargetPlatformContributionCollector_Searching=Searching -TargetPlatformContributionCollector_updatingTargetPlatformCache=Updating Target Platform Cache ( -TargetPlatformContributionCollector_WaitingForTargetPlatformIndexingToComplete=Waiting for target platform indexing to complete -TargetPlatformIconContributionCollector_images=Images diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/UIViewer.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/UIViewer.java deleted file mode 100644 index 902d64b4..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/UIViewer.java +++ /dev/null @@ -1,109 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.uistructure; - -import java.util.Collections; -import org.eclipse.core.databinding.observable.value.IObservableValue; -import org.eclipse.core.databinding.observable.value.IValueChangeListener; -import org.eclipse.core.databinding.observable.value.ValueChangeEvent; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.RegistryFactory; -import org.eclipse.e4.tools.emf.ui.common.IScriptingSupport; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.common.ControlHighlighter; -import org.eclipse.e4.tools.services.IResourcePool; -import org.eclipse.e4.ui.model.application.MApplicationElement; -import org.eclipse.e4.ui.model.internal.ModelUtils; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.IEMFValueProperty; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.IMenuListener; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; - -public class UIViewer { - public TreeViewer createViewer(Composite parent, EStructuralFeature feature, final IObservableValue master, IResourcePool resourcePool, final Messages messages) { - final TreeViewer viewer = new TreeViewer(parent); - viewer.setContentProvider(new WidgetContentProvider()); - viewer.setLabelProvider(new WidgetLabelProvider(resourcePool)); - IEMFValueProperty property = EMFProperties.value(feature); - IObservableValue value = property.observeDetail(master); - value.addValueChangeListener(new IValueChangeListener() { - - @Override - public void handleValueChange(ValueChangeEvent event) { - if (event.diff.getNewValue() != null) { - viewer.setInput(Collections.singleton(event.diff.getNewValue())); - viewer.expandToLevel(2); - } else { - viewer.setInput(Collections.emptyList()); - } - } - }); - - final MenuManager mgr = new MenuManager(); - mgr.setRemoveAllWhenShown(true); - mgr.addMenuListener(new IMenuListener() { - - @Override - public void menuAboutToShow(IMenuManager manager) { - final Object o = ((IStructuredSelection) viewer.getSelection()).getFirstElement(); - if (o instanceof Control) { - manager.add(new Action(messages.ModelEditor_ShowControl) { - @Override - public void run() { - ControlHighlighter.show((Control) o); - } - }); - } - - IExtensionRegistry registry = RegistryFactory.getRegistry(); - IExtensionPoint extPoint = registry.getExtensionPoint("org.eclipse.e4.tools.emf.ui.scripting"); //$NON-NLS-1$ - final IConfigurationElement[] elements = extPoint.getConfigurationElements(); - - final IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - - if (elements.length > 0 && !s.isEmpty()) { - MenuManager scriptExecute = new MenuManager(messages.ModelEditor_Script); - manager.add(scriptExecute); - for (IConfigurationElement e : elements) { - final IConfigurationElement le = e; - scriptExecute.add(new Action(e.getAttribute("label")) { //$NON-NLS-1$ - @Override - public void run() { - try { - MApplicationElement o = (MApplicationElement) master.getValue(); - IScriptingSupport support = (IScriptingSupport) le.createExecutableExtension("class"); //$NON-NLS-1$ - support.openEditor(viewer.getControl().getShell(), s.getFirstElement(), ModelUtils.getContainingContext(o)); - } catch (CoreException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - }); - } - } - } - }); - - viewer.getControl().setMenu(mgr.createContextMenu(viewer.getControl())); - - return viewer; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/ViewerElement.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/ViewerElement.java deleted file mode 100644 index 6502826d..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/ViewerElement.java +++ /dev/null @@ -1,192 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012, 2014 Remain BV and others - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Wim Jongman <wim.jongman@remainsoftware.com> - initial API and implementation - * Steven Spungin <steve@spungin.tv> -Bug 439284 - [model editor] make list a combo with autocomplete for add part - * descriptor - * Toni Umbreit - Bug 440289 - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.uistructure; - -import javax.inject.Inject; - -import org.eclipse.e4.core.contexts.ContextInjectionFactory; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.core.services.nls.Translation; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.jface.viewers.ComboViewer; -import org.eclipse.jface.viewers.StructuredViewer; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; - -/** - * A viewer with buttons. - * - * @author wim.jongman@remainsoftware.com - * - */ -public class ViewerElement { - - Messages Messages; - - private StructuredViewer viewer; - private final AbstractComponentEditor editor; - private ComboViewer dropDown; - private Button addButton; - private final Composite parent; - - private Button removeButton; - - private Button downButton; - - private Button upButton; - - /** - * @param parent - * @param editor - */ - @Inject - public ViewerElement(@Translation Messages Messages, Composite parent, AbstractComponentEditor editor) { - this.parent = parent; - this.editor = editor; - this.Messages = Messages; - createControl(); - } - - public StructuredViewer getViewer() { - return viewer; - } - - public void createControl() { - - createTopButtons(); - - if (viewer == null) { - viewer = new TableViewer(parent); - } - - final GridData gd = new GridData(GridData.FILL, GridData.FILL, true, true, 3, 1); - viewer.getControl().setLayoutData(gd); - - createBottomButtons(); - - } - - private void createBottomButtons() { - final Composite buttonCompBot = new Composite(parent, SWT.NONE); - buttonCompBot.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false, 3, 1)); - final GridLayout gl = new GridLayout(3, false); - gl.marginLeft = 0; - gl.marginRight = 0; - gl.marginWidth = 0; - gl.marginHeight = 0; - buttonCompBot.setLayout(gl); - - upButton = new Button(buttonCompBot, SWT.PUSH | SWT.FLAT); - upButton.setText(Messages.ModelTooling_Common_Up); - upButton.setImage(editor.createImage(ResourceProvider.IMG_Obj16_arrow_up)); - upButton.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 1, 1)); - - downButton = new Button(buttonCompBot, SWT.PUSH | SWT.FLAT); - downButton.setText(Messages.ModelTooling_Common_Down); - downButton.setImage(editor.createImage(ResourceProvider.IMG_Obj16_arrow_down)); - downButton.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 1, 1)); - - removeButton = new Button(buttonCompBot, SWT.PUSH | SWT.FLAT); - removeButton.setText(Messages.ModelTooling_Common_Remove); - removeButton.setImage(editor.createImage(ResourceProvider.IMG_Obj16_table_delete)); - removeButton.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 1, 1)); - - } - - /** - * Returns the button that removes an element from the list. Use it to add - * your {@link SelectionListener} to it. - * - * @return the {@link Button} - */ - public Button getButtonRemove() { - return removeButton; - } - - /** - * Returns the button that adds an element to the list. Use it to add your {@link SelectionListener} to it. - * - * @return the {@link Button} - */ - public Button getButtonAdd() { - return addButton; - } - - /** - * Returns the button that moves an element down in the list. Use it to add - * your {@link SelectionListener} to it. - * - * @return the {@link Button} - */ - public Button getButtonDown() { - return downButton; - } - - /** - * Returns the button that moves an element up in the list. Use it to add - * your {@link SelectionListener} to it. - * - * @return the {@link Button} - */ - public Button getButtonUp() { - return upButton; - } - - private void createTopButtons() { - final Composite buttonCompTop = new Composite(parent, SWT.NONE); - buttonCompTop.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false, 3, 1)); - final GridLayout buttonCompTopLayout = new GridLayout(2, false); - buttonCompTopLayout.marginLeft = 0; - buttonCompTopLayout.marginRight = 0; - buttonCompTopLayout.marginWidth = 0; - buttonCompTopLayout.marginHeight = 0; - buttonCompTop.setLayout(buttonCompTopLayout); - - dropDown = new ComboViewer(buttonCompTop, SWT.READ_ONLY | SWT.DROP_DOWN); - dropDown.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - - addButton = new Button(buttonCompTop, SWT.PUSH | SWT.FLAT); - addButton.setImage(editor.createImage(ResourceProvider.IMG_Obj16_table_add)); - addButton.setText(Messages.ModelTooling_Common_AddEllipsis); - addButton.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - - } - - public ComboViewer getDropDown() { - return dropDown; - } - - /** - * Creates and returns a new instance of this class based on the supplied - * context. - * - * @param parentContext - * @param parent - * @param editor - * @return a new {@link ViewerElement} - */ - public static ViewerElement create(IEclipseContext parentContext, Composite parent, AbstractComponentEditor editor) { - final IEclipseContext mycontext = parentContext.createChild(); - mycontext.set(Composite.class, parent); - mycontext.set(AbstractComponentEditor.class, editor); - return ContextInjectionFactory.make(ViewerElement.class, mycontext); - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/WidgetContentProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/WidgetContentProvider.java deleted file mode 100644 index d6da2593..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/WidgetContentProvider.java +++ /dev/null @@ -1,123 +0,0 @@ -package org.eclipse.e4.tools.emf.ui.internal.common.uistructure; - -import java.util.Collection; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.CoolBar; -import org.eclipse.swt.widgets.CoolItem; -import org.eclipse.swt.widgets.List; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.MenuItem; -import org.eclipse.swt.widgets.TabFolder; -import org.eclipse.swt.widgets.TabItem; -import org.eclipse.swt.widgets.ToolBar; -import org.eclipse.swt.widgets.ToolItem; -import org.eclipse.swt.widgets.Tree; - -public class WidgetContentProvider implements ITreeContentProvider { - - @Override - public void dispose() { - - } - - @Override - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - - } - - @Override - public Object[] getElements(Object inputElement) { - return ((Collection<?>) inputElement).toArray(); - } - - @Override - public Object[] getChildren(Object parentElement) { - if (parentElement instanceof Menu) { - Menu m = (Menu) parentElement; - MenuItem[] items = m.getItems(); - Object[] rv = new Object[items.length]; - System.arraycopy(items, 0, rv, 0, rv.length); - return rv; - } else if (parentElement instanceof MenuItem) { - MenuItem item = (MenuItem) parentElement; - if (item.getMenu() != null) { - MenuItem[] items = item.getMenu().getItems(); - Object[] rv = new Object[items.length]; - System.arraycopy(items, 0, rv, 0, rv.length); - return rv; - } - } else if (parentElement instanceof ToolBar) { - ToolBar toolbar = (ToolBar) parentElement; - ToolItem[] items = toolbar.getItems(); - Object[] rv = new Object[items.length]; - System.arraycopy(items, 0, rv, 0, rv.length); - return rv; - } else if (parentElement instanceof CoolBar) { - CoolBar coolbar = (CoolBar) parentElement; - CoolItem[] items = coolbar.getItems(); - Object[] rv = new Object[items.length]; - System.arraycopy(items, 0, rv, 0, rv.length); - return rv; - } else if (parentElement instanceof TabItem) { - TabItem item = (TabItem) parentElement; - if (item.getControl() != null) { - return new Object[] { item.getControl() }; - } - } else if (parentElement instanceof CTabItem) { - CTabItem item = (CTabItem) parentElement; - if (item.getControl() != null) { - return new Object[] { item.getControl() }; - } - } else if (parentElement instanceof Tree) { - // No children - - } else if (parentElement instanceof Tree) { - // No children - - } else if (parentElement instanceof List) { - // No children - - } else if (parentElement instanceof Combo) { - // No children - - } else if (parentElement instanceof CTabFolder) { - CTabFolder tabFolder = (CTabFolder) parentElement; - CTabItem[] items = tabFolder.getItems(); - Object[] rv = new Object[items.length]; - System.arraycopy(items, 0, rv, 0, rv.length); - return rv; - } else if (parentElement instanceof TabFolder) { - TabFolder tabFolder = (TabFolder) parentElement; - TabItem[] items = tabFolder.getItems(); - Object[] rv = new Object[items.length]; - System.arraycopy(items, 0, rv, 0, rv.length); - return rv; - } else if (parentElement instanceof Composite) { - Composite comp = (Composite) parentElement; - Control controls[] = comp.getChildren(); - Object[] rv = new Object[controls.length]; - System.arraycopy(controls, 0, rv, 0, rv.length); - return rv; - } - - return new Object[0]; - } - - @Override - public Object getParent(Object element) { - // TODO Auto-generated method stub - return null; - } - - @Override - public boolean hasChildren(Object element) { - return getChildren(element).length > 0; - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/WidgetLabelProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/WidgetLabelProvider.java deleted file mode 100644 index b1811dca..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/uistructure/WidgetLabelProvider.java +++ /dev/null @@ -1,192 +0,0 @@ -package org.eclipse.e4.tools.emf.ui.internal.common.uistructure; - -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.services.IResourcePool; -import org.eclipse.jface.viewers.StyledCellLabelProvider; -import org.eclipse.jface.viewers.StyledString; -import org.eclipse.jface.viewers.ViewerCell; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CCombo; -import org.eclipse.swt.custom.CLabel; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.custom.SashForm; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.CoolBar; -import org.eclipse.swt.widgets.CoolItem; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.MenuItem; -import org.eclipse.swt.widgets.ProgressBar; -import org.eclipse.swt.widgets.Sash; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.TabFolder; -import org.eclipse.swt.widgets.TabItem; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.Text; -import org.eclipse.swt.widgets.ToolBar; -import org.eclipse.swt.widgets.ToolItem; -import org.eclipse.swt.widgets.Tree; - -public class WidgetLabelProvider extends StyledCellLabelProvider { - private IResourcePool resourcePool; - - public WidgetLabelProvider(IResourcePool resourcePool) { - this.resourcePool = resourcePool; - } - - @Override - public void update(ViewerCell cell) { - Object element = cell.getElement(); - if (element instanceof Menu) { - Menu m = (Menu) element; - if ((m.getStyle() & SWT.BAR) == SWT.BAR) { - cell.setText("MenuBar"); //$NON-NLS-1$ - cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_menubar_obj)); - } else { - cell.setText("Menu"); //$NON-NLS-1$ - cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_menu_obj)); - } - } else if (element instanceof MenuItem) { - MenuItem item = (MenuItem) element; - if ((item.getStyle() & SWT.SEPARATOR) == SWT.SEPARATOR) { - cell.setText("Separator"); //$NON-NLS-1$ - cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_menuseparator_obj)); - } else { - StyledString s = new StyledString("MenuItem"); //$NON-NLS-1$ - s.append(" - " + ((MenuItem) element).getText(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ - cell.setStyleRanges(s.getStyleRanges()); - cell.setText(s.getString()); - cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_menuitem_obj)); - } - - } else if (element instanceof CLabel) { - StyledString s = new StyledString("Label"); //$NON-NLS-1$ - s.append(" - " + ((CLabel) element).getText(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ - cell.setStyleRanges(s.getStyleRanges()); - cell.setText(s.getString()); - cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_clabel_obj)); - } else if (element instanceof ToolBar) { - cell.setText("Toolbar"); //$NON-NLS-1$ - cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_toolbar_obj)); - } else if (element instanceof ToolItem) { - cell.setText("ToolItem"); //$NON-NLS-1$ - ToolItem item = (ToolItem) element; - if ((item.getStyle() & SWT.PUSH) == SWT.PUSH) { - cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_toolitempush_obj)); - } else if ((item.getStyle() & SWT.DROP_DOWN) == SWT.DROP_DOWN) { - cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_toolitemdrop_obj)); - } else if ((item.getStyle() & SWT.CHECK) == SWT.CHECK) { - cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_toolitemcheck_obj)); - } else if ((item.getStyle() & SWT.RADIO) == SWT.RADIO) { - cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_toolitemradio_obj)); - } else if ((item.getStyle() & SWT.SEPARATOR) == SWT.SEPARATOR) { - cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_toolitemseparator_obj)); - } - } else if (element instanceof CoolItem) { - cell.setText("CoolItem"); //$NON-NLS-1$ - CoolItem item = (CoolItem) element; - if ((item.getStyle() & SWT.PUSH) == SWT.PUSH) { - cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_toolitempush_obj)); - } else if ((item.getStyle() & SWT.DROP_DOWN) == SWT.DROP_DOWN) { - cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_toolitemdrop_obj)); - } else if ((item.getStyle() & SWT.CHECK) == SWT.CHECK) { - cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_toolitemcheck_obj)); - } else if ((item.getStyle() & SWT.RADIO) == SWT.RADIO) { - cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_toolitemradio_obj)); - } else if ((item.getStyle() & SWT.SEPARATOR) == SWT.SEPARATOR) { - cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_toolitemseparator_obj)); - } - } else if (element instanceof CoolBar) { - cell.setText("Coolbar"); //$NON-NLS-1$ - cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_coolbar_obj)); - } else if (element instanceof Shell) { - StyledString s = new StyledString("Shell"); //$NON-NLS-1$ - s.append(" - " + ((Shell) element).getText(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ - cell.setStyleRanges(s.getStyleRanges()); - cell.setText(s.getString()); - cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_shell_obj)); - } else if (element instanceof ProgressBar) { - cell.setText("ProgressBar"); //$NON-NLS-1$ - cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_progressbar_obj)); - } else if (element instanceof Group) { - StyledString s = new StyledString("Group"); //$NON-NLS-1$ - s.append(" - " + ((Group) element).getText(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ - cell.setStyleRanges(s.getStyleRanges()); - cell.setText(s.getString()); - cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_group_obj)); - } else if (element instanceof TabFolder) { - cell.setText("TabFolder"); //$NON-NLS-1$ - cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_tabfolder_obj)); - } else if (element instanceof CTabFolder) { - cell.setText("CTabFolder"); //$NON-NLS-1$ - cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_ctabfolder_obj)); - } else if (element instanceof Combo) { - cell.setText("Combo"); //$NON-NLS-1$ - cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_comboviewer_obj)); - } else if (element instanceof CCombo) { - cell.setText("CCombo"); //$NON-NLS-1$ - cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_ccombo_obj)); - } else if (element instanceof Table) { - cell.setText("Table"); //$NON-NLS-1$ - cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_table_obj)); - } else if (element instanceof Tree) { - cell.setText("Tree"); //$NON-NLS-1$ - cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_tree_obj)); - } else if (element instanceof Text) { - cell.setText("Text"); //$NON-NLS-1$ - cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_text_obj)); - } else if (element instanceof Sash) { - cell.setText("Sash"); //$NON-NLS-1$ - cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_separator_obj)); - } else if (element instanceof SashForm) { - cell.setText("Sash Form"); //$NON-NLS-1$ - cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_sashform_obj)); - } else if (element instanceof Label) { - Label l = (Label) element; - if ((l.getStyle() & SWT.SEPARATOR) == SWT.SEPARATOR) { - cell.setText("Separator"); //$NON-NLS-1$ - cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_separator_obj)); - } else { - StyledString s = new StyledString("Label"); //$NON-NLS-1$ - s.append(" - " + l.getText(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ - cell.setStyleRanges(s.getStyleRanges()); - cell.setText(s.getString()); - cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_label_obj)); - } - - } else if (element instanceof TabItem) { - StyledString s = new StyledString("TabItem"); //$NON-NLS-1$ - s.append(" - " + ((TabItem) element).getText(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ - cell.setStyleRanges(s.getStyleRanges()); - cell.setText(s.getString()); - } else if (element instanceof CTabItem) { - StyledString s = new StyledString("CTabItem"); //$NON-NLS-1$ - s.append(" - " + ((CTabItem) element).getText(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ - cell.setStyleRanges(s.getStyleRanges()); - cell.setText(s.getString()); - // cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_clabel_obj)); - } else if (element instanceof Button) { - Button b = (Button) element; - if ((b.getStyle() & SWT.PUSH) == SWT.PUSH) { - cell.setText("Button"); //$NON-NLS-1$ - cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_button_obj)); - } else if ((b.getStyle() & SWT.CHECK) == SWT.CHECK) { - cell.setText("Checkbox"); //$NON-NLS-1$ - cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_checkbox_obj)); - } else if ((b.getStyle() & SWT.RADIO) == SWT.RADIO) { - cell.setText("Radiobox"); //$NON-NLS-1$ - cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_radiobutton_obj)); - } - } else if (element instanceof Composite) { - cell.setText("Composite"); //$NON-NLS-1$ - cell.setImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Widgets_composite_obj)); - } else { - cell.setText(element + ""); //$NON-NLS-1$ - } - super.update(cell); - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/AnnotationAccess.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/AnnotationAccess.java deleted file mode 100644 index e6ef7aaa..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/AnnotationAccess.java +++ /dev/null @@ -1,73 +0,0 @@ -package org.eclipse.e4.tools.emf.ui.internal.common.xml; - -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.services.IResourcePool; -import org.eclipse.jface.text.source.Annotation; -import org.eclipse.jface.text.source.IAnnotationAccess; -import org.eclipse.jface.text.source.IAnnotationAccessExtension; -import org.eclipse.swt.graphics.GC; -import org.eclipse.swt.graphics.Rectangle; -import org.eclipse.swt.widgets.Canvas; - -public class AnnotationAccess implements IAnnotationAccess, IAnnotationAccessExtension { - private final IResourcePool pool; - - public AnnotationAccess(IResourcePool pool) { - this.pool = pool; - } - - @Override - public String getTypeLabel(Annotation annotation) { - return annotation.getText(); - } - - @Override - public int getLayer(Annotation annotation) { - return IAnnotationAccessExtension.DEFAULT_LAYER; - } - - @Override - public void paint(Annotation annotation, GC gc, Canvas canvas, Rectangle bounds) { - gc.drawImage(pool.getImageUnchecked(ResourceProvider.IMG_Obj16_error_obj), bounds.x, bounds.y); - } - - @Override - public boolean isPaintable(Annotation annotation) { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isSubtype(Object annotationType, Object potentialSupertype) { - // TODO Auto-generated method stub - return false; - } - - @Override - public Object[] getSupertypes(Object annotationType) { - // TODO Auto-generated method stub - return null; - } - - @Deprecated - @Override - public Object getType(Annotation annotation) { - // TODO Auto-generated method stub - return null; - } - - @Deprecated - @Override - public boolean isMultiLine(Annotation annotation) { - // TODO Auto-generated method stub - return false; - } - - @Deprecated - @Override - public boolean isTemporary(Annotation annotation) { - // TODO Auto-generated method stub - return false; - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/EMFDocumentResourceMediator.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/EMFDocumentResourceMediator.java deleted file mode 100644 index 1896f56e..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/EMFDocumentResourceMediator.java +++ /dev/null @@ -1,150 +0,0 @@ -/******************************************************************************* - * Contributors: - * Steven Spungin <steven@spungin.tv> - Bug 431735, Bug 391089 - *******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.internal.common.xml; - -import java.io.IOException; -import java.io.StringReader; -import java.io.StringWriter; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.e4.tools.emf.ui.internal.common.component.tabs.empty.E; -import org.eclipse.e4.ui.internal.workbench.E4XMIResource; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource.Diagnostic; -import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.text.Document; -import org.eclipse.jface.text.DocumentEvent; -import org.eclipse.jface.text.FindReplaceDocumentAdapter; -import org.eclipse.jface.text.IDocumentListener; -import org.eclipse.jface.text.IRegion; -import org.xml.sax.InputSource; - -public class EMFDocumentResourceMediator { - private IModelResource modelResource; - private Document document; - private boolean updateFromEMF; - private List<Diagnostic> errorList = new ArrayList<Diagnostic>(); - private Runnable documentValidationChanged; - - public EMFDocumentResourceMediator(final IModelResource modelResource) { - this.modelResource = modelResource; - document = new Document(); - document.addDocumentListener(new IDocumentListener() { - - @Override - public void documentChanged(DocumentEvent event) { - if (updateFromEMF) { - return; - } - - final String doc = document.get(); - final E4XMIResource res = new E4XMIResource(); - try { - res.load(new InputSource(new StringReader(doc)), null); - modelResource.replaceRoot(res.getContents().get(0)); - errorList.clear(); - if (documentValidationChanged != null) { - documentValidationChanged.run(); - } - } catch (final IOException e) { - errorList = res.getErrors(); - if (documentValidationChanged != null) { - documentValidationChanged.run(); - } - - } - } - - @Override - public void documentAboutToBeChanged(DocumentEvent event) { - - } - }); - updateFromEMF(); - } - - public void setValidationChangedCallback(Runnable runnable) { - documentValidationChanged = runnable; - } - - public List<Diagnostic> getErrorList() { - return Collections.unmodifiableList(errorList); - } - - public void updateFromEMF() { - try { - updateFromEMF = true; - document.set(toXMI((EObject) modelResource.getRoot().get(0))); - } finally { - updateFromEMF = false; - } - } - - public Document getDocument() { - return document; - } - - private String toXMI(EObject root) { - final E4XMIResource resource = (E4XMIResource) root.eResource(); - // resource.getContents().add(EcoreUtil.copy(root)); - final StringWriter writer = new StringWriter(); - try { - resource.save(writer, null); - } catch (final IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return writer.toString(); - } - - /** - * @param object - * @return The region for the start tag of the EObject, or null if not - * found. - */ - public IRegion findStartTag(EObject object) { - if (object == null) { - return null; - } - final E4XMIResource root = (E4XMIResource) ((EObject) modelResource.getRoot().get(0)).eResource(); - final String xmiId = root.getID(object); - - final FindReplaceDocumentAdapter find = new FindReplaceDocumentAdapter(document); - IRegion region; - try { - // TODO This will not work if the element has '<' or '>' in an - // attribute value - region = find.find(0, "<.*?" + xmiId + ".*?>", true, true, false, true); //$NON-NLS-1$ //$NON-NLS-2$ - return region; - } catch (final BadLocationException e) { - return null; - } - } - - /** - * - * @return The region for the start of the text, or null if not found or the - * text is empty. - */ - public IRegion findText(String text, int startOffset) { - if (E.isEmpty(text)) { - return null; - } - - final FindReplaceDocumentAdapter find = new FindReplaceDocumentAdapter(document); - IRegion region; - try { - region = find.find(startOffset, text, true, true, false, false); - return region; - } catch (final BadLocationException e) { - return null; - } - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/IXMLColorConstants.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/IXMLColorConstants.java deleted file mode 100644 index 0c7a2a58..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/IXMLColorConstants.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.xml; - -import org.eclipse.swt.graphics.RGB; - -public interface IXMLColorConstants { - RGB XML_COMMENT = new RGB(128, 0, 0); - RGB PROC_INSTR = new RGB(128, 128, 128); - RGB STRING = new RGB(0, 128, 0); - RGB DEFAULT = new RGB(0, 0, 0); - RGB TAG = new RGB(0, 0, 128); -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/NonRuleBasedDamagerRepairer.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/NonRuleBasedDamagerRepairer.java deleted file mode 100644 index a331cbf7..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/NonRuleBasedDamagerRepairer.java +++ /dev/null @@ -1,134 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.xml; - -import org.eclipse.core.runtime.Assert; -import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.text.DocumentEvent; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.IRegion; -import org.eclipse.jface.text.ITypedRegion; -import org.eclipse.jface.text.Region; -import org.eclipse.jface.text.TextAttribute; -import org.eclipse.jface.text.TextPresentation; -import org.eclipse.jface.text.presentation.IPresentationDamager; -import org.eclipse.jface.text.presentation.IPresentationRepairer; -import org.eclipse.swt.custom.StyleRange; - -public class NonRuleBasedDamagerRepairer implements IPresentationDamager, IPresentationRepairer { - - /** The document this object works on */ - protected IDocument fDocument; - /** - * The default text attribute if non is returned as data by the current - * token - */ - protected TextAttribute fDefaultTextAttribute; - - /** - * Constructor for NonRuleBasedDamagerRepairer. - */ - public NonRuleBasedDamagerRepairer(TextAttribute defaultTextAttribute) { - Assert.isNotNull(defaultTextAttribute); - - fDefaultTextAttribute = defaultTextAttribute; - } - - /** - * @see IPresentationRepairer#setDocument(IDocument) - */ - @Override - public void setDocument(IDocument document) { - fDocument = document; - } - - /** - * Returns the end offset of the line that contains the specified offset or - * if the offset is inside a line delimiter, the end offset of the next - * line. - * - * @param offset - * the offset whose line end offset must be computed - * @return the line end offset for the given offset - * @exception BadLocationException - * if offset is invalid in the current document - */ - protected int endOfLineOf(int offset) throws BadLocationException { - - IRegion info = fDocument.getLineInformationOfOffset(offset); - if (offset <= info.getOffset() + info.getLength()) - return info.getOffset() + info.getLength(); - - int line = fDocument.getLineOfOffset(offset); - try { - info = fDocument.getLineInformation(line + 1); - return info.getOffset() + info.getLength(); - } catch (BadLocationException x) { - return fDocument.getLength(); - } - } - - /** - * @see IPresentationDamager#getDamageRegion(ITypedRegion, DocumentEvent, - * boolean) - */ - @Override - public IRegion getDamageRegion(ITypedRegion partition, DocumentEvent event, boolean documentPartitioningChanged) { - if (!documentPartitioningChanged) { - try { - - IRegion info = fDocument.getLineInformationOfOffset(event.getOffset()); - int start = Math.max(partition.getOffset(), info.getOffset()); - - int end = event.getOffset() + (event.getText() == null ? event.getLength() : event.getText().length()); - - if (info.getOffset() <= end && end <= info.getOffset() + info.getLength()) { - // optimize the case of the same line - end = info.getOffset() + info.getLength(); - } else - end = endOfLineOf(end); - - end = Math.min(partition.getOffset() + partition.getLength(), end); - return new Region(start, end - start); - - } catch (BadLocationException x) { - } - } - - return partition; - } - - /** - * @see IPresentationRepairer#createPresentation(TextPresentation, - * ITypedRegion) - */ - @Override - public void createPresentation(TextPresentation presentation, ITypedRegion region) { - addRange(presentation, region.getOffset(), region.getLength(), fDefaultTextAttribute); - } - - /** - * Adds style information to the given text presentation. - * - * @param presentation - * the text presentation to be extended - * @param offset - * the offset of the range to be styled - * @param length - * the length of the range to be styled - * @param attr - * the attribute describing the style of the range to be styled - */ - protected void addRange(TextPresentation presentation, int offset, int length, TextAttribute attr) { - if (attr != null) - presentation.addStyleRange(new StyleRange(offset, length, attr.getForeground(), attr.getBackground(), attr.getStyle())); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/TagRule.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/TagRule.java deleted file mode 100644 index cb588bc1..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/TagRule.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.xml; - -import org.eclipse.jface.text.rules.ICharacterScanner; -import org.eclipse.jface.text.rules.IToken; -import org.eclipse.jface.text.rules.MultiLineRule; - -public class TagRule extends MultiLineRule { - - public TagRule(IToken token) { - super("<", ">", token); //$NON-NLS-1$//$NON-NLS-2$ - } - - @Override - protected boolean sequenceDetected(ICharacterScanner scanner, char[] sequence, boolean eofAllowed) { - int c = scanner.read(); - if (sequence[0] == '<') { - if (c == '?') { - // processing instruction - abort - scanner.unread(); - return false; - } - if (c == '!') { - scanner.unread(); - // comment - abort - return false; - } - } else if (sequence[0] == '>') { - scanner.unread(); - } - return super.sequenceDetected(scanner, sequence, eofAllowed); - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLConfiguration.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLConfiguration.java deleted file mode 100644 index 804dcea4..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLConfiguration.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.xml; - -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.services.IResourcePool; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.ITextDoubleClickStrategy; -import org.eclipse.jface.text.TextAttribute; -import org.eclipse.jface.text.presentation.IPresentationReconciler; -import org.eclipse.jface.text.presentation.PresentationReconciler; -import org.eclipse.jface.text.rules.DefaultDamagerRepairer; -import org.eclipse.jface.text.rules.Token; -import org.eclipse.jface.text.source.ISourceViewer; -import org.eclipse.jface.text.source.SourceViewerConfiguration; - -public class XMLConfiguration extends SourceViewerConfiguration { - private XMLDoubleClickStrategy doubleClickStrategy; - private XMLTagScanner tagScanner; - private XMLScanner scanner; - private IResourcePool pool; - - public XMLConfiguration(IResourcePool pool) { - this.pool = pool; - } - - @Override - public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) { - return new String[] { IDocument.DEFAULT_CONTENT_TYPE, XMLPartitionScanner.XML_COMMENT, XMLPartitionScanner.XML_TAG }; - } - - @Override - public ITextDoubleClickStrategy getDoubleClickStrategy(ISourceViewer sourceViewer, String contentType) { - if (doubleClickStrategy == null) - doubleClickStrategy = new XMLDoubleClickStrategy(); - return doubleClickStrategy; - } - - protected XMLScanner getXMLScanner() { - if (scanner == null) { - scanner = new XMLScanner(pool); - scanner.setDefaultReturnToken(new Token(new TextAttribute(pool.getColorUnchecked(ResourceProvider.COLOR_DEFAULT)))); - } - return scanner; - } - - protected XMLTagScanner getXMLTagScanner() { - if (tagScanner == null) { - tagScanner = new XMLTagScanner(pool); - tagScanner.setDefaultReturnToken(new Token(new TextAttribute(pool.getColorUnchecked(ResourceProvider.COLOR_TAG)))); - } - return tagScanner; - } - - @Override - public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) { - PresentationReconciler reconciler = new PresentationReconciler(); - - DefaultDamagerRepairer dr = new DefaultDamagerRepairer(getXMLTagScanner()); - reconciler.setDamager(dr, XMLPartitionScanner.XML_TAG); - reconciler.setRepairer(dr, XMLPartitionScanner.XML_TAG); - - dr = new DefaultDamagerRepairer(getXMLScanner()); - reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE); - reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE); - - NonRuleBasedDamagerRepairer ndr = new NonRuleBasedDamagerRepairer(new TextAttribute(pool.getColorUnchecked(ResourceProvider.COLOR_XML_COMMENT))); - reconciler.setDamager(ndr, XMLPartitionScanner.XML_COMMENT); - reconciler.setRepairer(ndr, XMLPartitionScanner.XML_COMMENT); - - return reconciler; - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLDoubleClickStrategy.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLDoubleClickStrategy.java deleted file mode 100644 index 6f05a9b6..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLDoubleClickStrategy.java +++ /dev/null @@ -1,128 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.xml; - -import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.ITextDoubleClickStrategy; -import org.eclipse.jface.text.ITextViewer; - -public class XMLDoubleClickStrategy implements ITextDoubleClickStrategy { - protected ITextViewer fText; - - @Override - public void doubleClicked(ITextViewer part) { - int pos = part.getSelectedRange().x; - - if (pos < 0) - return; - - fText = part; - - if (!selectComment(pos)) { - selectWord(pos); - } - } - - protected boolean selectComment(int caretPos) { - IDocument doc = fText.getDocument(); - int startPos, endPos; - - try { - int pos = caretPos; - char c = ' '; - - while (pos >= 0) { - c = doc.getChar(pos); - if (c == '\\') { - pos -= 2; - continue; - } - if (c == Character.LINE_SEPARATOR || c == '\"') - break; - --pos; - } - - if (c != '\"') - return false; - - startPos = pos; - - pos = caretPos; - int length = doc.getLength(); - c = ' '; - - while (pos < length) { - c = doc.getChar(pos); - if (c == Character.LINE_SEPARATOR || c == '\"') - break; - ++pos; - } - if (c != '\"') - return false; - - endPos = pos; - - int offset = startPos + 1; - int len = endPos - offset; - fText.setSelectedRange(offset, len); - return true; - } catch (BadLocationException x) { - } - - return false; - } - - protected boolean selectWord(int caretPos) { - - IDocument doc = fText.getDocument(); - int startPos, endPos; - - try { - - int pos = caretPos; - char c; - - while (pos >= 0) { - c = doc.getChar(pos); - if (!Character.isJavaIdentifierPart(c)) - break; - --pos; - } - - startPos = pos; - - pos = caretPos; - int length = doc.getLength(); - - while (pos < length) { - c = doc.getChar(pos); - if (!Character.isJavaIdentifierPart(c)) - break; - ++pos; - } - - endPos = pos; - selectRange(startPos, endPos); - return true; - - } catch (BadLocationException x) { - } - - return false; - } - - private void selectRange(int startPos, int stopPos) { - int offset = startPos + 1; - int length = stopPos - offset; - fText.setSelectedRange(offset, length); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLPartitionScanner.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLPartitionScanner.java deleted file mode 100644 index 04ea48a9..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLPartitionScanner.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.xml; - -import org.eclipse.jface.text.rules.IPredicateRule; -import org.eclipse.jface.text.rules.IToken; -import org.eclipse.jface.text.rules.MultiLineRule; -import org.eclipse.jface.text.rules.RuleBasedPartitionScanner; -import org.eclipse.jface.text.rules.Token; - -public class XMLPartitionScanner extends RuleBasedPartitionScanner { - public final static String XML_COMMENT = "__xml_comment"; //$NON-NLS-1$ - public final static String XML_TAG = "__xml_tag"; //$NON-NLS-1$ - - public XMLPartitionScanner() { - - IToken xmlComment = new Token(XML_COMMENT); - IToken tag = new Token(XML_TAG); - - IPredicateRule[] rules = new IPredicateRule[2]; - - rules[0] = new MultiLineRule("<!--", "-->", xmlComment); //$NON-NLS-1$//$NON-NLS-2$ - rules[1] = new TagRule(tag); - - setPredicateRules(rules); - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLScanner.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLScanner.java deleted file mode 100644 index 1e432958..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLScanner.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.xml; - -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.services.IResourcePool; -import org.eclipse.jface.text.TextAttribute; -import org.eclipse.jface.text.rules.IRule; -import org.eclipse.jface.text.rules.IToken; -import org.eclipse.jface.text.rules.RuleBasedScanner; -import org.eclipse.jface.text.rules.SingleLineRule; -import org.eclipse.jface.text.rules.Token; -import org.eclipse.jface.text.rules.WhitespaceRule; - -public class XMLScanner extends RuleBasedScanner { - - public XMLScanner(IResourcePool pool) { - IToken procInstr = new Token(new TextAttribute(pool.getColorUnchecked(ResourceProvider.COLOR_PROC_INSTR))); - - IRule[] rules = new IRule[2]; - // Add rule for processing instructions - rules[0] = new SingleLineRule("<?", "?>", procInstr); //$NON-NLS-1$//$NON-NLS-2$ - // Add generic whitespace rule. - rules[1] = new WhitespaceRule(new XMLWhitespaceDetector()); - - setRules(rules); - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLTagScanner.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLTagScanner.java deleted file mode 100644 index 3a120368..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLTagScanner.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.xml; - -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.services.IResourcePool; -import org.eclipse.jface.text.TextAttribute; -import org.eclipse.jface.text.rules.IRule; -import org.eclipse.jface.text.rules.IToken; -import org.eclipse.jface.text.rules.RuleBasedScanner; -import org.eclipse.jface.text.rules.SingleLineRule; -import org.eclipse.jface.text.rules.Token; -import org.eclipse.jface.text.rules.WhitespaceRule; - -public class XMLTagScanner extends RuleBasedScanner { - - public XMLTagScanner(IResourcePool pool) { - IToken string = new Token(new TextAttribute(pool.getColorUnchecked(ResourceProvider.COLOR_STRING))); - - IRule[] rules = new IRule[3]; - - // Add rule for double quotes - rules[0] = new SingleLineRule("\"", "\"", string, '\\'); //$NON-NLS-1$//$NON-NLS-2$ - // Add a rule for single quotes - rules[1] = new SingleLineRule("'", "'", string, '\\'); //$NON-NLS-1$ //$NON-NLS-2$ - // Add generic whitespace rule. - rules[2] = new WhitespaceRule(new XMLWhitespaceDetector()); - - setRules(rules); - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLWhitespaceDetector.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLWhitespaceDetector.java deleted file mode 100644 index 91a53aec..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLWhitespaceDetector.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.xml; - -import org.eclipse.jface.text.rules.IWhitespaceDetector; - -public class XMLWhitespaceDetector implements IWhitespaceDetector { - - @Override - public boolean isWhitespace(char c) { - return (c == ' ' || c == '\t' || c == '\n' || c == '\r'); - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/handlers/AbstractHandler.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/handlers/AbstractHandler.java deleted file mode 100644 index 62a9074e..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/handlers/AbstractHandler.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 432372 - *******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.internal.handlers; - -import javax.inject.Named; -import org.eclipse.e4.core.di.annotations.CanExecute; -import org.eclipse.e4.core.di.annotations.Optional; -import org.eclipse.e4.tools.emf.ui.internal.common.component.tabs.IViewEObjects; - -public class AbstractHandler { - - static final public String VIEWER_KEY = "org.eclipse.e4.tools.active-object-viewer"; //$NON-NLS-1$ - - @CanExecute - public boolean canExecute(@Optional @Named(VIEWER_KEY) IViewEObjects viewer) { - return (viewer != null); - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/handlers/AutosizeColumnsHandler.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/handlers/AutosizeColumnsHandler.java deleted file mode 100644 index b09dec25..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/handlers/AutosizeColumnsHandler.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 436889 - *******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.internal.handlers; - -import javax.inject.Named; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.core.di.annotations.Execute; -import org.eclipse.e4.tools.emf.ui.internal.common.component.tabs.IViewEObjects; - -public class AutosizeColumnsHandler extends MarkDuplicateItemsBase { - @Execute - public void execute(@Named(VIEWER_KEY) IViewEObjects viewer, IEclipseContext context) { - viewer.autosizeContent(); - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/handlers/MarkDuplicateAttributesHandler.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/handlers/MarkDuplicateAttributesHandler.java deleted file mode 100644 index d00cc705..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/handlers/MarkDuplicateAttributesHandler.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 432372, Ongoing Maintenance - *******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.internal.handlers; - -import java.util.Collection; -import java.util.HashSet; -import javax.inject.Named; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.core.di.annotations.Execute; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.common.component.tabs.IViewEObjects; -import org.eclipse.e4.tools.emf.ui.internal.common.component.tabs.empty.TitleAreaFilterDialogWithEmptyOptions; -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.window.Window; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Shell; - -public class MarkDuplicateAttributesHandler extends MarkDuplicateItemsBase { - - @Execute - public void execute(@Named(VIEWER_KEY) IViewEObjects viewer, IEclipseContext context, final Messages Messages) { - final HashSet<String> set = new HashSet<String>(); - Collection<EObject> allEObjects = viewer.getAllEObjects(); - for (EObject obj : allEObjects) { - for (EAttribute attribute : obj.eClass().getEAllAttributes()) { - set.add(attribute.getName()); - } - } - ILabelProvider renderer = new LabelProvider() { - @Override - public String getText(Object element) { - return String.valueOf(element); - } - }; - - TitleAreaFilterDialogWithEmptyOptions dlg = new TitleAreaFilterDialogWithEmptyOptions(context.get(Shell.class), renderer) { - @Override - protected Control createContents(Composite parent) { - Control ret = super.createContents(parent); - setMessage(Messages.MarkDuplicateAttributesHandler_SelectAnAttributeToMarkeDuplicate); - setTitle(Messages.MarkDuplicateAttributesHandler_MarkDuplicates); - setElements(set.toArray(new String[0])); - return ret; - } - }; - if (dlg.open() == Window.OK) { - Collection<EObject> marked = getDuplicateList(dlg.getFirstElement().toString(), allEObjects); - applyEmptyOption(marked, dlg.getFirstElement().toString(), dlg.getEmptyFilterOption()); - viewer.highlightEObjects(marked); - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/handlers/MarkDuplicateElementIdsHandler.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/handlers/MarkDuplicateElementIdsHandler.java deleted file mode 100644 index b8cb1453..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/handlers/MarkDuplicateElementIdsHandler.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 432372 - *******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.internal.handlers; - -public class MarkDuplicateElementIdsHandler extends MarkDuplicateItemsBase { - - public MarkDuplicateElementIdsHandler() { - setAttributeName("elementId"); //$NON-NLS-1$ - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/handlers/MarkDuplicateItemsBase.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/handlers/MarkDuplicateItemsBase.java deleted file mode 100644 index 848e40a6..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/handlers/MarkDuplicateItemsBase.java +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 432372 - *******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.internal.handlers; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.core.di.annotations.Execute; -import org.eclipse.e4.tools.emf.ui.internal.common.component.tabs.EmfUtil; -import org.eclipse.e4.tools.emf.ui.internal.common.component.tabs.IViewEObjects; -import org.eclipse.e4.tools.emf.ui.internal.common.component.tabs.empty.E; -import org.eclipse.e4.tools.emf.ui.internal.common.component.tabs.empty.EmptyFilterOption; -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EObject; - -public class MarkDuplicateItemsBase extends AbstractHandler { - - private String attName; - - @Execute - public void execute(IEclipseContext context) { - IViewEObjects viewer = (IViewEObjects) context.get(VIEWER_KEY); - Collection<EObject> duplicates = getDuplicateList(getAttName(), viewer.getAllEObjects()); - applyEmptyOption(duplicates, getAttName(), EmptyFilterOption.EXCLUDE); - viewer.highlightEObjects(duplicates); - } - - static Collection<EObject> getDuplicateList(String attName, Collection<EObject> all) { - Map<String, List<EObject>> map = getDuplicateMap(attName, all); - List<EObject> duplicates = new ArrayList<EObject>(); - for (String key : map.keySet()) { - List<EObject> list = map.get(key); - if (list.size() > 1) { - duplicates.addAll(list); - } - } - return duplicates; - } - - static Map<String, List<EObject>> getDuplicateMap(String attName, Collection<EObject> selected) { - ConcurrentHashMap<String, List<EObject>> map = new ConcurrentHashMap<String, List<EObject>>(); - for (Iterator<?> it = selected.iterator(); it.hasNext();) { - Object object = it.next(); - if (object instanceof EObject) { - EObject item = (EObject) object; - EAttribute att = EmfUtil.getAttribute(item, attName); - if (att != null) { - String attValue; - Object obj = item.eGet(att); - if (obj == null) { - attValue = ""; //$NON-NLS-1$ - } else { - attValue = String.valueOf(obj); - } - List<EObject> list = map.get(attValue); - if (list == null) { - list = new ArrayList<EObject>(); - map.put(attValue, list); - } - list.add(item); - } - } - } - return map; - } - - public String getAttName() { - return attName; - } - - public void setAttributeName(String attName) { - this.attName = attName; - } - - static protected void applyEmptyOption(Collection<EObject> marked, String attName, EmptyFilterOption emptyFilterOption) { - switch (emptyFilterOption) { - case EXCLUDE: - for (Iterator<?> it = marked.iterator(); it.hasNext();) { - EObject eObject = (EObject) it.next(); - if (E.isEmpty(EmfUtil.getAttributeValue(eObject, attName))) { - it.remove(); - } - } - break; - case ONLY: - for (Iterator<?> it = marked.iterator(); it.hasNext();) { - EObject eObject = (EObject) it.next(); - if (E.notEmpty(EmfUtil.getAttributeValue(eObject, attName))) { - it.remove(); - } - } - break; - case INCLUDE: - default: - break; - } - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/handlers/MarkDuplicateLabelsHandler.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/handlers/MarkDuplicateLabelsHandler.java deleted file mode 100644 index e352bc13..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/handlers/MarkDuplicateLabelsHandler.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 432372 - *******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.internal.handlers; - -public class MarkDuplicateLabelsHandler extends MarkDuplicateItemsBase { - - public MarkDuplicateLabelsHandler() { - setAttributeName("label"); //$NON-NLS-1$ - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/handlers/RepairDuplicateItemsHandler.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/handlers/RepairDuplicateItemsHandler.java deleted file mode 100644 index a0eae910..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/handlers/RepairDuplicateItemsHandler.java +++ /dev/null @@ -1,115 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 432372 - *******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.internal.handlers; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.core.di.annotations.CanExecute; -import org.eclipse.e4.core.di.annotations.Execute; -import org.eclipse.e4.tools.emf.ui.internal.common.component.tabs.EmfUtil; -import org.eclipse.e4.tools.emf.ui.internal.common.component.tabs.IViewEObjects; -import org.eclipse.e4.tools.emf.ui.internal.common.component.tabs.empty.E; -import org.eclipse.e4.tools.emf.ui.internal.common.component.tabs.empty.EmptyFilterOption; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.command.CompoundCommand; -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; - -public class RepairDuplicateItemsHandler extends MarkDuplicateItemsBase { - - static public String name = "org.eclipse.e4.tools.active-object-viewer"; //$NON-NLS-1$ - static String attName = "elementId"; //$NON-NLS-1$ - - @Override - @Execute - public void execute(IEclipseContext context) { - IViewEObjects viewer = (IViewEObjects) context.get(name); - Collection<EObject> all = viewer.getAllEObjects(); - Map<String, List<EObject>> map = MarkDuplicateElementIdsHandler.getDuplicateMap(attName, all); - Iterator<Entry<String, List<EObject>>> it = map.entrySet().iterator(); - CompoundCommand compoundCommand = new CompoundCommand(); - EditingDomain editingDomain = viewer.getEditingDomain(); - - while (it.hasNext()) { - Entry<String, List<EObject>> entry = it.next(); - List<EObject> listDups = entry.getValue(); - if (listDups.size() > 1) { - ArrayList<EObject> toFix = new ArrayList<EObject>(listDups.subList(1, listDups.size())); - Iterator<EObject> itToFix = toFix.iterator(); - while (itToFix.hasNext()) { - EObject eObject = itToFix.next(); - EAttribute att = EmfUtil.getAttribute(eObject, attName); - String value = (String) eObject.eGet(att); - // do not repair empty or null values - if (E.isEmpty(value)) { - break; - } - int index = -1; - while (map.containsKey(value)) { - index++; - int lastDot = value.lastIndexOf('.'); - if (lastDot == -1) { - lastDot = value.length(); - } - try { - String suffix = value.substring(lastDot + 1); - Integer.parseInt(suffix); - // ends with integer - value = value.substring(0, lastDot); - } catch (Exception e) { - } - value = value + "." + index; //$NON-NLS-1$ - } - Command cmd = SetCommand.create(editingDomain, eObject, att, value); - compoundCommand.append(cmd); - // Note: If the compound command cannot execute, we - // must revert these changes - listDups.remove(eObject); - List<EObject> newList = new ArrayList<EObject>(); - newList.add(eObject); - map.put(value, newList); - // Note: end - - } - } - } - - if (compoundCommand.isEmpty() == false) { - if (compoundCommand.canExecute()) { - editingDomain.getCommandStack().execute(compoundCommand); - } else { - // this will rollback our local map changes - // Object obj = - // ContextInjectionFactory.make(MarkDuplicateItemsHandler.class, - // context); - // ContextInjectionFactory.invoke(obj, Execute.class, context); - } - Collection<EObject> duplicateList = MarkDuplicateElementIdsHandler.getDuplicateList(attName, all); - applyEmptyOption(duplicateList, attName, EmptyFilterOption.EXCLUDE); - viewer.highlightEObjects(duplicateList); - } - } - - @CanExecute - public boolean canExecute(IEclipseContext context) { - IViewEObjects viewer = (IViewEObjects) context.get(name); - return (viewer != null); - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/handlers/ResetToDefaultHandler.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/handlers/ResetToDefaultHandler.java deleted file mode 100644 index 94116111..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/handlers/ResetToDefaultHandler.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation - *******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.internal.handlers; - -import javax.inject.Named; -import org.eclipse.e4.core.di.annotations.Execute; -import org.eclipse.e4.tools.emf.ui.internal.common.component.tabs.IViewEObjects; - -public class ResetToDefaultHandler extends AbstractHandler { - - @Execute - public void execute(@Named(VIEWER_KEY) IViewEObjects viewer) { - viewer.resetToDefault(); - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/handlers/UnmarkItemsHandler.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/handlers/UnmarkItemsHandler.java deleted file mode 100644 index b7918889..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/handlers/UnmarkItemsHandler.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 432372 - *******************************************************************************/ - -package org.eclipse.e4.tools.emf.ui.internal.handlers; - -import java.util.Collections; -import javax.inject.Named; -import org.eclipse.e4.core.di.annotations.Execute; -import org.eclipse.e4.tools.emf.ui.internal.common.component.tabs.IViewEObjects; -import org.eclipse.emf.ecore.EObject; - -public class UnmarkItemsHandler extends AbstractHandler { - - @Execute - public void execute(@Named(VIEWER_KEY) IViewEObjects viewer) { - viewer.highlightEObjects(Collections.<EObject> emptyList()); - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/imp/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/imp/Messages.java deleted file mode 100644 index 06bed42c..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/imp/Messages.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.eclipse.e4.tools.emf.ui.internal.imp; - -import org.eclipse.osgi.util.NLS; - -public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.e4.tools.emf.ui.internal.imp.messages"; //$NON-NLS-1$ - public static String ModelImportPage1_SelectPluginAndElements; - public static String ModelImportPage1_Description; - public static String ModelImportPage1_Go; - public static String ModelImportPage1_Import; - public static String ModelImportPage1_Import1; - public static String ModelImportPage1_SelectPlugInAndElementsToImport; - public static String ModelImportPage1_ToImport; - public static String ModelImportPage1_WizardPage; - public static String ModelImportPage1_WrongInput; - public static String ModelImportWizard_ImportWizard; - public static String ModelImportWizard_Model; - public static String ModelImportWizard_UnknownElement; - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - private Messages() { - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/imp/ModelImportPage1.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/imp/ModelImportPage1.java deleted file mode 100644 index c001fdc4..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/imp/ModelImportPage1.java +++ /dev/null @@ -1,194 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Remain BV, Industrial-TSI BV and others. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Wim Jongmam <wim.jongman@remainsoftware.com> - initial API and implementation - * Steven Spungin <steven@spungin.tv> - Ongoing Maintenance - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.imp; - -import java.util.ArrayList; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.jface.layout.TableColumnLayout; -import org.eclipse.jface.viewers.CheckStateChangedEvent; -import org.eclipse.jface.viewers.CheckboxTableViewer; -import org.eclipse.jface.viewers.ColumnWeightData; -import org.eclipse.jface.viewers.ComboViewer; -import org.eclipse.jface.viewers.ICheckStateListener; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.TableViewerColumn; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.wizard.IWizard; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.TableColumn; - -public class ModelImportPage1 extends WizardPage { - - private class TableLabelProvider extends LabelProvider implements ITableLabelProvider { - @Override - public Image getColumnImage(Object element, int columnIndex) { - return null; - } - - @Override - public String getColumnText(Object element, int columnIndex) { - if (element instanceof IConfigurationElement) { - IConfigurationElement config = (IConfigurationElement) element; - return config.getAttribute(wizard.getMappingName()); - } - return element.toString(); - } - } - - private IExtensionRegistry registry; - private ModelImportWizard wizard; - protected Object[] checkedElements; - - private class TableContentProvider implements IStructuredContentProvider { - @Override - public Object[] getElements(Object inputElement) { - - if (!(inputElement instanceof RegistryStruct)) { - return new String[] { Messages.ModelImportPage1_WrongInput }; - } - - RegistryStruct input = (RegistryStruct) inputElement; - - return RegistryUtil.getExtensions(registry, input, wizard.isLiveModel()); - } - - @Override - public void dispose() { - } - - @Override - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - } - } - - private class ComboContentProvider implements IStructuredContentProvider { - @Override - public Object[] getElements(Object inputElement) { - return RegistryUtil.getProvidingBundles(registry, wizard.getExtensionPoint(), wizard.isLiveModel()); - } - - @Override - public void dispose() { - } - - @Override - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - } - } - - /** - * Create the wizard. - */ - public ModelImportPage1() { - super(Messages.ModelImportPage1_WizardPage); - setTitle(Messages.ModelImportPage1_Import + " "); //$NON-NLS-1$ - setDescription(Messages.ModelImportPage1_SelectPlugInAndElementsToImport); - wizard = (ModelImportWizard) getWizard(); - setPageComplete(false); - } - - /** - * Create contents of the wizard. - * - * @param parent - */ - @Override - public void createControl(Composite parent) { - Composite container = new Composite(parent, SWT.NULL); - - setControl(container); - container.setLayout(new GridLayout(1, false)); - - ComboViewer comboViewer = new ComboViewer(container, SWT.NONE); - Combo combo = comboViewer.getCombo(); - combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); - - Composite composite = new Composite(container, SWT.NONE); - composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); - TableColumnLayout tcl_composite = new TableColumnLayout(); - composite.setLayout(tcl_composite); - - final CheckboxTableViewer checkboxTableViewer = CheckboxTableViewer.newCheckList(composite, SWT.BORDER | SWT.FULL_SELECTION); - - TableViewerColumn tableViewerColumn = new TableViewerColumn(checkboxTableViewer, SWT.NONE); - TableColumn column = tableViewerColumn.getColumn(); - column.setResizable(false); - tcl_composite.setColumnData(column, new ColumnWeightData(1, ColumnWeightData.MINIMUM_WIDTH, true)); - column.setText(Messages.ModelImportPage1_Description); - checkboxTableViewer.setLabelProvider(new TableLabelProvider()); - checkboxTableViewer.setContentProvider(new TableContentProvider()); - comboViewer.setContentProvider(new ComboContentProvider()); - - comboViewer.setInput(Messages.ModelImportPage1_Go); - - comboViewer.addSelectionChangedListener(new ISelectionChangedListener() { - - @Override - public void selectionChanged(SelectionChangedEvent event) { - String bundle = ((IStructuredSelection) event.getSelection()).getFirstElement().toString(); - RegistryStruct struct = RegistryUtil.getStruct(wizard.getApplicationElement(), wizard.getHint()); - struct.setBundle(bundle); - checkboxTableViewer.setInput(struct); - - } - }); - - checkboxTableViewer.addCheckStateListener(new ICheckStateListener() { - @Override - public void checkStateChanged(CheckStateChangedEvent event) { - checkedElements = checkboxTableViewer.getCheckedElements(); - if (checkedElements.length > 0) { - setPageComplete(true); - } else { - setPageComplete(false); - } - } - }); - } - - @Override - public void setWizard(IWizard newWizard) { - this.wizard = (ModelImportWizard) newWizard; - setTitle(Messages.ModelImportPage1_Import + " " + wizard.getApplicationElement().getSimpleName()); //$NON-NLS-1$ - - String hint = wizard.getHint(); - if (hint != null && hint.length() > 0) { - setDescription(Messages.ModelImportPage1_SelectPluginAndElements + " (" + hint + ") " + Messages.ModelImportPage1_ToImport); //$NON-NLS-1$//$NON-NLS-2$ - // else already set - } - - super.setWizard(newWizard); - } - - public IConfigurationElement[] getConfigurationElements() { - ArrayList<IConfigurationElement> result = new ArrayList<IConfigurationElement>(); - for (Object element : checkedElements) { - if (element instanceof IConfigurationElement) { - result.add((IConfigurationElement) element); - } - } - return result.toArray(new IConfigurationElement[0]); - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/imp/ModelImportWizard.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/imp/ModelImportWizard.java deleted file mode 100644 index e9afdeef..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/imp/ModelImportWizard.java +++ /dev/null @@ -1,140 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Remain BV, Industrial-TSI BV and others. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Wim Jongmam <wim.jongman@remainsoftware.com> - initial API and implementation - * Steven Spungin <steven@spungin.tv> - Ongoing Maintenance - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.imp; - -import org.eclipse.core.runtime.Assert; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; -import org.eclipse.e4.tools.services.IResourcePool; -import org.eclipse.e4.ui.model.application.MApplication; -import org.eclipse.e4.ui.model.application.MApplicationElement; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.wizard.Wizard; - -public class ModelImportWizard extends Wizard { - - private final Class<? extends MApplicationElement> applicationElement; - - private ModelImportPage1 page1; - - private final MApplication application; - - private final AbstractComponentEditor editor; - - private final String hint; - - public ModelImportWizard(Class<? extends MApplicationElement> applicationElement, AbstractComponentEditor editor, - IResourcePool resourcePool) { - this(applicationElement, editor, "", resourcePool); //$NON-NLS-1$ - } - - public ModelImportWizard(Class<? extends MApplicationElement> applicationElement, AbstractComponentEditor editor, - String hint, IResourcePool resourcePool) { - this.applicationElement = applicationElement; - this.editor = editor; - this.hint = hint; - application = (MApplication) editor.getEditor().getModelProvider().getRoot().get(0); - setWindowTitle(Messages.ModelImportWizard_Model - + " " + applicationElement.getSimpleName() + " " + Messages.ModelImportWizard_ImportWizard); //$NON-NLS-1$ //$NON-NLS-2$ - setDefaultPageImageDescriptor(ImageDescriptor.createFromImage(resourcePool - .getImageUnchecked(ResourceProvider.IMG_Wizban16_imp3x_wiz))); - Assert.isNotNull(RegistryUtil.getStruct(applicationElement, getHint()), - Messages.ModelImportWizard_UnknownElement + ": " + applicationElement.getClass().getName()); //$NON-NLS-1$ - } - - @Override - public void addPages() { - page1 = new ModelImportPage1(); - page1.setWizard(this); - addPage(page1); - } - - @Override - public boolean performFinish() { - - return true; - } - - /** - * @return the {@link MApplicationElement} passed in the constructor. - */ - public Class<? extends MApplicationElement> getApplicationElement() { - return applicationElement; - } - - /** - * @return the extension point name associated with the {@link MApplicationElement} that is passed in the - * constructor of - * this wizard. - * @see #MAPPING_EXTENSION - * @see #getApplicationElement() - */ - protected String getExtensionPointName() { - return RegistryUtil.getStruct(applicationElement, getHint()).getExtensionPointName(); - } - - /** - * @return the extension point id associated with the {@link MApplicationElement} that is passed in the constructor - * of - * this wizard. - * @see #MAPPING_EXTENSION - * @see #getApplicationElement() - */ - protected String getExtensionPoint() { - return RegistryUtil.getStruct(applicationElement, getHint()).getExtensionPoint(); - } - - /** - * @return the attribute name of the {@link IConfigurationElement} that - * contains the description that you want to see in the wizard page. - * @see #MAPPING_NAME - */ - protected String getMappingName() { - return RegistryUtil.getStruct(applicationElement, getHint()).getMappingName(); - } - - /** - * Returns the list of {@link MApplicationElement}s of the type passed in - * the constructor of the wizard. - * - * - * - * @return an array of {@link MApplicationElement} - */ - public MApplicationElement[] getElements(Class<? extends MApplicationElement> type) { - return RegistryUtil.getModelElements(type, getHint(), application, page1.getConfigurationElements()); - } - - public AbstractComponentEditor getEditor() { - return editor; - } - - /** - * Returns if this is a live model. - * - * @return true or false - */ - public boolean isLiveModel() { - return editor.getEditor().isLiveModel(); - } - - /** - * Returns the hint that explains the meaning of the caller. - * - * @return the hint as a String - */ - public String getHint() { - return hint; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/imp/RegistryStruct.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/imp/RegistryStruct.java deleted file mode 100644 index 2ba95e84..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/imp/RegistryStruct.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.eclipse.e4.tools.emf.ui.internal.imp; - -public class RegistryStruct { - - String bundle; - String extensionPoint; - String extensionPointName; - String mappingName; - - public RegistryStruct(String bundle, String extensionPoint, String extensionPointName, String mappingName) { - super(); - this.bundle = bundle; - this.extensionPoint = extensionPoint; - this.extensionPointName = extensionPointName; - this.mappingName = mappingName; - } - - public String getBundle() { - return bundle; - } - - public String getExtensionPoint() { - return extensionPoint; - } - - public String getExtensionPointName() { - return extensionPointName; - } - - public String getMappingName() { - return mappingName; - } - - public void setBundle(String bundle) { - this.bundle = bundle; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/imp/RegistryUtil.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/imp/RegistryUtil.java deleted file mode 100644 index 537a4494..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/imp/RegistryUtil.java +++ /dev/null @@ -1,476 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Remain BV, Industrial-TSI BV and others. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Wim Jongmam <wim.jongman@remainsoftware.com> - initial API and implementation - * Steven Spungin <steven@spungin.tv> - Ongoing Maintenance - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.imp; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; - -import org.eclipse.core.runtime.Assert; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtension; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.e4.tools.emf.ui.common.IExtensionLookup; -import org.eclipse.e4.ui.model.application.MApplication; -import org.eclipse.e4.ui.model.application.MApplicationElement; -import org.eclipse.e4.ui.model.application.commands.MCategory; -import org.eclipse.e4.ui.model.application.commands.MCommand; -import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; -import org.eclipse.e4.ui.model.application.commands.MHandler; -import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptor; -import org.eclipse.e4.ui.model.application.ui.advanced.MAdvancedFactory; -import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective; -import org.eclipse.e4.ui.model.application.ui.basic.MInputPart; -import org.eclipse.e4.ui.model.application.ui.basic.MPart; -import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.MMenu; -import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; -import org.eclipse.e4.ui.model.application.ui.menu.MToolBar; -import org.eclipse.e4.ui.workbench.UIEvents.ApplicationElement; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.osgi.framework.BundleContext; -import org.osgi.framework.FrameworkUtil; -import org.osgi.framework.InvalidSyntaxException; -import org.osgi.framework.ServiceReference; - -@SuppressWarnings("deprecation") -public class RegistryUtil { - - private static final String PLATFORM = "platform:"; //$NON-NLS-1$ - private static final String EMPTY_STRING = ""; //$NON-NLS-1$ - private static final String COMMAND_ID = "commandId"; //$NON-NLS-1$ - private static final String CATEGORY_ID = "categoryId"; //$NON-NLS-1$ - private static final String COMPATIBILITY_VIEW = "bundleclass://org.eclipse.ui.workbench/org.eclipse.ui.internal.e4.compatibility.CompatibilityView"; //$NON-NLS-1$ - private static final String VIEW_MENU = "ViewMenu"; //$NON-NLS-1$ - private static final String LAUNCHER = "launcher"; //$NON-NLS-1$ - private static final String EDITOR = "editor"; //$NON-NLS-1$ - private static final String VIEW = "View"; //$NON-NLS-1$ - private static final String CATEGORY_TAG = "categoryTag:"; //$NON-NLS-1$ - private static final String CATEGORY = "category"; //$NON-NLS-1$ - private static final String CLASS = "class"; //$NON-NLS-1$ - private static final String DESCRIPTION = "description"; //$NON-NLS-1$ - private static final String ICON = "icon"; //$NON-NLS-1$ - private static final String NAME = "name"; //$NON-NLS-1$ - private static final String ID = "id"; //$NON-NLS-1$ - public final static String HINT_VIEW = "view"; //$NON-NLS-1$ - public final static String HINT_EDITOR = EDITOR; - public final static String HINT_COMPAT_VIEW = "compatibilityView"; //$NON-NLS-1$ - - /** - * - * @param t - * @param application - * @param elements - */ - public static MApplicationElement[] getModelElements(Class<? extends MApplicationElement> t, String hint, - MApplication application, IConfigurationElement... elements) { - - Assert.isNotNull(t); - Assert.isNotNull(elements); - Assert.isTrue(elements.length > 0); - - if (t.equals(MCommand.class)) { - return getCommands(elements, application); - } else if (t.equals(MCategory.class)) { - return getCategories(elements); - } else if (t.equals(MPerspective.class)) { - return getPerspectives(elements); - } else if (t.equals(MPart.class) && HINT_COMPAT_VIEW.equals(hint)) { - return getViewsAsCompatibilityViews(elements); - } else if (t.equals(MPart.class)) { - return getViews(elements); - } else if (t.equals(MInputPart.class)) { - return getEditors(elements); - } else if (t.equals(MHandler.class)) { - return getHandlers(elements, application); - } else if (t.equals(MPartDescriptor.class) && HINT_EDITOR.equals(hint)) { - return getEditorPartDescriptors(elements); - } else if (t.equals(MPartDescriptor.class) && HINT_VIEW.equals(hint)) { - return getViewPartDescriptors(elements); - } else if (t.equals(MPartDescriptor.class) && HINT_COMPAT_VIEW.equals(hint)) { - return getPartDescriptorsAsCompatibilyViews(elements); - } - return new MApplicationElement[0]; - } - - private static MCommand[] getCommands(IConfigurationElement[] elements, MApplication application) { - - final ArrayList<MCommand> result = new ArrayList<MCommand>(); - - final MCommandsFactory commandsFactory = MCommandsFactory.INSTANCE; - - for (final IConfigurationElement element : elements) { - - final MCommand command = commandsFactory.createCommand(); - command.setCommandName(element.getAttribute(NAME)); - command.setDescription(element.getAttribute(DESCRIPTION)); - command.setElementId(element.getAttribute(ID)); - final String catId = element.getAttribute(CATEGORY_ID); - - if (catId != null && catId.trim().length() > 0) { - final List<MCategory> categories = application.getCategories(); - for (final MCategory category : categories) { - if (category.getElementId().equals(catId)) { - command.setCategory(category); - break; - } - } - } - - result.add(command); - } - - return result.toArray(new MCommand[0]); - } - - private static MPerspective[] getPerspectives(IConfigurationElement[] elements) { - - final ArrayList<MPerspective> result = new ArrayList<MPerspective>(); - - final MAdvancedFactory factory = MAdvancedFactory.INSTANCE; - - for (final IConfigurationElement element : elements) { - final MPerspective perspective = factory.createPerspective(); - perspective.setLabel(element.getAttribute(NAME)); - perspective.setIconURI(getIconURI(element, ICON)); - perspective.setElementId(element.getAttribute(ID)); - perspective.setToBeRendered(true); - perspective.setVisible(true); - result.add(perspective); - } - - return result.toArray(new MPerspective[0]); - } - - private static MCategory[] getCategories(IConfigurationElement[] elements) { - - final ArrayList<MCategory> result = new ArrayList<MCategory>(); - - final MCommandsFactory commandsFactory = MCommandsFactory.INSTANCE; - - for (final IConfigurationElement element : elements) { - - final MCategory category = commandsFactory.createCategory(); - category.setDescription(element.getAttribute(DESCRIPTION)); - category.setElementId(element.getAttribute(ID)); - category.setName(element.getAttribute(NAME)); - - result.add(category); - } - - return result.toArray(new MCategory[0]); - } - - private static MPart[] getViews(IConfigurationElement[] elements) { - - final ArrayList<MPart> result = new ArrayList<MPart>(); - for (final IConfigurationElement element : elements) { - final MPart part = (MPart) EcoreUtil.create(BasicPackageImpl.Literals.PART); - part.setElementId(element.getAttribute(ID)); - part.setLabel(element.getAttribute(NAME)); - part.setIconURI(getIconURI(element, ICON)); - part.setContributionURI(getContributionURI(element, CLASS)); - part.setToBeRendered(true); - part.setVisible(true); - part.setToolbar(createToolBar(part)); - part.getMenus().add(createViewMenu(part)); - part.setCloseable(true); - part.getTags().add(VIEW); - if (element.getAttribute(CATEGORY) != null) { - part.getTags().add(CATEGORY_TAG + element.getAttribute(CATEGORY)); - } - - result.add(part); - } - return result.toArray(new MPart[0]); - } - - private static MToolBar createToolBar(MPart part) { - final MToolBar toolBar = MMenuFactory.INSTANCE.createToolBar(); - toolBar.setElementId(part.getElementId()); - return toolBar; - } - - private static MMenu createViewMenu(MPart part) { - final MMenu menu = MMenuFactory.INSTANCE.createMenu(); - menu.setElementId(part.getElementId()); - menu.getTags().add(VIEW_MENU); - return menu; - } - - private static MPart[] getViewsAsCompatibilityViews(IConfigurationElement[] elements) { - final ArrayList<MPart> result = new ArrayList<MPart>(); - final MPart[] parts = getViews(elements); - for (final MPart part : parts) { - part.setContributionURI(COMPATIBILITY_VIEW); - result.add(part); - } - return result.toArray(new MPart[0]); - } - - private static MPartDescriptor[] getPartDescriptorsAsCompatibilyViews(IConfigurationElement[] elements) { - final ArrayList<MPartDescriptor> result = new ArrayList<MPartDescriptor>(); - final MPartDescriptor[] parts = getViewPartDescriptors(elements); - for (final MPartDescriptor part : parts) { - part.setContributionURI(COMPATIBILITY_VIEW); - result.add(part); - } - return result.toArray(new MPartDescriptor[0]); - } - - private static MPart[] getEditors(IConfigurationElement[] elements) { - - final ArrayList<MPart> result = new ArrayList<MPart>(); - for (final IConfigurationElement element : elements) { - if ("editor".equals(element.getName())) /* Sanity Check */{ //$NON-NLS-1$ - final MPart part = (MPart) EcoreUtil.create(BasicPackageImpl.Literals.PART); - part.setElementId(element.getAttribute("id")); //$NON-NLS-1$ - part.setLabel(element.getAttribute("name")); //$NON-NLS-1$ - part.setIconURI(getIconURI(element, "icon")); //$NON-NLS-1$ - if (element.getAttribute("class") != null) { //$NON-NLS-1$ - part.setContributionURI(getContributionURI(element, "class")); //$NON-NLS-1$ - } else { - part.setContributionURI(getContributionURI(element, "launcher")); //$NON-NLS-1$ - } - part.setToBeRendered(true); - part.setVisible(true); - part.setToolbar(createToolBar(part)); - part.getMenus().add(createViewMenu(part)); - part.setCloseable(true); - result.add(part); - } - } - - return result.toArray(new MPart[0]); - } - - private static MPartDescriptor[] getEditorPartDescriptors(IConfigurationElement[] elements) { - - final ArrayList<MPartDescriptor> result = new ArrayList<MPartDescriptor>(); - for (final IConfigurationElement element : elements) { - final MPartDescriptor part = (MPartDescriptor) EcoreUtil - .create(org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl.Literals.PART_DESCRIPTOR); - part.setElementId(element.getAttribute(ID)); - part.setLabel(element.getAttribute(NAME)); - part.setIconURI(getIconURI(element, ICON)); - if (element.getAttribute(CLASS) != null) { - part.setContributionURI(getContributionURI(element, CLASS)); - } else { - part.setContributionURI(getContributionURI(element, LAUNCHER)); - } - part.setDirtyable(true); - part.setAllowMultiple(true); - - final MToolBar toolBar = MMenuFactory.INSTANCE.createToolBar(); - toolBar.setElementId(part.getElementId()); - part.setToolbar(toolBar); - - final MMenu menu = MMenuFactory.INSTANCE.createMenu(); - menu.setElementId(part.getElementId()); - menu.getTags().add(VIEW_MENU); - part.getMenus().add(menu); - - part.setCloseable(true); - result.add(part); - } - - return result.toArray(new MPartDescriptor[0]); - } - - private static MPartDescriptor[] getViewPartDescriptors(IConfigurationElement[] elements) { - - final ArrayList<MPartDescriptor> result = new ArrayList<MPartDescriptor>(); - for (final IConfigurationElement element : elements) { - final MPartDescriptor part = (MPartDescriptor) EcoreUtil - .create(org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl.Literals.PART_DESCRIPTOR); - part.setElementId(element.getAttribute(ID)); - part.setLabel(element.getAttribute(NAME)); - part.setIconURI(getIconURI(element, ICON)); - - final MToolBar toolBar = MMenuFactory.INSTANCE.createToolBar(); - toolBar.setElementId(part.getElementId()); - part.setToolbar(toolBar); - - final MMenu menu = MMenuFactory.INSTANCE.createMenu(); - menu.setElementId(part.getElementId()); - menu.getTags().add(VIEW_MENU); - part.getMenus().add(menu); - - part.setCloseable(true); - result.add(part); - } - - return result.toArray(new MPartDescriptor[0]); - } - - private static MHandler[] getHandlers(IConfigurationElement[] elements, MApplication application) { - - final ArrayList<MHandler> result = new ArrayList<MHandler>(); - for (final IConfigurationElement element : elements) { - final MHandler hand = MCommandsFactory.INSTANCE.createHandler(); - hand.setElementId(element.getAttribute(ID)); - hand.setContributionURI(getContributionURI(element, CLASS)); - - final String cmdId = element.getAttribute(COMMAND_ID); - - if (cmdId != null && cmdId.trim().length() > 0) { - final List<MCommand> categories = application.getCommands(); - for (final MCommand command : categories) { - if (command.getElementId().equals(cmdId)) { - hand.setCommand(command); - break; - } - } - } - result.add(hand); - } - return result.toArray(new MHandler[0]); - } - - private static String getIconURI(IConfigurationElement element, String attribute) { - if (element.getAttribute(attribute) == null) { - return EMPTY_STRING; - } - // FIXME any other cases? - if (element.getAttribute(attribute).startsWith(PLATFORM)) { - return element.getAttribute(attribute); - } - return "platform:/plugin/" + element.getContributor().getName() + "/" + element.getAttribute(attribute); //$NON-NLS-1$ //$NON-NLS-2$ - } - - private static String getContributionURI(IConfigurationElement element, String attribute) { - return "bundleclass://" + element.getContributor().getName() + "/" + element.getAttribute(attribute); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * Returns a list of bundle id's that have extension to the passed extension - * point. - * - * @param registry - * @param extensionPoint - * @return the bundle ids as an array of Strings - */ - public static String[] getProvidingBundles(IExtensionRegistry registry, String extensionPoint, boolean isLive) { - - final IExtensionLookup service = getService(IExtensionLookup.class, null); - - if (service == null) { - return new String[] { "No " + IExtensionLookup.class.getName() + " service found." }; //$NON-NLS-1$ //$NON-NLS-2$ - } - - final ArrayList<String> result = new ArrayList<String>(); - - final IExtension[] extensions = service.findExtensions(extensionPoint, isLive); - for (final IExtension extension : extensions) { - final IConfigurationElement[] elements = extension.getConfigurationElements(); - for (final IConfigurationElement element : elements) { - if (!result.contains(element.getContributor().getName())) { - result.add(element.getContributor().getName()); - } - } - } - - final String[] resultArray = result.toArray(new String[0]); - Arrays.sort(resultArray); - return resultArray; - } - - /** - * - * @param registry - * @param struct - * @return the array of {@link IConfigurationElement} objects that meets the - * passed criteria. - */ - public static IConfigurationElement[] getExtensions(IExtensionRegistry registry, RegistryStruct struct, - boolean isLive) { - - final IExtensionLookup service = getService(IExtensionLookup.class, null); - if (struct == null || service == null) { - return new IConfigurationElement[0]; - } - - final ArrayList<IConfigurationElement> result = new ArrayList<IConfigurationElement>(); - - final IExtension[] extensions = service.findExtensions(struct.getExtensionPoint(), isLive); - for (final IExtension extension : extensions) { - final IConfigurationElement[] elements = extension.getConfigurationElements(); - for (final IConfigurationElement element : elements) { - if (element.getContributor().getName().equals(struct.getBundle())) { - if (element.getName().equals(struct.getExtensionPointName())) { - result.add(element); - } - } - } - } - - return result.toArray(new IConfigurationElement[0]); - } - - /** - * This will return a structure that contains the registry information we - * are looking for. - * - * @param applicationElement - * @return the structure that matches the extension registry to the passed {@link ApplicationElement} - */ - public static RegistryStruct getStruct(Class<? extends MApplicationElement> applicationElement, String hint) { - - if (applicationElement == MCommand.class) { - return new RegistryStruct(EMPTY_STRING, "org.eclipse.ui.commands", "command", NAME); //$NON-NLS-1$ //$NON-NLS-2$ - } else if (applicationElement == MCategory.class) { - return new RegistryStruct(EMPTY_STRING, "org.eclipse.ui.commands", CATEGORY, NAME); //$NON-NLS-1$ - } else if (applicationElement == MPerspective.class) { - return new RegistryStruct(EMPTY_STRING, "org.eclipse.ui.perspectives", "perspective", NAME); //$NON-NLS-1$ //$NON-NLS-2$ - } else if (applicationElement == MPart.class) { - return new RegistryStruct(EMPTY_STRING, "org.eclipse.ui.views", "view", NAME); //$NON-NLS-1$ //$NON-NLS-2$ - } else if (applicationElement == MHandler.class) { - return new RegistryStruct(EMPTY_STRING, "org.eclipse.ui.handlers", "handler", COMMAND_ID); //$NON-NLS-1$ //$NON-NLS-2$ - } else if (applicationElement == MPart.class) { - return new RegistryStruct(EMPTY_STRING, "org.eclipse.ui.views", "view", NAME); //$NON-NLS-1$ //$NON-NLS-2$ - } - - else if (applicationElement == MInputPart.class) { - return new RegistryStruct("", "org.eclipse.ui.editors", "editor", "name"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - } - - else if (applicationElement == MPartDescriptor.class) { - if (hint == HINT_EDITOR) - { - return new RegistryStruct(EMPTY_STRING, "org.eclipse.ui.editors", EDITOR, NAME); //$NON-NLS-1$ - } - if (hint == HINT_VIEW || hint == HINT_COMPAT_VIEW) - { - return new RegistryStruct(EMPTY_STRING, "org.eclipse.ui.views", "view", NAME); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - return null; - } - - private static <T> T getService(Class<T> clazz, String filter) { - - try { - final BundleContext context = FrameworkUtil.getBundle(RegistryUtil.class).getBundleContext(); - Collection<ServiceReference<T>> references; - references = context.getServiceReferences(clazz, filter); - for (final ServiceReference<T> reference : references) { - return context.getService(reference); - } - } catch (final InvalidSyntaxException e) { - // FIXME log - } - return null; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/imp/messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/imp/messages.properties deleted file mode 100644 index b2d9b523..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/imp/messages.properties +++ /dev/null @@ -1,11 +0,0 @@ -ModelImportPage1_SelectPluginAndElements=Select plug-in and elements -ModelImportPage1_Description=Description -ModelImportPage1_Go=go -ModelImportPage1_Import=Import -ModelImportPage1_SelectPlugInAndElementsToImport=Select plug-in and elements to import -ModelImportPage1_ToImport=to import -ModelImportPage1_WizardPage=wizardPage -ModelImportPage1_WrongInput=Wrong input -ModelImportWizard_ImportWizard=Import Wizard -ModelImportWizard_Model=Model -ModelImportWizard_UnknownElement=Unknown Element diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbm/ApplicationModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbm/ApplicationModelEditor.java deleted file mode 100644 index f994c56b..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbm/ApplicationModelEditor.java +++ /dev/null @@ -1,170 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - - - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Wim Jongman <wim.jongman@remainsoftware.com> - https://bugs.eclipse.org/bugs/show_bug.cgi?id=393150 - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.wbm; - -import java.io.IOException; -import javax.annotation.PreDestroy; -import javax.inject.Inject; -import javax.inject.Named; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResourceChangeEvent; -import org.eclipse.core.resources.IResourceChangeListener; -import org.eclipse.core.resources.IResourceDelta; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Status; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.core.di.annotations.Optional; -import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.services.IResourcePool; -import org.eclipse.e4.ui.di.UISynchronize; -import org.eclipse.e4.ui.model.application.ui.basic.MPart; -import org.eclipse.e4.ui.workbench.modeling.EPartService; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Shell; -import org.osgi.framework.FrameworkUtil; - -public class ApplicationModelEditor extends ModelEditor { - - private static final String EDITORPROJECT = "org.eclipse.e4.tools.emf.ui.editorproject"; //$NON-NLS-1$ - - @Inject - @Optional - MPart part; - - @Inject - EPartService partService; - - private Resource resource; - - private IProject project; - - @Inject - Shell shell; - - @Inject - UISynchronize sync; - - @Inject - public ApplicationModelEditor(Composite composite, IEclipseContext context, IModelResource modelProvider, @Named(EDITORPROJECT) @Optional IProject project, IResourcePool resourcePool) { - super(composite, context, modelProvider, project, resourcePool); - EList<Resource> resources = modelProvider.getEditingDomain().getResourceSet().getResources(); - if (!resources.isEmpty()) { - resource = resources.get(0); - } - } - - @Inject - public void addResourceListener(@Named(EDITORPROJECT) @Optional IProject project) { - if (project != null && resource != null) { - this.project = project; - project.getWorkspace().addResourceChangeListener(listener); - } - } - - @PreDestroy - private void removeResourceListener() { - if (project != null) { - project.getWorkspace().removeResourceChangeListener(listener); - } - } - - /** - * Listen for changes on the resource being edited. Will close the part if - * the resource was deleted or the containing project was closed. - */ - private IResourceChangeListener listener = new IResourceChangeListener() { - @Override - public void resourceChanged(IResourceChangeEvent event) { - - if (event.getType() == IResourceChangeEvent.PRE_CLOSE || event.getType() == IResourceChangeEvent.PRE_DELETE) { - if (event.getResource().equals(project)) { - hidePart(true); - } - return; - } - - if (resource == null) - return; - - IResourceDelta delta = event.getDelta().findMember(new Path(resource.getURI().toPlatformString(false))); - if (delta == null) { - return; - } - - if (delta.getKind() == IResourceDelta.REMOVED) { - hidePart(true); - } - - // If the current model editor is causing this resource change event - // then skip the reload. - if (!isSaving()) { - - // reload the model if the file has changed - if (delta.getKind() == IResourceDelta.CHANGED) { - reloadModel(); - } - } - } - - private void hidePart(boolean force) { - partService.hidePart(part, force); - } - }; - - /** - * Shows an error dialog based on the passed exception. It should never - * occur but if it does, the user can report a problem. - * - * @param exc - */ - protected void statusDialog(final Exception exc) { - try { - sync.syncExec(new Runnable() { - @Override - public void run() { - String bundle = FrameworkUtil.getBundle(getClass()).getSymbolicName(); - Status status = new Status(IStatus.ERROR, bundle, exc.getMessage()); - ErrorDialog.openError(shell, exc.getMessage(), exc.getMessage(), status); - exc.printStackTrace(System.err); - } - }); - } catch (Exception e) { - } - } - - /** - * Reload the model. - */ - protected void reloadModel() { - getModelProvider().getRoot().getRealm().asyncExec(new Runnable() { - @Override - public void run() { - try { - resource.unload(); - resource.load(null); - getModelProvider().replaceRoot(resource.getContents().get(0)); - doSave(new NullProgressMonitor()); - } catch (IOException e) { - statusDialog(e); - } - } - }); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.jdt.templates/.classpath b/bundles/org.eclipse.e4.tools.jdt.templates/.classpath deleted file mode 100644 index ad32c83a..00000000 --- a/bundles/org.eclipse.e4.tools.jdt.templates/.classpath +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="src" path="src"/> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/bundles/org.eclipse.e4.tools.jdt.templates/.project b/bundles/org.eclipse.e4.tools.jdt.templates/.project deleted file mode 100644 index e0303cd3..00000000 --- a/bundles/org.eclipse.e4.tools.jdt.templates/.project +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.e4.tools.jdt.templates</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ManifestBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.SchemaBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.pde.PluginNature</nature> - <nature>org.eclipse.jdt.core.javanature</nature> - </natures> -</projectDescription> diff --git a/bundles/org.eclipse.e4.tools.jdt.templates/.settings/org.eclipse.core.resources.prefs b/bundles/org.eclipse.e4.tools.jdt.templates/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index f548abbf..00000000 --- a/bundles/org.eclipse.e4.tools.jdt.templates/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,6 +0,0 @@ -eclipse.preferences.version=1 - -encoding//model/etypes.ecore=UTF-8 - - -encoding/<project>=UTF-8 diff --git a/bundles/org.eclipse.e4.tools.jdt.templates/.settings/org.eclipse.core.runtime.prefs b/bundles/org.eclipse.e4.tools.jdt.templates/.settings/org.eclipse.core.runtime.prefs deleted file mode 100644 index 5a0ad22d..00000000 --- a/bundles/org.eclipse.e4.tools.jdt.templates/.settings/org.eclipse.core.runtime.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -line.separator=\n diff --git a/bundles/org.eclipse.e4.tools.jdt.templates/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.e4.tools.jdt.templates/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index c9482977..00000000 --- a/bundles/org.eclipse.e4.tools.jdt.templates/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,418 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.builder.cleanOutputFolder=clean -org.eclipse.jdt.core.builder.duplicateResourceTask=warning -org.eclipse.jdt.core.builder.invalidClasspath=abort -org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore -org.eclipse.jdt.core.builder.resourceCopyExclusionFilter= -org.eclipse.jdt.core.circularClasspath=error -org.eclipse.jdt.core.classpath.exclusionPatterns=enabled -org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled -org.eclipse.jdt.core.classpath.outputOverlappingAnotherSource=error -org.eclipse.jdt.core.codeComplete.argumentPrefixes= -org.eclipse.jdt.core.codeComplete.argumentSuffixes= -org.eclipse.jdt.core.codeComplete.fieldPrefixes= -org.eclipse.jdt.core.codeComplete.fieldSuffixes= -org.eclipse.jdt.core.codeComplete.localPrefixes= -org.eclipse.jdt.core.codeComplete.localSuffixes= -org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= -org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= -org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= -org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= -org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled -org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore -org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull -org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault -org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable -org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.doc.comment.support=enabled -org.eclipse.jdt.core.compiler.maxProblemPerUnit=100 -org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.autoboxing=ignore -org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning -org.eclipse.jdt.core.compiler.problem.deadCode=warning -org.eclipse.jdt.core.compiler.problem.deprecation=warning -org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled -org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled -org.eclipse.jdt.core.compiler.problem.discouragedReference=warning -org.eclipse.jdt.core.compiler.problem.emptyStatement=warning -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore -org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning -org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled -org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore -org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning -org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning -org.eclipse.jdt.core.compiler.problem.forbiddenReference=error -org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning -org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled -org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning -org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore -org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning -org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=disabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=public -org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning -org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning -org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled -org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning -org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore -org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled -org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public -org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag -org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled -org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning -org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning -org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning -org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning -org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning -org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error -org.eclipse.jdt.core.compiler.problem.nullReference=warning -org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error -org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning -org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning -org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning -org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore -org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore -org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning -org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning -org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning -org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore -org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning -org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore -org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore -org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled -org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning -org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled -org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled -org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled -org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore -org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning -org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning -org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning -org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore -org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning -org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning -org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled -org.eclipse.jdt.core.compiler.problem.unusedImport=warning -org.eclipse.jdt.core.compiler.problem.unusedLabel=warning -org.eclipse.jdt.core.compiler.problem.unusedLocal=warning -org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled -org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning -org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning -org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.6 -org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled -org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,HIGH,LOW,LOW,LOW,LOW,LOW,NORMAL -org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX,PERF,MEM,POLISH,@generated NOT,@ADDED,APITODO -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_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=true -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=true -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=do not insert -org.eclipse.jdt.core.formatter.comment.line_length=120 -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=1 -org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=1 -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_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_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_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=false -org.eclipse.jdt.core.formatter.join_wrapped_lines=false -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=true -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 -org.eclipse.jdt.core.incompatibleJDKLevel=ignore -org.eclipse.jdt.core.incompleteClasspath=error diff --git a/bundles/org.eclipse.e4.tools.jdt.templates/.settings/org.eclipse.jdt.launching.prefs b/bundles/org.eclipse.e4.tools.jdt.templates/.settings/org.eclipse.jdt.launching.prefs deleted file mode 100644 index 3bb23527..00000000 --- a/bundles/org.eclipse.e4.tools.jdt.templates/.settings/org.eclipse.jdt.launching.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.launching.PREF_STRICTLY_COMPATIBLE_JRE_NOT_AVAILABLE=ignore diff --git a/bundles/org.eclipse.e4.tools.jdt.templates/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.e4.tools.jdt.templates/.settings/org.eclipse.jdt.ui.prefs deleted file mode 100644 index 791508d1..00000000 --- a/bundles/org.eclipse.e4.tools.jdt.templates/.settings/org.eclipse.jdt.ui.prefs +++ /dev/null @@ -1,115 +0,0 @@ -cleanup.add_default_serial_version_id=true -cleanup.add_generated_serial_version_id=false -cleanup.add_missing_annotations=true -cleanup.add_missing_deprecated_annotations=true -cleanup.add_missing_methods=false -cleanup.add_missing_nls_tags=false -cleanup.add_missing_override_annotations=true -cleanup.add_missing_override_annotations_interface_methods=true -cleanup.add_serial_version_id=false -cleanup.always_use_blocks=true -cleanup.always_use_parentheses_in_expressions=false -cleanup.always_use_this_for_non_static_field_access=false -cleanup.always_use_this_for_non_static_method_access=false -cleanup.convert_to_enhanced_for_loop=false -cleanup.correct_indentation=true -cleanup.format_source_code=true -cleanup.format_source_code_changes_only=false -cleanup.make_local_variable_final=true -cleanup.make_parameters_final=false -cleanup.make_private_fields_final=true -cleanup.make_type_abstract_if_missing_method=false -cleanup.make_variable_declarations_final=true -cleanup.never_use_blocks=false -cleanup.never_use_parentheses_in_expressions=true -cleanup.organize_imports=true -cleanup.qualify_static_field_accesses_with_declaring_class=false -cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true -cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -cleanup.qualify_static_member_accesses_with_declaring_class=true -cleanup.qualify_static_method_accesses_with_declaring_class=false -cleanup.remove_private_constructors=true -cleanup.remove_trailing_whitespaces=true -cleanup.remove_trailing_whitespaces_all=true -cleanup.remove_trailing_whitespaces_ignore_empty=false -cleanup.remove_unnecessary_casts=false -cleanup.remove_unnecessary_nls_tags=false -cleanup.remove_unused_imports=true -cleanup.remove_unused_local_variables=false -cleanup.remove_unused_private_fields=true -cleanup.remove_unused_private_members=false -cleanup.remove_unused_private_methods=true -cleanup.remove_unused_private_types=true -cleanup.sort_members=false -cleanup.sort_members_all=false -cleanup.use_blocks=true -cleanup.use_blocks_only_for_return_and_throw=false -cleanup.use_parentheses_in_expressions=true -cleanup.use_this_for_non_static_field_access=true -cleanup.use_this_for_non_static_field_access_only_if_necessary=true -cleanup.use_this_for_non_static_method_access=true -cleanup.use_this_for_non_static_method_access_only_if_necessary=true -cleanup_profile=_esmCleanUp -cleanup_settings_version=2 -eclipse.preferences.version=1 -editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true -formatter_profile=_esmFormatter -formatter_settings_version=12 -org.eclipse.jdt.ui.exception.name=ex -org.eclipse.jdt.ui.gettersetter.use.is=true -org.eclipse.jdt.ui.javadoc=true -org.eclipse.jdt.ui.keywordthis=false -org.eclipse.jdt.ui.overrideannotation=true -org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*******************************************************************************\r\n * Copyright (c) 2011-${year} EclipseSource Muenchen GmbH and others.\r\n * \r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n * \r\n * Contributors\:\r\n * ${user} - initial API and implementation\r\n ******************************************************************************/</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n *\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment"/><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/**\r\n * {@inheritDoc}\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="false" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">\t\t\t// TODO Auto-generated catch block\r\n\t\t\t// Do NOT catch all Exceptions ("catch (Exception e)")\r\n\t\t\t// Log AND handle Exceptions if possible \r\n //\r\n // You can just uncomment one of the lines below to log an exception\:\r\n\t\t\t// logException will show the logged excpetion to the user\r\n\t\t\t// ModelUtil.logException(${exception_var});\r\n\t\t\t// ModelUtil.logException("YOUR MESSAGE HERE", ${exception_var});\r\n\t\t\t// logWarning will only add the message to the error log\r\n\t\t\t// ModelUtil.logWarning("YOUR MESSAGE HERE", ${exception_var});\r\n\t\t\t// ModelUtil.logWarning("YOUR MESSAGE HERE");\r\n\t\t\t//\t\t\t\r\n\t\t\t// If handling is not possible declare and rethrow Exception</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates> -sp_cleanup.add_default_serial_version_id=true -sp_cleanup.add_generated_serial_version_id=false -sp_cleanup.add_missing_annotations=true -sp_cleanup.add_missing_deprecated_annotations=true -sp_cleanup.add_missing_methods=false -sp_cleanup.add_missing_nls_tags=false -sp_cleanup.add_missing_override_annotations=true -sp_cleanup.add_missing_override_annotations_interface_methods=true -sp_cleanup.add_serial_version_id=false -sp_cleanup.always_use_blocks=true -sp_cleanup.always_use_parentheses_in_expressions=false -sp_cleanup.always_use_this_for_non_static_field_access=false -sp_cleanup.always_use_this_for_non_static_method_access=false -sp_cleanup.convert_to_enhanced_for_loop=false -sp_cleanup.correct_indentation=true -sp_cleanup.format_source_code=true -sp_cleanup.format_source_code_changes_only=false -sp_cleanup.make_local_variable_final=true -sp_cleanup.make_parameters_final=false -sp_cleanup.make_private_fields_final=true -sp_cleanup.make_type_abstract_if_missing_method=false -sp_cleanup.make_variable_declarations_final=true -sp_cleanup.never_use_blocks=false -sp_cleanup.never_use_parentheses_in_expressions=true -sp_cleanup.on_save_use_additional_actions=true -sp_cleanup.organize_imports=true -sp_cleanup.qualify_static_field_accesses_with_declaring_class=false -sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_with_declaring_class=true -sp_cleanup.qualify_static_method_accesses_with_declaring_class=false -sp_cleanup.remove_private_constructors=true -sp_cleanup.remove_trailing_whitespaces=true -sp_cleanup.remove_trailing_whitespaces_all=true -sp_cleanup.remove_trailing_whitespaces_ignore_empty=false -sp_cleanup.remove_unnecessary_casts=false -sp_cleanup.remove_unnecessary_nls_tags=true -sp_cleanup.remove_unused_imports=true -sp_cleanup.remove_unused_local_variables=false -sp_cleanup.remove_unused_private_fields=true -sp_cleanup.remove_unused_private_members=false -sp_cleanup.remove_unused_private_methods=true -sp_cleanup.remove_unused_private_types=true -sp_cleanup.sort_members=false -sp_cleanup.sort_members_all=false -sp_cleanup.use_blocks=true -sp_cleanup.use_blocks_only_for_return_and_throw=false -sp_cleanup.use_parentheses_in_expressions=true -sp_cleanup.use_this_for_non_static_field_access=true -sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true -sp_cleanup.use_this_for_non_static_method_access=true -sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/bundles/org.eclipse.e4.tools.jdt.templates/.settings/org.eclipse.pde.api.tools.prefs b/bundles/org.eclipse.e4.tools.jdt.templates/.settings/org.eclipse.pde.api.tools.prefs deleted file mode 100644 index e4e3c007..00000000 --- a/bundles/org.eclipse.e4.tools.jdt.templates/.settings/org.eclipse.pde.api.tools.prefs +++ /dev/null @@ -1,97 +0,0 @@ -ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Error -ANNOTATION_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error -ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Error -ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD=Error -ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error -API_COMPONENT_ELEMENT_TYPE_REMOVED_API_TYPE=Error -API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_API_TYPE=Error -API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_TYPE=Error -API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Error -API_USE_SCAN_FIELD_SEVERITY=Error -API_USE_SCAN_METHOD_SEVERITY=Error -API_USE_SCAN_TYPE_SEVERITY=Error -CLASS_ELEMENT_TYPE_ADDED_METHOD=Error -CLASS_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error -CLASS_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error -CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error -CLASS_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error -CLASS_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error -CLASS_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error -CLASS_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error -CLASS_ELEMENT_TYPE_REMOVED_CONSTRUCTOR=Error -CLASS_ELEMENT_TYPE_REMOVED_FIELD=Error -CLASS_ELEMENT_TYPE_REMOVED_METHOD=Error -CLASS_ELEMENT_TYPE_REMOVED_SUPERCLASS=Error -CLASS_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error -CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error -CONSTRUCTOR_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error -CONSTRUCTOR_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error -CONSTRUCTOR_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error -CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error -ENUM_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error -ENUM_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error -ENUM_ELEMENT_TYPE_REMOVED_ENUM_CONSTANT=Error -ENUM_ELEMENT_TYPE_REMOVED_FIELD=Error -ENUM_ELEMENT_TYPE_REMOVED_METHOD=Error -ENUM_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error -FIELD_ELEMENT_TYPE_ADDED_VALUE=Error -FIELD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error -FIELD_ELEMENT_TYPE_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT=Error -FIELD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error -FIELD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error -FIELD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error -FIELD_ELEMENT_TYPE_CHANGED_TYPE=Error -FIELD_ELEMENT_TYPE_CHANGED_VALUE=Error -FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENT=Error -FIELD_ELEMENT_TYPE_REMOVED_VALUE=Error -ILLEGAL_EXTEND=Warning -ILLEGAL_IMPLEMENT=Warning -ILLEGAL_INSTANTIATE=Warning -ILLEGAL_OVERRIDE=Warning -ILLEGAL_REFERENCE=Warning -INTERFACE_ELEMENT_TYPE_ADDED_FIELD=Error -INTERFACE_ELEMENT_TYPE_ADDED_METHOD=Error -INTERFACE_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error -INTERFACE_ELEMENT_TYPE_ADDED_SUPER_INTERFACE_WITH_METHODS=Error -INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error -INTERFACE_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error -INTERFACE_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error -INTERFACE_ELEMENT_TYPE_REMOVED_FIELD=Error -INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Error -INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error -INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error -INVALID_JAVADOC_TAG=Warning -INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Error -LEAK_EXTEND=Warning -LEAK_FIELD_DECL=Warning -LEAK_IMPLEMENT=Warning -LEAK_METHOD_PARAM=Warning -LEAK_METHOD_RETURN_TYPE=Warning -METHOD_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error -METHOD_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error -METHOD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error -METHOD_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error -METHOD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error -METHOD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error -METHOD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error -METHOD_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error -METHOD_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Error -METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error -MISSING_EE_DESCRIPTIONS=Error -TYPE_PARAMETER_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error -TYPE_PARAMETER_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error -TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error -TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error -TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error -TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error -UNUSED_PROBLEM_FILTERS=Ignore -automatically_removed_unused_problem_filters=Disabled -eclipse.preferences.version=1 -incompatible_api_component_version=Error -incompatible_api_component_version_include_major_without_breaking_change=Disabled -incompatible_api_component_version_include_minor_without_api_change=Disabled -invalid_since_tag_version=Error -malformed_since_tag=Error -missing_since_tag=Error -report_api_breakage_when_major_version_incremented=Disabled -report_resolution_errors_api_component=Warning diff --git a/bundles/org.eclipse.e4.tools.jdt.templates/.settings/org.eclipse.pde.prefs b/bundles/org.eclipse.e4.tools.jdt.templates/.settings/org.eclipse.pde.prefs deleted file mode 100644 index 406a6085..00000000 --- a/bundles/org.eclipse.e4.tools.jdt.templates/.settings/org.eclipse.pde.prefs +++ /dev/null @@ -1,32 +0,0 @@ -compilers.f.unresolved-features=1 -compilers.f.unresolved-plugins=1 -compilers.incompatible-environment=1 -compilers.p.build=1 -compilers.p.build.bin.includes=1 -compilers.p.build.encodings=2 -compilers.p.build.java.compiler=2 -compilers.p.build.java.compliance=1 -compilers.p.build.missing.output=2 -compilers.p.build.output.library=1 -compilers.p.build.source.library=1 -compilers.p.build.src.includes=1 -compilers.p.deprecated=1 -compilers.p.discouraged-class=2 -compilers.p.internal=1 -compilers.p.missing-packages=1 -compilers.p.missing-version-export-package=1 -compilers.p.missing-version-import-package=1 -compilers.p.missing-version-require-bundle=1 -compilers.p.no-required-att=0 -compilers.p.not-externalized-att=2 -compilers.p.unknown-attribute=1 -compilers.p.unknown-class=1 -compilers.p.unknown-element=1 -compilers.p.unknown-identifier=1 -compilers.p.unknown-resource=1 -compilers.p.unresolved-ex-points=0 -compilers.p.unresolved-import=0 -compilers.s.create-docs=false -compilers.s.doc-folder=doc -compilers.s.open-tags=1 -eclipse.preferences.version=1 diff --git a/bundles/org.eclipse.e4.tools.jdt.templates/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.jdt.templates/META-INF/MANIFEST.MF deleted file mode 100644 index 06c4dd89..00000000 --- a/bundles/org.eclipse.e4.tools.jdt.templates/META-INF/MANIFEST.MF +++ /dev/null @@ -1,13 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-SymbolicName: org.eclipse.e4.tools.jdt.templates;singleton:=true -Bundle-Version: 0.12.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 -Require-Bundle: org.eclipse.jdt.ui;bundle-version="3.6.0", - org.eclipse.ui.editors;bundle-version="3.6.0", - org.eclipse.jface.text;bundle-version="3.6.0", - org.eclipse.jdt.core;bundle-version="3.6.0", - org.eclipse.core.runtime;bundle-version="3.6.0" -Export-Package: org.eclipse.e4.internal.tools.jdt.templates;version="0.12.0.qualifier";x-internal:=true -Bundle-Vendor: %providerName diff --git a/bundles/org.eclipse.e4.tools.jdt.templates/about.html b/bundles/org.eclipse.e4.tools.jdt.templates/about.html deleted file mode 100644 index c1343aa3..00000000 --- a/bundles/org.eclipse.e4.tools.jdt.templates/about.html +++ /dev/null @@ -1,45 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> -<title>About</title> -</head> -<body lang="EN-US"> -<h2>About This Content</h2> - -<p>December 3, 2009</p> -<h3>License</h3> - -<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise -indicated below, the Content is provided to you under the terms and conditions of the -Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available -at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. -For purposes of the EPL, "Program" will mean the Content.</p> - -<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is -being redistributed by another party ("Redistributor") and different terms and conditions may -apply to your use of any object code in the Content. Check the Redistributor's license that was -provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise -indicated below, the terms and conditions of the EPL still apply to any source code in the Content -and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p> - -<h3>Third Party Content</h3> - -<p>The Content includes items from third parties as set out below. If you did not -receive this Content directly from the Eclipse Foundation, the following is provided for informational -purposes only, and you should look to the Redistributor’s license for terms and conditions of use.</p> - -<h4>Silk icon set Version 1.3</h4> -<p> -This plugin contains icons from the Silk icon set created by Mark James. The original files can -be found at: -<ul> -<a href="http://www.famfamfam.com/lab/icons/silk/">http://www.famfamfam.com/lab/icons/silk/</a></ul> -<p>The license can be found at:</p> -<ul> - <li><a href="http://creativecommons.org/licenses/by/2.5/">http://creativecommons.org/licenses/by/2.5/</a></li> -</ul> - -</body> -</html>
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.jdt.templates/build.properties b/bundles/org.eclipse.e4.tools.jdt.templates/build.properties deleted file mode 100644 index d4135f90..00000000 --- a/bundles/org.eclipse.e4.tools.jdt.templates/build.properties +++ /dev/null @@ -1,9 +0,0 @@ -source.. = src/ -output.. = bin/ -bin.includes = META-INF/,\ - .,\ - plugin.xml,\ - plugin.properties,\ - templates/,\ - icons/,\ - about.html diff --git a/bundles/org.eclipse.e4.tools.jdt.templates/forceQualifierUpdate.txt b/bundles/org.eclipse.e4.tools.jdt.templates/forceQualifierUpdate.txt deleted file mode 100644 index 396f0875..00000000 --- a/bundles/org.eclipse.e4.tools.jdt.templates/forceQualifierUpdate.txt +++ /dev/null @@ -1,2 +0,0 @@ -# To force a version qualifier update add the bug here -Bug 403237 - o.e.e4.tools cannot be build with "mvn clean install" diff --git a/bundles/org.eclipse.e4.tools.jdt.templates/icons/full/elcl16/e4assist_co.gif b/bundles/org.eclipse.e4.tools.jdt.templates/icons/full/elcl16/e4assist_co.gif Binary files differdeleted file mode 100644 index 150a1f7e..00000000 --- a/bundles/org.eclipse.e4.tools.jdt.templates/icons/full/elcl16/e4assist_co.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.jdt.templates/plugin.properties b/bundles/org.eclipse.e4.tools.jdt.templates/plugin.properties deleted file mode 100644 index 195bb415..00000000 --- a/bundles/org.eclipse.e4.tools.jdt.templates/plugin.properties +++ /dev/null @@ -1,10 +0,0 @@ - -# <copyright> -# </copyright> -# -# $Id: plugin.properties,v 1.2 2010/07/20 21:48:42 tschindl Exp $ - -pluginName = EMF ModelTooling JDT Templates -providerName = Eclipse.org - -extension-point.name = Editors
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.jdt.templates/plugin.xml b/bundles/org.eclipse.e4.tools.jdt.templates/plugin.xml deleted file mode 100644 index 30b8ff7f..00000000 --- a/bundles/org.eclipse.e4.tools.jdt.templates/plugin.xml +++ /dev/null @@ -1,112 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.4"?> -<plugin> - <extension - point="org.eclipse.jdt.ui.javaCompletionProposalComputer" - id="e4ProposalCategory" - name="e4 proposals"> - <proposalCategory - icon="$nl$/icons/full/elcl16/e4assist_co.gif"/> - </extension> - <extension - point="org.eclipse.jdt.ui.javaCompletionProposalComputer" - id="e4BuilderCompletionProposalComputer"> - <javaCompletionProposalComputer - activate="true" - categoryId="org.eclipse.e4.tools.jdt.templates.e4ProposalCategory" - class="org.eclipse.e4.internal.tools.jdt.templates.E4TemplateCompletionProposalComputer"> - </javaCompletionProposalComputer> - </extension> - <extension - point="org.eclipse.ui.editors.templates"> - <contextType - name="e4" - class="org.eclipse.e4.internal.tools.jdt.templates.E4ContextType" - id="e4" - registryId="org.eclipse.jdt.ui.CompilationUnitEditor"> - </contextType> - <contextType - name="e4 statements" - class="org.eclipse.e4.internal.tools.jdt.templates.E4ContextType" - id="e4-statements" - registryId="org.eclipse.jdt.ui.CompilationUnitEditor"> - </contextType> - <contextType - name="e4 members" - class="org.eclipse.e4.internal.tools.jdt.templates.E4ContextType" - id="e4-members" - registryId="org.eclipse.jdt.ui.CompilationUnitEditor"> - </contextType> - <include - file="templates/default-e4templates.xml"> - </include> - <resolver - class="org.eclipse.jdt.internal.corext.template.java.FieldResolver" - contextTypeId="e4-members" - description="%templates.java.resolvers.Field.description" - name="%templates.java.resolvers.Field.name" - type="field"/> - <resolver - class="org.eclipse.jdt.internal.corext.template.java.LocalVarResolver" - contextTypeId="e4-members" - description="%templates.java.resolvers.LocalVar.description" - name="Local Variable" - type="localVar"/> - <resolver - class="org.eclipse.jdt.internal.corext.template.java.VarResolver" - contextTypeId="e4-members" - description="%templates.java.resolvers.Var.description" - name="Variable" - type="var"/> - <resolver - class="org.eclipse.jdt.internal.corext.template.java.NameResolver" - contextTypeId="e4-members" - description="%templates.java.resolvers.Name.description" - name="New Name" - type="newName"/> - <resolver - class="org.eclipse.jdt.internal.corext.template.java.TypeResolver" - contextTypeId="e4-members" - description="%templates.java.resolvers.Type.description" - name="New Type" - type="newType"/> - <resolver - class="org.eclipse.jdt.internal.corext.template.java.ElementTypeResolver" - contextTypeId="e4-members" - description="%templates.java.resolvers.ElementType.description" - name="Element Type" - type="elemType"/> - <resolver - class="org.eclipse.jdt.internal.corext.template.java.TypeVariableResolver" - contextTypeId="e4-members" - description="%templates.java.resolvers.ArgumentType.description" - name="Argument Type" - type="argType"/> - <resolver - class="org.eclipse.jdt.internal.corext.template.java.LinkResolver" - contextTypeId="e4-members" - description="%templates.java.resolvers.Link.description" - name="Linked Mode" - type="link"/> - <resolver - class="org.eclipse.jdt.internal.corext.template.java.ImportsResolver" - contextTypeId="e4-members" - description="%templates.java.resolvers.Imports.description" - name="Import" - type="import"/> - <resolver - class="org.eclipse.jdt.internal.corext.template.java.StaticImportResolver" - contextTypeId="e4-members" - description="%templates.java.resolvers.ImportStatic.description" - name="Import Static" - type="importStatic"/> - <resolver - class="org.eclipse.jdt.internal.corext.template.java.ExceptionVariableNameResolver" - contextTypeId="e4-members" - description="%templates.java.resolvers.ExceptionVariableName.description" - name="Exception Variable Name" - type="exception_variable_name"> - </resolver> - </extension> - -</plugin> diff --git a/bundles/org.eclipse.e4.tools.jdt.templates/pom.xml b/bundles/org.eclipse.e4.tools.jdt.templates/pom.xml deleted file mode 100644 index c7ab963d..00000000 --- a/bundles/org.eclipse.e4.tools.jdt.templates/pom.xml +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.eclipse.e4.tools</groupId> - <artifactId>e4-tools-aggregator</artifactId> - <version>0.17.0-SNAPSHOT</version> - <relativePath>../../</relativePath> - </parent> - - <groupId>org.eclipse.e4</groupId> - <artifactId>org.eclipse.e4.tools.jdt.templates</artifactId> - <version>0.12.0.qualifier</version> - <packaging>eclipse-plugin</packaging> - -</project> diff --git a/bundles/org.eclipse.e4.tools.jdt.templates/src/org/eclipse/e4/internal/tools/jdt/templates/E4ContextType.java b/bundles/org.eclipse.e4.tools.jdt.templates/src/org/eclipse/e4/internal/tools/jdt/templates/E4ContextType.java deleted file mode 100644 index 4cf75ec0..00000000 --- a/bundles/org.eclipse.e4.tools.jdt.templates/src/org/eclipse/e4/internal/tools/jdt/templates/E4ContextType.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation (adapted from JDT's SWTContextType) - *******************************************************************************/ -package org.eclipse.e4.internal.tools.jdt.templates; - -import org.eclipse.jdt.internal.corext.template.java.AbstractJavaContextType; -import org.eclipse.jdt.internal.corext.template.java.JavaContext; - -/** - * The context type for templates inside e4 code. - * The same class is used for several context types: - * <dl> - * <li>templates for all Java code locations</li> - * <li>templates for member locations</li> - * <li>templates for statement locations</li> - * </dl> - */ -@SuppressWarnings("restriction") -public class E4ContextType extends AbstractJavaContextType { - - /** - * The context type id for templates working on all Java code locations in e4 projects - */ - public static final String ID_ALL = "e4"; //$NON-NLS-1$ - - /** - * The context type id for templates working on member locations in e4 projects - */ - public static final String ID_MEMBERS = "e4-members"; //$NON-NLS-1$ - - /** - * The context type id for templates working on statement locations in e4 projects - */ - public static final String ID_STATEMENTS = "e4-statements"; //$NON-NLS-1$ - - @Override - protected void initializeContext(JavaContext context) { - if (!getId().equals(E4ContextType.ID_ALL)) { // a specific context must also allow the templates that work - // everywhere - context.addCompatibleContextType(E4ContextType.ID_ALL); - } - } -} diff --git a/bundles/org.eclipse.e4.tools.jdt.templates/src/org/eclipse/e4/internal/tools/jdt/templates/E4TemplateCompletionProposalComputer.java b/bundles/org.eclipse.e4.tools.jdt.templates/src/org/eclipse/e4/internal/tools/jdt/templates/E4TemplateCompletionProposalComputer.java deleted file mode 100644 index 45575bcc..00000000 --- a/bundles/org.eclipse.e4.tools.jdt.templates/src/org/eclipse/e4/internal/tools/jdt/templates/E4TemplateCompletionProposalComputer.java +++ /dev/null @@ -1,216 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation (adapted from JDT's SWTTemplateCompletionProposalComputer) - *******************************************************************************/ -package org.eclipse.e4.internal.tools.jdt.templates; - -import org.eclipse.core.runtime.Assert; -import org.eclipse.jdt.core.CompletionContext; -import org.eclipse.jdt.core.ElementChangedEvent; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.IElementChangedListener; -import org.eclipse.jdt.core.IJavaElementDelta; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.internal.ui.JavaPlugin; -import org.eclipse.jdt.internal.ui.text.java.AbstractTemplateCompletionProposalComputer; -import org.eclipse.jdt.internal.ui.text.template.contentassist.TemplateEngine; -import org.eclipse.jdt.ui.text.java.JavaContentAssistInvocationContext; -import org.eclipse.jface.text.templates.ContextTypeRegistry; -import org.eclipse.jface.text.templates.TemplateContextType; - -/** - * Computer that computes the template proposals for the E4 context type. - * - */ -@SuppressWarnings("restriction") -public class E4TemplateCompletionProposalComputer extends AbstractTemplateCompletionProposalComputer { - - /** - * The name of <code>javax.inject.Inject</code> used to detect - * if a project uses e4. - */ - private static final String E4_TYPE_NAME = "org.eclipse.e4.ui.di.Focus"; //$NON-NLS-1$ - - /** - * Listener that resets the cached java project if its build path changes. - */ - private final class BuildPathChangeListener implements IElementChangedListener { - - @Override - public void elementChanged(ElementChangedEvent event) { - final IJavaProject javaProject = getCachedJavaProject(); - if (javaProject == null) { - return; - } - - final IJavaElementDelta[] children = event.getDelta().getChangedChildren(); - for (int i = 0; i < children.length; i++) { - final IJavaElementDelta child = children[i]; - if (javaProject.equals(child.getElement())) { - if (isClasspathChange(child)) { - setCachedJavaProject(null); - } - } - } - } - - /** - * Does the delta indicate a classpath change? - * - * @param delta the delta to inspect - * @return true if classpath has changed - */ - private boolean isClasspathChange(IJavaElementDelta delta) { - final int flags = delta.getFlags(); - if (isClasspathChangeFlag(flags)) { - return true; - } - - if ((flags & IJavaElementDelta.F_CHILDREN) != 0) { - final IJavaElementDelta[] children = delta.getAffectedChildren(); - for (int i = 0; i < children.length; i++) { - if (isClasspathChangeFlag(children[i].getFlags())) { - return true; - } - } - } - - return false; - } - - /** - * Do the flags indicate a classpath change? - * - * @param flags the flags to inspect - * @return true if the flag flags a classpath change - */ - private boolean isClasspathChangeFlag(int flags) { - if ((flags & IJavaElementDelta.F_RESOLVED_CLASSPATH_CHANGED) != 0) { - return true; - } - - if ((flags & IJavaElementDelta.F_ADDED_TO_CLASSPATH) != 0) { - return true; - } - - if ((flags & IJavaElementDelta.F_REMOVED_FROM_CLASSPATH) != 0) { - return true; - } - - if ((flags & IJavaElementDelta.F_ARCHIVE_CONTENT_CHANGED) != 0) { - return true; - } - - return false; - } - } - - /** - * Engine used to compute the proposals for this computer - */ - private final TemplateEngine fE4TemplateEngine; - private final TemplateEngine fE4MembersTemplateEngine; - private final TemplateEngine fE4StatementsTemplateEngine; - - /** - * The Java project of the compilation unit for which a template - * engine has been computed last time if any - */ - private IJavaProject fCachedJavaProject; - /** - * Is org.eclipse.e4.core.services.IDisposable on class path of <code>fJavaProject</code>. Invalid - * if <code>fJavaProject</code> is <code>false</code>. - */ - private boolean fIsE4OnClasspath; - - public E4TemplateCompletionProposalComputer() { - final ContextTypeRegistry templateContextRegistry = JavaPlugin.getDefault().getTemplateContextRegistry(); - fE4TemplateEngine = createTemplateEngine(templateContextRegistry, E4ContextType.ID_ALL); - fE4MembersTemplateEngine = createTemplateEngine(templateContextRegistry, E4ContextType.ID_MEMBERS); - fE4StatementsTemplateEngine = createTemplateEngine(templateContextRegistry, E4ContextType.ID_STATEMENTS); - - JavaCore.addElementChangedListener(new BuildPathChangeListener()); - } - - private static TemplateEngine createTemplateEngine(ContextTypeRegistry templateContextRegistry, String contextTypeId) { - final TemplateContextType contextType = templateContextRegistry.getContextType(contextTypeId); - Assert.isNotNull(contextType); - return new TemplateEngine(contextType); - } - - @Override - protected TemplateEngine computeCompletionEngine(JavaContentAssistInvocationContext context) { - final ICompilationUnit unit = context.getCompilationUnit(); - if (unit == null) { - return null; - } - - final IJavaProject javaProject = unit.getJavaProject(); - if (javaProject == null) { - return null; - } - - if (isE4OnClasspath(javaProject)) { - final CompletionContext coreContext = context.getCoreContext(); - if (coreContext != null) { - final int tokenLocation = coreContext.getTokenLocation(); - if ((tokenLocation & CompletionContext.TL_MEMBER_START) != 0) { - return fE4MembersTemplateEngine; - } - if ((tokenLocation & CompletionContext.TL_STATEMENT_START) != 0) { - return fE4StatementsTemplateEngine; - } - } - return fE4TemplateEngine; - } - - return null; - } - - /** - * Tells whether E4 is on the given project's class path. - * - * @param javaProject the Java project - * @return <code>true</code> if the given project's class path - */ - private synchronized boolean isE4OnClasspath(IJavaProject javaProject) { - if (!javaProject.equals(fCachedJavaProject)) { - fCachedJavaProject = javaProject; - try { - final IType type = javaProject.findType(E4_TYPE_NAME); - fIsE4OnClasspath = type != null; - } catch (final JavaModelException e) { - fIsE4OnClasspath = false; - } - } - return fIsE4OnClasspath; - } - - /** - * Returns the cached Java project. - * - * @return the cached Java project or <code>null</code> if none - */ - private synchronized IJavaProject getCachedJavaProject() { - return fCachedJavaProject; - } - - /** - * Set the cached Java project. - * - * @param project or <code>null</code> to reset the cache - */ - private synchronized void setCachedJavaProject(IJavaProject project) { - fCachedJavaProject = project; - } - -} diff --git a/bundles/org.eclipse.e4.tools.jdt.templates/templates/default-e4templates.xml b/bundles/org.eclipse.e4.tools.jdt.templates/templates/default-e4templates.xml deleted file mode 100644 index 025f5b34..00000000 --- a/bundles/org.eclipse.e4.tools.jdt.templates/templates/default-e4templates.xml +++ /dev/null @@ -1,76 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<!-- -/******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boris Bokowski, IBM Corporation - initial API and implementation - * Lars Vogel <Lars.Vogel@gmail.com> - Reworked templates - *******************************************************************************/ ---> - -<templates> - -<template name="Inject - Composite" description="Injected Parent Composite" id="org.eclipse.e4.tools.jdt.templates.parent" context="e4-members" enabled="true" autoinsert="false">@Inject -Composite parent; -${imp:import(javax.inject.Inject)} -</template> - -<template name="Inject - Preference Value" description="Injected Preference Value" id="org.eclipse.e4.tools.jdt.templates.preference" context="e4-members" enabled="true" autoinsert="false">@Inject -void setPreferenceValue(@Named("preference-PREFERENCE_KEY") String preferenceValue) { - ${cursor} -}</template> - -<template name="Inject - Preferences" description="Injected Preferences Service" id="org.eclipse.e4.tools.jdt.templates.preferences" context="e4-members" enabled="true" autoinsert="false">@Inject -IEclipsePreferences preferences;</template> - -<template name="Inject - Logger" description="Injected Logger" id="org.eclipse.e4.tools.jdt.templates.logger" context="e4-members" enabled="true" autoinsert="false">@Inject -Logger logger;</template> - -<template name="Inject - Eventbroker" description="Injected Event Broker" id="org.eclipse.e4.tools.jdt.templates.eventbroker" context="e4-members" enabled="true" autoinsert="false">@Inject -IEventBroker eventBroker; -${imp:import(org.eclipse.e4.core.services.events.IEventBroker)} -</template> - - -<template name="Injectject - Event" description="Event Handler Method" id="org.eclipse.e4.tools.jdt.templates.eventhandler" context="e4-members" enabled="true" autoinsert="false">@EventHandler("some/event/topic") -void handleSomeEvent(Payload payloadObject) { - ${cursor} -}</template> - -<template name="Inject - Styling Engine" description="Injected Styling Engine" id="org.eclipse.e4.tools.jdt.templates.stylingengine" context="e4-members" enabled="true" autoinsert="false">@Inject -IStylingEngine stylingEngine;</template> - - -<template name="PostConstruct" description="Creates @PostConstruct method" id="org.eclipse.e4.tools.jdt.templates.init" context="e4-members" enabled="true" autoinsert="false">@PostConstruct -public void postConstruct(${type:newType(org.eclipse.swt.widgets.Composite)} parent) { - ${cursor} -} -${imp:import(javax.annotation.PostConstruct)} -</template> - -<template name="Focus" description="Creates @Focus method" id="org.eclipse.e4.tools.jdt.templates.focus" context="e4-members" enabled="true" autoinsert="false">@Focus -public void onFocus() { -} -${imp:import(org.eclipse.e4.ui.di.Focus)} -</template> - -<template name="PreDestroy" description="Creates @PreDestroy method" id="org.eclipse.e4.tools.jdt.templates.dispose" context="e4-members" enabled="true" autoinsert="false">@PreDestroy -public void preDestroy() { -} -${imp:import(javax.annotation.PreDestroy)} -</template> - -<template name="Execute" description="Creates Execute method" id="org.eclipse.e4.tools.jdt.templates.execute" context="e4-members" enabled="true" autoinsert="false">@Execute -public void execute() { -} -${imp:import(org.eclipse.e4.core.di.annotations.Execute)} -</template> - - -</templates> diff --git a/bundles/org.eclipse.e4.tools.services/.classpath b/bundles/org.eclipse.e4.tools.services/.classpath deleted file mode 100644 index ad32c83a..00000000 --- a/bundles/org.eclipse.e4.tools.services/.classpath +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="src" path="src"/> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/bundles/org.eclipse.e4.tools.services/.project b/bundles/org.eclipse.e4.tools.services/.project deleted file mode 100644 index d8bd3a01..00000000 --- a/bundles/org.eclipse.e4.tools.services/.project +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.e4.tools.services</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ManifestBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.SchemaBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ds.core.builder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.pde.PluginNature</nature> - <nature>org.eclipse.jdt.core.javanature</nature> - </natures> -</projectDescription> diff --git a/bundles/org.eclipse.e4.tools.services/.settings/org.eclipse.core.resources.prefs b/bundles/org.eclipse.e4.tools.services/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index f548abbf..00000000 --- a/bundles/org.eclipse.e4.tools.services/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,6 +0,0 @@ -eclipse.preferences.version=1 - -encoding//model/etypes.ecore=UTF-8 - - -encoding/<project>=UTF-8 diff --git a/bundles/org.eclipse.e4.tools.services/.settings/org.eclipse.core.runtime.prefs b/bundles/org.eclipse.e4.tools.services/.settings/org.eclipse.core.runtime.prefs deleted file mode 100644 index 5a0ad22d..00000000 --- a/bundles/org.eclipse.e4.tools.services/.settings/org.eclipse.core.runtime.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -line.separator=\n diff --git a/bundles/org.eclipse.e4.tools.services/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.e4.tools.services/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index c9482977..00000000 --- a/bundles/org.eclipse.e4.tools.services/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,418 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.builder.cleanOutputFolder=clean -org.eclipse.jdt.core.builder.duplicateResourceTask=warning -org.eclipse.jdt.core.builder.invalidClasspath=abort -org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore -org.eclipse.jdt.core.builder.resourceCopyExclusionFilter= -org.eclipse.jdt.core.circularClasspath=error -org.eclipse.jdt.core.classpath.exclusionPatterns=enabled -org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled -org.eclipse.jdt.core.classpath.outputOverlappingAnotherSource=error -org.eclipse.jdt.core.codeComplete.argumentPrefixes= -org.eclipse.jdt.core.codeComplete.argumentSuffixes= -org.eclipse.jdt.core.codeComplete.fieldPrefixes= -org.eclipse.jdt.core.codeComplete.fieldSuffixes= -org.eclipse.jdt.core.codeComplete.localPrefixes= -org.eclipse.jdt.core.codeComplete.localSuffixes= -org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= -org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= -org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= -org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= -org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled -org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore -org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull -org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault -org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable -org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.doc.comment.support=enabled -org.eclipse.jdt.core.compiler.maxProblemPerUnit=100 -org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.autoboxing=ignore -org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning -org.eclipse.jdt.core.compiler.problem.deadCode=warning -org.eclipse.jdt.core.compiler.problem.deprecation=warning -org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled -org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled -org.eclipse.jdt.core.compiler.problem.discouragedReference=warning -org.eclipse.jdt.core.compiler.problem.emptyStatement=warning -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore -org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning -org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled -org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore -org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning -org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning -org.eclipse.jdt.core.compiler.problem.forbiddenReference=error -org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning -org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled -org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning -org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore -org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning -org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=disabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=public -org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning -org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning -org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled -org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning -org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore -org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled -org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public -org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag -org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled -org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning -org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning -org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning -org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning -org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning -org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error -org.eclipse.jdt.core.compiler.problem.nullReference=warning -org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error -org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning -org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning -org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning -org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore -org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore -org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning -org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning -org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning -org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore -org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning -org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore -org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore -org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled -org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning -org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled -org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled -org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled -org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore -org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning -org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning -org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning -org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore -org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning -org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning -org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled -org.eclipse.jdt.core.compiler.problem.unusedImport=warning -org.eclipse.jdt.core.compiler.problem.unusedLabel=warning -org.eclipse.jdt.core.compiler.problem.unusedLocal=warning -org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled -org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning -org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning -org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.6 -org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled -org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,HIGH,LOW,LOW,LOW,LOW,LOW,NORMAL -org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX,PERF,MEM,POLISH,@generated NOT,@ADDED,APITODO -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_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=true -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=true -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=do not insert -org.eclipse.jdt.core.formatter.comment.line_length=120 -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=1 -org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=1 -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_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_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_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=false -org.eclipse.jdt.core.formatter.join_wrapped_lines=false -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=true -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 -org.eclipse.jdt.core.incompatibleJDKLevel=ignore -org.eclipse.jdt.core.incompleteClasspath=error diff --git a/bundles/org.eclipse.e4.tools.services/.settings/org.eclipse.jdt.launching.prefs b/bundles/org.eclipse.e4.tools.services/.settings/org.eclipse.jdt.launching.prefs deleted file mode 100644 index 3bb23527..00000000 --- a/bundles/org.eclipse.e4.tools.services/.settings/org.eclipse.jdt.launching.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.launching.PREF_STRICTLY_COMPATIBLE_JRE_NOT_AVAILABLE=ignore diff --git a/bundles/org.eclipse.e4.tools.services/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.e4.tools.services/.settings/org.eclipse.jdt.ui.prefs deleted file mode 100644 index 791508d1..00000000 --- a/bundles/org.eclipse.e4.tools.services/.settings/org.eclipse.jdt.ui.prefs +++ /dev/null @@ -1,115 +0,0 @@ -cleanup.add_default_serial_version_id=true -cleanup.add_generated_serial_version_id=false -cleanup.add_missing_annotations=true -cleanup.add_missing_deprecated_annotations=true -cleanup.add_missing_methods=false -cleanup.add_missing_nls_tags=false -cleanup.add_missing_override_annotations=true -cleanup.add_missing_override_annotations_interface_methods=true -cleanup.add_serial_version_id=false -cleanup.always_use_blocks=true -cleanup.always_use_parentheses_in_expressions=false -cleanup.always_use_this_for_non_static_field_access=false -cleanup.always_use_this_for_non_static_method_access=false -cleanup.convert_to_enhanced_for_loop=false -cleanup.correct_indentation=true -cleanup.format_source_code=true -cleanup.format_source_code_changes_only=false -cleanup.make_local_variable_final=true -cleanup.make_parameters_final=false -cleanup.make_private_fields_final=true -cleanup.make_type_abstract_if_missing_method=false -cleanup.make_variable_declarations_final=true -cleanup.never_use_blocks=false -cleanup.never_use_parentheses_in_expressions=true -cleanup.organize_imports=true -cleanup.qualify_static_field_accesses_with_declaring_class=false -cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true -cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -cleanup.qualify_static_member_accesses_with_declaring_class=true -cleanup.qualify_static_method_accesses_with_declaring_class=false -cleanup.remove_private_constructors=true -cleanup.remove_trailing_whitespaces=true -cleanup.remove_trailing_whitespaces_all=true -cleanup.remove_trailing_whitespaces_ignore_empty=false -cleanup.remove_unnecessary_casts=false -cleanup.remove_unnecessary_nls_tags=false -cleanup.remove_unused_imports=true -cleanup.remove_unused_local_variables=false -cleanup.remove_unused_private_fields=true -cleanup.remove_unused_private_members=false -cleanup.remove_unused_private_methods=true -cleanup.remove_unused_private_types=true -cleanup.sort_members=false -cleanup.sort_members_all=false -cleanup.use_blocks=true -cleanup.use_blocks_only_for_return_and_throw=false -cleanup.use_parentheses_in_expressions=true -cleanup.use_this_for_non_static_field_access=true -cleanup.use_this_for_non_static_field_access_only_if_necessary=true -cleanup.use_this_for_non_static_method_access=true -cleanup.use_this_for_non_static_method_access_only_if_necessary=true -cleanup_profile=_esmCleanUp -cleanup_settings_version=2 -eclipse.preferences.version=1 -editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true -formatter_profile=_esmFormatter -formatter_settings_version=12 -org.eclipse.jdt.ui.exception.name=ex -org.eclipse.jdt.ui.gettersetter.use.is=true -org.eclipse.jdt.ui.javadoc=true -org.eclipse.jdt.ui.keywordthis=false -org.eclipse.jdt.ui.overrideannotation=true -org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*******************************************************************************\r\n * Copyright (c) 2011-${year} EclipseSource Muenchen GmbH and others.\r\n * \r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n * \r\n * Contributors\:\r\n * ${user} - initial API and implementation\r\n ******************************************************************************/</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n *\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment"/><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/**\r\n * {@inheritDoc}\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="false" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">\t\t\t// TODO Auto-generated catch block\r\n\t\t\t// Do NOT catch all Exceptions ("catch (Exception e)")\r\n\t\t\t// Log AND handle Exceptions if possible \r\n //\r\n // You can just uncomment one of the lines below to log an exception\:\r\n\t\t\t// logException will show the logged excpetion to the user\r\n\t\t\t// ModelUtil.logException(${exception_var});\r\n\t\t\t// ModelUtil.logException("YOUR MESSAGE HERE", ${exception_var});\r\n\t\t\t// logWarning will only add the message to the error log\r\n\t\t\t// ModelUtil.logWarning("YOUR MESSAGE HERE", ${exception_var});\r\n\t\t\t// ModelUtil.logWarning("YOUR MESSAGE HERE");\r\n\t\t\t//\t\t\t\r\n\t\t\t// If handling is not possible declare and rethrow Exception</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates> -sp_cleanup.add_default_serial_version_id=true -sp_cleanup.add_generated_serial_version_id=false -sp_cleanup.add_missing_annotations=true -sp_cleanup.add_missing_deprecated_annotations=true -sp_cleanup.add_missing_methods=false -sp_cleanup.add_missing_nls_tags=false -sp_cleanup.add_missing_override_annotations=true -sp_cleanup.add_missing_override_annotations_interface_methods=true -sp_cleanup.add_serial_version_id=false -sp_cleanup.always_use_blocks=true -sp_cleanup.always_use_parentheses_in_expressions=false -sp_cleanup.always_use_this_for_non_static_field_access=false -sp_cleanup.always_use_this_for_non_static_method_access=false -sp_cleanup.convert_to_enhanced_for_loop=false -sp_cleanup.correct_indentation=true -sp_cleanup.format_source_code=true -sp_cleanup.format_source_code_changes_only=false -sp_cleanup.make_local_variable_final=true -sp_cleanup.make_parameters_final=false -sp_cleanup.make_private_fields_final=true -sp_cleanup.make_type_abstract_if_missing_method=false -sp_cleanup.make_variable_declarations_final=true -sp_cleanup.never_use_blocks=false -sp_cleanup.never_use_parentheses_in_expressions=true -sp_cleanup.on_save_use_additional_actions=true -sp_cleanup.organize_imports=true -sp_cleanup.qualify_static_field_accesses_with_declaring_class=false -sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_with_declaring_class=true -sp_cleanup.qualify_static_method_accesses_with_declaring_class=false -sp_cleanup.remove_private_constructors=true -sp_cleanup.remove_trailing_whitespaces=true -sp_cleanup.remove_trailing_whitespaces_all=true -sp_cleanup.remove_trailing_whitespaces_ignore_empty=false -sp_cleanup.remove_unnecessary_casts=false -sp_cleanup.remove_unnecessary_nls_tags=true -sp_cleanup.remove_unused_imports=true -sp_cleanup.remove_unused_local_variables=false -sp_cleanup.remove_unused_private_fields=true -sp_cleanup.remove_unused_private_members=false -sp_cleanup.remove_unused_private_methods=true -sp_cleanup.remove_unused_private_types=true -sp_cleanup.sort_members=false -sp_cleanup.sort_members_all=false -sp_cleanup.use_blocks=true -sp_cleanup.use_blocks_only_for_return_and_throw=false -sp_cleanup.use_parentheses_in_expressions=true -sp_cleanup.use_this_for_non_static_field_access=true -sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true -sp_cleanup.use_this_for_non_static_method_access=true -sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/bundles/org.eclipse.e4.tools.services/.settings/org.eclipse.pde.api.tools.prefs b/bundles/org.eclipse.e4.tools.services/.settings/org.eclipse.pde.api.tools.prefs deleted file mode 100644 index e4e3c007..00000000 --- a/bundles/org.eclipse.e4.tools.services/.settings/org.eclipse.pde.api.tools.prefs +++ /dev/null @@ -1,97 +0,0 @@ -ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Error -ANNOTATION_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error -ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Error -ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD=Error -ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error -API_COMPONENT_ELEMENT_TYPE_REMOVED_API_TYPE=Error -API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_API_TYPE=Error -API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_TYPE=Error -API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Error -API_USE_SCAN_FIELD_SEVERITY=Error -API_USE_SCAN_METHOD_SEVERITY=Error -API_USE_SCAN_TYPE_SEVERITY=Error -CLASS_ELEMENT_TYPE_ADDED_METHOD=Error -CLASS_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error -CLASS_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error -CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error -CLASS_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error -CLASS_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error -CLASS_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error -CLASS_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error -CLASS_ELEMENT_TYPE_REMOVED_CONSTRUCTOR=Error -CLASS_ELEMENT_TYPE_REMOVED_FIELD=Error -CLASS_ELEMENT_TYPE_REMOVED_METHOD=Error -CLASS_ELEMENT_TYPE_REMOVED_SUPERCLASS=Error -CLASS_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error -CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error -CONSTRUCTOR_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error -CONSTRUCTOR_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error -CONSTRUCTOR_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error -CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error -ENUM_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error -ENUM_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error -ENUM_ELEMENT_TYPE_REMOVED_ENUM_CONSTANT=Error -ENUM_ELEMENT_TYPE_REMOVED_FIELD=Error -ENUM_ELEMENT_TYPE_REMOVED_METHOD=Error -ENUM_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error -FIELD_ELEMENT_TYPE_ADDED_VALUE=Error -FIELD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error -FIELD_ELEMENT_TYPE_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT=Error -FIELD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error -FIELD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error -FIELD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error -FIELD_ELEMENT_TYPE_CHANGED_TYPE=Error -FIELD_ELEMENT_TYPE_CHANGED_VALUE=Error -FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENT=Error -FIELD_ELEMENT_TYPE_REMOVED_VALUE=Error -ILLEGAL_EXTEND=Warning -ILLEGAL_IMPLEMENT=Warning -ILLEGAL_INSTANTIATE=Warning -ILLEGAL_OVERRIDE=Warning -ILLEGAL_REFERENCE=Warning -INTERFACE_ELEMENT_TYPE_ADDED_FIELD=Error -INTERFACE_ELEMENT_TYPE_ADDED_METHOD=Error -INTERFACE_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error -INTERFACE_ELEMENT_TYPE_ADDED_SUPER_INTERFACE_WITH_METHODS=Error -INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error -INTERFACE_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error -INTERFACE_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error -INTERFACE_ELEMENT_TYPE_REMOVED_FIELD=Error -INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Error -INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error -INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error -INVALID_JAVADOC_TAG=Warning -INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Error -LEAK_EXTEND=Warning -LEAK_FIELD_DECL=Warning -LEAK_IMPLEMENT=Warning -LEAK_METHOD_PARAM=Warning -LEAK_METHOD_RETURN_TYPE=Warning -METHOD_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error -METHOD_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error -METHOD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error -METHOD_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error -METHOD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error -METHOD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error -METHOD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error -METHOD_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error -METHOD_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Error -METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error -MISSING_EE_DESCRIPTIONS=Error -TYPE_PARAMETER_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error -TYPE_PARAMETER_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error -TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error -TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error -TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error -TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error -UNUSED_PROBLEM_FILTERS=Ignore -automatically_removed_unused_problem_filters=Disabled -eclipse.preferences.version=1 -incompatible_api_component_version=Error -incompatible_api_component_version_include_major_without_breaking_change=Disabled -incompatible_api_component_version_include_minor_without_api_change=Disabled -invalid_since_tag_version=Error -malformed_since_tag=Error -missing_since_tag=Error -report_api_breakage_when_major_version_incremented=Disabled -report_resolution_errors_api_component=Warning diff --git a/bundles/org.eclipse.e4.tools.services/.settings/org.eclipse.pde.prefs b/bundles/org.eclipse.e4.tools.services/.settings/org.eclipse.pde.prefs deleted file mode 100644 index 0bbee3c4..00000000 --- a/bundles/org.eclipse.e4.tools.services/.settings/org.eclipse.pde.prefs +++ /dev/null @@ -1,32 +0,0 @@ -compilers.f.unresolved-features=1 -compilers.f.unresolved-plugins=1 -compilers.incompatible-environment=1 -compilers.p.build=1 -compilers.p.build.bin.includes=1 -compilers.p.build.encodings=2 -compilers.p.build.java.compiler=2 -compilers.p.build.java.compliance=1 -compilers.p.build.missing.output=2 -compilers.p.build.output.library=1 -compilers.p.build.source.library=1 -compilers.p.build.src.includes=1 -compilers.p.deprecated=1 -compilers.p.discouraged-class=1 -compilers.p.internal=1 -compilers.p.missing-packages=1 -compilers.p.missing-version-export-package=1 -compilers.p.missing-version-import-package=1 -compilers.p.missing-version-require-bundle=1 -compilers.p.no-required-att=0 -compilers.p.not-externalized-att=2 -compilers.p.unknown-attribute=1 -compilers.p.unknown-class=1 -compilers.p.unknown-element=1 -compilers.p.unknown-identifier=1 -compilers.p.unknown-resource=1 -compilers.p.unresolved-ex-points=0 -compilers.p.unresolved-import=0 -compilers.s.create-docs=false -compilers.s.doc-folder=doc -compilers.s.open-tags=1 -eclipse.preferences.version=1 diff --git a/bundles/org.eclipse.e4.tools.services/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.services/META-INF/MANIFEST.MF deleted file mode 100644 index 88301650..00000000 --- a/bundles/org.eclipse.e4.tools.services/META-INF/MANIFEST.MF +++ /dev/null @@ -1,19 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %Bundle-Name -Bundle-SymbolicName: org.eclipse.e4.tools.services -Bundle-Version: 0.12.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 -Export-Package: org.eclipse.e4.tools.services;version="0.12.0.qualifier";x-friends:="org.eclipse.e4.tools.compat,org.eclipse.e4.tools.emf.editor3x,org.eclipse.e4.tools.emf.ui", - org.eclipse.e4.tools.services.impl;version="0.12.0.qualifier";x-friends:="org.eclipse.e4.tools.emf.ui" -Bundle-Vendor: %Bundle-Vendor -Require-Bundle: org.eclipse.swt;bundle-version="3.7.0", - org.eclipse.equinox.common;bundle-version="3.6.0", - org.eclipse.e4.core.contexts;bundle-version="0.9.0", - org.eclipse.osgi;bundle-version="3.7.0", - org.eclipse.e4.core.di;bundle-version="0.9.0" -Service-Component: OSGI-INF/resourcepoolfunction.xml, OSGI-INF/resourceservice.xml -Bundle-ActivationPolicy: lazy -Import-Package: javax.annotation;version="1.0.0", - javax.inject;version="1.0.0" -Bundle-Activator: org.eclipse.e4.tools.services.ToolsServicesActivator diff --git a/bundles/org.eclipse.e4.tools.services/OSGI-INF/l10n/bundle.properties b/bundles/org.eclipse.e4.tools.services/OSGI-INF/l10n/bundle.properties deleted file mode 100644 index 190cbb96..00000000 --- a/bundles/org.eclipse.e4.tools.services/OSGI-INF/l10n/bundle.properties +++ /dev/null @@ -1,3 +0,0 @@ -#Properties file for org.eclipse.e4.tools.services -Bundle-Name = Services -Bundle-Vendor = Eclipse.org
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.services/OSGI-INF/resourcepoolfunction.xml b/bundles/org.eclipse.e4.tools.services/OSGI-INF/resourcepoolfunction.xml deleted file mode 100644 index ee100cca..00000000 --- a/bundles/org.eclipse.e4.tools.services/OSGI-INF/resourcepoolfunction.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.e4.tools.services.resourcepoolfactory"> - <implementation class="org.eclipse.e4.tools.services.impl.ResourcePoolFactory"/> - <service> - <provide interface="org.eclipse.e4.core.contexts.IContextFunction"/> - </service> - <property name="service.context.key" type="String" value="org.eclipse.e4.tools.services.IResourcePool"/> -</scr:component> diff --git a/bundles/org.eclipse.e4.tools.services/OSGI-INF/resourceservice.xml b/bundles/org.eclipse.e4.tools.services/OSGI-INF/resourceservice.xml deleted file mode 100644 index 3291208d..00000000 --- a/bundles/org.eclipse.e4.tools.services/OSGI-INF/resourceservice.xml +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.e4.tools.services.resourceservice"> - <implementation class="org.eclipse.e4.tools.services.impl.ResourceService"/> - <service> - <provide interface="org.eclipse.e4.tools.services.IResourceService"/> - </service> -</scr:component> diff --git a/bundles/org.eclipse.e4.tools.services/about.html b/bundles/org.eclipse.e4.tools.services/about.html deleted file mode 100644 index 82494867..00000000 --- a/bundles/org.eclipse.e4.tools.services/about.html +++ /dev/null @@ -1,28 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> -<title>About</title> -</head> -<body lang="EN-US"> -<h2>About This Content</h2> - -<p>December 3, 2009</p> -<h3>License</h3> - -<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise -indicated below, the Content is provided to you under the terms and conditions of the -Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available -at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. -For purposes of the EPL, "Program" will mean the Content.</p> - -<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is -being redistributed by another party ("Redistributor") and different terms and conditions may -apply to your use of any object code in the Content. Check the Redistributor's license that was -provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise -indicated below, the terms and conditions of the EPL still apply to any source code in the Content -and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p> - -</body> -</html>
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.services/build.properties b/bundles/org.eclipse.e4.tools.services/build.properties deleted file mode 100644 index 67344cd6..00000000 --- a/bundles/org.eclipse.e4.tools.services/build.properties +++ /dev/null @@ -1,6 +0,0 @@ -output.. = bin/ -bin.includes = META-INF/,\ - .,\ - about.html,\ - OSGI-INF/ -source.. = src/ diff --git a/bundles/org.eclipse.e4.tools.services/forceQualifierUpdate.txt b/bundles/org.eclipse.e4.tools.services/forceQualifierUpdate.txt deleted file mode 100644 index 396f0875..00000000 --- a/bundles/org.eclipse.e4.tools.services/forceQualifierUpdate.txt +++ /dev/null @@ -1,2 +0,0 @@ -# To force a version qualifier update add the bug here -Bug 403237 - o.e.e4.tools cannot be build with "mvn clean install" diff --git a/bundles/org.eclipse.e4.tools.services/pom.xml b/bundles/org.eclipse.e4.tools.services/pom.xml deleted file mode 100644 index 1e3a49e2..00000000 --- a/bundles/org.eclipse.e4.tools.services/pom.xml +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.eclipse.e4.tools</groupId> - <artifactId>e4-tools-aggregator</artifactId> - <version>0.17.0-SNAPSHOT</version> - <relativePath>../../</relativePath> - </parent> - - <groupId>org.eclipse.e4</groupId> - <artifactId>org.eclipse.e4.tools.services</artifactId> - <version>0.12.0.qualifier</version> - <packaging>eclipse-plugin</packaging> - -</project> diff --git a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/BasicResourceProvider.java b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/BasicResourceProvider.java deleted file mode 100644 index e79a071c..00000000 --- a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/BasicResourceProvider.java +++ /dev/null @@ -1,70 +0,0 @@ -package org.eclipse.e4.tools.services; - -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.util.Map; - -import org.eclipse.core.runtime.FileLocator; -import org.eclipse.core.runtime.Path; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.RGB; -import org.eclipse.swt.widgets.Display; -import org.osgi.framework.BundleContext; - -public abstract class BasicResourceProvider implements IResourceProviderService { - protected Map<String, String> properties; - protected BundleContext context; - - public void activate(BundleContext context, Map<String, String> properties) { - this.properties = properties; - this.context = context; - } - - @Override - public Image getImage(Display display, String key) { - final URL url = FileLocator.find(context.getBundle(), new Path(properties.get(key)), null); - - if (url != null) { - InputStream stream = null; - try { - stream = url.openStream(); - return new Image(display, stream); - } catch (final Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } finally { - if (stream != null) { - try { - stream.close(); - } catch (final IOException e) { - } - } - } - } - - // TODO Auto-generated method stub - return null; - } - - @Override - public Font getFont(Display display, String key) { - return null; - } - - @Override - public Color getColor(Display display, String key) { - final String color = properties.get(key); - if (color.startsWith("rgb")) { //$NON-NLS-1$ - final String rgb = color.substring(color.indexOf('(') + 1, color.indexOf(')')); - final String[] cols = rgb.split(","); //$NON-NLS-1$ - final int r = Integer.parseInt(cols[0].trim()); - final int g = Integer.parseInt(cols[1].trim()); - final int b = Integer.parseInt(cols[2].trim()); - return new Color(display, new RGB(r, g, b)); - } - return null; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/IClipboardService.java b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/IClipboardService.java deleted file mode 100644 index 2f1f796a..00000000 --- a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/IClipboardService.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.services; - -public interface IClipboardService { - public void copy(); - public void paste(); - public void cut(); - public void setHandler(Handler handler); - - public interface Handler { - public void paste(); - public void copy(); - public void cut(); -// public boolean canCopy(); -// public boolean canPaste(); - } -} diff --git a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/IDirtyProviderService.java b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/IDirtyProviderService.java deleted file mode 100644 index cdbd5489..00000000 --- a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/IDirtyProviderService.java +++ /dev/null @@ -1,15 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.services; - -public interface IDirtyProviderService { - public void setDirtyState(boolean dirtyState); -} diff --git a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/IResourcePool.java b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/IResourcePool.java deleted file mode 100644 index bd06e5ea..00000000 --- a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/IResourcePool.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.eclipse.e4.tools.services; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.Image; - -public interface IResourcePool { - public Image getImage(String imageKey) throws CoreException; - public Image getImageUnchecked(String imageKey); - - public Color getColor(String imageKey) throws CoreException; - public Color getColorUnchecked(String imageKey); - - public Font getFont(String imageKey) throws CoreException; - public Font getFontUnchecked(String imageKey); -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/IResourceProviderService.java b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/IResourceProviderService.java deleted file mode 100644 index 70413f2b..00000000 --- a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/IResourceProviderService.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.eclipse.e4.tools.services; - -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Display; - -public interface IResourceProviderService { - public Image getImage(Display display, String key); - public Font getFont(Display display, String key); - public Color getColor(Display display, String key); -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/IResourceService.java b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/IResourceService.java deleted file mode 100644 index a52c0fbd..00000000 --- a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/IResourceService.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.services; - -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; - -public interface IResourceService { - public interface IPooledResource<T> { - public T getResource(); - public String getId(); - public void dispose(); - } - - public interface IDiposeableResourcePool extends IResourcePool { - public void dispose(); - } - - public IPooledResource<Image> getImage(Display display, String key); - public IPooledResource<Color> getColor(Display display, String key); - public IPooledResource<Font> getFont(Display display, String key); - - public IDiposeableResourcePool getResourcePool(Display display); - public IResourcePool getControlPool(Control control); -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/ToolsServicesActivator.java b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/ToolsServicesActivator.java deleted file mode 100644 index b9104c4c..00000000 --- a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/ToolsServicesActivator.java +++ /dev/null @@ -1,68 +0,0 @@ -package org.eclipse.e4.tools.services; - -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; -import org.osgi.service.log.LogService; -import org.osgi.service.packageadmin.PackageAdmin; -import org.osgi.util.tracker.ServiceTracker; - -@SuppressWarnings("deprecation") -public class ToolsServicesActivator implements BundleActivator { - - static private ToolsServicesActivator defaultInstance; - private BundleContext bundleContext; - private ServiceTracker<PackageAdmin, PackageAdmin> pkgAdminTracker; - private ServiceTracker<LogService, LogService> logTracker; - public static final String PLUGIN_ID = "org.eclipse.e4.tools.services"; //$NON-NLS-1$ - - public ToolsServicesActivator() { - defaultInstance = this; - } - - public static ToolsServicesActivator getDefault() { - return defaultInstance; - } - - @Override - public void start(BundleContext context) throws Exception { - bundleContext = context; - } - - @Override - public void stop(BundleContext context) throws Exception { - if (pkgAdminTracker != null) { - pkgAdminTracker.close(); - pkgAdminTracker = null; - } - if (logTracker != null) { - logTracker.close(); - logTracker = null; - } - bundleContext = null; - } - - public PackageAdmin getPackageAdmin() { - if (pkgAdminTracker == null) { - if (bundleContext == null) { - return null; - } - pkgAdminTracker = new ServiceTracker<PackageAdmin, PackageAdmin>(bundleContext, - PackageAdmin.class, null); - pkgAdminTracker.open(); - } - return pkgAdminTracker.getService(); - } - - public LogService getLogService() { - if (logTracker == null) { - if (bundleContext == null) { - return null; - } - logTracker = new ServiceTracker<LogService, LogService>(bundleContext, - LogService.class, null); - logTracker.open(); - } - return logTracker.getService(); - } - -} diff --git a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/Messages.java b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/Messages.java deleted file mode 100644 index 149c954b..00000000 --- a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/Messages.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011-2014 EclipseSource Muenchen GmbH and others. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Jonas - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.services.impl; - -import org.eclipse.osgi.util.NLS; - -/** - * @author Jonas - * - */ -public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.e4.tools.services.impl.messages"; //$NON-NLS-1$ - public static String ResourceService_NoProvider; - public static String ResourceService_PoolDisposed; - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - private Messages() { - } -} diff --git a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/ResourceBundleHelper.java b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/ResourceBundleHelper.java deleted file mode 100644 index 4aa8f663..00000000 --- a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/ResourceBundleHelper.java +++ /dev/null @@ -1,604 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Dirk Fauth and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Dirk Fauth <dirk.fauth@gmail.com> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.services.impl; - -import java.io.IOException; -import java.io.InputStream; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URL; -import java.net.URLConnection; -import java.security.AccessController; -import java.security.PrivilegedActionException; -import java.security.PrivilegedExceptionAction; -import java.util.List; -import java.util.Locale; -import java.util.MissingResourceException; -import java.util.PropertyResourceBundle; -import java.util.ResourceBundle; -import java.util.ResourceBundle.Control; - -import org.eclipse.e4.tools.services.ToolsServicesActivator; -import org.eclipse.osgi.service.localization.BundleLocalization; -import org.osgi.framework.Bundle; -import org.osgi.service.log.LogService; -import org.osgi.service.packageadmin.PackageAdmin; - -/** - * Helper class for retrieving {@link ResourceBundle}s out of OSGi {@link Bundle}s. - * - * @author Dirk Fauth - */ -// There is no replacement for PackageAdmin#getBundles() -@SuppressWarnings("deprecation") -public class ResourceBundleHelper { - - /** - * The schema identifier used for Eclipse platform references - */ - private static final String PLATFORM_SCHEMA = "platform"; //$NON-NLS-1$ - /** - * The schema identifier used for Eclipse bundle class references - */ - private static final String BUNDLECLASS_SCHEMA = "bundleclass"; //$NON-NLS-1$ - /** - * Identifier part of the Eclipse platform schema to point to a plugin - */ - private static final String PLUGIN_SEGMENT = "/plugin/"; //$NON-NLS-1$ - /** - * Identifier part of the Eclipse platform schema to point to a fragment - */ - private static final String FRAGMENT_SEGMENT = "/fragment/"; //$NON-NLS-1$ - /** - * The separator character for paths in the platform schema - */ - private static final String PATH_SEPARATOR = "/"; //$NON-NLS-1$ - - /** - * Parses the specified contributor URI and loads the {@link ResourceBundle} for the specified {@link Locale} out of - * an OSGi {@link Bundle}. - * <p> - * Following URIs are supported: - * <ul> - * <li>platform:/[plugin|fragment]/[Bundle-SymbolicName]<br> - * Load the OSGi resource bundle out of the bundle/fragment named [Bundle-SymbolicName]</li> - * <li>platform:/[plugin|fragment]/[Bundle-SymbolicName]/[Path]/[Basename]<br> - * Load the resource bundle specified by [Path] and [Basename] out of the bundle/fragment named - * [Bundle-SymbolicName].</li> - * <li>bundleclass://[plugin|fragment]/[Full-Qualified-Classname]<br> - * Instantiate the class specified by [Full-Qualified-Classname] out of the bundle/fragment named - * [Bundle-SymbolicName]. Note that the class needs to be a subtype of {@link ResourceBundle}.</li> - * </ul> - * </p> - * - * @param contributorURI The URI that points to a {@link ResourceBundle} - * @param locale The {@link Locale} to use for loading the {@link ResourceBundle} - * @param localization The service for retrieving a {@link ResourceBundle} for a given {@link Locale} out of - * the given {@link Bundle} which is specified by URI. - * @return the resource bundle - */ - public static ResourceBundle getResourceBundleForUri(String contributorURI, Locale locale, - BundleLocalization localization) { - if (contributorURI == null) { - return null; - } - - final LogService logService = ToolsServicesActivator.getDefault().getLogService(); - - URI uri; - try { - uri = new URI(contributorURI); - } catch (final URISyntaxException e) { - if (logService != null) - { - logService.log(LogService.LOG_ERROR, "Invalid contributor URI: " + contributorURI); //$NON-NLS-1$ - } - return null; - } - - String bundleName = null; - Bundle bundle = null; - String resourcePath = null; - String classPath = null; - - // the uri follows the platform schema, so we search for .properties files in the bundle - if (PLATFORM_SCHEMA.equals(uri.getScheme())) { - bundleName = uri.getPath(); - if (bundleName.startsWith(PLUGIN_SEGMENT)) { - bundleName = bundleName.substring(PLUGIN_SEGMENT.length()); - } else if (bundleName.startsWith(FRAGMENT_SEGMENT)) { - bundleName = bundleName.substring(FRAGMENT_SEGMENT.length()); - } - - resourcePath = ""; //$NON-NLS-1$ - if (bundleName.contains(PATH_SEPARATOR)) { - resourcePath = bundleName.substring(bundleName.indexOf(PATH_SEPARATOR) + 1); - bundleName = bundleName.substring(0, bundleName.indexOf(PATH_SEPARATOR)); - } - } else if (BUNDLECLASS_SCHEMA.equals(uri.getScheme())) { - if (uri.getAuthority() == null) { - if (logService != null) - { - logService.log(LogService.LOG_ERROR, "Failed to get bundle for: " + contributorURI); //$NON-NLS-1$ - } - } - bundleName = uri.getAuthority(); - // remove the leading / - classPath = uri.getPath().substring(1); - } - - ResourceBundle result = null; - - if (bundleName != null) { - bundle = getBundleForName(bundleName); - - if (bundle != null) { - if (resourcePath == null && classPath != null) { - // the URI points to a class within the bundle classpath - // therefore we are trying to instantiate the class - try { - final Class<?> resourceBundleClass = bundle.loadClass(classPath); - result = getEquinoxResourceBundle(classPath, locale, resourceBundleClass.getClassLoader()); - } catch (final Exception e) { - if (logService != null) - { - logService.log(LogService.LOG_ERROR, - "Failed to load specified ResourceBundle: " + contributorURI, e); //$NON-NLS-1$ - } - } - } - else if (resourcePath.length() > 0) { - // the specified URI points to a resource - // therefore we try to load the .properties files into a ResourceBundle - result = getEquinoxResourceBundle(resourcePath.replace('.', '/'), locale, bundle); - } - else { - // there is no class and no special resource specified within the URI - // therefore we load the OSGi resource bundle out of the specified Bundle - // for the current Locale - result = localization.getLocalization(bundle, locale.toString()); - } - } - } - - return result; - } - - /** - * This method searches for the {@link ResourceBundle} in a modified way by inspecting the configuration option - * <code>equinox.root.locale</code>. - * <p> - * If the value for this system property is set to an empty String the default search order for ResourceBundles is - * used: - * <ul> - * <li>bn + Ls + "_" + Cs + "_" + Vs</li> - * <li>bn + Ls + "_" + Cs</li> - * <li>bn + Ls</li> - * <li>bn + Ld + "_" + Cd + "_" + Vd</li> - * <li>bn + Ld + "_" + Cd</li> - * <li>bn + Ld</li> - * <li>bn</li> - * </ul> - * Where bn is this bundle's localization basename, Ls, Cs and Vs are the specified locale (language, country, - * variant) and Ld, Cd and Vd are the default locale (language, country, variant). - * </p> - * <p> - * If Ls equals the value of <code>equinox.root.locale</code> then the following search order is used: - * <ul> - * <li>bn + Ls + "_" + Cs + "_" + Vs</li> - * <li>bn + Ls + "_" + Cs</li> - * <li>bn + Ls</li> - * <li>bn</li> - * <li>bn + Ld + "_" + Cd + "_" + Vd</li> - * <li>bn + Ld + "_" + Cd</li> - * <li>bn + Ld</li> - * <li>bn</li> - * </ul> - * </p> - * If <code>equinox.root.locale=en</code> and en_XX or en is asked for then this allows the root file to be used - * instead of - * falling back to the default locale. - * - * @param baseName the base name of the resource bundle, a fully qualified class name - * @param locale the locale for which a resource bundle is desired - * @param loader the class loader from which to load the resource bundle - * @return a resource bundle for the given base name and locale - * - * @see ResourceBundle#getBundle(String, Locale, ClassLoader) - */ - public static ResourceBundle getEquinoxResourceBundle(String baseName, Locale locale, ClassLoader loader) { - ResourceBundle resourceBundle = null; - - final String equinoxLocale = getEquinoxRootLocale(); - // if the equinox.root.locale is not empty and the specified locale equals the equinox.root.locale - // -> use the special search order - if (equinoxLocale.length() > 0 && locale.toString().startsWith(equinoxLocale)) { - // there is a equinox.root.locale configured that matches the specified locale - // so the special search order is used - // to achieve this we first search without a fallback to the default locale - try { - resourceBundle = ResourceBundle.getBundle(baseName, locale, loader, - ResourceBundle.Control.getNoFallbackControl(Control.FORMAT_DEFAULT)); - } catch (final MissingResourceException e) { - // do nothing - } - // if there is no ResourceBundle found for that path, we will now search for the default locale - // ResourceBundle - if (resourceBundle == null) { - try { - resourceBundle = ResourceBundle.getBundle(baseName, Locale.getDefault(), loader, - ResourceBundle.Control.getNoFallbackControl(Control.FORMAT_DEFAULT)); - } catch (final MissingResourceException e) { - // do nothing - } - } - } - else { - // there is either no equinox.root.locale configured or it does not match the specified locale - // -> use the default search order - try { - resourceBundle = ResourceBundle.getBundle(baseName, locale, loader); - } catch (final MissingResourceException e) { - // do nothing - } - } - - return resourceBundle; - } - - /** - * This method searches for the {@link ResourceBundle} in a modified way by inspecting the configuration option - * <code>equinox.root.locale</code>. It uses the {@link BundleResourceBundleControl} to load the resources out - * of a {@link Bundle}. - * <p> - * <b>Note: This method will only search for ResourceBundles based on properties files.</b> - * </p> - * <p> - * If the value for this system property is set to an empty String the default search order for ResourceBundles is - * used: - * <ul> - * <li>bn + Ls + "_" + Cs + "_" + Vs</li> - * <li>bn + Ls + "_" + Cs</li> - * <li>bn + Ls</li> - * <li>bn + Ld + "_" + Cd + "_" + Vd</li> - * <li>bn + Ld + "_" + Cd</li> - * <li>bn + Ld</li> - * <li>bn</li> - * </ul> - * Where bn is this bundle's localization basename, Ls, Cs and Vs are the specified locale (language, country, - * variant) and Ld, Cd and Vd are the default locale (language, country, variant). - * </p> - * <p> - * If Ls equals the value of <code>equinox.root.locale</code> then the following search order is used: - * <ul> - * <li>bn + Ls + "_" + Cs + "_" + Vs</li> - * <li>bn + Ls + "_" + Cs</li> - * <li>bn + Ls</li> - * <li>bn</li> - * <li>bn + Ld + "_" + Cd + "_" + Vd</li> - * <li>bn + Ld + "_" + Cd</li> - * <li>bn + Ld</li> - * <li>bn</li> - * </ul> - * </p> - * If <code>equinox.root.locale=en</code> and en_XX or en is asked for then this allows the root file to be used - * instead of - * falling back to the default locale. - * - * @param baseName the base name of the resource bundle, a fully qualified class name - * @param locale the locale for which a resource bundle is desired - * @param bundle The OSGi {@link Bundle} to lookup the {@link ResourceBundle} - * @return a resource bundle for the given base name and locale - * - * @see ResourceBundle#getBundle(String, Locale, Control) - */ - public static ResourceBundle getEquinoxResourceBundle(String baseName, Locale locale, Bundle bundle) { - return getEquinoxResourceBundle(baseName, locale, - new BundleResourceBundleControl(bundle, true), new BundleResourceBundleControl(bundle, false)); - } - - /** - * This method searches for the {@link ResourceBundle} in a modified way by inspecting the configuration option - * <code>equinox.root.locale</code>. - * <p> - * <b>Note: This method will only search for ResourceBundles based on properties files.</b> - * </p> - * <p> - * If the value for this system property is set to an empty String the default search order for ResourceBundles is - * used: - * <ul> - * <li>bn + Ls + "_" + Cs + "_" + Vs</li> - * <li>bn + Ls + "_" + Cs</li> - * <li>bn + Ls</li> - * <li>bn + Ld + "_" + Cd + "_" + Vd</li> - * <li>bn + Ld + "_" + Cd</li> - * <li>bn + Ld</li> - * <li>bn</li> - * </ul> - * Where bn is this bundle's localization basename, Ls, Cs and Vs are the specified locale (language, country, - * variant) and Ld, Cd and Vd are the default locale (language, country, variant). - * </p> - * <p> - * If Ls equals the value of <code>equinox.root.locale</code> then the following search order is used: - * <ul> - * <li>bn + Ls + "_" + Cs + "_" + Vs</li> - * <li>bn + Ls + "_" + Cs</li> - * <li>bn + Ls</li> - * <li>bn</li> - * <li>bn + Ld + "_" + Cd + "_" + Vd</li> - * <li>bn + Ld + "_" + Cd</li> - * <li>bn + Ld</li> - * <li>bn</li> - * </ul> - * </p> - * If <code>equinox.root.locale=en</code> and en_XX or en is asked for then this allows the root file to be used - * instead of - * falling back to the default locale. - * - * @param baseName the base name of the resource bundle, a fully qualified class name - * @param locale the locale for which a resource bundle is desired - * @param withFallback The {@link Control} that uses the default locale fallback on searching for resource bundles. - * @param withoutFallback The {@link Control} that doesn't use the default locale fallback on searching for resource - * bundles. - * @return a resource bundle for the given base name and locale - * - * @see ResourceBundle#getBundle(String, Locale, Control) - */ - public static ResourceBundle getEquinoxResourceBundle(String baseName, Locale locale, Control withFallback, - Control withoutFallback) { - ResourceBundle resourceBundle = null; - - final String equinoxLocale = getEquinoxRootLocale(); - // if the equinox.root.locale is not empty and the specified locale equals the equinox.root.locale - // -> use the special search order - if (equinoxLocale.length() > 0 && locale.toString().startsWith(equinoxLocale)) { - // there is a equinox.root.locale configured that matches the specified locale - // so the special search order is used - // to achieve this we first search without a fallback to the default locale - try { - resourceBundle = ResourceBundle.getBundle(baseName, locale, withoutFallback); - } catch (final MissingResourceException e) { - // do nothing - } - // if there is no ResourceBundle found for that path, we will now search for the default locale - // ResourceBundle - if (resourceBundle == null) { - try { - resourceBundle = ResourceBundle.getBundle(baseName, Locale.getDefault(), withoutFallback); - } catch (final MissingResourceException e) { - // do nothing - } - } - } - else { - // there is either no equinox.root.locale configured or it does not match the specified locale - // -> use the default search order - try { - resourceBundle = ResourceBundle.getBundle(baseName, locale, withFallback); - } catch (final MissingResourceException e) { - // do nothing - } - } - - return resourceBundle; - } - - /** - * @return The value for the system property for key <code>equinox.root.locale</code>. - * If none is specified than <b>en</b> will be returned as default. - */ - private static String getEquinoxRootLocale() { - // Logic from FrameworkProperties.getProperty("equinox.root.locale", "en") - String root = System.getProperties().getProperty("equinox.root.locale"); //$NON-NLS-1$ - if (root == null) { - root = "en"; //$NON-NLS-1$ - } - return root; - } - - /** - * This method is copied out of org.eclipse.e4.ui.internal.workbench.Activator - * because as it is a internal resource, it is not accessible for us. - * - * @param bundleName - * the bundle id - * @return A bundle if found, or <code>null</code> - */ - public static Bundle getBundleForName(String bundleName) { - final PackageAdmin packageAdmin = ToolsServicesActivator.getDefault().getPackageAdmin(); - final Bundle[] bundles = packageAdmin.getBundles(bundleName, null); - if (bundles == null) { - return null; - } - // Return the first bundle that is not installed or uninstalled - for (int i = 0; i < bundles.length; i++) { - if ((bundles[i].getState() & (Bundle.INSTALLED | Bundle.UNINSTALLED)) == 0) { - return bundles[i]; - } - } - return null; - } - - /** - * <p> - * Converts a String to a Locale. - * </p> - * - * <p> - * This method takes the string format of a locale and creates the locale object from it. - * </p> - * - * <pre> - * MessageFactoryServiceImpl.toLocale("en") = new Locale("en", "") - * MessageFactoryServiceImpl.toLocale("en_GB") = new Locale("en", "GB") - * MessageFactoryServiceImpl.toLocale("en_GB_xxx") = new Locale("en", "GB", "xxx") - * </pre> - * - * <p> - * This method validates the input strictly. The language code must be lowercase. The country code must be - * uppercase. The separator must be an underscore. The length must be correct. - * </p> - * - * <p> - * This method is inspired by <code>org.apache.commons.lang.LocaleUtils.toLocale(String)</code> by fixing the - * parsing error for uncommon Locales like having a language and a variant code but no country code, or a Locale - * that only consists of a country code. - * </p> - * - * @param str the locale String to convert - * @return a Locale that matches the specified locale String or <code>null</code> if the specified String is - * <code>null</code> - * @throws IllegalArgumentException if the String is an invalid format - */ - public static Locale toLocale(String str) { - if (str == null) { - return null; - } - - String language = ""; //$NON-NLS-1$ - String country = ""; //$NON-NLS-1$ - String variant = ""; //$NON-NLS-1$ - - final String[] localeParts = str.split("_"); //$NON-NLS-1$ - if (localeParts.length == 0 || localeParts.length > 3 - || localeParts.length == 1 && localeParts[0].length() == 0) { - throw new IllegalArgumentException("Invalid locale format: " + str); //$NON-NLS-1$ - } - if (localeParts[0].length() == 1 || localeParts[0].length() > 2) { - throw new IllegalArgumentException("Invalid locale format: " + str); //$NON-NLS-1$ - } - else if (localeParts[0].length() == 2) { - final char ch0 = localeParts[0].charAt(0); - final char ch1 = localeParts[0].charAt(1); - if (ch0 < 'a' || ch0 > 'z' || ch1 < 'a' || ch1 > 'z') { - throw new IllegalArgumentException("Invalid locale format: " + str); //$NON-NLS-1$ - } - } - - language = localeParts[0]; - - if (localeParts.length > 1) { - if (localeParts[1].length() == 1 || localeParts[1].length() > 2) { - throw new IllegalArgumentException("Invalid locale format: " + str); //$NON-NLS-1$ - } - else if (localeParts[1].length() == 2) { - final char ch3 = localeParts[1].charAt(0); - final char ch4 = localeParts[1].charAt(1); - if (ch3 < 'A' || ch3 > 'Z' || ch4 < 'A' || ch4 > 'Z') { - throw new IllegalArgumentException("Invalid locale format: " + str); //$NON-NLS-1$ - } - } - - country = localeParts[1]; - } - - if (localeParts.length == 3) { - if (localeParts[0].length() == 0 && localeParts[1].length() == 0) { - throw new IllegalArgumentException("Invalid locale format: " + str); //$NON-NLS-1$ - } - variant = localeParts[2]; - } - - return new Locale(language, country, variant); - } - - /** - * Specialization of {@link Control} which loads the {@link ResourceBundle} out of an - * OSGi {@link Bundle} instead of using a classloader. - * - * <p> - * It only supports properties based {@link ResourceBundle}s. If you want to use source based {@link ResourceBundle} - * s you have to use the bundleclass URI with the Message annotation. - * - * @author Dirk Fauth - * - */ - static class BundleResourceBundleControl extends ResourceBundle.Control { - - /** - * Flag to determine whether the default locale should be used as fallback locale - * in case there is no {@link ResourceBundle} found for the specified locale. - */ - private final boolean useFallback; - - /** - * The OSGi {@link Bundle} to lookup the {@link ResourceBundle} - */ - private final Bundle osgiBundle; - - /** - * - * @param osgiBundle The OSGi {@link Bundle} to lookup the {@link ResourceBundle} - * @param useFallback <code>true</code> if the default locale should be used as fallback - * locale in the search path or <code>false</code> if there should be no fallback. - */ - public BundleResourceBundleControl(Bundle osgiBundle, boolean useFallback) { - this.osgiBundle = osgiBundle; - this.useFallback = useFallback; - } - - @Override - public ResourceBundle newBundle(String baseName, Locale locale, - String format, ClassLoader loader, boolean reload) - throws IllegalAccessException, InstantiationException, IOException { - - final String bundleName = toBundleName(baseName, locale); - ResourceBundle bundle = null; - if (format.equals("java.properties")) { //$NON-NLS-1$ - final String resourceName = toResourceName(bundleName, "properties"); //$NON-NLS-1$ - InputStream stream = null; - try { - stream = AccessController.doPrivileged( - new PrivilegedExceptionAction<InputStream>() { - @Override - public InputStream run() throws IOException { - InputStream is = null; - final URL url = osgiBundle.getEntry(resourceName); - if (url != null) { - final URLConnection connection = url.openConnection(); - if (connection != null) { - // Disable caches to get fresh data for - // reloading. - connection.setUseCaches(false); - is = connection.getInputStream(); - } - } - return is; - } - }); - } catch (final PrivilegedActionException e) { - throw (IOException) e.getException(); - } - if (stream != null) { - try { - bundle = new PropertyResourceBundle(stream); - } finally { - stream.close(); - } - } - } - else { - throw new IllegalArgumentException("unknown format: " + format); //$NON-NLS-1$ - } - return bundle; - } - - @Override - public List<String> getFormats(String baseName) { - return FORMAT_PROPERTIES; - } - - @Override - public Locale getFallbackLocale(String baseName, Locale locale) { - return useFallback ? super.getFallbackLocale(baseName, locale) : null; - } - } -} diff --git a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/ResourceBundleTranslationProvider.java b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/ResourceBundleTranslationProvider.java deleted file mode 100644 index 6cd9fd88..00000000 --- a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/ResourceBundleTranslationProvider.java +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Dirk Fauth and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Dirk Fauth <dirk.fauth@gmail.com> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.services.impl; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -/** - * Wrapper class for accessing translations out of a {@link ResourceBundle}. - * - * @author Dirk Fauth - * - */ -public class ResourceBundleTranslationProvider { - - /** - * The {@link ResourceBundle} to use for translations. - */ - private ResourceBundle resourceBundle; - - /** - * - * @param resourceBundle The {@link ResourceBundle} to use for translations. - * Can be <code>null</code>, which will lead to simply return the key - * modified by prefixing and suffixing it with "!" when calling translate(String). - */ - public ResourceBundleTranslationProvider(ResourceBundle resourceBundle) { - this.setResourceBundle(resourceBundle); - } - - /** - * Tries to retrieve the translation value for the given key out of the {@link ResourceBundle} - * set to this {@link ResourceBundleTranslationProvider}. If there is no {@link ResourceBundle} - * set or there is no translation found for the given key, the key itself prefixed and suffixed - * with "!" will be returned to indicate that there is no translation found. - * <p>This implementation also supports the usage of dot separation for property keys. As in Java - * variables can not be separated with a dot, the underscore needs to be used for separation of - * the variable. This will be replaced automatically to a dot, if there is no translation found - * with an underscore as separator. - * </p> - * @param key The key of the requested translation property. - * @return The translation for the given key or the key itself prefixed and suffixed - * with "!" to indicate that there is no translation available for the - * given key. - */ - public String translate(String key) { - String result = ""; //$NON-NLS-1$ - try { - if (this.resourceBundle == null) { - result = "!" + key + "!"; //$NON-NLS-1$ //$NON-NLS-2$ - } - else { - result = this.resourceBundle.getString(key); - } - } catch (MissingResourceException e) { - if (key.contains("_")) { //$NON-NLS-1$ - result = translate(key.replace('_', '.')); - } else { - result = "!" + key + "!"; //$NON-NLS-1$ //$NON-NLS-2$ - } - } - return result; - } - - /** - * @return The {@link ResourceBundle} that is used for translations. - */ - public ResourceBundle getResourceBundle() { - return resourceBundle; - } - - /** - * @param resourceBundle The {@link ResourceBundle} to use for translations. - */ - public void setResourceBundle(ResourceBundle resourceBundle) { - this.resourceBundle = resourceBundle; - } -} diff --git a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/ResourcePoolFactory.java b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/ResourcePoolFactory.java deleted file mode 100644 index 43b46b71..00000000 --- a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/ResourcePoolFactory.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.services.impl; - -import org.eclipse.e4.core.contexts.ContextFunction; -import org.eclipse.e4.core.contexts.ContextInjectionFactory; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.tools.services.impl.ResourceService.ResourcePool; - -public class ResourcePoolFactory extends ContextFunction { - - @Override - public Object compute(IEclipseContext context, String contextKey) { - return ContextInjectionFactory.make(ResourcePool.class, context); - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/ResourceService.java b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/ResourceService.java deleted file mode 100644 index 773cfdf1..00000000 --- a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/ResourceService.java +++ /dev/null @@ -1,410 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.services.impl; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.annotation.PreDestroy; -import javax.inject.Inject; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.e4.tools.services.IResourcePool; -import org.eclipse.e4.tools.services.IResourceProviderService; -import org.eclipse.e4.tools.services.IResourceService; -import org.eclipse.e4.tools.services.ToolsServicesActivator; -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.Resource; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.FrameworkUtil; -import org.osgi.framework.InvalidSyntaxException; -import org.osgi.framework.ServiceReference; - -public class ResourceService implements IResourceService { - private enum Type { - IMAGE, FONT, COLOR - } - - static class PooledResource<T extends Resource> implements - IPooledResource<T> { - private final Display display; - private int count; - private T resource; - private String id; - private ResourceService resourceService; - - PooledResource(Display display, ResourceService resourceService, - String id, T resource) { - this.display = display; - this.id = id; - this.count = 1; - this.resourceService = resourceService; - this.resource = resource; - } - - @Override - public String getId() { - return id; - } - - @Override - public T getResource() { - return resource; - } - - @Override - public void dispose() { - this.count--; - if (this.count == 0) { - resourceService.removePooledResource(this); - if (resource != null) { - resource.dispose(); - } - resource = null; - id = null; - resourceService = null; - } - } - } - - public static class ResourcePool implements IDiposeableResourcePool { - private IResourceService resourceService; - - private List<IPooledResource<Image>> pooledImages = new ArrayList<IPooledResource<Image>>(); - private List<IPooledResource<Font>> pooledFonts = new ArrayList<IPooledResource<Font>>(); - private List<IPooledResource<Color>> pooledColors = new ArrayList<IPooledResource<Color>>(); - private final Display display; - - @Inject - public ResourcePool(IResourceService resourceService, Display display) { - this.display = display; - this.resourceService = resourceService; - } - - @Override - public Image getImage(String key) throws CoreException { - if (resourceService == null) { - throw new CoreException( - new Status(IStatus.ERROR, - ToolsServicesActivator.PLUGIN_ID, - Messages.ResourceService_PoolDisposed)); - } - IPooledResource<Image> image = null; - - for (final IPooledResource<Image> img : pooledImages) { - if (img.getId().equals(key)) { - image = img; - } - } - if (image == null) { - image = resourceService.getImage(display, key); - pooledImages.add(image); - } - - return image.getResource(); - } - - @Override - public Font getFont(String key) throws CoreException { - if (resourceService == null) { - throw new CoreException( - new Status(IStatus.ERROR, - ToolsServicesActivator.PLUGIN_ID, - Messages.ResourceService_PoolDisposed)); - } - - IPooledResource<Font> font = null; - for (final IPooledResource<Font> fon : pooledFonts) { - if (fon.getId().equals(key)) { - font = fon; - } - } - if (font == null) { - font = resourceService.getFont(display, key); - pooledFonts.add(font); - } - return font.getResource(); - } - - @Override - public Color getColor(String key) throws CoreException { - if (resourceService == null) { - throw new CoreException( - new Status(IStatus.ERROR, - ToolsServicesActivator.PLUGIN_ID, - Messages.ResourceService_PoolDisposed)); - } - IPooledResource<Color> color = null; - - for (final IPooledResource<Color> col : pooledColors) { - if (col.getId().equals(key)) { - color = col; - } - } - - if (color == null) { - color = resourceService.getColor(display, - key); - pooledColors.add(color); - } - return color.getResource(); - } - - @Override - public Image getImageUnchecked(String key) { - try { - return getImage(key); - } catch (final CoreException e) { - return null; - } - } - - @Override - public Font getFontUnchecked(String key) { - try { - return getFont(key); - } catch (final CoreException e) { - return null; - } - } - - @Override - public Color getColorUnchecked(String key) { - try { - return getColor(key); - } catch (final CoreException e) { - return null; - } - } - - @Override - @PreDestroy - public void dispose() { - for (final IPooledResource<Image> img : pooledImages) { - img.dispose(); - } - for (final IPooledResource<Font> font : pooledFonts) { - font.dispose(); - } - for (final IPooledResource<Color> col : pooledColors) { - col.dispose(); - } - resourceService = null; - pooledImages = null; - pooledFonts = null; - pooledColors = null; - } - } - - static class DisplayPool { - private Map<String, PooledResource<Image>> imagePool; - private Map<String, PooledResource<Color>> colorPool; - private Map<String, PooledResource<Font>> fontPool; - - public Map<String, PooledResource<Color>> getColorPool() { - if (colorPool == null) { - colorPool = new HashMap<String, ResourceService.PooledResource<Color>>(); - } - return colorPool; - } - - public Map<String, PooledResource<Image>> getImagePool() { - if (imagePool == null) { - imagePool = new HashMap<String, ResourceService.PooledResource<Image>>(); - } - return imagePool; - } - - public Map<String, PooledResource<Font>> getFontPool() { - if (fontPool == null) { - fontPool = new HashMap<String, ResourceService.PooledResource<Font>>(); - } - return fontPool; - } - } - - private final Map<Display, DisplayPool> displayPool = new HashMap<Display, ResourceService.DisplayPool>(); - // private Map<String, IResourceProviderService> imagekey2providers = new - // HashMap<String, IResourceProviderService>(); - // private Map<String, IResourceProviderService> fontkey2providers = new - // HashMap<String, IResourceProviderService>(); - // private Map<String, IResourceProviderService> colorkey2providers = new - // HashMap<String, IResourceProviderService>(); - private final BundleContext context; - - public ResourceService() { - final Bundle b = FrameworkUtil.getBundle(ResourceService.class); - context = b.getBundleContext(); - } - - protected void removePooledResource(PooledResource<?> resource) { - if (resource.getResource() instanceof Image) { - displayPool.get(resource.display).getImagePool().remove(resource.getId()); - } else if (resource.getResource() instanceof Color) { - displayPool.get(resource.display).getColorPool().remove(resource.getId()); - } else if (resource.getResource() instanceof Font) { - displayPool.get(resource.display).getFontPool().remove(resource.getId()); - } - } - - @SuppressWarnings("unchecked") - private <R extends Resource> PooledResource<R> loadResource( - Display display, String key, Type type) { - DisplayPool p = displayPool.get(display); - PooledResource<R> resource = null; - - if (p != null) { - if (type == Type.IMAGE) { - resource = (PooledResource<R>) p.getImagePool().get(key); - } else if (type == Type.COLOR) { - resource = (PooledResource<R>) p.getColorPool().get(key); - } else { - resource = (PooledResource<R>) p.getFontPool().get(key); - } - } - - if (resource != null && resource.getResource() != null) { - resource.count++; - } else { - resource = new PooledResource<R>(display, this, key, - (R) lookupResource(display, key, type)); - - if (p == null) { - p = new DisplayPool(); - displayPool.put(display, p); - } - - if (type == Type.IMAGE) { - p.getImagePool().put(key, (PooledResource<Image>) resource); - } else if (type == Type.COLOR) { - p.getColorPool().put(key, (PooledResource<Color>) resource); - } else { - p.getFontPool().put(key, (PooledResource<Font>) resource); - } - - } - - return resource; - } - - @SuppressWarnings("unchecked") - private <R> R lookupResource(Display display, String key, Type type) { - - if (type == Type.IMAGE) { - final IResourceProviderService provider = lookupOSGI(key); - if (provider != null) { - return (R) provider.getImage(display, key); - } - } else if (type == Type.COLOR) { - final IResourceProviderService provider = lookupOSGI(key); - if (provider != null) { - return (R) provider.getColor(display, key); - } - - } else { - final IResourceProviderService provider = lookupOSGI(key); - if (provider != null) { - return (R) provider.getFont(display, key); - } - } - throw new IllegalArgumentException(Messages.ResourceService_NoProvider + key - + "'."); //$NON-NLS-1$ - } - - private IResourceProviderService lookupOSGI(String key) { - try { - final Collection<ServiceReference<IResourceProviderService>> refs = context - .getServiceReferences(IResourceProviderService.class, "(" //$NON-NLS-1$ - + key + "=*)"); //$NON-NLS-1$ - if (!refs.isEmpty()) { - final ServiceReference<IResourceProviderService> ref = refs - .iterator().next(); - return context.getService(ref); - } - } catch (final InvalidSyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return null; - } - - // public void addProvider(IResourceProviderService provider, - // Map<String, String> map) { - // for (Entry<String, String> e : map.entrySet()) { - // if( e.getKey().startsWith("IMAGE") ) { - // imagekey2providers.put(e.getKey(), provider); - // } else if( e.getKey().startsWith("FONT") ) { - // fontkey2providers.put(e.getKey(), provider); - // } else if( e.getKey().startsWith("COLOR") ) { - // colorkey2providers.put(e.getKey(), provider); - // } - // } - // } - // - // public void removeProvider(IResourceProviderService provider, - // Map<String, String> map) { - // for (Entry<String, String> e : map.entrySet()) { - // if( e.getKey().startsWith("IMAGE") ) { - // imagekey2providers.remove(e.getKey()); - // } else if( e.getKey().startsWith("FONT") ) { - // fontkey2providers.remove(e.getKey()); - // } else if( e.getKey().startsWith("COLOR") ) { - // colorkey2providers.remove(e.getKey()); - // } - // } - // } - - @Override - public PooledResource<Image> getImage(Display display, String key) { - return loadResource(display, key, Type.IMAGE); - } - - @Override - public PooledResource<Color> getColor(Display display, String key) { - return loadResource(display, key, Type.COLOR); - } - - @Override - public PooledResource<Font> getFont(Display display, String key) { - return loadResource(display, key, Type.FONT); - } - - @Override - public IDiposeableResourcePool getResourcePool(Display display) { - return new ResourcePool(this, display); - } - - @Override - public IResourcePool getControlPool(Control control) { - final ResourcePool pool = new ResourcePool(this, control.getDisplay()); - control.addDisposeListener(new DisposeListener() { - - @Override - public void widgetDisposed(DisposeEvent e) { - pool.dispose(); - } - }); - return pool; - } - -} diff --git a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/messages.properties b/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/messages.properties deleted file mode 100644 index e7f5b650..00000000 --- a/bundles/org.eclipse.e4.tools.services/src/org/eclipse/e4/tools/services/impl/messages.properties +++ /dev/null @@ -1,2 +0,0 @@ -ResourceService_NoProvider=No provider known for ' -ResourceService_PoolDisposed=The pool is disposed diff --git a/bundles/org.eclipse.e4.tools/.classpath b/bundles/org.eclipse.e4.tools/.classpath deleted file mode 100644 index ad32c83a..00000000 --- a/bundles/org.eclipse.e4.tools/.classpath +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="src" path="src"/> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/bundles/org.eclipse.e4.tools/.jetproperties b/bundles/org.eclipse.e4.tools/.jetproperties deleted file mode 100644 index 2907c83a..00000000 --- a/bundles/org.eclipse.e4.tools/.jetproperties +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<jet-settings> - <template-container>templates</template-container> <source-container>src</source-container> -</jet-settings> diff --git a/bundles/org.eclipse.e4.tools/.project b/bundles/org.eclipse.e4.tools/.project deleted file mode 100644 index 62db1d2d..00000000 --- a/bundles/org.eclipse.e4.tools/.project +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.e4.tools</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.emf.codegen.JETBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ManifestBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.SchemaBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.emf.codegen.jet.IJETNature</nature> - <nature>org.eclipse.pde.PluginNature</nature> - <nature>org.eclipse.jdt.core.javanature</nature> - </natures> -</projectDescription> diff --git a/bundles/org.eclipse.e4.tools/.settings/org.eclipse.core.resources.prefs b/bundles/org.eclipse.e4.tools/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index f548abbf..00000000 --- a/bundles/org.eclipse.e4.tools/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,6 +0,0 @@ -eclipse.preferences.version=1 - -encoding//model/etypes.ecore=UTF-8 - - -encoding/<project>=UTF-8 diff --git a/bundles/org.eclipse.e4.tools/.settings/org.eclipse.core.runtime.prefs b/bundles/org.eclipse.e4.tools/.settings/org.eclipse.core.runtime.prefs deleted file mode 100644 index 5a0ad22d..00000000 --- a/bundles/org.eclipse.e4.tools/.settings/org.eclipse.core.runtime.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -line.separator=\n diff --git a/bundles/org.eclipse.e4.tools/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.e4.tools/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index c9482977..00000000 --- a/bundles/org.eclipse.e4.tools/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,418 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.builder.cleanOutputFolder=clean -org.eclipse.jdt.core.builder.duplicateResourceTask=warning -org.eclipse.jdt.core.builder.invalidClasspath=abort -org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore -org.eclipse.jdt.core.builder.resourceCopyExclusionFilter= -org.eclipse.jdt.core.circularClasspath=error -org.eclipse.jdt.core.classpath.exclusionPatterns=enabled -org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled -org.eclipse.jdt.core.classpath.outputOverlappingAnotherSource=error -org.eclipse.jdt.core.codeComplete.argumentPrefixes= -org.eclipse.jdt.core.codeComplete.argumentSuffixes= -org.eclipse.jdt.core.codeComplete.fieldPrefixes= -org.eclipse.jdt.core.codeComplete.fieldSuffixes= -org.eclipse.jdt.core.codeComplete.localPrefixes= -org.eclipse.jdt.core.codeComplete.localSuffixes= -org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= -org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= -org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= -org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= -org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled -org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore -org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull -org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault -org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable -org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.doc.comment.support=enabled -org.eclipse.jdt.core.compiler.maxProblemPerUnit=100 -org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.autoboxing=ignore -org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning -org.eclipse.jdt.core.compiler.problem.deadCode=warning -org.eclipse.jdt.core.compiler.problem.deprecation=warning -org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled -org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled -org.eclipse.jdt.core.compiler.problem.discouragedReference=warning -org.eclipse.jdt.core.compiler.problem.emptyStatement=warning -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore -org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning -org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled -org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore -org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning -org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning -org.eclipse.jdt.core.compiler.problem.forbiddenReference=error -org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning -org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled -org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning -org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore -org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning -org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=disabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=public -org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning -org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning -org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled -org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning -org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore -org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled -org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public -org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag -org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled -org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning -org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning -org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning -org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning -org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning -org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error -org.eclipse.jdt.core.compiler.problem.nullReference=warning -org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error -org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning -org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning -org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning -org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore -org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore -org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning -org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning -org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning -org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore -org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning -org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore -org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore -org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled -org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning -org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled -org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled -org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled -org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore -org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning -org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning -org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning -org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore -org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning -org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning -org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled -org.eclipse.jdt.core.compiler.problem.unusedImport=warning -org.eclipse.jdt.core.compiler.problem.unusedLabel=warning -org.eclipse.jdt.core.compiler.problem.unusedLocal=warning -org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled -org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning -org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning -org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.6 -org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled -org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,HIGH,LOW,LOW,LOW,LOW,LOW,NORMAL -org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX,PERF,MEM,POLISH,@generated NOT,@ADDED,APITODO -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_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=true -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=true -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=do not insert -org.eclipse.jdt.core.formatter.comment.line_length=120 -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=1 -org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=1 -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_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_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_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=false -org.eclipse.jdt.core.formatter.join_wrapped_lines=false -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=true -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 -org.eclipse.jdt.core.incompatibleJDKLevel=ignore -org.eclipse.jdt.core.incompleteClasspath=error diff --git a/bundles/org.eclipse.e4.tools/.settings/org.eclipse.jdt.launching.prefs b/bundles/org.eclipse.e4.tools/.settings/org.eclipse.jdt.launching.prefs deleted file mode 100644 index 3bb23527..00000000 --- a/bundles/org.eclipse.e4.tools/.settings/org.eclipse.jdt.launching.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.launching.PREF_STRICTLY_COMPATIBLE_JRE_NOT_AVAILABLE=ignore diff --git a/bundles/org.eclipse.e4.tools/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.e4.tools/.settings/org.eclipse.jdt.ui.prefs deleted file mode 100644 index 791508d1..00000000 --- a/bundles/org.eclipse.e4.tools/.settings/org.eclipse.jdt.ui.prefs +++ /dev/null @@ -1,115 +0,0 @@ -cleanup.add_default_serial_version_id=true -cleanup.add_generated_serial_version_id=false -cleanup.add_missing_annotations=true -cleanup.add_missing_deprecated_annotations=true -cleanup.add_missing_methods=false -cleanup.add_missing_nls_tags=false -cleanup.add_missing_override_annotations=true -cleanup.add_missing_override_annotations_interface_methods=true -cleanup.add_serial_version_id=false -cleanup.always_use_blocks=true -cleanup.always_use_parentheses_in_expressions=false -cleanup.always_use_this_for_non_static_field_access=false -cleanup.always_use_this_for_non_static_method_access=false -cleanup.convert_to_enhanced_for_loop=false -cleanup.correct_indentation=true -cleanup.format_source_code=true -cleanup.format_source_code_changes_only=false -cleanup.make_local_variable_final=true -cleanup.make_parameters_final=false -cleanup.make_private_fields_final=true -cleanup.make_type_abstract_if_missing_method=false -cleanup.make_variable_declarations_final=true -cleanup.never_use_blocks=false -cleanup.never_use_parentheses_in_expressions=true -cleanup.organize_imports=true -cleanup.qualify_static_field_accesses_with_declaring_class=false -cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true -cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -cleanup.qualify_static_member_accesses_with_declaring_class=true -cleanup.qualify_static_method_accesses_with_declaring_class=false -cleanup.remove_private_constructors=true -cleanup.remove_trailing_whitespaces=true -cleanup.remove_trailing_whitespaces_all=true -cleanup.remove_trailing_whitespaces_ignore_empty=false -cleanup.remove_unnecessary_casts=false -cleanup.remove_unnecessary_nls_tags=false -cleanup.remove_unused_imports=true -cleanup.remove_unused_local_variables=false -cleanup.remove_unused_private_fields=true -cleanup.remove_unused_private_members=false -cleanup.remove_unused_private_methods=true -cleanup.remove_unused_private_types=true -cleanup.sort_members=false -cleanup.sort_members_all=false -cleanup.use_blocks=true -cleanup.use_blocks_only_for_return_and_throw=false -cleanup.use_parentheses_in_expressions=true -cleanup.use_this_for_non_static_field_access=true -cleanup.use_this_for_non_static_field_access_only_if_necessary=true -cleanup.use_this_for_non_static_method_access=true -cleanup.use_this_for_non_static_method_access_only_if_necessary=true -cleanup_profile=_esmCleanUp -cleanup_settings_version=2 -eclipse.preferences.version=1 -editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true -formatter_profile=_esmFormatter -formatter_settings_version=12 -org.eclipse.jdt.ui.exception.name=ex -org.eclipse.jdt.ui.gettersetter.use.is=true -org.eclipse.jdt.ui.javadoc=true -org.eclipse.jdt.ui.keywordthis=false -org.eclipse.jdt.ui.overrideannotation=true -org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*******************************************************************************\r\n * Copyright (c) 2011-${year} EclipseSource Muenchen GmbH and others.\r\n * \r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n * \r\n * Contributors\:\r\n * ${user} - initial API and implementation\r\n ******************************************************************************/</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n *\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment"/><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/**\r\n * {@inheritDoc}\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="false" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">\t\t\t// TODO Auto-generated catch block\r\n\t\t\t// Do NOT catch all Exceptions ("catch (Exception e)")\r\n\t\t\t// Log AND handle Exceptions if possible \r\n //\r\n // You can just uncomment one of the lines below to log an exception\:\r\n\t\t\t// logException will show the logged excpetion to the user\r\n\t\t\t// ModelUtil.logException(${exception_var});\r\n\t\t\t// ModelUtil.logException("YOUR MESSAGE HERE", ${exception_var});\r\n\t\t\t// logWarning will only add the message to the error log\r\n\t\t\t// ModelUtil.logWarning("YOUR MESSAGE HERE", ${exception_var});\r\n\t\t\t// ModelUtil.logWarning("YOUR MESSAGE HERE");\r\n\t\t\t//\t\t\t\r\n\t\t\t// If handling is not possible declare and rethrow Exception</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates> -sp_cleanup.add_default_serial_version_id=true -sp_cleanup.add_generated_serial_version_id=false -sp_cleanup.add_missing_annotations=true -sp_cleanup.add_missing_deprecated_annotations=true -sp_cleanup.add_missing_methods=false -sp_cleanup.add_missing_nls_tags=false -sp_cleanup.add_missing_override_annotations=true -sp_cleanup.add_missing_override_annotations_interface_methods=true -sp_cleanup.add_serial_version_id=false -sp_cleanup.always_use_blocks=true -sp_cleanup.always_use_parentheses_in_expressions=false -sp_cleanup.always_use_this_for_non_static_field_access=false -sp_cleanup.always_use_this_for_non_static_method_access=false -sp_cleanup.convert_to_enhanced_for_loop=false -sp_cleanup.correct_indentation=true -sp_cleanup.format_source_code=true -sp_cleanup.format_source_code_changes_only=false -sp_cleanup.make_local_variable_final=true -sp_cleanup.make_parameters_final=false -sp_cleanup.make_private_fields_final=true -sp_cleanup.make_type_abstract_if_missing_method=false -sp_cleanup.make_variable_declarations_final=true -sp_cleanup.never_use_blocks=false -sp_cleanup.never_use_parentheses_in_expressions=true -sp_cleanup.on_save_use_additional_actions=true -sp_cleanup.organize_imports=true -sp_cleanup.qualify_static_field_accesses_with_declaring_class=false -sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_with_declaring_class=true -sp_cleanup.qualify_static_method_accesses_with_declaring_class=false -sp_cleanup.remove_private_constructors=true -sp_cleanup.remove_trailing_whitespaces=true -sp_cleanup.remove_trailing_whitespaces_all=true -sp_cleanup.remove_trailing_whitespaces_ignore_empty=false -sp_cleanup.remove_unnecessary_casts=false -sp_cleanup.remove_unnecessary_nls_tags=true -sp_cleanup.remove_unused_imports=true -sp_cleanup.remove_unused_local_variables=false -sp_cleanup.remove_unused_private_fields=true -sp_cleanup.remove_unused_private_members=false -sp_cleanup.remove_unused_private_methods=true -sp_cleanup.remove_unused_private_types=true -sp_cleanup.sort_members=false -sp_cleanup.sort_members_all=false -sp_cleanup.use_blocks=true -sp_cleanup.use_blocks_only_for_return_and_throw=false -sp_cleanup.use_parentheses_in_expressions=true -sp_cleanup.use_this_for_non_static_field_access=true -sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true -sp_cleanup.use_this_for_non_static_method_access=true -sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/bundles/org.eclipse.e4.tools/.settings/org.eclipse.pde.api.tools.prefs b/bundles/org.eclipse.e4.tools/.settings/org.eclipse.pde.api.tools.prefs deleted file mode 100644 index e4e3c007..00000000 --- a/bundles/org.eclipse.e4.tools/.settings/org.eclipse.pde.api.tools.prefs +++ /dev/null @@ -1,97 +0,0 @@ -ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Error -ANNOTATION_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error -ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Error -ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD=Error -ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error -API_COMPONENT_ELEMENT_TYPE_REMOVED_API_TYPE=Error -API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_API_TYPE=Error -API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_TYPE=Error -API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Error -API_USE_SCAN_FIELD_SEVERITY=Error -API_USE_SCAN_METHOD_SEVERITY=Error -API_USE_SCAN_TYPE_SEVERITY=Error -CLASS_ELEMENT_TYPE_ADDED_METHOD=Error -CLASS_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error -CLASS_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error -CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error -CLASS_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error -CLASS_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error -CLASS_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error -CLASS_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error -CLASS_ELEMENT_TYPE_REMOVED_CONSTRUCTOR=Error -CLASS_ELEMENT_TYPE_REMOVED_FIELD=Error -CLASS_ELEMENT_TYPE_REMOVED_METHOD=Error -CLASS_ELEMENT_TYPE_REMOVED_SUPERCLASS=Error -CLASS_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error -CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error -CONSTRUCTOR_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error -CONSTRUCTOR_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error -CONSTRUCTOR_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error -CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error -ENUM_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error -ENUM_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error -ENUM_ELEMENT_TYPE_REMOVED_ENUM_CONSTANT=Error -ENUM_ELEMENT_TYPE_REMOVED_FIELD=Error -ENUM_ELEMENT_TYPE_REMOVED_METHOD=Error -ENUM_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error -FIELD_ELEMENT_TYPE_ADDED_VALUE=Error -FIELD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error -FIELD_ELEMENT_TYPE_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT=Error -FIELD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error -FIELD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error -FIELD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error -FIELD_ELEMENT_TYPE_CHANGED_TYPE=Error -FIELD_ELEMENT_TYPE_CHANGED_VALUE=Error -FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENT=Error -FIELD_ELEMENT_TYPE_REMOVED_VALUE=Error -ILLEGAL_EXTEND=Warning -ILLEGAL_IMPLEMENT=Warning -ILLEGAL_INSTANTIATE=Warning -ILLEGAL_OVERRIDE=Warning -ILLEGAL_REFERENCE=Warning -INTERFACE_ELEMENT_TYPE_ADDED_FIELD=Error -INTERFACE_ELEMENT_TYPE_ADDED_METHOD=Error -INTERFACE_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error -INTERFACE_ELEMENT_TYPE_ADDED_SUPER_INTERFACE_WITH_METHODS=Error -INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error -INTERFACE_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error -INTERFACE_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error -INTERFACE_ELEMENT_TYPE_REMOVED_FIELD=Error -INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Error -INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error -INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error -INVALID_JAVADOC_TAG=Warning -INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Error -LEAK_EXTEND=Warning -LEAK_FIELD_DECL=Warning -LEAK_IMPLEMENT=Warning -LEAK_METHOD_PARAM=Warning -LEAK_METHOD_RETURN_TYPE=Warning -METHOD_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error -METHOD_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error -METHOD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error -METHOD_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error -METHOD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error -METHOD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error -METHOD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error -METHOD_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error -METHOD_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Error -METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error -MISSING_EE_DESCRIPTIONS=Error -TYPE_PARAMETER_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error -TYPE_PARAMETER_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error -TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error -TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error -TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error -TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error -UNUSED_PROBLEM_FILTERS=Ignore -automatically_removed_unused_problem_filters=Disabled -eclipse.preferences.version=1 -incompatible_api_component_version=Error -incompatible_api_component_version_include_major_without_breaking_change=Disabled -incompatible_api_component_version_include_minor_without_api_change=Disabled -invalid_since_tag_version=Error -malformed_since_tag=Error -missing_since_tag=Error -report_api_breakage_when_major_version_incremented=Disabled -report_resolution_errors_api_component=Warning diff --git a/bundles/org.eclipse.e4.tools/.settings/org.eclipse.pde.prefs b/bundles/org.eclipse.e4.tools/.settings/org.eclipse.pde.prefs deleted file mode 100644 index 0bbee3c4..00000000 --- a/bundles/org.eclipse.e4.tools/.settings/org.eclipse.pde.prefs +++ /dev/null @@ -1,32 +0,0 @@ -compilers.f.unresolved-features=1 -compilers.f.unresolved-plugins=1 -compilers.incompatible-environment=1 -compilers.p.build=1 -compilers.p.build.bin.includes=1 -compilers.p.build.encodings=2 -compilers.p.build.java.compiler=2 -compilers.p.build.java.compliance=1 -compilers.p.build.missing.output=2 -compilers.p.build.output.library=1 -compilers.p.build.source.library=1 -compilers.p.build.src.includes=1 -compilers.p.deprecated=1 -compilers.p.discouraged-class=1 -compilers.p.internal=1 -compilers.p.missing-packages=1 -compilers.p.missing-version-export-package=1 -compilers.p.missing-version-import-package=1 -compilers.p.missing-version-require-bundle=1 -compilers.p.no-required-att=0 -compilers.p.not-externalized-att=2 -compilers.p.unknown-attribute=1 -compilers.p.unknown-class=1 -compilers.p.unknown-element=1 -compilers.p.unknown-identifier=1 -compilers.p.unknown-resource=1 -compilers.p.unresolved-ex-points=0 -compilers.p.unresolved-import=0 -compilers.s.create-docs=false -compilers.s.doc-folder=doc -compilers.s.open-tags=1 -eclipse.preferences.version=1 diff --git a/bundles/org.eclipse.e4.tools/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools/META-INF/MANIFEST.MF deleted file mode 100644 index 119e50a3..00000000 --- a/bundles/org.eclipse.e4.tools/META-INF/MANIFEST.MF +++ /dev/null @@ -1,30 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %Bundle-Name -Bundle-SymbolicName: org.eclipse.e4.tools;singleton:=true -Bundle-Version: 0.12.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 -Require-Bundle: org.eclipse.ui;bundle-version="3.6.0", - org.eclipse.core.runtime;bundle-version="3.6.0", - org.eclipse.e4.ui.model.workbench;bundle-version="0.9.1", - org.eclipse.core.resources;bundle-version="3.6.0", - org.eclipse.jdt.core;bundle-version="3.6.0", - org.eclipse.jdt.launching;bundle-version="3.5.100", - org.eclipse.ui.ide;bundle-version="3.6.0", - org.eclipse.core.databinding;bundle-version="1.3.100", - org.eclipse.core.databinding.beans;bundle-version="1.2.100", - org.eclipse.jface.databinding;bundle-version="1.4.0", - org.eclipse.core.databinding.property;bundle-version="1.3.0", - org.eclipse.jdt.ui;bundle-version="3.6.0", - org.eclipse.emf.ecore;bundle-version="2.9.0", - org.eclipse.emf.ecore.xmi;bundle-version="2.9.0", - org.eclipse.pde.core;bundle-version="3.9.0", - org.eclipse.pde.ui;bundle-version="3.8.0" -Bundle-ActivationPolicy: lazy -Bundle-Activator: org.eclipse.e4.internal.tools.ToolsPlugin -Export-Package: org.eclipse.e4.internal.tools;version="0.12.0.qualifier";x-internal:=true, - org.eclipse.e4.internal.tools.wizards.classes;version="0.12.0.qualifier";x-friends:="org.eclipse.e4.tools.emf.editor3x", - org.eclipse.e4.internal.tools.wizards.classes.templates;version="0.12.0.qualifier";x-internal:=true, - org.eclipse.e4.internal.tools.wizards.model;version="0.12.0.qualifier";x-internal:=true, - org.eclipse.e4.internal.tools.wizards.project;version="0.12.0.qualifier";x-internal:=true -Bundle-Vendor: %Bundle-Vendor diff --git a/bundles/org.eclipse.e4.tools/OSGI-INF/l10n/bundle.properties b/bundles/org.eclipse.e4.tools/OSGI-INF/l10n/bundle.properties deleted file mode 100644 index f129e2aa..00000000 --- a/bundles/org.eclipse.e4.tools/OSGI-INF/l10n/bundle.properties +++ /dev/null @@ -1,20 +0,0 @@ -#Properties file for org.eclipse.e4.tools -category.name = Eclipse 4 -category.name.0 = Classes -category.name.1 = Model -wizard.name = Eclipse 4 Application Project -wizard.name.description = Create an Eclipse 4 application project -wizard.name.0 = New Application Model -wizard.name.0.description = Create an Eclipse 4 application model -wizard.name.1 = New Model Fragment -wizard.name.1.description = Create an Eclipse 4 model fragment -wizard.name.2 = New Handler Class -wizard.name.2.description = Create an Eclipse 4 command handler class -wizard.name.3 = New Part Class -wizard.name.3.description = Create an Eclipse 4 part class -wizard.name.4 = New Addon Class -wizard.name.4.description = Create an Eclipse 4 add-on class -wizard.name.5 = New Tool Control Class -wizard.name.5.description = Create an Eclipse 4 tool control class -Bundle-Name = Tools -Bundle-Vendor = Eclipse.org
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools/README.md b/bundles/org.eclipse.e4.tools/README.md deleted file mode 100644 index 6a7e7a0d..00000000 --- a/bundles/org.eclipse.e4.tools/README.md +++ /dev/null @@ -1,14 +0,0 @@ -org.eclipse.e4.tools -==================== - -Provides the e4 wizards for new Eclipse 4 RCP applications, e4 based classses, application models and model fragments. - -For more information, refer to the [Eclipse e4 wiki page] [1]. - -License -------- - -[Eclipse Public License (EPL) v1.0][2] - -[1]: http://www.eclipse.org/e4/ -[2]: http://wiki.eclipse.org/EPL diff --git a/bundles/org.eclipse.e4.tools/about.html b/bundles/org.eclipse.e4.tools/about.html deleted file mode 100644 index c1343aa3..00000000 --- a/bundles/org.eclipse.e4.tools/about.html +++ /dev/null @@ -1,45 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> -<title>About</title> -</head> -<body lang="EN-US"> -<h2>About This Content</h2> - -<p>December 3, 2009</p> -<h3>License</h3> - -<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise -indicated below, the Content is provided to you under the terms and conditions of the -Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available -at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. -For purposes of the EPL, "Program" will mean the Content.</p> - -<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is -being redistributed by another party ("Redistributor") and different terms and conditions may -apply to your use of any object code in the Content. Check the Redistributor's license that was -provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise -indicated below, the terms and conditions of the EPL still apply to any source code in the Content -and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p> - -<h3>Third Party Content</h3> - -<p>The Content includes items from third parties as set out below. If you did not -receive this Content directly from the Eclipse Foundation, the following is provided for informational -purposes only, and you should look to the Redistributor’s license for terms and conditions of use.</p> - -<h4>Silk icon set Version 1.3</h4> -<p> -This plugin contains icons from the Silk icon set created by Mark James. The original files can -be found at: -<ul> -<a href="http://www.famfamfam.com/lab/icons/silk/">http://www.famfamfam.com/lab/icons/silk/</a></ul> -<p>The license can be found at:</p> -<ul> - <li><a href="http://creativecommons.org/licenses/by/2.5/">http://creativecommons.org/licenses/by/2.5/</a></li> -</ul> - -</body> -</html>
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools/build.properties b/bundles/org.eclipse.e4.tools/build.properties deleted file mode 100644 index ecd7b1c6..00000000 --- a/bundles/org.eclipse.e4.tools/build.properties +++ /dev/null @@ -1,9 +0,0 @@ -source.. = src/ -output.. = bin/ -bin.includes = META-INF/,\ - .,\ - plugin.xml,\ - templates/,\ - about.html,\ - OSGI-INF/,\ - icons/ diff --git a/bundles/org.eclipse.e4.tools/forceQualifierUpdate.txt b/bundles/org.eclipse.e4.tools/forceQualifierUpdate.txt deleted file mode 100644 index 396f0875..00000000 --- a/bundles/org.eclipse.e4.tools/forceQualifierUpdate.txt +++ /dev/null @@ -1,2 +0,0 @@ -# To force a version qualifier update add the bug here -Bug 403237 - o.e.e4.tools cannot be build with "mvn clean install" diff --git a/bundles/org.eclipse.e4.tools/icons/full/obj16/Addons.png b/bundles/org.eclipse.e4.tools/icons/full/obj16/Addons.png Binary files differdeleted file mode 100644 index 3262767c..00000000 --- a/bundles/org.eclipse.e4.tools/icons/full/obj16/Addons.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools/icons/full/obj16/Part.gif b/bundles/org.eclipse.e4.tools/icons/full/obj16/Part.gif Binary files differdeleted file mode 100644 index 610f5844..00000000 --- a/bundles/org.eclipse.e4.tools/icons/full/obj16/Part.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools/icons/full/obj16/ToolControl.gif b/bundles/org.eclipse.e4.tools/icons/full/obj16/ToolControl.gif Binary files differdeleted file mode 100644 index 3e53cbdc..00000000 --- a/bundles/org.eclipse.e4.tools/icons/full/obj16/ToolControl.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools/icons/full/obj16/application_view_tile.png b/bundles/org.eclipse.e4.tools/icons/full/obj16/application_view_tile.png Binary files differdeleted file mode 100644 index 3bc0bd32..00000000 --- a/bundles/org.eclipse.e4.tools/icons/full/obj16/application_view_tile.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools/icons/full/obj16/class_obj.gif b/bundles/org.eclipse.e4.tools/icons/full/obj16/class_obj.gif Binary files differdeleted file mode 100644 index e4c2a836..00000000 --- a/bundles/org.eclipse.e4.tools/icons/full/obj16/class_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools/icons/full/obj16/plugin.png b/bundles/org.eclipse.e4.tools/icons/full/obj16/plugin.png Binary files differdeleted file mode 100644 index 6187b15a..00000000 --- a/bundles/org.eclipse.e4.tools/icons/full/obj16/plugin.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools/icons/full/wizban/newclass_wiz.png b/bundles/org.eclipse.e4.tools/icons/full/wizban/newclass_wiz.png Binary files differdeleted file mode 100644 index cc123864..00000000 --- a/bundles/org.eclipse.e4.tools/icons/full/wizban/newclass_wiz.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools/org/eclipse/e4/tools/emf/editor3x/templates/HandlerTemplate.java b/bundles/org.eclipse.e4.tools/org/eclipse/e4/tools/emf/editor3x/templates/HandlerTemplate.java deleted file mode 100644 index e969a093..00000000 --- a/bundles/org.eclipse.e4.tools/org/eclipse/e4/tools/emf/editor3x/templates/HandlerTemplate.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.eclipse.e4.tools.emf.editor3x.templates; - -import org.eclipse.e4.tools.emf.editor3x.wizard.NewHandlerClassWizard.HandlerClass; - -public class HandlerTemplate -{ - protected static String nl; - public static synchronized HandlerTemplate create(String lineSeparator) - { - nl = lineSeparator; - HandlerTemplate result = new HandlerTemplate(); - nl = null; - return result; - } - - public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; - protected final String TEXT_1 = " " + NL + "package "; - protected final String TEXT_2 = ";" + NL + "" + NL + "import org.eclipse.e4.core.di.annotations.Execute;"; - protected final String TEXT_3 = NL + "import org.eclipse.e4.core.di.annotations.CanExecute;"; - protected final String TEXT_4 = NL + NL + "public class "; - protected final String TEXT_5 = " {" + NL + "\t@Execute" + NL + "\tpublic void "; - protected final String TEXT_6 = "() {" + NL + "\t\t//TODO Your code goes here" + NL + "\t}" + NL + "\t"; - protected final String TEXT_7 = NL + "\t" + NL + "\t@CanExecute" + NL + "\tpublic boolean "; - protected final String TEXT_8 = "() {" + NL + "\t\t//TODO Your code goes here" + NL + "\t}" + NL + "\t"; - protected final String TEXT_9 = "\t" + NL + "}"; - - public String generate(Object argument) - { - final StringBuffer stringBuffer = new StringBuffer(); - HandlerClass domainClass = (HandlerClass)argument; - stringBuffer.append(TEXT_1); - stringBuffer.append( domainClass.getPackageFragment().getElementName() ); - stringBuffer.append(TEXT_2); - if( domainClass.isUseCanExecute() ) { - stringBuffer.append(TEXT_3); - } - stringBuffer.append(TEXT_4); - stringBuffer.append( domainClass.getName() ); - stringBuffer.append(TEXT_5); - stringBuffer.append( domainClass.getExecuteMethodName() ); - stringBuffer.append(TEXT_6); - if( domainClass.isUseCanExecute() ) { - stringBuffer.append(TEXT_7); - stringBuffer.append( domainClass.getCanExecuteMethodName() ); - stringBuffer.append(TEXT_8); - } - stringBuffer.append(TEXT_9); - return stringBuffer.toString(); - } -} diff --git a/bundles/org.eclipse.e4.tools/org/eclipse/e4/tools/emf/editor3x/templates/PartTemplate.java b/bundles/org.eclipse.e4.tools/org/eclipse/e4/tools/emf/editor3x/templates/PartTemplate.java deleted file mode 100644 index 3bcf8475..00000000 --- a/bundles/org.eclipse.e4.tools/org/eclipse/e4/tools/emf/editor3x/templates/PartTemplate.java +++ /dev/null @@ -1,89 +0,0 @@ -package org.eclipse.e4.tools.emf.editor3x.templates; - -import org.eclipse.e4.tools.emf.editor3x.wizard.NewPartClassWizard.PartClass; - -public class PartTemplate -{ - protected static String nl; - public static synchronized PartTemplate create(String lineSeparator) - { - nl = lineSeparator; - PartTemplate result = new PartTemplate(); - nl = null; - return result; - } - - public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; - protected final String TEXT_1 = " " + NL + "package "; - protected final String TEXT_2 = ";" + NL + "" + NL + "import javax.inject.Inject;"; - protected final String TEXT_3 = NL + "import javax.annotation.PostConstruct;"; - protected final String TEXT_4 = NL + "import javax.annotation.PreDestroy;"; - protected final String TEXT_5 = NL + "import org.eclipse.e4.ui.di.Focus;"; - protected final String TEXT_6 = NL + "import org.eclipse.e4.ui.di.Persist;"; - protected final String TEXT_7 = NL + NL + "public class "; - protected final String TEXT_8 = " {" + NL + "\t@Inject" + NL + "\tpublic "; - protected final String TEXT_9 = "() {" + NL + "\t\t//TODO Your code here" + NL + "\t}" + NL + "\t"; - protected final String TEXT_10 = NL + "\t@PostConstruct" + NL + "\tpublic void "; - protected final String TEXT_11 = "() {" + NL + "\t\t//TODO Your code here" + NL + "\t}" + NL + "\t"; - protected final String TEXT_12 = NL + "\t"; - protected final String TEXT_13 = NL + "\t@PreDestroy" + NL + "\tpublic void "; - protected final String TEXT_14 = "() {" + NL + "\t\t//TODO Your code here" + NL + "\t}" + NL + "\t"; - protected final String TEXT_15 = NL + "\t"; - protected final String TEXT_16 = NL + "\t@Focus" + NL + "\tpublic void "; - protected final String TEXT_17 = "() {" + NL + "\t\t//TODO Your code here" + NL + "\t}" + NL + "\t"; - protected final String TEXT_18 = NL + "\t"; - protected final String TEXT_19 = NL + "\t@Persist" + NL + "\tpublic void "; - protected final String TEXT_20 = "() {" + NL + "\t\t//TODO Your code here" + NL + "\t}" + NL + "\t"; - protected final String TEXT_21 = NL + "}"; - - public String generate(Object argument) - { - final StringBuffer stringBuffer = new StringBuffer(); - PartClass domainClass = (PartClass)argument; - stringBuffer.append(TEXT_1); - stringBuffer.append( domainClass.getPackageFragment().getElementName() ); - stringBuffer.append(TEXT_2); - if( domainClass.isUsePostConstruct() ) { - stringBuffer.append(TEXT_3); - } - if( domainClass.isUsePredestroy() ) { - stringBuffer.append(TEXT_4); - } - if( domainClass.isUseFocus() ) { - stringBuffer.append(TEXT_5); - } - if( domainClass.isUsePersist() ) { - stringBuffer.append(TEXT_6); - } - stringBuffer.append(TEXT_7); - stringBuffer.append( domainClass.getName() ); - stringBuffer.append(TEXT_8); - stringBuffer.append( domainClass.getName() ); - stringBuffer.append(TEXT_9); - if( domainClass.isUsePostConstruct() ) { - stringBuffer.append(TEXT_10); - stringBuffer.append( domainClass.getPostConstructMethodName() ); - stringBuffer.append(TEXT_11); - } - stringBuffer.append(TEXT_12); - if( domainClass.isUsePredestroy() ) { - stringBuffer.append(TEXT_13); - stringBuffer.append( domainClass.getPreDestroyMethodName() ); - stringBuffer.append(TEXT_14); - } - stringBuffer.append(TEXT_15); - if( domainClass.isUseFocus() ) { - stringBuffer.append(TEXT_16); - stringBuffer.append( domainClass.getFocusMethodName() ); - stringBuffer.append(TEXT_17); - } - stringBuffer.append(TEXT_18); - if( domainClass.isUsePersist() ) { - stringBuffer.append(TEXT_19); - stringBuffer.append( domainClass.getPersistMethodName() ); - stringBuffer.append(TEXT_20); - } - stringBuffer.append(TEXT_21); - return stringBuffer.toString(); - } -} diff --git a/bundles/org.eclipse.e4.tools/org/eclipse/e4/tools/internal/classes/templates/HandlerTemplate.java b/bundles/org.eclipse.e4.tools/org/eclipse/e4/tools/internal/classes/templates/HandlerTemplate.java deleted file mode 100644 index 711cdd74..00000000 --- a/bundles/org.eclipse.e4.tools/org/eclipse/e4/tools/internal/classes/templates/HandlerTemplate.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.eclipse.e4.tools.internal.classes.templates; - -import org.eclipse.e4.tools.internal.classes.NewHandlerClassWizard.HandlerClass; - -public class HandlerTemplate -{ - protected static String nl; - public static synchronized HandlerTemplate create(String lineSeparator) - { - nl = lineSeparator; - HandlerTemplate result = new HandlerTemplate(); - nl = null; - return result; - } - - public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; - protected final String TEXT_1 = " " + NL + "package "; - protected final String TEXT_2 = ";" + NL + "" + NL + "import org.eclipse.e4.core.di.annotations.Execute;"; - protected final String TEXT_3 = NL + "import org.eclipse.e4.core.di.annotations.CanExecute;"; - protected final String TEXT_4 = NL + NL + "public class "; - protected final String TEXT_5 = " {" + NL + "\t@Execute" + NL + "\tpublic void "; - protected final String TEXT_6 = "() {" + NL + "\t\t//TODO Your code goes here" + NL + "\t}" + NL + "\t"; - protected final String TEXT_7 = NL + "\t" + NL + "\t@CanExecute" + NL + "\tpublic boolean "; - protected final String TEXT_8 = "() {" + NL + "\t\t//TODO Your code goes here" + NL + "\t}" + NL + "\t"; - protected final String TEXT_9 = "\t" + NL + "}"; - - public String generate(Object argument) - { - final StringBuffer stringBuffer = new StringBuffer(); - HandlerClass domainClass = (HandlerClass)argument; - stringBuffer.append(TEXT_1); - stringBuffer.append( domainClass.getPackageFragment().getElementName() ); - stringBuffer.append(TEXT_2); - if( domainClass.isUseCanExecute() ) { - stringBuffer.append(TEXT_3); - } - stringBuffer.append(TEXT_4); - stringBuffer.append( domainClass.getName() ); - stringBuffer.append(TEXT_5); - stringBuffer.append( domainClass.getExecuteMethodName() ); - stringBuffer.append(TEXT_6); - if( domainClass.isUseCanExecute() ) { - stringBuffer.append(TEXT_7); - stringBuffer.append( domainClass.getCanExecuteMethodName() ); - stringBuffer.append(TEXT_8); - } - stringBuffer.append(TEXT_9); - return stringBuffer.toString(); - } -} diff --git a/bundles/org.eclipse.e4.tools/org/eclipse/e4/tools/internal/classes/templates/PartTemplate.java b/bundles/org.eclipse.e4.tools/org/eclipse/e4/tools/internal/classes/templates/PartTemplate.java deleted file mode 100644 index d10a2681..00000000 --- a/bundles/org.eclipse.e4.tools/org/eclipse/e4/tools/internal/classes/templates/PartTemplate.java +++ /dev/null @@ -1,89 +0,0 @@ -package org.eclipse.e4.tools.internal.classes.templates; - -import org.eclipse.e4.tools.internal.classes.NewPartClassWizard.PartClass; - -public class PartTemplate -{ - protected static String nl; - public static synchronized PartTemplate create(String lineSeparator) - { - nl = lineSeparator; - PartTemplate result = new PartTemplate(); - nl = null; - return result; - } - - public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; - protected final String TEXT_1 = " " + NL + "package "; - protected final String TEXT_2 = ";" + NL + "" + NL + "import javax.inject.Inject;"; - protected final String TEXT_3 = NL + "import javax.annotation.PostConstruct;"; - protected final String TEXT_4 = NL + "import javax.annotation.PreDestroy;"; - protected final String TEXT_5 = NL + "import org.eclipse.e4.ui.di.Focus;"; - protected final String TEXT_6 = NL + "import org.eclipse.e4.ui.di.Persist;"; - protected final String TEXT_7 = NL + NL + "public class "; - protected final String TEXT_8 = " {" + NL + "\t@Inject" + NL + "\tpublic "; - protected final String TEXT_9 = "() {" + NL + "\t\t//TODO Your code here" + NL + "\t}" + NL + "\t"; - protected final String TEXT_10 = NL + "\t@PostConstruct" + NL + "\tpublic void "; - protected final String TEXT_11 = "() {" + NL + "\t\t//TODO Your code here" + NL + "\t}" + NL + "\t"; - protected final String TEXT_12 = NL + "\t"; - protected final String TEXT_13 = NL + "\t@PreDestroy" + NL + "\tpublic void "; - protected final String TEXT_14 = "() {" + NL + "\t\t//TODO Your code here" + NL + "\t}" + NL + "\t"; - protected final String TEXT_15 = NL + "\t"; - protected final String TEXT_16 = NL + "\t@Focus" + NL + "\tpublic void "; - protected final String TEXT_17 = "() {" + NL + "\t\t//TODO Your code here" + NL + "\t}" + NL + "\t"; - protected final String TEXT_18 = NL + "\t"; - protected final String TEXT_19 = NL + "\t@Persist" + NL + "\tpublic void "; - protected final String TEXT_20 = "() {" + NL + "\t\t//TODO Your code here" + NL + "\t}" + NL + "\t"; - protected final String TEXT_21 = NL + "}"; - - public String generate(Object argument) - { - final StringBuffer stringBuffer = new StringBuffer(); - PartClass domainClass = (PartClass)argument; - stringBuffer.append(TEXT_1); - stringBuffer.append( domainClass.getPackageFragment().getElementName() ); - stringBuffer.append(TEXT_2); - if( domainClass.isUsePostConstruct() ) { - stringBuffer.append(TEXT_3); - } - if( domainClass.isUsePredestroy() ) { - stringBuffer.append(TEXT_4); - } - if( domainClass.isUseFocus() ) { - stringBuffer.append(TEXT_5); - } - if( domainClass.isUsePersist() ) { - stringBuffer.append(TEXT_6); - } - stringBuffer.append(TEXT_7); - stringBuffer.append( domainClass.getName() ); - stringBuffer.append(TEXT_8); - stringBuffer.append( domainClass.getName() ); - stringBuffer.append(TEXT_9); - if( domainClass.isUsePostConstruct() ) { - stringBuffer.append(TEXT_10); - stringBuffer.append( domainClass.getPostConstructMethodName() ); - stringBuffer.append(TEXT_11); - } - stringBuffer.append(TEXT_12); - if( domainClass.isUsePredestroy() ) { - stringBuffer.append(TEXT_13); - stringBuffer.append( domainClass.getPreDestroyMethodName() ); - stringBuffer.append(TEXT_14); - } - stringBuffer.append(TEXT_15); - if( domainClass.isUseFocus() ) { - stringBuffer.append(TEXT_16); - stringBuffer.append( domainClass.getFocusMethodName() ); - stringBuffer.append(TEXT_17); - } - stringBuffer.append(TEXT_18); - if( domainClass.isUsePersist() ) { - stringBuffer.append(TEXT_19); - stringBuffer.append( domainClass.getPersistMethodName() ); - stringBuffer.append(TEXT_20); - } - stringBuffer.append(TEXT_21); - return stringBuffer.toString(); - } -} diff --git a/bundles/org.eclipse.e4.tools/plugin.xml b/bundles/org.eclipse.e4.tools/plugin.xml deleted file mode 100644 index 9dc10a45..00000000 --- a/bundles/org.eclipse.e4.tools/plugin.xml +++ /dev/null @@ -1,92 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.4"?> -<plugin> - <extension - point="org.eclipse.ui.newWizards"> - <category - id="org.eclipse.e4.tools" - name="%category.name"> - </category> - <category - id="org.eclipse.e4.tools.classes" - name="%category.name.0" - parentCategory="org.eclipse.e4.tools"> - </category> - <category - id="org.eclipse.e4.tools.model" - name="%category.name.1" - parentCategory="org.eclipse.e4.tools"> - </category> - <wizard - category="org.eclipse.e4.tools" - class="org.eclipse.e4.internal.tools.wizards.project.E4NewProjectWizard" - icon="platform:/plugin/org.eclipse.pde.ui/icons/etool16/newpprj_wiz.gif" - id="org.eclipse.e4.tools.E4NewProjectWizard" - name="%wizard.name" - project="true"> - <description> - %wizard.name.description - </description> - </wizard> - <wizard - category="org.eclipse.e4.tools/org.eclipse.e4.tools.model" - class="org.eclipse.e4.internal.tools.wizards.model.NewApplicationModelWizard" - icon="icons/full/obj16/application_view_tile.png" - id="org.eclipse.e4.tools.newappmodel" - name="%wizard.name.0"> - <description> - %wizard.name.0.description - </description> - </wizard> - <wizard - category="org.eclipse.e4.tools/org.eclipse.e4.tools.model" - class="org.eclipse.e4.internal.tools.wizards.model.NewContributionModelWizard" - icon="icons/full/obj16/plugin.png" - id="org.eclipse.e4.tools.newmodelfragment" - name="%wizard.name.1"> - <description> - %wizard.name.1.description - </description> - </wizard> - <wizard - category="org.eclipse.e4.tools/org.eclipse.e4.tools.classes" - class="org.eclipse.e4.internal.tools.wizards.classes.NewHandlerClassWizard" - icon="icons/full/obj16/class_obj.gif" - id="org.eclipse.e4.tools.newhandler" - name="%wizard.name.2"> - <description> - %wizard.name.2.description - </description> - </wizard> - <wizard - category="org.eclipse.e4.tools/org.eclipse.e4.tools.classes" - class="org.eclipse.e4.internal.tools.wizards.classes.NewPartClassWizard" - icon="icons/full/obj16/Part.gif" - id="org.eclipse.e4.tools.newpart" - name="%wizard.name.3"> - <description> - %wizard.name.3.description - </description> - </wizard> - <wizard - category="org.eclipse.e4.tools/org.eclipse.e4.tools.classes" - class="org.eclipse.e4.internal.tools.wizards.classes.NewAddonClassWizard" - icon="icons/full/obj16/Addons.png" - id="org.eclipse.e4.tools.newaddon" - name="%wizard.name.4"> - <description> - %wizard.name.4.description - </description> - </wizard> - <wizard - category="org.eclipse.e4.tools/org.eclipse.e4.tools.classes" - class="org.eclipse.e4.internal.tools.wizards.classes.NewToolControlClassWizard" - icon="icons/full/obj16/ToolControl.gif" - id="org.eclipse.e4.tools.newtoolcontrol" - name="%wizard.name.5"> - <description> - %wizard.name.5.description - </description> - </wizard> - </extension> -</plugin> diff --git a/bundles/org.eclipse.e4.tools/pom.xml b/bundles/org.eclipse.e4.tools/pom.xml deleted file mode 100644 index 8d876aa1..00000000 --- a/bundles/org.eclipse.e4.tools/pom.xml +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.eclipse.e4.tools</groupId> - <artifactId>e4-tools-aggregator</artifactId> - <version>0.17.0-SNAPSHOT</version> - <relativePath>../../</relativePath> - </parent> - - <groupId>org.eclipse.e4</groupId> - <artifactId>org.eclipse.e4.tools</artifactId> - <version>0.12.0.qualifier</version> - <packaging>eclipse-plugin</packaging> - -</project> diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/Messages.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/Messages.java deleted file mode 100644 index 1c484b1b..00000000 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/Messages.java +++ /dev/null @@ -1,114 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011-2014 EclipseSource Muenchen GmbH and others. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Jonas - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.internal.tools; - -import org.eclipse.osgi.util.NLS; - -/** - * @author Jonas - * - */ -public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.e4.internal.tools.messages"; //$NON-NLS-1$ - public static String AbstractNewClassPage_Browse; - public static String AbstractNewClassPage_ChooseAPackage; - public static String AbstractNewClassPage_ChoosePackage; - public static String AbstractNewClassPage_ClassExists; - public static String AbstractNewClassPage_Name; - public static String AbstractNewClassPage_NameMustBeQualified; - public static String AbstractNewClassPage_NameNotEmpty; - public static String AbstractNewClassPage_NeedToSelectAPackage; - public static String AbstractNewClassPage_Package; - public static String AbstractNewClassPage_SourceFolder; - public static String AbstractNewClassPage_SourceFolderNotEmpty; - public static String AbstractNewClassWizard_NewClass; - public static String BaseApplicationModelWizard_AddExtractedNode; - public static String BaseApplicationModelWizard_Error; - public static String BaseApplicationModelWizard_FileExists; - public static String BaseApplicationModelWizard_TheFileAlreadyExists; - public static String NewAddonClassWizard_NewAddon; - public static String NewAddonClassWizard_NewAddonClass; - public static String NewApplicationModelWizard_IncludeDefaultAddons; - public static String NewApplicationWizardPage_AddLifecycleClass; - public static String NewApplicationWizardPage_AddOptionCleanPersistedState; - public static String NewApplicationWizardPage_ConfigureApplication; - public static String NewApplicationWizardPage_CreateSampleContent; - public static String NewApplicationWizardPage_CSSStyle; - public static String NewApplicationWizardPage_Dots; - public static String NewApplicationWizardPage_E4Lifecycle; - public static String NewApplicationWizardPage_Eclipse4Application; - public static String NewApplicationWizardPage_EnableDevelopmentMode; - public static String NewApplicationWizardPage_Height; - public static String NewApplicationWizardPage_InputValueEmpty; - public static String NewApplicationWizardPage_InputValueError; - public static String NewApplicationWizardPage_LifecycleClassName; - public static String NewApplicationWizardPage_Name; - public static String NewApplicationWizardPage_NewE4ApplicationWizardPage; - public static String NewApplicationWizardPage_OnlyNumericValues; - public static String NewApplicationWizardPage_PreferenceCustomization; - public static String NewApplicationWizardPage_Product; - public static String NewApplicationWizardPage_Properties; - public static String NewApplicationWizardPage_Property; - public static String NewApplicationWizardPage_Rectangle; - public static String NewApplicationWizardPage_SetRectangle; - public static String NewApplicationWizardPage_TemplateOption; - public static String NewApplicationWizardPage_ValueShouldNotBeEmpty; - public static String NewApplicationWizardPage_Width; - public static String NewApplicationWizardPage_X; - public static String NewApplicationWizardPage_Y; - public static String NewDynamicMenuContributionClassWizard_AboutToShowMethod; - public static String NewDynamicMenuContributionClassWizard_CreateNewContribution; - public static String NewDynamicMenuContributionClassWizard_NewDynamicContribution; - public static String NewHandlerClassWizard_CanExecuteMethod; - public static String NewHandlerClassWizard_CreateNewHandler; - public static String NewHandlerClassWizard_ExecuteMethod; - public static String NewHandlerClassWizard_NewHandler; - public static String NewModelFilePage_Browse; - public static String NewModelFilePage_Container; - public static String NewModelFilePage_FileContainerMustBeSpecified; - public static String NewModelFilePage_FileContainerMustExists; - public static String NewModelFilePage_FileExtensionMustBeE4XMI; - public static String NewModelFilePage_FileName; - public static String NewModelFilePage_FileNameMustBeSpecified; - public static String NewModelFilePage_FileNameMustBeValid; - public static String NewModelFilePage_NewApplicationModel; - public static String NewModelFilePage_ProjectMustBeWritable; - public static String NewModelFilePage_SelectTheNewContainer; - public static String NewModelFilePage_TheWizardCreates; - public static String NewPartClassWizard_CreateNewPart; - public static String NewPartClassWizard_FocusMethod; - public static String NewPartClassWizard_NewPart; - public static String NewPartClassWizard_PersistMethod; - public static String NewPartClassWizard_PostConstructMethod; - public static String NewPartClassWizard_PredestroyMethod; - public static String NewToolControlClassWizard_CreateDefaultConstructor; - public static String NewToolControlClassWizard_CreateGUIMethod; - public static String NewToolControlClassWizard_CreateNewToolControl; - public static String NewToolControlClassWizard_NewToolControl; - public static String E4NewProjectWizard_About; - public static String E4NewProjectWizard_File; - public static String E4NewProjectWizard_Help; - public static String E4NewProjectWizard_InDialogs; - public static String E4NewProjectWizard_InDialogsAndWindows; - public static String E4NewProjectWizard_InWindows; - public static String E4NewProjectWizard_Open; - public static String E4NewProjectWizard_Quit; - public static String E4NewProjectWizard_SamplePart; - public static String E4NewProjectWizard_Save; - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - private Messages() { - } -} diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/ToolsPlugin.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/ToolsPlugin.java deleted file mode 100644 index 4d408c26..00000000 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/ToolsPlugin.java +++ /dev/null @@ -1,123 +0,0 @@ -package org.eclipse.e4.internal.tools; - -import java.net.URL; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -public class ToolsPlugin extends AbstractUIPlugin { - // The plug-in ID - public static final String PLUGIN_ID = "org.eclipse.e4.tools"; //$NON-NLS-1$ - - private static ToolsPlugin plugin; - - private ResourceLocator resourceLocator; - - /* - * (non-Javadoc) - * @see - * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext - * ) - */ - @Override - public void start(BundleContext context) throws Exception { - super.start(context); - plugin = this; - } - - /* - * (non-Javadoc) - * @see - * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext - * ) - */ - @Override - public void stop(BundleContext context) throws Exception { - plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static ToolsPlugin getDefault() { - return plugin; - } - - public ResourceLocator getResourceLocator() { - if (resourceLocator == null) { - resourceLocator = new ResourceLocator() { - - @Override - public String getString(String key, Object[] substitutions, - boolean translate) { - return null; - } - - @Override - public String getString(String key, Object[] substitutions) { - return null; - } - - @Override - public String getString(String key, boolean translate) { - return null; - } - - @Override - public String getString(String key) { - return null; - } - - @Override - public Object getImage(String key) { - return null; - } - - @Override - public URL getBaseURL() { - return null; - } - }; - } - return resourceLocator; - } - - public static void log(IStatus status, int nesting, boolean appendLogger) { - getDefault().getLog().log(status); - } - - /** - * Log Throwable Error - */ - public static void logError(Throwable t) { - logError(t, 0, true); - } - - public static void logError(Throwable t, boolean appendLogger) { - logError(t, 0, appendLogger); - } - - public static void logError(Throwable t, int nesting) { - logError(t, nesting, true); - } - - public static void logError(Throwable t, int nesting, boolean appendLogger) { - log(newStatus(IStatus.ERROR, t.getMessage(), t), nesting, appendLogger); - } - - /** - * Create an IStatus - * - * @return a new IStatus - */ - public static IStatus newStatus(int severity, String message, - Throwable exception) { - return new Status(severity, PLUGIN_ID, 0, message, exception); - } -} diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/messages.properties b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/messages.properties deleted file mode 100644 index 8a4f5dda..00000000 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/messages.properties +++ /dev/null @@ -1,85 +0,0 @@ -AbstractNewClassPage_Browse=Browse ... -AbstractNewClassPage_ChooseAPackage=Choose a Package -AbstractNewClassPage_ChoosePackage=Choose Package -AbstractNewClassPage_ClassExists=Java Class already exists -AbstractNewClassPage_Name=Name -AbstractNewClassPage_NameMustBeQualified=Name must not be qualified or contain spaces -AbstractNewClassPage_NameNotEmpty=Name must not be empty -AbstractNewClassPage_NeedToSelectAPackage=You need to select a package -AbstractNewClassPage_Package=Package -AbstractNewClassPage_SourceFolder=Source folder -AbstractNewClassPage_SourceFolderNotEmpty=Source folder must not be empty -AbstractNewClassWizard_NewClass=New contribution class -BaseApplicationModelWizard_AddExtractedNode=Would you like to add the extracted node to this file? -BaseApplicationModelWizard_Error=Error -BaseApplicationModelWizard_FileExists=File exists -BaseApplicationModelWizard_TheFileAlreadyExists=The file already exists. -E4NewProjectWizard_About=About -E4NewProjectWizard_File=File -E4NewProjectWizard_Help=Help -E4NewProjectWizard_InDialogs=In Dialogs -E4NewProjectWizard_InDialogsAndWindows=In Dialog and Windows -E4NewProjectWizard_InWindows=In Windows -E4NewProjectWizard_Open=Open -E4NewProjectWizard_Quit=Quit -E4NewProjectWizard_SamplePart=Sample Part -E4NewProjectWizard_Save=Save -NewAddonClassWizard_NewAddon=New Addon -NewAddonClassWizard_NewAddonClass=Create a new addon class -NewApplicationModelWizard_IncludeDefaultAddons=Include default addons -NewApplicationWizardPage_AddLifecycleClass=Add a lifecycle class -NewApplicationWizardPage_AddOptionCleanPersistedState=Add option -clearPersistedState to the Product's Program Arguments -NewApplicationWizardPage_ConfigureApplication=Configure application with special values. -NewApplicationWizardPage_CreateSampleContent=Create sample content (parts, menu etc.) -NewApplicationWizardPage_CSSStyle=CSS Style: -NewApplicationWizardPage_Dots=... -NewApplicationWizardPage_E4Lifecycle=E4LifeCycle -NewApplicationWizardPage_Eclipse4Application=Eclipse 4 Application -NewApplicationWizardPage_EnableDevelopmentMode=Enable development mode for application model -NewApplicationWizardPage_Height=Height: -NewApplicationWizardPage_InputValueEmpty=Input value empty -NewApplicationWizardPage_InputValueError=Input value error -NewApplicationWizardPage_LifecycleClassName=LifeCycle class name: -NewApplicationWizardPage_Name=Name:* -NewApplicationWizardPage_NewE4ApplicationWizardPage=New Eclipse 4 Application Wizard Page -NewApplicationWizardPage_OnlyNumericValues=Only numeric is allowed\! -NewApplicationWizardPage_PreferenceCustomization=Preference Customization: -NewApplicationWizardPage_Product=Product -NewApplicationWizardPage_Properties=Properties -NewApplicationWizardPage_Property=Property " -NewApplicationWizardPage_Rectangle=Rect -NewApplicationWizardPage_SetRectangle=Set Rect -NewApplicationWizardPage_TemplateOption=Template option -NewApplicationWizardPage_ValueShouldNotBeEmpty=Value shoud not be empty\! -NewApplicationWizardPage_Width=Width: -NewApplicationWizardPage_X=X: -NewApplicationWizardPage_Y=Y: -NewDynamicMenuContributionClassWizard_AboutToShowMethod=AboutToShow Method -NewDynamicMenuContributionClassWizard_CreateNewContribution=Create a new dynamic menu contribution class -NewDynamicMenuContributionClassWizard_NewDynamicContribution=New Dynamic Menu Contribution -NewHandlerClassWizard_CanExecuteMethod=Can-Execute Method -NewHandlerClassWizard_CreateNewHandler=Create a new handler class -NewHandlerClassWizard_ExecuteMethod=Execute Method -NewHandlerClassWizard_NewHandler=New Handler -NewModelFilePage_Browse=Browse... -NewModelFilePage_Container=&Container: -NewModelFilePage_FileContainerMustBeSpecified=File container must be specified -NewModelFilePage_FileContainerMustExists=File container must exist -NewModelFilePage_FileExtensionMustBeE4XMI=File extension must be "e4xmi" -NewModelFilePage_FileName=&File name: -NewModelFilePage_FileNameMustBeSpecified=File name must be specified -NewModelFilePage_FileNameMustBeValid=File name must be valid -NewModelFilePage_NewApplicationModel=New application model -NewModelFilePage_ProjectMustBeWritable=Project must be writable -NewModelFilePage_SelectTheNewContainer=Select new file container -NewModelFilePage_TheWizardCreates=This wizard creates a new Eclipse 4 application model -NewPartClassWizard_CreateNewPart=Create a new part class -NewPartClassWizard_FocusMethod=Focus Method -NewPartClassWizard_NewPart=New Part -NewPartClassWizard_PersistMethod=Persist Method -NewPartClassWizard_PostConstructMethod=PostContruct Method -NewPartClassWizard_PredestroyMethod=Predestroy Method -NewToolControlClassWizard_CreateDefaultConstructor=Create Default Constructor -NewToolControlClassWizard_CreateGUIMethod=Create GUI Method -NewToolControlClassWizard_CreateNewToolControl=Create a new tool control class -NewToolControlClassWizard_NewToolControl=New Tool Control diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassPage.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassPage.java deleted file mode 100644 index 9b8b43f3..00000000 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassPage.java +++ /dev/null @@ -1,513 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Sopot Cela <sopotcela@gmail.com> - ******************************************************************************/ -package org.eclipse.e4.internal.tools.wizards.classes; - -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; - -import org.eclipse.core.databinding.Binding; -import org.eclipse.core.databinding.DataBindingContext; -import org.eclipse.core.databinding.UpdateValueStrategy; -import org.eclipse.core.databinding.beans.BeanProperties; -import org.eclipse.core.databinding.conversion.Converter; -import org.eclipse.core.databinding.validation.IValidator; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.e4.internal.tools.Messages; -import org.eclipse.e4.internal.tools.ToolsPlugin; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.IJavaModel; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jdt.core.JavaConventions; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.internal.ui.JavaPlugin; -import org.eclipse.jdt.internal.ui.wizards.NewWizardMessages; -import org.eclipse.jdt.internal.ui.wizards.TypedElementSelectionValidator; -import org.eclipse.jdt.internal.ui.wizards.TypedViewerFilter; -import org.eclipse.jdt.ui.JavaElementComparator; -import org.eclipse.jdt.ui.JavaElementLabelProvider; -import org.eclipse.jdt.ui.StandardJavaElementContentProvider; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.databinding.wizard.WizardPageSupport; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerFilter; -import org.eclipse.jface.window.Window; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.dialogs.ElementListSelectionDialog; -import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; - -@SuppressWarnings("restriction") -public abstract class AbstractNewClassPage extends WizardPage { - private static final String BUNDLECLASS = "bundleclass://"; //$NON-NLS-1$ - private static final String FRAGMENT_ROOT = "fragmentRoot"; //$NON-NLS-1$ - public static final String PACKAGE_FRAGMENT = "packageFragment"; //$NON-NLS-1$ - public static final String PROPERTY_NAME = "name"; //$NON-NLS-1$ - - public static class JavaClass { - - protected PropertyChangeSupport support = new PropertyChangeSupport(this); - - private IPackageFragmentRoot fragmentRoot; - private IPackageFragment packageFragment; - private String name; - - public JavaClass(IPackageFragmentRoot fragmentRoot) { - this.fragmentRoot = fragmentRoot; - } - - public IPackageFragmentRoot getFragmentRoot() { - return fragmentRoot; - } - - public void setFragmentRoot(IPackageFragmentRoot fragmentRoot) { - support.firePropertyChange(FRAGMENT_ROOT, this.fragmentRoot, this.fragmentRoot = fragmentRoot); - } - - public IPackageFragment getPackageFragment() { - return packageFragment; - } - - public void setPackageFragment(IPackageFragment packageFragment) { - support.firePropertyChange(PACKAGE_FRAGMENT, this.packageFragment, this.packageFragment = packageFragment); - } - - public String getName() { - return name; - } - - public void setName(String name) { - support.firePropertyChange(PROPERTY_NAME, this.name, this.name = name); - } - - public void addPropertyChangeListener(PropertyChangeListener listener) { - support.addPropertyChangeListener(listener); - } - - public void removePropertyChangeListener(PropertyChangeListener listener) { - support.removePropertyChangeListener(listener); - } - - public static boolean exists(IPackageFragmentRoot pFragmentRoot, IPackageFragment pPackageFragment, String pName) { - - if (pFragmentRoot == null) { - return false; - } - - final String cuName = pName + ".java"; //$NON-NLS-1$ - IFile file; - - if (pPackageFragment != null) { - final ICompilationUnit unit = pPackageFragment.getCompilationUnit(cuName); - final IResource resource = unit.getResource(); - file = (IFile) resource; - } else { - final IFolder p = (IFolder) pFragmentRoot.getResource(); - file = p.getFile(cuName); - } - return file.exists(); - } - } - - private JavaClass clazz; - private IPackageFragmentRoot froot; - private final IWorkspaceRoot fWorkspaceRoot; - private String initialString; - - protected AbstractNewClassPage(String pageName, String title, String description, IPackageFragmentRoot froot, - IWorkspaceRoot fWorkspaceRoot) { - super(pageName); - this.froot = froot; - this.fWorkspaceRoot = fWorkspaceRoot; - - setTitle(title); - setDescription(description); - } - - protected AbstractNewClassPage(String pageName, String title, String description, IPackageFragmentRoot froot, - IWorkspaceRoot fWorkspaceRoot, String initialString) { - this(pageName, title, description, froot, fWorkspaceRoot); - this.initialString = initialString; - } - - @Override - public void createControl(Composite parent) { - final Image img = new Image(parent.getDisplay(), getClass().getClassLoader().getResourceAsStream( - "/icons/full/wizban/newclass_wiz.png")); //$NON-NLS-1$ - setImageDescriptor(ImageDescriptor.createFromImage(img)); - - parent.addDisposeListener(new DisposeListener() { - - @Override - public void widgetDisposed(DisposeEvent e) { - img.dispose(); - setImageDescriptor(null); - } - }); - - parent = new Composite(parent, SWT.NULL); - parent.setLayoutData(new GridData(GridData.FILL_BOTH)); - parent.setLayout(new GridLayout(3, false)); - - clazz = createInstance(); - if (froot != null && initialString != null) { - clazz.setPackageFragment(froot.getPackageFragment(parseInitialStringForPackage(initialString) == null ? "" //$NON-NLS-1$ - : parseInitialStringForPackage(initialString))); - clazz.setName(parseInitialStringForClassName(initialString)); - } - final DataBindingContext dbc = new DataBindingContext(); - WizardPageSupport.create(this, dbc); - - { - final Label l = new Label(parent, SWT.NONE); - l.setText(Messages.AbstractNewClassPage_SourceFolder); - - final Text t = new Text(parent, SWT.BORDER); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - t.setEditable(false); - - final Binding bd = dbc.bindValue( - WidgetProperties.text().observe(t), - BeanProperties.value(FRAGMENT_ROOT).observe(clazz), - new UpdateValueStrategy().setBeforeSetValidator(new PFRootValidator()), - new UpdateValueStrategy().setConverter(new PackageFragmentRootToStringConverter()) - ); - - final Button b = new Button(parent, SWT.PUSH); - b.setText(Messages.AbstractNewClassPage_Browse); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - final IPackageFragmentRoot root = choosePackageRoot(); - if (root != null) { - froot = root; - clazz.setFragmentRoot(root); - } - bd.updateModelToTarget(); - } - }); - } - - { - final Label l = new Label(parent, SWT.NONE); - l.setText(Messages.AbstractNewClassPage_Package); - final Text t = new Text(parent, SWT.BORDER); - t.setEditable(true); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - final Binding bd = dbc.bindValue( - WidgetProperties.text(SWT.Modify).observe(t), - BeanProperties.value(PACKAGE_FRAGMENT).observe(clazz), - new UpdateValueStrategy().setConverter(new StringToPackageFragmentConverter(clazz)), - new UpdateValueStrategy().setConverter(new PackageFragmentToStringConverter()) - ); - - final Button b = new Button(parent, SWT.PUSH); - b.setText(Messages.AbstractNewClassPage_Browse); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - final IPackageFragment fragment = choosePackage(); - if (fragment != null) { - clazz.setPackageFragment(fragment); - } - bd.updateModelToTarget(); // TODO Find out why this is needed - } - }); - } - - { - final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - final Label l = new Label(parent, SWT.NONE); - l.setText(Messages.AbstractNewClassPage_Name); - - final Text t = new Text(parent, SWT.BORDER); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - dbc.bindValue(textProp.observe(t), BeanProperties.value(PROPERTY_NAME, String.class).observe(clazz), - new UpdateValueStrategy().setBeforeSetValidator(new ClassnameValidator(clazz)), null); - - new Label(parent, SWT.NONE); - } - - { - final Label l = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL); - l.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false, 3, 1)); - } - - createFields(parent, dbc); - setControl(parent); - } - - private String parseInitialStringForPackage(String initialString2) { - if (initialString2 == null) { - return null; - } - final int ioBC = initialString2.indexOf(BUNDLECLASS); - final int iSecondSlash = initialString2.lastIndexOf('/'); - if ( - - initialString2.length() == 0 || // empty - ioBC == -1 || // no bundle class - iSecondSlash == -1 || // no package &| class name - initialString2.indexOf('.') == -1// no package - ) { - return null; - } - - final int lastDot = initialString2.lastIndexOf('.'); - final String packageString = initialString2.substring(iSecondSlash + 1, lastDot); - return packageString; - } - - private String parseInitialStringForClassName(String initialString) { - if (initialString == null) { - return null; - } - final int ioBC = initialString.indexOf(BUNDLECLASS); - final int iSecondSlash = initialString.lastIndexOf('/'); - if ( - - initialString.length() == 0 || // empty - ioBC == -1 || // no bundle class - iSecondSlash == -1 || // no package &| class name - initialString.indexOf('.') == -1// no package - ) { - return null; - } - final int lastDot = initialString.lastIndexOf('.'); - if (lastDot != -1) { - return initialString.substring(lastDot + 1); - } - return null; - } - - private IPackageFragmentRoot choosePackageRoot() { - final IJavaElement initElement = clazz.getFragmentRoot(); - Class<?>[] acceptedClasses = new Class[] { IPackageFragmentRoot.class, IJavaProject.class }; - final TypedElementSelectionValidator validator = new TypedElementSelectionValidator(acceptedClasses, false) { - @Override - public boolean isSelectedValid(Object element) { - try { - if (element instanceof IJavaProject) { - final IJavaProject jproject = (IJavaProject) element; - final IPath path = jproject.getProject().getFullPath(); - return jproject.findPackageFragmentRoot(path) != null; - } else if (element instanceof IPackageFragmentRoot) { - return ((IPackageFragmentRoot) element).getKind() == IPackageFragmentRoot.K_SOURCE; - } - return true; - } catch (final JavaModelException e) { - JavaPlugin.log(e.getStatus()); // just log, no UI in validation - } - return false; - } - }; - - acceptedClasses = new Class[] { IJavaModel.class, IPackageFragmentRoot.class, IJavaProject.class }; - final ViewerFilter filter = new TypedViewerFilter(acceptedClasses) { - @Override - public boolean select(Viewer viewer, Object parent, Object element) { - if (element instanceof IPackageFragmentRoot) { - try { - return ((IPackageFragmentRoot) element).getKind() == IPackageFragmentRoot.K_SOURCE; - } catch (final JavaModelException e) { - JavaPlugin.log(e.getStatus()); // just log, no UI in validation - return false; - } - } - return super.select(viewer, parent, element); - } - }; - - final StandardJavaElementContentProvider provider = new StandardJavaElementContentProvider(); - final ILabelProvider labelProvider = new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT); - final ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), labelProvider, provider); - dialog.setValidator(validator); - dialog.setComparator(new JavaElementComparator()); - dialog.setTitle(NewWizardMessages.NewContainerWizardPage_ChooseSourceContainerDialog_title); - dialog.setMessage(NewWizardMessages.NewContainerWizardPage_ChooseSourceContainerDialog_description); - dialog.addFilter(filter); - dialog.setInput(JavaCore.create(fWorkspaceRoot)); - dialog.setInitialSelection(initElement); - dialog.setHelpAvailable(false); - - if (dialog.open() == Window.OK) { - final Object element = dialog.getFirstResult(); - if (element instanceof IJavaProject) { - final IJavaProject jproject = (IJavaProject) element; - return jproject.getPackageFragmentRoot(jproject.getProject()); - } else if (element instanceof IPackageFragmentRoot) { - return (IPackageFragmentRoot) element; - } - return null; - } - return null; - } - - private IPackageFragment choosePackage() { - IJavaElement[] packages = null; - try { - if (froot != null && froot.exists()) { - packages = froot.getChildren(); - } - } catch (final JavaModelException e) { - e.printStackTrace(); - } - if (packages == null) { - packages = new IJavaElement[0]; - } - - final ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), - new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT)); - dialog.setIgnoreCase(false); - dialog.setTitle(Messages.AbstractNewClassPage_ChoosePackage); - dialog.setMessage(Messages.AbstractNewClassPage_ChooseAPackage); - dialog.setEmptyListMessage(Messages.AbstractNewClassPage_NeedToSelectAPackage); - dialog.setElements(packages); - dialog.setHelpAvailable(false); - final IPackageFragment pack = clazz.getPackageFragment(); - if (pack != null) { - dialog.setInitialSelections(new Object[] { pack }); - } - - if (dialog.open() == Window.OK) { - return (IPackageFragment) dialog.getFirstResult(); - } - return null; - } - - protected abstract void createFields(Composite parent, DataBindingContext dbc); - - protected abstract JavaClass createInstance(); - - public JavaClass getClazz() { - return clazz; - } - - static class ClassnameValidator implements IValidator { - - private final JavaClass clazz; - - public ClassnameValidator(JavaClass clazz) { - this.clazz = clazz; - } - - @Override - public IStatus validate(Object value) { - final String name = value.toString(); - if (name.length() == 0) { - return new Status(IStatus.ERROR, ToolsPlugin.PLUGIN_ID, Messages.AbstractNewClassPage_NameNotEmpty); - } - if (name.indexOf('.') != -1 || name.trim().indexOf(' ') != -1) { - return new Status(IStatus.ERROR, ToolsPlugin.PLUGIN_ID, - Messages.AbstractNewClassPage_NameMustBeQualified); - } - if (JavaClass.exists(clazz.getFragmentRoot(), clazz.getPackageFragment(), name)) { - return new Status(IStatus.ERROR, ToolsPlugin.PLUGIN_ID, Messages.AbstractNewClassPage_ClassExists); - } - - return JavaConventions.validateJavaTypeName(name, JavaCore.VERSION_1_3, JavaCore.VERSION_1_3); - } - } - - static class PFRootValidator implements IValidator { - - @Override - public IStatus validate(Object value) { - final String name = value.toString(); - if (name.length() == 0) { - return new Status(IStatus.ERROR, ToolsPlugin.PLUGIN_ID, - Messages.AbstractNewClassPage_SourceFolderNotEmpty); - } - - return new Status(IStatus.OK, ToolsPlugin.PLUGIN_ID, ""); //$NON-NLS-1$ - } - } - - static class PackageFragmentRootToStringConverter extends Converter { - - public PackageFragmentRootToStringConverter() { - super(IPackageFragmentRoot.class, String.class); - } - - @Override - public Object convert(Object fromObject) { - final IPackageFragmentRoot f = (IPackageFragmentRoot) fromObject; - if (f == null) { - return ""; //$NON-NLS-1$ - } - return f.getPath().makeRelative().toString(); - } - } - - static class PackageFragmentToStringConverter extends Converter { - - public PackageFragmentToStringConverter() { - super(IPackageFragment.class, String.class); - } - - @Override - public Object convert(Object fromObject) { - if (fromObject == null) { - return ""; //$NON-NLS-1$ - } - final IPackageFragment f = (IPackageFragment) fromObject; - return f.getElementName(); - } - } - - static class StringToPackageFragmentConverter extends Converter { - - private final JavaClass clazz; - - public StringToPackageFragmentConverter(JavaClass clazz) { - super(String.class, IPackageFragment.class); - this.clazz = clazz; - } - - @Override - public Object convert(Object fromObject) { - if (clazz.getFragmentRoot() == null) { - return null; - } - if (fromObject == null) { - return clazz.getFragmentRoot().getPackageFragment(""); //$NON-NLS-1$ - } - - return clazz.getFragmentRoot().getPackageFragment((String) fromObject); - - } - } -} diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassWizard.java deleted file mode 100644 index f38d1a13..00000000 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/AbstractNewClassWizard.java +++ /dev/null @@ -1,249 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Sopot Cela <sopotcela@gmail.com> - ******************************************************************************/ -package org.eclipse.e4.internal.tools.wizards.classes; - -import java.io.ByteArrayInputStream; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.e4.internal.tools.Messages; -import org.eclipse.e4.internal.tools.wizards.classes.AbstractNewClassPage.JavaClass; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.pde.core.project.IBundleProjectDescription; -import org.eclipse.pde.core.project.IBundleProjectService; -import org.eclipse.pde.core.project.IRequiredBundleDescription; -import org.eclipse.ui.INewWizard; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.ide.IDE; -import org.osgi.framework.BundleContext; -import org.osgi.framework.FrameworkUtil; -import org.osgi.framework.ServiceReference; - -public abstract class AbstractNewClassWizard extends Wizard implements INewWizard { - private static final String JAVA = ".java"; //$NON-NLS-1$ - protected IPackageFragmentRoot root; - protected IFile file; - - public AbstractNewClassWizard() { - setWindowTitle(Messages.AbstractNewClassWizard_NewClass); - } - - @Override - public void init(IWorkbench workbench, IStructuredSelection selection) { - root = getFragmentRoot(getInitialJavaElement(selection)); - } - - protected IJavaElement getInitialJavaElement(IStructuredSelection selection) { - IJavaElement jelem = null; - if (selection != null && !selection.isEmpty()) { - final Object selectedElement = selection.getFirstElement(); - if (selectedElement instanceof IAdaptable) { - final IAdaptable adaptable = (IAdaptable) selectedElement; - - jelem = (IJavaElement) adaptable.getAdapter(IJavaElement.class); - if (jelem == null || !jelem.exists()) { - jelem = null; - IResource resource = (IResource) adaptable - .getAdapter(IResource.class); - if (resource != null - && resource.getType() != IResource.ROOT) { - while (jelem == null - && resource.getType() != IResource.PROJECT) { - resource = resource.getParent(); - jelem = (IJavaElement) resource - .getAdapter(IJavaElement.class); - } - if (jelem == null) { - jelem = JavaCore.create(resource); // java project - } - } - } - } - } - - return jelem; - } - - protected IPackageFragmentRoot getFragmentRoot(IJavaElement elem) { - IPackageFragmentRoot initRoot = null; - if (elem != null) { - initRoot = (IPackageFragmentRoot) elem - .getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT); - try { - if (initRoot == null - || initRoot.getKind() != IPackageFragmentRoot.K_SOURCE) { - final IJavaProject jproject = elem.getJavaProject(); - if (jproject != null) { - initRoot = null; - if (jproject.exists()) { - final IPackageFragmentRoot[] roots = jproject - .getPackageFragmentRoots(); - for (int i = 0; i < roots.length; i++) { - if (roots[i].getKind() == IPackageFragmentRoot.K_SOURCE) { - initRoot = roots[i]; - break; - } - } - } - if (initRoot == null) { - initRoot = jproject.getPackageFragmentRoot(jproject - .getResource()); - } - } - } - } catch (final JavaModelException e) { - // TODO - e.printStackTrace(); - } - } - return initRoot; - } - - protected abstract String getContent(); - - public JavaClass getDomainClass() { - return ((AbstractNewClassPage) getPages()[0]).getClazz(); - } - - protected void checkRequiredBundles() { - final IProject project = getDomainClass().getFragmentRoot().getJavaProject().getProject(); - final BundleContext context = FrameworkUtil.getBundle(NewAddonClassWizard.class).getBundleContext(); - final ServiceReference<IBundleProjectService> ref = context.getServiceReference(IBundleProjectService.class); - final IBundleProjectService service = context.getService(ref); - try { - final IBundleProjectDescription description = service.getDescription(project); - final Set<String> requiredBundles = getRequiredBundles(); - final IRequiredBundleDescription[] arTmp = description.getRequiredBundles(); - final List<IRequiredBundleDescription> descs = new ArrayList<IRequiredBundleDescription>(); - if (arTmp != null) { - descs.addAll(Arrays.asList(arTmp)); - } - for (final IRequiredBundleDescription bd : descs) { - requiredBundles.remove(bd.getName()); - } - - if (requiredBundles.size() > 0) { - for (final String b : requiredBundles) { - descs.add(service.newRequiredBundle(b, null, false, false)); - } - description.setRequiredBundles(descs.toArray(new IRequiredBundleDescription[0])); - description.apply(new NullProgressMonitor()); - } - } catch (final CoreException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - protected Set<String> getRequiredBundles() { - final Set<String> rv = new HashSet<String>(); - rv.add("javax.inject"); //$NON-NLS-1$ - return rv; - } - - @Override - public boolean performFinish() { - final JavaClass clazz = getDomainClass(); - final String content = getContent(); - - if (clazz.getFragmentRoot() == null) { - return false; - } - - checkRequiredBundles(); - - IPackageFragment fragment = clazz.getPackageFragment(); - boolean exists = false; - if (fragment != null) { - IJavaElement[] children; - try { - children = clazz.getFragmentRoot().getChildren(); - - for (final IJavaElement iJavaElement : children) { - final IPackageFragment pf = (IPackageFragment) iJavaElement; - if (pf.getElementName().equals(fragment.getElementName())) { - exists = true; - break; - } - } - - if (!exists) { - fragment = clazz.getFragmentRoot().createPackageFragment(fragment.getElementName(), true, null); - } - } catch (final JavaModelException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - final String cuName = clazz.getName() + JAVA; - final ICompilationUnit unit = fragment.getCompilationUnit(cuName); - final IResource resource = unit.getResource(); - file = (IFile) resource; - try { - if (!file.exists()) { - file.create(new ByteArrayInputStream(content.getBytes()), - true, null); - } else { - file.setContents(new ByteArrayInputStream(content.getBytes()), - IResource.FORCE | IResource.KEEP_HISTORY, null); - } - IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), file); - // unit.open(null); - } catch (final CoreException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } else { - final String cuName = clazz.getName() + JAVA; - final IFolder p = (IFolder) clazz.getFragmentRoot().getResource(); - file = p.getFile(cuName); - try { - if (!file.exists()) { - file.create(new ByteArrayInputStream(content.getBytes()), - true, null); - } else { - file.setContents(new ByteArrayInputStream(content.getBytes()), - IResource.FORCE | IResource.KEEP_HISTORY, null); - } - IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), file); - } catch (final CoreException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - return true; - - } - - public IFile getFile() { - return file; - } -} diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewAddonClassWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewAddonClassWizard.java deleted file mode 100644 index 3c333bd7..00000000 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewAddonClassWizard.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Sopot Cela <sopotcela@gmail.com> - ******************************************************************************/ -package org.eclipse.e4.internal.tools.wizards.classes; - -import java.util.Set; - -import org.eclipse.core.databinding.DataBindingContext; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.e4.internal.tools.Messages; -import org.eclipse.e4.internal.tools.wizards.classes.templates.AddonTemplate; -import org.eclipse.swt.widgets.Composite; - -public class NewAddonClassWizard extends AbstractNewClassWizard { - private String initialString; - - public NewAddonClassWizard(String contributionURI) { - initialString = contributionURI; - } - - public NewAddonClassWizard() { - // Intentially left empty - } - - @Override - public void addPages() { - addPage(new AbstractNewClassPage("Classinformation", //$NON-NLS-1$ - Messages.NewAddonClassWizard_NewAddon, - Messages.NewAddonClassWizard_NewAddonClass, root, ResourcesPlugin.getWorkspace().getRoot(), initialString) { - - @Override - protected void createFields(Composite parent, - DataBindingContext dbc) { - } - - @Override - protected JavaClass createInstance() { - return new JavaClass(root); - } - - }); - } - - @Override - protected String getContent() { - final AddonTemplate template = new AddonTemplate(); - return template.generate(getDomainClass()); - } - - @Override - protected Set<String> getRequiredBundles() { - final Set<String> rv = super.getRequiredBundles(); - rv.add("javax.annotation"); //$NON-NLS-1$ - rv.add("org.eclipse.e4.core.services"); //$NON-NLS-1$ - return rv; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewDynamicMenuContributionClassWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewDynamicMenuContributionClassWizard.java deleted file mode 100644 index 5e0fa426..00000000 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewDynamicMenuContributionClassWizard.java +++ /dev/null @@ -1,151 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 MEDEVIT, FHV and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Marco Descher <marco@descher.at> - initial API and implementation - *******************************************************************************/ -package org.eclipse.e4.internal.tools.wizards.classes; - -import java.util.Set; - -import org.eclipse.core.databinding.DataBindingContext; -import org.eclipse.core.databinding.beans.BeanProperties; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.e4.internal.tools.Messages; -import org.eclipse.e4.internal.tools.wizards.classes.AbstractNewClassPage.JavaClass; -import org.eclipse.e4.internal.tools.wizards.classes.templates.DynamicMenuContributionTemplate; -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class NewDynamicMenuContributionClassWizard extends -AbstractNewClassWizard { - - private static final String ABOUT_TO_SHOW_METHOD_NAME = "aboutToShowMethodName"; //$NON-NLS-1$ - private static final String ABOUT_TO_HIDE_METHOD_NAME = "aboutToHideMethodName"; //$NON-NLS-1$ - private static final String USE_ABOUT_TO_HIDE = "useAboutToHide"; //$NON-NLS-1$ - private final String initialString; - - public NewDynamicMenuContributionClassWizard(String contributionURI) { - initialString = contributionURI; - } - - @Override - protected String getContent() { - final DynamicMenuContributionTemplate template = new DynamicMenuContributionTemplate(); - return template.generate(getDomainClass()); - } - - @Override - public void addPages() { - addPage(new AbstractNewClassPage("Classinformation", //$NON-NLS-1$ - Messages.NewDynamicMenuContributionClassWizard_NewDynamicContribution, - Messages.NewDynamicMenuContributionClassWizard_CreateNewContribution, root, ResourcesPlugin.getWorkspace().getRoot(), - initialString) { - - @Override - protected JavaClass createInstance() { - return new DynamicMenuContributionClass(root); - } - - @Override - protected void createFields(Composite parent, DataBindingContext dbc) { - final IWidgetValueProperty textProp = WidgetProperties - .text(SWT.Modify); - - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.NewDynamicMenuContributionClassWizard_AboutToShowMethod); - - final Text t = new Text(parent, SWT.BORDER); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - dbc.bindValue( - textProp.observe(t), - BeanProperties.value(ABOUT_TO_SHOW_METHOD_NAME).observe( - getClazz())); - - l = new Label(parent, SWT.NONE); - } - - { - final Label l = new Label(parent, SWT.NONE); - l.setText(Messages.NewDynamicMenuContributionClassWizard_AboutToShowMethod); - - final Text t = new Text(parent, SWT.BORDER); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - dbc.bindValue(textProp.observe(t), - BeanProperties.value(ABOUT_TO_HIDE_METHOD_NAME) - .observe(getClazz())); - dbc.bindValue( - WidgetProperties.enabled().observe(t), - BeanProperties.value(USE_ABOUT_TO_HIDE).observe( - getClazz())); - - final Button b = new Button(parent, SWT.CHECK); - dbc.bindValue( - WidgetProperties.selection().observe(b), - BeanProperties.value(USE_ABOUT_TO_HIDE).observe( - getClazz())); - } - } - }); - } - - @Override - protected Set<String> getRequiredBundles() { - final Set<String> set = super.getRequiredBundles(); - set.add("org.eclipse.e4.ui.di"); //$NON-NLS-1$ - set.add("org.eclipse.e4.ui.model.workbench"); //$NON-NLS-1$ - return set; - } - - public static class DynamicMenuContributionClass extends JavaClass { - private String aboutToShowMethodName = "aboutToShow"; //$NON-NLS-1$ - private String aboutToHideMethodName = "aboutToHide"; //$NON-NLS-1$ - private boolean useAboutToHide = false; - - public DynamicMenuContributionClass(IPackageFragmentRoot root) { - super(root); - } - - public String getAboutToShowMethodName() { - return aboutToShowMethodName; - } - - public void setAboutToShowMethodName(String executeMethodName) { - support.firePropertyChange(ABOUT_TO_SHOW_METHOD_NAME, - aboutToShowMethodName, - aboutToShowMethodName = executeMethodName); - } - - public String getAboutToHideMethodName() { - return aboutToHideMethodName; - } - - public void setAboutToHideMethodName(String canExecuteMethodName) { - support.firePropertyChange(ABOUT_TO_HIDE_METHOD_NAME, - aboutToHideMethodName, - aboutToHideMethodName = canExecuteMethodName); - } - - public boolean isUseAboutToHide() { - return useAboutToHide; - } - - public void setUseAboutToHide(boolean useAboutToHide) { - support.firePropertyChange(USE_ABOUT_TO_HIDE, this.useAboutToHide, - this.useAboutToHide = useAboutToHide); - } - } - -} diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewHandlerClassWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewHandlerClassWizard.java deleted file mode 100644 index 9c675f96..00000000 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewHandlerClassWizard.java +++ /dev/null @@ -1,153 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Sopot Cela <sopotcela@gmail.com> - ******************************************************************************/ -package org.eclipse.e4.internal.tools.wizards.classes; - -import java.util.Set; - -import org.eclipse.core.databinding.DataBindingContext; -import org.eclipse.core.databinding.beans.BeanProperties; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.e4.internal.tools.Messages; -import org.eclipse.e4.internal.tools.wizards.classes.AbstractNewClassPage.JavaClass; -import org.eclipse.e4.internal.tools.wizards.classes.templates.HandlerTemplate; -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class NewHandlerClassWizard extends AbstractNewClassWizard { - private static final String USE_CAN_EXECUTE = "useCanExecute"; //$NON-NLS-1$ - private static final String CAN_EXECUTE_METHOD_NAME = "canExecuteMethodName"; //$NON-NLS-1$ - private static final String EXECUTE_METHOD_NAME = "executeMethodName"; //$NON-NLS-1$ - private String initialString; - - public NewHandlerClassWizard(String contributionURI) { - initialString = contributionURI; - } - - public NewHandlerClassWizard() { - // Intentially left empty - } - - @Override - protected String getContent() { - final HandlerTemplate template = new HandlerTemplate(); - return template.generate(getDomainClass()); - } - - @Override - public void addPages() { - addPage(new AbstractNewClassPage( - "Classinformation", //$NON-NLS-1$ - Messages.NewHandlerClassWizard_NewHandler, - Messages.NewHandlerClassWizard_CreateNewHandler, root, ResourcesPlugin.getWorkspace().getRoot(), - initialString) { - - @Override - protected JavaClass createInstance() { - return new HandlerClass(root); - } - - @Override - protected void createFields(Composite parent, DataBindingContext dbc) { - final IWidgetValueProperty textProp = WidgetProperties - .text(SWT.Modify); - - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.NewHandlerClassWizard_ExecuteMethod); - - final Text t = new Text(parent, SWT.BORDER); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - dbc.bindValue( - textProp.observe(t), - BeanProperties.value(EXECUTE_METHOD_NAME).observe( - getClazz())); - - l = new Label(parent, SWT.NONE); - } - - { - final Label l = new Label(parent, SWT.NONE); - l.setText(Messages.NewHandlerClassWizard_CanExecuteMethod); - - final Text t = new Text(parent, SWT.BORDER); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - dbc.bindValue(textProp.observe(t), - BeanProperties.value(CAN_EXECUTE_METHOD_NAME) - .observe(getClazz())); - dbc.bindValue( - WidgetProperties.enabled().observe(t), - BeanProperties.value(USE_CAN_EXECUTE).observe( - getClazz())); - - final Button b = new Button(parent, SWT.CHECK); - dbc.bindValue( - WidgetProperties.selection().observe(b), - BeanProperties.value(USE_CAN_EXECUTE).observe( - getClazz())); - } - } - }); - } - - @Override - protected Set<String> getRequiredBundles() { - final Set<String> set = super.getRequiredBundles(); - set.add("org.eclipse.e4.core.di"); //$NON-NLS-1$ - return set; - } - - public static class HandlerClass extends JavaClass { - private String executeMethodName = "execute"; //$NON-NLS-1$ - private String canExecuteMethodName = "canExecute"; //$NON-NLS-1$ - private boolean useCanExecute = false; - - public HandlerClass(IPackageFragmentRoot root) { - super(root); - } - - public String getExecuteMethodName() { - return executeMethodName; - } - - public void setExecuteMethodName(String executeMethodName) { - support.firePropertyChange(EXECUTE_METHOD_NAME, - this.executeMethodName, - this.executeMethodName = executeMethodName); - } - - public String getCanExecuteMethodName() { - return canExecuteMethodName; - } - - public void setCanExecuteMethodName(String canExecuteMethodName) { - support.firePropertyChange(CAN_EXECUTE_METHOD_NAME, - this.canExecuteMethodName, - this.canExecuteMethodName = canExecuteMethodName); - } - - public boolean isUseCanExecute() { - return useCanExecute; - } - - public void setUseCanExecute(boolean useCanExecute) { - support.firePropertyChange(USE_CAN_EXECUTE, this.useCanExecute, - this.useCanExecute = useCanExecute); - } - } -} diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewPartClassWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewPartClassWizard.java deleted file mode 100644 index e82ad118..00000000 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewPartClassWizard.java +++ /dev/null @@ -1,284 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Sopot Cela <sopotcela@gmail.com> - ******************************************************************************/ -package org.eclipse.e4.internal.tools.wizards.classes; - -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import java.util.Set; - -import org.eclipse.core.databinding.DataBindingContext; -import org.eclipse.core.databinding.beans.BeanProperties; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.e4.internal.tools.Messages; -import org.eclipse.e4.internal.tools.wizards.classes.AbstractNewClassPage.JavaClass; -import org.eclipse.e4.internal.tools.wizards.classes.templates.PartTemplate; -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class NewPartClassWizard extends AbstractNewClassWizard { - - private static final String PERSIST_METHOD_NAME = "persistMethodName"; //$NON-NLS-1$ - private static final String USE_PERSIST = "usePersist"; //$NON-NLS-1$ - private static final String USE_FOCUS = "useFocus"; //$NON-NLS-1$ - private static final String FOCUS_METHOD_NAME = "focusMethodName"; //$NON-NLS-1$ - private static final String USE_PREDESTROY = "usePredestroy"; //$NON-NLS-1$ - private static final String PRE_DESTROY_METHOD_NAME = "preDestroyMethodName"; //$NON-NLS-1$ - private static final String USE_POST_CONSTRUCT = "usePostConstruct"; //$NON-NLS-1$ - private static final String POST_CONSTRUCT_METHOD_NAME = "postConstructMethodName"; //$NON-NLS-1$ - private String initialString; - - public NewPartClassWizard(String contributionURI) { - initialString = contributionURI; - } - - public NewPartClassWizard() { - // Intentially left empty - } - - @Override - public void addPages() { - addPage(new AbstractNewClassPage("Classinformation", Messages.NewPartClassWizard_NewPart, //$NON-NLS-1$ - Messages.NewPartClassWizard_CreateNewPart, root, ResourcesPlugin.getWorkspace() - .getRoot(), initialString) { - - @Override - protected void createFields(Composite parent, DataBindingContext dbc) { - final IWidgetValueProperty textProp = WidgetProperties - .text(SWT.Modify); - final IWidgetValueProperty enabledProp = WidgetProperties.enabled(); - - { - final Label l = new Label(parent, SWT.NONE); - l.setText(Messages.NewPartClassWizard_PostConstructMethod); - - final Text t = new Text(parent, SWT.BORDER); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - dbc.bindValue(textProp.observe(t), - BeanProperties.value(POST_CONSTRUCT_METHOD_NAME) - .observe(getClazz())); - dbc.bindValue( - enabledProp.observe(t), - BeanProperties.value(USE_POST_CONSTRUCT).observe( - getClazz())); - - final Button b = new Button(parent, SWT.CHECK); - dbc.bindValue( - WidgetProperties.selection().observe(b), - BeanProperties.value(USE_POST_CONSTRUCT).observe( - getClazz())); - } - - { - final Label l = new Label(parent, SWT.NONE); - l.setText(Messages.NewPartClassWizard_PredestroyMethod); - - final Text t = new Text(parent, SWT.BORDER); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - dbc.bindValue(textProp.observe(t), - BeanProperties.value(PRE_DESTROY_METHOD_NAME) - .observe(getClazz())); - dbc.bindValue( - enabledProp.observe(t), - BeanProperties.value(USE_PREDESTROY).observe( - getClazz())); - - final Button b = new Button(parent, SWT.CHECK); - dbc.bindValue( - WidgetProperties.selection().observe(b), - BeanProperties.value(USE_PREDESTROY).observe( - getClazz())); - } - - { - final Label l = new Label(parent, SWT.NONE); - l.setText(Messages.NewPartClassWizard_FocusMethod); - - final Text t = new Text(parent, SWT.BORDER); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - dbc.bindValue(textProp.observe(t), - BeanProperties.value(FOCUS_METHOD_NAME) - .observe(getClazz())); - dbc.bindValue( - enabledProp.observe(t), - BeanProperties.value(USE_FOCUS).observe( - getClazz())); - - final Button b = new Button(parent, SWT.CHECK); - dbc.bindValue( - WidgetProperties.selection().observe(b), - BeanProperties.value(USE_FOCUS).observe( - getClazz())); - } - - { - final Label l = new Label(parent, SWT.NONE); - l.setText(Messages.NewPartClassWizard_PersistMethod); - - final Text t = new Text(parent, SWT.BORDER); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - dbc.bindValue(textProp.observe(t), - BeanProperties.value(PERSIST_METHOD_NAME) - .observe(getClazz())); - dbc.bindValue( - enabledProp.observe(t), - BeanProperties.value(USE_PERSIST).observe( - getClazz())); - - final Button b = new Button(parent, SWT.CHECK); - dbc.bindValue( - WidgetProperties.selection().observe(b), - BeanProperties.value(USE_PERSIST).observe( - getClazz())); - } - } - - @Override - protected JavaClass createInstance() { - return new PartClass(root); - } - - }); - } - - @Override - protected Set<String> getRequiredBundles() { - final Set<String> rv = super.getRequiredBundles(); - final PartClass cl = (PartClass) getDomainClass(); - if (cl.usePostConstruct || cl.usePredestroy) { - rv.add("javax.annotation"); //$NON-NLS-1$ - } else if (cl.useFocus || cl.usePersist) { - rv.add("org.eclipse.e4.ui.di"); //$NON-NLS-1$ - } - - return rv; - } - - @Override - protected String getContent() { - final PartTemplate template = new PartTemplate(); - return template.generate(getDomainClass()); - } - - public static class PartClass extends JavaClass { - - private final PropertyChangeSupport support = new PropertyChangeSupport(this); - - private boolean usePostConstruct = true; - private String postConstructMethodName = "postConstruct"; //$NON-NLS-1$ - - private boolean usePredestroy; - private String preDestroyMethodName = "preDestroy"; //$NON-NLS-1$ - - private boolean useFocus; - private String focusMethodName = "onFocus"; //$NON-NLS-1$ - - private boolean usePersist; - private String persistMethodName = "save"; //$NON-NLS-1$ - - public PartClass(IPackageFragmentRoot fragmentRoot) { - super(fragmentRoot); - } - - @Override - public void addPropertyChangeListener(PropertyChangeListener listener) { - support.addPropertyChangeListener(listener); - } - - @Override - public void removePropertyChangeListener(PropertyChangeListener listener) { - support.removePropertyChangeListener(listener); - } - - public boolean isUsePostConstruct() { - return usePostConstruct; - } - - public void setUsePostConstruct(boolean usePostConstruct) { - support.firePropertyChange(USE_POST_CONSTRUCT, - this.usePostConstruct, - this.usePostConstruct = usePostConstruct); - } - - public String getPostConstructMethodName() { - return postConstructMethodName; - } - - public void setPostConstructMethodName(String postConstructMethodName) { - support.firePropertyChange(POST_CONSTRUCT_METHOD_NAME, - this.postConstructMethodName, - this.postConstructMethodName = postConstructMethodName); - } - - public boolean isUsePredestroy() { - return usePredestroy; - } - - public void setUsePredestroy(boolean usePredestroy) { - support.firePropertyChange(USE_PREDESTROY, this.usePredestroy, - this.usePredestroy = usePredestroy); - } - - public String getPreDestroyMethodName() { - return preDestroyMethodName; - } - - public void setPreDestroyMethodName(String preDestroyMethodName) { - support.firePropertyChange(PRE_DESTROY_METHOD_NAME, - this.preDestroyMethodName, - this.preDestroyMethodName = preDestroyMethodName); - } - - public boolean isUseFocus() { - return useFocus; - } - - public void setUseFocus(boolean useFocus) { - support.firePropertyChange(USE_FOCUS, this.useFocus, - this.useFocus = useFocus); - } - - public String getFocusMethodName() { - return focusMethodName; - } - - public void setFocusMethodName(String focusMethodName) { - support.firePropertyChange(FOCUS_METHOD_NAME, this.focusMethodName, - this.focusMethodName = focusMethodName); - } - - public boolean isUsePersist() { - return usePersist; - } - - public void setUsePersist(boolean usePersist) { - support.firePropertyChange(USE_PERSIST, this.usePersist, - this.usePersist = usePersist); - } - - public String getPersistMethodName() { - return persistMethodName; - } - - public void setPersistMethodName(String persistMethodName) { - support.firePropertyChange(PERSIST_METHOD_NAME, - this.persistMethodName, - this.persistMethodName = persistMethodName); - } - } -} diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewToolControlClassWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewToolControlClassWizard.java deleted file mode 100644 index ccb1f029..00000000 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/NewToolControlClassWizard.java +++ /dev/null @@ -1,135 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Dmitry Spiridenok <d.spiridenok@gmail.com> - Bug 412672 - ******************************************************************************/ -package org.eclipse.e4.internal.tools.wizards.classes; - -import java.util.Set; - -import org.eclipse.core.databinding.DataBindingContext; -import org.eclipse.core.databinding.beans.BeanProperties; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.e4.internal.tools.Messages; -import org.eclipse.e4.internal.tools.wizards.classes.AbstractNewClassPage.JavaClass; -import org.eclipse.e4.internal.tools.wizards.classes.templates.ToolControlTemplate; -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class NewToolControlClassWizard extends AbstractNewClassWizard { - private static final String CREATE_DEFAULT_CONSTRUCTOR = "createDefaultConstructor"; //$NON-NLS-1$ - private static final String CREATE_GUI_METHOD_NAME = "createGuiMethodName"; //$NON-NLS-1$ - private String initialString; - - public NewToolControlClassWizard(String contributionURI) { - initialString = contributionURI; - } - - public NewToolControlClassWizard() { - // Intentionally left empty - } - - @Override - protected String getContent() { - final ToolControlTemplate template = new ToolControlTemplate(); - return template.generate(getDomainClass()); - } - - @Override - public void addPages() { - addPage(new AbstractNewClassPage("Classinformation", //$NON-NLS-1$ - Messages.NewToolControlClassWizard_NewToolControl, - Messages.NewToolControlClassWizard_CreateNewToolControl, root, ResourcesPlugin.getWorkspace().getRoot(), initialString) { - - @Override - protected JavaClass createInstance() { - return new ToolControlClass(root); - } - - @Override - protected void createFields(Composite parent, DataBindingContext dbc) { - final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.NewToolControlClassWizard_CreateGUIMethod); - - final Text t = new Text(parent, SWT.BORDER); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - dbc.bindValue( - textProp.observe(t), - BeanProperties.value(CREATE_GUI_METHOD_NAME).observe( - getClazz())); - - l = new Label(parent, SWT.NONE); - } - { - final Label l = new Label(parent, SWT.NONE); - l.setText(Messages.NewToolControlClassWizard_CreateDefaultConstructor); - - // Text t = new Text(parent, SWT.BORDER); - // t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - // dbc.bindValue(textProp.observe(t), - // BeanProperties.value("defaultConstructorName") - // .observe(getClazz())); - // dbc.bindValue( - // WidgetProperties.enabled().observe(t), - // BeanProperties.value("useDefaultConstructor").observe( - // getClazz())); - - final Button b = new Button(parent, SWT.CHECK); - dbc.bindValue( - WidgetProperties.selection().observe(b), - BeanProperties.value(CREATE_DEFAULT_CONSTRUCTOR).observe( - getClazz())); - } - } - }); - } - - @Override - protected Set<String> getRequiredBundles() { - final Set<String> set = super.getRequiredBundles(); - set.add("org.eclipse.e4.core.di"); //$NON-NLS-1$ - return set; - } - - public static class ToolControlClass extends JavaClass { - private String createGuiMethodName = "createGui"; //$NON-NLS-1$ - private boolean createDefaultCostructor = false; - - public ToolControlClass(IPackageFragmentRoot root) { - super(root); - } - - public String getCreateGuiMethodName() { - return createGuiMethodName; - } - - public void setCreateGuiMethodName(String createGuiMethodName) { - support.firePropertyChange(CREATE_GUI_METHOD_NAME, - this.createGuiMethodName, - this.createGuiMethodName = createGuiMethodName); - } - - public boolean isCreateDefaultConstructor() { - return createDefaultCostructor; - } - - public void setCreateDefaultConstructor(boolean createDefaultConstructor) { - support.firePropertyChange(CREATE_DEFAULT_CONSTRUCTOR, createDefaultCostructor, - createDefaultCostructor = createDefaultConstructor); - } - } -} diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/templates/AddonTemplate.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/templates/AddonTemplate.java deleted file mode 100644 index 0f1e1f64..00000000 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/templates/AddonTemplate.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.eclipse.e4.internal.tools.wizards.classes.templates; - -import org.eclipse.e4.internal.tools.wizards.classes.AbstractNewClassPage.JavaClass; - -public class AddonTemplate -{ - protected static String nl; - public static synchronized AddonTemplate create(String lineSeparator) - { - nl = lineSeparator; - AddonTemplate result = new AddonTemplate(); - nl = null; - return result; - } - - public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; - protected final String TEXT_1 = " "; - protected final String TEXT_2 = NL + "package "; - protected final String TEXT_3 = ";"; - protected final String TEXT_4 = NL + NL + "import javax.inject.Inject;" + NL + "" + NL + "import org.eclipse.e4.core.di.annotations.Optional;" + NL + "import org.eclipse.e4.core.di.extensions.EventTopic;" + NL + "import org.eclipse.e4.ui.workbench.UIEvents;" + NL + "import org.osgi.service.event.Event;" + NL + "" + NL + "import org.eclipse.e4.core.services.events.IEventBroker;" + NL + "" + NL + "public class "; - protected final String TEXT_5 = " {" + NL + "" + NL + "\t@Inject" + NL + "\t@Optional" + NL + "\tpublic void applicationStarted(" + NL + "\t\t\t@EventTopic(UIEvents.UILifeCycle.APP_STARTUP_COMPLETE) Event event) {" + NL + "\t\t// TODO Modify the UIEvents.UILifeCycle.APP_STARTUP_COMPLETE EventTopic to a certain event you want to listen to." + NL + "\t}" + NL + "" + NL + "}"; - protected final String TEXT_6 = NL; - - public String generate(Object argument) - { - final StringBuffer stringBuffer = new StringBuffer(); - JavaClass domainClass = (JavaClass)argument; - stringBuffer.append(TEXT_1); - if( domainClass.getPackageFragment() != null && domainClass.getPackageFragment().getElementName().trim().length() > 0 ) { - stringBuffer.append(TEXT_2); - stringBuffer.append( domainClass.getPackageFragment().getElementName() ); - stringBuffer.append(TEXT_3); - } - stringBuffer.append(TEXT_4); - stringBuffer.append( domainClass.getName() ); - stringBuffer.append(TEXT_5); - stringBuffer.append(TEXT_6); - return stringBuffer.toString(); - } -} diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/templates/DynamicMenuContributionTemplate.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/templates/DynamicMenuContributionTemplate.java deleted file mode 100644 index 5810b065..00000000 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/templates/DynamicMenuContributionTemplate.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.eclipse.e4.internal.tools.wizards.classes.templates; - -import org.eclipse.e4.internal.tools.wizards.classes.NewDynamicMenuContributionClassWizard.DynamicMenuContributionClass; -@SuppressWarnings("nls") -public class DynamicMenuContributionTemplate -{ - protected static String nl; - public static synchronized DynamicMenuContributionTemplate create(String lineSeparator) - { - nl = lineSeparator; - DynamicMenuContributionTemplate result = new DynamicMenuContributionTemplate(); - nl = null; - return result; - } - - public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; - protected final String TEXT_1 = " "; - protected final String TEXT_2 = NL + "package "; - protected final String TEXT_3 = ";"; - protected final String TEXT_4 = NL + NL + "import java.util.List;" + NL + "" + NL + "import org.eclipse.e4.ui.di.AboutToShow;"; - protected final String TEXT_5 = NL + "import org.eclipse.e4.ui.di.AboutToHide;"; - protected final String TEXT_6 = NL + NL + "import org.eclipse.e4.ui.model.application.ui.menu.MMenuElement;" + NL + "" + NL + "public class "; - protected final String TEXT_7 = " {" + NL + "\t@AboutToShow" + NL + "\tpublic void "; - protected final String TEXT_8 = "(List<MMenuElement> items) {" + NL + "\t\t" + NL + "\t}" + NL + "\t"; - protected final String TEXT_9 = NL + "\t" + NL + "\t@AboutToHide" + NL + "\tpublic void "; - protected final String TEXT_10 = "(List<MMenuElement> items) {" + NL + "\t\t" + NL + "\t}" + NL + "\t"; - protected final String TEXT_11 = "\t" + NL + "}"; - - public String generate(Object argument) - { - final StringBuffer stringBuffer = new StringBuffer(); - DynamicMenuContributionClass domainClass = (DynamicMenuContributionClass)argument; - stringBuffer.append(TEXT_1); - if( domainClass.getPackageFragment() != null && domainClass.getPackageFragment().getElementName().trim().length() > 0 ) { - stringBuffer.append(TEXT_2); - stringBuffer.append( domainClass.getPackageFragment().getElementName() ); - stringBuffer.append(TEXT_3); - } - stringBuffer.append(TEXT_4); - if( domainClass.isUseAboutToHide() ) { - stringBuffer.append(TEXT_5); - } - stringBuffer.append(TEXT_6); - stringBuffer.append( domainClass.getName() ); - stringBuffer.append(TEXT_7); - stringBuffer.append( domainClass.getAboutToShowMethodName() ); - stringBuffer.append(TEXT_8); - if( domainClass.isUseAboutToHide() ) { - stringBuffer.append(TEXT_9); - stringBuffer.append( domainClass.getAboutToHideMethodName() ); - stringBuffer.append(TEXT_10); - } - stringBuffer.append(TEXT_11); - return stringBuffer.toString(); - } -} diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/templates/HandlerTemplate.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/templates/HandlerTemplate.java deleted file mode 100644 index bd0f997f..00000000 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/templates/HandlerTemplate.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.eclipse.e4.internal.tools.wizards.classes.templates; - -import org.eclipse.e4.internal.tools.wizards.classes.NewHandlerClassWizard.HandlerClass; -@SuppressWarnings("nls") -public class HandlerTemplate -{ - protected static String nl; - public static synchronized HandlerTemplate create(String lineSeparator) - { - nl = lineSeparator; - HandlerTemplate result = new HandlerTemplate(); - nl = null; - return result; - } - - public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; - protected final String TEXT_1 = " "; - protected final String TEXT_2 = NL + "package "; - protected final String TEXT_3 = ";"; - protected final String TEXT_4 = NL + NL + "import org.eclipse.e4.core.di.annotations.Execute;"; - protected final String TEXT_5 = NL + "import org.eclipse.e4.core.di.annotations.CanExecute;"; - protected final String TEXT_6 = NL + NL + "public class "; - protected final String TEXT_7 = " {" + NL + "\t@Execute" + NL + "\tpublic void "; - protected final String TEXT_8 = "() {" + NL + "\t\t" + NL + "\t}" + NL + "\t"; - protected final String TEXT_9 = NL + "\t" + NL + "\t@CanExecute" + NL + "\tpublic boolean "; - protected final String TEXT_10 = "() {" + NL + "\t\t" + NL + "\t\treturn true;" + NL + "\t}" + NL + "\t"; - protected final String TEXT_11 = "\t" + NL + "}"; - - public String generate(Object argument) - { - final StringBuffer stringBuffer = new StringBuffer(); - HandlerClass domainClass = (HandlerClass)argument; - stringBuffer.append(TEXT_1); - if( domainClass.getPackageFragment() != null && domainClass.getPackageFragment().getElementName().trim().length() > 0 ) { - stringBuffer.append(TEXT_2); - stringBuffer.append( domainClass.getPackageFragment().getElementName() ); - stringBuffer.append(TEXT_3); - } - stringBuffer.append(TEXT_4); - if( domainClass.isUseCanExecute() ) { - stringBuffer.append(TEXT_5); - } - stringBuffer.append(TEXT_6); - stringBuffer.append( domainClass.getName() ); - stringBuffer.append(TEXT_7); - stringBuffer.append( domainClass.getExecuteMethodName() ); - stringBuffer.append(TEXT_8); - if( domainClass.isUseCanExecute() ) { - stringBuffer.append(TEXT_9); - stringBuffer.append( domainClass.getCanExecuteMethodName() ); - stringBuffer.append(TEXT_10); - } - stringBuffer.append(TEXT_11); - return stringBuffer.toString(); - } -} diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/templates/PartTemplate.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/templates/PartTemplate.java deleted file mode 100644 index 38c4b91d..00000000 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/templates/PartTemplate.java +++ /dev/null @@ -1,95 +0,0 @@ -package org.eclipse.e4.internal.tools.wizards.classes.templates; - -import org.eclipse.e4.internal.tools.wizards.classes.NewPartClassWizard.PartClass; -@SuppressWarnings("nls") -public class PartTemplate -{ - protected static String nl; - public static synchronized PartTemplate create(String lineSeparator) - { - nl = lineSeparator; - PartTemplate result = new PartTemplate(); - nl = null; - return result; - } - - public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; - protected final String TEXT_1 = " "; - protected final String TEXT_2 = NL + "package "; - protected final String TEXT_3 = ";"; - protected final String TEXT_4 = NL + NL + "import javax.inject.Inject;"; - protected final String TEXT_5 = NL + "import javax.annotation.PostConstruct;" + NL + "import org.eclipse.swt.widgets.Composite;"; - protected final String TEXT_6 = NL + "import javax.annotation.PreDestroy;"; - protected final String TEXT_7 = NL + "import org.eclipse.e4.ui.di.Focus;"; - protected final String TEXT_8 = NL + "import org.eclipse.e4.ui.di.Persist;"; - protected final String TEXT_9 = NL + NL + "public class "; - protected final String TEXT_10 = " {" + NL + "\t@Inject" + NL + "\tpublic "; - protected final String TEXT_11 = "() {" + NL + "\t\t" + NL + "\t}" + NL + "\t"; - protected final String TEXT_12 = NL + "\t@PostConstruct" + NL + "\tpublic void "; - protected final String TEXT_13 = "(Composite parent) {" + NL + "\t\t" + NL + "\t}" + NL + "\t"; - protected final String TEXT_14 = NL + "\t"; - protected final String TEXT_15 = NL + "\t@PreDestroy" + NL + "\tpublic void "; - protected final String TEXT_16 = "() {" + NL + "\t\t" + NL + "\t}" + NL + "\t"; - protected final String TEXT_17 = NL + "\t"; - protected final String TEXT_18 = NL + "\t@Focus" + NL + "\tpublic void "; - protected final String TEXT_19 = "() {" + NL + "\t\t" + NL + "\t}" + NL + "\t"; - protected final String TEXT_20 = NL + "\t"; - protected final String TEXT_21 = NL + "\t@Persist" + NL + "\tpublic void "; - protected final String TEXT_22 = "() {" + NL + "\t\t" + NL + "\t}" + NL + "\t"; - protected final String TEXT_23 = NL + "}"; - - public String generate(Object argument) - { - final StringBuffer stringBuffer = new StringBuffer(); - PartClass domainClass = (PartClass)argument; - stringBuffer.append(TEXT_1); - if( domainClass.getPackageFragment() != null && domainClass.getPackageFragment().getElementName().trim().length() > 0 ) { - stringBuffer.append(TEXT_2); - stringBuffer.append( domainClass.getPackageFragment().getElementName() ); - stringBuffer.append(TEXT_3); - } - stringBuffer.append(TEXT_4); - if( domainClass.isUsePostConstruct() ) { - stringBuffer.append(TEXT_5); - } - if( domainClass.isUsePredestroy() ) { - stringBuffer.append(TEXT_6); - } - if( domainClass.isUseFocus() ) { - stringBuffer.append(TEXT_7); - } - if( domainClass.isUsePersist() ) { - stringBuffer.append(TEXT_8); - } - stringBuffer.append(TEXT_9); - stringBuffer.append( domainClass.getName() ); - stringBuffer.append(TEXT_10); - stringBuffer.append( domainClass.getName() ); - stringBuffer.append(TEXT_11); - if( domainClass.isUsePostConstruct() ) { - stringBuffer.append(TEXT_12); - stringBuffer.append( domainClass.getPostConstructMethodName() ); - stringBuffer.append(TEXT_13); - } - stringBuffer.append(TEXT_14); - if( domainClass.isUsePredestroy() ) { - stringBuffer.append(TEXT_15); - stringBuffer.append( domainClass.getPreDestroyMethodName() ); - stringBuffer.append(TEXT_16); - } - stringBuffer.append(TEXT_17); - if( domainClass.isUseFocus() ) { - stringBuffer.append(TEXT_18); - stringBuffer.append( domainClass.getFocusMethodName() ); - stringBuffer.append(TEXT_19); - } - stringBuffer.append(TEXT_20); - if( domainClass.isUsePersist() ) { - stringBuffer.append(TEXT_21); - stringBuffer.append( domainClass.getPersistMethodName() ); - stringBuffer.append(TEXT_22); - } - stringBuffer.append(TEXT_23); - return stringBuffer.toString(); - } -} diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/templates/ToolControlTemplate.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/templates/ToolControlTemplate.java deleted file mode 100644 index ecfff8dd..00000000 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/classes/templates/ToolControlTemplate.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.eclipse.e4.internal.tools.wizards.classes.templates; - -import org.eclipse.e4.internal.tools.wizards.classes.NewToolControlClassWizard.ToolControlClass; -@SuppressWarnings("nls") -public class ToolControlTemplate -{ - protected static String nl; - public static synchronized ToolControlTemplate create(String lineSeparator) - { - nl = lineSeparator; - ToolControlTemplate result = new ToolControlTemplate(); - nl = null; - return result; - } - - public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; - protected final String TEXT_1 = "package "; - protected final String TEXT_2 = ";"; - protected final String TEXT_3 = NL + NL + "import javax.annotation.PostConstruct;"; - protected final String TEXT_4 = NL + "import javax.inject.Inject;"; - protected final String TEXT_5 = NL + NL + "public class "; - protected final String TEXT_6 = " {" + NL + "\t"; - protected final String TEXT_7 = NL + "\t@Inject" + NL + "\tpublic "; - protected final String TEXT_8 = "() {" + NL + "\t\t" + NL + "\t}" + NL + "\t"; - protected final String TEXT_9 = NL + "\t@PostConstruct" + NL + "\tpublic void "; - protected final String TEXT_10 = "() {" + NL + "\t\t" + NL + "\t}" + NL + "}"; - - public String generate(Object argument) - { - final StringBuffer stringBuffer = new StringBuffer(); - ToolControlClass domainClass = (ToolControlClass)argument; - if( domainClass.getPackageFragment() != null && domainClass.getPackageFragment().getElementName().trim().length() > 0 ) { - stringBuffer.append(TEXT_1); - stringBuffer.append( domainClass.getPackageFragment().getElementName() ); - stringBuffer.append(TEXT_2); - } - stringBuffer.append(TEXT_3); - if( domainClass.isCreateDefaultConstructor() ) { - stringBuffer.append(TEXT_4); - } - stringBuffer.append(TEXT_5); - stringBuffer.append( domainClass.getName() ); - stringBuffer.append(TEXT_6); - if( domainClass.isCreateDefaultConstructor() ) { - stringBuffer.append(TEXT_7); - stringBuffer.append( domainClass.getName() ); - stringBuffer.append(TEXT_8); - } - stringBuffer.append(TEXT_9); - stringBuffer.append( domainClass.getCreateGuiMethodName() ); - stringBuffer.append(TEXT_10); - return stringBuffer.toString(); - } -} diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/BaseApplicationModelWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/BaseApplicationModelWizard.java deleted file mode 100644 index 9e093e72..00000000 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/BaseApplicationModelWizard.java +++ /dev/null @@ -1,477 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 - 2014 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Dmitry Spiridenok <d.spiridenok@gmail.com> - Bug 408712 - * Marco Descher <marco@descher.at> - Bug 434371 - ******************************************************************************/ -package org.eclipse.e4.internal.tools.wizards.model; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Status; -import org.eclipse.e4.internal.tools.Messages; -import org.eclipse.e4.ui.model.application.MApplicationElement; -import org.eclipse.e4.ui.model.application.commands.MCommand; -import org.eclipse.e4.ui.model.application.commands.MHandler; -import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem; -import org.eclipse.e4.ui.model.fragment.MModelFragment; -import org.eclipse.e4.ui.model.fragment.MModelFragments; -import org.eclipse.emf.common.util.TreeIterator; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.osgi.service.resolver.BundleDescription; -import org.eclipse.pde.core.build.IBuildEntry; -import org.eclipse.pde.core.plugin.IExtensionsModelFactory; -import org.eclipse.pde.core.plugin.IMatchRules; -import org.eclipse.pde.core.plugin.IPluginAttribute; -import org.eclipse.pde.core.plugin.IPluginElement; -import org.eclipse.pde.core.plugin.IPluginExtension; -import org.eclipse.pde.core.plugin.IPluginImport; -import org.eclipse.pde.core.plugin.IPluginModelBase; -import org.eclipse.pde.core.plugin.IPluginObject; -import org.eclipse.pde.core.plugin.PluginRegistry; -import org.eclipse.pde.internal.core.build.WorkspaceBuildModel; -import org.eclipse.pde.internal.core.bundle.BundlePluginModel; -import org.eclipse.pde.internal.core.bundle.WorkspaceBundlePluginModel; -import org.eclipse.pde.internal.core.project.PDEProject; -import org.eclipse.ui.INewWizard; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.IWorkbenchWizard; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.actions.WorkspaceModifyOperation; -import org.eclipse.ui.part.FileEditorInput; -import org.eclipse.ui.part.ISetSelectionTarget; - -@SuppressWarnings("restriction") -public abstract class BaseApplicationModelWizard extends Wizard implements INewWizard { - private NewModelFilePage page; - private ISelection selection; - - protected IWorkbench workbench; - - /** - * Constructor for NewApplicationModelWizard. - */ - public BaseApplicationModelWizard() { - super(); - setNeedsProgressMonitor(true); - } - - /** - * Adding the page to the wizard. - */ - - @Override - public void addPages() { - page = createWizardPage(selection); - addPage(page); - } - - protected abstract NewModelFilePage createWizardPage(ISelection selection); - - public abstract String getDefaultFileName(); - - @Override - public boolean performFinish() { - try { - // Remember the file. - // - final IFile modelFile = getModelFile(); - - if (modelFile.exists()) { - if (!MessageDialog.openQuestion(getShell(), Messages.BaseApplicationModelWizard_FileExists, - Messages.BaseApplicationModelWizard_TheFileAlreadyExists - + Messages.BaseApplicationModelWizard_AddExtractedNode)) { - return false; - } - } - - // Do the work within an operation. - // - final WorkspaceModifyOperation operation = - new WorkspaceModifyOperation() { - @Override - protected void execute(IProgressMonitor progressMonitor) { - try { - // Create a resource set - // - final ResourceSet resourceSet = new ResourceSetImpl(); - - // Get the URI of the model file. - // - final URI fileURI = URI.createPlatformResourceURI(modelFile.getFullPath().toString(), true); - - // Create a resource for this file. - // - final Resource resource = resourceSet.createResource(fileURI); - - // If target file already exists, load its content - // - if (modelFile.exists()) { - resource.load(null); - } - - // Add the initial model object to the contents. - // - final EObject rootObject = createInitialModel(); - if (rootObject != null) { - if (resource.getContents().size() == 0) { - // If target model is empty (file just created) => add as is - resource.getContents().add(rootObject); - } else { - // Otherwise (file already exists) => take the roots of source and target models - // and copy multiple attributes 'imports' and 'fragments' objects from source to - // target - final MModelFragments sourceFragments = (MModelFragments) rootObject; - final MModelFragments targetFragments = (MModelFragments) resource.getContents() - .get(0); - - final List<MCommand> listOfAllImportsFromElements = new ArrayList<MCommand>(); - for (final MModelFragment fragment : sourceFragments.getFragments()) { - final List<MCommand> commandsToImport = new ArrayList<MCommand>(); - final EObject eObject = (EObject) fragment; - final TreeIterator<EObject> eAllContents = eObject.eAllContents(); - while (eAllContents.hasNext()) { - final EObject next = eAllContents.next(); - final MApplicationElement mApplicationElement = (MApplicationElement) next; - if (mApplicationElement instanceof MHandler) { - final MHandler mHandler = (MHandler) mApplicationElement; - final MCommand command = mHandler.getCommand(); - commandsToImport.add(command); - final MApplicationElement copy = (MApplicationElement) EcoreUtil - .copy((EObject) command); - targetFragments.getImports().add(copy); - mHandler.setCommand((MCommand) copy); - } - else if (mApplicationElement instanceof MHandledItem) { - final MHandledItem mHandledItem = (MHandledItem) mApplicationElement; - final MCommand command = mHandledItem.getCommand(); - commandsToImport.add(command); - final MApplicationElement copy = (MApplicationElement) EcoreUtil - .copy((EObject) command); - targetFragments.getImports().add(copy); - mHandledItem.setCommand((MCommand) copy); - } - - } - listOfAllImportsFromElements.addAll(commandsToImport); - targetFragments.getFragments().add( - (MModelFragment) EcoreUtil.copy((EObject) fragment)); - - } - for (final MApplicationElement element : sourceFragments.getImports()) { - boolean isAlreadyImport = true; - for (final MCommand mCommand : listOfAllImportsFromElements) { - - if (!mCommand.getElementId().equals(element.getElementId())) { - - isAlreadyImport = false; - break; - } - if (!isAlreadyImport) { - - targetFragments.getImports().add( - (MApplicationElement) EcoreUtil.copy((EObject) element)); - } - - } - - } - - } - } - - // Save the contents of the resource to the file system. - // - final Map<Object, Object> options = new HashMap<Object, Object>(); - resource.save(options); - adjustBuildPropertiesFile(modelFile); - adjustDependencies(modelFile); - } - catch (final Exception exception) { - throw new RuntimeException(exception); - } - finally { - progressMonitor.done(); - } - } - }; - - getContainer().run(false, false, operation); - - // Select the new file resource in the current view. - // - final IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow(); - final IWorkbenchPage page = workbenchWindow.getActivePage(); - final IWorkbenchPart activePart = page.getActivePart(); - if (activePart instanceof ISetSelectionTarget) { - final ISelection targetSelection = new StructuredSelection(modelFile); - getShell().getDisplay().asyncExec - (new Runnable() { - @Override - public void run() { - ((ISetSelectionTarget) activePart).selectReveal(targetSelection); - } - }); - } - - // Open an editor on the new file. - // - try { - page.openEditor - (new FileEditorInput(modelFile), - workbench.getEditorRegistry().getDefaultEditor(modelFile.getFullPath().toString()).getId()); - } catch (final PartInitException exception) { - MessageDialog.openError(workbenchWindow.getShell(), "Could not init editor", exception.getMessage()); //$NON-NLS-1$ - return false; - } - - return true; - } catch (final Exception exception) { - exception.printStackTrace(); - MessageDialog.openError(getShell(), Messages.BaseApplicationModelWizard_Error, exception.getMessage()); - return false; - } - } - - protected abstract EObject createInitialModel(); - - protected IFile getModelFile() throws CoreException { - final String containerName = page.getContainerName(); - final String fileName = page.getFileName(); - final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); - final IResource resource = root.findMember(new Path(containerName)); - if (!resource.exists() || !(resource instanceof IContainer)) { - throwCoreException("Container \"" + containerName //$NON-NLS-1$ - + "\" does not exist."); //$NON-NLS-1$ - } - final IContainer container = (IContainer) resource; - return container.getFile(new Path(fileName)); - } - - private void throwCoreException(String message) throws CoreException { - final IStatus status = new Status(IStatus.ERROR, "org.eclipse.e4.tools.emf.editor3x", IStatus.OK, message, null); //$NON-NLS-1$ - throw new CoreException(status); - } - - /** - * We will accept the selection in the workbench to see if we can initialize - * from it. - * - * @see IWorkbenchWizard#init(IWorkbench, IStructuredSelection) - */ - @Override - public void init(IWorkbench workbench, IStructuredSelection selection) { - this.workbench = workbench; - this.selection = selection; - } - - /** - * Adds other file to the build.properties file. - */ - private void adjustBuildPropertiesFile(IFile file) - throws CoreException { - final IProject project = file.getProject(); - final IFile buildPropertiesFile = PDEProject.getBuildProperties(project); - if (buildPropertiesFile.exists()) { - final WorkspaceBuildModel model = new WorkspaceBuildModel(buildPropertiesFile); - final IBuildEntry entry = model.getBuild().getEntry(IBuildEntry.BIN_INCLUDES); - final String token = file.getProjectRelativePath().toString(); - if (!entry.contains(token)) { - entry.addToken(token); - } - model.save(); - } - } - - /** - * Callback hook to allow for after-file-creation modifications. Default - * implementation does nothing. - * - * @param file - * the file created by the wizard - */ - protected void adjustDependencies(IFile file) { - } - - /** - * Add the required dependencies (org.eclipse.e4.ui.model.workbench) and - * register fragment.e4xmi at the required extension point - * (org.eclipse.e4.workbench.model) - */ - protected void adjustFragmentDependencies(IFile file) { - final IProject project = file.getProject(); - final IFile pluginXml = PDEProject.getPluginXml(project); - final IFile manifest = PDEProject.getManifest(project); - - final WorkspaceBundlePluginModel fModel = new WorkspaceBundlePluginModel( - manifest, pluginXml); - try { - addWorkbenchDependencyIfRequired(fModel); - registerWithExtensionPointIfRequired(project, fModel, file); - } catch (final CoreException e) { - e.printStackTrace(); - MessageDialog.openError(getShell(), Messages.BaseApplicationModelWizard_Error, e.getMessage()); - } - } - - private void addWorkbenchDependencyIfRequired( - WorkspaceBundlePluginModel fModel) throws CoreException { - final IPluginImport[] imports = fModel.getPluginBase().getImports(); - - final String WORKBENCH_IMPORT_ID = "org.eclipse.e4.ui.model.workbench"; //$NON-NLS-1$ - - for (final IPluginImport iPluginImport : imports) { - if (WORKBENCH_IMPORT_ID.equalsIgnoreCase(iPluginImport.getId())) { - return; - } - } - - String version = ""; //$NON-NLS-1$ - final IPluginModelBase findModel = PluginRegistry - .findModel(WORKBENCH_IMPORT_ID); - if (findModel != null) { - final BundleDescription bundleDescription = findModel - .getBundleDescription(); - if (bundleDescription != null) { - version = bundleDescription.getVersion().toString() - .replaceFirst("\\.qualifier$", ""); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - final IPluginImport workbenchImport = fModel.getPluginFactory() - .createImport(); - workbenchImport.setId(WORKBENCH_IMPORT_ID); - workbenchImport.setVersion(version); - workbenchImport.setMatch(IMatchRules.GREATER_OR_EQUAL); - fModel.getPluginBase().add(workbenchImport); - fModel.save(); - } - - /** - * Register the fragment.e4xmi with the org.eclipse.e4.workbench.model - * extension point, if there is not already a fragment registered. - */ - private void registerWithExtensionPointIfRequired(IProject project, - WorkspaceBundlePluginModel fModel, IFile file) throws CoreException { - - final String WORKBENCH_MODEL_EP_ID = "org.eclipse.e4.workbench.model"; //$NON-NLS-1$ - final String FRAGMENT = "fragment"; //$NON-NLS-1$ - - // Fix bug #436836 : the received fModel is an empty plugin model without extension. - // We must copy extensions found in registry plugin model into it - // The registry plugin model is read only and must be copied inside the new extension value.. - final BundlePluginModel registryModel = (BundlePluginModel) PluginRegistry.findModel(project.getName()); - // The registry Model is not modifiable and may be contains some existing extensions. - // Must copy them in the new created fModel - for (final IPluginExtension e : registryModel.getPluginBase().getExtensions()) { - final IPluginExtension clonedExtens = copyExtension(fModel.getFactory(), e); - fModel.getPluginBase().add(clonedExtens); - } - - // Can now check if we must add this extension (may be already inside). - final IPluginExtension[] extensions = fModel.getPluginBase().getExtensions(); - for (final IPluginExtension iPluginExtension : extensions) { - if (WORKBENCH_MODEL_EP_ID - .equalsIgnoreCase(iPluginExtension.getPoint())) { - final IPluginObject[] children = iPluginExtension.getChildren(); - for (final IPluginObject child : children) { - if (FRAGMENT.equalsIgnoreCase(child.getName())) { - return; - } - } - } - } - - final IPluginExtension extPointFragmentRegister = fModel.getPluginFactory() - .createExtension(); - final IPluginElement element = extPointFragmentRegister.getModel() - .getFactory().createElement(extPointFragmentRegister); - element.setName(FRAGMENT); - element.setAttribute("uri", file.getName()); //$NON-NLS-1$ - extPointFragmentRegister.setId(project.getName() + "." + FRAGMENT); //$NON-NLS-1$ - extPointFragmentRegister.setPoint(WORKBENCH_MODEL_EP_ID); - extPointFragmentRegister.add(element); - fModel.getPluginBase().add(extPointFragmentRegister); - fModel.save(); - } - - // Used to Fix bug #436836 - private IPluginExtension copyExtension(IExtensionsModelFactory factory, final IPluginExtension ext) { - try - { - final IPluginExtension clonedExt = factory.createExtension(); - clonedExt.setPoint(ext.getPoint()); - final IPluginObject[] _children = ext.getChildren(); - for (final IPluginObject elt : _children) { - if (elt instanceof IPluginElement) { - final IPluginElement ipe = (IPluginElement) elt; - final IPluginElement clonedElt = copyExtensionElement(factory, ipe, ext); - clonedExt.add(clonedElt); - } - } - return clonedExt; - } catch (final Exception e) { - e.printStackTrace(); - } - return null; - - } - - // Used to Fix bug #436836 - private IPluginElement copyExtensionElement(IExtensionsModelFactory factory, final IPluginElement elt, - final IPluginObject parent) { - try - { - final IPluginElement clonedElt = factory.createElement(parent); - clonedElt.setName(elt.getName()); - for (final IPluginAttribute a : elt.getAttributes()) { - clonedElt.setAttribute(a.getName(), a.getValue()); - } - for (final IPluginObject e : elt.getChildren()) { - if (e instanceof IPluginElement) { - final IPluginElement ipe = (IPluginElement) e; - final IPluginElement copyExtensionElement = copyExtensionElement(factory, ipe, clonedElt); - clonedElt.add(copyExtensionElement); - } - } - return clonedElt; - } catch (final Exception e) { - e.printStackTrace(); - } - return null; - - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/ExtractContributionModelWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/ExtractContributionModelWizard.java deleted file mode 100644 index bbbc1b17..00000000 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/ExtractContributionModelWizard.java +++ /dev/null @@ -1,130 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010-2014 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Sopot Cela <sopotcela@gmail.com> - initial API and implementation - * Marco Descher <marco@descher.at> - Bug 434371 - ******************************************************************************/ -package org.eclipse.e4.internal.tools.wizards.model; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.ui.model.application.MApplicationElement; -import org.eclipse.e4.ui.model.application.commands.MCommand; -import org.eclipse.e4.ui.model.application.commands.MHandler; -import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem; -import org.eclipse.e4.ui.model.fragment.MFragmentFactory; -import org.eclipse.e4.ui.model.fragment.MModelFragments; -import org.eclipse.e4.ui.model.fragment.MStringModelFragment; -import org.eclipse.emf.common.util.TreeIterator; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.ui.PlatformUI; - -public class ExtractContributionModelWizard extends BaseApplicationModelWizard { - - private final List<MApplicationElement> oes = new ArrayList<MApplicationElement>(); - - public ExtractContributionModelWizard(MApplicationElement oe) { - super(); - oes.add(oe); - } - - public ExtractContributionModelWizard(List<MApplicationElement> oes) { - this.oes.addAll(oes); - } - - public ExtractContributionModelWizard() { - super(); - } - - @Override - public String getDefaultFileName() { - return "fragment.e4xmi"; //$NON-NLS-1$ - } - - HashMap<String, MCommand> importCommands = new HashMap<String, MCommand>(); - - public void resolveCommandImports(MApplicationElement moe, MModelFragments mModelFragments) { - if (moe instanceof MHandler) { - - final MHandler mhandler = (MHandler) moe; - final MCommand command = ((MHandler) moe).getCommand(); - final MCommand existImportCommand = importCommands.get(command.getElementId()); - if (existImportCommand == null) { - final MApplicationElement copy = (MApplicationElement) EcoreUtil.copy((EObject) command); - mhandler.setCommand((MCommand) copy); - importCommands.put(copy.getElementId(), (MCommand) copy); - mModelFragments.getImports().add(copy); - } else { - mhandler.setCommand(existImportCommand); - } - } else if (moe instanceof MHandledItem) { - final MHandledItem mh = (MHandledItem) moe; - final MCommand command = mh.getCommand(); - final MCommand existImportCommand = importCommands.get(command.getElementId()); - if (existImportCommand == null) { - final MApplicationElement copy = (MApplicationElement) EcoreUtil.copy((EObject) command); - mh.setCommand((MCommand) copy); - importCommands.put(copy.getElementId(), command); - mModelFragments.getImports().add(copy); - } else { - mh.setCommand(existImportCommand); - } - } - } - - @Override - protected EObject createInitialModel() { - final MModelFragments createModelFragments = MFragmentFactory.INSTANCE.createModelFragments(); - for (final MApplicationElement moe : oes) { - final EObject eObject = (EObject) moe; - final TreeIterator<EObject> eAllContents = eObject.eAllContents(); - boolean hasNext = eAllContents.hasNext(); - if (!hasNext) { - resolveCommandImports(moe, createModelFragments); - } - while (hasNext) { - final MApplicationElement next = (MApplicationElement) eAllContents.next(); - resolveCommandImports(next, createModelFragments); - hasNext = eAllContents.hasNext(); - } - final MStringModelFragment createStringModelFragment = MFragmentFactory.INSTANCE - .createStringModelFragment(); - final MApplicationElement e = (MApplicationElement) EcoreUtil.copy((EObject) moe); - final String featurename = ((EObject) moe).eContainmentFeature().getName(); - createStringModelFragment.setParentElementId(((MApplicationElement) ((EObject) moe).eContainer()) - .getElementId()); - createStringModelFragment.getElements().add(e); - createStringModelFragment.setFeaturename(featurename); - - createModelFragments.getFragments().add(createStringModelFragment); - } - return (EObject) createModelFragments; - } - - public void setup(IProject project) { - init(PlatformUI.getWorkbench(), new StructuredSelection(project)); - } - - @Override - protected NewModelFilePage createWizardPage(ISelection selection) { - return new NewModelFilePage(selection, getDefaultFileName()); - } - - @Override - protected void adjustDependencies(IFile file) { - super.adjustFragmentDependencies(file); - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewApplicationModelWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewApplicationModelWizard.java deleted file mode 100644 index 3af82800..00000000 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewApplicationModelWizard.java +++ /dev/null @@ -1,94 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.internal.tools.wizards.model; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.e4.internal.tools.Messages; -import org.eclipse.e4.ui.model.application.MAddon; -import org.eclipse.e4.ui.model.application.MApplication; -import org.eclipse.e4.ui.model.application.MApplicationFactory; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; - -public class NewApplicationModelWizard extends BaseApplicationModelWizard { - - @Override - public String getDefaultFileName() { - return "Application.e4xmi"; //$NON-NLS-1$ - } - - @Override - protected EObject createInitialModel() { - final MApplication application = MApplicationFactory.INSTANCE.createApplication(); - try { - application.setElementId(getModelFile().getProject().getName() + ".application"); //$NON-NLS-1$ - if (((ModelFilePageImpl) getPages()[0]).includeDefaultAddons.getSelection()) { - final String[][] addons = { - { - "org.eclipse.e4.core.commands.service", "bundleclass://org.eclipse.e4.core.commands/org.eclipse.e4.core.commands.CommandServiceAddon" }, //$NON-NLS-1$ //$NON-NLS-2$ - { - "org.eclipse.e4.ui.contexts.service", "bundleclass://org.eclipse.e4.ui.services/org.eclipse.e4.ui.services.ContextServiceAddon" }, //$NON-NLS-1$ //$NON-NLS-2$ - { - "org.eclipse.e4.ui.bindings.service", "bundleclass://org.eclipse.e4.ui.bindings/org.eclipse.e4.ui.bindings.BindingServiceAddon" }, //$NON-NLS-1$ //$NON-NLS-2$ - { - "org.eclipse.e4.ui.workbench.commands.model", "bundleclass://org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.CommandProcessingAddon" }, //$NON-NLS-1$ //$NON-NLS-2$ - { - "org.eclipse.e4.ui.workbench.contexts.model", "bundleclass://org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.ContextProcessingAddon" }, //$NON-NLS-1$ //$NON-NLS-2$ - { - "org.eclipse.e4.ui.workbench.bindings.model", "bundleclass://org.eclipse.e4.ui.workbench.swt/org.eclipse.e4.ui.workbench.swt.util.BindingProcessingAddon" }, //$NON-NLS-1$ //$NON-NLS-2$ - { - "org.eclipse.e4.ui.workbench.handler.model", "bundleclass://org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.HandlerProcessingAddon" } //$NON-NLS-1$ //$NON-NLS-2$ - - }; - - for (final String[] a : addons) { - final MAddon addon = MApplicationFactory.INSTANCE.createAddon(); - addon.setElementId(a[0]); - addon.setContributionURI(a[1]); - application.getAddons().add(addon); - } - } - } catch (final CoreException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return (EObject) application; - } - - @Override - protected NewModelFilePage createWizardPage(ISelection selection) { - return new ModelFilePageImpl(selection, getDefaultFileName()); - } - - static class ModelFilePageImpl extends NewModelFilePage { - - private Button includeDefaultAddons; - - public ModelFilePageImpl(ISelection selection, String defaultFilename) { - super(selection, defaultFilename); - } - - @Override - protected void createAdditionalControls(Composite parent) { - super.createAdditionalControls(parent); - - new Label(parent, SWT.NONE); - - includeDefaultAddons = new Button(parent, SWT.CHECK); - includeDefaultAddons.setText(Messages.NewApplicationModelWizard_IncludeDefaultAddons); - includeDefaultAddons.setSelection(true); - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewContributionModelWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewContributionModelWizard.java deleted file mode 100644 index 076f4737..00000000 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewContributionModelWizard.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010-2014 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Marco Descher <marco@descher.at> - Bug 392907, Bug 434371 - ******************************************************************************/ -package org.eclipse.e4.internal.tools.wizards.model; - -import org.eclipse.core.resources.IFile; -import org.eclipse.e4.ui.model.fragment.MFragmentFactory; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jface.viewers.ISelection; - -public class NewContributionModelWizard extends BaseApplicationModelWizard { - - @Override - public String getDefaultFileName() { - return "fragment.e4xmi"; //$NON-NLS-1$ - } - - @Override - protected EObject createInitialModel() { - return (EObject) MFragmentFactory.INSTANCE.createModelFragments(); - } - - @Override - protected NewModelFilePage createWizardPage(ISelection selection) { - return new NewModelFilePage(selection, getDefaultFileName()); - } - - @Override - protected void adjustDependencies(IFile file) { - super.adjustFragmentDependencies(file); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewModelFilePage.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewModelFilePage.java deleted file mode 100644 index 00dc0e1e..00000000 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/model/NewModelFilePage.java +++ /dev/null @@ -1,224 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.internal.tools.wizards.model; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.Path; -import org.eclipse.e4.internal.tools.Messages; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jface.dialogs.IDialogPage; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.window.Window; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.dialogs.ContainerSelectionDialog; - -/** - * The "New" wizard page allows setting the container for the new file as well - * as the file name. The page will only accept file name without the extension - * OR with the extension that matches the expected one (e4xmi). - */ - -public class NewModelFilePage extends WizardPage { - private Text containerText; - - private Text fileText; - - private final ISelection selection; - - private final String defaultFilename; - - /** - * Constructor for SampleNewWizardPage. - * - */ - public NewModelFilePage(ISelection selection, String defaultFilename) { - super("wizardPage"); //$NON-NLS-1$ - setTitle(Messages.NewModelFilePage_NewApplicationModel); - setDescription(Messages.NewModelFilePage_TheWizardCreates); - this.selection = selection; - this.defaultFilename = defaultFilename; - } - - /** - * @see IDialogPage#createControl(Composite) - */ - @Override - public void createControl(Composite parent) { - final Composite container = new Composite(parent, SWT.NULL); - final GridLayout layout = new GridLayout(); - container.setLayout(layout); - layout.numColumns = 3; - layout.verticalSpacing = 9; - Label label = new Label(container, SWT.NULL); - label.setText(Messages.NewModelFilePage_Container); - - containerText = new Text(container, SWT.BORDER | SWT.SINGLE); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - containerText.setLayoutData(gd); - containerText.addModifyListener(new ModifyListener() { - @Override - public void modifyText(ModifyEvent e) { - dialogChanged(); - } - }); - - final Button button = new Button(container, SWT.PUSH); - button.setText(Messages.NewModelFilePage_Browse); - button.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - handleBrowse(); - } - }); - label = new Label(container, SWT.NULL); - label.setText(Messages.NewModelFilePage_FileName); - - fileText = new Text(container, SWT.BORDER | SWT.SINGLE); - gd = new GridData(GridData.FILL_HORIZONTAL); - fileText.setLayoutData(gd); - fileText.addModifyListener(new ModifyListener() { - @Override - public void modifyText(ModifyEvent e) { - dialogChanged(); - } - }); - - new Label(container, SWT.NONE); - - createAdditionalControls(container); - initialize(); - dialogChanged(); - setControl(container); - } - - protected void createAdditionalControls(Composite parent) { - - } - - /** - * Tests if the current workbench selection is a suitable container to use. - */ - - private void initialize() { - if (selection != null && selection.isEmpty() == false - && selection instanceof IStructuredSelection) { - final IStructuredSelection ssel = (IStructuredSelection) selection; - if (ssel.size() > 1) { - return; - } - final Object obj = ssel.getFirstElement(); - - if (obj instanceof IResource) { - IContainer container; - if (obj instanceof IContainer) { - container = (IContainer) obj; - } else { - container = ((IResource) obj).getParent(); - } - containerText.setText(container.getFullPath().toString()); - } else if (obj instanceof IJavaProject) { - final IJavaProject container = (IJavaProject) obj; - try { - containerText.setText(container.getCorrespondingResource().getFullPath().toString()); - } catch (final JavaModelException e) { - e.printStackTrace(); - } - } - } - fileText.setText(defaultFilename); - } - - /** - * Uses the standard container selection dialog to choose the new value for - * the container field. - */ - - private void handleBrowse() { - final ContainerSelectionDialog dialog = new ContainerSelectionDialog( - getShell(), ResourcesPlugin.getWorkspace().getRoot(), false, - Messages.NewModelFilePage_SelectTheNewContainer); - if (dialog.open() == Window.OK) { - final Object[] result = dialog.getResult(); - if (result.length == 1) { - containerText.setText(((Path) result[0]).toString()); - } - } - } - - /** - * Ensures that both text fields are set. - */ - - private void dialogChanged() { - final IResource container = ResourcesPlugin.getWorkspace().getRoot() - .findMember(new Path(getContainerName())); - final String fileName = getFileName(); - - if (getContainerName().length() == 0) { - updateStatus(Messages.NewModelFilePage_FileContainerMustBeSpecified); - return; - } - if (container == null - || (container.getType() & (IResource.PROJECT | IResource.FOLDER)) == 0) { - updateStatus(Messages.NewModelFilePage_FileContainerMustExists); - return; - } - if (!container.isAccessible()) { - updateStatus(Messages.NewModelFilePage_ProjectMustBeWritable); - return; - } - if (fileName.length() == 0) { - updateStatus(Messages.NewModelFilePage_FileNameMustBeSpecified); - return; - } - if (fileName.replace('\\', '/').indexOf('/', 1) > 0) { - updateStatus(Messages.NewModelFilePage_FileNameMustBeValid); - return; - } - final int dotLoc = fileName.lastIndexOf('.'); - if (dotLoc != -1) { - final String ext = fileName.substring(dotLoc + 1); - if (ext.equalsIgnoreCase("e4xmi") == false) { //$NON-NLS-1$ - updateStatus(Messages.NewModelFilePage_FileExtensionMustBeE4XMI); - return; - } - } - updateStatus(null); - } - - private void updateStatus(String message) { - setErrorMessage(message); - setPageComplete(message == null); - } - - public String getContainerName() { - return containerText.getText(); - } - - public String getFileName() { - return fileText.getText(); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java deleted file mode 100644 index 715982ac..00000000 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java +++ /dev/null @@ -1,814 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2013 Soyatec(http://www.soyatec.com) and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Soyatec - initial API and implementation - * IBM Corporation - ongoing enhancements - * Sopot Cela - ongoing enhancements - * Lars Vogel - ongoing enhancements - * Wim Jongman - ongoing enhancements - * Steven Spungin - ongoing enhancements, Bug 438591 - *******************************************************************************/ -package org.eclipse.e4.internal.tools.wizards.project; - -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; -import java.net.URL; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Platform; -import org.eclipse.e4.internal.tools.Messages; -import org.eclipse.e4.ui.model.application.MAddon; -import org.eclipse.e4.ui.model.application.MApplication; -import org.eclipse.e4.ui.model.application.MApplicationFactory; -import org.eclipse.e4.ui.model.application.commands.MBindingContext; -import org.eclipse.e4.ui.model.application.commands.MBindingTable; -import org.eclipse.e4.ui.model.application.commands.MCommand; -import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; -import org.eclipse.e4.ui.model.application.commands.MHandler; -import org.eclipse.e4.ui.model.application.commands.MKeyBinding; -import org.eclipse.e4.ui.model.application.ui.advanced.MAdvancedFactory; -import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective; -import org.eclipse.e4.ui.model.application.ui.advanced.MPerspectiveStack; -import org.eclipse.e4.ui.model.application.ui.basic.MBasicFactory; -import org.eclipse.e4.ui.model.application.ui.basic.MPart; -import org.eclipse.e4.ui.model.application.ui.basic.MPartSashContainer; -import org.eclipse.e4.ui.model.application.ui.basic.MPartStack; -import org.eclipse.e4.ui.model.application.ui.basic.MTrimBar; -import org.eclipse.e4.ui.model.application.ui.basic.MTrimmedWindow; -import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem; -import org.eclipse.e4.ui.model.application.ui.menu.MHandledToolItem; -import org.eclipse.e4.ui.model.application.ui.menu.MMenu; -import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; -import org.eclipse.e4.ui.model.application.ui.menu.MToolBar; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.emf.ecore.xmi.XMLResource; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jface.dialogs.IDialogSettings; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.pde.core.build.IBuildEntry; -import org.eclipse.pde.core.plugin.IMatchRules; -import org.eclipse.pde.core.plugin.IPluginElement; -import org.eclipse.pde.core.plugin.IPluginExtension; -import org.eclipse.pde.core.plugin.IPluginModelBase; -import org.eclipse.pde.core.plugin.IPluginReference; -import org.eclipse.pde.internal.core.ICoreConstants; -import org.eclipse.pde.internal.core.build.WorkspaceBuildModel; -import org.eclipse.pde.internal.core.bundle.WorkspaceBundlePluginModel; -import org.eclipse.pde.internal.core.plugin.WorkspacePluginModelBase; -import org.eclipse.pde.internal.core.project.PDEProject; -import org.eclipse.pde.internal.core.util.CoreUtility; -import org.eclipse.pde.internal.ui.PDEPlugin; -import org.eclipse.pde.internal.ui.wizards.IProjectProvider; -import org.eclipse.pde.internal.ui.wizards.plugin.NewPluginProjectWizard; -import org.eclipse.pde.internal.ui.wizards.plugin.NewProjectCreationOperation; -import org.eclipse.pde.internal.ui.wizards.plugin.PluginFieldData; -import org.eclipse.pde.ui.IBundleContentWizard; -import org.eclipse.pde.ui.IFieldData; -import org.eclipse.pde.ui.templates.PluginReference; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.IWorkingSet; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.part.FileEditorInput; -import org.osgi.framework.Bundle; -import org.osgi.framework.Version; - -/** - * @author jin.liu (jin.liu@soyatec.com) - */ -@SuppressWarnings("restriction") -public class E4NewProjectWizard extends NewPluginProjectWizard { - - private static final String NAME = "name"; //$NON-NLS-1$ - private static final String APPLICATION = "application"; //$NON-NLS-1$ - private static final String PRODUCT = "product"; //$NON-NLS-1$ - private static final String TRUE = "TRUE"; //$NON-NLS-1$ - private static final String PLUGIN_XML = "plugin.xml"; //$NON-NLS-1$ - private static final String MODEL_EDITOR_ID = "org.eclipse.e4.tools.emf.editor3x.e4wbm"; //$NON-NLS-1$ - private static final String APPLICATION_MODEL = "Application.e4xmi"; //$NON-NLS-1$ - private final PluginFieldData fPluginData; - private NewApplicationWizardPage fApplicationPage; - private IProjectProvider fProjectProvider; - private PluginContentPage fContentPage; - private boolean isMinimalist; - - public E4NewProjectWizard() { - fPluginData = new PluginFieldData(); - } - - @Override - public void addPages() { - fMainPage = new E4NewProjectWizardPage("main", fPluginData, false, getSelection()); //$NON-NLS-1$ - fMainPage.setTitle(""); //$NON-NLS-1$ - fMainPage.setDescription(""); //$NON-NLS-1$ - final String pname = getDefaultValue(DEF_PROJECT_NAME); - if (pname != null) { - fMainPage.setInitialProjectName(pname); - } - addPage(fMainPage); - - fProjectProvider = new IProjectProvider() { - @Override - public String getProjectName() { - return fMainPage.getProjectName(); - } - - @Override - public IProject getProject() { - return fMainPage.getProjectHandle(); - } - - @Override - public IPath getLocationPath() { - return fMainPage.getLocationPath(); - } - }; - - fContentPage = new PluginContentPage("page2", fProjectProvider, fMainPage, fPluginData); //$NON-NLS-1$ - - fApplicationPage = new NewApplicationWizardPage(fProjectProvider, - fPluginData); - - addPage(fContentPage); - addPage(fApplicationPage); - } - - @Override - public boolean performFinish() { - try { - fMainPage.updateData(); - fContentPage.updateData(); - final IDialogSettings settings = getDialogSettings(); - if (settings != null) { - fMainPage.saveSettings(settings); - fContentPage.saveSettings(settings); - } - - // Create the project - getContainer().run( - false, - true, - new NewProjectCreationOperation(fPluginData, - fProjectProvider, new ContentWizard())); - - // Add Project to working set - final IWorkingSet[] workingSets = fMainPage.getSelectedWorkingSets(); - if (workingSets.length > 0) { - getWorkbench().getWorkingSetManager().addToWorkingSets( - fProjectProvider.getProject(), workingSets); - } - - createProductsExtension(fProjectProvider.getProject()); - - createApplicationResources(fProjectProvider.getProject(), - new NullProgressMonitor()); - - // Add the resources to build.properties - adjustBuildPropertiesFile(fProjectProvider.getProject()); - - // Open the model editor - openEditorForApplicationModel(); - - return true; - } catch (final InvocationTargetException e) { - PDEPlugin.logException(e); - } catch (final InterruptedException e) { - } catch (final CoreException e) { - PDEPlugin.logException(e); - } - return false; - } - - /** - * Opens the model editor after the project was created. - * - * @throws PartInitException - */ - private void openEditorForApplicationModel() throws PartInitException { - final IFile file = fProjectProvider.getProject().getFile(APPLICATION_MODEL); - if (file != null) { - final FileEditorInput input = new FileEditorInput(file); - final IWorkbenchWindow window = PlatformUI.getWorkbench() - .getActiveWorkbenchWindow(); - final IWorkbenchPage page = window.getActivePage(); - page.openEditor(input, MODEL_EDITOR_ID); - } - } - - /** - * Adds other resources to the build.properties file. - * - * @param project - * @throws CoreException - */ - private void adjustBuildPropertiesFile(IProject project) - throws CoreException { - final IFile file = PDEProject.getBuildProperties(project); - if (file.exists()) { - final WorkspaceBuildModel model = new WorkspaceBuildModel(file); - final IBuildEntry e = model.getBuild().getEntry(IBuildEntry.BIN_INCLUDES); - - e.addToken(PLUGIN_XML); - e.addToken(APPLICATION_MODEL); - - // Event though an icons directory is always created - // it seems appropriate to only add it if it contains - // some content - if (!isMinimalist) { - e.addToken("icons/"); //$NON-NLS-1$ - } - - final Map<String, String> map = fApplicationPage.getData(); - final String cssEntry = map - .get(NewApplicationWizardPage.APPLICATION_CSS_PROPERTY); - if (cssEntry != null) { - e.addToken(cssEntry); - } - - model.save(); - } - } - - /** - * create products extension detail - * - * @param project - */ - public void createProductsExtension(IProject project) { - final Map<String, String> map = fApplicationPage.getData(); - if (map == null - || map.get(NewApplicationWizardPage.PRODUCT_NAME) == null) { - return; - } - - final WorkspacePluginModelBase fmodel = new WorkspaceBundlePluginModel( - project.getFile(ICoreConstants.BUNDLE_FILENAME_DESCRIPTOR), - project.getFile(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR)); - final IPluginExtension extension = fmodel.getFactory().createExtension(); - try { - final String productName = map.get(NewApplicationWizardPage.PRODUCT_NAME); - final String applicationName = map - .get(NewApplicationWizardPage.APPLICATION); - - String cssValue = map - .get(NewApplicationWizardPage.APPLICATION_CSS_PROPERTY); - if (cssValue != null) { - cssValue = "platform:/plugin/" + fPluginData.getId() + "/" //$NON-NLS-1$ //$NON-NLS-2$ - + cssValue; - map.put(NewApplicationWizardPage.APPLICATION_CSS_PROPERTY, - cssValue); - } - - if (TRUE.equals(map.get(NewApplicationWizardPage.generateLifecycle))) { - String lifeCycleValue = map - .get(NewApplicationWizardPage.generateLifecycleName); - if (lifeCycleValue != null && lifeCycleValue.isEmpty() == false) { - lifeCycleValue = "bundleclass://" + fPluginData.getId() + "/" //$NON-NLS-1$ //$NON-NLS-2$ - + fPluginData.getId().toLowerCase() + "." + lifeCycleValue; //$NON-NLS-1$ - map.put(NewApplicationWizardPage.LIFECYCLE_URI_PROPERTY, - lifeCycleValue); - } - } - - extension.setPoint("org.eclipse.core.runtime.products"); //$NON-NLS-1$ - extension.setId(PRODUCT); - final IPluginElement productElement = fmodel.getFactory().createElement( - extension); - - productElement.setName(PRODUCT); - if (applicationName != null) { - productElement.setAttribute(APPLICATION, applicationName); - } else { - productElement.setAttribute(APPLICATION, - NewApplicationWizardPage.E4_APPLICATION); - } - productElement.setAttribute(NAME, productName); - - final Set<Entry<String, String>> set = map.entrySet(); - if (set != null) { - final Iterator<Entry<String, String>> it = set.iterator(); - if (it != null) { - while (it.hasNext()) { - final Entry<String, String> entry = it.next(); - final String value = entry.getValue(); - if (value == null || value.trim().length() == 0) { - continue; - } - - if (entry.getKey().equals( - NewApplicationWizardPage.PRODUCT_NAME) - || entry.getKey().equals( - NewApplicationWizardPage.APPLICATION) - || entry.getKey().equals( - NewApplicationWizardPage.richSample) - || entry.getKey().equals( - NewApplicationWizardPage.generateLifecycle) - || entry.getKey().equals( - NewApplicationWizardPage.generateLifecycleName) - || entry.getKey() - .equals(NewApplicationWizardPage.CLEAR_PERSISTED_STATE)) { - continue; - } - final IPluginElement element = fmodel.getFactory() - .createElement(productElement); - element.setName("property"); //$NON-NLS-1$ - element.setAttribute(NAME, entry.getKey()); - element.setAttribute("value", value); //$NON-NLS-1$ - productElement.add(element); - } - } - } - extension.add(productElement); - fmodel.getPluginBase().add(extension); - fmodel.save(); - - } catch (final CoreException e) { - PDEPlugin.logException(e); - } - } - - /** - * create products extension detail - * - * @param project - */ - public void createApplicationResources(IProject project, - IProgressMonitor monitor) { - final Map<String, String> map = fApplicationPage.getData(); - if (map == null - || map.get(NewApplicationWizardPage.PRODUCT_NAME) == null) { - return; - } - isMinimalist = !map.get(NewApplicationWizardPage.richSample) - .equalsIgnoreCase(TRUE); - - // If the project has invalid characters, the plug-in name would replace - // them with underscores, product name does the same - final String pluginName = fPluginData.getId(); - - // BEGIN Generate E4Lifecycle class with annotations - final boolean lifeCycleCreated = TRUE.equals(map.get(NewApplicationWizardPage.generateLifecycle)); - if (lifeCycleCreated) { - final String classname = fPluginData.getId() + "." //$NON-NLS-1$ - + map.get(NewApplicationWizardPage.generateLifecycleName); - final LifeCycleClassCodeGenerator fGenerator = new LifeCycleClassCodeGenerator(project, classname, - fPluginData); - try { - fGenerator.generate(new NullProgressMonitor()); - } catch (final CoreException e2) { - e2.printStackTrace(); - } - } - // END Generate E4Lifecycle class with annotations - - // If there's no Activator or LifeCycle created we create default package - if (!fPluginData.doGenerateClass() && !lifeCycleCreated) { - final String packageName = fPluginData.getId(); - IPath path = new Path(packageName.replace('.', '/')); - if (fPluginData.getSourceFolderName().trim().length() > 0) { - path = new Path(fPluginData.getSourceFolderName()).append(path); - } - - try { - CoreUtility.createFolder(project.getFolder(path)); - } catch (final CoreException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - final IJavaProject javaProject = JavaCore.create(project); - IPackageFragment fragment = null; - - try { - for (final IPackageFragment element : javaProject.getPackageFragments()) { - if (element.getKind() == IPackageFragmentRoot.K_SOURCE) { - fragment = element; - } - } - } catch (final JavaModelException e1) { - e1.printStackTrace(); - } - - createApplicationModel(project, pluginName, fragment); - - final String cssPath = map - .get(NewApplicationWizardPage.APPLICATION_CSS_PROPERTY); - if (cssPath != null && cssPath.trim().length() > 0) { - final IFile file = project.getFile(cssPath); - - try { - prepareFolder(file.getParent(), monitor); - - final URL corePath = ResourceLocator - .getProjectTemplateFiles("css/default.css"); //$NON-NLS-1$ - file.create(corePath.openStream(), true, monitor); - } catch (final Exception e) { - PDEPlugin.logException(e); - } - } - - final String template_id = "common"; //$NON-NLS-1$ - final Set<String> binaryExtentions = new HashSet<String>(); - binaryExtentions.add(".gif"); //$NON-NLS-1$ - binaryExtentions.add(".png"); //$NON-NLS-1$ - - final Map<String, String> keys = new HashMap<String, String>(); - keys.put("projectName", pluginName); //$NON-NLS-1$ - keys.put("productFileName", //$NON-NLS-1$ - map.get(NewApplicationWizardPage.PRODUCT_NAME)); - final String elementName = fragment.getElementName(); - keys.put("packageName", (elementName.equals("") ? "" : elementName //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - + ".") //$NON-NLS-1$ - + "handlers"); //$NON-NLS-1$ - keys.put("packageName2", (elementName.equals("") ? "" : elementName //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - + ".") //$NON-NLS-1$ - + "parts"); //$NON-NLS-1$ - keys.put("programArgs", //$NON-NLS-1$ - "true".equalsIgnoreCase(map //$NON-NLS-1$ - .get(NewApplicationWizardPage.CLEAR_PERSISTED_STATE)) ? "-clearPersistedState" //$NON-NLS-1$ - : ""); //$NON-NLS-1$ - try { - final URL corePath = ResourceLocator.getProjectTemplateFiles(template_id); - final IRunnableWithProgress op = new TemplateOperation(corePath, project, - keys, binaryExtentions, isMinimalist); - getContainer().run(false, true, op); - } catch (final Exception e) { - PDEPlugin.logException(e); - } - if (!isMinimalist) { - try { - final URL corePath = ResourceLocator.getProjectTemplateFiles("src"); //$NON-NLS-1$ - final IRunnableWithProgress op = new TemplateOperation(corePath, - (IContainer) fragment.getResource(), keys, - binaryExtentions, isMinimalist); - getContainer().run(false, true, op); - } catch (final Exception e) { - PDEPlugin.logException(e); - } - } - } - - private void createApplicationModel(IProject project, String pluginName, - IPackageFragment fragment) { - final Map<String, String> map = fApplicationPage.getData(); - final boolean isMinimalist = !map.get(NewApplicationWizardPage.richSample) - .equalsIgnoreCase(TRUE); - if (APPLICATION_MODEL != null && APPLICATION_MODEL.trim().length() > 0) { - - // Create a resource set - // - final ResourceSet resourceSet = new ResourceSetImpl(); - - // Get the URI of the model file. - // - final URI fileURI = URI.createPlatformResourceURI(project.getName() + "/" //$NON-NLS-1$ - + APPLICATION_MODEL, true); - - // Create a resource for this file. - // - final Resource resource = resourceSet.createResource(fileURI); - - final MApplication application = MApplicationFactory.INSTANCE - .createApplication(); - - application.setElementId("org.eclipse.e4.ide.application"); //$NON-NLS-1$ - - MAddon addon = MApplicationFactory.INSTANCE.createAddon(); - addon.setElementId("org.eclipse.e4.core.commands.service"); //$NON-NLS-1$ - addon - .setContributionURI("bundleclass://org.eclipse.e4.core.commands/org.eclipse.e4.core.commands.CommandServiceAddon"); //$NON-NLS-1$ - application.getAddons().add(addon); - - addon = MApplicationFactory.INSTANCE.createAddon(); - addon.setElementId("org.eclipse.e4.ui.contexts.service"); //$NON-NLS-1$ - addon - .setContributionURI("bundleclass://org.eclipse.e4.ui.services/org.eclipse.e4.ui.services.ContextServiceAddon"); //$NON-NLS-1$ - application.getAddons().add(addon); - - addon = MApplicationFactory.INSTANCE.createAddon(); - addon.setElementId("org.eclipse.e4.ui.bindings.service"); //$NON-NLS-1$ - addon - .setContributionURI("bundleclass://org.eclipse.e4.ui.bindings/org.eclipse.e4.ui.bindings.BindingServiceAddon"); //$NON-NLS-1$ - application.getAddons().add(addon); - - addon = MApplicationFactory.INSTANCE.createAddon(); - addon.setElementId("org.eclipse.e4.ui.workbench.commands.model"); //$NON-NLS-1$ - addon - .setContributionURI("bundleclass://org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.CommandProcessingAddon"); //$NON-NLS-1$ - application.getAddons().add(addon); - - addon = MApplicationFactory.INSTANCE.createAddon(); - addon.setElementId("org.eclipse.e4.ui.workbench.handler.model"); //$NON-NLS-1$ - addon - .setContributionURI("bundleclass://org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.HandlerProcessingAddon"); //$NON-NLS-1$ - application.getAddons().add(addon); - - addon = MApplicationFactory.INSTANCE.createAddon(); - addon.setElementId("org.eclipse.e4.ui.workbench.contexts.model"); //$NON-NLS-1$ - addon - .setContributionURI("bundleclass://org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.ContextProcessingAddon"); //$NON-NLS-1$ - application.getAddons().add(addon); - - addon = MApplicationFactory.INSTANCE.createAddon(); - addon.setElementId("org.eclipse.e4.ui.workbench.bindings.model"); //$NON-NLS-1$ - addon - .setContributionURI("bundleclass://org.eclipse.e4.ui.workbench.swt/org.eclipse.e4.ui.workbench.swt.util.BindingProcessingAddon"); //$NON-NLS-1$ - application.getAddons().add(addon); - final MTrimmedWindow mainWindow = MBasicFactory.INSTANCE - .createTrimmedWindow(); - application.getChildren().add(mainWindow); - mainWindow.setLabel(pluginName); - mainWindow.setWidth(500); - mainWindow.setHeight(400); - resource.getContents().add((EObject) application); - final MBindingContext rootContext = MCommandsFactory.INSTANCE - .createBindingContext(); - rootContext.setElementId("org.eclipse.ui.contexts.dialogAndWindow"); //$NON-NLS-1$ - rootContext.setName(Messages.E4NewProjectWizard_InDialogsAndWindows); - - MBindingContext childContext = MCommandsFactory.INSTANCE - .createBindingContext(); - childContext.setElementId("org.eclipse.ui.contexts.window"); //$NON-NLS-1$ - childContext.setName(Messages.E4NewProjectWizard_InWindows); - rootContext.getChildren().add(childContext); - - childContext = MCommandsFactory.INSTANCE.createBindingContext(); - childContext.setElementId("org.eclipse.ui.contexts.dialog"); //$NON-NLS-1$ - childContext.setName(Messages.E4NewProjectWizard_InDialogs); - rootContext.getChildren().add(childContext); - - application.getRootContext().add(rootContext); - application.getBindingContexts().add(rootContext); - if (!isMinimalist) { - - // Create Quit command - final MCommand quitCommand = createCommand("org.eclipse.ui.file.exit", "quitCommand", //$NON-NLS-1$ //$NON-NLS-2$ - "QuitHandler", "M1+Q", pluginName, fragment, //$NON-NLS-1$ //$NON-NLS-2$ - application); - - final MCommand openCommand = createCommand(pluginName + ".open", //$NON-NLS-1$ - "openCommand", "OpenHandler", "M1+O", pluginName, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - fragment, application); - - final MCommand saveCommand = createCommand("org.eclipse.ui.file.save", "saveCommand", //$NON-NLS-1$ //$NON-NLS-2$ - "SaveHandler", "M1+S", pluginName, fragment, //$NON-NLS-1$ //$NON-NLS-2$ - application); - - final MCommand aboutCommand = createCommand("org.eclipse.ui.help.aboutAction", "aboutCommand", //$NON-NLS-1$ //$NON-NLS-2$ - "AboutHandler", "M1+A", pluginName, fragment, //$NON-NLS-1$//$NON-NLS-2$ - application); - - final MMenu menu = MMenuFactory.INSTANCE.createMenu(); - mainWindow.setMainMenu(menu); - menu.setElementId("menu:org.eclipse.ui.main.menu"); //$NON-NLS-1$ - - final MMenu fileMenuItem = MMenuFactory.INSTANCE.createMenu(); - menu.getChildren().add(fileMenuItem); - fileMenuItem.setLabel(Messages.E4NewProjectWizard_File); - { - final MHandledMenuItem menuItemOpen = MMenuFactory.INSTANCE - .createHandledMenuItem(); - fileMenuItem.getChildren().add(menuItemOpen); - menuItemOpen.setLabel(Messages.E4NewProjectWizard_Open); - menuItemOpen.setIconURI("platform:/plugin/" + pluginName //$NON-NLS-1$ - + "/icons/sample.png"); //$NON-NLS-1$ - menuItemOpen.setCommand(openCommand); - - final MHandledMenuItem menuItemSave = MMenuFactory.INSTANCE - .createHandledMenuItem(); - fileMenuItem.getChildren().add(menuItemSave); - menuItemSave.setLabel(Messages.E4NewProjectWizard_Save); - menuItemSave.setIconURI("platform:/plugin/" + pluginName //$NON-NLS-1$ - + "/icons/save_edit.png"); //$NON-NLS-1$ - menuItemSave.setCommand(saveCommand); - - final MHandledMenuItem menuItemQuit = MMenuFactory.INSTANCE - .createHandledMenuItem(); - fileMenuItem.getChildren().add(menuItemQuit); - menuItemQuit.setLabel(Messages.E4NewProjectWizard_Quit); - menuItemQuit.setCommand(quitCommand); - } - final MMenu helpMenuItem = MMenuFactory.INSTANCE.createMenu(); - menu.getChildren().add(helpMenuItem); - helpMenuItem.setLabel(Messages.E4NewProjectWizard_Help); - { - final MHandledMenuItem menuItemAbout = MMenuFactory.INSTANCE - .createHandledMenuItem(); - helpMenuItem.getChildren().add(menuItemAbout); - menuItemAbout.setLabel(Messages.E4NewProjectWizard_About); - menuItemAbout.setCommand(aboutCommand); - } - - // PerspectiveStack - final MPerspectiveStack perspectiveStack = MAdvancedFactory.INSTANCE - .createPerspectiveStack(); - mainWindow.getChildren().add(perspectiveStack); - - final MPerspective perspective = MAdvancedFactory.INSTANCE - .createPerspective(); - perspectiveStack.getChildren().add(perspective); - { - // Part Container - final MPartSashContainer partSashContainer = MBasicFactory.INSTANCE - .createPartSashContainer(); - perspective.getChildren().add(partSashContainer); - - final MPartStack partStack = MBasicFactory.INSTANCE - .createPartStack(); - partSashContainer.getChildren().add(partStack); - - final MPart part = MBasicFactory.INSTANCE.createPart(); - partStack.getChildren().add(part); - part.setLabel(Messages.E4NewProjectWizard_SamplePart); - part.setContributionURI("bundleclass://" + pluginName + "/" //$NON-NLS-1$ //$NON-NLS-2$ - + fragment.getElementName() + ".parts" //$NON-NLS-1$ - + ".SamplePart"); //$NON-NLS-1$ - - } - - // WindowTrim - final MTrimBar trimBar = MBasicFactory.INSTANCE.createTrimBar(); - mainWindow.getTrimBars().add(trimBar); - - final MToolBar toolBar = MMenuFactory.INSTANCE.createToolBar(); - toolBar.setElementId("toolbar:org.eclipse.ui.main.toolbar"); //$NON-NLS-1$ - trimBar.getChildren().add(toolBar); - - final MHandledToolItem toolItemOpen = MMenuFactory.INSTANCE - .createHandledToolItem(); - toolBar.getChildren().add(toolItemOpen); - toolItemOpen.setIconURI("platform:/plugin/" + pluginName //$NON-NLS-1$ - + "/icons/sample.png"); //$NON-NLS-1$ - toolItemOpen.setCommand(openCommand); - - final MHandledToolItem toolItemSave = MMenuFactory.INSTANCE - .createHandledToolItem(); - toolBar.getChildren().add(toolItemSave); - toolItemSave.setIconURI("platform:/plugin/" + pluginName //$NON-NLS-1$ - + "/icons/save_edit.png"); //$NON-NLS-1$ - toolItemSave.setCommand(saveCommand); - } - final Map<Object, Object> options = new HashMap<Object, Object>(); - options.put(XMLResource.OPTION_ENCODING, "UTF-8"); //$NON-NLS-1$ - try { - resource.save(options); - } catch (final IOException e) { - PDEPlugin.logException(e); - - } - } - } - - private MCommand createCommand(String commandId, String name, - String className, String keyBinding, String projectName, - IPackageFragment fragment, MApplication application) { - final MCommand command = MCommandsFactory.INSTANCE.createCommand(); - command.setCommandName(name); - command.setElementId(commandId); - application.getCommands().add(command); - { - // Create handler for command - final MHandler handler = MCommandsFactory.INSTANCE.createHandler(); - handler.setCommand(command); - final String elementName = fragment.getElementName(); - handler.setContributionURI("bundleclass://" + projectName + "/" //$NON-NLS-1$ //$NON-NLS-2$ - + (elementName.equals("") ? "" : elementName + ".") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - + "handlers." + className); //$NON-NLS-1$ - handler.setElementId(projectName + ".handler." + name); //$NON-NLS-1$ - application.getHandlers().add(handler); - - // create binding for the command - final MKeyBinding binding = MCommandsFactory.INSTANCE.createKeyBinding(); - binding.setKeySequence(keyBinding); - binding.setCommand(command); - final List<MBindingTable> tables = application.getBindingTables(); - if (tables.size() == 0) { - MBindingContext rootContext = null; - if (application.getRootContext().size() > 0) { - rootContext = application.getRootContext().get(0); - } else { - rootContext = MCommandsFactory.INSTANCE - .createBindingContext(); - rootContext - .setElementId("org.eclipse.ui.contexts.dialogAndWindow"); //$NON-NLS-1$ - rootContext.setName(Messages.E4NewProjectWizard_InDialogsAndWindows); - application.getRootContext().add(rootContext); - } - final MBindingTable table = MCommandsFactory.INSTANCE - .createBindingTable(); - table.setBindingContext(rootContext); - tables.add(table); - } - tables.get(0).getBindings().add(binding); - } - return command; - } - - private void prepareFolder(IContainer container, IProgressMonitor monitor) - throws CoreException { - final IContainer parent = container.getParent(); - if (parent instanceof IFolder) { - prepareFolder(parent, monitor); - } - if (!container.exists() && container instanceof IFolder) { - final IFolder folder = (IFolder) container; - folder.create(true, true, monitor); - } - } - - @Override - public String getPluginId() { - return fPluginData.getId(); - } - - @Override - public String getPluginVersion() { - return fPluginData.getVersion(); - } - - private class ContentWizard extends Wizard implements IBundleContentWizard { - - String[] dependencies = new String[] { "javax.inject", //$NON-NLS-1$ - "org.eclipse.core.runtime", "org.eclipse.swt", //$NON-NLS-1$//$NON-NLS-2$ - "org.eclipse.e4.ui.model.workbench", "org.eclipse.jface", //$NON-NLS-1$ //$NON-NLS-2$ - "org.eclipse.e4.ui.services", "org.eclipse.e4.ui.workbench", //$NON-NLS-1$ //$NON-NLS-2$ - "org.eclipse.e4.core.di", "org.eclipse.e4.ui.di", //$NON-NLS-1$ //$NON-NLS-2$ - "org.eclipse.e4.core.contexts", }; //$NON-NLS-1$ - - @Override - public void init(IFieldData data) { - } - - @Override - public IPluginReference[] getDependencies(String schemaVersion) { - final ArrayList<IPluginReference> result = new ArrayList<IPluginReference>( - dependencies.length); - for (final String dependency : dependencies) { - final Bundle bundle = Platform.getBundle(dependency); - String versionString = "0.0.0"; //$NON-NLS-1$ - if (dependency != null) { - final Version version = bundle.getVersion(); - versionString = version.getMajor() + "." //$NON-NLS-1$ - + version.getMinor() + "." + version.getMicro(); //$NON-NLS-1$ - } - result.add(new PluginReference(dependency, versionString, - IMatchRules.GREATER_OR_EQUAL)); - } - return result.toArray(new IPluginReference[0]); - } - - @Override - public String[] getNewFiles() { - return new String[0]; - } - - @Override - public boolean performFinish(IProject project, IPluginModelBase model, - IProgressMonitor monitor) { - return true; - } - - @Override - public String[] getImportPackages() { - return new String[] {}; - } - - @Override - public boolean performFinish() { - return true; - } - - } -} diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizardPage.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizardPage.java deleted file mode 100644 index 00e7d07b..00000000 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizardPage.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Soyatec(http://www.soyatec.com) and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Soyatec - initial API and implementation - *******************************************************************************/ -package org.eclipse.e4.internal.tools.wizards.project; - -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.pde.internal.ui.wizards.plugin.AbstractFieldData; -import org.eclipse.swt.widgets.Composite; - -@SuppressWarnings("restriction") -public class E4NewProjectWizardPage extends org.eclipse.pde.internal.ui.wizards.plugin.NewProjectCreationPage { - - public E4NewProjectWizardPage(String pageName, AbstractFieldData data, boolean fragment, - IStructuredSelection selection) { - super(pageName, data, fragment, selection); - } - - @Override - public void createControl(Composite parent) { - super.createControl(parent); - fOSGIButton.setSelection(true); - fEclipseButton.setSelection(false); - fEclipseButton.setEnabled(false); - fEclipseCombo.setEnabled(false); - } -} diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/LifeCycleClassCodeGenerator.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/LifeCycleClassCodeGenerator.java deleted file mode 100644 index 5c803e1b..00000000 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/LifeCycleClassCodeGenerator.java +++ /dev/null @@ -1,127 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation - *******************************************************************************/ - -package org.eclipse.e4.internal.tools.wizards.project; - -import java.io.BufferedReader; -import java.io.ByteArrayInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.PrintWriter; -import java.io.StringWriter; -import java.net.URL; -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.pde.internal.core.util.CoreUtility; -import org.eclipse.pde.internal.ui.wizards.plugin.PluginFieldData; -import org.osgi.framework.FrameworkUtil; - -@SuppressWarnings("restriction") -public class LifeCycleClassCodeGenerator { - private static final String PACKAGE_DECLARATION = "PACKAGE_DECLARATION"; //$NON-NLS-1$ - private final PluginFieldData fPluginData; - private final IProject fProject; - private final String fQualifiedClassName; - - public LifeCycleClassCodeGenerator(IProject project, String qualifiedClassName, PluginFieldData data) { - fProject = project; - fQualifiedClassName = qualifiedClassName; - fPluginData = data; - - } - - public IFile generate(IProgressMonitor monitor) throws CoreException { - final int nameloc = fQualifiedClassName.lastIndexOf('.'); - String packageName = nameloc == -1 ? "" : fQualifiedClassName.substring(0, nameloc); //$NON-NLS-1$ - // CoreUtility.createFolder was throwing exception if Activator was already created with lower case package and - // this method called it with different case. - packageName = packageName.toLowerCase(); - final String className = fQualifiedClassName.substring(nameloc + 1); - - IPath path = new Path(packageName.replace('.', '/')); - if (fPluginData.getSourceFolderName().trim().length() > 0) { - path = new Path(fPluginData.getSourceFolderName()).append(path); - } - - CoreUtility.createFolder(fProject.getFolder(path)); - - final IFile file = fProject.getFile(path.append(className + ".java")); //$NON-NLS-1$ - final StringWriter swriter = new StringWriter(); - final PrintWriter writer = new PrintWriter(swriter); - generateClass(packageName, className, swriter); - writer.flush(); - - try { - swriter.close(); - final ByteArrayInputStream stream = new ByteArrayInputStream(swriter.toString().getBytes( - fProject.getDefaultCharset())); - if (file.exists()) { - file.setContents(stream, false, true, monitor); - } else { - file.create(stream, false, monitor); - } - stream.close(); - } catch (final Exception e) { - - } - return file; - } - - private void generateClass(String packageName, String className, StringWriter writer) { - - final Map<String, String> map = new HashMap<String, String>(); - if (packageName.equals("")) { //$NON-NLS-1$ - map.put(PACKAGE_DECLARATION, ""); //$NON-NLS-1$ - } else { - map.put(PACKAGE_DECLARATION, "package " + packageName + ";"); //$NON-NLS-1$ //$NON-NLS-2$ - } - map.put("PACKAGE_NAME", packageName); //$NON-NLS-1$ - map.put("CLASS_NAME", className); //$NON-NLS-1$ - - try { - String template = getResourceAsString(this.getClass(), "/templates/E4LifeCycle.java"); //$NON-NLS-1$ - template = SimpleTemplate.process(template, map); - writer.write(template); - } catch (final Exception e) { - e.printStackTrace(); - } - - } - - public static String getResourceAsString(Class<?> classInBundle, String templatePath) throws FileNotFoundException, - IOException { - final URL url = FrameworkUtil.getBundle(classInBundle).getResource(templatePath); - return readTextFile(url.openStream()); - } - - public static String readTextFile(InputStream stream) throws IOException, FileNotFoundException { - final StringBuilder sb = new StringBuilder(); - final BufferedReader reader = new BufferedReader(new InputStreamReader(stream)); - - final char[] chars = new char[1024]; - int numRead = 0; - while ((numRead = reader.read(chars)) > -1) { - sb.append(String.copyValueOf(chars, 0, numRead)); - } - - reader.close(); - return sb.toString(); - } -} diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/NewApplicationWizardPage.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/NewApplicationWizardPage.java deleted file mode 100644 index 71a85c99..00000000 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/NewApplicationWizardPage.java +++ /dev/null @@ -1,527 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2012 Soyatec (http://www.soyatec.com) and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Soyatec - initial API and implementation - * IBM Corporation - ongoing enhancements - * Lars Vogel, vogella GmbH - ongoing enhancements - * Sopot Cela - ongoing enhancements - * Steven Spungin - ongoing enhancements, Bug 438591 - *******************************************************************************/ -package org.eclipse.e4.internal.tools.wizards.project; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.internal.tools.Messages; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.pde.internal.ui.wizards.IProjectProvider; -import org.eclipse.pde.internal.ui.wizards.plugin.AbstractFieldData; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.events.VerifyEvent; -import org.eclipse.swt.events.VerifyListener; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.RGB; -import org.eclipse.swt.graphics.Rectangle; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.ColorDialog; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.branding.IProductConstants; - -/** - * @author jin.liu (jin.liu@soyatec.com) - */ -@SuppressWarnings("restriction") -public class NewApplicationWizardPage extends WizardPage { - private static final String TRUE = "TRUE"; //$NON-NLS-1$ - private static final String TRUESMALL = "true"; //$NON-NLS-1$ - private static final String FALSE = "FALSE"; //$NON-NLS-1$ - public static final String E4_APPLICATION = "org.eclipse.e4.ui.workbench.swt.E4Application"; //$NON-NLS-1$ - public static final String APPLICATION_CSS_PROPERTY = "applicationCSS"; //$NON-NLS-1$ - public static final String LIFECYCLE_URI_PROPERTY = "lifeCycleURI"; //$NON-NLS-1$ - public static final String PRODUCT_NAME = "productName"; //$NON-NLS-1$ - public static final String APPLICATION = "application"; //$NON-NLS-1$ - public static final String CLEAR_PERSISTED_STATE = "clearPersistedState"; //$NON-NLS-1$ - public static final String EOL = System.getProperty("line.separator"); //$NON-NLS-1$ - public static final String richSample = "RICH_SAMPLE"; //$NON-NLS-1$ - public static final String generateLifecycle = "GENERATE_LIFECYCLE"; //$NON-NLS-1$ - public static final String generateLifecycleName = "GENERATE_LIFECYCLE_NAME"; //$NON-NLS-1$ - - private final Map<String, String> data; - - private IProject project; - private final IProjectProvider projectProvider; - private Text proNameText; - private Group propertyGroup; - private final AbstractFieldData pluginData; - - private PropertyData[] PROPERTIES; - private Button richSampleCheckbox; - protected Button generateLifecycleClassCheckbox; - protected Text lifeCycleName; - - protected NewApplicationWizardPage(IProjectProvider projectProvider, - AbstractFieldData pluginData) { - super(Messages.NewApplicationWizardPage_NewE4ApplicationWizardPage); - this.projectProvider = projectProvider; - this.pluginData = pluginData; - data = new HashMap<String, String>(); - data.put(richSample, FALSE);// minimalist by default - setTitle(Messages.NewApplicationWizardPage_Eclipse4Application); - setMessage(Messages.NewApplicationWizardPage_ConfigureApplication); - } - - public IProject getProject() { - if (project == null && projectProvider != null) { - project = projectProvider.getProject(); - } - return project; - } - - public void setProject(IProject project) { - this.project = project; - } - - /* - * (non-Javadoc) - * @see - * org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets - * .Composite) - */ - @Override - public void createControl(Composite parent) { - final Composite control = new Composite(parent, SWT.NONE); - control.setLayout(new GridLayout()); - - final Group productGroup = createProductGroup(control); - productGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - propertyGroup = createPropertyGroup(control); - propertyGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - final Group templateGroup = createTemplateGroup(control); - templateGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - setControl(control); - } - - private Group createTemplateGroup(Composite parent) { - final Group group = new Group(parent, SWT.NONE); - group.setLayout(new GridLayout(3, false)); - group.setText(Messages.NewApplicationWizardPage_TemplateOption); - - richSampleCheckbox = new Button(group, SWT.CHECK); - - richSampleCheckbox.setSelection(false); - richSampleCheckbox.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - data.put(richSample, richSampleCheckbox.getSelection() ? TRUE : FALSE); - } - }); - richSampleCheckbox.setText(Messages.NewApplicationWizardPage_CreateSampleContent); - richSampleCheckbox.setLayoutData(new GridData(SWT.BEGINNING, SWT.TOP, false, false, 2, 1)); - - { - final SelectionListener listener = new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - lifeCycleName.setEnabled(generateLifecycleClassCheckbox.getSelection()); - data.put(generateLifecycle, generateLifecycleClassCheckbox.getSelection() ? TRUE : FALSE); - } - }; - - generateLifecycleClassCheckbox = new Button(group, SWT.CHECK); - generateLifecycleClassCheckbox.setSelection(false); - - generateLifecycleClassCheckbox.setText(Messages.NewApplicationWizardPage_AddLifecycleClass); - generateLifecycleClassCheckbox.setLayoutData(new GridData(SWT.BEGINNING, SWT.TOP, false, false, 2, 1)); - generateLifecycleClassCheckbox.addSelectionListener(listener); - - new Label(group, SWT.NONE); - final Label lbl = new Label(group, SWT.NONE); - lbl.setText(Messages.NewApplicationWizardPage_LifecycleClassName); - final GridData gd = new GridData(); - gd.horizontalIndent = 20; - lbl.setLayoutData(gd); - - lifeCycleName = new Text(group, SWT.BORDER); - lifeCycleName.setText(Messages.NewApplicationWizardPage_E4Lifecycle); - lifeCycleName.setEnabled(false); - lifeCycleName.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false)); - lifeCycleName.addModifyListener(new ModifyListener() { - - @Override - public void modifyText(ModifyEvent e) { - data.put(generateLifecycleName, lifeCycleName.getText()); - } - }); - data.put(generateLifecycleName, lifeCycleName.getText()); - } - return group; - } - - static class PropertyData { - private final String name; - private final String label; - private String extraTooltipInfo; - - private final String value; - private final Class<?> type; - private final boolean editable; - - public PropertyData(String name, String label, String value, - Class<?> type, boolean editable) { - this.name = name; - this.value = value; - this.label = label; - this.type = type; - this.editable = editable; - } - - public PropertyData(String name, String label, String value, - Class<?> type, boolean editable, String extraTooltipInfo) { - this.name = name; - this.value = value; - this.label = label; - this.type = type; - this.editable = editable; - this.extraTooltipInfo = extraTooltipInfo; - } - - public String getName() { - return name; - } - - public String getValue() { - return value; - } - - public Class<?> getType() { - return type; - } - - public boolean isEditable() { - return editable; - } - - public String getLabel() { - return label; - } - - public String getExtraTooltipInfo() { - return extraTooltipInfo; - } - - } - - private Group createPropertyGroup(Composite control) { - final Group group = new Group(control, SWT.NONE); - group.setText(Messages.NewApplicationWizardPage_Properties); - - group.setLayout(new GridLayout(3, false)); - - return group; - } - - private void createPropertyItem(final Composite parent, - final PropertyData property) { - - if (property.getType() == Boolean.class) { - final Button button = new Button(parent, SWT.CHECK); - button.setSelection(TRUESMALL.equalsIgnoreCase(property.getValue())); - button.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - handleCheckBoxEvent(property.getName(), - button.getSelection()); - } - }); - button.setText(property.getLabel()); - new Label(parent, SWT.NONE); - } else { - createLabelForField(parent, property); - final Text valueText = new Text(parent, SWT.BORDER); - valueText.setText(property.getValue()); - final GridData gridData = new GridData(GridData.FILL_HORIZONTAL); - valueText.setLayoutData(gridData); - if (!property.isEditable()) { - valueText.setEditable(false); - } - valueText.addListener(SWT.Modify, new Listener() { - @Override - public void handleEvent(Event event) { - handleTextEvent(property.getName(), valueText); - } - }); - - if (property.getType() == Color.class - || property.getType() == Rectangle.class) { - final Button button = new Button(parent, SWT.PUSH); - button.setText(Messages.NewApplicationWizardPage_Dots); - button.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - handleLinkEvent(property, valueText, parent.getShell()); - } - }); - } else { - new Label(parent, SWT.NONE); - } - } - data.put(property.getName(), property.getValue()); - } - - private void createLabelForField(final Composite parent, - final PropertyData property) { - final Label label = new Label(parent, SWT.NONE); - label.setText(property.getLabel()); - label.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_BLUE)); - label.setToolTipText(Messages.NewApplicationWizardPage_Property + property.getName() + "\""); //$NON-NLS-1$ - if (property.getExtraTooltipInfo() != null) { - label.setToolTipText(label.getToolTipText() + EOL - + property.getExtraTooltipInfo()); - } - } - - private void handleLinkEvent(PropertyData property, Text valueText, - Shell shell) { - if (property == null || valueText == null || valueText.isDisposed()) { - return; - } - if (property.getType() == Color.class) { - final ColorDialog colorDialog = new ColorDialog(shell); - final RGB selectRGB = colorDialog.open(); - if (selectRGB != null) { - valueText.setText((hexColorConvert(Integer - .toHexString(selectRGB.blue)) - + hexColorConvert(Integer - .toHexString(selectRGB.green)) + hexColorConvert(Integer.toHexString(selectRGB.red))) - .toUpperCase()); - } - } else if (property.getType() == Rectangle.class) { - createRectDialog(shell, valueText).open(); - } - } - - /** - * exchange the color pattern of hex numeric - * - * @param color - * @return the converted hex color - */ - public String hexColorConvert(String color) { - if (color.length() == 1) { - return "0" + color; //$NON-NLS-1$ - } - return color; - } - - /** - * create Rect Set dialog - * - * @param parent - * @param valueText - * @return a rect dialog - */ - public Dialog createRectDialog(final Composite parent, final Text valueText) { - return new Dialog(parent.getShell()) { - Text xPointText, yPointText, widthText, heightText; - - @Override - protected Button createButton(Composite parent, int id, - String label, boolean defaultButton) { - return super.createButton(parent, id, label, defaultButton); - } - - @Override - protected Control createDialogArea(final Composite parent) { - final Composite composite = (Composite) super - .createDialogArea(parent); - composite.getShell().setText(Messages.NewApplicationWizardPage_SetRectangle); - final Group group = new Group(composite, SWT.NONE); - group.setText(Messages.NewApplicationWizardPage_Rectangle); - final GridLayout gridLayout = new GridLayout(); - gridLayout.numColumns = 4; - group.setLayout(gridLayout); - - final Label xPointLabel = new Label(group, SWT.NONE); - xPointLabel.setText(Messages.NewApplicationWizardPage_X); - xPointText = new Text(group, SWT.BORDER); - final VerifyListener verifyListener = createVerifyListener(parent - .getShell()); - xPointText.addVerifyListener(verifyListener); - final Label yPointLabel = new Label(group, SWT.NONE); - yPointLabel.setText(Messages.NewApplicationWizardPage_Y); - yPointText = new Text(group, SWT.BORDER); - yPointText.addVerifyListener(verifyListener); - final Label widthLabel = new Label(group, SWT.NONE); - widthLabel.setText(Messages.NewApplicationWizardPage_Width); - widthText = new Text(group, SWT.BORDER); - widthText.addVerifyListener(verifyListener); - final Label heighttLabel = new Label(group, SWT.NONE); - heighttLabel.setText(Messages.NewApplicationWizardPage_Height); - heightText = new Text(group, SWT.BORDER); - heightText.addVerifyListener(verifyListener); - - return composite; - } - - @Override - protected void buttonPressed(int buttonId) { - if (IDialogConstants.OK_ID == buttonId) { - final String xPoint = xPointText.getText(); - final String yPoint = yPointText.getText(); - final String width = widthText.getText(); - final String height = heightText.getText(); - if (xPoint.length() == 0 || yPoint.length() == 0 - || width.length() == 0 || height.length() == 0) { - MessageDialog.openWarning(parent.getShell(), - Messages.NewApplicationWizardPage_InputValueEmpty, - Messages.NewApplicationWizardPage_ValueShouldNotBeEmpty); - } else { - valueText.setText(xPoint + "," + yPoint + "," + width //$NON-NLS-1$ //$NON-NLS-2$ - + "," + height); //$NON-NLS-1$ - okPressed(); - } - } else if (IDialogConstants.CANCEL_ID == buttonId) { - cancelPressed(); - } - } - }; - } - - /** - * create verify Listener - * - * @param shell - * @return a new verify listener - */ - public VerifyListener createVerifyListener(final Shell shell) { - return new VerifyListener() { - @Override - public void verifyText(VerifyEvent e) { - final char c = e.character; - if ("0123456789".indexOf(c) == -1) { //$NON-NLS-1$ - e.doit = false; - MessageDialog.openWarning(shell, Messages.NewApplicationWizardPage_InputValueError, - Messages.NewApplicationWizardPage_OnlyNumericValues); - return; - } - } - }; - } - - private void handleTextEvent(String property, Text valueText) { - if (property == null || valueText == null || valueText.isDisposed()) { - return; - } - String value = valueText.getText(); - if (value.equals("")) { //$NON-NLS-1$ - value = null; - } - data.put(property, value); - } - - protected void handleCheckBoxEvent(String property, boolean selection) { - if (property == null) { - return; - } - data.put(property, Boolean.toString(selection)); - } - - private Group createProductGroup(Composite control) { - final Group proGroup = new Group(control, SWT.NONE); - proGroup.setText(Messages.NewApplicationWizardPage_Product); - - proGroup.setLayout(new GridLayout(2, false)); - - final Label proNameLabel = new Label(proGroup, SWT.NONE); - proNameLabel.setText(Messages.NewApplicationWizardPage_Name); - - proNameText = new Text(proGroup, SWT.BORDER); - proNameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - proNameText.addListener(SWT.Modify, new Listener() { - @Override - public void handleEvent(Event event) { - handleTextEvent(PRODUCT_NAME, proNameText); - } - }); - return proGroup; - } - - protected PropertyData[] getPropertyData() { - if (PROPERTIES == null) { - PROPERTIES = new PropertyData[] { - new PropertyData(APPLICATION_CSS_PROPERTY, Messages.NewApplicationWizardPage_CSSStyle, - "css/default.css", String.class, true), //$NON-NLS-1$ - new PropertyData( - IProductConstants.PREFERENCE_CUSTOMIZATION, - Messages.NewApplicationWizardPage_PreferenceCustomization, "", String.class, true), //$NON-NLS-1$ - new PropertyData(CLEAR_PERSISTED_STATE, - Messages.NewApplicationWizardPage_EnableDevelopmentMode, - TRUESMALL, Boolean.class, true, - Messages.NewApplicationWizardPage_AddOptionCleanPersistedState) }; // plugin_customization.ini - } - return PROPERTIES; - } - - @Override - public void setVisible(boolean visible) { - if (visible && PROPERTIES == null) { - - // Use the plug-in name for the product name (not project name which - // can contain illegal characters) - proNameText.setText(pluginData.getId()); - - for (final PropertyData property : getPropertyData()) { - createPropertyItem(propertyGroup, property); - } - propertyGroup.getParent().layout(); - } - super.setVisible(visible); - } - - /** - * @return the data - */ - public Map<String, String> getData() { - if (PROPERTIES == null) { - for (final PropertyData property : getPropertyData()) { - data.put(property.getName(), property.getValue()); - } - - // Use the plug-in name for the product name (not project name which - // can contain illegal characters) - final String productName = pluginData.getId(); - - data.put(PRODUCT_NAME, productName); - data.put(APPLICATION, E4_APPLICATION); - } - final Map<String, String> map = new HashMap<String, String>(); - map.putAll(data); - return map; - } -} diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/PluginContentPage.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/PluginContentPage.java deleted file mode 100644 index 5894a7aa..00000000 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/PluginContentPage.java +++ /dev/null @@ -1,432 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * Soyatec - port to e4 - * Lars Vogel, vogella GmbH - ongoing enhancements - *******************************************************************************/ -package org.eclipse.e4.internal.tools.wizards.project; - -import java.util.Locale; -import java.util.TreeSet; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jdt.core.JavaConventions; -import org.eclipse.jdt.launching.IVMInstall; -import org.eclipse.jdt.launching.JavaRuntime; -import org.eclipse.jdt.launching.environments.IExecutionEnvironment; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.dialogs.IDialogSettings; -import org.eclipse.jface.dialogs.IMessageProvider; -import org.eclipse.pde.internal.core.util.PDEJavaHelper; -import org.eclipse.pde.internal.core.util.VMUtil; -import org.eclipse.pde.internal.ui.IHelpContextIds; -import org.eclipse.pde.internal.ui.PDEUIMessages; -import org.eclipse.pde.internal.ui.SWTFactory; -import org.eclipse.pde.internal.ui.wizards.IProjectProvider; -import org.eclipse.pde.internal.ui.wizards.plugin.AbstractFieldData; -import org.eclipse.pde.internal.ui.wizards.plugin.ContentPage; -import org.eclipse.pde.internal.ui.wizards.plugin.NewProjectCreationPage; -import org.eclipse.pde.internal.ui.wizards.plugin.PluginFieldData; -import org.eclipse.pde.internal.ui.wizards.plugin.TemplateListSelectionPage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.dialogs.PreferencesUtil; -import org.osgi.framework.Version; - -/** - * Content wizard page for the New Plugin Project wizard (page 2) - */ -@SuppressWarnings("restriction") -public class PluginContentPage extends ContentPage { - private Text fClassText; - protected Button fGenerateActivator; - protected Button fUIPlugin; - private Label fClassLabel; - private Label fEELabel; - private Button fExeEnvButton; - private Combo fEEChoice; - - /** - * Button to enable API analysis for the project during project creation - */ - private Button fApiAnalysisButton; - - /** - * Dialog settings constants - */ - private final static String S_GENERATE_ACTIVATOR = "generateActivator"; //$NON-NLS-1$ - private final static String S_UI_PLUGIN = "uiPlugin"; //$NON-NLS-1$ - private final static String S_RCP_PLUGIN = "rcpPlugin"; //$NON-NLS-1$ - private final static String S_API_ANALYSIS = "apiAnalysis"; //$NON-NLS-1$ - - protected final static int P_CLASS_GROUP = 2; - private final static String NO_EXECUTION_ENVIRONMENT = PDEUIMessages.PluginContentPage_noEE; - - /** - * default tText modify listener - */ - private final ModifyListener classListener = new ModifyListener() { - @Override - public void modifyText(ModifyEvent e) { - if (fInitialized) { - fChangedGroups |= P_CLASS_GROUP; - } - validatePage(); - } - }; - - /** - * Constructor - * - * @param pageName - * @param provider - * @param page - * @param data - */ - public PluginContentPage(String pageName, IProjectProvider provider, NewProjectCreationPage page, - AbstractFieldData data) { - super(pageName, provider, page, data); - setTitle(PDEUIMessages.ContentPage_title); - setDescription(PDEUIMessages.ContentPage_desc); - } - - /* - * (non-Javadoc) - * @see org.eclipse.pde.internal.ui.wizards.plugin.ContentPage#createControl(org.eclipse.swt.widgets.Composite) - */ - @Override - public void createControl(Composite parent) { - final Composite container = new Composite(parent, SWT.NONE); - container.setLayout(new GridLayout()); - - createPluginPropertiesGroup(container); - createPluginClassGroup(container); - - Dialog.applyDialogFont(container); - setControl(container); - PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IHelpContextIds.NEW_PROJECT_REQUIRED_DATA); - } - - /** - * Creates all of the plugin properties widgets - * - * @param container - */ - private void createPluginPropertiesGroup(Composite container) { - final Group propertiesGroup = SWTFactory.createGroup(container, PDEUIMessages.ContentPage_pGroup, 3, 1, - GridData.FILL_HORIZONTAL); - - Label label = new Label(propertiesGroup, SWT.NONE); - label.setText(PDEUIMessages.ContentPage_pid); - fIdText = createText(propertiesGroup, propertiesListener, 2); - - label = new Label(propertiesGroup, SWT.NONE); - label.setText(PDEUIMessages.ContentPage_pversion); - fVersionText = createText(propertiesGroup, propertiesListener, 2); - - label = new Label(propertiesGroup, SWT.NONE); - label.setText(PDEUIMessages.ContentPage_pname); - fNameText = createText(propertiesGroup, propertiesListener, 2); - - label = new Label(propertiesGroup, SWT.NONE); - label.setText(PDEUIMessages.ContentPage_pprovider); - fProviderCombo = createProviderCombo(propertiesGroup, propertiesListener, 2); - - createExecutionEnvironmentControls(propertiesGroup); - } - - /** - * Creates all of the EE widgets - * - * @param container - */ - private void createExecutionEnvironmentControls(Composite container) { - // Create label - fEELabel = new Label(container, SWT.NONE); - fEELabel.setText(PDEUIMessages.NewProjectCreationPage_executionEnvironments_label); - - // Create combo - fEEChoice = new Combo(container, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.BORDER); - fEEChoice.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - // Gather EEs - final IExecutionEnvironment[] exeEnvs = VMUtil.getExecutionEnvironments(); - final TreeSet<String> availableEEs = new TreeSet<String>(); - for (int i = 0; i < exeEnvs.length; i++) { - availableEEs.add(exeEnvs[i].getId()); - } - availableEEs.add(NO_EXECUTION_ENVIRONMENT); - - // Set data - fEEChoice.setItems(availableEEs.toArray(new String[availableEEs.size() - 1])); - fEEChoice.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - validatePage(); - } - }); - - // Set default EE based on strict match to default VM - final IVMInstall defaultVM = JavaRuntime.getDefaultVMInstall(); - final String[] EEChoices = fEEChoice.getItems(); - for (int i = 0; i < EEChoices.length; i++) { - if (!EEChoices[i].equals(NO_EXECUTION_ENVIRONMENT)) { - if (VMUtil.getExecutionEnvironment(EEChoices[i]).isStrictlyCompatible(defaultVM)) { - fEEChoice.select(i); - break; - } - } - } - - // Create button - fExeEnvButton = new Button(container, SWT.PUSH); - fExeEnvButton.setLayoutData(new GridData()); - fExeEnvButton.setText(PDEUIMessages.NewProjectCreationPage_environmentsButton); - fExeEnvButton.addListener(SWT.Selection, new Listener() { - @Override - public void handleEvent(Event event) { - PreferencesUtil.createPreferenceDialogOn(getShell(), "org.eclipse.jdt.debug.ui.jreProfiles", //$NON-NLS-1$ - new String[] { "org.eclipse.jdt.debug.ui.jreProfiles" }, null).open(); //$NON-NLS-1$ - } - }); - } - - /** - * Creates all of the plugin options widgets - * - * @param container - */ - protected void createPluginClassGroup(Composite container) { - final Group classGroup = SWTFactory.createGroup(container, PDEUIMessages.ContentPage_pClassGroup, 2, 1, - GridData.FILL_HORIZONTAL); - - final IDialogSettings settings = getDialogSettings(); - - fGenerateActivator = SWTFactory.createCheckButton(classGroup, PDEUIMessages.ContentPage_generate, null, false, - 2); - fGenerateActivator.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - fClassLabel.setEnabled(fGenerateActivator.getSelection()); - fClassText.setEnabled(fGenerateActivator.getSelection()); - updateData(); - validatePage(); - } - }); - - fClassLabel = new Label(classGroup, SWT.NONE); - fClassLabel.setText(PDEUIMessages.ContentPage_classname); - final GridData gd = new GridData(); - gd.horizontalIndent = 20; - fClassLabel.setLayoutData(gd); - fClassText = createText(classGroup, classListener); - - fUIPlugin = SWTFactory.createCheckButton(classGroup, PDEUIMessages.ContentPage_uicontribution, null, - settings != null ? !settings.getBoolean(S_UI_PLUGIN) : true, 2); - fUIPlugin.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - updateData(); - validatePage(); - } - }); - - fApiAnalysisButton = SWTFactory.createCheckButton(classGroup, - PDEUIMessages.PluginContentPage_enable_api_analysis, null, false, 2); - fApiAnalysisButton.setSelection(settings != null ? settings.getBoolean(S_API_ANALYSIS) : false); - fApiAnalysisButton.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - updateData(); - validatePage(); - } - }); - } - - /* - * (non-Javadoc) - * @see org.eclipse.pde.internal.ui.wizards.plugin.ContentPage#updateData() - */ - @Override - public void updateData() { - super.updateData(); - final PluginFieldData data = (PluginFieldData) fData; - data.setClassname(fClassText.getText().trim()); - data.setUIPlugin(fUIPlugin.getSelection()); - data.setDoGenerateClass(fGenerateActivator.getSelection()); - data.setRCPApplicationPlugin(!fData.isSimple() && !isPureOSGi()); - data.setEnableAPITooling(fApiAnalysisButton.getSelection()); - if (fEEChoice.isEnabled() && !fEEChoice.getText().equals(NO_EXECUTION_ENVIRONMENT)) { - fData.setExecutionEnvironment(fEEChoice.getText().trim()); - } else { - fData.setExecutionEnvironment(null); - } - } - - /* - * (non-Javadoc) - * @see org.eclipse.pde.internal.ui.wizards.plugin.ContentPage#setVisible(boolean) - */ - @Override - public void setVisible(boolean visible) { - if (visible) { - fMainPage.updateData(); - - final boolean wasGenActivatorEnabled = fGenerateActivator.isEnabled(); - fGenerateActivator.setEnabled(!fData.isSimple()); - // if fGenerateActivator is disabled, set selection to false - if (!fGenerateActivator.isEnabled()) { - fGenerateActivator.setSelection(false); - } - // if the fGenerateActivator was disabled and is now enabled, then set the selection to true - else if (!wasGenActivatorEnabled) { - fGenerateActivator.setSelection(true); - } - fClassLabel.setEnabled(!fData.isSimple() && fGenerateActivator.getSelection()); - fClassText.setEnabled(!fData.isSimple() && fGenerateActivator.getSelection()); - final boolean wasUIPluginEnabled = fUIPlugin.isEnabled(); - fUIPlugin.setEnabled(!fData.isSimple() && !isPureOSGi()); - // if fUIPlugin is disabled, set selection to false - if (!fUIPlugin.isEnabled()) { - fUIPlugin.setSelection(false); - } - // if the fUIPlugin was disabled and is now enabled, then set the selection to true - else if (!wasUIPluginEnabled) { - fUIPlugin.setSelection(true); - } - - // plugin class group - if ((fChangedGroups & P_CLASS_GROUP) == 0) { - final int oldfChanged = fChangedGroups; - fClassText.setText(computeId().replaceAll("-", "_").toLowerCase(Locale.ENGLISH) + ".Activator"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - fChangedGroups = oldfChanged; - } - - final boolean allowEESelection = !fData.isSimple() && fData.hasBundleStructure(); - fEELabel.setEnabled(allowEESelection); - fEEChoice.setEnabled(allowEESelection); - fExeEnvButton.setEnabled(allowEESelection); - // API tooling only works for osgi bundles with java natures - fApiAnalysisButton.setEnabled(allowEESelection); - if (allowEESelection && getDialogSettings() != null) { - fApiAnalysisButton.setSelection(getDialogSettings().getBoolean(S_API_ANALYSIS)); - } else { - fApiAnalysisButton.setSelection(false); - } - } - super.setVisible(visible); - } - - /** - * @return if the field data is using the OSGi framework - */ - private boolean isPureOSGi() { - return ((PluginFieldData) fData).getOSGiFramework() != null; - } - - /* - * (non-Javadoc) - * @see org.eclipse.pde.internal.ui.wizards.plugin.ContentPage#validatePage() - */ - @Override - protected void validatePage() { - String errorMessage = validateProperties(); - if (errorMessage == null && fGenerateActivator.getSelection()) { - final IStatus status = JavaConventions.validateJavaTypeName(fClassText.getText().trim(), - PDEJavaHelper.getJavaSourceLevel(null), PDEJavaHelper.getJavaComplianceLevel(null)); - if (status.getSeverity() == IStatus.ERROR) { - errorMessage = status.getMessage(); - } else if (status.getSeverity() == IStatus.WARNING) { - setMessage(status.getMessage(), IMessageProvider.WARNING); - } - } - if (errorMessage == null) { - final String eeid = fEEChoice.getText(); - if (fEEChoice.isEnabled()) { - final IExecutionEnvironment ee = VMUtil.getExecutionEnvironment(eeid); - if (ee != null && ee.getCompatibleVMs().length == 0) { - errorMessage = PDEUIMessages.NewProjectCreationPage_invalidEE; - } - } - } - setErrorMessage(errorMessage); - setPageComplete(errorMessage == null); - } - - /** - * Saves the current state of widgets of interest in the dialog settings for the wizard - * - * @param settings - */ - @Override - public void saveSettings(IDialogSettings settings) { - if (fGenerateActivator.isEnabled()) { - settings.put(S_GENERATE_ACTIVATOR, !fGenerateActivator.getSelection()); - } - if (fUIPlugin.isEnabled()) { - settings.put(S_UI_PLUGIN, !fUIPlugin.getSelection()); - } - if (fApiAnalysisButton.isEnabled()) { - settings.put(S_API_ANALYSIS, fApiAnalysisButton.getSelection()); - } - settings.put(S_RCP_PLUGIN, true); - } - - /* - * (non-Javadoc) - * @see org.eclipse.jface.wizard.WizardPage#canFlipToNextPage() - */ - @Override - public boolean canFlipToNextPage() { - if (getNextPage() instanceof TemplateListSelectionPage) { - final TemplateListSelectionPage templatePage = (TemplateListSelectionPage) getNextPage(); - return super.canFlipToNextPage() && templatePage.isAnyTemplateAvailable(); - } - return super.canFlipToNextPage(); - } - - /* - * (non-Javadoc) - * @see org.eclipse.pde.internal.ui.wizards.plugin.ContentPage#computeId() - */ - @Override - protected String computeId() { - String id = super.computeId(); - // In addition to removed illegal characters, the xmi model does not recognize plug-in uris if they end in a - // version number - // See PlatformURLPluginConnection.parse() - int underScore = id.lastIndexOf('_'); - while (underScore >= 0) { - try { - Version.parseVersion(id.substring(underScore + 1)); - // name cannot end with a valid version, remove it - id = id.substring(0, underScore); - } catch (final IllegalArgumentException iae) { - // valid name so far, continue to next underscore - } - underScore = id.lastIndexOf('_', underScore - 1); - - } - return id; - } -} diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/ResourceLocator.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/ResourceLocator.java deleted file mode 100644 index ecb0627c..00000000 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/ResourceLocator.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Soyatec (http://www.soyatec.com) and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Soyatec - initial API and implementation - *******************************************************************************/ -package org.eclipse.e4.internal.tools.wizards.project; - -import java.io.IOException; -import java.net.URL; - -import org.eclipse.core.runtime.FileLocator; -import org.eclipse.core.runtime.Plugin; -import org.eclipse.e4.internal.tools.ToolsPlugin; - -public class ResourceLocator { - private static final String TEMPLATE_FOLDER = "templates"; //$NON-NLS-1$ - - private static ResourceLocator instance = new ResourceLocator(); - - private ResourceLocator() { - } - - public static ResourceLocator getInstance() { - return instance; - } - - public static URL getProjectTemplateFiles(String folder) - throws IOException { - final Plugin plugin = getResorucePlugin(); - final URL installURL = plugin.getBundle().getEntry( - "/" + TEMPLATE_FOLDER + "/" + folder); //$NON-NLS-1$ //$NON-NLS-2$ - // FileLocator.toFileURL(installURL); - final URL corePath = FileLocator.resolve(installURL); - return corePath; - } - - public static URL getFile(String relativePath) throws IOException { - final Plugin plugin = getResorucePlugin(); - final URL installURL = plugin.getBundle().getEntry(relativePath); - final URL corePath = FileLocator.resolve(installURL); - return corePath; - } - - public static Plugin getResorucePlugin() { - return ToolsPlugin.getDefault(); - } -} diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/SimpleTemplate.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/SimpleTemplate.java deleted file mode 100644 index 57a52b6e..00000000 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/SimpleTemplate.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation - *******************************************************************************/ -package org.eclipse.e4.internal.tools.wizards.project; - -import java.util.Map; - -/** - * A <em>very</em> basic template processor.<br /> - * Any value between pairs of @@ will be substituted by the value in a map.<br /> - * Any values not in the map will be replaced by an empty string. <br /> - * <br /> - * Behavior is undefined if keys or values contain the @@ marker. - * - * @author Steven Spungin - * - */ -public class SimpleTemplate { - - public static String process(String source, Map<String, String> substitutionMap) { - for (final String key : substitutionMap.keySet()) { - source = source.replaceAll("@@" + key + "@@", substitutionMap.get(key)); //$NON-NLS-1$ //$NON-NLS-2$ - } - source = source.replaceAll("@@.*?@@", ""); //$NON-NLS-1$ //$NON-NLS-2$ - return source; - } -} diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/TemplateOperation.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/TemplateOperation.java deleted file mode 100644 index e41d259e..00000000 --- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/TemplateOperation.java +++ /dev/null @@ -1,419 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Soyatec (http://www.soyatec.com) and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Soyatec - initial API and implementation - * Sopot Cela - ongoing enhancements - *******************************************************************************/ -package org.eclipse.e4.internal.tools.wizards.project; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.lang.reflect.InvocationTargetException; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; -import java.util.zip.ZipEntry; -import java.util.zip.ZipException; -import java.util.zip.ZipFile; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.e4.internal.tools.ToolsPlugin; -import org.eclipse.pde.internal.ui.PDEUIMessages; -import org.eclipse.pde.ui.templates.IVariableProvider; -import org.eclipse.ui.actions.WorkspaceModifyOperation; - -@SuppressWarnings("restriction") -public class TemplateOperation extends WorkspaceModifyOperation implements - IVariableProvider { - - private final URL templateDirectory; - private final IContainer target; - private final Map<String, String> keys; - private final Set<String> binaryExtentions; - private final boolean isMinimalist; - - public TemplateOperation(URL source, IContainer target, - Map<String, String> keys, Set<String> binaryExtentions, boolean justProduct) { - templateDirectory = source; - this.binaryExtentions = binaryExtentions; - this.target = target; - this.keys = keys; - isMinimalist = justProduct; - } - - @Override - protected void execute(IProgressMonitor monitor) throws CoreException, - InvocationTargetException, InterruptedException { - monitor.setTaskName(PDEUIMessages.AbstractTemplateSection_generating); - - if ("jar".equals(templateDirectory.getProtocol())) { //$NON-NLS-1$ - final String file = templateDirectory.getFile(); - final int exclamation = file.indexOf('!'); - if (exclamation < 0) { - return; - } - URL fileUrl = null; - try { - fileUrl = new URL(file.substring(0, exclamation)); - } catch (final MalformedURLException mue) { - ToolsPlugin.logError(mue); - return; - } - final File pluginJar = new File(fileUrl.getFile()); - if (!pluginJar.exists()) { - return; - } - final String templateDirectory = file.substring(exclamation + 1); // "/some/path/" - final IPath path = new Path(templateDirectory); - ZipFile zipFile = null; - try { - zipFile = new ZipFile(pluginJar); - generateFiles(zipFile, path, target, monitor); - } catch (final ZipException ze) { - } catch (final IOException ioe) { - } finally { - if (zipFile != null) { - try { - zipFile.close(); - } catch (final IOException e) { - } - } - } - } else if ("file".equals(templateDirectory.getProtocol())) { //$NON-NLS-1$ - final File directory = new File(templateDirectory.getFile()); - if (!directory.exists()) { - return; - } - generateFiles(directory, target, true, monitor); - } - } - - private void generateFiles(File src, IContainer dst, boolean firstLevel, - IProgressMonitor monitor) throws CoreException { - if (!firstLevel && isMinimalist) { - return; - } - final File[] members = src.listFiles(); - - for (int i = 0; i < members.length; i++) { - final File member = members[i]; - final String name = member.getName(); - if (member.isDirectory()) { - if (".svn".equals(name) || "cvs".equalsIgnoreCase(name)) { //$NON-NLS-1$ //$NON-NLS-2$ - continue; - } - IContainer dstContainer = null; - - final String folderName = getProcessedString(name, name); - dstContainer = dst.getFolder(new Path(folderName)); - if (dstContainer != null && !dstContainer.exists()) { - ((IFolder) dstContainer).create(true, true, monitor); - } - - generateFiles(member, dstContainer, false, monitor); - } else { - InputStream in = null; - try { - in = new FileInputStream(member); - copyFile(name, in, dst, monitor); - } catch (final IOException ioe) { - } finally { - if (in != null) { - try { - in.close(); - } catch (final IOException ioe2) { - } - } - } - } - } - } - - /** - * - * - * @param zipFile - * @param path - * @param dst - * @param monitor - * @throws CoreException - */ - private void generateFiles(ZipFile zipFile, IPath path, IContainer dst, - IProgressMonitor monitor) throws CoreException { - final int pathLength = path.segmentCount(); - // Immidiate children - final Map<String, ZipEntry> childZipEntries = new HashMap<String, ZipEntry>(); // "dir/" or "dir/file.java" - - for (final Enumeration<? extends ZipEntry> zipEntries = zipFile.entries(); zipEntries - .hasMoreElements();) { - final ZipEntry zipEntry = zipEntries.nextElement(); - final IPath entryPath = new Path(zipEntry.getName()); - if (entryPath.segmentCount() <= pathLength) { - // ancestor or current directory - continue; - } - if (!path.isPrefixOf(entryPath)) { - // not a descendant - continue; - } - if (entryPath.segmentCount() == pathLength + 1) { - childZipEntries.put(zipEntry.getName(), zipEntry); - } else { - final String name = entryPath.uptoSegment(pathLength + 1) - .addTrailingSeparator().toString(); - if (!childZipEntries.containsKey(name)) { - final ZipEntry dirEntry = new ZipEntry(name); - childZipEntries.put(name, dirEntry); - } - } - } - - for (final Iterator<ZipEntry> it = childZipEntries.values().iterator(); it.hasNext();) { - final ZipEntry zipEnry = it.next(); - final String name = new Path(zipEnry.getName()).lastSegment().toString(); - if (zipEnry.isDirectory()) { - IContainer dstContainer = null; - - final String folderName = getProcessedString(name, name); - dstContainer = dst.getFolder(new Path(folderName)); - if (dstContainer != null && !dstContainer.exists()) { - ((IFolder) dstContainer).create(true, true, monitor); - } - generateFiles(zipFile, path.append(name), dstContainer, monitor); - } else { - InputStream in = null; - try { - in = zipFile.getInputStream(zipEnry); - copyFile(name, in, dst, monitor); - } catch (final IOException ioe) { - } finally { - if (in != null) { - try { - in.close(); - } catch (final IOException ioe2) { - } - } - } - } - } - } - - private void copyFile(String fileName, InputStream input, IContainer dst, - IProgressMonitor monitor) throws CoreException { - final String targetFileName = getProcessedString(fileName, fileName); - - monitor.subTask(targetFileName); - final IFile dstFile = dst.getFile(new Path(targetFileName)); - - try { - final InputStream stream = isBinary(fileName) ? input - : getProcessedStream(fileName, input); - if (dstFile.exists()) { - dstFile.setContents(stream, true, true, monitor); - } else { - dstFile.create(stream, true, monitor); - } - stream.close(); - - } catch (final IOException e) { - } - } - - protected void copyFile(String fileName, InputStream input, IContainer dst, - final String destPath, IProgressMonitor monitor) - throws CoreException { - String targetFileName = null; - if (destPath == null) { - targetFileName = getProcessedString(fileName, fileName); - } else { - targetFileName = destPath; - } - - monitor.subTask(targetFileName); - final IFile dstFile = dst.getFile(new Path(targetFileName)); - - try { - final InputStream stream = isBinary(fileName) ? input - : getProcessedStream(fileName, input); - if (dstFile.exists()) { - dstFile.setContents(stream, true, true, monitor); - } else { - dstFile.create(stream, true, monitor); - } - stream.close(); - - } catch (final IOException e) { - } - } - - /** - * - * @param fileName - * @param input - * @param dst - * @param basePath - * @param monitor - * @throws CoreException - */ - public void copyFile(String fileName, InputStream input, IContainer dst, - final String basePath, final String destName, - IProgressMonitor monitor) throws CoreException { - if (basePath == null || basePath.equals("")) { //$NON-NLS-1$ - copyFile(fileName, input, dst, monitor); - } - - final String targetFileName = destName == null ? getProcessedString(fileName, - fileName) : destName; - - monitor.subTask(targetFileName); - final IFile dstFile = dst.getFile(new Path(basePath + targetFileName)); - - try { - final InputStream stream = isBinary(fileName) ? input - : getProcessedStream(fileName, input); - if (dstFile.exists()) { - dstFile.setContents(stream, true, true, monitor); - } else { - dstFile.create(stream, true, monitor); - } - stream.close(); - - } catch (final IOException e) { - } - } - - private boolean isBinary(String fileName) { - if (binaryExtentions == null) { - return false; - } - - final String ext = getfileExtention(fileName); - if (ext == null) { - return false; - } - return binaryExtentions.contains(ext); - } - - private String getfileExtention(String name) { - final int indexOf = name.lastIndexOf('.'); - if (indexOf == -1) { - return null; - } - return name.substring(indexOf); - } - - private InputStream getProcessedStream(String fileName, InputStream stream) - throws IOException, CoreException { - final InputStreamReader reader = new InputStreamReader(stream); - final int bufsize = 1024; - final char[] cbuffer = new char[bufsize]; - int read = 0; - final StringBuffer keyBuffer = new StringBuffer(); - final StringBuffer outBuffer = new StringBuffer(); - - boolean replacementMode = false; - boolean almostReplacementMode = false; - boolean escape = false; - while (read != -1) { - read = reader.read(cbuffer); - for (int i = 0; i < read; i++) { - final char c = cbuffer[i]; - - if (escape) { - final StringBuffer buf = outBuffer; - buf.append(c); - escape = false; - continue; - } - - if (c == '@') { - if (replacementMode && almostReplacementMode) { - almostReplacementMode = false; - } else if (replacementMode) { - replacementMode = false; - final String key = keyBuffer.toString(); - final String value = key.length() == 0 ? "@@" //$NON-NLS-1$ - : getReplacementString(key); - outBuffer.append(value); - keyBuffer.delete(0, keyBuffer.length()); - } else if (almostReplacementMode) { - replacementMode = true; - } else { - almostReplacementMode = true; - } - } else { - if (replacementMode) { - keyBuffer.append(c); - } else { - if (almostReplacementMode) { - outBuffer.append('@'); - } - outBuffer.append(c); - almostReplacementMode = false; - } - } - } - } - return new ByteArrayInputStream(outBuffer.toString().getBytes()); - // return new - // ByteArrayInputStream(outBuffer.toString().getBytes(project. - // getDefaultCharset())); - } - - private String getProcessedString(String fileName, String source) { - if (source.indexOf('$') == -1) { - return source; - } - int loc = -1; - final StringBuffer buffer = new StringBuffer(); - boolean replacementMode = false; - for (int i = 0; i < source.length(); i++) { - final char c = source.charAt(i); - if (c == '$') { - if (replacementMode) { - final String key = source.substring(loc, i); - final String value = key.length() == 0 ? "$" : getReplacementString(key); //$NON-NLS-1$ - buffer.append(value); - replacementMode = false; - } else { - replacementMode = true; - loc = i + 1; - continue; - } - } else if (!replacementMode) { - buffer.append(c); - } - } - return buffer.toString(); - } - - public String getReplacementString(String key) { - final String result = keys.get(key); - return result != null ? result : key; - } - - @Override - public Object getValue(String variable) { - return getReplacementString(variable); - } - -} diff --git a/bundles/org.eclipse.e4.tools/templates/E4LifeCycle.java b/bundles/org.eclipse.e4.tools/templates/E4LifeCycle.java deleted file mode 100644 index eb63e04f..00000000 --- a/bundles/org.eclipse.e4.tools/templates/E4LifeCycle.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 TwelveTone LLC and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation - *******************************************************************************/ -@@PACKAGE_DECLARATION@@ - -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.ui.workbench.lifecycle.PostContextCreate; -import org.eclipse.e4.ui.workbench.lifecycle.PreSave; -import org.eclipse.e4.ui.workbench.lifecycle.ProcessAdditions; -import org.eclipse.e4.ui.workbench.lifecycle.ProcessRemovals; - -/** - * This is a stub implementation containing e4 LifeCycle annotated methods.<br /> - * There is a corresponding entry in <em>plugin.xml</em> (under the - * <em>org.eclipse.core.runtime.products' extension point</em>) that references - * this class. - **/ -@SuppressWarnings("restriction") -public class @@CLASS_NAME@@ { - - @PostContextCreate - void postContextCreate(IEclipseContext workbenchContext) { - } - - @PreSave - void preSave(IEclipseContext workbenchContext) { - } - - @ProcessAdditions - void processAdditions(IEclipseContext workbenchContext) { - } - - @ProcessRemovals - void processRemovals(IEclipseContext workbenchContext) { - } -} diff --git a/bundles/org.eclipse.e4.tools/templates/addon.txtjet b/bundles/org.eclipse.e4.tools/templates/addon.txtjet deleted file mode 100644 index 7404b0a0..00000000 --- a/bundles/org.eclipse.e4.tools/templates/addon.txtjet +++ /dev/null @@ -1,25 +0,0 @@ -<%@ jet package="org.eclipse.e4.internal.tools.wizards.classes.templates" class="AddonTemplate" imports="org.eclipse.e4.internal.tools.wizards.classes.AbstractNewClassPage.JavaClass" %> -<% JavaClass domainClass = (JavaClass)argument; %> -<% if( domainClass.getPackageFragment() != null && domainClass.getPackageFragment().getElementName().trim().length() > 0 ) { %> -package <%= domainClass.getPackageFragment().getElementName() %>; -<% } %> - -import javax.inject.Inject; - -import org.eclipse.e4.core.di.annotations.Optional; -import org.eclipse.e4.core.di.extensions.EventTopic; -import org.eclipse.e4.ui.workbench.UIEvents; -import org.osgi.service.event.Event; - -import org.eclipse.e4.core.services.events.IEventBroker; - -public class <%= domainClass.getName() %> { - - @Inject - @Optional - public void applicationStarted( - @EventTopic(UIEvents.UILifeCycle.APP_STARTUP_COMPLETE) Event event) { - // TODO Modify the UIEvents.UILifeCycle.APP_STARTUP_COMPLETE EventTopic to a certain event you want to listen to. - } - -} diff --git a/bundles/org.eclipse.e4.tools/templates/common/$productFileName$.product b/bundles/org.eclipse.e4.tools/templates/common/$productFileName$.product deleted file mode 100644 index 838c6abe..00000000 --- a/bundles/org.eclipse.e4.tools/templates/common/$productFileName$.product +++ /dev/null @@ -1,110 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?pde version="3.5"?> - -<product name="@@projectName@@" id="@@projectName@@.product" application="org.eclipse.e4.ui.workbench.swt.E4Application" version="1.0.0.qualifier" useFeatures="false" includeLaunchers="true"> - - <configIni use="default"> - </configIni> - - <launcherArgs> - <programArgs>@@programArgs@@</programArgs> - <vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts</vmArgsMac> - </launcherArgs> - - <windowImages/> - - <plugins> - <plugin id="@@projectName@@"/> - <plugin id="com.ibm.icu"/> - <plugin id="javax.annotation"/> - <plugin id="javax.inject"/> - <plugin id="javax.xml"/> - <plugin id="org.apache.batik.css"/> - <plugin id="org.apache.batik.util"/> - <plugin id="org.apache.batik.util.gui"/> - <plugin id="org.apache.commons.logging"/> - <plugin id="org.eclipse.core.commands"/> - <plugin id="org.eclipse.core.contenttype"/> - <plugin id="org.eclipse.core.databinding"/> - <plugin id="org.eclipse.core.databinding.beans"/> - <plugin id="org.eclipse.core.databinding.observable"/> - <plugin id="org.eclipse.core.databinding.property"/> - <plugin id="org.eclipse.core.expressions"/> - <plugin id="org.eclipse.core.filesystem"/> - <plugin id="org.eclipse.core.filesystem.aix.ppc" fragment="true"/> - <plugin id="org.eclipse.core.filesystem.hpux.ia64_32" fragment="true"/> - <plugin id="org.eclipse.core.filesystem.linux.ppc" fragment="true"/> - <plugin id="org.eclipse.core.filesystem.linux.x86" fragment="true"/> - <plugin id="org.eclipse.core.filesystem.linux.x86_64" fragment="true"/> - <plugin id="org.eclipse.core.filesystem.macosx" fragment="true"/> - <plugin id="org.eclipse.core.filesystem.solaris.sparc" fragment="true"/> - <plugin id="org.eclipse.core.filesystem.win32.x86" fragment="true"/> - <plugin id="org.eclipse.core.filesystem.win32.x86_64" fragment="true"/> - <plugin id="org.eclipse.core.jobs"/> - <plugin id="org.eclipse.core.resources"/> - <plugin id="org.eclipse.core.resources.win32.x86" fragment="true"/> - <plugin id="org.eclipse.core.runtime"/> - <plugin id="org.eclipse.core.runtime.compatibility.registry" fragment="true"/> - <plugin id="org.eclipse.e4.core.commands"/> - <plugin id="org.eclipse.e4.core.contexts"/> - <plugin id="org.eclipse.e4.core.di"/> - <plugin id="org.eclipse.e4.core.di.extensions"/> - <plugin id="org.eclipse.e4.core.services"/> - <plugin id="org.eclipse.e4.ui.bindings"/> - <plugin id="org.eclipse.e4.ui.css.core"/> - <plugin id="org.eclipse.e4.ui.css.swt"/> - <plugin id="org.eclipse.e4.ui.css.swt.theme"/> - <plugin id="org.eclipse.e4.ui.di"/> - <plugin id="org.eclipse.e4.ui.model.workbench"/> - <plugin id="org.eclipse.e4.ui.services"/> - <plugin id="org.eclipse.e4.ui.widgets"/> - <plugin id="org.eclipse.e4.ui.workbench"/> - <plugin id="org.eclipse.e4.ui.workbench.renderers.swt"/> - <plugin id="org.eclipse.e4.ui.workbench.renderers.swt.cocoa"/> - <plugin id="org.eclipse.e4.ui.workbench.swt"/> - <plugin id="org.eclipse.e4.ui.workbench3"/> - <plugin id="org.eclipse.emf.common"/> - <plugin id="org.eclipse.emf.databinding"/> - <plugin id="org.eclipse.emf.ecore"/> - <plugin id="org.eclipse.emf.ecore.change"/> - <plugin id="org.eclipse.emf.ecore.xmi"/> - <plugin id="org.eclipse.equinox.app"/> - <plugin id="org.eclipse.equinox.common"/> - <plugin id="org.eclipse.equinox.concurrent"/> - <plugin id="org.eclipse.equinox.ds"/> - <plugin id="org.eclipse.equinox.event"/> - <plugin id="org.eclipse.equinox.preferences"/> - <plugin id="org.eclipse.equinox.registry"/> - <plugin id="org.eclipse.equinox.util"/> - <plugin id="org.eclipse.jface"/> - <plugin id="org.eclipse.jface.databinding"/> - <plugin id="org.eclipse.osgi"/> - <plugin id="org.eclipse.osgi.compatibility.state"/> - <plugin id="org.eclipse.osgi.services"/> - <plugin id="org.eclipse.swt"/> - <plugin id="org.eclipse.swt.carbon.macosx" fragment="true"/> - <plugin id="org.eclipse.swt.cocoa.macosx" fragment="true"/> - <plugin id="org.eclipse.swt.cocoa.macosx.x86_64" fragment="true"/> - <plugin id="org.eclipse.swt.gtk.linux.ppc" fragment="true"/> - <plugin id="org.eclipse.swt.gtk.linux.ppc64" fragment="true"/> - <plugin id="org.eclipse.swt.gtk.linux.s390" fragment="true"/> - <plugin id="org.eclipse.swt.gtk.linux.s390x" fragment="true"/> - <plugin id="org.eclipse.swt.gtk.linux.x86" fragment="true"/> - <plugin id="org.eclipse.swt.gtk.linux.x86_64" fragment="true"/> - <plugin id="org.eclipse.swt.gtk.solaris.sparc" fragment="true"/> - <plugin id="org.eclipse.swt.gtk.solaris.x86" fragment="true"/> - <plugin id="org.eclipse.swt.motif.aix.ppc" fragment="true"/> - <plugin id="org.eclipse.swt.motif.hpux.ia64_32" fragment="true"/> - <plugin id="org.eclipse.swt.motif.linux.x86" fragment="true"/> - <plugin id="org.eclipse.swt.motif.solaris.sparc" fragment="true"/> - <plugin id="org.eclipse.swt.photon.qnx.x86" fragment="true"/> - <plugin id="org.eclipse.swt.win32.win32.x86" fragment="true"/> - <plugin id="org.eclipse.swt.win32.win32.x86_64" fragment="true"/> - <plugin id="org.w3c.css.sac"/> - <plugin id="org.w3c.dom.smil"/> - <plugin id="org.w3c.dom.svg"/> - <plugin id="org.w3c.dom.events"/> - </plugins> - - -</product> diff --git a/bundles/org.eclipse.e4.tools/templates/common/icons/sample.png b/bundles/org.eclipse.e4.tools/templates/common/icons/sample.png Binary files differdeleted file mode 100644 index 932e4518..00000000 --- a/bundles/org.eclipse.e4.tools/templates/common/icons/sample.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools/templates/common/icons/save_edit.png b/bundles/org.eclipse.e4.tools/templates/common/icons/save_edit.png Binary files differdeleted file mode 100644 index 2c598e5a..00000000 --- a/bundles/org.eclipse.e4.tools/templates/common/icons/save_edit.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools/templates/css/default.css b/bundles/org.eclipse.e4.tools/templates/css/default.css deleted file mode 100644 index e69de29b..00000000 --- a/bundles/org.eclipse.e4.tools/templates/css/default.css +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools/templates/dynamicMenuContribution.txtjet b/bundles/org.eclipse.e4.tools/templates/dynamicMenuContribution.txtjet deleted file mode 100644 index 3567f49c..00000000 --- a/bundles/org.eclipse.e4.tools/templates/dynamicMenuContribution.txtjet +++ /dev/null @@ -1,28 +0,0 @@ -<%@ jet package="org.eclipse.e4.internal.tools.wizards.classes.templates" class="DynamicMenuContributionTemplate" imports="org.eclipse.e4.internal.tools.wizards.classes.NewDynamicMenuContributionClassWizard.DynamicMenuContributionClass" %> -<% DynamicMenuContributionClass domainClass = (DynamicMenuContributionClass)argument; %> -<% if( domainClass.getPackageFragment() != null && domainClass.getPackageFragment().getElementName().trim().length() > 0 ) { %> -package <%= domainClass.getPackageFragment().getElementName() %>; -<% } %> - -import java.util.List; - -import org.eclipse.e4.ui.di.AboutToShow; -<% if( domainClass.isUseAboutToHide() ) { %> -import org.eclipse.e4.ui.di.AboutToHide; -<% } %> - -import org.eclipse.e4.ui.model.application.ui.menu.MMenuElement; - -public class <%= domainClass.getName() %> { - @AboutToShow - public void <%= domainClass.getAboutToShowMethodName() %>(List<MMenuElement> items) { - - } - <% if( domainClass.isUseAboutToHide() ) { %> - - @AboutToHide - public void <%= domainClass.getAboutToHideMethodName() %>(List<MMenuElement> items) { - - } - <% } %> -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools/templates/handler.txtjet b/bundles/org.eclipse.e4.tools/templates/handler.txtjet deleted file mode 100644 index cd2f8208..00000000 --- a/bundles/org.eclipse.e4.tools/templates/handler.txtjet +++ /dev/null @@ -1,25 +0,0 @@ -<%@ jet package="org.eclipse.e4.internal.tools.wizards.classes.templates" class="HandlerTemplate" imports="org.eclipse.e4.internal.tools.wizards.classes.NewHandlerClassWizard.HandlerClass" %> -<% HandlerClass domainClass = (HandlerClass)argument; %> -<% if( domainClass.getPackageFragment() != null && domainClass.getPackageFragment().getElementName().trim().length() > 0 ) { %> -package <%= domainClass.getPackageFragment().getElementName() %>; -<% } %> - -import org.eclipse.e4.core.di.annotations.Execute; -<% if( domainClass.isUseCanExecute() ) { %> -import org.eclipse.e4.core.di.annotations.CanExecute; -<% } %> - -public class <%= domainClass.getName() %> { - @Execute - public void <%= domainClass.getExecuteMethodName() %>() { - - } - <% if( domainClass.isUseCanExecute() ) { %> - - @CanExecute - public boolean <%= domainClass.getCanExecuteMethodName() %>() { - - return true; - } - <% } %> -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools/templates/part.txtjet b/bundles/org.eclipse.e4.tools/templates/part.txtjet deleted file mode 100644 index a51b59d5..00000000 --- a/bundles/org.eclipse.e4.tools/templates/part.txtjet +++ /dev/null @@ -1,51 +0,0 @@ -<%@ jet package="org.eclipse.e4.internal.tools.wizards.classes.templates" class="PartTemplate" imports="org.eclipse.e4.internal.tools.wizards.classes.NewPartClassWizard.PartClass" %> -<% PartClass domainClass = (PartClass)argument; %> -<% if( domainClass.getPackageFragment() != null && domainClass.getPackageFragment().getElementName().trim().length() > 0 ) { %> -package <%= domainClass.getPackageFragment().getElementName() %>; -<% } %> - -import javax.inject.Inject; -<% if( domainClass.isUsePostConstruct() ) { %> -import javax.annotation.PostConstruct; -import org.eclipse.swt.widgets.Composite; -<% } %> -<% if( domainClass.isUsePredestroy() ) { %> -import javax.annotation.PreDestroy; -<% } %> -<% if( domainClass.isUseFocus() ) { %> -import org.eclipse.e4.ui.di.Focus; -<% } %> -<% if( domainClass.isUsePersist() ) { %> -import org.eclipse.e4.ui.di.Persist; -<% } %> - -public class <%= domainClass.getName() %> { - @Inject - public <%= domainClass.getName() %>() { - - } - <% if( domainClass.isUsePostConstruct() ) { %> - @PostConstruct - public void <%= domainClass.getPostConstructMethodName() %>(Composite parent) { - - } - <% } %> - <% if( domainClass.isUsePredestroy() ) { %> - @PreDestroy - public void <%= domainClass.getPreDestroyMethodName() %>() { - - } - <% } %> - <% if( domainClass.isUseFocus() ) { %> - @Focus - public void <%= domainClass.getFocusMethodName() %>() { - - } - <% } %> - <% if( domainClass.isUsePersist() ) { %> - @Persist - public void <%= domainClass.getPersistMethodName() %>() { - - } - <% } %> -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools/templates/src/handlers/AboutHandler.java b/bundles/org.eclipse.e4.tools/templates/src/handlers/AboutHandler.java deleted file mode 100644 index df0b8ed6..00000000 --- a/bundles/org.eclipse.e4.tools/templates/src/handlers/AboutHandler.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 - 2013 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * Lars Vogel <lars.Vogel@gmail.com> - Bug 419770 - *******************************************************************************/ -package @@packageName@@; - -import org.eclipse.e4.core.di.annotations.Execute; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.swt.widgets.Shell; - -public class AboutHandler { - @Execute - public void execute(Shell shell) { - MessageDialog.openInformation(shell, "About", "Eclipse 4 Application example."); - } -} diff --git a/bundles/org.eclipse.e4.tools/templates/src/handlers/OpenHandler.java b/bundles/org.eclipse.e4.tools/templates/src/handlers/OpenHandler.java deleted file mode 100644 index fe13432b..00000000 --- a/bundles/org.eclipse.e4.tools/templates/src/handlers/OpenHandler.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * Lars Vogel <lars.Vogel@gmail.com> - Bug 419770 - *******************************************************************************/ -package @@packageName@@; - -import org.eclipse.e4.core.di.annotations.Execute; -import org.eclipse.swt.widgets.FileDialog; -import org.eclipse.swt.widgets.Shell; -public class OpenHandler { - - @Execute - public void execute(Shell shell){ - FileDialog dialog = new FileDialog(shell); - dialog.open(); - } -} diff --git a/bundles/org.eclipse.e4.tools/templates/src/handlers/QuitHandler.java b/bundles/org.eclipse.e4.tools/templates/src/handlers/QuitHandler.java deleted file mode 100644 index 3b1929b5..00000000 --- a/bundles/org.eclipse.e4.tools/templates/src/handlers/QuitHandler.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 - 2013 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * Lars Vogel <lars.Vogel@gmail.com> - Bug 419770 - *******************************************************************************/ -package @@packageName@@; - -import org.eclipse.e4.core.di.annotations.Execute; -import org.eclipse.e4.ui.workbench.IWorkbench; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.swt.widgets.Shell; - - -public class QuitHandler { - @Execute - public void execute(IWorkbench workbench, Shell shell){ - if (MessageDialog.openConfirm(shell, "Confirmation", - "Do you want to exit?")) { - workbench.close(); - } - } -} diff --git a/bundles/org.eclipse.e4.tools/templates/src/handlers/SaveHandler.java b/bundles/org.eclipse.e4.tools/templates/src/handlers/SaveHandler.java deleted file mode 100644 index 1127141e..00000000 --- a/bundles/org.eclipse.e4.tools/templates/src/handlers/SaveHandler.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 - 2013 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * Lars Vogel <lars.Vogel@gmail.com> - Bug 419770 - *******************************************************************************/ -package @@packageName@@; - -import org.eclipse.e4.core.di.annotations.CanExecute; -import org.eclipse.e4.core.di.annotations.Execute; -import org.eclipse.e4.ui.workbench.modeling.EPartService; - -public class SaveHandler { - - @CanExecute - public boolean canExecute(EPartService partService) { - if (partService != null) { - return !partService.getDirtyParts().isEmpty(); - } - return false; - } - - @Execute - public void execute(EPartService partService) { - partService.saveAll(false); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools/templates/src/parts/SamplePart.java b/bundles/org.eclipse.e4.tools/templates/src/parts/SamplePart.java deleted file mode 100644 index 28ae4816..00000000 --- a/bundles/org.eclipse.e4.tools/templates/src/parts/SamplePart.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 - 2013 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * Lars Vogel <lars.Vogel@gmail.com> - Bug 419770 - *******************************************************************************/ -package @@packageName2@@; - -import javax.annotation.PostConstruct; -import javax.inject.Inject; - -import org.eclipse.e4.ui.di.Focus; -import org.eclipse.e4.ui.di.Persist; -import org.eclipse.e4.ui.model.application.ui.MDirtyable; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Text; - -public class SamplePart { - - private Text txtInput; - private TableViewer tableViewer; - - @Inject - private MDirtyable dirty; - - @PostConstruct - public void createComposite(Composite parent) { - parent.setLayout(new GridLayout(1, false)); - - txtInput = new Text(parent, SWT.BORDER); - txtInput.setMessage("Enter text to mark part as dirty"); - txtInput.addModifyListener(new ModifyListener() { - @Override - public void modifyText(ModifyEvent e) { - dirty.setDirty(true); - } - }); - txtInput.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - tableViewer = new TableViewer(parent); - - tableViewer.add("Sample item 1"); - tableViewer.add("Sample item 2"); - tableViewer.add("Sample item 3"); - tableViewer.add("Sample item 4"); - tableViewer.add("Sample item 5"); - tableViewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH)); - } - - @Focus - public void setFocus() { - tableViewer.getTable().setFocus(); - } - - @Persist - public void save() { - dirty.setDirty(false); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools/templates/toolControl.txtjet b/bundles/org.eclipse.e4.tools/templates/toolControl.txtjet deleted file mode 100644 index 524631cd..00000000 --- a/bundles/org.eclipse.e4.tools/templates/toolControl.txtjet +++ /dev/null @@ -1,23 +0,0 @@ -<%@ jet package="org.eclipse.e4.internal.tools.wizards.classes.templates" class="ToolControlTemplate" imports="org.eclipse.e4.internal.tools.wizards.classes.NewToolControlClassWizard.ToolControlClass" %> -<% ToolControlClass domainClass = (ToolControlClass)argument; %> -<% if( domainClass.getPackageFragment() != null && domainClass.getPackageFragment().getElementName().trim().length() > 0 ) { %> -package <%= domainClass.getPackageFragment().getElementName() %>; -<% } %> - -import javax.annotation.PostConstruct; -<% if( domainClass.isCreateDefaultConstructor() ) { %> -import javax.inject.Inject; -<% } %> - -public class <%= domainClass.getName() %> { - <% if( domainClass.isCreateDefaultConstructor() ) { %> - @Inject - public <%= domainClass.getName() %>() { - - } - <% } %> - @PostConstruct - public void <%= domainClass.getCreateGuiMethodName() %>() { - - } -}
\ No newline at end of file diff --git a/features/org.eclipse.e4.core.tools.feature/.project b/features/org.eclipse.e4.core.tools.feature/.project deleted file mode 100644 index d0fa7e44..00000000 --- a/features/org.eclipse.e4.core.tools.feature/.project +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.e4.core.tools.feature</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.pde.FeatureBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.pde.FeatureNature</nature> - </natures> -</projectDescription> diff --git a/features/org.eclipse.e4.core.tools.feature/.settings/org.eclipse.core.runtime.prefs b/features/org.eclipse.e4.core.tools.feature/.settings/org.eclipse.core.runtime.prefs deleted file mode 100644 index 5a0ad22d..00000000 --- a/features/org.eclipse.e4.core.tools.feature/.settings/org.eclipse.core.runtime.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -line.separator=\n diff --git a/features/org.eclipse.e4.core.tools.feature/build.properties b/features/org.eclipse.e4.core.tools.feature/build.properties deleted file mode 100644 index b3a611b5..00000000 --- a/features/org.eclipse.e4.core.tools.feature/build.properties +++ /dev/null @@ -1,2 +0,0 @@ -bin.includes = feature.xml,\ - feature.properties diff --git a/features/org.eclipse.e4.core.tools.feature/feature.properties b/features/org.eclipse.e4.core.tools.feature/feature.properties deleted file mode 100755 index 41626957..00000000 --- a/features/org.eclipse.e4.core.tools.feature/feature.properties +++ /dev/null @@ -1,149 +0,0 @@ -############################################################################### -# Copyright (c) 2000, 2009 IBM Corporation and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# IBM Corporation - initial API and implementation -############################################################################### -# feature.properties -# contains externalized strings for feature.xml -# "%foo" in feature.xml corresponds to the key "foo" in this file -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# This file should be translated. - -# "featureName" property - name of the feature -featureName=Eclipse e4 Tools (Incubation) - -# "providerName" property - name of the company that provides the feature -providerName=Eclipse.org - -# "updateSiteName" property - label for the update site -updateSiteName=The Eclipse Project Updates - -# "secondarySiteName" property - label for the update site -secondaryUpdateSiteName=Ganymede Discovery Site - - -# "description" property - description of the feature -description=Eclipse e4 Modeltooling - -# "copyright" property - text of the "Feature Update Copyright" -copyright=\ -Copyright (c) 2010 BestSolution.at, Soyatec and others.\n\ -All rights reserved. This program and the accompanying materials\n\ -are made available under the terms of the Eclipse Public License v1.0\n\ -which accompanies this distribution, and is available at\n\ -http://www.eclipse.org/legal/epl-v10.html\n\ -\n\ -Contributors:\n\ - BestSolution.at - initial API and implementation\n\ - Soytec - initial API and implementation\n -################ end of copyright property #################################### - -# "licenseURL" property - URL of the "Feature License" -# do not translate value - just change to point to a locale-specific HTML page -licenseURL=license.html - -# "license" property - text of the "Feature Update License" -# should be plain text version of license agreement pointed to be "licenseURL" -license=\ -ECLIPSE FOUNDATION SOFTWARE USER AGREEMENT\n\ -March 17, 2005\n\ -\n\ -Usage Of Content\n\ -\n\ -THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ -OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ -USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ -AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ -NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ -AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ -AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ -OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ -TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ -OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ -BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ -\n\ -Applicable Licenses\n\ -\n\ -Unless otherwise indicated, all Content made available by the Eclipse Foundation\n\ -is provided to you under the terms and conditions of the Eclipse Public\n\ -License Version 1.0 ("EPL"). A copy of the EPL is provided with this\n\ -Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ -For purposes of the EPL, "Program" will mean the Content.\n\ -\n\ -Content includes, but is not limited to, source code, object code,\n\ -documentation and other files maintained in the Eclipse.org CVS\n\ -repository ("Repository") in CVS modules ("Modules") and made available\n\ -as downloadable archives ("Downloads").\n\ -\n\ - - Content may be structured and packaged into modules to facilitate delivering,\n\ - extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ - plug-in fragments ("Fragments"), and features ("Features").\n\ - - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java? ARchive)\n\ - in a directory named "plugins".\n\ - - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ - Each Feature may be packaged as a sub-directory in a directory named "features".\n\ - Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ - numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ - - Features may also include other Features ("Included Features"). Within a Feature, files\n\ - named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ -\n\ -Features may also include other Features ("Included Features"). Files named\n\ -"feature.xml" may contain a list of the names and version numbers of\n\ -Included Features.\n\ -\n\ -The terms and conditions governing Plug-ins and Fragments should be\n\ -contained in files named "about.html" ("Abouts"). The terms and\n\ -conditions governing Features and Included Features should be contained\n\ -in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ -Licenses may be located in any directory of a Download or Module\n\ -including, but not limited to the following locations:\n\ -\n\ - - The top-level (root) directory\n\ - - Plug-in and Fragment directories\n\ - - Inside Plug-ins and Fragments packaged as JARs\n\ - - Sub-directories of the directory named "src" of certain Plug-ins\n\ - - Feature directories\n\ -\n\ -Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ -Eclipse Update Manager, you must agree to a license ("Feature Update\n\ -License") during the installation process. If the Feature contains\n\ -Included Features, the Feature Update License should either provide you\n\ -with the terms and conditions governing the Included Features or inform\n\ -you where you can locate them. Feature Update Licenses may be found in\n\ -the "license" property of files named "feature.properties". Such Abouts,\n\ -Feature Licenses and Feature Update Licenses contain the terms and\n\ -conditions (or references to such terms and conditions) that govern your\n\ -use of the associated Content in that directory.\n\ -\n\ -THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER\n\ -TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ -SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ -\n\ - - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ - - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ - - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ - - IBM Public License 1.0 (available at http://oss.software.ibm.com/developerworks/opensource/license10.html)\n\ - - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ - - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ -\n\ -IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ -TO USE OF THE CONTENT. If no About, Feature License or Feature Update License\n\ -is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ -govern that particular Content.\n\ -\n\ -Cryptography\n\ -\n\ -Content may contain encryption software. The country in which you are\n\ -currently may have restrictions on the import, possession, and use,\n\ -and/or re-export to another country, of encryption software. BEFORE\n\ -using any encryption software, please check the country's laws,\n\ -regulations and policies concerning the import, possession, or use,\n\ -and re-export of encryption software, to see if this is permitted.\n\ -\n\ -Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.\n -########### end of license property ########################################## diff --git a/features/org.eclipse.e4.core.tools.feature/feature.xml b/features/org.eclipse.e4.core.tools.feature/feature.xml deleted file mode 100644 index 75f368c9..00000000 --- a/features/org.eclipse.e4.core.tools.feature/feature.xml +++ /dev/null @@ -1,62 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<feature - id="org.eclipse.e4.core.tools.feature" - label="%featureName" - version="0.14.0.qualifier" - provider-name="%providerName"> - - <description> - %description - </description> - - <copyright> - %copyright - </copyright> - - <license url="%licenseURL"> - %license - </license> - - <plugin - id="org.eclipse.e4.tools.emf.editor3x" - download-size="0" - install-size="0" - version="0.0.0" - unpack="false"/> - - <plugin - id="org.eclipse.e4.tools.emf.ui" - download-size="0" - install-size="0" - version="0.0.0" - unpack="false"/> - - <plugin - id="org.eclipse.e4.tools.compat" - download-size="0" - install-size="0" - version="0.0.0" - unpack="false"/> - - <plugin - id="org.eclipse.e4.tools.services" - download-size="0" - install-size="0" - version="0.0.0" - unpack="false"/> - - <plugin - id="org.eclipse.e4.tools" - download-size="0" - install-size="0" - version="0.0.0" - unpack="false"/> - - <plugin - id="org.eclipse.e4.tools.jdt.templates" - download-size="0" - install-size="0" - version="0.0.0" - unpack="false"/> - -</feature> diff --git a/features/org.eclipse.e4.core.tools.feature/forceQualifierUpdate.txt b/features/org.eclipse.e4.core.tools.feature/forceQualifierUpdate.txt deleted file mode 100644 index 396f0875..00000000 --- a/features/org.eclipse.e4.core.tools.feature/forceQualifierUpdate.txt +++ /dev/null @@ -1,2 +0,0 @@ -# To force a version qualifier update add the bug here -Bug 403237 - o.e.e4.tools cannot be build with "mvn clean install" diff --git a/features/org.eclipse.e4.core.tools.feature/pom.xml b/features/org.eclipse.e4.core.tools.feature/pom.xml deleted file mode 100644 index dcaf8f4c..00000000 --- a/features/org.eclipse.e4.core.tools.feature/pom.xml +++ /dev/null @@ -1,47 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.eclipse.e4.tools</groupId> - <artifactId>e4-tools-aggregator</artifactId> - <version>0.17.0-SNAPSHOT</version> - <relativePath>../../</relativePath> - </parent> - - <groupId>org.eclipse.e4</groupId> - <artifactId>org.eclipse.e4.core.tools.feature</artifactId> - <version>0.14.0.qualifier</version> - <packaging>eclipse-feature</packaging> - - <build> - <plugins> - <plugin> - <groupId>org.eclipse.tycho.extras</groupId> - <artifactId>tycho-source-feature-plugin</artifactId> - <executions> - <execution> - <phase>package</phase> - <id>source-feature</id> - <goals> - <goal>source-feature</goal> - </goals> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.eclipse.tycho</groupId> - <artifactId>tycho-p2-plugin</artifactId> - <version>${tycho.version}</version> - <executions> - <execution> - <id>attached-p2-metadata</id> - <phase>package</phase> - <goals> - <goal>p2-metadata</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> -</project> diff --git a/features/org.eclipse.e4.core.tools.feature/sourceTemplateFeature/eclipse_update_120.jpg b/features/org.eclipse.e4.core.tools.feature/sourceTemplateFeature/eclipse_update_120.jpg Binary files differdeleted file mode 100755 index bfdf708a..00000000 --- a/features/org.eclipse.e4.core.tools.feature/sourceTemplateFeature/eclipse_update_120.jpg +++ /dev/null diff --git a/features/org.eclipse.e4.core.tools.feature/sourceTemplateFeature/epl-v10.html b/features/org.eclipse.e4.core.tools.feature/sourceTemplateFeature/epl-v10.html deleted file mode 100755 index ed4b1966..00000000 --- a/features/org.eclipse.e4.core.tools.feature/sourceTemplateFeature/epl-v10.html +++ /dev/null @@ -1,328 +0,0 @@ -<html xmlns:o="urn:schemas-microsoft-com:office:office" -xmlns:w="urn:schemas-microsoft-com:office:word" -xmlns="http://www.w3.org/TR/REC-html40"> - -<head> -<meta http-equiv=Content-Type content="text/html; charset=windows-1252"> -<meta name=ProgId content=Word.Document> -<meta name=Generator content="Microsoft Word 9"> -<meta name=Originator content="Microsoft Word 9"> -<link rel=File-List -href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml"> -<title>Eclipse Public License - Version 1.0</title> -<!--[if gte mso 9]><xml> - <o:DocumentProperties> - <o:Revision>2</o:Revision> - <o:TotalTime>3</o:TotalTime> - <o:Created>2004-03-05T23:03:00Z</o:Created> - <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved> - <o:Pages>4</o:Pages> - <o:Words>1626</o:Words> - <o:Characters>9270</o:Characters> - <o:Lines>77</o:Lines> - <o:Paragraphs>18</o:Paragraphs> - <o:CharactersWithSpaces>11384</o:CharactersWithSpaces> - <o:Version>9.4402</o:Version> - </o:DocumentProperties> -</xml><![endif]--><!--[if gte mso 9]><xml> - <w:WordDocument> - <w:TrackRevisions/> - </w:WordDocument> -</xml><![endif]--> -<style> -<!-- - /* Font Definitions */ -@font-face - {font-family:Tahoma; - panose-1:2 11 6 4 3 5 4 4 2 4; - mso-font-charset:0; - mso-generic-font-family:swiss; - mso-font-pitch:variable; - mso-font-signature:553679495 -2147483648 8 0 66047 0;} - /* Style Definitions */ -p.MsoNormal, li.MsoNormal, div.MsoNormal - {mso-style-parent:""; - margin:0in; - margin-bottom:.0001pt; - mso-pagination:widow-orphan; - font-size:12.0pt; - font-family:"Times New Roman"; - mso-fareast-font-family:"Times New Roman";} -p - {margin-right:0in; - mso-margin-top-alt:auto; - mso-margin-bottom-alt:auto; - margin-left:0in; - mso-pagination:widow-orphan; - font-size:12.0pt; - font-family:"Times New Roman"; - mso-fareast-font-family:"Times New Roman";} -p.BalloonText, li.BalloonText, div.BalloonText - {mso-style-name:"Balloon Text"; - margin:0in; - margin-bottom:.0001pt; - mso-pagination:widow-orphan; - font-size:8.0pt; - font-family:Tahoma; - mso-fareast-font-family:"Times New Roman";} -@page Section1 - {size:8.5in 11.0in; - margin:1.0in 1.25in 1.0in 1.25in; - mso-header-margin:.5in; - mso-footer-margin:.5in; - mso-paper-source:0;} -div.Section1 - {page:Section1;} ---> -</style> -</head> - -<body lang=EN-US style='tab-interval:.5in'> - -<div class=Section1> - -<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b> -</p> - -<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER -THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, -REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE -OF THIS AGREEMENT.</span> </p> - -<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p> - -<p><span style='font-size:10.0pt'>"Contribution" means:</span> </p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a) -in the case of the initial Contributor, the initial code and documentation -distributed under this Agreement, and<br clear=left> -b) in the case of each subsequent Contributor:</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i) -changes to the Program, and</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii) -additions to the Program;</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where -such changes and/or additions to the Program originate from and are distributed -by that particular Contributor. A Contribution 'originates' from a Contributor -if it was added to the Program by such Contributor itself or anyone acting on -such Contributor's behalf. Contributions do not include additions to the -Program which: (i) are separate modules of software distributed in conjunction -with the Program under their own license agreement, and (ii) are not derivative -works of the Program. </span></p> - -<p><span style='font-size:10.0pt'>"Contributor" means any person or -entity that distributes the Program.</span> </p> - -<p><span style='font-size:10.0pt'>"Licensed Patents " mean patent -claims licensable by a Contributor which are necessarily infringed by the use -or sale of its Contribution alone or when combined with the Program. </span></p> - -<p><span style='font-size:10.0pt'>"Program" means the Contributions -distributed in accordance with this Agreement.</span> </p> - -<p><span style='font-size:10.0pt'>"Recipient" means anyone who -receives the Program under this Agreement, including all Contributors.</span> </p> - -<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a) -Subject to the terms of this Agreement, each Contributor hereby grants Recipient -a non-exclusive, worldwide, royalty-free copyright license to<span -style='color:red'> </span>reproduce, prepare derivative works of, publicly -display, publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and object code -form.</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) -Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free -patent license under Licensed Patents to make, use, sell, offer to sell, import -and otherwise transfer the Contribution of such Contributor, if any, in source -code and object code form. This patent license shall apply to the combination -of the Contribution and the Program if, at the time the Contribution is added -by the Contributor, such addition of the Contribution causes such combination -to be covered by the Licensed Patents. The patent license shall not apply to -any other combinations which include the Contribution. No hardware per se is -licensed hereunder. </span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c) -Recipient understands that although each Contributor grants the licenses to its -Contributions set forth herein, no assurances are provided by any Contributor -that the Program does not infringe the patent or other intellectual property -rights of any other entity. Each Contributor disclaims any liability to Recipient -for claims brought by any other entity based on infringement of intellectual -property rights or otherwise. As a condition to exercising the rights and -licenses granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For example, -if a third party patent license is required to allow Recipient to distribute -the Program, it is Recipient's responsibility to acquire that license before -distributing the Program.</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d) -Each Contributor represents that to its knowledge it has sufficient copyright -rights in its Contribution, if any, to grant the copyright license set forth in -this Agreement. </span></p> - -<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p> - -<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the -Program in object code form under its own license agreement, provided that:</span> -</p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a) -it complies with the terms and conditions of this Agreement; and</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) -its license agreement:</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i) -effectively disclaims on behalf of all Contributors all warranties and -conditions, express and implied, including warranties or conditions of title -and non-infringement, and implied warranties or conditions of merchantability -and fitness for a particular purpose; </span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii) -effectively excludes on behalf of all Contributors all liability for damages, -including direct, indirect, special, incidental and consequential damages, such -as lost profits; </span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii) -states that any provisions which differ from this Agreement are offered by that -Contributor alone and not by any other party; and</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv) -states that source code for the Program is available from such Contributor, and -informs licensees how to obtain it in a reasonable manner on or through a -medium customarily used for software exchange.<span style='color:blue'> </span></span></p> - -<p><span style='font-size:10.0pt'>When the Program is made available in source -code form:</span> </p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a) -it must be made available under this Agreement; and </span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a -copy of this Agreement must be included with each copy of the Program. </span></p> - -<p><span style='font-size:10.0pt'>Contributors may not remove or alter any -copyright notices contained within the Program. </span></p> - -<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the -originator of its Contribution, if any, in a manner that reasonably allows -subsequent Recipients to identify the originator of the Contribution. </span></p> - -<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p> - -<p><span style='font-size:10.0pt'>Commercial distributors of software may -accept certain responsibilities with respect to end users, business partners -and the like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a commercial -product offering should do so in a manner which does not create potential -liability for other Contributors. Therefore, if a Contributor includes the -Program in a commercial product offering, such Contributor ("Commercial -Contributor") hereby agrees to defend and indemnify every other -Contributor ("Indemnified Contributor") against any losses, damages and -costs (collectively "Losses") arising from claims, lawsuits and other -legal actions brought by a third party against the Indemnified Contributor to -the extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor -to control, and cooperate with the Commercial Contributor in, the defense and -any related settlement negotiations. The Indemnified Contributor may participate -in any such claim at its own expense.</span> </p> - -<p><span style='font-size:10.0pt'>For example, a Contributor might include the -Program in a commercial product offering, Product X. That Contributor is then a -Commercial Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance claims and -warranties are such Commercial Contributor's responsibility alone. Under this -section, the Commercial Contributor would have to defend claims against the -other Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, the -Commercial Contributor must pay those damages.</span> </p> - -<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p> - -<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, -WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and distributing the -Program and assumes all risks associated with its exercise of rights under this -Agreement , including but not limited to the risks and costs of program errors, -compliance with applicable laws, damage to or loss of data, programs or -equipment, and unavailability or interruption of operations. </span></p> - -<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p> - -<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF -THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGES.</span> </p> - -<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p> - -<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid -or unenforceable under applicable law, it shall not affect the validity or -enforceability of the remainder of the terms of this Agreement, and without -further action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable.</span> </p> - -<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation -against any entity (including a cross-claim or counterclaim in a lawsuit) -alleging that the Program itself (excluding combinations of the Program with -other software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of the date -such litigation is filed. </span></p> - -<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement -shall terminate if it fails to comply with any of the material terms or -conditions of this Agreement and does not cure such failure in a reasonable -period of time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use and -distribution of the Program as soon as reasonably practicable. However, -Recipient's obligations under this Agreement and any licenses granted by -Recipient relating to the Program shall continue and survive. </span></p> - -<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute -copies of this Agreement, but in order to avoid inconsistency the Agreement is -copyrighted and may only be modified in the following manner. The Agreement -Steward reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement Steward has -the right to modify this Agreement. The Eclipse Foundation is the initial -Agreement Steward. The Eclipse Foundation may assign the responsibility to -serve as the Agreement Steward to a suitable separate entity. Each new version -of the Agreement will be given a distinguishing version number. The Program -(including Contributions) may always be distributed subject to the version of -the Agreement under which it was received. In addition, after a new version of -the Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly stated -in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to -the intellectual property of any Contributor under this Agreement, whether -expressly, by implication, estoppel or otherwise. All rights in the Program not -expressly granted under this Agreement are reserved.</span> </p> - -<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the -State of New York and the intellectual property laws of the United States of -America. No party to this Agreement will bring a legal action under this -Agreement more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation.</span> </p> - -<p class=MsoNormal><![if !supportEmptyParas]> <![endif]><o:p></o:p></p> - -</div> - -</body> - -</html>
\ No newline at end of file diff --git a/features/org.eclipse.e4.core.tools.feature/sourceTemplateFeature/feature.properties b/features/org.eclipse.e4.core.tools.feature/sourceTemplateFeature/feature.properties deleted file mode 100755 index 7b266ca8..00000000 --- a/features/org.eclipse.e4.core.tools.feature/sourceTemplateFeature/feature.properties +++ /dev/null @@ -1,144 +0,0 @@ -############################################################################### -# Copyright (c) 2000, 2007 IBM Corporation and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# IBM Corporation - initial API and implementation -############################################################################### -# feature.properties -# contains externalized strings for feature.xml -# "%foo" in feature.xml corresponds to the key "foo" in this file -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# This file should be translated. - -# "featureName" property - name of the feature -featureName=Eclipse e4 Tools Source (Incubation) - -# "providerName" property - name of the company that provides the feature -providerName=Eclipse.org - -# "updateSiteName" property - label for the update site -updateSiteName=The Eclipse Project Updates - -# "description" property - description of the feature -description=Source code zips for Eclipse E4 initiative. - -# "copyright" property - text of the "Feature Update Copyright" -copyright=\ -Copyright (c) 2000, 2007 IBM Corporation and others.\n\ -All rights reserved. This program and the accompanying materials\n\ -are made available under the terms of the Eclipse Public License v1.0\n\ -which accompanies this distribution, and is available at\n\ -http://www.eclipse.org/legal/epl-v10.html\n\ -\n\ -Contributors:\n\ - IBM Corporation - initial API and implementation\n -################ end of copyright property #################################### - -# "licenseURL" property - URL of the "Feature License" -# do not translate value - just change to point to a locale-specific HTML page -licenseURL=license.html - -# "license" property - text of the "Feature Update License" -# should be plain text version of license agreement pointed to be "licenseURL" -license=\ -ECLIPSE FOUNDATION SOFTWARE USER AGREEMENT\n\ -March 17, 2005\n\ -\n\ -Usage Of Content\n\ -\n\ -THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ -OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ -USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ -AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ -NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ -AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ -AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ -OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ -TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ -OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ -BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ -\n\ -Applicable Licenses\n\ -\n\ -Unless otherwise indicated, all Content made available by the Eclipse Foundation\n\ -is provided to you under the terms and conditions of the Eclipse Public\n\ -License Version 1.0 ("EPL"). A copy of the EPL is provided with this\n\ -Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ -For purposes of the EPL, "Program" will mean the Content.\n\ -\n\ -Content includes, but is not limited to, source code, object code,\n\ -documentation and other files maintained in the Eclipse.org CVS\n\ -repository ("Repository") in CVS modules ("Modules") and made available\n\ -as downloadable archives ("Downloads").\n\ -\n\ - - Content may be structured and packaged into modules to facilitate delivering,\n\ - extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ - plug-in fragments ("Fragments"), and features ("Features").\n\ - - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java? ARchive)\n\ - in a directory named "plugins".\n\ - - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ - Each Feature may be packaged as a sub-directory in a directory named "features".\n\ - Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ - numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ - - Features may also include other Features ("Included Features"). Within a Feature, files\n\ - named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ -\n\ -Features may also include other Features ("Included Features"). Files named\n\ -"feature.xml" may contain a list of the names and version numbers of\n\ -Included Features.\n\ -\n\ -The terms and conditions governing Plug-ins and Fragments should be\n\ -contained in files named "about.html" ("Abouts"). The terms and\n\ -conditions governing Features and Included Features should be contained\n\ -in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ -Licenses may be located in any directory of a Download or Module\n\ -including, but not limited to the following locations:\n\ -\n\ - - The top-level (root) directory\n\ - - Plug-in and Fragment directories\n\ - - Inside Plug-ins and Fragments packaged as JARs\n\ - - Sub-directories of the directory named "src" of certain Plug-ins\n\ - - Feature directories\n\ -\n\ -Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ -Eclipse Update Manager, you must agree to a license ("Feature Update\n\ -License") during the installation process. If the Feature contains\n\ -Included Features, the Feature Update License should either provide you\n\ -with the terms and conditions governing the Included Features or inform\n\ -you where you can locate them. Feature Update Licenses may be found in\n\ -the "license" property of files named "feature.properties". Such Abouts,\n\ -Feature Licenses and Feature Update Licenses contain the terms and\n\ -conditions (or references to such terms and conditions) that govern your\n\ -use of the associated Content in that directory.\n\ -\n\ -THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER\n\ -TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ -SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ -\n\ - - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ - - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ - - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ - - IBM Public License 1.0 (available at http://oss.software.ibm.com/developerworks/opensource/license10.html)\n\ - - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ - - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ -\n\ -IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ -TO USE OF THE CONTENT. If no About, Feature License or Feature Update License\n\ -is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ -govern that particular Content.\n\ -\n\ -Cryptography\n\ -\n\ -Content may contain encryption software. The country in which you are\n\ -currently may have restrictions on the import, possession, and use,\n\ -and/or re-export to another country, of encryption software. BEFORE\n\ -using any encryption software, please check the country's laws,\n\ -regulations and policies concerning the import, possession, or use,\n\ -and re-export of encryption software, to see if this is permitted.\n\ -\n\ -Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.\n -########### end of license property ########################################## diff --git a/features/org.eclipse.e4.core.tools.feature/sourceTemplateFeature/license.html b/features/org.eclipse.e4.core.tools.feature/sourceTemplateFeature/license.html deleted file mode 100755 index c6af966b..00000000 --- a/features/org.eclipse.e4.core.tools.feature/sourceTemplateFeature/license.html +++ /dev/null @@ -1,79 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> -<html> -<head> -<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1"> -<title>Eclipse.org Software User Agreement</title> -</head> - -<body lang="EN-US" link=blue vlink=purple> -<h2>Eclipse Foundation Software User Agreement</h2> -<p>March 17, 2005</p> - -<h3>Usage Of Content</h3> - -<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS - (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND - CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE - OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR - NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND - CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p> - -<h3>Applicable Licenses</h3> - -<p>Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 - ("EPL"). A copy of the EPL is provided with this Content and is also available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. - For purposes of the EPL, "Program" will mean the Content.</p> - -<p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse.org CVS repository ("Repository") in CVS - modules ("Modules") and made available as downloadable archives ("Downloads").</p> - -<ul> - <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").</li> - <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".</li> - <li>A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins - and/or Fragments associated with that Feature.</li> - <li>Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.</li> -</ul> - -<p>The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and -Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module -including, but not limited to the following locations:</p> - -<ul> - <li>The top-level (root) directory</li> - <li>Plug-in and Fragment directories</li> - <li>Inside Plug-ins and Fragments packaged as JARs</li> - <li>Sub-directories of the directory named "src" of certain Plug-ins</li> - <li>Feature directories</li> -</ul> - -<p>Note: if a Feature made available by the Eclipse Foundation is installed using the Eclipse Update Manager, you must agree to a license ("Feature Update License") during the -installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or -inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. -Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in -that directory.</p> - -<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE -OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p> - -<ul> - <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li> - <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li> - <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li> - <li>IBM Public License 1.0 (available at <a href="http://oss.software.ibm.com/developerworks/opensource/license10.html">http://oss.software.ibm.com/developerworks/opensource/license10.html</a>)</li> - <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li> - <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li> -</ul> - -<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please -contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p> - -<h3>Cryptography</h3> - -<p>Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to - another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, - possession, or use, and re-export of encryption software, to see if this is permitted.</p> - -<small>Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.</small> -</body> -</html> diff --git a/features/org.eclipse.e4.core.tools.feature/sourceTemplatePlugin/build.properties b/features/org.eclipse.e4.core.tools.feature/sourceTemplatePlugin/build.properties deleted file mode 100755 index cdb3ab38..00000000 --- a/features/org.eclipse.e4.core.tools.feature/sourceTemplatePlugin/build.properties +++ /dev/null @@ -1,12 +0,0 @@ -############################################################################### -# Copyright (c) 2000, 2006 IBM Corporation and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# IBM Corporation - initial API and implementation -############################################################################### -bin.includes = plugin.xml, src/**, META-INF/ -sourcePlugin = true @@ -42,14 +42,8 @@ </repositories> <modules> - <module>./bundles/org.eclipse.e4.tools</module> - <module>./bundles/org.eclipse.e4.tools.services</module> - <module>./bundles/org.eclipse.e4.tools.compat</module> <module>./bundles/org.eclipse.e4.tools.emf.liveeditor</module> - <module>./bundles/org.eclipse.e4.tools.emf.editor3x</module> - <module>./bundles/org.eclipse.e4.tools.emf.ui</module> <module>./bundles/org.eclipse.e4.tools.emf.ui.script.js</module> - <module>./bundles/org.eclipse.e4.tools.jdt.templates</module> <module>./bundles/org.eclipse.e4.tools.orion.css.editor</module> <module>./bundles/org.eclipse.e4.tools.orion.editor</module> <module>./bundles/org.eclipse.e4.tools.orion.editor.samples</module> @@ -59,7 +53,6 @@ <module>./bundles/org.eclipse.e4.tools.spy</module> <module>./bundles/org.eclipse.e4.tools.bundle.spy</module> <module>./bundles/org.eclipse.e4.tools.event.spy</module> - <module>./features/org.eclipse.e4.core.tools.feature</module> <module>./features/org.eclipse.e4.tools.orion.css.editor.feature</module> <module>./features/org.eclipse.e4.tools.css.spy.feature</module> <module>./features/org.eclipse.e4.tools.context.spy.feature</module> |
