Codota Logo
FileEncodingQuery.getDefaultEncoding
Code IndexAdd Codota to your IDE (free)

How to use
getDefaultEncoding
method
in
org.netbeans.api.queries.FileEncodingQuery

Best Java code snippets using org.netbeans.api.queries.FileEncodingQuery.getDefaultEncoding (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
StringBuilder s =
  • Codota Iconnew StringBuilder()
  • Codota Iconnew StringBuilder(32)
  • Codota IconString str;new StringBuilder(str)
  • Smart code suggestions by Codota
}
origin: org.netbeans.modules/org-netbeans-modules-cnd-makeproject

public String getSourceEncoding() {
  if (sourceEncoding == null) {
    // Read configurations.xml. That's where encoding is stored for project version < 50)
    if (!projectDescriptorProvider.gotDescriptor()) {
      return FileEncodingQuery.getDefaultEncoding().name();
    }
  }
  if (sourceEncoding == null) {
    sourceEncoding = FileEncodingQuery.getDefaultEncoding().name();
  }
  return sourceEncoding;
}
origin: org.netbeans.modules/org-netbeans-modules-php-project

private Charset getEncoding() {
  Charset enc = (Charset) descriptor.getProperty(ENCODING);
  if (enc == null) {
    // #136917
    enc = FileEncodingQuery.getDefaultEncoding();
  }
  return enc;
}
origin: org.netbeans.modules/org-netbeans-modules-php-project

private String getEncoding() {
  return project != null ? ProjectPropertiesSupport.getEncoding(project) : FileEncodingQuery.getDefaultEncoding().name();
}
origin: org.netbeans.modules/org-netbeans-modules-swingapp

  private static String[] getSubstituteNames(String projectName, String appClassName) {
    int i = appClassName.lastIndexOf('.');
    String packageName = appClassName.substring(0, i);

    appClassName = appClassName.substring(i+1); // short name

    String appSuffix = "Application"; // NOI18N
    if (!appClassName.endsWith(appSuffix)) {
      appSuffix = "App"; // NOI18N
      if (!appClassName.endsWith(appSuffix))
        appSuffix = null;
    }
    String appPrefix = appSuffix != null ?
      appClassName.substring(0, appClassName.length() - appSuffix.length()) :
      appClassName;

    return new String[] {
      projectName,
      packageName,
      appClassName,
      appPrefix + "View", // NOI18N
      appPrefix + "AboutBox", // NOI18N
      FileEncodingQuery.getDefaultEncoding().name() // for source.encoding in project.properties
    };
  }
}
origin: org.netbeans.modules/org-netbeans-modules-cnd-modelimpl

protected final String getEncoding() {
  FileObject fo = getFileObject();
  Charset cs = null;
  if (fo != null && fo.isValid()) {
    cs = FileEncodingQuery.getEncoding(fo);
  }
  if (cs == null) {
    cs = FileEncodingQuery.getDefaultEncoding();
  }
  return cs.name();
}
origin: org.netbeans.modules/org-netbeans-modules-cnd-modelimpl

private String getEncoding() {
  FileObject fo = getFileObject();
  Charset cs = null;
  if (fo != null && fo.isValid()) {
    cs = FileEncodingQuery.getEncoding(fo);
  }
  if (cs == null) {
    cs = FileEncodingQuery.getDefaultEncoding();
  }
  return cs.name();
}

origin: org.codehaus.mevenide/nb-project

  public EncodingModel (String originalEncoding) {
    Charset defEnc = null;
    for (Charset c : Charset.availableCharsets().values()) {
      if (c.name().equals(originalEncoding)) {
        defEnc = c;
      }
      addElement(c);
    }
    if (defEnc == null) {
      //Create artificial Charset to keep the original value
      //May happen when the project was set up on the platform
      //which supports more encodings
      try {
        defEnc = new UnknownCharset (originalEncoding);
        addElement(defEnc);
      } catch (IllegalCharsetNameException e) {
        //The source.encoding property is completely broken
        Logger.getLogger(this.getClass().getName()).info("IllegalCharsetName: " + originalEncoding); //NOI18N
      }
    }
    if (defEnc == null) {
      defEnc = FileEncodingQuery.getDefaultEncoding();
    }
    setSelectedItem(defEnc);
  }
}
origin: org.netbeans.modules/org-netbeans-modules-swingapp

