use of com.intellij.facet.FacetManagerAdapter in project android by JetBrains.
the class AndroidProjectComponent method projectOpened.
@Override
public void projectOpened() {
final CompilerManager manager = CompilerManager.getInstance(myProject);
manager.addBeforeTask(new AndroidPrecompileTask());
myDisposable = Disposer.newDisposable(getClass().getName());
if (!ApplicationManager.getApplication().isUnitTestMode() && !ApplicationManager.getApplication().isHeadlessEnvironment()) {
if (ProjectFacetManager.getInstance(myProject).hasFacets(AndroidFacet.ID)) {
createAndroidSpecificComponents();
} else {
final MessageBusConnection connection = myProject.getMessageBus().connect(myDisposable);
connection.subscribe(FacetManager.FACETS_TOPIC, new FacetManagerAdapter() {
@Override
public void facetAdded(@NotNull Facet facet) {
if (facet instanceof AndroidFacet) {
createAndroidSpecificComponents();
connection.disconnect();
}
}
});
}
}
}
use of com.intellij.facet.FacetManagerAdapter in project intellij-plugins by JetBrains.
the class OsmorcPostStartupActivity method runActivity.
@Override
public void runActivity(@NotNull Project project) {
if (project.isDefault()) {
return;
}
MessageBusConnection connection = project.getMessageBus().connect();
connection.subscribe(FacetManager.FACETS_TOPIC, new FacetManagerAdapter() {
@Override
public void facetAdded(@NotNull Facet facet) {
handleFacetChange(facet, project);
}
@Override
public void facetConfigurationChanged(@NotNull Facet facet) {
handleFacetChange(facet, project);
}
});
connection.subscribe(ProjectManager.TOPIC, new ProjectManagerListener() {
@Override
public void projectClosing(Project project) {
for (Module module : ModuleManager.getInstance(project).getModules()) {
AdditionalJARContentsWatcherManager.getInstance(module).cleanup();
}
}
});
}
use of com.intellij.facet.FacetManagerAdapter in project intellij-community by JetBrains.
the class FacetPointersManagerImpl method initComponent.
@Override
public void initComponent() {
MessageBusConnection connection = myProject.getMessageBus().connect();
connection.subscribe(ProjectTopics.MODULES, new ModuleListener() {
@Override
public void moduleAdded(@NotNull Project project, @NotNull Module module) {
refreshPointers(module);
}
@Override
public void modulesRenamed(@NotNull Project project, @NotNull List<Module> modules, @NotNull Function<Module, String> oldNameProvider) {
for (Module module : modules) {
refreshPointers(module);
}
}
});
connection.subscribe(FacetManager.FACETS_TOPIC, new FacetManagerAdapter() {
@Override
public void facetAdded(@NotNull Facet facet) {
refreshPointers(facet.getModule());
}
@Override
public void beforeFacetRenamed(@NotNull Facet facet) {
final FacetPointerImpl pointer = myPointers.get(constructId(facet));
if (pointer != null) {
pointer.refresh();
}
}
@Override
public void facetRenamed(@NotNull final Facet facet, @NotNull final String oldName) {
refreshPointers(facet.getModule());
}
});
for (Module module : ModuleManager.getInstance(myProject).getModules()) {
refreshPointers(module);
}
}
Aggregations