Package net.sphene.goim.rcp.extensionpoints

Source Code of net.sphene.goim.rcp.extensionpoints.ContactListExtensionPoint$ContactListExtension

/*
* Gamers Own Instant Messenger
* Copyright (C) 2005-2006 Herbert Poul (kahless@sphene.net)
* http://goim.sphene.net
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
*/
package net.sphene.goim.rcp.extensionpoints;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform;

public class ContactListExtensionPoint {
  private static final String EXTENSION_POINT = "net.sphene.goim.rcp.contactlist";
 
  private static final String VIEWID_ATTRIBUTE = "viewid";
  private static final String NAME_ATTRIBUTE = "name";

 
  private static List<ContactListExtension> contactLists = null;
 
  public static List<ContactListExtension> getContactListExtensions() {
    if(contactLists != null) return contactLists;
    IExtensionRegistry registry = Platform.getExtensionRegistry();
    IExtensionPoint extensionPoint = registry.getExtensionPoint(EXTENSION_POINT);
    contactLists = new ArrayList<ContactListExtension>();
    for(IConfigurationElement element : extensionPoint.getConfigurationElements()) {
      contactLists.add(new ContactListExtension(element));
    }
    return contactLists;
  }

  public static class ContactListExtension {
    public String viewid;
    public String name;
    public ContactListExtension(IConfigurationElement element) {
      viewid = element.getAttribute(VIEWID_ATTRIBUTE);
      name = element.getAttribute(NAME_ATTRIBUTE);
    }
  }
}
TOP

Related Classes of net.sphene.goim.rcp.extensionpoints.ContactListExtensionPoint$ContactListExtension

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.