Search in sources :

Example 1 with ResourceBundleNode

use of com.intellij.lang.properties.projectView.ResourceBundleNode in project intellij-community by JetBrains.

the class AddNewPropertyFileAction method update.

@Override
public void update(AnActionEvent e) {
    final Navigatable[] data = CommonDataKeys.NAVIGATABLE_ARRAY.getData(e.getDataContext());
    if (data != null && data.length == 1) {
        if (data[0] instanceof ResourceBundleNode || data[0] instanceof CustomResourceBundlePropertiesFileNode) {
            final ResourceBundle resourceBundle = (ResourceBundle) ((ProjectViewNode) data[0]).getValue();
            LOG.assertTrue(resourceBundle != null);
            if (CreateResourceBundleDialogComponent.getResourceBundlePlacementDirectory(resourceBundle) != null) {
                e.getPresentation().setEnabledAndVisible(true);
                return;
            }
        }
    }
    e.getPresentation().setEnabledAndVisible(false);
}
Also used : ResourceBundleNode(com.intellij.lang.properties.projectView.ResourceBundleNode) CustomResourceBundlePropertiesFileNode(com.intellij.lang.properties.projectView.CustomResourceBundlePropertiesFileNode) ResourceBundle(com.intellij.lang.properties.ResourceBundle) Navigatable(com.intellij.pom.Navigatable)

Example 2 with ResourceBundleNode

use of com.intellij.lang.properties.projectView.ResourceBundleNode in project intellij-community by JetBrains.

the class ResourcesFavoriteNodeProvider method getFavoriteNodes.

@Override
public Collection<AbstractTreeNode> getFavoriteNodes(final DataContext context, final ViewSettings viewSettings) {
    final Project project = CommonDataKeys.PROJECT.getData(context);
    if (project == null) {
        return null;
    }
    final ResourceBundle[] resourceBundles = ResourceBundle.ARRAY_DATA_KEY.getData(context);
    //on bundles nodes
    if (resourceBundles != null) {
        final Collection<AbstractTreeNode> result = new ArrayList<>();
        for (ResourceBundle bundle : resourceBundles) {
            result.add(new ResourceBundleNode(project, bundle, viewSettings));
        }
        return result;
    }
    return null;
}
Also used : ResourceBundleNode(com.intellij.lang.properties.projectView.ResourceBundleNode) Project(com.intellij.openapi.project.Project) ArrayList(java.util.ArrayList) AbstractTreeNode(com.intellij.ide.util.treeView.AbstractTreeNode) ResourceBundle(com.intellij.lang.properties.ResourceBundle)

Aggregations

ResourceBundle (com.intellij.lang.properties.ResourceBundle)2 ResourceBundleNode (com.intellij.lang.properties.projectView.ResourceBundleNode)2 AbstractTreeNode (com.intellij.ide.util.treeView.AbstractTreeNode)1 CustomResourceBundlePropertiesFileNode (com.intellij.lang.properties.projectView.CustomResourceBundlePropertiesFileNode)1 Project (com.intellij.openapi.project.Project)1 Navigatable (com.intellij.pom.Navigatable)1 ArrayList (java.util.ArrayList)1