clean-up re Bug 338524 - Avoid using class MessageFormat
- no more NLS problems in any of our plugins.
diff --git a/plugins/org.eclipse.objectteams.otdt.refactoring/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.objectteams.otdt.refactoring/.settings/org.eclipse.jdt.core.prefs
index 9e07070..247b4b7 100644
--- a/plugins/org.eclipse.objectteams.otdt.refactoring/.settings/org.eclipse.jdt.core.prefs
+++ b/plugins/org.eclipse.objectteams.otdt.refactoring/.settings/org.eclipse.jdt.core.prefs
@@ -1,4 +1,4 @@
-#Sat Aug 28 18:48:01 CEST 2010
+#Tue Mar 01 14:47:11 CET 2011
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
@@ -25,6 +25,7 @@
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
@@ -47,12 +48,15 @@
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+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.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.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
diff --git a/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/RefactoringMessages.java b/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/RefactoringMessages.java
new file mode 100644
index 0000000..da3faf0
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/RefactoringMessages.java
@@ -0,0 +1,65 @@
+package org.eclipse.objectteams.otdt.internal.refactoring;
+
+import org.eclipse.osgi.util.NLS;
+
+public class RefactoringMessages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.objectteams.otdt.internal.refactoring.RefactoringMessages"; //$NON-NLS-1$
+ public static String ChangeSignatureAdaptor_callinBaseArgDeleteIncomplete_info;
+ public static String ChangeSignatureAdaptor_callinRoleArgAddIncomplete_info;
+ public static String ChangeSignatureAdaptor_calloutBaseArgAddIncomplete_info;
+ public static String ChangeSignatureAdaptor_calloutRoleArgDeleteIncomplete_info;
+ public static String ChangeSignatureAdaptor_cannotCreateParamMap_CTF_warning;
+ public static String ChangeSignatureAdaptor_cannotCreateParamMap_MultiCallin_warning;
+ public static String ChangeSignatureAdaptor_cannotUpdateParameterMapping_warning;
+ public static String MoveInstanceMethodAdaptor_ambiguousMethodSpec_error;
+ public static String MoveInstanceMethodAdaptor_checkOverloading_progress;
+ public static String MoveInstanceMethodAdaptor_moveInstanceMethod_name;
+ public static String MoveInstanceMethodAdaptor_overloading_error;
+ public static String PullUpAdaptor_ambiguousMethodSpec_error;
+ public static String PullUpAdaptor_callinMethodToNonRole_error;
+ public static String PullUpAdaptor_checkOverloading_progress;
+ public static String PullUpAdaptor_checkOverriding_progress;
+ public static String PullUpAdaptor_checkShadowing_progress;
+ public static String PullUpAdaptor_fieldShadowing_error;
+ public static String PullUpAdaptor_overloading_error;
+ public static String PullUpAdaptor_overriding_error;
+ public static String PullUpAdaptor_referencedByMethodBinding_error;
+ public static String PushDownAdaptor_ambiguousMethodSpec_error;
+ public static String PushDownAdaptor_boundAsCallout_error;
+ public static String PushDownAdaptor_boundAsCTF_error;
+ public static String PushDownAdaptor_boundInCallin_error;
+ public static String PushDownAdaptor_checkShadowing_progress;
+ public static String PushDownAdaptor_overloading_error;
+ public static String PushDownAdaptor_overloading_progress;
+ public static String PushDownAdaptor_overriding_progress;
+ public static String PushDownAdaptor_overridingImplicitlyInherited_error;
+ public static String PushDownAdaptor_phantomRoleConflict_error;
+ public static String PushDownAdaptor_referencedByCallin_error;
+ public static String PushDownAdaptor_referencedByCallout_error;
+ public static String PushDownAdaptor_referencedByCalloutParamMap_error;
+ public static String PushDownAdaptor_referencedByCTF_error;
+ public static String PushDownAdaptor_referencedByCTFParamMap_error;
+ public static String PushDownAdaptor_referencedByMethod_error;
+ public static String PushDownAdaptor_referencedInCallinParamMap_error;
+ public static String PushDownAdaptor_shadowing_error;
+ public static String RenameMethodAmbuguityMsgCreator_ambiguousMethodSpec_error;
+ public static String RenameMethodOverloadingMsgCreator_overloading_error;
+ public static String RenameTypeAdaptor_addType_editName;
+ public static String RenameTypeAdaptor_changeImplicitTypes_progress;
+ public static String RenameTypeAdaptor_newTypeConflic_error;
+ public static String RenameTypeAdaptor_overridden_error;
+ public static String RenameTypeAdaptor_overriding_error;
+ public static String RenameTypeAdaptor_overriding_progress;
+ public static String RenameTypeAdaptor_predefinedRoleName_error;
+ public static String RenameTypeAdaptor_roleShadowing_error;
+ public static String RenameTypeAdaptor_shadowedByRole_error;
+ public static String RenameTypeAdaptor_shadowExistingType_error;
+ public static String RenameTypeAdaptor_teamCollidesWithPackage_error;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, RefactoringMessages.class);
+ }
+
+ private RefactoringMessages() {
+ }
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/RefactoringMessages.properties b/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/RefactoringMessages.properties
new file mode 100644
index 0000000..7ac0858
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/RefactoringMessages.properties
@@ -0,0 +1,51 @@
+ChangeSignatureAdaptor_callinBaseArgDeleteIncomplete_info=Deleting arguments at the base side of a callin binding is not fully supported. Please manually update transitive references.
+ChangeSignatureAdaptor_callinRoleArgAddIncomplete_info=Adding arguments at the role side of a callin binding is not fully supported. Please manually update transitive references.
+ChangeSignatureAdaptor_calloutBaseArgAddIncomplete_info=Adding arguments at the base side of a callout binding is not fully supported. Please manually update transitive references.
+ChangeSignatureAdaptor_calloutRoleArgDeleteIncomplete_info=Deleting arguments at the role side of a callout binding is not fully supported. Please manually update transitive references.
+ChangeSignatureAdaptor_cannotCreateParamMap_CTF_warning=Need to create parameter mapping, which however is not yet implemented for callout-to-field
+ChangeSignatureAdaptor_cannotCreateParamMap_MultiCallin_warning=Need to create parameter mapping, which however is not yet implemented for callin to multiple bases
+ChangeSignatureAdaptor_cannotUpdateParameterMapping_warning=Cannot update existing parameter mapping
+MoveInstanceMethodAdaptor_ambiguousMethodSpec_error=Refactoring cannot be performed\! There would be an ambiguous method specifier in a method binding after moving\!
+MoveInstanceMethodAdaptor_checkOverloading_progress=Checking Overloading
+MoveInstanceMethodAdaptor_moveInstanceMethod_name=Move Instance Method
+MoveInstanceMethodAdaptor_overloading_error=Moved method will be overloaded after refactoring\!
+PullUpAdaptor_ambiguousMethodSpec_error=Refactoring cannot be performed\! There would be an ambiguous method specifier in a method binding after moving\!
+PullUpAdaptor_callinMethodToNonRole_error=The callin method ''{0}'' can only be moved to a role (OTJLD \uFFFD4.2.(d)).
+PullUpAdaptor_checkOverloading_progress=Checking Overloading
+PullUpAdaptor_checkOverriding_progress=Checking Overriding
+PullUpAdaptor_checkShadowing_progress=Checking Shadowing
+PullUpAdaptor_fieldShadowing_error=The pulled up field ''{0}'' would be shadowed in ''{1}''.
+PullUpAdaptor_overloading_error=The pulled up method ''{0}'' would be overloaded after refactoring.
+PullUpAdaptor_overriding_error=The pulled up method ''{0}'' would be overridden in ''{1}''.
+PullUpAdaptor_referencedByMethodBinding_error=Pulled up member ''{0}'' is referenced in an aspect binding by ''{1}''
+PushDownAdaptor_ambiguousMethodSpec_error=Refactoring cannot be performed\! There would be an ambiguous method specifier in a method binding after moving\!
+PushDownAdaptor_boundAsCallout_error=The pushed down method ''{0}'' is bound in a callout method binding in ''{1}''.
+PushDownAdaptor_boundAsCTF_error=The pushed down method ''{0}'' is bound in a callout to field binding in ''{1}''.
+PushDownAdaptor_boundInCallin_error=The pushed down method ''{0}'' is bound in a callin method binding in ''{1}'' and will not be visible after refactoring.
+PushDownAdaptor_checkShadowing_progress=Checking Shadowing
+PushDownAdaptor_overloading_error=The pushed down method ''{0}'' would be overloaded after refactoring.
+PushDownAdaptor_overloading_progress=Checking Overloading
+PushDownAdaptor_overriding_progress=Checking Overriding
+PushDownAdaptor_overridingImplicitlyInherited_error=The pushed down method ''{0}'' would override the implicitly inherited method ''{1}''.
+PushDownAdaptor_phantomRoleConflict_error=An implicit sub role of ''{0}'' is a phantom role, therefore the pushed down members cannot be moved to ''{1}''.
+PushDownAdaptor_referencedByCallin_error=The pushed down method ''{0}'' is referenced in a callin method binding in ''{1}'' and will not be visible after refactoring.
+PushDownAdaptor_referencedByCallout_error=The pushed down method ''{0}'' is referenced in a callout method binding in ''{1}'' and will not be visible after refactoring.
+PushDownAdaptor_referencedByCalloutParamMap_error=The pushed down member ''{0}'' is referenced in a callout parameter mapping in ''{1}'' and will not be visible after refactoring.
+PushDownAdaptor_referencedByCTF_error=The pushed down field ''{0}'' is referenced in a callout to field binding in ''{1}'' and will not be visible after refactoring.
+PushDownAdaptor_referencedByCTFParamMap_error=The pushed down member ''{0}'' is referenced in a callout to field value mapping in ''{1}'' and will not be visible after refactoring.
+PushDownAdaptor_referencedByMethod_error=Pushed down member ''{0}'' is referenced by ''{1}''.
+PushDownAdaptor_referencedInCallinParamMap_error=The pushed down member ''{0}'' is referenced in a callin parameter mapping in ''{1}'' and will not be visible after refactoring.
+PushDownAdaptor_shadowing_error=The pushed down field ''{0}'' would be shadowed in ''{1}''.
+RenameMethodAmbuguityMsgCreator_ambiguousMethodSpec_error=Refactoring cannot be performed\! There would be an ambiguous method specifier in a method binding after renaming\!
+RenameMethodOverloadingMsgCreator_overloading_error=Renamed method will be overloaded after refactoring\!
+RenameTypeAdaptor_addType_editName=Add Type
+RenameTypeAdaptor_changeImplicitTypes_progress=Create changes for implicit type declarations
+RenameTypeAdaptor_newTypeConflic_error=New type ''{0}'' conflicts with the existing type ''{1}''.
+RenameTypeAdaptor_overridden_error=The renamed role type would be overridden by role type ''{0}''.
+RenameTypeAdaptor_overriding_error=The renamed role type would override the inherited role type ''{0}''.
+RenameTypeAdaptor_overriding_progress=Check Overriding
+RenameTypeAdaptor_predefinedRoleName_error=''{0}'' is a predefined role type and cannot be overridden
+RenameTypeAdaptor_roleShadowing_error=A role type named ''{0}'' exists in ''{1}'' and would shadow the renamed type (OTJLD §1.4(a)).
+RenameTypeAdaptor_shadowedByRole_error=The role type ''{0}'' would shadow the renamed type (OTJLD §1.4(a)).
+RenameTypeAdaptor_shadowExistingType_error=The renamed role type would shadow the visible type ''{0}'' (OTJLD §1.4(a)).
+RenameTypeAdaptor_teamCollidesWithPackage_error=The new team name ''{0}'' collides with the package ''{1}'', therefore a renaming of the role directory ''{2}'' is impossible.
diff --git a/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/adaptor/ChangeSignatureAdaptor.java b/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/adaptor/ChangeSignatureAdaptor.java
index 9dcdf4b..123429a 100644
--- a/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/adaptor/ChangeSignatureAdaptor.java
+++ b/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/adaptor/ChangeSignatureAdaptor.java
@@ -26,11 +26,6 @@
import org.eclipse.jdt.core.dom.CallinMappingDeclaration;
import org.eclipse.jdt.core.dom.CalloutMappingDeclaration;
import org.eclipse.jdt.core.dom.ChildListPropertyDescriptor;
-import org.eclipse.jdt.core.dom.ClassInstanceCreation;
-import org.eclipse.jdt.core.dom.EnumConstantDeclaration;
-import org.eclipse.jdt.core.dom.EnumDeclaration;
-import org.eclipse.jdt.core.dom.MethodDeclaration;
-import org.eclipse.jdt.core.dom.MethodInvocation;
import org.eclipse.jdt.core.dom.MethodMappingElement;
import org.eclipse.jdt.core.dom.MethodSpec;
import org.eclipse.jdt.core.dom.ParameterMapping;
@@ -39,21 +34,21 @@
import org.eclipse.jdt.core.dom.StructuralPropertyDescriptor;
import org.eclipse.jdt.core.dom.rewrite.ASTRewrite;
import org.eclipse.jdt.core.dom.rewrite.ListRewrite;
-import org.eclipse.jdt.internal.corext.dom.ASTNodes;
import org.eclipse.jdt.internal.corext.refactoring.ParameterInfo;
import org.eclipse.jdt.internal.corext.refactoring.RefactoringCoreMessages;
import org.eclipse.jdt.internal.corext.refactoring.base.JavaStatusContext;
import org.eclipse.jdt.internal.corext.refactoring.rename.TempOccurrenceAnalyzer;
import org.eclipse.jdt.internal.corext.refactoring.structure.CompilationUnitRewrite;
-import org.eclipse.jdt.internal.corext.util.Messages;
import org.eclipse.jdt.internal.ui.viewsupport.BasicElementLabels;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
import org.eclipse.ltk.core.refactoring.RefactoringStatusContext;
+import org.eclipse.objectteams.otdt.internal.refactoring.RefactoringMessages;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.text.edits.TextEditGroup;
import base org.eclipse.jdt.internal.corext.refactoring.structure.ChangeSignatureProcessor;
-import base org.eclipse.jdt.internal.corext.refactoring.structure.ChangeSignatureProcessor.OccurrenceUpdate;
import base org.eclipse.jdt.internal.corext.refactoring.structure.ChangeSignatureProcessor.DeclarationUpdate;
+import base org.eclipse.jdt.internal.corext.refactoring.structure.ChangeSignatureProcessor.OccurrenceUpdate;
/**
* OT/J adaptations for the "Change Signature" Refactoring.
@@ -109,14 +104,14 @@
boolean hasAdditions = !getAddedInfos().isEmpty();
if (!isSrcSide && hasAdditions) {
if (node.getParent().getNodeType() == ASTNode.CALLIN_MAPPING_DECLARATION)
- refResult.merge(RefactoringStatus.createInfoStatus("Adding arguments at the role side of a callin binding is not fully supported. Please manually update transitive references."));
+ refResult.merge(RefactoringStatus.createInfoStatus(RefactoringMessages.ChangeSignatureAdaptor_callinRoleArgAddIncomplete_info));
else
- refResult.merge(RefactoringStatus.createInfoStatus("Adding arguments at the base side of a callout binding is not fully supported. Please manually update transitive references."));
+ refResult.merge(RefactoringStatus.createInfoStatus(RefactoringMessages.ChangeSignatureAdaptor_calloutBaseArgAddIncomplete_info));
} else if (isSrcSide && hasDelections) {
if (node.getParent().getNodeType() == ASTNode.CALLIN_MAPPING_DECLARATION)
- refResult.merge(RefactoringStatus.createInfoStatus("Deleting arguments at the base side of a callin binding is not fully supported. Please manually update transitive references."));
+ refResult.merge(RefactoringStatus.createInfoStatus(RefactoringMessages.ChangeSignatureAdaptor_callinBaseArgDeleteIncomplete_info));
else
- refResult.merge(RefactoringStatus.createInfoStatus("Deleting arguments at the role side of a callout binding is not fully supported. Please manually update transitive references."));
+ refResult.merge(RefactoringStatus.createInfoStatus(RefactoringMessages.ChangeSignatureAdaptor_calloutRoleArgDeleteIncomplete_info));
}
}
@@ -195,7 +190,7 @@
Object[] keys= new String[]{ BasicElementLabels.getJavaElementName(paramDecl.getName().getIdentifier()),
BasicElementLabels.getJavaElementName(fMethodSpec.getName().getIdentifier()),
BasicElementLabels.getJavaElementName(typeName)};
- String msg= Messages.format(RefactoringCoreMessages.ChangeSignatureRefactoring_parameter_used, keys);
+ String msg= NLS.bind(RefactoringCoreMessages.ChangeSignatureRefactoring_parameter_used, keys);
fResult.addError(msg, context);
}
}
@@ -220,7 +215,7 @@
return;
AbstractMethodMappingDeclaration mapping = (AbstractMethodMappingDeclaration) this.fMethodSpec.getParent();
if (mapping.hasParameterMapping()) {
- fResult.merge(RefactoringStatus.createWarningStatus("Cannot update existing parameter mapping"));
+ fResult.merge(RefactoringStatus.createWarningStatus(RefactoringMessages.ChangeSignatureAdaptor_cannotUpdateParameterMapping_warning));
return;
}
// collect these pieces of information:
@@ -234,7 +229,7 @@
if (isRoleSide) {
List baseMappingElements = ((CallinMappingDeclaration)mapping).getBaseMappingElements();
if (baseMappingElements.size() > 1) {
- fResult.merge(RefactoringStatus.createWarningStatus("Need to create parameter mapping, which however is not yet implemented for callin to multiple bases"));
+ fResult.merge(RefactoringStatus.createWarningStatus(RefactoringMessages.ChangeSignatureAdaptor_cannotCreateParamMap_MultiCallin_warning));
return;
}
otherSideArguments = ((MethodSpec)baseMappingElements.get(0)).parameters();
@@ -248,7 +243,7 @@
if (isRoleSide) {
MethodMappingElement baseMappingElement = ((CalloutMappingDeclaration)mapping).getBaseMappingElement();
if (baseMappingElement.getNodeType() == ASTNode.FIELD_ACCESS_SPEC) {
- fResult.merge(RefactoringStatus.createWarningStatus("Need to create parameter mapping, which however is not yet implemented for callout-to-field"));
+ fResult.merge(RefactoringStatus.createWarningStatus(RefactoringMessages.ChangeSignatureAdaptor_cannotCreateParamMap_CTF_warning));
return;
}
otherSideArguments = ((MethodSpec)baseMappingElement).parameters();
diff --git a/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/adaptor/CorextAdaptor.java b/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/adaptor/CorextAdaptor.java
index 927b11f..d90046b 100644
--- a/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/adaptor/CorextAdaptor.java
+++ b/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/adaptor/CorextAdaptor.java
@@ -149,7 +149,7 @@
ASTNode getDestination() -> get ASTNode fDestination;
String getMethodName() -> String getMethodName();
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({ "unchecked", "rawtypes" })
List<ParameterInfo> getParameterInfos() -> List getParameterInfos();
}
diff --git a/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/adaptor/MoveInstanceMethodAdaptor.java b/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/adaptor/MoveInstanceMethodAdaptor.java
index 97a85de..36ea39c 100644
--- a/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/adaptor/MoveInstanceMethodAdaptor.java
+++ b/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/adaptor/MoveInstanceMethodAdaptor.java
@@ -7,6 +7,7 @@
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
+import org.eclipse.objectteams.otdt.internal.refactoring.RefactoringMessages;
import org.eclipse.objectteams.otdt.internal.refactoring.util.IAmbuguityMessageCreator;
import org.eclipse.objectteams.otdt.internal.refactoring.util.IOverloadingMessageCreator;
import org.eclipse.objectteams.otdt.internal.refactoring.util.RefactoringUtil;
@@ -32,8 +33,8 @@
void checkFinalConditions(IProgressMonitor pm, RefactoringStatus result) throws CoreException {
if(!result.hasFatalError())
- result.merge(RefactoringUtil.checkForExistingRoles("Move Instance Method", getFMethod().getJavaProject(), pm));
- pm.beginTask("Checking Overloading", 1);
+ result.merge(RefactoringUtil.checkForExistingRoles(RefactoringMessages.MoveInstanceMethodAdaptor_moveInstanceMethod_name, getFMethod().getJavaProject(), pm));
+ pm.beginTask(RefactoringMessages.MoveInstanceMethodAdaptor_checkOverloading_progress, 1);
pm.subTask(""); //$NON-NLS-1$
result.merge(checkOverloadingAndAmbiguity(pm));
pm.worked(1);
@@ -54,13 +55,13 @@
new IAmbuguityMessageCreator() {
public String createAmbiguousMethodSpecifierMsg() {
- return "Refactoring cannot be performed! There would be an ambiguous method specifier in a method binding after moving!";
+ return RefactoringMessages.MoveInstanceMethodAdaptor_ambiguousMethodSpec_error;
}
}, new IOverloadingMessageCreator() {
public String createOverloadingMessage() {
- return "Moved method will be overloaded after refactoring!";
+ return RefactoringMessages.MoveInstanceMethodAdaptor_overloading_error;
}
}, pm);
diff --git a/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/adaptor/NotSupportedRefactoringAdaptor.java b/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/adaptor/NotSupportedRefactoringAdaptor.java
index ab32cb0..ee41b55 100644
--- a/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/adaptor/NotSupportedRefactoringAdaptor.java
+++ b/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/adaptor/NotSupportedRefactoringAdaptor.java
@@ -4,15 +4,16 @@
package org.eclipse.objectteams.otdt.internal.refactoring.adaptor;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.ltk.core.refactoring.RefactoringStatus;
-import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
-import org.eclipse.objectteams.otdt.internal.refactoring.util.RefactoringUtil;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IField;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.ITypeRoot;
import org.eclipse.jdt.core.refactoring.descriptors.ExtractClassDescriptor;
+import org.eclipse.jdt.internal.corext.refactoring.RefactoringCoreMessages;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
+import org.eclipse.objectteams.otdt.internal.refactoring.util.RefactoringUtil;
import base org.eclipse.jdt.internal.corext.refactoring.code.InlineConstantRefactoring;
import base org.eclipse.jdt.internal.corext.refactoring.code.InlineMethodRefactoring;
@@ -36,7 +37,7 @@
IJavaProject getProject() -> IJavaProject getProject();
private void checkFinalConditions(IProgressMonitor pm, RefactoringStatus status) when(!status.hasFatalError()) {
- status.merge(RefactoringUtil.checkForExistingRoles("Introduce Indirection", getProject(),pm));
+ status.merge(RefactoringUtil.checkForExistingRoles(RefactoringCoreMessages.IntroduceIndirectionRefactoring_introduce_indirection_name, getProject(),pm));
}
void checkFinalConditions(IProgressMonitor pm, RefactoringStatus status) <- after RefactoringStatus checkFinalConditions(
@@ -51,7 +52,7 @@
ITypeRoot getFInitialTypeRoot() -> get ITypeRoot fInitialTypeRoot;
private void checkFinalConditions(IProgressMonitor pm, RefactoringStatus status) when(!status.hasFatalError()) {
- status.merge(RefactoringUtil.checkForExistingRoles("Inline Method", getFInitialTypeRoot().getJavaProject(), pm));
+ status.merge(RefactoringUtil.checkForExistingRoles(RefactoringCoreMessages.InlineMethodRefactoring_name, getFInitialTypeRoot().getJavaProject(), pm));
}
void checkFinalConditions(IProgressMonitor pm, RefactoringStatus status) <- after RefactoringStatus checkFinalConditions(IProgressMonitor pm) with {
@@ -65,7 +66,7 @@
IField getFField() -> get IField fField;
private void checkFinalConditions(IProgressMonitor pm, RefactoringStatus status) when(!status.hasFatalError()) {
- status.merge(RefactoringUtil.checkForExistingRoles("Inline Constant", getFField().getJavaProject(), pm));
+ status.merge(RefactoringUtil.checkForExistingRoles(RefactoringCoreMessages.InlineConstantRefactoring_name, getFField().getJavaProject(), pm));
}
void checkFinalConditions(IProgressMonitor pm, RefactoringStatus status) <- after RefactoringStatus checkFinalConditions(IProgressMonitor pm) with {
@@ -79,7 +80,7 @@
ExtractClassDescriptor getFDescriptor() -> get ExtractClassDescriptor fDescriptor;
private void checkFinalConditions(IProgressMonitor pm, RefactoringStatus status) when(!status.hasFatalError()) {
- status.merge(RefactoringUtil.checkForExistingRoles("Extract Class", getFDescriptor().getType().getJavaProject(), pm));
+ status.merge(RefactoringUtil.checkForExistingRoles(RefactoringCoreMessages.ExtractClassRefactoring_refactoring_name, getFDescriptor().getType().getJavaProject(), pm));
}
void checkFinalConditions(IProgressMonitor pm, RefactoringStatus status) <- after RefactoringStatus checkFinalConditions(IProgressMonitor pm) with {
@@ -96,7 +97,7 @@
protected class IntroduceParameterObjectProcessor extends ChangeSignatureProcessor playedBy IntroduceParameterObjectProcessor {
protected void checkFinalConditions(IProgressMonitor pm, RefactoringStatus status) when(!status.hasFatalError()) {
- status.merge(RefactoringUtil.checkForExistingRoles("Introduce Parameter Object", getFMethod().getJavaProject(), pm));
+ status.merge(RefactoringUtil.checkForExistingRoles(RefactoringCoreMessages.IntroduceParameterObjectRefactoring_refactoring_name, getFMethod().getJavaProject(), pm));
}
void checkFinalConditions(IProgressMonitor pm, RefactoringStatus status) <- after RefactoringStatus checkFinalConditions(IProgressMonitor pm,
CheckConditionsContext context) with {
@@ -110,7 +111,7 @@
ICompilationUnit getFCu() -> get ICompilationUnit fCu;
private void checkFinalConditions(IProgressMonitor pm, RefactoringStatus status) when(!status.hasFatalError()) {
- status.merge(RefactoringUtil.checkForExistingRoles("Change Type", getFCu().getJavaProject(), pm));
+ status.merge(RefactoringUtil.checkForExistingRoles(RefactoringCoreMessages.ChangeTypeRefactoring_name, getFCu().getJavaProject(), pm));
}
void checkFinalConditions(IProgressMonitor pm, RefactoringStatus status) <- after RefactoringStatus checkFinalConditions(IProgressMonitor pm) with {
diff --git a/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/adaptor/RenameTypeAdaptor.java b/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/adaptor/RenameTypeAdaptor.java
index 940f9f5..0ce4943 100644
--- a/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/adaptor/RenameTypeAdaptor.java
+++ b/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/adaptor/RenameTypeAdaptor.java
@@ -3,7 +3,6 @@
*/
package org.eclipse.objectteams.otdt.internal.refactoring.adaptor;
-import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -26,7 +25,6 @@
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.internal.corext.refactoring.Checks;
-import org.eclipse.jdt.internal.corext.refactoring.RefactoringCoreMessages;
import org.eclipse.jdt.internal.corext.refactoring.SearchResultGroup;
import org.eclipse.jdt.internal.corext.refactoring.base.JavaStatusContext;
import org.eclipse.jdt.internal.corext.refactoring.changes.DynamicValidationRefactoringChange;
@@ -35,20 +33,21 @@
import org.eclipse.jdt.internal.corext.refactoring.changes.TextChangeCompatibility;
import org.eclipse.jdt.internal.corext.refactoring.util.TextChangeManager;
import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
-import org.eclipse.jdt.internal.corext.util.Messages;
import org.eclipse.jdt.internal.ui.viewsupport.BasicElementLabels;
import org.eclipse.ltk.core.refactoring.Change;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
import org.eclipse.ltk.core.refactoring.TextChange;
import org.eclipse.ltk.core.refactoring.TextFileChange;
import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
-import org.eclipse.text.edits.ReplaceEdit;
import org.eclipse.objectteams.otdt.core.IOTType;
import org.eclipse.objectteams.otdt.core.IPhantomType;
import org.eclipse.objectteams.otdt.core.IRoleType;
import org.eclipse.objectteams.otdt.core.OTModelManager;
import org.eclipse.objectteams.otdt.core.TypeHelper;
import org.eclipse.objectteams.otdt.core.hierarchy.OTTypeHierarchies;
+import org.eclipse.objectteams.otdt.internal.refactoring.RefactoringMessages;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.text.edits.ReplaceEdit;
import base org.eclipse.jdt.internal.corext.refactoring.rename.RenameTypeProcessor;
@@ -295,7 +294,7 @@
}
private void addTypeDeclarationUpdate(TextChangeManager manager, IType type) throws CoreException {
- String name = RefactoringCoreMessages.RenameTypeRefactoring_update;
+ String name = RefactoringMessages.RenameTypeAdaptor_addType_editName;
int typeNameLength = type.getElementName().length();
ICompilationUnit cu = type.getCompilationUnit();
TextChangeCompatibility.addTextEdit(manager.get(cu), name, new ReplaceEdit(type.getNameRange().getOffset(), typeNameLength, getNewElementName()));
@@ -304,7 +303,7 @@
}
private void createChanges(IProgressMonitor pm) throws JavaModelException, CoreException{
- pm.beginTask("Create changes for implicit type declarations", fImplicitRelatedTypes.length);
+ pm.beginTask(RefactoringMessages.RenameTypeAdaptor_changeImplicitTypes_progress, fImplicitRelatedTypes.length);
pm.subTask(""); //$NON-NLS-1$
if(fTypeToRenameIsRole){
for (int i = 0; i < fImplicitRelatedTypes.length; i++) {
@@ -341,7 +340,9 @@
// a role directory exists
if(fRoleDirectory != null){
// rename the directory to the new team name
- RenamePackageChange renameRoleFolderChange= new RenamePackageChange( fRoleDirectory, typeToRename.getPackageFragment().getElementName() + "." + getNewElementName(), false);
+ RenamePackageChange renameRoleFolderChange= new RenamePackageChange( fRoleDirectory,
+ typeToRename.getPackageFragment().getElementName() + '.' + getNewElementName(),
+ false);
((DynamicValidationRefactoringChange)jdtChange).add(renameRoleFolderChange);
}
}
@@ -393,8 +394,7 @@
for (int j = 0; j < roles.length; j++) {
IType role = roles[j];
if(role.getElementName().equals(getNewElementName())){
- String msg = Messages.format("A role type named ''{0}'' exists in ''{1}'' and would shadow the renamed type (OTJLD §1.4(a)).", new String[] { getNewElementName(),
- type.getFullyQualifiedName('.') });
+ String msg = NLS.bind(RefactoringMessages.RenameTypeAdaptor_roleShadowing_error, getNewElementName(), type.getFullyQualifiedName('.'));
jdtStatus.addError(msg, JavaStatusContext.create(role));
}
}
@@ -442,7 +442,7 @@
|| newRoleName.equals(ICONFINED)
|| newRoleName.equals(ILOWERABLE))
{
- status.addFatalError(RefactoringCoreMessages.RenameTypeRefactoring_choose_another_name);
+ status.addFatalError(NLS.bind(RefactoringMessages.RenameTypeAdaptor_predefinedRoleName_error, newRoleName));
}
return status;
}
@@ -459,7 +459,7 @@
IOTType otElement = OTModelManager.getOTElement(getFType());
IOTType enclosingTeam = ((IRoleType)otElement).getTeam();
- pm.beginTask("Check Overriding", 1);
+ pm.beginTask(RefactoringMessages.RenameTypeAdaptor_overriding_progress, 1);
pm.subTask(""); //$NON-NLS-1$
RefactoringStatus status = new RefactoringStatus();
try{
@@ -468,8 +468,7 @@
for (int i = 0; i < roles.length; i++) {
IType currRole = roles[i];
if(currRole.getElementName().equals(getNewElementName())){
- String msg = Messages.format("The renamed role type would override the inherited role type ''{0}''.",
- new String[] { currRole.getFullyQualifiedName('.') });
+ String msg = NLS.bind(RefactoringMessages.RenameTypeAdaptor_overriding_error, currRole.getFullyQualifiedName('.'));
status.addError(msg, JavaStatusContext.create(currRole));
return status;
}
@@ -485,8 +484,7 @@
for (int j = 0; j < declaredRoles.length; j++) {
IType currRole = declaredRoles[j];
if(currRole.getElementName().equals(getNewElementName())){
- String msg = Messages.format("The renamed role type would be overridden by role type ''{0}''.",
- new String[] { currRole.getFullyQualifiedName('.') });
+ String msg = NLS.bind(RefactoringMessages.RenameTypeAdaptor_overridden_error, currRole.getFullyQualifiedName('.'));
status.addError(msg, JavaStatusContext.create(currRole));
return status;
}
@@ -509,8 +507,11 @@
private RefactoringStatus checkForConflictingRoleDirectoryName(IPackageFragment roleDirectory) throws JavaModelException {
IJavaElement[] packages= ((IPackageFragmentRoot)roleDirectory.getParent()).getChildren();
for (int i = 0; i < packages.length; i++) {
- if(packages[i].getElementName().equals(getFType().getPackageFragment().getElementName() + "." + getNewElementName())){
- String msg = MessageFormat.format("The new team name ''{0}'' collides with the package ''{1}'', therefore a renaming of the role directory ''{2}'' is impossible.", new Object[]{getFType().getElementName(), packages[i].getElementName(), roleDirectory.getElementName()});
+ if(packages[i].getElementName().equals(getFType().getPackageFragment().getElementName() + '.' + getNewElementName())) {
+ String msg = NLS.bind(RefactoringMessages.RenameTypeAdaptor_teamCollidesWithPackage_error,
+ new String[] { getFType().getElementName(),
+ packages[i].getElementName(),
+ roleDirectory.getElementName()});
return RefactoringStatus.createErrorStatus(msg);
}
}
@@ -545,8 +546,8 @@
for (int j = 0; j < nestedRoles.length; j++) {
IType role = nestedRoles[j];
if(role.getElementName().equals(getNewElementName())){
- String msg = Messages.format("The role type ''{0}'' would shadow the renamed type (OTJLD §1.4(a))."
- , new String[] { BasicElementLabels.getJavaElementName(role.getFullyQualifiedName('.')) });
+ String msg = NLS.bind(RefactoringMessages.RenameTypeAdaptor_shadowedByRole_error,
+ BasicElementLabels.getJavaElementName(role.getFullyQualifiedName('.')));
status.addError(msg, JavaStatusContext.create(role));
}
}
@@ -563,8 +564,8 @@
}
IType role = outerRoles[i];
if(role.getElementName().equals(getNewElementName())){
- String msg = Messages.format("The renamed role type would shadow the visible type ''{0}'' (OTJLD §1.4(a))."
- , new String[] { BasicElementLabels.getJavaElementName(role.getFullyQualifiedName('.')) });
+ String msg = NLS.bind(RefactoringMessages.RenameTypeAdaptor_shadowExistingType_error,
+ BasicElementLabels.getJavaElementName(role.getFullyQualifiedName('.')));
status.addError(msg, JavaStatusContext.create(role));
}
}
@@ -587,8 +588,9 @@
if(otElement instanceof IRoleType){
IRoleType role = (IRoleType) otElement;
if(role.getElementName().equals(getNewElementName())){
- String msg = Messages.format(RefactoringCoreMessages.RenameTypeRefactoring_member_type_exists, new String[] { getNewElementLabel(),
- BasicElementLabels.getJavaElementName(role.getTeam().getFullyQualifiedName('.')) });
+ String msg = NLS.bind(RefactoringMessages.RenameTypeAdaptor_newTypeConflic_error,
+ getNewElementLabel(),
+ BasicElementLabels.getJavaElementName(role.getTeam().getFullyQualifiedName('.')));
status.addError(msg, JavaStatusContext.create(role));
}
}
@@ -635,7 +637,7 @@
String name = packages[i].getElementName();
String fragmentName = fragment.getElementName();
// role directory found
- if(name.equals(fragmentName + "." + enclosingTeam.getElementName())){
+ if(name.equals(fragmentName + '.' + enclosingTeam.getElementName())){
return (IPackageFragment)packages[i];
}
}
diff --git a/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/adaptor/pullup/PullUpAdaptor.java b/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/adaptor/pullup/PullUpAdaptor.java
index 974ea94..6db94b8 100644
--- a/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/adaptor/pullup/PullUpAdaptor.java
+++ b/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/adaptor/pullup/PullUpAdaptor.java
@@ -1,6 +1,5 @@
package org.eclipse.objectteams.otdt.internal.refactoring.adaptor.pullup;
-import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -28,7 +27,6 @@
import org.eclipse.jdt.core.search.SearchRequestor;
import org.eclipse.jdt.internal.corext.refactoring.RefactoringCoreMessages;
import org.eclipse.jdt.internal.corext.refactoring.base.JavaStatusContext;
-import org.eclipse.jdt.internal.corext.util.Messages;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
import org.eclipse.ltk.core.refactoring.RefactoringStatusEntry;
import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
@@ -41,9 +39,11 @@
import org.eclipse.objectteams.otdt.core.TypeHelper;
import org.eclipse.objectteams.otdt.core.hierarchy.OTTypeHierarchies;
import org.eclipse.objectteams.otdt.internal.core.RoleType;
+import org.eclipse.objectteams.otdt.internal.refactoring.RefactoringMessages;
import org.eclipse.objectteams.otdt.internal.refactoring.util.IAmbuguityMessageCreator;
import org.eclipse.objectteams.otdt.internal.refactoring.util.IOverloadingMessageCreator;
import org.eclipse.objectteams.otdt.internal.refactoring.util.RefactoringUtil;
+import org.eclipse.osgi.util.NLS;
import base org.eclipse.jdt.internal.corext.refactoring.structure.PullUpRefactoringProcessor;
@@ -101,7 +101,7 @@
// remove the subtypes of the declaring type
implicitSubRoles.removeAll(Arrays.asList(OTTypeHierarchies.getInstance().getAllTSubTypes(hier, getDeclaringType())));
- pm.beginTask("Checking Shadowing", implicitSubRoles.size());
+ pm.beginTask(RefactoringMessages.PullUpAdaptor_checkShadowing_progress, implicitSubRoles.size());
pm.subTask(""); //$NON-NLS-1$
for (int i = 0; i < getFMembersToMove().length; i++) {
@@ -116,8 +116,9 @@
membersToDelete.addAll(Arrays.asList(getMembersToDelete(pm)));
// do not indicate shadowing by deleted fields as an error
if(!membersToDelete.contains(shadowingField)) {
- String msg = Messages.format("The pulled up field ''{0}'' would be shadowed in ''{1}''.", new String[] { field.getElementName(),
- type.getFullyQualifiedName('.') });
+ String msg = NLS.bind(RefactoringMessages.PullUpAdaptor_fieldShadowing_error,
+ field.getElementName(),
+ type.getFullyQualifiedName('.'));
status.addFatalError(msg, JavaStatusContext.create(shadowingField));
}
@@ -144,7 +145,7 @@
IMethod method = (IMethod)element;
// callin methods can only be moved to roles
if(Flags.isCallin(method.getFlags()) && !TypeHelper.isRole(getDestinationType().getFlags())){
- String msg = Messages.format("The callin method ''{0}'' can only be moved to a role (OTJLD �4.2.(d)).", new String[] { method.getElementName() });
+ String msg = NLS.bind(RefactoringMessages.PullUpAdaptor_callinMethodToNonRole_error, method.getElementName());
status.addFatalError(msg, JavaStatusContext.create(method));
}
}
@@ -164,13 +165,13 @@
new IAmbuguityMessageCreator() {
public String createAmbiguousMethodSpecifierMsg() {
- return "Refactoring cannot be performed! There would be an ambiguous method specifier in a method binding after moving!";
+ return RefactoringMessages.PullUpAdaptor_ambiguousMethodSpec_error;
}
}, new IOverloadingMessageCreator() {
public String createOverloadingMessage() {
- String msg = Messages.format("The pulled up method ''{0}'' would be overloaded after refactoring.", new String[] { method.getElementName()});
+ String msg = NLS.bind(RefactoringMessages.PullUpAdaptor_overloading_error, method.getElementName());
return msg;
}
@@ -185,7 +186,7 @@
ITypeHierarchy destinationTypeHierarchy = getDestinationTypeHierarchy(pm);
IType[] subtypes = destinationTypeHierarchy.getAllSubtypes(getDestinationType());
- pm.beginTask("Checking Overloading", subtypes.length + 1);
+ pm.beginTask(RefactoringMessages.PullUpAdaptor_checkOverloading_progress, subtypes.length + 1);
pm.subTask(""); //$NON-NLS-1$
RefactoringStatus status = new RefactoringStatus();
@@ -227,7 +228,7 @@
// remove the subtypes of the declaring type
allSubTypes.removeAll(Arrays.asList(hier.getAllSubtypes(getDeclaringType())));
- pm.beginTask("Checking Overriding", allSubTypes.size());
+ pm.beginTask(RefactoringMessages.PullUpAdaptor_checkOverriding_progress, allSubTypes.size());
pm.subTask(""); //$NON-NLS-1$
for (int i = 0; i < getFMembersToMove().length; i++) {
@@ -244,8 +245,9 @@
membersToDelete.addAll(Arrays.asList(getMembersToDelete(pm)));
// do not indicate overriding for deleted/moved methods as an error
if(!membersToMove.contains(overridingMethod) && !membersToDelete.contains(overridingMethod)) {
- String msg = Messages.format("The pulled up method ''{0}'' would be overridden in ''{1}''.", new String[] { method.getElementName(),
- type.getFullyQualifiedName('.') });
+ String msg = NLS.bind(RefactoringMessages.PullUpAdaptor_overriding_error,
+ method.getElementName(),
+ type.getFullyQualifiedName('.'));
status.addError(msg, JavaStatusContext.create(overridingMethod));
}
@@ -350,8 +352,9 @@
*/
private void addAspectBindingWarning(IMember member, RefactoringStatus status,IMethodMapping mapping){
status.addEntry(new RefactoringStatusEntry(RefactoringStatus.WARNING,
- MessageFormat.format("Pulled up member ''{0}'' is referenced in an aspect binding by ''{1}''",
- new Object[]{member.getElementName(), mapping.getDeclaringType().getFullyQualifiedName()})));
+ NLS.bind(RefactoringMessages.PullUpAdaptor_referencedByMethodBinding_error,
+ member.getElementName(),
+ mapping.getDeclaringType().getFullyQualifiedName())));
}
diff --git a/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/adaptor/pushdown/PushDownAdaptor.java b/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/adaptor/pushdown/PushDownAdaptor.java
index 0c1697e..bfa227a 100644
--- a/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/adaptor/pushdown/PushDownAdaptor.java
+++ b/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/adaptor/pushdown/PushDownAdaptor.java
@@ -28,7 +28,6 @@
import org.eclipse.jdt.internal.core.ResolvedSourceMethod;
import org.eclipse.jdt.internal.corext.refactoring.base.JavaStatusContext;
import org.eclipse.jdt.internal.corext.refactoring.structure.PushDownRefactoringProcessor.MemberActionInfo;
-import org.eclipse.jdt.internal.corext.util.Messages;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
import org.eclipse.objectteams.otdt.core.ICallinMapping;
@@ -37,9 +36,11 @@
import org.eclipse.objectteams.otdt.core.IPhantomType;
import org.eclipse.objectteams.otdt.core.TypeHelper;
import org.eclipse.objectteams.otdt.core.hierarchy.OTTypeHierarchies;
+import org.eclipse.objectteams.otdt.internal.refactoring.RefactoringMessages;
import org.eclipse.objectteams.otdt.internal.refactoring.util.IAmbuguityMessageCreator;
import org.eclipse.objectteams.otdt.internal.refactoring.util.IOverloadingMessageCreator;
import org.eclipse.objectteams.otdt.internal.refactoring.util.RefactoringUtil;
+import org.eclipse.osgi.util.NLS;
import base org.eclipse.jdt.internal.corext.refactoring.structure.PushDownRefactoringProcessor;
@@ -53,14 +54,12 @@
@SuppressWarnings("decapsulation") // base class is final
protected class PushDownRefactoringProcessor playedBy PushDownRefactoringProcessor {
- MemberActionInfo[] getAbstractDeclarationInfos() -> MemberActionInfo[] getAbstractDeclarationInfos();
// callouts
- IType[] getAbstractDestinations(IProgressMonitor arg0) -> IType[] getAbstractDestinations(IProgressMonitor arg0);
- IMember[] getMembersToMove() -> IMember[] getMembersToMove();
- IType getDeclaringType() -> IType getDeclaringType();
+ MemberActionInfo[] getAbstractDeclarationInfos() -> MemberActionInfo[] getAbstractDeclarationInfos();
+ IType[] getAbstractDestinations(IProgressMonitor arg0) -> IType[] getAbstractDestinations(IProgressMonitor arg0);
+ IMember[] getMembersToMove() -> IMember[] getMembersToMove();
+ IType getDeclaringType() -> IType getDeclaringType();
ITypeHierarchy getHierarchyOfDeclaringClass(IProgressMonitor pm) -> ITypeHierarchy getHierarchyOfDeclaringClass(IProgressMonitor pm);
-
- private ITypeHierarchy fDeclaringTypeHierachy;
private void checkFinalConditions(IProgressMonitor pm, CheckConditionsContext context, RefactoringStatus status) throws CoreException {
@@ -89,7 +88,7 @@
ArrayList<IType> subTypes = new ArrayList<IType>();
subTypes.addAll(Arrays.asList(hier.getSubtypes(getDeclaringType())));
- pm.beginTask("Checking Shadowing", subTypes.size());
+ pm.beginTask(RefactoringMessages.PushDownAdaptor_checkShadowing_progress, subTypes.size());
pm.subTask(""); //$NON-NLS-1$
for (int i = 0; i < getMembersToMove().length; i++) {
@@ -108,8 +107,8 @@
IField shadowingField = RefactoringUtil.fieldIsShadowedInType(field.getElementName(), field.getTypeSignature(), implicitSuperType);
if(shadowingField != null){
- String msg = Messages.format("The pushed down field ''{0}'' would be shadowed in ''{1}''.", new String[] { field.getElementName(),
- implicitSuperType.getFullyQualifiedName('.') });
+ String msg = NLS.bind(RefactoringMessages.PushDownAdaptor_shadowing_error,
+ new String[] { field.getElementName(), implicitSuperType.getFullyQualifiedName('.') });
status.addError(msg, JavaStatusContext.create(shadowingField));
}
@@ -177,16 +176,16 @@
if (element instanceof ICalloutMapping) {
ICalloutMapping mapping = (ICalloutMapping) element;
if(mapping.getBoundBaseMethod().equals(member)){
- String msg = Messages.format("The pushed down method ''{0}'' is referenced in a callout method binding in ''{1}'' and will not be visible after refactoring.",
+ String msg = NLS.bind(RefactoringMessages.PushDownAdaptor_referencedByCallout_error,
new String[] { member.getElementName(), mapping.getDeclaringType().getFullyQualifiedName('.') });
status.addError(msg, JavaStatusContext.create(mapping));
} else if(mapping.getRoleMethod() != null && mapping.getRoleMethod().equals(member)){
- String msg = Messages.format("The pushed down method ''{0}'' is bound in a callout method binding in ''{1}''.",
+ String msg = NLS.bind(RefactoringMessages.PushDownAdaptor_boundAsCallout_error,
new String[] { member.getElementName(), mapping.getDeclaringType().getFullyQualifiedName('.') });
status.addError(msg, JavaStatusContext.create(mapping));
}else{
// TODO find a better way to analyze references in parameter mappings
- String msg = Messages.format("The pushed down member ''{0}'' is referenced in a callout parameter mapping in ''{1}'' and will not be visible after refactoring.",
+ String msg = NLS.bind(RefactoringMessages.PushDownAdaptor_referencedByCalloutParamMap_error,
new String[] { member.getElementName(), mapping.getDeclaringType().getFullyQualifiedName('.') });
status.addError(msg, JavaStatusContext.create(mapping));
}
@@ -194,16 +193,16 @@
if (element instanceof ICalloutToFieldMapping) {
ICalloutToFieldMapping mapping = (ICalloutToFieldMapping) element;
if(mapping.getBoundBaseField().equals(member)){
- String msg = Messages.format("The pushed down field ''{0}'' is referenced in a callout to field binding in ''{1}'' and will not be visible after refactoring.",
+ String msg = NLS.bind(RefactoringMessages.PushDownAdaptor_referencedByCTF_error,
new String[] { member.getElementName(), mapping.getDeclaringType().getFullyQualifiedName('.') });
status.addError(msg, JavaStatusContext.create(mapping));
} else if(mapping.getRoleMethod() != null && mapping.getRoleMethod().equals(member)){
- String msg = Messages.format("The pushed down method ''{0}'' is bound in a callout to field binding in ''{1}''.",
+ String msg = NLS.bind(RefactoringMessages.PushDownAdaptor_boundAsCTF_error,
new String[] { member.getElementName(), mapping.getDeclaringType().getFullyQualifiedName('.') });
status.addError(msg, JavaStatusContext.create(mapping));
}else{
// TODO find a better way to analyze references in parameter mappings
- String msg = Messages.format("The pushed down member ''{0}'' is referenced in a callout to field value mapping in ''{1}'' and will not be visible after refactoring.",
+ String msg = NLS.bind(RefactoringMessages.PushDownAdaptor_referencedByCTFParamMap_error,
new String[] { member.getElementName(), mapping.getDeclaringType().getFullyQualifiedName('.') });
status.addError(msg, JavaStatusContext.create(mapping));
}
@@ -213,7 +212,7 @@
boolean baseMethodFound = false;
for (int j = 0; j < mapping.getBoundBaseMethods().length; j++) {
if(mapping.getBoundBaseMethods()[i].equals(member)){
- String msg = Messages.format("The pushed down method ''{0}'' is referenced in a callin method binding in ''{1}'' and will not be visible after refactoring.",
+ String msg = NLS.bind(RefactoringMessages.PushDownAdaptor_referencedByCallin_error,
new String[] { member.getElementName(), mapping.getDeclaringType().getFullyQualifiedName('.') });
status.addError(msg, JavaStatusContext.create(mapping));
baseMethodFound = true;
@@ -226,12 +225,12 @@
}
if(mapping.getRoleMethod().equals(member)){
- String msg = Messages.format("The pushed down method ''{0}'' is bound in a callin method binding in ''{1}'' and will not be visible after refactoring.",
+ String msg = NLS.bind(RefactoringMessages.PushDownAdaptor_boundInCallin_error,
new String[] { member.getElementName(), mapping.getDeclaringType().getFullyQualifiedName('.') });
status.addError(msg, JavaStatusContext.create(mapping));
} else {
// TODO find a better way to analyze references in parameter mappings
- String msg = Messages.format("The pushed down member ''{0}'' is referenced in a callin parameter mapping in ''{1}'' and will not be visible after refactoring.",
+ String msg = NLS.bind(RefactoringMessages.PushDownAdaptor_referencedInCallinParamMap_error,
new String[] { member.getElementName(), mapping.getDeclaringType().getFullyQualifiedName('.') });
status.addError(msg, JavaStatusContext.create(mapping));
}
@@ -241,7 +240,7 @@
ResolvedSourceMethod method = (ResolvedSourceMethod) element;
// References in the declaring type are checked by the base
if(!method.getDeclaringType().equals(getDeclaringType())){
- String msg = Messages.format("Pushed down member ''{0}'' is referenced by ''{1}''.",
+ String msg = NLS.bind(RefactoringMessages.PushDownAdaptor_referencedByMethod_error,
new String[] { member.getElementName(), method.getDeclaringType().getFullyQualifiedName('.') });
status.addError(msg, JavaStatusContext.create(method));
}
@@ -271,7 +270,7 @@
for (int i = 0; i < subTypes.length; i++) {
IType subType = subTypes[i];
if(subType instanceof IPhantomType){
- String msg = Messages.format("An implicit sub role of ''{0}'' is a phantom role, therefore the pushed down members cannot be moved to ''{1}''.", new String[] { getDeclaringType().getFullyQualifiedName('.'), subType.getFullyQualifiedName('.') });
+ String msg = NLS.bind(RefactoringMessages.PushDownAdaptor_phantomRoleConflict_error, new String[] { getDeclaringType().getFullyQualifiedName('.'), subType.getFullyQualifiedName('.') });
status.addError(msg, JavaStatusContext.create(subType));
}
}
@@ -299,7 +298,7 @@
ITypeHierarchy hierarchy = type.newSupertypeHierarchy(pm);
IType[] superRoles = OTTypeHierarchies.getInstance().getTSuperTypes(hierarchy, type);
- pm.beginTask("Checking Overriding", superRoles.length);
+ pm.beginTask(RefactoringMessages.PushDownAdaptor_overriding_progress, superRoles.length);
pm.subTask(""); //$NON-NLS-1$
for (int i = 0; i < superRoles.length; i++) {
@@ -312,7 +311,9 @@
IMethod pushedDownMethod = (IMethod) membersToPushDown[j];
IMethod overriddenMethod = superRole.getMethod(pushedDownMethod.getElementName(), pushedDownMethod.getParameterTypes());
if(overriddenMethod.exists()){
- String msg = Messages.format("The pushed down method ''{0}'' would override the implicitly inherited method ''{1}''.", new String[] { pushedDownMethod.getElementName(), overriddenMethod.getDeclaringType().getFullyQualifiedName('.') + "." + overriddenMethod.getElementName()});
+ String msg = NLS.bind(RefactoringMessages.PushDownAdaptor_overridingImplicitlyInherited_error,
+ pushedDownMethod.getElementName(),
+ overriddenMethod.getDeclaringType().getFullyQualifiedName('.') + '.' + overriddenMethod.getElementName());
status.addError(msg, JavaStatusContext.create(overriddenMethod));
}
}
@@ -339,13 +340,13 @@
new IAmbuguityMessageCreator() {
public String createAmbiguousMethodSpecifierMsg() {
- return "Refactoring cannot be performed! There would be an ambiguous method specifier in a method binding after moving!";
+ return RefactoringMessages.PushDownAdaptor_ambiguousMethodSpec_error;
}
}, new IOverloadingMessageCreator() {
public String createOverloadingMessage() {
- String msg = Messages.format("The pushed down method ''{0}'' would be overloaded after refactoring.", new String[] { method.getElementName()});
+ String msg = NLS.bind(RefactoringMessages.PushDownAdaptor_overloading_error, new String[] { method.getElementName()});
return msg;
}
@@ -359,7 +360,7 @@
IType[] subtypes = getAbstractDestinations(pm);
- pm.beginTask("Checking Overloading", subtypes.length);
+ pm.beginTask(RefactoringMessages.PushDownAdaptor_overloading_progress, subtypes.length);
pm.subTask(""); //$NON-NLS-1$
RefactoringStatus status = new RefactoringStatus();
diff --git a/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/adaptor/rename/RenameMethodAmbuguityMsgCreator.java b/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/adaptor/rename/RenameMethodAmbuguityMsgCreator.java
index 7178797..218e540 100644
--- a/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/adaptor/rename/RenameMethodAmbuguityMsgCreator.java
+++ b/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/adaptor/rename/RenameMethodAmbuguityMsgCreator.java
@@ -1,5 +1,6 @@
package org.eclipse.objectteams.otdt.internal.refactoring.adaptor.rename;
+import org.eclipse.objectteams.otdt.internal.refactoring.RefactoringMessages;
import org.eclipse.objectteams.otdt.internal.refactoring.util.IAmbuguityMessageCreator;
public class RenameMethodAmbuguityMsgCreator implements IAmbuguityMessageCreator {
@@ -10,7 +11,7 @@
* @see org.eclipse.objectteams.otdt.refactoring.util.IAmbuguityMessageCreator#createAmbiguousMethodSpecifierMsg()
*/
public String createAmbiguousMethodSpecifierMsg() {
- return "Refactoring cannot be performed! There would be an ambiguous method specifier in a method binding after renaming!";
+ return RefactoringMessages.RenameMethodAmbuguityMsgCreator_ambiguousMethodSpec_error;
}
}
diff --git a/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/adaptor/rename/RenameMethodOverloadingMsgCreator.java b/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/adaptor/rename/RenameMethodOverloadingMsgCreator.java
index 181450b..2c51c92 100644
--- a/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/adaptor/rename/RenameMethodOverloadingMsgCreator.java
+++ b/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/adaptor/rename/RenameMethodOverloadingMsgCreator.java
@@ -1,5 +1,6 @@
package org.eclipse.objectteams.otdt.internal.refactoring.adaptor.rename;
+import org.eclipse.objectteams.otdt.internal.refactoring.RefactoringMessages;
import org.eclipse.objectteams.otdt.internal.refactoring.util.IOverloadingMessageCreator;
public class RenameMethodOverloadingMsgCreator implements IOverloadingMessageCreator {
@@ -10,7 +11,7 @@
* @see org.eclipse.objectteams.otdt.refactoring.util.IOverloadingMessageCreator#createOverloadingMessage()
*/
public String createOverloadingMessage() {
- return "Renamed method will be overloaded after refactoring!";
+ return RefactoringMessages.RenameMethodOverloadingMsgCreator_overloading_error;
}
}
diff --git a/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/corext/OTRefactoringCoreMessages.java b/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/corext/OTRefactoringCoreMessages.java
index e48b59a..872f22b 100644
--- a/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/corext/OTRefactoringCoreMessages.java
+++ b/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/corext/OTRefactoringCoreMessages.java
@@ -20,10 +20,11 @@
**********************************************************************/
package org.eclipse.objectteams.otdt.internal.refactoring.corext;
-import java.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
+import org.eclipse.osgi.util.NLS;
+
/**
* This utility class is a part of the OT/J refactoring adaptation.
* It contains some helper methods in order to retrieve message
@@ -58,7 +59,7 @@
{
try
{
- return MessageFormat.format(_resourceBundle.getString(key), new Object[] { arg });
+ return NLS.bind(_resourceBundle.getString(key), new Object[] { arg });
}
catch (MissingResourceException e)
{
@@ -70,7 +71,7 @@
{
try
{
- return MessageFormat.format(_resourceBundle.getString(key), args);
+ return NLS.bind(_resourceBundle.getString(key), args);
}
catch (MissingResourceException e)
{
diff --git a/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/otrefactorings/OTRefactoringMessages.java b/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/otrefactorings/OTRefactoringMessages.java
new file mode 100644
index 0000000..4ed7506
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/otrefactorings/OTRefactoringMessages.java
@@ -0,0 +1,88 @@
+package org.eclipse.objectteams.otdt.internal.refactoring.otrefactorings;
+
+import org.eclipse.osgi.util.NLS;
+
+public class OTRefactoringMessages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.objectteams.otdt.internal.refactoring.otrefactorings.OTRefactoringMessages"; //$NON-NLS-1$
+ public static String ExtractCallin_extractCallin_commandName;
+ public static String ExtractCallin_extractCallin_name;
+ public static String ExtractCallin_extractCallin_tooltip;
+ public static String ExtractCallin_notAvailableOnSelection_error;
+ public static String ExtractCallinInputPage_copyBaseMethod_checkbox;
+ public static String ExtractCallinInputPage_deleteBaseMethod_checkbox;
+ public static String ExtractCallinInputPage_extractMode_group;
+ public static String ExtractCallinInputPage_modeAfter_label;
+ public static String ExtractCallinInputPage_modeBefore_label;
+ public static String ExtractCallinInputPage_modeReplace_label;
+ public static String ExtractCallinInputPage_roleMethod_label;
+ public static String ExtractCallinInputPage_targetRole_label;
+ public static String ExtractCallinRefactoring_baseMethodAbstract_error;
+ public static String ExtractCallinRefactoring_baseMethodBinary_error;
+ public static String ExtractCallinRefactoring_baseMethodCallout_error;
+ public static String ExtractCallinRefactoring_baseMethodReadOnly_error;
+ public static String ExtractCallinRefactoring_bindingSearchFailed_error;
+ public static String ExtractCallinRefactoring_callinKindInvalid_error;
+ public static String ExtractCallinRefactoring_callinKindUnspecified_error;
+ public static String ExtractCallinRefactoring_callToExtractNotFound_After_error;
+ public static String ExtractCallinRefactoring_callToExtractNotFound_Before_error;
+ public static String ExtractCallinRefactoring_compileErrors_error;
+ public static String ExtractCallinRefactoring_inexistentMethod_error;
+ public static String ExtractCallinRefactoring_methodNameClash;
+ public static String ExtractCallinRefactoring_preconditions_progress;
+ public static String ExtractCallinRefactoring_roleBinary_error;
+ public static String ExtractCallinRefactoring_roleInexistent_error;
+ public static String ExtractCallinRefactoring_roleMethodNameEmpty_error;
+ public static String ExtractCallinRefactoring_roleMethodUnspecified_error;
+ public static String ExtractCallinRefactoring_roleReadOnly_error;
+ public static String ExtractCallinRefactoring_roleUnspecified_error;
+ public static String ExtractCallinRefactoring_unboundRole_error;
+ public static String ExtractCallinRefactoring_unparseableType_error;
+ public static String ExtractCallinRefactoring_unspecifiedMethod_error;
+ public static String ExtractCallinWizard_extractCallinInput_pageName;
+ public static String InlineCallin_inlineCallin_name;
+ public static String InlineCallin_inlineCallin_commandName;
+ public static String InlineCallin_inlineCallin_tooltip;
+ public static String InlineCallin_notAvailableOnSelection_error;
+ public static String InlineCallinInputPage_basemethod_columnLabel;
+ public static String InlineCallinInputPage_baseMethod_label;
+ public static String InlineCallinInputPage_callinKind_columnLabel;
+ public static String InlineCallinInputPage_deleteMethod_button;
+ public static String InlineCallinInputPage_kindAfter_label;
+ public static String InlineCallinInputPage_kindBefore_label;
+ public static String InlineCallinInputPage_kindReplace_label;
+ public static String InlineCallinInputPage_methodName_lable;
+ public static String InlineCallinRefactoring_binaryBase_error;
+ public static String InlineCallinRefactoring_binaryMethod_error;
+ public static String InlineCallinRefactoring_compileErrors_error;
+ public static String InlineCallinRefactoring_creatingChange_progress;
+ public static String InlineCallinRefactoring_emptyMethodName_error;
+ public static String InlineCallinRefactoring_inexistentMethod_error;
+ public static String InlineCallinRefactoring_methodBoundByOtherCallin_error;
+ public static String InlineCallinRefactoring_methodIsCallout_error;
+ public static String InlineCallinRefactoring_methodIsUsed_error;
+ public static String InlineCallinRefactoring_methodIsUsedBy_error;
+ public static String InlineCallinRefactoring_methodNameClash_error;
+ public static String InlineCallinRefactoring_methodUsesRoleField_error;
+ public static String InlineCallinRefactoring_methodUsesRoleMethod_error;
+ public static String InlineCallinRefactoring_missingBaseMethod_error;
+ public static String InlineCallinRefactoring_missingNewMethodName_error;
+ public static String InlineCallinRefactoring_noMethod_error;
+ public static String InlineCallinRefactoring_notInsideRole_error;
+ public static String InlineCallinRefactoring_preconditions_progress;
+ public static String InlineCallinRefactoring_readOnlyBase_error;
+ public static String InlineCallinRefactoring_readOnlyMethod_error;
+ public static String InlineCallinRefactoring_unboundMethod_error;
+ public static String InlineCallinRefactoring_unboundRole_error;
+ public static String InlineCallinRefactoring_unparseableMethodMapping_error;
+ public static String InlineCallinRefactoring_unparseableType_error;
+ public static String InlineCallinWizard_inlineCallinInput_pageName;
+ public static String OTRefactoring_organizeImports_editName;
+ public static String RefactoringUtil_notFullyOTAware_info;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, OTRefactoringMessages.class);
+ }
+
+ private OTRefactoringMessages() {
+ }
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/otrefactorings/OTRefactoringMessages.properties b/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/otrefactorings/OTRefactoringMessages.properties
new file mode 100644
index 0000000..e956f83
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/otrefactorings/OTRefactoringMessages.properties
@@ -0,0 +1,74 @@
+ExtractCallin_extractCallin_commandName=Extract Callin ...
+ExtractCallin_extractCallin_name=Extract Callin
+ExtractCallin_extractCallin_tooltip=Extract a callin binding and method.
+ExtractCallin_notAvailableOnSelection_error=Operation unavailable on the current selection. Select a callin-bound role method or a callin method binding
+ExtractCallinInputPage_copyBaseMethod_checkbox=&Copy base method code
+ExtractCallinInputPage_deleteBaseMethod_checkbox=&Delete extracted base method
+ExtractCallinInputPage_extractMode_group=Extract Mode
+ExtractCallinInputPage_modeAfter_label=&After
+ExtractCallinInputPage_modeBefore_label=&Before
+ExtractCallinInputPage_modeReplace_label=R&eplace
+ExtractCallinInputPage_roleMethod_label=&Role method name:
+ExtractCallinInputPage_targetRole_label=&Target role:
+ExtractCallinRefactoring_baseMethodAbstract_error=Method ''{0}'' is abstract, cannot extract.
+ExtractCallinRefactoring_baseMethodBinary_error=Method ''{0}'' is declared in a binary class file.
+ExtractCallinRefactoring_baseMethodCallout_error=Method ''{0}'' is an callout method and cannot be extracted.
+ExtractCallinRefactoring_baseMethodReadOnly_error=Method ''{0}'' is declared in a read-only class file.
+ExtractCallinRefactoring_bindingSearchFailed_error=Could not perform the search for binding role types.
+ExtractCallinRefactoring_callinKindInvalid_error=Invalid callin kind.
+ExtractCallinRefactoring_callinKindUnspecified_error=Callin kind has not been specified.
+ExtractCallinRefactoring_callToExtractNotFound_After_error=The last statement in the base method must be a method invocation to extract an after callin.
+ExtractCallinRefactoring_callToExtractNotFound_Before_error=The first statement in the base method must be a method invocation to extract a before callin.
+ExtractCallinRefactoring_compileErrors_error=Compilation unit ''{0}'' contains compile errors.
+ExtractCallinRefactoring_inexistentMethod_error=Method ''{0}'' does not exist.
+ExtractCallinRefactoring_methodNameClash=A method with the same name already exists.
+ExtractCallinRefactoring_preconditions_progress=Checking preconditions...
+ExtractCallinRefactoring_roleBinary_error=Type ''{0}'' is declared in a binary class file.
+ExtractCallinRefactoring_roleInexistent_error=Type ''{0}'' does not exist.
+ExtractCallinRefactoring_roleMethodNameEmpty_error=New role method name cannot be empty.
+ExtractCallinRefactoring_roleMethodUnspecified_error=No new role method name specified.
+ExtractCallinRefactoring_roleReadOnly_error=Type ''{0}'' is declared in a read-only file.
+ExtractCallinRefactoring_roleUnspecified_error=No target role selected.
+ExtractCallinRefactoring_unboundRole_error=The declaring type ''{0}'' is not bound by a role.
+ExtractCallinRefactoring_unparseableType_error=Could not parse the declaring type.
+ExtractCallinRefactoring_unspecifiedMethod_error=Method has not been specified.
+ExtractCallinWizard_extractCallinInput_pageName=ExtractCallinInputPage
+InlineCallin_inlineCallin_commandName=Inline Callin ...
+InlineCallin_inlineCallin_name=Inline Callin
+InlineCallin_inlineCallin_tooltip=Inline a callin-bound role meth.
+InlineCallin_notAvailableOnSelection_error=Operation unavailable on the current selection. Select a callin-bound role method or a callin method binding
+InlineCallinInputPage_basemethod_columnLabel=Base Method
+InlineCallinInputPage_baseMethod_label=&Select the bound base methods:
+InlineCallinInputPage_callinKind_columnLabel=Callin Kind
+InlineCallinInputPage_deleteMethod_button=&Delete role method
+InlineCallinInputPage_kindAfter_label=After
+InlineCallinInputPage_kindBefore_label=Before
+InlineCallinInputPage_kindReplace_label=Replace
+InlineCallinInputPage_methodName_lable=&Inlined method name:
+InlineCallinRefactoring_binaryBase_error=Base class ''{0}'' is a binary type, cannot modify.
+InlineCallinRefactoring_binaryMethod_error=Method ''{0}'' is declared in a binary class file.
+InlineCallinRefactoring_compileErrors_error=Compilation unit ''{0}'' contains compile errors.
+InlineCallinRefactoring_creatingChange_progress=Creating Change
+InlineCallinRefactoring_emptyMethodName_error=New role method name cannot be empty.
+InlineCallinRefactoring_inexistentMethod_error=Method ''{0}'' does not exist.
+InlineCallinRefactoring_methodBoundByOtherCallin_error=The Role Method ''{0}'' is bound in a callin binding and cannot be inlined.
+InlineCallinRefactoring_methodIsCallout_error=The Role Method ''{0}'' is bound in a callout binding and cannot be inlined.
+InlineCallinRefactoring_methodIsUsed_error=The Role Method ''{0}'' is referenced and cannot be deleted.
+InlineCallinRefactoring_methodIsUsedBy_error=The Role Method ''{0}'' is referenced by ''{1}'' and cannot be deleted.
+InlineCallinRefactoring_methodNameClash_error=A method with the same name already exists.
+InlineCallinRefactoring_methodUsesRoleField_error=The method to inline ''{0}'' references the role field ''{1}''.
+InlineCallinRefactoring_methodUsesRoleMethod_error=The method to inline ''{0}'' references the role method ''{1}''.
+InlineCallinRefactoring_missingBaseMethod_error=No base method selected.
+InlineCallinRefactoring_missingNewMethodName_error=No new role method name specified.
+InlineCallinRefactoring_noMethod_error=Method has not been specified.
+InlineCallinRefactoring_notInsideRole_error=The selected method ''{0}'' is not declared in a role.
+OTRefactoring_organizeImports_editName=Organize Imports
+InlineCallinRefactoring_preconditions_progress=Checking preconditions...
+InlineCallinRefactoring_readOnlyBase_error=Base class ''{0}'' is read-only, cannot modify.
+InlineCallinRefactoring_readOnlyMethod_error=Method ''{0}'' is declared in a read-only class file.
+InlineCallinRefactoring_unboundMethod_error=The selected method ''{0}'' is not bound on the left hand side of a callin method binding.
+InlineCallinRefactoring_unboundRole_error=The declaring role class is not bound to a base class.
+InlineCallinRefactoring_unparseableMethodMapping_error=Could not parse the method mappings.
+InlineCallinRefactoring_unparseableType_error=Could not parse the declaring type.
+InlineCallinWizard_inlineCallinInput_pageName=InlineCallinInputPage
+RefactoringUtil_notFullyOTAware_info=The ''{0}'' Refactoring is not yet fully OT-aware\!
diff --git a/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/otrefactorings/extractcallin/ExtractCallinAction.java b/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/otrefactorings/extractcallin/ExtractCallinAction.java
index 78cd2ee..9501bdd 100644
--- a/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/otrefactorings/extractcallin/ExtractCallinAction.java
+++ b/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/otrefactorings/extractcallin/ExtractCallinAction.java
@@ -5,6 +5,7 @@
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation;
import org.eclipse.objectteams.otdt.internal.refactoring.otrefactorings.AbstractCallinRefactoringAction;
+import org.eclipse.objectteams.otdt.internal.refactoring.otrefactorings.OTRefactoringMessages;
import org.eclipse.objectteams.otdt.internal.refactoring.otrefactorings.AbstractCallinRefactoringAction.SelectionDispatchAction;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
@@ -47,21 +48,21 @@
new RefactoringWizardOpenOperation(
new ExtractCallinWizard(
new ExtractCallinRefactoring((IMethod)fJavaElement),
- "Extract Callin"
+ OTRefactoringMessages.ExtractCallin_extractCallin_name
)
- ).run(fWindow.getShell(), "Extract Callin");
+ ).run(fWindow.getShell(), OTRefactoringMessages.ExtractCallin_extractCallin_name);
} catch (InterruptedException exception) {
// Do nothing
}
} else {
- MessageDialog.openInformation(null, "Extract Callin", "Operation unavailable on the current selection. Select a callin-bound role method or a callin method binding");
+ MessageDialog.openInformation(null, OTRefactoringMessages.ExtractCallin_extractCallin_name, OTRefactoringMessages.ExtractCallin_notAvailableOnSelection_error);
}
}
}
// =========== Start ExtractCallinAction ===========
public ExtractCallinAction() {
- super("Extract Callin ...", "Extract a callin binding and method.");
+ super(OTRefactoringMessages.ExtractCallin_extractCallin_commandName, OTRefactoringMessages.ExtractCallin_extractCallin_tooltip);
}
protected CallinRefactoringActionCommon createRefactoringActionCommon(IWorkbenchWindow window) {
diff --git a/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/otrefactorings/extractcallin/ExtractCallinInputPage.java b/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/otrefactorings/extractcallin/ExtractCallinInputPage.java
index 2d28b5a..5a57021 100644
--- a/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/otrefactorings/extractcallin/ExtractCallinInputPage.java
+++ b/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/otrefactorings/extractcallin/ExtractCallinInputPage.java
@@ -20,6 +20,7 @@
import org.eclipse.swt.widgets.Text;
import org.eclipse.objectteams.otdt.core.ICallinMapping;
import org.eclipse.objectteams.otdt.core.IRoleType;
+import org.eclipse.objectteams.otdt.internal.refactoring.otrefactorings.OTRefactoringMessages;
public class ExtractCallinInputPage extends UserInputWizardPage {
@@ -61,13 +62,13 @@
result.setLayout(layout);
Label label = new Label(result, SWT.NONE);
- label.setText("&Role method name:");
+ label.setText(OTRefactoringMessages.ExtractCallinInputPage_roleMethod_label);
fNameField = createNameField(result);
// Role Selection
label = new Label(result, SWT.NONE);
- label.setText("&Target role:");
+ label.setText(OTRefactoringMessages.ExtractCallinInputPage_targetRole_label);
Composite composite = new Composite(result, SWT.NONE);
@@ -94,7 +95,7 @@
fReferenceButton = new Button(result, SWT.CHECK);
fReferenceButton.setEnabled(true);
- fReferenceButton.setText("&Delete extracted base method");
+ fReferenceButton.setText(OTRefactoringMessages.ExtractCallinInputPage_deleteBaseMethod_checkbox);
fReferenceButton.addSelectionListener(new SelectionAdapter() {
@Override
@@ -149,11 +150,11 @@
data.verticalIndent = 2;
fExtractMode.setLayoutData(data);
fExtractMode.setLayout(new GridLayout());
- fExtractMode.setText("Extract Mode");
+ fExtractMode.setText(OTRefactoringMessages.ExtractCallinInputPage_extractMode_group);
fReplaceRadio = new Button(fExtractMode, SWT.RADIO);
fReplaceRadio.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- fReplaceRadio.setText("R&eplace");
+ fReplaceRadio.setText(OTRefactoringMessages.ExtractCallinInputPage_modeReplace_label);
fReplaceRadio.setSelection(true);
fRefactoring.setMappingKind(ICallinMapping.KIND_REPLACE);
fReplaceRadio.addSelectionListener(new SelectionAdapter() {
@@ -169,7 +170,7 @@
data = new GridData(GridData.FILL_HORIZONTAL);
data.horizontalIndent = convertWidthInCharsToPixels(3);
fRemove.setLayoutData(data);
- fRemove.setText("&Copy base method code");
+ fRemove.setText(OTRefactoringMessages.ExtractCallinInputPage_copyBaseMethod_checkbox);
fRemove.setSelection(fRefactoring.isCopyBaseMethod());
fRemove.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
@@ -180,7 +181,7 @@
fBeforeRadio = new Button(fExtractMode, SWT.RADIO);
fBeforeRadio.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- fBeforeRadio.setText("&Before");
+ fBeforeRadio.setText(OTRefactoringMessages.ExtractCallinInputPage_modeBefore_label);
fBeforeRadio.setSelection(false);
fBeforeRadio.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
@@ -194,7 +195,7 @@
fAfterRadio = new Button(fExtractMode, SWT.RADIO);
fAfterRadio.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- fAfterRadio.setText("&After");
+ fAfterRadio.setText(OTRefactoringMessages.ExtractCallinInputPage_modeAfter_label);
fAfterRadio.setSelection(false);
fAfterRadio.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
diff --git a/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/otrefactorings/extractcallin/ExtractCallinRefactoring.java b/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/otrefactorings/extractcallin/ExtractCallinRefactoring.java
index 1a18d7e..16c48c7 100644
--- a/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/otrefactorings/extractcallin/ExtractCallinRefactoring.java
+++ b/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/otrefactorings/extractcallin/ExtractCallinRefactoring.java
@@ -1,6 +1,5 @@
package org.eclipse.objectteams.otdt.internal.refactoring.otrefactorings.extractcallin;
-import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
@@ -38,10 +37,12 @@
import org.eclipse.jdt.core.dom.IExtendedModifier;
import org.eclipse.jdt.core.dom.IMethodBinding;
import org.eclipse.jdt.core.dom.ITypeBinding;
+import org.eclipse.jdt.core.dom.MethodBindingOperator;
import org.eclipse.jdt.core.dom.MethodDeclaration;
import org.eclipse.jdt.core.dom.MethodInvocation;
import org.eclipse.jdt.core.dom.MethodSpec;
import org.eclipse.jdt.core.dom.Modifier;
+import org.eclipse.jdt.core.dom.Modifier.ModifierKeyword;
import org.eclipse.jdt.core.dom.Name;
import org.eclipse.jdt.core.dom.NodeFinder;
import org.eclipse.jdt.core.dom.ParameterMapping;
@@ -50,7 +51,6 @@
import org.eclipse.jdt.core.dom.Statement;
import org.eclipse.jdt.core.dom.ThisExpression;
import org.eclipse.jdt.core.dom.Type;
-import org.eclipse.jdt.core.dom.Modifier.ModifierKeyword;
import org.eclipse.jdt.core.dom.rewrite.ASTNodeCreator;
import org.eclipse.jdt.core.dom.rewrite.ASTRewrite;
import org.eclipse.jdt.core.dom.rewrite.ImportRewrite;
@@ -62,14 +62,15 @@
import org.eclipse.ltk.core.refactoring.Refactoring;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
import org.eclipse.ltk.core.refactoring.TextFileChange;
-import org.eclipse.text.edits.MultiTextEdit;
-import org.eclipse.text.edits.TextEdit;
-import org.eclipse.text.edits.TextEditGroup;
import org.eclipse.objectteams.otdt.core.ICallinMapping;
import org.eclipse.objectteams.otdt.core.IRoleType;
import org.eclipse.objectteams.otdt.internal.core.AbstractCalloutMapping;
-import org.eclipse.objectteams.otdt.internal.core.CalloutMapping;
+import org.eclipse.objectteams.otdt.internal.refactoring.otrefactorings.OTRefactoringMessages;
import org.eclipse.objectteams.otdt.internal.refactoring.util.RefactoringUtil;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.text.edits.MultiTextEdit;
+import org.eclipse.text.edits.TextEdit;
+import org.eclipse.text.edits.TextEditGroup;
@SuppressWarnings("restriction")
public class ExtractCallinRefactoring extends Refactoring {
@@ -186,26 +187,26 @@
public RefactoringStatus checkInitialConditions(IProgressMonitor monitor) throws CoreException, OperationCanceledException {
RefactoringStatus status= new RefactoringStatus();
try {
- monitor.beginTask("Checking preconditions...", 1);
+ monitor.beginTask(OTRefactoringMessages.ExtractCallinRefactoring_preconditions_progress, 1);
if (fBaseMethod == null) {
- status.merge(RefactoringStatus.createFatalErrorStatus("Method has not been specified."));
+ status.merge(RefactoringStatus.createFatalErrorStatus(OTRefactoringMessages.ExtractCallinRefactoring_unspecifiedMethod_error));
} else if (!fBaseMethod.exists()) {
- status.merge(RefactoringStatus.createFatalErrorStatus(MessageFormat.format("Method ''{0}'' does not exist.", new Object[] { fBaseMethod
+ status.merge(RefactoringStatus.createFatalErrorStatus(NLS.bind(OTRefactoringMessages.ExtractCallinRefactoring_inexistentMethod_error, new Object[] { fBaseMethod
.getElementName() })));
}else if (fBaseMethod.isBinary()){
- status.merge(RefactoringStatus.createFatalErrorStatus(MessageFormat.format("Method ''{0}'' is declared in a binary class file.", new Object[] { fBaseMethod
+ status.merge(RefactoringStatus.createFatalErrorStatus(NLS.bind(OTRefactoringMessages.ExtractCallinRefactoring_baseMethodBinary_error, new Object[] { fBaseMethod
.getElementName() })));
}else if (fBaseMethod.isReadOnly()){
- status.merge(RefactoringStatus.createFatalErrorStatus(MessageFormat.format("Method ''{0}'' is declared in a read-only class file.", new Object[] { fBaseMethod
+ status.merge(RefactoringStatus.createFatalErrorStatus(NLS.bind(OTRefactoringMessages.ExtractCallinRefactoring_baseMethodReadOnly_error, new Object[] { fBaseMethod
.getElementName() })));
} else if (!fBaseMethod.getCompilationUnit().isStructureKnown()) {
- status.merge(RefactoringStatus.createFatalErrorStatus(MessageFormat.format("Compilation unit ''{0}'' contains compile errors.",
+ status.merge(RefactoringStatus.createFatalErrorStatus(NLS.bind(OTRefactoringMessages.ExtractCallinRefactoring_compileErrors_error,
new Object[] { fBaseMethod.getCompilationUnit().getElementName() })));
} else if (Flags.isAbstract(fBaseMethod.getFlags())){
- status.merge(RefactoringStatus.createFatalErrorStatus(MessageFormat.format("Method ''{0}'' is abstract, cannot extract.", new Object[] { fBaseMethod
+ status.merge(RefactoringStatus.createFatalErrorStatus(NLS.bind(OTRefactoringMessages.ExtractCallinRefactoring_baseMethodAbstract_error, new Object[] { fBaseMethod
.getElementName() })));
} else if (fBaseMethod instanceof AbstractCalloutMapping){
- status.merge(RefactoringStatus.createFatalErrorStatus(MessageFormat.format("Method ''{0}'' is an callout method and cannot be extracted.", new Object[] { fBaseMethod
+ status.merge(RefactoringStatus.createFatalErrorStatus(NLS.bind(OTRefactoringMessages.ExtractCallinRefactoring_baseMethodCallout_error, new Object[] { fBaseMethod
.getElementName() })));
}else{
status.merge(initialize(monitor));
@@ -233,7 +234,7 @@
fBoundRoles = findCandidateRoles();
if (fBoundRoles.size() == 0) {
- status.merge(RefactoringStatus.createFatalErrorStatus(MessageFormat.format("The declaring type ''{0}'' is not bound by a role.",
+ status.merge(RefactoringStatus.createFatalErrorStatus(NLS.bind(OTRefactoringMessages.ExtractCallinRefactoring_unboundRole_error,
new Object[] { fBaseType.getElementName() })));
}
@@ -253,15 +254,15 @@
RefactoringStatus status = new RefactoringStatus();
if (fRoleType == null) {
- status.merge(RefactoringStatus.createFatalErrorStatus("No target role selected."));
+ status.merge(RefactoringStatus.createFatalErrorStatus(OTRefactoringMessages.ExtractCallinRefactoring_roleUnspecified_error));
}else if (!fRoleType.exists()) {
- status.merge(RefactoringStatus.createFatalErrorStatus(MessageFormat.format("Type ''{0}'' does not exist.", new Object[] { fRoleType
+ status.merge(RefactoringStatus.createFatalErrorStatus(NLS.bind(OTRefactoringMessages.ExtractCallinRefactoring_roleInexistent_error, new Object[] { fRoleType
.getElementName() })));
}else if (fRoleType.isBinary()){
- status.merge(RefactoringStatus.createFatalErrorStatus(MessageFormat.format("Type ''{0}'' is declared in a binary class file.", new Object[] { fRoleType
+ status.merge(RefactoringStatus.createFatalErrorStatus(NLS.bind(OTRefactoringMessages.ExtractCallinRefactoring_roleBinary_error, new Object[] { fRoleType
.getElementName() })));
}else if (fRoleType.isReadOnly()){
- status.merge(RefactoringStatus.createFatalErrorStatus(MessageFormat.format("Type ''{0}'' is declared in a read-only file.", new Object[] { fRoleType
+ status.merge(RefactoringStatus.createFatalErrorStatus(NLS.bind(OTRefactoringMessages.ExtractCallinRefactoring_roleReadOnly_error, new Object[] { fRoleType
.getElementName() })));
}
@@ -285,16 +286,16 @@
private RefactoringStatus checkCallinKind() throws JavaModelException {
if (fMappingKind == 0) {
- return RefactoringStatus.createFatalErrorStatus("Callin kind has not been specified.");
+ return RefactoringStatus.createFatalErrorStatus(OTRefactoringMessages.ExtractCallinRefactoring_callinKindUnspecified_error);
}
if (fMappingKind == ICallinMapping.KIND_BEFORE && !isExtractBeforeAvailable()) {
- return RefactoringStatus.createFatalErrorStatus("The first statement in the base method must be a method invocation to extract a before callin.");
+ return RefactoringStatus.createFatalErrorStatus(OTRefactoringMessages.ExtractCallinRefactoring_callToExtractNotFound_Before_error);
}
if (fMappingKind == ICallinMapping.KIND_AFTER && !isExtractAfterAvailable()) {
- return RefactoringStatus.createFatalErrorStatus("The last statement in the base method must be a method invocation to extract an after callin.");
+ return RefactoringStatus.createFatalErrorStatus(OTRefactoringMessages.ExtractCallinRefactoring_callToExtractNotFound_After_error);
}
if (fMappingKind != ICallinMapping.KIND_REPLACE && fMappingKind != ICallinMapping.KIND_BEFORE && fMappingKind != ICallinMapping.KIND_AFTER) {
- return RefactoringStatus.createFatalErrorStatus("Invalid callin kind.");
+ return RefactoringStatus.createFatalErrorStatus(OTRefactoringMessages.ExtractCallinRefactoring_callinKindInvalid_error);
}
return new RefactoringStatus();
}
@@ -308,7 +309,7 @@
@Override
public String getName() {
- return "Extract Callin";
+ return OTRefactoringMessages.ExtractCallin_extractCallin_name;
}
@SuppressWarnings("unchecked")
@@ -380,21 +381,21 @@
MultiTextEdit baseMultiEdit = new MultiTextEdit();
baseMultiEdit.addChild(fBaseRewrite.rewriteAST());
fBaseTextFileChange = new TextFileChange(fBaseCUnit.getElementName(), (IFile) fBaseCUnit.getResource());
- fBaseTextFileChange.setTextType("java");
+ fBaseTextFileChange.setTextType("java"); //$NON-NLS-1$
fBaseTextFileChange.setEdit(baseMultiEdit);
// create the text change for the role
MultiTextEdit roleMultiEdit = new MultiTextEdit();
roleMultiEdit.addChild(fRoleRewrite.rewriteAST());
fRoleTextFileChange = new TextFileChange(fRoleCUnit.getElementName(), (IFile) fRoleCUnit.getResource());
- fRoleTextFileChange.setTextType("java");
+ fRoleTextFileChange.setTextType("java"); //$NON-NLS-1$
fRoleTextFileChange.setEdit(roleMultiEdit);
// Update imports
if (fRoleImportRewriter.hasRecordedChanges()) {
TextEdit edit = fRoleImportRewriter.rewriteImports(null);
roleMultiEdit.addChild(edit);
- fRoleTextFileChange.addTextEditGroup(new TextEditGroup("Update Imports", new TextEdit[] { edit }));
+ fRoleTextFileChange.addTextEditGroup(new TextEditGroup(OTRefactoringMessages.OTRefactoring_organizeImports_editName, new TextEdit[] { edit }));
}
}
@@ -458,9 +459,8 @@
private CallinMappingDeclaration createMethodMapping() throws JavaModelException {
CallinMappingDeclaration mapping = fRoleAST.newCallinMappingDeclaration();
- Modifier callinModifier = createCallinModifier();
-
- mapping.setCallinModifier(callinModifier);
+
+ mapping.setBindingOperator(createCallinBindingOp());
IMethodBinding roleMethodBinding = RefactoringUtil.methodToDeclaration(fExtractedBaseMethod, fRootBase).resolveBinding();
MethodSpec roleMethodSpec = createMethodSpec(fRoleAST, fRoleImportRewriter, roleMethodBinding, fExtractedBaseMethod.getParameterNames());
@@ -481,7 +481,7 @@
parameterMapping.setIdentifier(fRoleAST.newSimpleName(varDecl.getName().getIdentifier()));
parameterMapping.setExpression(expr);
- parameterMapping.setDirection("<-");
+ parameterMapping.setDirection("<-"); //$NON-NLS-1$
mapping.getParameterMappings().add(parameterMapping);
}
}
@@ -511,17 +511,22 @@
return false;
}
- private Modifier createCallinModifier() {
+ private MethodBindingOperator createCallinBindingOp() {
+ ModifierKeyword keyword;
switch (fMappingKind) {
case ICallinMapping.KIND_BEFORE:
- return fRoleAST.newModifier(ModifierKeyword.BEFORE_KEYWORD);
+ keyword = ModifierKeyword.BEFORE_KEYWORD;
+ break;
case ICallinMapping.KIND_AFTER:
- return fRoleAST.newModifier(ModifierKeyword.AFTER_KEYWORD);
+ keyword = ModifierKeyword.AFTER_KEYWORD;
+ break;
case ICallinMapping.KIND_REPLACE:
- return fRoleAST.newModifier(ModifierKeyword.REPLACE_KEYWORD);
+ keyword = ModifierKeyword.REPLACE_KEYWORD;
+ break;
default:
return null;
}
+ return fRoleAST.newMethodBindingOperator(keyword, MethodBindingOperator.KIND_CALLIN);
}
@SuppressWarnings("unchecked")
@@ -678,16 +683,16 @@
private RefactoringStatus checkIfMethodExists() {
try {
if (methodWithNameExists(fRoleType, fRoleMethodName)) {
- return RefactoringStatus.createErrorStatus(MessageFormat.format("A method with the same name already exists.", fRoleMethodName));
+ return RefactoringStatus.createErrorStatus(NLS.bind(OTRefactoringMessages.ExtractCallinRefactoring_methodNameClash, fRoleMethodName));
}
} catch (JavaModelException exception) {
- return RefactoringStatus.createFatalErrorStatus("Could not perform the search for binding role types.");
+ return RefactoringStatus.createFatalErrorStatus(OTRefactoringMessages.ExtractCallinRefactoring_bindingSearchFailed_error);
}
return new RefactoringStatus();
}
private RefactoringStatus createCouldNotParseStatus() {
- return RefactoringStatus.createFatalErrorStatus("Could not parse the declaring type.");
+ return RefactoringStatus.createFatalErrorStatus(OTRefactoringMessages.ExtractCallinRefactoring_unparseableType_error);
}
private boolean methodWithNameExists(IType type, String methodName) throws JavaModelException {
@@ -748,10 +753,10 @@
RefactoringStatus result = new RefactoringStatus();
if (name == null)
- return RefactoringStatus.createFatalErrorStatus("No new role method name specified.");
+ return RefactoringStatus.createFatalErrorStatus(OTRefactoringMessages.ExtractCallinRefactoring_roleMethodUnspecified_error);
if ("".equals(name)) //$NON-NLS-1$
- return RefactoringStatus.createFatalErrorStatus("New role method name cannot be empty.");
+ return RefactoringStatus.createFatalErrorStatus(OTRefactoringMessages.ExtractCallinRefactoring_roleMethodNameEmpty_error);
IJavaProject javaProject = this.fRoleType.getJavaProject();
String sourceLevel= javaProject.getOption(JavaCore.COMPILER_SOURCE, true);
diff --git a/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/otrefactorings/extractcallin/ExtractCallinWizard.java b/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/otrefactorings/extractcallin/ExtractCallinWizard.java
index 3b18686..a943786 100644
--- a/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/otrefactorings/extractcallin/ExtractCallinWizard.java
+++ b/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/otrefactorings/extractcallin/ExtractCallinWizard.java
@@ -1,6 +1,7 @@
package org.eclipse.objectteams.otdt.internal.refactoring.otrefactorings.extractcallin;
import org.eclipse.ltk.ui.refactoring.RefactoringWizard;
+import org.eclipse.objectteams.otdt.internal.refactoring.otrefactorings.OTRefactoringMessages;
public class ExtractCallinWizard extends RefactoringWizard {
@@ -11,6 +12,6 @@
@Override
protected void addUserInputPages() {
- addPage(new ExtractCallinInputPage("ExtractCallinInputPage"));
+ addPage(new ExtractCallinInputPage(OTRefactoringMessages.ExtractCallinWizard_extractCallinInput_pageName));
}
}
\ No newline at end of file
diff --git a/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/otrefactorings/inlinecallin/InlineCallinAction.java b/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/otrefactorings/inlinecallin/InlineCallinAction.java
index 5730bb9..f6b85cf 100644
--- a/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/otrefactorings/inlinecallin/InlineCallinAction.java
+++ b/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/otrefactorings/inlinecallin/InlineCallinAction.java
@@ -21,10 +21,11 @@
import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
import org.eclipse.objectteams.otdt.core.ICallinMapping;
import org.eclipse.objectteams.otdt.internal.refactoring.otrefactorings.AbstractCallinRefactoringAction;
+import org.eclipse.objectteams.otdt.internal.refactoring.otrefactorings.OTRefactoringMessages;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
/**
* Action classes for the inline callin refactoring:
@@ -66,14 +67,16 @@
new RefactoringWizardOpenOperation(
new InlineCallinWizard(
new InlineCallinRefactoring((IMethod)fJavaElement),
- "Inline Callin"
+ OTRefactoringMessages.InlineCallin_inlineCallin_name
)
- ).run(fWindow.getShell(), "Inline Callin");
+ ).run(fWindow.getShell(), OTRefactoringMessages.InlineCallin_inlineCallin_name);
} catch (InterruptedException exception) {
// Do nothing
}
} else {
- MessageDialog.openInformation(null, "Inline Callin", "Operation unavailable on the current selection. Select a callin-bound role method or a callin method binding");
+ MessageDialog.openInformation(null,
+ OTRefactoringMessages.InlineCallin_inlineCallin_name,
+ OTRefactoringMessages.InlineCallin_notAvailableOnSelection_error);
}
}
}
@@ -82,7 +85,7 @@
// =========== Start InlineCallinAction ===========
public InlineCallinAction () {
- super("Inline Callin ...", "Inline a callin-bound role meth.");
+ super(OTRefactoringMessages.InlineCallin_inlineCallin_commandName, OTRefactoringMessages.InlineCallin_inlineCallin_tooltip);
}
protected CallinRefactoringActionCommon createRefactoringActionCommon(IWorkbenchWindow window) {
diff --git a/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/otrefactorings/inlinecallin/InlineCallinInputPage.java b/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/otrefactorings/inlinecallin/InlineCallinInputPage.java
index d533d0c..2e0b117 100644
--- a/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/otrefactorings/inlinecallin/InlineCallinInputPage.java
+++ b/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/otrefactorings/inlinecallin/InlineCallinInputPage.java
@@ -35,6 +35,7 @@
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.Text;
import org.eclipse.objectteams.otdt.core.ICallinMapping;
+import org.eclipse.objectteams.otdt.internal.refactoring.otrefactorings.OTRefactoringMessages;
@SuppressWarnings("restriction")
public class InlineCallinInputPage extends UserInputWizardPage {
@@ -62,7 +63,7 @@
result.setLayout(layout);
Label label = new Label(result, SWT.NONE);
- label.setText("&Inlined method name:");
+ label.setText(OTRefactoringMessages.InlineCallinInputPage_methodName_lable);
fNameField = createNameField(result);
@@ -71,7 +72,7 @@
fReferenceButton = new Button(result, SWT.CHECK);
fReferenceButton.setEnabled(false);
- fReferenceButton.setText("&Delete role method");
+ fReferenceButton.setText(OTRefactoringMessages.InlineCallinInputPage_deleteMethod_button);
GridData data = new GridData(GridData.FILL_HORIZONTAL);
data.horizontalSpan = 2;
data.verticalIndent = 2;
@@ -158,7 +159,7 @@
protected void createMemberTableLabel(final Composite parent) {
fLabel = new Label(parent, SWT.NONE);
- fLabel.setText("&Select the bound base methods:");
+ fLabel.setText(OTRefactoringMessages.InlineCallinInputPage_baseMethod_label);
final GridData data = new GridData();
data.horizontalSpan = 2;
fLabel.setLayoutData(data);
@@ -196,10 +197,10 @@
table.setLayout(tableLayout);
final TableColumn column0 = new TableColumn(table, SWT.NONE);
- column0.setText("Base Method");
+ column0.setText(OTRefactoringMessages.InlineCallinInputPage_basemethod_columnLabel);
final TableColumn column1 = new TableColumn(table, SWT.NONE);
- column1.setText("Callin Kind");
+ column1.setText(OTRefactoringMessages.InlineCallinInputPage_callinKind_columnLabel);
fTableViewer = new CheckboxTableViewer(table);
fTableViewer.setUseHashlookup(true);
@@ -223,9 +224,9 @@
private static class BaseMethodInfoLabelProvider extends LabelProvider implements ITableLabelProvider {
- private static final String BEFORE_LABEL = "Before";
- private static final String AFTER_LABEL = "After";
- private static final String REPLACE_LABEL = "Replace";
+ private static final String BEFORE_LABEL = OTRefactoringMessages.InlineCallinInputPage_kindBefore_label;
+ private static final String AFTER_LABEL = OTRefactoringMessages.InlineCallinInputPage_kindAfter_label;
+ private static final String REPLACE_LABEL = OTRefactoringMessages.InlineCallinInputPage_kindReplace_label;
private static final int CALLIN_KIND_COLUMN = 1;
private static final int METHOD_COLUMN = 0;
diff --git a/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/otrefactorings/inlinecallin/InlineCallinRefactoring.java b/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/otrefactorings/inlinecallin/InlineCallinRefactoring.java
index eadd37c..8a972d0 100644
--- a/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/otrefactorings/inlinecallin/InlineCallinRefactoring.java
+++ b/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/otrefactorings/inlinecallin/InlineCallinRefactoring.java
@@ -1,6 +1,5 @@
package org.eclipse.objectteams.otdt.internal.refactoring.otrefactorings.inlinecallin;
-import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -51,6 +50,7 @@
import org.eclipse.jdt.core.dom.MethodInvocation;
import org.eclipse.jdt.core.dom.MethodSpec;
import org.eclipse.jdt.core.dom.Modifier;
+import org.eclipse.jdt.core.dom.Modifier.ModifierKeyword;
import org.eclipse.jdt.core.dom.ParameterMapping;
import org.eclipse.jdt.core.dom.PrimitiveType;
import org.eclipse.jdt.core.dom.ReturnStatement;
@@ -60,7 +60,6 @@
import org.eclipse.jdt.core.dom.Type;
import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
import org.eclipse.jdt.core.dom.VariableDeclarationStatement;
-import org.eclipse.jdt.core.dom.Modifier.ModifierKeyword;
import org.eclipse.jdt.core.dom.rewrite.ASTRewrite;
import org.eclipse.jdt.core.dom.rewrite.ImportRewrite;
import org.eclipse.jdt.core.dom.rewrite.ListRewrite;
@@ -76,16 +75,12 @@
import org.eclipse.jdt.internal.corext.refactoring.structure.ImportRewriteUtil;
import org.eclipse.jdt.internal.corext.refactoring.structure.ReferenceFinderUtil;
import org.eclipse.jdt.internal.corext.refactoring.util.RefactoringASTParser;
-import org.eclipse.jdt.internal.corext.util.Messages;
import org.eclipse.jdt.ui.JavaElementLabels;
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.eclipse.ltk.core.refactoring.TextFileChange;
-import org.eclipse.text.edits.MultiTextEdit;
-import org.eclipse.text.edits.TextEdit;
-import org.eclipse.text.edits.TextEditGroup;
import org.eclipse.objectteams.otdt.core.ICallinMapping;
import org.eclipse.objectteams.otdt.core.ICalloutMapping;
import org.eclipse.objectteams.otdt.core.ICalloutToFieldMapping;
@@ -94,7 +89,12 @@
import org.eclipse.objectteams.otdt.core.IRoleType;
import org.eclipse.objectteams.otdt.core.OTModelManager;
import org.eclipse.objectteams.otdt.internal.refactoring.corext.rename.BaseCallFinder;
+import org.eclipse.objectteams.otdt.internal.refactoring.otrefactorings.OTRefactoringMessages;
import org.eclipse.objectteams.otdt.internal.refactoring.util.RefactoringUtil;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.text.edits.MultiTextEdit;
+import org.eclipse.text.edits.TextEdit;
+import org.eclipse.text.edits.TextEditGroup;
@SuppressWarnings("restriction")
public class InlineCallinRefactoring extends Refactoring {
@@ -178,7 +178,7 @@
@Override
public String getName() {
- return "Inline Callin";
+ return OTRefactoringMessages.InlineCallin_inlineCallin_name;
}
public void setRoleMethodName(String name) {
@@ -202,23 +202,23 @@
RefactoringStatus status= new RefactoringStatus();
try {
- monitor.beginTask("Checking preconditions...", 1);
+ monitor.beginTask(OTRefactoringMessages.InlineCallinRefactoring_preconditions_progress, 1);
if (fRoleMethod == null){
- status.merge(RefactoringStatus.createFatalErrorStatus("Method has not been specified."));
+ status.merge(RefactoringStatus.createFatalErrorStatus(OTRefactoringMessages.InlineCallinRefactoring_noMethod_error));
}else if (!fRoleMethod.exists()){
- status.merge(RefactoringStatus.createFatalErrorStatus(MessageFormat.format("Method ''{0}'' does not exist.", new Object[] { fRoleMethod
+ status.merge(RefactoringStatus.createFatalErrorStatus(NLS.bind(OTRefactoringMessages.InlineCallinRefactoring_inexistentMethod_error, new Object[] { fRoleMethod
.getElementName() })));
}else if (fRoleMethod.isBinary()){
- status.merge(RefactoringStatus.createFatalErrorStatus(MessageFormat.format("Method ''{0}'' is declared in a binary class file.", new Object[] { fRoleMethod
+ status.merge(RefactoringStatus.createFatalErrorStatus(NLS.bind(OTRefactoringMessages.InlineCallinRefactoring_binaryMethod_error, new Object[] { fRoleMethod
.getElementName() })));
}else if (fRoleMethod.isReadOnly()){
- status.merge(RefactoringStatus.createFatalErrorStatus(MessageFormat.format("Method ''{0}'' is declared in a read-only class file.", new Object[] { fRoleMethod
+ status.merge(RefactoringStatus.createFatalErrorStatus(NLS.bind(OTRefactoringMessages.InlineCallinRefactoring_readOnlyMethod_error, new Object[] { fRoleMethod
.getElementName() })));
}else if (!fRoleMethod.getCompilationUnit().isStructureKnown()){
- status.merge(RefactoringStatus.createFatalErrorStatus(MessageFormat.format("Compilation unit ''{0}'' contains compile errors.",
+ status.merge(RefactoringStatus.createFatalErrorStatus(NLS.bind(OTRefactoringMessages.InlineCallinRefactoring_compileErrors_error,
new Object[] { fRoleMethod.getCompilationUnit().getElementName() })));
} else if (!RefactoringUtil.isRoleMethod(fRoleMethod)) {
- status.merge(RefactoringStatus.createFatalErrorStatus(MessageFormat.format("The selected method ''{0}'' is not declared in a role.",
+ status.merge(RefactoringStatus.createFatalErrorStatus(NLS.bind(OTRefactoringMessages.InlineCallinRefactoring_notInsideRole_error,
new Object[] { fRoleMethod.getElementName() })));
}else{
status.merge(initialize(monitor));
@@ -243,15 +243,15 @@
try {
IType baseType = ((IRoleType) OTModelManager.getOTElement(fRoleMethod.getDeclaringType())).getBaseClass();
- if (baseType.isBinary()) {
- status.merge(RefactoringStatus.createFatalErrorStatus("Base class "+baseType.getElementName()+" is a binary type, cannot modify."));
- return status;
- }
- if(baseType.isReadOnly()){
- status.merge(RefactoringStatus.createFatalErrorStatus("Base class "+baseType.getElementName()+" is read-only, cannot modify."));
- return status;
- }
if (baseType != null) {
+ if (baseType.isBinary()) {
+ status.merge(RefactoringStatus.createFatalErrorStatus(NLS.bind(OTRefactoringMessages.InlineCallinRefactoring_binaryBase_error, baseType.getElementName())));
+ return status;
+ }
+ if(baseType.isReadOnly()){
+ status.merge(RefactoringStatus.createFatalErrorStatus(NLS.bind(OTRefactoringMessages.InlineCallinRefactoring_readOnlyBase_error, baseType.getElementName())));
+ return status;
+ }
fBaseType = baseType;
fBaseCUnit = baseType.getCompilationUnit();
@@ -262,7 +262,7 @@
fBaseImportRewriter = StubUtility.createImportRewrite(fRootBase, true);
fBaseAST = fRootBase.getAST();
} else {
- status.merge(RefactoringStatus.createFatalErrorStatus("The declaring role class is not bound to a base class."));
+ status.merge(RefactoringStatus.createFatalErrorStatus(OTRefactoringMessages.InlineCallinRefactoring_unboundRole_error));
}
} catch (JavaModelException e) {
status.merge(createCouldNotParseStatus());
@@ -282,8 +282,8 @@
}
if (fBoundCallinMappings.size() == 0) {
- status.merge(RefactoringStatus.createFatalErrorStatus(MessageFormat.format(
- "The selected method ''{0}'' is not bound on the left hand side of a callin method binding.", new Object[] { fRoleMethod
+ status.merge(RefactoringStatus.createFatalErrorStatus(NLS.bind(
+ OTRefactoringMessages.InlineCallinRefactoring_unboundMethod_error, new Object[] { fRoleMethod
.getElementName() })));
}
@@ -296,7 +296,7 @@
}
fCallinBaseMethodInfos = infos.toArray(new CallinBaseMethodInfo[infos.size()]);
} catch (JavaModelException e) {
- status.merge(RefactoringStatus.createFatalErrorStatus("Could not parse the method mappings."));
+ status.merge(RefactoringStatus.createFatalErrorStatus(OTRefactoringMessages.InlineCallinRefactoring_unparseableMethodMapping_error));
}
}
return status;
@@ -354,15 +354,13 @@
continue;
}
} else {
- status.addError(Messages.format("The Role Method ''{0}'' is bound in a callin binding and cannot be inlined.", new String[] { fRoleMethod
- .getElementName() }));
+ status.addError(NLS.bind(OTRefactoringMessages.InlineCallinRefactoring_methodBoundByOtherCallin_error, fRoleMethod.getElementName()));
continue;
}
}
if (element instanceof ICalloutMapping) {
- status.addError(Messages.format("The Role Method ''{0}'' is bound in a callout binding and cannot be inlined.", new String[] { fRoleMethod
- .getElementName() }));
+ status.addError(NLS.bind(OTRefactoringMessages.InlineCallinRefactoring_methodIsCallout_error, fRoleMethod.getElementName()));
continue;
}
@@ -370,12 +368,11 @@
if (element instanceof IMember) {
// try to create context informations for the search result
IMember referencingMember = (IMember) element;
- String msg = Messages.format("The Role Method ''{0}'' is referenced by ''{1}'' and cannot be deleted.", new String[] {
- fRoleMethod.getElementName(), JavaElementLabels.getTextLabel(referencingMember, JavaElementLabels.ALL_FULLY_QUALIFIED) });
+ String msg = NLS.bind(OTRefactoringMessages.InlineCallinRefactoring_methodIsUsedBy_error,
+ fRoleMethod.getElementName(), JavaElementLabels.getTextLabel(referencingMember, JavaElementLabels.ALL_FULLY_QUALIFIED));
status.addError(msg, JavaStatusContext.create(referencingMember));
} else {
- status.addError(Messages.format("The Role Method ''{0}'' is referenced and cannot be deleted.",
- new String[] { fRoleMethod.getElementName() }));
+ status.addError(NLS.bind(OTRefactoringMessages.InlineCallinRefactoring_methodIsUsed_error, fRoleMethod.getElementName()));
}
}
}
@@ -386,10 +383,10 @@
RefactoringStatus result = new RefactoringStatus();
if (name == null)
- return RefactoringStatus.createFatalErrorStatus("No new role method name specified.");
+ return RefactoringStatus.createFatalErrorStatus(OTRefactoringMessages.InlineCallinRefactoring_missingNewMethodName_error);
if ("".equals(name)) //$NON-NLS-1$
- return RefactoringStatus.createFatalErrorStatus("New role method name cannot be empty.");
+ return RefactoringStatus.createFatalErrorStatus(OTRefactoringMessages.InlineCallinRefactoring_emptyMethodName_error);
IJavaProject javaProject = this.fRoleType.getJavaProject();
String sourceLevel= javaProject.getOption(JavaCore.COMPILER_SOURCE, true);
@@ -413,7 +410,7 @@
private RefactoringStatus checkIfMethodExists() {
try {
if (methodWithNameExists(fBaseType, fRoleMethodName)){
- return RefactoringStatus.createErrorStatus(MessageFormat.format("A method with the same name already exists.", fRoleMethodName));
+ return RefactoringStatus.createErrorStatus(NLS.bind(OTRefactoringMessages.InlineCallinRefactoring_methodNameClash_error, fRoleMethodName));
}
} catch (JavaModelException exception) {
return createCouldNotParseStatus();
@@ -429,7 +426,7 @@
for (int i = 0; i < referencedMethods.length; i++) {
IMethod referencedMethod = referencedMethods[i];
if (referencedMethod.getDeclaringType().equals(fRoleType)) {
- status.merge(RefactoringStatus.createErrorStatus(MessageFormat.format("The method to inline ''{0}'' references the role method ''{1}''.",
+ status.merge(RefactoringStatus.createErrorStatus(NLS.bind(OTRefactoringMessages.InlineCallinRefactoring_methodUsesRoleMethod_error,
fRoleMethodName, referencedMethod)));
}
}
@@ -439,7 +436,7 @@
for (int i = 0; i < referencedFileds.length; i++) {
IField referencedFiled = referencedFileds[i];
if (referencedFiled.getDeclaringType().equals(fRoleType)) {
- status.merge(RefactoringStatus.createErrorStatus(MessageFormat.format("The method to inline ''{0}'' references the role field ''{1}''.",
+ status.merge(RefactoringStatus.createErrorStatus(NLS.bind(OTRefactoringMessages.InlineCallinRefactoring_methodUsesRoleField_error,
fRoleMethodName, referencedFiled)));
}
}
@@ -456,7 +453,7 @@
RefactoringStatus checkBaseMethods() {
RefactoringStatus status = new RefactoringStatus();
if (fTargetBaseMethods == null || fTargetBaseMethods.length == 0) {
- status.merge(RefactoringStatus.createFatalErrorStatus("No base method selected."));
+ status.merge(RefactoringStatus.createFatalErrorStatus(OTRefactoringMessages.InlineCallinRefactoring_missingBaseMethod_error));
}
return status;
}
@@ -471,12 +468,12 @@
}
private RefactoringStatus createCouldNotParseStatus() {
- return RefactoringStatus.createFatalErrorStatus("Could not parse the declaring type.");
+ return RefactoringStatus.createFatalErrorStatus(OTRefactoringMessages.InlineCallinRefactoring_unparseableType_error);
}
@Override
public Change createChange(IProgressMonitor pm) throws CoreException, OperationCanceledException {
- pm.beginTask("Creating Change", fCallinBaseMethodInfos.length + 2);
+ pm.beginTask(OTRefactoringMessages.InlineCallinRefactoring_creatingChange_progress, fCallinBaseMethodInfos.length + 2);
inlineCallin(pm);
Change change = new CompositeChange(getName(), new TextFileChange[] { fBaseTextFileChange, fRoleTextFileChange });
pm.done();
@@ -557,20 +554,20 @@
MultiTextEdit baseMultiEdit = new MultiTextEdit();
baseMultiEdit.addChild(fBaseRewrite.rewriteAST());
fBaseTextFileChange = new TextFileChange(fBaseCUnit.getElementName(), (IFile) fBaseCUnit.getResource());
- fBaseTextFileChange.setTextType("java");
+ fBaseTextFileChange.setTextType("java"); //$NON-NLS-1$
fBaseTextFileChange.setEdit(baseMultiEdit);
if (fBaseImportRewriter.hasRecordedChanges()) {
TextEdit edit = fBaseImportRewriter.rewriteImports(null);
baseMultiEdit.addChild(edit);
- fBaseTextFileChange.addTextEditGroup(new TextEditGroup("Organize Imports", new TextEdit[] { edit }));
+ fBaseTextFileChange.addTextEditGroup(new TextEditGroup(OTRefactoringMessages.OTRefactoring_organizeImports_editName, new TextEdit[] { edit }));
}
// create the text change for the role
MultiTextEdit roleMultiEdit = new MultiTextEdit();
roleMultiEdit.addChild(fRoleRewrite.rewriteAST());
fRoleTextFileChange = new TextFileChange(fRoleCUnit.getElementName(), (IFile) fRoleCUnit.getResource());
- fRoleTextFileChange.setTextType("java");
+ fRoleTextFileChange.setTextType("java"); //$NON-NLS-1$
fRoleTextFileChange.setEdit(roleMultiEdit);
}
@@ -1406,7 +1403,7 @@
}
private String generateResultVarName(CallinBaseMethodInfo baseMethodInfo) throws JavaModelException {
- String name = "baseResult";
+ String name = "baseResult"; //$NON-NLS-1$
List<String> paramNames = Arrays.asList(baseMethodInfo.getMethod().getParameterNames());
return generateVarName(name, paramNames);
}
@@ -1436,10 +1433,10 @@
private void generateBaseMethodNames(CallinBaseMethodInfo[] baseMethodInfos) throws JavaModelException {
for (int i = 0; i < baseMethodInfos.length; i++) {
- String newBaseName = "base_" + fTargetBaseMethods[i].getMethod().getElementName();
+ String newBaseName = "base_" + fTargetBaseMethods[i].getMethod().getElementName(); //$NON-NLS-1$
int j = 2;
while (methodWithNameExists(fBaseType, newBaseName)) {
- newBaseName = "base_" + fTargetBaseMethods[i].getMethod().getElementName() + j;
+ newBaseName = "base_" + fTargetBaseMethods[i].getMethod().getElementName() + j; //$NON-NLS-1$
j++;
}
baseMethodInfos[i].setNewMethodName(newBaseName);
@@ -1451,7 +1448,7 @@
List<String> localVarNames = new ArrayList<String>();
localVarNames.addAll(localVarNamesInRoleMethod());
localVarNames.addAll(Arrays.asList(fRoleMethod.getParameterNames()));
- String tunneledName = generateVarName("tunneled" + upperCasedName, localVarNames);
+ String tunneledName = generateVarName("tunneled" + upperCasedName, localVarNames); //$NON-NLS-1$
return tunneledName;
}
diff --git a/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/otrefactorings/inlinecallin/InlineCallinWizard.java b/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/otrefactorings/inlinecallin/InlineCallinWizard.java
index 2b603f2..b36a520 100644
--- a/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/otrefactorings/inlinecallin/InlineCallinWizard.java
+++ b/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/otrefactorings/inlinecallin/InlineCallinWizard.java
@@ -1,6 +1,7 @@
package org.eclipse.objectteams.otdt.internal.refactoring.otrefactorings.inlinecallin;
import org.eclipse.ltk.ui.refactoring.RefactoringWizard;
+import org.eclipse.objectteams.otdt.internal.refactoring.otrefactorings.OTRefactoringMessages;
public class InlineCallinWizard extends RefactoringWizard {
@@ -11,6 +12,6 @@
@Override
protected void addUserInputPages() {
- addPage(new InlineCallinInputPage("InlineCallinInputPage"));
+ addPage(new InlineCallinInputPage(OTRefactoringMessages.InlineCallinWizard_inlineCallinInput_pageName));
}
}
\ No newline at end of file
diff --git a/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/util/RefactoringUtil.java b/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/util/RefactoringUtil.java
index e7ccadd..be517bd 100644
--- a/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/util/RefactoringUtil.java
+++ b/plugins/org.eclipse.objectteams.otdt.refactoring/src/org/eclipse/objectteams/otdt/internal/refactoring/util/RefactoringUtil.java
@@ -39,8 +39,6 @@
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IMember;
import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.ITypeHierarchy;
import org.eclipse.jdt.core.JavaModelException;
@@ -58,8 +56,8 @@
import org.eclipse.jdt.core.dom.MethodDeclaration;
import org.eclipse.jdt.core.dom.MethodMappingElement;
import org.eclipse.jdt.core.dom.MethodSpec;
-import org.eclipse.jdt.core.dom.Modifier;
import org.eclipse.jdt.core.dom.Name;
+import org.eclipse.jdt.core.dom.NodeFinder;
import org.eclipse.jdt.core.dom.RoleTypeDeclaration;
import org.eclipse.jdt.core.search.IJavaSearchConstants;
import org.eclipse.jdt.core.search.IJavaSearchScope;
@@ -70,13 +68,11 @@
import org.eclipse.jdt.internal.core.JavaModelManager;
import org.eclipse.jdt.internal.corext.Corext;
import org.eclipse.jdt.internal.corext.dom.ASTNodes;
-import org.eclipse.jdt.core.dom.NodeFinder;
import org.eclipse.jdt.internal.corext.refactoring.Checks;
import org.eclipse.jdt.internal.corext.refactoring.base.JavaStatusContext;
import org.eclipse.jdt.internal.corext.refactoring.rename.RippleMethodFinder2;
import org.eclipse.jdt.internal.corext.refactoring.util.RefactoringASTParser;
import org.eclipse.jdt.internal.corext.util.JdtFlags;
-import org.eclipse.jdt.internal.corext.util.Messages;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
import org.eclipse.ltk.core.refactoring.RefactoringStatusContext;
import org.eclipse.ltk.core.refactoring.RefactoringStatusEntry;
@@ -93,6 +89,8 @@
import org.eclipse.objectteams.otdt.internal.refactoring.OTRefactoringPlugin;
import org.eclipse.objectteams.otdt.internal.refactoring.corext.OTRefactoringCoreMessages;
import org.eclipse.objectteams.otdt.internal.refactoring.corext.base.OTRefactoringStatusCodes;
+import org.eclipse.objectteams.otdt.internal.refactoring.otrefactorings.OTRefactoringMessages;
+import org.eclipse.osgi.util.NLS;
/**
* This utility class is a part of the OT/J refactoring adaptation. It contains
@@ -750,7 +748,7 @@
* @param newMethodName
* the name of the refactored method
* @param oldMethodName
- * the old name of the refactored method
+ * the old name of the refactored method (can be null)
* @param focusType
* the regarded type
* @param roleTypes
@@ -809,7 +807,7 @@
* @param newMethodName
* the name of the refactored method
* @param oldMethodName
- * the old name of the refactored method
+ * the old name of the refactored method (can be null)
* @param superTypes
* the super types of the focus type
* @param msgCreator a message creator object to provide refactoring specific error messages
@@ -920,7 +918,7 @@
IRoleType roleType = (IRoleType) OTModelManager.getOTElement(focusType);
result.merge(RefactoringUtil.checkOverloadingAndAmbiguityForRole(result, newMethodName, newParamTypes, roleType, ambigutiyMsgCreator, overloadingMsgCreator,
pm));
- result.merge(RefactoringUtil.checkAmbiguityForBasePresentInFocusTypeSuperhierarchy(newMethodName, "", superTypes, ambigutiyMsgCreator, roleType));
+ result.merge(RefactoringUtil.checkAmbiguityForBasePresentInFocusTypeSuperhierarchy(newMethodName, null, superTypes, ambigutiyMsgCreator, roleType));
}
// if the focus type is an unbound regular class,
// check for overloading methods in this class and its supertypes
@@ -934,7 +932,7 @@
// check for overloading methods in this base class and its supertypes,
// and for ambiguity in method bindings of bound role classes
else if (baseTypes.contains(focusType)) {
- result.merge(RefactoringUtil.checkOverloadingAndAmbiguityForBase(result, newMethodName, "", newParamTypes, focusType, roleTypes,
+ result.merge(RefactoringUtil.checkOverloadingAndAmbiguityForBase(result, newMethodName, null, newParamTypes, focusType, roleTypes,
ambigutiyMsgCreator, overloadingMsgCreator, pm));
}
// if the focus type has subtypes,
@@ -957,14 +955,14 @@
// check also ambiguous base method specs
if (baseClass != null && baseClass.equals(focusType)) {
roleList.add(roleType);
- result.merge(RefactoringUtil.checkForAmbiguousBaseMethodSpecs(roleList, newMethodName, "", ambigutiyMsgCreator));
+ result.merge(RefactoringUtil.checkForAmbiguousBaseMethodSpecs(roleList, newMethodName, null, ambigutiyMsgCreator));
}
// else if base class of role type is a direct or
// indirect
// superclass of focus type, check also ambiguous base
// method specs
else {
- result.merge(RefactoringUtil.checkAmbiguityForBasePresentInFocusTypeSuperhierarchy(newMethodName, "", superTypes, ambigutiyMsgCreator,
+ result.merge(RefactoringUtil.checkAmbiguityForBasePresentInFocusTypeSuperhierarchy(newMethodName, null, superTypes, ambigutiyMsgCreator,
roleType));
}
}
@@ -983,7 +981,7 @@
// supertypes
// and for ambiguity in method bindings of bound role classes
else if (baseTypes.contains(subType)) {
- result.merge(RefactoringUtil.checkOverloadingAndAmbiguityForBase(result, newMethodName, "", newParamTypes, subType, roleTypes, ambigutiyMsgCreator,
+ result.merge(RefactoringUtil.checkOverloadingAndAmbiguityForBase(result, newMethodName, null, newParamTypes, subType, roleTypes, ambigutiyMsgCreator,
overloadingMsgCreator, pm));
}
}
@@ -1334,7 +1332,7 @@
}
public static RefactoringStatus createNotYetFullyOTAwareMsg(String refactoringName) {
- return RefactoringStatus.createInfoStatus(Messages.format("The ''{0}'' Refactoring is not yet fully OT-aware!", new Object[] { refactoringName }));
+ return RefactoringStatus.createInfoStatus(NLS.bind(OTRefactoringMessages.RefactoringUtil_notFullyOTAware_info, refactoringName ));
}
@SuppressWarnings("rawtypes")