private static void addRecordTargetVariablesRecursive(@NotNull AppleScriptTargetRecordLiteral targetRecord, @NotNull List<AppleScriptTargetVariable> targetVariables) { for (AppleScriptObjectTargetPropertyDeclaration property : targetRecord.getObjectTargetPropertyDeclarationList()) { AppleScriptTargetVariable innerVariable = property.getTargetVariable(); AppleScriptTargetListLiteral innerList = property.getTargetListLiteral(); AppleScriptTargetRecordLiteral innerRecord = property.getTargetRecordLiteral(); if (innerVariable != null) { targetVariables.add(innerVariable); } if (innerList != null) { targetVariables.addAll(innerList.getTargetVariableList()); } if (innerRecord != null) { addRecordTargetVariablesRecursive(innerRecord, targetVariables); } } }
private static void copyFile(@NotNull File source, @NotNull File dir) throws IOException { //noinspection ResultOfMethodCallIgnored dir.mkdirs(); File dest = new File(dir, source.getName()); if (dest.exists()) { //noinspection ResultOfMethodCallIgnored dest.delete(); } //noinspection ResultOfMethodCallIgnored dest.createNewFile(); try (InputStream is = new FileInputStream(source); OutputStream os = new FileOutputStream(dest)) { byte[] buffer = new byte[BUFFER_SIZE]; int length; while ((length = is.read(buffer)) > 0) { os.write(buffer, 0, length); } } }
@Override public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) { // TODO registrar.registerReferenceProvider(PlatformPatterns.psiElement(PsiLiteralExpression.class), new PsiReferenceProvider() { @NotNull @Override public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) { PsiLiteralExpression literalExpression = (PsiLiteralExpression) element; String value = literalExpression.getValue() instanceof String ? (String) literalExpression.getValue() : null; if (value != null && value.startsWith("simple" + ":")) { return new PsiReference[]{ new CptReference(element, new TextRange(8, value.length() + 1))}; } return PsiReference.EMPTY_ARRAY; } }); }
@NotNull @Override public Type visit(For node, State s) { bindIter(s, node.target, node.iter, SCOPE); Type t1 = Types.UNKNOWN; Type t2 = Types.UNKNOWN; Type t3 = Types.UNKNOWN; State s1 = s.copy(); State s2 = s.copy(); if (node.body != null) { t1 = visit(node.body, s1); s.merge(s1); t2 = visit(node.body, s1); s.merge(s1); } if (node.orelse != null) { t3 = visit(node.orelse, s2); s.merge(s2); } return UnionType.union(UnionType.union(t1, t2), t3); }
public KubeCloudClient(@Nullable String serverUuid, @NotNull String cloudProfileId, @NotNull KubeApiConnector apiConnector, @NotNull List<KubeCloudImage> images, @NotNull KubeCloudClientParametersImpl kubeClientParams, @NotNull BuildAgentPodTemplateProviders podTemplateProviders, @NotNull KubeDataCache cache, @NotNull KubeBackgroundUpdater updater) { myServerUuid = serverUuid; myCloudProfileId = cloudProfileId; myApiConnector = apiConnector; myImageIdToImageMap = new ConcurrentHashMap<>(Maps.uniqueIndex(images, CloudImage::getId)); myKubeClientParams = kubeClientParams; myPodTemplateProviders = podTemplateProviders; myCache = cache; myUpdater = updater; myUpdater.registerClient(this); }
@NotNull @Override public TransformationMenuItem createItem(@NotNull TransformationMenuContext context) { String description; try { description = "submenu " + getText(context); } catch (Throwable t) { return super.createItem(context); } context.getEditorMenuTrace().pushTraceInfo(); context.getEditorMenuTrace().setDescriptor(new EditorMenuDescriptorBase(description, new SNodePointer("r:7c1e5bbb-2d18-4cf3-a11d-502be6b13261(jetbrains.mps.samples.VoiceMenu.editor)", "8517997849287913434"))); try { return super.createItem(context); } finally { context.getEditorMenuTrace().popTraceInfo(); } }
@NotNull @Override public ItemPresentation getPresentation() { return new ItemPresentation() { @Nullable @Override public String getPresentableText() { return presText; } @Nullable @Override public String getLocationString() { return null; } @Nullable @Override public Icon getIcon(boolean b) { return PlatformIcons.CLASS_ICON; } }; }
@Override protected AnswerPlaceholder getTargetPlaceholder(@NotNull final TaskFile taskFile, int offset) { final AnswerPlaceholder selectedAnswerPlaceholder = taskFile.getAnswerPlaceholder(offset); final List<AnswerPlaceholder> placeholders = taskFile.getActivePlaceholders(); if (selectedAnswerPlaceholder == null) { for (AnswerPlaceholder placeholder : placeholders) { if (placeholder.getOffset() > offset) { return placeholder; } } } else { int index = selectedAnswerPlaceholder.getIndex(); if (StudyUtils.indexIsValid(index, placeholders)) { int newIndex = index + 1; return placeholders.get(newIndex == placeholders.size() ? 0 : newIndex); } } return null; }
@NotNull private Set<Integer> getExpandedRows() { Set<Integer> expanded = new HashSet<>(tree1.getRowCount()); for (int i = 0; i < tree1.getRowCount(); i++) { if (tree1.isExpanded(i)) { expanded.add(i); } } return expanded; }
@Override @FXThread protected void createContent(@NotNull final VBox root) { imageView = new ImageView(); FXUtils.addToPane(imageView, root); FXUtils.addClassTo(root, CSSClasses.IMAGE_VIEW_EDITOR_CONTAINER); }
@Override public @NotNull Stopwatch begin(@NotNull Stopwatch submittedStopwatch) { tasks.queued.dec(); tasks.used.inc(); time.delay.observe(submittedStopwatch.stop()); return submittedStopwatch; }
@Override protected <T> T invokeSpecial0(@NotNull SNode node, @NotNull SMethod<T> method, @Nullable Object[] parameters) { int methodIndex = BH_METHODS.indexOf(method); if (methodIndex < 0) { throw new BHMethodNotFoundException(this, method); } switch (methodIndex) { case 0: return (T) ((SNode) GeefOvergang_id2hDGrbWPFpO(node)); default: throw new BHMethodNotFoundException(this, method); } }
@Nullable @Contract(pure = true) public static PsiElement getPrevNonWhitespaceElement(@NotNull final PsiElement element) { Validate.notNull(element); PsiElement prevSibling = element.getPrevSibling(); while (null != prevSibling && (isWhiteSpace(prevSibling) || isLineBreak(prevSibling))) { prevSibling = prevSibling.getPrevSibling(); } return prevSibling; }
@NotNull private static Set<String> collectPluginOptionKeys() { Set<String> result = new HashSet<>(); for (Field field : TrauteConstants.class.getFields()) { int modifiers = field.getModifiers(); if ((modifiers & PUBLIC) == 0 || (modifiers & STATIC) == 0 || (modifiers & FINAL) == 0 || field.getType() != String.class) { continue; } try { String value = field.get(null).toString(); if (!value.contains("traute")) { continue; } if (field.getName().contains("PREFIX")) { for (InstrumentationType type : InstrumentationType.values()) { result.add(value + type.getShortName()); } } else { result.add(value); } } catch (IllegalAccessException e) { throw new RuntimeException(String.format( "Unexpected exception on attempt to collect plugin option keys for %s.%s", TrauteConstants.class.getName(), field.getName() ), e); } } return result; }
private void printInstrumentationResults(@NotNull JavaFileObject file, @NotNull StatsCollector statsCollector, @NotNull TrautePluginLogger logger) { ConcurrentMap<InstrumentationType, Long> stats = statsCollector.getStats(); long totalInstrumentationsNumber = stats.entrySet() .stream() .mapToLong(Map.Entry::getValue) .sum(); if (totalInstrumentationsNumber <= 0) { return; } StringBuilder details = new StringBuilder(); for (InstrumentationType type : InstrumentationType.values()) { Long count = stats.get(type); if (count != null) { details.append(type).append(": ").append(count).append(", "); } } details.setLength(details.length() - 2); String fileName = file.toUri().getSchemeSpecificPart(); while (fileName.startsWith("//")) { fileName = fileName.substring(1); } logger.info(String.format( "added %d instrumentation%s to the class %s - %s", totalInstrumentationsNumber, totalInstrumentationsNumber > 1 ? "s" : "", fileName, details) ); }
@Override public boolean check(@NotNull IfMacroContext ctx) throws GenerationFailureException { switch (methodKey) { case 0: return QueriesGenerated.ifMacro_Condition_2702278965991008820(ctx); case 1: return QueriesGenerated.ifMacro_Condition_2702278965991168248(ctx); default: throw new GenerationFailureException(String.format("Inconsistent QueriesGenerated: there's no condition method for if macro %s (key: #%d)", ctx.getTemplateReference(), methodKey)); } }
/** * Create feed client. * * @param url feed url. * @return feed client. */ public FeedClient createFeedClient(@NotNull final String url) { final Retrofit.Builder retrofitBuilder = configureRetrofit() .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) .baseUrl(url); feedClient = new FeedClient(retrofitBuilder); return feedClient; }
public void checkInput(float delta, @NotNull Vector2 mouseInput) { // checks for keyboard input to move the player. // getDeltaTime() returns the time passed between the last and the current frame in seconds. int speed = Tile.SIZE * 5; // this is technically in units/second. Vector2 movement = new Vector2(); if(Gdx.input.isKeyPressed(Input.Keys.LEFT)) movement.x--; if(Gdx.input.isKeyPressed(Input.Keys.RIGHT)) movement.x++; if(Gdx.input.isKeyPressed(Input.Keys.UP)) movement.y++; if(Gdx.input.isKeyPressed(Input.Keys.DOWN)) movement.y--; movement.nor(); movement.add(mouseInput); movement.nor(); movement.scl(speed * delta); move(movement.x, movement.y); if(pressingKey(Input.Keys.Q)) cycleHeldItem(false); if(pressingKey(Input.Keys.E)) cycleHeldItem(true); if(pressingKey(Input.Keys.C)) attack(); else if(pressingKey(Input.Keys.V)) interact(); heldItem = heldItem == null ? null : heldItem.consume(); }
@NotNull @Override public DefaultActionGroup getTaskDescriptionActionGroup() { DefaultActionGroup taskDescriptionActionGroup = super.getTaskDescriptionActionGroup(); taskDescriptionActionGroup.remove(ActionManager.getInstance().getAction(StudyShowHintAction.ACTION_ID)); StudyFillPlaceholdersAction fillPlaceholdersAction = new StudyFillPlaceholdersAction(); fillPlaceholdersAction.getTemplatePresentation().setIcon(EduKotlinIcons.FILL_PLACEHOLDERS_ICON); fillPlaceholdersAction.getTemplatePresentation().setText("Fill Answer Placeholders"); taskDescriptionActionGroup.add(fillPlaceholdersAction); return taskDescriptionActionGroup; }
@Override public @NotNull Array<TreeNode<?>> getChildren(@NotNull final NodeTree<?> nodeTree) { final Array<TreeNode<?>> result = ArrayFactory.newArray(TreeNode.class); final List<Spatial> children = getSpatials(); children.forEach(spatial -> result.add(FACTORY_REGISTRY.createFor(spatial))); result.addAll(super.getChildren(nodeTree)); return result; }
@Override public boolean isPlatformExtModule(@NotNull final File file) { Validate.notNull(file); return file.getAbsolutePath().contains(HybrisConstants.PLATFORM_EXT_MODULE_PREFIX) && new File(file, HybrisConstants.EXTENSION_INFO_XML).isFile() && !isCoreExtModule(file); }
@Nullable private static String getAnnotationName(@NotNull final PsiAnnotation annotation) { final Ref<String> qualifiedAnnotationName = new Ref<>(); ApplicationManager.getApplication().runReadAction(() -> { String qualifiedName = annotation.getQualifiedName(); qualifiedAnnotationName.set(qualifiedName); } ); return qualifiedAnnotationName.get(); }
@NotNull private static Position getPosition(int pos, int[] lineStarts) { int line = Arrays.binarySearch(lineStarts, pos); if (line < 0) { int insertion_point = -1 * line - 1; line = insertion_point - 1; } return new Position(line, pos - lineStarts[line]); }
/** * Replace header with xml version 1.0 to version 1.1. * @param xmlEntry string for replacing * @return new string after replacing */ @NotNull static String replaceXmlHeaderVersion(@NotNull final String xmlEntry){ final Matcher matcher = XML_HEADER_PATTERN.matcher(xmlEntry); if (matcher.find()) { return matcher.replaceFirst(matcher.group(1) + "1.1" + matcher.group(3)); } return xmlEntry; }
@Nullable @Override public Custom deserialize(@Nullable Object serialized, @NotNull Class wantedType, @NotNull SerializerSet serializerSet) throws IllegalArgumentException { if (serialized instanceof Map) { Custom custom = new Custom(((Map) serialized).get("name").toString().toLowerCase()); List<?> data = ((List<?>)((Map)((Map) serialized).get("data")).get("array")); custom.data.array = data.toArray(new Object[data.size()]); for (int i = 0; i < data.size(); i++) { custom.data.array[i] = Integer.valueOf(String.valueOf(data.get(i))); } return custom; } else { throw new IllegalArgumentException("serialized form must be a map"); } }
/** * Parses the given file (which must be in yaml format) and inserts comments. * * @throws IOException if the file does not exist, is a directory or cannot be read/written for some reason. */ public void saveCommentsToFile(@NotNull final File yamlFile) throws IOException { if (commentMap.hasComments()) { String fileAsString = FileUtil.getFileContentsAsString(yamlFile); String instrumentedContents = addCommentsToYamlString(fileAsString); saveNewContentsToFile(instrumentedContents, yamlFile); } }
/** * Get the Desk Note service * * @return the default Desk Note service */ @NotNull public NoteService notes() { if (noteService == null) { noteService = this.getRestAdapter().create(NoteService.class); } return noteService; }
@Override public @NotNull List<EditableProperty<?, ?>> getEditableProperties() { final List<EditableProperty<?, ?>> result = super.getEditableProperties(); result.add(new SimpleProperty<>(DIRECTION_LIGHT_FROM_SCENE, "Direction light", this, makeGetter(this, DirectionalLight.class, "getDirectionalLight"), makeSetter(this, DirectionalLight.class, "setDirectionalLight"))); return result; }
@NotNull static ArrayHashElement[] getMessages(PhpPsiElement element, String category) { ArrayList<ArrayHashElement> messages = new ArrayList<>(); PsiDirectory directory = getDirectory(element); if (directory != null) { PsiFile file = directory.findFile(category.concat(".php")); if (file != null) { messages.addAll(loadMessagesFromFile(file)); } } return messages.toArray(new ArrayHashElement[messages.size()]); }
@NotNull @Override public String getNodeText(@NotNull PsiElement element, boolean useFullName) { if (element instanceof YAMLKeyValue) { if (useFullName) { return resolvePath(element); } else { return ((YAMLKeyValue) element).getKeyText(); } } else { return ""; } }
@Override public void configure( @NotNull final HybrisProjectDescriptor hybrisProjectDescriptor, @NotNull final Project project, @NotNull final List<EclipseModuleDescriptor> eclipseModules, @Nullable final String[] eclipseGroup ) { if (eclipseModules.isEmpty()) { return; } final EclipseImportBuilder eclipseImportBuilder = new EclipseImportBuilder(); final List<String> projectList = eclipseModules .stream() .map(AbstractHybrisModuleDescriptor::getRootDirectory) .map(File::getPath) .collect(Collectors.toList()); if (hybrisProjectDescriptor.getModulesFilesDirectory() != null) { eclipseImportBuilder.getParameters().converterOptions.commonModulesDirectory = hybrisProjectDescriptor.getModulesFilesDirectory().getPath(); } eclipseImportBuilder.setList(projectList); ApplicationManager.getApplication().invokeAndWait(() -> { final List<Module> newRootModules = eclipseImportBuilder.commit(project); moveEclipseModulesToGroup(project, newRootModules, eclipseGroup); }); }
@Override public void write(@NotNull final JmeExporter exporter) throws IOException { super.write(exporter); final OutputCapsule capsule = exporter.getCapsule(this); capsule.write(getGamma(), "gamma", 0.6F); capsule.write(getNumColors(), "numColors", 8); capsule.write(getStrength(), "strength", 1.0f); }
@FXThread private void build(@NotNull final AbstractControl control, @NotNull final VBox container, @NotNull final ModelChangeConsumer changeConsumer) { final boolean enabled = control.isEnabled(); final BooleanPropertyControl<ModelChangeConsumer, AbstractControl> enabledControl = new BooleanPropertyControl<>(enabled, Messages.MODEL_PROPERTY_IS_ENABLED, changeConsumer); enabledControl.setApplyHandler(AbstractControl::setEnabled); enabledControl.setSyncHandler(AbstractControl::isEnabled); enabledControl.setEditObject(control); FXUtils.addToPane(enabledControl, container); }
@NotNull @Override public MultiEncryption deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException { JsonNode node = jsonParser.getCodec().readTree(jsonParser); String version = deserializeVersion(node); switch (version) { case VERSION1_0: return deserialize1_0(node); default: throw new RuntimeException("Value of " + VERSION_NAME + " is \"" + version + "\" but must be \"1.0\""); } }
@Override @FXThread protected void createComponents(@NotNull final HBox container) { super.createComponents(container); fieldContainer = new HBox(); if (!isSingleRow()) { fieldContainer.prefWidthProperty().bind(container.widthProperty()); } textureTooltip = new ImageChannelPreview(); final VBox previewContainer = new VBox(); texturePreview = new ImageView(); texturePreview.fitHeightProperty().bind(previewContainer.heightProperty()); texturePreview.fitWidthProperty().bind(previewContainer.widthProperty()); Tooltip.install(texturePreview, textureTooltip); final Button settingsButton = new Button(); settingsButton.setGraphic(new ImageView(Icons.SETTINGS_16)); settingsButton.setOnAction(event -> openSettings()); settingsButton.disableProperty().bind(buildDisableRemoveCondition()); final Button addButton = new Button(); addButton.setGraphic(new ImageView(Icons.ADD_12)); addButton.setOnAction(event -> processAdd()); final Button removeButton = new Button(); removeButton.setGraphic(new ImageView(Icons.REMOVE_12)); removeButton.setOnAction(event -> processRemove()); removeButton.disableProperty().bind(buildDisableRemoveCondition()); if (!isSingleRow()) { textureLabel = new Label(NO_TEXTURE); textureLabel.prefWidthProperty().bind(widthProperty() .subtract(removeButton.widthProperty()) .subtract(previewContainer.widthProperty()) .subtract(settingsButton.widthProperty()) .subtract(addButton.widthProperty())); FXUtils.addToPane(textureLabel, fieldContainer); FXUtils.addClassTo(textureLabel, CSSClasses.ABSTRACT_PARAM_CONTROL_ELEMENT_LABEL); FXUtils.addClassesTo(fieldContainer, CSSClasses.TEXT_INPUT_CONTAINER, CSSClasses.ABSTRACT_PARAM_CONTROL_INPUT_CONTAINER); } else { FXUtils.addClassesTo(fieldContainer, CSSClasses.TEXT_INPUT_CONTAINER_WITHOUT_PADDING); } FXUtils.addToPane(previewContainer, fieldContainer); FXUtils.addToPane(addButton, fieldContainer); FXUtils.addToPane(settingsButton, fieldContainer); FXUtils.addToPane(removeButton, fieldContainer); FXUtils.addToPane(fieldContainer, container); FXUtils.addToPane(texturePreview, previewContainer); FXUtils.addClassTo(previewContainer, CSSClasses.ABSTRACT_PARAM_CONTROL_PREVIEW_CONTAINER); FXUtils.addClassesTo(settingsButton, addButton, removeButton, CSSClasses.FLAT_BUTTON, CSSClasses.INPUT_CONTROL_TOOLBAR_BUTTON); }
Inline_Builder_xevd8x_a61a(@NotNull EditorContext context, SNode referencingNode, @NotNull SNode node) { super(context); myReferencingNode = referencingNode; myNode = node; }
Pool(@NotNull Map<String, String> options, @NotNull IMessage message, long time, @NotNull Type type) { this.options = options; this.message = message; this.time = time; this.type = type; }
@NotNull @Override public PsiType getPsiType() { //definition from dictionary by name? is it really needed? return null; }
public FolderAssetResourcePropertyControl(@NotNull final VarTable vars, @NotNull final PropertyDefinition definition, @NotNull final Runnable validationCallback) { super(vars, definition, validationCallback); }
@Override @NotNull public String id() { return "maven"; }