本文整理汇总了Java中com.intellij.openapi.vcs.changes.CommitContext类的典型用法代码示例。如果您正苦于以下问题:Java CommitContext类的具体用法?Java CommitContext怎么用?Java CommitContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CommitContext类属于com.intellij.openapi.vcs.changes包,在下文中一共展示了CommitContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: apply
import com.intellij.openapi.vcs.changes.CommitContext; //导入依赖的package包/类
@CalledInAwt
@Override
public void apply(MultiMap<VirtualFile, AbstractFilePatchInProgress> patchGroups,
LocalChangeList localList,
String fileName,
TransparentlyFailedValueI<Map<String, Map<String, CharSequence>>, PatchSyntaxException> additionalInfo) {
final Collection<PatchApplier> appliers = new LinkedList<PatchApplier>();
final CommitContext commitContext = new CommitContext();
applyAdditionalInfoBefore(myProject, additionalInfo, commitContext);
for (VirtualFile base : patchGroups.keySet()) {
final PatchApplier patchApplier =
new PatchApplier<BinaryFilePatch>(myProject, base, ObjectsConvertor.convert(patchGroups.get(base),
new Convertor<AbstractFilePatchInProgress, FilePatch>() {
public FilePatch convert(AbstractFilePatchInProgress o) {
return o.getPatch();
}
}), localList, null, commitContext);
appliers.add(patchApplier);
}
if (PatchApplier.executePatchGroup(appliers, localList) != ApplyPatchStatus.ABORT) {
applyAdditionalInfo(myProject, additionalInfo, commitContext);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:ApplyPatchDefaultExecutor.java
示例2: applyAdditionalInfoImpl
import com.intellij.openapi.vcs.changes.CommitContext; //导入依赖的package包/类
public static void applyAdditionalInfoImpl(final Project project,
TransparentlyFailedValueI<Map<String, Map<String, CharSequence>>, PatchSyntaxException> additionalInfo,
CommitContext commitContext, final Consumer<InfoGroup> worker) {
final PatchEP[] extensions = Extensions.getExtensions(PatchEP.EP_NAME, project);
if (extensions.length == 0) return;
if (additionalInfo != null) {
try {
final Map<String, Map<String, CharSequence>> map = additionalInfo.get();
for (Map.Entry<String, Map<String, CharSequence>> entry : map.entrySet()) {
final String path = entry.getKey();
final Map<String, CharSequence> innerMap = entry.getValue();
for (PatchEP extension : extensions) {
final CharSequence charSequence = innerMap.get(extension.getName());
if (charSequence != null) {
worker.consume(new InfoGroup(extension, path, charSequence, commitContext));
}
}
}
}
catch (PatchSyntaxException e) {
VcsBalloonProblemNotifier
.showOverChangesView(project, "Can not apply additional patch info: " + e.getMessage(), MessageType.ERROR);
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:ApplyPatchDefaultExecutor.java
示例3: apply
import com.intellij.openapi.vcs.changes.CommitContext; //导入依赖的package包/类
public Result apply(final VirtualFile fileToPatch,
final ApplyPatchContext context,
final Project project,
FilePath pathBeforeRename,
Getter<CharSequence> baseContents,
CommitContext commitContext) throws IOException {
if (LOG.isDebugEnabled()) {
LOG.debug("apply patch called for : " + fileToPatch.getPath());
}
if (myPatch.isNewFile()) {
applyCreate(project, fileToPatch, commitContext);
} else if (myPatch.isDeletedFile()) {
FileEditorManager.getInstance(project).closeFile(fileToPatch);
fileToPatch.delete(this);
}
else {
return applyChange(project, fileToPatch, pathBeforeRename, baseContents);
}
return SUCCESS;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ApplyFilePatchBase.java
示例4: applyCreate
import com.intellij.openapi.vcs.changes.CommitContext; //导入依赖的package包/类
protected void applyCreate(Project project, final VirtualFile newFile, CommitContext commitContext) throws IOException {
final Document document = FileDocumentManager.getInstance().getDocument(newFile);
if (document == null) {
throw new IOException("Failed to set contents for new file " + newFile.getPath());
}
final String charsetName = CharsetEP.getCharset(newFile.getPath(), commitContext);
if (charsetName != null) {
try {
final Charset charset = Charset.forName(charsetName);
newFile.setCharset(charset);
} catch (IllegalArgumentException e) {
//
}
}
document.setText(myPatch.getNewFileText());
FileDocumentManager.getInstance().saveDocument(document);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:ApplyTextFilePatch.java
示例5: apply
import com.intellij.openapi.vcs.changes.CommitContext; //导入依赖的package包/类
@Override
public void apply(MultiMap<VirtualFile, FilePatchInProgress> patchGroups,
LocalChangeList localList,
String fileName,
TransparentlyFailedValueI<Map<String, Map<String, CharSequence>>, PatchSyntaxException> additionalInfo) {
final Collection<PatchApplier> appliers = new LinkedList<PatchApplier>();
final CommitContext commitContext = new CommitContext();
applyAdditionalInfoBefore(myProject, additionalInfo, commitContext);
for (VirtualFile base : patchGroups.keySet()) {
final PatchApplier patchApplier =
new PatchApplier<BinaryFilePatch>(myProject, base, ObjectsConvertor.convert(patchGroups.get(base),
new Convertor<FilePatchInProgress, FilePatch>() {
public FilePatch convert(FilePatchInProgress o) {
return o.getPatch();
}
}), localList, null, commitContext);
appliers.add(patchApplier);
}
PatchApplier.executePatchGroup(appliers, localList);
applyAdditionalInfo(myProject, additionalInfo, commitContext);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:ApplyPatchDefaultExecutor.java
示例6: apply
import com.intellij.openapi.vcs.changes.CommitContext; //导入依赖的package包/类
public Result apply(final VirtualFile fileToPatch,
final ApplyPatchContext context,
final Project project,
FilePath pathBeforeRename,
Getter<CharSequence> baseContents, CommitContext commitContext) throws IOException {
if (LOG.isDebugEnabled()) {
LOG.debug("apply patch called for : " + fileToPatch.getPath());
}
context.addAffectedFile(getTarget(fileToPatch));
if (myPatch.isNewFile()) {
applyCreate(fileToPatch, commitContext);
} else if (myPatch.isDeletedFile()) {
FileEditorManagerImpl.getInstance(project).closeFile(fileToPatch);
fileToPatch.delete(this);
}
else {
return applyChange(project, fileToPatch, pathBeforeRename, baseContents);
}
return SUCCESS;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:ApplyFilePatchBase.java
示例7: applyCreate
import com.intellij.openapi.vcs.changes.CommitContext; //导入依赖的package包/类
protected void applyCreate(final VirtualFile newFile, CommitContext commitContext) throws IOException {
final Document document = FileDocumentManager.getInstance().getDocument(newFile);
if (document == null) {
throw new IOException("Failed to set contents for new file " + newFile.getPath());
}
final String charsetName = CharsetEP.getCharset(newFile.getPath(), commitContext);
if (charsetName != null) {
try {
final Charset charset = Charset.forName(charsetName);
newFile.setCharset(charset);
} catch (IllegalArgumentException e) {
//
}
}
document.setText(myPatch.getNewFileText());
FileDocumentManager.getInstance().saveDocument(document);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:ApplyTextFilePatch.java
示例8: writePatches
import com.intellij.openapi.vcs.changes.CommitContext; //导入依赖的package包/类
public static void writePatches(@Nonnull final Project project,
String fileName,
@Nullable String basePath,
List<FilePatch> patches,
CommitContext commitContext,
@Nonnull Charset charset) throws IOException {
Writer writer = new OutputStreamWriter(new FileOutputStream(fileName), charset);
try {
final String lineSeparator = CodeStyleFacade.getInstance(project).getLineSeparator();
UnifiedDiffWriter
.write(project, basePath, patches, writer, lineSeparator, Extensions.getExtensions(PatchEP.EP_NAME, project), commitContext);
}
finally {
writer.close();
}
}
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:PatchWriter.java
示例9: getPatchAppliers
import com.intellij.openapi.vcs.changes.CommitContext; //导入依赖的package包/类
@Nonnull
protected Collection<PatchApplier> getPatchAppliers(@Nonnull MultiMap<VirtualFile, AbstractFilePatchInProgress> patchGroups,
@Nullable LocalChangeList localList,
@Nonnull CommitContext commitContext) {
final Collection<PatchApplier> appliers = new LinkedList<>();
for (VirtualFile base : patchGroups.keySet()) {
appliers.add(new PatchApplier<BinaryFilePatch>(myProject, base,
ContainerUtil
.map(patchGroups.get(base), new Function<AbstractFilePatchInProgress, FilePatch>() {
@Override
public FilePatch fun(AbstractFilePatchInProgress patchInProgress) {
return patchInProgress.getPatch();
}
}), localList, null, commitContext));
}
return appliers;
}
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:ApplyPatchDefaultExecutor.java
示例10: applyAdditionalInfoImpl
import com.intellij.openapi.vcs.changes.CommitContext; //导入依赖的package包/类
private static void applyAdditionalInfoImpl(final Project project,
@Nullable ThrowableComputable<Map<String, Map<String, CharSequence>>, PatchSyntaxException> additionalInfo,
CommitContext commitContext, final Consumer<InfoGroup> worker) {
final PatchEP[] extensions = Extensions.getExtensions(PatchEP.EP_NAME, project);
if (extensions.length == 0) return;
if (additionalInfo != null) {
try {
for (Map.Entry<String, Map<String, CharSequence>> entry : additionalInfo.compute().entrySet()) {
final String path = entry.getKey();
final Map<String, CharSequence> innerMap = entry.getValue();
for (PatchEP extension : extensions) {
final CharSequence charSequence = innerMap.get(extension.getName());
if (charSequence != null) {
worker.consume(new InfoGroup(extension, path, charSequence, commitContext));
}
}
}
}
catch (PatchSyntaxException e) {
VcsBalloonProblemNotifier
.showOverChangesView(project, "Can not apply additional patch info: " + e.getMessage(), MessageType.ERROR);
}
}
}
开发者ID:consulo,项目名称:consulo,代码行数:26,代码来源:ApplyPatchDefaultExecutor.java
示例11: writeFilePatches
import com.intellij.openapi.vcs.changes.CommitContext; //导入依赖的package包/类
public static void writeFilePatches(Project p, String filePath, List<FilePatch> patches, CommitContext commitContext) throws IOException {
Writer writer = new OutputStreamWriter(new FileOutputStream(filePath));
try {
String lineSeparator = CodeStyleSettingsManager.getInstance(p).getCurrentSettings().getLineSeparator();
UnifiedDiffWriter.write(p, patches, writer, lineSeparator, commitContext);
}
finally {
writer.close();
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:PatchCreator.java
示例12: write
import com.intellij.openapi.vcs.changes.CommitContext; //导入依赖的package包/类
public static void write(Project project, Collection<FilePatch> patches, Writer writer, final String lineSeparator,
final PatchEP[] extensions, final CommitContext commitContext) throws IOException {
for(FilePatch filePatch: patches) {
if (!(filePatch instanceof TextFilePatch)) continue;
TextFilePatch patch = (TextFilePatch) filePatch;
final String path = patch.getBeforeName() == null ? patch.getAfterName() : patch.getBeforeName();
final Map<String , CharSequence> additionalMap = new HashMap<String, CharSequence>();
for (PatchEP extension : extensions) {
final CharSequence charSequence = extension.provideContent(path, commitContext);
if (! StringUtil.isEmpty(charSequence)) {
additionalMap.put(extension.getName(), charSequence);
}
}
writeFileHeading(patch, writer, lineSeparator, additionalMap);
for(PatchHunk hunk: patch.getHunks()) {
writeHunkStart(writer, hunk.getStartLineBefore(), hunk.getEndLineBefore(), hunk.getStartLineAfter(), hunk.getEndLineAfter(),
lineSeparator);
for(PatchLine line: hunk.getLines()) {
char prefixChar = ' ';
switch(line.getType()) {
case ADD: prefixChar = '+'; break;
case REMOVE: prefixChar = '-'; break;
case CONTEXT: prefixChar = ' '; break;
}
String text = line.getText();
if (text.endsWith("\n")) {
text = text.substring(0, text.length()-1);
}
writeLine(writer, text, prefixChar);
if (line.isSuppressNewLine()) {
writer.write(lineSeparator + NO_NEWLINE_SIGNATURE + lineSeparator);
}
else {
writer.write(lineSeparator);
}
}
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:40,代码来源:UnifiedDiffWriter.java
示例13: consumeContentBeforePatchApplied
import com.intellij.openapi.vcs.changes.CommitContext; //导入依赖的package包/类
@Override
public void consumeContentBeforePatchApplied(@NotNull String path,
@NotNull CharSequence content,
CommitContext commitContext) {
if (commitContext == null) return;
Map<String, String> map = commitContext.getUserData(ourStoredTexts);
if (map == null) {
map = new HashMap<String, String>();
commitContext.putUserData(ourStoredTexts, map);
}
final File file = new File(myBaseDir, path);
map.put(file.getPath(), content.toString());
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:BaseRevisionTextPatchEP.java
示例14: consumeContentBeforePatchApplied
import com.intellij.openapi.vcs.changes.CommitContext; //导入依赖的package包/类
@Override
public void consumeContentBeforePatchApplied(@NotNull String path,
@NotNull CharSequence content,
CommitContext commitContext) {
if (commitContext == null) return;
Map<String, String> map = commitContext.getUserData(ourName);
if (map == null) {
map = new HashMap<String, String>();
commitContext.putUserData(ourName, map);
}
final File file = new File(myBaseDir, path);
map.put(FilePathsHelper.convertPath(file.getPath()), content.toString());
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:CharsetEP.java
示例15: tryApplyPatch
import com.intellij.openapi.vcs.changes.CommitContext; //导入依赖的package包/类
@NotNull
private static ApplyFilePatch.Result tryApplyPatch(@Nullable final Project project,
@NotNull final ApplyFilePatchBase patch,
@Nullable final ApplyPatchContext context,
@NotNull final VirtualFile file,
@Nullable final CommitContext commitContext) {
final FilePatch patchBase = patch.getPatch();
return ApplicationManager.getApplication().runWriteAction(
new Computable<ApplyFilePatch.Result>() {
@Override
public ApplyFilePatch.Result compute() {
try {
return patch.apply(file, context, project, VcsUtil.getFilePath(file), new Getter<CharSequence>() {
@Override
public CharSequence get() {
final BaseRevisionTextPatchEP baseRevisionTextPatchEP =
Extensions.findExtension(PatchEP.EP_NAME, project, BaseRevisionTextPatchEP.class);
final String path = ObjectUtils.chooseNotNull(patchBase.getBeforeName(), patchBase.getAfterName());
return baseRevisionTextPatchEP.provideContent(path, commitContext);
}
}, commitContext);
}
catch (IOException e) {
LOG.error(e);
return ApplyFilePatch.Result.createThrow(e);
}
}
});
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:ApplyPatchAction.java
示例16: writePatches
import com.intellij.openapi.vcs.changes.CommitContext; //导入依赖的package包/类
public static void writePatches(final Project project,
String fileName,
List<FilePatch> patches,
CommitContext commitContext,
Charset charset) throws IOException {
Writer writer = new OutputStreamWriter(new FileOutputStream(fileName), charset);
try {
final String lineSeparator = CodeStyleFacade.getInstance(project).getLineSeparator();
UnifiedDiffWriter.write(project, patches, writer, lineSeparator, commitContext);
}
finally {
writer.close();
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:PatchWriter.java
示例17: applyAdditionalInfoBefore
import com.intellij.openapi.vcs.changes.CommitContext; //导入依赖的package包/类
public static void applyAdditionalInfoBefore(final Project project,
TransparentlyFailedValueI<Map<String, Map<String, CharSequence>>, PatchSyntaxException> additionalInfo,
CommitContext commitContext) {
applyAdditionalInfoImpl(project, additionalInfo, commitContext, new Consumer<InfoGroup>() {
@Override
public void consume(InfoGroup infoGroup) {
infoGroup.myPatchEP.consumeContentBeforePatchApplied(infoGroup.myPath, infoGroup.myContent, infoGroup.myCommitContext);
}
});
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:ApplyPatchDefaultExecutor.java
示例18: applyAdditionalInfo
import com.intellij.openapi.vcs.changes.CommitContext; //导入依赖的package包/类
private static void applyAdditionalInfo(final Project project,
TransparentlyFailedValueI<Map<String, Map<String, CharSequence>>, PatchSyntaxException> additionalInfo,
CommitContext commitContext) {
applyAdditionalInfoImpl(project, additionalInfo, commitContext, new Consumer<InfoGroup>() {
@Override
public void consume(InfoGroup infoGroup) {
infoGroup.myPatchEP.consumeContent(infoGroup.myPath, infoGroup.myContent, infoGroup.myCommitContext);
}
});
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:ApplyPatchDefaultExecutor.java
示例19: savePathFile
import com.intellij.openapi.vcs.changes.CommitContext; //导入依赖的package包/类
public void savePathFile(@NotNull ContentProvider contentProvider,
@NotNull final File patchPath,
@NotNull CommitContext commitContext)
throws IOException {
OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(patchPath), CharsetToolkit.UTF8_CHARSET);
try {
contentProvider.writeContentTo(writer, commitContext);
}
finally {
writer.close();
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:CompoundShelfFileProcessor.java
示例20: createHandler
import com.intellij.openapi.vcs.changes.CommitContext; //导入依赖的package包/类
@NotNull
@Override
public CheckinHandler createHandler(@NotNull final CheckinProjectPanel panel, @NotNull final CommitContext commitContext) {
return new CheckinHandler() {
@Override
public void checkinSuccessful() {
final String message = panel.getCommitMessage();
if (message != null) {
final Project project = panel.getProject();
final TaskManagerImpl manager = (TaskManagerImpl)TaskManager.getManager(project);
if (manager.getState().saveContextOnCommit) {
Task task = findTaskInRepositories(message, manager);
if (task == null) {
task = manager.createLocalTask(message);
}
final LocalTask localTask = manager.addTask(task);
localTask.setUpdated(new Date());
//noinspection SSBasedInspection
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
if (!project.isDisposed()) {
WorkingContextManager.getInstance(project).saveContext(localTask);
}
}
});
}
}
}
};
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:TaskCheckinHandlerFactory.java
注:本文中的com.intellij.openapi.vcs.changes.CommitContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论