/** Returns list of file extensions associated with specified MIME type. In * other words files with those extensions are recognized as specified MIME type * in NetBeans' filesystem. It never returns {@code null}. * @param mimeType the MIME type (e.g. image/gif) * @return list of file extensions associated with specified MIME type, never {@code null} * @see #setMIMEType(String, String) * @since org.openide.filesystems 7.18 */ public static List<String> getMIMETypeExtensions(String mimeType) { Parameters.notEmpty("mimeType", mimeType); //NOI18N HashMap<String, String> extensionToMime = new HashMap<String, String>(); for (FileObject mimeResolverFO : MIMEResolverImpl.getOrderedResolvers()) { Map<String, Set<String>> mimeToExtensions = MIMEResolverImpl.getMIMEToExtensions(mimeResolverFO); for (Map.Entry<String, Set<String>> entry : mimeToExtensions.entrySet()) { String mimeKey = entry.getKey(); Set<String> extensions = entry.getValue(); for (String extension : extensions) { extensionToMime.put(extension, mimeKey); } } } List<String> registeredExtensions = new ArrayList<String>(); for (Map.Entry<String, String> entry : extensionToMime.entrySet()) { if (entry.getValue().equals(mimeType)) { registeredExtensions.add(entry.getKey()); } } return registeredExtensions; }
Parameters.notEmpty("extension", extension); //NOI18N final Map<String, Set<String>> mimeToExtensions = new HashMap<String, Set<String>>(); FileObject userDefinedResolverFO = MIMEResolverImpl.getUserDefinedResolver();
/** * Constructs a new exception with the specified detail failure message and cause. * @param failureMessage the detail failure message. * @param cause the cause (which is saved for later retrieval by the * {@link #getCause()} method). (A <tt>null</tt> value is permitted, * and indicates that the cause is nonexistent or unknown.) */ public ExtendingException(String failureMessage, Throwable cause) { super(failureMessage, cause); Parameters.notEmpty("failureMessage", failureMessage); }
/** * Set display name that is used for executable running (as a title of the Output window). * <p> * The default value is {@link #getExecutable() executable} with {@link #getParameters() parameters}. * @param displayName display name that is used for executable running * @return the external executable instance itself */ public ExternalExecutable displayName(String displayName) { Parameters.notEmpty("displayName", displayName); // NOI18N this.displayName = displayName; return this; }
/** * Set display name that is used for executable running (as a title of the Output window). * <p> * The default value is {@link #getExecutable() executable} with {@link #getParameters() parameters}. * @param displayName display name that is used for executable running * @return the PHP Executable instance itself */ public PhpExecutable displayName(String displayName) { Parameters.notEmpty("displayName", displayName); // NOI18N this.displayName = displayName; return this; }
/** * Set identifier of the IDE PHP Options. If the executable is not {@link PhpExecutableValidator valid} and user should be * {@link #warnUser(boolean) warned} about it, IDE Options are opened with this category selected. * <p> * The default value is {@code null} (the General PHP category). * @param optionsSubcategory identifier of the IDE PHP Options * @return the PHP Executable instance itself */ public PhpExecutable optionsSubcategory(String optionsSubcategory) { Parameters.notEmpty("optionsSubcategory", optionsSubcategory); // NOI18N this.optionsSubcategory = optionsSubcategory; return this; }
/** * Remove custom parameter. * @param key key of the parameter */ public void removeParameter(String key) { Parameters.notEmpty("key", key); // NOI18N parameters.remove(key); }
/** * Capitalizes first character of the passed input. * <p> * Example: foobarbaz -> Foobarbaz * @param input text to be capitalized, never null or empty * @return capitalized input string, never null * @since 2.21 */ public static String capitalize(String input) { Parameters.notEmpty("input", input); //NOI18N return input.substring(0, 1).toUpperCase() + input.substring(1); }
/** * Decapitalizes first character of the passed input. * <p> * Example: Foobarbaz -> foobarbaz * @param input text to be decapitalized, never null or empty * @return decapitalized input string, never null * @since 2.33 */ public static String decapitalize(String input) { Parameters.notEmpty("input", input); //NOI18N return input.substring(0, 1).toLowerCase() + input.substring(1); }
/** * Set name of the executable. This name is used for {@link PhpExecutableValidator validation} only (before running). * <p> * The default value is {@code null} (it means "File"). * @param executableName name of the executable * @return the PHP Executable instance itself */ public PhpExecutable executableName(@NonNull String executableName) { Parameters.notEmpty("executableName", executableName); // NOI18N this.executableName = executableName; return this; }
/** * Set custom parameter. * @param key key of the parameter * @param value value of the parameter */ public void setParameter(String key, Object value) { Parameters.notEmpty("key", key); // NOI18N Parameters.notNull("value", value); // NOI18N parameters.put(key, value); }
/** * Set name of the executable. This name is used for {@link ExternalExecutableValidator validation} only (before running). * <p> * The default value is {@code null} (it means "File"). * @param executableName name of the executable * @return the external executable instance itself */ public ExternalExecutable executableName(@NonNull String executableName) { Parameters.notEmpty("executableName", executableName); // NOI18N this.executableName = executableName; return this; }
/** * Create new annotation tag with documentation. * @param name tag name; never {@code null} * @param insertTemplate text that it inserted to the source file; never {@code null} * @param documentation documentation of the tag, HTML allowed; can be {@code null} */ public AnnotationCompletionTag(@NonNull String name, @NonNull String insertTemplate, @NullAllowed String documentation) { Parameters.notEmpty("name", name); Parameters.notEmpty("insertTemplate", insertTemplate); this.name = name; this.insertTemplate = insertTemplate; this.documentation = documentation; }
/** * Create new annotation tag with documentation. * @param name tag name; never {@code null} * @param insertTemplate text that it inserted to the source file; never {@code null} * @param documentation documentation of the tag, HTML allowed; can be {@code null} */ public AnnotationCompletionTag(@NonNull String name, @NonNull String insertTemplate, @NullAllowed String documentation) { Parameters.notEmpty("name", name); Parameters.notEmpty("insertTemplate", insertTemplate); this.name = name; this.insertTemplate = insertTemplate; this.documentation = documentation; }
/** * Constructs a new exception with the specified detail failure message and cause. * @param failureMessage the detail failure message. * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method). * (A {@code null} value is permitted, and indicates that the cause is nonexistent or unknown.) */ public ExtendingException(@NonNull String failureMessage, @NullAllowed Throwable cause) { super(failureMessage, cause); Parameters.notEmpty("failureMessage", failureMessage); }
/** * Set Site Root folder, never {@code null} or empty string. * * @param siteRootFolder Site Root folder, never {@code null} or empty string * @return itself * @since 1.37 */ @NonNull public CreateProjectProperties setSiteRootFolder(@NonNull String siteRootFolder) { Parameters.notEmpty("siteRootFolder", siteRootFolder); // NOI18N this.siteRootFolder = siteRootFolder; return this; }
/** * Set project name, never {@code null} or empty string. * * @param projectName project name, never {@code null} or empty string * @return itself * @since 1.37 */ @NonNull public CreateProjectProperties setProjectName(@NonNull String projectName) { Parameters.notEmpty("projectName", projectName); // NOI18N this.projectName = projectName; return this; }
protected PhpBaseElement(@NonNull String name, @NullAllowed String fullyQualifiedName, @NullAllowed PhpClass type, @NullAllowed FileObject file, int offset, @NullAllowed String description) { Parameters.notEmpty("name", name); this.name = name; this.fullyQualifiedName = fullyQualifiedName; this.type = type; this.file = file; this.offset = offset; this.description = description; }