本文整理汇总了Java中com.intellij.util.ObjectUtil类的典型用法代码示例。如果您正苦于以下问题:Java ObjectUtil类的具体用法?Java ObjectUtil怎么用?Java ObjectUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ObjectUtil类属于com.intellij.util包,在下文中一共展示了ObjectUtil类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: resolveTypeForParameter
import com.intellij.util.ObjectUtil; //导入依赖的package包/类
@NotNull
@RequiredReadAction
public static DotNetTypeRef resolveTypeForParameter(CSharpLambdaExpressionImpl target, int parameterIndex)
{
CSharpLambdaResolveResult leftTypeRef = resolveLeftLambdaTypeRef(target);
if(leftTypeRef == null)
{
return DotNetTypeRef.ERROR_TYPE;
}
if(leftTypeRef == CSharpUndefinedLambdaResolveResult.INSTANCE)
{
return DotNetTypeRef.UNKNOWN_TYPE;
}
DotNetTypeRef[] leftTypeParameters = leftTypeRef.getParameterTypeRefs();
DotNetTypeRef typeRef = ArrayUtil2.safeGet(leftTypeParameters, parameterIndex);
return ObjectUtil.notNull(typeRef, DotNetTypeRef.ERROR_TYPE);
}
开发者ID:consulo,项目名称:consulo-csharp,代码行数:19,代码来源:CSharpLambdaExpressionImplUtil.java
示例2: checkImpl
import com.intellij.util.ObjectUtil; //导入依赖的package包/类
@RequiredReadAction
@Nullable
@Override
public HighlightInfoFactory checkImpl(@NotNull CSharpLanguageVersion languageVersion, @NotNull CSharpHighlightContext highlightContext, @NotNull CSharpMethodDeclaration element)
{
DotNetParameter[] parameters = element.getParameters();
if(parameters.length > 0 && parameters[0].hasModifier(CSharpModifier.THIS))
{
PsiElement parent = element.getParent();
if(parent instanceof CSharpTypeDeclaration)
{
if(((CSharpTypeDeclaration) parent).getGenericParametersCount() > 0 || !((CSharpTypeDeclaration) parent).hasModifier(DotNetModifier.STATIC))
{
return newBuilder(ObjectUtil.notNull(element.getNameIdentifier(), element), formatElement(element));
}
}
}
return super.checkImpl(languageVersion, highlightContext, element);
}
开发者ID:consulo,项目名称:consulo-csharp,代码行数:20,代码来源:CS1106.java
示例3: checkImpl
import com.intellij.util.ObjectUtil; //导入依赖的package包/类
@RequiredReadAction
@Nullable
@Override
public HighlightInfoFactory checkImpl(@NotNull CSharpLanguageVersion languageVersion, @NotNull CSharpHighlightContext highlightContext, @NotNull DotNetModifierListOwner element)
{
PsiElement parent = element.getParent();
if(parent instanceof DotNetTypeDeclaration && ((DotNetTypeDeclaration) parent).hasModifier(DotNetModifier.STATIC))
{
if(CSharpPsiUtilImpl.isTypeLikeElement(element))
{
return null;
}
if(!element.hasModifier(DotNetModifier.STATIC))
{
PsiElement nameIdentifier = ((PsiNameIdentifierOwner) element).getNameIdentifier();
return newBuilder(ObjectUtil.notNull(nameIdentifier, element), formatElement(element)).addQuickFix(new AddModifierFix
(DotNetModifier.STATIC, element));
}
}
return null;
}
开发者ID:consulo,项目名称:consulo-csharp,代码行数:22,代码来源:CS0708.java
示例4: getDocument
import com.intellij.util.ObjectUtil; //导入依赖的package包/类
@Override
@SuppressWarnings({"EmptyCatchBlock"})
@Nullable
public Document getDocument() {
if (myDocument == null) {
if (isBinary()) return null;
String text = null;
try {
Charset charset = ObjectUtil
.notNull(myCharset, EncodingProjectManager.getInstance(myProject).getDefaultCharset());
text = CharsetToolkit.bytesToString(myBytes, charset);
}
catch (IllegalCharsetNameException e) {
}
// Still NULL? only if not supported or an exception was thrown.
// Decode a string using the truly default encoding.
if (text == null) text = new String(myBytes);
text = LineTokenizer.correctLineSeparators(text);
myDocument = EditorFactory.getInstance().createDocument(text);
myDocument.setReadOnly(true);
}
return myDocument;
}
开发者ID:consulo,项目名称:consulo,代码行数:27,代码来源:BinaryContent.java
示例5: show
import com.intellij.util.ObjectUtil; //导入依赖的package包/类
@Messages.YesNoCancelResult
public int show() {
String yesText = ObjectUtil.chooseNotNull(myYesText, Messages.YES_BUTTON);
String noText = ObjectUtil.chooseNotNull(myNoText, Messages.NO_BUTTON);
String cancelText = ObjectUtil.chooseNotNull(myCancelText, Messages.CANCEL_BUTTON);
try {
if (Messages.canShowMacSheetPanel() && !Messages.isApplicationInUnitTestOrHeadless()) {
return MacMessages.getInstance().showYesNoCancelDialog(myTitle, myMessage, yesText, noText, cancelText, WindowManager.getInstance().suggestParentWindow(myProject), myDoNotAskOption);
}
}
catch (Exception ignored) {}
int buttonNumber = Messages.showDialog(myProject, myMessage, myTitle, new String[]{yesText, noText, cancelText}, 0, myIcon, myDoNotAskOption);
return buttonNumber == 0 ? Messages.YES : buttonNumber == 1 ? Messages.NO : Messages.CANCEL;
}
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:MessageDialogBuilder.java
示例6: processKeyEvent
import com.intellij.util.ObjectUtil; //导入依赖的package包/类
@Override
protected void processKeyEvent(KeyEvent e){
if (!myProcessCursorKeys) {
super.processKeyEvent(e);
return;
}
int keyCode = e.getKeyCode();
final int selColumn = columnModel.getSelectionModel().getAnchorSelectionIndex();
boolean treeHasFocus = selColumn == -1 || selColumn >= 0 && isTreeColumn(selColumn);
boolean oneRowSelected = getSelectedRowCount() == 1;
if(treeHasFocus && oneRowSelected && ((keyCode == KeyEvent.VK_LEFT) || (keyCode == KeyEvent.VK_RIGHT))){
myTree._processKeyEvent(e);
int rowToSelect = ObjectUtil.notNull(myTree.getSelectionRows())[0];
getSelectionModel().setSelectionInterval(rowToSelect, rowToSelect);
TableUtil.scrollSelectionToVisible(this);
}
else{
super.processKeyEvent(e);
}
}
开发者ID:consulo,项目名称:consulo,代码行数:22,代码来源:TreeTable.java
示例7: update
import com.intellij.util.ObjectUtil; //导入依赖的package包/类
@RequiredDispatchThread
@Override
public void update(@Nonnull AnActionEvent e) {
if (!EarlyAccessProgramManager.is(ServiceAuthEarlyAccessProgramDescriptor.class)) {
e.getPresentation().setEnabledAndVisible(false);
return;
}
ServiceAuthConfiguration configuration = ServiceAuthConfiguration.getInstance();
Presentation presentation = e.getPresentation();
String email = configuration.getEmail();
if (email == null) {
presentation.setText("Logged as anonymous");
presentation.setIcon(AllIcons.Actions.LoginAvator);
}
else {
presentation.setText("Logged as '" + email + "'");
Icon userIcon = configuration.getUserIcon();
presentation.setIcon(ObjectUtil.notNull(userIcon, AllIcons.Actions.LoginAvator));
}
}
开发者ID:consulo,项目名称:consulo,代码行数:25,代码来源:LoginAction.java
示例8: replaceWatchedRoots
import com.intellij.util.ObjectUtil; //导入依赖的package包/类
@Nonnull
@Override
public Set<WatchRequest> replaceWatchedRoots(@Nonnull Collection<WatchRequest> watchRequests,
@Nullable Collection<String> recursiveRoots,
@Nullable Collection<String> flatRoots) {
recursiveRoots = ObjectUtil.notNull(recursiveRoots, Collections.emptyList());
flatRoots = ObjectUtil.notNull(flatRoots, Collections.emptyList());
Set<WatchRequest> result = new HashSet<>();
synchronized (myLock) {
boolean update = doAddRootsToWatch(recursiveRoots, flatRoots, result) |
doRemoveWatchedRoots(watchRequests);
if (update) {
myNormalizedTree = null;
setUpFileWatcher();
}
}
return result;
}
开发者ID:consulo,项目名称:consulo,代码行数:20,代码来源:LocalFileSystemImpl.java
示例9: getData
import com.intellij.util.ObjectUtil; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public <T> T getData(@Nonnull Key<T> dataId) {
int currentEventCount = IdeEventQueue.getInstance().getEventCount();
if (myEventCount != -1 && myEventCount != currentEventCount) {
LOG.error("cannot share data context between Swing events; initial event count = " + myEventCount + "; current event count = " + currentEventCount);
return doGetData(dataId);
}
if (ourSafeKeys.contains(dataId)) {
Object answer = myCachedData.get(dataId);
if (answer == null) {
answer = doGetData(dataId);
myCachedData.put(dataId, answer == null ? ObjectUtil.NULL : answer);
}
return answer != ObjectUtil.NULL ? (T)answer : null;
}
else {
return doGetData(dataId);
}
}
开发者ID:consulo,项目名称:consulo,代码行数:22,代码来源:DataManagerImpl.java
示例10: invoke
import com.intellij.util.ObjectUtil; //导入依赖的package包/类
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
if (method.getDeclaringClass() == Object.class) {
return method.invoke(myRemote, args);
}
else {
Method m = ourRemoteToLocalMap.get(Pair.<Class<?>, Class<?>>create(myRemote.getClass(), myClazz)).get(method);
if (m == null) throw new NoSuchMethodError(method.getName() + " in " + myRemote.getClass());
try {
return handleRemoteResult(m.invoke(myRemote, args), method.getReturnType(), myLoader, false);
}
catch (InvocationTargetException e) {
Throwable cause = e.getCause(); // root cause may go deeper than we need, so leave it like this
if (cause instanceof ServerError) cause = ObjectUtil.chooseNotNull(cause.getCause(), cause);
if (cause instanceof RuntimeException) throw cause;
if (cause instanceof Error) throw cause;
if (canThrow(cause, method)) throw cause;
throw new RuntimeException(cause);
}
}
}
开发者ID:consulo,项目名称:consulo,代码行数:21,代码来源:RemoteUtil.java
示例11: findPackage
import com.intellij.util.ObjectUtil; //导入依赖的package包/类
@RequiredReadAction
@Nullable
@Override
public PsiPackage findPackage(@Nonnull String qualifiedName, @Nonnull Class<? extends ModuleExtension> extensionClass) {
ConcurrentMap<String, Object> map = myPackageCache.get(extensionClass);
if (map != null) {
final Object value = map.get(qualifiedName);
// if we processed - but not found package
if (value == ObjectUtil.NULL) {
return null;
}
else if (value != null) {
return (PsiPackage)value;
}
}
PsiPackage newPackage = createPackage(qualifiedName, extensionClass);
Object valueForInsert = ObjectUtil.notNull(newPackage, ObjectUtil.NULL);
myPackageCache.computeIfAbsent(extensionClass, aClass -> ContainerUtil.newConcurrentMap()).putIfAbsent(qualifiedName, valueForInsert);
return newPackage;
}
开发者ID:consulo,项目名称:consulo,代码行数:25,代码来源:PsiPackageManagerImpl.java
示例12: calculateRoot
import com.intellij.util.ObjectUtil; //导入依赖的package包/类
private Object calculateRoot(DataContext dataContext) {
// Narrow down the root element to the first interesting one
Object root = dataContext.getData(LangDataKeys.MODULE);
if (root != null) return root;
Project project = dataContext.getData(CommonDataKeys.PROJECT);
if (project == null) return null;
Object projectChild;
Object projectGrandChild = null;
CommonProcessors.FindFirstAndOnlyProcessor<Object> processor = new CommonProcessors.FindFirstAndOnlyProcessor<>();
processChildren(project, processor);
projectChild = processor.reset();
if (projectChild != null) {
processChildren(projectChild, processor);
projectGrandChild = processor.reset();
}
return ObjectUtil.chooseNotNull(projectGrandChild, ObjectUtil.chooseNotNull(projectChild, project));
}
开发者ID:consulo,项目名称:consulo,代码行数:21,代码来源:NavBarModel.java
示例13: getJsonGetPropertyName
import com.intellij.util.ObjectUtil; //导入依赖的package包/类
@Nullable
public static String getJsonGetPropertyName(@NotNull Method method)
{
JomPropertyGetter annotation = method.getAnnotation(JomPropertyGetter.class);
if(annotation == null)
{
return null;
}
String propertyName = StringUtil.getPropertyName(method.getName());
propertyName = ObjectUtil.notNull(propertyName, method.getName());
if(!StringUtil.isEmpty(annotation.value()))
{
propertyName = annotation.value();
}
return propertyName;
}
开发者ID:consulo,项目名称:consulo-javascript,代码行数:18,代码来源:JomUtil.java
示例14: createAlternativeJdk
import com.intellij.util.ObjectUtil; //导入依赖的package包/类
private static Sdk createAlternativeJdk(@NotNull String jreHome) throws CantRunException
{
final Sdk configuredJdk = SdkTable.getInstance().findSdk(jreHome);
if(configuredJdk != null)
{
return configuredJdk;
}
if(!OwnJdkUtil.checkForJre(jreHome))
{
throw new CantRunException(JavaExecutionBundle.message("jre.path.is.not.valid.jre.home.error.message", jreHome));
}
final JavaSdk javaSdk = JavaSdk.getInstance();
return javaSdk.createJdk(ObjectUtil.notNull(javaSdk.getVersionString(jreHome), ""), jreHome);
}
开发者ID:consulo,项目名称:consulo-java,代码行数:17,代码来源:JavaParametersUtil.java
示例15: getGUID
import com.intellij.util.ObjectUtil; //导入依赖的package包/类
@Nullable
@RequiredReadAction
public String getGUID(@NotNull VirtualFile virtualFile)
{
String name = virtualFile.getName();
VirtualFile parent = virtualFile.getParent();
if(parent == null)
{
return null;
}
int targetId = FileBasedIndex.getFileId(virtualFile);
Object o = myGUIDs.computeIfAbsent(targetId, integer ->
{
VirtualFile child = parent.findChild(name + "." + Unity3dMetaFileType.INSTANCE.getDefaultExtension());
if(child != null)
{
String guid = null;
PsiFile file = PsiManager.getInstance(myProject).findFile(child);
if(file instanceof YAMLFile)
{
guid = Unity3dMetaIndexExtension.findGUIDFromFile((YAMLFile) file);
}
return guid == null ? ObjectUtil.NULL : guid;
}
return ObjectUtil.NULL;
});
return o instanceof String ? (String) o : null;
}
开发者ID:consulo,项目名称:consulo-unity3d,代码行数:32,代码来源:Unity3dMetaManager.java
示例16: findExtensionMethodGroupByName
import com.intellij.util.ObjectUtil; //导入依赖的package包/类
@RequiredReadAction
@Nullable
@Override
@SuppressWarnings("unchecked")
public CSharpElementGroup<CSharpMethodDeclaration> findExtensionMethodGroupByName(@NotNull String name)
{
Object o = myExtensionGroups.get(name);
return o == ObjectUtil.NULL ? null : (CSharpElementGroup<CSharpMethodDeclaration>) o;
}
开发者ID:consulo,项目名称:consulo-csharp,代码行数:10,代码来源:CSharpNamespaceResolveContext.java
示例17: getName
import com.intellij.util.ObjectUtil; //导入依赖的package包/类
@RequiredReadAction
@NotNull
@Override
public String getName()
{
String assemblyTitle = DotNetAssemblyUtil.getAssemblyTitle(myModule);
return ObjectUtil.notNull(assemblyTitle, myModule.getName());
}
开发者ID:consulo,项目名称:consulo-csharp,代码行数:9,代码来源:ConsuloModuleAsAssemblyModule.java
示例18: selectCompositeOrSelfType
import com.intellij.util.ObjectUtil; //导入依赖的package包/类
@RequiredReadAction
@NotNull
public static DotNetTypeDeclaration selectCompositeOrSelfType(@NotNull DotNetTypeDeclaration parent)
{
if(parent.hasModifier(CSharpModifier.PARTIAL))
{
CSharpCompositeTypeDeclaration compositeType = findCompositeType((CSharpTypeDeclaration) parent);
return ObjectUtil.notNull(compositeType, parent);
}
return parent;
}
开发者ID:consulo,项目名称:consulo-csharp,代码行数:12,代码来源:CSharpCompositeTypeDeclaration.java
示例19: findCompositeType
import com.intellij.util.ObjectUtil; //导入依赖的package包/类
@RequiredReadAction
@Nullable
public static CSharpCompositeTypeDeclaration findCompositeType(@NotNull CSharpTypeDeclaration parent)
{
Object cachedValue = CachedValuesManager.getCachedValue(parent, () -> CachedValueProvider.Result.create(findCompositeTypeImpl(parent), PsiModificationTracker
.OUT_OF_CODE_BLOCK_MODIFICATION_COUNT));
return cachedValue == ObjectUtil.NULL ? null : (CSharpCompositeTypeDeclaration) cachedValue;
}
开发者ID:consulo,项目名称:consulo-csharp,代码行数:9,代码来源:CSharpCompositeTypeDeclaration.java
示例20: checkImpl
import com.intellij.util.ObjectUtil; //导入依赖的package包/类
@RequiredReadAction
@Nullable
@Override
public HighlightInfoFactory checkImpl(@NotNull CSharpLanguageVersion languageVersion, @NotNull CSharpHighlightContext highlightContext, @NotNull CSharpMethodDeclaration element)
{
DotNetParameter[] parameters = element.getParameters();
if(parameters.length > 0 && parameters[0].hasModifier(CSharpModifier.THIS))
{
if(!element.hasModifier(DotNetModifier.STATIC))
{
return newBuilder(ObjectUtil.notNull(element.getNameIdentifier(), element), formatElement(element));
}
}
return null;
}
开发者ID:consulo,项目名称:consulo-csharp,代码行数:16,代码来源:CS1105.java
注:本文中的com.intellij.util.ObjectUtil类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论