本文整理汇总了Java中org.netbeans.jcode.console.Console类的典型用法代码示例。如果您正苦于以下问题:Java Console类的具体用法?Java Console怎么用?Java Console使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Console类属于org.netbeans.jcode.console包,在下文中一共展示了Console类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateNgHome
import org.netbeans.jcode.console.Console; //导入依赖的package包/类
private void generateNgHome(NGApplicationConfig applicationConfig, ApplicationSourceFilter fileFilter) throws IOException {
Map<String, Object> data = new HashMap();
data.put("entityScriptFiles", entityScriptFiles);
scriptFiles.remove(MODULE_JS);
scriptFiles.add(0, MODULE_JS);
data.put("scriptFiles", scriptFiles);
EJSParser parser = new EJSParser();
parser.addContext(applicationConfig);
parser.addContext(data);
copyDynamicFile(parser.getParserManager(), getTemplatePath() + "_index.html", webRoot, "index.html", handler);
copyDynamicFile(parser.getParserManager(), getTemplatePath() + "_bower.json", projectRoot, "bower.json", handler);
handler.append(Console.wrap(AngularGenerator.class, "MSG_Copying_Bower_Lib_Files", FG_RED, BOLD));
FileUtil.copyStaticResource(getTemplatePath() + "bower_components.zip", webRoot, null, handler);
}
示例2: generateNgApplication
import org.netbeans.jcode.console.Console; //导入依赖的package包/类
protected void generateNgApplication(NGApplicationConfig applicationConfig, ApplicationSourceFilter fileFilter) throws IOException {
handler.append(Console.wrap(AngularGenerator.class, "MSG_Copying_Application_Files", FG_RED, BOLD, UNDERLINE));
EJSParser parser = new EJSParser();
parser.addContext(applicationConfig);
Function<String, String> pathResolver = (templatePath) -> {
String simpleFileName = getSimpleFileNameWithExt(templatePath);
String ext = getFileExt(templatePath);
if (!templatePath.startsWith("app")) {
if (!fileFilter.isEnable(templatePath)) {
return null;
}
} else if (!fileFilter.isEnable(simpleFileName)) {
return null;
}
if (templatePath.contains("/_")) {
templatePath = templatePath.replaceAll("/_", "/");
}
if ("js".equals(ext)) {
scriptFiles.add(templatePath);
}
return templatePath;
};
copyDynamicResource(parser.getParserManager(), getTemplatePath() + "web-resources.zip", webRoot, pathResolver, handler);
}
示例3: generateWelcomeFileDD
import org.netbeans.jcode.console.Console; //导入依赖的package包/类
private void generateWelcomeFileDD() throws IOException {
String welcomeFile;
if (mvcData.isAuthentication()) {
welcomeFile = "/index.jsp";
} else {
// welcomeFile = '/' + jspData.getFolder() + "/home.jsp";
welcomeFile = "/home.jsp";
}
boolean success = WebDDUtil.setWelcomeFiles(project, welcomeFile);
if (!success) { // NetBeans API bug resolution
handler.progress(Console.wrap(NbBundle.getMessage(WebDDUtil.class, "MSG_Init_WelcomeFile", jspData.getFolder()), FG_MAGENTA, BOLD, UNDERLINE));
Map<String, Object> params = new HashMap<>();
params.put("WELCOME_FILE", welcomeFile);
WebDDUtil.createDD(project, WEB_XML_DD, params);
}
handler.progress(Console.wrap(NbBundle.getMessage(WebDDUtil.class, "MSG_Progress_WelcomeFile", jspData.getFolder()), FG_MAGENTA, BOLD, UNDERLINE));
}
示例4: generate
import org.netbeans.jcode.console.Console; //导入依赖的package包/类
@Override
public void generate(ITaskSupervisor task, Project project, SourceGroup sourceGroup, EntityMappings entityMappings) {
if (!entityMappings.getGenerateStaticMetamodel()) {
return;
}
this.staticMetamodelClass = new HashSet<>();
this.task = task;
destDir = FileUtil.toFile(sourceGroup.getRootFolder());
this.entityPackageName = entityMappings.getPackage();
this.packageName = entityMappings.getProjectPackage() + '.' + entityMappings.getStaticMetamodelPackage();
if(!JavaSourceHelper.isValidPackageName(packageName)){
this.packageName = entityPackageName;
}
task.log(Console.wrap("Generating StaticModel Class : " , FG_RED, BOLD), true);
try {
for (JavaClass javaClass : entityMappings.getJavaClass()) {
generateStaticMetamodel((ManagedClass) javaClass);
}
flushStaticMetamodel();
} catch (InvalidDataException | IOException ex) {
ExceptionUtils.printStackTrace(ex);
}
}
示例5: generateEntityClasses
import org.netbeans.jcode.console.Console; //导入依赖的package包/类
private void generateEntityClasses() throws InvalidDataException, IOException {
List<Entity> parsedEntities = entityMappings.getEntity()
.stream()
.filter(e -> e.getGenerateSourceCode())
.collect(toList());
if(!parsedEntities.isEmpty()){
task.log(Console.wrap("Generating Entity Class : " , FG_RED, BOLD), true);
}
for (Entity parsedEntity : parsedEntities) {
task.log(parsedEntity.getClazz(), true);
ManagedClassDefSnippet classDef = new EntityGenerator(parsedEntity, packageName).getClassDef();
classDef.setJaxbSupport(entityMappings.getJaxbSupport());
classesRepository.addWritableSnippet(ClassType.ENTITY_CLASS, classDef);
parsedEntity.setFileObject(ORMConverterUtil.writeSnippet(classDef, destDir));
}
}
示例6: generateClientSideComponent
import org.netbeans.jcode.console.Console; //导入依赖的package包/类
@Override
protected void generateClientSideComponent() {
try {
NGApplicationConfig applicationConfig = getAppConfig();
ApplicationSourceFilter fileFilter = getApplicationSourceFilter(applicationConfig);
handler.append(Console.wrap(AngularGenerator.class, "MSG_Copying_Entity_Files", FG_RED, BOLD, UNDERLINE));
Map<String, String> templateLib = getResource(getTemplatePath() + "entity-include-resources.zip");
List<NGEntity> entities = new ArrayList<>();
for (Entity entity : entityMapping.getGeneratedEntity().collect(toList())) {
NGEntity ngEntity = getEntity(applicationConfig, entity);
if (ngEntity != null) {
entities.add(ngEntity);
generateNgEntity(applicationConfig, fileFilter, getEntityConfig(entity), ngEntity, templateLib);
generateNgEntityi18nResource(applicationConfig, fileFilter, ngEntity);
}
}
applicationConfig.setEntities(entities);
if (appConfigData.isCompleteApplication()) {
generateNgApplication(applicationConfig, fileFilter);
generateNgApplicationi18nResource(applicationConfig, fileFilter);
generateNgLocaleResource(applicationConfig, fileFilter);
generateNgHome(applicationConfig, fileFilter);
}
} catch (IOException ex) {
Exceptions.printStackTrace(ex);
}
}
示例7: execute
import org.netbeans.jcode.console.Console; //导入依赖的package包/类
@Override
public void execute() throws IOException {
targetProject = appConfigData.getTargetProject();
targetSource = appConfigData.getTargetSourceGroup();
gatewayProject = appConfigData.getGatewayProject();
gatewaySource = appConfigData.getGatewaySourceGroup();
handler.progress(Console.wrap(RepositoryGenerator.class, "MSG_Progress_Now_Generating", FG_RED, BOLD, UNDERLINE));
if (appConfigData.isMonolith() || appConfigData.isMicroservice()) {
if (appConfigData.isCompleteApplication()) {
generateAbstract(true, targetSource, appConfigData.getTargetPackage());
generateProducer(targetSource, appConfigData.getTargetPackage());
addMavenDependencies("repository/pom/_pom.xml", targetProject);
}
generateRepository();
}
if (appConfigData.isGateway()) {
generateAbstract(true, gatewaySource, appConfigData.getGatewayPackage());
generateProducer(gatewaySource, appConfigData.getGatewayPackage());
addMavenDependencies("repository/pom/_pom.xml", gatewayProject);
}
if (appConfigData.isCompleteApplication()) {
handler.info("Build",
Console.wrap(" mvn clean install ${profile} ${buildProperties}", BOLD),
appConfigData.isGateway() ? gatewayProject : targetProject);
}
}
示例8: execute
import org.netbeans.jcode.console.Console; //导入依赖的package包/类
@Override
public void execute() throws IOException {
project = appConfigData.getTargetProject();
source = appConfigData.getTargetSourceGroup();
handler.progress(Console.wrap(MVCControllerGenerator.class, "MSG_Progress_Now_Generating", FG_RED, BOLD, UNDERLINE));
if (appConfigData.isCompleteApplication()) {
generateUtil();
addMavenDependencies();
}
for (Entity entity : entityMapping.getGeneratedEntity().collect(toList())) {
generate(entity, false, false, true);
}
}
示例9: generateStaticResources
import org.netbeans.jcode.console.Console; //导入依赖的package包/类
public void generateStaticResources(Project project, ProgressHandler handler) throws IOException {
handler.append(Console.wrap(JSPViewerGenerator.class, "MSG_Copying_Static_Files", FG_RED, BOLD, UNDERLINE));
Sources sources = ProjectUtils.getSources(project);
SourceGroup sourceGroups[] = sources.getSourceGroups(WebProjectConstants.TYPE_DOC_ROOT);
FileObject webRoot = sourceGroups[0].getRootFolder();
if (!jspData.isOnlineTheme()) {
FileUtil.copyStaticResource(TEMPLATE_PATH + "lib-resources.zip", webRoot, jspData.getResourceFolder(), handler);
}
FileUtil.copyStaticResource(TEMPLATE_PATH + "theme-resources.zip", webRoot, jspData.getResourceFolder(), handler);
Map<String, Object> params = new HashMap<>();
params.put("webPath", jspData.getFolder());
params.put("resourcePath", jspData.getResourceFolder());
String applicationPath = mvcData.getRestConfigData() == null ? "" : mvcData.getRestConfigData().getApplicationPath();
params.put("applicationPath", applicationPath);
params.put("CSRFPrevention", mvcData.isCSRF());
params.put("XSSPrevention", mvcData.isXSS());
params.put("Authentication", mvcData.isAuthentication());
params.put("online", jspData.isOnlineTheme());
handler.append(Console.wrap(JSPViewerGenerator.class, "MSG_Generating_Static_Template", FG_RED, BOLD));
for (Entry<String, String> entry : TEMPLATE_PATTERN_FILES.entrySet()) {
String targetPath = jspData.getResourceFolder() + '/' + entry.getValue();
// if (webRoot.getFileObject(targetPath) == null) {
expandSingleJSPTemplate(TEMPLATE_PATH + COMMON_TEMPLATE_PATH + entry.getKey(),
targetPath, webRoot, params, handler);
// }
}
}
示例10: generateCRUD
import org.netbeans.jcode.console.Console; //导入依赖的package包/类
public void generateCRUD(Set<String> entities, boolean overrideExisting) throws IOException {
handler.progress(Console.wrap(JSPViewerGenerator.class, "MSG_Generating_CRUD_Template", FG_RED, BOLD, UNDERLINE));
for (String entityFQN : entities) {
Sources sources = ProjectUtils.getSources(project);
SourceGroup sourceGroups[] = sources.getSourceGroups(WebProjectConstants.TYPE_DOC_ROOT);
FileObject webRoot = sourceGroups[0].getRootFolder();
String entityClass = entityFQN;
String crudPath = jspData.getFolder();
String jspEntityIncludeFolder;
if (StringUtils.isNotBlank(crudPath)) {
jspEntityIncludeFolder = "/" + crudPath;
} else {
jspEntityIncludeFolder = "/" + DEFAULT_GENERATED_CRUD_PATH;
}
Map<String, Object> params = FromEntityBase.createFieldParameters(webRoot, entityClass, entityClass, null, false, true);
params.put("CSRFPrevention", mvcData.isCSRF());
params.put("XSSPrevention", mvcData.isXSS());
params.put("webPath", jspData.getFolder());
params.put("resourcePath", jspData.getResourceFolder());
for (Entry<Operation, String> entry : CRUD_FILES.entrySet()) {
expandSingleJSPTemplate(TEMPLATE_PATH + CRUD_PATH + entry.getValue(),
getJSPFileName(entityClass,jspEntityIncludeFolder, GENERATED_CRUD_FILES.get(entry.getKey())) + JSP_EXT,
webRoot, params, handler);
}
}
}
示例11: executeCommand
import org.netbeans.jcode.console.Console; //导入依赖的package包/类
public static void executeCommand(FileObject workingFolder, ProgressHandler handler, String... command) {
try {
ProcessBuilder pb = new ProcessBuilder(command);
// Map<String, String> env = pb.environment();
// If you want clean environment, call env.clear() first
// env.put("VAR1", "myValue");
// env.remove("OTHERVAR");
// env.put("VAR2", env.get("VAR1") + "suffix");
pb.directory(FileUtil.toFile(workingFolder));
Process proc = pb.start();
BufferedReader stdInput = new BufferedReader(new InputStreamReader(proc.getInputStream()));
BufferedReader stdError = new BufferedReader(new InputStreamReader(proc.getErrorStream()));
// read the output from the command
String s;
while ((s = stdInput.readLine()) != null) {
handler.append(Console.wrap(s, FG_BLUE));
}
// read any errors from the attempted command
while ((s = stdError.readLine()) != null) {
handler.append(Console.wrap(s, FG_RED));
}
} catch (IOException ex) {
Exceptions.printStackTrace(ex);
}
}
示例12: printMessage
import org.netbeans.jcode.console.Console; //导入依赖的package包/类
private void printMessage(MessageType messageType, Console bgColor, Console fgColor, Set<Message> messageRepository) {
String type = Console.wrap(messageType.getHeading(), bgColor, FG_WHITE, BOLD, BLINK);
if (!messageRepository.isEmpty()) {
taskSupervisor.log(type, true);
String previousHelpMessage = null;
for (Message message : messageRepository) {
String currentHelpMessage = null;
taskSupervisor.log(Console.wrap(message.getTitle() + " > \t", fgColor, BOLD, UNDERLINE), false);
String parsedMessage[] = message.getDescription().split("#");
taskSupervisor.log(expandTemplateContent(parsedMessage[0], dynamicVariables), true);
if(parsedMessage.length>1){
currentHelpMessage = parsedMessage[1];
}
if (previousHelpMessage != null) { //currentHelpMessage **
if (!previousHelpMessage.equals(currentHelpMessage)) {
taskSupervisor.log(previousHelpMessage, true);
previousHelpMessage = currentHelpMessage;
}
} else if (currentHelpMessage != null) {//previousHelpMessage == null
previousHelpMessage = currentHelpMessage;
}
}
if(previousHelpMessage!=null){
taskSupervisor.log(previousHelpMessage, true);
}
}
}
示例13: finishLog
import org.netbeans.jcode.console.Console; //导入依赖的package包/类
/**
* This method logs the finish status message (success, fail or cancel) and
* the run time stats. Override to replace this message with a custom header
* message and invoke super to prepend or append to this message.
*/
protected void finishLog() {
// there are some cases where the task "finish" gets called more than
// once and we want to prevent the finish message from being displayed
// more than once.
if (finished) {
return;
}
finished = true;
log(SUMMARY); // NOI18N
if (cancelled) {
log(Console.wrap(NbBundle.getMessage(
AbstractNBTask.class, "MSG_Report_Cancelled") + " " + // NOI18N
NbBundle.getMessage(
AbstractNBTask.class, "MSG_TotalTime", timeMsg), FG_RED, BOLD)); // NOI18N
} else if (success) {
log(Console.wrap(NbBundle.getMessage(
AbstractNBTask.class, "MSG_Report_Successful") + " " + // NOI18N
NbBundle.getMessage(
AbstractNBTask.class, "MSG_TotalTime", timeMsg), FG_GREEN, BOLD)); // NOI18N
} else {
log(Console.wrap(NbBundle.getMessage(
AbstractNBTask.class, "MSG_Report_Failed") + " " + // NOI18N
NbBundle.getMessage(
AbstractNBTask.class, "MSG_TotalTime", timeMsg), FG_RED, BOLD)); // NOI18N
}
}
示例14: addWebProperties
import org.netbeans.jcode.console.Console; //导入依赖的package包/类
private void addWebProperties() {
if (POMManager.isMavenProject(project)) {
POMManager pomManager = new POMManager(project);
Properties properties = new Properties();
if (config.isDockerEnable()) {
properties.put(WEB_SVC, getWebService());
}
String registryPort = appConfigData.getRegistryType() == CONSUL ? "8500" : "8081";
if (appConfigData.isMicroservice()){
properties.put(WEB_HOST, "http://localhost");
properties.put(WEB_PORT, "8080");
properties.put(CONTEXT_PATH, appConfigData.getTargetContextPath());
properties.put(REGISTRY_URL, "http://localhost:"+registryPort);
appConfigData.addBuildProperty(WEB_HOST, "<container host>");
appConfigData.addBuildProperty(WEB_PORT, "<container port>");
appConfigData.addBuildProperty(REGISTRY_URL, "<registry url>");
handler.info("Service Registry",
Console.wrap(String.join(", ", WEB_HOST, WEB_PORT, REGISTRY_URL), BOLD, FG_MAGENTA)
+ " properties are required for Service Registry");
} else if (appConfigData.isGateway()) {
properties.put(WEB_PORT, "8080");//for docker
properties.put(REGISTRY_URL, "http://localhost:"+registryPort);
appConfigData.addBuildProperty(REGISTRY_URL, "<registry url>");
handler.info("Service Discovery",
Console.wrap(REGISTRY_URL, BOLD, FG_MAGENTA)
+ " property is required for Service Discovery");
}
pomManager.addProperties(DEVELOPMENT_PROFILE, properties);
pomManager.commit();
appConfigData.addProfile(DEVELOPMENT_PROFILE);
}
}
示例15: generateDefaultClasses
import org.netbeans.jcode.console.Console; //导入依赖的package包/类
private void generateDefaultClasses() throws InvalidDataException, IOException {
List<DefaultClass> parsedDefaultClasses = entityMappings.getDefaultClass().stream().filter(e -> e.getGenerateSourceCode()).collect(toList());
if(!parsedDefaultClasses.isEmpty()){
task.log(Console.wrap("Generating IdClass/PrimaryKey Class : " , FG_RED, BOLD), true);
}
for (DefaultClass parsedDefaultClasse : parsedDefaultClasses) {
task.log(parsedDefaultClasse.getClazz(), true);
if (parsedDefaultClasse.isEmbeddable()) {
generateEmbededIdClasses(parsedDefaultClasse);
} else {
generateIdClasses(parsedDefaultClasse);
}
}
}