Search in sources :

Example 1 with ExternalEntityData

use of com.intellij.openapi.externalSystem.model.project.ExternalEntityData in project intellij-community by JetBrains.

the class OpenExternalConfigAction method isEnabled.

@Override
protected boolean isEnabled(AnActionEvent e) {
    if (!super.isEnabled(e))
        return false;
    final ExternalEntityData externalData = getExternalData(e, ExternalEntityData.class);
    if (!(externalData instanceof ExternalConfigPathAware))
        return false;
    VirtualFile config = getExternalConfig((ExternalConfigPathAware) externalData, externalData.getOwner());
    if (config == null)
        return false;
    ProjectSystemId externalSystemId = getSystemId(e);
    e.getPresentation().setText(ExternalSystemBundle.message("action.open.config.text", externalSystemId.getReadableName()));
    e.getPresentation().setDescription(ExternalSystemBundle.message("action.open.config.description", externalSystemId.getReadableName()));
    final ExternalSystemUiAware uiAware = getExternalSystemUiAware(e);
    if (uiAware != null) {
        e.getPresentation().setIcon(uiAware.getProjectIcon());
    }
    return true;
}
Also used : ExternalConfigPathAware(com.intellij.openapi.externalSystem.model.project.ExternalConfigPathAware) VirtualFile(com.intellij.openapi.vfs.VirtualFile) ExternalEntityData(com.intellij.openapi.externalSystem.model.project.ExternalEntityData) ProjectSystemId(com.intellij.openapi.externalSystem.model.ProjectSystemId) ExternalSystemUiAware(com.intellij.openapi.externalSystem.ExternalSystemUiAware)

Aggregations

ExternalSystemUiAware (com.intellij.openapi.externalSystem.ExternalSystemUiAware)1 ProjectSystemId (com.intellij.openapi.externalSystem.model.ProjectSystemId)1 ExternalConfigPathAware (com.intellij.openapi.externalSystem.model.project.ExternalConfigPathAware)1 ExternalEntityData (com.intellij.openapi.externalSystem.model.project.ExternalEntityData)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1