String ext = destFile.getExt().toLowerCase();
if (ext.endsWith("java")) { // NOI18N
  encoding = FileEncodingQuery.getDefaultEncoding().name();
} else if (ext.endsWith("form") || ext.endsWith("xml")) { // NOI18N
  encoding = "UTF-8"; // NOI18N
  propertiesEncoding = true;
} else if (fileName.startsWith("src/META-INF/")) { // NOI18N
  encoding = FileEncodingQuery.getDefaultEncoding().name();
origin: org.netbeans.modules/org-netbeans-modules-ruby-project

helper.putPrimaryConfigurationData(data, true);
Charset enc = FileEncodingQuery.getDefaultEncoding();
ep.setProperty(RubyProjectProperties.SOURCE_ENCODING, enc.name());
ep.setProperty(RubyProjectProperties.MAIN_CLASS, mainClass == null ? "" : mainClass); // NOI18N
origin: org.netbeans.modules/org-netbeans-modules-visualweb-project-jsf

String content = readResource(Thread.currentThread().getContextClassLoader().getResourceAsStream(RESOURCE_FOLDER + FORWARD_JSF), "UTF-8"); //NOI18N
content = content.replace("__FORWARD__", ConfigurationUtils.translateURI(facesMapping, pageName));
Charset encoding = FileEncodingQuery.getDefaultEncoding();
content = content.replaceAll("__ENCODING__", encoding.name());
origin: org.netbeans.modules/org-netbeans-modules-cnd-modelimpl

private long testAPTLexer(FileObject fo, boolean printTokens) throws FileNotFoundException, RecognitionException, TokenStreamException, IOException, ClassNotFoundException {
  print("Testing APT lexer:"); // NOI18N
  long time = System.currentTimeMillis();
  Reader reader = null;
  InputStream stream = null;
  try {
    stream = new BufferedInputStream(fo.getInputStream(), TraceFlags.BUF_SIZE);
    reader = new InputStreamReader(stream, FileEncodingQuery.getDefaultEncoding());
    TokenStream ts = APTTokenStreamBuilder.buildTokenStream(fo.getPath(), reader, getFileLanguage(fo));
    for (Token t = ts.nextToken(); !APTUtils.isEOF(t); t = ts.nextToken()) {
      if (printTokens) {
        print("" + t);
      }
    }
    time = System.currentTimeMillis() - time;
    if (isShowTime()) {
      print("APT Lexing " + fo.getNameExt() + " took " + time + " ms"); // NOI18N
    }
    return time;
  } finally {
    if (reader != null) {
      reader.close();
    }
    if (stream != null) {
      stream.close();
    }
  }
}
origin: org.netbeans.modules/org-netbeans-modules-ruby-railsprojects

private static RakeProjectHelper createProject(FileObject dirFO, final RubyPlatform platform, RailsProjectCreateData createData) throws IOException {
  RakeProjectHelper h = ProjectGenerator.createProject(dirFO, RailsProjectType.TYPE);
  Element data = h.getPrimaryConfigurationData(true);
  Document doc = data.getOwnerDocument();
  Element nameEl = doc.createElementNS(RailsProjectType.PROJECT_CONFIGURATION_NAMESPACE, "name"); // NOI18N
  nameEl.appendChild(doc.createTextNode(createData.getName()));
  data.appendChild(nameEl);
  // set the target server
  EditableProperties privateProperties = h.getProperties(RakeProjectHelper.PRIVATE_PROPERTIES_PATH);
  privateProperties.put(RailsProjectProperties.RAILS_SERVERTYPE, createData.getServerInstanceId());
  EditableProperties ep = h.getProperties(RakeProjectHelper.PROJECT_PROPERTIES_PATH);
  RubyInstance instance = ServerRegistry.getDefault().getServer(createData.getServerInstanceId(), platform);
  int port = instance != null ? instance.getRailsPort() : 3000;
  ep.setProperty(RailsProjectProperties.RAILS_PORT, String.valueOf(port));
  Charset enc = FileEncodingQuery.getDefaultEncoding();
  ep.setProperty(RailsProjectProperties.SOURCE_ENCODING, enc.name());
  h.putPrimaryConfigurationData(data, true);
  RailsProjectProperties.storePlatform(ep, platform);
  h.putProperties(RakeProjectHelper.PRIVATE_PROPERTIES_PATH, privateProperties);
  h.putProperties(RakeProjectHelper.PROJECT_PROPERTIES_PATH, ep);
  return h;
}
origin: org.netbeans.modules/org-netbeans-modules-form-j2ee

String javaEncoding = FileEncodingQuery.getDefaultEncoding().name();
String form = read(formFile, formEncoding);
String java = read(javaFile, javaEncoding);
origin: dcaoyuan/nbscala

ep.setProperty(J2SEProjectProperties.JAVADOC_ENCODING, "${"+J2SEProjectProperties.SOURCE_ENCODING+"}"); // NOI18N
ep.setProperty(J2SEProjectProperties.JAVADOC_ADDITIONALPARAM, ""); // NOI18N
Charset enc = FileEncodingQuery.getDefaultEncoding();
ep.setProperty(J2SEProjectProperties.SOURCE_ENCODING, enc.name());
if (manifestFile != null) {
origin: org.netbeans.modules/org-netbeans-modules-javafx2-project

ep.setProperty(JFXProjectProperties.JAVADOC_ENCODING, "${" + JFXProjectProperties.SOURCE_ENCODING + "}"); // NOI18N
ep.setProperty(JFXProjectProperties.JAVADOC_ADDITIONALPARAM, ""); // NOI18N
Charset enc = FileEncodingQuery.getDefaultEncoding();
ep.setProperty(JFXProjectProperties.SOURCE_ENCODING, enc.name());
if (manifestFile != null) {
origin: org.netbeans.modules/org-netbeans-modules-j2ee-ejbjarproject

Charset enc = FileEncodingQuery.getDefaultEncoding();
ep.setProperty(EjbJarProjectProperties.SOURCE_ENCODING, enc.name());
origin: org.netbeans.modules/org-netbeans-modules-j2ee-clientproject

Charset enc = FileEncodingQuery.getDefaultEncoding();
epPriv.setProperty(AppClientProjectProperties.SOURCE_ENCODING, enc.name());
origin: org.netbeans.modules/org-netbeans-modules-web-project

Charset enc = FileEncodingQuery.getDefaultEncoding();
ep.setProperty(WebProjectProperties.SOURCE_ENCODING, enc.name());
origin: org.netbeans.modules/org-netbeans-modules-j2ee-ejbjarproject

ep.setProperty(EjbJarProjectProperties.SRC_DIR, "${"+EjbJarProjectProperties.SOURCE_ROOT+"}/"+DEFAULT_JAVA_FOLDER); //NOI18N
ep.setProperty(EjbJarProjectProperties.META_INF_EXCLUDES, "sun-cmp-mappings.xml"); // NOI18N
Charset enc = FileEncodingQuery.getDefaultEncoding();
ep.setProperty(EjbJarProjectProperties.SOURCE_ENCODING, enc.name());
h.putProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH, ep);
origin: org.netbeans.modules/org-netbeans-modules-web-jsf

          String content = readResource(getClass().getResourceAsStream(RESOURCE_FOLDER + FORWARD_JSF), "UTF-8"); //NOI18N
          content = content.replace("__FORWARD__", ConfigurationUtils.translateURI(facesMapping, WELCOME_JSF));
          Charset encoding = FileEncodingQuery.getDefaultEncoding();
          content = content.replaceAll("__ENCODING__", encoding.name());
Charset encoding = FileEncodingQuery.getDefaultEncoding();
content = content.replaceAll("__ENCODING__", encoding.name());
FileObject target = FileUtil.createData(webModule.getDocumentBase(), WELCOME_JSF);
org.netbeans.api.queriesFileEncodingQuerygetDefaultEncoding

Javadoc

Returns the encoding which should be used for newly created projects. The typical user of this method is a code generating new projects. The returned value is a last used encoding set for project.

Popular methods of FileEncodingQuery

  • getEncoding
    Returns encoding of given file. A folder also may be passed to this method in an attempt to get the
  • setDefaultEncoding
    Sets the encoding which should be used for newly created projects. The typical user of this method i

Popular in Java

  • Parsing JSON documents to java classes using gson
  • startActivity (Activity)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • onCreateOptionsMenu (Activity)
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • FileWriter (java.io)
    Convenience class for writing character files. The constructors of this class assume that the defaul
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • Properties (java.util)
    The Properties class represents a persistent set of properties. The Properties can be saved to a st
  • Reference (javax.naming)
  • BoxLayout (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now