ADT: Extract String IDs from Layout XML strings.
This would have been part of CL #7041 if I had not forgotten a last git commit -a --amend.
This commit is contained in:
@@ -132,7 +132,7 @@ class ExtractStringInputPage extends UserInputWizardPage implements IWizardPage
|
|||||||
// line: Textfield for string value (based on selection, if any)
|
// line: Textfield for string value (based on selection, if any)
|
||||||
|
|
||||||
Label label = new Label(group, SWT.NONE);
|
Label label = new Label(group, SWT.NONE);
|
||||||
label.setText("String");
|
label.setText("&String");
|
||||||
|
|
||||||
String selectedString = ref.getTokenString();
|
String selectedString = ref.getTokenString();
|
||||||
|
|
||||||
@@ -156,16 +156,17 @@ class ExtractStringInputPage extends UserInputWizardPage implements IWizardPage
|
|||||||
|
|
||||||
label = new Label(group, SWT.NONE);
|
label = new Label(group, SWT.NONE);
|
||||||
if (ref.getMode() == ExtractStringRefactoring.Mode.EDIT_SOURCE) {
|
if (ref.getMode() == ExtractStringRefactoring.Mode.EDIT_SOURCE) {
|
||||||
label.setText("Replace by R.string.");
|
label.setText("&Replace by R.string.");
|
||||||
} else if (ref.getMode() == ExtractStringRefactoring.Mode.SELECT_NEW_ID) {
|
} else if (ref.getMode() == ExtractStringRefactoring.Mode.SELECT_NEW_ID) {
|
||||||
label.setText("New R.string.");
|
label.setText("New &R.string.");
|
||||||
} else {
|
} else {
|
||||||
label.setText("ID R.string.");
|
label.setText("ID &R.string.");
|
||||||
}
|
}
|
||||||
|
|
||||||
mStringIdField = new Text(group, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
|
mStringIdField = new Text(group, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
|
||||||
mStringIdField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
mStringIdField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||||
mStringIdField.setText(guessId(selectedString));
|
mStringIdField.setText(guessId(selectedString));
|
||||||
|
mStringIdField.forceFocus();
|
||||||
|
|
||||||
ref.setNewStringId(mStringIdField.getText().trim());
|
ref.setNewStringId(mStringIdField.getText().trim());
|
||||||
|
|
||||||
@@ -196,7 +197,7 @@ class ExtractStringInputPage extends UserInputWizardPage implements IWizardPage
|
|||||||
|
|
||||||
Label label;
|
Label label;
|
||||||
label = new Label(group, SWT.NONE);
|
label = new Label(group, SWT.NONE);
|
||||||
label.setText("Configuration:");
|
label.setText("&Configuration:");
|
||||||
|
|
||||||
mConfigSelector = new ConfigurationSelector(group);
|
mConfigSelector = new ConfigurationSelector(group);
|
||||||
GridData gd = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL);
|
GridData gd = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL);
|
||||||
@@ -210,7 +211,7 @@ class ExtractStringInputPage extends UserInputWizardPage implements IWizardPage
|
|||||||
// line: selection of the output file
|
// line: selection of the output file
|
||||||
|
|
||||||
label = new Label(group, SWT.NONE);
|
label = new Label(group, SWT.NONE);
|
||||||
label.setText("Resource file:");
|
label.setText("Resource &file:");
|
||||||
|
|
||||||
mResFileCombo = new Combo(group, SWT.DROP_DOWN);
|
mResFileCombo = new Combo(group, SWT.DROP_DOWN);
|
||||||
mResFileCombo.select(0);
|
mResFileCombo.select(0);
|
||||||
|
|||||||
@@ -1036,10 +1036,10 @@ public class ExtractStringRefactoring extends Refactoring {
|
|||||||
if (!name.equals(initialTypeName)) {
|
if (!name.equals(initialTypeName)) {
|
||||||
// Only accept the same folder type (e.g. layout-*)
|
// Only accept the same folder type (e.g. layout-*)
|
||||||
ResourceFolderType t =
|
ResourceFolderType t =
|
||||||
ResourceFolderType.getFolderType(initialTypeName);
|
ResourceFolderType.getFolderType(name);
|
||||||
if (t == type) {
|
if (type.equals(t)) {
|
||||||
// recompute the path
|
// recompute the path
|
||||||
IPath p = res.getFullPath().append(name).append(filename);
|
IPath p = res.getProjectRelativePath().append(name).append(filename);
|
||||||
IResource f = project.findMember(p);
|
IResource f = project.findMember(p);
|
||||||
if (f != null && f instanceof IFile) {
|
if (f != null && f instanceof IFile) {
|
||||||
files.add((IFile) f);
|
files.add((IFile) f);
|
||||||
|
|||||||
Reference in New Issue
Block a user