本文整理匯總了Java中com.intellij.diff.contents.DiffContent.getContentType方法的典型用法代碼示例。如果您正苦於以下問題:Java DiffContent.getContentType方法的具體用法?Java DiffContent.getContentType怎麽用?Java DiffContent.getContentType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.diff.contents.DiffContent
的用法示例。
在下文中一共展示了DiffContent.getContentType方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createComponent
import com.intellij.diff.contents.DiffContent; //導入方法依賴的package包/類
@Nonnull
private JComponent createComponent(@Nonnull DiffRequest request) {
if (request instanceof MessageDiffRequest) {
// TODO: explain some of ErrorDiffRequest exceptions ?
String message = ((MessageDiffRequest)request).getMessage();
return DiffUtil.createMessagePanel(message);
}
if (request instanceof ComponentDiffRequest) {
return ((ComponentDiffRequest)request).getComponent(myContext);
}
if (request instanceof ContentDiffRequest) {
List<DiffContent> contents = ((ContentDiffRequest)request).getContents();
for (final DiffContent content : contents) {
if (content instanceof FileContent && UnknownFileType.INSTANCE == content.getContentType()) {
final VirtualFile file = ((FileContent)content).getFile();
UnknownFileTypeDiffRequest unknownFileTypeRequest = new UnknownFileTypeDiffRequest(file, myRequest.getTitle());
return unknownFileTypeRequest.getComponent(myContext);
}
}
}
return DiffUtil.createMessagePanel("Can't show diff");
}
示例2: getEditorFileType
import com.intellij.diff.contents.DiffContent; //導入方法依賴的package包/類
@Nullable
private static FileType getEditorFileType(@NotNull AnActionEvent e) {
DiffContent content = e.getData(DiffDataKeys.CURRENT_CONTENT);
if (content != null && content.getContentType() != null) return content.getContentType();
DiffRequest request = e.getData(DiffDataKeys.DIFF_REQUEST);
if (request instanceof ContentDiffRequest) {
for (DiffContent diffContent : ((ContentDiffRequest)request).getContents()) {
FileType type = diffContent.getContentType();
if (type != null && type != UnknownFileType.INSTANCE) return type;
}
}
return null;
}
示例3: wantShowContent
import com.intellij.diff.contents.DiffContent; //導入方法依賴的package包/類
@Override
public boolean wantShowContent(@NotNull DiffContent content, @NotNull DiffContext context) {
if (content instanceof FileContent) {
if (content.getContentType() == null) return false;
if (content.getContentType().isBinary()) return true;
if (content.getContentType() instanceof UIBasedFileType) return true;
return false;
}
return false;
}
示例4: canShowContent
import com.intellij.diff.contents.DiffContent; //導入方法依賴的package包/類
private static boolean canShowContent(@NotNull DiffContent content) {
if (content instanceof EmptyContent) return true;
if (content instanceof DirectoryContent) return true;
if (content instanceof FileContent &&
content.getContentType() instanceof ArchiveFileType &&
((FileContent)content).getFile().isValid() &&
((FileContent)content).getFile().isInLocalFileSystem()) {
return true;
}
return false;
}
示例5: getEditorFileType
import com.intellij.diff.contents.DiffContent; //導入方法依賴的package包/類
@javax.annotation.Nullable
private static FileType getEditorFileType(@Nonnull AnActionEvent e) {
DiffContent content = e.getData(DiffDataKeys.CURRENT_CONTENT);
if (content != null && content.getContentType() != null) return content.getContentType();
DiffRequest request = e.getData(DiffDataKeys.DIFF_REQUEST);
if (request instanceof ContentDiffRequest) {
for (DiffContent diffContent : ((ContentDiffRequest)request).getContents()) {
FileType type = diffContent.getContentType();
if (type != null && type != UnknownFileType.INSTANCE) return type;
}
}
return null;
}
示例6: wantShowContent
import com.intellij.diff.contents.DiffContent; //導入方法依賴的package包/類
@Override
public boolean wantShowContent(@Nonnull DiffContent content, @Nonnull DiffContext context) {
if (content instanceof FileContent) {
if (content.getContentType() == null) return false;
if (content.getContentType().isBinary()) return true;
if (content.getContentType() instanceof UIBasedFileType) return true;
return false;
}
return false;
}
示例7: canShowContent
import com.intellij.diff.contents.DiffContent; //導入方法依賴的package包/類
private static boolean canShowContent(@Nonnull DiffContent content) {
if (content instanceof EmptyContent) return true;
if (content instanceof DirectoryContent) return true;
if (content instanceof FileContent &&
content.getContentType() instanceof ArchiveFileType &&
((FileContent)content).getFile().isValid() &&
((FileContent)content).getFile().isInLocalFileSystem()) {
return true;
}
return false;
}
示例8: createDiffElement
import com.intellij.diff.contents.DiffContent; //導入方法依賴的package包/類
@NotNull
private static DiffElement createDiffElement(@NotNull DiffContent content) {
if (content instanceof EmptyContent) {
return new DiffElement() {
@Override
public String getPath() {
return "";
}
@NotNull
@Override
public String getName() {
return "Nothing";
}
@Override
public long getSize() {
return -1;
}
@Override
public long getTimeStamp() {
return -1;
}
@Override
public boolean isContainer() {
return true;
}
@Override
public DiffElement[] getChildren() throws IOException {
return EMPTY_ARRAY;
}
@Nullable
@Override
public byte[] getContent() throws IOException {
return null;
}
@Override
public Object getValue() {
return null;
}
};
}
if (content instanceof DirectoryContent) {
return new VirtualFileDiffElement(((DirectoryContent)content).getFile());
}
if (content instanceof FileContent && content.getContentType() instanceof ArchiveFileType) {
return new JarFileDiffElement(((FileContent)content).getFile());
}
throw new IllegalArgumentException(content.getClass() + " " + content.getContentType());
}
示例9: createDiffElement
import com.intellij.diff.contents.DiffContent; //導入方法依賴的package包/類
@Nonnull
private static DiffElement createDiffElement(@Nonnull DiffContent content) {
if (content instanceof EmptyContent) {
return new DiffElement() {
@Override
public String getPath() {
return "";
}
@Nonnull
@Override
public String getName() {
return "Nothing";
}
@Override
public long getSize() {
return -1;
}
@Override
public long getTimeStamp() {
return -1;
}
@Override
public boolean isContainer() {
return true;
}
@Override
public DiffElement[] getChildren() throws IOException {
return EMPTY_ARRAY;
}
@Nullable
@Override
public byte[] getContent() throws IOException {
return null;
}
@Override
public Object getValue() {
return null;
}
};
}
if (content instanceof DirectoryContent) {
return new VirtualFileDiffElement(((DirectoryContent)content).getFile());
}
if (content instanceof FileContent && content.getContentType() instanceof ArchiveFileType) {
return new ArchiveFileDiffElement(((FileContent)content).getFile());
}
throw new IllegalArgumentException(content.getClass() + " " + content.getContentType());
}