Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
37ae1348
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
37ae1348
编写于
12月 20, 2016
作者:
C
Christof Marti
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
'Open Folder' hints in viewlets when no folder open
上级
817beafe
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
180 addition
and
84 deletion
+180
-84
src/vs/workbench/browser/actions/fileActions.ts
src/vs/workbench/browser/actions/fileActions.ts
+47
-0
src/vs/workbench/parts/debug/browser/debugViewlet.ts
src/vs/workbench/parts/debug/browser/debugViewlet.ts
+28
-3
src/vs/workbench/parts/files/browser/explorerViewlet.ts
src/vs/workbench/parts/files/browser/explorerViewlet.ts
+1
-1
src/vs/workbench/parts/files/browser/views/emptyView.ts
src/vs/workbench/parts/files/browser/views/emptyView.ts
+13
-16
src/vs/workbench/parts/files/electron-browser/electronFileActions.ts
...bench/parts/files/electron-browser/electronFileActions.ts
+0
-36
src/vs/workbench/parts/files/electron-browser/files.electron.contribution.ts
...rts/files/electron-browser/files.electron.contribution.ts
+2
-1
src/vs/workbench/parts/git/browser/gitViewlet.ts
src/vs/workbench/parts/git/browser/gitViewlet.ts
+1
-1
src/vs/workbench/parts/git/browser/views/empty/emptyView.ts
src/vs/workbench/parts/git/browser/views/empty/emptyView.ts
+1
-1
src/vs/workbench/parts/git/browser/views/noworkspace/noworkspaceView.css
...h/parts/git/browser/views/noworkspace/noworkspaceView.css
+0
-11
src/vs/workbench/parts/git/browser/views/noworkspace/noworkspaceView.ts
...ch/parts/git/browser/views/noworkspace/noworkspaceView.ts
+33
-5
src/vs/workbench/parts/search/browser/media/searchviewlet.css
...vs/workbench/parts/search/browser/media/searchviewlet.css
+4
-0
src/vs/workbench/parts/search/browser/searchViewlet.ts
src/vs/workbench/parts/search/browser/searchViewlet.ts
+48
-8
src/vs/workbench/parts/watermark/electron-browser/watermark.ts
...s/workbench/parts/watermark/electron-browser/watermark.ts
+2
-1
未找到文件。
src/vs/workbench/browser/actions/fileActions.ts
0 → 100644
浏览文件 @
37ae1348
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
Action
}
from
'
vs/base/common/actions
'
;
import
nls
=
require
(
'
vs/nls
'
);
import
{
IWindowService
}
from
'
vs/platform/windows/common/windows
'
;
export
class
OpenFolderAction
extends
Action
{
static
ID
=
'
workbench.action.files.openFolder
'
;
static
LABEL
=
nls
.
localize
(
'
openFolder
'
,
"
Open Folder...
"
);
constructor
(
id
:
string
,
label
:
string
,
@
IWindowService
private
windowService
:
IWindowService
)
{
super
(
id
,
label
);
}
run
():
TPromise
<
any
>
{
return
this
.
windowService
.
openFolderPicker
();
}
}
export
class
OpenFileFolderAction
extends
Action
{
static
ID
=
'
workbench.action.files.openFileFolder
'
;
static
LABEL
=
nls
.
localize
(
'
openFileFolder
'
,
"
Open...
"
);
constructor
(
id
:
string
,
label
:
string
,
@
IWindowService
private
windowService
:
IWindowService
)
{
super
(
id
,
label
);
}
run
():
TPromise
<
any
>
{
return
this
.
windowService
.
openFileFolderPicker
();
}
}
src/vs/workbench/parts/debug/browser/debugViewlet.ts
浏览文件 @
37ae1348
...
...
@@ -5,6 +5,7 @@
import
'
vs/css!./media/debugViewlet
'
;
import
*
as
nls
from
'
vs/nls
'
;
import
*
as
errors
from
'
vs/base/common/errors
'
;
import
{
$
,
Builder
,
Dimension
}
from
'
vs/base/browser/builder
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
*
as
lifecycle
from
'
vs/base/common/lifecycle
'
;
...
...
@@ -22,6 +23,9 @@ import { IProgressService, IProgressRunner } from 'vs/platform/progress/common/p
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IStorageService
}
from
'
vs/platform/storage/common/storage
'
;
import
env
=
require
(
'
vs/base/common/platform
'
);
import
{
Button
}
from
'
vs/base/browser/ui/button/button
'
;
import
{
OpenFolderAction
,
OpenFileFolderAction
}
from
'
vs/workbench/browser/actions/fileActions
'
;
export
class
DebugViewlet
extends
Viewlet
{
...
...
@@ -33,6 +37,7 @@ export class DebugViewlet extends Viewlet {
private
$el
:
Builder
;
private
splitView
:
SplitView
;
private
views
:
IViewletView
[];
private
openFolderButton
:
Button
;
private
lastFocusedView
:
IViewletView
;
...
...
@@ -78,12 +83,27 @@ export class DebugViewlet extends Viewlet {
this
.
lastFocusedView
=
view
;
}));
}
else
{
this
.
$el
.
append
(
$
([
const
noworkspace
=
$
([
'
<div class="noworkspace-view">
'
,
'
<p>
'
,
nls
.
localize
(
'
noWorkspace
'
,
"
There is no currently opened
folder.
"
),
'
</p>
'
,
'
<p>
'
,
nls
.
localize
(
'
noWorkspace
Help
'
,
"
You have not yet opened a
folder.
"
),
'
</p>
'
,
'
<p>
'
,
nls
.
localize
(
'
pleaseRestartToDebug
'
,
"
Open a folder in order to start debugging.
"
),
'
</p>
'
,
'
</div>
'
].
join
(
''
)));
].
join
(
''
));
this
.
openFolderButton
=
new
Button
(
noworkspace
);
this
.
openFolderButton
.
label
=
nls
.
localize
(
'
openFolder
'
,
"
Open Folder
"
);
this
.
openFolderButton
.
addListener2
(
'
click
'
,
()
=>
{
const
actionClass
=
env
.
isMacintosh
?
OpenFileFolderAction
:
OpenFolderAction
;
const
action
=
this
.
instantiationService
.
createInstance
<
string
,
string
,
IAction
>
(
actionClass
,
actionClass
.
ID
,
actionClass
.
LABEL
);
this
.
actionRunner
.
run
(
action
).
done
(()
=>
{
action
.
dispose
();
},
err
=>
{
action
.
dispose
();
errors
.
onUnexpectedError
(
err
);
});
});
this
.
$el
.
append
(
noworkspace
);
}
return
TPromise
.
as
(
null
);
...
...
@@ -111,6 +131,11 @@ export class DebugViewlet extends Viewlet {
if
(
this
.
views
.
length
>
0
)
{
this
.
views
[
0
].
focusBody
();
return
;
}
if
(
this
.
openFolderButton
)
{
this
.
openFolderButton
.
getElement
().
focus
();
}
}
...
...
src/vs/workbench/parts/files/browser/explorerViewlet.ts
浏览文件 @
37ae1348
...
...
@@ -189,7 +189,7 @@ export class ExplorerViewlet extends Viewlet {
// No workspace
else
{
this
.
emptyView
=
explorerOrEmptyView
=
this
.
instantiationService
.
createInstance
(
EmptyView
);
this
.
emptyView
=
explorerOrEmptyView
=
this
.
instantiationService
.
createInstance
(
EmptyView
,
this
.
getActionRunner
()
);
}
if
(
this
.
openEditorsVisible
)
{
...
...
src/vs/workbench/parts/files/browser/views/emptyView.ts
浏览文件 @
37ae1348
...
...
@@ -5,23 +5,23 @@
'
use strict
'
;
import
nls
=
require
(
'
vs/nls
'
);
import
*
as
errors
from
'
vs/base/common/errors
'
;
import
env
=
require
(
'
vs/base/common/platform
'
);
import
DOM
=
require
(
'
vs/base/browser/dom
'
);
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IAction
,
Action
}
from
'
vs/base/common/actions
'
;
import
{
IAction
Runner
,
I
Action
}
from
'
vs/base/common/actions
'
;
import
{
Button
}
from
'
vs/base/browser/ui/button/button
'
;
import
{
$
}
from
'
vs/base/browser/builder
'
;
import
{
IActionItem
}
from
'
vs/base/browser/ui/actionbar/actionbar
'
;
import
{
CollapsibleView
}
from
'
vs/base/browser/ui/splitview/splitview
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
Registry
}
from
'
vs/platform/platform
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IWorkbenchActionRegistry
,
Extensions
}
from
'
vs/workbench/common/actionRegistry
'
;
import
{
OpenFolderAction
,
OpenFileFolderAction
}
from
'
vs/workbench/browser/actions/fileActions
'
;
export
class
EmptyView
extends
CollapsibleView
{
private
openFolderButton
:
Button
;
constructor
(
@
ITelemetryService
private
telemetryService
:
ITelemetryService
,
constructor
(
private
actionRunner
:
IActionRunner
,
@
IInstantiationService
private
instantiationService
:
IInstantiationService
)
{
super
({
...
...
@@ -46,7 +46,14 @@ export class EmptyView extends CollapsibleView {
this
.
openFolderButton
=
new
Button
(
section
);
this
.
openFolderButton
.
label
=
nls
.
localize
(
'
openFolder
'
,
"
Open Folder
"
);
this
.
openFolderButton
.
addListener2
(
'
click
'
,
()
=>
{
this
.
runWorkbenchAction
(
env
.
isMacintosh
?
'
workbench.action.files.openFileFolder
'
:
'
workbench.action.files.openFolder
'
);
const
actionClass
=
env
.
isMacintosh
?
OpenFileFolderAction
:
OpenFolderAction
;
const
action
=
this
.
instantiationService
.
createInstance
<
string
,
string
,
IAction
>
(
actionClass
,
actionClass
.
ID
,
actionClass
.
LABEL
);
this
.
actionRunner
.
run
(
action
).
done
(()
=>
{
action
.
dispose
();
},
err
=>
{
action
.
dispose
();
errors
.
onUnexpectedError
(
err
);
});
});
}
...
...
@@ -54,16 +61,6 @@ export class EmptyView extends CollapsibleView {
// no-op
}
private
runWorkbenchAction
(
actionId
:
string
):
void
{
this
.
telemetryService
.
publicLog
(
'
workbenchActionExecuted
'
,
{
id
:
actionId
,
from
:
'
explorer
'
});
let
actionRegistry
=
<
IWorkbenchActionRegistry
>
Registry
.
as
(
Extensions
.
WorkbenchActions
);
let
actionDescriptor
=
actionRegistry
.
getWorkbenchAction
(
actionId
);
let
action
=
<
Action
>
this
.
instantiationService
.
createInstance
(
actionDescriptor
.
syncDescriptor
);
return
action
.
run
().
done
(()
=>
action
.
dispose
());
}
public
create
():
TPromise
<
void
>
{
return
TPromise
.
as
(
null
);
}
...
...
src/vs/workbench/parts/files/electron-browser/electronFileActions.ts
浏览文件 @
37ae1348
...
...
@@ -141,42 +141,6 @@ export class OpenFileAction extends Action {
}
}
export
class
OpenFolderAction
extends
Action
{
static
ID
=
'
workbench.action.files.openFolder
'
;
static
LABEL
=
nls
.
localize
(
'
openFolder
'
,
"
Open Folder...
"
);
constructor
(
id
:
string
,
label
:
string
,
@
IWindowService
private
windowService
:
IWindowService
)
{
super
(
id
,
label
);
}
run
():
TPromise
<
any
>
{
return
this
.
windowService
.
openFolderPicker
();
}
}
export
class
OpenFileFolderAction
extends
Action
{
static
ID
=
'
workbench.action.files.openFileFolder
'
;
static
LABEL
=
nls
.
localize
(
'
openFileFolder
'
,
"
Open...
"
);
constructor
(
id
:
string
,
label
:
string
,
@
IWindowService
private
windowService
:
IWindowService
)
{
super
(
id
,
label
);
}
run
():
TPromise
<
any
>
{
return
this
.
windowService
.
openFileFolderPicker
();
}
}
export
class
ShowOpenedFileInNewWindow
extends
Action
{
public
static
ID
=
'
workbench.action.files.showOpenedFileInNewWindow
'
;
...
...
src/vs/workbench/parts/files/electron-browser/files.electron.contribution.ts
浏览文件 @
37ae1348
...
...
@@ -16,7 +16,8 @@ import { asFileResource } from 'vs/workbench/parts/files/common/files';
import
{
IWorkbenchContributionsRegistry
,
Extensions
as
WorkbenchExtensions
}
from
'
vs/workbench/common/contributions
'
;
import
{
GlobalNewUntitledFileAction
,
SaveFileAsAction
}
from
'
vs/workbench/parts/files/browser/fileActions
'
;
import
{
DirtyFilesTracker
}
from
'
vs/workbench/parts/files/electron-browser/dirtyFilesTracker
'
;
import
{
OpenFolderAction
,
OpenFileAction
,
OpenFileFolderAction
,
ShowOpenedFileInNewWindow
,
GlobalRevealInOSAction
,
GlobalCopyPathAction
,
CopyPathAction
,
RevealInOSAction
}
from
'
vs/workbench/parts/files/electron-browser/electronFileActions
'
;
import
{
OpenFileAction
,
ShowOpenedFileInNewWindow
,
GlobalRevealInOSAction
,
GlobalCopyPathAction
,
CopyPathAction
,
RevealInOSAction
}
from
'
vs/workbench/parts/files/electron-browser/electronFileActions
'
;
import
{
OpenFolderAction
,
OpenFileFolderAction
}
from
'
vs/workbench/browser/actions/fileActions
'
;
import
{
IInstantiationService
,
ServicesAccessor
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
KeyMod
,
KeyChord
,
KeyCode
}
from
'
vs/base/common/keyCodes
'
;
import
{
CommandsRegistry
}
from
'
vs/platform/commands/common/commands
'
;
...
...
src/vs/workbench/parts/git/browser/gitViewlet.ts
浏览文件 @
37ae1348
...
...
@@ -60,7 +60,7 @@ export class GitViewlet
this
.
instantiationService
.
createInstance
(
empty
.
EmptyView
,
this
,
this
.
getActionRunner
()),
this
.
instantiationService
.
createInstance
(
gitless
.
GitlessView
),
new
notroot
.
NotRootView
(),
new
noworkspace
.
NoWorkspaceView
(
),
this
.
instantiationService
.
createInstance
(
noworkspace
.
NoWorkspaceView
,
this
.
getActionRunner
()
),
new
DisabledView
(),
this
.
instantiationService
.
createInstance
(
HugeView
)
];
...
...
src/vs/workbench/parts/git/browser/views/empty/emptyView.ts
浏览文件 @
37ae1348
...
...
@@ -95,7 +95,7 @@ export class EmptyView extends EventEmitter.EventEmitter implements GitView.IVie
var
initSection
=
$
(
'
.section
'
).
appendTo
(
this
.
$el
);
this
.
initButton
=
new
Button
(
initSection
);
this
.
initButton
.
label
=
nls
.
localize
(
'
gitinit
'
,
'
Initialize
git r
epository
'
);
this
.
initButton
.
label
=
nls
.
localize
(
'
gitinit
'
,
'
Initialize
Git R
epository
'
);
this
.
initButton
.
addListener2
(
'
click
'
,
(
e
)
=>
{
DOM
.
EventHelper
.
stop
(
e
);
...
...
src/vs/workbench/parts/git/browser/views/noworkspace/noworkspaceView.css
浏览文件 @
37ae1348
...
...
@@ -10,14 +10,3 @@
.git-viewlet
>
.noworkspace-view
>
p
{
line-height
:
1.5em
;
}
.git-viewlet
>
.noworkspace-view
.code
{
display
:
inline
;
}
.git-viewlet
>
.noworkspace-view
a
{
color
:
inherit
;
font-weight
:
bold
;
text-decoration
:
underline
;
}
src/vs/workbench/parts/git/browser/views/noworkspace/noworkspaceView.ts
浏览文件 @
37ae1348
...
...
@@ -7,11 +7,16 @@
import
'
vs/css!./noworkspaceView
'
;
import
nls
=
require
(
'
vs/nls
'
);
import
*
as
errors
from
'
vs/base/common/errors
'
;
import
winjs
=
require
(
'
vs/base/common/winjs.base
'
);
import
ee
=
require
(
'
vs/base/common/eventEmitter
'
);
import
env
=
require
(
'
vs/base/common/platform
'
);
import
view
=
require
(
'
vs/workbench/parts/git/browser/views/view
'
);
import
builder
=
require
(
'
vs/base/browser/builder
'
);
import
actions
=
require
(
'
vs/base/common/actions
'
);
import
{
Button
}
from
'
vs/base/browser/ui/button/button
'
;
import
{
IActionRunner
,
IAction
}
from
'
vs/base/common/actions
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
OpenFolderAction
,
OpenFileFolderAction
}
from
'
vs/workbench/browser/actions/fileActions
'
;
const
$
=
builder
.
$
;
export
class
NoWorkspaceView
...
...
@@ -19,6 +24,14 @@ export class NoWorkspaceView
implements
view
.
IView
{
public
ID
=
'
noworkspace
'
;
private
_element
:
HTMLElement
;
private
_openFolderButton
:
Button
;
constructor
(
private
actionRunner
:
IActionRunner
,
@
IInstantiationService
private
instantiationService
:
IInstantiationService
,
)
{
super
();
}
public
get
element
():
HTMLElement
{
if
(
!
this
.
_element
)
{
...
...
@@ -31,14 +44,29 @@ export class NoWorkspaceView
private
render
():
void
{
this
.
_element
=
$
([
'
<div class="noworkspace-view">
'
,
'
<p>
'
,
nls
.
localize
(
'
noWorkspace
'
,
"
There is no currently opened
folder.
"
),
'
</p>
'
,
'
<p>
'
,
nls
.
localize
(
'
noWorkspace
Help
'
,
"
You have not yet opened a
folder.
"
),
'
</p>
'
,
'
<p>
'
,
nls
.
localize
(
'
pleaseRestart
'
,
"
Open a folder with a Git repository in order to access Git features.
"
),
'
</p>
'
,
'
</div>
'
].
join
(
''
)).
getHTMLElement
();
this
.
_openFolderButton
=
new
Button
(
this
.
_element
);
this
.
_openFolderButton
.
label
=
nls
.
localize
(
'
openFolder
'
,
"
Open Folder
"
);
this
.
_openFolderButton
.
addListener2
(
'
click
'
,
()
=>
{
const
actionClass
=
env
.
isMacintosh
?
OpenFileFolderAction
:
OpenFolderAction
;
const
action
=
this
.
instantiationService
.
createInstance
<
string
,
string
,
IAction
>
(
actionClass
,
actionClass
.
ID
,
actionClass
.
LABEL
);
this
.
actionRunner
.
run
(
action
).
done
(()
=>
{
action
.
dispose
();
},
err
=>
{
action
.
dispose
();
errors
.
onUnexpectedError
(
err
);
});
});
}
public
focus
():
void
{
return
;
if
(
this
.
_openFolderButton
)
{
this
.
_openFolderButton
.
getElement
().
focus
();
}
}
public
layout
(
dimension
:
builder
.
Dimension
):
void
{
...
...
@@ -53,11 +81,11 @@ export class NoWorkspaceView
return
null
;
}
public
getActions
():
actions
.
IAction
[]
{
public
getActions
():
IAction
[]
{
return
[];
}
public
getSecondaryActions
():
actions
.
IAction
[]
{
public
getSecondaryActions
():
IAction
[]
{
return
[];
}
}
\ No newline at end of file
src/vs/workbench/parts/search/browser/media/searchviewlet.css
浏览文件 @
37ae1348
...
...
@@ -152,6 +152,10 @@
padding-top
:
2px
;
}
.search-viewlet
.message
p
:first-child
{
margin-top
:
0
;
}
.search-viewlet
.filematch
{
position
:
relative
;
line-height
:
22px
;
...
...
src/vs/workbench/parts/search/browser/searchViewlet.ts
浏览文件 @
37ae1348
...
...
@@ -13,6 +13,7 @@ import lifecycle = require('vs/base/common/lifecycle');
import
errors
=
require
(
'
vs/base/common/errors
'
);
import
aria
=
require
(
'
vs/base/browser/ui/aria/aria
'
);
import
{
IExpression
}
from
'
vs/base/common/glob
'
;
import
env
=
require
(
'
vs/base/common/platform
'
);
import
{
isFunction
}
from
'
vs/base/common/types
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
strings
=
require
(
'
vs/base/common/strings
'
);
...
...
@@ -52,6 +53,7 @@ import { RefreshAction, CollapseAllAction, ClearSearchResultsAction, ConfigureGl
import
{
IReplaceService
}
from
'
vs/workbench/parts/search/common/replace
'
;
import
Severity
from
'
vs/base/common/severity
'
;
import
{
IUntitledEditorService
}
from
'
vs/workbench/services/untitled/common/untitledEditorService
'
;
import
{
OpenFolderAction
,
OpenFileFolderAction
}
from
'
vs/workbench/browser/actions/fileActions
'
;
import
*
as
Constants
from
'
vs/workbench/parts/search/common/constants
'
;
export
class
SearchViewlet
extends
Viewlet
{
...
...
@@ -219,6 +221,9 @@ export class SearchViewlet extends Viewlet {
}).
getHTMLElement
();
this
.
messages
=
builder
.
div
({
'
class
'
:
'
messages
'
}).
hide
().
clone
();
if
(
!
this
.
contextService
.
getWorkspace
())
{
this
.
searchWithoutFolderMessage
(
this
.
clearMessage
());
}
this
.
createSearchResultsView
(
builder
);
...
...
@@ -350,7 +355,8 @@ export class SearchViewlet extends Viewlet {
this
.
searchWidget
.
setReplaceAllActionState
(
false
);
this
.
viewModel
.
searchResult
.
replaceAll
(
progressRunner
).
then
(()
=>
{
progressRunner
.
done
();
this
.
showMessage
(
afterReplaceAllMessage
);
this
.
clearMessage
()
.
p
({
text
:
afterReplaceAllMessage
});
},
(
error
)
=>
{
progressRunner
.
done
();
errors
.
isPromiseCanceledError
(
error
);
...
...
@@ -359,8 +365,10 @@ export class SearchViewlet extends Viewlet {
}
}
private
showMessage
(
text
:
string
):
Builder
{
return
this
.
messages
.
empty
().
show
().
asContainer
().
div
({
'
class
'
:
'
message
'
,
text
:
text
});
private
clearMessage
():
Builder
{
return
this
.
messages
.
empty
().
show
()
.
asContainer
().
div
({
'
class
'
:
'
message
'
})
.
asContainer
();
}
private
createSearchResultsView
(
builder
:
Builder
):
void
{
...
...
@@ -572,6 +580,9 @@ export class SearchViewlet extends Viewlet {
public
clearSearchResults
():
void
{
this
.
viewModel
.
searchResult
.
clear
();
this
.
showEmptyStage
();
if
(
!
this
.
contextService
.
getWorkspace
())
{
this
.
searchWithoutFolderMessage
(
this
.
clearMessage
());
}
this
.
searchWidget
.
clear
();
this
.
viewModel
.
cancelSearch
();
}
...
...
@@ -838,10 +849,11 @@ export class SearchViewlet extends Viewlet {
this
.
tree
.
onHidden
();
this
.
results
.
hide
();
let
div
=
this
.
showMessage
(
message
);
const
div
=
this
.
clearMessage
();
const
p
=
$
(
div
).
p
({
text
:
message
});
if
(
!
completed
)
{
$
(
div
).
a
({
$
(
p
).
a
({
'
class
'
:
[
'
pointer
'
,
'
prominent
'
],
text
:
nls
.
localize
(
'
rerunSearch.message
'
,
"
Search again
"
)
}).
on
(
dom
.
EventType
.
CLICK
,
(
e
:
MouseEvent
)
=>
{
...
...
@@ -850,7 +862,7 @@ export class SearchViewlet extends Viewlet {
this
.
onQueryChanged
(
true
);
});
}
else
if
(
hasIncludes
||
hasExcludes
)
{
$
(
div
).
a
({
$
(
p
).
a
({
'
class
'
:
[
'
pointer
'
,
'
prominent
'
],
'
tabindex
'
:
'
0
'
,
text
:
nls
.
localize
(
'
rerunSearchInAll.message
'
,
"
Search again in all files
"
)
...
...
@@ -863,16 +875,24 @@ export class SearchViewlet extends Viewlet {
this
.
onQueryChanged
(
true
);
});
}
else
{
$
(
div
).
a
({
$
(
p
).
a
({
'
class
'
:
[
'
pointer
'
,
'
prominent
'
],
'
tabindex
'
:
'
0
'
,
text
:
nls
.
localize
(
'
openSettings.message
'
,
"
Open Settings
"
)
}).
on
(
dom
.
EventType
.
CLICK
,
(
e
:
MouseEvent
)
=>
{
dom
.
EventHelper
.
stop
(
e
,
false
);
this
.
preferencesService
.
openWorkspaceSettings
().
done
(()
=>
null
,
errors
.
onUnexpectedError
);
if
(
this
.
contextService
.
getWorkspace
())
{
this
.
preferencesService
.
openWorkspaceSettings
().
done
(()
=>
null
,
errors
.
onUnexpectedError
);
}
else
{
this
.
preferencesService
.
openGlobalSettings
().
done
(()
=>
null
,
errors
.
onUnexpectedError
);
}
});
}
if
(
!
this
.
contextService
.
getWorkspace
())
{
this
.
searchWithoutFolderMessage
(
div
);
}
}
else
{
this
.
viewModel
.
searchResult
.
toggleHighlights
(
true
);
// show highlights
...
...
@@ -949,6 +969,26 @@ export class SearchViewlet extends Viewlet {
this
.
viewModel
.
search
(
query
).
done
(
onComplete
,
onError
,
onProgress
);
}
private
searchWithoutFolderMessage
(
div
:
Builder
):
void
{
$
(
div
).
p
({
text
:
nls
.
localize
(
'
searchWithoutFolder
'
,
"
You have not yet opened a folder. Only open files are currently searched -
"
)
})
.
asContainer
().
a
({
'
class
'
:
[
'
pointer
'
,
'
prominent
'
],
'
tabindex
'
:
'
0
'
,
text
:
nls
.
localize
(
'
openFolder
'
,
"
Open Folder
"
)
}).
on
(
dom
.
EventType
.
CLICK
,
(
e
:
MouseEvent
)
=>
{
dom
.
EventHelper
.
stop
(
e
,
false
);
const
actionClass
=
env
.
isMacintosh
?
OpenFileFolderAction
:
OpenFolderAction
;
const
action
=
this
.
instantiationService
.
createInstance
<
string
,
string
,
IAction
>
(
actionClass
,
actionClass
.
ID
,
actionClass
.
LABEL
);
this
.
actionRunner
.
run
(
action
).
done
(()
=>
{
action
.
dispose
();
},
err
=>
{
action
.
dispose
();
errors
.
onUnexpectedError
(
err
);
});
});
}
private
showEmptyStage
():
void
{
// disable 'result'-actions
...
...
src/vs/workbench/parts/watermark/electron-browser/watermark.ts
浏览文件 @
37ae1348
...
...
@@ -20,7 +20,8 @@ import { GlobalQuickOpenAction } from 'vs/workbench/browser/parts/quickopen/quic
import
{
KeybindingsReferenceAction
,
OpenRecentAction
}
from
'
vs/workbench/electron-browser/actions
'
;
import
{
ShowRecommendedKeymapExtensionsAction
}
from
'
vs/workbench/parts/extensions/browser/extensionsActions
'
;
import
{
GlobalNewUntitledFileAction
}
from
'
vs/workbench/parts/files/browser/fileActions
'
;
import
{
OpenFolderAction
,
OpenFileAction
,
OpenFileFolderAction
}
from
'
vs/workbench/parts/files/electron-browser/electronFileActions
'
;
import
{
OpenFileAction
}
from
'
vs/workbench/parts/files/electron-browser/electronFileActions
'
;
import
{
OpenFolderAction
,
OpenFileFolderAction
}
from
'
vs/workbench/browser/actions/fileActions
'
;
import
{
ShowAllCommandsAction
}
from
'
vs/workbench/parts/quickopen/browser/commandsHandler
'
;
import
{
Parts
,
IPartService
}
from
'
vs/workbench/services/part/common/partService
'
;
import
{
StartAction
}
from
'
vs/workbench/parts/debug/browser/debugActions
'
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录