Java Code Examples for org.netbeans.spi.project.support.ant.PropertyUtils#getUsablePropertyName()
The following examples show how to use
org.netbeans.spi.project.support.ant.PropertyUtils#getUsablePropertyName() .
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: PlatformConvertor.java From netbeans with Apache License 2.0 | 6 votes |
@NonNull public static String getFreeAntName (@NonNull final String name) { if (name == null || name.length() == 0) { throw new IllegalArgumentException (); } final FileObject platformsFolder = FileUtil.getConfigFile(PLATFORM_STOREGE); String antName = PropertyUtils.getUsablePropertyName(name); if (platformsFolder.getFileObject(antName,"xml") != null) { //NOI18N String baseName = antName; int index = 1; antName = baseName + Integer.toString (index); while (platformsFolder.getFileObject(antName,"xml") != null) { //NOI18N index ++; antName = baseName + Integer.toString (index); } } return antName; }
Example 2
Source File: PlatformConvertor.java From NBANDROID-V2 with Apache License 2.0 | 6 votes |
@NonNull public static String getFreeAntName(@NonNull final String name) { if (name == null || name.length() == 0) { throw new IllegalArgumentException(); } final FileObject platformsFolder = FileUtil.getConfigFile(AndroidSdkProvider.PLATFORM_STORAGE); String antName = PropertyUtils.getUsablePropertyName(name); if (platformsFolder.getFileObject(antName, "xml") != null) { //NOI18N String baseName = antName; int index = 1; antName = baseName + Integer.toString(index); while (platformsFolder.getFileObject(antName, "xml") != null) { //NOI18N index++; antName = baseName + Integer.toString(index); } } return antName; }
Example 3
Source File: NbModuleProject.java From netbeans with Apache License 2.0 | 6 votes |
private void addFileRef(Map<String, String> props, String path) { // #66275: // XXX parts of code copied from o.n.spi.project.ant.ReferenceHelper; // will do proper API change later with issue #70894, will also simplify impl of isssue #66188 final File normalizedFile = FileUtil.normalizeFile(PropertyUtils.resolveFile(getProjectDirectoryFile(), path)); String fileID = normalizedFile.getName(); // if the file is folder then add to ID string also parent folder name, // i.e. if external source folder name is "src" the ID will // be a bit more selfdescribing, e.g. project-src in case // of ID for ant/project/src directory. if (normalizedFile.isDirectory() && normalizedFile.getParentFile() != null) { fileID = normalizedFile.getParentFile().getName()+"-"+normalizedFile.getName(); } fileID = PropertyUtils.getUsablePropertyName(fileID); // we don't need to resolve duplicate file names here, all <c-p-e>-s reside in release/modules/ext props.put(REF_START + fileID, path); }
Example 4
Source File: ProjectFactorySupport.java From netbeans with Apache License 2.0 | 6 votes |
private static String getValueTag(DotClassPathEntry entry) { switch (entry.getKind()) { case PROJECT: return entry.getRawPath().substring(1); // project name case VARIABLE: String v[] = EclipseUtils.splitVariable(entry.getRawPath()); return PropertyUtils.getUsablePropertyName(v[0]) + v[1]; // variable name case CONTAINER: return entry.getContainerMapping(); // mapping as produced by container resolver case LIBRARY: case OUTPUT: case SOURCE: default: return entry.getRawPath(); // file path } }
Example 5
Source File: ProjectInfoImpl.java From netbeans with Apache License 2.0 | 5 votes |
@Override public String getName() { synchronized (guard) { if (name == null) { name = PropertyUtils.getUsablePropertyName(getDisplayName()); } return name; } }
Example 6
Source File: ProjectServerPanel.java From netbeans with Apache License 2.0 | 5 votes |
private String getServerLibraryName() { if (!serverLibraryCheckbox.isSelected() || !serverLibraryCheckbox.isEnabled()) { return null; } Deployment deployment = Deployment.getDefault(); String name = deployment.getServerDisplayName(deployment.getServerID(getSelectedServer())); // null can occur only if the server was removed somehow return (name == null) ? "" : PropertyUtils.getUsablePropertyName(name); // NOI18N }
Example 7
Source File: EclipseProject.java From netbeans with Apache License 2.0 | 5 votes |
void setupEnvironmentVariables(List<String> importProblems) throws IOException { if (workspace == null) { return; } EditableProperties ep = PropertyUtils.getGlobalProperties(); boolean changed = false; for (DotClassPathEntry entry : cp.getClassPathEntries()) { if (entry.getKind() != DotClassPathEntry.Kind.VARIABLE) { continue; } String s = EclipseUtils.splitVariable(entry.getRawPath())[0]; Workspace.Variable v = getVariable(s); if (v != null) { s = "var."+PropertyUtils.getUsablePropertyName(s); //NOI18N if (ep.getProperty(s) == null) { ep.setProperty(s, v.getLocation()); changed = true; } else if (!ep.getProperty(s).equals(v.getLocation())) { importProblems.add(org.openide.util.NbBundle.getMessage(EclipseProject.class, "MSG_IDEVariableMismatch", s, ep.getProperty(s), v.getLocation())); //NOI18N } } else { importProblems.add(org.openide.util.NbBundle.getMessage(EclipseProject.class, "MSG_IDEVariableNotFound", s)); //NOI18N ep.setProperty(s, ""); //NOI18N changed = true; } } if (changed) { PropertyUtils.putGlobalProperties(ep); } }
Example 8
Source File: ProjectFactorySupport.java From netbeans with Apache License 2.0 | 5 votes |
/** * Converts VARIABLE classpath entry to Ant property, eg. * SOME_ROOT/lib/a.jar -> ${var.SOME_ROOT}/lib/a.jar */ private static String asAntVariable(DotClassPathEntry entry) { if (entry.getKind() != DotClassPathEntry.Kind.VARIABLE) { throw new IllegalStateException("not a VARIABLE entry "+entry); // NOI18N } String s[] = EclipseUtils.splitVariable(entry.getRawPath()); String varName = PropertyUtils.getUsablePropertyName(s[0]); return "${var."+varName+"}"+s[1]; // NOI18N }
Example 9
Source File: RemotePlatform.java From netbeans with Apache License 2.0 | 5 votes |
@NonNull public static RemotePlatform prototype( @NonNull final String displayName, @NonNull final Map<String,String> additionalProperties, @NonNull final Map<String,String> sysProps ) { Parameters.notNull("displayName", displayName); //NOI18N Parameters.notNull("additionalProperties", additionalProperties); //NOI18N Parameters.notNull("sysProps", sysProps); //NOI18N String currentDisplayName = displayName; String antName; for (int i=0;;i++) { antName = PropertyUtils.getUsablePropertyName(currentDisplayName); if (RemotePlatformProvider.isValidPlatformAntName(antName)) { break; } currentDisplayName = String.format( "%s %d", //NOI18N displayName, i); } final Map<String,String> props = new HashMap<>(); props.putAll(additionalProperties); props.put(PLAT_PROP_ANT_NAME, antName); return create( displayName, props, sysProps); }
Example 10
Source File: TestJavaPlatform.java From netbeans with Apache License 2.0 | 5 votes |
public TestJavaPlatform( @NonNull final String name, @NonNull final FileObject installFolder, @NonNull final Map<String,String> sysProps) { super( name, PropertyUtils.getUsablePropertyName(name), Collections.singletonList(installFolder.toURL()), new HashMap<String, String>(), sysProps, Collections.emptyList(), Collections.emptyList()); }
Example 11
Source File: ClassPathContainerResolver.java From netbeans with Apache License 2.0 | 4 votes |
private static String getNetBeansLibraryName(String container) { return PropertyUtils.getUsablePropertyName(getEclipseLibraryName(container)); }
Example 12
Source File: JSTestDriverCustomizerPanel.java From netbeans with Apache License 2.0 | 4 votes |
private static String getBrowserPropertyName(WebBrowser browser) { return PropertyUtils.getUsablePropertyName(USE_BROWSER+browser.getId()); //NOI18N }
Example 13
Source File: AntServices.java From netbeans with Apache License 2.0 | 4 votes |
@Override public String getUsablePropertyName(String displayName) { return PropertyUtils.getUsablePropertyName(displayName); }
Example 14
Source File: SuiteProject.java From netbeans with Apache License 2.0 | 4 votes |
public String getName() { return PropertyUtils.getUsablePropertyName(getSimpleName()); }
Example 15
Source File: FreeformProject.java From netbeans with Apache License 2.0 | 4 votes |
public String getName() { return PropertyUtils.getUsablePropertyName(getDisplayName()); }
Example 16
Source File: Utils.java From netbeans with Apache License 2.0 | 4 votes |
/** Create a valid default for context path from project name. */ public static String createDefaultContext(String projectName) { return "/" + PropertyUtils.getUsablePropertyName(projectName); }
Example 17
Source File: ProjectServerPanel.java From netbeans with Apache License 2.0 | 4 votes |
/** Create a valid default for context path from project name. */ private static String createDefaultContext(String projectName) { return "/" + (projectName != null ? PropertyUtils.getUsablePropertyName(projectName) : ""); }
Example 18
Source File: PhpProject.java From netbeans with Apache License 2.0 | 4 votes |
@Override public String getName() { return PropertyUtils.getUsablePropertyName(getDisplayName()); }