1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Bug 328012 - UI freezes when opening a launch configuration if the binary is on a slow file system

This commit is contained in:
Sergey Prigogin 2010-11-28 21:17:37 +00:00
parent 3e56b321b1
commit 93025a22fb
3 changed files with 8 additions and 23 deletions

View file

@ -356,7 +356,6 @@ public class CMainTab extends CAbstractMainTab {
*/ */
@Override @Override
protected void handleSearchButtonSelected() { protected void handleSearchButtonSelected() {
if (getCProject() == null) { if (getCProject() == null) {
MessageDialog.openInformation(getShell(), LaunchMessages.getString("CMainTab.Project_required"), //$NON-NLS-1$ MessageDialog.openInformation(getShell(), LaunchMessages.getString("CMainTab.Project_required"), //$NON-NLS-1$
LaunchMessages.getString("CMainTab.Enter_project_before_searching_for_program")); //$NON-NLS-1$ LaunchMessages.getString("CMainTab.Enter_project_before_searching_for_program")); //$NON-NLS-1$
@ -364,7 +363,6 @@ public class CMainTab extends CAbstractMainTab {
} }
ILabelProvider programLabelProvider = new CElementLabelProvider() { ILabelProvider programLabelProvider = new CElementLabelProvider() {
@Override @Override
public String getText(Object element) { public String getText(Object element) {
if (element instanceof IBinary) { if (element instanceof IBinary) {
@ -395,7 +393,6 @@ public class CMainTab extends CAbstractMainTab {
}; };
ILabelProvider qualifierLabelProvider = new CElementLabelProvider() { ILabelProvider qualifierLabelProvider = new CElementLabelProvider() {
@Override @Override
public String getText(Object element) { public String getText(Object element) {
if (element instanceof IBinary) { if (element instanceof IBinary) {
@ -422,7 +419,6 @@ public class CMainTab extends CAbstractMainTab {
IBinary binary = (IBinary)dialog.getFirstResult(); IBinary binary = (IBinary)dialog.getFirstResult();
fProgText.setText(binary.getResource().getProjectRelativePath().toString()); fProgText.setText(binary.getResource().getProjectRelativePath().toString());
} }
} }
/* /*
@ -432,7 +428,6 @@ public class CMainTab extends CAbstractMainTab {
*/ */
@Override @Override
public boolean isValid(ILaunchConfiguration config) { public boolean isValid(ILaunchConfiguration config) {
setErrorMessage(null); setErrorMessage(null);
setMessage(null); setMessage(null);
@ -474,16 +469,9 @@ public class CMainTab extends CAbstractMainTab {
return false; return false;
} }
} }
try { // Notice that we don't check if exePath points to a valid executable since such
if (!isBinary(project, exePath)) { // check is too expensive to be done on the UI thread.
setErrorMessage(LaunchMessages.getString("CMainTab.Program_is_not_a_recongnized_executable")); //$NON-NLS-1$ // See "https://bugs.eclipse.org/bugs/show_bug.cgi?id=328012".
return false;
}
} catch (CoreException e) {
GdbUIPlugin.log(e);
setErrorMessage(e.getLocalizedMessage());
return false;
}
} }
if (fCoreText != null) { if (fCoreText != null) {
@ -541,16 +529,13 @@ public class CMainTab extends CAbstractMainTab {
* Set the program name attributes on the working copy based on the ICElement * Set the program name attributes on the working copy based on the ICElement
*/ */
protected void initializeProgramName(ICElement cElement, ILaunchConfigurationWorkingCopy config) { protected void initializeProgramName(ICElement cElement, ILaunchConfigurationWorkingCopy config) {
boolean renamed = false; boolean renamed = false;
if (!(cElement instanceof IBinary)) if (!(cElement instanceof IBinary)) {
{
cElement = cElement.getCProject(); cElement = cElement.getCProject();
} }
if (cElement instanceof ICProject) { if (cElement instanceof ICProject) {
IProject project = cElement.getCProject().getProject(); IProject project = cElement.getCProject().getProject();
String name = project.getName(); String name = project.getName();
ICProjectDescription projDes = CCorePlugin.getDefault().getProjectDescription(project); ICProjectDescription projDes = CCorePlugin.getDefault().getProjectDescription(project);
@ -590,8 +575,7 @@ public class CMainTab extends CAbstractMainTab {
} }
} }
if (!renamed) if (!renamed) {
{
String name = getLaunchConfigurationDialog().generateName(cElement.getCProject().getElementName()); String name = getLaunchConfigurationDialog().generateName(cElement.getCProject().getElementName());
config.rename(name); config.rename(name);
} }
@ -620,5 +604,4 @@ public class CMainTab extends CAbstractMainTab {
public Image getImage() { public Image getImage() {
return LaunchImages.get(LaunchImages.IMG_VIEW_MAIN_TAB); return LaunchImages.get(LaunchImages.IMG_VIEW_MAIN_TAB);
} }
} }

View file

@ -98,7 +98,6 @@ CMainTab.Search...=Searc&h Project...
CMainTab.Choose_program_to_run=Choose a &program to run: CMainTab.Choose_program_to_run=Choose a &program to run:
CMainTab.Choose_program_to_run_from_NAME=Choose a program to run from {0}: CMainTab.Choose_program_to_run_from_NAME=Choose a program to run from {0}:
CMainTab.UseTerminal=Connect process input && output to a terminal. CMainTab.UseTerminal=Connect process input && output to a terminal.
CMainTab.Program_is_not_a_recongnized_executable=Program is not a recognized executable.
CMaintab.Application_Selection=Application Selection CMaintab.Application_Selection=Application Selection
CMaintab.Core_Selection=Core File Selection CMaintab.Core_Selection=Core File Selection
CMaintab.Trace_Selection=Trace File Selection CMaintab.Trace_Selection=Trace File Selection

View file

@ -477,11 +477,14 @@ public abstract class CAbstractMainTab extends CLaunchConfigurationTab {
} }
/** /**
* This method is deprecated since LaunchUtils#getBinary(IProject, IPath) is too slow to be
* called on the UI thread. See "https://bugs.eclipse.org/bugs/show_bug.cgi?id=328012".
* @param project * @param project
* @param exePath * @param exePath
* @return * @return
* @throws CoreException * @throws CoreException
*/ */
@Deprecated
protected boolean isBinary(IProject project, IPath exePath) throws CoreException { protected boolean isBinary(IProject project, IPath exePath) throws CoreException {
try { try {
Boolean binValue = fBinaryExeCache.get(exePath); Boolean binValue = fBinaryExeCache.get(exePath);