Java Code Examples for com.intellij.util.ArrayUtil#append()
The following examples show how to use
com.intellij.util.ArrayUtil#append() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SdkFields.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Create a command to run 'flutter attach --machine'. */ public GeneralCommandLine createFlutterSdkAttachCommand(@NotNull Project project, @NotNull FlutterLaunchMode flutterLaunchMode, @Nullable FlutterDevice device) throws ExecutionException { final MainFile main = MainFile.verify(filePath, project).get(); final FlutterSdk flutterSdk = FlutterSdk.getFlutterSdk(project); if (flutterSdk == null) { throw new ExecutionException(FlutterBundle.message("flutter.sdk.is.not.configured")); } final PubRoot root = PubRoot.forDirectory(main.getAppDir()); if (root == null) { throw new ExecutionException("Entrypoint isn't within a Flutter pub root"); } String[] args = additionalArgs == null ? new String[]{ } : additionalArgs.split(" "); if (buildFlavor != null) { args = ArrayUtil.append(args, "--flavor=" + buildFlavor); } final FlutterCommand command = flutterSdk.flutterAttach(root, main.getFile(), device, flutterLaunchMode, args); return command.createGeneralCommandLine(project); }
Example 2
Source File: GotoTargetHandler.java From consulo with Apache License 2.0 | 6 votes |
public boolean addTarget(final PsiElement element) { if (ArrayUtil.find(targets, element) > -1) return false; targets = ArrayUtil.append(targets, element); renderers.put(element, createRenderer(this, element)); if (!hasDifferentNames && element instanceof PsiNamedElement) { final String name = ApplicationManager.getApplication().runReadAction(new Computable<String>() { @Override public String compute() { return ((PsiNamedElement)element).getName(); } }); myNames.add(name); hasDifferentNames = myNames.size() > 1; } return true; }
Example 3
Source File: PantsProjectImportProvider.java From intellij-pants-plugin with Apache License 2.0 | 6 votes |
@Override public ModuleWizardStep[] createSteps(WizardContext context) { /** * Newer export version project sdk can be automatically discovered and configured. */ AtomicBoolean isSdkConfigured = new AtomicBoolean(true); String message = PantsBundle.message("pants.default.sdk.config.progress"); ProgressManager.getInstance().run(new Task.Modal(context.getProject(), message, !CAN_BE_CANCELLED) { @Override public void run(@NotNull ProgressIndicator indicator) { if (isSdkConfigured.get()) { isSdkConfigured.set(isJvmProject(context.getProjectFileDirectory())); } } }); if (isSdkConfigured.get()) { return super.createSteps(context); } return ArrayUtil.append(super.createSteps(context), new ProjectJdkStep(context)); }
Example 4
Source File: MsilPropertyAsCSharpPropertyDeclaration.java From consulo-csharp with Apache License 2.0 | 6 votes |
@Nonnull public static CSharpModifier[] getAdditionalModifiers(PsiElement parent, List<Pair<DotNetXAccessor, MsilMethodEntry>> pairs) { PsiElement maybeTypeParent = parent.getParent(); if(maybeTypeParent instanceof MsilClassEntry && ((MsilClassEntry) maybeTypeParent).hasModifier(MsilTokens.INTERFACE_KEYWORD)) { return CSharpModifier.EMPTY_ARRAY; } boolean staticMod = false; List<CSharpAccessModifier> modifiers = new SmartList<CSharpAccessModifier>(); for(Pair<DotNetXAccessor, MsilMethodEntry> pair : pairs) { CSharpAccessModifier accessModifier = getAccessModifier(pair.getSecond()); modifiers.add(accessModifier); if(pair.getSecond().hasModifier(MsilTokens.STATIC_KEYWORD)) { staticMod = true; } } ContainerUtil.sort(modifiers); CSharpAccessModifier access = modifiers.isEmpty() ? CSharpAccessModifier.PUBLIC : modifiers.get(0); return staticMod ? ArrayUtil.append(access.getModifiers(), CSharpModifier.STATIC) : access.getModifiers(); }
Example 5
Source File: HaxeAnnotationTest.java From intellij-haxe with Apache License 2.0 | 6 votes |
private void doTest(String... additionalPaths) throws Exception { final String[] paths = ArrayUtil.append(additionalPaths, getTestName(false) + ".hx"); myFixture.configureByFiles(ArrayUtil.reverseArray(paths)); final HaxeTypeAnnotator annotator = new HaxeTypeAnnotator(); try { LanguageAnnotators.INSTANCE.addExplicitExtension(HaxeLanguage.INSTANCE, annotator); myFixture.enableInspections(getAnnotatorBasedInspection()); try { myFixture.testHighlighting(true, true, true, myFixture.getFile().getVirtualFile()); } finally { LanguageAnnotators.INSTANCE.removeExplicitExtension(HaxeLanguage.INSTANCE, annotator); } } finally { LanguageAnnotators.INSTANCE.removeExplicitExtension(HaxeLanguage.INSTANCE, annotator); } }
Example 6
Source File: AbstractProgressIndicatorExBase.java From consulo with Apache License 2.0 | 6 votes |
@Override public final void addStateDelegate(@Nonnull ProgressIndicatorEx delegate) { synchronized (getLock()) { delegate.initStateFrom(this); ProgressIndicatorEx[] stateDelegates = myStateDelegates; if (stateDelegates == null) { myStateDelegates = stateDelegates = new ProgressIndicatorEx[1]; stateDelegates[0] = delegate; } else { // hard throw is essential for avoiding deadlocks if (ArrayUtil.contains(delegate, stateDelegates)) { throw new IllegalArgumentException("Already registered: " + delegate); } myStateDelegates = ArrayUtil.append(stateDelegates, delegate, ProgressIndicatorEx.class); } } }
Example 7
Source File: ConflictsDialog.java From consulo with Apache License 2.0 | 5 votes |
private UsagePresentation getPresentation(final UsagePresentation usagePresentation, PsiElement element) { final Collection<String> elementConflicts = new LinkedHashSet<String>(myElementConflictDescription.get(element)); final String conflictDescription = " (" + Pattern.compile("<[^<>]*>").matcher(StringUtil.join(elementConflicts, "\n")).replaceAll("") + ")"; return new UsagePresentation() { @Override @Nonnull public TextChunk[] getText() { final TextChunk[] chunks = usagePresentation.getText(); return ArrayUtil .append(chunks, new TextChunk(SimpleTextAttributes.GRAY_ITALIC_ATTRIBUTES.toTextAttributes(), conflictDescription)); } @Override @Nonnull public String getPlainText() { return usagePresentation.getPlainText() + conflictDescription; } @Override public Image getIcon() { return usagePresentation.getIcon(); } @Override public String getTooltipText() { return usagePresentation.getTooltipText(); } }; }
Example 8
Source File: WeaveDebugProcess.java From mule-intellij-plugins with Apache License 2.0 | 5 votes |
@NotNull @Override public XBreakpointHandler<?>[] getBreakpointHandlers() { final XBreakpointHandler<?>[] breakpointHandlers = super.getBreakpointHandlers(); return ArrayUtil.append(breakpointHandlers, breakpointHandler); }
Example 9
Source File: SdkFields.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Create a command to run 'flutter run --machine'. */ public GeneralCommandLine createFlutterSdkRunCommand(@NotNull Project project, @NotNull RunMode runMode, @NotNull FlutterLaunchMode flutterLaunchMode, @Nullable FlutterDevice device ) throws ExecutionException { final MainFile main = MainFile.verify(filePath, project).get(); final FlutterSdk flutterSdk = FlutterSdk.getFlutterSdk(project); if (flutterSdk == null) { throw new ExecutionException(FlutterBundle.message("flutter.sdk.is.not.configured")); } final PubRoot root = PubRoot.forDirectory(main.getAppDir()); if (root == null) { throw new ExecutionException("Entrypoint isn't within a Flutter pub root"); } final FlutterCommand command; String[] args = additionalArgs == null ? new String[]{ } : additionalArgs.split(" "); if (buildFlavor != null) { args = ArrayUtil.append(args, "--flavor=" + buildFlavor); } if (FlutterSettings.getInstance().isShowStructuredErrors() && flutterSdk.getVersion().isDartDefineSupported()) { args = ArrayUtil.append(args, "--dart-define=flutter.inspector.structuredErrors=true"); } command = flutterSdk.flutterRun(root, main.getFile(), device, runMode, flutterLaunchMode, project, args); return command.createGeneralCommandLine(project); }
Example 10
Source File: SdkFields.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Create a command to run 'flutter run --machine'. */ public GeneralCommandLine createFlutterSdkRunCommand(@NotNull Project project, @NotNull RunMode runMode, @NotNull FlutterLaunchMode flutterLaunchMode, @Nullable FlutterDevice device ) throws ExecutionException { final MainFile main = MainFile.verify(filePath, project).get(); final FlutterSdk flutterSdk = FlutterSdk.getFlutterSdk(project); if (flutterSdk == null) { throw new ExecutionException(FlutterBundle.message("flutter.sdk.is.not.configured")); } final PubRoot root = PubRoot.forDirectory(main.getAppDir()); if (root == null) { throw new ExecutionException("Entrypoint isn't within a Flutter pub root"); } final FlutterCommand command; String[] args = additionalArgs == null ? new String[]{ } : additionalArgs.split(" "); if (buildFlavor != null) { args = ArrayUtil.append(args, "--flavor=" + buildFlavor); } if (FlutterSettings.getInstance().isShowStructuredErrors() && flutterSdk.getVersion().isDartDefineSupported()) { args = ArrayUtil.append(args, "--dart-define=flutter.inspector.structuredErrors=true"); } command = flutterSdk.flutterRun(root, main.getFile(), device, runMode, flutterLaunchMode, project, args); return command.createGeneralCommandLine(project); }
Example 11
Source File: MessageBusImpl.java From consulo with Apache License 2.0 | 5 votes |
/** * calculates {@link #myOrder} for the given child bus */ @Nonnull private int[] nextOrder() { MessageBusImpl lastChild = ContainerUtil.getLastItem(myChildBuses); int lastChildIndex = lastChild == null ? 0 : ArrayUtil.getLastElement(lastChild.myOrder, 0); if (lastChildIndex == Integer.MAX_VALUE) { LOG.error("Too many child buses"); } return ArrayUtil.append(myOrder, lastChildIndex + 1); }
Example 12
Source File: DesktopEditorComposite.java From consulo with Apache License 2.0 | 5 votes |
@RequiredUIAccess void addEditor(@Nonnull FileEditor editor) { ApplicationManager.getApplication().assertIsDispatchThread(); myEditors = ArrayUtil.append(myEditors, editor); if (myTabbedPaneWrapper == null) { myTabbedPaneWrapper = createTabbedPaneWrapper(myEditors); myComponent.setComponent(myTabbedPaneWrapper.getComponent()); } else { JComponent component = createEditorComponent(editor); myTabbedPaneWrapper.addTab(getDisplayName(editor), component); } myFocusWatcher.deinstall(myFocusWatcher.getTopComponent()); myFocusWatcher.install(myComponent); }
Example 13
Source File: InspectionEP.java From consulo with Apache License 2.0 | 5 votes |
@javax.annotation.Nullable public String[] getGroupPath() { String name = getGroupDisplayName(); if (name == null) return null; if (groupPath == null) { return new String[]{name.isEmpty() ? InspectionProfileEntry.GENERAL_GROUP_NAME : name}; } return ArrayUtil.append(groupPath.split(","), name); }
Example 14
Source File: ModuleGroup.java From consulo with Apache License 2.0 | 4 votes |
private static String[] directChild(final String[] parent, final String[] descendant) { if (!isChild(parent, descendant)) return null; return ArrayUtil.append(parent, descendant[parent.length]); }
Example 15
Source File: PsalmValidatorConfiguration.java From idea-php-generics-plugin with MIT License | 4 votes |
@Transient public String[] getStandards() { return (String[]) ArrayUtil.append(this.myStandards.split(";"), "Custom"); }
Example 16
Source File: ThriftQuoteHandler.java From intellij-thrift with Apache License 2.0 | 4 votes |
public ThriftQuoteHandler() { super(ArrayUtil.append(ThriftTokenTypeSets.STRINGS.getTypes(), TokenType.BAD_CHARACTER)); }
Example 17
Source File: CSharpReferenceExpressionImplUtil.java From consulo-csharp with Apache License 2.0 | 4 votes |
@Nonnull @RequiredReadAction public static StubScopeProcessor createMemberProcessor(@Nonnull CSharpResolveOptions options, @Nonnull Processor<ResolveResult> resultProcessor) { ResolveToKind kind = options.getKind(); PsiElement element = options.getElement(); boolean completion = options.isCompletion(); ExecuteTarget[] targets; Comparator<ResolveResult> sorter = null; switch(kind) { case TYPE_LIKE: targets = new ExecuteTarget[]{ ExecuteTarget.GENERIC_PARAMETER, ExecuteTarget.TYPE, ExecuteTarget.DELEGATE_METHOD, ExecuteTarget.NAMESPACE, ExecuteTarget.TYPE_DEF }; sorter = TypeLikeComparator.create(element); break; case QUALIFIED_NAMESPACE: targets = new ExecuteTarget[]{ExecuteTarget.NAMESPACE}; break; case FIELD_OR_PROPERTY: targets = new ExecuteTarget[]{ ExecuteTarget.FIELD, ExecuteTarget.PROPERTY, ExecuteTarget.EVENT }; break; case ARRAY_METHOD: targets = new ExecuteTarget[]{ExecuteTarget.ELEMENT_GROUP}; break; case METHOD: targets = new ExecuteTarget[]{ ExecuteTarget.ELEMENT_GROUP, ExecuteTarget.FIELD, ExecuteTarget.PROPERTY, ExecuteTarget.EVENT, ExecuteTarget.LOCAL_VARIABLE_OR_PARAMETER_OR_LOCAL_METHOD }; break; case CONSTRUCTOR: case THIS_CONSTRUCTOR: case BASE_CONSTRUCTOR: targets = new ExecuteTarget[]{ ExecuteTarget.ELEMENT_GROUP }; break; case NAMEOF: targets = ExecuteTarget.values(); break; default: targets = new ExecuteTarget[]{ ExecuteTarget.MEMBER, ExecuteTarget.TYPE_DEF, ExecuteTarget.ELEMENT_GROUP }; sorter = StaticVsInstanceComparator.create(element); if(completion) { // append generic when completion due at ANY_MEMBER it dont resolved targets = ArrayUtil.append(targets, ExecuteTarget.GENERIC_PARAMETER); } break; } if(options.isCompletion()) { return new CompletionResolveScopeProcessor(options, resultProcessor, targets); } else { if(sorter != null) { return new SortedMemberResolveScopeProcessor(options, resultProcessor, sorter, targets); } else { return new MemberResolveScopeProcessor(options, resultProcessor, targets); } } }
Example 18
Source File: OSSPantsPythonIntegrationTest.java From intellij-pants-plugin with Apache License 2.0 | 4 votes |
@Override protected String[] getRequiredPluginIds() { return ArrayUtil.append(super.getRequiredPluginIds(), "PythonCore"); }
Example 19
Source File: ConfigurableWrapper.java From consulo with Apache License 2.0 | 4 votes |
@Override public ConfigurableWrapper addChild(Configurable configurable) { myKids = ArrayUtil.append(myKids, configurable); return this; }
Example 20
Source File: PhpStanValidatorConfiguration.java From idea-php-generics-plugin with MIT License | 4 votes |
@Transient public String[] getStandards() { return (String[]) ArrayUtil.append(this.myStandards.split(";"), "Custom"); }