本文整理汇总了Java中com.intellij.openapi.util.Trinity类的典型用法代码示例。如果您正苦于以下问题:Java Trinity类的具体用法?Java Trinity怎么用?Java Trinity使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Trinity类属于com.intellij.openapi.util包,在下文中一共展示了Trinity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getExceptionTypes
import com.intellij.openapi.util.Trinity; //导入依赖的package包/类
private List<Trinity> getExceptionTypes() {
List<Trinity> types = new ArrayList<Trinity>();
types.add(new Trinity("Exception", PhpIcons.EXCEPTION, "PHP Exception"));
types.add(new Trinity("Error", PhpIcons.EXCEPTION, "PHP Exception"));
types.add(new Trinity("BadFunctionCallException", PhpIcons.EXCEPTION, "PHP Exception"));
types.add(new Trinity("BadMethodCallException", PhpIcons.EXCEPTION, "PHP Exception"));
types.add(new Trinity("DomainException", PhpIcons.EXCEPTION, "PHP Exception"));
types.add(new Trinity("InvalidArgumentException", PhpIcons.EXCEPTION, "PHP Exception"));
types.add(new Trinity("LengthException", PhpIcons.EXCEPTION, "PHP Exception"));
types.add(new Trinity("LogicException", PhpIcons.EXCEPTION, "PHP Exception"));
types.add(new Trinity("OutOfBoundsException", PhpIcons.EXCEPTION, "PHP Exception"));
types.add(new Trinity("OutOfRangeException", PhpIcons.EXCEPTION, "PHP Exception"));
types.add(new Trinity("OverflowException", PhpIcons.EXCEPTION, "PHP Exception"));
types.add(new Trinity("RangeException", PhpIcons.EXCEPTION, "PHP Exception"));
types.add(new Trinity("RuntimeException", PhpIcons.EXCEPTION, "PHP Exception"));
types.add(new Trinity("UnderflowException", PhpIcons.EXCEPTION, "PHP Exception"));
types.add(new Trinity("UnexpectedValueException", PhpIcons.EXCEPTION, "PHP Exception"));
return types;
}
示例2: getAvailableTemplates
import com.intellij.openapi.util.Trinity; //导入依赖的package包/类
private List<Trinity> getAvailableTemplates() {
List<Trinity> templates = new ArrayList<Trinity>();
FileTemplate classTemplate = FileTemplateManager.getInstance(this.myProject).getInternalTemplate("PHP Class");
for (FileTemplate template : FileTemplateManager.getInstance(this.myProject).getAllTemplates()) {
if (template.getExtension().equals("class.php")) {
templates.add(new Trinity(template.getName(), PhpIcons.CLASS, template));
}
}
if (templates.size() < 1) {
templates.add(new Trinity(classTemplate.getName(), PhpIcons.CLASS, classTemplate));
}
return templates;
}
示例3: TextWithImportsImpl
import com.intellij.openapi.util.Trinity; //导入依赖的package包/类
public TextWithImportsImpl(@NotNull PsiElement expression) {
myKind = CodeFragmentKind.EXPRESSION;
final String text = expression.getText();
PsiFile containingFile = expression.getContainingFile();
if(containingFile instanceof PsiExpressionCodeFragment) {
myText = text;
myImports = ((JavaCodeFragment)containingFile).importsToString();
myFileType = StdFileTypes.JAVA;
}
else {
Trinity<String, String, FileType> trinity = parseExternalForm(text);
myText = trinity.first;
myImports = trinity.second;
myFileType = trinity.third;
}
}
示例4: createVariableValue
import com.intellij.openapi.util.Trinity; //导入依赖的package包/类
@NotNull
public DfaVariableValue createVariableValue(@NotNull PsiModifierListOwner myVariable,
@Nullable PsiType varType,
boolean isNegated,
@Nullable DfaVariableValue qualifier) {
Trinity<Boolean,String,DfaVariableValue> key = Trinity.create(isNegated, ((PsiNamedElement)myVariable).getName(), qualifier);
for (DfaVariableValue aVar : myExistingVars.get(key)) {
if (aVar.hardEquals(myVariable, varType, isNegated, qualifier)) return aVar;
}
DfaVariableValue result = new DfaVariableValue(myVariable, varType, isNegated, myFactory, qualifier);
myExistingVars.putValue(key, result);
while (qualifier != null) {
qualifier.myDependents.add(result);
qualifier = qualifier.getQualifier();
}
return result;
}
示例5: findMethodRange
import com.intellij.openapi.util.Trinity; //导入依赖的package包/类
private static List<TextRange> findMethodRange(final ExceptionWorker worker,
final Document document,
final Trinity<PsiClass, PsiFile, String> previousLineResult) {
return ApplicationManager.getApplication().runReadAction(new Computable<List<TextRange>>() {
@Override
public List<TextRange> compute() {
List<TextRange> ranges = getTextRangeForMethod(worker, previousLineResult);
if (ranges == null) return null;
final List<TextRange> result = new ArrayList<TextRange>();
for (TextRange range : ranges) {
result.add(new TextRange(document.getLineNumber(range.getStartOffset()),
document.getLineNumber(range.getEndOffset())));
}
return result;
}
});
}
示例6: selectMethod
import com.intellij.openapi.util.Trinity; //导入依赖的package包/类
@Nullable
private static List<PsiMethod> selectMethod(final PsiMethod[] methods, final Trinity<PsiClass, PsiFile, String> previousLineResult) {
if (previousLineResult == null || previousLineResult.getThird() == null) return null;
final List<PsiMethod> result = new SmartList<PsiMethod>();
for (final PsiMethod method : methods) {
method.accept(new JavaRecursiveElementVisitor() {
@Override
public void visitCallExpression(PsiCallExpression callExpression) {
final PsiMethod resolved = callExpression.resolveMethod();
if (resolved != null) {
if (resolved.getName().equals(previousLineResult.getThird())) {
result.add(method);
}
}
}
});
}
return result;
}
示例7: startListening
import com.intellij.openapi.util.Trinity; //导入依赖的package包/类
private void startListening(@NotNull final List<Trinity<PsiModifierListOwner, String, Boolean>> expectedSequence) {
myBusConnection = myProject.getMessageBus().connect();
myBusConnection.subscribe(ExternalAnnotationsManager.TOPIC, new DefaultAnnotationsListener() {
private int index = 0;
@Override
public void afterExternalAnnotationChanging(@NotNull PsiModifierListOwner owner, @NotNull String annotationFQName,
boolean successful) {
if (index < expectedSequence.size() && expectedSequence.get(index).first == owner
&& expectedSequence.get(index).second.equals(annotationFQName) && expectedSequence.get(index).third == successful) {
index++;
myExpectedEventWasProduced = true;
}
else {
super.afterExternalAnnotationChanging(owner, annotationFQName, successful);
}
}
});
}
示例8: testMoveUpDown
import com.intellij.openapi.util.Trinity; //导入依赖的package包/类
public void testMoveUpDown() {
doExpand();
checkPositionToMove(0, 1, null);
checkPositionToMove(2, 1, Trinity.create(2, 3, BELOW));
checkPositionToMove(2, -1, null);
checkPositionToMove(14, 1, null);
checkPositionToMove(14, -1, null);
checkPositionToMove(15, -1, null);
checkPositionToMove(16, -1, null);
checkPositionToMove(3, -1, Trinity.create(3, 2, ABOVE));
checkPositionToMove(6, 1, Trinity.create(6, 9, BELOW));
checkPositionToMove(7, 1, Trinity.create(7, 8, BELOW));
checkPositionToMove(10, -1, Trinity.create(10, 8, BELOW));
checkPositionToMove(8, 1, Trinity.create(8, 9, BELOW));
checkPositionToMove(21, -1, Trinity.create(21, 20, BELOW));
checkPositionToMove(21, 1, null);
checkPositionToMove(20, 1, Trinity.create(20, 21, ABOVE));
checkPositionToMove(20, -1, Trinity.create(20, 19, ABOVE));
checkPositionToMove(19, 1, Trinity.create(19, 20, BELOW));
checkPositionToMove(19, -1, Trinity.create(19, 17, BELOW));
checkPositionToMove(17, -1, Trinity.create(17, 16, ABOVE));
checkPositionToMove(17, 1, Trinity.create(17, 18, BELOW));
}
示例9: removeNotification
import com.intellij.openapi.util.Trinity; //导入依赖的package包/类
public void removeNotification(Notification notification) {
synchronized (myNotifications) {
myNotifications.remove(notification);
}
Runnable handler = removeHandlers.remove(notification);
if (handler != null) {
UIUtil.invokeLaterIfNeeded(handler);
}
Trinity<Notification, String, Long> oldStatus = getStatusMessage();
if (oldStatus != null && notification == oldStatus.first) {
setStatusToImportant();
}
fireModelChanged();
}
示例10: updateModel
import com.intellij.openapi.util.Trinity; //导入依赖的package包/类
public void updateModel(List<? extends ChangeList> changeLists, Trinity<List<VirtualFile>, Integer, Integer> unversionedFiles, final List<LocallyDeletedChange> locallyDeletedFiles,
List<VirtualFile> modifiedWithoutEditing,
MultiMap<String, VirtualFile> switchedFiles,
@Nullable Map<VirtualFile, String> switchedRoots,
@Nullable List<VirtualFile> ignoredFiles,
final List<VirtualFile> lockedFolders,
@Nullable final Map<VirtualFile, LogicalLock> logicallyLockedFiles) {
TreeModelBuilder builder = new TreeModelBuilder(myProject, isShowFlatten());
final DefaultTreeModel model = builder.buildModel(changeLists, unversionedFiles, locallyDeletedFiles, modifiedWithoutEditing,
switchedFiles, switchedRoots, ignoredFiles, lockedFolders, logicallyLockedFiles);
TreeState state = TreeState.createOn(this, (ChangesBrowserNode)getModel().getRoot());
state.setScrollToSelection(false);
DefaultTreeModel oldModel = getModel();
setModel(model);
setCellRenderer(isShowFlatten() ? myShowFlattenNodeRenderer : myNodeRenderer);
ChangesBrowserNode root = (ChangesBrowserNode)model.getRoot();
expandPath(new TreePath(root.getPath()));
state.applyTo(this, (ChangesBrowserNode)getModel().getRoot());
expandDefaultChangeList(oldModel, root);
}
示例11: showCustomOption
import com.intellij.openapi.util.Trinity; //导入依赖的package包/类
@Override
public void showCustomOption(Class<? extends CustomCodeStyleSettings> settingsClass,
String fieldName,
String title,
String groupName,
@Nullable OptionAnchor anchor,
@Nullable String anchorFieldName,
Object... options) {
if (myIsFirstUpdate) {
myCustomOptions.putValue(groupName, (Trinity)Trinity.create(settingsClass, fieldName, title));
}
for (IntOption option : myOptions) {
if (option.myTarget.getName().equals(fieldName)) {
option.myTextField.setEnabled(true);
}
}
}
示例12: TemplateKindCombo
import com.intellij.openapi.util.Trinity; //导入依赖的package包/类
public TemplateKindCombo() {
//noinspection unchecked
getComboBox().setRenderer(new ListCellRendererWrapper() {
@Override
public void customize(final JList list, final Object value, final int index, final boolean selected, final boolean cellHasFocus) {
if (value instanceof Trinity) {
setText((String)((Trinity)value).first);
setIcon ((Icon)((Trinity)value).second);
}
}
});
new ComboboxSpeedSearch(getComboBox()) {
@Override
protected String getElementText(Object element) {
if (element instanceof Trinity) {
return (String)((Trinity)element).first;
}
return null;
}
}.setComparator(new SpeedSearchComparator(true));
setButtonListener(null);
}
示例13: prepareRenaming
import com.intellij.openapi.util.Trinity; //导入依赖的package包/类
public void prepareRenaming(PsiElement element, String newName, Map<PsiElement, String> allRenames) {
final AntDomElement antElement = convertToAntDomElement(element);
String propName = null;
if (antElement instanceof AntDomProperty) {
propName = ((AntDomProperty)antElement).getName().getStringValue();
}
else if (antElement instanceof AntDomAntCallParam) {
propName = ((AntDomAntCallParam)antElement).getName().getStringValue();
}
if (propName != null) {
final AntDomProject contextProject = antElement.getContextAntProject();
final List<PsiElement> additional = AntCallParamsFinder.resolve(contextProject, propName);
for (PsiElement psiElement : additional) {
allRenames.put(psiElement, newName);
}
if (antElement instanceof AntDomAntCallParam) {
final Trinity<PsiElement, Collection<String>, PropertiesProvider> result = PropertyResolver.resolve(contextProject, propName, null);
if (result.getFirst() != null) {
allRenames.put(result.getFirst(), newName);
}
}
}
}
示例14: resolve
import com.intellij.openapi.util.Trinity; //导入依赖的package包/类
@NotNull
public ResolveResult[] resolve(@NotNull AntDomPropertyReference antDomPropertyReference, boolean incompleteCode) {
final List<ResolveResult> result = new ArrayList<ResolveResult>();
final AntDomProject project = antDomPropertyReference.myInvocationContextElement.getParentOfType(AntDomProject.class, true);
if (project != null) {
final AntDomProject contextAntProject = project.getContextAntProject();
final String propertyName = antDomPropertyReference.getCanonicalText();
final Trinity<PsiElement,Collection<String>,PropertiesProvider> resolved =
PropertyResolver.resolve(contextAntProject, propertyName, antDomPropertyReference.myInvocationContextElement);
final PsiElement mainDeclaration = resolved.getFirst();
if (mainDeclaration != null) {
result.add(new MyResolveResult(mainDeclaration, resolved.getThird()));
}
final List<PsiElement> antCallParams = AntCallParamsFinder.resolve(project, propertyName);
for (PsiElement param : antCallParams) {
result.add(new MyResolveResult(param, null));
}
}
return ContainerUtil.toArray(result, new ResolveResult[result.size()]);
}
示例15: computeRawActions
import com.intellij.openapi.util.Trinity; //导入依赖的package包/类
private Set<Trinity<Module, SyncAction, MvcFramework>> computeRawActions(Set<Pair<Object, SyncAction>> actions) {
//get module by object and kill duplicates
final Set<Trinity<Module, SyncAction, MvcFramework>> rawActions = new LinkedHashSet<Trinity<Module, SyncAction, MvcFramework>>();
for (final Pair<Object, SyncAction> pair : actions) {
for (Module module : determineModuleBySyncActionObject(pair.first)) {
if (!module.isDisposed()) {
final MvcFramework framework = (pair.second == SyncAction.CreateAppStructureIfNeeded)
? MvcFramework.getInstanceBySdk(module)
: MvcFramework.getInstance(module);
if (framework != null && !framework.isAuxModule(module)) {
rawActions.add(Trinity.create(module, pair.second, framework));
}
}
}
}
return rawActions;
}