diff --git a/src/vs/editor/contrib/clipboard/browser/clipboard.ts b/src/vs/editor/contrib/clipboard/browser/clipboard.ts index 0ca0969c3d8..d67a3aebbc1 100644 --- a/src/vs/editor/contrib/clipboard/browser/clipboard.ts +++ b/src/vs/editor/contrib/clipboard/browser/clipboard.ts @@ -46,22 +46,7 @@ abstract class ExecCommandAction extends EditorAction { } } -abstract class ClipboardWritingAction extends ExecCommandAction { - - public enabled(accessor:ServicesAccessor, editor:editorCommon.ICommonCodeEditor): boolean { - if (!super.enabled(accessor, editor)) { - return false; - } - - if (browser.enableEmptySelectionClipboard) { - return true; - } else { - return !editor.getSelection().isEmpty(); - } - } -} - -class ExecCommandCutAction extends ClipboardWritingAction { +class ExecCommandCutAction extends ExecCommandAction { constructor() { super( @@ -87,9 +72,17 @@ class ExecCommandCutAction extends ClipboardWritingAction { order: 1 }; } + + public run(accessor:ServicesAccessor, editor:editorCommon.ICommonCodeEditor): void { + if (!browser.enableEmptySelectionClipboard && editor.getSelection().isEmpty()) { + return; + } + + super.run(accessor, editor); + } } -class ExecCommandCopyAction extends ClipboardWritingAction { +class ExecCommandCopyAction extends ExecCommandAction { constructor() { super( @@ -115,6 +108,14 @@ class ExecCommandCopyAction extends ClipboardWritingAction { order: 2 }; } + + public run(accessor:ServicesAccessor, editor:editorCommon.ICommonCodeEditor): void { + if (!browser.enableEmptySelectionClipboard && editor.getSelection().isEmpty()) { + return; + } + + super.run(accessor, editor); + } } class ExecCommandPasteAction extends ExecCommandAction { diff --git a/src/vs/editor/contrib/links/browser/links.ts b/src/vs/editor/contrib/links/browser/links.ts index dd207613ccf..5917323f08f 100644 --- a/src/vs/editor/contrib/links/browser/links.ts +++ b/src/vs/editor/contrib/links/browser/links.ts @@ -328,15 +328,6 @@ class OpenLinkAction extends EditorAction { this._precondition = null; } - public enabled(accessor:ServicesAccessor, editor:editorCommon.ICommonCodeEditor): boolean { - let linkDetector = LinkDetector.get(editor); - if (linkDetector.isComputing()) { - // optimistic enablement while state is being computed - return true; - } - return !!linkDetector.getLinkOccurence(editor.getPosition()); - } - public run(accessor:ServicesAccessor, editor:editorCommon.ICommonCodeEditor): void { let linkDetector = LinkDetector.get(editor); let link = linkDetector.getLinkOccurence(editor.getPosition());