use of com.jetbrains.cidr.lang.workspace.OCWorkspace in project intellij by bazelbuild.
the class BlazeCppIntegrationTestCase method enableCSupportInIde.
private static void enableCSupportInIde(Project project) {
OCWorkspace workspace = OCWorkspaceProvider.getWorkspace(project);
assertThat(workspace).isNotNull();
if (LANGUAGE_SUPPORT_DISABLED.get(project, false)) {
LANGUAGE_SUPPORT_DISABLED.set(project, false);
}
}
use of com.jetbrains.cidr.lang.workspace.OCWorkspace in project intellij by bazelbuild.
the class SyncStatusHelper method isUnsynced.
static boolean isUnsynced(Project project, VirtualFile virtualFile) {
if (!virtualFile.isInLocalFileSystem()) {
return false;
}
if (ProjectFileIndex.SERVICE.getInstance(project).getModuleForFile(virtualFile) == null) {
return false;
}
OCWorkspace workspace = OCWorkspaceProvider.getWorkspace(project);
if (!(workspace instanceof BlazeCWorkspace)) {
// Skip if the project isn't a Blaze project or doesn't have C support enabled anyway.
return false;
}
if (workspace.getConfigurations().isEmpty()) {
// The workspace configurations may not have been loaded yet.
return false;
}
SourceToTargetMap sourceToTargetMap = SourceToTargetMap.getInstance(project);
return sourceToTargetMap.getRulesForSourceFile(VfsUtilCore.virtualToIoFile(virtualFile)).isEmpty();
}
use of com.jetbrains.cidr.lang.workspace.OCWorkspace in project intellij by bazelbuild.
the class BlazeCSyncPlugin method updateInMemoryState.
@Override
public void updateInMemoryState(Project project, BlazeContext context, WorkspaceRoot workspaceRoot, ProjectViewSet projectViewSet, BlazeProjectData blazeProjectData, Module workspaceModule) {
if (!blazeProjectData.workspaceLanguageSettings.isLanguageActive(LanguageClass.C)) {
return;
}
Scope.push(context, childContext -> {
childContext.push(new TimingScope("Setup C Workspace", EventType.Other));
OCWorkspace workspace = OCWorkspaceProvider.getWorkspace(project);
if (workspace instanceof BlazeCWorkspace) {
BlazeCWorkspace blazeCWorkspace = (BlazeCWorkspace) workspace;
blazeCWorkspace.update(childContext, workspaceRoot, projectViewSet, blazeProjectData);
}
});
}
use of com.jetbrains.cidr.lang.workspace.OCWorkspace in project intellij by bazelbuild.
the class BlazeCppSymbolRebuildSyncListener method onSyncComplete.
@Override
public void onSyncComplete(Project project, BlazeContext context, BlazeImportSettings importSettings, ProjectViewSet projectViewSet, BlazeProjectData blazeProjectData, SyncMode syncMode, SyncResult syncResult) {
if (!blazeProjectData.workspaceLanguageSettings.isLanguageActive(LanguageClass.C)) {
return;
}
OCWorkspace workspace = OCWorkspaceProvider.getWorkspace(project);
if (!(workspace instanceof BlazeCWorkspace)) {
return;
}
loadOrRebuildSymbolTables(project);
}
use of com.jetbrains.cidr.lang.workspace.OCWorkspace in project intellij by bazelbuild.
the class BlazeNdkSupportEnabler method enableCSupportInIde.
/**
* If {@code enabled} is true, this method will enable C support in the IDE if it is not already
* enabled. if {@code enabled} is false this method will clear out any currently stored
* information in the IDE about C and will disable C support in the IDE, unless support is already
* disabled. In either case, if the value of enabled matches what the IDE currently does, this
* method will do nothing.
*
* @param project the project to enable or disable c support in.
* @param enabled if true, turn on C support in the IDE. If false, turn off C support in the IDE.
*/
private static void enableCSupportInIde(Project project, boolean enabled) {
OCWorkspace workspace = OCWorkspaceProvider.getWorkspace(project);
if (workspace == null) {
// NDK workspace manager plugin isn't enabled.
return;
}
Boolean isCurrentlyEnabled = !LANGUAGE_SUPPORT_DISABLED.get(project, false);
if (isCurrentlyEnabled != enabled) {
NdkHelper.disableCppLanguageSupport(project, !enabled);
rebuildSymbols(project);
}
}
Aggregations