1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-14 20:45:22 +02:00

[216252] canceled --> cancelled in comments and locals

This commit is contained in:
Martin Oberhuber 2008-04-12 00:35:17 +00:00
parent 71fbaa7e47
commit 20598876f5
5 changed files with 109 additions and 105 deletions

View file

@ -114,7 +114,7 @@ public class TelnetConnectorService extends StandardConnectorService implements
return telnetSet; return telnetSet;
} }
public static void checkCanceled(IProgressMonitor monitor) { public static void checkCancelled(IProgressMonitor monitor) {
if (monitor.isCanceled()) if (monitor.isCanceled())
throw new OperationCanceledException(); throw new OperationCanceledException();
} }

View file

@ -15,7 +15,7 @@ package org.eclipse.rse.services.clientserver;
public class SystemOperationMonitor implements ISystemOperationMonitor public class SystemOperationMonitor implements ISystemOperationMonitor
{ {
private boolean canceled = false; private boolean cancelled = false;
private boolean done = false; private boolean done = false;
@ -31,13 +31,13 @@ public class SystemOperationMonitor implements ISystemOperationMonitor
public boolean isCancelled() public boolean isCancelled()
{ {
return canceled; return cancelled;
} }
public void setCancelled(boolean value) public void setCancelled(boolean value)
{ {
canceled = value; cancelled = value;
} }
} }

View file

