Java Code Examples for org.openide.loaders.MultiDataObject#Entry

The following examples show how to use org.openide.loaders.MultiDataObject#Entry . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JspNode.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** Set request parameters for a given entry.
* @param entry the entry
* @param args array of arguments
* @exception IOException if arguments cannot be set
*/
static void setRequestParams(MultiDataObject.Entry entry, String params) throws IOException {
    StringBuffer newParams=new StringBuffer();
    String s=null;
    if (params!=null){
        for (int i=0;i<params.length();i++) {
            char ch = params.charAt(i);
            if ((int)ch!=13 && (int)ch!=10) newParams.append(ch);
        }
        s=newParams.toString();
        if (s.length()==0) s=null;
    } 
    WebExecSupport.setQueryString(entry.getFile (), s);
}
 
Example 2
Source File: JspServletDataLoader.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** Create a secondary file entry.
* By default, {@link FileEntry.Numb} is used for the class files
*
* @param secondaryFile secondary file to create entry for
* @return the entry
*/
protected MultiDataObject.Entry createSecondaryEntry (MultiDataObject obj, FileObject secondaryFile) {
    //The JavaDataObject itself has no secondary entries, but its subclasses have.
    //So we have to keep it as MultiFileLoader
    Logger.getLogger("global").log(Level.INFO, "Subclass of JavaDataLoader (" + this.getClass().getName() + ") has secondary entries but does not override createSecondaryEntries (MultidataObject, FileObject) method."); // NOI18N
    return new FileEntry.Numb(obj, secondaryFile);
}
 
Example 3
Source File: JavaDataLoader.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** Create the primary file entry.
    * Subclasses may override {@link JavaDataLoader.JavaFileEntry} and return a new instance
    * of the overridden entry type.
    *
    * @param primaryFile primary file recognized by this loader
    * @return primary entry for that file
    */
    protected MultiDataObject.Entry createPrimaryEntry (MultiDataObject obj, FileObject primaryFile) {
        if (getExtensions().isRegistered(primaryFile)) {
//            return new JavaFileEntry (obj, primaryFile);
            return JavaDataSupport.createJavaFileEntry(obj, primaryFile);
        }
        else {
            return new FileEntry(obj, primaryFile);
        }
    }
 
Example 4
Source File: PropertyChangeTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
protected MultiDataObject.Entry createPrimaryEntry(MultiDataObject obj, FileObject primaryFile) {
    return new FileEntry (obj, primaryFile);
}
 
Example 5
Source File: SCFTHandlerTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
protected MultiDataObject.Entry createPrimaryEntry(MultiDataObject obj, FileObject primaryFile) {
    LOG.fine("new primary entry " + primaryFile);
    return new FE(obj, primaryFile);
}
 
Example 6
Source File: SCFTHandlerTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
protected MultiDataObject.Entry createPrimaryEntry(MultiDataObject obj, FileObject primaryFile) {
    LOG.fine("new primary entry " + primaryFile);
    return new FE(obj, primaryFile);
}
 
Example 7
Source File: Util.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/** Gets a label for properties nodes for individual locales. */
public static String getLocaleLabel(MultiDataObject.Entry fe) {
    
    String localeSuffix = getLocaleSuffix(fe);
    String language;
    String country;
    String variant;

    /*
     * Get the abbreviations for language, country and variant and check
     * if at least one of them is specified. If none of them is specified,
     * return the default label:
     */
    if (localeSuffix.length() == 0) {
        language = "";                                              //NOI18N
        country = "";                                               //NOI18N
        variant = "";                                               //NOI18N
    } else {
        language = getLanguage(localeSuffix);
        country  = getCountry(localeSuffix);
        variant  = getVariant(localeSuffix);

        // intern empty strings so that we can use '==' instead of equals():
        language = language.length() != 0 ? language : "";          //NOI18N
        country  = country.length() != 0  ? country : "";           //NOI18N
        variant  = variant.length() != 0  ? variant : "";           //NOI18N
    }

    String defaultLangName = null;
    if (language == "") {                                           //NOI18N
        defaultLangName = NbBundle.getMessage(
                Util.class,
                "LAB_defaultLanguage");                             //NOI18N
    }

    /* Simple case #1 - the default locale */
    if (language == "" && country == "" && variant == "") {         //NOI18N
        return defaultLangName;
    }

    String localeSpec = localeSuffix.substring(1);
    Locale locale = new Locale(language, country, variant);

    /* - language name: */
    String langName;
    if (language == "") {                                           //NOI18N
        langName = defaultLangName;
    } else {
        langName = locale.getDisplayLanguage();
        if (langName.equals(language)) {
            langName = NbBundle.getMessage(Util.class,
                                           "LAB_unknownLanguage",   //NOI18N
                                           language);
        }
    }

    /* Simple case #2 - language specification only */
    if (country == "" && variant == "") {                           //NOI18N
        return NbBundle.getMessage(Util.class,
                                   "LAB_localeSpecLang",            //NOI18N
                                   localeSpec,
                                   langName);
    }

    /* - country name: */
    String countryName = "";                                        //NOI18N
    if (country != "") {                                            //NOI18N
        countryName = locale.getDisplayCountry();
        if (countryName.equals(country)) {
            countryName = NbBundle.getMessage(Util.class,
                                              "LAB_unknownCountry", //NOI18N
                                              country);
        }
    }

    /* - variant name: */
    String variantName = variant == "" ? ""                         //NOI18N
                                       : locale.getDisplayVariant();

    /* Last case - country and/or variant specification */
    String countryAndVariant;
    if (variantName == "") {                                        //NOI18N
        countryAndVariant = countryName;
    } else if (countryName == "") {                                 //NOI18N
        countryAndVariant = variantName;
    } else {
        countryAndVariant = countryName + ", " + variantName;       //NOI18N
    }
    return NbBundle.getMessage(Util.class,
                               "LAB_localeSpecLangCountry",         //NOI18N
                               localeSpec,
                               langName,
                               countryAndVariant);

}
 
