Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
d212179d
D
dbeaver
项目概览
suliangchun
/
dbeaver
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dbeaver
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d212179d
编写于
7月 09, 2014
作者:
J
jurgen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Resource properties for standalone version
上级
6f085b0c
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
568 addition
and
3 deletion
+568
-3
docs/todo.txt
docs/todo.txt
+2
-1
plugins/org.jkiss.dbeaver.core.application/META-INF/MANIFEST.MF
...s/org.jkiss.dbeaver.core.application/META-INF/MANIFEST.MF
+2
-1
plugins/org.jkiss.dbeaver.core.application/plugin.xml
plugins/org.jkiss.dbeaver.core.application/plugin.xml
+8
-0
plugins/org.jkiss.dbeaver.core.application/src/org/jkiss/dbeaver/ui/dialogs/ResourceInfoPage.java
...on/src/org/jkiss/dbeaver/ui/dialogs/ResourceInfoPage.java
+554
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/UIUtils.java
....jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/UIUtils.java
+1
-1
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/editors/text/FileRefDocumentProvider.java
...kiss/dbeaver/ui/editors/text/FileRefDocumentProvider.java
+1
-0
未找到文件。
docs/todo.txt
浏览文件 @
d212179d
BUG: insert explicit values for auto-increment columns in data transfer (configurable)
MySQL and Cassandra + SSL.
SQL folding.
SQL folding
Resource property page (file encoding etc)
NoSQL: in record mode show only existing attrs for dynamic metadata
NoSQL: hide dynamic columns which presents in less than 50% of records. Show them as arrays??
...
...
plugins/org.jkiss.dbeaver.core.application/META-INF/MANIFEST.MF
浏览文件 @
d212179d
...
...
@@ -17,4 +17,5 @@ Require-Bundle: org.jkiss.dbeaver.core,
org.eclipse.jface,
org.eclipse.core.resources,
org.eclipse.ui.workbench.texteditor,
org.eclipse.help
org.eclipse.help,
org.eclipse.core.filesystem
plugins/org.jkiss.dbeaver.core.application/plugin.xml
浏览文件 @
d212179d
...
...
@@ -258,6 +258,14 @@
</extension>
<extension
point=
"org.eclipse.ui.propertyPages"
>
<page
class=
"org.jkiss.dbeaver.ui.dialogs.ResourceInfoPage"
id=
"org.jkiss.dbeaver.ui.dialogs.ResourceInfoPage"
name=
"Resource properties"
>
<enabledWhen>
<adapt
type=
"org.eclipse.core.resources.IResource"
/>
</enabledWhen>
</page>
</extension>
<extension
point=
"org.eclipse.ui.splashHandlers"
>
<splashHandler
class=
"org.jkiss.dbeaver.core.application.DBeaverSplashHandler"
...
...
plugins/org.jkiss.dbeaver.core.application/src/org/jkiss/dbeaver/ui/dialogs/ResourceInfoPage.java
0 → 100644
浏览文件 @
d212179d
/*
* Copyright (C) 2010-2014 Serge Rieder
* serge@jkiss.org
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package
org.jkiss.dbeaver.ui.dialogs
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.eclipse.core.filesystem.EFS
;
import
org.eclipse.core.filesystem.IFileInfo
;
import
org.eclipse.core.filesystem.IFileStore
;
import
org.eclipse.core.resources.IFile
;
import
org.eclipse.core.resources.IProject
;
import
org.eclipse.core.resources.IResource
;
import
org.eclipse.core.runtime.CoreException
;
import
org.eclipse.core.runtime.content.IContentDescription
;
import
org.eclipse.core.runtime.content.IContentType
;
import
org.eclipse.jface.dialogs.Dialog
;
import
org.eclipse.osgi.util.NLS
;
import
org.eclipse.osgi.util.TextProcessor
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.layout.GridData
;
import
org.eclipse.swt.layout.GridLayout
;
import
org.eclipse.swt.widgets.*
;
import
org.eclipse.ui.PlatformUI
;
import
org.eclipse.ui.dialogs.PropertyPage
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.utils.ContentUtils
;
import
java.net.URI
;
import
java.text.DateFormat
;
import
java.text.MessageFormat
;
import
java.text.NumberFormat
;
import
java.util.Date
;
/**
* The ResourceInfoPage is the page that shows the basic info about the
* resource.
*/
public
class
ResourceInfoPage
extends
PropertyPage
{
static
final
Log
log
=
LogFactory
.
getLog
(
ResourceInfoPage
.
class
);
private
static
String
BYTES_LABEL
=
"{0} Bytes"
;
private
static
String
FILE_LABEL
=
"File"
;
private
static
String
FILE_NOT_EXIST_TEXT
=
"File not exist"
;
private
static
String
FILE_TYPE_FORMAT
=
"File"
;
private
static
String
FOLDER_LABEL
=
"Folder"
;
private
static
String
LINKED_FILE_LABEL
=
"Linked file"
;
private
static
String
LINKED_FOLDER_LABEL
=
"Linked folder"
;
private
static
String
VIRTUAL_FOLDER_LABEL
=
"Virtual folder"
;
private
static
String
VIRTUAL_FOLDER_TEXT
=
"Virtual folder"
;
private
static
String
MISSING_PATH_VARIABLE_TEXT
=
"Undefined path variable"
;
private
static
String
NOT_EXIST_TEXT
=
"Not exist"
;
private
static
String
NOT_LOCAL_TEXT
=
"Not local"
;
private
static
String
PROJECT_LABEL
=
"Project"
;
private
static
String
UNKNOWN_LABEL
=
"Unknown"
;
private
static
String
TYPE_TITLE
=
"Type"
;
private
static
String
LOCATION_TITLE
=
"Location"
;
private
static
String
RESOLVED_LOCATION_TITLE
=
"Resolved location"
;
private
static
String
SIZE_TITLE
=
"Size"
;
private
static
String
PATH_TITLE
=
"Path"
;
private
static
String
TIMESTAMP_TITLE
=
"Last modified"
;
private
IContentDescription
cachedContentDescription
;
private
Combo
encodingEditor
;
private
Text
resolvedLocationValue
=
null
;
// Max value width in characters before wrapping
private
static
final
int
MAX_VALUE_WIDTH
=
80
;
private
Composite
createBasicInfoGroup
(
Composite
basicInfoComposite
,
IResource
resource
)
{
// The group for path
Label
pathLabel
=
new
Label
(
basicInfoComposite
,
SWT
.
NONE
);
pathLabel
.
setText
(
PATH_TITLE
);
GridData
gd
=
new
GridData
();
gd
.
verticalAlignment
=
SWT
.
TOP
;
pathLabel
.
setLayoutData
(
gd
);
// path value label
Text
pathValueText
=
new
Text
(
basicInfoComposite
,
SWT
.
WRAP
|
SWT
.
READ_ONLY
);
String
pathString
=
TextProcessor
.
process
(
resource
.
getFullPath
()
.
toString
());
pathValueText
.
setText
(
pathString
);
gd
=
new
GridData
();
gd
.
widthHint
=
convertWidthInCharsToPixels
(
MAX_VALUE_WIDTH
);
gd
.
grabExcessHorizontalSpace
=
true
;
gd
.
horizontalAlignment
=
GridData
.
FILL
;
pathValueText
.
setLayoutData
(
gd
);
pathValueText
.
setBackground
(
pathValueText
.
getDisplay
().
getSystemColor
(
SWT
.
COLOR_WIDGET_BACKGROUND
));
// The group for types
Label
typeTitle
=
new
Label
(
basicInfoComposite
,
SWT
.
LEFT
);
typeTitle
.
setText
(
TYPE_TITLE
);
Text
typeValue
=
new
Text
(
basicInfoComposite
,
SWT
.
LEFT
|
SWT
.
READ_ONLY
);
typeValue
.
setText
(
getTypeString
(
resource
,
getContentDescription
(
resource
)));
typeValue
.
setBackground
(
typeValue
.
getDisplay
().
getSystemColor
(
SWT
.
COLOR_WIDGET_BACKGROUND
));
if
(
resource
.
isLinked
()
&&
!
resource
.
isVirtual
())
{
// The group for location
Label
locationTitle
=
new
Label
(
basicInfoComposite
,
SWT
.
LEFT
);
locationTitle
.
setText
(
LOCATION_TITLE
);
gd
=
new
GridData
();
gd
.
verticalAlignment
=
SWT
.
TOP
;
locationTitle
.
setLayoutData
(
gd
);
Composite
locationComposite
=
new
Composite
(
basicInfoComposite
,
SWT
.
NULL
);
GridLayout
layout
=
new
GridLayout
();
layout
.
numColumns
=
2
;
layout
.
marginWidth
=
0
;
layout
.
marginHeight
=
0
;
locationComposite
.
setLayout
(
layout
);
gd
=
new
GridData
();
gd
.
widthHint
=
convertWidthInCharsToPixels
(
MAX_VALUE_WIDTH
);
gd
.
grabExcessHorizontalSpace
=
true
;
gd
.
verticalAlignment
=
SWT
.
TOP
;
gd
.
horizontalAlignment
=
GridData
.
FILL
;
locationComposite
.
setLayoutData
(
gd
);
Text
locationValue
=
new
Text
(
locationComposite
,
SWT
.
WRAP
|
SWT
.
READ_ONLY
);
String
locationStr
=
TextProcessor
.
process
(
getLocationText
(
resource
));
locationValue
.
setText
(
locationStr
);
gd
=
new
GridData
();
gd
.
widthHint
=
convertWidthInCharsToPixels
(
MAX_VALUE_WIDTH
);
gd
.
grabExcessHorizontalSpace
=
true
;
gd
.
verticalAlignment
=
SWT
.
TOP
;
gd
.
horizontalAlignment
=
GridData
.
FILL
;
locationValue
.
setLayoutData
(
gd
);
locationValue
.
setBackground
(
locationValue
.
getDisplay
().
getSystemColor
(
SWT
.
COLOR_WIDGET_BACKGROUND
));
// displayed in all cases since the link can be changed to a path variable any time by the user in this dialog
Label
resolvedLocationTitle
=
new
Label
(
basicInfoComposite
,
SWT
.
LEFT
);
resolvedLocationTitle
.
setText
(
RESOLVED_LOCATION_TITLE
);
gd
=
new
GridData
();
gd
.
verticalAlignment
=
SWT
.
TOP
;
resolvedLocationTitle
.
setLayoutData
(
gd
);
resolvedLocationValue
=
new
Text
(
basicInfoComposite
,
SWT
.
WRAP
|
SWT
.
READ_ONLY
);
resolvedLocationValue
.
setText
(
getResolvedLocationText
(
resource
));
gd
=
new
GridData
();
gd
.
widthHint
=
convertWidthInCharsToPixels
(
MAX_VALUE_WIDTH
);
gd
.
grabExcessHorizontalSpace
=
true
;
gd
.
horizontalAlignment
=
GridData
.
FILL
;
resolvedLocationValue
.
setLayoutData
(
gd
);
resolvedLocationValue
.
setBackground
(
resolvedLocationValue
.
getDisplay
().
getSystemColor
(
SWT
.
COLOR_WIDGET_BACKGROUND
));
}
else
{
if
(!
resource
.
isVirtual
())
{
// The group for location
Label
locationTitle
=
new
Label
(
basicInfoComposite
,
SWT
.
LEFT
);
locationTitle
.
setText
(
LOCATION_TITLE
);
gd
=
new
GridData
();
gd
.
verticalAlignment
=
SWT
.
TOP
;
locationTitle
.
setLayoutData
(
gd
);
Text
locationValue
=
new
Text
(
basicInfoComposite
,
SWT
.
WRAP
|
SWT
.
READ_ONLY
);
String
locationStr
=
TextProcessor
.
process
(
getLocationText
(
resource
));
locationValue
.
setText
(
locationStr
);
gd
=
new
GridData
();
gd
.
widthHint
=
convertWidthInCharsToPixels
(
MAX_VALUE_WIDTH
);
gd
.
grabExcessHorizontalSpace
=
true
;
gd
.
horizontalAlignment
=
GridData
.
FILL
;
locationValue
.
setLayoutData
(
gd
);
locationValue
.
setBackground
(
locationValue
.
getDisplay
()
.
getSystemColor
(
SWT
.
COLOR_WIDGET_BACKGROUND
));
}
}
if
(
resource
.
getType
()
==
IResource
.
FILE
)
{
// The group for size
Label
sizeTitle
=
new
Label
(
basicInfoComposite
,
SWT
.
LEFT
);
sizeTitle
.
setText
(
SIZE_TITLE
);
Text
sizeValue
=
new
Text
(
basicInfoComposite
,
SWT
.
LEFT
|
SWT
.
READ_ONLY
);
sizeValue
.
setText
(
getSizeString
(
resource
));
gd
=
new
GridData
();
gd
.
widthHint
=
convertWidthInCharsToPixels
(
MAX_VALUE_WIDTH
);
gd
.
grabExcessHorizontalSpace
=
true
;
gd
.
horizontalAlignment
=
GridData
.
FILL
;
sizeValue
.
setLayoutData
(
gd
);
sizeValue
.
setBackground
(
sizeValue
.
getDisplay
().
getSystemColor
(
SWT
.
COLOR_WIDGET_BACKGROUND
));
}
Label
timeStampLabel
=
new
Label
(
basicInfoComposite
,
SWT
.
NONE
);
timeStampLabel
.
setText
(
TIMESTAMP_TITLE
);
// timeStamp value label
Text
timeStampValue
=
new
Text
(
basicInfoComposite
,
SWT
.
READ_ONLY
);
timeStampValue
.
setText
(
getDateStringValue
(
resource
));
timeStampValue
.
setBackground
(
timeStampValue
.
getDisplay
()
.
getSystemColor
(
SWT
.
COLOR_WIDGET_BACKGROUND
));
timeStampValue
.
setLayoutData
(
new
GridData
(
GridData
.
FILL_HORIZONTAL
|
GridData
.
GRAB_HORIZONTAL
));
return
basicInfoComposite
;
}
protected
Control
createContents
(
Composite
parent
)
{
PlatformUI
.
getWorkbench
().
getHelpSystem
().
setHelp
(
getControl
(),
"Resource properties"
);
// layout the page
IResource
resource
=
(
IResource
)
getElement
().
getAdapter
(
IResource
.
class
);
if
(
resource
==
null
)
{
Label
label
=
new
Label
(
parent
,
SWT
.
NONE
);
label
.
setText
(
"No Resource"
);
return
label
;
}
// top level group
Composite
composite
=
new
Composite
(
parent
,
SWT
.
NONE
);
GridLayout
layout
=
new
GridLayout
();
layout
.
marginWidth
=
0
;
layout
.
marginHeight
=
0
;
composite
.
setLayout
(
layout
);
GridData
data
=
new
GridData
(
GridData
.
FILL
);
data
.
grabExcessHorizontalSpace
=
true
;
composite
.
setLayoutData
(
data
);
Composite
encodingComposite
=
new
Composite
(
composite
,
SWT
.
NULL
);
layout
=
new
GridLayout
();
layout
.
numColumns
=
2
;
layout
.
marginWidth
=
0
;
layout
.
marginHeight
=
0
;
encodingComposite
.
setLayout
(
layout
);
encodingComposite
.
setLayoutData
(
new
GridData
(
GridData
.
FILL_BOTH
));
createBasicInfoGroup
(
encodingComposite
,
resource
);
{
UIUtils
.
createControlLabel
(
encodingComposite
,
"Encoding"
);
IContentDescription
contentDescription
=
getContentDescription
(
resource
);
String
defEncoding
=
contentDescription
==
null
?
ContentUtils
.
getDefaultFileEncoding
()
:
contentDescription
.
getCharset
();
encodingEditor
=
UIUtils
.
createEncodingCombo
(
encodingComposite
,
defEncoding
);
}
Dialog
.
applyDialogFont
(
composite
);
return
composite
;
}
private
IContentDescription
getContentDescription
(
IResource
resource
)
{
if
(
resource
.
getType
()
!=
IResource
.
FILE
)
{
return
null
;
}
if
(
cachedContentDescription
==
null
)
{
try
{
cachedContentDescription
=
((
IFile
)
resource
)
.
getContentDescription
();
}
catch
(
CoreException
e
)
{
// silently ignore
}
}
return
cachedContentDescription
;
}
protected
void
performDefaults
()
{
IResource
resource
=
(
IResource
)
getElement
().
getAdapter
(
IResource
.
class
);
if
(
resource
==
null
)
return
;
if
(
encodingEditor
!=
null
)
{
//encodingEditor.loadDefault();
}
}
/**
* Apply the read only state and the encoding to the resource.
*/
public
boolean
performOk
()
{
IResource
resource
=
(
IResource
)
getElement
().
getAdapter
(
IResource
.
class
);
if
(
resource
==
null
)
return
true
;
/*
try {
if (newResourceLocation != null) {
if (resource.getType() == IResource.FILE)
((IFile)resource).createLink(newResourceLocation, IResource.REPLACE,
new NullProgressMonitor());
if (resource.getType() == IResource.FOLDER)
((IFolder)resource).createLink(newResourceLocation, IResource.REPLACE,
new NullProgressMonitor());
}
} catch (CoreException exception) {
ErrorDialog.openError(getShell(),
"Error", exception.getLocalizedMessage(), exception.getStatus());
return false;
} finally {
// This must be invoked after the 'derived' property has been set,
// because it may influence the place where encoding is stored.
if (encodingEditor != null) {
encodingEditor.store();
}
}
*/
return
true
;
}
private
static
String
getContentTypeString
(
IContentDescription
description
)
{
if
(
description
!=
null
)
{
IContentType
contentType
=
description
.
getContentType
();
if
(
contentType
!=
null
)
{
return
contentType
.
getName
();
}
}
return
null
;
}
public
static
String
getDateStringValue
(
IResource
resource
)
{
// don't access the file system for closed projects (bug 151089)
if
(!
isProjectAccessible
(
resource
))
{
return
UNKNOWN_LABEL
;
}
URI
location
=
resource
.
getLocationURI
();
if
(
location
==
null
)
{
if
(
resource
.
isLinked
())
{
return
MISSING_PATH_VARIABLE_TEXT
;
}
return
NOT_EXIST_TEXT
;
}
IFileInfo
info
=
getFileInfo
(
location
);
if
(
info
==
null
)
{
return
UNKNOWN_LABEL
;
}
if
(
info
.
exists
())
{
DateFormat
format
=
DateFormat
.
getDateTimeInstance
(
DateFormat
.
LONG
,
DateFormat
.
MEDIUM
);
return
format
.
format
(
new
Date
(
info
.
getLastModified
()));
}
return
NOT_EXIST_TEXT
;
}
public
static
IFileInfo
getFileInfo
(
URI
location
)
{
if
(
location
.
getScheme
()
==
null
)
return
null
;
IFileStore
store
=
getFileStore
(
location
);
if
(
store
==
null
)
{
return
null
;
}
return
store
.
fetchInfo
();
}
public
static
IFileStore
getFileStore
(
URI
uri
)
{
try
{
return
EFS
.
getStore
(
uri
);
}
catch
(
CoreException
e
)
{
log
.
error
(
e
);
return
null
;
}
}
/**
* Get the location of a resource
*
* @param resource
* @return String the text to display the location
*/
public
static
String
getLocationText
(
IResource
resource
)
{
if
(
resource
.
isVirtual
())
return
VIRTUAL_FOLDER_TEXT
;
URI
resolvedLocation
=
resource
.
getLocationURI
();
URI
location
=
resolvedLocation
;
boolean
isLinked
=
resource
.
isLinked
();
if
(
isLinked
)
{
location
=
resource
.
getRawLocationURI
();
}
if
(
location
==
null
)
{
return
NOT_EXIST_TEXT
;
}
if
(
resolvedLocation
.
getScheme
()
==
null
)
return
location
.
toString
();
IFileStore
store
=
getFileStore
(
resolvedLocation
);
// don't access the file system for closed projects (bug 151089)
boolean
isPathVariable
=
isPathVariable
(
resource
);
if
(
isProjectAccessible
(
resource
)
&&
!
isPathVariable
)
{
// No path variable used. Display the file not exist message
// in the location. Fixes bug 33318.
if
(
store
==
null
)
{
return
UNKNOWN_LABEL
;
}
if
(!
store
.
fetchInfo
().
exists
())
{
return
NLS
.
bind
(
FILE_NOT_EXIST_TEXT
,
store
.
toString
());
}
}
if
(
isLinked
&&
isPathVariable
)
{
String
tmp
=
org
.
eclipse
.
core
.
filesystem
.
URIUtil
.
toPath
(
resource
.
getRawLocationURI
()).
toOSString
();
return
resource
.
getPathVariableManager
().
convertToUserEditableFormat
(
tmp
,
true
);
}
if
(
store
!=
null
)
{
return
store
.
toString
();
}
return
location
.
toString
();
}
public
static
String
getResolvedLocationText
(
IResource
resource
)
{
URI
location
=
resource
.
getLocationURI
();
if
(
location
==
null
)
{
if
(
resource
.
isLinked
())
{
return
MISSING_PATH_VARIABLE_TEXT
;
}
return
NOT_EXIST_TEXT
;
}
if
(
location
.
getScheme
()
==
null
)
return
UNKNOWN_LABEL
;
IFileStore
store
=
getFileStore
(
location
);
if
(
store
==
null
)
{
return
UNKNOWN_LABEL
;
}
// don't access the file system for closed projects (bug 151089)
if
(
isProjectAccessible
(
resource
)
&&
!
store
.
fetchInfo
().
exists
())
{
return
NLS
.
bind
(
FILE_NOT_EXIST_TEXT
,
store
.
toString
());
}
return
store
.
toString
();
}
public
static
String
getSizeString
(
IResource
resource
)
{
if
(
resource
.
getType
()
!=
IResource
.
FILE
)
{
return
""
;
//$NON-NLS-1$
}
IFile
file
=
(
IFile
)
resource
;
URI
location
=
file
.
getLocationURI
();
if
(
location
==
null
)
{
if
(
file
.
isLinked
())
{
return
MISSING_PATH_VARIABLE_TEXT
;
}
return
NOT_EXIST_TEXT
;
}
IFileInfo
info
=
getFileInfo
(
location
);
if
(
info
==
null
)
{
return
UNKNOWN_LABEL
;
}
if
(
info
.
exists
())
{
return
NLS
.
bind
(
BYTES_LABEL
,
NumberFormat
.
getInstance
().
format
(
info
.
getLength
()));
}
return
NOT_EXIST_TEXT
;
}
public
static
String
getTypeString
(
IResource
resource
,
IContentDescription
description
)
{
if
(
resource
.
getType
()
==
IResource
.
FILE
)
{
if
(
resource
.
isLinked
())
{
return
LINKED_FILE_LABEL
;
}
if
(
resource
instanceof
IFile
)
{
String
contentType
=
getContentTypeString
(
description
);
if
(
contentType
!=
null
)
{
return
MessageFormat
.
format
(
FILE_TYPE_FORMAT
,
new
String
[]{
contentType
});
}
}
return
FILE_LABEL
;
}
if
(
resource
.
getType
()
==
IResource
.
FOLDER
)
{
if
(
resource
.
isVirtual
())
{
return
VIRTUAL_FOLDER_LABEL
;
}
if
(
resource
.
isLinked
())
{
return
LINKED_FOLDER_LABEL
;
}
return
FOLDER_LABEL
;
}
if
(
resource
.
getType
()
==
IResource
.
PROJECT
)
{
return
PROJECT_LABEL
;
}
// Should not be possible
return
UNKNOWN_LABEL
;
}
private
static
boolean
isPathVariable
(
IResource
resource
)
{
if
(!
resource
.
isLinked
())
{
return
false
;
}
URI
resolvedLocation
=
resource
.
getLocationURI
();
if
(
resolvedLocation
==
null
)
{
// missing path variable
return
true
;
}
URI
rawLocation
=
resource
.
getRawLocationURI
();
return
!
resolvedLocation
.
equals
(
rawLocation
);
}
private
static
boolean
isProjectAccessible
(
IResource
resource
)
{
IProject
project
=
resource
.
getProject
();
return
project
!=
null
&&
project
.
isAccessible
();
}
}
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/UIUtils.java
浏览文件 @
d212179d
...
...
@@ -687,7 +687,7 @@ public class UIUtils {
if
(
curCharset
==
null
)
{
curCharset
=
ContentUtils
.
getDefaultFileEncoding
();
}
Combo
encodingCombo
=
new
Combo
(
parent
,
SWT
.
DROP_DOWN
|
SWT
.
READ_ONLY
);
Combo
encodingCombo
=
new
Combo
(
parent
,
SWT
.
DROP_DOWN
);
encodingCombo
.
setVisibleItemCount
(
30
);
SortedMap
<
String
,
Charset
>
charsetMap
=
Charset
.
availableCharsets
();
int
index
=
0
;
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/editors/text/FileRefDocumentProvider.java
浏览文件 @
d212179d
...
...
@@ -199,6 +199,7 @@ public class FileRefDocumentProvider extends BaseTextDocumentProvider {
protected
boolean
setDocumentContent
(
IDocument
document
,
IStorage
storage
)
throws
CoreException
{
try
{
String
charsetFor
=
((
IFile
)
storage
).
getCharsetFor
(
new
InputStreamReader
(
storage
.
getContents
()));
InputStream
contentStream
=
storage
.
getContents
();
try
{
String
encoding
=
(
storage
instanceof
IEncodedStorage
?
((
IEncodedStorage
)
storage
).
getCharset
()
:
ContentUtils
.
getDefaultFileEncoding
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录