@ -10,7 +10,7 @@
* component that contains this file: David McKnight, Kushal Munir, * component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
* *
* Contributors: * Contributors:
* {Name} (company) - description of contribution. * {Name} (company) - description of contribution.
* Xuan Chen (IBM) - [192741] [Archives] Move a folder from within an Archive doesn't work if > 1 level deep * Xuan Chen (IBM) - [192741] [Archives] Move a folder from within an Archive doesn't work if > 1 level deep
@ -818,7 +818,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
/** /**
* Same as {@link #getSizeFor(String)} but allows to specify whether to * Same as {@link #getSizeFor(String)} but allows to specify whether to
* close the zip file or not. * close the zip file or not.
* *
* @param fullVirtualName absolute virtual path to the node to inspect * @param fullVirtualName absolute virtual path to the node to inspect
* @param closeZipFile <code>true</code> if the zip file should be closed * @param closeZipFile <code>true</code> if the zip file should be closed
* @return the uncompressed size of the node requested. * @return the uncompressed size of the node requested.
@ -1119,7 +1119,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
/** /**
* Create an empty file, also creating parent folders if necessary. * Create an empty file, also creating parent folders if necessary.
* *
* @param file An abstract file handle to create physically. * @param file An abstract file handle to create physically.
* @return <code>true</code> if successful, <code>false</code> * @return <code>true</code> if successful, <code>false</code>
* otherwise. * otherwise.
@ -1199,8 +1199,8 @@ public class SystemZipHandler implements ISystemArchiveHandler
// if it is an empty zip file, no need to recreate it // if it is an empty zip file, no need to recreate it
if (!(vcList.length == 1) || !vcList[0].fullName.equals("")) //$NON-NLS-1$ if (!(vcList.length == 1) || !vcList[0].fullName.equals("")) //$NON-NLS-1$
{ {
boolean isCanceled = recreateZipDeleteEntries(vcList, dest, null, archiveOperationMonitor); boolean isCancelled = recreateZipDeleteEntries(vcList, dest, null, archiveOperationMonitor);
if (isCanceled) if (isCancelled)
{ {
dest.close(); dest.close();
if (!(outputTempFile == null)) outputTempFile.delete(); if (!(outputTempFile == null)) outputTempFile.delete();
@ -1319,8 +1319,8 @@ public class SystemZipHandler implements ISystemArchiveHandler
// if it is an empty zip file, no need to recreate it // if it is an empty zip file, no need to recreate it
if (!(vcList.length == 1) || !vcList[0].fullName.equals("")) //$NON-NLS-1$ if (!(vcList.length == 1) || !vcList[0].fullName.equals("")) //$NON-NLS-1$
{ {
boolean isCanceled = recreateZipDeleteEntries(vcList, dest, null, archiveOperationMonitor); boolean isCancelled = recreateZipDeleteEntries(vcList, dest, null, archiveOperationMonitor);
if (isCanceled) if (isCancelled)
{ {
dest.close(); dest.close();
if (!(outputTempFile == null)) if (!(outputTempFile == null))
@ -1386,7 +1386,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
/** /**
* Helper method. populates <code>found</code> with a collapsed list of * Helper method. populates <code>found</code> with a collapsed list of
* all nodes in the subtree of the file system rooted at <code>parent</code>. * all nodes in the subtree of the file system rooted at <code>parent</code>.
* *
* @since org.eclipse.rse.services 3.0 * @since org.eclipse.rse.services 3.0
*/ */
public static boolean listAllFiles(File parent, HashSet found, ISystemOperationMonitor archiveOperationMonitor) public static boolean listAllFiles(File parent, HashSet found, ISystemOperationMonitor archiveOperationMonitor)
@ -1751,8 +1751,8 @@ public class SystemZipHandler implements ISystemArchiveHandler
} }
// recreate the zip file without the omissions // recreate the zip file without the omissions
boolean isCanceled = recreateZipDeleteEntries(vcList, dest, omissions, archiveOperationMonitor); boolean isCancelled = recreateZipDeleteEntries(vcList, dest, omissions, archiveOperationMonitor);
if (isCanceled) if (isCancelled)
{ {
dest.close(); dest.close();
if (!(outputTempFile == null)) outputTempFile.delete(); if (!(outputTempFile == null)) outputTempFile.delete();
@ -1855,8 +1855,8 @@ public class SystemZipHandler implements ISystemArchiveHandler
HashSet omissions = new HashSet(); HashSet omissions = new HashSet();
omissions.add(fullVirtualName); omissions.add(fullVirtualName);
boolean isCanceled = recreateZipDeleteEntries(vcList, dest, omissions, archiveOperationMonitor); boolean isCancelled = recreateZipDeleteEntries(vcList, dest, omissions, archiveOperationMonitor);
if (isCanceled) if (isCancelled)
{ {
dest.close(); dest.close();
if (!(outputTempFile == null)) outputTempFile.delete(); if (!(outputTempFile == null)) outputTempFile.delete();
@ -1932,8 +1932,8 @@ public class SystemZipHandler implements ISystemArchiveHandler
VirtualChild[] vcList = getVirtualChildrenList(false, archiveOperationMonitor); VirtualChild[] vcList = getVirtualChildrenList(false, archiveOperationMonitor);
HashSet omissions = new HashSet(); HashSet omissions = new HashSet();
omissions.add(fullVirtualName); omissions.add(fullVirtualName);
boolean isCanceled = recreateZipDeleteEntries(vcList, dest, omissions, archiveOperationMonitor); boolean isCancelled = recreateZipDeleteEntries(vcList, dest, omissions, archiveOperationMonitor);
if (isCanceled) if (isCancelled)
{ {
dest.close(); dest.close();
if (!(outputTempFile == null)) outputTempFile.delete(); if (!(outputTempFile == null)) outputTempFile.delete();
@ -2054,11 +2054,11 @@ public class SystemZipHandler implements ISystemArchiveHandler
newOldNames.put(newFullVirtualName, fullVirtualName); newOldNames.put(newFullVirtualName, fullVirtualName);
} }
// find the entry to rename and rename it // find the entry to rename and rename it
boolean isCanceled = recreateZipRenameEntries(vcList, dest, oldNewNames, archiveOperationMonitor); boolean isCancelled = recreateZipRenameEntries(vcList, dest, oldNewNames, archiveOperationMonitor);
dest.close(); dest.close();
if (isCanceled) if (isCancelled)
{ {
if (!(outputTempFile == null)) outputTempFile.delete(); if (!(outputTempFile == null)) outputTempFile.delete();
if (closeZipFile) closeZipFile(); if (closeZipFile) closeZipFile();
@ -2228,8 +2228,8 @@ public class SystemZipHandler implements ISystemArchiveHandler
// if it is an empty zip file, no need to recreate it // if it is an empty zip file, no need to recreate it
if (!(vcList.length == 1) || !vcList[0].fullName.equals("")) //$NON-NLS-1$ if (!(vcList.length == 1) || !vcList[0].fullName.equals("")) //$NON-NLS-1$
{ {
boolean isCanceled = recreateZipDeleteEntries(vcList, dest, null, archiveOperationMonitor); boolean isCancelled = recreateZipDeleteEntries(vcList, dest, null, archiveOperationMonitor);
if (isCanceled) if (isCancelled)
{ {
dest.close(); dest.close();
if (!(outputTempFile == null)) outputTempFile.delete(); if (!(outputTempFile == null)) outputTempFile.delete();
@ -2752,8 +2752,8 @@ public class SystemZipHandler implements ISystemArchiveHandler
{ {
//String sourceName = name; //String sourceName = name;
HashSet children = new HashSet(); HashSet children = new HashSet();
boolean isCanceled = listAllFiles(file, children, archiveOperationMonitor); boolean isCancelled = listAllFiles(file, children, archiveOperationMonitor);
if (isCanceled) if (isCancelled)
{ {
return false; return false;
} }
@ -2840,8 +2840,8 @@ public class SystemZipHandler implements ISystemArchiveHandler
else else
{ {
HashSet children = new HashSet(); HashSet children = new HashSet();
boolean isCanceled = listAllFiles(file, children, archiveOperationMonitor); boolean isCancelled = listAllFiles(file, children, archiveOperationMonitor);
if (isCanceled) if (isCancelled)
{ {
return false; return false;
} }

View file

@ -7,10 +7,10 @@
* *
* Initial Contributors: * Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer * The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir, * component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
* *
* Contributors: * Contributors:
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
@ -54,8 +54,8 @@ import org.eclipse.ui.progress.IElementCollector;
/** /**
* A SystemFetchOperation is used to perform a query of a remote system on behalf of a subsystem. The operation * A SystemFetchOperation is used to perform a query of a remote system on behalf of a subsystem. The operation
* has some knowledge of the containing user interface, e.g. the workbench part which is responsible for * has some knowledge of the containing user interface, e.g. the workbench part which is responsible for
* issuing the query. It is created with a "collector" that will contain the results of the query. * issuing the query. It is created with a "collector" that will contain the results of the query.
* <p> * <p>
* This class may be subclassed but usually is used directly. * This class may be subclassed but usually is used directly.
@ -69,7 +69,7 @@ public class SystemFetchOperation extends JobChangeAdapter implements IRunnableW
protected ISystemViewElementAdapter _adapter; protected ISystemViewElementAdapter _adapter;
protected boolean _canRunAsJob; protected boolean _canRunAsJob;
protected InvocationTargetException _exc; protected InvocationTargetException _exc;
/** /**
* Creates an instance of this fetch operation. This instance cannot be run in a job, but must be invoked directly. * Creates an instance of this fetch operation. This instance cannot be run in a job, but must be invoked directly.
* @param part the workbench part associated with this fetch. * @param part the workbench part associated with this fetch.
@ -77,7 +77,7 @@ public class SystemFetchOperation extends JobChangeAdapter implements IRunnableW
* @param adapter the adapter that can be used to extract information from the remote objects that will be retrieved by this fetch. * @param adapter the adapter that can be used to extract information from the remote objects that will be retrieved by this fetch.
* @param collector the collector for the fetch results. * @param collector the collector for the fetch results.
*/ */
public SystemFetchOperation(IWorkbenchPart part, Object remoteObject, ISystemViewElementAdapter adapter, IElementCollector collector) public SystemFetchOperation(IWorkbenchPart part, Object remoteObject, ISystemViewElementAdapter adapter, IElementCollector collector)
{ {
_part = part; _part = part;
_remoteObject = remoteObject; _remoteObject = remoteObject;
@ -85,7 +85,7 @@ public class SystemFetchOperation extends JobChangeAdapter implements IRunnableW
_adapter = adapter; _adapter = adapter;
_canRunAsJob = false; _canRunAsJob = false;
} }
/** /**
* Creates an instance of this fetch operation. * Creates an instance of this fetch operation.
* @param part the workbench part associated with this fetch. * @param part the workbench part associated with this fetch.
@ -94,7 +94,7 @@ public class SystemFetchOperation extends JobChangeAdapter implements IRunnableW
* @param collector the collector for the fetch results. * @param collector the collector for the fetch results.
* @param canRunAsJob true if this fetch operation can be run in a job of its own, false otherwise * @param canRunAsJob true if this fetch operation can be run in a job of its own, false otherwise
*/ */
public SystemFetchOperation(IWorkbenchPart part, Object remoteObject, ISystemViewElementAdapter adapter, IElementCollector collector, boolean canRunAsJob) public SystemFetchOperation(IWorkbenchPart part, Object remoteObject, ISystemViewElementAdapter adapter, IElementCollector collector, boolean canRunAsJob)
{ {
_part = part; _part = part;
_remoteObject = remoteObject; _remoteObject = remoteObject;
@ -102,21 +102,21 @@ public class SystemFetchOperation extends JobChangeAdapter implements IRunnableW
_adapter = adapter; _adapter = adapter;
_canRunAsJob = canRunAsJob; _canRunAsJob = canRunAsJob;
} }
public void setException(InvocationTargetException exc) public void setException(InvocationTargetException exc)
{ {
_exc = exc; _exc = exc;
} }
/** /**
* Return the part that is associated with this operation. * Return the part that is associated with this operation.
* *
* @return Returns the part or <code>null</code> * @return Returns the part or <code>null</code>
*/ */
public IWorkbenchPart getPart() { public IWorkbenchPart getPart() {
return _part; return _part;
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor) * @see org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor)
*/ */
@ -139,18 +139,18 @@ public class SystemFetchOperation extends JobChangeAdapter implements IRunnableW
monitor.done(); monitor.done();
} }
} }
protected void startOperation() { protected void startOperation() {
//statusCount = 0; //statusCount = 0;
//resetErrors(); //resetErrors();
//confirmOverwrite = true; //confirmOverwrite = true;
} }
protected void endOperation() { protected void endOperation() {
//handleErrors((IStatus[]) errors.toArray(new IStatus[errors.size()])); //handleErrors((IStatus[]) errors.toArray(new IStatus[errors.size()]));
} }
/** /**
* An action that prompts the user for credentials to connect the subsystem that is issued the fetch. * An action that prompts the user for credentials to connect the subsystem that is issued the fetch.
* <p> * <p>
@ -159,33 +159,37 @@ public class SystemFetchOperation extends JobChangeAdapter implements IRunnableW
public class PromptForPassword implements Runnable public class PromptForPassword implements Runnable
{ {
public SubSystem _ss; public SubSystem _ss;
private boolean isCanceled = false; private boolean isCancelled = false;
public PromptForPassword(SubSystem ss) public PromptForPassword(SubSystem ss)
{ {
_ss = ss; _ss = ss;
} }
public void run() public void run()
{ {
try try
{ {
isCanceled = false; isCancelled = false;
_ss.promptForPassword(); _ss.promptForPassword();
} }
catch (InterruptedException e) { catch (InterruptedException e) {
isCanceled = true; isCancelled = true;
} }
catch (Exception e) catch (Exception e)
{ {
} }
} }
public boolean isCanceled() { /**
return isCanceled; * @since org.eclipse.rse.ui 3.0 renamed from isCanceled to isCancelled
* @return true if cancelled
*/
public boolean isCancelled() {
return isCancelled;
} }
} }
/** /**
* A sub-operation that broadcasts any connection status change. * A sub-operation that broadcasts any connection status change.
* <p> * <p>
@ -198,18 +202,18 @@ public class SystemFetchOperation extends JobChangeAdapter implements IRunnableW
{ {
_ss = ss; _ss = ss;
} }
public void run() public void run()
{ {
ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry(); ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
registry.connectedStatusChange(_ss, true, false); registry.connectedStatusChange(_ss, true, false);
} }
} }
/** /**
* Subclasses must override this method to perform the operation. * Subclasses must override this method to perform the operation.
* Clients should never call this method directly. * Clients should never call this method directly.
* *
* @param monitor * @param monitor
* @throws Exception * @throws Exception
* @throws InterruptedException * @throws InterruptedException
@ -229,14 +233,14 @@ public class SystemFetchOperation extends JobChangeAdapter implements IRunnableW
{ {
if (!ss.isConnected()) if (!ss.isConnected())
{ {
Display dis = Display.getDefault(); Display dis = Display.getDefault();
PromptForPassword prompter = new PromptForPassword(ss); PromptForPassword prompter = new PromptForPassword(ss);
dis.syncExec(prompter); dis.syncExec(prompter);
if (prompter.isCanceled()) { if (prompter.isCancelled()) {
SystemMessage canceledMessage = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXPAND_CANCELLED); SystemMessage cancelledMessage = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXPAND_CANCELLED);
SystemMessageObject canceledMessageObject = new SystemMessageObject(canceledMessage, ISystemMessageObject.MSGTYPE_CANCEL, _remoteObject); SystemMessageObject cancelledMessageObject = new SystemMessageObject(cancelledMessage, ISystemMessageObject.MSGTYPE_CANCEL, _remoteObject);
_collector.add(canceledMessageObject, monitor); _collector.add(cancelledMessageObject, monitor);
throw new InterruptedException(); throw new InterruptedException();
} }
try try
@ -255,9 +259,9 @@ public class SystemFetchOperation extends JobChangeAdapter implements IRunnableW
{ {
showOperationErrorMessage(null, e, ss); showOperationErrorMessage(null, e, ss);
} }
dis.asyncExec(new UpdateRegistry(ss)); dis.asyncExec(new UpdateRegistry(ss));
} }
} }
Object[] children = null; Object[] children = null;
@ -272,7 +276,7 @@ public class SystemFetchOperation extends JobChangeAdapter implements IRunnableW
_collector.add(children, monitor); _collector.add(children, monitor);
monitor.done(); monitor.done();
} }
/** /**
* Show an error message as a result of running this operation. * Show an error message as a result of running this operation.
* Uses the user interface knowledge of this operation to show the message. * Uses the user interface knowledge of this operation to show the message.
@ -295,7 +299,7 @@ public class SystemFetchOperation extends JobChangeAdapter implements IRunnableW
{ {
displayAsyncMsg(ss, (SystemMessageException)exc); displayAsyncMsg(ss, (SystemMessageException)exc);
//sysMsg = ((SystemMessageException)exc).getSystemMessage(); //sysMsg = ((SystemMessageException)exc).getSystemMessage();
} }
else else
{ {
String excMsg = exc.getMessage(); String excMsg = exc.getMessage();
@ -303,12 +307,12 @@ public class SystemFetchOperation extends JobChangeAdapter implements IRunnableW
excMsg = "Exception " + exc.getClass().getName(); //$NON-NLS-1$ excMsg = "Exception " + exc.getClass().getName(); //$NON-NLS-1$
sysMsg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_OPERATION_FAILED); sysMsg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_OPERATION_FAILED);
sysMsg.makeSubstitution(excMsg); sysMsg.makeSubstitution(excMsg);
SystemMessageDialog.displayErrorMessage(shell, sysMsg, exc); SystemMessageDialog.displayErrorMessage(shell, sysMsg, exc);
} }
} }
/** /**
* Display message on message thread * Display message on message thread
*/ */
@ -324,7 +328,7 @@ public class SystemFetchOperation extends JobChangeAdapter implements IRunnableW
{ {
return GenericMessages.RSEQuery_task; return GenericMessages.RSEQuery_task;
} }
/** /**
* Run the operation in a context that is determined by the {@link #canRunAsJob()} * Run the operation in a context that is determined by the {@link #canRunAsJob()}
* hint. If this operation can run as a job then it will be run in a background thread. * hint. If this operation can run as a job then it will be run in a background thread.
@ -341,7 +345,7 @@ public class SystemFetchOperation extends JobChangeAdapter implements IRunnableW
* the operation is run in the operation's context. Subclasses may * the operation is run in the operation's context. Subclasses may
* override in order to perform prechecks to determine if the operation * override in order to perform prechecks to determine if the operation
* should run. This may include prompting the user for information, etc. * should run. This may include prompting the user for information, etc.
* *
* @return whether the operation should be run. * @return whether the operation should be run.
*/ */
protected boolean shouldRun() { protected boolean shouldRun() {
@ -351,7 +355,7 @@ public class SystemFetchOperation extends JobChangeAdapter implements IRunnableW
/** /**
* Returns the scheduling rule that is to be obtained before this * Returns the scheduling rule that is to be obtained before this
* operation is executed by it's context or <code>null</code> if * operation is executed by it's context or <code>null</code> if
* no scheduling rule is to be obtained. If the operation is run * no scheduling rule is to be obtained. If the operation is run
* as a job, the schdulin rule is used as the schduling rule of the * as a job, the schdulin rule is used as the schduling rule of the
* job. Otherwise, it is obtained before execution of the operation * job. Otherwise, it is obtained before execution of the operation
* occurs. * occurs.
@ -360,90 +364,90 @@ public class SystemFetchOperation extends JobChangeAdapter implements IRunnableW
* rule is obtained. Sublcasses can override to in order ot obtain a * rule is obtained. Sublcasses can override to in order ot obtain a
* scheduling rule or can obtain schduling rules withing their operation * scheduling rule or can obtain schduling rules withing their operation
* if finer grained schduling is desired. * if finer grained schduling is desired.
* *
* @return the schduling rule to be obtained by this operation * @return the schduling rule to be obtained by this operation
* or <code>null</code>. * or <code>null</code>.
*/ */
protected ISchedulingRule getSchedulingRule() { protected ISchedulingRule getSchedulingRule() {
return null; return null;
} }
/** /**
* Return whether the auto-build should be postponed until after * Return whether the auto-build should be postponed until after
* the operation is complete. The default is to postpone the auto-build. * the operation is complete. The default is to postpone the auto-build.
* subclas can override. * subclas can override.
* *
* @return whether to postpone the auto-build while the operation is executing. * @return whether to postpone the auto-build while the operation is executing.
*/ */
protected boolean isPostponeAutobuild() { protected boolean isPostponeAutobuild() {
return true; return true;
} }
/** /**
* If this operation can safely be run in the background, then subclasses can * If this operation can safely be run in the background, then subclasses can
* override this method and return <code>true</code>. This will make their * override this method and return <code>true</code>. This will make their
* action run in a {@link org.eclipse.core.runtime.jobs.Job}. * action run in a {@link org.eclipse.core.runtime.jobs.Job}.
* Subsclass that override this method should * Subsclass that override this method should
* also override the <code>getJobName()</code> method. * also override the <code>getJobName()</code> method.
* *
* @return <code>true</code> if this action can be run in the background and * @return <code>true</code> if this action can be run in the background and
* <code>false</code> otherwise. * <code>false</code> otherwise.
*/ */
protected boolean canRunAsJob() { protected boolean canRunAsJob() {
return _canRunAsJob; return _canRunAsJob;
} }
/** /**
* Return the job name to be used if the action can run as a job. (i.e. * Return the job name to be used if the action can run as a job. (i.e.
* if <code>canRunAsJob()</code> returns <code>true</code>). * if <code>canRunAsJob()</code> returns <code>true</code>).
* *
* @return the string to be used as the job name * @return the string to be used as the job name
*/ */
protected String getJobName() { protected String getJobName() {
return ""; //$NON-NLS-1$ return ""; //$NON-NLS-1$
} }
/** /**
* This method is called to allow subclasses to configure an action that could be run to show * This method is called to allow subclasses to configure an action that could be run to show
* the results of the action to the user. Default is to return null. * the results of the action to the user. Default is to return null.
* *
* @return an action that could be run to see the results of this operation * @return an action that could be run to see the results of this operation
*/ */
protected IAction getGotoAction() { protected IAction getGotoAction() {
return null; return null;
} }
/** /**
* This method is called to allow subclasses to configure an icon to show when running this * This method is called to allow subclasses to configure an icon to show when running this
* operation. * operation.
* *
* @return an URL to an icon * @return an URL to an icon
*/ */
protected URL getOperationIcon() { protected URL getOperationIcon() {
return null; return null;
} }
/** /**
* This method is called to allow subclasses to have the operation remain in the progress * This method is called to allow subclasses to have the operation remain in the progress
* indicator even after the job is done. * indicator even after the job is done.
* *
* @return <code>true</code> to keep the operation and <code>false</code> otherwise. * @return <code>true</code> to keep the operation and <code>false</code> otherwise.
*/ */
protected boolean getKeepOperation() { protected boolean getKeepOperation() {
return false; return false;
} }
/** /**
* Return a shell that can be used by the operation to display dialogs, etc. * Return a shell that can be used by the operation to display dialogs, etc.
* *
* @return a shell * @return a shell
*/ */
protected Shell getShell() protected Shell getShell()
{ {
return SystemBasePlugin.getActiveWorkbenchShell(); return SystemBasePlugin.getActiveWorkbenchShell();
} }
private ISystemRunnableContext getRunnableContext() { private ISystemRunnableContext getRunnableContext() {
if (context == null && canRunAsJob()) { if (context == null && canRunAsJob()) {
SystemJobRunnableContext context = new SystemJobRunnableContext(getJobName(), getOperationIcon(), getGotoAction(), getKeepOperation(), this, getSite()); SystemJobRunnableContext context = new SystemJobRunnableContext(getJobName(), getOperationIcon(), getGotoAction(), getKeepOperation(), this, getSite());
@ -460,10 +464,10 @@ public class SystemFetchOperation extends JobChangeAdapter implements IRunnableW
return context; return context;
} }
} }
private IWorkbenchSite getSite() { private IWorkbenchSite getSite() {
IWorkbenchSite site = null; IWorkbenchSite site = null;
if(_part != null) { if(_part != null) {

View file

@ -63,13 +63,13 @@ public class StandardCredentialsProvider extends AbstractCredentialsProvider {
* A runnable that will actually perform the prompting. * A runnable that will actually perform the prompting.
*/ */
private class PromptForCredentials implements Runnable { private class PromptForCredentials implements Runnable {
private boolean canceled = false; private boolean cancelled = false;
/** /**
* @return true if prompting was cancelled. * @return true if prompting was cancelled.
*/ */
public boolean isCanceled() { public boolean isCancelled() {
return canceled; return cancelled;
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -95,15 +95,15 @@ public class StandardCredentialsProvider extends AbstractCredentialsProvider {
} catch (Exception e) { } catch (Exception e) {
logException(e); logException(e);
} }
canceled = dialog.wasCancelled(); cancelled = dialog.wasCancelled();
if (!canceled) { if (!cancelled) {
userId = dialog.getUserId(); userId = dialog.getUserId();
password = dialog.getPassword(); password = dialog.getPassword();
saveUserId = dialog.getIsUserIdChangePermanent(); saveUserId = dialog.getIsUserIdChangePermanent();
savePassword = dialog.getIsSavePassword(); savePassword = dialog.getIsSavePassword();
} }
} else { } else {
canceled = true; cancelled = true;
} }
} }
} }
@ -114,14 +114,14 @@ public class StandardCredentialsProvider extends AbstractCredentialsProvider {
*/ */
private class PromptForNewPassword implements Runnable { private class PromptForNewPassword implements Runnable {
private SystemMessage message; private SystemMessage message;
private boolean canceled = false; private boolean cancelled = false;
public PromptForNewPassword(SystemMessage message) { public PromptForNewPassword(SystemMessage message) {
this.message = message; this.message = message;
} }
public boolean isCancelled() { public boolean isCancelled() {
return canceled; return cancelled;
} }
public void run() { public void run() {
@ -130,13 +130,13 @@ public class StandardCredentialsProvider extends AbstractCredentialsProvider {
SystemChangePasswordDialog dlg = new SystemChangePasswordDialog(shell, getConnectorService().getHostName(), getUserId(), message); SystemChangePasswordDialog dlg = new SystemChangePasswordDialog(shell, getConnectorService().getHostName(), getUserId(), message);
dlg.setSavePassword(savePassword); dlg.setSavePassword(savePassword);
dlg.open(); dlg.open();
canceled = dlg.wasCancelled(); cancelled = dlg.wasCancelled();
if (!canceled) { if (!cancelled) {
password = dlg.getNewPassword(); password = dlg.getNewPassword();
savePassword = dlg.getIsSavePassword(); savePassword = dlg.getIsSavePassword();
} }
} else { } else {
canceled = true; cancelled = true;
} }
} }
} }
@ -398,7 +398,7 @@ public class StandardCredentialsProvider extends AbstractCredentialsProvider {
private void promptForCredentials() throws OperationCanceledException { private void promptForCredentials() throws OperationCanceledException {
PromptForCredentials runnable = new PromptForCredentials(); PromptForCredentials runnable = new PromptForCredentials();
Display.getDefault().syncExec(runnable); Display.getDefault().syncExec(runnable);
if (runnable.isCanceled()) { if (runnable.isCancelled()) {
throw new OperationCanceledException(); throw new OperationCanceledException();
} }
} }