Example 8
Source File: DefaultCreationNoTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
protected MultiDataObject.Entry createSecondaryEntry(MultiDataObject obj, FileObject secondaryFile) {
    return null;
}
 
Example 9
Source File: DefaultCreationNoTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
protected MultiDataObject.Entry createPrimaryEntry(MultiDataObject obj, FileObject primaryFile) {
    return new FE(obj, primaryFile);
}
 
Example 10
Source File: PropertiesProviderTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
protected MultiDataObject.Entry createSecondaryEntry(MultiDataObject obj, FileObject secondaryFile) {
    return new FileEntry(obj, secondaryFile);
}
 
Example 11
Source File: IndentEngineIntTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
protected MultiDataObject.Entry createSecondaryEntry(MultiDataObject obj, FileObject secondaryFile) {
    return new FileEntry(obj, secondaryFile);
}
 
Example 12
Source File: SCFTHandlerTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
protected MultiDataObject.Entry createSecondaryEntry(MultiDataObject obj, FileObject secondaryFile) {
    LOG.fine("new snd entry: " + secondaryFile);
    return new FE(obj, secondaryFile);
}
 
Example 13
Source File: CreateFromTemplateHandlerTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
protected MultiDataObject.Entry createPrimaryEntry(MultiDataObject obj, FileObject primaryFile) {
    return new FE(obj, primaryFile);
}
 
Example 14
Source File: HtmlDataObject.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/** Constructs new ViewSupport */
public ViewSupport(MultiDataObject.Entry primary) 
{
    this.primary = primary;
}
 
Example 15
Source File: PropertiesDataLoader.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/**
 * @return  <code>PropertiesFileEntry</code> for the given file
 */
protected MultiDataObject.Entry createSecondaryEntry(
        MultiDataObject obj,
        FileObject secondaryFile) {
    return new PropertiesFileEntry(obj, secondaryFile);
}
 
Example 16
Source File: PropertiesProviderTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
protected MultiDataObject.Entry createSecondaryEntry(MultiDataObject obj, FileObject secondaryFile) {
    LOG.fine("new snd entry: " + secondaryFile);
    return new FE(obj, secondaryFile);
}
 
Example 17
Source File: ImageOpenSupport.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/** Constructs ImageOpenSupportObject on given MultiDataObject.Entry. */
public ImageOpenSupport(MultiDataObject.Entry entry) {
    super(entry, new Environment(entry.getDataObject())); // TEMP
}
 
Example 18
Source File: Util.java    From netbeans with Apache License 2.0 3 votes vote down vote up
/**
 * Returns a locale specification suffix of a given
 * <code>MultiDataObject</code> entry.
 * <p>
 * Examples:<br />
 * <pre>    </pre>Bundle.properties       -&gt; &quot;&quot;<br />
 * <pre>    </pre>Bundle_en_CA.properties -&gt; &quot;_en_CA&quot;
 * 
 * @param  fe  <code>DataObject</code> entry, representing a single bundle
 * @return  locale specification suffix of a given entry;
 *          or an empty string if the given entry has no locale suffix
 * @see  #getLanguage
 * @see  #getCountry
 * @see  #getVariant
 */
public static String getLocaleSuffix(MultiDataObject.Entry fe) {
    FileObject fo = fe.getFile();
    String fName = fo.getName();
    String baseName = getBaseName(fName);
    if (fName.equals(baseName))
        return "";
    else
        return fName.substring(baseName.length());
}
 
Example 19
Source File: BinaryModelFileLoader.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 2 votes vote down vote up
/** Create a secondary file entry.
 * Secondary files are properties files, which should also be retained (so, not a
 * FileEntry.Numb object)
 * @param secondaryFile secondary file to create entry for
 * @return the entry
 */
protected MultiDataObject.Entry createSecondaryEntry(
        MultiDataObject obj, FileObject secondaryFile) {
    return new FileEntry(obj, secondaryFile);
}
 
Example 20
Source File: SimpleES.java    From netbeans with Apache License 2.0 2 votes vote down vote up
/** Constructor. 
 * @param obj data object to work on
 * @param set set to add/remove save cookie from
 */
public SimpleES (DataObject obj, MultiDataObject.Entry entry, CookieSet set) {
    this(obj, entry, set, null);
}