本文整理汇总了Java中com.intellij.util.ObjectUtil.notNull方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectUtil.notNull方法的具体用法?Java ObjectUtil.notNull怎么用?Java ObjectUtil.notNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.util.ObjectUtil
的用法示例。
在下文中一共展示了ObjectUtil.notNull方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例2: 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;
}
示例3: 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);
}
}
示例4: 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;
}
示例5: 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;
}
示例6: 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;
}
示例7: getName
import com.intellij.util.ObjectUtil; //导入方法依赖的package包/类
@RequiredReadAction
@NotNull
@Override
public String getName()
{
String assemblyTitle = DotNetAssemblyUtil.getAssemblyTitle(myModule);
return ObjectUtil.notNull(assemblyTitle, myModule.getName());
}
示例8: 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;
}
示例9: computeChildren
import com.intellij.util.ObjectUtil; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public void computeChildren(@NotNull UserDataHolderBase dataHolder,
@NotNull DotNetDebugContext debugContext,
@NotNull DotNetAbstractVariableValueNode parentNode,
@NotNull DotNetStackFrameProxy frameProxy,
@Nullable DotNetValueProxy oldValue,
@NotNull XCompositeNode node)
{
if(oldValue == null || !isMyValue(oldValue))
{
node.setErrorMessage("No value");
return;
}
T value = (T) oldValue;
final int length = getSize(value);
final int startIndex = ObjectUtil.notNull(dataHolder.getUserData(ourLastIndex), 0);
XValueChildrenList childrenList = new XValueChildrenList();
int max = Math.min(startIndex + XCompositeNode.MAX_CHILDREN_TO_SHOW, length);
for(int i = startIndex; i < max; i++)
{
childrenList.add(createChildValue(i, debugContext, frameProxy, value));
}
dataHolder.putUserData(ourLastIndex, max);
node.addChildren(childrenList, true);
if(length > max)
{
node.tooManyChildren(length - max);
}
}
示例10: processLanguageSubstitution
import com.intellij.util.ObjectUtil; //导入方法依赖的package包/类
private static void processLanguageSubstitution(@Nonnull final VirtualFile file,
@Nonnull Language originalLang,
@Nonnull final Language substitutedLang) {
if (file instanceof VirtualFileWindow) {
// Injected files are created with substituted language, no need to reparse:
// com.intellij.psi.impl.source.tree.injected.MultiHostRegistrarImpl#doneInjecting
return;
}
Language prevSubstitutedLang = SUBSTITUTED_LANG_KEY.get(file);
final Language prevLang = ObjectUtil.notNull(prevSubstitutedLang, originalLang);
if (!prevLang.is(substitutedLang)) {
if (file.replace(SUBSTITUTED_LANG_KEY, prevSubstitutedLang, substitutedLang)) {
if (prevSubstitutedLang == null) {
return; // no need to reparse for the first language substitution
}
if (ApplicationManager.getApplication().isUnitTestMode()) {
return;
}
file.putUserData(REPARSING_SCHEDULED, true);
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
if (file.replace(REPARSING_SCHEDULED, true, null)) {
LOG.info("Reparsing " + file.getPath() + " because of language substitution " +
prevLang.getID() + "->" + substitutedLang.getID());
FileContentUtilCore.reparseFiles(file);
}
}
}, ModalityState.defaultModalityState());
}
}
}
示例11: getStripeTitle
import com.intellij.util.ObjectUtil; //导入方法依赖的package包/类
@RequiredUIAccess
@Override
@Nonnull
public final String getStripeTitle() {
UIAccess.assertIsUIThread();
return ObjectUtil.notNull(myStripeTitle, myId);
}
示例12: getIcon
import com.intellij.util.ObjectUtil; //导入方法依赖的package包/类
@Nonnull
public static Icon getIcon(@Nullable Sdk sdk) {
if (sdk == null) {
return AllIcons.Toolbar.Unknown;
}
SdkType sdkType = (SdkType)sdk.getSdkType();
Icon icon = ObjectUtil.notNull(sdkType.getIcon(), AllIcons.Toolbar.Unknown);
if(sdk.isPredefined()) {
return new IconDescriptor(icon).addLayerIcon(AllIcons.Nodes.Locked).toIcon();
}
else {
return icon;
}
}
示例13: actionPerformed
import com.intellij.util.ObjectUtil; //导入方法依赖的package包/类
@Override
public void actionPerformed(@Nonnull AnActionEvent e) {
Project project = e.getRequiredData(CommonDataKeys.PROJECT);
if (ChangeListManager.getInstance(project).isFreezedWithNotification(null)) return;
VcsRevisionNumber currentRevisionNumber = e.getRequiredData(VcsDataKeys.HISTORY_SESSION).getCurrentRevisionNumber();
VcsFileRevision selectedRevision = e.getRequiredData(VcsDataKeys.VCS_FILE_REVISIONS)[0];
FilePath filePath = e.getRequiredData(VcsDataKeys.FILE_PATH);
if (currentRevisionNumber != null && selectedRevision != null) {
DiffFromHistoryHandler diffHandler =
ObjectUtil.notNull(e.getRequiredData(VcsDataKeys.HISTORY_PROVIDER).getHistoryDiffHandler(), new StandardDiffFromHistoryHandler());
diffHandler.showDiffForTwo(project, filePath, selectedRevision, new CurrentRevision(filePath.getVirtualFile(), currentRevisionNumber));
}
}
示例14: getSplittersToFocus
import com.intellij.util.ObjectUtil; //导入方法依赖的package包/类
private EditorSplitters getSplittersToFocus() {
Window activeWindow = myWindowManager.getMostRecentFocusedWindow();
if (activeWindow instanceof DesktopFloatingDecorator) {
IdeFocusManager ideFocusManager = IdeFocusManager.findInstanceByComponent(activeWindow);
IdeFrame lastFocusedFrame = ideFocusManager.getLastFocusedFrame();
JComponent frameComponent = lastFocusedFrame != null ? lastFocusedFrame.getComponent() : null;
Window lastFocusedWindow = frameComponent != null ? SwingUtilities.getWindowAncestor(frameComponent) : null;
activeWindow = ObjectUtil.notNull(lastFocusedWindow, activeWindow);
}
FileEditorManagerEx fem = FileEditorManagerEx.getInstanceEx(myProject);
EditorSplitters splitters = activeWindow != null ? fem.getSplittersFor(activeWindow) : null;
return splitters != null ? splitters : fem.getSplitters();
}
示例15: isClassInProductionSources
import com.intellij.util.ObjectUtil; //导入方法依赖的package包/类
private static <T extends ComboBox<?>> boolean isClassInProductionSources(T moduleComboBox, Function<T, Module> getSelectedModule, EditorTextFieldWithBrowseButton classSelector)
{
Module module = getSelectedModule.apply(moduleComboBox);
if(module == null)
{
return false;
}
return ObjectUtil.notNull(JavaParametersUtil.isClassInProductionSources(classSelector.getText(), module), Boolean.FALSE);
}