|
What this is
Other links
The source code/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original * Code is Ralph Krueger. */ package org.netbeans.modules.changelog.settings; import java.beans.*; import java.util.*; import org.openide.util.*; import org.netbeans.modules.changelog.html.*; /** Property editor for Default Server Info prop. of the ChangeLog settings * * @author Ralph Krueger */ public class DefaultServerInfoPE extends PropertyEditorSupport { private static final java.util.ResourceBundle bundle = NbBundle.getBundle(DefaultServerInfoPE.class); /** localized string*/ private final static String DEFAULTS = bundle.getString("DefaultServerInfoPE.noDefault.text"); // NOI18N /** array of display names */ private String[] texts; /** array of internal Ids */ private String[] ids; /** @return names of the supported LookAndFeels */ public String[] getTags() { if (texts == null ) { initValues(); } return texts; } private void initValues() { Lookup.Template template = new Lookup.Template(ChangeLogHTMLService.class); Lookup.Result result = Lookup.getDefault().lookup(template); Collection col = result.allItems(); texts = new String[col.size() + 1]; ids = new String[col.size() + 1]; texts[0] = DEFAULTS; ids[0] = ""; Iterator it = col.iterator(); int index = 1; while (it.hasNext()) { Lookup.Item item = (Lookup.Item)it.next(); ChangeLogHTMLService serv = (ChangeLogHTMLService)item.getInstance(); texts[index] = serv.getName(); ids[index] = item.getId(); index = index + 1; } } private int findIndexInArray(String[] arr, String value) { for (int i = 0; i < arr.length; i++) { if (value.equals(arr[i])) { return i; } } return -1; } /** Gets the property value as a string suitable for presentation * to a human to edit. * * @return The property value as a string suitable for presentation * to a human to edit. * |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.