mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-14 12:35:22 +02:00
[270777][cleanup] Improve try..catch construct
This commit is contained in:
parent
654cf929b5
commit
a941b54180
1 changed files with 43 additions and 44 deletions
|
@ -287,20 +287,19 @@ public class SystemFetchOperation extends JobChangeAdapter implements IRunnableW
|
||||||
_connectorServicePool.waitUntilNotContained(connectorService);
|
_connectorServicePool.waitUntilNotContained(connectorService);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
final Display dis = Display.getDefault();
|
||||||
_connectorServicePool.add(connectorService);
|
_connectorServicePool.add(connectorService);
|
||||||
|
try
|
||||||
Display dis = Display.getDefault();
|
{
|
||||||
PromptForPassword prompter = new PromptForPassword(ss);
|
PromptForPassword prompter = new PromptForPassword(ss);
|
||||||
dis.syncExec(prompter);
|
dis.syncExec(prompter);
|
||||||
if (prompter.isCancelled()) {
|
if (prompter.isCancelled()) {
|
||||||
SystemMessage cancelledMessage = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXPAND_CANCELLED);
|
SystemMessage cancelledMessage = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXPAND_CANCELLED);
|
||||||
SystemMessageObject cancelledMessageObject = new SystemMessageObject(cancelledMessage, ISystemMessageObject.MSGTYPE_CANCEL, _remoteObject);
|
SystemMessageObject cancelledMessageObject = new SystemMessageObject(cancelledMessage, ISystemMessageObject.MSGTYPE_CANCEL,
|
||||||
|
_remoteObject);
|
||||||
_collector.add(cancelledMessageObject, monitor);
|
_collector.add(cancelledMessageObject, monitor);
|
||||||
_connectorServicePool.remove(connectorService);
|
|
||||||
throw new InterruptedException();
|
throw new InterruptedException();
|
||||||
}
|
}
|
||||||
try
|
|
||||||
{
|
|
||||||
connectorService.connect(monitor);
|
connectorService.connect(monitor);
|
||||||
if (_exc != null)
|
if (_exc != null)
|
||||||
{
|
{
|
||||||
|
@ -310,13 +309,11 @@ public class SystemFetchOperation extends JobChangeAdapter implements IRunnableW
|
||||||
catch (InvocationTargetException exc)
|
catch (InvocationTargetException exc)
|
||||||
{
|
{
|
||||||
showOperationErrorMessage(null, exc, ss);
|
showOperationErrorMessage(null, exc, ss);
|
||||||
_connectorServicePool.remove(connectorService);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
showOperationErrorMessage(null, e, ss);
|
showOperationErrorMessage(null, e, ss);
|
||||||
_connectorServicePool.remove(connectorService);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
|
@ -470,7 +467,9 @@ public class SystemFetchOperation extends JobChangeAdapter implements IRunnableW
|
||||||
{
|
{
|
||||||
String excMsg = exc.getMessage();
|
String excMsg = exc.getMessage();
|
||||||
if ((excMsg == null) || (excMsg.length()==0))
|
if ((excMsg == null) || (excMsg.length()==0))
|
||||||
excMsg = "Exception " + exc.getClass().getName(); //$NON-NLS-1$
|
exc.getClass().getName();
|
||||||
|
else
|
||||||
|
excMsg = exc.getClass().getName() + ": " + excMsg; //$NON-NLS-1$
|
||||||
sysMsg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_OPERATION_FAILED);
|
sysMsg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_OPERATION_FAILED);
|
||||||
sysMsg.makeSubstitution(excMsg);
|
sysMsg.makeSubstitution(excMsg);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue