mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-16 13:35:22 +02:00
Bug 148977: New Filter dialog should propose a default filter name on the 2nd page
https://bugs.eclipse.org/bugs/show_bug.cgi?id=148977
This commit is contained in:
parent
8896f1d83e
commit
e207aecd08
2 changed files with 44 additions and 6 deletions
|
@ -1,5 +1,5 @@
|
||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
|
* Copyright (c) 2002, 2010 IBM Corporation and others. All rights reserved.
|
||||||
* This program and the accompanying materials are made available under the terms
|
* This program and the accompanying materials are made available under the terms
|
||||||
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
@ -15,6 +15,7 @@
|
||||||
* David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible
|
* David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible
|
||||||
* David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared
|
* David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared
|
||||||
* David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
|
* David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
|
||||||
|
* David Dykstal (IBM) - [148977] New Filter dialog should propose a default filter name on the 2nd page
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.files.ui.widgets;
|
package org.eclipse.rse.files.ui.widgets;
|
||||||
|
@ -862,4 +863,24 @@ public class SystemFileFilterStringEditPane
|
||||||
return super.canSaveImplicitly();
|
return super.canSaveImplicitly();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDefaultFilterName()
|
||||||
|
{
|
||||||
|
String defaultFilterName = ""; //$NON-NLS-1$
|
||||||
|
if (folderCombo != null) {
|
||||||
|
String folderName = folderCombo.getText().trim();
|
||||||
|
if (folderName.length() > 0) {
|
||||||
|
String separator = inputSubsystemConfiguration.getSeparator();
|
||||||
|
if (folderName.endsWith(separator)) {
|
||||||
|
folderName = folderName.substring(0, folderName.length() - separator.length());
|
||||||
|
}
|
||||||
|
int p = folderName.lastIndexOf(separator);
|
||||||
|
p += separator.length();
|
||||||
|
if (p < folderName.length()) {
|
||||||
|
defaultFilterName = folderName.substring(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return defaultFilterName;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2002, 2008 IBM Corporation and others.
|
* Copyright (c) 2002, 2010 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -16,6 +16,7 @@
|
||||||
* David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
|
* David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
|
||||||
* David McKnight (IBM) - [226948] [api][regression] SystemNewFilterWizard.createNamePage() is no longer available
|
* David McKnight (IBM) - [226948] [api][regression] SystemNewFilterWizard.createNamePage() is no longer available
|
||||||
* David McKnight (IBM) - [249482] Duplicate Filters can be created if changing the filter pool
|
* David McKnight (IBM) - [249482] Duplicate Filters can be created if changing the filter pool
|
||||||
|
* David Dykstal (IBM) - [148977] New Filter dialog should propose a default filter name on the 2nd page
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.ui.filters.dialogs;
|
package org.eclipse.rse.ui.filters.dialogs;
|
||||||
|
@ -537,10 +538,26 @@ public class SystemNewFilterWizardNamePage
|
||||||
if (!userEditedName && (nameText!=null))
|
if (!userEditedName && (nameText!=null))
|
||||||
{
|
{
|
||||||
String defaultName = ((SystemNewFilterWizard)getWizard()).getDefaultFilterName();
|
String defaultName = ((SystemNewFilterWizard)getWizard()).getDefaultFilterName();
|
||||||
if (defaultName != null)
|
if (defaultName != null) {
|
||||||
{
|
if (defaultName.length() > 0) {
|
||||||
|
if (nameValidator != null) {
|
||||||
|
String nameProposal = defaultName;
|
||||||
|
boolean invalid = true;
|
||||||
|
int times = 0;
|
||||||
|
while (invalid && times < 20) { // try only 20 times
|
||||||
|
if (nameValidator.validate(nameProposal) != null) {
|
||||||
|
times++;
|
||||||
|
nameProposal = defaultName + " " + times; //$NON-NLS-1$
|
||||||
|
} else {
|
||||||
|
invalid = false;
|
||||||
|
defaultName = nameProposal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
ignoreChanges = true;
|
ignoreChanges = true;
|
||||||
nameText.setText(defaultName);
|
nameText.setText(defaultName);
|
||||||
|
nameText.selectAll();
|
||||||
ignoreChanges = false;
|
ignoreChanges = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue