List of usage examples for javax.lang.model SourceVersion isName
public static boolean isName(CharSequence name)
From source file:org.netbeans.jcode.mvc.controller.MVCPanel.java
@Override public boolean hasError() { warningLabel.setText(""); if (!isValidPackageName(getPackage())) { warningLabel.setText(NbBundle.getMessage(MVCPanel.class, "MVCPanel.invalidPackage.message")); return true; }/*from w w w. j a v a 2s .c o m*/ String prefix = getPrefix(); String suffix = getSuffix(); if (StringUtils.isNotBlank(prefix) && !SourceVersion.isName(prefix)) { warningLabel.setText(NbBundle.getMessage(MVCPanel.class, "MVCPanel.invalidPrefix.message")); return true; } if (StringUtils.isNotBlank(suffix) && !SourceVersion.isName(prefix + '_' + suffix)) { warningLabel.setText(NbBundle.getMessage(MVCPanel.class, "MVCPanel.invalidSuffix.message")); return true; } return false; }
From source file:org.netbeans.jcode.rest.applicationconfig.RestConfigPanel.java
@Override public boolean hasError() { warningLabel.setText(""); String _package = getPackage(); if (!JavaIdentifiers.isValidPackageName(_package)) { warningLabel/* w w w . j a v a 2 s . c o m*/ .setText(NbBundle.getMessage(RestConfigPanel.class, "RestConfigDialog.invalidPackage.message")); return true; } String restClass = getRestClass(); if (!SourceVersion.isName(restClass)) { warningLabel.setText( NbBundle.getMessage(RestConfigPanel.class, "RestConfigDialog.invalidClassName.message")); return true; } String restPath = getRestPath(); if (StringUtils.isBlank(restPath)) { warningLabel .setText(NbBundle.getMessage(RestConfigPanel.class, "RestConfigDialog.invalidPath.message")); return true; } if (StringUtils.equals(restPath, DEFAULT_RESOURCE_FOLDER)) { warningLabel.setText(NbBundle.getMessage(RestConfigPanel.class, "RestConfigDialog.reservedPath.message", DEFAULT_RESOURCE_FOLDER)); return true; } RestApplication restApplication = restApplications.get(restPath); if (restApplication != null && !restApplication.getApplicationClass().equals(_package + "." + restClass)) { warningLabel.setText(NbBundle.getMessage(RestConfigPanel.class, "RestConfigDialog.alreadyExist.message", restApplication.getApplicationClass())); return true; } return false; }
From source file:org.netbeans.jpa.modeler.core.widget.attribute.AttributeWidget.java
public void validateName(String previousName, String name) { if (JavaPersistenceQLKeywords.isKeyword(name)) { getSignalManager().fire(ERROR, AttributeValidator.ATTRIBUTE_NAME_WITH_JPQL_KEYWORD); } else {/*from w w w . j a v a 2s.c om*/ getSignalManager().clear(ERROR, AttributeValidator.ATTRIBUTE_NAME_WITH_JPQL_KEYWORD); } if (SourceVersion.isName(name)) { getSignalManager().clear(ERROR, AttributeValidator.INVALID_ATTRIBUTE_NAME); } else { getSignalManager().fire(ERROR, AttributeValidator.INVALID_ATTRIBUTE_NAME); } this.getClassWidget().scanDuplicateAttributes(previousName, name); }
From source file:org.netbeans.jpa.modeler.core.widget.JavaClassWidget.java
protected void validateName(String previousName, String name) { if (JavaPersistenceQLKeywords.isKeyword(JavaClassWidget.this.getName())) { getSignalManager().fire(ERROR, ClassValidator.CLASS_NAME_WITH_JPQL_KEYWORD); } else {/*from w w w . j a v a2s .c o m*/ getSignalManager().clear(ERROR, ClassValidator.CLASS_NAME_WITH_JPQL_KEYWORD); } if (isAutoGeneratedEntity(JavaClassWidget.this.getName())) { getSignalManager().fire(WARNING, ClassValidator.CLASS_NAME_WITH_AUTO_GEN_ENITY); } else { getSignalManager().clear(WARNING, ClassValidator.CLASS_NAME_WITH_AUTO_GEN_ENITY); } if (SourceVersion.isName(name)) { getSignalManager().clear(ERROR, ClassValidator.INVALID_CLASS_NAME); } else { getSignalManager().fire(ERROR, ClassValidator.INVALID_CLASS_NAME); } scanDuplicateClass(previousName, name); scanReservedDefaultClass(previousName, name); }
From source file:org.netbeans.jpa.modeler.source.generator.ui.GenerateCodeDialog.java
private boolean hasError() { if (sourceGroup == null) { NotifyDescriptor d = new NotifyDescriptor.Message("Please select the Source Folder .", NotifyDescriptor.INFORMATION_MESSAGE); d.setTitle("Source Folder"); DialogDisplayer.getDefault().notify(d); return true; }/* w w w. j av a 2s. c o m*/ if (!SourceVersion.isName(getPackage())) { NotifyDescriptor d = new NotifyDescriptor.Message("Please select the Entity Package .", NotifyDescriptor.INFORMATION_MESSAGE); d.setTitle("Entity Package"); DialogDisplayer.getDefault().notify(d); return true; } for (Component component : configPane.getComponents()) { if (component instanceof LayerConfigPanel) { LayerConfigPanel panel = (LayerConfigPanel) component; if (panel.hasError()) { configPane.setSelectedComponent(component); return true; } else { panel.store(); } } } return false; }
From source file:org.opensingular.form.SFormUtil.java
@Nonnull static String validatePackageName(@Nonnull String name) { Objects.requireNonNull(name); if (!SourceVersion.isName(name)) { throw new SingularFormException('\'' + name + "' no um nome vlido para um pacote"); }//from www .j a v a 2 s . c om return name; }