本文整理汇总了Java中com.intellij.openapi.util.UserDataHolder类的典型用法代码示例。如果您正苦于以下问题:Java UserDataHolder类的具体用法?Java UserDataHolder怎么用?Java UserDataHolder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UserDataHolder类属于com.intellij.openapi.util包,在下文中一共展示了UserDataHolder类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: install
import com.intellij.openapi.util.UserDataHolder; //导入依赖的package包/类
public void install(@Nullable List<MergeLineFragment> fragments,
@NotNull UserDataHolder context,
@NotNull FoldingModelSupport.Settings settings) {
Iterator<int[]> it = map(fragments, new Function<MergeLineFragment, int[]>() {
@Override
public int[] fun(MergeLineFragment fragment) {
return new int[]{
fragment.getStartLine(ThreeSide.LEFT),
fragment.getEndLine(ThreeSide.LEFT),
fragment.getStartLine(ThreeSide.BASE),
fragment.getEndLine(ThreeSide.BASE),
fragment.getStartLine(ThreeSide.RIGHT),
fragment.getEndLine(ThreeSide.RIGHT)};
}
});
install(it, context, settings);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:ThreesideTextDiffViewerEx.java
示例2: install
import com.intellij.openapi.util.UserDataHolder; //导入依赖的package包/类
protected void install(@Nullable final Iterator<int[]> changedLines,
@NotNull final UserDataHolder context,
@NotNull final Settings settings) {
ApplicationManager.getApplication().assertIsDispatchThread();
if (changedLines == null) return;
if (settings.range == -1) return;
runBatchOperation(new Runnable() {
@Override
public void run() {
FoldingBuilder builder = new FoldingBuilder(context, settings);
builder.build(changedLines);
}
});
updateLineNumbers(true);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:FoldingModelSupport.java
示例3: getParameterizedCachedValue
import com.intellij.openapi.util.UserDataHolder; //导入依赖的package包/类
public <T, D extends UserDataHolder, P> T getParameterizedCachedValue(@NotNull D dataHolder,
@NotNull Key<ParameterizedCachedValue<T,P>> key,
@NotNull ParameterizedCachedValueProvider<T, P> provider,
boolean trackValue,
P parameter) {
ParameterizedCachedValue<T,P> value;
if (dataHolder instanceof UserDataHolderEx) {
UserDataHolderEx dh = (UserDataHolderEx)dataHolder;
value = dh.getUserData(key);
if (value == null) {
value = createParameterizedCachedValue(provider, trackValue);
value = dh.putUserDataIfAbsent(key, value);
}
}
else {
synchronized (dataHolder) {
value = dataHolder.getUserData(key);
if (value == null) {
value = createParameterizedCachedValue(provider, trackValue);
dataHolder.putUserData(key, value);
}
}
}
return value.getValue(parameter);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:CachedValuesManager.java
示例4: checkProvider
import com.intellij.openapi.util.UserDataHolder; //导入依赖的package包/类
static void checkProvider(CachedValueProvider provider, UserDataHolder userDataHolder) {
if (!DO_CHECKS) return;
Class<? extends CachedValueProvider> providerClass = provider.getClass();
if (!ourCheckedClasses.add(providerClass)) return;
for (Field field : providerClass.getDeclaredFields()) {
try {
field.setAccessible(true);
Object o = field.get(provider);
if (o instanceof PsiElement && o != userDataHolder) {
LOG.error("Incorrect CachedValue use. Provider references PSI, causing memory leaks and possible invalid element access: field " + field.getName() + " of " + provider);
return;
}
}
catch (IllegalAccessException e) {
LOG.error(e);
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:CachedValueChecker.java
示例5: getDiffRequestProducers
import com.intellij.openapi.util.UserDataHolder; //导入依赖的package包/类
@NotNull
@Override
public DiffRequestProducer getDiffRequestProducers(final Project project, final PatchReader baseContents) {
final ShelvedBinaryFile file = getPatch().getShelvedBinaryFile();
return new DiffRequestProducer() {
@NotNull
@Override
public DiffRequest process(@NotNull UserDataHolder context, @NotNull ProgressIndicator indicator)
throws DiffRequestProducerException, ProcessCanceledException {
Change change = file.createChange(project);
return PatchDiffRequestFactory.createDiffRequest(project, change, getName(), context, indicator);
}
@NotNull
@Override
public String getName() {
final File file1 = new File(VfsUtilCore.virtualToIoFile(getBase()),
file.AFTER_PATH == null ? file.BEFORE_PATH : file.AFTER_PATH);
return FileUtil.toSystemDependentName(file1.getPath());
}
};
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:BinaryFilePatchInProgress.java
示例6: processBinaryFiles
import com.intellij.openapi.util.UserDataHolder; //导入依赖的package包/类
private static void processBinaryFiles(@NotNull final Project project,
@NotNull List<ShelvedBinaryFile> files,
@NotNull List<MyDiffRequestProducer> diffRequestProducers) {
final String base = project.getBaseDir().getPath();
for (final ShelvedBinaryFile shelvedChange : files) {
diffRequestProducers.add(new MyDiffRequestProducer(shelvedChange) {
@NotNull
@Override
public DiffRequest process(@NotNull UserDataHolder context, @NotNull ProgressIndicator indicator)
throws DiffRequestProducerException, ProcessCanceledException {
Change change = shelvedChange.createChange(project);
return PatchDiffRequestFactory.createDiffRequest(project, change, getName(), context, indicator);
}
@NotNull
@Override
public FilePath getFilePath() {
final File file = new File(base, shelvedChange.AFTER_PATH == null ? shelvedChange.BEFORE_PATH : shelvedChange.AFTER_PATH);
return VcsUtil.getFilePath(file);
}
});
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:DiffShelvedChangesAction.java
示例7: findData
import com.intellij.openapi.util.UserDataHolder; //导入依赖的package包/类
/**
* Search for data in dataholder or members of union recursively
* @param type start point
* @param key key to search
* @param <T> result tyoe
* @return data or null if not found
*/
@Nullable
public static <T> T findData(@NotNull final PyType type, @NotNull final Key<T> key) {
if (type instanceof UserDataHolder) {
return ((UserDataHolder)type).getUserData(key);
}
if (type instanceof PyUnionType) {
for (final PyType memberType : ((PyUnionType)type).getMembers()) {
if (memberType == null) {
continue;
}
final T result = findData(memberType, key);
if (result != null) {
return result;
}
}
}
return null;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:PyTypeUtil.java
示例8: install
import com.intellij.openapi.util.UserDataHolder; //导入依赖的package包/类
public void install(@Nullable List<MergeLineFragment> fragments,
@Nonnull UserDataHolder context,
@Nonnull FoldingModelSupport.Settings settings) {
Iterator<int[]> it = map(fragments, new Function<MergeLineFragment, int[]>() {
@Override
public int[] fun(MergeLineFragment fragment) {
return new int[]{
fragment.getStartLine(ThreeSide.LEFT),
fragment.getEndLine(ThreeSide.LEFT),
fragment.getStartLine(ThreeSide.BASE),
fragment.getEndLine(ThreeSide.BASE),
fragment.getStartLine(ThreeSide.RIGHT),
fragment.getEndLine(ThreeSide.RIGHT)};
}
});
install(it, context, settings);
}
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:ThreesideTextDiffViewerEx.java
示例9: install
import com.intellij.openapi.util.UserDataHolder; //导入依赖的package包/类
protected void install(@javax.annotation.Nullable final Iterator<int[]> changedLines,
@Nonnull final UserDataHolder context,
@Nonnull final Settings settings) {
ApplicationManager.getApplication().assertIsDispatchThread();
if (changedLines == null) return;
if (settings.range == -1) return;
runBatchOperation(new Runnable() {
@Override
public void run() {
FoldingBuilder builder = new FoldingBuilder(context, settings);
builder.build(changedLines);
}
});
updateLineNumbers(true);
}
开发者ID:consulo,项目名称:consulo,代码行数:19,代码来源:FoldingModelSupport.java
示例10: getParameterizedCachedValue
import com.intellij.openapi.util.UserDataHolder; //导入依赖的package包/类
public <T, D extends UserDataHolder, P> T getParameterizedCachedValue(@Nonnull D dataHolder,
@Nonnull Key<ParameterizedCachedValue<T, P>> key,
@Nonnull ParameterizedCachedValueProvider<T, P> provider,
boolean trackValue,
P parameter) {
ParameterizedCachedValue<T, P> value;
if (dataHolder instanceof UserDataHolderEx) {
UserDataHolderEx dh = (UserDataHolderEx)dataHolder;
value = dh.getUserData(key);
if (value == null) {
value = createParameterizedCachedValue(provider, trackValue);
value = dh.putUserDataIfAbsent(key, value);
}
}
else {
synchronized (dataHolder) {
value = dataHolder.getUserData(key);
if (value == null) {
value = createParameterizedCachedValue(provider, trackValue);
dataHolder.putUserData(key, value);
}
}
}
return value.getValue(parameter);
}
开发者ID:consulo,项目名称:consulo,代码行数:27,代码来源:CachedValuesManager.java
示例11: AttachItem
import com.intellij.openapi.util.UserDataHolder; //导入依赖的package包/类
public AttachItem(@Nonnull XLocalAttachGroup group,
boolean isFirstInGroup,
@Nonnull String groupName,
@Nonnull ProcessInfo info,
@Nonnull List<XLocalAttachDebugger> debuggers,
int selectedDebugger,
@Nonnull UserDataHolder dataHolder) {
myGroupName = groupName;
myDataHolder = dataHolder;
assert !debuggers.isEmpty() : "debugger list should not be empty";
assert selectedDebugger >= 0 && selectedDebugger < debuggers.size() : "wrong selected debugger index";
myGroup = group;
myIsFirstInGroup = isFirstInGroup;
myProcessInfo = info;
myDebuggers = debuggers;
mySelectedDebugger = selectedDebugger;
if (debuggers.size() > 1) {
mySubItems = ContainerUtil.map(debuggers, debugger -> new AttachItem(myGroup, false, myProcessInfo, Collections.singletonList(debugger), dataHolder));
}
else {
mySubItems = Collections.emptyList();
}
}
开发者ID:consulo,项目名称:consulo,代码行数:26,代码来源:AttachToLocalProcessAction.java
示例12: getDiffRequestProducers
import com.intellij.openapi.util.UserDataHolder; //导入依赖的package包/类
@Nonnull
@Override
public DiffRequestProducer getDiffRequestProducers(final Project project, final PatchReader baseContents) {
final ShelvedBinaryFile file = getPatch().getShelvedBinaryFile();
return new DiffRequestProducer() {
@Nonnull
@Override
public DiffRequest process(@Nonnull UserDataHolder context, @Nonnull ProgressIndicator indicator)
throws DiffRequestProducerException, ProcessCanceledException {
Change change = file.createChange(project);
return PatchDiffRequestFactory.createDiffRequest(project, change, getName(), context, indicator);
}
@Nonnull
@Override
public String getName() {
final File file1 = new File(VfsUtilCore.virtualToIoFile(getBase()),
file.AFTER_PATH == null ? file.BEFORE_PATH : file.AFTER_PATH);
return FileUtil.toSystemDependentName(file1.getPath());
}
};
}
开发者ID:consulo,项目名称:consulo,代码行数:23,代码来源:BinaryFilePatchInProgress.java
示例13: processBinaryFiles
import com.intellij.openapi.util.UserDataHolder; //导入依赖的package包/类
private static void processBinaryFiles(@Nonnull final Project project,
@Nonnull List<ShelvedBinaryFile> files,
@Nonnull List<MyDiffRequestProducer> diffRequestProducers) {
final String base = project.getBaseDir().getPath();
for (final ShelvedBinaryFile shelvedChange : files) {
final File file = new File(base, shelvedChange.AFTER_PATH == null ? shelvedChange.BEFORE_PATH : shelvedChange.AFTER_PATH);
final FilePath filePath = VcsUtil.getFilePath(file);
diffRequestProducers.add(new MyDiffRequestProducer(shelvedChange, filePath) {
@Nonnull
@Override
public DiffRequest process(@Nonnull UserDataHolder context, @Nonnull ProgressIndicator indicator)
throws DiffRequestProducerException, ProcessCanceledException {
Change change = shelvedChange.createChange(project);
return PatchDiffRequestFactory.createDiffRequest(project, change, getName(), context, indicator);
}
});
}
}
开发者ID:consulo,项目名称:consulo,代码行数:19,代码来源:DiffShelvedChangesAction.java
示例14: addTrace
import com.intellij.openapi.util.UserDataHolder; //导入依赖的package包/类
private void addTrace(@Nullable PsiClassStub stub)
{
if(ourTraceStubAstBinding)
{
String creationTrace = "Creation thread: " + Thread.currentThread() + "\n" + DebugUtil.currentStackTrace();
if(stub != null)
{
creationTrace += "\nfrom stub " + stub + "@" + System.identityHashCode(stub) + "\n";
if(stub instanceof UserDataHolder)
{
String stubTrace = ((UserDataHolder) stub).getUserData(CREATION_TRACE);
if(stubTrace != null)
{
creationTrace += stubTrace;
}
}
}
putUserData(CREATION_TRACE, creationTrace);
}
}
开发者ID:consulo,项目名称:consulo-java,代码行数:21,代码来源:PsiClassImpl.java
示例15: addTrace
import com.intellij.openapi.util.UserDataHolder; //导入依赖的package包/类
private void addTrace(@Nullable PsiClassStub stub) {
if (ourTraceStubAstBinding) {
String creationTrace = "Creation thread: " + Thread.currentThread() + "\n" + DebugUtil.currentStackTrace();
if (stub != null) {
creationTrace += "\nfrom stub " + stub + "@" + System.identityHashCode(stub) + "\n";
if (stub instanceof UserDataHolder) {
String stubTrace = ((UserDataHolder)stub).getUserData(CREATION_TRACE);
if (stubTrace != null) {
creationTrace += stubTrace;
}
}
}
putUserData(CREATION_TRACE, creationTrace);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:PsiClassImpl.java
示例16: ProjectConfigurableContext
import com.intellij.openapi.util.UserDataHolder; //导入依赖的package包/类
public ProjectConfigurableContext(final @NotNull Facet facet, final boolean isNewFacet,
@Nullable FacetEditorContext parentContext,
final ModuleConfigurationState state, final UserDataHolder sharedModuleData,
final UserDataHolder sharedProjectData) {
super(facet, parentContext, state.getFacetsProvider(), state.getModulesProvider(), sharedModuleData, sharedProjectData);
myModuleConfigurationState = state;
myNewFacet = isNewFacet;
myModule = facet.getModule();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:ProjectConfigurableContext.java
示例17: FacetEditorContextBase
import com.intellij.openapi.util.UserDataHolder; //导入依赖的package包/类
public FacetEditorContextBase(@NotNull Facet facet, final @Nullable FacetEditorContext parentContext, final @Nullable FacetsProvider facetsProvider,
final @NotNull ModulesProvider modulesProvider,
final UserDataHolder sharedModuleData,
final UserDataHolder sharedProjectData) {
myFacet = facet;
mySharedProjectData = sharedProjectData;
mySharedModuleData = sharedModuleData;
myParentContext = parentContext;
myModulesProvider = modulesProvider;
myFacetsProvider = facetsProvider != null ? facetsProvider : DefaultFacetsProvider.INSTANCE;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:FacetEditorContextBase.java
示例18: getContextRefElements
import com.intellij.openapi.util.UserDataHolder; //导入依赖的package包/类
public Collection<?> getContextRefElements(final String typeQName) {
final Collection<PsiVariable> variables = getVariables(typeQName);
final Collection<PsiMethod> containingClassMethods = getContainingClassMethods(typeQName);
final Collection<UserDataHolder> refElements = new ArrayList<UserDataHolder>(variables.size() + containingClassMethods.size());
refElements.addAll(variables);
refElements.addAll(containingClassMethods);
for (final ContextRelevantVariableGetter contextRelevantVariableGetter : getRelevantVariablesGetters(typeQName)) {
refElements.add(contextRelevantVariableGetter.createLookupElement());
}
return refElements;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:ChainCompletionContext.java
示例19: install
import com.intellij.openapi.util.UserDataHolder; //导入依赖的package包/类
public void install(@Nullable List<LineRange> changedLines,
@NotNull UserDataHolder context,
@NotNull FoldingModelSupport.Settings settings) {
Iterator<int[]> it = map(changedLines, new Function<LineRange, int[]>() {
@Override
public int[] fun(LineRange line) {
return new int[]{
line.start,
line.end};
}
});
install(it, context, settings);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:UnifiedDiffViewer.java
示例20: install
import com.intellij.openapi.util.UserDataHolder; //导入依赖的package包/类
public void install(@Nullable final List<LineFragment> fragments,
@NotNull UserDataHolder context,
@NotNull FoldingModelSupport.Settings settings) {
Iterator<int[]> it = map(fragments, new Function<LineFragment, int[]>() {
@Override
public int[] fun(LineFragment fragment) {
return new int[]{
fragment.getStartLine1(),
fragment.getEndLine1(),
fragment.getStartLine2(),
fragment.getEndLine2()};
}
});
install(it, context, settings);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:SimpleDiffViewer.java
注:本文中的com.intellij.openapi.util.UserDataHolder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论