diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 37211e6db1..eaee0e58ab 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -7,10 +7,10 @@ jobs: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - - name: Set up JDK 1.8 + - name: Set up JDK 21 uses: actions/setup-java@v4 with: - java-version: 8 + java-version: 21 distribution: temurin - uses: actions/cache@v4 with: diff --git a/.mvn/extensions.xml b/.mvn/extensions.xml index 10e3eba490..5e2ee31b97 100644 --- a/.mvn/extensions.xml +++ b/.mvn/extensions.xml @@ -1,8 +1,8 @@ - org.eclipse.tycho.extras - tycho-pomless - 1.7.0 + org.eclipse.tycho + tycho-build + 5.0.2 diff --git a/.mvn/jvm.config b/.mvn/jvm.config new file mode 100644 index 0000000000..d9a10a29f8 --- /dev/null +++ b/.mvn/jvm.config @@ -0,0 +1 @@ +-Djdk.xml.maxGeneralEntitySizeLimit=0 diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties index 72853742a6..6d503071da 100644 --- a/.mvn/wrapper/maven-wrapper.properties +++ b/.mvn/wrapper/maven-wrapper.properties @@ -1 +1 @@ -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip \ No newline at end of file +distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.9.11/apache-maven-3.9.11-bin.zip \ No newline at end of file diff --git a/.project b/.project index 3772f9b4f8..60756cd5be 100644 --- a/.project +++ b/.project @@ -16,12 +16,12 @@ - 1621691322894 + 1778528525239 30 org.eclipse.core.resources.regexFilterMatcher - node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000000..04cd618865 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "java.configuration.updateBuildConfiguration": "automatic" +} diff --git a/extras/org.erlide.licenses/.project b/extras/org.erlide.licenses/.project index c3ba574d0d..cfddf7306c 100644 --- a/extras/org.erlide.licenses/.project +++ b/extras/org.erlide.licenses/.project @@ -22,12 +22,12 @@ - 1621691322858 + 1778528525220 30 org.eclipse.core.resources.regexFilterMatcher - node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ diff --git a/extras/wrangler/.project b/extras/wrangler/.project deleted file mode 100644 index 5b17f5086b..0000000000 --- a/extras/wrangler/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - org.erlide.wrangler.parent - - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.m2e.core.maven2Nature - - - - 1621691323028 - - 30 - - org.eclipse.core.resources.regexFilterMatcher - node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ - - - - diff --git a/extras/wrangler/.settings/org.eclipse.core.resources.prefs b/extras/wrangler/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 99f26c0203..0000000000 --- a/extras/wrangler/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -encoding/=UTF-8 diff --git a/extras/wrangler/.settings/org.eclipse.m2e.core.prefs b/extras/wrangler/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index f897a7f1cb..0000000000 --- a/extras/wrangler/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/extras/wrangler/features/org.erlide.wrangler/.project b/extras/wrangler/features/org.erlide.wrangler/.project deleted file mode 100644 index a10462200e..0000000000 --- a/extras/wrangler/features/org.erlide.wrangler/.project +++ /dev/null @@ -1,34 +0,0 @@ - - - org.erlide.wrangler - - - - - - org.eclipse.pde.FeatureBuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.m2e.core.maven2Nature - org.eclipse.pde.FeatureNature - - - - 1621691323011 - - 30 - - org.eclipse.core.resources.regexFilterMatcher - node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ - - - - diff --git a/extras/wrangler/features/org.erlide.wrangler/.settings/org.eclipse.core.resources.prefs b/extras/wrangler/features/org.erlide.wrangler/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 99f26c0203..0000000000 --- a/extras/wrangler/features/org.erlide.wrangler/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -encoding/=UTF-8 diff --git a/extras/wrangler/features/org.erlide.wrangler/.settings/org.eclipse.m2e.core.prefs b/extras/wrangler/features/org.erlide.wrangler/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index f897a7f1cb..0000000000 --- a/extras/wrangler/features/org.erlide.wrangler/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/extras/wrangler/features/org.erlide.wrangler/build.properties b/extras/wrangler/features/org.erlide.wrangler/build.properties deleted file mode 100644 index 64f93a9f0b..0000000000 --- a/extras/wrangler/features/org.erlide.wrangler/build.properties +++ /dev/null @@ -1 +0,0 @@ -bin.includes = feature.xml diff --git a/extras/wrangler/features/org.erlide.wrangler/feature.xml b/extras/wrangler/features/org.erlide.wrangler/feature.xml deleted file mode 100644 index cb88174877..0000000000 --- a/extras/wrangler/features/org.erlide.wrangler/feature.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - - This feature provides the integration of the Wrangler refactoring -tool in Erlide. - - - - Copyright (c) 2004-2010 Gyorgy Orosz, Simon Thompson, Huiqing Li, -Erlide team and others. -All rights reserved. This program and the accompanying materials -are made available under the terms of the Eclipse Public License -v1.0 which accompanies this distribution, and is available at -http://www.eclipse.org/legal/epl-v10.html - - - - Eclipse Public License - v 1.0 -is available from http://www.eclipse.org/legal/epl-v10.html - - - - - - - - - - - - - - - - - diff --git a/extras/wrangler/features/org.erlide.wrangler/pom.xml b/extras/wrangler/features/org.erlide.wrangler/pom.xml deleted file mode 100644 index e63446842e..0000000000 --- a/extras/wrangler/features/org.erlide.wrangler/pom.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - 4.0.0 - - org.erlide - org.erlide.wrangler.parent - 1.0.0 - ../.. - - - org.erlide.wrangler - 0.11.0-SNAPSHOT - eclipse-feature - diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/.classpath b/extras/wrangler/plugins/org.erlide.wrangler.core/.classpath deleted file mode 100644 index 9c389258f9..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.core/.classpath +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/.gitignore b/extras/wrangler/plugins/org.erlide.wrangler.core/.gitignore deleted file mode 100644 index 869a1228aa..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.core/.gitignore +++ /dev/null @@ -1 +0,0 @@ -!ebin/*.beam \ No newline at end of file diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/.project b/extras/wrangler/plugins/org.erlide.wrangler.core/.project deleted file mode 100644 index 701a5e3826..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.core/.project +++ /dev/null @@ -1,45 +0,0 @@ - - - org.erlide.wrangler.core - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.m2e.core.maven2Nature - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - - - - 1621691323019 - - 30 - - org.eclipse.core.resources.regexFilterMatcher - node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ - - - - diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/.settings/org.eclipse.core.resources.prefs b/extras/wrangler/plugins/org.erlide.wrangler.core/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 370ae2c698..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.core/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -encoding/=ISO-8859-1 diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/.settings/org.eclipse.jdt.core.prefs b/extras/wrangler/plugins/org.erlide.wrangler.core/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 590ab09f99..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.core/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,119 +0,0 @@ -eclipse.preferences.version=1 -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=enabled -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.nonnull.secondary= -org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault -org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary= -org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable -org.eclipse.jdt.core.compiler.annotation.nullable.secondary= -org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.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=warning -org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning -org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled -org.eclipse.jdt.core.compiler.problem.fieldHiding=warning -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=enabled -org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning -org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning -org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning -org.eclipse.jdt.core.compiler.problem.missingDefaultCase=warning -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.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=ignore -org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning -org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning -org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning -org.eclipse.jdt.core.compiler.problem.nullReference=error -org.eclipse.jdt.core.compiler.problem.nullSpecViolation=warning -org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning -org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning -org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning -org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning -org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning -org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning -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=warning -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=enabled -org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled -org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled -org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore -org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning -org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled -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.unlikelyCollectionMethodArgumentType=warning -org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled -org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info -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=warning -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.unusedExceptionParameter=ignore -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=ignore -org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.release=disabled -org.eclipse.jdt.core.compiler.source=1.8 diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/.settings/org.eclipse.m2e.core.prefs b/extras/wrangler/plugins/org.erlide.wrangler.core/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index f897a7f1cb..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.core/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/.settings/org.erlide.core.prefs b/extras/wrangler/plugins/org.erlide.wrangler.core/.settings/org.erlide.core.prefs deleted file mode 100644 index a892907202..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.core/.settings/org.erlide.core.prefs +++ /dev/null @@ -1,6 +0,0 @@ -#Thu Nov 24 12:07:45 CET 2011 -backend_version=R15B -eclipse.preferences.version=1 -include_dirs=wrangler/include; -output_dir=wrangler/ebin -source_dirs=wrangler/src/gen_refacs;wrangler/src/gen_composite_refacs;wrangler/src; diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/META-INF/MANIFEST.MF b/extras/wrangler/plugins/org.erlide.wrangler.core/META-INF/MANIFEST.MF deleted file mode 100644 index 88c82d3438..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.core/META-INF/MANIFEST.MF +++ /dev/null @@ -1,10 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: Wrangler Core Plugin -Bundle-SymbolicName: org.erlide.wrangler.core;singleton:=true -Bundle-Version: 0.11.0.qualifier -Bundle-Vendor: UKC -Require-Bundle: org.erlide.core;bundle-version="0.32.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 -Import-Package: org.eclipse.jdt.annotation;resolution:=optional -Automatic-Module-Name: org.erlide.wrangler.core diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/build.properties b/extras/wrangler/plugins/org.erlide.wrangler.core/build.properties deleted file mode 100644 index f5131b65ed..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.core/build.properties +++ /dev/null @@ -1,9 +0,0 @@ -bin.includes = META-INF/,\ - plugin.xml,\ - wrangler/ebin/,\ - wrangler/app/ -src.includes = wrangler/app/,\ - wrangler/include/ -customBuildCallbacks=customBuildCallbacks.xml -customBuildCallbacks.inheritall=true -customBuildCallbacks.failonerror=true diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/plugin.xml b/extras/wrangler/plugins/org.erlide.wrangler.core/plugin.xml deleted file mode 100644 index 7c3cc7a0cd..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.core/plugin.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/pom.xml b/extras/wrangler/plugins/org.erlide.wrangler.core/pom.xml deleted file mode 100644 index 58218b9950..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.core/pom.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - 4.0.0 - - org.erlide - org.erlide.wrangler.parent - 1.0.0 - ../.. - - - org.erlide.wrangler.core - 0.11.0-SNAPSHOT - eclipse-plugin - - - ISO-8859-1 - - diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/app/wrangler.app b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/app/wrangler.app deleted file mode 100644 index d0e2945b01..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/app/wrangler.app +++ /dev/null @@ -1,112 +0,0 @@ -{application, wrangler, - [ {description, "Wrangler: the Erlang refactorer"}, - {vsn, "1.0"}, - {modules, [api_ast_traverse, - api_interface, - api_refac, - api_spec, - api_wrangler, - distel, - distel_ie, - emacs_inspec, - emacs_wrangler, - fdoc, - gen_composite_refac, - gen_refac, - inspec_examples, - inspec_feedback_wrangler, - inspec_lib, - otp_doc, - refac_add_a_tag, - refac_clone_evolution, - refac_comment_out_spec, - refac_duplicated_code, - refac_expr_search, - refac_fold_against_macro, - refac_fold_expression, - refac_fun_to_process, - refac_gen, - refac_inc_sim_code, - refac_inline_var, - refac_intro_new_var, - refac_move_fun, - refac_new_fun, - refac_new_let, - refac_new_macro, - refac_qc_gen, - refac_register_pid, - refac_rename_fun, - refac_rename_mod, - refac_rename_process, - refac_rename_var, - refac_sim_code, - refac_sim_expr_search, - refac_state_to_record, - refac_tuple, - refac_unfold_fun_app, - wrangler, - wrangler_add_new_refac, - wrangler_annotate_ast, - wrangler_annotate_pid, - wrangler_anti_unification, - wrangler_ast_server, - wrangler_atom_annotation, - wrangler_atom_utils, - wrangler_backup_server, - wrangler_callgraph, - wrangler_callgraph_server, - wrangler_cmd_server, - wrangler_code_inspector_lib, - wrangler_code_search_utils, - wrangler_comment_scan, - wrangler_epp, - wrangler_epp_dodger, - wrangler_error_logger, - wrangler_expand_rule, - wrangler_gen, - wrangler_gen_refac_server, - wrangler_generalised_unification, - wrangler_io, - wrangler_misc, - wrangler_modularity_inspection, - wrangler_module_graph, - wrangler_modulegraph_server, - wrangler_prettypr, - wrangler_prettypr_0, - wrangler_preview_server, - wrangler_recomment, - wrangler_refacs, - wrangler_scan, - wrangler_scan_with_layout, - wrangler_side_effect, - wrangler_slice, - wrangler_suffix_tree, - wrangler_sup, - wrangler_syntax, - wrangler_syntax_lib, - wrangler_type_info, - wrangler_undo_server, - wrangler_unification, - wrangler_write_file, - wrangler_parse, - refac_batch_clone_elimination, - refac_add_an_import_attribute, - refac_apply_to_remote_call, - refac_keysearch_to_keyfind, - refac_remove_an_argument, - refac_remove_an_import_attribute, - refac_specialise_a_function, - refac_swap_function_arguments, - refac_add_to_export - ]}, - {registered, [wrangler_ast_server, - wrangler_callgraph_server, - wrangler_modulegraph_server, - wrangler_error_logger, - wrangler_preview_server, - wrangler_undo_server, - wrangler_backup_server, - wrangler_cmd_server, - wrangler_gen_refac_server]}, - {applications, [kernel, stdlib]}, - {mod, {wrangler, []}}]}. diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/.marker b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/.marker deleted file mode 100644 index 8b13789179..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/.marker +++ /dev/null @@ -1 +0,0 @@ - diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/api_ast_traverse.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/api_ast_traverse.beam deleted file mode 100644 index b454d6dd48..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/api_ast_traverse.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/api_interface.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/api_interface.beam deleted file mode 100644 index 473a47e117..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/api_interface.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/api_refac.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/api_refac.beam deleted file mode 100644 index 04e00a840f..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/api_refac.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/api_spec.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/api_spec.beam deleted file mode 100644 index f3ddb76ae3..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/api_spec.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/api_wrangler.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/api_wrangler.beam deleted file mode 100644 index e02337aa87..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/api_wrangler.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/distel.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/distel.beam deleted file mode 100644 index 5fd2e9abf5..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/distel.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/distel_ie.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/distel_ie.beam deleted file mode 100644 index 61181f6e3a..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/distel_ie.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/emacs_inspec.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/emacs_inspec.beam deleted file mode 100644 index f1924edfa3..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/emacs_inspec.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/emacs_wrangler.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/emacs_wrangler.beam deleted file mode 100644 index 9fe54700c3..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/emacs_wrangler.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/fdoc.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/fdoc.beam deleted file mode 100644 index 7ff1dd8c55..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/fdoc.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/gen_composite_refac.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/gen_composite_refac.beam deleted file mode 100644 index b7071a9a88..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/gen_composite_refac.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/gen_refac.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/gen_refac.beam deleted file mode 100644 index c2de28ca80..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/gen_refac.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/inspec_examples.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/inspec_examples.beam deleted file mode 100644 index 1830949a5e..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/inspec_examples.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/inspec_feedback_wrangler.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/inspec_feedback_wrangler.beam deleted file mode 100644 index 25138151ea..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/inspec_feedback_wrangler.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/inspec_lib.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/inspec_lib.beam deleted file mode 100644 index 499d33c104..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/inspec_lib.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/otp_doc.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/otp_doc.beam deleted file mode 100644 index 72a816965d..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/otp_doc.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_add_a_tag.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_add_a_tag.beam deleted file mode 100644 index 7784f0ef62..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_add_a_tag.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_add_an_import_attribute.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_add_an_import_attribute.beam deleted file mode 100644 index ad035f526d..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_add_an_import_attribute.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_add_to_export.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_add_to_export.beam deleted file mode 100644 index 6470c5aab2..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_add_to_export.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_apply_to_remote_call.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_apply_to_remote_call.beam deleted file mode 100644 index b83e45a3ee..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_apply_to_remote_call.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_batch_clone_elimination.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_batch_clone_elimination.beam deleted file mode 100644 index 5339995730..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_batch_clone_elimination.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_clone_evolution.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_clone_evolution.beam deleted file mode 100644 index 1922bdf466..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_clone_evolution.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_comment_out_spec.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_comment_out_spec.beam deleted file mode 100644 index bb5065e483..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_comment_out_spec.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_duplicated_code.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_duplicated_code.beam deleted file mode 100644 index bb153732c8..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_duplicated_code.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_expr_search.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_expr_search.beam deleted file mode 100644 index 3a51c82516..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_expr_search.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_fold_against_macro.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_fold_against_macro.beam deleted file mode 100644 index fa24e077ee..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_fold_against_macro.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_fold_expression.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_fold_expression.beam deleted file mode 100644 index a1331fed85..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_fold_expression.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_fun_to_process.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_fun_to_process.beam deleted file mode 100644 index d17ad5e7b1..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_fun_to_process.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_gen.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_gen.beam deleted file mode 100644 index b3edf8b5da..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_gen.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_inc_sim_code.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_inc_sim_code.beam deleted file mode 100644 index 984967ab13..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_inc_sim_code.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_inline_var.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_inline_var.beam deleted file mode 100644 index df99ab4d73..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_inline_var.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_intro_new_var.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_intro_new_var.beam deleted file mode 100644 index 7c45737529..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_intro_new_var.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_keysearch_to_keyfind.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_keysearch_to_keyfind.beam deleted file mode 100644 index 2485a311b4..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_keysearch_to_keyfind.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_move_fun.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_move_fun.beam deleted file mode 100644 index 58cb6be6bc..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_move_fun.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_new_fun.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_new_fun.beam deleted file mode 100644 index 7d9f61fd1d..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_new_fun.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_new_let.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_new_let.beam deleted file mode 100644 index 229a3eafc4..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_new_let.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_new_macro.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_new_macro.beam deleted file mode 100644 index 988fba28b2..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_new_macro.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_qc_gen.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_qc_gen.beam deleted file mode 100644 index c47ab37c90..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_qc_gen.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_register_pid.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_register_pid.beam deleted file mode 100644 index 1c1c748d9e..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_register_pid.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_remove_an_argument.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_remove_an_argument.beam deleted file mode 100644 index c5d4d332f7..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_remove_an_argument.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_remove_an_import_attribute.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_remove_an_import_attribute.beam deleted file mode 100644 index e2fc426e83..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_remove_an_import_attribute.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_rename_fun.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_rename_fun.beam deleted file mode 100644 index 8b55771016..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_rename_fun.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_rename_mod.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_rename_mod.beam deleted file mode 100644 index b4c642e94f..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_rename_mod.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_rename_process.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_rename_process.beam deleted file mode 100644 index 958a627356..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_rename_process.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_rename_var.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_rename_var.beam deleted file mode 100644 index bce4c36bd2..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_rename_var.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_sim_code.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_sim_code.beam deleted file mode 100644 index 88fe6259db..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_sim_code.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_sim_expr_search.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_sim_expr_search.beam deleted file mode 100644 index ebea9d0bd5..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_sim_expr_search.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_specialise_a_function.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_specialise_a_function.beam deleted file mode 100644 index b0984bffba..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_specialise_a_function.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_state_to_record.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_state_to_record.beam deleted file mode 100644 index a19055aa03..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_state_to_record.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_swap_function_arguments.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_swap_function_arguments.beam deleted file mode 100644 index 0786272e37..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_swap_function_arguments.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_tuple.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_tuple.beam deleted file mode 100644 index 2499792e5e..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_tuple.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_unfold_fun_app.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_unfold_fun_app.beam deleted file mode 100644 index 049aae3e2f..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/refac_unfold_fun_app.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler.beam deleted file mode 100644 index d2faea35ba..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_add_new_refac.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_add_new_refac.beam deleted file mode 100644 index 3132fcdd2c..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_add_new_refac.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_annotate_ast.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_annotate_ast.beam deleted file mode 100644 index af65a02185..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_annotate_ast.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_annotate_pid.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_annotate_pid.beam deleted file mode 100644 index 5e03b8888f..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_annotate_pid.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_anti_unification.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_anti_unification.beam deleted file mode 100644 index bf1375b336..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_anti_unification.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_ast_server.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_ast_server.beam deleted file mode 100644 index 31587fc510..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_ast_server.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_atom_annotation.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_atom_annotation.beam deleted file mode 100644 index 12ef4a0491..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_atom_annotation.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_atom_utils.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_atom_utils.beam deleted file mode 100644 index 43892e08ee..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_atom_utils.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_backup_server.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_backup_server.beam deleted file mode 100644 index 320e3e6ee0..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_backup_server.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_callgraph.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_callgraph.beam deleted file mode 100644 index f54e39590d..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_callgraph.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_callgraph_server.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_callgraph_server.beam deleted file mode 100644 index 0a98eec76b..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_callgraph_server.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_cmd_server.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_cmd_server.beam deleted file mode 100644 index 41ded4f213..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_cmd_server.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_code_inspector_lib.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_code_inspector_lib.beam deleted file mode 100644 index bda4d4e1be..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_code_inspector_lib.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_code_search_utils.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_code_search_utils.beam deleted file mode 100644 index 6b35062aaa..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_code_search_utils.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_comment_scan.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_comment_scan.beam deleted file mode 100644 index 66b6e34ee7..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_comment_scan.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_epp.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_epp.beam deleted file mode 100644 index 16d531ea99..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_epp.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_epp_dodger.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_epp_dodger.beam deleted file mode 100644 index 8e6a04e4bb..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_epp_dodger.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_error_logger.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_error_logger.beam deleted file mode 100644 index ce1ec6b58a..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_error_logger.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_expand_rule.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_expand_rule.beam deleted file mode 100644 index eaac98c615..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_expand_rule.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_gen.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_gen.beam deleted file mode 100644 index 7a3ed2cee3..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_gen.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_gen_refac_server.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_gen_refac_server.beam deleted file mode 100644 index c9169694de..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_gen_refac_server.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_generalised_unification.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_generalised_unification.beam deleted file mode 100644 index d7753be15e..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_generalised_unification.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_io.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_io.beam deleted file mode 100644 index 922061995f..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_io.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_misc.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_misc.beam deleted file mode 100644 index 4254416f16..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_misc.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_modularity_inspection.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_modularity_inspection.beam deleted file mode 100644 index f5b8a3aa6f..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_modularity_inspection.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_module_graph.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_module_graph.beam deleted file mode 100644 index ecdd16a9a1..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_module_graph.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_modulegraph_server.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_modulegraph_server.beam deleted file mode 100644 index f8dabe16bc..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_modulegraph_server.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_parse.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_parse.beam deleted file mode 100644 index 5a35c61bad..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_parse.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_prettypr.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_prettypr.beam deleted file mode 100644 index 307626d71e..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_prettypr.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_prettypr_0.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_prettypr_0.beam deleted file mode 100644 index a6a97f75fe..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_prettypr_0.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_preview_server.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_preview_server.beam deleted file mode 100644 index f744b57c7d..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_preview_server.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_recomment.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_recomment.beam deleted file mode 100644 index c402da2525..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_recomment.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_refacs.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_refacs.beam deleted file mode 100644 index a48426e69f..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_refacs.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_scan.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_scan.beam deleted file mode 100644 index c50988e3db..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_scan.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_scan_with_layout.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_scan_with_layout.beam deleted file mode 100644 index dad456b34a..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_scan_with_layout.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_side_effect.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_side_effect.beam deleted file mode 100644 index 81e5fc4d75..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_side_effect.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_slice.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_slice.beam deleted file mode 100644 index 05fd980d58..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_slice.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_suffix_tree.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_suffix_tree.beam deleted file mode 100644 index 806698d0a9..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_suffix_tree.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_sup.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_sup.beam deleted file mode 100644 index 40fb0f5314..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_sup.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_syntax.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_syntax.beam deleted file mode 100644 index e18667ae2b..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_syntax.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_syntax_lib.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_syntax_lib.beam deleted file mode 100644 index 6e475d90cf..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_syntax_lib.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_type_info.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_type_info.beam deleted file mode 100644 index 3ce1380ee1..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_type_info.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_undo_server.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_undo_server.beam deleted file mode 100644 index 6953c2949f..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_undo_server.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_unification.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_unification.beam deleted file mode 100644 index 0db742a3d7..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_unification.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_write_file.beam b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_write_file.beam deleted file mode 100644 index 04e7b1235c..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/ebin/wrangler_write_file.beam and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/include/wrangler.hrl b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/include/wrangler.hrl deleted file mode 100644 index 6fa2b7dff7..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/include/wrangler.hrl +++ /dev/null @@ -1,187 +0,0 @@ -%%% This is an -*- Erlang -*- file. -%%%------------------------------------------------------------------- -%%% File : wrangler.hrl -%%%------------------------------------------------------------------- - --compile({parse_transform, wrangler_expand_rule}). - --record(rule, {template_before, - template_after, - condition}). - --record(args, {current_file_name :: filename(), - cursor_pos :: pos(), - highlight_range :: {pos(), pos()}, - user_inputs :: [string()], - focus_sel :: any(), - selective :: boolean(), - search_paths ::[dir()|filename()], - tabwidth =8 ::integer() - }). - --type args() :: #args{}. --type(filename()::string()). --type(modulename()::atom()). --type(functionname()::atom()). --type(functionarity()::integer()). --type(dir()::string()). --type(syntaxTree() :: {tree, any(), any(), any()}| {wrapper, any(), any(), any()}). --type(pos()::{integer(), integer()}). --type(line()::integer()). --type(col()::integer()). --type(key():: attributes | errors | exports | functions | imports | module_imports | module | records | rules | warnings). --type(module_info()::[{key(), any()}]). --type(anyterm()::any()). --type(editor()::emacs|eclipse). --type(whitespace() :: '\t' | '\n' | ' '). --type(token() :: {'var', pos(), atom()} | {'integer', pos(), integer()} | {'string', pos(), string()} - | {'float', pos(), float()} | {'char', pos(), char()} - | {'atom', pos(), atom()} | {atom(), pos()} - | {'whitespace', pos(), whitespace()} | {'comment', pos(), string()}). - --type(scc_order()::[[{{atom(), atom(), integer()}, syntaxTree()}]]). --type(callercallee()::[{{modulename(), functionname(), functionarity()}, [{modulename(), functionname(), functionarity()}]}]). --type(external_calls()::[{atom(), atom(), integer()}]). --record(callgraph, {'callercallee', 'scc_order', 'external_calls'}). - --define(EMACS, true). - --ifdef(EMACS). --define(wrangler_io(__String, __Args),wrangler_io:format(__String, __Args)). --else. --define(wrangler_io(__String, __Args), ok). --endif. - --define(RULE(Before, After, Cond), - fun()-> - api_refac:check_collect_template(Before, 'RULE'), - {rule, fun(_W_Node_) -> - _W_NewCond=fun(_W_Bind_) -> - api_refac:make_cond(Cond, _W_Bind_) - end, - case api_refac:match(Before, _W_Node_, _W_NewCond) of - {true, _W_Bind1_} -> - _This@=_W_Node_, - api_refac:generate_bindings(Before, '_W_Bind1_'), - _W_After=fun()-> After end(), - {wrangler_misc:reset_pos_and_range(_W_After), true}; - false ->{_W_Node_, false} - end - end, Before} - end()). - --define(T(Template), api_refac:template(Template)). - --define(TO_AST(Str), api_refac:quote(Str)). - --define(PP(Node), api_refac:pp(Node)). - --define(COLLECT(Temp,Collector, Cond), - fun()-> - api_refac:check_collect_template(Temp, 'COLLECT'), - {collector, fun(_W_File_,_W_Node_) -> - _W_NewCond_=fun(_W_Bind_) -> - _This@=_W_Node_, - _File@=_W_File_, - api_refac:make_cond(Cond, _W_Bind_) - end, - case api_refac:match(Temp, _W_Node_, _W_NewCond_) of - {true, _W_Bind1_} -> - _This@=_W_Node_, - _File@=_W_File_, - api_refac:generate_bindings(Temp, '_W_Bind1_'), - _W_NewCollector_=fun() -> - api_refac:expand_collector(Collector) - end, - {_W_NewCollector_(), true}; - false -> - {none, false} - end - end, Temp} - end()). - - - --define(COLLECT_LOC(Temp, Cond), - fun()-> - api_refac:check_collect_template(Temp, 'COLLECT'), - {collector, fun(_W_File_,_W_Node_) -> - _W_NewCond_=fun(_W_Bind_) -> - _This@=_W_Node_, - _File@=_W_File_, - api_refac:make_cond(Cond, _W_Bind_) - end, - case api_refac:match(Temp, _W_Node_, _W_NewCond_) of - {true, _W_Bind1_} -> - _This@=_W_Node_, - _File@=_W_File_, - {{_File@, api_refac:start_end_loc(_This@)}, true}; - false -> - {none, false} - end - end, Temp} - end()). - --define(EQUAL(Node1, Node2), - api_refac:equal(Node1, Node2)). - --define(MATCH(Temp, Node), - api_refac:expand_match(Temp, Node, fun(_) -> true end)). - - --define(MATCH(Temp, Node, Cond), - begin - _W_NewCond =fun(_W_Bind_) -> - api_refac:make_cond(Cond, _W_Bind_) - end, - api_refac:expand_match(Temp, Node, _W_NewCond) - end). - - --define(STOP_TD_TP(Rules, FileOrDirs), - api_refac:search_and_transform(Rules, FileOrDirs, stop_td_tp)). - --define(FULL_TD_TP(Rules, FileOrDirs), - api_refac:search_and_transform(Rules, FileOrDirs, full_td_tp)). - --define(FULL_TD_TU(Collectors, FileOrDirs), - api_refac:search_and_collect(Collectors, FileOrDirs, full_td_tu)). - --define(STOP_TD_TU(Collectors, FileOrDirs), - api_refac:search_and_collect(Collectors, FileOrDirs, stop_td_tu)). - --define(FUN_APPLY(M,F,A), - {meta_apply, api_refac:meta_apply_templates({M,F,A})}). - --define(interactive(ERs), - {interactive, atomic, ERs}). - --define(interactive(Qualifier, ERs), - {interactive, Qualifier, ERs}). - --define(repeat_interactive(ERs), - {repeat_interactive, atomic, ERs}). - --define(repeat_interactive(Qualifier, ERs), - {repeat_interactive, Qualifier, ERs}). - --define(if_then(Cond, Refac), - {if_then, fun()-> Cond end, Refac}). - --define(while(Cond, Refac), - {while, fun()->Cond end, atomic, Refac}). - --define(while(Cond, Qualifier, Refac), - {while, fun()->Cond end, Qualifier,Refac}). - --define(non_atomic(CRs),{non_atomic, CRs}). - --define(atomic(CRs), {atomic, CRs}). - --define(refac_(RefacName, Args), {refac_, RefacName, fun()->Args end}). - --define(refac_(RefacName, Args, SearchPaths), - {refac_, RefacName, fun()->Args++[SearchPaths] end}). - --define(current(M,F,A), - wrangler_cmd_server:update_entity({M,F,A})). diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/include/wrangler_internal.hrl b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/include/wrangler_internal.hrl deleted file mode 100644 index d034192acd..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/include/wrangler_internal.hrl +++ /dev/null @@ -1,106 +0,0 @@ -%%% This is an -*- Erlang -*- file. -%%%------------------------------------------------------------------- -%%% File : wrangler.hrl -%%%------------------------------------------------------------------- - --record(options, {search_paths=[], - include_dirs=[], - plt_libs= [kernel,stdlib] - }). - --record(attr, {pos = {0,0}, ann = [], com = none}). - -% type defined by typer: --record(typer_analysis, - {mode , - macros = [] , % {macro_name, value} - includes = [] , - - %% Esp for Dialyzer - %% ---------------------- - code_server = dialyzer_codeserver:new(), - callgraph = dialyzer_callgraph:new(), - ana_files = [], - plt = none, - - %% Esp for TypEr - %% ---------------------- - t_files = [], - - %% For choosing between contracts or comments - contracts = true, - - %% Any file in 'final_files' is compilable. - %% And we need to keep it as {FileName,ModuleName} - %% in case filename does NOT match with moduleName - final_files = [], - - ex_func = dict:new(), - record = dict:new(), - - %% Functions: the line number of the function - %% should be kept as well - func = dict:new(), - inc_func = dict:new(), - trust_plt = dialyzer_plt:new()}). - - --define(DEFAULT_LOC, - {0, 0}). %% default defining location. --define(DEFAULT_MODULE, - unknown). %% default module name. - --define(ModuleGraphTab, wrangler_modulegraph_tab). - --define(DEFAULT_TABWIDTH, 8). --define(DEFAULT_EUNIT_TEST_SUFFIX, "_test"). --define(DEFAULT_EUNIT_GENERATOR_SUFFIX, "_test_"). --define(DEFAULT_EUNIT_TESTMODULE_SUFFIX, "_tests"). --define(DEFAULT_EQC_PROP_PREFIX, "prop_"). --define(DEFAULT_TS_MODULE_SUFFIX, "_SUITE"). --define(EMACS, true). --define(MONITOR, true). - --define(WRANGLER_DIR, filename:dirname(lists:filter(fun(X)-> lists:suffix("wrangler/ebin", X) end, code:get_path())) ). - --ifdef(EMACS). --define(wrangler_io(__String, __Args),wrangler_io:format(__String, __Args)). --else. --define(wrangler_io(__String, __Args), ok). --endif. - --define(log_warning(String), wrangler_error_logger:add_to_logger({warning, String})). - -%%-define(DEBUG, true) - --ifdef(DEBUG). --define(debug(__String, __Args), ?wrangler_io(__String, __Args)). --else. --define(debug(__String, __Args), ok). --endif. - - --type(filename()::string()). --type(modulename()::atom()). --type(functionname()::atom()). --type(functionarity()::integer()). --type(dir()::string()). --type (syntaxTree() :: {tree, any(), any(), any()}| {wrapper, any(), any(), any()}). --type(pos()::{integer(), integer()}). --type(line()::integer()). --type(col()::integer()). --type(key():: attributes | errors | exports | functions | imports | module_imports | module | records | rules | warnings). --type(module_info()::[{key(), any()}]). --type(anyterm()::any()). --type(editor()::emacs|eclipse). --type(whitespace() :: '\t' | '\n' | ' '). --type(token() :: {'var', pos(), atom()} | {'integer', pos(), integer()} | {'string', pos(), string()} - | {'float', pos(), float()} | {'char', pos(), char()} - | {'atom', pos(), atom()} | {atom(), pos()} - | {'whitespace', pos(), whitespace()} | {'comment', pos(), string()}). - --type(scc_order()::[[{{atom(), atom(), integer()}, syntaxTree()}]]). --type(callercallee()::[{{modulename(), functionname(), functionarity()}, [{modulename(), functionname(), functionarity()}]}]). --type(external_calls()::[{atom(), atom(), integer()}]). --record(callgraph, {'callercallee', 'scc_order', 'external_calls'}). - diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/priv/dialyzer_plt b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/priv/dialyzer_plt deleted file mode 100644 index b94e907776..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/priv/dialyzer_plt and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/priv/side_effect_plt b/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/priv/side_effect_plt deleted file mode 100644 index 76fafeb6f7..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.core/wrangler/priv/side_effect_plt and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.help/.classpath b/extras/wrangler/plugins/org.erlide.wrangler.help/.classpath deleted file mode 100644 index 9c389258f9..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.help/.classpath +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/extras/wrangler/plugins/org.erlide.wrangler.help/.project b/extras/wrangler/plugins/org.erlide.wrangler.help/.project deleted file mode 100644 index be7e05a231..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.help/.project +++ /dev/null @@ -1,45 +0,0 @@ - - - org.erlide.wrangler.help - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.m2e.core.maven2Nature - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - - - - 1621691323023 - - 30 - - org.eclipse.core.resources.regexFilterMatcher - node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ - - - - diff --git a/extras/wrangler/plugins/org.erlide.wrangler.help/.settings/org.eclipse.core.resources.prefs b/extras/wrangler/plugins/org.erlide.wrangler.help/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 99f26c0203..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.help/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -encoding/=UTF-8 diff --git a/extras/wrangler/plugins/org.erlide.wrangler.help/.settings/org.eclipse.jdt.core.prefs b/extras/wrangler/plugins/org.erlide.wrangler.help/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 9f6ece88bd..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.help/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.release=disabled -org.eclipse.jdt.core.compiler.source=1.8 diff --git a/extras/wrangler/plugins/org.erlide.wrangler.help/.settings/org.eclipse.m2e.core.prefs b/extras/wrangler/plugins/org.erlide.wrangler.help/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index f897a7f1cb..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.help/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/extras/wrangler/plugins/org.erlide.wrangler.help/META-INF/MANIFEST.MF b/extras/wrangler/plugins/org.erlide.wrangler.help/META-INF/MANIFEST.MF deleted file mode 100644 index d0a9f050a9..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.help/META-INF/MANIFEST.MF +++ /dev/null @@ -1,9 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: Wrangler Help plug-in -Bundle-SymbolicName: org.erlide.wrangler.help;singleton:=true -Bundle-Version: 0.11.0.qualifier -Bundle-Vendor: UKC -Require-Bundle: org.eclipse.help;bundle-version="[3.6.0,4.0.0)" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 -Automatic-Module-Name: org.erlide.wrangler.help diff --git a/extras/wrangler/plugins/org.erlide.wrangler.help/build.properties b/extras/wrangler/plugins/org.erlide.wrangler.help/build.properties deleted file mode 100644 index f09b731a1c..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.help/build.properties +++ /dev/null @@ -1,7 +0,0 @@ -bin.includes = META-INF/,\ - plugin.xml,\ - html/,\ - images/,\ - toc.xml -src.includes = toc.xml,\ - images/ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.help/html/code_inspections.html b/extras/wrangler/plugins/org.erlide.wrangler.help/html/code_inspections.html deleted file mode 100644 index 7f0a7b9967..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.help/html/code_inspections.html +++ /dev/null @@ -1,109 +0,0 @@ - - - - Code Inspections - - -

Code Inspections

-

Wrangler built-in code inspections

- -

Dependencies of a module

-

Reports the names of modules that depend on the current module, as well as modules on which the - current module depends.

- -

Nested if Expressions

-

Reports all the functions that contain one or more ```if''' expressions that are - nested the specified number of levels or more.

-

The whole project is searched if the 'Search in the project' option is selected, otherwise - only the current Erlang module is searched.

- -

Nested case Expressions

-

Reports all the functions that contain one or more ```case''' expressions that are - nested the specified number of levels or more.

-

The whole project is searched if the 'Search in the project' option is selected, otherwise - only the current Erlang module is searched.

- -

Nested receive Expressions

-

Reports all the functions that contain one or more ```receive'' expressions that are - nested the specified number of levels or more.

-

The whole project is searched if the 'Search in the project' option is selected, otherwise - only the current Erlang module is searched.

- -

Long Functions

-

Reports all the functions that has more than the specified number of lines of code, - not including comments and white lines.

- -

Large Modules

-

Reports all the modules that has more than the specified number of lines of code, not - including comments and white lines.

- -

Generate Function Callgraph

-

Generates the function callgraph for the current module. Only functions that are defined in - the current moudle are shown in the callgraph.

- -

Generate Module Graph

-

Generates the module graph for the current Erlang project. The user can decide whether the edges - between modules should be labelled with the functions called.

- -

Cyclic Module Dependency

-

Reports the cyclic module dependencies, if there is any, for the current Erlang project.

- -

Module Dependency via Only Internal Functions

-

Reports the module dependencies in the current Erlang project that are introduced because of the export of - functions that should be kept internal to its defining module according to Wrangler's analysis.

- -

Show Non Tail-recursive Servers

-

The Erlang Programming Rules says: All servers must be tail-recursive, otherwise the server will - consume memory until the system runs out of it. This function reports server functions that are not tail-recursive.

-

In Erlang, it is not a good practice to write a server function like this:

-
	
-        loop() ->
-           receive
-             {msg1, Msg1} -> 
-                ...,
-                loop();
-             stop ->
-                true;
-             Other ->
-                error_logger:log({error, {process_got_other, self(), Other}}),
-                loop()
-           end,
-           io:format("Server going down").     
- -

The above is not tail-recursive. This is a correct solution:

-

-        loop() ->
-           receive
-             {msg1, Msg1} -> 
-               ...,
-               loop();
-             stop ->
-               io:format("Server going down");
-             Other ->
-               error_logger:log({error, {process_got_other, self(), Other}}),
-               loop()
-           end. 
-      	
- -

Incomplete Receive Patterns

-

Reports functions which has a receive expression that does not flush unknown messages.

-

The Erlang Programming Rules says: Every server should have an Other alternative in at least - one receive statement. This is to avoid filling up message queues. Example:

-
	
-           main_loop() ->
-               receive
-                 {msg1, Msg1} -> 
-                    ...,
-                    main_loop();
-                 {msg2, Msg2} ->
-                    ...,
-                    main_loop();
-                 Other -> % Flushes the message queue.
-                   error_logger:error_msg(
-                      "Error: Process ~w got unknown msg ~w~n.", 
-                       [self(), Other]),
-                   main_loop()
-               end.
-	  
- - \ No newline at end of file diff --git a/extras/wrangler/plugins/org.erlide.wrangler.help/html/general.html b/extras/wrangler/plugins/org.erlide.wrangler.help/html/general.html deleted file mode 100644 index 148ceae33e..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.help/html/general.html +++ /dev/null @@ -1,60 +0,0 @@ - - - - Wrangler Refactor Tool - - -

Wrangler Refactor Tool

-

Introduction

-

What is refactoring?

-

"Refactoring is a disciplined technique for restructuring an existing body of code, - altering its internal structure without changing its external behavior. - Its heart is a series of small behavior preserving transformations. Each transformation - (called a 'refactoring') does little, but a sequence of transformations can produce a significant restructuring. - Since each refactoring is small, it's less likely to go wrong. The system is also kept fully working after each small refactoring, - reducing the chances that a system can get seriously broken during the restructuring." -
http://www.refactoring.com/

-

What is Wrangler?

-

Wrangler is an Erlang refactoring tool. - It is built using the Erlang Syntax Tools library. Wrangler has a GUI for both the EMACS editor and the Eclipse IDE, using erlIDE. It supports - preservation of the code layout for that part of the code that is unmodified. -

-

Features:

-
    -
  • layout-preserving
  • -
  • supports Eclipse undo/redo operations
  • -
  • integrated with Erlide
  • -
  • supports cross-module refactorings
  • -
  • supports preview of the changes
  • -
-

Implemented Refactorings

-

Implemented Code Inspections

-

How Wrangler refactoring works

-

Each refactoring can be invoked from the Refactor menu selecting its name.

- Refactor menu -

Then a wizard window appears, in which the necessary parameters are requested and the user can select either to apply the refactoring, or to preview the results of doing it.

- Wizard -

If the result of the selected refactoring is undesirable, it can be cancelled after previewing it.

- Preview window -

Refactorings can be also called from the Navigator/Outline view by right clicking on an Erlang element, and then selecting the Refactor menu.
- Some of them (such as rename function refactoring) also has a shortcut (e.g. CTRL + ALT + R F), in this case it is possible to call the refactoring with the key combination.

- -

Links

- - - diff --git a/extras/wrangler/plugins/org.erlide.wrangler.help/html/refactorings.html b/extras/wrangler/plugins/org.erlide.wrangler.help/html/refactorings.html deleted file mode 100644 index f8c35ad67f..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.help/html/refactorings.html +++ /dev/null @@ -1,400 +0,0 @@ - - - - Refactorings - - -

Refactorings

-

General refactorings

-

Rename variable

- Rename a variable with a new name supplied by the user. -

This refactoring has a local effect, i.e., it only affects the function clause - in which the refactoring is initialised.

- -

The following side-conditions (or pre-conditions) apply to this refactoring:

-
    -
  • The new variable name should not conflict with any of the declared variable names in the same scope;
  • -
  • The new variable name should not shadow any of the existing variables in the outer scopes, - or be shadowed by any of existing variables in the inner scopes, i.e., renaming to the new name - should not change the semantics of the program.
  • -
-

Usage: to apply this refactoring, point the cursor to any occurrence of this variable, then select - Rename Variable... from the Refactor menu, after that, - Wrangler will ask you for the new name.

-

Shortcut:

SHIFT+ALT+R V - -

Rename function

- Rename a function with a new name supplied by the user. -

When renaming an exported function, this refactoring has a global effect, that is, - it affects all those modules in which this function is imported/used.

- -

The following side-conditions (or pre-conditions } apply to this refactoring:

-
    -
  • The new function name should not cause confliction with any of the functions which are in scope in the - current module;
  • -
  • In the case that the function to be renamed is imported by another module, the new function name (with the same - arity) should not be already in scope (either defined or imported) in that module.
  • -
-

Usage: to apply this refactoring, point the cursor to any occurrence of this - function name, then select Rename Function... from the Refactor menu, - after that, Wrangler will ask you for the function"s new name.

-

Note: It is also possible to call the refactoring from the Outline/Navigator view's popup menu.

-

Shortcut:

SHIFT+ALT+R F - -

Rename module

- Rename a module with a new name supplied by the user. -

This refactoring affects all those modules in which the module name is used.

- -

The following side-conditions apply to this refactoring:

-
    -
  • The new module name should not have been used as a module name in the program under consideration.
  • -
  • This refactoring assume that the file basename is always the same as the module name, therefore this - refactoring changes the filename as well.
  • -
-

Usage: to apply this refactoring, point the cursor anywhere in the module to be renamed, then select - Rename Module... from the Refactor menu, after that, the refactorer will prompt to select - the target module name.

-

Note: It is also possible to call the refactoring from the Outline/Navigator view's popup menu.

-

Shortcut:

SHIFT+ALT+R M - -

Generalise function

-

Generalise a function definition by selecting a sub-expression of its right-hand - side and making this the value of a new argument added to the definition of the function. - The sub-expression becomes the actual parameter at the call sites.

- -

Here is an example of generalisation, in which the function add_one defined - on the left-hand side is generalised on the expression 1 , and the result is - shown on the right-hand side.

-
	
-```    -module (test).                          -module (test). 
-       -export([f/1]).                          -export([f/1]).
-   
-       add_one ([H|T]) ->                       add_one (N, [H|T]) ->
-          [H+1 | add_one(T)];                      [H+N | add_one(N,T)];
-       add_one ([]) -> [].                      add_one (N, []) -> [].
-
-       f(X) -> add_one(X).                      f(X) -> add_one(1,X)
-''' 
-		
- -

In the case that the selected expression has a side-effect, the refactorer will wrap this expression - in an function expression before passing it as the actual parameter to the call-sites. This is illustrated - in the following example, in which function repeat/1 is generalised on the expression - io:format("Hello\n").

-

-```    -module (test).                          -module (test).                          
-       -export([f/0]).                          -export([f/0]).
-
-       repeat(0) -> ok;                         repeat(A, 0) -> ok;
-       repeat(N) ->                             repeat(A, N) ->
-          io:format("Hello\n"),                    A( ),
-       repeat(N-1).                             repeat(A,N-1).
-
-       f() -> repeat(5).                        f( ) -> 
-                                                   repeat (fun( )->io:format ("Hello\n") end, 5).
-'''
-		
- -

This refactoring only affects the module in which the refactoring is initialised. In the case that - the generalised function is exported by the module, an auxiliary function will be created - to wrap the generalised function up, so that the module's interface is not changed. -

-

The following side-conditions apply to this refactoring:

-
    -
  • Suppose the function to be generalised is foo/n , then foo/n+1 should not - be in scope before the generalisation;
  • -
  • The new parameter name provided by the user should not conflict with the existing parameters or - change the semantics of the function to be generalised.
  • -
-

Usage: to apply this refactoring, highlight the expression first, then select - Generalise function... from the Refactor menu, after - that the refactorer will ask for the new parameter name.

- - -

Move function

- Move a function definition from its current module to another. -

This refactoring has a global effect, i.e., it affects all the modules - in the project - in which - the function is imported/used.

- -

This refactoring assumes that an Erlang module name always matches its file name.

- -

Suppose we move function foo/n from its current module M - to module N , then the following side-conditions apply to - this refactoring:

-
    -
  • If foo/n is already in scope in module N , then its defining - module should be M .
  • -
  • Function foo/n should not contain any uses of implicit fun expressions (Note: move a - collection of functions together to another module will be supported by another refactoring).
  • -
-

Usage: to apply this refactoring, point the cursor at the function definition, then - select Move function... from the Refactor menu, - Wrangler will ask you to select one of the existing modules.

-

Note: It is also possible to call the refactoring from the Outline/Navigator view's popup menu. Moreover user could move function with - drag'n'drop in the Navigator view as well.

-

Shortcut:

SHIFT+ALT+M - -

Function extraction

- Introduce a new function to represent an expression or expression sequence. -

This refactoring allows the user to introduce a new function to represent a selected expression or expression - sequence, and replace the selected code with a call to the new function. Free variables - within the selected code become the formal parameters of the function definition.

-

Usage: highlight the expression/expression sequence of interest, then selected the Function extraction... - from the Refactor menu, Wrangler will then ask you for the new function name. -

- - -

Fold expression against local function

- Fold expressions against a function definition. -

This refactoring replaces instances of the right-hand side of a function clause definition by - the corresponding left-hand side with necessary parameter substitutions.

- -

In the case that a candidate expression/expression sequence needs to export some variables which - are used by the code following code, that expression/expression sequence will be replaced by a match - expression, whose left-hand side it the exported variable(s), and right-hand side is the function - application.

- -

This refactoring does not support folding against function clauses with guard expressions, or - function clauses with complex formal parameters, such as tuples, lists, or records.

- -

Usage: first point the cursor to the function clause against which expressions will be - folded if the function is defined in the current module, then select Fold expression... - from the Refactor menu; after that Wrangler will search the current module for expressions - which are instances of the right-hand side of the selected function clause. A dialog is shown, where user can review, and select the - candidates.

- -

If no candidate expression has been found, a message will be given, and the refactoring - finishes; otherwise you a wizard window appears and you can select those expressions which would like to be folded. - For the smarter usage in this stage of the process moving the cursor above the selectable expressions - in the dialog window - - they are highlighted in the background on by one.

- -

Fold expression against remote function

-

This refactoring does the some as Fold expression against local function, except the - except that the remote function can be selected from a different module.

-
-

Usage: start the refactoring from the Refactor menu, then select the remote function clause from the dialog box.

- -

Tuple function parameters

- Turn some consecutive parameters of a function into a tuple parameter. -

When the function under consideration is exported by the module where it is defined, - this refactoring has a global effect.

- -

Suppose the new function after refactoring is f/n, then the following side-conditions apply:

-
    -
  • f/n should not cause confliction with any of the functions which are in scope in the - current module;
  • -
  • In the case that the function is imported by another module, then f/n - should not be already in scope (either defined or imported) in that module.
  • -
-

Usage: to apply this refactoring, highlight the arguments to be grouped into a tuple from the function definition, then select - Tuple function parameters... from the Refactor menu. -

- -

Unfold function application

- Unfold a function application to an instance of the function's body. -

This refactoring replaces a function application with an instance of the function body. - With the current implementation, Wrangler unfolds a function application only if the function is defined in the same module, - and Wrangler could work out which function clause to use (in case the function definition contains multiple function clauses).

- -

Usage: Point the cursor to the function name in the function application to unfold, then select Unfold Function Application... from Refactor.

- -

Macro related refactorings

- -

Introduce macro

- Introduce a macro to represent a syntactically well-formed expression/pattern or a sequence of expressions/patterns. -

This refactoring allows the user to define a new macro to represent a expression/pattern or sequence of expressions/patterns selected by the user, - and replace the selected code with an application of the macro. - Free variables within the selected code become the formal parameters of the macro definition.

- -

Usage: Highlight the expression of interest, then selected the Introduce a Macro from Refactor, Wrangler will then prompt for the new macro name.

- -

Fold against macro

- Fold expressions/patterns against a macro definition. -

This refactoring replaces instances of the right-hand side of a macro definition by the corresponding left-hand side - with necessary parameter substitutions.

- -

Usage: to apply this refactoring, first point the cursor to the macro definition against which candidate expressions/candidates - will be folded; then select Fold Against Macro Definition from the Refactor menu; after that, Wrangler will search - the current module for expressions/patterns which are instances of the right-hand side of the selected macro definition; and direct you through the refactoring process. - (see Fold expression against local function

- -

Identical code recognizing refactorings

- -

Identical code detection

- An identical code detector that works with multiple Erlang modules as well. -

This function reports duplicated code fragments found in the current Erlang module (if selected, then in the project), it does - not remove those code clones though. The user will be prompted for three parameters: the minimum number of - tokens a cloned code fragment should have, the minimum number of times a code fragment appears in the program and where to detect (current module/project). -

-

The current version of the duplicated code detector reports clones that are syntactically - identical after consistent renaming of variables, except for variations in literals, layout and comments. -

-

- Usage: simply select the Detect Identical code from the Refactor/Identical Code menu, - then an input dialog appears which is for typing the necessary parameters. Finally the 'Duplicated code' view appears in the bottom of the workbench, where double clicking on the found expressions - results to highlightion of the according code part in the editor. Results are grouped by duplications and modules. -

-
-

The refactoring also suggest you a generalised function, which can be used instead of the duplicates. It can be copied to the clipboard clicking on the Copy generalised function to clipboard icon. -

- -

Search identical expression

- Search for clones of an expression/expression sequence selected in the current file. - -

This functionality allows searching for clones of a selected expression or expression - sequence. The found clones are syntactically identical to the code fragment selected after consistent renaming of variables, - except for variations in literals, layout and comments. -

-

When the selected code contains multiple, but non-continuous sequence of, expressions, the first - continuous sequence of expressions is taken as the user-selected expression. A continuous sequence of - expressions is a sequence of expressions separated by ','.

- Usage: highlight the expression/expression sequence of interest, then selected Search expression... from - the Refactor/Identical code menu. -

Then the 'Duplicated code' view appears in the bottom of the workbench, where double clicking on the found expressions - results to highlightion of the according code part in the editor. - -

Similar code detection

- A similar code detector that searches for similar code in the current module or across multiple Erlang modules. - -

This function reports similar expression sequences found in the project directories, - but does not remove those clones though. The algorithm is based on the notion of anti-unification, or the least common generalisation. - The user needs to provide three parameters to be used by the clone detector, and they are: the minimum length of an expression sequence, the minimum number of duplication times, and a similarity score which should be between 0.1 and 1.0.

- -

Usage: select Detect Similar Code from Refactor/Identical Code menu, Wrangler will then prompt to input the parameters needed. - The results will be displayed in the Duplicated code view. The refactoring also suggest you a generalised function, which can be used instead of the duplicates. It can be copied to the clipboard clicking on the Copy generalised function to clipboard icon. -

- - -

Similar expression search

- Search expression search in the current Erlang buffer. - -

This functionality allows searching for expression sequence that are similar to the expression sequence selected. - In this context, two expressions, A and B say, are similar if there exists an anti-unifier, say C, of A and B, - and C satisfies the similarity score specified by the user (the calculation calculated of similarity score is going to be further explored).

- -

Usage: highlight the expression sequence of interest, then selected Similar Expression Search from Refactor/Identical code, then Wrangler will ask you about the similarity score. - Finally the results will be displayed in the Duplicated code view. The refactoring also suggest you a generalised function, which can be used instead of the duplicates. It can be copied to the clipboard clicking on the Copy generalised function to clipboard icon. -

-

QuickCheck related refactorings

-

Please note, that these refactorings are only enabled when QuickCheck is installed.

-

Introduce ?LET

- Introduce ?LET. - -

Bind the values generated by a generator to a variable, so that the values generated by the generator can be referred by other generators. - The refactoring helps to introduce dependency between QuickCheck generators. This refactoring is especially for QuickCheck users.

- -

Usage: highlight the expression, which should be a QuickCheck generator, then select the refactoring command, you will be prompted for the pattern variable name.

- -

Merge ?LET

- Merge nested but independent ?LETs into one ?LET. - -

This refactoring combines multiple nested, but undependent, ?LETs into one; the latter representation has better shrinking performance. This refactoring is especially for QuickCheck users.

- -

Usage: Select the refactoring command, and Wrangler will search for candidates to merge automatically, guide you through the candidates found one by one, and ask you to decide whether to merge.

- -

Merge ?FORALL

- Merge nested but undependent ?FORALLs into one ?FORALL. - -

This refactoring combines multiple nested, but undependent, ?FORALLs into one; the latter representation has better shrinking performance. This refactoring is especially for QuickCheck users.

- -

Usage: Select the refactoring command, and Wrangler will search for candidates to merge automatically, guide you through the candidates found one by one, and ask you to decide whether to merge.

- -

eqc_fsm State into a record

- Turn a non-record representation of eqc_fsm state into a record representation. - -

This refactoring introduce a record to represent the state used by eqc_fsm. This refactoring is especially for QuickCheck users.

- -

Usage: Select the refactoring command, and Wrangler will check the current type of the state machine, and prompt you to input the record and field names if Wrangler is able to proceed the refactoring.

- -

eqc_statem State data to record

- Turn a non-record representation of eqc_statem state into a record representation. - -

This refactoring introduce a record to represent the state used by eqc_statem. This refactoring is especially for QuickCheck users.

- -

Usage: Select the refactoring command, and Wrangler will check the current type of the state machine, and prompt you to input the record and field names if Wrangler is able to proceed the refactoring.

- -

gen_fsm State data to record

- Turn a non-record representation of gen_fsm state into a record representation. - -

This refactoring introduce a record to represent the state used by eqc_statem.

- -

Usage: Select the refactoring command, and Wrangler will check the current type of the state machine, and prompt you to input the record and field names if Wrangler is able to proceed the refactoring.

- -

Other refactorings

-

Rename process

- Rename a registered process with a new name supplied by the user. -

To apply this refactoring, point the cursor to the process name, then select - Rename process from the Refactor menu, after that, Wrangler will prompt - to enter the new process name. -

-

This refactoring has a global effect, i.e. it needs to check the whole program for places where the - original process name is used. -

-

The following side-conditions apply to this refactoring: -

    -
  • The new process name should not be the atom 'undefined'
  • -
  • The new process name should not have been used as a process name in the program under consideration.
  • -
  • Since there are some cases where Wrangler cannot infer whether an atom represents a process name or not, for example, - a process name in a message, it would be help the refactoring process to select the process name from expressions, such as - registration expressions, where it is easier for Wrangler to infer that the atom is a process name.
  • -
-

- -

Function to process

- Turn a function into a server process. -

This refactoring turns a function into a server process, and all the function calls to this function into process communication. - Turning a function into a server process provides potential for memorisation of calculated values, adding states to the process, etc. -

-

The following example shows the application of this refactoring to the function f/2 on the - left-hand side, and the result is shown on the right-hand side.

-


-
-``` f(add,X,Y) -> X +Y;                        f_rpc(RegName, Request) ->                  
-    f(sub,X,Y) -> X - Y.                            Fun = fun() ->
-                                                                try  
-    g(X, Y) ->                                                     register(RegName, self())
-        f(add, X,Y)*f(sub, X, Y).                               catch 
-                                                                   true -> f();
-                                                                   error:_ -> already_running
-                                                                end
-                                                          end,
-                                                    Spawn(Fun),
-                                                    RegName ! {self(), Request},
-                                                    receive {RegName, Response} -> Response end.
-
-                                                f() ->
-                                                  receive
-                                                     {From, {add, X, Y}} -> From ! {f, X + Y}, f();
-                                                     {From, {sub, X, Y}} -> From ! {f, X - Y}, f()
-                                                  end.
-
-                                               g(X, Y) ->
-                                                  f_rpc(f, {add, X, Y}) * f_rpc(f, {sub, X, Y}).
-
-'''
-   		
-

The following side-conditions apply to this refactoring:

-

    -
  • The process name provided by the user should be lexically legal, and not conflict with existing process names.
  • -
  • The function should not be a recursive function, either directly or indirectly.
  • -
  • The current function or functions called by this function should not register the Pid returned by self().
  • -
-

-

- Wrangler generates the new function name and the rpc function name automatically, but the user could always rename it afterwards. - Suppose the original function is f/n, then the new function name would be f/0 and the rpc - function name would be f_rpc/2; if any conflicts occur, '_i' will be attached to the end of the function - name where i is a smallest number that makes the name fresh. -

-

To apply this refactoring, point the cursor to the function of interest, then select - Convert Function to Process from the Refactor menu, after that, Wrangler will prompt - to enter the process registration name. -

- -

Normalize record expression

- Reorder the record fields in a record expression to be consistent with the record definition. - -

Usage: point cursor to the record expression interested, then select Normalise Record Expression from Refactor.

- - - \ No newline at end of file diff --git a/extras/wrangler/plugins/org.erlide.wrangler.help/images/copy-icon.png b/extras/wrangler/plugins/org.erlide.wrangler.help/images/copy-icon.png deleted file mode 100644 index c8063a3d88..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.help/images/copy-icon.png and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.help/images/duplicated_view.png b/extras/wrangler/plugins/org.erlide.wrangler.help/images/duplicated_view.png deleted file mode 100644 index dd1ed95999..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.help/images/duplicated_view.png and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.help/images/fold_exp_remote.png b/extras/wrangler/plugins/org.erlide.wrangler.help/images/fold_exp_remote.png deleted file mode 100644 index 3a7806a6ae..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.help/images/fold_exp_remote.png and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.help/images/preview.png b/extras/wrangler/plugins/org.erlide.wrangler.help/images/preview.png deleted file mode 100644 index 150b65b525..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.help/images/preview.png and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.help/images/refactor-menu.png b/extras/wrangler/plugins/org.erlide.wrangler.help/images/refactor-menu.png deleted file mode 100644 index 22e6021094..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.help/images/refactor-menu.png and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.help/images/rename-variable-dialog.png b/extras/wrangler/plugins/org.erlide.wrangler.help/images/rename-variable-dialog.png deleted file mode 100644 index e746ad9848..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.help/images/rename-variable-dialog.png and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.help/plugin.xml b/extras/wrangler/plugins/org.erlide.wrangler.help/plugin.xml deleted file mode 100644 index c6c43d4705..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.help/plugin.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - diff --git a/extras/wrangler/plugins/org.erlide.wrangler.help/pom.xml b/extras/wrangler/plugins/org.erlide.wrangler.help/pom.xml deleted file mode 100644 index fec78a63a7..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.help/pom.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - 4.0.0 - - org.erlide - org.erlide.wrangler.parent - 1.0.0 - ../.. - - - org.erlide.wrangler.help - 0.11.0-SNAPSHOT - eclipse-plugin - diff --git a/extras/wrangler/plugins/org.erlide.wrangler.help/toc.xml b/extras/wrangler/plugins/org.erlide.wrangler.help/toc.xml deleted file mode 100644 index 29ce2ae838..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.help/toc.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/.classpath b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/.classpath deleted file mode 100644 index af1317214a..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/.classpath +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/.project b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/.project deleted file mode 100644 index 4bb9f23a4f..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/.project +++ /dev/null @@ -1,45 +0,0 @@ - - - org.erlide.wrangler.refactoring.codeinspection - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.m2e.core.maven2Nature - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - - - - 1621691323045 - - 30 - - org.eclipse.core.resources.regexFilterMatcher - node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ - - - - diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/.settings/org.eclipse.core.resources.prefs b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 99f26c0203..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -encoding/=UTF-8 diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/.settings/org.eclipse.jdt.core.prefs b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 590ab09f99..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,119 +0,0 @@ -eclipse.preferences.version=1 -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=enabled -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.nonnull.secondary= -org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault -org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary= -org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable -org.eclipse.jdt.core.compiler.annotation.nullable.secondary= -org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.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=warning -org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning -org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled -org.eclipse.jdt.core.compiler.problem.fieldHiding=warning -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=enabled -org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning -org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning -org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning -org.eclipse.jdt.core.compiler.problem.missingDefaultCase=warning -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.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=ignore -org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning -org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning -org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning -org.eclipse.jdt.core.compiler.problem.nullReference=error -org.eclipse.jdt.core.compiler.problem.nullSpecViolation=warning -org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning -org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning -org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning -org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning -org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning -org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning -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=warning -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=enabled -org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled -org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled -org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore -org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning -org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled -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.unlikelyCollectionMethodArgumentType=warning -org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled -org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info -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=warning -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.unusedExceptionParameter=ignore -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=ignore -org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.release=disabled -org.eclipse.jdt.core.compiler.source=1.8 diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/.settings/org.eclipse.m2e.core.prefs b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index f897a7f1cb..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/.settings/org.eclipse.pde.prefs b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/.settings/org.eclipse.pde.prefs deleted file mode 100644 index e81e18d47a..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/.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=1 -compilers.p.build.java.compiler=1 -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=2 -compilers.p.discouraged-class=1 -compilers.p.internal=1 -compilers.p.missing-packages=2 -compilers.p.missing-version-export-package=2 -compilers.p.missing-version-import-package=2 -compilers.p.missing-version-require-bundle=2 -compilers.p.no-required-att=0 -compilers.p.not-externalized-att=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/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/META-INF/MANIFEST.MF b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/META-INF/MANIFEST.MF deleted file mode 100644 index 790fed334e..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/META-INF/MANIFEST.MF +++ /dev/null @@ -1,19 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: Wrangler code inspection fragment -Bundle-SymbolicName: org.erlide.wrangler.refactoring.codeinspection;singleton:=true -Bundle-Version: 0.11.0.qualifier -Bundle-Vendor: UKC -Fragment-Host: org.erlide.wrangler.refactoring;bundle-version="0.10.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 -Require-Bundle: org.eclipse.ui, - com.google.guava;bundle-version="[21.0.0,33.4.0)", - javax.inject;bundle-version="1.0.0", - org.eclipse.xtext.xbase.lib;bundle-version="2.19.0", - com.abstratt.graphviz;bundle-version="[2.2.201606,3.0.0)", - com.ericsson.otp.jinterface;bundle-version="1.8.0" -Export-Package: org.erlide.wrangler.refactoring.codeinspection;x-internal:=true, - org.erlide.wrangler.refactoring.codeinspection.ui;x-internal:=true, - org.erlide.wrangler.refactoring.codeinspection.view;x-internal:=true -Import-Package: org.eclipse.jdt.annotation;resolution:=optional -Automatic-Module-Name: org.erlide.wrangler.refactoring.codeinspection diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/build.properties b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/build.properties deleted file mode 100644 index 43b7667e15..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/build.properties +++ /dev/null @@ -1,6 +0,0 @@ -source.. = src/ -bin.includes = META-INF/,\ - .,\ - fragment.xml -javacDefaultEncoding.. = UTF-8 -javacProjectSettings = true diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/fragment.xml b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/fragment.xml deleted file mode 100644 index ae49dde934..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/fragment.xml +++ /dev/null @@ -1,214 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/icons/.directory b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/icons/.directory deleted file mode 100644 index c971dc3ea4..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/icons/.directory +++ /dev/null @@ -1,8 +0,0 @@ -[Dolphin] -AdditionalInfo=3 -ShowPreview=true -Timestamp=2010,6,28,15,0,21 -ViewMode=1 - -[Settings] -ShowDotFiles=true diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/icons/Fit16.gif b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/icons/Fit16.gif deleted file mode 100644 index 0d94f66d20..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/icons/Fit16.gif and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/icons/Open16.gif b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/icons/Open16.gif deleted file mode 100644 index 79522f9243..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/icons/Open16.gif and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/icons/Original16.gif b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/icons/Original16.gif deleted file mode 100644 index 57e71ce3f2..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/icons/Original16.gif and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/icons/Rotate16.gif b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/icons/Rotate16.gif deleted file mode 100644 index 587b9d2084..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/icons/Rotate16.gif and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/icons/ZoomIn16.gif b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/icons/ZoomIn16.gif deleted file mode 100644 index 2329426e48..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/icons/ZoomIn16.gif and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/icons/ZoomOut16.gif b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/icons/ZoomOut16.gif deleted file mode 100644 index f9f7565878..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/icons/ZoomOut16.gif and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/icons/sample.gif b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/icons/sample.gif deleted file mode 100644 index 34fb3c9d8c..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/icons/sample.gif and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/icons/wrangler.gif b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/icons/wrangler.gif deleted file mode 100644 index cacb0c1dbe..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/icons/wrangler.gif and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/pom.xml b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/pom.xml deleted file mode 100644 index de9cabe90f..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/pom.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - 4.0.0 - - org.erlide - org.erlide.wrangler.parent - 1.0.0 - ../.. - - - org.erlide.wrangler.refactoring.codeinspection - 0.11.0-SNAPSHOT - eclipse-plugin - diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/src/org/erlide/wrangler/refactoring/codeinspection/CodeInspectionViewsManager.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/src/org/erlide/wrangler/refactoring/codeinspection/CodeInspectionViewsManager.java deleted file mode 100644 index 108d25a76f..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/src/org/erlide/wrangler/refactoring/codeinspection/CodeInspectionViewsManager.java +++ /dev/null @@ -1,160 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.codeinspection; - -import java.io.File; -import java.util.ArrayList; - -import org.eclipse.swt.graphics.Image; -import org.eclipse.ui.IViewPart; -import org.eclipse.ui.IViewReference; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.PlatformUI; -import org.erlide.engine.model.IErlElement; -import org.erlide.util.ErlLogger; -import org.erlide.wrangler.refactoring.codeinspection.view.CodeInspectionResultsView; -import org.erlide.wrangler.refactoring.codeinspection.view.GraphImageView; - -/** - * Manages the displaying of the Graph View - * - * @author Gyorgy Orosz - * - */ -public class CodeInspectionViewsManager { - public static final String GRAPH_VIEW = org.erlide.wrangler.refactoring.codeinspection.view.GraphImageView.VIEW_ID; - public static final String CODE_INSPECTION_VIEW = org.erlide.wrangler.refactoring.codeinspection.view.CodeInspectionResultsView.VIEW_ID; - - private CodeInspectionViewsManager() { - } - - /** - * Shows the image in the graph view with the given title. - * - * @param img - * image - * @param title - * view title - * @param secondaryID - * view secondary id - * @param dotFile - * .dot file which is displayed - */ - public static void showDotImage(final Image img, final String title, - final String secondaryID, final File dotFile) { - final GraphImageView view = (GraphImageView) CodeInspectionViewsManager - .showView(CodeInspectionViewsManager.GRAPH_VIEW, secondaryID); - view.setViewTitle(title); - view.setImage(img); - view.setDotFile(dotFile); - } - - /** - * Shows Erlang elements in a list view - * - * @param title - * view title - * @param e - * Erlang elements - */ - public static void showErlElements(final String title, final ArrayList e, - final String secId) { - try { - final CodeInspectionResultsView v = (CodeInspectionResultsView) CodeInspectionViewsManager - .showView(CodeInspectionViewsManager.CODE_INSPECTION_VIEW, secId); - v.addElements(e); - v.setViewTitle(title); - v.refresh(); - } catch (final Exception ex) { - ex.printStackTrace(); - } - } - - /** - * Shows a view. - * - * @param viewId - * view id, which is shown - * - * @return view which is shown - */ - public static IViewPart showView(final String viewId) { - - final IWorkbench workbench = PlatformUI.getWorkbench(); - - final IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); - try { - final IViewPart view = window.getActivePage().showView(viewId); - return view; - } catch (final PartInitException e) { - ErlLogger.error(e); - } - return null; - } - - /** - * Shows a an instance of a view - * - * @param viewId - * view id - * @param secondaryID - * view secondary id, to handle multiple instances - * @return view object - */ - public static IViewPart showView(final String viewId, final String secondaryID) { - final IWorkbench workbench = PlatformUI.getWorkbench(); - - final IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); - try { - final IViewPart view = window.getActivePage().showView(viewId, secondaryID, - IWorkbenchPage.VIEW_ACTIVATE); - return view; - } catch (final PartInitException e) { - ErlLogger.error(e); - } - return null; - } - - /** - * Hides a view. - * - * @param viewId - * view, which will be hidden - */ - public static void hideView(final String viewId) { - CodeInspectionViewsManager.hideView(viewId, null); - } - - /** - * Hides an instance of a view - * - * @param viewId - * view id - * @param secondaryId - * secondary id of a view instance - */ - public static void hideView(final String viewId, final String secondaryId) { - final IWorkbench workbench = PlatformUI.getWorkbench(); - - final IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); - IViewPart view; - final IViewReference viewr = window.getActivePage().findViewReference(viewId, - secondaryId); - if (viewr != null) { - view = viewr.getView(false); - if (view != null) { - window.getActivePage().hideView(view); - } - } - - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/src/org/erlide/wrangler/refactoring/codeinspection/GraphResultingInspectionHandler.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/src/org/erlide/wrangler/refactoring/codeinspection/GraphResultingInspectionHandler.java deleted file mode 100644 index d3671f5e01..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/src/org/erlide/wrangler/refactoring/codeinspection/GraphResultingInspectionHandler.java +++ /dev/null @@ -1,167 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.codeinspection; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; - -import org.eclipse.core.commands.AbstractHandler; -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.ImageData; -import org.eclipse.swt.widgets.Display; -import org.eclipse.ui.PlatformUI; -import org.erlide.util.ErlLogger; -import org.erlide.wrangler.refactoring.backend.internal.WranglerBackendManager; -import org.erlide.wrangler.refactoring.exception.WranglerException; -import org.erlide.wrangler.refactoring.selection.IErlSelection; -import org.erlide.wrangler.refactoring.util.GlobalParameters; - -import com.abstratt.graphviz.GraphViz; -import com.ericsson.otp.erlang.OtpErlangBoolean; - -/** - * This class is for handling commands which are from wrangler code inspection - * functionality, and result a graph. - * - * @author Gyorgy Orosz - * - */ -public class GraphResultingInspectionHandler extends AbstractHandler { - protected static final String CYCLYC_VIEW_ID = "cyclic"; - protected static final String FUNCTION_CALL_GRAPH_VIEW_ID = "functioncallgraph"; - protected static final String MODULE_GRAPH_VIEW_ID = "modulegraph"; - protected static final String IMPROPER_DEPENDECIES_VIEW_ID = "improperdependecies"; - - @Override - public Object execute(final ExecutionEvent event) throws ExecutionException { - final String actionId = event.getCommand().getId(); - PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() - .getActiveEditor().setFocus(); - try { - GlobalParameters.setSelection(PlatformUI.getWorkbench() - .getActiveWorkbenchWindow().getActivePage().getSelection()); - } catch (final WranglerException e1) { - MessageDialog.openError( - PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), - "Error", e1.getMessage()); - return null; - } - try { - final File tmpFile = File.createTempFile("wrangler_graph_", ".dot"); - tmpFile.deleteOnExit(); - - final IErlSelection wranglerSelection = GlobalParameters - .getWranglerSelection(); - - if ("org.erlide.wrangler.refactoring.codeinspection.cyclicdependencies" - .equals(actionId)) { - final Boolean answer = MessageDialog.openQuestion( - PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), - "Labels", "Label edges with function names called?"); - runInspection("Cyclic module dependency", - GraphResultingInspectionHandler.CYCLYC_VIEW_ID, - "There is no cyclic dependent modules in the project!", tmpFile, - "cyclic_dependent_modules", "ssx", tmpFile.getAbsolutePath(), - wranglerSelection.getSearchPath(), new OtpErlangBoolean(answer)); - } else if ("org.erlide.wrangler.refactoring.codeinspection.generatefunctioncallgraph" - .equals(actionId)) { - runInspection("Function callgraph", - GraphResultingInspectionHandler.FUNCTION_CALL_GRAPH_VIEW_ID, - "There is no dependent functions in the module!", tmpFile, - "gen_function_callgraph", "sss", tmpFile.getAbsolutePath(), - wranglerSelection.getFilePath(), - wranglerSelection.getSearchPath()); - - } else if ("org.erlide.wrangler.refactoring.codeinspection.generatemodulegraph" - .equals(actionId)) { - final Boolean answer = MessageDialog.openQuestion( - PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), - "Labels", "Label edges with function names called?"); - runInspection("Module dependency graph", - GraphResultingInspectionHandler.MODULE_GRAPH_VIEW_ID, - "There is no dependent modules in the project!", tmpFile, - "gen_module_graph", "ssx", tmpFile.getAbsolutePath(), - wranglerSelection.getSearchPath(), new OtpErlangBoolean(answer)); - - } else if ("org.erlide.wrangler.refactoring.codeinspection.improperdependecies" - .equals(actionId)) { - runInspection("Improper module dependencies", - GraphResultingInspectionHandler.IMPROPER_DEPENDECIES_VIEW_ID, - "There is no improper module dependecies!", tmpFile, - "improper_inter_module_calls", "ss", tmpFile.getAbsolutePath(), - wranglerSelection.getSearchPath()); - - } - - } catch (final Exception e) { - ErlLogger.error(e); - } - return event; - } - - /** - * Run code inspection function, and shows the result in the workbench - * - * @param viewtTitle - * title of the view - * @param noResultMessage - * if there is no result, this message will be displayed - * @param tmpFile - * temp .dot file - * @param functionName - * function to call - * @param signature - * parameters signature - * @param parameters - * function parameters - * - */ - protected void runInspection(final String viewtTitle, final String secondaryID, - final String noResultMessage, final File tmpFile, final String functionName, - final String signature, final Object... parameters) { - try { - CodeInspectionViewsManager.hideView(CodeInspectionViewsManager.GRAPH_VIEW, - secondaryID); - final Boolean b = WranglerBackendManager.getRefactoringBackend() - .callSimpleInspection(functionName, signature, parameters); - if (b) { - try (final FileInputStream fis = new FileInputStream(tmpFile)) { - if (fis.available() > 0) { - final byte[] data = GraphViz.load(fis, "png", 0, 0); - final ImageData imageData = new ImageData( - new ByteArrayInputStream(data)); - final Image img = new Image(Display.getCurrent(), imageData); - CodeInspectionViewsManager.showDotImage(img, viewtTitle, - secondaryID, tmpFile); - } else { - MessageDialog.openInformation( - GlobalParameters.getEditor().getSite().getShell(), - viewtTitle, noResultMessage); - } - } - } else { - MessageDialog.openError(GlobalParameters.getEditor().getSite().getShell(), - "Internal error", "Internal error occured. Please report it!"); - } - } catch (final IOException e) { - ErlLogger.error(e); - } catch (final CoreException e) { - ErlLogger.error(e); - } catch (final Exception e) { - ErlLogger.error(e); - } - - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/src/org/erlide/wrangler/refactoring/codeinspection/SimpleCodeInspectionHandler.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/src/org/erlide/wrangler/refactoring/codeinspection/SimpleCodeInspectionHandler.java deleted file mode 100644 index a8b59c056e..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/src/org/erlide/wrangler/refactoring/codeinspection/SimpleCodeInspectionHandler.java +++ /dev/null @@ -1,470 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.codeinspection; - -import java.util.ArrayList; - -import org.eclipse.core.commands.AbstractHandler; -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.jface.dialogs.IInputValidator; -import org.eclipse.jface.dialogs.InputDialog; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.window.Window; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.PlatformUI; -import org.erlide.engine.ErlangEngine; -import org.erlide.engine.model.ErlElementKind; -import org.erlide.engine.model.ErlModelException; -import org.erlide.engine.model.IErlElement; -import org.erlide.engine.model.erlang.FunctionRef; -import org.erlide.engine.model.erlang.IErlFunctionClause; -import org.erlide.engine.model.root.IErlModule; -import org.erlide.runtime.rpc.RpcResult; -import org.erlide.util.ErlLogger; -import org.erlide.wrangler.refactoring.backend.internal.WranglerBackendManager; -import org.erlide.wrangler.refactoring.codeinspection.ui.InputDialogWithCheckbox; -import org.erlide.wrangler.refactoring.exception.WranglerException; -import org.erlide.wrangler.refactoring.selection.IErlSelection; -import org.erlide.wrangler.refactoring.util.GlobalParameters; - -import com.ericsson.otp.erlang.OtpErlangAtom; -import com.ericsson.otp.erlang.OtpErlangList; -import com.ericsson.otp.erlang.OtpErlangLong; -import com.ericsson.otp.erlang.OtpErlangObject; -import com.ericsson.otp.erlang.OtpErlangRangeException; -import com.ericsson.otp.erlang.OtpErlangString; -import com.ericsson.otp.erlang.OtpErlangTuple; - -/** - * Handles commands, which needs only a listing UI, and inspects the code. - * - * @author Gyorgy Orosz - * - */ -public class SimpleCodeInspectionHandler extends AbstractHandler { - protected final class IntegerInputValidator implements IInputValidator { - @Override - public String isValid(final String newText) { - try { - Integer.parseInt(newText); - return null; - } catch (final Exception e) { - return "Please type an integer!"; - } - - } - } - - protected static final String LARGE_MODULES_VIEW_ID = "largemodules"; - protected static final String DEPENECIES_1_VIEW_ID = "dependencies1"; - protected static final String DEPENECIES_2_VIEW_ID = "dependencies2"; - protected static final String NON_TAIL_RECURSIVE_VIEW_ID = "nontailrecursive"; - protected static final String NOT_FLUSH_UNKNOWN_MESSAGES = "notflush"; - protected static final String NESTED_EXPRESSIONS = "nested"; - protected static final String LONG_FUNCTIONS = "longfunctions"; - - @Override - public Object execute(final ExecutionEvent event) throws ExecutionException { - final String actionId = event.getCommand().getId(); - PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() - .getActiveEditor().setFocus(); - try { - GlobalParameters.setSelection(PlatformUI.getWorkbench() - .getActiveWorkbenchWindow().getActivePage().getSelection()); - } catch (final WranglerException e) { - MessageDialog.openError( - PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), - "Error", e.getMessage()); - return null; - } - - final IErlSelection wranglerSelection = GlobalParameters.getWranglerSelection(); - final Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() - .getShell(); - - if ("org.erlide.wrangler.refactoring.codeinspection.largemodules" - .equals(actionId)) { - handleLargeModulesCall(wranglerSelection, shell); - - } else if ("org.erlide.wrangler.refactoring.codeinspection.dependencies" - .equals(actionId)) { - handleDepenenciesCall(wranglerSelection, shell); - } else if ("org.erlide.wrangler.refactoring.codeinspection.nontailrecursive" - .equals(actionId)) { - handleNonTailRecursiveCall(wranglerSelection, shell); - } else if ("org.erlide.wrangler.refactoring.codeinspection.notflush" - .equals(actionId)) { - handleNotFlushUnknownMessages(wranglerSelection, shell); - } else if ("org.erlide.wrangler.refactoring.codeinspection.nestedif" - .equals(actionId)) { - handleNested(wranglerSelection, shell, "if"); - - } else if ("org.erlide.wrangler.refactoring.codeinspection.nestedcase" - .equals(actionId)) { - handleNested(wranglerSelection, shell, "case"); - - } else if ("org.erlide.wrangler.refactoring.codeinspection.nestedreceive" - .equals(actionId)) { - handleNested(wranglerSelection, shell, "receive"); - - } else if ("org.erlide.wrangler.refactoring.codeinspection.longfunctions" - .equals(actionId)) { - handleLongFunctions(wranglerSelection, shell); - } - - return event; - } - - private void handleLongFunctions(final IErlSelection wranglerSelection, - final Shell shell) { - try { - CodeInspectionViewsManager - .hideView(SimpleCodeInspectionHandler.LONG_FUNCTIONS); - // call inputdialog - final InputDialogWithCheckbox dialog = new InputDialogWithCheckbox(shell, - "Search for long functions", "Number of lines:", - "Search in the project", "", new IntegerInputValidator()); - if (Window.OK == dialog.open()) { - final int linesVal = Integer.parseInt(dialog.getValue()); - final boolean inProject = dialog.isCheckBoxChecked(); - RpcResult res = null; - if (inProject) { - res = WranglerBackendManager.getRefactoringBackend().callInspection( - "long_functions_in_dirs_eclipse", "ixi", linesVal, - wranglerSelection.getSearchPath(), - GlobalParameters.getTabWidth()); - } else { - res = WranglerBackendManager.getRefactoringBackend().callInspection( - "long_functions_in_file_eclipse", "sixi", - wranglerSelection.getFilePath(), linesVal, - wranglerSelection.getSearchPath(), - GlobalParameters.getTabWidth()); - } - // handle rpc - final ArrayList elements = processFunctionResult(shell, res); - if (elements == null) { - return; - } - // show result - if (!elements.isEmpty()) { - CodeInspectionViewsManager.showErlElements("Long functions", elements, - SimpleCodeInspectionHandler.LONG_FUNCTIONS); - } else { - MessageDialog.openInformation(shell, "No result", - "Could not found any function which is longer, than " - + linesVal + " lines."); - } - - } - } catch (final Exception e) { - ErlLogger.error(e); - } - - } - - private void handleNested(final IErlSelection wranglerSelection, final Shell shell, - final String type) { - try { - CodeInspectionViewsManager - .hideView(SimpleCodeInspectionHandler.NESTED_EXPRESSIONS + type); - // call inputdialog - final InputDialogWithCheckbox dialog = new InputDialogWithCheckbox(shell, - "Search for nested expression", "Nest level:", - "Search in the project", "", new IntegerInputValidator()); - if (Window.OK == dialog.open()) { - final int nestedVal = Integer.parseInt(dialog.getValue()); - final boolean inProject = dialog.isCheckBoxChecked(); - RpcResult res = null; - if (inProject) { - res = WranglerBackendManager.getRefactoringBackend().callInspection( - "nested_exprs_in_dirs_eclipse", "iaxi", nestedVal, type, - wranglerSelection.getSearchPath(), - GlobalParameters.getTabWidth()); - } else { - res = WranglerBackendManager.getRefactoringBackend().callInspection( - "nested_exprs_in_file_eclipse", "siaxi", - wranglerSelection.getFilePath(), nestedVal, type, - wranglerSelection.getSearchPath(), - GlobalParameters.getTabWidth()); - } - // handle rpc - final ArrayList elements = processFunctionResult(shell, res); - if (elements == null) { - return; - } - // show result - if (!elements.isEmpty()) { - CodeInspectionViewsManager.showErlElements( - "Nested " + type + " expressions", elements, - SimpleCodeInspectionHandler.NESTED_EXPRESSIONS + type); - } else { - MessageDialog.openInformation(shell, "No result", - "Could not found any " + nestedVal + " levels nested " + type - + " expression!"); - } - - } - } catch (final Exception e) { - ErlLogger.error(e); - } - - } - - private void handleNotFlushUnknownMessages(final IErlSelection wranglerSelection, - final Shell shell) { - final String inFile = "not_flush_unknown_messages_in_file_eclipse"; - final String inProject = "not_flush_unknown_messages_in_dirs_eclipse"; - CodeInspectionViewsManager - .hideView(SimpleCodeInspectionHandler.NOT_FLUSH_UNKNOWN_MESSAGES); - final Boolean answer = MessageDialog.openQuestion(shell, - "Find incomplete receive patterns", - "Would you like to run the scan in the whole project?"); - try { - RpcResult result = null; - String function = ""; - if (answer) { - function = inProject; - result = WranglerBackendManager.getRefactoringBackend().callInspection( - function, "xi", wranglerSelection.getSearchPath(), - GlobalParameters.getTabWidth()); - } else { - function = inFile; - result = WranglerBackendManager.getRefactoringBackend().callInspection( - function, "sxi", wranglerSelection.getFilePath(), - wranglerSelection.getSearchPath(), - GlobalParameters.getTabWidth()); - } - - final ArrayList elements = processFunctionResult(shell, result); - - if (elements == null) { - return; - } - if (!elements.isEmpty()) { - CodeInspectionViewsManager.showErlElements("Incomplete receive patterns", - elements, SimpleCodeInspectionHandler.NOT_FLUSH_UNKNOWN_MESSAGES); - } else { - MessageDialog.openInformation(shell, "No result", - "Could not found any incomplete receive patterns!"); - } - } catch (final Exception e) { - ErlLogger.error(e); - } - } - - private ArrayList processFunctionResult(final Shell shell, - final RpcResult result) throws OtpErlangRangeException { - final ArrayList elements = new ArrayList<>(); - final OtpErlangObject obj = result.getValue(); - final OtpErlangTuple restuple = (OtpErlangTuple) obj; - final OtpErlangAtom resindicator = (OtpErlangAtom) restuple.elementAt(0); - if ("ok".equals(resindicator.atomValue())) { - final OtpErlangList erlangFunctionList = (OtpErlangList) restuple - .elementAt(1); - for (int i = 0; i < erlangFunctionList.arity(); ++i) { - final OtpErlangTuple fTuple = (OtpErlangTuple) erlangFunctionList - .elementAt(i); - IErlFunctionClause f; - try { - f = extractFunction(fTuple); - elements.add(f); - } catch (final ErlModelException e) { - } - } - } else { - final OtpErlangString s = (OtpErlangString) restuple.elementAt(1); - MessageDialog.openError(shell, "Error", s.stringValue()); - return null; - } - return elements; - } - - private void handleNonTailRecursiveCall(final IErlSelection wranglerSelection, - final Shell shell) { - CodeInspectionViewsManager - .hideView(SimpleCodeInspectionHandler.NON_TAIL_RECURSIVE_VIEW_ID); - - try { - final String inFile = "non_tail_recursive_servers_in_file_eclipse"; - final String inProject = "non_tail_recursive_servers_in_dirs_eclipse"; - final Boolean answer = MessageDialog.openQuestion(shell, - "Find non tail recursive servers", - "Would you like to run the scan in the whole project?"); - String function = ""; - RpcResult res = null; - if (!answer) { - function = inFile; - res = WranglerBackendManager.getRefactoringBackend().callInspection( - function, "sxi", wranglerSelection.getFilePath(), - wranglerSelection.getSearchPath(), - GlobalParameters.getTabWidth()); - } else { - function = inProject; - res = WranglerBackendManager.getRefactoringBackend().callInspection( - function, "xi", wranglerSelection.getSearchPath(), - GlobalParameters.getTabWidth()); - } - - final ArrayList elements = processFunctionResult(shell, res); - - if (elements == null) { - return; - } - if (!elements.isEmpty()) { - CodeInspectionViewsManager.showErlElements("Non tail recursive servers", - elements, SimpleCodeInspectionHandler.NON_TAIL_RECURSIVE_VIEW_ID); - } else { - MessageDialog.openInformation(shell, "No result", - "Could not found any non tail recursive server!"); - } - } catch (final Exception e) { - ErlLogger.error(e); - } - - } - - private IErlFunctionClause extractFunction(final OtpErlangTuple fTuple) - throws OtpErlangRangeException, ErlModelException { - final IErlModule mod = extractModule(fTuple.elementAt(0)); - final String function = ((OtpErlangAtom) fTuple.elementAt(1)).atomValue(); - final int arity = ((OtpErlangLong) fTuple.elementAt(2)).intValue(); - final IErlFunctionClause f = ErlangEngine.getInstance().getModel() - .findFunction(new FunctionRef(mod.getModuleName(), function, arity)); - return f; - } - - private void handleDepenenciesCall(final IErlSelection wranglerSelection, - final Shell shell) { - // hiding the views - CodeInspectionViewsManager.hideView( - CodeInspectionViewsManager.CODE_INSPECTION_VIEW, - SimpleCodeInspectionHandler.DEPENECIES_1_VIEW_ID); - CodeInspectionViewsManager.hideView( - CodeInspectionViewsManager.CODE_INSPECTION_VIEW, - SimpleCodeInspectionHandler.DEPENECIES_2_VIEW_ID); - - // run the rpc - try { - final RpcResult res = WranglerBackendManager.getRefactoringBackend() - .callInspection("dependencies_of_a_module_eclipse", "sx", - wranglerSelection.getFilePath(), - wranglerSelection.getSearchPath()); - - ArrayList modules1 = new ArrayList<>(); - ArrayList modules2 = new ArrayList<>(); - - final OtpErlangObject obj = res.getValue(); - final OtpErlangTuple restuple = (OtpErlangTuple) obj; - final OtpErlangAtom resindicator = (OtpErlangAtom) restuple.elementAt(0); - if ("ok".equals(resindicator.atomValue())) { - final OtpErlangTuple listtuple = (OtpErlangTuple) restuple.elementAt(1); - final OtpErlangList modList1 = (OtpErlangList) listtuple.elementAt(0); - final OtpErlangList modList2 = (OtpErlangList) listtuple.elementAt(1); - modules1 = createErlModuleList(modList1); - modules2 = createErlModuleList(modList2); - } else { - final OtpErlangString s = (OtpErlangString) restuple.elementAt(1); - MessageDialog.openError(shell, "Error", s.stringValue()); - return; - } - - if (!modules1.isEmpty()) { - CodeInspectionViewsManager.showErlElements( - "Modules which depends on " + wranglerSelection.getErlElement() - .getAncestorOfKind(ErlElementKind.MODULE).getName(), - modules1, SimpleCodeInspectionHandler.DEPENECIES_1_VIEW_ID); - } - if (!modules2.isEmpty()) { - CodeInspectionViewsManager.showErlElements( - "Modules, on which " + wranglerSelection.getErlElement() - .getAncestorOfKind(ErlElementKind.MODULE).getName() - + " depends", - modules2, SimpleCodeInspectionHandler.DEPENECIES_2_VIEW_ID); - } else { - MessageDialog.openInformation(shell, "No result", - "There is no large module with the specified parameter!"); - } - } catch (final Exception e) { - ErlLogger.error(e); - } - } - - private ArrayList createErlModuleList(final OtpErlangList modList) { - final ArrayList modules = new ArrayList<>(); - for (int i = 0; i < modList.arity(); ++i) { - IErlModule m; - try { - m = extractModule(modList.elementAt(i)); - modules.add(m); - } catch (final ErlModelException e) { - } - } - return modules; - } - - private IErlModule extractModule(final OtpErlangObject m) throws ErlModelException { - String name = ""; - if (m instanceof OtpErlangString) { - final OtpErlangString element = (OtpErlangString) m; - name = element.stringValue(); - } else if (m instanceof OtpErlangAtom) { - final OtpErlangAtom atom = (OtpErlangAtom) m; - name = atom.atomValue(); - } - final String[] modNameParts = name.split("/"); - final IErlModule mod = ErlangEngine.getInstance().getModel() - .findModule(modNameParts[modNameParts.length - 1]); - return mod; - } - - private void handleLargeModulesCall(final IErlSelection wranglerSelection, - final Shell shell) { - CodeInspectionViewsManager.hideView( - CodeInspectionViewsManager.CODE_INSPECTION_VIEW, - SimpleCodeInspectionHandler.LARGE_MODULES_VIEW_ID); - - final InputDialog dialog = new InputDialog(shell, "Lines of a large module", - "Lines of a large module:", "", new IntegerInputValidator()); - final int ret = dialog.open(); - if (ret == Window.CANCEL) { - return; - } - final int lines = Integer.parseInt(dialog.getValue()); - final RpcResult res = WranglerBackendManager.getRefactoringBackend() - .callInspection("large_modules_eclipse", "ixi", lines, - wranglerSelection.getSearchPath(), - GlobalParameters.getTabWidth()); - - ArrayList modules = new ArrayList<>(); - try { - final OtpErlangObject obj = res.getValue(); - final OtpErlangTuple restuple = (OtpErlangTuple) obj; - final OtpErlangAtom resindicator = (OtpErlangAtom) restuple.elementAt(0); - if ("ok".equals(resindicator.atomValue())) { - - final OtpErlangList modList = (OtpErlangList) restuple.elementAt(1); - modules = createErlModuleList(modList); - } else { - final OtpErlangString s = (OtpErlangString) restuple.elementAt(1); - MessageDialog.openError(shell, "Error", s.stringValue()); - return; - } - } catch (final Exception e) { - ErlLogger.error(e); - } - if (!modules.isEmpty()) { - CodeInspectionViewsManager.showErlElements("Large modules", modules, - SimpleCodeInspectionHandler.LARGE_MODULES_VIEW_ID); - } else { - MessageDialog.openInformation(shell, "No result", - "There is no large module with the specified parameter!"); - } - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/src/org/erlide/wrangler/refactoring/codeinspection/ui/InputDialogWithCheckbox.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/src/org/erlide/wrangler/refactoring/codeinspection/ui/InputDialogWithCheckbox.java deleted file mode 100644 index a97fb088af..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/src/org/erlide/wrangler/refactoring/codeinspection/ui/InputDialogWithCheckbox.java +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.codeinspection.ui; - -import org.eclipse.jface.dialogs.IInputValidator; -import org.eclipse.jface.dialogs.InputDialog; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -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.Shell; - -/** - * Simple input dialog with a checkbox - * - * @author Gyorgy Orosz - * - */ -public class InputDialogWithCheckbox extends InputDialog { - protected String checkBoxText; - protected Button checkBox; - protected boolean isCheckBoxSelected; - - /** - * Constructor - * - * @param parentShell - * parent shell - * @param dialogTitle - * dialog title - * @param dialogMessage - * dialog message - * @param checkBoxText - * checkbox text - * @param initialValue - * initial value - * @param validator - * validator object - */ - public InputDialogWithCheckbox(final Shell parentShell, final String dialogTitle, - final String dialogMessage, final String checkBoxText, - final String initialValue, final IInputValidator validator) { - super(parentShell, dialogTitle, dialogMessage, initialValue, validator); - this.checkBoxText = checkBoxText; - - } - - @Override - protected Control createDialogArea(final Composite parent) { - final Composite c = (Composite) super.createDialogArea(parent); - checkBox = new Button(c, SWT.CHECK); - checkBox.setText(checkBoxText); - - checkBox.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL - | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL - | GridData.VERTICAL_ALIGN_CENTER)); - checkBox.addSelectionListener(new SelectionListener() { - - @Override - public void widgetSelected(final SelectionEvent e) { - isCheckBoxSelected = checkBox.getSelection(); - - } - - @Override - public void widgetDefaultSelected(final SelectionEvent e) { - widgetSelected(e); - } - }); - - return c; - } - - /** - * Returns the checkbox last value. - * - * @return true if the checkbox was selected - */ - public boolean isCheckBoxChecked() { - return isCheckBoxSelected; - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/src/org/erlide/wrangler/refactoring/codeinspection/view/CodeInspectionResultsView.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/src/org/erlide/wrangler/refactoring/codeinspection/view/CodeInspectionResultsView.java deleted file mode 100644 index 751d5b9267..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/src/org/erlide/wrangler/refactoring/codeinspection/view/CodeInspectionResultsView.java +++ /dev/null @@ -1,160 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.codeinspection.view; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IFile; -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.TableViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.ISharedImages; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.part.ViewPart; -import org.erlide.engine.ErlangEngine; -import org.erlide.engine.model.IErlElement; -import org.erlide.engine.model.erlang.IErlFunctionClause; -import org.erlide.engine.model.root.IErlModule; -import org.erlide.util.ErlLogger; -import org.erlide.wrangler.refactoring.util.WranglerUtils; - -/** - * View which handles textual data referencing to an Erlang element, got from code - * inspection functions - * - * @author Gyorgy Orosz - * - */ -public class CodeInspectionResultsView extends ViewPart { - public static final String VIEW_ID = "org.erlide.wrangler.refactoring.codeinspection.codeinspectionresultview"; - - List results = new ArrayList<>(); - - private TableViewer viewer; - - class ViewContentProvider implements IStructuredContentProvider { - @Override - public void inputChanged(final Viewer v, final Object oldInput, - final Object newInput) { - } - - @Override - public void dispose() { - } - - @Override - public Object[] getElements(final Object parent) { - return results.toArray(); - } - } - - class ViewLabelProvider extends LabelProvider implements ITableLabelProvider { - @Override - public String getColumnText(final Object obj, final int index) { - final IErlElement e = (IErlElement) obj; - if (e instanceof IErlModule) { - final IErlModule m = (IErlModule) e; - return m.getModuleName() + "\t\t- " - + e.getResource().getFullPath().toString(); - } else if (e instanceof IErlFunctionClause) { - final IErlFunctionClause fc = (IErlFunctionClause) e; - return ErlangEngine.getInstance().getModelUtilService().getModule(fc) - .getModuleName() + ":" + fc.toString(); - } - return e.toString(); - } - - @Override - public Image getColumnImage(final Object obj, final int index) { - return getImage(obj); - } - - @Override - public Image getImage(final Object obj) { - if (obj instanceof IErlModule) { - return PlatformUI.getWorkbench().getSharedImages() - .getImage(ISharedImages.IMG_OBJ_FILE); - } else if (obj instanceof IErlFunctionClause) { - return PlatformUI.getWorkbench().getSharedImages() - .getImage(ISharedImages.IMG_OBJ_ELEMENT); - } else { - return null; - } - } - } - - @Override - public void createPartControl(final Composite parent) { - viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); - viewer.setContentProvider(new ViewContentProvider()); - viewer.setLabelProvider(new ViewLabelProvider()); - viewer.setInput(getViewSite()); - viewer.addDoubleClickListener(event -> { - - final IStructuredSelection s = (IStructuredSelection) event.getSelection(); - final Object o = s.getFirstElement(); - if (o instanceof IErlModule) { - final IErlModule m = (IErlModule) o; - WranglerUtils.openFile((IFile) m.getResource()); - } else if (o instanceof IErlFunctionClause) { - WranglerUtils.highlightSelection((IErlFunctionClause) o); - } - - }); - - } - - /** - * Passes the focus request to the viewer's control. - */ - @Override - public void setFocus() { - viewer.getControl().setFocus(); - } - - /** - * Refresh the view, to show the latest content. - */ - public void refresh() { - try { - viewer.refresh(); - } catch (final Exception e) { - ErlLogger.error(e); - } - - } - - /** - * Adds Erlang elements to the view - * - * @param e - * Erlang elements' list - */ - public void addElements(final ArrayList e) { - results = e; - } - - /** - * Sets the view title - * - * @param title - * title - */ - public void setViewTitle(final String title) { - setPartName(title); - - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/src/org/erlide/wrangler/refactoring/codeinspection/view/GraphImageView.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/src/org/erlide/wrangler/refactoring/codeinspection/view/GraphImageView.java deleted file mode 100644 index 8ef2d92ca2..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/src/org/erlide/wrangler/refactoring/codeinspection/view/GraphImageView.java +++ /dev/null @@ -1,303 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. All rights reserved. This program - * and the accompanying materials are made available under the terms of the Common Public - * License v1.0 which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.erlide.wrangler.refactoring.codeinspection.view; - -import java.io.File; -import java.io.IOException; - -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.FileDialog; -import org.eclipse.ui.ISharedImages; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.part.ViewPart; - -import com.google.common.io.Files; - -/** - * This ImageView class shows how to use SWTImageCanvas to manipulate images. - *

- * To facilitate the usage, you should setFocus to the canvas at the beginning, and call - * the dispose at the end. - *

- * - * @author Chengdong Li: cli4@uky.edu - * @see uky.article.imageviewer.SWTImageCanvas - * @author György Orosz - */ - -public class GraphImageView extends ViewPart { - // IPath fragmentPath; - // { - // Bundle[] bs = Platform - // .getFragments(Platform - // .getBundle(org.erlide.wrangler.refactoring.Activator.PLUGIN_ID)); - // if (bs.length < 1) { - // ErlLogger.debug("Fragment is not loaded?! No C binary is run."); - // - // } - // Bundle fragment = null; - // for (int i = 0; i < bs.length; ++i) { - // if (bs[i].getSymbolicName().equals( - // "org.erlide.wrangler.refactoring.codeinspection")) { - // fragment = bs[i]; - // break; - // } - // } - // - // java.net.URL url = FileLocator.find(fragment, new Path(""), null); - // try { - // url = FileLocator.resolve(url); - // } catch (IOException e) { - // ErlLogger.error(e); - // } - // fragmentPath = new Path(url.getPath()); - // } - - /** - * Save image action class - * - * @author Gyorgy Orosz - */ - public class SaveImageAction extends Action { - /** - * Constructor - */ - public SaveImageAction() { - setText("Save image as..."); - setToolTipText("Save image as..."); - setImageDescriptor(PlatformUI.getWorkbench().getSharedImages() - .getImageDescriptor(ISharedImages.IMG_ETOOL_SAVEAS_EDIT)); - - } - - @Override - public void run() { - imageCanvas.onFileSave(); - } - - } - - /** - * Save file action class - * - * @author Gyorgy Orosz - */ - public class SaveDOTAction extends Action { - /** - * Constructor - */ - public SaveDOTAction() { - setText("Save .dot file as..."); - setToolTipText("Save .dot file as..."); - setImageDescriptor(PlatformUI.getWorkbench().getSharedImages() - .getImageDescriptor(ISharedImages.IMG_ETOOL_SAVEAS_EDIT)); - - } - - @Override - public void run() { - final FileDialog fileChooser = new FileDialog(imageCanvas.getShell(), - SWT.SAVE); - fileChooser.setText("Save .dot file"); - fileChooser.setFilterPath(""); - fileChooser.setFilterExtensions(new String[] { "*.dot" }); - fileChooser.setFilterNames(new String[] { "Graphviz file " + " (dot)" }); - final String filename = fileChooser.open(); - if (filename != null) { - try { - Files.copy(dotFile, new File(filename)); - } catch (final IOException e) { - MessageDialog.openError(imageCanvas.getShell(), "Saving error", - e.getMessage()); - } - } - } - } - - // public class RotateAction extends Action { - // public RotateAction() { - // setText("Rotate image"); - // setToolTipText("Rotate image"); - // // setImageDescriptor(new Ima - // - // } - // - // @Override - // public void run() { - // ImageData src = imageCanvas.getImageData(); - // if (src == null) - // return; - // PaletteData srcPal = src.palette; - // PaletteData destPal; - // ImageData dest; - // /* construct a new ImageData */ - // if (srcPal.isDirect) { - // destPal = new PaletteData(srcPal.redMask, srcPal.greenMask, - // srcPal.blueMask); - // } else { - // destPal = new PaletteData(srcPal.getRGBs()); - // } - // dest = new ImageData(src.height, src.width, src.depth, destPal); - // /* rotate by rearranging the pixels */ - // for (int i = 0; i < src.width; i++) { - // for (int j = 0; j < src.height; j++) { - // int pixel = src.getPixel(i, j); - // dest.setPixel(j, src.width - 1 - i, pixel); - // } - // } - // imageCanvas.setImageData(dest); - // } - // - // } - // - // public class FitWindowAction extends Action { - // public FitWindowAction() { - // setText(""); - // setToolTipText(""); - // setImageDescriptor(PlatformUI.getWorkbench().getSharedImages() - // .getImageDescriptor(ISharedImages.IMG_ELCL_REMOVEALL)); - // - // } - // - // @Override - // public void run() { - // - // } - // - // } - // - // public class OriginalSizeAction extends Action { - // public OriginalSizeAction() { - // setText(""); - // setToolTipText(""); - // setImageDescriptor(PlatformUI.getWorkbench().getSharedImages() - // .getImageDescriptor(ISharedImages.IMG_ELCL_REMOVEALL)); - // - // } - // - // @Override - // public void run() { - // - // } - // - // } - // - // public class ZoomInAction extends Action { - // public ZoomInAction() { - // setText(""); - // setToolTipText(""); - // setImageDescriptor(PlatformUI.getWorkbench().getSharedImages() - // .getImageDescriptor(ISharedImages.IMG_ELCL_REMOVEALL)); - // - // } - // - // @Override - // public void run() { - // - // } - // - // } - // - // public class ZoomOutAction extends Action { - // public ZoomOutAction() { - // setText(""); - // setToolTipText(""); - // setImageDescriptor(PlatformUI.getWorkbench().getSharedImages() - // .getImageDescriptor(ISharedImages.IMG_ELCL_REMOVEALL)); - // - // } - // - // @Override - // public void run() { - // - // } - // - // } - - /** - * View id - */ - public static String VIEW_ID = "org.erlide.wrangler.codeinspection.graphview"; - SWTImageCanvas imageCanvas; - private File dotFile; - - /** - * The constructor. - */ - public GraphImageView() { - } - - /** - * Create the GUI. - * - * @param frame - * The Composite handle of parent - */ - @Override - public void createPartControl(final Composite frame) { - imageCanvas = new SWTImageCanvas(frame); - final IToolBarManager mgr = getViewSite().getActionBars().getToolBarManager(); - mgr.add(new SaveImageAction()); - mgr.add(new SaveDOTAction()); - } - - /** - * Called when we must grab focus. - * - * @see org.eclipse.ui.part.ViewPart#setFocus - */ - @Override - public void setFocus() { - imageCanvas.setFocus(); - } - - /** - * Called when the View is to be disposed - */ - @Override - public void dispose() { - imageCanvas.dispose(); - super.dispose(); - } - - /** - * Set view title - * - * @param title - * title string - */ - public void setViewTitle(final String title) { - setPartName(title); - } - - /** - * Stores the given file - * - * @param f - * dot file - */ - public void setDotFile(final File f) { - dotFile = f; - } - - /** - * Loads the given image to the canvas - * - * @param imgpath - * image path - */ - public void setImage(final Image img) { - imageCanvas.setImage(img); - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/src/org/erlide/wrangler/refactoring/codeinspection/view/PushActionDelegate.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/src/org/erlide/wrangler/refactoring/codeinspection/view/PushActionDelegate.java deleted file mode 100644 index 73188bac3a..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/src/org/erlide/wrangler/refactoring/codeinspection/view/PushActionDelegate.java +++ /dev/null @@ -1,101 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 Chengdong Li : cdli@ccs.uky.edu All rights reserved. This program - * and the accompanying materials are made available under the terms of the Common Public - * License v1.0 which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - *******************************************************************************/ -package org.erlide.wrangler.refactoring.codeinspection.view; - -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.swt.graphics.ImageData; -import org.eclipse.swt.graphics.PaletteData; -import org.eclipse.ui.IViewActionDelegate; -import org.eclipse.ui.IViewPart; - -/** - * Action delegate for all toolbar push-buttons. - *

- * - * @author Chengdong Li: cli4@uky.edu - * - */ -public class PushActionDelegate implements IViewActionDelegate { - /** pointer to image view */ - public GraphImageView view; - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart) - */ - @Override - public void init(final IViewPart viewPart) { - if (viewPart instanceof GraphImageView) { - view = (GraphImageView) viewPart; - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) - */ - @Override - public void run(final IAction action) { - final String myId = action.getId(); - final SWTImageCanvas imageCanvas = view.imageCanvas; - if ("toolbar.open".equals(myId)) { - imageCanvas.onFileOpen(); - return; - } - if (imageCanvas.getSourceImage() == null) { - return; - } - if ("toolbar.zoomin".equals(myId)) { - imageCanvas.zoomIn(); - } else if ("toolbar.zoomout".equals(myId)) { - imageCanvas.zoomOut(); - } else if ("toolbar.fit".equals(myId)) { - imageCanvas.fitCanvas(); - } else if ("toolbar.rotate".equals(myId)) { - /* rotate image anti-clockwise */ - final ImageData src = imageCanvas.getImageData(); - if (src == null) { - return; - } - final PaletteData srcPal = src.palette; - PaletteData destPal; - ImageData dest; - /* construct a new ImageData */ - if (srcPal.isDirect) { - destPal = new PaletteData(srcPal.redMask, srcPal.greenMask, - srcPal.blueMask); - } else { - destPal = new PaletteData(srcPal.getRGBs()); - } - dest = new ImageData(src.height, src.width, src.depth, destPal); - /* rotate by rearranging the pixels */ - for (int i = 0; i < src.width; i++) { - for (int j = 0; j < src.height; j++) { - final int pixel = src.getPixel(i, j); - dest.setPixel(j, src.width - 1 - i, pixel); - } - } - imageCanvas.setImageData(dest); - } else if ("toolbar.original".equals(myId)) { - imageCanvas.showOriginal(); - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action - * .IAction, org.eclipse.jface.viewers.ISelection) - */ - @Override - public void selectionChanged(final IAction action, final ISelection selection) { - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/src/org/erlide/wrangler/refactoring/codeinspection/view/SWT2Dutil.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/src/org/erlide/wrangler/refactoring/codeinspection/view/SWT2Dutil.java deleted file mode 100644 index 29c9e9cebf..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/src/org/erlide/wrangler/refactoring/codeinspection/view/SWT2Dutil.java +++ /dev/null @@ -1,137 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 Chengdong Li : cdli@ccs.uky.edu All rights reserved. This program - * and the accompanying materials are made available under the terms of the Common Public - * License v1.0 which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - *******************************************************************************/ -package org.erlide.wrangler.refactoring.codeinspection.view; - -import java.awt.geom.AffineTransform; -import java.awt.geom.Point2D; - -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.graphics.Rectangle; -import org.erlide.util.ErlLogger; - -/** - * Utility for Java2d transform - * - * @author Chengdong Li: cli4@uky.edu - * - */ -public class SWT2Dutil { - - private SWT2Dutil() { - } - - /** - * Given an arbitrary rectangle, get the rectangle with the given transform. The - * result rectangle is positive width and positive height. - * - * @param af - * AffineTransform - * @param src - * source rectangle - * @return rectangle after transform with positive width and height - */ - public static Rectangle transformRect(final AffineTransform af, - final Rectangle src0) { - final Rectangle dest = new Rectangle(0, 0, 0, 0); - final Rectangle src = SWT2Dutil.absRect(src0); - Point p1 = new Point(src.x, src.y); - p1 = SWT2Dutil.transformPoint(af, p1); - dest.x = p1.x; - dest.y = p1.y; - dest.width = (int) (src.width * af.getScaleX()); - dest.height = (int) (src.height * af.getScaleY()); - return dest; - } - - /** - * Given an arbitrary rectangle, get the rectangle with the inverse given transform. - * The result rectangle is positive width and positive height. - * - * @param af - * AffineTransform - * @param src - * source rectangle - * @return rectangle after transform with positive width and height - */ - public static Rectangle inverseTransformRect(final AffineTransform af, - final Rectangle src0) { - final Rectangle dest = new Rectangle(0, 0, 0, 0); - final Rectangle src = SWT2Dutil.absRect(src0); - Point p1 = new Point(src.x, src.y); - p1 = SWT2Dutil.inverseTransformPoint(af, p1); - dest.x = p1.x; - dest.y = p1.y; - dest.width = (int) (src.width / af.getScaleX()); - dest.height = (int) (src.height / af.getScaleY()); - return dest; - } - - /** - * Given an arbitrary point, get the point with the given transform. - * - * @param af - * affine transform - * @param pt - * point to be transformed - * @return point after tranform - */ - public static Point transformPoint(final AffineTransform af, final Point pt) { - final Point2D src = new Point2D.Float(pt.x, pt.y); - final Point2D dest = af.transform(src, null); - final Point point = new Point((int) Math.floor(dest.getX()), - (int) Math.floor(dest.getY())); - return point; - } - - /** - * Given an arbitrary point, get the point with the inverse given transform. - * - * @param af - * AffineTransform - * @param pt - * source point - * @return point after transform - */ - public static Point inverseTransformPoint(final AffineTransform af, final Point pt) { - final Point2D src = new Point2D.Float(pt.x, pt.y); - try { - final Point2D dest = af.inverseTransform(src, null); - return new Point((int) Math.floor(dest.getX()), - (int) Math.floor(dest.getY())); - } catch (final Exception e) { - ErlLogger.error(e); - return new Point(0, 0); - } - } - - /** - * Given arbitrary rectangle, return a rectangle with upper-left start and positive - * width and height. - * - * @param src - * source rectangle - * @return result rectangle with positive width and height - */ - public static Rectangle absRect(final Rectangle src) { - final Rectangle dest = new Rectangle(0, 0, 0, 0); - if (src.width < 0) { - dest.x = src.x + src.width + 1; - dest.width = -src.width; - } else { - dest.x = src.x; - dest.width = src.width; - } - if (src.height < 0) { - dest.y = src.y + src.height + 1; - dest.height = -src.height; - } else { - dest.y = src.y; - dest.height = src.height; - } - return dest; - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/src/org/erlide/wrangler/refactoring/codeinspection/view/SWTImageCanvas.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/src/org/erlide/wrangler/refactoring/codeinspection/view/SWTImageCanvas.java deleted file mode 100644 index f10053896e..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/src/org/erlide/wrangler/refactoring/codeinspection/view/SWTImageCanvas.java +++ /dev/null @@ -1,418 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 Chengdong Li : cdli@ccs.uky.edu All rights reserved. This program - * and the accompanying materials are made available under the terms of the Common Public - * License v1.0 which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - *******************************************************************************/ -package org.erlide.wrangler.refactoring.codeinspection.view; - -import java.awt.geom.AffineTransform; - -import org.eclipse.core.runtime.Path; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ControlAdapter; -import org.eclipse.swt.events.ControlEvent; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.GC; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.ImageData; -import org.eclipse.swt.graphics.ImageLoader; -import org.eclipse.swt.graphics.Rectangle; -import org.eclipse.swt.widgets.Canvas; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.FileDialog; -import org.eclipse.swt.widgets.ScrollBar; - -/** - * A scrollable image canvas that extends org.eclipse.swt.graphics.Canvas. - *

- * It requires Eclipse (version >= 2.1) on Win32/win32; Linux/gtk; MacOSX/carbon. - *

- * This implementation using the pure SWT, no UI AWT package is used. For convenience, I - * put everything into one class. However, the best way to implement this is to use - * inheritance to create multiple hierarchies. - * - * @author Chengdong Li: cli4@uky.edu - */ -public class SWTImageCanvas extends Canvas { - /* zooming rates in x and y direction are equal. */ - final float ZOOMIN_RATE = 1.1f; /* zoomin rate */ - final float ZOOMOUT_RATE = 0.9f; /* zoomout rate */ - private Image sourceImage; /* original image */ - Image screenImage; /* screen image */ - private AffineTransform transform = new AffineTransform(); - - private String currentDir = ""; /* remembering file open directory */ - - public SWTImageCanvas(final Composite parent) { - this(parent, SWT.NULL); - } - - /** - * Constructor for ScrollableCanvas. - * - * @param parent - * the parent of this control. - * @param style - * the style of this control. - */ - public SWTImageCanvas(final Composite parent, final int style) { - super(parent, - style | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.NO_BACKGROUND); - addControlListener(new ControlAdapter() { /* resize listener. */ - @Override - public void controlResized(final ControlEvent event) { - syncScrollBars(); - } - }); - addPaintListener(event -> paint(event.gc)); - initScrollBars(); - } - - /** - * Dispose the garbage here - */ - @Override - public void dispose() { - if (sourceImage != null && !sourceImage.isDisposed()) { - sourceImage.dispose(); - } - if (screenImage != null && !screenImage.isDisposed()) { - screenImage.dispose(); - } - } - - /* Paint function */ - private void paint(final GC gc) { - final Rectangle clientRect = getClientArea(); /* Canvas' painting area */ - if (sourceImage != null) { - Rectangle imageRect = SWT2Dutil.inverseTransformRect(transform, clientRect); - final int gap = 2; /* find a better start point to render */ - imageRect.x -= gap; - imageRect.y -= gap; - imageRect.width += 2 * gap; - imageRect.height += 2 * gap; - - final Rectangle imageBound = sourceImage.getBounds(); - imageRect = imageRect.intersection(imageBound); - final Rectangle destRect = SWT2Dutil.transformRect(transform, imageRect); - - if (screenImage != null) { - screenImage.dispose(); - } - screenImage = new Image(getDisplay(), clientRect.width, clientRect.height); - final GC newGC = new GC(screenImage); - newGC.setClipping(clientRect); - newGC.drawImage(sourceImage, imageRect.x, imageRect.y, imageRect.width, - imageRect.height, destRect.x, destRect.y, destRect.width, - destRect.height); - newGC.dispose(); - - gc.drawImage(screenImage, 0, 0); - } else { - gc.setClipping(clientRect); - gc.fillRectangle(clientRect); - initScrollBars(); - } - } - - /* Initalize the scrollbar and register listeners. */ - private void initScrollBars() { - final ScrollBar horizontal = getHorizontalBar(); - horizontal.setEnabled(false); - horizontal.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(final SelectionEvent event) { - scrollHorizontally((ScrollBar) event.widget); - } - }); - final ScrollBar vertical = getVerticalBar(); - vertical.setEnabled(false); - vertical.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(final SelectionEvent event) { - scrollVertically((ScrollBar) event.widget); - } - }); - } - - /* Scroll horizontally */ - private void scrollHorizontally(final ScrollBar scrollBar) { - if (sourceImage == null) { - return; - } - - final AffineTransform af = transform; - final double tx = af.getTranslateX(); - final double select = -scrollBar.getSelection(); - af.preConcatenate(AffineTransform.getTranslateInstance(select - tx, 0)); - transform = af; - syncScrollBars(); - } - - /* Scroll vertically */ - private void scrollVertically(final ScrollBar scrollBar) { - if (sourceImage == null) { - return; - } - - final AffineTransform af = transform; - final double ty = af.getTranslateY(); - final double select = -scrollBar.getSelection(); - af.preConcatenate(AffineTransform.getTranslateInstance(0, select - ty)); - transform = af; - syncScrollBars(); - } - - /** - * Source image getter. - * - * @return sourceImage. - */ - public Image getSourceImage() { - return sourceImage; - } - - /** - * Synchronize the scrollbar with the image. If the transform is out of range, it will - * correct it. This function considers only following factors : transform, image - * size, client area. - */ - public void syncScrollBars() { - if (sourceImage == null) { - redraw(); - return; - } - - AffineTransform af = transform; - final double sx = af.getScaleX(); - final double sy = af.getScaleY(); - double tx = af.getTranslateX(); - double ty = af.getTranslateY(); - if (tx > 0) { - tx = 0; - } - if (ty > 0) { - ty = 0; - } - - final ScrollBar horizontal = getHorizontalBar(); - horizontal.setIncrement(getClientArea().width / 100); - horizontal.setPageIncrement(getClientArea().width); - final Rectangle imageBound = sourceImage.getBounds(); - final int cw = getClientArea().width; - final int ch = getClientArea().height; - if (imageBound.width * sx > cw) { /* image is wider than client area */ - horizontal.setMaximum((int) (imageBound.width * sx)); - horizontal.setEnabled(true); - if ((int) -tx > horizontal.getMaximum() - cw) { - tx = -horizontal.getMaximum() + cw; - } - } else { /* image is narrower than client area */ - horizontal.setEnabled(false); - tx = (cw - imageBound.width * sx) / 2; // center if too small. - } - horizontal.setSelection((int) -tx); - horizontal.setThumb(getClientArea().width); - - final ScrollBar vertical = getVerticalBar(); - vertical.setIncrement(getClientArea().height / 100); - vertical.setPageIncrement(getClientArea().height); - if (imageBound.height * sy > ch) { /* image is higher than client area */ - vertical.setMaximum((int) (imageBound.height * sy)); - vertical.setEnabled(true); - if ((int) -ty > vertical.getMaximum() - ch) { - ty = -vertical.getMaximum() + ch; - } - } else { /* image is less higher than client area */ - vertical.setEnabled(false); - ty = (ch - imageBound.height * sy) / 2; // center if too small. - } - vertical.setSelection((int) -ty); - vertical.setThumb(getClientArea().height); - - /* update transform. */ - af = AffineTransform.getScaleInstance(sx, sy); - af.preConcatenate(AffineTransform.getTranslateInstance(tx, ty)); - transform = af; - - redraw(); - } - - /** - * Reload image from a file - * - * @param filename - * image file - * @return swt image created from image file - */ - public Image loadImage(final String filename) { - if (sourceImage != null && !sourceImage.isDisposed()) { - sourceImage.dispose(); - sourceImage = null; - } - sourceImage = new Image(getDisplay(), filename); - showOriginal(); - return sourceImage; - } - - /** - * Load image - * - * @param img - * image object - */ - public void setImage(final Image img) { - sourceImage = img; - showOriginal(); - } - - /** - * Save image to a file - */ - public void onFileSave() { - final FileDialog fileChooser = new FileDialog(getShell(), SWT.SAVE); - fileChooser.setText("Save image file"); - fileChooser.setFilterPath(currentDir); - fileChooser.setFilterExtensions(new String[] { "*.jpg;*.png" }); - fileChooser.setFilterNames(new String[] { "Image file " + " (jpeg, png)" }); - final String filename = fileChooser.open(); - if (filename != null) { - final ImageLoader imageLoader = new ImageLoader(); - imageLoader.data = new ImageData[] { sourceImage.getImageData() }; - final Path p = new Path(filename); - if ("jpg".equals(p.getFileExtension())) { - imageLoader.save(filename, SWT.IMAGE_JPEG); - } else { - imageLoader.save(filename, SWT.IMAGE_PNG); - } - - } - - } - - /** - * Call back funtion of button "open". Will open a file dialog, and choose the image - * file. It supports image formats supported by Eclipse. - */ - public void onFileOpen() { - final FileDialog fileChooser = new FileDialog(getShell(), SWT.OPEN); - fileChooser.setText("Open image file"); - fileChooser.setFilterPath(currentDir); - fileChooser.setFilterExtensions( - new String[] { "*.gif; *.jpg; *.png; *.ico; *.bmp" }); - fileChooser.setFilterNames( - new String[] { "SWT image" + " (gif, jpeg, png, ico, bmp)" }); - final String filename = fileChooser.open(); - if (filename != null) { - loadImage(filename); - currentDir = fileChooser.getFilterPath(); - } - } - - /** - * Get the image data. (for future use only) - * - * @return image data of canvas - */ - public ImageData getImageData() { - return sourceImage.getImageData(); - } - - /** - * Reset the image data and update the image - * - * @param data - * image data to be set - */ - public void setImageData(final ImageData data) { - if (sourceImage != null) { - sourceImage.dispose(); - } - if (data != null) { - sourceImage = new Image(getDisplay(), data); - } - syncScrollBars(); - } - - /** - * Fit the image onto the canvas - */ - public void fitCanvas() { - if (sourceImage == null) { - return; - } - final Rectangle imageBound = sourceImage.getBounds(); - final Rectangle destRect = getClientArea(); - final double sx = (double) destRect.width / (double) imageBound.width; - final double sy = (double) destRect.height / (double) imageBound.height; - final double s = Math.min(sx, sy); - final double dx = 0.5 * destRect.width; - final double dy = 0.5 * destRect.height; - centerZoom(dx, dy, s, new AffineTransform()); - } - - /** - * Show the image with the original size - */ - public void showOriginal() { - if (sourceImage == null) { - return; - } - transform = new AffineTransform(); - syncScrollBars(); - } - - /** - * Perform a zooming operation centered on the given point (dx, dy) and using the - * given scale factor. The given AffineTransform instance is preconcatenated. - * - * @param dx - * center x - * @param dy - * center y - * @param scale - * zoom rate - * @param af - * original affinetransform - */ - public void centerZoom(final double dx, final double dy, final double scale, - final AffineTransform af) { - af.preConcatenate(AffineTransform.getTranslateInstance(-dx, -dy)); - af.preConcatenate(AffineTransform.getScaleInstance(scale, scale)); - af.preConcatenate(AffineTransform.getTranslateInstance(dx, dy)); - transform = af; - syncScrollBars(); - } - - /** - * Zoom in around the center of client Area. - */ - public void zoomIn() { - if (sourceImage == null) { - return; - } - final Rectangle rect = getClientArea(); - final int w = rect.width; - final int h = rect.height; - final double dx = (double) w / 2; - final double dy = (double) h / 2; - centerZoom(dx, dy, ZOOMIN_RATE, transform); - } - - /** - * Zoom out around the center of client Area. - */ - public void zoomOut() { - if (sourceImage == null) { - return; - } - final Rectangle rect = getClientArea(); - final int w = rect.width; - final int h = rect.height; - final double dx = (double) w / 2; - final double dy = (double) h / 2; - centerZoom(dx, dy, ZOOMOUT_RATE, transform); - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/.classpath b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/.classpath deleted file mode 100644 index af1317214a..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/.classpath +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/.gitignore b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/.gitignore deleted file mode 100644 index 08eb0a07a6..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/.gitignore +++ /dev/null @@ -1 +0,0 @@ -!bin/ \ No newline at end of file diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/.project b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/.project deleted file mode 100644 index 3af1edbb16..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/.project +++ /dev/null @@ -1,45 +0,0 @@ - - - org.erlide.wrangler.refactoring.duplicatedcode - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.m2e.core.maven2Nature - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - - - - 1621691323058 - - 30 - - org.eclipse.core.resources.regexFilterMatcher - node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ - - - - diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/.settings/org.eclipse.core.resources.prefs b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 99f26c0203..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -encoding/=UTF-8 diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/.settings/org.eclipse.jdt.core.prefs b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 590ab09f99..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,119 +0,0 @@ -eclipse.preferences.version=1 -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=enabled -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.nonnull.secondary= -org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault -org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary= -org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable -org.eclipse.jdt.core.compiler.annotation.nullable.secondary= -org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.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=warning -org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning -org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled -org.eclipse.jdt.core.compiler.problem.fieldHiding=warning -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=enabled -org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning -org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning -org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning -org.eclipse.jdt.core.compiler.problem.missingDefaultCase=warning -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.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=ignore -org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning -org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning -org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning -org.eclipse.jdt.core.compiler.problem.nullReference=error -org.eclipse.jdt.core.compiler.problem.nullSpecViolation=warning -org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning -org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning -org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning -org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning -org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning -org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning -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=warning -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=enabled -org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled -org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled -org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore -org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning -org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled -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.unlikelyCollectionMethodArgumentType=warning -org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled -org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info -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=warning -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.unusedExceptionParameter=ignore -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=ignore -org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.release=disabled -org.eclipse.jdt.core.compiler.source=1.8 diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/.settings/org.eclipse.jdt.ui.prefs b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/.settings/org.eclipse.jdt.ui.prefs deleted file mode 100644 index fc1e0b1985..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/.settings/org.eclipse.jdt.ui.prefs +++ /dev/null @@ -1,104 +0,0 @@ -cleanup.add_all=true -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=true -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=true -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.arrays_fill=true -cleanup.bitwise_conditional_expression=false -cleanup.boolean_literal=true -cleanup.break_loop=true -cleanup.collection_cloning=true -cleanup.comparison_statement=true -cleanup.convert_functional_interfaces=true -cleanup.convert_to_enhanced_for_loop=true -cleanup.convert_to_enhanced_for_loop_if_loop_var_used=false -cleanup.convert_to_switch_expressions=false -cleanup.correct_indentation=false -cleanup.double_negation=true -cleanup.else_if=true -cleanup.embedded_if=false -cleanup.evaluate_nullable=true -cleanup.format_source_code=true -cleanup.format_source_code_changes_only=false -cleanup.hash=true -cleanup.if_condition=true -cleanup.insert_inferred_type_arguments=false -cleanup.instanceof=false -cleanup.join=true -cleanup.lazy_logical_operator=true -cleanup.make_local_variable_final=true -cleanup.make_parameters_final=true -cleanup.make_private_fields_final=true -cleanup.make_type_abstract_if_missing_method=false -cleanup.make_variable_declarations_final=true -cleanup.map_cloning=true -cleanup.merge_conditional_blocks=false -cleanup.never_use_blocks=false -cleanup.never_use_parentheses_in_expressions=true -cleanup.no_string_creation=true -cleanup.no_super=true -cleanup.number_suffix=true -cleanup.objects_equals=true -cleanup.organize_imports=true -cleanup.overridden_assignment=true -cleanup.precompile_regex=true -cleanup.primitive_serialization=true -cleanup.pull_up_assignment=false -cleanup.push_down_negation=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.redundant_falling_through_block_end=true -cleanup.remove_private_constructors=true -cleanup.remove_redundant_modifiers=true -cleanup.remove_redundant_semicolons=true -cleanup.remove_redundant_type_arguments=true -cleanup.remove_trailing_whitespaces=true -cleanup.remove_trailing_whitespaces_all=true -cleanup.remove_trailing_whitespaces_ignore_empty=false -cleanup.remove_unnecessary_array_creation=true -cleanup.remove_unnecessary_casts=true -cleanup.remove_unnecessary_nls_tags=true -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.simplify_lambda_expression_and_method_ref=true -cleanup.sort_members=false -cleanup.sort_members_all=false -cleanup.strictly_equal_or_different=true -cleanup.stringbuilder=false -cleanup.switch=false -cleanup.ternary_operator=true -cleanup.try_with_resource=true -cleanup.use_anonymous_class_creation=false -cleanup.use_autoboxing=false -cleanup.use_blocks=true -cleanup.use_blocks_only_for_return_and_throw=false -cleanup.use_directly_map_method=true -cleanup.use_lambda=true -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.use_unboxing=false -cleanup.use_var=false -cleanup.useless_continue=true -cleanup.useless_return=true -cleanup_profile=_erlide -cleanup_settings_version=2 -eclipse.preferences.version=1 diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/.settings/org.eclipse.m2e.core.prefs b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index f897a7f1cb..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/META-INF/MANIFEST.MF b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/META-INF/MANIFEST.MF deleted file mode 100644 index 32e3cad197..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/META-INF/MANIFEST.MF +++ /dev/null @@ -1,25 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: Duplicated code detection fragment -Bundle-SymbolicName: org.erlide.wrangler.refactoring.duplicatedcode;singleton:=true -Bundle-Version: 0.11.0.qualifier -Bundle-Vendor: UKC -Fragment-Host: org.erlide.wrangler.refactoring;bundle-version="0.9" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 -Export-Package: org.erlide.wrangler.refactoring.core.exception, - org.erlide.wrangler.refactoring.duplicatedcode, - org.erlide.wrangler.refactoring.duplicatedcode.actions, - org.erlide.wrangler.refactoring.duplicatedcode.core, - org.erlide.wrangler.refactoring.duplicatedcode.ui, - org.erlide.wrangler.refactoring.duplicatedcode.ui.elements, - org.erlide.wrangler.refactoring.util -Import-Package: org.erlide.wrangler.refactoring.exception, - org.erlide.wrangler.refactoring.util, - org.eclipse.jdt.annotation;resolution:=optional -Require-Bundle: org.eclipse.ui, - org.eclipse.core.resources, - com.google.guava;bundle-version="[21.0.0,33.4.0)", - javax.inject;bundle-version="1.0.0", - org.eclipse.xtext.xbase.lib;bundle-version="2.19.0", - com.ericsson.otp.jinterface;bundle-version="1.8.0" -Automatic-Module-Name: org.erlide.wrangler.refactoring.duplicatedcode diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/build.properties b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/build.properties deleted file mode 100644 index 61db507c9c..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/build.properties +++ /dev/null @@ -1,11 +0,0 @@ -source.. = src/ -bin.includes = META-INF/,\ - .,\ - fragment.xml,\ - icons/,\ - wrangler/ -src.includes = wrangler/,\ - icons/ -javacDefaultEncoding.. = UTF-8 -javacProjectSettings = true -output.. = target/classes/ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/fragment.xml b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/fragment.xml deleted file mode 100644 index 65119c4636..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/fragment.xml +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

- - - - - - - - - - - - - diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/icons/codeSnippet.gif b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/icons/codeSnippet.gif deleted file mode 100644 index acc5fb603a..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/icons/codeSnippet.gif and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/icons/erlFile.gif b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/icons/erlFile.gif deleted file mode 100644 index 640e6952da..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/icons/erlFile.gif and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/icons/erlang.gif b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/icons/erlang.gif deleted file mode 100644 index 3fb608514e..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/icons/erlang.gif and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/icons/match.gif b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/icons/match.gif deleted file mode 100644 index 25c66a1838..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/icons/match.gif and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/icons/wrangler.gif b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/icons/wrangler.gif deleted file mode 100644 index cacb0c1dbe..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/icons/wrangler.gif and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/pom.xml b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/pom.xml deleted file mode 100644 index 65960ebc3d..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/pom.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - 4.0.0 - - org.erlide - org.erlide.wrangler.parent - 1.0.0 - ../.. - - - org.erlide.wrangler.refactoring.duplicatedcode - 0.11.0-SNAPSHOT - eclipse-plugin - diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/core/exception/WranglerRefactoringException.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/core/exception/WranglerRefactoringException.java deleted file mode 100644 index 88c58b3a74..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/core/exception/WranglerRefactoringException.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.core.exception; - -import org.erlide.wrangler.refactoring.exception.WranglerException; - -/** - * Exception for error handling in the integration - * - * @author Gyorgy Orosz - * - */ -public class WranglerRefactoringException extends WranglerException { - - /** - * Constructor - * - * @param message - * error message - */ - public WranglerRefactoringException(final String message) { - super(message); - - } - - /** - * - */ - private static final long serialVersionUID = -3593105842104036784L; - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/core/exception/WranglerWarningException.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/core/exception/WranglerWarningException.java deleted file mode 100644 index 1c3d28b07d..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/core/exception/WranglerWarningException.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.core.exception; - -import org.erlide.wrangler.refactoring.exception.WranglerException; - -/** - * Exception which is used to indicate a warning - * - * @author Gyorgy Orosz - * - */ -public class WranglerWarningException extends WranglerException { - - protected WranglerWarningException(final String message) { - super(message); - - } - - /** - * - */ - private static final long serialVersionUID = 1L; - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/DuplicatesUIManager.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/DuplicatesUIManager.java deleted file mode 100644 index 64f1a11337..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/DuplicatesUIManager.java +++ /dev/null @@ -1,94 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.duplicatedcode; - -import java.util.List; - -import org.eclipse.ui.IViewPart; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.PlatformUI; -import org.erlide.util.ErlLogger; -import org.erlide.wrangler.refactoring.duplicatedcode.ui.IDuplicatedCodeResultDisplayer; -import org.erlide.wrangler.refactoring.duplicatedcode.ui.elements.DuplicatedCodeElement; - -/** - * Manages the duplicates views visibility through static methods - * - * @author Gyorgy Orosz - * - */ -public class DuplicatesUIManager { - /** - * Duplicated view ID. - */ - public static final String duplicatedView = "org.erlide.wrangler.refactoring.duplicatedcode.views.DuplicatedCodeView"; - // private static List result; - private static IDuplicatedCodeResultDisplayer dupDisplayer; - - private DuplicatesUIManager() { - } - - /** - * Stores the view object - * - * @param displayer - * duplicates view - */ - public static void setDuplicatedCodeResultDisplayer( - final IDuplicatedCodeResultDisplayer displayer) { - DuplicatesUIManager.dupDisplayer = displayer; - } - - /** - * Sets the duplicates in the view. - * - * @param root - * list of the duplicates - */ - public static void setRefactoringResults(final List root) { - DuplicatesUIManager.dupDisplayer.showResult(root); - } - - /** - * Shows the duplicates view. - */ - public static void showDuplicatesView() { - final IWorkbench workbench = PlatformUI.getWorkbench(); - - final IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); - try { - - @SuppressWarnings("unused") - final IViewPart view = window.getActivePage() - .showView(DuplicatesUIManager.duplicatedView); - - } catch (final PartInitException e) { - ErlLogger.error(e); - } - } - - /** - * Hide the duplicates view. - */ - public static void closeDuplicatesView() { - final IWorkbench workbench = PlatformUI.getWorkbench(); - - final IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); - IViewPart view; - try { - view = window.getActivePage().showView(DuplicatesUIManager.duplicatedView); - window.getActivePage().hideView(view); - } catch (final PartInitException e) { - ErlLogger.error(e); - } - - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/actions/ClipboardAction.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/actions/ClipboardAction.java deleted file mode 100644 index 694f4099ac..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/actions/ClipboardAction.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.duplicatedcode.actions; - -import org.eclipse.jface.action.Action; -import org.eclipse.swt.dnd.Clipboard; -import org.eclipse.swt.dnd.TextTransfer; -import org.eclipse.swt.widgets.Display; - -/** - * Handles the 'copy to clipboard' action. - * - * @author Gyorgy Orosz - * - */ -public class ClipboardAction extends Action { - private final Display display; - private String text; - - /** - * Constructor - * - * @param display - * actual SWT display - */ - public ClipboardAction(final Display display) { - this.display = display; - } - - @Override - public void run() { - final Clipboard cb = new Clipboard(display); - final TextTransfer textTransfer = TextTransfer.getInstance(); - cb.setContents(new Object[] { text }, new TextTransfer[] { textTransfer }); - } - - @Override - public void setText(final String text) { - this.text = text; - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/core/AbstractDuplicatesParser.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/core/AbstractDuplicatesParser.java deleted file mode 100644 index 8e7c9f4513..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/core/AbstractDuplicatesParser.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.duplicatedcode.core; - -import java.util.List; - -import org.erlide.wrangler.refactoring.duplicatedcode.ui.elements.DuplicatedCodeElement; - -import com.ericsson.otp.erlang.OtpErlangObject; - -/** - * Abstract class for common functions used by duplicates parsers - * - * @author Gyorgy Orosz - * - */ -public abstract class AbstractDuplicatesParser implements IResultParser { - - protected String errorMessage; - protected boolean isSuccessful; - protected List duplicates; - - /** - * Constructor - * - * @param obj - * object to be parsed - */ - public AbstractDuplicatesParser(final OtpErlangObject obj) { - parse(obj); - } - - @Override - public List getDuplicates() { - return duplicates; - } - - @Override - public String getErrorMessage() { - return errorMessage; - } - - @Override - public boolean isSuccessful() { - return isSuccessful; - } - - protected void setUnSuccessful(final String errorMessage) { - isSuccessful = false; - this.errorMessage = errorMessage; - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/core/AbstractDuplicatesSearcherAction.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/core/AbstractDuplicatesSearcherAction.java deleted file mode 100644 index fb58bb16e1..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/core/AbstractDuplicatesSearcherAction.java +++ /dev/null @@ -1,112 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.duplicatedcode.core; - -import java.io.IOException; -import java.util.List; - -import org.eclipse.core.commands.AbstractHandler; -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.ui.PlatformUI; -import org.erlide.wrangler.refactoring.core.exception.WranglerWarningException; -import org.erlide.wrangler.refactoring.duplicatedcode.DuplicatesUIManager; -import org.erlide.wrangler.refactoring.duplicatedcode.ui.elements.DuplicatedCodeElement; -import org.erlide.wrangler.refactoring.exception.WranglerRpcParsingException; -import org.erlide.wrangler.refactoring.util.GlobalParameters; - -/** - * Abstract class, which has common methods for running a duplicated search refactoring - * - * @author Gyorgy Orosz - * - */ -public abstract class AbstractDuplicatesSearcherAction extends AbstractHandler { - - @Override - public Object execute(final ExecutionEvent event) throws ExecutionException { - run(); - return null; - } - - protected final String rpcErrorMsg = "An error occured during the refactoring!"; - - /** - * Runs the refactoring. - */ - public void run() { - // TODO: run it in a new thread - selectionChanged(); - if (getUserInput()) { - final IProgressMonitor monitor = new NullProgressMonitor(); - try { - IResultParser result; - monitor.beginTask("Detecting..", 0); - - result = callRefactoring(); - if (result.isSuccessful()) { - showDuplicatesView(); - addDuplicates(result.getDuplicates()); - } else { - DuplicatesUIManager.closeDuplicatesView(); - displayErrorNotification(result.getErrorMessage()); - } - } catch (final WranglerWarningException e) { - - } catch (final WranglerRpcParsingException e) { - displayErrorNotification(rpcErrorMsg); - } catch (final CoreException e) { - displayErrorNotification(rpcErrorMsg); - } catch (final IOException e) { - displayErrorNotification(rpcErrorMsg); - } finally { - monitor.done(); - } - } - - } - - protected abstract boolean getUserInput(); - - protected void addDuplicates(final List duplicatedCode) { - DuplicatesUIManager.setRefactoringResults(duplicatedCode); - } - - protected abstract IResultParser callRefactoring() throws WranglerRpcParsingException, - CoreException, IOException, WranglerWarningException; - - /** - * Handles the event when a selectino is changed in the workbench - */ - public void selectionChanged() { - GlobalParameters.setEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow() - .getActivePage().getActiveEditor()); - } - - /* - * public void setActiveEditor(IAction action, IEditorPart targetEditor) { - * GlobalParameters.setEditor(targetEditor); } - */ - - void displayErrorNotification(final String errorMsg) { - MessageDialog.openError( - PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), - "Refactoring error", errorMsg); - - } - - void showDuplicatesView() { - DuplicatesUIManager.showDuplicatesView(); - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/core/DuplicateDetectionAction.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/core/DuplicateDetectionAction.java deleted file mode 100644 index 9f176665bf..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/core/DuplicateDetectionAction.java +++ /dev/null @@ -1,139 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.duplicatedcode.core; - -import java.io.IOException; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.FileLocator; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Platform; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.PlatformUI; -import org.erlide.runtime.rpc.RpcResult; -import org.erlide.util.ErlLogger; -import org.erlide.wrangler.refactoring.backend.internal.WranglerBackendManager; -import org.erlide.wrangler.refactoring.backend.internal.WranglerRefactoringBackend; -import org.erlide.wrangler.refactoring.core.exception.WranglerWarningException; -import org.erlide.wrangler.refactoring.duplicatedcode.ui.DuplicateCodeDetectionInputDialog; -import org.erlide.wrangler.refactoring.exception.WranglerRpcParsingException; -import org.erlide.wrangler.refactoring.selection.IErlMemberSelection; -import org.erlide.wrangler.refactoring.util.GlobalParameters; -import org.osgi.framework.Bundle; - -import com.ericsson.otp.erlang.OtpErlangList; -import com.ericsson.otp.erlang.OtpErlangString; - -/** - * Idenctical code detection refactoring runner - * - * @author Gyorgy Orosz - * - */ -public class DuplicateDetectionAction extends AbstractDuplicatesSearcherAction { - - protected boolean onlyInfile; - protected int minToks; - protected int minClones; - - @SuppressWarnings("boxing") - @Override - protected IResultParser callRefactoring() throws WranglerRpcParsingException, - CoreException, IOException, WranglerWarningException { - String functionName; - RpcResult result; - - // getting the path of the fragment - - final String suffixPath = getSuffixPath(); - ErlLogger.debug("Suffix binary at: " + suffixPath); - final WranglerRefactoringBackend backend = WranglerBackendManager - .getRefactoringBackend(); - final IErlMemberSelection sel = (IErlMemberSelection) GlobalParameters - .getWranglerSelection(); - - if (onlyInfile) { - functionName = "duplicated_code_eclipse"; - final OtpErlangString fp = new OtpErlangString(sel.getFilePath()); - final OtpErlangString[] fpa = new OtpErlangString[1]; - fpa[0] = fp; - final OtpErlangList fpl = new OtpErlangList(fpa); - - result = backend.callWithoutParser( - WranglerRefactoringBackend.UNLIMITED_TIMEOUT, functionName, "xiiis", - fpl, minToks, minClones, GlobalParameters.getTabWidth(), suffixPath); - } else { - functionName = "duplicated_code_eclipse"; - result = backend.callWithoutParser( - WranglerRefactoringBackend.UNLIMITED_TIMEOUT, functionName, "xiiis", - sel.getSearchPath(), minToks, minClones, - GlobalParameters.getTabWidth(), suffixPath); - } - - if (!result.isOk()) { - throw new WranglerRpcParsingException("Rpc error"); - } - return new DuplicateDetectionParser(result.getValue()); - } - - private String getSuffixPath() throws IOException { - final Bundle[] bs = Platform.getFragments( - Platform.getBundle(org.erlide.wrangler.refactoring.Activator.PLUGIN_ID)); - if (bs.length < 1) { - ErlLogger.warn("Fragment is not loaded?! No C binary is run."); - return ""; - } - Bundle fragment = null; - for (final Bundle b : bs) { - if ("org.erlide.wrangler.refactoring.duplicatedcode" - .equals(b.getSymbolicName())) { - fragment = b; - break; - } - } - java.net.URL url = FileLocator.find(fragment, new Path(""), null); - url = FileLocator.resolve(url); - IPath path = new Path(url.getPath()); - path = path.append("wrangler"); - path = path.append("bin"); - - final String os = Platform.getOS(); - if (os.equals(Platform.OS_LINUX)) { - path = path.append("linux"); - path = path.append("suffixtree"); - } else if (os.equals(Platform.OS_WIN32)) { - path = path.append("win32"); - path = path.append("suffixtree.exe"); - } else if (os.equals(Platform.OS_MACOSX)) { - path = path.append("macosx"); - path = path.append("suffixtree"); - } else { - ErlLogger.debug("Not supported OS found, no C binary is used."); - return ""; - } - - return path.toOSString(); - } - - @Override - protected boolean getUserInput() { - final Shell shell = PlatformUI.getWorkbench().getDisplay().getActiveShell(); - - final DuplicateCodeDetectionInputDialog inputd = new DuplicateCodeDetectionInputDialog( - shell, "Identical code detection..."); - inputd.open(); - - onlyInfile = inputd.onlyInFile(); - minToks = inputd.getMinToks(); - minClones = inputd.getMinClones(); - - return inputd.isFinished(); - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/core/DuplicateDetectionParser.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/core/DuplicateDetectionParser.java deleted file mode 100644 index c81bb94333..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/core/DuplicateDetectionParser.java +++ /dev/null @@ -1,149 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.duplicatedcode.core; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.resources.IFile; -import org.erlide.wrangler.refactoring.duplicatedcode.ui.elements.DuplicatedCodeElement; -import org.erlide.wrangler.refactoring.duplicatedcode.ui.elements.DuplicatedCodeInstanceElement; -import org.erlide.wrangler.refactoring.duplicatedcode.ui.elements.DuplicatedFileElement; -import org.erlide.wrangler.refactoring.util.WranglerUtils; - -import com.ericsson.otp.erlang.OtpErlangList; -import com.ericsson.otp.erlang.OtpErlangLong; -import com.ericsson.otp.erlang.OtpErlangObject; -import com.ericsson.otp.erlang.OtpErlangRangeException; -import com.ericsson.otp.erlang.OtpErlangString; -import com.ericsson.otp.erlang.OtpErlangTuple; - -/** - * Parser class for Identical expression search refactorings - * - * @author Gyorgy Orosz - * - */ -public class DuplicateDetectionParser extends AbstractDuplicatesParser { - - private final String emptyErrorMessage = "No expression found!"; - - /** - * Constructor - * - * @param obj - * object to be parsed - */ - public DuplicateDetectionParser(final OtpErlangObject obj) { - super(obj); - } - - // [{ [{ {filename(), integer(), integer()} , {filename(), integer(), - // integer()} }], integer(), integer(), string()}] - @Override - public void parse(final OtpErlangObject object) { - try { - // TODO testing all cases - if (object instanceof OtpErlangTuple) { - final OtpErlangTuple objectTuple = (OtpErlangTuple) object; - setUnSuccessful( - ((OtpErlangString) objectTuple.elementAt(1)).stringValue()); - - } else { - final OtpErlangList resultList = (OtpErlangList) object; - if (resultList.arity() == 0) { - setUnSuccessful(emptyErrorMessage); - return; - } - - duplicates = new ArrayList<>(); - for (int i = 0; i < resultList.arity(); ++i) { - duplicates.add(parseDuplicates(resultList.elementAt(i))); - } - isSuccessful = true; - } - } catch (final Exception e) { - setUnSuccessful(e.getMessage()); - } - - } - - // { [{ {filename(), integer(), integer()} , {filename(), integer(), - // integer()} }], integer(), integer(), string()} - protected DuplicatedCodeElement parseDuplicates(final OtpErlangObject object) - throws OtpErlangRangeException { - final OtpErlangTuple listElementTuple = (OtpErlangTuple) object; - final OtpErlangList duplicateCodeList = (OtpErlangList) listElementTuple - .elementAt(0); - final Map> values = new LinkedHashMap<>(); - - final OtpErlangString suggestion = (OtpErlangString) listElementTuple - .elementAt(3); - final String suggStr = suggestion.stringValue(); - - final OtpErlangObject[] elements = duplicateCodeList.elements(); - - for (final OtpErlangObject element : elements) { - OtpErlangTuple elementPair = (OtpErlangTuple) element; - - String replicationFunction = ""; - final OtpErlangTuple checkable = (OtpErlangTuple) elementPair.elementAt(0); - if (checkable.elementAt(0) instanceof OtpErlangTuple) { - final OtpErlangString repFunStr = (OtpErlangString) elementPair - .elementAt(1); - replicationFunction = repFunStr.stringValue(); - elementPair = checkable; - - } - final OtpErlangTuple firstElement = (OtpErlangTuple) elementPair.elementAt(0); - final OtpErlangTuple secondElement = (OtpErlangTuple) elementPair - .elementAt(1); - final OtpErlangString fileName = (OtpErlangString) firstElement.elementAt(0); - final OtpErlangLong startLine = (OtpErlangLong) firstElement.elementAt(1); - final OtpErlangLong startCol = (OtpErlangLong) firstElement.elementAt(2); - final OtpErlangLong endLine = (OtpErlangLong) secondElement.elementAt(1); - final OtpErlangLong endCol = (OtpErlangLong) secondElement.elementAt(2); - - final String fileNameStr = fileName.stringValue(); - final IFile file = WranglerUtils.getFileFromPath(fileNameStr); - final DuplicatedCodeInstanceElement instance = new DuplicatedCodeInstanceElement( - file, startLine.intValue(), startCol.intValue(), endLine.intValue(), - endCol.intValue() + 1); - instance.setSuggestedCode(suggStr); - instance.setReplicationFunction(replicationFunction); - if (values.containsKey(file)) { - values.get(file).add(instance); - } else { - final List dupList = new ArrayList<>(); - dupList.add(instance); - values.put(file, dupList); - } - } - - final DuplicatedCodeElement result = new DuplicatedCodeElement( - values.entrySet().iterator().next().getValue().get(0)); - result.setSuggestedCode(suggStr); - - for (final Map.Entry> entry : values - .entrySet()) { - final DuplicatedFileElement dupFile = new DuplicatedFileElement( - entry.getKey()); - dupFile.setSuggestedCode(suggStr); - for (final DuplicatedCodeInstanceElement instance : entry.getValue()) { - dupFile.addChild(instance); - } - - result.addChild(dupFile); - } - - return result; - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/core/ExpressionSearchAction.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/core/ExpressionSearchAction.java deleted file mode 100644 index 87ca3dca34..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/core/ExpressionSearchAction.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.duplicatedcode.core; - -import org.erlide.runtime.rpc.RpcResult; -import org.erlide.wrangler.refactoring.backend.internal.WranglerBackendManager; -import org.erlide.wrangler.refactoring.backend.internal.WranglerRefactoringBackend; -import org.erlide.wrangler.refactoring.exception.WranglerRpcParsingException; -import org.erlide.wrangler.refactoring.selection.IErlMemberSelection; -import org.erlide.wrangler.refactoring.util.GlobalParameters; - -/** - * Expression search refactoring runner - * - * @author Gyorgy Orosz - * - */ -public class ExpressionSearchAction extends AbstractDuplicatesSearcherAction { - - @Override - protected IResultParser callRefactoring() throws WranglerRpcParsingException { - final IErlMemberSelection sel = (IErlMemberSelection) GlobalParameters - .getWranglerSelection(); - final WranglerRefactoringBackend backend = WranglerBackendManager - .getRefactoringBackend(); - final RpcResult result = backend.callWithoutParser( - WranglerRefactoringBackend.UNLIMITED_TIMEOUT, "expr_search_eclipse", - "sxxi", sel.getFilePath(), sel.getSelectionRange().getStartPos(), - sel.getSelectionRange().getEndPos(), GlobalParameters.getTabWidth()); - if (result.isOk()) { - return new ExpressionSearchParser(result.getValue()); - } - throw new WranglerRpcParsingException("RPC error"); - } - - @Override - protected boolean getUserInput() { - return true; - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/core/ExpressionSearchParser.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/core/ExpressionSearchParser.java deleted file mode 100644 index 7703e6e36c..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/core/ExpressionSearchParser.java +++ /dev/null @@ -1,104 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.duplicatedcode.core; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.erlide.wrangler.refactoring.duplicatedcode.ui.elements.DuplicatedCodeElement; -import org.erlide.wrangler.refactoring.duplicatedcode.ui.elements.DuplicatedCodeInstanceElement; -import org.erlide.wrangler.refactoring.selection.IErlSelection; -import org.erlide.wrangler.refactoring.util.GlobalParameters; - -import com.ericsson.otp.erlang.OtpErlangList; -import com.ericsson.otp.erlang.OtpErlangLong; -import com.ericsson.otp.erlang.OtpErlangObject; -import com.ericsson.otp.erlang.OtpErlangString; -import com.ericsson.otp.erlang.OtpErlangTuple; - -/** - * Parser class for expression search refactoring - * - * @author Gyorgy Orosz - * - */ -public class ExpressionSearchParser extends AbstractDuplicatesParser { - - /** - * Constructor - * - * @param obj - * object to be parsed - */ - public ExpressionSearchParser(final OtpErlangObject obj) { - super(obj); - } - - @Override - public void parse(final OtpErlangObject object) { - try { - final OtpErlangTuple res = (OtpErlangTuple) object; - - if (!"ok".equals(res.elementAt(0).toString())) { - setUnSuccessful(((OtpErlangString) res.elementAt(1)).stringValue()); - return; - } - if (res.elementAt(1).equals(new OtpErlangList())) { - setUnSuccessful("No more instances found!"); - return; - } - - final OtpErlangList posList = (OtpErlangList) res.elementAt(1); - OtpErlangTuple actPos; - OtpErlangLong startLine; - OtpErlangLong startColumn; - OtpErlangLong endLine; - OtpErlangLong endColumn; - - final List instances = new ArrayList<>(); - - for (final OtpErlangObject aPosList : posList) { - actPos = (OtpErlangTuple) aPosList; - startLine = (OtpErlangLong) ((OtpErlangTuple) actPos.elementAt(0)) - .elementAt(0); - startColumn = (OtpErlangLong) ((OtpErlangTuple) actPos.elementAt(0)) - .elementAt(1); - endLine = (OtpErlangLong) ((OtpErlangTuple) actPos.elementAt(1)) - .elementAt(0); - endColumn = (OtpErlangLong) ((OtpErlangTuple) actPos.elementAt(1)) - .elementAt(1); - - final IErlSelection sel = GlobalParameters.getWranglerSelection(); - instances.add(new DuplicatedCodeInstanceElement( - (IFile) sel.getErlElement().getResource(), startLine.intValue(), - startColumn.intValue(), endLine.intValue(), - endColumn.intValue() + 1)); - } - - final DuplicatedCodeInstanceElement defaultInstance = instances.get(0); - - final DuplicatedCodeElement result = new DuplicatedCodeElement( - defaultInstance); - - for (final DuplicatedCodeInstanceElement instance : instances) { - result.addChild(instance); - } - - isSuccessful = true; - errorMessage = null; - duplicates = new ArrayList<>(); - duplicates.add(result); - - } catch (final Exception e) { - setUnSuccessful(e.getMessage()); - } - - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/core/IResultParser.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/core/IResultParser.java deleted file mode 100644 index 49fcce52c7..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/core/IResultParser.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.duplicatedcode.core; - -import java.util.List; - -import org.erlide.wrangler.refactoring.duplicatedcode.ui.elements.DuplicatedCodeElement; - -import com.ericsson.otp.erlang.OtpErlangObject; - -/** - * Interface for parsing duplicated RPC messages from Wrangler. - * - * @author Gyorgy Orosz - * - */ -public interface IResultParser { - /** - * Indicates whether the RPC was successful - * - * @return true if RPC is successful - */ - boolean isSuccessful(); - - /** - * Gets the error message if there's any. - * - * @return error message string - */ - String getErrorMessage(); - - /** - * Parses the RPC - * - * @param object - * rpc result - */ - void parse(OtpErlangObject object); - - /** - * Returns with the duplicates - * - * @return list of duplicates - */ - List getDuplicates(); -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/core/SimilarDetectionAction.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/core/SimilarDetectionAction.java deleted file mode 100644 index 7cea4b69a4..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/core/SimilarDetectionAction.java +++ /dev/null @@ -1,97 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.duplicatedcode.core; - -import java.io.IOException; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.PlatformUI; -import org.erlide.runtime.rpc.RpcResult; -import org.erlide.wrangler.refactoring.backend.internal.WranglerBackendManager; -import org.erlide.wrangler.refactoring.backend.internal.WranglerRefactoringBackend; -import org.erlide.wrangler.refactoring.core.exception.WranglerWarningException; -import org.erlide.wrangler.refactoring.duplicatedcode.ui.SimilarCodeDetectionInputDialog; -import org.erlide.wrangler.refactoring.exception.WranglerRpcParsingException; -import org.erlide.wrangler.refactoring.selection.IErlMemberSelection; -import org.erlide.wrangler.refactoring.util.GlobalParameters; - -import com.ericsson.otp.erlang.OtpErlangList; -import com.ericsson.otp.erlang.OtpErlangString; - -/** - * Similar code detection refactoring runner - * - * @author Gyorgy Orosz - * - */ -public class SimilarDetectionAction extends AbstractDuplicatesSearcherAction { - - int minLen; - int minFreq; - int minToks; - int maxNewVars; - double simScore; - boolean onlyInFile; - - @Override - protected IResultParser callRefactoring() throws WranglerRpcParsingException, - CoreException, IOException, WranglerWarningException { - final WranglerRefactoringBackend backend = WranglerBackendManager - .getRefactoringBackend(); - final IErlMemberSelection sel = (IErlMemberSelection) GlobalParameters - .getWranglerSelection(); - - RpcResult result; - final String functionName = "sim_code_detection_eclipse"; - if (onlyInFile) { - - final OtpErlangString fp = new OtpErlangString(sel.getFilePath()); - final OtpErlangString[] fpa = new OtpErlangString[1]; - fpa[0] = fp; - final OtpErlangList fpl = new OtpErlangList(fpa); - - result = backend.callWithoutParser( - WranglerRefactoringBackend.UNLIMITED_TIMEOUT, functionName, - "xiiiidxi", fpl, minLen, minToks, minFreq, maxNewVars, simScore, - sel.getSearchPath(), GlobalParameters.getTabWidth()); - } else { - result = backend.callWithoutParser( - WranglerRefactoringBackend.UNLIMITED_TIMEOUT, functionName, - "xiiiidxi", sel.getSearchPath(), minLen, minToks, minFreq, maxNewVars, - simScore, sel.getSearchPath(), GlobalParameters.getTabWidth()); - } - - if (!result.isOk()) { - throw new WranglerRpcParsingException("Rpc error"); - } - return new DuplicateDetectionParser(result.getValue()); - - } - - @Override - protected boolean getUserInput() { - final Shell shell = PlatformUI.getWorkbench().getDisplay().getActiveShell(); - - final SimilarCodeDetectionInputDialog inputd = new SimilarCodeDetectionInputDialog( - shell, "Similar code detection..."); - - inputd.open(); - - simScore = inputd.getSimScore(); - minFreq = inputd.getMinFreq(); - minLen = inputd.getMinLen(); - onlyInFile = inputd.onlyinFile(); - maxNewVars = inputd.getMaxNewVars(); - minToks = inputd.getMinToks(); - - return inputd.isFinished(); - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/core/SimilarExpressionSearchParser.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/core/SimilarExpressionSearchParser.java deleted file mode 100644 index fc797e9a67..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/core/SimilarExpressionSearchParser.java +++ /dev/null @@ -1,141 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.duplicatedcode.core; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.resources.IFile; -import org.erlide.wrangler.refactoring.duplicatedcode.ui.elements.DuplicatedCodeElement; -import org.erlide.wrangler.refactoring.duplicatedcode.ui.elements.DuplicatedCodeInstanceElement; -import org.erlide.wrangler.refactoring.duplicatedcode.ui.elements.DuplicatedFileElement; -import org.erlide.wrangler.refactoring.util.WranglerUtils; - -import com.ericsson.otp.erlang.OtpErlangList; -import com.ericsson.otp.erlang.OtpErlangLong; -import com.ericsson.otp.erlang.OtpErlangObject; -import com.ericsson.otp.erlang.OtpErlangRangeException; -import com.ericsson.otp.erlang.OtpErlangString; -import com.ericsson.otp.erlang.OtpErlangTuple; - -/** - * Parser for RPc messages which is sent by similar expresiion search refactoring - * - * @author Gyorgy Orosz - * - */ -public class SimilarExpressionSearchParser extends AbstractDuplicatesParser { - - /** - * Constructor - * - * @param obj - * object to be parsed - */ - public SimilarExpressionSearchParser(final OtpErlangObject obj) { - super(obj); - } - - /* - * Parse Wrangler messages which are in the following format: {ok, {[{{filename, - * startLine, startCol},{filePath, endLine, endCol}}], generalisation} - * - * @see org.erlide.wrangler.refactoring.duplicatedcode.core.IResultParser#parse - * (com.ericsson.otp.erlang.OtpErlangObject) - */ - @Override - public void parse(final OtpErlangObject object) { - try { - final OtpErlangTuple res = (OtpErlangTuple) object; - if (!"ok".equals(res.elementAt(0).toString())) { - setUnSuccessful(((OtpErlangString) res.elementAt(1)).stringValue()); - return; - } - - final OtpErlangTuple result = (OtpErlangTuple) res.elementAt(1); - - if (result.elementAt(0).equals(new OtpErlangList())) { - setUnSuccessful("No more instances found!"); - return; - } - - final DuplicatedCodeElement dup = parseDuplicates(result); - duplicates = new ArrayList<>(); - duplicates.add(dup); - isSuccessful = true; - errorMessage = null; - } catch (final Exception e) { - setUnSuccessful(e.getMessage()); - } - - } - - // { [{ {filename(), integer(), integer()} , {filename(), integer(), - // integer()} }], integer(), integer(), string()} - protected DuplicatedCodeElement parseDuplicates(final OtpErlangObject object) - throws OtpErlangRangeException { - final OtpErlangTuple listElementTuple = (OtpErlangTuple) object; - final OtpErlangList duplicateCodeList = (OtpErlangList) listElementTuple - .elementAt(0); - final Map> values = new LinkedHashMap<>(); - - final OtpErlangString suggestion = (OtpErlangString) listElementTuple - .elementAt(1); - final String suggStr = suggestion.stringValue(); - - final OtpErlangObject[] elements = duplicateCodeList.elements(); - - for (final OtpErlangObject element : elements) { - final OtpErlangTuple elementPair = (OtpErlangTuple) element; - final OtpErlangTuple firstElement = (OtpErlangTuple) elementPair.elementAt(0); - final OtpErlangTuple secondElement = (OtpErlangTuple) elementPair - .elementAt(1); - final OtpErlangString fileName = (OtpErlangString) firstElement.elementAt(0); - final OtpErlangLong startLine = (OtpErlangLong) firstElement.elementAt(1); - final OtpErlangLong startCol = (OtpErlangLong) firstElement.elementAt(2); - final OtpErlangLong endLine = (OtpErlangLong) secondElement.elementAt(1); - final OtpErlangLong endCol = (OtpErlangLong) secondElement.elementAt(2); - - final String fileNameStr = fileName.stringValue(); - final IFile file = WranglerUtils.getFileFromPath(fileNameStr); - final DuplicatedCodeInstanceElement instance = new DuplicatedCodeInstanceElement( - file, startLine.intValue(), startCol.intValue(), endLine.intValue(), - endCol.intValue() + 1); - instance.setSuggestedCode(suggStr); - if (values.containsKey(file)) { - values.get(file).add(instance); - } else { - final List dupList = new ArrayList<>(); - dupList.add(instance); - values.put(file, dupList); - } - } - - final DuplicatedCodeElement result = new DuplicatedCodeElement( - values.entrySet().iterator().next().getValue().get(0)); - result.setSuggestedCode(suggStr); - - for (final Map.Entry> entry : values - .entrySet()) { - final DuplicatedFileElement dupFile = new DuplicatedFileElement( - entry.getKey()); - dupFile.setSuggestedCode(suggStr); - for (final DuplicatedCodeInstanceElement instance : entry.getValue()) { - dupFile.addChild(instance); - } - - result.addChild(dupFile); - } - - return result; - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/core/SimilarSearchAction.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/core/SimilarSearchAction.java deleted file mode 100644 index 1fc4d7d2ed..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/core/SimilarSearchAction.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.duplicatedcode.core; - -import java.io.IOException; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.PlatformUI; -import org.erlide.runtime.rpc.RpcResult; -import org.erlide.wrangler.refactoring.backend.internal.WranglerBackendManager; -import org.erlide.wrangler.refactoring.backend.internal.WranglerRefactoringBackend; -import org.erlide.wrangler.refactoring.core.exception.WranglerWarningException; -import org.erlide.wrangler.refactoring.duplicatedcode.ui.SimilarSearchInputDialog; -import org.erlide.wrangler.refactoring.exception.WranglerRpcParsingException; -import org.erlide.wrangler.refactoring.selection.IErlMemberSelection; -import org.erlide.wrangler.refactoring.util.GlobalParameters; - -import com.ericsson.otp.erlang.OtpErlangFloat; - -/** - * Parses the result of an rpc between Wrangler and erlide, which about finding similar - * expressions. - * - * @author György Orosz - * - */ -public class SimilarSearchAction extends AbstractDuplicatesSearcherAction { - - private float simScore; - boolean onlyInFile = true; - - @Override - protected IResultParser callRefactoring() throws WranglerRpcParsingException, - CoreException, IOException, WranglerWarningException { - - final IErlMemberSelection sel = (IErlMemberSelection) GlobalParameters - .getWranglerSelection(); - final WranglerRefactoringBackend backend = WranglerBackendManager - .getRefactoringBackend(); - RpcResult result; - String functionName; - if (onlyInFile) { - functionName = "simi_expr_search_in_buffer_eclipse"; - } else { - functionName = "simi_expr_search_in_dirs_eclipse"; - } - result = backend.callWithoutParser(WranglerRefactoringBackend.UNLIMITED_TIMEOUT, - functionName, "sxxxxi", sel.getFilePath(), - sel.getSelectionRange().getStartPos(), - sel.getSelectionRange().getEndPos(), new OtpErlangFloat(simScore), - sel.getSearchPath(), GlobalParameters.getTabWidth()); - - if (result.isOk()) { - return new SimilarExpressionSearchParser(result.getValue()); - } - throw new WranglerRpcParsingException("RPC error"); - } - - @Override - protected boolean getUserInput() { - final Shell shell = PlatformUI.getWorkbench().getDisplay().getActiveShell(); - - final SimilarSearchInputDialog inputd = new SimilarSearchInputDialog(shell, - "Search for similar expressions..."); - inputd.open(); - simScore = (float) inputd.getSimScore(); - onlyInFile = inputd.onlyinFile(); - return inputd.isFinished(); - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/ui/DoubleClickListener.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/ui/DoubleClickListener.java deleted file mode 100644 index 1b12d76745..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/ui/DoubleClickListener.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * - */ -package org.erlide.wrangler.refactoring.duplicatedcode.ui; - -import org.eclipse.jface.viewers.DoubleClickEvent; -import org.eclipse.jface.viewers.IDoubleClickListener; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.texteditor.ITextEditor; -import org.erlide.wrangler.refactoring.duplicatedcode.ui.elements.DuplicatedCodeElement; -import org.erlide.wrangler.refactoring.duplicatedcode.ui.elements.DuplicatedCodeInstanceElement; -import org.erlide.wrangler.refactoring.duplicatedcode.ui.elements.DuplicatedFileElement; -import org.erlide.wrangler.refactoring.util.WranglerUtils; - -class DoubleClickListener implements IDoubleClickListener { - - DoubleClickListener() { - - } - - @Override - public void doubleClick(final DoubleClickEvent event) { - final ISelection selection = event.getSelection(); - - final Object obj = ((IStructuredSelection) selection).getFirstElement(); - - if (obj instanceof DuplicatedCodeInstanceElement) { - higlightCodePart((DuplicatedCodeInstanceElement) obj); - } else if (obj instanceof DuplicatedCodeElement) { - higlightCodePart(((DuplicatedCodeElement) obj).getCodePart()); - } else if (obj instanceof DuplicatedFileElement) { - final DuplicatedFileElement obj2 = (DuplicatedFileElement) obj; - WranglerUtils.openFile(obj2.getContainingFile()); - } - - } - - public void higlightCodePart(final DuplicatedCodeInstanceElement codePart) { - final ITextEditor textEditor = (ITextEditor) WranglerUtils - .openFile(codePart.getContainingFile()); - WranglerUtils.highlightOffsetSelection(codePart.getStartOffset(), - codePart.getEndOffset(), textEditor); - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/ui/DuplicateCodeDetectionInputDialog.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/ui/DuplicateCodeDetectionInputDialog.java deleted file mode 100644 index 7909f02639..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/ui/DuplicateCodeDetectionInputDialog.java +++ /dev/null @@ -1,180 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.duplicatedcode.ui; - -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -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.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; -import org.erlide.wrangler.refactoring.ui.AbstractInputDialog; - -/** - * Input dialog for getting necessary input for duplicated code detection refactoring - * - * @author Gyorgy Orosz - * - */ -public class DuplicateCodeDetectionInputDialog extends AbstractInputDialog { - - private int minToks; - - private int minClones; - - private boolean workOnlyInCurrentFile; - - private Text minToksText; - - private Text minClonesText; - - private Button onlyInFileCheckBoxButton; - - /** - * Constructor - * - * @param parentShell - * SWT shell - * @param dialogTitle - * dialog title - */ - public DuplicateCodeDetectionInputDialog(final Shell parentShell, - final String dialogTitle) { - super(parentShell, dialogTitle); - } - - /** - * Gets the value of minimal tokens - * - * @return number of minimal tokens - */ - public int getMinToks() { - return minToks; - } - - /** - * Gets the value of minimal clone numbers - * - * @return minimal clones number - */ - public int getMinClones() { - return minClones; - } - - /** - * Gets the value of the 'run only in the current module' checkbox - * - * @return true, if the refactoring will be run in only the current module - */ - public boolean onlyInFile() { - return workOnlyInCurrentFile; - } - - /* - * @Override protected void buttonPressed(int buttonId) { - * super.buttonPressed(buttonId); } - */ - - @Override - protected void createButtonsForButtonBar(final Composite parent) { - super.createButtonsForButtonBar(parent); - - minToksText.setFocus(); - minToksText.setText(""); - minToksText.selectAll(); - - } - - @Override - protected Control createDialogArea(final Composite parent) { - // create composite - final Composite composite = (Composite) super.createDialogArea(parent); - // create message - - final Label minTokslabel = new Label(composite, SWT.WRAP); - minTokslabel.setText("Minimal numbers of tokens a code clone should have:"); - final GridData minToksData = new GridData(GridData.GRAB_HORIZONTAL - | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL - | GridData.VERTICAL_ALIGN_CENTER); - minToksData.widthHint = convertHorizontalDLUsToPixels( - IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); - minTokslabel.setLayoutData(minToksData); - minTokslabel.setFont(parent.getFont()); - - minToksText = new Text(composite, getInputTextStyle()); - minToksText.setLayoutData( - new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); - minToksText.setText("20"); - minToksText.addModifyListener(e -> validateInput()); - - final Label minClonesLabel = new Label(composite, SWT.WRAP); - minClonesLabel.setText("Minimum number of appearance times:"); - final GridData minClonesData = new GridData( // GridData.GRAB_HORIZONTAL - // | - GridData.GRAB_VERTICAL // | GridData.HORIZONTAL_ALIGN_FILL - | GridData.VERTICAL_ALIGN_CENTER); - minClonesData.widthHint = convertHorizontalDLUsToPixels( - IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); - minClonesLabel.setLayoutData(minClonesData); - minClonesLabel.setFont(parent.getFont()); - minClonesText = new Text(composite, getInputTextStyle()); - minClonesText.setLayoutData( - new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); - minClonesText.setText("2"); - minClonesText.addModifyListener(e -> validateInput()); - - onlyInFileCheckBoxButton = new Button(composite, SWT.CHECK); - onlyInFileCheckBoxButton.setText("Detect duplicates in the project"); - onlyInFileCheckBoxButton.setLayoutData( - new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); - onlyInFileCheckBoxButton.addSelectionListener(new SelectionListener() { - - @Override - public void widgetDefaultSelected(final SelectionEvent e) { - } - - @Override - public void widgetSelected(final SelectionEvent e) { - validateInput(); - - } - - }); - errorMessageText = new Text(composite, SWT.READ_ONLY | SWT.WRAP); - errorMessageText.setLayoutData( - new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); - errorMessageText.setBackground(errorMessageText.getDisplay() - .getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); - - setErrorMessage("Please use only integers!"); - - applyDialogFont(composite); - return composite; - } - - @Override - protected void validateInput() { - String errorMsg = null; - try { - workOnlyInCurrentFile = !onlyInFileCheckBoxButton.getSelection(); - minToks = Integer.parseInt(minToksText.getText()); - minClones = Integer.parseInt(minClonesText.getText()); - setErrorMessage(null); - } catch (final Exception e) { - errorMsg = "Minimal number of clones and tokens should be integers."; - setErrorMessage(errorMsg); - } - - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/ui/DuplicatesView.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/ui/DuplicatesView.java deleted file mode 100644 index e27711fc99..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/ui/DuplicatesView.java +++ /dev/null @@ -1,200 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.duplicatedcode.ui; - -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.TreeSelection; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.ISelectionListener; -import org.eclipse.ui.ISharedImages; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.part.ViewPart; -import org.erlide.wrangler.refactoring.duplicatedcode.actions.ClipboardAction; -import org.erlide.wrangler.refactoring.duplicatedcode.ui.elements.AbstractResultTreeObject; -import org.erlide.wrangler.refactoring.duplicatedcode.ui.elements.DuplicatedCodeInstanceElement; - -/** - * Duplicates view - * - * @author Gyorgy Orosz - * - */ -public class DuplicatesView extends ViewPart { - // private final class HighlightAction extends Action { - // public void run() { - // ISelection selection = viewer.getSelection(); - // Object obj = ((IStructuredSelection) selection) - // .getFirstElement(); - // showMessage("Double-click detected on " + obj.toString()); - // } - // } - - ISelectionListener listener = (part, selection) -> MessageDialog - .openInformation(getSite().getShell(), "test", selection.toString()); - - private TreeViewer viewer; - private Action copyGeneralisedToClipboard; - private final Action copyFunCallToClipboard = new ClipboardAction( - PlatformUI.getWorkbench().getDisplay()) { - private boolean hasText; - - @Override - public void run() { - if (!hasText) { - MessageDialog.openInformation( - PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), - "Empty clipboard", - "There is no FunCall element according the selected item!"); - } else { - super.run(); - } - } - - @Override - public void setText(final String text) { - super.setText(text); - hasText = true; - } - - }; - - /** - * The constructor. - */ - public DuplicatesView() { - } - - /** - * Refresh the view - */ - public void refresh() { - viewer.refresh(); - } - - /** - * This is a callback that will allow us to create the viewer and initialize it. - */ - @Override - public void createPartControl(final Composite parent) { - viewer = new TreeViewer(parent, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL); - // drillDownAdapter = new DrillDownAdapter(viewer); - viewer.setContentProvider(new DuplicatesViewContentProvider(this)); - viewer.setLabelProvider(new DuplicatesViewLabelProvider()); - // viewer.setSorter(new NameSorter()); - viewer.setInput(getViewSite()); - makeActions(); - createToolbar(); - hookDoubleClickAction(); - // contributeToActionBars(); - addListeners(); - - } - - // private void hookContextMenu() { - // MenuManager menuMgr = new MenuManager("#PopupMenu"); - // menuMgr.setRemoveAllWhenShown(true); - // menuMgr.addMenuListener(new IMenuListener() { - // public void menuAboutToShow(IMenuManager manager) { - // DuplicatedCodeView.this.fillContextMenu(manager); - // } - // }); - // Menu menu = menuMgr.createContextMenu(viewer.getControl()); - // viewer.getControl().setMenu(menu); - // getSite().registerContextMenu(menuMgr, viewer); - // } - // - // private void contributeToActionBars() { - // IActionBars bars = getViewSite().getActionBars(); - // fillLocalPullDown(bars.getMenuManager()); - // fillLocalToolBar(bars.getToolBarManager()); - // } - - // private void fillLocalPullDown(IMenuManager manager) { - // manager.add(action1); - // // manager.add(new Separator()); - // // manager.add(action2); - // } - // - // private void fillContextMenu(IMenuManager manager) { - // manager.add(action1); - // // manager.add(action2); - // manager.add(new Separator()); - // drillDownAdapter.addNavigationActions(manager); - // // Other plug-ins can contribute there actions here - // manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); - // } - // - // private void fillLocalToolBar(IToolBarManager manager) { - // // manager.add(action1); - // // manager.add(action2); - // // manager.add(new Separator()); - // drillDownAdapter.addNavigationActions(manager); - // } - - private void addListeners() { - // getSite().getWorkbenchWindow().getSelectionService() - // .addSelectionListener(listener); - - } - - private void createToolbar() { - final IToolBarManager mgr = getViewSite().getActionBars().getToolBarManager(); - mgr.add(copyGeneralisedToClipboard); - mgr.add(copyFunCallToClipboard); - - } - - private void makeActions() { - - copyGeneralisedToClipboard = new ClipboardAction( - PlatformUI.getWorkbench().getDisplay()); - copyGeneralisedToClipboard - .setToolTipText("Copy generalised function to the clipboard"); - copyGeneralisedToClipboard.setImageDescriptor(PlatformUI.getWorkbench() - .getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_COPY)); - copyFunCallToClipboard.setToolTipText("Copy FunCall to the clipboard"); - copyFunCallToClipboard.setImageDescriptor(PlatformUI.getWorkbench() - .getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_COPY)); - - viewer.addSelectionChangedListener(event -> { - final ISelection sel = event.getSelection(); - if (sel == null || sel.isEmpty()) { - return; - } - final TreeSelection tsel = (TreeSelection) sel; - final AbstractResultTreeObject selection = (AbstractResultTreeObject) tsel - .getFirstElement(); - copyGeneralisedToClipboard.setText(selection.getSuggestedCode()); - - if (selection instanceof DuplicatedCodeInstanceElement) { - final DuplicatedCodeInstanceElement dcie = (DuplicatedCodeInstanceElement) selection; - copyFunCallToClipboard.setText(dcie.getReplicationFunction()); - } - - }); - - } - - private void hookDoubleClickAction() { - viewer.addDoubleClickListener(new DoubleClickListener()); - } - - /** - * Passing the focus request to the viewer's control. - */ - @Override - public void setFocus() { - viewer.getControl().setFocus(); - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/ui/DuplicatesViewContentProvider.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/ui/DuplicatesViewContentProvider.java deleted file mode 100644 index 68b4b7de9f..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/ui/DuplicatesViewContentProvider.java +++ /dev/null @@ -1,103 +0,0 @@ -/** - * - */ -package org.erlide.wrangler.refactoring.duplicatedcode.ui; - -import java.util.List; - -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.Viewer; -import org.erlide.wrangler.refactoring.duplicatedcode.DuplicatesUIManager; -import org.erlide.wrangler.refactoring.duplicatedcode.ui.elements.AbstractResultTreeObject; -import org.erlide.wrangler.refactoring.duplicatedcode.ui.elements.AbstractResultTreeParent; -import org.erlide.wrangler.refactoring.duplicatedcode.ui.elements.DuplicatedCodeElement; -import org.erlide.wrangler.refactoring.duplicatedcode.ui.elements.ResultTreeRoot; - -/** - * Content provider for the duplicates view. - * - * @author Gyorgy Orosz - * - */ -public class DuplicatesViewContentProvider - implements ITreeContentProvider, IDuplicatedCodeResultDisplayer { - - private final DuplicatesView duplicatedCodeView; - - DuplicatesViewContentProvider(final DuplicatesView duplicatedCodeView) { - this.duplicatedCodeView = duplicatedCodeView; - DuplicatesUIManager.setDuplicatedCodeResultDisplayer(this); - } - - private ResultTreeRoot invisibleRoot; - - @Override - public void inputChanged(final Viewer v, final Object oldInput, - final Object newInput) { - } - - @Override - public void dispose() { - } - - @Override - public Object[] getElements(final Object parent) { - if (parent.equals(duplicatedCodeView.getViewSite())) { - if (invisibleRoot == null) { - initialize(); - } - return getChildren(invisibleRoot); - } - return getChildren(parent); - } - - @Override - public Object getParent(final Object child) { - if (child instanceof AbstractResultTreeObject) { - return ((AbstractResultTreeObject) child).getParent(); - } - return null; - } - - @Override - public Object[] getChildren(final Object parent) { - if (parent instanceof AbstractResultTreeParent) { - return ((AbstractResultTreeParent) parent).getChildren(); - } - return new Object[0]; - } - - @Override - public boolean hasChildren(final Object parent) { - if (parent instanceof AbstractResultTreeParent) { - return ((AbstractResultTreeParent) parent).hasChildren(); - } - return false; - } - - private void initialize() { - invisibleRoot = new ResultTreeRoot(); - } - - /** - * Add a child to the view. - * - * @param child - * child to be added. - */ - public void addChild(final AbstractResultTreeObject child) { - invisibleRoot.addChild(child); - } - - @Override - public void showResult(final List result) { - invisibleRoot.dropChildren(); - if (result != null) { - for (final DuplicatedCodeElement d : result) { - invisibleRoot.addChild(d); - } - } - duplicatedCodeView.refresh(); - - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/ui/DuplicatesViewLabelProvider.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/ui/DuplicatesViewLabelProvider.java deleted file mode 100644 index 524701f84c..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/ui/DuplicatesViewLabelProvider.java +++ /dev/null @@ -1,70 +0,0 @@ -/** - * - */ -package org.erlide.wrangler.refactoring.duplicatedcode.ui; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.swt.graphics.Image; -import org.eclipse.ui.ISharedImages; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.erlide.wrangler.refactoring.Activator; -import org.erlide.wrangler.refactoring.duplicatedcode.ui.elements.DuplicatedCodeElement; -import org.erlide.wrangler.refactoring.duplicatedcode.ui.elements.DuplicatedCodeInstanceElement; -import org.erlide.wrangler.refactoring.duplicatedcode.ui.elements.DuplicatedFileElement; - -class DuplicatesViewLabelProvider extends LabelProvider { - Image erlangFileImage; - - Image codeSnippetImage; - - Image duplicateImage; - - public DuplicatesViewLabelProvider() { - createImages(); - } - - @Override - public void dispose() { - erlangFileImage.dispose(); - codeSnippetImage.dispose(); - duplicateImage.dispose(); - } - - private void createImages() { - - erlangFileImage = DuplicatesViewLabelProvider - .getImageDescriptor("icons/erlFile.gif").createImage(); - codeSnippetImage = DuplicatesViewLabelProvider - .getImageDescriptor("icons/match.gif").createImage(); - duplicateImage = DuplicatesViewLabelProvider - .getImageDescriptor("icons/codeSnippet.gif").createImage(); - } - - @Override - public String getText(final Object obj) { - return obj.toString(); - } - - @Override - public Image getImage(final Object obj) { - if (obj instanceof DuplicatedFileElement) { - return erlangFileImage; - } else if (obj instanceof DuplicatedCodeElement) { - return duplicateImage; - } else if (obj instanceof DuplicatedCodeInstanceElement) { - return codeSnippetImage; - } - final String imageKey = ISharedImages.IMG_OBJ_FILE; - return PlatformUI.getWorkbench().getSharedImages().getImage(imageKey); - } - - public static ImageDescriptor getImageDescriptor(final String name) { - - final ImageDescriptor descriptor = AbstractUIPlugin - .imageDescriptorFromPlugin(Activator.PLUGIN_ID, name); - - return descriptor; - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/ui/IDuplicatedCodeResultDisplayer.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/ui/IDuplicatedCodeResultDisplayer.java deleted file mode 100644 index d6a1eaa2ce..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/ui/IDuplicatedCodeResultDisplayer.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.duplicatedcode.ui; - -import java.util.List; - -import org.erlide.wrangler.refactoring.duplicatedcode.ui.elements.DuplicatedCodeElement; - -/** - * Interface for displaying duplicated codeparts. - * - * @author Gyorgy Orosz - * - */ -public interface IDuplicatedCodeResultDisplayer { - /** - * Show the result of a duplicated search refactoring. - * - * @param result - * result of the refactoring - duplicates - */ - void showResult(List result); - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/ui/SimilarCodeDetectionInputDialog.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/ui/SimilarCodeDetectionInputDialog.java deleted file mode 100644 index 63aece9ef1..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/ui/SimilarCodeDetectionInputDialog.java +++ /dev/null @@ -1,260 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.duplicatedcode.ui; - -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -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.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; -import org.erlide.wrangler.refactoring.ui.AbstractInputDialog; - -/** - * Input dialog for getting input for the similar code detection refactorings - * - * @author Gyorgy Orosz - * - */ -public class SimilarCodeDetectionInputDialog extends AbstractInputDialog { - - private Button onlyInFileCheckBoxButton; - private Text minLenText; - private Text minFreqText; - private Text minToksText; - private Text maxNewVarsText; - - private int minLen; - private int minFreq; - private int minToks; - private int maxNewVars; - private float simScore; - private boolean workOnlyInCurrentFile = true; - - private Text simScoreText; - - /** - * Constructor - * - * @param parentShell - * SWT shell - * @param title - * dialog title - */ - public SimilarCodeDetectionInputDialog(final Shell parentShell, final String title) { - super(parentShell, title); - } - - @Override - protected void validateInput() { - String errorMsg = null; - workOnlyInCurrentFile = !onlyInFileCheckBoxButton.getSelection(); - try { - simScore = Float.parseFloat(simScoreText.getText()); - minLen = Integer.parseInt(minLenText.getText()); - minFreq = Integer.parseInt(minFreqText.getText()); - minToks = Integer.parseInt(minToksText.getText()); - maxNewVars = Integer.parseInt(maxNewVarsText.getText()); - setErrorMessage(null); - } catch (final Exception e) { - errorMsg = "Please type correct values!"; - setErrorMessage(errorMsg); - } - - } - - @Override - protected Control createDialogArea(final Composite parent) { - final Composite composite = (Composite) super.createDialogArea(parent); - - final Label minLenlabel = new Label(composite, SWT.WRAP); - minLenlabel.setText("Minimum lenght of an expression sequence:"); - final GridData minLenData = new GridData(GridData.GRAB_HORIZONTAL - | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL - | GridData.VERTICAL_ALIGN_CENTER); - minLenData.widthHint = convertHorizontalDLUsToPixels( - IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); - minLenlabel.setLayoutData(minLenData); - minLenlabel.setFont(parent.getFont()); - - minLenText = new Text(composite, getInputTextStyle()); - minLenText.setLayoutData( - new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); - minLenText.setText("5"); - minLenText.addModifyListener(e -> validateInput()); - - final Label minTokslabel = new Label(composite, SWT.WRAP); - minTokslabel.setText("Minimum number of tokens a clone should have:"); - final GridData minToksData = new GridData(GridData.GRAB_HORIZONTAL - | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL - | GridData.VERTICAL_ALIGN_CENTER); - minToksData.widthHint = convertHorizontalDLUsToPixels( - IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); - minTokslabel.setLayoutData(minToksData); - minTokslabel.setFont(parent.getFont()); - - minToksText = new Text(composite, getInputTextStyle()); - minToksText.setLayoutData( - new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); - minToksText.setText("40"); - minToksText.addModifyListener(e -> validateInput()); - - final Label minFreqLabel = new Label(composite, SWT.WRAP); - minFreqLabel.setText("Minimum number appearance times:"); - final GridData minFreqData = new GridData(GridData.GRAB_HORIZONTAL - | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL - | GridData.VERTICAL_ALIGN_CENTER); - minFreqData.widthHint = convertHorizontalDLUsToPixels( - IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); - minFreqLabel.setLayoutData(minFreqData); - minFreqLabel.setFont(parent.getFont()); - - minFreqText = new Text(composite, getInputTextStyle()); - minFreqText.setLayoutData( - new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); - minFreqText.setText("2"); - minFreqText.addModifyListener(e -> validateInput()); - - final Label maxNewVarsLabel = new Label(composite, SWT.WRAP); - maxNewVarsLabel.setText( - "Maximum number of new parameters of the least-general abstraction:"); - final GridData maxNewVarsData = new GridData(GridData.GRAB_HORIZONTAL - | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL - | GridData.VERTICAL_ALIGN_CENTER); - maxNewVarsData.widthHint = convertHorizontalDLUsToPixels( - IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); - maxNewVarsLabel.setLayoutData(maxNewVarsData); - maxNewVarsLabel.setFont(parent.getFont()); - - maxNewVarsText = new Text(composite, getInputTextStyle()); - maxNewVarsText.setLayoutData( - new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); - maxNewVarsText.setText("4"); - maxNewVarsText.addModifyListener(e -> validateInput()); - - final Label simScoreLabel = new Label(composite, SWT.WRAP); - simScoreLabel.setText("Similarity score (between 0.1 and 1.0):"); - final GridData simScoreData = new GridData(GridData.GRAB_HORIZONTAL - | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL - | GridData.VERTICAL_ALIGN_CENTER); - simScoreData.widthHint = convertHorizontalDLUsToPixels( - IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); - simScoreLabel.setLayoutData(simScoreData); - simScoreLabel.setFont(parent.getFont()); - - simScoreText = new Text(composite, getInputTextStyle()); - simScoreText.setLayoutData( - new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); - simScoreText.setText("0.8"); - simScoreText.addModifyListener(e -> validateInput()); - - onlyInFileCheckBoxButton = new Button(composite, SWT.CHECK); - onlyInFileCheckBoxButton.setText("Detect similar code snippets in the project"); - - onlyInFileCheckBoxButton.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL - | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL - | GridData.VERTICAL_ALIGN_CENTER)); - onlyInFileCheckBoxButton.addSelectionListener(new SelectionListener() { - - @Override - public void widgetSelected(final SelectionEvent e) { - validateInput(); - - } - - @Override - public void widgetDefaultSelected(final SelectionEvent e) { - validateInput(); - - } - - }); - - errorMessageText = new Text(composite, SWT.READ_ONLY | SWT.WRAP); - errorMessageText.setLayoutData( - new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); - errorMessageText.setBackground(errorMessageText.getDisplay() - .getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); - - setErrorMessage(""); - - applyDialogFont(composite); - validateInput(); - return composite; - } - - /* - * protected Spinner createValueSpinner(Composite parent, int min, int max, int - * digits, int value) { Spinner ret = new Spinner(parent, SWT.BORDER); - * ret.setMinimum(min); ret.setMaximum(max); ret.setDigits(digits); - * ret.setSelection(value); - * - * GridData gd = new GridData(); gd.verticalIndent = 2; gd.horizontalAlignment = - * SWT.RIGHT; gd.grabExcessHorizontalSpace = true; ret.setLayoutData(gd); - * - * return ret; } - */ - - /** - * Returns the user typed similarity score. - * - * @return similarity scores - */ - public double getSimScore() { - return simScore; - } - - /** - * Returns the user typed minimal length - * - * @return minimal length - */ - public int getMinLen() { - return minLen; - } - - /** - * - * @return minimal number of tokens - */ - public int getMinToks() { - return minToks; - } - - /** - * - * @return maximal number of new variables - */ - public int getMaxNewVars() { - return maxNewVars; - } - - /** - * Returns the user types minimal frequency value - * - * @return minimal frequency value - */ - public int getMinFreq() { - return minFreq; - } - - /** - * Returns the value of the checkbox 'run refactoring in only current module' - * - * @return true if the refactoring should run only in the current module - */ - public boolean onlyinFile() { - return workOnlyInCurrentFile; - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/ui/SimilarSearchInputDialog.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/ui/SimilarSearchInputDialog.java deleted file mode 100644 index dfd4d81d0f..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/ui/SimilarSearchInputDialog.java +++ /dev/null @@ -1,136 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.duplicatedcode.ui; - -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -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.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; -import org.erlide.wrangler.refactoring.ui.AbstractInputDialog; - -/** - * Input dialog for getting input for Similar expression search refactoring - * - * @author Gyorgy Orosz - * - */ -public class SimilarSearchInputDialog extends AbstractInputDialog { - - private Button onlyInFileCheckBoxButton; - private float simScore; - private boolean workOnlyInCurrentFile = true; - private Text simScoreText; - - /** - * Constructor - * - * @param parentShell - * SWT shell - * @param title - * dialog title - */ - public SimilarSearchInputDialog(final Shell parentShell, final String title) { - super(parentShell, title); - } - - @Override - protected Control createDialogArea(final Composite parent) { - final Composite composite = (Composite) super.createDialogArea(parent); - - final Label simScoreLabel = new Label(composite, SWT.WRAP); - simScoreLabel.setText("Similarity score (between 0.1 and 1.0):"); - final GridData simScoreData = new GridData(GridData.GRAB_HORIZONTAL - | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL - | GridData.VERTICAL_ALIGN_CENTER); - simScoreData.widthHint = convertHorizontalDLUsToPixels( - IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); - simScoreLabel.setLayoutData(simScoreData); - simScoreLabel.setFont(parent.getFont()); - - simScoreText = new Text(composite, getInputTextStyle()); - simScoreText.setLayoutData( - new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); - simScoreText.setText("0.8"); - simScoreText.addModifyListener(e -> validateInput()); - - onlyInFileCheckBoxButton = new Button(composite, SWT.CHECK); - onlyInFileCheckBoxButton.setText("Detect similar code snippets in the project"); - - onlyInFileCheckBoxButton.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL - | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL - | GridData.VERTICAL_ALIGN_CENTER)); - onlyInFileCheckBoxButton.addSelectionListener(new SelectionListener() { - - @Override - public void widgetSelected(final SelectionEvent e) { - validateInput(); - - } - - @Override - public void widgetDefaultSelected(final SelectionEvent e) { - validateInput(); - - } - - }); - - errorMessageText = new Text(composite, SWT.READ_ONLY | SWT.WRAP); - errorMessageText.setLayoutData( - new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); - errorMessageText.setBackground(errorMessageText.getDisplay() - .getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); - - setErrorMessage(""); - - applyDialogFont(composite); - validateInput(); - return composite; - } - - @Override - protected void validateInput() { - String errorMsg = null; - workOnlyInCurrentFile = !onlyInFileCheckBoxButton.getSelection(); - try { - simScore = Float.parseFloat(simScoreText.getText()); - setErrorMessage(null); - } catch (final Exception e) { - errorMsg = "Please type correct values!"; - setErrorMessage(errorMsg); - } - - } - - /** - * Gets the user typed similarity score value - * - * @return similarity score value - */ - public double getSimScore() { - return simScore; - } - - /** - * Returns the value of the checkbox 'run refactoring in only current module' - * - * @return true if the refactoring should run only in the current module - */ - public boolean onlyinFile() { - return workOnlyInCurrentFile; - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/ui/elements/AbstractResultTreeObject.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/ui/elements/AbstractResultTreeObject.java deleted file mode 100644 index 173b93657e..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/ui/elements/AbstractResultTreeObject.java +++ /dev/null @@ -1,82 +0,0 @@ -/** - * - */ -package org.erlide.wrangler.refactoring.duplicatedcode.ui.elements; - -import org.eclipse.core.runtime.IAdaptable; - -/** - * Abstract element of the duplicates view Treeview - * - * @author Gyorgy Orosz - * - */ -public abstract class AbstractResultTreeObject implements IAdaptable { - // private String name; - private AbstractResultTreeParent parent; - - /* - * public abstract ResultTreeObject(String name); { this.name = name; } - */ - - /** - * Returns the name of the element. - * - * @return name of the element - */ - public abstract String getName(); /* - * { return name; } - */ - - /** - * Sets the parent of the current element. - * - * @param parent - * parent of the current item - * - */ - public void setParent(final AbstractResultTreeParent parent) { - this.parent = parent; - } - - /** - * Get the parent item of the current - * - * @return parent item - */ - public AbstractResultTreeParent getParent() { - return parent; - } - - @Override - public String toString() { - return getName(); - } - - @Override - public T getAdapter(final Class adapter) { - return null; - } - - String suggestedCode = ""; - - /** - * Get the codepart suggested by Wrangler - * - * @return suggested codepart stringss - */ - public String getSuggestedCode() { - return suggestedCode; - } - - /** - * Set the suggested code part fromWrangler - * - * @param str - * suggested code part string - */ - public void setSuggestedCode(final String str) { - suggestedCode = str; - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/ui/elements/AbstractResultTreeParent.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/ui/elements/AbstractResultTreeParent.java deleted file mode 100644 index c9cd018d73..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/ui/elements/AbstractResultTreeParent.java +++ /dev/null @@ -1,69 +0,0 @@ -/** - * - */ -package org.erlide.wrangler.refactoring.duplicatedcode.ui.elements; - -import java.util.ArrayList; - -/** - * A tree element which can contain other elements - * - * @author Gyorgy Orosz - * - */ -public abstract class AbstractResultTreeParent extends AbstractResultTreeObject { - protected ArrayList children; - - /* - * public ResultTreeParent(String name) { super(name); children = new ArrayList(); } - */ - - /** - * Adds a child element - * - * @param child - * child element - */ - public void addChild(final AbstractResultTreeObject child) { - if (children == null) { - children = new ArrayList<>(); - } - children.add(child); - child.setParent(this); - } - - /** - * Removes a child element - * - * @param child - * child element - */ - public void removeChild(final AbstractResultTreeObject child) { - if (children != null) { - children.remove(child); - child.setParent(null); - } - } - - /** - * Return the children of the the current element - * - * @return children elmements - */ - public AbstractResultTreeObject[] getChildren() { - if (children != null) { - return children.toArray(new AbstractResultTreeObject[children.size()]); - } - return new AbstractResultTreeObject[0]; - } - - /** - * Return true if the element has children - * - * @return true, if has any child element - */ - public boolean hasChildren() { - return children != null && !children.isEmpty(); - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/ui/elements/DuplicatedCodeElement.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/ui/elements/DuplicatedCodeElement.java deleted file mode 100644 index 3b0c47597b..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/ui/elements/DuplicatedCodeElement.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.duplicatedcode.ui.elements; - -/** - * TreeView element, which represents a set of duplicates - * - * @author Gyorgy Orosz - * - */ -public class DuplicatedCodeElement extends AbstractResultTreeParent { - - String codePartId; - DuplicatedCodeInstanceElement defaultCodePart; - - /** - * Constructor - * - * @param defaultInstance - * a particular element, which will be used to show the corresponding code - * part - */ - public DuplicatedCodeElement(final DuplicatedCodeInstanceElement defaultInstance) { - defaultCodePart = defaultInstance; - } - - @Override - public String getName() { - return "\"" + defaultCodePart.getCodePartString() + "\""; - } - - /** - * Returns the default code part - * - * @return default code part - */ - public DuplicatedCodeInstanceElement getCodePart() { - return defaultCodePart; - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/ui/elements/DuplicatedCodeInstanceElement.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/ui/elements/DuplicatedCodeInstanceElement.java deleted file mode 100644 index a3343a2359..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/ui/elements/DuplicatedCodeInstanceElement.java +++ /dev/null @@ -1,130 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.duplicatedcode.ui.elements; - -import org.eclipse.core.resources.IFile; -import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.text.IDocument; -import org.erlide.util.ErlLogger; -import org.erlide.wrangler.refactoring.util.WranglerUtils; - -/** - * Treeview element, which represents a single code part string - * - * @author Gyorgy Orosz - * - */ -public class DuplicatedCodeInstanceElement extends AbstractResultTreeObject { - - private String replicationFunction = ""; - private int startOffset; - private int endOffset; - private String codePartString; - private final IFile containingFile; - private final int startLine; - - // private ITextEditor containingEditor; - - /** - * Constructor - * - * @param containingFile - * file which contains the code part string - * @param startLine - * starting line of the selection - * @param startColumn - * starting column of the selection - * @param endLine - * ending line of the selection - * @param endColumn - * ending column of the selection - */ - public DuplicatedCodeInstanceElement(final IFile containingFile, final int startLine, - final int startColumn, final int endLine, final int endColumn) { - - this.containingFile = containingFile; - this.startLine = startLine; - final IDocument doc = WranglerUtils.getDocument(containingFile); - try { - startOffset = WranglerUtils.calculateOffsetFromPosition(startLine, - startColumn, doc); - endOffset = WranglerUtils.calculateOffsetFromPosition(endLine, endColumn, - doc); - codePartString = WranglerUtils.getTextSegment(startOffset, endOffset, doc); - } catch (final BadLocationException e) { - ErlLogger.error(e); - } - - } - - /** - * Return the starting offset of the represented selection - * - * @return starting offset of the selection - */ - public int getStartOffset() { - return startOffset; - } - - /** - * Return the ending offset of the represented selection - * - * @return ending offset of the selection - */ - public int getEndOffset() { - return endOffset; - } - - /* - * public ITextEditor getEditor() { return containingEditor; } - */ - - /** - * Returns the file which contains the selection - * - * @return file which contains the selection - */ - public IFile getContainingFile() { - return containingFile; - } - - /** - * Returns the string which is represented - * - * @return code part string - */ - public String getCodePartString() { - return simplifyCodePartString(codePartString); - } - - /** - * @return the replicationfunction - */ - public String getReplicationFunction() { - return replicationFunction; - } - - /** - * Sets the replicationfunction - */ - public void setReplicationFunction(final String replicationFunction) { - this.replicationFunction = replicationFunction; - } - - @Override - public String getName() { - return startLine + ": \"" + getCodePartString() + "\""; - } - - protected String simplifyCodePartString(final String input) { - return input;// input.replace("\n", " ").replace("\t", "").replace("\r", - // ""); - - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/ui/elements/DuplicatedFileElement.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/ui/elements/DuplicatedFileElement.java deleted file mode 100644 index 639644d72e..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/ui/elements/DuplicatedFileElement.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.duplicatedcode.ui.elements; - -import org.eclipse.core.resources.IFile; - -/** - * Element, which represents a module in the TreeView - * - * @author Gyorgy Orosz - * - */ -public class DuplicatedFileElement extends AbstractResultTreeParent { - IFile containingFile; - - // ITextEditor editor; - - /** - * Constructor - * - * @param containFile - * file which is represented - */ - public DuplicatedFileElement(final IFile containFile) { - // this.editor = editor; - containingFile = containFile; - } - - @Override - public String getName() { - return containingFile.getName(); - } - - /* - * public ITextEditor getTextEditor() { return editor; } - */ - - /** - * Returns the represented file - * - * @return represented file - */ - public IFile getContainingFile() { - return containingFile; - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/ui/elements/ResultTreeRoot.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/ui/elements/ResultTreeRoot.java deleted file mode 100644 index 248ef3dd5b..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/ui/elements/ResultTreeRoot.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.duplicatedcode.ui.elements; - -/** - * Root element of a TreeView for Duplicates view - * - * @author Gyorgy Orosz - * - */ -public class ResultTreeRoot extends AbstractResultTreeParent { - - @Override - public String getName() { - return ""; - } - - /** - * Drops children elements. - */ - public void dropChildren() { - if (children != null) { - children.clear(); - } - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/wrangler/bin/linux/suffixtree b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/wrangler/bin/linux/suffixtree deleted file mode 100644 index 28bc90e1d9..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/wrangler/bin/linux/suffixtree and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/wrangler/bin/macosx/suffixtree b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/wrangler/bin/macosx/suffixtree deleted file mode 100644 index c9e231e54f..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/wrangler/bin/macosx/suffixtree and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/wrangler/bin/win32/suffixtree.exe b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/wrangler/bin/win32/suffixtree.exe deleted file mode 100644 index cc152ccabc..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/wrangler/bin/win32/suffixtree.exe and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/.classpath b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/.classpath deleted file mode 100644 index fc04be1d74..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/.classpath +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/.project b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/.project deleted file mode 100644 index 724c302a71..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/.project +++ /dev/null @@ -1,45 +0,0 @@ - - - org.erlide.wrangler.refactoring - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.m2e.core.maven2Nature - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - - - - 1621691323042 - - 30 - - org.eclipse.core.resources.regexFilterMatcher - node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ - - - - diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/.settings/org.eclipse.core.resources.prefs b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 99f26c0203..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -encoding/=UTF-8 diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/.settings/org.eclipse.jdt.core.prefs b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 590ab09f99..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,119 +0,0 @@ -eclipse.preferences.version=1 -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=enabled -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.nonnull.secondary= -org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault -org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary= -org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable -org.eclipse.jdt.core.compiler.annotation.nullable.secondary= -org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.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=warning -org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning -org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled -org.eclipse.jdt.core.compiler.problem.fieldHiding=warning -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=enabled -org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning -org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning -org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning -org.eclipse.jdt.core.compiler.problem.missingDefaultCase=warning -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.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=ignore -org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning -org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning -org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning -org.eclipse.jdt.core.compiler.problem.nullReference=error -org.eclipse.jdt.core.compiler.problem.nullSpecViolation=warning -org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning -org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning -org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning -org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning -org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning -org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning -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=warning -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=enabled -org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled -org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled -org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore -org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning -org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled -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.unlikelyCollectionMethodArgumentType=warning -org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled -org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info -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=warning -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.unusedExceptionParameter=ignore -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=ignore -org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.release=disabled -org.eclipse.jdt.core.compiler.source=1.8 diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/.settings/org.eclipse.jdt.ui.prefs b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/.settings/org.eclipse.jdt.ui.prefs deleted file mode 100644 index 533dfa94d5..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/.settings/org.eclipse.jdt.ui.prefs +++ /dev/null @@ -1,54 +0,0 @@ -cleanup_settings_version=2 -eclipse.preferences.version=1 -editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true -formatter_settings_version=11 -internal.default.compliance=default -org.eclipse.jdt.ui.javadoc=false -org.eclipse.jdt.ui.text.custom_code_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_nls_tags=false -sp_cleanup.add_missing_override_annotations=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.format_source_code=true -sp_cleanup.make_local_variable_final=false -sp_cleanup.make_parameters_final=false -sp_cleanup.make_private_fields_final=true -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=false -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=false -sp_cleanup.qualify_static_method_accesses_with_declaring_class=false -sp_cleanup.remove_private_constructors=true -sp_cleanup.remove_trailing_whitespaces=false -sp_cleanup.remove_trailing_whitespaces_all=true -sp_cleanup.remove_trailing_whitespaces_ignore_empty=false -sp_cleanup.remove_unnecessary_casts=true -sp_cleanup.remove_unnecessary_nls_tags=false -sp_cleanup.remove_unused_imports=false -sp_cleanup.remove_unused_local_variables=false -sp_cleanup.remove_unused_private_fields=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=false -sp_cleanup.use_blocks_only_for_return_and_throw=false -sp_cleanup.use_parentheses_in_expressions=false -sp_cleanup.use_this_for_non_static_field_access=false -sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true -sp_cleanup.use_this_for_non_static_method_access=false -sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/.settings/org.eclipse.ltk.core.refactoring.prefs b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/.settings/org.eclipse.ltk.core.refactoring.prefs deleted file mode 100644 index 7c196112cc..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/.settings/org.eclipse.ltk.core.refactoring.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Mon Apr 28 15:32:19 BST 2008 -eclipse.preferences.version=1 -org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/.settings/org.eclipse.m2e.core.prefs b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index f897a7f1cb..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/.settings/org.eclipse.wst.validation.prefs b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/.settings/org.eclipse.wst.validation.prefs deleted file mode 100644 index a7eb6ed093..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/.settings/org.eclipse.wst.validation.prefs +++ /dev/null @@ -1,6 +0,0 @@ -#Wed May 21 15:22:14 BST 2008 -DELEGATES_PREFERENCE=delegateValidatorListorg.eclipse.wst.xsd.core.internal.validation.eclipse.XSDDelegatingValidator\=org.eclipse.wst.xsd.core.internal.validation.eclipse.Validator; -USER_BUILD_PREFERENCE=enabledBuildValidatorListorg.eclipse.wst.xsd.core.internal.validation.eclipse.XSDDelegatingValidator;org.eclipse.wst.xml.core.internal.validation.eclipse.Validator;org.eclipse.wst.dtd.core.internal.validation.eclipse.Validator; -USER_MANUAL_PREFERENCE=enabledManualValidatorListorg.eclipse.wst.xsd.core.internal.validation.eclipse.XSDDelegatingValidator;org.eclipse.wst.xml.core.internal.validation.eclipse.Validator;org.eclipse.wst.dtd.core.internal.validation.eclipse.Validator; -USER_PREFERENCE=overrideGlobalPreferencesfalse -eclipse.preferences.version=1 diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/.settings/org.erlide.core.prefs b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/.settings/org.erlide.core.prefs deleted file mode 100644 index aee01e9d27..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/.settings/org.erlide.core.prefs +++ /dev/null @@ -1,12 +0,0 @@ -#Fri Mar 12 15:19:50 CET 2010 -backend_version=R15B -eclipse.preferences.version=1 -external_includes= -external_modules= -include_dirs=wrangler/include; -make_unique=true -output_dir=wrangler/ebin -runtimes=r12-5 -source_dirs=wrangler/erl; -type=NORMAL -use_pathz=true diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/META-INF/MANIFEST.MF b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/META-INF/MANIFEST.MF deleted file mode 100644 index 55acaf3758..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/META-INF/MANIFEST.MF +++ /dev/null @@ -1,50 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: Wrangler Refactor plug-in -Bundle-SymbolicName: org.erlide.wrangler.refactoring;singleton:=true -Bundle-Version: 0.11.0.qualifier -Bundle-Activator: org.erlide.wrangler.refactoring.Activator -Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.9.100,4.0.0)", - org.eclipse.ltk.core.refactoring;bundle-version="[3.6.100,4.0.0)", - org.eclipse.ltk.ui.refactoring;bundle-version="[3.7.100,4.0.0)", - org.eclipse.jface.text;bundle-version="[3.8.101,4.0.0)", - org.eclipse.ui;bundle-version="[3.105.0,4.0.0)", - org.eclipse.ui.workbench.texteditor;bundle-version="[3.8.101,4.0.0)", - org.eclipse.ui.ide;bundle-version="[3.9.2,4.0.0)", - org.eclipse.ui.editors;bundle-version="[3.8.100,4.0.0)", - org.eclipse.ui.navigator;bundle-version="[3.5.300,4.0.0)", - org.eclipse.core.expressions;bundle-version="[3.4.501,4.0.0)", - org.eclipse.core.filesystem;bundle-version="[1.4.0,4.0.0)", - org.eclipse.debug.core;bundle-version="[3.8.0,4.0.0)", - org.erlide.ui;bundle-version="0.32.0", - org.erlide.backend;bundle-version="0.32.0", - org.erlide.model.api;bundle-version="0.32.0", - org.incava.util.diff, - org.erlide.util;bundle-version="0.32.0", - org.erlide.runtime;bundle-version="0.32.0", - com.google.guava;bundle-version="[21.0.0,33.4.0)", - javax.inject;bundle-version="1.0.0", - org.eclipse.xtext.xbase.lib;bundle-version="2.19.0", - com.ericsson.otp.jinterface;bundle-version="1.8.0" -Bundle-ActivationPolicy: lazy -Export-Package: org.erlide.wrangler.refactoring;x-internal:=true, - org.erlide.wrangler.refactoring.backend, - org.erlide.wrangler.refactoring.backend.internal;x-internal:=true, - org.erlide.wrangler.refactoring.core, - org.erlide.wrangler.refactoring.core.internal;x-internal:=true, - org.erlide.wrangler.refactoring.exception, - org.erlide.wrangler.refactoring.selection, - org.erlide.wrangler.refactoring.selection.internal;x-internal:=true, - org.erlide.wrangler.refactoring.ui, - org.erlide.wrangler.refactoring.ui.dnd, - org.erlide.wrangler.refactoring.ui.menu, - org.erlide.wrangler.refactoring.ui.validator, - org.erlide.wrangler.refactoring.ui.warning, - org.erlide.wrangler.refactoring.ui.wizard, - org.erlide.wrangler.refactoring.ui.wizardpages;x-internal:=true, - org.erlide.wrangler.refactoring.util -Bundle-Localization: plugin -Bundle-Vendor: UKC -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 -Import-Package: org.eclipse.jdt.annotation;resolution:=optional -Automatic-Module-Name: org.erlide.wrangler.refactoring diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/build.properties b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/build.properties deleted file mode 100644 index 1e02be9a4a..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/build.properties +++ /dev/null @@ -1,8 +0,0 @@ -bin.includes = META-INF/,\ - .,\ - plugin.xml,\ - plugin.properties -jars.compile.order = . -source.. = src/ -javacDefaultEncoding.. = UTF-8 -output.. = target/classes/ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/contexts.xml b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/contexts.xml deleted file mode 100644 index 02e26e45c4..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/contexts.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - This is the context help for the sample view with a table viewer. It was generated by a PDE template. - - - - - - - - - diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/icons/wrangler.gif b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/icons/wrangler.gif deleted file mode 100644 index cacb0c1dbe..0000000000 Binary files a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/icons/wrangler.gif and /dev/null differ diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/plugin.properties b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/plugin.properties deleted file mode 100644 index ed44405094..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/plugin.properties +++ /dev/null @@ -1,37 +0,0 @@ -#Properties file for org.erlide.wrangler.refactoring -Bundle-Name.0 = Wrangler Refactoring Plug-in -RefactoringMenu_Label = Refac&tor -renameVariableName = &Rename Variable... -renameFunctionName = &Rename Function... -renameModuleName = &Rename Module... -moveFunctionName = &Move Function To Another Module... -generaliseName = &Generalise Function Definition... -funExtractionName = Function E&xtraction... -tupleFunParamsName = &Tuple Function Arguments... -tupleToRecordName = Tuple To &Record... -renameParticipant.name.0 = name -foldExpressionName = Fol&d Expression Against Local Function... -foldRemoteExpressionName = Fold Expression Against &Remote Function... -searchExpressionName = &Search Expression... -detectDuplicatesName = Detect Duplicated &Code... -renameProcessName = Rename &Process (beta)... -funToProcessName = &Convert Function To Process (beta)... -rename = &Rename -introduceMacroName = &Introduce a Macro... -foldMacroName = Fold Against Mac&ro Definition... -normalizeRecordExpressionName = &Normalize Record Expression... -introduceLetName = Introduce &?LET... -mergeLetName = &Merge ?LET Expressions... -mergeForAllName = &Merge ?FORALL Expressions... -quickcheckmenu = &QuickCheck Refactorings -eqc_statemtorecordName = eqc_statem &State Data To Record... -eqc_fsmtorecordName = eqc_fsm &State Data To Record... -gen_fsmtorecordName = gen_fsm &State Data To Record... -unfoldFunctionName = &Unfold Function Application... -partitionExportsName = &Partition Exported Functions... -introduceNewVariable = Introduce New Variable... -applyAdhocRefac = &Apply Adhoc Refactoring -applyCompositeRefac = &Apply Composite Refactoring -userRefacs = &gen_refac Refacs -userMyRefacs = &My gen_refac Refacs -addRefac = &Add Your Refactoring diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/plugin.xml b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/plugin.xml deleted file mode 100644 index 9d24e95c78..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/plugin.xml +++ /dev/null @@ -1,688 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/pom.xml b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/pom.xml deleted file mode 100644 index 680a7822d2..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/pom.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - 4.0.0 - - org.erlide - org.erlide.wrangler.parent - 1.0.0 - ../.. - - - org.erlide.wrangler.refactoring - 0.11.0-SNAPSHOT - eclipse-plugin - diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/Activator.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/Activator.java deleted file mode 100644 index 56b0f2fb7f..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/Activator.java +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.erlide.engine.model.OtpRpcFactory; -import org.erlide.runtime.rpc.IOtpRpc; -import org.erlide.runtime.rpc.RpcResult; -import org.erlide.util.ErlLogger; -import org.osgi.framework.BundleContext; - -import com.ericsson.otp.erlang.OtpErlangList; - -/** - * The activator class controls the plug-in life cycle - */ -public class Activator extends AbstractUIPlugin { - /** - * The plug-in ID. - */ - public static final String PLUGIN_ID = "org.erlide.wrangler.refactoring"; - - /** - * The core plugin ID. - */ - public static final String CORE_ID = "org.erlide.wrangler.core"; - - // The shared instance - private static Activator plugin; - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static Activator getDefault() { - return Activator.plugin; - } - - /** - * The constructor - */ - public Activator() { - } - - public IOtpRpc getBackend() { - return OtpRpcFactory.getOtpRpc(); - } - - /** - * Loads the necessary *.ebin files to the Erlang node for the plug-in. - * - * @throws CoreException - * detailed exception about the loading process errors - */ - private void initWrangler() throws CoreException { - final IOtpRpc mb = getBackend(); - RpcResult res = mb.call_noexception("wrangler_refacs", "init_eclipse", ""); - ErlLogger.debug("Wrangler app started:\n" + res); - res = mb.call_noexception("wrangler_error_logger", "init", "x", - new OtpErlangList()); - - ErlLogger.debug("Error logger started:" + res); - } - - @Override - public void start(final BundleContext context) throws Exception { - super.start(context); - Activator.plugin = this; - initWrangler(); - } - - @Override - public void stop(final BundleContext context) throws Exception { - Activator.plugin = null; - super.stop(context); - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/ChangedFile.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/ChangedFile.java deleted file mode 100644 index 82e832ce36..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/ChangedFile.java +++ /dev/null @@ -1,174 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.backend; - -import java.io.File; -import java.io.IOException; -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.ltk.core.refactoring.Change; -import org.eclipse.ltk.core.refactoring.TextFileChange; -import org.eclipse.text.edits.MultiTextEdit; -import org.eclipse.text.edits.TextEdit; -import org.erlide.wrangler.refactoring.util.ChangesetMaker; - -/** - * Represents an Erlang file, and a string which contains the modified source. - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class ChangedFile { - - /** - * Represented Erlang file OS dependent path before the refactoring. - */ - String oldPath; - - /** - * Represented Erlang file OS dependent path after the refactoring. - */ - String newPath; - - /** - * Modified source of oldPath. - */ - String newFileContent; - - /** - * Constructs a new object. - * - * @param oldPath - * Old path of the file. - * @param newPath - * New path of the file. - * @param newFileContent - * New content of the source file. - */ - public ChangedFile(final String oldPath, final String newPath, - final String newFileContent) { - this.oldPath = oldPath; - this.newPath = newPath; - this.newFileContent = newFileContent; - } - - /** - * Creates Change objects from the original and the modified source. - * - * @return the created Change object which typically instance of - * TextFileChange - * @throws IOException - * if an exception occurs while accessing the source file - */ - public Change createChanges(final IFile file) throws IOException { - IFile eclipseRep; - if (file == null) { - eclipseRep = findEclipseRepresentation(oldPath); - } else { - eclipseRep = file; - } - - final TextFileChange change = new TextFileChange(oldPath, eclipseRep); - // change.setSaveMode(TextFileChange.FORCE_SAVE); - final File tf = new File(oldPath); - final List edits = ChangesetMaker.createEdits(tf, newFileContent); - final MultiTextEdit multiEdit = new MultiTextEdit(); - if (!edits.isEmpty()) { - for (final TextEdit edit : edits) { - multiEdit.addChild(edit); - } - change.setEdit(multiEdit); - return change; - } - return null; - } - - public Change createChanges() throws IOException { - return createChanges(null); - - } - - /** - * Finds the Eclipse representation of the given path. - * - * @param anOldPath - * OS dependent path of the refactored file - * @return an IFile object of the given path - * @throws IOException - * if the given path could not be found on the workspace - */ - private IFile findEclipseRepresentation(final String anOldPath) throws IOException { - final IWorkspace workspace = ResourcesPlugin.getWorkspace(); - final IWorkspaceRoot root = workspace.getRoot(); - final Path p = new Path(anOldPath); - @SuppressWarnings("deprecation") - final IFile[] files = root.findFilesForLocation(p); - if (files == null || files.length != 1) { - throw new IOException("File not found"); - } - - return files[0]; - - } - - /** - * True if the file name is changed during the refactoring. - * - * @return true if the file name has changed - */ - public boolean isNameChanged() { - return !newPath.equals(oldPath); - } - - /** - * Returns the IPath object of the old path. - * - * @return IPath object - */ - public IPath getPath() { - IFile f; - try { - f = findEclipseRepresentation(oldPath); - } catch (final IOException e) { - return null; - } - return f.getFullPath(); - } - - /** - * Returns the IPath object of the new paths - * - * @return IPath object - */ - public IPath getNewPath() { - IFile f; - try { - f = findEclipseRepresentation(newPath); - } catch (final IOException e) { - return null; - } - return f.getFullPath(); - } - - /** - * If the refactoring changes the file name, it returns back the new one. - * - * @return new file name - */ - public String getNewName() { - return Path.fromOSString(newPath).toFile().getName(); - // return newPath; - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/IRefactoringRpcMessage.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/IRefactoringRpcMessage.java deleted file mode 100644 index da4c26e786..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/IRefactoringRpcMessage.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.backend; - -import java.util.List; - -/** - * Interface for handling RpcMessages which contains information about a Wrangler - * refactoring - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public interface IRefactoringRpcMessage extends IRpcMessage { - /** - * Successful refactorings contains source file modification, which are represented - * with filename-source code pairs - * - * @return changed files list - */ - List getRefactoringChangeset(); - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/IRpcMessage.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/IRpcMessage.java deleted file mode 100644 index 8977bd1287..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/IRpcMessage.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.backend; - -import org.erlide.runtime.rpc.RpcResult; - -/** - * Interface for handling RpcResultImpl objects of the Erlide's backend, which contains - * information about a RPC with Wrangler - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public interface IRpcMessage { - /** - * Returns true if the wrangler operation was successful. - * - * @return true if the wrangler operation node was successful - */ - boolean isSuccessful(); - - /** - * If Wrangler could not perform the operation, it returns with an error or warning - * message. It is returned by this function. - * - * @return error message from wrangler - */ - String getMessageString(); - - /** - * Returns with the state of the refactoring - * - * @return RefactoringState - */ - RefactoringState getRefactoringState(); - - /** - * Parses an RpcResultImpl object. - * - * @param result - * result of an RPC - */ - void parse(RpcResult result); - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/IWranglerBackend.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/IWranglerBackend.java deleted file mode 100644 index 0b1e3aa445..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/IWranglerBackend.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.backend; - -/** - * Interface for Wrangler Backends - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public interface IWranglerBackend { -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/RefactoringState.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/RefactoringState.java deleted file mode 100644 index a86bb83d14..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/RefactoringState.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.backend; - -/** - * State of a Wrangler Refactoring. - * - * The class does not intend to cover all the cases, just thise which are essential. - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public enum RefactoringState { - /** - * refactoring succeeds - */ - OK, - /** - * refactoring fails - */ - ERROR, - /** - * refactoring succeeds, but has warning message - */ - WARNING, - /** - * refactoring returns with a question - */ - QUESTION, - /** - * multi_instances - for fold expression - */ - MULTI_INSTANCES, - /** - * unknown_side_effect - for fold expression - */ - UNKNOWN_SIDE_EFFECT, - /** - * more_than_one_clause - for fold expression - */ - MORE_THAN_ONE_CLAUSE -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/SyntaxInfo.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/SyntaxInfo.java deleted file mode 100644 index 1cc9c3cb9f..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/SyntaxInfo.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.backend; - -/** - * Represents syntax information about a selection - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class SyntaxInfo { - /** - * @param type - * expression type - * @param definitionPosLine - * expression starting position - * @param definitionPosColumn - * expression starting column - */ - public SyntaxInfo(final Type type, final int definitionPosLine, - final int definitionPosColumn) { - this.definitionPosColumn = definitionPosColumn; - this.definitionPosLine = definitionPosLine; - this.type = type; - } - - protected int definitionPosLine; - protected int definitionPosColumn; - protected Type type; - - /** - * Returns true if the selection is variable - * - * @return boolean - */ - public boolean isVariable() { - return type == Type.VARIABLE; - } - - /** - * An expression type - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ - public enum Type { - /** - * selection is an expression - */ - EXPRESSION, - /** - * selection is a variable - */ - VARIABLE, - /** - * selection is sg. else - */ - NONE - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/UserRefactoringInfo.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/UserRefactoringInfo.java deleted file mode 100644 index 22a9313a2b..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/UserRefactoringInfo.java +++ /dev/null @@ -1,53 +0,0 @@ -package org.erlide.wrangler.refactoring.backend; - -/** - * Simple class that contains user refactoring's informations - * - * @author Aleksandra Lipiec - * @version %I%, %G% - */ -public class UserRefactoringInfo { - - private final String label; // menu item's label - private final String callback; // name of callback module - - public UserRefactoringInfo(final String module) { - callback = module; - label = prepareLabel(module); - } - - public String getLabel() { - return label; - } - - public String getCallback() { - return callback; - } - - // prepare label's text based on module name - private String prepareLabel(final String module) { - final StringBuilder buf = new StringBuilder(); - for (final String part : module.split("_")) { - buf.append(Character.toUpperCase(part.charAt(0))).append(part.substring(1)) - .append(" "); - } - return buf.toString().trim(); - } - - @Override - public String toString() { - return label; - } - - @Override - public boolean equals(final Object obj) { - return obj instanceof UserRefactoringInfo - && ((UserRefactoringInfo) obj).getCallback().equals(callback); - } - - @Override - public int hashCode() { - return callback.hashCode(); - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/UserRefactoringsManager.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/UserRefactoringsManager.java deleted file mode 100644 index bbb71411ee..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/UserRefactoringsManager.java +++ /dev/null @@ -1,179 +0,0 @@ -package org.erlide.wrangler.refactoring.backend; - -import java.util.Enumeration; -import java.util.LinkedList; -import java.util.List; - -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Platform; -import org.erlide.runtime.rpc.RpcResult; -import org.erlide.util.ErlLogger; -import org.erlide.wrangler.refactoring.Activator; -import org.erlide.wrangler.refactoring.backend.internal.WranglerBackendManager; -import org.osgi.framework.Bundle; - -import com.ericsson.otp.erlang.OtpErlangList; -import com.ericsson.otp.erlang.OtpErlangObject; -import com.ericsson.otp.erlang.OtpErlangString; -import com.ericsson.otp.erlang.OtpErlangTuple; - -/** - * Class for handling logic of installed user refactorings installed means: currently in - * repository or added by a user - * - * Singleton - * - * @author Aleksandra Lipiec - * @version %I%, %G% - */ -public class UserRefactoringsManager { - - private static UserRefactoringsManager manager; - - private List elementaryRefacs; // gen_refac refacs - private List compositeRefacs; // gen_composite_refac - // refacs - private List myElementaryRefacs; // gen_refac refacs - // - user's - private List myCompositeRefacs; // gen_composite_refac - - // refacs - user's - - private UserRefactoringsManager() { - - } - - public static synchronized UserRefactoringsManager getInstance() { - if (UserRefactoringsManager.manager == null) { - UserRefactoringsManager.manager = new UserRefactoringsManager(); - } - return UserRefactoringsManager.manager; - } - - public synchronized List getElementary() { - if (elementaryRefacs == null) { - scanForUserRefactorings(); - } - return elementaryRefacs; - } - - public synchronized List getComposite() { - if (compositeRefacs == null) { - scanForUserRefactorings(); - } - return compositeRefacs; - } - - public synchronized List getMyElementary() { - if (myElementaryRefacs == null) { - scanForUserRefactorings(); - } - return myElementaryRefacs; - } - - public synchronized List getMyComposite() { - if (myCompositeRefacs == null) { - scanForUserRefactorings(); - } - return myCompositeRefacs; - } - - public synchronized void addMyElementary(final String module) { - if (myElementaryRefacs == null) { - scanForUserRefactorings(); - } - final UserRefactoringInfo info = new UserRefactoringInfo(module); - if (!myElementaryRefacs.contains(info)) { - myElementaryRefacs.add(info); - } - } - - public synchronized void addMyComposite(final String module) { - if (myCompositeRefacs == null) { - scanForUserRefactorings(); - } - final UserRefactoringInfo info = new UserRefactoringInfo(module); - if (!myCompositeRefacs.contains(info)) { - myCompositeRefacs.add(info); - } - } - - /** - * Looks for user defined refactorings (in order to generate menu items for them) - */ - @SuppressWarnings("rawtypes") - private void scanForUserRefactorings() { - elementaryRefacs = new LinkedList<>(); - compositeRefacs = new LinkedList<>(); - myElementaryRefacs = new LinkedList<>(); - myCompositeRefacs = new LinkedList<>(); - - final Bundle coreBundle = Platform.getBundle(Activator.CORE_ID); - - final Enumeration modules = coreBundle.findEntries("wrangler/ebin", "*.beam", - false); - - // modules that origin from repository - final List erlModules = new LinkedList<>(); - while (modules != null && modules.hasMoreElements()) { - final String next = modules.nextElement().toString(); - final String module = next.substring(next.lastIndexOf('/') + 1, - next.lastIndexOf('.')); - erlModules.add(new OtpErlangString(module)); - } - - RpcResult res = WranglerBackendManager.getRefactoringBackend().callWithoutParser( - "get_user_refactorings", "x", - new OtpErlangList(erlModules.toArray(new OtpErlangObject[0]))); - - if (res.isOk() && res.getValue() instanceof OtpErlangList) { - final OtpErlangList genRefac = (OtpErlangList) ((OtpErlangTuple) ((OtpErlangList) res - .getValue()).elementAt(0)).elementAt(1); - final OtpErlangList genCompositeRefac = (OtpErlangList) ((OtpErlangTuple) ((OtpErlangList) res - .getValue()).elementAt(1)).elementAt(1); - - for (final OtpErlangObject obj : genRefac) { - elementaryRefacs.add(new UserRefactoringInfo(obj.toString())); - } - for (final OtpErlangObject obj : genCompositeRefac) { - compositeRefacs.add(new UserRefactoringInfo(obj.toString())); - } - } - - ErlLogger.info("Refac modules found " + res.toString()); - - // user's own refactoring - final Enumeration userModules = coreBundle - .findEntries("wrangler/ebin/my_gen_refac", "*.beam", false); - while (userModules != null && userModules.hasMoreElements()) { - final String next = userModules.nextElement().toString(); - myElementaryRefacs.add(new UserRefactoringInfo( - next.substring(next.lastIndexOf('/') + 1, next.lastIndexOf('.')))); - - } - // user's own composite refactorings - final Enumeration userCompositeModules = coreBundle - .findEntries("wrangler/ebin/my_gen_composite_refac", "*.beam", false); - while (userCompositeModules != null && userCompositeModules.hasMoreElements()) { - final String next = userCompositeModules.nextElement().toString(); - myCompositeRefacs.add(new UserRefactoringInfo( - next.substring(next.lastIndexOf('/') + 1, next.lastIndexOf('.')))); - } - - // load refactorings - res = WranglerBackendManager.getRefactoringBackend() - .callWithoutParser("load_user_refactorings", "s", getEbinPath()); - ErlLogger.debug(res.toString()); - - } - - // path to ebin directory - private String getEbinPath() { - final Bundle coreBundle = Platform.getBundle(Activator.CORE_ID); - String path = new Path(coreBundle.getLocation()).append("wrangler").append("ebin") - .toOSString(); - path = path.substring(path.lastIndexOf(':') + 1); - return path; - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/WranglerSyntaxBackend.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/WranglerSyntaxBackend.java deleted file mode 100644 index 2f49983216..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/WranglerSyntaxBackend.java +++ /dev/null @@ -1,115 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.backend; - -import org.eclipse.core.resources.IFile; -import org.erlide.runtime.rpc.IOtpRpc; -import org.erlide.runtime.rpc.RpcResult; -import org.erlide.util.ErlLogger; -import org.erlide.wrangler.refactoring.backend.SyntaxInfo.Type; -import org.erlide.wrangler.refactoring.util.GlobalParameters; - -import com.ericsson.otp.erlang.OtpErlangAtom; -import com.ericsson.otp.erlang.OtpErlangInt; -import com.ericsson.otp.erlang.OtpErlangList; -import com.ericsson.otp.erlang.OtpErlangLong; -import com.ericsson.otp.erlang.OtpErlangObject; -import com.ericsson.otp.erlang.OtpErlangTuple; - -/** - * Wranglers syntax backend, which is for determining about a selection its type - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class WranglerSyntaxBackend implements IWranglerBackend { - protected IOtpRpc backend; - protected static final String MODULE = "wrangler_ast_server"; - protected static final String INTERFACE_MODULE = "api_interface"; - protected static final String PARSE_FUNCTION = "parse_annotate_file"; - protected static final String VAR_FUNCTION = "pos_to_var_name"; - - /** - * @param backend - * Backend object - */ - public WranglerSyntaxBackend(final IOtpRpc backend) { - this.backend = backend; - } - - protected OtpErlangTuple parseFile(final IFile f) { - final String filePath = f.getLocation().toOSString(); - final RpcResult res = backend.call_noexception(WranglerSyntaxBackend.MODULE, - WranglerSyntaxBackend.PARSE_FUNCTION, "sax", filePath, "true", - GlobalParameters.getWranglerSelection().getSearchPath()); - return parseParserResult(res.getValue()); - } - - protected OtpErlangTuple parseParserResult(final OtpErlangObject value) { - final OtpErlangTuple backendResult = (OtpErlangTuple) value; - if (!"ok".equals(((OtpErlangAtom) backendResult.elementAt(0)).atomValue())) { - return null; - } - final OtpErlangTuple wranglerResult = (OtpErlangTuple) backendResult.elementAt(1); - - return (OtpErlangTuple) wranglerResult.elementAt(0); - - } - - protected SyntaxInfo varToPos(final OtpErlangTuple syntaxTree, final int line, - final int col) { - final OtpErlangInt[] position = new OtpErlangInt[2]; - position[0] = new OtpErlangInt(line); - position[1] = new OtpErlangInt(col); - final RpcResult res = backend.call_noexception( - WranglerSyntaxBackend.INTERFACE_MODULE, - WranglerSyntaxBackend.VAR_FUNCTION, "xx", syntaxTree, - new OtpErlangTuple(position)); - return parseVarInfo(res.getValue()); - } - - private SyntaxInfo parseVarInfo(final OtpErlangObject value) { - try { - final OtpErlangTuple result = (OtpErlangTuple) value; - if (!"ok".equals(((OtpErlangAtom) result.elementAt(0)).atomValue())) { - return new SyntaxInfo(Type.NONE, -1, -1); - } - SyntaxInfo ret; - final OtpErlangTuple res = (OtpErlangTuple) result.elementAt(1); - final OtpErlangTuple position = (OtpErlangTuple) ((OtpErlangList) res - .elementAt(1)).elementAt(0); - OtpErlangLong line; - OtpErlangLong col; - line = (OtpErlangLong) position.elementAt(0); - col = (OtpErlangLong) position.elementAt(0); - ret = new SyntaxInfo(Type.VARIABLE, line.intValue(), col.intValue()); - return ret; - } catch (final Exception e) { - ErlLogger.debug(e); - return null; - } - } - - /** - * Returns syntax information about a selection - * - * @param f - * selected file - * @param line - * selected line - * @param pos - * selected position - * @return syntax information - */ - public SyntaxInfo getSyntaxInfo(final IFile f, final int line, final int pos) { - return varToPos(parseFile(f), line, pos); - } - - // TODO:: implement expression checking -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/internal/AbstractRefactoringRpcMessage.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/internal/AbstractRefactoringRpcMessage.java deleted file mode 100644 index d60167a8fb..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/internal/AbstractRefactoringRpcMessage.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.backend.internal; - -import java.util.ArrayList; -import java.util.List; - -import org.erlide.util.erlang.OtpErlang; -import org.erlide.wrangler.refactoring.backend.ChangedFile; -import org.erlide.wrangler.refactoring.backend.IRefactoringRpcMessage; - -import com.ericsson.otp.erlang.OtpErlangList; -import com.ericsson.otp.erlang.OtpErlangString; -import com.ericsson.otp.erlang.OtpErlangTuple; - -/** - * Abstract class for parsing an RPC message from Wrangler. - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public abstract class AbstractRefactoringRpcMessage extends AbstractRpcMessage - implements IRefactoringRpcMessage { - - protected ArrayList changedFiles; - - /** - * Returns with those files, which are changed during the refactoring. - */ - @Override - public List getRefactoringChangeset() { - return changedFiles; - } - - protected ArrayList parseFileList(final OtpErlangList fileList) { - final ArrayList ret = new ArrayList<>(); - - OtpErlangTuple e; - OtpErlangString oldPath; - OtpErlangString newPath; - for (int i = 0; i < fileList.arity(); ++i) { - e = (OtpErlangTuple) fileList.elementAt(i); - oldPath = (OtpErlangString) e.elementAt(0); - newPath = (OtpErlangString) e.elementAt(1); - final String newContent = OtpErlang.asString(e.elementAt(2)); - - ret.add(new ChangedFile(oldPath.stringValue(), newPath.stringValue(), - newContent)); - } - return ret; - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/internal/AbstractRpcMessage.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/internal/AbstractRpcMessage.java deleted file mode 100644 index 9991793ff8..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/internal/AbstractRpcMessage.java +++ /dev/null @@ -1,97 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.backend.internal; - -import org.erlide.runtime.rpc.RpcResult; -import org.erlide.util.ErlLogger; -import org.erlide.wrangler.refactoring.backend.IRpcMessage; -import org.erlide.wrangler.refactoring.backend.RefactoringState; -import org.erlide.wrangler.refactoring.exception.WranglerException; - -import com.ericsson.otp.erlang.OtpErlangTuple; - -/** - * Abstract class for parsing RpcResultImpl objects - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public abstract class AbstractRpcMessage implements IRpcMessage { - protected RefactoringState refactoringState = RefactoringState.ERROR; - - protected String messageString = ""; - - /** - * Parses the Erlang object and stores the result. - * - * @param result - * input object to be parsed - */ - @Override - public void parse(final RpcResult result) { - try { - if (!result.isOk()) { - org.erlide.util.ErlLogger.error("Erlide communication error: ", result); - setUnsuccessful("Communication error occured, please try again!"); - ErlLogger.error(result.toString()); - return; - } - final OtpErlangTuple resultTuple = (OtpErlangTuple) result.getValue(); - parseRefactoringMessage(resultTuple); - - } catch (final Exception e) { - ErlLogger.error(e); - setUnsuccessful( - "Internal error occured during the refactoring.\nPlease report it!"); - } - } - - protected abstract void parseRefactoringMessage(OtpErlangTuple resultTuple) - throws WranglerException; - - @Override - public String getMessageString() { - return messageString; - } - - @Override - public boolean isSuccessful() { - return refactoringState == RefactoringState.OK; - } - - @Override - public RefactoringState getRefactoringState() { - return refactoringState; - } - - protected void setUnsuccessful(final String errorMsg) { - messageString = errorMsg; - refactoringState = RefactoringState.ERROR; - } - - protected void setWarning(final String message) { - messageString = message; - refactoringState = RefactoringState.WARNING; - } - - protected void setQuestion(final String message) { - messageString = message; - refactoringState = RefactoringState.QUESTION; - } - - protected void setSuccessful() { - messageString = ""; - refactoringState = RefactoringState.OK; - } - - protected void setState(final String message, final RefactoringState state) { - messageString = message; - refactoringState = state; - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/internal/ExpressionPosRpcMessage.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/internal/ExpressionPosRpcMessage.java deleted file mode 100644 index bc676f22ac..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/internal/ExpressionPosRpcMessage.java +++ /dev/null @@ -1,107 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.backend.internal; - -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; - -import org.eclipse.jface.text.IDocument; -import org.erlide.util.ErlLogger; -import org.erlide.wrangler.refactoring.exception.WranglerException; -import org.erlide.wrangler.refactoring.exception.WranglerRpcParsingException; -import org.erlide.wrangler.refactoring.util.ErlRange; -import org.erlide.wrangler.refactoring.util.IErlRange; -import org.erlide.wrangler.refactoring.util.IRange; -import org.erlide.wrangler.refactoring.util.Range; - -import com.ericsson.otp.erlang.OtpErlangList; -import com.ericsson.otp.erlang.OtpErlangObject; -import com.ericsson.otp.erlang.OtpErlangRangeException; -import com.ericsson.otp.erlang.OtpErlangString; -import com.ericsson.otp.erlang.OtpErlangTuple; - -/** - * RpcResultImpl parser which parses object which got from Fold expression refactorings - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class ExpressionPosRpcMessage extends AbstractRpcMessage { - - protected OtpErlangObject syntaxTree; - protected Map positionDefs; - - @Override - protected void parseRefactoringMessage(final OtpErlangTuple resultTuple) - throws WranglerException { - try { - final OtpErlangObject wranglerResult = resultTuple.elementAt(1); - if ("ok".equals(resultTuple.elementAt(0).toString())) { - OtpErlangList posDefList; - if (wranglerResult instanceof OtpErlangTuple) { - syntaxTree = ((OtpErlangTuple) wranglerResult).elementAt(0); - posDefList = (OtpErlangList) ((OtpErlangTuple) wranglerResult) - .elementAt(1); - } else { - syntaxTree = null; - posDefList = (OtpErlangList) wranglerResult; - } - - positionDefs = new HashMap<>(); - final OtpErlangObject[] elements = posDefList.elements(); - for (final OtpErlangObject o : elements) { - final OtpErlangTuple value = (OtpErlangTuple) o; - final OtpErlangTuple pos = (OtpErlangTuple) value.elementAt(0); - try { - positionDefs.put(new Range(pos), value); - } catch (final OtpErlangRangeException e) { - ErlLogger.error(e); - setUnsuccessful("Failed to parse the result!"); - } - } - setSuccessful(); - - } else { - final OtpErlangString errorMsg = (OtpErlangString) wranglerResult; - setUnsuccessful(errorMsg.stringValue()); - } - } catch (final Exception e) { - throw new WranglerRpcParsingException(resultTuple.toString()); - } - - } - - /** - * Returns a syntax tree object which is got from Wrangler - * - * @return syntax tree wrapped in an Erlang object - */ - public OtpErlangObject getSyntaxTree() { - return syntaxTree; - } - - /** - * Returns pairs which represents a selection in a module. - * - * @param doc - * the document which containing the module - * @return selections - */ - public HashMap getPositionDefinitions( - final IDocument doc) { - final HashMap ret = new HashMap<>(); - for (final Entry r : positionDefs.entrySet()) { - ret.put(new ErlRange(r.getKey(), doc), r.getValue()); - } - - return ret; - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/internal/GenFunRefactoringMessage.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/internal/GenFunRefactoringMessage.java deleted file mode 100644 index 5fc235d141..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/internal/GenFunRefactoringMessage.java +++ /dev/null @@ -1,124 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.backend.internal; - -import java.util.HashMap; - -import org.erlide.wrangler.refactoring.backend.RefactoringState; -import org.erlide.wrangler.refactoring.exception.WranglerException; -import org.erlide.wrangler.refactoring.exception.WranglerRpcParsingException; - -import com.ericsson.otp.erlang.OtpErlangList; -import com.ericsson.otp.erlang.OtpErlangObject; -import com.ericsson.otp.erlang.OtpErlangString; -import com.ericsson.otp.erlang.OtpErlangTuple; - -/** - * RpcResultImpl parser class for parsing results of a n generalise function refactoring - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class GenFunRefactoringMessage extends AbstractRefactoringRpcMessage { - - /** - * Generalise function's possible parameters names - * - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ - public enum GenFunReturnParameterName { - //@formatter:off - parName, - funName, - arity, - funDefPos, - exp, - sideEffect, - dupsInFun, - logCmd, - noOfClauses, - dupsInClause - //@formatter:on - } - - @Override - protected void parseRefactoringMessage(final OtpErlangTuple resultTuple) - throws WranglerException { - final OtpErlangObject wranglerResult = resultTuple.elementAt(1); - final String state = resultTuple.elementAt(0).toString(); - if ("ok".equals(state)) { - - if (wranglerResult instanceof OtpErlangList) { - changedFiles = parseFileList((OtpErlangList) wranglerResult); - setSuccessful(); - } - } else if ("error".equals(state)) { - final OtpErlangString msg = (OtpErlangString) wranglerResult; - setUnsuccessful(msg.stringValue()); - - } else if ("multiple_instances".equals(state)) { - parameters = new HashMap<>(); - final OtpErlangTuple pars = (OtpErlangTuple) wranglerResult; - setState("", RefactoringState.MULTI_INSTANCES); - parameters.put(GenFunReturnParameterName.parName, pars.elementAt(0)); - parameters.put(GenFunReturnParameterName.funName, pars.elementAt(1)); - parameters.put(GenFunReturnParameterName.arity, pars.elementAt(2)); - parameters.put(GenFunReturnParameterName.funDefPos, pars.elementAt(3)); - parameters.put(GenFunReturnParameterName.exp, pars.elementAt(4)); - parameters.put(GenFunReturnParameterName.sideEffect, pars.elementAt(5)); - parameters.put(GenFunReturnParameterName.dupsInFun, pars.elementAt(6)); - parameters.put(GenFunReturnParameterName.logCmd, pars.elementAt(7)); - - } else if ("unknown_side_effect".equals(state)) { - parameters = new HashMap<>(); - final OtpErlangTuple pars = (OtpErlangTuple) wranglerResult; - setState("", RefactoringState.UNKNOWN_SIDE_EFFECT); - - parameters.put(GenFunReturnParameterName.parName, pars.elementAt(0)); - parameters.put(GenFunReturnParameterName.funName, pars.elementAt(1)); - parameters.put(GenFunReturnParameterName.arity, pars.elementAt(2)); - parameters.put(GenFunReturnParameterName.funDefPos, pars.elementAt(3)); - parameters.put(GenFunReturnParameterName.exp, pars.elementAt(4)); - parameters.put(GenFunReturnParameterName.noOfClauses, pars.elementAt(5)); - parameters.put(GenFunReturnParameterName.dupsInFun, pars.elementAt(6)); - parameters.put(GenFunReturnParameterName.dupsInClause, pars.elementAt(7)); - parameters.put(GenFunReturnParameterName.logCmd, pars.elementAt(8)); - - } else if ("more_than_one_clause".equals(state)) { - parameters = new HashMap<>(); - final OtpErlangTuple pars = (OtpErlangTuple) wranglerResult; - setState("", RefactoringState.MORE_THAN_ONE_CLAUSE); - - parameters.put(GenFunReturnParameterName.parName, pars.elementAt(0)); - parameters.put(GenFunReturnParameterName.funName, pars.elementAt(1)); - parameters.put(GenFunReturnParameterName.arity, pars.elementAt(2)); - parameters.put(GenFunReturnParameterName.funDefPos, pars.elementAt(3)); - parameters.put(GenFunReturnParameterName.exp, pars.elementAt(4)); - parameters.put(GenFunReturnParameterName.sideEffect, pars.elementAt(5)); - parameters.put(GenFunReturnParameterName.dupsInFun, pars.elementAt(6)); - parameters.put(GenFunReturnParameterName.dupsInClause, pars.elementAt(7)); - parameters.put(GenFunReturnParameterName.logCmd, pars.elementAt(8)); - } else { - throw new WranglerRpcParsingException(resultTuple.toString()); - } - } - - protected HashMap parameters; - - /** - * Get parameters in a map - * - * @return parameter name. value pairs - */ - public HashMap getParameters() { - return parameters; - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/internal/ProcessRpcMessage.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/internal/ProcessRpcMessage.java deleted file mode 100644 index b5339eecdd..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/internal/ProcessRpcMessage.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.backend.internal; - -import org.erlide.wrangler.refactoring.exception.WranglerException; - -import com.ericsson.otp.erlang.OtpErlangList; -import com.ericsson.otp.erlang.OtpErlangObject; -import com.ericsson.otp.erlang.OtpErlangString; -import com.ericsson.otp.erlang.OtpErlangTuple; - -/** - * Rpc message parser for process related refactorings - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class ProcessRpcMessage extends AbstractRefactoringRpcMessage { - - protected boolean hasUndecidables; - - @Override - protected void parseRefactoringMessage(final OtpErlangTuple resultTuple) - throws WranglerException { - final OtpErlangObject wranglerResult = resultTuple.elementAt(1); - if ("ok".equals(resultTuple.elementAt(0).toString())) { - - if (wranglerResult instanceof OtpErlangList) { - changedFiles = parseFileList((OtpErlangList) wranglerResult); - setSuccessful(); - return; - } - } else if ("undecidables".equals(resultTuple.elementAt(0).toString())) { - hasUndecidables = true; - - } - final OtpErlangString errorMsg = (OtpErlangString) wranglerResult; - setUnsuccessful(errorMsg.stringValue()); - - } - - /** - * Returns true if refactoring is unsure... - * - * @return true if is unsure - */ - public boolean hasUndecidables() { - return hasUndecidables; - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/internal/RefactoringRpcMessage.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/internal/RefactoringRpcMessage.java deleted file mode 100644 index ac1a83a132..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/internal/RefactoringRpcMessage.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.backend.internal; - -import org.erlide.wrangler.refactoring.exception.WranglerRpcParsingException; - -import com.ericsson.otp.erlang.OtpErlangList; -import com.ericsson.otp.erlang.OtpErlangObject; -import com.ericsson.otp.erlang.OtpErlangString; -import com.ericsson.otp.erlang.OtpErlangTuple; - -/** - * Simple wrapper class for Wrangler refactorings messages. - * - * Suitable for those refactorings which have a simple state transition containing 4 - * cases. First: refactoring has been called and succeeds. Second: Refactoring fails after - * calling. Third: refactoring returns with warning message, user accepts it and succeeds. - * Fourth: same before but after accepting, refactoring fails. - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class RefactoringRpcMessage extends AbstractRefactoringRpcMessage { - - OtpErlangTuple resultTuple; - - @Override - protected void parseRefactoringMessage(final OtpErlangTuple tuple) - throws WranglerRpcParsingException { - resultTuple = tuple; - - final OtpErlangObject wranglerResult = tuple.elementAt(1); - if ("ok".equals(tuple.elementAt(0).toString())) { - - if (wranglerResult instanceof OtpErlangList) { - changedFiles = parseFileList((OtpErlangList) wranglerResult); - setSuccessful(); - return; - } - } else { - final OtpErlangString msg = (OtpErlangString) wranglerResult; - if ("warning".equals(tuple.elementAt(0).toString())) { - setWarning(msg.stringValue()); - } else if ("question".equals(tuple.elementAt(0).toString())) { - setQuestion(msg.stringValue()); - } else { - setUnsuccessful(msg.stringValue()); - } - return; - } - - throw new WranglerRpcParsingException(tuple.toString()); - - } - - /** - * Returns the raw result object from Wrangler - * - * @return result from Wrangler - */ - public OtpErlangTuple getResultObject() { - return resultTuple; - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/internal/StateDataToRecordRpcMessage.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/internal/StateDataToRecordRpcMessage.java deleted file mode 100644 index ded72a1e66..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/internal/StateDataToRecordRpcMessage.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.backend.internal; - -import org.erlide.wrangler.refactoring.exception.WranglerException; - -import com.ericsson.otp.erlang.OtpErlangLong; -import com.ericsson.otp.erlang.OtpErlangObject; -import com.ericsson.otp.erlang.OtpErlangRangeException; -import com.ericsson.otp.erlang.OtpErlangString; -import com.ericsson.otp.erlang.OtpErlangTuple; - -/** - * RPC message parser class for * State data to record refactorings - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class StateDataToRecordRpcMessage extends AbstractRefactoringRpcMessage { - - protected int fieldCount; - protected OtpErlangObject stateFuns; - - @Override - protected void parseRefactoringMessage(final OtpErlangTuple resultTuple) - throws WranglerException { - - final OtpErlangObject wranglerResult = resultTuple.elementAt(1); - if (!"ok".equals(resultTuple.elementAt(0).toString())) { - final OtpErlangString msg = (OtpErlangString) wranglerResult; - setUnsuccessful(msg.stringValue()); - } else { - if ("non_tuple".equals(wranglerResult.toString())) { - fieldCount = 1; - } else { - try { - fieldCount = ((OtpErlangLong) ((OtpErlangTuple) wranglerResult) - .elementAt(1)).intValue(); - } catch (final OtpErlangRangeException e) { - throw new WranglerException(e.getMessage()); - } - } - stateFuns = resultTuple.elementAt(2); - setSuccessful(); - } - - } - - /** - * Returns the number of fields, which the refactoring will need - * - * @return number of fields - */ - public int getFieldCount() { - return fieldCount; - } - - /** - * Returns StateFun Erlang object - * - * @return statefun - */ - public OtpErlangObject getStateFuns() { - return stateFuns; - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/internal/WranglerBackendManager.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/internal/WranglerBackendManager.java deleted file mode 100644 index afdb549bfd..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/internal/WranglerBackendManager.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.backend.internal; - -import org.erlide.wrangler.refactoring.Activator; -import org.erlide.wrangler.refactoring.backend.WranglerSyntaxBackend; - -/** - * Stores Erlide backends for wrangler , and has interface to access them - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class WranglerBackendManager { - static WranglerRefactoringBackend refactoringBackend; - static WranglerSyntaxBackend syntaxBackend; - - private WranglerBackendManager() { - } - - /** - * Returns an Erlide backend which is used to run Wrangler refactorings - * - * @return Erlide backend - */ - public static WranglerRefactoringBackend getRefactoringBackend() { - if (WranglerBackendManager.refactoringBackend == null) { - WranglerBackendManager.refactoringBackend = new WranglerRefactoringBackend( - Activator.getDefault().getBackend()); - } - return WranglerBackendManager.refactoringBackend; - } - - /** - * Returns an Erlide backend which is used for sending syntax RPCs - * - * @return Erlide backend - */ - public static WranglerSyntaxBackend getSyntaxBackend() { - if (WranglerBackendManager.syntaxBackend == null) { - WranglerBackendManager.syntaxBackend = new WranglerSyntaxBackend( - Activator.getDefault().getBackend()); - } - return WranglerBackendManager.syntaxBackend; - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/internal/WranglerRefactoringBackend.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/internal/WranglerRefactoringBackend.java deleted file mode 100644 index 95f52ebc43..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/internal/WranglerRefactoringBackend.java +++ /dev/null @@ -1,218 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.backend.internal; - -import org.erlide.runtime.rpc.IOtpRpc; -import org.erlide.runtime.rpc.RpcResult; -import org.erlide.util.ErlLogger; -import org.erlide.wrangler.refactoring.backend.IRpcMessage; -import org.erlide.wrangler.refactoring.backend.IWranglerBackend; - -import com.ericsson.otp.erlang.OtpErlangAtom; - -/** - * This class handles the Erlide backends, and holds special ones for Wrangler operations - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class WranglerRefactoringBackend implements IWranglerBackend { - /** - * Wrangler module name - */ - public static final String MODULE = "wrangler_refacs"; - /** - * Wrangler code inspection module name - */ - public static final String INSPECTION_MODULE = "inspec_lib"; - protected static final String RENAME_FUNCTION = "rename_fun_eclipse"; - - protected IOtpRpc backend; - public static final int UNLIMITED_TIMEOUT = Integer.MAX_VALUE; - - /** - * Default constructor - * - * @param backend - * Erlide backend - */ - public WranglerRefactoringBackend(final IOtpRpc backend) { - this.backend = backend; - } - - /** - * Send an RPC, and allow to define a costum parser - * - * @param parser - * parser object - * @param functionName - * function name in wrangler_refacs.erl - * @param signature - * parameters signature - * @param parameters - * parameters array - * @return parsed RPC message - */ - public IRpcMessage callWithParser(final IRpcMessage parser, final String functionName, - final String signature, final Object... parameters) { - final RpcResult res = callWithoutParser(functionName, signature, parameters); - parser.parse(res); - return parser; - } - - /** - * Send an RPC and parses it with the default parser - * - * @param functionName - * function name in wrangler.erl - * @param signature - * parameters signature - * @param parameters - * parameters in an array - * @return parsed RPC message - * @noreference This method is not intended to be referenced by clients. - */ - public AbstractRefactoringRpcMessage call(final String functionName, - final String signature, final Object... parameters) { - final RpcResult res = callWithoutParser(functionName, signature, parameters); - final AbstractRefactoringRpcMessage message = new RefactoringRpcMessage(); - message.parse(res); - return message; - } - - /** - * Call an RPC without a parser - * - * @param functionName - * function name in wrangler_refacs.erl - * @param signature - * parameters signature - * @param parameters - * parameters array - * @return raw RPC result - */ - public RpcResult callWithoutParser(final String functionName, final String signature, - final Object... parameters) { - /* - * ErlLogger .info("Wrangler call: " + makeLogStr(functionName, parameters)); - * RpcResultImpl res = backend.call_noexception(MODULE, functionName, signature, - * parameters); - */ - return callWithoutParser(-1, functionName, signature, parameters); - } - - /** - * Send an RPC without using any RpcResultImpl parser - * - * @param timeout - * timeout for the RPC - * @param functionName - * function name - * @param signature - * signature for the parameters - * @param parameters - * parameters - * @return RpcResultImpl object - */ - public RpcResult callWithoutParser(final int timeout, final String functionName, - final String signature, final Object... parameters) { - ErlLogger.info("Wrangler call: " + makeLogStr(functionName, parameters)); - RpcResult res; - if (timeout < 0) { - res = backend.call_noexception(WranglerRefactoringBackend.MODULE, - functionName, signature, parameters); - } else { - res = backend.call_noexception(timeout, WranglerRefactoringBackend.MODULE, - functionName, signature, parameters); - } - - // ErlLogger.info("Warning: " + err); - return res; - } - - /** - * Call inspection function which returns with boolean values - * - * @param functionName - * function to call - * @param signature - * signature - * @param parameters - * parameters - * @return true if the call was successful, else false - */ - public boolean callSimpleInspection(final String functionName, final String signature, - final Object... parameters) { - ErlLogger.info( - "Wrangler inspection call: " + makeLogStr(functionName, parameters)); - RpcResult res; - res = backend.call_noexception(WranglerRefactoringBackend.UNLIMITED_TIMEOUT, - WranglerRefactoringBackend.INSPECTION_MODULE, functionName, signature, - parameters); - try { - if (res.isOk()) { - final OtpErlangAtom b = (OtpErlangAtom) res.getValue(); - return "true".equals(b.atomValue()) || "ok".equals(b.atomValue()); - } - } catch (final Exception e) { - ErlLogger.error(e); - } - return false; - - } - - /** - * Call an inspection function - * - * @param functionName - * function name - * @param signature - * signature - * @param parameters - * function parameters - * @return RpcResultImpl wrapped result - */ - public RpcResult callInspection(final String functionName, final String signature, - final Object... parameters) { - ErlLogger.info( - "Wrangler inspection call: " + makeLogStr(functionName, parameters)); - RpcResult res; - res = backend.call_noexception(WranglerRefactoringBackend.UNLIMITED_TIMEOUT, - WranglerRefactoringBackend.INSPECTION_MODULE, functionName, signature, - parameters); - return res; - - } - - /** - * Gets logged info (warnings, errors) from Wrangler - * - * @return log list - */ - public RpcResult getLoggedInfo() { - final RpcResult res = backend.call_noexception("wrangler_error_logger", - "get_logged_info", ""); - @SuppressWarnings("unused") - final RpcResult res2 = backend.call_noexception("wrangler_error_logger", - "remove_all_from_logger", ""); - return res; - } - - protected String makeLogStr(final String function, final Object[] parameters) { - String ret = function + "("; - for (final Object o : parameters) { - ret += o.toString(); - ret += ", "; - } - if (ret.endsWith(", ")) { - ret = ret.substring(0, ret.length() - 2); - } - return ret + ")"; - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/CostumWorkflowRefactoring.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/CostumWorkflowRefactoring.java deleted file mode 100644 index 99615834a0..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/CostumWorkflowRefactoring.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.core; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.ltk.core.refactoring.RefactoringStatus; -import org.eclipse.swt.widgets.Shell; -import org.erlide.wrangler.refactoring.backend.IRefactoringRpcMessage; -import org.erlide.wrangler.refactoring.selection.IErlSelection; - -/** - * Abstract class for simple Wrangler refactorings, which needs to communicate with the - * user over the refactoring time. - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public abstract class CostumWorkflowRefactoring extends SimpleWranglerRefactoring { - - protected RefactoringStatus status; - - /** - * Runs an RPC like run() - * - * @param selection - * erlang selection - * @return parsed refactoring message - */ - public abstract IRefactoringRpcMessage runAlternative(IErlSelection selection); - - @Override - public RefactoringStatus checkFinalConditions(final IProgressMonitor pm) - throws CoreException, OperationCanceledException { - return status; - } - - /** - * Returns a worklfow controller object, in which the refactoring behaviour can be - * modified. - * - * @param shell - * shell - * @return refactoring workflow controller - */ - public abstract RefactoringWorkflowController getWorkflowController(Shell shell); - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/CostumWorkflowRefactoringWithPositionsSelection.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/CostumWorkflowRefactoringWithPositionsSelection.java deleted file mode 100644 index 841e824d09..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/CostumWorkflowRefactoringWithPositionsSelection.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.core; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.erlide.wrangler.refactoring.util.IErlRange; - -import com.ericsson.otp.erlang.OtpErlangList; -import com.ericsson.otp.erlang.OtpErlangObject; -import com.ericsson.otp.erlang.OtpErlangTuple; - -/** - * Abstract class for integrating Wrangler refactorings which offer a selection list for - * the user. These selections are tipically code parts. - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public abstract class CostumWorkflowRefactoringWithPositionsSelection - extends CostumWorkflowRefactoring { - - protected Map positions; - protected List selectedPositions; - - /** - * Get those exporessions with positions which can be selected by the user. - * - * @return List of positions - */ - public List getPositions() { - final List ret = new ArrayList<>(positions.keySet()); - return ret; - } - - /** - * Setter method, which offers the ability to set the selected positions. - * - * @param l - * selected positions - */ - public void setSelectedPos(final ArrayList l) { - selectedPositions = l; - } - - protected OtpErlangList getSelectedPos() { - if (selectedPositions == null) { - return new OtpErlangList(); - } - OtpErlangList ret; - final OtpErlangObject[] selection = new OtpErlangObject[selectedPositions.size()]; - - for (int i = 0; i < selectedPositions.size(); ++i) { - selection[i] = positions.get(selectedPositions.get(i)); - } - - ret = new OtpErlangList(selection); - return ret; - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/RefactoringWorkflowController.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/RefactoringWorkflowController.java deleted file mode 100644 index e4dc98b0a1..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/RefactoringWorkflowController.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.core; - -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.swt.widgets.Shell; - -/** - * Class is for controlling costum behaviour of a Wrangler refactoring - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public abstract class RefactoringWorkflowController { - Shell shell; - - /** - * Constructor - * - * @param shell - * shell - */ - public RefactoringWorkflowController(final Shell shell) { - this.shell = shell; - } - - /** - * Call the RPC. - */ - public abstract void doRefactoring(); - - /** - * Abort the refactoring. - */ - public void stop() { - shell.close(); - } - - /** - * Ask a question from the user in an input dialog. - * - * @param title - * dialog title - * @param message - * queestion - * @return true if the answer is yes, else false - */ - public boolean ask(final String title, final String message) { - return MessageDialog.openQuestion(shell, title, message); - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/SimpleOneStepWranglerRefactoring.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/SimpleOneStepWranglerRefactoring.java deleted file mode 100644 index 9c0b4f75fa..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/SimpleOneStepWranglerRefactoring.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.core; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.ltk.core.refactoring.RefactoringStatus; -import org.erlide.wrangler.refactoring.backend.IRefactoringRpcMessage; -import org.erlide.wrangler.refactoring.selection.IErlSelection; -import org.erlide.wrangler.refactoring.util.GlobalParameters; - -/** - * This kind of Refactoring class is used when a refactoring only needs a single input and - * does not have any other interactions. e.g. rename variable - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public abstract class SimpleOneStepWranglerRefactoring extends SimpleWranglerRefactoring { - - /** - * If the refactoring returns with a warning message, wrangler should know that the - * user asked to continue. It is done by calling a function. - * - * @return a refactoring message - */ - // public abstract IRefactoringRpcMessage runAfterWarning(IErlSelection - // sel); - @Override - public RefactoringStatus checkFinalConditions(final IProgressMonitor pm) - throws CoreException, OperationCanceledException { - final IErlSelection sel = GlobalParameters.getWranglerSelection(); - final IRefactoringRpcMessage message = run(sel); - if (message.isSuccessful()) { - changedFiles = message.getRefactoringChangeset(); - return new RefactoringStatus(); - // } else if (message.getRefactoringState() == - // RefactoringState.WARNING) { - // return RefactoringStatus.createWarningStatus(message - // .getMessageString()); - } - return RefactoringStatus.createFatalErrorStatus(message.getMessageString()); - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/SimpleWranglerRefactoring.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/SimpleWranglerRefactoring.java deleted file mode 100644 index 756373bbf8..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/SimpleWranglerRefactoring.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.core; - -/** - * Abstract class for implementing wrangler refactorings which has a simple workflow. - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public abstract class SimpleWranglerRefactoring extends WranglerRefactoring { - - protected String userInput; - - /** - * Most of the refactorings needs an input parameter (e.g. new name). This function is - * for setting this input. - * - * @param userInput - * user input data - */ - public void setUserInput(final String userInput) { - this.userInput = userInput; - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/WranglerRefactoring.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/WranglerRefactoring.java deleted file mode 100644 index 2c5e1ad21f..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/WranglerRefactoring.java +++ /dev/null @@ -1,118 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.core; - -import java.io.IOException; -import java.util.List; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.core.runtime.Status; -import org.eclipse.ltk.core.refactoring.Change; -import org.eclipse.ltk.core.refactoring.CompositeChange; -import org.eclipse.ltk.core.refactoring.Refactoring; -import org.eclipse.ltk.core.refactoring.RefactoringStatus; -import org.erlide.wrangler.refactoring.Activator; -import org.erlide.wrangler.refactoring.backend.ChangedFile; -import org.erlide.wrangler.refactoring.backend.IRefactoringRpcMessage; -import org.erlide.wrangler.refactoring.selection.IErlSelection; -import org.erlide.wrangler.refactoring.util.WranglerUtils; - -/** - * Abstract class for implementing Wrangler refactorings. Implementors should extend this. - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public abstract class WranglerRefactoring extends Refactoring { - protected List changedFiles; - - /** - * @return the changed files by the refactoring - */ - public List getChangedFiles() { - return changedFiles; - } - - /** - * Run the RPC call. Usually only one RPC call is needed, for this, this function is - * used to do the trick. - * - * @param sel - * selected code piece - * @return parsed refactoring message - */ - public abstract IRefactoringRpcMessage run(IErlSelection sel); - - @Override - public abstract RefactoringStatus checkFinalConditions(IProgressMonitor pm) - throws CoreException, OperationCanceledException; - - @Override - public abstract RefactoringStatus checkInitialConditions(IProgressMonitor pm) - throws CoreException, OperationCanceledException; - - @Override - public Change createChange(final IProgressMonitor pm) - throws CoreException, OperationCanceledException { - pm.beginTask("Creating changes", changedFiles.size() + 1); - final CompositeChange change = new CompositeChange(getName()); - pm.internalWorked(1); - - try { - Change c; - for (final ChangedFile e : changedFiles) { - c = e.createChanges(); - if (c != null) { - change.add(c); - pm.internalWorked(1); - } - } - } catch (final IOException e) { - final Status s = new Status(IStatus.ERROR, Activator.PLUGIN_ID, - e.getMessage()); - - throw new CoreException(s); - } finally { - pm.done(); - } - - return change; - } - - @Override - public abstract String getName(); - - /** - * This operation is run after doing the refactoring. - */ - public void doAfterRefactoring() { - WranglerUtils.notifyErlide(getChangedFiles()); - } - - /** - * This operation is run before the refactoring is started. - * - */ - public void doBeforeRefactoring() { - - } - - /** - * Obtains default value of refactored element - * - * @return default (previous) value of refactored element - */ - public String getDefaultValue() { - return ""; - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/ApplyAdhocElemRefactoring.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/ApplyAdhocElemRefactoring.java deleted file mode 100644 index 78e1537920..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/ApplyAdhocElemRefactoring.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.erlide.wrangler.refactoring.core.internal; - -/** - * Logic for running ad hoc user-defined elementary refactorings - * - * @author Aleksandra Lipiec - * @version %I%, %G% - */ -public class ApplyAdhocElemRefactoring extends UserElementaryRefactoring { - - private final UserAdhocRefactoring delegate; // delegate for adhoc specific - - // functionality - - public ApplyAdhocElemRefactoring() { - delegate = new UserAdhocRefactoring(this); - } - - @Override - public String getName() { - return "Apply ad hoc refactoring"; - } - - @Override - public boolean fetchParPrompts() { - if (fetched) { - return true; - } - - return delegate.load() && super.fetchParPrompts(); - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/ApplyUserElementaryRefactoring.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/ApplyUserElementaryRefactoring.java deleted file mode 100644 index 0fe75de1c2..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/ApplyUserElementaryRefactoring.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.erlide.wrangler.refactoring.core.internal; - -/** - * Logic for running user-defined, commited elementary refactrings - * - * @author Aleksandra Lipiec - * @version %I%, %G% - */ -public class ApplyUserElementaryRefactoring extends UserElementaryRefactoring { - - private final String name; // name of the refactoring - - public ApplyUserElementaryRefactoring(final String name, - final String callbackModule) { - this.name = name; - setCallbackModuleName(callbackModule); - } - - @Override - public String getName() { - return name; - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/EqcFsmStateDataToRecordRefactoring.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/EqcFsmStateDataToRecordRefactoring.java deleted file mode 100644 index 8557f25b26..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/EqcFsmStateDataToRecordRefactoring.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.core.internal; - -import org.erlide.wrangler.refactoring.backend.IRefactoringRpcMessage; -import org.erlide.wrangler.refactoring.backend.internal.StateDataToRecordRpcMessage; -import org.erlide.wrangler.refactoring.backend.internal.WranglerBackendManager; -import org.erlide.wrangler.refactoring.selection.IErlMemberSelection; -import org.erlide.wrangler.refactoring.selection.IErlSelection; -import org.erlide.wrangler.refactoring.util.GlobalParameters; - -import com.ericsson.otp.erlang.OtpErlangBoolean; - -/** - * Integration of the eqc_fsm state data to record refactoring - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ - -public class EqcFsmStateDataToRecordRefactoring extends QuickCheckStateRefactoring { - - @Override - public String getName() { - return "eqc_fsm State data to record"; - } - - @Override - protected StateDataToRecordRpcMessage runFirst(final IErlMemberSelection sel) { - final IRefactoringRpcMessage parser = new StateDataToRecordRpcMessage(); - - return (StateDataToRecordRpcMessage) WranglerBackendManager - .getRefactoringBackend().callWithParser(parser, - "eqc_fsm_to_record_eclipse", "sxi", sel.getFilePath(), - sel.getSearchPath(), GlobalParameters.getTabWidth()); - } - - @Override - public IRefactoringRpcMessage run(final IErlSelection sel) { - - return WranglerBackendManager.getRefactoringBackend().call( - "eqc_fsm_to_record_1_eclipse", "ssxxxxi", sel.getFilePath(), - getRecordName(), getFieldsName(), stateFuns, - new OtpErlangBoolean(fieldCount > 1), sel.getSearchPath(), - GlobalParameters.getTabWidth()); - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/EqcStatemStateDataToRecordRefactoring.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/EqcStatemStateDataToRecordRefactoring.java deleted file mode 100644 index 8bd80195cb..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/EqcStatemStateDataToRecordRefactoring.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.core.internal; - -import org.erlide.wrangler.refactoring.backend.IRefactoringRpcMessage; -import org.erlide.wrangler.refactoring.backend.internal.StateDataToRecordRpcMessage; -import org.erlide.wrangler.refactoring.backend.internal.WranglerBackendManager; -import org.erlide.wrangler.refactoring.selection.IErlMemberSelection; -import org.erlide.wrangler.refactoring.selection.IErlSelection; -import org.erlide.wrangler.refactoring.util.GlobalParameters; - -import com.ericsson.otp.erlang.OtpErlangBoolean; - -/** - * Integration of the eqc_statem State Data to record refactoring - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class EqcStatemStateDataToRecordRefactoring extends QuickCheckStateRefactoring { - - @Override - public String getName() { - return "eqc_statem State data to record"; - } - - @Override - public IRefactoringRpcMessage run(final IErlSelection sel) { - - return WranglerBackendManager.getRefactoringBackend().call( - "eqc_statem_to_record_1_eclipse", "ssxxxxi", sel.getFilePath(), - getRecordName(), getFieldsName(), stateFuns, - new OtpErlangBoolean(fieldCount > 1), sel.getSearchPath(), - GlobalParameters.getTabWidth()); - } - - @Override - protected StateDataToRecordRpcMessage runFirst(final IErlMemberSelection sel) { - final IRefactoringRpcMessage parser = new StateDataToRecordRpcMessage(); - - return (StateDataToRecordRpcMessage) WranglerBackendManager - .getRefactoringBackend().callWithParser(parser, - "eqc_statem_to_record_eclipse", "sxi", sel.getFilePath(), - sel.getSearchPath(), GlobalParameters.getTabWidth()); - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/ExtractFunctionRefactoring.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/ExtractFunctionRefactoring.java deleted file mode 100644 index 62e5e07c3b..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/ExtractFunctionRefactoring.java +++ /dev/null @@ -1,108 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.core.internal; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.ltk.core.refactoring.RefactoringStatus; -import org.eclipse.swt.widgets.Shell; -import org.erlide.wrangler.refactoring.backend.IRefactoringRpcMessage; -import org.erlide.wrangler.refactoring.backend.RefactoringState; -import org.erlide.wrangler.refactoring.backend.internal.WranglerBackendManager; -import org.erlide.wrangler.refactoring.core.CostumWorkflowRefactoring; -import org.erlide.wrangler.refactoring.core.RefactoringWorkflowController; -import org.erlide.wrangler.refactoring.selection.IErlMemberSelection; -import org.erlide.wrangler.refactoring.selection.IErlSelection; -import org.erlide.wrangler.refactoring.selection.IErlSelection.SelectionKind; -import org.erlide.wrangler.refactoring.util.GlobalParameters; - -/** - * Extract function refactoring integration class. - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class ExtractFunctionRefactoring extends CostumWorkflowRefactoring { - - @Override - public RefactoringStatus checkInitialConditions(final IProgressMonitor pm) - throws CoreException, OperationCanceledException { - final IErlSelection selection = GlobalParameters.getWranglerSelection(); - - if (!(selection instanceof IErlMemberSelection) - || selection.getKind() != SelectionKind.FUNCTION - && selection.getKind() != SelectionKind.FUNCTION_CLAUSE) { - return RefactoringStatus - .createFatalErrorStatus("Please select an expression!"); - } - - return new RefactoringStatus(); - } - - @Override - public String getName() { - return "Extract function"; - } - - @Override - public IRefactoringRpcMessage run(final IErlSelection selection) { - final IErlMemberSelection sel = (IErlMemberSelection) selection; - return WranglerBackendManager.getRefactoringBackend().call( - "fun_extraction_eclipse", "sxxsi", sel.getFilePath(), - sel.getSelectionRange().getStartPos(), - sel.getSelectionRange().getEndPos(), userInput, - GlobalParameters.getTabWidth()); - - } - - @Override - public RefactoringWorkflowController getWorkflowController(final Shell shell) { - return new RefactoringWorkflowController(shell) { - - @Override - public void doRefactoring() { - final IErlSelection sel = GlobalParameters.getWranglerSelection(); - IRefactoringRpcMessage message = run(sel); - if (message.isSuccessful()) { - changedFiles = message.getRefactoringChangeset(); - status = new RefactoringStatus(); - } else if (message.getRefactoringState() == RefactoringState.WARNING) { - final boolean answer = !ask("Warning", message.getMessageString()); - if (answer) { - message = runAlternative(sel); - if (message.getRefactoringState() == RefactoringState.OK) { - status = new RefactoringStatus(); - } else { - status = RefactoringStatus - .createFatalErrorStatus(message.getMessageString()); - } - } else { - stop(); - } - } else { - status = RefactoringStatus - .createFatalErrorStatus(message.getMessageString()); - } - } - - }; - } - - @Override - public IRefactoringRpcMessage runAlternative(final IErlSelection selection) { - final IErlMemberSelection sel = (IErlMemberSelection) selection; - return WranglerBackendManager.getRefactoringBackend().call( - "fun_extraction_eclipse", "sxxsi", sel.getFilePath(), - sel.getSelectionRange().getStartPos(), - sel.getSelectionRange().getEndPos(), userInput, - GlobalParameters.getTabWidth()); - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/FoldAgainstMacro.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/FoldAgainstMacro.java deleted file mode 100644 index ec9a6237a2..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/FoldAgainstMacro.java +++ /dev/null @@ -1,107 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.core.internal; - -import java.util.ArrayList; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.ltk.core.refactoring.RefactoringStatus; -import org.eclipse.swt.widgets.Shell; -import org.erlide.wrangler.refactoring.backend.IRefactoringRpcMessage; -import org.erlide.wrangler.refactoring.backend.internal.ExpressionPosRpcMessage; -import org.erlide.wrangler.refactoring.backend.internal.WranglerBackendManager; -import org.erlide.wrangler.refactoring.core.CostumWorkflowRefactoringWithPositionsSelection; -import org.erlide.wrangler.refactoring.core.RefactoringWorkflowController; -import org.erlide.wrangler.refactoring.selection.IErlMemberSelection; -import org.erlide.wrangler.refactoring.selection.IErlSelection; -import org.erlide.wrangler.refactoring.util.GlobalParameters; - -import com.ericsson.otp.erlang.OtpErlangObject; - -/** - * Fold against macro refactoring integration - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class FoldAgainstMacro extends CostumWorkflowRefactoringWithPositionsSelection { - protected OtpErlangObject syntaxTree; - - @Override - public RefactoringWorkflowController getWorkflowController(final Shell shell) { - return new RefactoringWorkflowController(shell) { - @Override - public void doRefactoring() { - } - }; - } - - @Override - public IRefactoringRpcMessage runAlternative(final IErlSelection selection) { - return null; - } - - @Override - public RefactoringStatus checkInitialConditions(final IProgressMonitor pm) - throws CoreException, OperationCanceledException { - final IErlSelection selection = GlobalParameters.getWranglerSelection(); - - /* - * if (!((selection instanceof IErlMemberSelection) && (selection .getKind() == - * SelectionKind.FUNCTION || selection.getKind() == - * SelectionKind.FUNCTION_CLAUSE))) return RefactoringStatus - * .createFatalErrorStatus("Please select an expression!"); - */ - - final IErlMemberSelection sel = (IErlMemberSelection) selection; - ExpressionPosRpcMessage m = new ExpressionPosRpcMessage(); - m = (ExpressionPosRpcMessage) WranglerBackendManager.getRefactoringBackend() - .callWithParser(m, "fold_against_macro_eclipse", "siixi", - sel.getFilePath(), sel.getMemberRange().getStartLine(), - sel.getMemberRange().getStartCol(), sel.getSearchPath(), - GlobalParameters.getTabWidth()); - if (m.isSuccessful()) { - syntaxTree = m.getSyntaxTree(); - positions = m.getPositionDefinitions(sel.getDocument()); - selectedPositions = new ArrayList<>(); - } else { - return RefactoringStatus.createFatalErrorStatus(m.getMessageString()); - } - return new RefactoringStatus(); - } - - @Override - public String getName() { - return "Fold against macri definition"; - } - - @Override - public IRefactoringRpcMessage run(final IErlSelection selection) { - final IErlMemberSelection sel = (IErlMemberSelection) selection; - return WranglerBackendManager.getRefactoringBackend().call( - "fold_against_macro_1_eclipse", "sxxxi", sel.getFilePath(), - getSelectedPos(), syntaxTree, sel.getSearchPath(), - GlobalParameters.getTabWidth()); - } - - @Override - public RefactoringStatus checkFinalConditions(final IProgressMonitor pm) - throws CoreException, OperationCanceledException { - final IErlSelection sel = GlobalParameters.getWranglerSelection(); - final IRefactoringRpcMessage message = run(sel); - if (message.isSuccessful()) { - changedFiles = message.getRefactoringChangeset(); - return new RefactoringStatus(); - } - return RefactoringStatus.createFatalErrorStatus(message.getMessageString()); - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/FoldLocalExpressionRefactoring.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/FoldLocalExpressionRefactoring.java deleted file mode 100644 index 0f2292e206..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/FoldLocalExpressionRefactoring.java +++ /dev/null @@ -1,117 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.core.internal; - -import java.util.ArrayList; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.ltk.core.refactoring.RefactoringStatus; -import org.eclipse.swt.widgets.Shell; -import org.erlide.wrangler.refactoring.backend.IRefactoringRpcMessage; -import org.erlide.wrangler.refactoring.backend.internal.ExpressionPosRpcMessage; -import org.erlide.wrangler.refactoring.backend.internal.WranglerBackendManager; -import org.erlide.wrangler.refactoring.core.CostumWorkflowRefactoringWithPositionsSelection; -import org.erlide.wrangler.refactoring.core.RefactoringWorkflowController; -import org.erlide.wrangler.refactoring.selection.IErlMemberSelection; -import org.erlide.wrangler.refactoring.selection.IErlSelection; -import org.erlide.wrangler.refactoring.selection.IErlSelection.SelectionKind; -import org.erlide.wrangler.refactoring.util.GlobalParameters; - -import com.ericsson.otp.erlang.OtpErlangObject; - -/** - * Fold expression against local function refactoring integrations - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class FoldLocalExpressionRefactoring - extends CostumWorkflowRefactoringWithPositionsSelection { - - protected OtpErlangObject syntaxTree; - - /** - * Preprocessing the file(s), and finding the candidates to fold. - */ - @Override - public RefactoringStatus checkInitialConditions(final IProgressMonitor pm) - throws CoreException, OperationCanceledException { - - final IErlSelection selection = GlobalParameters.getWranglerSelection(); - - if (!(selection instanceof IErlMemberSelection) - || selection.getKind() != SelectionKind.FUNCTION - && selection.getKind() != SelectionKind.FUNCTION_CLAUSE) { - return RefactoringStatus - .createFatalErrorStatus("Please select an expression!"); - } - - final IErlMemberSelection sel = (IErlMemberSelection) selection; - ExpressionPosRpcMessage m = new ExpressionPosRpcMessage(); - m = (ExpressionPosRpcMessage) WranglerBackendManager.getRefactoringBackend() - .callWithParser(m, "fold_expr_by_loc_eclipse", "siixi", sel.getFilePath(), - sel.getMemberRange().getStartLine(), - sel.getMemberRange().getStartCol(), sel.getSearchPath(), - GlobalParameters.getTabWidth()); - if (m.isSuccessful()) { - syntaxTree = m.getSyntaxTree(); - positions = m.getPositionDefinitions(sel.getDocument()); - selectedPositions = new ArrayList<>(); - } else { - return RefactoringStatus.createFatalErrorStatus(m.getMessageString()); - } - return new RefactoringStatus(); - - } - - @Override - public String getName() { - return "Fold expression"; - } - - /** - * Fold the selected expression(s). - */ - @Override - public IRefactoringRpcMessage run(final IErlSelection selection) { - final IErlMemberSelection sel = (IErlMemberSelection) selection; - return WranglerBackendManager.getRefactoringBackend().call("fold_expr_1_eclipse", - "sxxxi", sel.getFilePath(), syntaxTree, getSelectedPos(), - sel.getSearchPath(), GlobalParameters.getTabWidth()); - } - - @Override - public RefactoringWorkflowController getWorkflowController(final Shell shell) { - return new RefactoringWorkflowController(shell) { - @Override - public void doRefactoring() { - } - }; - } - - @Override - public IRefactoringRpcMessage runAlternative(final IErlSelection selection) { - return null; - } - - @Override - public RefactoringStatus checkFinalConditions(final IProgressMonitor pm) - throws CoreException, OperationCanceledException { - final IErlSelection sel = GlobalParameters.getWranglerSelection(); - final IRefactoringRpcMessage message = run(sel); - if (message.isSuccessful()) { - changedFiles = message.getRefactoringChangeset(); - return new RefactoringStatus(); - } - return RefactoringStatus.createFatalErrorStatus(message.getMessageString()); - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/FoldRemoteExpressionRefactoring.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/FoldRemoteExpressionRefactoring.java deleted file mode 100644 index e79c1a3cac..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/FoldRemoteExpressionRefactoring.java +++ /dev/null @@ -1,133 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.core.internal; - -import java.util.ArrayList; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.ltk.core.refactoring.RefactoringStatus; -import org.eclipse.swt.widgets.Shell; -import org.erlide.engine.ErlangEngine; -import org.erlide.engine.model.erlang.IErlFunction; -import org.erlide.engine.model.erlang.IErlFunctionClause; -import org.erlide.wrangler.refactoring.backend.IRefactoringRpcMessage; -import org.erlide.wrangler.refactoring.backend.internal.ExpressionPosRpcMessage; -import org.erlide.wrangler.refactoring.backend.internal.WranglerBackendManager; -import org.erlide.wrangler.refactoring.core.CostumWorkflowRefactoringWithPositionsSelection; -import org.erlide.wrangler.refactoring.core.RefactoringWorkflowController; -import org.erlide.wrangler.refactoring.selection.IErlMemberSelection; -import org.erlide.wrangler.refactoring.selection.IErlSelection; -import org.erlide.wrangler.refactoring.util.GlobalParameters; - -import com.ericsson.otp.erlang.OtpErlangObject; - -/** - * Fold expression against remote function refactoring integration - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class FoldRemoteExpressionRefactoring - extends CostumWorkflowRefactoringWithPositionsSelection { - - // the selected module, on which, the refactoring will be applied - private final IErlMemberSelection selection; - // the selected function clause, which is applied on the module - private final IErlFunctionClause functionClause; - protected OtpErlangObject syntaxTree; - - /** - * Constructor - * - * @param functionClause - * selected function clause, which against should be folded - * @param selection - * the current position in the actual file, when the refactoring was - * started - */ - public FoldRemoteExpressionRefactoring(final IErlFunctionClause functionClause, - final IErlMemberSelection selection) { - this.functionClause = functionClause; - this.selection = selection; - } - - @Override - public RefactoringWorkflowController getWorkflowController(final Shell shell) { - return null; - } - - @Override - public IRefactoringRpcMessage runAlternative(final IErlSelection theSelection) { - return null; - } - - @Override - public RefactoringStatus checkInitialConditions(final IProgressMonitor pm) - throws CoreException, OperationCanceledException { - if (functionClause == null) { - return RefactoringStatus - .createFatalErrorStatus("No function clause was given!"); - } - ExpressionPosRpcMessage m = new ExpressionPosRpcMessage(); - final String path = selection.getFilePath(); - final String moduleName = ErlangEngine.getInstance().getModelUtilService() - .getModule(functionClause).getModuleName(); - final String functionName = functionClause.getFunctionName(); - final int arity = functionClause.getArity(); - - int clauseIndex = 1; - if (!(functionClause instanceof IErlFunction)) { - clauseIndex = Integer.valueOf(functionClause.getName().substring(1)); - } - - m = (ExpressionPosRpcMessage) WranglerBackendManager.getRefactoringBackend() - .callWithParser(m, "fold_expr_by_name_eclipse", "sssiixi", path, - moduleName, functionName, arity, clauseIndex, - selection.getSearchPath(), GlobalParameters.getTabWidth()); - - if (m.isSuccessful()) { - syntaxTree = m.getSyntaxTree(); - // TODO: store positions, selectedpositions - positions = m.getPositionDefinitions(selection.getDocument()); - selectedPositions = new ArrayList<>(); - } else { - return RefactoringStatus.createFatalErrorStatus(m.getMessageString()); - } - - return new RefactoringStatus(); - } - - @Override - public String getName() { - return "Fold expression"; - } - - @Override - public RefactoringStatus checkFinalConditions(final IProgressMonitor pm) - throws CoreException, OperationCanceledException { - final IErlSelection sel = GlobalParameters.getWranglerSelection(); - final IRefactoringRpcMessage message = run(sel); - if (message.isSuccessful()) { - changedFiles = message.getRefactoringChangeset(); - return new RefactoringStatus(); - } - return RefactoringStatus.createFatalErrorStatus(message.getMessageString()); - } - - @Override - public IRefactoringRpcMessage run(final IErlSelection theSelection) { - final IErlMemberSelection sel = (IErlMemberSelection) theSelection; - return WranglerBackendManager.getRefactoringBackend().call("fold_expr_1_eclipse", - "sxxxi", sel.getFilePath(), syntaxTree, getSelectedPos(), - sel.getSearchPath(), GlobalParameters.getTabWidth()); - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/FunctionToProcessRefactoring.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/FunctionToProcessRefactoring.java deleted file mode 100644 index 36d25c5385..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/FunctionToProcessRefactoring.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.core.internal; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.ltk.core.refactoring.RefactoringStatus; -import org.erlide.wrangler.refactoring.backend.IRefactoringRpcMessage; -import org.erlide.wrangler.refactoring.backend.internal.ProcessRpcMessage; -import org.erlide.wrangler.refactoring.backend.internal.WranglerBackendManager; -import org.erlide.wrangler.refactoring.selection.IErlMemberSelection; -import org.erlide.wrangler.refactoring.selection.IErlSelection; -import org.erlide.wrangler.refactoring.selection.IErlSelection.SelectionKind; -import org.erlide.wrangler.refactoring.util.GlobalParameters; - -/** - * Function to process refactoring integration - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class FunctionToProcessRefactoring extends ProcessRelatedRefactoring { - - @Override - public RefactoringStatus checkInitialConditions(final IProgressMonitor pm) - throws CoreException, OperationCanceledException { - final IErlSelection sel = GlobalParameters.getWranglerSelection(); - if (sel instanceof IErlMemberSelection) { - final SelectionKind kind = sel.getKind(); - if (kind == SelectionKind.FUNCTION_CLAUSE || kind == SelectionKind.FUNCTION) { - return new RefactoringStatus(); - } - } - return RefactoringStatus.createFatalErrorStatus("Please select a function!"); - } - - @Override - protected ProcessRpcMessage checkUndecidables(final IErlMemberSelection sel) { - return (ProcessRpcMessage) WranglerBackendManager.getRefactoringBackend() - .callWithParser(new ProcessRpcMessage(), "fun_to_process_eclipse", - "siisxi", sel.getFilePath(), - sel.getSelectionRange().getStartLine(), - sel.getSelectionRange().getStartCol(), userInput, - sel.getSearchPath(), GlobalParameters.getTabWidth()); - } - - @Override - protected String getUndecidableWarningMessage() { - return "There are undecidable cases."; - } - - @Override - public String getName() { - return "Convert function to process"; - } - - @Override - public IRefactoringRpcMessage run(final IErlSelection selection) { - final IErlMemberSelection sel = (IErlMemberSelection) selection; - return WranglerBackendManager.getRefactoringBackend().call( - "fun_to_process_1_eclipse", "siisxi", sel.getFilePath(), - sel.getMemberRange().getStartLine(), sel.getMemberRange().getStartCol(), - userInput, sel.getSearchPath(), GlobalParameters.getTabWidth()); - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/GenFsmStateDataToRecordRefactoring.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/GenFsmStateDataToRecordRefactoring.java deleted file mode 100644 index 2df9102dbd..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/GenFsmStateDataToRecordRefactoring.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.core.internal; - -import org.erlide.wrangler.refactoring.backend.IRefactoringRpcMessage; -import org.erlide.wrangler.refactoring.backend.internal.StateDataToRecordRpcMessage; -import org.erlide.wrangler.refactoring.backend.internal.WranglerBackendManager; -import org.erlide.wrangler.refactoring.selection.IErlMemberSelection; -import org.erlide.wrangler.refactoring.selection.IErlSelection; -import org.erlide.wrangler.refactoring.util.GlobalParameters; - -import com.ericsson.otp.erlang.OtpErlangBoolean; - -/** - * Integration of the gen_fsm state data to record refactoring - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class GenFsmStateDataToRecordRefactoring extends QuickCheckStateRefactoring { - - @Override - public String getName() { - return "gen_fsm State data to record"; - } - - @Override - protected StateDataToRecordRpcMessage runFirst(final IErlMemberSelection sel) { - final IRefactoringRpcMessage parser = new StateDataToRecordRpcMessage(); - - return (StateDataToRecordRpcMessage) WranglerBackendManager - .getRefactoringBackend().callWithParser(parser, - "gen_fsm_to_record_eclipse", "sxi", sel.getFilePath(), - sel.getSearchPath(), GlobalParameters.getTabWidth()); - } - - @Override - public IRefactoringRpcMessage run(final IErlSelection sel) { - - return WranglerBackendManager.getRefactoringBackend().call( - "gen_fsm_to_record_1_eclipse", "ssxxxxi", sel.getFilePath(), - getRecordName(), getFieldsName(), stateFuns, - new OtpErlangBoolean(fieldCount > 1), sel.getSearchPath(), - GlobalParameters.getTabWidth()); - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/GeneraliseFunctionRefactoring.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/GeneraliseFunctionRefactoring.java deleted file mode 100644 index 538dd627ee..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/GeneraliseFunctionRefactoring.java +++ /dev/null @@ -1,273 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.core.internal; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.ltk.core.refactoring.RefactoringStatus; -import org.eclipse.swt.widgets.Shell; -import org.erlide.util.ErlLogger; -import org.erlide.wrangler.refactoring.backend.IRefactoringRpcMessage; -import org.erlide.wrangler.refactoring.backend.internal.GenFunRefactoringMessage; -import org.erlide.wrangler.refactoring.backend.internal.GenFunRefactoringMessage.GenFunReturnParameterName; -import org.erlide.wrangler.refactoring.backend.internal.WranglerBackendManager; -import org.erlide.wrangler.refactoring.core.CostumWorkflowRefactoringWithPositionsSelection; -import org.erlide.wrangler.refactoring.core.RefactoringWorkflowController; -import org.erlide.wrangler.refactoring.selection.IErlMemberSelection; -import org.erlide.wrangler.refactoring.selection.IErlSelection; -import org.erlide.wrangler.refactoring.util.ErlRange; -import org.erlide.wrangler.refactoring.util.GlobalParameters; -import org.erlide.wrangler.refactoring.util.IErlRange; -import org.erlide.wrangler.refactoring.util.Range; - -import com.ericsson.otp.erlang.OtpErlangBoolean; -import com.ericsson.otp.erlang.OtpErlangException; -import com.ericsson.otp.erlang.OtpErlangList; -import com.ericsson.otp.erlang.OtpErlangObject; -import com.ericsson.otp.erlang.OtpErlangTuple; - -/** - * Integration class of the generalise function refactoring - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class GeneraliseFunctionRefactoring - extends CostumWorkflowRefactoringWithPositionsSelection { - - /** - * The state of the generalise function refactoring, after calling the first RPC - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ - public enum State { - ok, error, multi_instance, unknown_side_effect, more_than_one_clause - } - - private final State state; - private String errorMessage; - private GenFunRefactoringMessage message; - - private boolean onlyInClause; - private boolean sideEffect; - - /** - * Constructor - * - * @param state - * state of the refactoring - * @param text - * error message in case of wrong input - */ - public GeneraliseFunctionRefactoring(final State state, final String text) { - this.state = state; - errorMessage = text; - - } - - /** - * Constructor - * - * @param state - * state of the refactoring - * @param message - * RPC message from Wrangler - */ - public GeneraliseFunctionRefactoring(final State state, - final GenFunRefactoringMessage message) { - this.state = state; - this.message = message; - } - - /** - * Constructor - * - * @param state - * state of the refactoring - * @param message - * RPC message from Wrangler - * @param onlyInClause - * user input - */ - public GeneraliseFunctionRefactoring(final State state, - final GenFunRefactoringMessage message, final boolean onlyInClause) { - this(state, message); - this.onlyInClause = onlyInClause; - } - - /** - * Constructor - * - * @param state - * state of the refactoring - * @param message - * RPC message from Wrangler - * @param onlyInClause - * user input - * @param sideEffect - * user input - */ - public GeneraliseFunctionRefactoring(final State state, - final GenFunRefactoringMessage message, final boolean onlyInClause, - final boolean sideEffect) { - this(state, message, onlyInClause); - this.sideEffect = sideEffect; - - } - - /* - * public GeneraliseFunctionRefactoring(State state) { } - */ - - @Override - public RefactoringStatus checkInitialConditions(final IProgressMonitor pm) - throws CoreException, OperationCanceledException { - if (state == State.error) { - return RefactoringStatus.createFatalErrorStatus(errorMessage); - } else if (state == State.multi_instance) { - positions = createPositionList((OtpErlangList) message.getParameters() - .get(GenFunReturnParameterName.dupsInFun)); - } else if (state == State.more_than_one_clause - || state == State.unknown_side_effect) { - if (onlyInClause) { - positions = createPositionList((OtpErlangList) message.getParameters() - .get(GenFunReturnParameterName.dupsInClause)); - } else { - positions = createPositionList((OtpErlangList) message.getParameters() - .get(GenFunReturnParameterName.dupsInFun)); - } - } - return new RefactoringStatus(); - } - - /** - * Returns IErlRange, OtpErlangTuple pairs, which are represents the same position in - * a module - * - * @param thePositions - * @return - */ - protected HashMap createPositionList( - final OtpErlangList thePositions) { - try { - final HashMap ret = new HashMap<>(); - final IErlMemberSelection sel = (IErlMemberSelection) GlobalParameters - .getWranglerSelection(); - for (final OtpErlangObject o : thePositions) { - // {{sl, sc}, {el,ec}} - final OtpErlangTuple pos = (OtpErlangTuple) o; - ret.put(new ErlRange(new Range(pos), sel.getDocument()), pos); - } - - return ret; - } catch (final OtpErlangException e) { - ErlLogger.error(e); - return null; - } - } - - @Override - public String getName() { - return "Generalise function definition"; - } - - @Override - public IRefactoringRpcMessage run(final IErlSelection sel) { - - if (state == State.ok) { - return message; - } else if (state == State.error) { - } else { - final Map p = message - .getParameters(); - OtpErlangObject sideEffectPar; - OtpErlangObject parName; - OtpErlangObject funName; - OtpErlangObject arity; - OtpErlangObject funDefPos; - OtpErlangObject exp; - OtpErlangObject logCmd; - sideEffectPar = p.get(GenFunReturnParameterName.sideEffect); - parName = p.get(GenFunReturnParameterName.parName); - funName = p.get(GenFunReturnParameterName.funName); - arity = p.get(GenFunReturnParameterName.arity); - funDefPos = p.get(GenFunReturnParameterName.funDefPos); - exp = p.get(GenFunReturnParameterName.exp); - logCmd = p.get(GenFunReturnParameterName.logCmd); - if (state == State.multi_instance) { - return WranglerBackendManager.getRefactoringBackend().call( - "gen_fun_1_eclipse", "xsxxxxxxxix", sideEffectPar, - sel.getFilePath(), parName, funName, arity, funDefPos, exp, - getSelectedPos(), sel.getSearchPath(), - GlobalParameters.getTabWidth(), logCmd); - } else if (state == State.unknown_side_effect) { - if (onlyInClause) { - return WranglerBackendManager.getRefactoringBackend().call( - "gen_fun_clause_eclipse", "sxxxxxixxx", sel.getFilePath(), - parName, funName, arity, funDefPos, exp, - GlobalParameters.getTabWidth(), - new OtpErlangBoolean(sideEffect), getSelectedPos(), logCmd); - } - return WranglerBackendManager.getRefactoringBackend().call( - "gen_fun_1_eclipse", "xsxxxxxxxix", - new OtpErlangBoolean(sideEffect), sel.getFilePath(), parName, - funName, arity, funDefPos, exp, getSelectedPos(), - sel.getSearchPath(), GlobalParameters.getTabWidth(), logCmd); - } else if (state == State.more_than_one_clause) { - if (onlyInClause) { - return WranglerBackendManager.getRefactoringBackend().call( - "gen_fun_clause_eclipse", "sxxxxxixxx", sel.getFilePath(), - parName, funName, arity, funDefPos, exp, - GlobalParameters.getTabWidth(), sideEffectPar, - getSelectedPos(), logCmd); - } - return WranglerBackendManager.getRefactoringBackend().call( - "gen_fun_1_eclipse", "xsxxxxxxxix", sideEffectPar, - sel.getFilePath(), parName, funName, arity, funDefPos, exp, - getSelectedPos(), sel.getSearchPath(), - GlobalParameters.getTabWidth(), logCmd); - } - } - - return null; - - } - - @Override - public RefactoringStatus checkFinalConditions(final IProgressMonitor pm) - throws CoreException, OperationCanceledException { - final IErlSelection sel = GlobalParameters.getWranglerSelection(); - final IRefactoringRpcMessage theMessage = run(sel); - if (theMessage.isSuccessful()) { - changedFiles = theMessage.getRefactoringChangeset(); - return new RefactoringStatus(); - } - return RefactoringStatus.createFatalErrorStatus(theMessage.getMessageString()); - } - - @Override - public RefactoringWorkflowController getWorkflowController(final Shell shell) { - return new RefactoringWorkflowController(shell) { - @Override - public void doRefactoring() { - } - }; - } - - @Override - public IRefactoringRpcMessage runAlternative(final IErlSelection selection) { - return null; - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/IntroduceLetRefactoring.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/IntroduceLetRefactoring.java deleted file mode 100644 index 51bd479997..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/IntroduceLetRefactoring.java +++ /dev/null @@ -1,108 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.core.internal; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.ltk.core.refactoring.RefactoringStatus; -import org.eclipse.swt.widgets.Shell; -import org.erlide.wrangler.refactoring.backend.IRefactoringRpcMessage; -import org.erlide.wrangler.refactoring.backend.RefactoringState; -import org.erlide.wrangler.refactoring.backend.internal.RefactoringRpcMessage; -import org.erlide.wrangler.refactoring.backend.internal.WranglerBackendManager; -import org.erlide.wrangler.refactoring.core.CostumWorkflowRefactoring; -import org.erlide.wrangler.refactoring.core.RefactoringWorkflowController; -import org.erlide.wrangler.refactoring.selection.IErlMemberSelection; -import org.erlide.wrangler.refactoring.selection.IErlSelection; -import org.erlide.wrangler.refactoring.util.GlobalParameters; - -import com.ericsson.otp.erlang.OtpErlangObject; -import com.ericsson.otp.erlang.OtpErlangTuple; - -/** - * Introduce ?LET expression refactoring integration - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class IntroduceLetRefactoring extends CostumWorkflowRefactoring { - - OtpErlangObject expr; - OtpErlangObject parentExpr; - - @Override - public RefactoringStatus checkInitialConditions(final IProgressMonitor pm) - throws CoreException, OperationCanceledException { - // FIXME: what are the preconditions? add them! - return new RefactoringStatus(); - } - - @Override - public String getName() { - return "Introduce ?LET"; - } - - @Override - public IRefactoringRpcMessage run(final IErlSelection selection) { - final IErlMemberSelection sel = (IErlMemberSelection) selection; - return WranglerBackendManager.getRefactoringBackend().call("new_let_eclipse", - "sxxsxi", sel.getFilePath(), sel.getSelectionRange().getStartPos(), - sel.getSelectionRange().getEndPos(), userInput, sel.getSearchPath(), - GlobalParameters.getTabWidth()); - } - - @Override - public RefactoringWorkflowController getWorkflowController(final Shell shell) { - return new RefactoringWorkflowController(shell) { - - @Override - public void doRefactoring() { - final IErlSelection sel = GlobalParameters.getWranglerSelection(); - RefactoringRpcMessage message = (RefactoringRpcMessage) run(sel); - if (message.isSuccessful()) { - changedFiles = message.getRefactoringChangeset(); - status = new RefactoringStatus(); - } else if (message.getRefactoringState() == RefactoringState.QUESTION) { - if (ask("Question", message.getMessageString())) { - final OtpErlangTuple res = message.getResultObject(); - expr = ((OtpErlangTuple) res.elementAt(2)).elementAt(0); - parentExpr = ((OtpErlangTuple) res.elementAt(2)).elementAt(1); - message = (RefactoringRpcMessage) runAlternative(sel); - if (message.isSuccessful()) { - status = new RefactoringStatus(); - changedFiles = message.getRefactoringChangeset(); - } else { - status = RefactoringStatus - .createFatalErrorStatus(message.getMessageString()); - } - } else { - status = RefactoringStatus.createFatalErrorStatus( - "Refactoring failed: the expression selected is not a QuickCheck generator."); - } - - } else if (message.getRefactoringState() == RefactoringState.ERROR) { - status = RefactoringStatus - .createFatalErrorStatus(message.getMessageString()); - } - - } - - }; - } - - @Override - public IRefactoringRpcMessage runAlternative(final IErlSelection selection) { - final IErlMemberSelection sel = (IErlMemberSelection) selection; - return WranglerBackendManager.getRefactoringBackend().call("new_let_1_eclipse", - "ssxxxi", sel.getFilePath(), userInput, expr, parentExpr, - sel.getSearchPath(), GlobalParameters.getTabWidth()); - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/IntroduceMacroRefactoring.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/IntroduceMacroRefactoring.java deleted file mode 100644 index 2fab1a48c9..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/IntroduceMacroRefactoring.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.core.internal; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.ltk.core.refactoring.RefactoringStatus; -import org.erlide.wrangler.refactoring.backend.IRefactoringRpcMessage; -import org.erlide.wrangler.refactoring.backend.internal.WranglerBackendManager; -import org.erlide.wrangler.refactoring.core.SimpleOneStepWranglerRefactoring; -import org.erlide.wrangler.refactoring.selection.IErlMemberSelection; -import org.erlide.wrangler.refactoring.selection.IErlSelection; -import org.erlide.wrangler.refactoring.util.GlobalParameters; - -/** - * Integration of the Introduce macro refactoring - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class IntroduceMacroRefactoring extends SimpleOneStepWranglerRefactoring { - - @Override - public RefactoringStatus checkInitialConditions(final IProgressMonitor pm) - throws CoreException, OperationCanceledException { - // Guess, no initial condition - return new RefactoringStatus(); - } - - @Override - public String getName() { - return "Introduce macro"; - } - - @Override - public IRefactoringRpcMessage run(final IErlSelection selection) { - final IErlMemberSelection sel = (IErlMemberSelection) selection; - // TODO: extend it - - return WranglerBackendManager.getRefactoringBackend().call("new_macro_eclipse", - "sxxsxi", sel.getFilePath(), sel.getSelectionRange().getStartPos(), - sel.getSelectionRange().getEndPos(), userInput, sel.getSearchPath(), - GlobalParameters.getTabWidth()); - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/IntroduceNewVariableRefactoring.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/IntroduceNewVariableRefactoring.java deleted file mode 100644 index 6280245ab4..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/IntroduceNewVariableRefactoring.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.erlide.wrangler.refactoring.core.internal; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.ltk.core.refactoring.RefactoringStatus; -import org.erlide.wrangler.refactoring.backend.IRefactoringRpcMessage; -import org.erlide.wrangler.refactoring.backend.internal.WranglerBackendManager; -import org.erlide.wrangler.refactoring.core.SimpleOneStepWranglerRefactoring; -import org.erlide.wrangler.refactoring.selection.IErlMemberSelection; -import org.erlide.wrangler.refactoring.selection.IErlSelection; -import org.erlide.wrangler.refactoring.util.GlobalParameters; - -public class IntroduceNewVariableRefactoring extends SimpleOneStepWranglerRefactoring { - - @Override - public IRefactoringRpcMessage run(final IErlSelection selection) { - final IErlMemberSelection sel = (IErlMemberSelection) selection; - return WranglerBackendManager.getRefactoringBackend().call( - "intro_new_var_eclipse", "sxxsxi", sel.getFilePath(), - sel.getSelectionRange().getStartPos(), - sel.getSelectionRange().getEndPos(), userInput, sel.getSearchPath(), - GlobalParameters.getTabWidth()); - } - - @Override - public RefactoringStatus checkInitialConditions(final IProgressMonitor pm) - throws CoreException, OperationCanceledException { - final IErlSelection sel = GlobalParameters.getWranglerSelection(); - if (sel instanceof IErlMemberSelection) { - return new RefactoringStatus(); - } - - return RefactoringStatus.createFatalErrorStatus("Please select an expression!"); - } - - @Override - public String getName() { - return "Introduce new variable"; - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/MergeForAllRefactoring.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/MergeForAllRefactoring.java deleted file mode 100644 index ebc5adc3ae..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/MergeForAllRefactoring.java +++ /dev/null @@ -1,99 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.core.internal; - -import java.util.ArrayList; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.ltk.core.refactoring.RefactoringStatus; -import org.eclipse.swt.widgets.Shell; -import org.erlide.wrangler.refactoring.backend.IRefactoringRpcMessage; -import org.erlide.wrangler.refactoring.backend.internal.ExpressionPosRpcMessage; -import org.erlide.wrangler.refactoring.backend.internal.WranglerBackendManager; -import org.erlide.wrangler.refactoring.core.CostumWorkflowRefactoringWithPositionsSelection; -import org.erlide.wrangler.refactoring.core.RefactoringWorkflowController; -import org.erlide.wrangler.refactoring.selection.IErlMemberSelection; -import org.erlide.wrangler.refactoring.selection.IErlSelection; -import org.erlide.wrangler.refactoring.util.GlobalParameters; - -/** - * Integration for the Merge ?FORALL refactoring - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class MergeForAllRefactoring - extends CostumWorkflowRefactoringWithPositionsSelection { - @Override - public RefactoringWorkflowController getWorkflowController(final Shell shell) { - return new RefactoringWorkflowController(shell) { - @Override - public void doRefactoring() { - } - }; - } - - @Override - public String getName() { - return "Merge ?FORALL refactoring"; - } - - @Override - public RefactoringStatus checkFinalConditions(final IProgressMonitor pm) - throws CoreException, OperationCanceledException { - final IErlSelection sel = GlobalParameters.getWranglerSelection(); - final IRefactoringRpcMessage message = run(sel); - if (message.isSuccessful()) { - changedFiles = message.getRefactoringChangeset(); - return new RefactoringStatus(); - } - return RefactoringStatus.createFatalErrorStatus(message.getMessageString()); - } - - @Override - public IRefactoringRpcMessage runAlternative(final IErlSelection selection) { - return null; - } - - @Override - public RefactoringStatus checkInitialConditions(final IProgressMonitor pm) - throws CoreException, OperationCanceledException { - final IErlSelection selection = GlobalParameters.getWranglerSelection(); - - /* - * if (!((selection instanceof IErlMemberSelection) && (selection .getKind() == - * SelectionKind.FUNCTION || selection.getKind() == - * SelectionKind.FUNCTION_CLAUSE))) return RefactoringStatus - * .createFatalErrorStatus("Please select an expression!"); - */ - - final IErlMemberSelection sel = (IErlMemberSelection) selection; - ExpressionPosRpcMessage m = new ExpressionPosRpcMessage(); - m = (ExpressionPosRpcMessage) WranglerBackendManager.getRefactoringBackend() - .callWithParser(m, "merge_forall_eclipse", "sxi", sel.getFilePath(), - sel.getSearchPath(), GlobalParameters.getTabWidth()); - if (m.isSuccessful()) { - positions = m.getPositionDefinitions(sel.getDocument()); - selectedPositions = new ArrayList<>(); - } else { - return RefactoringStatus.createFatalErrorStatus(m.getMessageString()); - } - return new RefactoringStatus(); - } - - @Override - public IRefactoringRpcMessage run(final IErlSelection selection) { - final IErlMemberSelection sel = (IErlMemberSelection) selection; - return WranglerBackendManager.getRefactoringBackend().call( - "merge_forall_1_eclipse", "sxxi", sel.getFilePath(), getSelectedPos(), - sel.getSearchPath(), GlobalParameters.getTabWidth()); - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/MergeLetRefactoring.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/MergeLetRefactoring.java deleted file mode 100644 index cc76b61251..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/MergeLetRefactoring.java +++ /dev/null @@ -1,99 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.core.internal; - -import java.util.ArrayList; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.ltk.core.refactoring.RefactoringStatus; -import org.eclipse.swt.widgets.Shell; -import org.erlide.wrangler.refactoring.backend.IRefactoringRpcMessage; -import org.erlide.wrangler.refactoring.backend.internal.ExpressionPosRpcMessage; -import org.erlide.wrangler.refactoring.backend.internal.WranglerBackendManager; -import org.erlide.wrangler.refactoring.core.CostumWorkflowRefactoringWithPositionsSelection; -import org.erlide.wrangler.refactoring.core.RefactoringWorkflowController; -import org.erlide.wrangler.refactoring.selection.IErlMemberSelection; -import org.erlide.wrangler.refactoring.selection.IErlSelection; -import org.erlide.wrangler.refactoring.util.GlobalParameters; - -/** - * Integration class of the Merge ?LET refactoring - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class MergeLetRefactoring extends CostumWorkflowRefactoringWithPositionsSelection { - - @Override - public RefactoringWorkflowController getWorkflowController(final Shell shell) { - return new RefactoringWorkflowController(shell) { - @Override - public void doRefactoring() { - } - }; - } - - @Override - public String getName() { - return "Merge ?LET refactoring"; - } - - @Override - public RefactoringStatus checkFinalConditions(final IProgressMonitor pm) - throws CoreException, OperationCanceledException { - final IErlSelection sel = GlobalParameters.getWranglerSelection(); - final IRefactoringRpcMessage message = run(sel); - if (message.isSuccessful()) { - changedFiles = message.getRefactoringChangeset(); - return new RefactoringStatus(); - } - return RefactoringStatus.createFatalErrorStatus(message.getMessageString()); - } - - @Override - public IRefactoringRpcMessage runAlternative(final IErlSelection selection) { - return null; - } - - @Override - public RefactoringStatus checkInitialConditions(final IProgressMonitor pm) - throws CoreException, OperationCanceledException { - final IErlSelection selection = GlobalParameters.getWranglerSelection(); - - /* - * if (!((selection instanceof IErlMemberSelection) && (selection .getKind() == - * SelectionKind.FUNCTION || selection.getKind() == - * SelectionKind.FUNCTION_CLAUSE))) return RefactoringStatus - * .createFatalErrorStatus("Please select an expression!"); - */ - - final IErlMemberSelection sel = (IErlMemberSelection) selection; - ExpressionPosRpcMessage m = new ExpressionPosRpcMessage(); - m = (ExpressionPosRpcMessage) WranglerBackendManager.getRefactoringBackend() - .callWithParser(m, "merge_let_eclipse", "sxi", sel.getFilePath(), - sel.getSearchPath(), GlobalParameters.getTabWidth()); - if (m.isSuccessful()) { - positions = m.getPositionDefinitions(sel.getDocument()); - selectedPositions = new ArrayList<>(); - } else { - return RefactoringStatus.createFatalErrorStatus(m.getMessageString()); - } - return new RefactoringStatus(); - } - - @Override - public IRefactoringRpcMessage run(final IErlSelection selection) { - final IErlMemberSelection sel = (IErlMemberSelection) selection; - return WranglerBackendManager.getRefactoringBackend().call("merge_let_1_eclipse", - "sxxi", sel.getFilePath(), getSelectedPos(), sel.getSearchPath(), - GlobalParameters.getTabWidth()); - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/MoveFunctionRefactoring.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/MoveFunctionRefactoring.java deleted file mode 100644 index 7445fe1970..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/MoveFunctionRefactoring.java +++ /dev/null @@ -1,94 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.core.internal; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.ltk.core.refactoring.RefactoringStatus; -import org.erlide.wrangler.refactoring.backend.IRefactoringRpcMessage; -import org.erlide.wrangler.refactoring.backend.RefactoringState; -import org.erlide.wrangler.refactoring.backend.internal.WranglerBackendManager; -import org.erlide.wrangler.refactoring.core.SimpleOneStepWranglerRefactoring; -import org.erlide.wrangler.refactoring.selection.IErlMemberSelection; -import org.erlide.wrangler.refactoring.selection.IErlSelection; -import org.erlide.wrangler.refactoring.util.GlobalParameters; - -/** - * Move function refactoring integration class - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class MoveFunctionRefactoring extends SimpleOneStepWranglerRefactoring { - - @Override - public RefactoringStatus checkInitialConditions(final IProgressMonitor pm) - throws CoreException, OperationCanceledException { - /* - * IErlSelection sel = GlobalParameters.getWranglerSelection(); if (sel instanceof - * IErlMemberSelection) { SelectionKind kind = sel.getKind(); if (kind == - * SelectionKind.FUNCTION_CLAUSE || kind == SelectionKind.FUNCTION) return new - * RefactoringStatus(); } return RefactoringStatus - * .createFatalErrorStatus("Please select a function!"); - */ - return new RefactoringStatus(); - } - - @Override - public String getName() { - return "Move function"; - } - - @Override - public IRefactoringRpcMessage run(final IErlSelection selection) { - final IErlMemberSelection sel = (IErlMemberSelection) selection; - return WranglerBackendManager.getRefactoringBackend().call("move_fun_eclipse", - "siisxi", sel.getFilePath(), sel.getSelectionRange().getStartLine(), - sel.getSelectionRange().getStartCol(), userInput, - /* new OtpErlangBoolean(false), */sel.getSearchPath(), - GlobalParameters.getTabWidth()); - } - - /** - * Call an RPC - * - * @param selection - * erlang selection - * @return parsed RPC message - */ - public IRefactoringRpcMessage run2(final IErlSelection selection) { - final IErlMemberSelection sel = (IErlMemberSelection) selection; - return WranglerBackendManager.getRefactoringBackend().call("move_fun_1_eclipse", - "siisxxi", sel.getFilePath(), sel.getSelectionRange().getStartLine(), - sel.getSelectionRange().getStartCol(), userInput, - /* new OtpErlangBoolean(false), */sel.getSearchPath(), - GlobalParameters.getTabWidth()); - } - - @Override - public RefactoringStatus checkFinalConditions(final IProgressMonitor pm) - throws CoreException, OperationCanceledException { - final IErlSelection sel = GlobalParameters.getWranglerSelection(); - IRefactoringRpcMessage message = run(sel); - if (message.isSuccessful()) { - changedFiles = message.getRefactoringChangeset(); - return new RefactoringStatus(); - } else if (message.getRefactoringState() == RefactoringState.QUESTION) { - message = run2(sel); - if (message.isSuccessful()) { - changedFiles = message.getRefactoringChangeset(); - return new RefactoringStatus(); - } - return RefactoringStatus.createFatalErrorStatus(message.getMessageString()); - } else { - return RefactoringStatus.createFatalErrorStatus(message.getMessageString()); - } - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/NormalizeRecordExpression.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/NormalizeRecordExpression.java deleted file mode 100644 index 69cb883d9a..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/NormalizeRecordExpression.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.core.internal; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.ltk.core.refactoring.RefactoringStatus; -import org.erlide.wrangler.refactoring.backend.IRefactoringRpcMessage; -import org.erlide.wrangler.refactoring.backend.internal.WranglerBackendManager; -import org.erlide.wrangler.refactoring.core.SimpleOneStepWranglerRefactoring; -import org.erlide.wrangler.refactoring.selection.IErlMemberSelection; -import org.erlide.wrangler.refactoring.selection.IErlSelection; -import org.erlide.wrangler.refactoring.selection.IErlSelection.SelectionKind; -import org.erlide.wrangler.refactoring.util.GlobalParameters; - -import com.ericsson.otp.erlang.OtpErlangBoolean; - -/** - * Normalize record expression refactoring's integration - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class NormalizeRecordExpression extends SimpleOneStepWranglerRefactoring { - - private final boolean showDefault; - - /** - * @param showDefault - * indicates whether the refactoring should include default fields - */ - public NormalizeRecordExpression(final boolean showDefault) { - this.showDefault = showDefault; - } - - @Override - public RefactoringStatus checkInitialConditions(final IProgressMonitor pm) - throws CoreException, OperationCanceledException { - final IErlSelection sel = GlobalParameters.getWranglerSelection(); - if (sel instanceof IErlMemberSelection) { - final SelectionKind kind = sel.getKind(); - if (kind == SelectionKind.FUNCTION_CLAUSE || kind == SelectionKind.FUNCTION) { - return new RefactoringStatus(); - } - } - - return RefactoringStatus - .createFatalErrorStatus("Please select a record expression!"); - } - - @Override - public String getName() { - return "Normalize record expression"; - } - - @Override - public IRefactoringRpcMessage run(final IErlSelection selection) { - final IErlMemberSelection sel = (IErlMemberSelection) selection; - return WranglerBackendManager.getRefactoringBackend().call( - "normalise_record_expr_eclipse", "sxxxi", sel.getFilePath(), - sel.getSelectionRange().getStartPos(), new OtpErlangBoolean(showDefault), - sel.getSearchPath(), GlobalParameters.getTabWidth()); - - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/PartitionExportsRefactoring.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/PartitionExportsRefactoring.java deleted file mode 100644 index e72030c954..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/PartitionExportsRefactoring.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.core.internal; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.ltk.core.refactoring.RefactoringStatus; -import org.erlide.wrangler.refactoring.backend.IRefactoringRpcMessage; -import org.erlide.wrangler.refactoring.backend.internal.WranglerBackendManager; -import org.erlide.wrangler.refactoring.core.SimpleOneStepWranglerRefactoring; -import org.erlide.wrangler.refactoring.selection.IErlSelection; -import org.erlide.wrangler.refactoring.util.GlobalParameters; - -/** - * Integration class of the partition_exports_eclipse wrangler refactoring - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class PartitionExportsRefactoring extends SimpleOneStepWranglerRefactoring { - - @Override - public RefactoringStatus checkInitialConditions(final IProgressMonitor pm) - throws CoreException, OperationCanceledException { - - return new RefactoringStatus(); - } - - @Override - public String getName() { - return "Partition exported functions"; - } - - @Override - public IRefactoringRpcMessage run(final IErlSelection sel) { - return WranglerBackendManager.getRefactoringBackend().call( - "partition_exports_eclipse", "sdxi", sel.getFilePath(), - Double.parseDouble(userInput), sel.getSearchPath(), - GlobalParameters.getTabWidth()); - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/ProcessRelatedRefactoring.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/ProcessRelatedRefactoring.java deleted file mode 100644 index 514ac9bc33..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/ProcessRelatedRefactoring.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.core.internal; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.ltk.core.refactoring.RefactoringStatus; -import org.erlide.wrangler.refactoring.backend.IRefactoringRpcMessage; -import org.erlide.wrangler.refactoring.backend.internal.ProcessRpcMessage; -import org.erlide.wrangler.refactoring.core.SimpleWranglerRefactoring; -import org.erlide.wrangler.refactoring.selection.IErlMemberSelection; -import org.erlide.wrangler.refactoring.selection.IErlSelection; -import org.erlide.wrangler.refactoring.util.GlobalParameters; - -/** - * Process related refactoring integration class - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public abstract class ProcessRelatedRefactoring extends SimpleWranglerRefactoring { - - protected String undecidables; - - @Override - public RefactoringStatus checkFinalConditions(final IProgressMonitor pm) - throws CoreException, OperationCanceledException { - final IErlSelection sel = GlobalParameters.getWranglerSelection(); - - final ProcessRpcMessage msg = checkUndecidables((IErlMemberSelection) sel); - - if (msg.isSuccessful()) { - changedFiles = msg.getRefactoringChangeset(); - return new RefactoringStatus(); - } else if (msg.hasUndecidables()) { - undecidables = msg.getMessageString(); - final IRefactoringRpcMessage message = run(sel); - changedFiles = message.getRefactoringChangeset(); - - return RefactoringStatus.createWarningStatus(getUndecidableWarningMessage()); - } else { - return RefactoringStatus.createFatalErrorStatus(msg.getMessageString()); - - } - } - - protected abstract String getUndecidableWarningMessage(); - - /** - * @noreference This method is not intended to be referenced by clients. - */ - protected abstract ProcessRpcMessage checkUndecidables(IErlMemberSelection sel); -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/QuickCheckStateRefactoring.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/QuickCheckStateRefactoring.java deleted file mode 100644 index 4f1fcb4082..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/QuickCheckStateRefactoring.java +++ /dev/null @@ -1,95 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.core.internal; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.ltk.core.refactoring.RefactoringStatus; -import org.erlide.wrangler.refactoring.backend.internal.StateDataToRecordRpcMessage; -import org.erlide.wrangler.refactoring.core.SimpleOneStepWranglerRefactoring; -import org.erlide.wrangler.refactoring.selection.IErlMemberSelection; -import org.erlide.wrangler.refactoring.util.GlobalParameters; - -import com.ericsson.otp.erlang.OtpErlangList; -import com.ericsson.otp.erlang.OtpErlangObject; -import com.ericsson.otp.erlang.OtpErlangString; - -/** - * Abstract refactoring for QuickCheck state data to record refactorings - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public abstract class QuickCheckStateRefactoring - extends SimpleOneStepWranglerRefactoring { - - protected OtpErlangObject stateFuns; - protected int fieldCount; - private String recordName; - private List fieldsNames; - - @Override - public RefactoringStatus checkInitialConditions(final IProgressMonitor pm) - throws CoreException, OperationCanceledException { - // FIXME: what kind of preconditions do I need? - final IErlMemberSelection sel = (IErlMemberSelection) GlobalParameters - .getWranglerSelection(); - final StateDataToRecordRpcMessage message = runFirst(sel); - if (!message.isSuccessful()) { - return RefactoringStatus.createFatalErrorStatus(message.getMessageString()); - } - fieldCount = message.getFieldCount(); - stateFuns = message.getStateFuns(); - return new RefactoringStatus(); - } - - /** - * @noreference This method is not intended to be referenced by clients. - */ - protected abstract StateDataToRecordRpcMessage runFirst(IErlMemberSelection sel); - - /** - * Returns the count of fields which a new record may need - * - * @return coutn of fields - */ - public int getRecordFieldCount() { - return fieldCount; - } - - /** - * Record data setter - * - * @param name - * record name - * @param fieldNames - * field names - */ - public void setRecordData(final String name, final List fieldNames) { - recordName = name; - fieldsNames = fieldNames; - } - - protected String getRecordName() { - return recordName; - } - - protected OtpErlangList getFieldsName() { - final ArrayList f = new ArrayList<>(); - for (final String s : fieldsNames) { - f.add(new OtpErlangString(s)); - } - return new OtpErlangList(f.toArray(new OtpErlangString[0])); - - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/RenameFunctionRefactoring.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/RenameFunctionRefactoring.java deleted file mode 100644 index e8b6df1f08..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/RenameFunctionRefactoring.java +++ /dev/null @@ -1,128 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.core.internal; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.ltk.core.refactoring.RefactoringStatus; -import org.eclipse.swt.widgets.Shell; -import org.erlide.runtime.rpc.RpcResult; -import org.erlide.wrangler.refactoring.backend.IRefactoringRpcMessage; -import org.erlide.wrangler.refactoring.backend.RefactoringState; -import org.erlide.wrangler.refactoring.backend.internal.WranglerBackendManager; -import org.erlide.wrangler.refactoring.core.CostumWorkflowRefactoring; -import org.erlide.wrangler.refactoring.core.RefactoringWorkflowController; -import org.erlide.wrangler.refactoring.selection.IErlMemberSelection; -import org.erlide.wrangler.refactoring.selection.IErlSelection; -import org.erlide.wrangler.refactoring.util.GlobalParameters; -import org.erlide.wrangler.refactoring.util.IErlRange; - -import com.ericsson.otp.erlang.OtpErlangString; - -/** - * Rename function refactoring integration - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class RenameFunctionRefactoring extends CostumWorkflowRefactoring { - - @Override - public RefactoringStatus checkInitialConditions(final IProgressMonitor pm) - throws CoreException, OperationCanceledException { - /* - * IErlSelection sel = GlobalParameters.getWranglerSelection(); if (sel instanceof - * IErlMemberSelection) { SelectionKind kind = sel.getKind(); if (kind == - * SelectionKind.FUNCTION_CLAUSE || kind == SelectionKind.FUNCTION) return new - * RefactoringStatus(); } return RefactoringStatus - * .createFatalErrorStatus("Please select a function!"); - */ - return new RefactoringStatus(); - } - - @Override - public String getName() { - return "Rename function"; - } - - @Override - public IRefactoringRpcMessage run(final IErlSelection selection) { - final IErlMemberSelection sel = (IErlMemberSelection) selection; - final IErlRange memberRange = sel.getSelectionRange(); - - return WranglerBackendManager.getRefactoringBackend().call("rename_fun_eclipse", - "siisxi", sel.getFilePath(), memberRange.getStartLine(), - memberRange.getStartCol(), userInput, sel.getSearchPath(), - GlobalParameters.getTabWidth()); - } - - @Override - public IRefactoringRpcMessage runAlternative(final IErlSelection selection) { - final IErlMemberSelection sel = (IErlMemberSelection) selection; - final IErlRange memberRange = sel.getMemberRange(); - - return WranglerBackendManager.getRefactoringBackend().call("rename_fun_1_eclipse", - "siisxi", sel.getFilePath(), memberRange.getStartLine(), - memberRange.getStartCol(), userInput, sel.getSearchPath(), - GlobalParameters.getTabWidth()); - } - - @Override - public RefactoringWorkflowController getWorkflowController(final Shell shell) { - return new RefactoringWorkflowController(shell) { - - @Override - public void doRefactoring() { - final IErlSelection sel = GlobalParameters.getWranglerSelection(); - IRefactoringRpcMessage message = run(sel); - if (message.isSuccessful()) { - changedFiles = message.getRefactoringChangeset(); - status = new RefactoringStatus(); - } else if (message.getRefactoringState() == RefactoringState.WARNING) { - if (ask("Warning", message.getMessageString())) { - message = runAlternative(sel); - if (message.getRefactoringState() == RefactoringState.OK) { - status = new RefactoringStatus(); - } else { - status = RefactoringStatus - .createFatalErrorStatus(message.getMessageString()); - } - } else { - stop(); - } - } else { - status = RefactoringStatus - .createFatalErrorStatus(message.getMessageString()); - } - } - - }; - } - - @Override - public String getDefaultValue() { - final IErlMemberSelection sel = (IErlMemberSelection) GlobalParameters - .getWranglerSelection(); - if (sel == null) { - return ""; - } - - final RpcResult res = WranglerBackendManager.getRefactoringBackend() - .callWithoutParser("get_fun_name_eclipse", "siixi", sel.getFilePath(), - sel.getSelectionRange().getStartLine(), - sel.getSelectionRange().getStartCol(), sel.getSearchPath(), - GlobalParameters.getTabWidth()); - - if (res.getValue().getClass().equals(OtpErlangString.class)) { - return ((OtpErlangString) res.getValue()).stringValue(); - } - return ""; - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/RenameModuleRefactoring.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/RenameModuleRefactoring.java deleted file mode 100644 index de4710dbc5..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/RenameModuleRefactoring.java +++ /dev/null @@ -1,150 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.core.internal; - -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.Change; -import org.eclipse.ltk.core.refactoring.CompositeChange; -import org.eclipse.ltk.core.refactoring.RefactoringStatus; -import org.eclipse.ltk.core.refactoring.resource.RenameResourceChange; -import org.eclipse.swt.widgets.Shell; -import org.erlide.wrangler.refactoring.backend.ChangedFile; -import org.erlide.wrangler.refactoring.backend.IRefactoringRpcMessage; -import org.erlide.wrangler.refactoring.backend.RefactoringState; -import org.erlide.wrangler.refactoring.backend.internal.WranglerBackendManager; -import org.erlide.wrangler.refactoring.core.CostumWorkflowRefactoring; -import org.erlide.wrangler.refactoring.core.RefactoringWorkflowController; -import org.erlide.wrangler.refactoring.selection.IErlSelection; -import org.erlide.wrangler.refactoring.util.GlobalParameters; - -import com.ericsson.otp.erlang.OtpErlangBoolean; - -/** - * Rename module refactoring integration class - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class RenameModuleRefactoring extends CostumWorkflowRefactoring { - - boolean renameTestMod; - - @Override - public RefactoringStatus checkInitialConditions(final IProgressMonitor pm) - throws CoreException, OperationCanceledException { - // since any selection contains a module, it can be applied - return new RefactoringStatus(); - } - - @Override - public String getName() { - return "Rename module"; - } - - @Override - public IRefactoringRpcMessage run(final IErlSelection sel) { - return WranglerBackendManager.getRefactoringBackend().call("rename_mod_eclipse", - "ssxi", sel.getFilePath(), userInput, sel.getSearchPath(), - GlobalParameters.getTabWidth()); - } - - @Override - public Change createChange(final IProgressMonitor pm) - throws CoreException, OperationCanceledException { - - final CompositeChange c = (CompositeChange) super.createChange(pm); - - for (final ChangedFile f : changedFiles) { - if (f.isNameChanged()) { - final IPath p = f.getPath(); - final String s = f.getNewName(); - final RenameResourceChange rch = new RenameResourceChange(p, s); - - c.add(rch); - } - } - - return c; - } - - @Override - public RefactoringWorkflowController getWorkflowController(final Shell shell) { - return new RefactoringWorkflowController(shell) { - - @Override - public void doRefactoring() { - final IErlSelection sel = GlobalParameters.getWranglerSelection(); - IRefactoringRpcMessage message = run(sel); - if (message.isSuccessful()) { - changedFiles = message.getRefactoringChangeset(); - status = new RefactoringStatus(); - } else if (message.getRefactoringState() == RefactoringState.QUESTION) { - renameTestMod = ask("Question", message.getMessageString()); - message = runAlternative(sel); - if (message.getRefactoringState() == RefactoringState.OK) { - changedFiles = message.getRefactoringChangeset(); - status = new RefactoringStatus(); - } else { - status = RefactoringStatus - .createFatalErrorStatus(message.getMessageString()); - } - } else if (message.getRefactoringState() == RefactoringState.WARNING) { - renameTestMod = !ask("Warning", message.getMessageString()); - if (!renameTestMod) { - message = runAlternative(sel); - if (message.getRefactoringState() == RefactoringState.OK) { - changedFiles = message.getRefactoringChangeset(); - status = new RefactoringStatus(); - } else { - status = RefactoringStatus - .createFatalErrorStatus(message.getMessageString()); - } - } else { - stop(); - } - } else { - status = RefactoringStatus - .createFatalErrorStatus(message.getMessageString()); - } - } - - }; - } - - @Override - public IRefactoringRpcMessage runAlternative(final IErlSelection sel) { - return WranglerBackendManager.getRefactoringBackend().call("rename_mod_1_eclipse", - "ssxix", sel.getFilePath(), userInput, sel.getSearchPath(), - GlobalParameters.getTabWidth(), new OtpErlangBoolean(renameTestMod)); - } - - @Override - public void doAfterRefactoring() { - // WranglerUtils.openFile(WranglerUtils.getFileFromPath(newPath)); - } - - @Override - public void doBeforeRefactoring() { - - } - - @Override - public String getDefaultValue() { - final IErlSelection sel = GlobalParameters.getWranglerSelection(); - if (sel == null) { - return ""; - } - - return sel.getErlModule().getModuleName(); - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/RenameProcessRefactoring.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/RenameProcessRefactoring.java deleted file mode 100644 index 370af0bcb4..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/RenameProcessRefactoring.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.core.internal; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.ltk.core.refactoring.RefactoringStatus; -import org.erlide.wrangler.refactoring.backend.IRefactoringRpcMessage; -import org.erlide.wrangler.refactoring.backend.internal.ProcessRpcMessage; -import org.erlide.wrangler.refactoring.backend.internal.WranglerBackendManager; -import org.erlide.wrangler.refactoring.selection.IErlMemberSelection; -import org.erlide.wrangler.refactoring.selection.IErlSelection; -import org.erlide.wrangler.refactoring.selection.IErlSelection.SelectionKind; -import org.erlide.wrangler.refactoring.util.GlobalParameters; - -/** - * Rename process refactorings integration - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class RenameProcessRefactoring extends ProcessRelatedRefactoring { - - @Override - public RefactoringStatus checkInitialConditions(final IProgressMonitor pm) - throws CoreException, OperationCanceledException { - final IErlSelection sel = GlobalParameters.getWranglerSelection(); - if (sel instanceof IErlMemberSelection) { - final SelectionKind kind = sel.getKind(); - if (kind == SelectionKind.FUNCTION_CLAUSE || kind == SelectionKind.FUNCTION) { - return new RefactoringStatus(); - } - } - return RefactoringStatus.createFatalErrorStatus("Please select a process!"); - } - - @Override - public String getName() { - return "Rename process"; - } - - @SuppressWarnings("boxing") - @Override - public IRefactoringRpcMessage run(final IErlSelection sel) { - return WranglerBackendManager.getRefactoringBackend().call( - "rename_process_1_eclipse", "sssxi", sel.getFilePath(), undecidables, - userInput, sel.getSearchPath(), GlobalParameters.getTabWidth()); - } - - @SuppressWarnings("boxing") - @Override - protected ProcessRpcMessage checkUndecidables(final IErlMemberSelection sel) { - return (ProcessRpcMessage) WranglerBackendManager.getRefactoringBackend() - .callWithParser(new ProcessRpcMessage(), "rename_process_eclipse", - "siisxi", sel.getFilePath(), - sel.getSelectionRange().getStartLine(), - sel.getSelectionRange().getStartCol(), userInput, - sel.getSearchPath(), GlobalParameters.getTabWidth()); - } - - @Override - protected String getUndecidableWarningMessage() { - return "Wrangler could not decide whether the new process name provided\n" - + "conflicts with the process name(s) used by other" - + " registration expression(s)."; - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/RenameVariableRefactoring.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/RenameVariableRefactoring.java deleted file mode 100644 index 46ff3b39e4..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/RenameVariableRefactoring.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.core.internal; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.ltk.core.refactoring.RefactoringStatus; -import org.erlide.runtime.rpc.RpcResult; -import org.erlide.wrangler.refactoring.backend.IRefactoringRpcMessage; -import org.erlide.wrangler.refactoring.backend.internal.WranglerBackendManager; -import org.erlide.wrangler.refactoring.core.SimpleOneStepWranglerRefactoring; -import org.erlide.wrangler.refactoring.selection.IErlMemberSelection; -import org.erlide.wrangler.refactoring.selection.IErlSelection; -import org.erlide.wrangler.refactoring.util.GlobalParameters; - -import com.ericsson.otp.erlang.OtpErlangString; - -/** - * Rename variable refactoring integration - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class RenameVariableRefactoring extends SimpleOneStepWranglerRefactoring { - - @Override - public RefactoringStatus checkInitialConditions(final IProgressMonitor pm) - throws CoreException, OperationCanceledException { - final IErlSelection sel = GlobalParameters.getWranglerSelection(); - if (sel instanceof IErlMemberSelection) { - // SelectionKind kind = sel.getDetailedKind(); - return new RefactoringStatus(); - } - - return RefactoringStatus.createFatalErrorStatus("Please select a variable!"); - } - - @Override - public String getName() { - return "Rename variable"; - } - - @Override - public IRefactoringRpcMessage run(final IErlSelection selection) { - final IErlMemberSelection sel = (IErlMemberSelection) selection; - return WranglerBackendManager.getRefactoringBackend().call("rename_var_eclipse", - "siisxi", sel.getFilePath(), sel.getSelectionRange().getStartLine(), - sel.getSelectionRange().getStartCol(), userInput, sel.getSearchPath(), - GlobalParameters.getTabWidth()); - } - - @Override - public String getDefaultValue() { - final IErlMemberSelection sel = (IErlMemberSelection) GlobalParameters - .getWranglerSelection(); - if (sel == null) { - return ""; - } - - final RpcResult res = WranglerBackendManager.getRefactoringBackend() - .callWithoutParser("get_var_name_eclipse", "siixi", sel.getFilePath(), - sel.getSelectionRange().getStartLine(), - sel.getSelectionRange().getStartCol(), sel.getSearchPath(), - GlobalParameters.getTabWidth()); - - if (res.getValue().getClass().equals(OtpErlangString.class)) { - return ((OtpErlangString) res.getValue()).stringValue(); - } - return ""; - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/TupleFunctionParametersRefactoring.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/TupleFunctionParametersRefactoring.java deleted file mode 100644 index f705715843..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/TupleFunctionParametersRefactoring.java +++ /dev/null @@ -1,97 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.core.internal; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.ltk.core.refactoring.RefactoringStatus; -import org.erlide.wrangler.refactoring.backend.IRefactoringRpcMessage; -import org.erlide.wrangler.refactoring.backend.internal.WranglerBackendManager; -import org.erlide.wrangler.refactoring.core.SimpleOneStepWranglerRefactoring; -import org.erlide.wrangler.refactoring.selection.IErlMemberSelection; -import org.erlide.wrangler.refactoring.selection.IErlSelection; -import org.erlide.wrangler.refactoring.selection.IErlSelection.SelectionKind; -import org.erlide.wrangler.refactoring.util.GlobalParameters; -import org.erlide.wrangler.refactoring.util.WranglerUtils; - -/** - * Tuple function parameters refactoring integration - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class TupleFunctionParametersRefactoring extends SimpleOneStepWranglerRefactoring { - protected int numberOfTuplingParameters = -1; - - @Override - public RefactoringStatus checkInitialConditions(final IProgressMonitor pm) - throws CoreException, OperationCanceledException { - final IErlSelection sel = GlobalParameters.getWranglerSelection(); - if (sel instanceof IErlMemberSelection) { - final SelectionKind kind = sel.getKind(); - if (kind == SelectionKind.FUNCTION_CLAUSE || kind == SelectionKind.FUNCTION) { - final IErlMemberSelection s = (IErlMemberSelection) sel; - numberOfTuplingParameters = calculateParametersNumber(WranglerUtils - .getTextFromEditor(s.getSelectionRange(), s.getDocument())); - if (numberOfTuplingParameters > 0) { - return new RefactoringStatus(); - } - } - } - return RefactoringStatus - .createFatalErrorStatus("Please select function parameters!"); - } - - private int calculateParametersNumber(final String textFromEditor) { - int noC = 0; - int depth = 0; - for (int i = 0; i < textFromEditor.length(); ++i) { - final char c = textFromEditor.charAt(i); - switch (c) { - case '{': - case '(': - case '[': - depth++; - break; - case ')': - case '}': - case ']': - depth--; - break; - case ',': - if (depth == 0) { - noC++; - } - break; - default: - break; - } - } - if (depth == 0) { - return noC + 1; - } - return -1; - } - - @Override - public String getName() { - return "Tuple functon parameters"; - } - - @Override - public IRefactoringRpcMessage run(final IErlSelection selection) { - final IErlMemberSelection sel = (IErlMemberSelection) selection; - return WranglerBackendManager.getRefactoringBackend().call("tuple_funpar_eclipse", - "sxxxi", sel.getFilePath(), sel.getSelectionRange().getStartPos(), - sel.getSelectionRange().getEndPos(), sel.getSearchPath(), - GlobalParameters.getTabWidth()); - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/UnfoldFunctionApplicationRefactoring.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/UnfoldFunctionApplicationRefactoring.java deleted file mode 100644 index 0c5b1d4e52..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/UnfoldFunctionApplicationRefactoring.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.core.internal; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.ltk.core.refactoring.RefactoringStatus; -import org.erlide.wrangler.refactoring.backend.IRefactoringRpcMessage; -import org.erlide.wrangler.refactoring.backend.internal.WranglerBackendManager; -import org.erlide.wrangler.refactoring.core.SimpleOneStepWranglerRefactoring; -import org.erlide.wrangler.refactoring.selection.IErlMemberSelection; -import org.erlide.wrangler.refactoring.selection.IErlSelection; -import org.erlide.wrangler.refactoring.util.GlobalParameters; - -/** - * Unfold tuple application refactoring integration class. - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class UnfoldFunctionApplicationRefactoring - extends SimpleOneStepWranglerRefactoring { - - /** - * Default constructor - */ - public UnfoldFunctionApplicationRefactoring() { - } - - @Override - public RefactoringStatus checkInitialConditions(final IProgressMonitor pm) - throws CoreException, OperationCanceledException { - final IErlSelection sel = GlobalParameters.getWranglerSelection(); - if (sel instanceof IErlMemberSelection) { - /* - * if (sel.getKind() == SelectionKind.FUNCTION || sel.getKind() == - * SelectionKind.FUNCTION_CLAUSE) - */ - return new RefactoringStatus(); - } - - return RefactoringStatus.createFatalErrorStatus("Please select a function!"); - } - - @Override - public String getName() { - return "Unfold Function Application"; - } - - @Override - public IRefactoringRpcMessage run(final IErlSelection selection) { - final IErlMemberSelection sel = (IErlMemberSelection) selection; - return WranglerBackendManager.getRefactoringBackend().call( - "unfold_fun_app_eclipse", "sxxi", sel.getFilePath(), - sel.getSelectionRange().getStartPos(), sel.getSearchPath(), - GlobalParameters.getTabWidth()); - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/UserAdhocRefactoring.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/UserAdhocRefactoring.java deleted file mode 100644 index 14d90d390d..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/UserAdhocRefactoring.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.erlide.wrangler.refactoring.core.internal; - -import org.erlide.engine.ErlangEngine; -import org.erlide.engine.model.ErlModelException; -import org.erlide.engine.model.root.IErlProject; -import org.erlide.runtime.rpc.RpcResult; -import org.erlide.wrangler.refactoring.backend.internal.WranglerBackendManager; - -/** - * Class for common functionalities of adhoc refactorings ad hoc specific methods should - * delegate to if - * - * @author Aleksandra Lipiec - * @version %I%, %G% - */ -public class UserAdhocRefactoring { - - private final UserRefactoring refac; // base refactoring - - public UserAdhocRefactoring(final UserRefactoring refac) { - this.refac = refac; - } - - /** - * Loading user's callback module - * - * @return - */ - public boolean load() { - String callbackPath; - try { - if (ErlangEngine.getInstance().getModel() - .findModule(refac.getCallbackModule()) == null) { - return false; - } - - final IErlProject project = ErlangEngine.getInstance().getModelUtilService() - .getProject(ErlangEngine.getInstance().getModel() - .findModule(refac.getCallbackModule())); - callbackPath = project.getWorkspaceProject().getLocation() - .append(project.getProperties().getOutputDir()).toString(); - } catch (final ErlModelException e) { - return false; - } - - final RpcResult res = WranglerBackendManager.getRefactoringBackend() - .callWithoutParser("load_callback_mod_eclipse", "ss", - refac.getCallbackModule(), callbackPath); - if (!res.isOk()) { - return false; - } - return true; - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/UserElementaryRefactoring.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/UserElementaryRefactoring.java deleted file mode 100644 index e5773735e6..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/UserElementaryRefactoring.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.erlide.wrangler.refactoring.core.internal; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.ltk.core.refactoring.RefactoringStatus; -import org.erlide.wrangler.refactoring.backend.IRefactoringRpcMessage; -import org.erlide.wrangler.refactoring.backend.internal.WranglerBackendManager; -import org.erlide.wrangler.refactoring.selection.IErlMemberSelection; -import org.erlide.wrangler.refactoring.selection.IErlSelection; -import org.erlide.wrangler.refactoring.util.GlobalParameters; - -import com.ericsson.otp.erlang.OtpErlangInt; -import com.ericsson.otp.erlang.OtpErlangList; -import com.ericsson.otp.erlang.OtpErlangObject; -import com.ericsson.otp.erlang.OtpErlangString; - -/** - * Abstract class for elementary user-defined refactorings - * - * @author Aleksandra Lipiec - * @version %I%, %G% - */ -public abstract class UserElementaryRefactoring extends UserRefactoring { - - @Override - public IRefactoringRpcMessage run(final IErlSelection selection) { - final IErlMemberSelection sel = (IErlMemberSelection) selection; - - final OtpErlangList pos = new OtpErlangList(new OtpErlangInt[] { - new OtpErlangInt(sel.getSelectionRange().getStartLine()), - new OtpErlangInt(sel.getSelectionRange().getStartCol()) }); - final OtpErlangList selectionBeg = new OtpErlangList(new OtpErlangInt[] { - new OtpErlangInt(sel.getSelectionRange().getStartLine()), - new OtpErlangInt(sel.getSelectionRange().getStartCol()) }); - final OtpErlangList selectionEnd = new OtpErlangList(new OtpErlangInt[] { - new OtpErlangInt(sel.getSelectionRange().getEndLine()), - new OtpErlangInt(sel.getSelectionRange().getEndCol()) }); - final OtpErlangList selectionPos = new OtpErlangList( - new OtpErlangObject[] { selectionBeg, selectionEnd }); - final OtpErlangList args = new OtpErlangList( - new OtpErlangObject[] { new OtpErlangString(sel.getFilePath()), pos, - selectionPos, prepareUserInput(), sel.getSearchPath(), - new OtpErlangInt(GlobalParameters.getTabWidth()) }); - - return WranglerBackendManager.getRefactoringBackend().call("run_refac_eclipse", - "sx", getCallbackModule(), args); - } - - @Override - public RefactoringStatus checkInitialConditions(final IProgressMonitor pm) - throws CoreException, OperationCanceledException { - return new RefactoringStatus(); // OK, no preconditins - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/UserRefactoring.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/UserRefactoring.java deleted file mode 100644 index e775de959c..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/core/internal/UserRefactoring.java +++ /dev/null @@ -1,168 +0,0 @@ -package org.erlide.wrangler.refactoring.core.internal; - -import java.util.ArrayList; -import java.util.LinkedList; -import java.util.List; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.ltk.core.refactoring.RefactoringStatus; -import org.eclipse.swt.widgets.Shell; -import org.erlide.runtime.rpc.RpcResult; -import org.erlide.wrangler.refactoring.backend.IRefactoringRpcMessage; -import org.erlide.wrangler.refactoring.backend.internal.WranglerBackendManager; -import org.erlide.wrangler.refactoring.core.RefactoringWorkflowController; -import org.erlide.wrangler.refactoring.core.SimpleOneStepWranglerRefactoring; -import org.erlide.wrangler.refactoring.selection.IErlSelection; -import org.erlide.wrangler.refactoring.util.GlobalParameters; - -import com.ericsson.otp.erlang.OtpErlangList; -import com.ericsson.otp.erlang.OtpErlangObject; -import com.ericsson.otp.erlang.OtpErlangString; -import com.ericsson.otp.erlang.OtpErlangTuple; - -/** - * Abstract class for user-defined refactoring handlers - * - * This class should be extended by classes dedicated to composite and elementary - * refactorings - * - * @author Aleksandra Lipiec - * @version %I%, %G% - */ -public abstract class UserRefactoring extends SimpleOneStepWranglerRefactoring { - - private String callbackModule; // callback module - private final List parPrompts = new LinkedList<>(); // parameter - // prompts - private List parValues = new ArrayList<>(0); // parameter - // values - // submited by - // user - protected boolean fetched; // if parameter prompts are already fetched - protected RefactoringStatus status; // refactoring status - - @Override - public RefactoringStatus checkFinalConditions(final IProgressMonitor pm) - throws CoreException, OperationCanceledException { - return status; - } - - public String getCallbackModule() { - return callbackModule; - } - - /** - * Ad hoc refactoring needs name of the callback module to be called - * - * @param module - */ - public void setCallbackModuleName(final String module) { - callbackModule = module; - fetched = false; - } - - /** - * Fetch parameter prompts from the right callback module - * - * @param module - */ - public boolean fetchParPrompts() { - if (fetched) { - return true; - } - - final RpcResult res = WranglerBackendManager.getRefactoringBackend() - .callWithoutParser("input_par_prompts_eclipse", "s", callbackModule); - final OtpErlangList params = (OtpErlangList) ((OtpErlangTuple) res.getValue()) - .elementAt(1); - parPrompts.clear(); - for (final OtpErlangObject obj : params.elements()) { - parPrompts.add(obj.toString().replace("\"", "")); - } - - fetched = true; - - return true; - } - - /** - * Getter for parameter prompts - * - * @return - */ - public List getParPrompts() { - return parPrompts; - } - - /** - * Clear parameter prompts list - */ - protected void clearParPrompts() { - parPrompts.clear(); - } - - /** - * Add a new prompt - * - * @param prompt - */ - protected void addParPrompts(final String prompt) { - parPrompts.add(prompt); - } - - /** - * Getter for parameter values - * - * @return - */ - public List getParValues() { - return parValues; - } - - /** - * Appends new parameter value - * - * @param value - */ - public void setParValue(final List params) { - parValues = params; - } - - protected OtpErlangList prepareUserInput() { - final OtpErlangObject[] params = new OtpErlangObject[parValues.size()]; - int i = 0; - for (final String val : parValues) { - params[i] = new OtpErlangString(val); - i++; - } - return new OtpErlangList(params); - } - - /** - * Defines workflow of the refactoring, sets changed files and status - * - * @param shell - * @return - */ - public RefactoringWorkflowController getWorkflowController(final Shell shell) { - return new RefactoringWorkflowController(shell) { - - @Override - public void doRefactoring() { - final IErlSelection sel = GlobalParameters.getWranglerSelection(); - final IRefactoringRpcMessage message = run(sel); - if (message.isSuccessful()) { - changedFiles = message.getRefactoringChangeset(); - status = new RefactoringStatus(); - } else { - status = RefactoringStatus - .createFatalErrorStatus(message.getMessageString()); - } - } - - }; - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/exception/WranglerException.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/exception/WranglerException.java deleted file mode 100644 index 7bc8e0229c..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/exception/WranglerException.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.exception; - -/** - * Absrtact class for exceptions used by the refactor plug-in. - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class WranglerException extends Exception { - - /** - * ID - */ - private static final long serialVersionUID = 6955527507414603986L; - - /** - * Constructor - * - * @param message - * message string - */ - public WranglerException(final String message) { - super(message); - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/exception/WranglerRpcParsingException.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/exception/WranglerRpcParsingException.java deleted file mode 100644 index 728d436529..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/exception/WranglerRpcParsingException.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.exception; - -/** - * Wrangler exception is thrown when the result of an rpc could not be parsed - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class WranglerRpcParsingException extends WranglerException { - - /** - * Constructor - * - * @param message - * message string - */ - public WranglerRpcParsingException(final String message) { - super(message); - } - - private static final long serialVersionUID = 1L; - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/selection/IErlMemberSelection.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/selection/IErlMemberSelection.java deleted file mode 100644 index d66b94020c..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/selection/IErlMemberSelection.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.selection; - -import org.eclipse.jface.text.IDocument; -import org.erlide.wrangler.refactoring.util.IErlRange; - -/** - * Selection which represents an Erlang member. - * - * (Erl module is not an erlang member but could be a selection) - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public interface IErlMemberSelection extends IErlSelection { - /** - * Get the selection range of the member - * - * @return selection range - */ - IErlRange getSelectionRange(); - - /** - * Get the member range - * - * @return range - */ - IErlRange getMemberRange(); - - /** - * Get the document which conatins the member - * - * @return document - */ - IDocument getDocument(); - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/selection/IErlSelection.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/selection/IErlSelection.java deleted file mode 100644 index 5a64a75952..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/selection/IErlSelection.java +++ /dev/null @@ -1,90 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.selection; - -import org.eclipse.core.resources.IFile; -import org.eclipse.jface.viewers.ISelection; -import org.erlide.engine.model.IErlElement; -import org.erlide.engine.model.root.IErlModule; - -import com.ericsson.otp.erlang.OtpErlangList; - -/** - * Interface for Erlang selection - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public interface IErlSelection extends ISelection { - /** - * Denotes the kind of a selection in the editor plain. - * - * We can differentiate: module, functino, function clause, expression, variable - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ - public enum SelectionKind { - MODULE, FUNCTION, FUNCTION_CLAUSE, EXPRESSION, VARIABLE - } - - /** - * Get the sort of the selection - * - * Erlide interface is used to get the kind. - * - * @return kind of the selection - */ - SelectionKind getKind(); - - /** - * Get detailed kind of the selection. - * - * Wrangler interface is used to get the kind - * - * @return kind of the selection - */ - SelectionKind getDetailedKind(); - - /** - * Get the actual selection's file path. - * - * @return file path string - */ - String getFilePath(); - - /** - * Get the actual file - * - * @return Ifile object - */ - IFile getFile(); - - /** - * Get the actual selection's module. - * - * @return - */ - IErlModule getErlModule(); - - /** - * Get the actual's selections project's search path. - * - * @return list of directories - */ - OtpErlangList getSearchPath(); - - /** - * Get the corresponding Erlang element - * - * @return IErlElement object - */ - IErlElement getErlElement(); - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/selection/internal/AbstractErlMemberSelection.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/selection/internal/AbstractErlMemberSelection.java deleted file mode 100644 index 79816982b8..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/selection/internal/AbstractErlMemberSelection.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.selection.internal; - -import org.eclipse.core.resources.IFile; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.ITextSelection; -import org.eclipse.ui.IFileEditorInput; -import org.eclipse.ui.texteditor.ITextEditor; -import org.erlide.engine.model.ErlElementKind; -import org.erlide.wrangler.refactoring.selection.IErlMemberSelection; - -/** - * Abstract class for representing Erlang member selection - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public abstract class AbstractErlMemberSelection extends AbstractErlSelection - implements IErlMemberSelection { - - protected ITextSelection textSelection; - - protected IDocument document; - - /** - * Default constructor - */ - public AbstractErlMemberSelection() { - } - - @Override - public IDocument getDocument() { - return document; - } - - /** - * Constructor - * - * @param editor - * the erlang editor which is used to get the current selection - */ - public AbstractErlMemberSelection(final ITextEditor editor) { - final ITextSelection selection = (ITextSelection) editor.getSelectionProvider() - .getSelection(); - final IFileEditorInput input = (IFileEditorInput) editor.getEditorInput(); - document = editor.getDocumentProvider().getDocument(input); - final IFile afile = input.getFile(); - store(selection, afile, document); - } - - protected void store(final ITextSelection selection, final IFile afile, - final IDocument adocument) { - file = afile; - textSelection = selection; - } - - /** - * @Override public ITextEditor getEditor() { return editor; } - */ - - @Override - public SelectionKind getKind() { - final ErlElementKind k = getErlElement().getKind(); - if (k == ErlElementKind.CLAUSE) { - return SelectionKind.FUNCTION_CLAUSE; - } else if (k == ErlElementKind.FUNCTION) { - return SelectionKind.FUNCTION; - } else { - return SelectionKind.MODULE; - } - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/selection/internal/AbstractErlSelection.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/selection/internal/AbstractErlSelection.java deleted file mode 100644 index ce3597d242..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/selection/internal/AbstractErlSelection.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.selection.internal; - -import java.util.Collection; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.erlide.engine.ErlangEngine; -import org.erlide.engine.model.root.IErlModel; -import org.erlide.engine.model.root.IErlProject; -import org.erlide.wrangler.refactoring.selection.IErlSelection; - -import com.ericsson.otp.erlang.OtpErlangList; -import com.ericsson.otp.erlang.OtpErlangString; - -/** - * Abstract class which represents an Erlang selection. - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public abstract class AbstractErlSelection implements IErlSelection { - - protected IFile file; - - @Override - public boolean isEmpty() { - return false; - } - - @Override - public OtpErlangList getSearchPath() { - final IProject project = file.getProject(); - final IErlModel model = ErlangEngine.getInstance().getModel(); - final IErlProject actualProject = model.getErlangProject(project); - final IPath projectLocation = actualProject.getWorkspaceProject().getLocation(); - - final Collection sourcDirs = actualProject.getProperties().getSourceDirs(); - final OtpErlangString[] searchPath = new OtpErlangString[sourcDirs.size()]; - int i = 0; - for (final IPath src : sourcDirs) { - searchPath[i++] = new OtpErlangString( - projectLocation.append(src).toOSString()); - } - return new OtpErlangList(searchPath); - } - - @Override - public String getFilePath() { - return file.getLocation().toOSString(); - } - - @Override - public IFile getFile() { - return file; - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/selection/internal/ErlMemberSelection.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/selection/internal/ErlMemberSelection.java deleted file mode 100644 index 3f91b2fef8..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/selection/internal/ErlMemberSelection.java +++ /dev/null @@ -1,99 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.selection.internal; - -import org.eclipse.core.resources.IFile; -import org.eclipse.jface.text.IDocument; -import org.erlide.engine.ErlangEngine; -import org.erlide.engine.model.IErlElement; -import org.erlide.engine.model.erlang.IErlMember; -import org.erlide.engine.model.root.IErlModule; -import org.erlide.wrangler.refactoring.util.ErlRange; -import org.erlide.wrangler.refactoring.util.IErlRange; -import org.erlide.wrangler.refactoring.util.WranglerUtils; - -/** - * Represents an Erlang member selection - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class ErlMemberSelection extends AbstractErlMemberSelection { - protected IErlElement element; - - protected IErlMember member; - - /** - * Constructor - * - * @param element - * Erlang element - Erlide representation - * @param file - * the file which contains the selection - * @param document - * document which contains the selection - */ - public ErlMemberSelection(final IErlElement element, final IFile file, - final IDocument document) { - this.document = document; - this.file = file; - this.element = element; - if (element instanceof IErlMember) { - member = (IErlMember) element; - } - } - - protected int getEndCol() { - return WranglerUtils.calculateColumnFromOffset( - member.getSourceRange().getOffset() + member.getSourceRange().getLength(), - getEndLine() - 1, document); - } - - protected int getEndLine() { - return member.getLineEnd() + 1; - } - - @Override - public IErlElement getErlElement() { - return element; - } - - protected int getStartCol() { - return WranglerUtils.calculateColumnFromOffset( - member.getSourceRange().getOffset(), getStartLine() - 1, document); - - } - - protected int getStartLine() { - return member.getLineStart() + 1; - } - - @Override - public IErlRange getMemberRange() { - return getSelectionRange(); - } - - @Override - public IErlRange getSelectionRange() { - IErlRange range; - range = new ErlRange(getStartLine(), getStartCol(), getEndLine(), getEndCol(), - member.getSourceRange().getOffset(), member.getSourceRange().getLength()); - return range; - } - - @Override - public SelectionKind getDetailedKind() { - return getKind(); - } - - @Override - public IErlModule getErlModule() { - return (IErlModule) ErlangEngine.getInstance().getModel().findElement(file); - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/selection/internal/ErlModuleSelection.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/selection/internal/ErlModuleSelection.java deleted file mode 100644 index 4742c4fdca..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/selection/internal/ErlModuleSelection.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.selection.internal; - -import org.eclipse.core.resources.IFile; -import org.erlide.engine.model.IErlElement; -import org.erlide.engine.model.root.IErlModule; - -/** - * Represents an Erlang module which is selected by the user - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class ErlModuleSelection extends AbstractErlSelection { - protected IErlModule module; - - /** - * Constructor - * - * @param module - * Erlang module - Erlide representation - * @param file - * file, which contains the module - */ - public ErlModuleSelection(final IErlModule module, final IFile file) { - this.module = module; - this.file = file; - } - - @Override - public IErlElement getErlElement() { - return module; - } - - @Override - public SelectionKind getDetailedKind() { - return getKind(); - } - - @Override - public SelectionKind getKind() { - return SelectionKind.MODULE; - } - - @Override - public IErlModule getErlModule() { - return module; - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/selection/internal/ErlTextMemberSelection.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/selection/internal/ErlTextMemberSelection.java deleted file mode 100644 index 88f2b87098..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/selection/internal/ErlTextMemberSelection.java +++ /dev/null @@ -1,154 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.selection.internal; - -import org.eclipse.core.resources.IFile; -import org.eclipse.jface.text.ITextSelection; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IFileEditorInput; -import org.eclipse.ui.texteditor.ITextEditor; -import org.erlide.engine.ErlangEngine; -import org.erlide.engine.model.ErlModelException; -import org.erlide.engine.model.IErlElement; -import org.erlide.engine.model.erlang.IErlMember; -import org.erlide.engine.model.root.IErlModule; -import org.erlide.wrangler.refactoring.backend.SyntaxInfo; -import org.erlide.wrangler.refactoring.backend.internal.WranglerBackendManager; -import org.erlide.wrangler.refactoring.exception.WranglerException; -import org.erlide.wrangler.refactoring.util.ErlRange; -import org.erlide.wrangler.refactoring.util.IErlRange; -import org.erlide.wrangler.refactoring.util.WranglerUtils; - -/** - * Selected Erlang member, from the editor - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class ErlTextMemberSelection extends AbstractErlMemberSelection { - - /** - * Constructor - * - * @param selection - * textselection from an Erlang editor - * @param editor - * editor, where the text is selected - * @throws WranglerException - */ - public ErlTextMemberSelection(final ITextSelection selection, - final ITextEditor editor) throws WranglerException { - final IEditorInput input = editor.getEditorInput(); - if (!(input instanceof IFileEditorInput)) { - throw new WranglerException("Can not refactor external modules!"); - } - document = editor.getDocumentProvider().getDocument(input); - final IFileEditorInput fileInput = (IFileEditorInput) input; - final IFile theFile = fileInput.getFile(); - store(selection, theFile, document); - } - - /** - * Constructor - * - * @param editor - * editor, which contains the selection - */ - public ErlTextMemberSelection(final ITextEditor editor) { - super(editor); - } - - protected int getStartCol() { - return WranglerUtils.calculateColumnFromOffset(textSelection.getOffset(), - getStartLine() - 1, document); - } - - protected int getEndLine() { - return textSelection.getEndLine() + 1; - } - - protected int getEndCol() { - return WranglerUtils.calculateColumnFromOffset( - textSelection.getOffset() + textSelection.getLength(), getEndLine() - 1, - document); - } - - protected int getStartLine() { - return textSelection.getStartLine() + 1; - } - - @Override - public IErlElement getErlElement() { - final IErlModule module = (IErlModule) ErlangEngine.getInstance().getModel() - .findElement(file); - - try { - final IErlElement element = module.getElementAt(textSelection.getOffset()); - if (element == null) { - return module; - } - return element; - - } catch (final ErlModelException e) { - } - return module; - } - - @Override - public IErlRange getMemberRange() { - if (getErlElement() instanceof IErlMember) { - IErlRange range; - final IErlMember member = (IErlMember) getErlElement(); - int sL; - int sC; - int eL; - int eC; - sL = member.getLineStart() + 1; - eL = member.getLineEnd() + 1; - - sC = WranglerUtils.calculateColumnFromOffset( - member.getSourceRange().getOffset(), sL - 1, document); - eC = WranglerUtils - .calculateColumnFromOffset( - member.getSourceRange().getOffset() - + member.getSourceRange().getLength(), - eL - 1, document); - range = new ErlRange(sL, sC, eL, eC, member.getSourceRange().getOffset(), - member.getSourceRange().getLength()); - - return range; - } - return getSelectionRange(); - } - - @Override - public IErlRange getSelectionRange() { - return new ErlRange(getStartLine(), getStartCol(), getEndLine(), getEndCol(), - textSelection.getOffset(), textSelection.getLength()); - } - - @Override - public SelectionKind getDetailedKind() { - if (getKind() == SelectionKind.FUNCTION - || getKind() == SelectionKind.FUNCTION_CLAUSE) { - final SyntaxInfo si = WranglerBackendManager.getSyntaxBackend() - .getSyntaxInfo(file, getStartLine(), getStartCol()); - if (si.isVariable()) { - return SelectionKind.VARIABLE; - // TODO:: expression checking is not implemented - } - } - return getKind(); - } - - @Override - public IErlModule getErlModule() { - return (IErlModule) ErlangEngine.getInstance().getModel().findElement(file); - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/AboutHandler.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/AboutHandler.java deleted file mode 100644 index 5eb7ac1a54..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/AboutHandler.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.erlide.wrangler.refactoring.ui; - -import org.eclipse.core.commands.AbstractHandler; -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.window.IShellProvider; -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.Link; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.PlatformUI; - -public class AboutHandler extends AbstractHandler { - - protected static class MyMessageDialog extends Dialog { - - String title; - String message; - - protected MyMessageDialog(final IShellProvider parentShell) { - super(parentShell); - } - - public MyMessageDialog(final Shell shell, final String title, - final String message) { - super(shell); - this.title = title; - this.message = message; - - } - - @Override - protected void createButtonsForButtonBar(final Composite parent) { - // create OK and Cancel buttons by default - createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); - } - - @Override - protected void configureShell(final Shell shell) { - super.configureShell(shell); - shell.setText(title); - } - - @Override - protected Control createDialogArea(final Composite parent) { - final Composite composite = (Composite) super.createDialogArea(parent); - - final Link url1 = new Link(composite, SWT.BORDER); - url1.setLayoutData(new GridData( - GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); - - url1.setText(message); - - return composite; - } - } - - @Override - public Object execute(final ExecutionEvent event) - throws org.eclipse.core.commands.ExecutionException { - - final MyMessageDialog m = new MyMessageDialog( - PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), - "Missing Graphviz library", - "For using Wrangler code inspection functionalities you must first install the Eclipse GraphViz plugin (and also the original graphviz binaries).\n" - + "Update site: https://erlide.org/update/libs/"); - - m.open(); - return null; - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/AbstractInputDialog.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/AbstractInputDialog.java deleted file mode 100644 index 5ed25aa57b..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/AbstractInputDialog.java +++ /dev/null @@ -1,116 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.ui; - -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.resource.StringConverter; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; - -/** - * Abstract class for creating input dialogs outside from a Wizard. - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public abstract class AbstractInputDialog extends Dialog { - - protected Text errorMessageText; - protected final String title; - protected boolean isFinished; - protected Button okButton; - - /** - * Constructor - * - * @param parentShell - * shell - * @param title - * dialog title - */ - public AbstractInputDialog(final Shell parentShell, final String title) { - super(parentShell); - this.title = title; - } - - protected abstract void validateInput(); - - /** - * Returns true if the dialog is finsihed normally - * - * @return false if closed unexpectedly - */ - public boolean isFinished() { - return isFinished; - } - - /** - * Set error message on the dialog - * - * @param errorMessage - * error message - */ - public void setErrorMessage(final String errorMessage) { - if (errorMessageText != null && !errorMessageText.isDisposed()) { - errorMessageText.setText(errorMessage == null ? " \n " : errorMessage); - - final boolean hasError = errorMessage != null - && StringConverter.removeWhiteSpaces(errorMessage).length() > 0; - errorMessageText.setEnabled(hasError); - errorMessageText.setVisible(hasError); - errorMessageText.getParent().update(); - - final Control button = getButton(IDialogConstants.OK_ID); - if (button != null) { - button.setEnabled(errorMessage == null); - } - } - } - - @Override - protected void configureShell(final Shell shell) { - super.configureShell(shell); - if (title != null) { - shell.setText(title); - } - } - - protected int getInputTextStyle() { - return SWT.SINGLE | SWT.BORDER; - } - - @Override - protected void createButtonsForButtonBar(final Composite parent) { - okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, - true); - createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, - false); - - okButton.addSelectionListener(new SelectionListener() { - - @Override - public void widgetDefaultSelected(final SelectionEvent e) { - } - - @Override - public void widgetSelected(final SelectionEvent e) { - isFinished = true; - } - - }); - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/AddRefacHandler.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/AddRefacHandler.java deleted file mode 100644 index c90a555d59..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/AddRefacHandler.java +++ /dev/null @@ -1,241 +0,0 @@ -package org.erlide.wrangler.refactoring.ui; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; - -import org.eclipse.core.commands.AbstractHandler; -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jface.dialogs.IInputValidator; -import org.eclipse.jface.dialogs.InputDialog; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.window.Window; -import org.eclipse.ui.PlatformUI; -import org.erlide.engine.ErlangEngine; -import org.erlide.engine.model.ErlElementKind; -import org.erlide.engine.model.ErlModelException; -import org.erlide.engine.model.IErlElement; -import org.erlide.engine.model.erlang.IErlAttribute; -import org.erlide.engine.model.root.IErlModule; -import org.erlide.engine.model.root.IErlProject; -import org.erlide.engine.services.parsing.ScannerService; -import org.erlide.wrangler.refactoring.Activator; -import org.erlide.wrangler.refactoring.backend.UserRefactoringsManager; -import org.erlide.wrangler.refactoring.backend.internal.WranglerBackendManager; -import org.erlide.wrangler.refactoring.ui.validator.IValidator; -import org.erlide.wrangler.refactoring.ui.validator.ModuleNameValidator; -import org.osgi.framework.Bundle; - -/** - * Handler for adding user-defined refactorings to Wrangler - * - * @author Aleksandra Lipiec - * @version %I%, %G% - */ -public class AddRefacHandler extends AbstractHandler { - - @Override - public Object execute(final ExecutionEvent event) throws ExecutionException { - - final InputDialog dialog = new InputDialog( - PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), - "Add user-defined refactoring", "Please type callback module name!", "", - new IInputValidator() { - - public IValidator internalV = new ModuleNameValidator(); - - @Override - public String isValid(final String newText) { - if (internalV.isValid(newText)) { - return null; - } - return "Please type a correct module name!"; - } - }); - - dialog.open(); - - if (dialog.getReturnCode() == Window.CANCEL) { - return null; - } - - final String callbackModule = dialog.getValue(); - - final RefacType type = checkType(callbackModule); - if (type == null) { - showErrorMesg("Callback module must implement either " - + "gen_refac or gen_composite_refac behaviour"); - return null; - } - - if (!addAndLoad(callbackModule, type)) { - showErrorMesg("Can not load callback module"); - return null; - } - if (type.equals(RefacType.ELEMENTARY)) { - UserRefactoringsManager.getInstance().addMyElementary(callbackModule); - } else { - UserRefactoringsManager.getInstance().addMyComposite(callbackModule); - } - - MessageDialog.openInformation( - PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), - "Add user-defined refactoring", "Success!"); - - return null; - } - - private void showErrorMesg(final String mesg) { - MessageDialog.openError( - PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), - "Add user-defined refactoring - error", mesg); - } - - // check if the refactoring is elementary or composite - private RefacType checkType(final String callbackModule) { - - try { - final IErlModule module = ErlangEngine.getInstance().getModel() - .findModule(callbackModule); - final ScannerService scanner = module.getScanner(); - try { - module.resetAndCacheScannerAndParser(null); - } finally { - scanner.dispose(); - } - - for (final IErlElement el : module - .getChildrenOfKind(ErlElementKind.ATTRIBUTE)) { - final IErlAttribute attr = (IErlAttribute) el; - if ("behaviour".equals(attr.getName()) - || "behavior".equals(attr.getName())) { - if (attr.getValue().toString().contains("gen_refac")) { - return RefacType.ELEMENTARY; - } else if (attr.getValue().toString() - .contains("gen_composite_refac")) { - return RefacType.COMPOSITE; - } - } - } - return null; - - } catch (final ErlModelException e) { - return null; - } - } - - // look for module path - private boolean addAndLoad(final String callbackModule, final RefacType type) { - - final String sourcePath = getBinPath(callbackModule); - - final IPath destDir = getDestDir(type); - final String destPath = getDestPath(callbackModule, destDir); - String destDirStr = destDir.toOSString(); - destDirStr = destDirStr.substring(destDirStr.lastIndexOf(":") + 1); - - if (sourcePath == null || destPath == null - || copy(sourcePath, destPath, destDirStr)) { - load(callbackModule, destDirStr); - } else { - return false; - } - - return true; - } - - // gets original binary path - private String getBinPath(final String callbackModule) { - String path; - - try { - if (ErlangEngine.getInstance().getModel() - .findModule(callbackModule) == null) { - return null; - } - - final IErlProject project = ErlangEngine.getInstance().getModelUtilService() - .getProject(ErlangEngine.getInstance().getModel() - .findModule(callbackModule)); - path = project.getWorkspaceProject().getLocation() - .append(project.getProperties().getOutputDir()) - .append(callbackModule + ".beam").toOSString(); - - return path; - - } catch (final ErlModelException e) { - return null; - } - } - - // destination directory - private IPath getDestDir(final RefacType type) { - final Bundle coreBundle = Platform.getBundle(Activator.CORE_ID); - return new Path(coreBundle.getLocation()).append("wrangler").append("ebin") - .append(type.getDirName()); - } - - // destination path - private String getDestPath(final String callbackModule, final IPath dir) { - String path = dir.append(callbackModule + ".beam").toOSString(); - path = path.substring(path.lastIndexOf(':') + 1); - return path; - } - - // copying files - private boolean copy(final String source, final String dest, final String destDir) { - - final File dir = new File(destDir); - if (!dir.exists()) { - if (!dir.mkdir()) { - return false; - } - } - - try (InputStream in = new FileInputStream(source); - OutputStream out = new FileOutputStream(dest)) { - final byte[] buf = new byte[1024]; - int len; - while ((len = in.read(buf)) > 0) { - out.write(buf, 0, len); - } - return true; - } catch (final IOException e1) { - return false; - } - } - - // invoke loading module - private void load(final String callbackModule, final String dir) { - WranglerBackendManager.getRefactoringBackend().callWithoutParser( - "load_callback_mod_eclipse", "ss", callbackModule, dir); - } - - /** - * enum for refactoring types - defining refactoring folders - * - * @author Aleksandra Lipiec - * @version %I%, %G% - */ - private enum RefacType { - ELEMENTARY("my_gen_refac"), COMPOSITE("my_gen_composite_refac"); - - private final String dir; - - RefacType(final String dir) { - this.dir = dir; - } - - public String getDirName() { - return dir; - } - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/ExpressionCheckButtonListener.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/ExpressionCheckButtonListener.java deleted file mode 100644 index 7bbe61c8fb..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/ExpressionCheckButtonListener.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.ui; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.swt.events.MouseEvent; -import org.eclipse.swt.events.MouseTrackListener; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Widget; -import org.erlide.wrangler.refactoring.selection.IErlMemberSelection; -import org.erlide.wrangler.refactoring.util.GlobalParameters; -import org.erlide.wrangler.refactoring.util.IErlRange; -import org.erlide.wrangler.refactoring.util.WranglerUtils; - -/** - * For SelectionInputDialog every selectable element is connected with an object from this - * class, to handle mouseover events - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class ExpressionCheckButtonListener implements MouseTrackListener { - - private final IErlMemberSelection selection; - private final Map checkButtons; - - /** - * Constructor - * - * @param checkButtons - * Elements which should be monitored - */ - public ExpressionCheckButtonListener(final HashMap checkButtons) { - this.checkButtons = checkButtons; - selection = (IErlMemberSelection) GlobalParameters.getWranglerSelection(); - } - - @Override - public void mouseEnter(final MouseEvent e) { - setHighlight(e.widget); - } - - @Override - public void mouseExit(final MouseEvent e) { - resetHighlight(); - } - - @Override - public void mouseHover(final MouseEvent e) { - } - - private void setHighlight(final Widget w) { - final int offset = checkButtons.get(w).getOffset(); - final int length = checkButtons.get(w).getLength(); - WranglerUtils.highlightSelection(offset, length, selection); - - } - - private void resetHighlight() { - WranglerUtils.highlightSelection(selection.getSelectionRange().getOffset(), - selection.getSelectionRange().getLength(), selection); - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/NewParameterNameInputDialog.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/NewParameterNameInputDialog.java deleted file mode 100644 index 1973d8f980..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/NewParameterNameInputDialog.java +++ /dev/null @@ -1,100 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.ui; - -import org.eclipse.jface.dialogs.IDialogConstants; -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.Text; -import org.erlide.wrangler.refactoring.ui.validator.IValidator; -import org.erlide.wrangler.refactoring.ui.validator.VariableNameValidator; - -/** - * Input dialog which accpets a single input data. - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class NewParameterNameInputDialog extends AbstractInputDialog { - - private Text newParameterName; - private String data; - - /** - * Constructor - * - * @param parentShell - * shell - * @param title - * dialog title - */ - public NewParameterNameInputDialog(final Shell parentShell, final String title) { - super(parentShell, title); - } - - /** - * Get input data - * - * @return input string - */ - public String getData() { - return data; - } - - @Override - protected Control createDialogArea(final Composite parent) { - final Composite composite = (Composite) super.createDialogArea(parent); - - final Label newParameterNameLabel = new Label(composite, SWT.WRAP); - newParameterNameLabel.setText("New parameter name:"); - final GridData minToksData = new GridData(GridData.GRAB_HORIZONTAL - | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL - | GridData.VERTICAL_ALIGN_CENTER); - minToksData.widthHint = convertHorizontalDLUsToPixels( - IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); - newParameterNameLabel.setLayoutData(minToksData); - newParameterNameLabel.setFont(parent.getFont()); - - newParameterName = new Text(composite, getInputTextStyle()); - newParameterName.setLayoutData( - new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); - newParameterName.addModifyListener(e -> { - data = newParameterName.getText(); - validateInput(); - }); - - errorMessageText = new Text(composite, SWT.READ_ONLY | SWT.WRAP); - errorMessageText.setLayoutData( - new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); - errorMessageText.setBackground(errorMessageText.getDisplay() - .getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); - - setErrorMessage("New parameter name must be a valid variable name!"); - newParameterName.setText(""); - - return composite; - - } - - @Override - protected void validateInput() { - final IValidator v = new VariableNameValidator(); - if (!v.isValid(newParameterName.getText())) { - setErrorMessage("New parameter name must be a valid variable name!"); - } else { - setErrorMessage(null); - } - - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/RefactoringHandler.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/RefactoringHandler.java deleted file mode 100644 index d90a9b8bb5..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/RefactoringHandler.java +++ /dev/null @@ -1,619 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.ui; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.commands.AbstractHandler; -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.resources.IProject; -import org.eclipse.jface.dialogs.IInputValidator; -import org.eclipse.jface.dialogs.InputDialog; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.window.Window; -import org.eclipse.ltk.core.refactoring.RefactoringStatus; -import org.eclipse.ltk.ui.refactoring.RefactoringWizard; -import org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IFileEditorInput; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.texteditor.ITextEditor; -import org.erlide.engine.ErlangEngine; -import org.erlide.engine.model.erlang.IErlFunctionClause; -import org.erlide.runtime.rpc.RpcResult; -import org.erlide.util.ErlLogger; -import org.erlide.util.erlang.OtpErlang; -import org.erlide.wrangler.refactoring.backend.RefactoringState; -import org.erlide.wrangler.refactoring.backend.internal.GenFunRefactoringMessage; -import org.erlide.wrangler.refactoring.backend.internal.GenFunRefactoringMessage.GenFunReturnParameterName; -import org.erlide.wrangler.refactoring.backend.internal.WranglerBackendManager; -import org.erlide.wrangler.refactoring.core.CostumWorkflowRefactoringWithPositionsSelection; -import org.erlide.wrangler.refactoring.core.WranglerRefactoring; -import org.erlide.wrangler.refactoring.core.internal.ApplyAdhocElemRefactoring; -import org.erlide.wrangler.refactoring.core.internal.ApplyUserElementaryRefactoring; -import org.erlide.wrangler.refactoring.core.internal.EqcFsmStateDataToRecordRefactoring; -import org.erlide.wrangler.refactoring.core.internal.EqcStatemStateDataToRecordRefactoring; -import org.erlide.wrangler.refactoring.core.internal.ExtractFunctionRefactoring; -import org.erlide.wrangler.refactoring.core.internal.FoldAgainstMacro; -import org.erlide.wrangler.refactoring.core.internal.FoldLocalExpressionRefactoring; -import org.erlide.wrangler.refactoring.core.internal.FoldRemoteExpressionRefactoring; -import org.erlide.wrangler.refactoring.core.internal.FunctionToProcessRefactoring; -import org.erlide.wrangler.refactoring.core.internal.GenFsmStateDataToRecordRefactoring; -import org.erlide.wrangler.refactoring.core.internal.GeneraliseFunctionRefactoring; -import org.erlide.wrangler.refactoring.core.internal.GeneraliseFunctionRefactoring.State; -import org.erlide.wrangler.refactoring.core.internal.IntroduceLetRefactoring; -import org.erlide.wrangler.refactoring.core.internal.IntroduceMacroRefactoring; -import org.erlide.wrangler.refactoring.core.internal.IntroduceNewVariableRefactoring; -import org.erlide.wrangler.refactoring.core.internal.MergeForAllRefactoring; -import org.erlide.wrangler.refactoring.core.internal.MergeLetRefactoring; -import org.erlide.wrangler.refactoring.core.internal.MoveFunctionRefactoring; -import org.erlide.wrangler.refactoring.core.internal.NormalizeRecordExpression; -import org.erlide.wrangler.refactoring.core.internal.PartitionExportsRefactoring; -import org.erlide.wrangler.refactoring.core.internal.RenameFunctionRefactoring; -import org.erlide.wrangler.refactoring.core.internal.RenameModuleRefactoring; -import org.erlide.wrangler.refactoring.core.internal.RenameProcessRefactoring; -import org.erlide.wrangler.refactoring.core.internal.RenameVariableRefactoring; -import org.erlide.wrangler.refactoring.core.internal.TupleFunctionParametersRefactoring; -import org.erlide.wrangler.refactoring.core.internal.UnfoldFunctionApplicationRefactoring; -import org.erlide.wrangler.refactoring.exception.WranglerException; -import org.erlide.wrangler.refactoring.selection.IErlMemberSelection; -import org.erlide.wrangler.refactoring.ui.validator.AtomValidator; -import org.erlide.wrangler.refactoring.ui.validator.IValidator; -import org.erlide.wrangler.refactoring.ui.validator.ModuleNameValidator; -import org.erlide.wrangler.refactoring.ui.validator.NonEmptyStringValidator; -import org.erlide.wrangler.refactoring.ui.validator.NormalDoulbeValidator; -import org.erlide.wrangler.refactoring.ui.validator.VariableNameValidator; -import org.erlide.wrangler.refactoring.ui.warning.WarningViewManager; -import org.erlide.wrangler.refactoring.ui.wizard.DefaultWranglerRefactoringWizard; -import org.erlide.wrangler.refactoring.ui.wizardpages.ComboInputPage; -import org.erlide.wrangler.refactoring.ui.wizardpages.CostumworkFlowInputPage; -import org.erlide.wrangler.refactoring.ui.wizardpages.RecordDataInputPage; -import org.erlide.wrangler.refactoring.ui.wizardpages.SelectionInputPage; -import org.erlide.wrangler.refactoring.ui.wizardpages.SimpleInputPage; -import org.erlide.wrangler.refactoring.ui.wizardpages.UserRefacInputPage; -import org.erlide.wrangler.refactoring.ui.wizardpages.WranglerPage; -import org.erlide.wrangler.refactoring.util.GlobalParameters; -import org.erlide.wrangler.refactoring.util.WranglerUtils; - -import com.ericsson.otp.erlang.OtpErlangList; -import com.ericsson.otp.erlang.OtpErlangLong; -import com.ericsson.otp.erlang.OtpErlangObject; -import com.ericsson.otp.erlang.OtpErlangRangeException; -import com.ericsson.otp.erlang.OtpErlangTuple; - -/** - * Handles refactoring commands - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class RefactoringHandler extends AbstractHandler { - - @Override - public Object execute(final ExecutionEvent event) throws ExecutionException { - try { - GlobalParameters.setSelection(PlatformUI.getWorkbench() - .getActiveWorkbenchWindow().getActivePage().getSelection()); - } catch (final WranglerException e1) { - - MessageDialog.openError( - PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), - "Error", e1.getMessage()); - return null; - } - - if (!checkForDirtyEditors()) { - return null; - } - - DefaultWranglerRefactoringWizard wizard; - WranglerRefactoring refactoring = null; - final String actionId = event.getCommand().getId(); - - final ArrayList pages = new ArrayList<>(); - - // apply ad hoc refactoring - if ("org.erlide.wrangler.refactoring.adhoc".equals(actionId)) { - final InputDialog dialog = getModuleInput("Apply ad hoc refactoring", - "Please type the gen_refac module name!"); - - dialog.open(); - - if (dialog.getReturnCode() == Window.CANCEL) { - return null; - } - - final String callbackModule = dialog.getValue(); - - pages.add(new UserRefacInputPage("Apply ad hoc refactoring", - "Please type input arguments for this refactoring", - "Arguments should not be empty!", new NonEmptyStringValidator())); - refactoring = new ApplyAdhocElemRefactoring(); - - ((ApplyAdhocElemRefactoring) refactoring) - .setCallbackModuleName(callbackModule); - - if (!((ApplyAdhocElemRefactoring) refactoring).fetchParPrompts()) { - MessageDialog.openError( - PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), - "Elementary refactoring error", "Can not load callback module"); - return null; - } - - // apply user-defined refactoring - } else if ("org.erlide.wrangler.refactoring.gen_refac".equals(actionId)) { - final String callbackModule = event - .getParameter("org.erlide.wrangler.refactoring.gen_refac.callback"); - final String name = event - .getParameter("org.erlide.wrangler.refactoring.gen_refac.name"); - - pages.add(new UserRefacInputPage(name, - "Please type input arguments for this refactoring", - "Arguments should not be empty!", new NonEmptyStringValidator())); - refactoring = new ApplyUserElementaryRefactoring(name, callbackModule); - - if (!((ApplyUserElementaryRefactoring) refactoring).fetchParPrompts()) { - MessageDialog.openError( - PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), - "Refactoring error", "Can not find callback module"); - return null; - } - - // run rename variable refactoring - } else if ("org.erlide.wrangler.refactoring.renamevariable".equals(actionId)) { - refactoring = new RenameVariableRefactoring(); - final SimpleInputPage page = new SimpleInputPage("Rename variable", - "Please type the new variable name!", "New variable name:", - "New name must be a valid Erlang variable name!", - new VariableNameValidator()); - page.setInput(refactoring.getDefaultValue()); - pages.add(page); - - // introduce new variable refactoring - } else if ("org.erlide.wrangler.refactoring.introducenewvariable" - .equals(actionId)) { - pages.add(new SimpleInputPage("Introduce new variable", - "Please type the new variable name!", "New variable name:", - "New name must be a valid Erlang variable name!", - new VariableNameValidator())); - refactoring = new IntroduceNewVariableRefactoring(); - - // run rename function refactoring - } else if ("org.erlide.wrangler.refactoring.renamefunction".equals(actionId)) { - refactoring = new RenameFunctionRefactoring(); - final CostumworkFlowInputPage page = new CostumworkFlowInputPage( - "Rename function", "Please type the new function name!", - "New function name:", "New name must be a valid Erlang atom!", - new AtomValidator()); - page.setInput(refactoring.getDefaultValue()); - pages.add(page); - - // run extract function refactoring - } else if ("org.erlide.wrangler.refactoring.extractfunction".equals(actionId)) { - pages.add(new CostumworkFlowInputPage("Extract function", - "Please type a function name!", "Function name:", - "Function name must be a valid Erlang atom!", new AtomValidator())); - refactoring = new ExtractFunctionRefactoring(); - - // run rename module refactoring - } else if ("org.erlide.wrangler.refactoring.renamemodule".equals(actionId)) { - final boolean answer = MessageDialog.openQuestion( - PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), - "Warning!", - "The requested operation cannot be undone. Would you like to continue?"); - - if (!answer) { - return null; - } - - refactoring = new RenameModuleRefactoring(); - final CostumworkFlowInputPage page = new CostumworkFlowInputPage( - "Rename module", "Please type the new module name!", - "New module name:", "New module name must be a valid Erlang atom!", - new AtomValidator()); - page.setInput(refactoring.getDefaultValue()); - pages.add(page); - - // run move function refactoring - } else if ("org.erlide.wrangler.refactoring.movefunction".equals(actionId)) { - - final IProject project = ErlangEngine.getInstance().getModelUtilService() - .getProject(GlobalParameters.getWranglerSelection().getErlElement()) - .getWorkspaceProject(); - final ArrayList moduleList = WranglerUtils.getModuleNames(project); - final String moduleName = GlobalParameters.getWranglerSelection() - .getErlElement().getResource().getName(); - moduleList.remove(WranglerUtils.removeExtension(moduleName)); - - pages.add(new ComboInputPage("Move function", - "Please select the destination module", "Destination module:", - moduleList)); - refactoring = new MoveFunctionRefactoring(); - - // run fold expression against a local function - } else if ("org.erlide.wrangler.refactoring.foldlocalexpression" - .equals(actionId)) { - - refactoring = new FoldLocalExpressionRefactoring(); - - pages.add(new SelectionInputPage("Fold expression", - "Please select expression which should be fold!", - "Select expressions which should be folded!", - (CostumWorkflowRefactoringWithPositionsSelection) refactoring)); - - // run fold expression against a remote function - } else { - final Shell activeShell = PlatformUI.getWorkbench().getDisplay() - .getActiveShell(); - if ("org.erlide.wrangler.refactoring.foldremoteexpression".equals(actionId)) { - - // must store the selection, because, the user through the - // dialog - // may change it - final IErlMemberSelection sel = (IErlMemberSelection) GlobalParameters - .getWranglerSelection(); - - final RemoteFunctionClauseDialog dialog = new RemoteFunctionClauseDialog( - activeShell, "Fold expression"); - - dialog.open(); - dialog.resetSelection(); - - if (dialog.isFinished()) { - final IErlFunctionClause functionClause = dialog.getFunctionClause(); - refactoring = new FoldRemoteExpressionRefactoring(functionClause, - sel); - pages.add(new SelectionInputPage("Fold expression", - "Please select expression which should be fold!", - "Select expressions which should be folded!", - (CostumWorkflowRefactoringWithPositionsSelection) refactoring)); - - } else { - return null; - } - - // run introduce macro refactoring - } else if ("org.erlide.wrangler.refactoring.introducemacro" - .equals(actionId)) { - refactoring = new IntroduceMacroRefactoring(); - pages.add(new SimpleInputPage("Introduce macro definition", - "Please type the new macro name!", "New macro name:", - "Macro name cannot be empty!", new NonEmptyStringValidator())); - // run rename process refactoring - } else if ("org.erlide.wrangler.refactoring.renameprocess".equals(actionId)) { - refactoring = new RenameProcessRefactoring(); - pages.add(new SimpleInputPage("Rename process", - "Please type the new process name!", "New process name:", - "New process name must be an Erlang atom!", new AtomValidator())); - - // run function to process refactoring - } else if ("org.erlide.wrangler.refactoring.functiontoprocess" - .equals(actionId)) { - refactoring = new FunctionToProcessRefactoring(); - pages.add(new SimpleInputPage("Convert function to process", - "Please type the new process name!", "New process name:", - "New process name must be an Erlang atom!", new AtomValidator())); - - // run tuple function parameters refactoring - } else if ("org.erlide.wrangler.refactoring.tuplefunctonparameters" - .equals(actionId)) { - refactoring = new TupleFunctionParametersRefactoring(); - - // run generalise function refactoring - } else if ("org.erlide.wrangler.refactoring.generalise".equals(actionId)) { - /* - * pages.add(new CostumworkFlowInputPage("Generalise function", - * "Please type the new parameter name!", "New parameter name:", - * "New parameter name must be a valid Erlang variable name!", new - * VariableNameValidator())); - */ - try { - refactoring = runGenFunRefactoring(pages, activeShell); - } catch (final OtpErlangRangeException e) { - ErlLogger.error(e); - return null; - } - - if (refactoring == null) { - return null; - } - - // fold against macro definition - } else if ("org.erlide.wrangler.refactoring.foldagainstmacro" - .equals(actionId)) { - refactoring = new FoldAgainstMacro(); - - pages.add(new SelectionInputPage("Fold against macro definition", - "Please select expression which should be fold!", - "Select expressions which should be folded!", - (CostumWorkflowRefactoringWithPositionsSelection) refactoring)); - - // normalize record expression - } else if ("org.erlide.wrangler.refactoring.normalizerecordexpression" - .equals(actionId)) { - final boolean showDefaultFields = MessageDialog.openQuestion(activeShell, - "Showing defaults", "Show record fields with default values?"); - refactoring = new NormalizeRecordExpression(showDefaultFields); - } else if ("org.erlide.wrangler.refactoring.introducelet".equals(actionId)) { - - pages.add(new CostumworkFlowInputPage("Introduce ?LET", - "Please type the pattern variable name!", - "Pattern variable name:", "New name must be a valid Erlang atom!", - new VariableNameValidator())); - refactoring = new IntroduceLetRefactoring(); - } else if ("org.erlide.wrangler.refactoring.mergelet".equals(actionId)) { - refactoring = new MergeLetRefactoring(); - pages.add(new SelectionInputPage("Merge ?LET expressions", - "Please select expressions which whould be merged!", - "Select expressions which should be merged", - (CostumWorkflowRefactoringWithPositionsSelection) refactoring)); - } else if ("org.erlide.wrangler.refactoring.mergeforall".equals(actionId)) { - refactoring = new MergeForAllRefactoring(); - pages.add(new SelectionInputPage("Merge ?FORALL expressions", - "Please select expressions which should be merged!", - "Select expressions which should be merged", - (CostumWorkflowRefactoringWithPositionsSelection) refactoring)); - - } else if ("org.erlide.wrangler.refactoring.eqc_statemtorecord" - .equals(actionId)) { - refactoring = new EqcStatemStateDataToRecordRefactoring(); - pages.add(new RecordDataInputPage("eqc_statem State Data To Record")); - - } else if ("org.erlide.wrangler.refactoring.eqc_fsmtorecord" - .equals(actionId)) { - refactoring = new EqcFsmStateDataToRecordRefactoring(); - pages.add(new RecordDataInputPage("eqc_fsm State Data To Record")); - - } else if ("org.erlide.wrangler.refactoring.gen_fsmtorecord" - .equals(actionId)) { - refactoring = new GenFsmStateDataToRecordRefactoring(); - pages.add(new RecordDataInputPage("gen_fsm State Data To Record")); - - } else if ("org.erlide.wrangler.refactoring.unfoldfunctionapplication" - .equals(actionId)) { - refactoring = new UnfoldFunctionApplicationRefactoring(); - - } else if ("org.erlide.wrangler.refactoring.partitionexports" - .equals(actionId)) { - refactoring = new PartitionExportsRefactoring(); - final SimpleInputPage page = new SimpleInputPage("Partition exports", - "Please input the the distance treshould between 0.1 and 1.0", - "Distance treshold", "The value must be between 0.1 and 1.0", - new NormalDoulbeValidator()); - page.setInput("0.8"); - pages.add(page); - } else { - return null; - } - } - - refactoring.doBeforeRefactoring(); - // run the given refactoring's wizard - wizard = new DefaultWranglerRefactoringWizard(refactoring, - RefactoringWizard.DIALOG_BASED_USER_INTERFACE, pages); - - final Shell shell = new Shell(); - final RefactoringWizardOpenOperation op = new RefactoringWizardOpenOperation( - wizard); - - try { - final int ret = op.run(shell, refactoring.getName()); - - if (RefactoringStatus.OK == ret) { - refactoring.doAfterRefactoring(); - } - } catch (final Exception e) { - ErlLogger.error(e); - } - - checkWarningMessages(); - return null; - - } - - private InputDialog getModuleInput(final String name, final String mesg) { - return new InputDialog( - PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), name, - mesg, "", new IInputValidator() { - - public IValidator internalV = new ModuleNameValidator(); - - @Override - public String isValid(final String newText) { - if (internalV.isValid(newText)) { - return null; - } - return "Please type a correct module name!"; - } - }); - } - - private boolean checkForDirtyEditors() { - final IEditorPart[] dirtyEditors = PlatformUI.getWorkbench() - .getActiveWorkbenchWindow().getActivePage().getDirtyEditors(); - if (dirtyEditors.length > 0) { - final Boolean answer = MessageDialog.openQuestion( - PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), - "Unsaved changes", - "For running Wrangler refactorings, all Erlang files need to be saved. Would you like to continue with saving files?"); - if (answer) { - for (final IEditorPart ed : dirtyEditors) { - if (ed instanceof ITextEditor) { - final ITextEditor ted = (ITextEditor) ed; - final IFileEditorInput fei = (IFileEditorInput) ted - .getEditorInput(); - if (WranglerUtils.isErlangFile(fei.getFile())) { - ed.doSave(null); - } - - } - } - } - } - return true; - - } - - /** - * Checks whether there is any warning messages, if yes displays a view, containg all - * of them. - */ - protected void checkWarningMessages() { - try { - final RpcResult res = WranglerBackendManager.getRefactoringBackend() - .getLoggedInfo(); - - if (res.isOk()) { - final OtpErlangObject resobj = res.getValue(); - if (!resobj.equals(new OtpErlangList())) { - final OtpErlangList reslist = (OtpErlangList) resobj; - for (int i = 0; i < reslist.arity(); ++i) { - final OtpErlangTuple restuple = (OtpErlangTuple) reslist - .elementAt(i); - final String formattedString = formatWarningString( - OtpErlang.asString(restuple.elementAt(1))); - WarningViewManager.addWarningMessage(formattedString); - } - } - } else { - ErlLogger.error("Wrangler logging error:" + res); - } - } catch (final Exception e) { - ErlLogger.error(e); - } - - } - - private String formatWarningString(final String stringValue) { - try { - String ret = stringValue.replaceAll("\\s=+\\s", ""); - ret = ret.replaceAll("WARNING:\\s*", ""); - ret = ret.replaceAll("((\\n)(\\n))", "\n"); - ret = ret.replaceAll("\\s+$", ""); - return ret; - } catch (final Exception e) { - ErlLogger.error(e); - return stringValue; - } - } - - /** - * Run the generalise function refactoring - * - * @param pages - * @param activeShell - * @return - * @throws OtpErlangRangeException - */ - protected WranglerRefactoring runGenFunRefactoring(final List pages, - final Shell activeShell) throws OtpErlangRangeException { - WranglerRefactoring refactoring = null; - - final IErlMemberSelection sel = (IErlMemberSelection) GlobalParameters - .getWranglerSelection(); - - // Ask the user about a new name - final NewParameterNameInputDialog dialog = new NewParameterNameInputDialog( - activeShell, "New parameter name"); - dialog.open(); - if (!dialog.isFinished()) { - return null; - } - - final String newParamName = dialog.getData(); - dialog.close(); - - // call initial RPC - final GenFunRefactoringMessage m = (GenFunRefactoringMessage) WranglerBackendManager - .getRefactoringBackend().callWithParser(new GenFunRefactoringMessage(), - "generalise_eclipse", "sxxsxi", sel.getFilePath(), - sel.getSelectionRange().getStartPos(), - sel.getSelectionRange().getEndPos(), newParamName, - sel.getSearchPath(), GlobalParameters.getTabWidth()); - - // Examine the result of the refactoring: 4 cases - if (m.getRefactoringState() == RefactoringState.OK) { - refactoring = new GeneraliseFunctionRefactoring(State.ok, m); - - } else if (m.getRefactoringState() == RefactoringState.MULTI_INSTANCES) { - - refactoring = new GeneraliseFunctionRefactoring(State.multi_instance, m); - - pages.add(new SelectionInputPage("Generalise expression", - "Please select which of them should be generalised!", - "Select one of them, which should be folded!", - (CostumWorkflowRefactoringWithPositionsSelection) refactoring)); - - } else if (m.getRefactoringState() == RefactoringState.MORE_THAN_ONE_CLAUSE) { - final boolean selectedClauseOnly = MessageDialog.openQuestion(activeShell, - "Multiple clauses", - "The function selected has multiple clauses, would you like" - + " to generalise the function clause selected only?"); - refactoring = new GeneraliseFunctionRefactoring(State.more_than_one_clause, m, - selectedClauseOnly); - if (((OtpErlangList) m.getParameters() - .get(GenFunReturnParameterName.dupsInClause)).arity() > 0) { - pages.add(new SelectionInputPage("Generalise expression", - "Please select which of them should be generalised!", - "Select one of them, which should be folded!", - (CostumWorkflowRefactoringWithPositionsSelection) refactoring)); - } - - } else if (m.getRefactoringState() == RefactoringState.UNKNOWN_SIDE_EFFECT) { - final boolean sideEffect = MessageDialog.openQuestion(activeShell, - "Side effect", "Does the expression selected has side effect?"); - - final OtpErlangObject noOfClausesPar = m.getParameters() - .get(GenFunReturnParameterName.noOfClauses); - if (noOfClausesPar != null - && ((OtpErlangLong) noOfClausesPar).intValue() > 1) { - final boolean selectedClauseOnly = MessageDialog.openQuestion(activeShell, - "Multiple clauses", - "The function selected has multiple clauses, would you like" - + " to generalise the function clause selected only?"); - refactoring = new GeneraliseFunctionRefactoring(State.unknown_side_effect, - m, selectedClauseOnly, sideEffect); - - if (!selectedClauseOnly - && ((OtpErlangList) m.getParameters() - .get(GenFunReturnParameterName.dupsInFun)).arity() > 0 - || selectedClauseOnly && ((OtpErlangList) m.getParameters() - .get(GenFunReturnParameterName.dupsInClause)) - .arity() > 0) { - pages.add(new SelectionInputPage("Generalise expression", - "Please select which of them should be generalised!", - "Select one of them, which should be folded!", - (CostumWorkflowRefactoringWithPositionsSelection) refactoring)); - } - - } else { - refactoring = new GeneraliseFunctionRefactoring(State.unknown_side_effect, - m, true, sideEffect); - pages.add(new SelectionInputPage("Generalise expression", - "Please select which of them should be generalised!", - "Select one of them, which should be folded!", - (CostumWorkflowRefactoringWithPositionsSelection) refactoring)); - - } - - } else if (m.getRefactoringState() == RefactoringState.ERROR) { - refactoring = new GeneraliseFunctionRefactoring(State.error, - m.getMessageString()); - - } else { - // error? - return null; - } - return refactoring; - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/RemoteFunctionClauseDialog.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/RemoteFunctionClauseDialog.java deleted file mode 100644 index c18b95c481..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/RemoteFunctionClauseDialog.java +++ /dev/null @@ -1,201 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.ui; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -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.Tree; -import org.eclipse.swt.widgets.TreeItem; -import org.erlide.engine.ErlangEngine; -import org.erlide.engine.model.ErlModelException; -import org.erlide.engine.model.IErlElement; -import org.erlide.engine.model.erlang.IErlFunction; -import org.erlide.engine.model.erlang.IErlFunctionClause; -import org.erlide.engine.model.root.IErlModule; -import org.erlide.util.ErlLogger; -import org.erlide.wrangler.refactoring.selection.IErlMemberSelection; -import org.erlide.wrangler.refactoring.util.GlobalParameters; -import org.erlide.wrangler.refactoring.util.WranglerUtils; - -/** - * Input dialog which shows up all the function clauses in all modules in the project - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class RemoteFunctionClauseDialog extends AbstractInputDialog { - - IErlMemberSelection initianlSelection = (IErlMemberSelection) GlobalParameters - .getWranglerSelection(); - - /** - * Sets back the initial Erlide selection - */ - public void resetSelection() { - WranglerUtils.highlightSelection( - initianlSelection.getSelectionRange().getOffset(), - initianlSelection.getSelectionRange().getLength(), initianlSelection); - } - - /** - * Constructor - * - * @param parentShell - * shell - * @param title - * Dialog title - */ - public RemoteFunctionClauseDialog(final Shell parentShell, final String title) { - super(parentShell, title); - } - - private IErlFunctionClause functionClause; - - @Override - protected Control createDialogArea(final Composite parent) { - - final Composite composite = (Composite) super.createDialogArea(parent); - final Tree functionClausesTree; - - final Label label = new Label(composite, SWT.WRAP); - label.setText("Please select the function clause which against should fold!"); - final GridData minToksData = new GridData(GridData.GRAB_HORIZONTAL - | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL - | GridData.VERTICAL_ALIGN_CENTER); - minToksData.widthHint = convertHorizontalDLUsToPixels( - IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); - label.setLayoutData(minToksData); - label.setFont(parent.getFont()); - - functionClausesTree = new Tree(composite, SWT.BORDER); - final GridData treeData = new GridData(GridData.GRAB_HORIZONTAL - | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL - | GridData.VERTICAL_ALIGN_CENTER); - treeData.widthHint = convertHorizontalDLUsToPixels( - IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); - functionClausesTree.setLayoutData(treeData); - - try { - final Collection erlmodules = ErlangEngine.getInstance() - .getModelUtilService() - .getProject(GlobalParameters.getWranglerSelection().getErlElement()) - .getModules(); - - for (final IErlModule m : erlmodules) { - // must refresh the scanner! - m.open(null); - - final TreeItem moduleName = new TreeItem(functionClausesTree, 0); - moduleName.setText(m.getModuleName()); - moduleName.setData(m); - final List functions = filterFunctions(m.getChildren()); - for (final IErlFunction f : functions) { - final TreeItem functionName = new TreeItem(moduleName, 0); - functionName.setText(f.getNameWithArity()); - final List clauses = filterClauses( - f.getChildren()); - functionName.setData(f); - for (final IErlFunctionClause c : clauses) { - final TreeItem clauseName = new TreeItem(functionName, 0); - clauseName.setText(String.valueOf(c.getName())); - clauseName.setData(c); - } - } - } - - // listen to treeitem selection - functionClausesTree.addSelectionListener(new SelectionListener() { - - @Override - public void widgetDefaultSelected(final SelectionEvent e) { - } - - // if a function or a function clause is selected, then - // highlight it - // and store the selection - @Override - public void widgetSelected(final SelectionEvent e) { - - final TreeItem[] selectedItems = functionClausesTree.getSelection(); - - if (selectedItems.length > 0) { - final TreeItem treeItem = selectedItems[0]; - final Object data = treeItem.getData(); - if (data instanceof IErlFunctionClause) { - // enable the ok button - okButton.setEnabled(true); - - // highlight - WranglerUtils.highlightSelection((IErlFunctionClause) data); - - // store - functionClause = (IErlFunctionClause) data; - } else { - okButton.setEnabled(false); - } - } - - } - - }); - } catch (final ErlModelException e) { - ErlLogger.error(e); - } - - applyDialogFont(composite); - return composite; - } - - protected List filterClauses( - final Collection children) { - final List clauses = new ArrayList<>(); - for (final IErlElement e : children) { - if (e instanceof IErlFunctionClause) { - clauses.add((IErlFunctionClause) e); - } - } - return clauses; - } - - protected List filterFunctions(final Collection elements) { - final List functions = new ArrayList<>(); - for (final IErlElement e : elements) { - if (e instanceof IErlFunction) { - functions.add((IErlFunction) e); - } - } - - return functions; - } - - @Override - protected void validateInput() { - } - - /** - * Returns the selected functionClause if there is. - * - * @return selected function clause - */ - public IErlFunctionClause getFunctionClause() { - return functionClause; - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/WranglerTester.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/WranglerTester.java deleted file mode 100644 index 7624530a44..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/WranglerTester.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.ui; - -import org.eclipse.core.expressions.PropertyTester; - -/** - * Property tester class for checking menu visibilty preconditions - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class WranglerTester extends PropertyTester { - /** - * Default constructor - */ - public WranglerTester() { - } - - /** - * Test if QC, GraphViz is installed on the system. - */ - - @Override - public boolean test(final Object receiver, final String property, final Object[] args, - final Object expectedValue) { - if ("hasQuickCheck".equals(property) || "hasGraphViz".equals(property)) { - } - - return true; - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/dnd/MoveFunctionDropHandler.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/dnd/MoveFunctionDropHandler.java deleted file mode 100644 index 609293a27f..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/dnd/MoveFunctionDropHandler.java +++ /dev/null @@ -1,112 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.ui.dnd; - -import java.util.ArrayList; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jface.util.LocalSelectionTransfer; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.TreeSelection; -import org.eclipse.ltk.ui.refactoring.RefactoringWizard; -import org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation; -import org.eclipse.swt.dnd.DropTargetEvent; -import org.eclipse.swt.dnd.TransferData; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.navigator.CommonDropAdapter; -import org.erlide.engine.model.IErlElement; -import org.erlide.engine.model.erlang.IErlFunctionClause; -import org.erlide.ui.navigator.dnd.INavigatorDropHandler; -import org.erlide.util.ErlLogger; -import org.erlide.wrangler.refactoring.core.internal.MoveFunctionRefactoring; -import org.erlide.wrangler.refactoring.exception.WranglerException; -import org.erlide.wrangler.refactoring.ui.wizard.DefaultWranglerRefactoringWizard; -import org.erlide.wrangler.refactoring.ui.wizardpages.WranglerPage; -import org.erlide.wrangler.refactoring.util.GlobalParameters; - -/** - * Implements san erlide drag'n'drop extension point - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class MoveFunctionDropHandler implements INavigatorDropHandler { - - /** - * Default constructor - */ - public MoveFunctionDropHandler() { - } - - @Override - public IStatus validateDrop(final Object target, final int operation, - final TransferData transferType) { - final ISelection sel = (ISelection) LocalSelectionTransfer.getTransfer() - .nativeToJava(transferType); - final TreeSelection s = (TreeSelection) sel; - final IErlElement e = (IErlElement) s.getFirstElement(); - - if (e instanceof IErlFunctionClause) { - if (target instanceof IErlElement || target instanceof IFile) { - return Status.OK_STATUS; - } - } - return Status.CANCEL_STATUS; - } - - @Override - public IStatus handleDrop(final CommonDropAdapter dropAdapter, - final DropTargetEvent dropTargetEvent, final Object target) { - - // get the source data - final TransferData td = dropAdapter.getCurrentTransfer(); - final ISelection sel = (ISelection) LocalSelectionTransfer.getTransfer() - .nativeToJava(td); - final TreeSelection s = (TreeSelection) sel; - try { - GlobalParameters.setSelection(s); - } catch (final WranglerException e1) { - e1.printStackTrace(); - } - - // get the target data - String moduleName; - IFile file; - if (target instanceof IFile) { - file = (IFile) target; - } else { - file = (IFile) ((IErlElement) target).getResource(); - } - moduleName = file.getName(); - - moduleName = moduleName.substring(0, moduleName.lastIndexOf(".")); - - final MoveFunctionRefactoring refactoring = new MoveFunctionRefactoring(); - refactoring.setUserInput(moduleName); - final RefactoringWizard wizard = new DefaultWranglerRefactoringWizard(refactoring, - RefactoringWizard.DIALOG_BASED_USER_INTERFACE, - new ArrayList()); - - final Shell shell = PlatformUI.getWorkbench().getDisplay().getActiveShell(); - - final RefactoringWizardOpenOperation op = new RefactoringWizardOpenOperation( - wizard); - - try { - op.run(shell, refactoring.getName()); - } catch (final Exception e) { - ErlLogger.error(e); - } - - return Status.OK_STATUS; - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/menu/UserMyRefacContribution.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/menu/UserMyRefacContribution.java deleted file mode 100644 index b23fedfee7..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/menu/UserMyRefacContribution.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.erlide.wrangler.refactoring.ui.menu; - -import java.util.HashMap; -import java.util.List; - -import org.eclipse.jface.action.IContributionItem; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.actions.CompoundContributionItem; -import org.eclipse.ui.menus.CommandContributionItem; -import org.eclipse.ui.menus.CommandContributionItemParameter; -import org.erlide.wrangler.refactoring.backend.UserRefactoringInfo; -import org.erlide.wrangler.refactoring.backend.UserRefactoringsManager; - -/** - * Menu contribution for generating menu items for user's own refactorings - * - * @author Aleksandra Lipiec - * @version %I%, %G% - */ -public class UserMyRefacContribution extends CompoundContributionItem { - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - protected IContributionItem[] getContributionItems() { - final List refacs = UserRefactoringsManager.getInstance() - .getMyElementary(); - if (refacs.isEmpty()) { - final CommandContributionItemParameter param = new CommandContributionItemParameter( - PlatformUI.getWorkbench(), null, - "org.erlide.wrangler.refactoring.empty", - CommandContributionItem.STYLE_PUSH); - param.label = ""; - final CommandContributionItem item = new CommandContributionItem(param); - return new IContributionItem[] { item }; - } - final IContributionItem[] items = new IContributionItem[refacs.size()]; - - int i = 0; - for (final UserRefactoringInfo info : refacs) { - final CommandContributionItemParameter param = new CommandContributionItemParameter( - PlatformUI.getWorkbench(), info.getCallback(), - "org.erlide.wrangler.refactoring.gen_refac", - CommandContributionItem.STYLE_PUSH); - param.label = info.getLabel(); - param.parameters = new HashMap(); - param.parameters.put("org.erlide.wrangler.refactoring.gen_refac.callback", - info.getCallback()); - param.parameters.put("org.erlide.wrangler.refactoring.gen_refac.name", - info.getLabel()); - items[i] = new CommandContributionItem(param); - i++; - } - - return items; - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/menu/UserRefacContribution.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/menu/UserRefacContribution.java deleted file mode 100644 index 237e2ba2a1..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/menu/UserRefacContribution.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.erlide.wrangler.refactoring.ui.menu; - -import java.util.HashMap; -import java.util.List; - -import org.eclipse.jface.action.IContributionItem; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.actions.CompoundContributionItem; -import org.eclipse.ui.menus.CommandContributionItem; -import org.eclipse.ui.menus.CommandContributionItemParameter; -import org.erlide.wrangler.refactoring.backend.UserRefactoringInfo; -import org.erlide.wrangler.refactoring.backend.UserRefactoringsManager; - -/** - * Menu contribution - committed refactoring menu items (those from the repository) - * - * @author Aleksandra Lipiec - * @version %I%, %G% - */ -public class UserRefacContribution extends CompoundContributionItem { - - public UserRefacContribution() { - } - - public UserRefacContribution(final String id) { - super(id); - } - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Override - protected IContributionItem[] getContributionItems() { - - final List refacs = UserRefactoringsManager.getInstance() - .getElementary(); - final IContributionItem[] items = new IContributionItem[refacs.size()]; - - int i = 0; - for (final UserRefactoringInfo info : refacs) { - final CommandContributionItemParameter param = new CommandContributionItemParameter( - PlatformUI.getWorkbench(), info.getCallback(), - "org.erlide.wrangler.refactoring.gen_refac", - CommandContributionItem.STYLE_PUSH); - param.label = info.getLabel(); - param.parameters = new HashMap(); - param.parameters.put("org.erlide.wrangler.refactoring.gen_refac.callback", - info.getCallback()); - param.parameters.put("org.erlide.wrangler.refactoring.gen_refac.name", - info.getLabel()); - items[i] = new CommandContributionItem(param); - i++; - } - - return items; - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/validator/AtomValidator.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/validator/AtomValidator.java deleted file mode 100644 index ad75aef92b..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/validator/AtomValidator.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.ui.validator; - -/** - * Validate a string which is an Erlang atom.ss - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class AtomValidator implements IValidator { - - @Override - public boolean isValid(final String s) { - if (s.isEmpty()) { - return false; - } - if (s.charAt(0) == '\'' && s.charAt(s.length() - 1) == '\'') { - return true; - } - if (s.substring(0, 1).replaceAll("[a-z]", "").isEmpty() - && s.replaceAll("[A-Za-z_@0-9]", "").isEmpty()) { - return true; - } - return false; - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/validator/IValidator.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/validator/IValidator.java deleted file mode 100644 index 4f606dabd0..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/validator/IValidator.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.ui.validator; - -/** - * Interface for validator classes. Implementors should implemet a class which is for - * validatin g a string. - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public interface IValidator { - /** - * Validate a string - * - * @param text - * input string - * @return true if the string is valid, else false - */ - boolean isValid(String text); -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/validator/ModuleNameValidator.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/validator/ModuleNameValidator.java deleted file mode 100644 index d6055e1cd5..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/validator/ModuleNameValidator.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.erlide.wrangler.refactoring.ui.validator; - -import org.erlide.engine.ErlangEngine; -import org.erlide.engine.model.ErlModelException; - -/** - * Validator for module names - * - * Check if module exists - * - * @author Aleksandra Lipiec - * @version %I%, %G% - */ -public class ModuleNameValidator extends AtomValidator { - - @Override - public boolean isValid(final String s) { - if (!super.isValid(s)) { - return false; - } - try { - if (ErlangEngine.getInstance().getModel().findModule(s) == null) { - return false; - } - } catch (final ErlModelException e) { - return false; - } - return true; - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/validator/NonEmptyStringValidator.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/validator/NonEmptyStringValidator.java deleted file mode 100644 index 2000faf304..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/validator/NonEmptyStringValidator.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.ui.validator; - -/** - * Validate a string which is not empty - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class NonEmptyStringValidator implements IValidator { - - @Override - public boolean isValid(final String text) { - return !"".equals(text); - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/validator/NormalDoulbeValidator.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/validator/NormalDoulbeValidator.java deleted file mode 100644 index b09752a83c..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/validator/NormalDoulbeValidator.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.erlide.wrangler.refactoring.ui.validator; - -/** - * Validates a string which is a double values and is between 0.1 and 1.0 - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class NormalDoulbeValidator implements IValidator { - - @Override - public boolean isValid(final String text) { - try { - final Double val = Double.parseDouble(text); - return val <= 1 && val >= 0.1; - } catch (final Exception e) { - return false; - } - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/validator/VariableNameValidator.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/validator/VariableNameValidator.java deleted file mode 100644 index b0960ac841..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/validator/VariableNameValidator.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.ui.validator; - -/** - * Validate a string which can be an Erlang variables - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class VariableNameValidator implements IValidator { - - @Override - public boolean isValid(final String s) { - if (s.isEmpty()) { - return false; - } - - if (s.startsWith("_") - || s.substring(0, 1).toUpperCase().equals(s.substring(0, 1))) { - return s.replaceAll("[A-Za-z_@0-9]", "").isEmpty(); - } - return false; - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/warning/IWarningHandler.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/warning/IWarningHandler.java deleted file mode 100644 index dee86788ff..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/warning/IWarningHandler.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.ui.warning; - -/** - * Interface class for adding and removing warning messages - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public interface IWarningHandler { - /** - * Adds a warning message to the view. - * - * @param message - * warning message - */ - void addMessage(String message); - - /** - * Removes all warning messages - */ - void removeAll(); - - /** - * Refreshes the displayed warning messages. - */ - void refresh(); - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/warning/WarningMessage.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/warning/WarningMessage.java deleted file mode 100644 index 2acdc51ab9..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/warning/WarningMessage.java +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.ui.warning; - -import java.util.Date; - -/** - * Data type for representing the corresponding data for warning messages - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class WarningMessage { - protected Date timestamp; - protected String message; - - /** - * Constructor - * - * @param timestamp - * time when the warning message was got - * @param message - * warning message - */ - public WarningMessage(final Date timestamp, final String message) { - this.timestamp = timestamp; - this.message = message; - } - - /** - * Constructor - * - * @param message - * warning message - */ - public WarningMessage(final String message) { - this(new Date(), message); - } - - /** - * @return the timestamp - */ - public Date getTimestamp() { - return timestamp; - } - - /** - * @return the message - */ - public String getMessage() { - return message; - } - - /** - * @param timestamp - * the timestamp to set - */ - public void setTimestamp(final Date timestamp) { - this.timestamp = timestamp; - } - - /** - * @param message - * the message to set - */ - public void setMessage(final String message) { - this.message = message; - } - - // /** - // * Returns the elements in an array - // * - // * @return elements array - // */ - // public Object[] toArray() { - // Object[] ret = new Object[2]; - // ret[0] = timestamp; - // ret[1] = message; - // return ret; - // } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/warning/WarningView.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/warning/WarningView.java deleted file mode 100644 index d7077b3d6f..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/warning/WarningView.java +++ /dev/null @@ -1,156 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.ui.warning; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -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.graphics.Image; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.ISharedImages; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.part.ViewPart; -import org.erlide.util.ErlLogger; - -/** - * Displays warning messages got from Wrangler - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class WarningView extends ViewPart implements IWarningHandler { - - /** - * The ID of the view as specified by the extension. - */ - public static final String ID = "org.erlide.wrangler.refactoring.ui.warning.WarningView"; - - private TableViewer viewer; - - private final List warningMessages = new ArrayList<>(); - - protected final class RemoveAction extends Action { - protected RemoveAction() { - setText("Remove all"); - setToolTipText("Remove all warning message"); - setImageDescriptor(PlatformUI.getWorkbench().getSharedImages() - .getImageDescriptor(ISharedImages.IMG_ELCL_REMOVEALL)); - - } - - @Override - public void run() { - removeAll(); - } - } - - // private Action doubleClickAction; - - class ViewContentProvider implements IStructuredContentProvider { - @Override - public void inputChanged(final Viewer v, final Object oldInput, - final Object newInput) { - } - - @Override - public void dispose() { - } - - @Override - public Object[] getElements(final Object parent) { - return warningMessages.toArray(); - } - } - - class ViewLabelProvider extends LabelProvider implements ITableLabelProvider { - @Override - public String getColumnText(final Object obj, final int index) { - return getText(((WarningMessage) obj).getMessage()); - } - - @Override - public Image getColumnImage(final Object obj, final int index) { - return getImage(obj); - } - - @Override - public Image getImage(final Object obj) { - return PlatformUI.getWorkbench().getSharedImages() - .getImage(ISharedImages.IMG_OBJS_WARN_TSK); - } - } - - class NameSorter extends ViewerComparator { - @Override - public int compare(final Viewer theViewer, final Object e1, final Object e2) { - final WarningMessage w1 = (WarningMessage) e1; - final WarningMessage w2 = (WarningMessage) e2; - return -1 * w1.getTimestamp().compareTo(w2.getTimestamp()); - } - } - - /** - * The constructor. - */ - public WarningView() { - } - - /** - * This is a callback that will allow us to create the viewer and initialize it. - */ - @Override - public void createPartControl(final Composite parent) { - viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); - viewer.setContentProvider(new ViewContentProvider()); - viewer.setLabelProvider(new ViewLabelProvider()); - viewer.setComparator(new NameSorter()); - viewer.setInput(getViewSite()); - final IToolBarManager mgr = getViewSite().getActionBars().getToolBarManager(); - mgr.add(new RemoveAction()); - - } - - /** - * Passing the focus request to the viewer's control. - */ - @Override - public void setFocus() { - viewer.getControl().setFocus(); - } - - @Override - public void addMessage(final String message) { - warningMessages.add(new WarningMessage(message)); - } - - @Override - public void refresh() { - try { - viewer.refresh(); - } catch (final Exception e) { - ErlLogger.error(e); - } - - } - - @Override - public void removeAll() { - warningMessages.clear(); - refresh(); - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/warning/WarningViewManager.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/warning/WarningViewManager.java deleted file mode 100644 index df26f5d421..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/warning/WarningViewManager.java +++ /dev/null @@ -1,95 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.ui.warning; - -import org.eclipse.ui.IViewPart; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.PlatformUI; -import org.erlide.util.ErlLogger; - -/** - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class WarningViewManager { - /** - * Warning view ID - */ - public static final String warningViewID = WarningView.ID; - - private static IWarningHandler view; - - private WarningViewManager() { - } - - /** - * Sets the warning view - * - * @param _view - * Warning message view - */ - public static void setWarningView(final IWarningHandler _view) { - WarningViewManager.view = _view; - } - - /** - * Adds a warning message to the view - * - * @param message - * warning message - */ - public static void addWarningMessage(final String message) { - try { - // if (view == null) { - WarningViewManager.setWarningView( - (IWarningHandler) WarningViewManager.showWarningView()); - // } - WarningViewManager.view.addMessage(message); - WarningViewManager.view.refresh(); - - } catch (final Exception t) { - t.printStackTrace(); - } - - } - - /** - * Shows the warning view. - * - * @return view which is shown - */ - public static IViewPart showWarningView() { - final IWorkbench workbench = PlatformUI.getWorkbench(); - - final IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); - try { - final IViewPart theView = window.getActivePage() - .showView(WarningViewManager.warningViewID); - return theView; - } catch (final PartInitException e) { - ErlLogger.error(e); - } - return null; - } - - /** - * Hides the warning view. - */ - public static void closeWarningView() { - final IWorkbench workbench = PlatformUI.getWorkbench(); - - final IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); - final IViewPart theView = window.getActivePage() - .findView(WarningViewManager.warningViewID); - window.getActivePage().hideView(theView); - - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/wizard/AbstractWranglerRefactoringWizard.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/wizard/AbstractWranglerRefactoringWizard.java deleted file mode 100644 index fce0119f70..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/wizard/AbstractWranglerRefactoringWizard.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.ui.wizard; - -import org.eclipse.ltk.core.refactoring.Refactoring; -import org.eclipse.ltk.ui.refactoring.RefactoringWizard; - -/** - * Abstract wizard which should be used for integrating wrangler refactoringss - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public abstract class AbstractWranglerRefactoringWizard extends RefactoringWizard { - - /** - * Default constructor - * - * @param refactoring - * refactoring - * @param flags - * flags - */ - public AbstractWranglerRefactoringWizard(final Refactoring refactoring, - final int flags) { - super(refactoring, flags); - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/wizard/DefaultWranglerRefactoringWizard.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/wizard/DefaultWranglerRefactoringWizard.java deleted file mode 100644 index d0c9cc79d0..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/wizard/DefaultWranglerRefactoringWizard.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.ui.wizard; - -import java.util.ArrayList; - -import org.eclipse.ltk.core.refactoring.Refactoring; -import org.erlide.wrangler.refactoring.ui.wizardpages.WranglerPage; - -/** - * Refactoring Wizard class which used for integrating Wrangler refactorings - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class DefaultWranglerRefactoringWizard extends AbstractWranglerRefactoringWizard { - - private final Iterable pages; - - /** - * Default constructor - * - * @param refactoring - * integrated refactoring - * @param flags - * flags - * @param pages - * input pages which should be shown - */ - public DefaultWranglerRefactoringWizard(final Refactoring refactoring, - final int flags, final ArrayList pages) { - super(refactoring, flags); - this.pages = pages; - setWindowTitle(refactoring.getName()); - setDefaultPageTitle(refactoring.getName()); - } - - @Override - protected void addUserInputPages() { - for (final WranglerPage page : pages) { - addPage(page); - } - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/wizardpages/ComboInputPage.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/wizardpages/ComboInputPage.java deleted file mode 100644 index 21ba7109da..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/wizardpages/ComboInputPage.java +++ /dev/null @@ -1,131 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.ui.wizardpages; - -import java.util.ArrayList; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.layout.RowLayout; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.erlide.wrangler.refactoring.core.SimpleOneStepWranglerRefactoring; -import org.erlide.wrangler.refactoring.core.SimpleWranglerRefactoring; -import org.erlide.wrangler.refactoring.ui.validator.AtomValidator; -import org.erlide.wrangler.refactoring.ui.validator.IValidator; - -/** - * Input page which displays a combo input element, and offers to select on of the listed - * elements - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class ComboInputPage extends InputPage { - - protected String labelText; - - protected Composite composite; - - protected Label inputLabel; - - protected Iterable moduleNames; - - protected Combo selectionList; - - /** - * Constructor - * - * @param name - * Input page title - * @param description - * description of the input page - * @param labelText - * label text of the input data - * @param moduleNames - * list of possible selections - */ - public ComboInputPage(final String name, final String description, - final String labelText, final ArrayList moduleNames) { - super(name); - setDescription(description); - this.labelText = labelText; - this.moduleNames = moduleNames; - - setPageComplete(false); - } - - @Override - public void createControl(final Composite parent) { - composite = new Composite(parent, SWT.NONE); - - inputLabel = new Label(composite, SWT.LEFT); - inputLabel.setText(labelText); - - // GridData gridData = new GridData(); - // gridData.horizontalAlignment = GridData.FILL; - // gridData.horizontalSpan = 2; - // inputLabel.setLayoutData(gridData); - - selectionList = new Combo(composite, SWT.DROP_DOWN); - for (final String s : moduleNames) { - selectionList.add(s); - } - // gridData = new GridData(); - // gridData.horizontalAlignment = GridData.FILL; - // gridData.horizontalSpan = 2; - // selectionList.setLayoutData(gridData); - - // GridLayout layout = new GridLayout(); - final RowLayout layout = new RowLayout(); - layout.spacing = 5; - layout.center = true; - - composite.setLayout(layout); - - setControl(composite); - - selectionList.addSelectionListener(new SelectionListener() { - - @Override - public void widgetDefaultSelected(final SelectionEvent e) { - } - - @Override - @SuppressWarnings("synthetic-access") - public void widgetSelected(final SelectionEvent e) { - ((SimpleOneStepWranglerRefactoring) getRefactoring()) - .setUserInput(selectionList.getText()); - setPageComplete(true); - } - }); - - final IValidator validator = new AtomValidator(); - - selectionList.addModifyListener(e -> { - if (validator.isValid(selectionList.getText())) { - ((SimpleWranglerRefactoring) getRefactoring()) - .setUserInput(selectionList.getText()); - setErrorMessage(null); - setPageComplete(true); - } else { - setPageComplete(false); - setErrorMessage("Module name must be a a valid atom!"); - } - }); - - } - - @Override - protected boolean isInputValid() { - return false; - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/wizardpages/CostumworkFlowInputPage.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/wizardpages/CostumworkFlowInputPage.java deleted file mode 100644 index 25f0dc5982..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/wizardpages/CostumworkFlowInputPage.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.ui.wizardpages; - -import org.eclipse.swt.widgets.Shell; -import org.erlide.wrangler.refactoring.core.CostumWorkflowRefactoring; -import org.erlide.wrangler.refactoring.core.RefactoringWorkflowController; -import org.erlide.wrangler.refactoring.ui.validator.IValidator; - -/** - * An Input page which hacks the standard workflow and allows to run costum commands after - * pressing next or finish. - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class CostumworkFlowInputPage extends SimpleInputPage { - - protected CostumWorkflowRefactoring costumWrokflowRefactoring; - protected RefactoringWorkflowController workflowController; - - /** - * Default constructor - * - * @param name - * Input page title - * @param description - * Input page description - * @param labelText - * input data label - * @param inputErrorMsg - * error message in case of the user mistyped sg - * @param validator - * validator object - */ - public CostumworkFlowInputPage(final String name, final String description, - final String labelText, final String inputErrorMsg, - final IValidator validator) { - super(name, description, labelText, inputErrorMsg, validator); - } - - @Override - protected void controlWorkflow(final Shell s) { - setCostumRefactoring(); - workflowController = costumWrokflowRefactoring.getWorkflowController(s); - workflowController.doRefactoring(); - } - - /* - * @Override public boolean isLastUserInputPage() { setCostumRefactoring(); if - * (workflowController.controlInputPagesOrder()) return - * workflowController.isLastPage(); else return super.isLastUserInputPage(); } - */ - - protected void setCostumRefactoring() { - if (costumWrokflowRefactoring == null) { - costumWrokflowRefactoring = (CostumWorkflowRefactoring) getRefactoring(); - } - } - - @Override - public boolean canFlipToNextPage() { - return isPageComplete(); - } -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/wizardpages/InputPage.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/wizardpages/InputPage.java deleted file mode 100644 index 753aa0ab17..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/wizardpages/InputPage.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.ui.wizardpages; - -import org.eclipse.jface.wizard.IWizardPage; -import org.eclipse.swt.widgets.Shell; - -/** - * Abstract input page class - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public abstract class InputPage extends WranglerPage { - - /** - * @param name - * input page title - */ - public InputPage(final String name) { - super(name); - } - - @Override - public IWizardPage getNextPage() { - controlWorkflow(getShell()); - // from UserInPutPageWizard class - return super.getNextPage(); - } - - @Override - protected boolean performFinish() { - controlWorkflow(getShell()); - return super.performFinish(); - } - - /** - * Abstract method which could be use for controlling the workflow. - * - * @param s - * shell - */ - protected void controlWorkflow(final Shell s) { - } - - protected abstract boolean isInputValid(); - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/wizardpages/ModuleInputPage.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/wizardpages/ModuleInputPage.java deleted file mode 100644 index ef1dc71643..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/wizardpages/ModuleInputPage.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.erlide.wrangler.refactoring.ui.wizardpages; - -import org.eclipse.jface.wizard.IWizardPage; -import org.erlide.wrangler.refactoring.core.internal.UserRefactoring; -import org.erlide.wrangler.refactoring.ui.validator.IValidator; - -/** - * Input page for ad hoc custom refactorings, enables to pass the name for the callback - * module - * - * @author Aleksandra Lipiec - * @version %I%, %G% - */ -public class ModuleInputPage extends SimpleInputPage { - - public ModuleInputPage(final String name, final String description, - final String labelText, final String inputErrorMsg, - final IValidator validator) { - super(name, description, labelText, inputErrorMsg, validator); - } - - @Override - protected boolean isInputValid() { - if (validator.isValid(inputText.getText())) { - ((UserRefactoring) getRefactoring()) - .setCallbackModuleName(inputText.getText()); - setErrorMessage(null); - setPageComplete(true); - return true; - - } - setPageComplete(false); - setErrorMessage(inputErrorMsg); - return false; - } - - @Override - public IWizardPage getNextPage() { - if (!((UserRefactoring) getRefactoring()).fetchParPrompts()) { - setErrorMessage("Can not load specified callback module"); - setPageComplete(false); - } - return super.getNextPage(); - - } - -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/wizardpages/MultiInputPage.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/wizardpages/MultiInputPage.java deleted file mode 100644 index 544e95f9ac..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/wizardpages/MultiInputPage.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.ui.wizardpages; - -import org.eclipse.swt.widgets.Composite; - -/** - * Input page which offers to input multiple data - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public abstract class MultiInputPage extends InputPage { - - /** - * Constructor - * - * @param name - * title - */ - public MultiInputPage(final String name) { - super(name); - } - - @Override - public abstract void createControl(Composite parent); -} diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/wizardpages/RecordDataInputPage.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/wizardpages/RecordDataInputPage.java deleted file mode 100644 index 604903f57a..0000000000 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/wizardpages/RecordDataInputPage.java +++ /dev/null @@ -1,136 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 György Orosz. All rights reserved. This program and the accompanying - * materials are made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: György Orosz - initial API and implementation - ******************************************************************************/ -package org.erlide.wrangler.refactoring.ui.wizardpages; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.swt.SWT; -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.Label; -import org.eclipse.swt.widgets.Text; -import org.erlide.wrangler.refactoring.core.internal.QuickCheckStateRefactoring; -import org.erlide.wrangler.refactoring.ui.validator.AtomValidator; -import org.erlide.wrangler.refactoring.ui.validator.IValidator; - -/** - * Wizard pages, on which the user can input the necessary data for a record - * - * @author Gyorgy Orosz - * @version %I%, %G% - */ -public class RecordDataInputPage extends MultiInputPage { - - IValidator validator; - - protected ArrayList fieldNames; - protected ArrayList