use of gnu.trove.THashMap in project intellij-plugins by JetBrains.
the class ResolveExternalInlineStyleSourceActionTest method testFindComponent2.
@JSTestOptions({ JSTestOption.WithCssSupportLoader, JSTestOption.WithJsSupportLoader, JSTestOption.WithGumboSdk, JSTestOption.WithFlexFacet })
public void testFindComponent2() throws Exception {
Map<String, String> styles = new THashMap<>();
styles.put("left", "10");
styles.put("right", "10");
styles.put("top", "4");
ResolveExternalInlineStyleSourceAction action = new ResolveExternalInlineStyleSourceAction("innerComponentInDeclarations", "spark.components.Button", "left", styles, myModule);
PsiElement element = (PsiElement) action.find();
assertNotNull(element);
assertEquals(1808, element.getTextOffset());
}
use of gnu.trove.THashMap in project intellij-plugins by JetBrains.
the class FlashBuilderImporter method commit.
public List<Module> commit(final Project project, final ModifiableModuleModel model, final ModulesProvider modulesProvider, final ModifiableArtifactModel artifactModel) {
//FlexModuleBuilder.setupResourceFilePatterns(project);
final boolean needToCommit = model == null;
final ModifiableModuleModel moduleModel = model != null ? model : ModuleManager.getInstance(project).getModifiableModel();
final List<String> paths = getList();
final boolean isArchive = paths.size() == 1 && FlashBuilderProjectFinder.hasArchiveExtension(paths.get(0));
final List<String> dotProjectPaths = getDotProjectPaths(project);
final List<FlashBuilderProject> flashBuilderProjects = FlashBuilderProjectLoadUtil.loadProjects(dotProjectPaths, isArchive);
final Map<FlashBuilderProject, ModifiableRootModel> flashBuilderProjectToModifiableModelMap = new THashMap<>();
final Map<Module, ModifiableRootModel> moduleToModifiableModelMap = new THashMap<>();
final Set<String> moduleNames = new THashSet<>(flashBuilderProjects.size());
final FlexProjectConfigurationEditor currentFlexEditor = FlexBuildConfigurationsExtension.getInstance().getConfigurator().getConfigEditor();
assert needToCommit == (currentFlexEditor == null);
for (FlashBuilderProject flashBuilderProject : flashBuilderProjects) {
final String moduleName = makeUnique(flashBuilderProject.getName(), moduleNames);
moduleNames.add(moduleName);
final String moduleFilePath = flashBuilderProject.getProjectRootPath() + "/" + moduleName + ModuleFileType.DOT_DEFAULT_EXTENSION;
if (LocalFileSystem.getInstance().findFileByPath(moduleFilePath) != null) {
ApplicationManager.getApplication().runWriteAction(() -> ModuleBuilder.deleteModuleFile(moduleFilePath));
}
final Module module = moduleModel.newModule(moduleFilePath, FlexModuleType.getInstance().getId());
final ModifiableRootModel rootModel = currentFlexEditor != null ? currentFlexEditor.getModifiableRootModel(module) : ModuleRootManager.getInstance(module).getModifiableModel();
flashBuilderProjectToModifiableModelMap.put(flashBuilderProject, rootModel);
moduleToModifiableModelMap.put(module, rootModel);
}
final FlexProjectConfigurationEditor flexConfigEditor = currentFlexEditor != null ? currentFlexEditor : FlexProjectConfigurationEditor.createEditor(project, moduleToModifiableModelMap, null, null);
final FlashBuilderSdkFinder sdkFinder = new FlashBuilderSdkFinder(project, getParameters().myInitiallySelectedPath, flashBuilderProjects);
final FlashBuilderModuleImporter flashBuilderModuleImporter = new FlashBuilderModuleImporter(project, flexConfigEditor, flashBuilderProjects, sdkFinder);
for (final FlashBuilderProject flashBuilderProject : flashBuilderProjects) {
flashBuilderModuleImporter.setupModule(flashBuilderProjectToModifiableModelMap.get(flashBuilderProject), flashBuilderProject);
}
if (needToCommit) {
try {
flexConfigEditor.commit();
} catch (ConfigurationException e) {
Logger.getInstance(FlashBuilderImporter.class).error(e);
}
ApplicationManager.getApplication().runWriteAction(() -> {
ModifiableModelCommitter.multiCommit(moduleToModifiableModelMap.values(), moduleModel);
});
}
return new ArrayList<>(moduleToModifiableModelMap.keySet());
}
use of gnu.trove.THashMap in project intellij-plugins by JetBrains.
the class FlashBuilderModuleImporter method loadEclipsePathVariables.
private static Map<String, String> loadEclipsePathVariables(final String workspacePath) {
final Map<String, String> eclipsePathVariables = new THashMap<>();
final VirtualFile prefsFile = LocalFileSystem.getInstance().findFileByPath(workspacePath + CORE_RESOURCES_PREFS_REL_PATH);
if (prefsFile == null)
return eclipsePathVariables;
final Properties properties = new Properties();
try {
properties.load(prefsFile.getInputStream());
for (final Map.Entry<Object, Object> entry : properties.entrySet()) {
final String key = (String) entry.getKey();
if (key.startsWith(PATHVARIABLE_DOT)) {
eclipsePathVariables.put(key.substring(PATHVARIABLE_DOT.length()), (String) entry.getValue());
}
}
} catch (IOException e) {
/*ignore*/
}
return eclipsePathVariables;
}
use of gnu.trove.THashMap in project intellij-plugins by JetBrains.
the class LibrarySorter method sort.
public SortResult sort(List<Library> libraries, File outFile, Condition<String> isExternal, boolean returnDefinitionMap) throws IOException {
final THashMap<CharSequence, Definition> definitionMap = new THashMap<>(libraries.size() * 128, AbcTranscoder.HASHING_STRATEGY);
final List<LibrarySetItem> unsortedItems = collectItems(libraries, definitionMap, isExternal);
final AbcMerger abcMerger = new AbcMerger(definitionMap, outFile, definitionProcessor);
try {
final ArrayList<Library> resourceOrStyleHolders = new ArrayList<>(unsortedItems.size());
for (LibrarySetItem item : unsortedItems) {
if (!item.hasDefinitions()) {
if (item.library.hasResourceBundles()) {
resourceOrStyleHolders.add(item.library);
}
continue;
}
if (item.library.hasResourceBundles() || item.library.isStyleOwner()) {
resourceOrStyleHolders.add(item.library);
}
abcMerger.process(item.library);
}
if (definitionMapProcessor != null) {
definitionMapProcessor.process(definitionMap, abcMerger);
}
final List<Decoder> decoders = new ArrayList<>(definitionMap.size());
final String[] singleStringArray = new String[1];
definitionMap.forEachValue(definition -> {
if (definition.doAbcData != null && (definition.resolved == ResolvedState.YES || (definition.resolved == ResolvedState.UNKNOWN && processDependencies(decoders, definition, definitionMap, singleStringArray)))) {
decoders.add(createDecoder(definition));
}
return true;
});
abcMerger.end(decoders, new Encoder());
return new SortResult(returnDefinitionMap ? definitionMap : null, resourceOrStyleHolders);
} finally {
abcMerger.close();
}
}
use of gnu.trove.THashMap in project intellij-plugins by JetBrains.
the class NodeClassInfo method getNodeClassInfo.
static NodeClassInfo getNodeClassInfo(@NotNull final JSClass jsClass) {
final JSAttributeList classAttributes = jsClass.getAttributeList();
final boolean dynamic = classAttributes != null && classAttributes.hasModifier(JSAttributeList.ModifierType.DYNAMIC);
final Map<String, Icon> ownStaticFields = new THashMap<>();
final Map<String, Icon> ownStaticProperties = new THashMap<>();
final Map<String, Icon> ownFields = new THashMap<>();
final Map<String, Icon> ownProperties = new THashMap<>();
final Map<String, Icon> inheritedStaticFields = new THashMap<>();
final Map<String, Icon> inheritedStaticProperties = new THashMap<>();
final Map<String, Icon> inheritedFields = new THashMap<>();
final Map<String, Icon> inheritedProperties = new THashMap<>();
fillMapsForClass(jsClass, ownStaticFields, ownStaticProperties, ownFields, ownProperties);
fillMapsForSupersRecursively(jsClass, new THashSet<>(), inheritedStaticFields, inheritedStaticProperties, inheritedFields, inheritedProperties);
return new NodeClassInfo(normalizeIfVector(jsClass.getQualifiedName()), dynamic, ownStaticFields, ownStaticProperties, ownFields, ownProperties, inheritedStaticFields, inheritedStaticProperties, inheritedFields, inheritedProperties);
}
Aggregations