Package com.salas.bb.plugins.domain

Examples of com.salas.bb.plugins.domain.Package


        // Load, initialize and populate the list
        List<File> packages = getPackages();
        for (File pckg : packages)
        {
            Package p = load(pckg);
            if (p != null)
            {
                try
                {
                    p.initialize();
                } catch (Throwable e)
                {
                    LOG.log(Level.SEVERE, "Failed to initailize the action.", e);
                }
                enabledPackages.add(p);
View Full Code Here


                for (File file : files)
                {
                    if ((file.isDirectory() || file.getName().matches(PACKAGE_FILENAME_PATTERN)) &&
                        !uninstallFilenames.contains(file.getName()))
                    {
                        Package p = load(file);
                        if (p != null) INSTALLED_PACKAGES.add(p);
                    }
                }
            }
        }
View Full Code Here

     *
     * @return loaded package or <code>NULL</code> if failed.
     */
    private static Package load(File packageFile)
    {
        Package p = null;
        InputStream is = null;

        try
        {
            // Create loader for the package and initialize the stream
View Full Code Here

        String desc = elPackage.getAttributeValue(ATTR_PACKAGE_DESCRIPTION);

        if (StringUtils.isEmpty(name)) throw new LoaderException("Package name isn't specified");
        if (StringUtils.isEmpty(desc)) throw new LoaderException("Package description isn't specified");

        Package p = new Package(packageFile.getName(), name, desc,
            elPackage.getAttributeValue(ATTR_PACKAGE_VERSION),
            elPackage.getAttributeValue(ATTR_PACKAGE_AUTHOR),
            elPackage.getAttributeValue(ATTR_PACKAGE_EMAIL));

        List elements = elPackage.getChildren();
        for (Object elementO : elements)
        {
            Element element = (Element)elementO;
            String elName = element.getName();

            IPlugin plugin = null;
            if (NODE_THEME.equals(elName))
            {
                plugin = parseTheme(element, loader);
            } else if (NODE_ACTIONS.equals(elName))
            {
                plugin = parseActions(element, loader);
            } else if (NODE_RESOURCES.equals(elName))
            {
                plugin = parseResources(element, loader);
            } else if (NODE_STRINGS.equals(elName))
            {
                plugin = parseStrings(element, loader);
            } else if (NODE_PREFERENCES.equals(elName))
            {
                plugin = parsePreferences(element);
            } else if (NODE_SMARTFEED.equals(elName))
            {
                plugin = parseSmartFeed(element, loader);
            } else if (NODE_CODE.equals(elName))
            {
                plugin = parseCode(element, loader);
            } else if (NODE_TOOLBAR.equals(elName))
            {
                plugin = parseToolbar(element);
            }

            if (plugin != null) p.add(plugin);
        }

        return p;
    }
View Full Code Here

         */
        public boolean equals(Object o)
        {
            if (this == o) return true;

            Package thatSource = o instanceof Package ? (Package)o : ((PackageCheckBox)o).getSource();

            return source != null ? source.equals(thatSource) : thatSource == null;
        }
View Full Code Here

    /**
     * Invoked when the selection state of the plug-in table changes.
     */
    private void onSelectionChange()
    {
        Package pckg = tblPackages.getHighlightedPackage();
        btnUninstall.setEnabled(pckg != null);

        String descr = null;
        if (pckg != null)
        {
            // Collect plug-in stats
            Map<String, Integer> cnts = new HashMap<String, Integer>();
            for (IPlugin plugin : pckg)
            {
                String typeName = plugin.getTypeName();
                Integer cnt = cnts.get(typeName);
                if (cnt == null) cnt = 0;
                cnts.put(typeName, cnt + 1);
            }

            // Build the list
            int i = 0;
            String[] contents = new String[cnts.size()];
            for (Map.Entry<String, Integer> entry : cnts.entrySet())
            {
                String type = entry.getKey();
                int cnt = entry.getValue();

                contents[i++] = type + (cnt > 1 ? " (" + cnt + ")" : "");
            }

            // Create the description text
            descr = MessageFormat.format("{0}\n\nAuthor: {1} {2}\nContents: {3}",
                pckg.getDescription(), pckg.getAuthor(), pckg.getEmail(), StringUtils.join(contents, ", "));
        }

        taDescription.setText(descr);
    }
View Full Code Here

         *
         * @param e event object.
         */
        public void actionPerformed(ActionEvent e)
        {
            Package pkg = tblPackages.getHighlightedPackage();
            if (pkg != null)
            {
                Manager.uninstall(pkg);
                reloadPackagesList();
                highlightFirstIfPresent();
View Full Code Here

TOP

Related Classes of com.salas.bb.plugins.domain.Package

Copyright © 2018 www.massapicom. 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.