use of com.intellij.diff.requests.DiffRequest in project intellij-community by JetBrains.
the class FileWithBranchComparer method showResult.
@Override
protected void showResult() {
if (!success.isNull()) {
String title = SvnBundle.message("compare.with.branch.diff.title");
String title1 = remoteTitleBuilder.toString();
String title2 = myVirtualFile.getPresentableUrl();
try {
DiffContent content1 = DiffContentFactory.getInstance().createFromBytes(myProject, content.get(), myVirtualFile);
DiffContent content2 = DiffContentFactory.getInstance().create(myProject, myVirtualFile);
DiffRequest request = new SimpleDiffRequest(title, content1, content2, title1, title2);
DiffManager.getInstance().showDiff(myProject, request);
} catch (IOException e) {
reportGeneralException(e);
}
}
}
use of com.intellij.diff.requests.DiffRequest in project intellij-community by JetBrains.
the class OpenInEditorAction method update.
@Override
public void update(@NotNull AnActionEvent e) {
if (!ActionPlaces.isToolbarPlace(e.getPlace())) {
e.getPresentation().setEnabledAndVisible(true);
return;
}
DiffRequest request = e.getData(DiffDataKeys.DIFF_REQUEST);
DiffContext context = e.getData(DiffDataKeys.DIFF_CONTEXT);
if (DiffUtil.isUserDataFlagSet(DiffUserDataKeys.GO_TO_SOURCE_DISABLE, request, context)) {
e.getPresentation().setVisible(false);
e.getPresentation().setEnabled(false);
}
if (e.getProject() == null) {
e.getPresentation().setVisible(true);
e.getPresentation().setEnabled(false);
return;
}
Navigatable[] navigatables = e.getData(DiffDataKeys.NAVIGATABLE_ARRAY);
if (navigatables == null || !ContainerUtil.exists(navigatables, (it) -> it.canNavigate())) {
e.getPresentation().setVisible(true);
e.getPresentation().setEnabled(false);
return;
}
e.getPresentation().setEnabledAndVisible(true);
}
use of com.intellij.diff.requests.DiffRequest in project intellij-community by JetBrains.
the class BaseShowDiffAction method actionPerformed.
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
Project project = e.getProject();
DiffRequest request = getDiffRequest(e);
if (request == null)
return;
DiffManager.getInstance().showDiff(project, request);
}
use of com.intellij.diff.requests.DiffRequest in project intellij-community by JetBrains.
the class CompareClipboardWithSelectionAction method getEditorFileType.
@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;
}
use of com.intellij.diff.requests.DiffRequest in project intellij-community by JetBrains.
the class CompareFilesAction method isAvailable.
@Override
protected boolean isAvailable(@NotNull AnActionEvent e) {
DiffRequest request = e.getData(DIFF_REQUEST);
if (request != null) {
return true;
}
VirtualFile[] files = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY);
if (files == null) {
return false;
}
if (files.length == 1) {
return hasContent(files[0]);
} else if (files.length == 2) {
return hasContent(files[0]) && hasContent(files[1]);
} else {
return false;
}
}
Aggregations