Lines 7-12
Link Here
|
7 |
* |
7 |
* |
8 |
* Contributors: |
8 |
* Contributors: |
9 |
* IBM Corporation - initial API and implementation |
9 |
* IBM Corporation - initial API and implementation |
|
|
10 |
* Brett Randall <javabrett@gmail.com> - Bug 374017 https://bugs.eclipse.org/374017 |
10 |
*******************************************************************************/ |
11 |
*******************************************************************************/ |
11 |
package org.eclipse.ui.actions; |
12 |
package org.eclipse.ui.actions; |
12 |
|
13 |
|
Lines 392-398
public abstract class WorkspaceAction extends SelectionListenerAction {
Link Here
|
392 |
} |
393 |
} |
393 |
for (Iterator i = getSelectedResources().iterator(); i.hasNext();) { |
394 |
for (Iterator i = getSelectedResources().iterator(); i.hasNext();) { |
394 |
IResource r = (IResource) i.next(); |
395 |
IResource r = (IResource) i.next(); |
395 |
if (!r.isAccessible()) { |
396 |
if (!updateSelected(r)) { |
396 |
return false; |
397 |
return false; |
397 |
} |
398 |
} |
398 |
} |
399 |
} |
Lines 400-405
public abstract class WorkspaceAction extends SelectionListenerAction {
Link Here
|
400 |
} |
401 |
} |
401 |
|
402 |
|
402 |
/** |
403 |
/** |
|
|
404 |
* Called by {@link #updateSelection(IStructuredSelection)} to test each |
405 |
* selected resource. If any resource returns false, the selection update |
406 |
* will result in a disabled action. |
407 |
* |
408 |
* This implementation returns true if a resource is accessible, otherwise |
409 |
* it returns false. Subclasses may override this behaviour with a more |
410 |
* specific resource test. |
411 |
* |
412 |
* @param resource |
413 |
* @return true if the current resource is selectable for this action |
414 |
* @since 3.8 |
415 |
*/ |
416 |
protected boolean updateSelected(IResource resource) { |
417 |
return resource.isAccessible(); |
418 |
} |
419 |
|
420 |
/** |
403 |
* Returns the elements that the action is to be performed on. By default |
421 |
* Returns the elements that the action is to be performed on. By default |
404 |
* return the selected resources. |
422 |
* return the selected resources. |
405 |
* <p> |
423 |
* <p> |