Examples of WebItemModuleDescriptor


Examples of com.atlassian.plugin.web.descriptors.WebItemModuleDescriptor

        descriptorGeneratorManager.unregisterGenerator(getPluginKey(), getKey());
    }

    public Iterable<WebItemModuleDescriptor> getDescriptorsToExposeForUsers(ConditionGenerator conditionGenerator, long state)
    {
        WebItemModuleDescriptor descriptor;
        try
        {
            Class cls = getClass().getClassLoader().loadClass("com.atlassian.confluence.plugin.descriptor.web.descriptors.ConfluenceWebItemModuleDescriptor");
            descriptor = (WebItemModuleDescriptor) cls.newInstance();
        }
        catch (Exception e)
        {
            // not confluence so try JIRA
            try
            {
                // Yes, this all sucks
                Class cls = getClass().getClassLoader().loadClass("com.atlassian.jira.plugin.webfragment.descriptors.JiraWebItemModuleDescriptor");
                Class ctx = getClass().getClassLoader().loadClass("com.atlassian.jira.security.JiraAuthenticationContext");
                Class mgrClass = getClass().getClassLoader().loadClass("com.atlassian.jira.ComponentManager");
                Object mgr = mgrClass.getMethod("getInstance").invoke(mgrClass);

                descriptor = (WebItemModuleDescriptor) cls.getConstructor(ctx, WebInterfaceManager.class).newInstance(
                        mgrClass.getMethod("getJiraAuthenticationContext").invoke(mgr),
                        webInterfaceManager
                );
            }
            catch (Exception ex)
            {
                // not JIRA or confluence so ignore

                descriptor = new DefaultWebItemModuleDescriptor(webInterfaceManager);
            }
        }

        Element userElement = (Element) originalElement.clone();
        userElement.addAttribute("key", getStatefulKey(userElement.attributeValue("key"), state));

        conditionGenerator.addConditionElement(userElement);
        resolveLinkPaths(state, userElement);

        descriptor.init(new ClassOverwrittingPlugin(getPlugin()), userElement);
        return Collections.singleton(descriptor);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.