mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
More info messages
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.formatting.commandLine;
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -23,8 +24,11 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public abstract class FileSetProcessor {
|
||||
private static final Logger LOG = Logger.getInstance("#" + FileSetProcessor.class.getName());
|
||||
|
||||
private File myRoot;
|
||||
private String myPattern;
|
||||
private int myProcessedFiles;
|
||||
|
||||
FileSetProcessor(@NotNull String fileSpec) {
|
||||
setRootAndPattern(fileSpec);
|
||||
@@ -37,6 +41,7 @@ public abstract class FileSetProcessor {
|
||||
private void processEntry(@NotNull File entry) throws IOException {
|
||||
if (entry.exists()) {
|
||||
if (entry.isDirectory()) {
|
||||
LOG.info("Scanning directory " + entry.getPath());
|
||||
File[] subEntries = entry.listFiles();
|
||||
if (subEntries != null) {
|
||||
for (File subEntry : subEntries) {
|
||||
@@ -50,7 +55,9 @@ public abstract class FileSetProcessor {
|
||||
if (virtualFile == null) {
|
||||
throw new IOException("Can not find " + entry.getPath());
|
||||
}
|
||||
LOG.info("Processing " + virtualFile.getPath());
|
||||
processFile(virtualFile);
|
||||
myProcessedFiles ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -97,6 +104,11 @@ public abstract class FileSetProcessor {
|
||||
break;
|
||||
}
|
||||
}
|
||||
LOG.info("Regexp: " + result);
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
public int getProcessedFiles() {
|
||||
return myProcessedFiles;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.intellij.openapi.application.ApplicationStarterEx;
|
||||
import com.intellij.openapi.application.ex.ApplicationEx;
|
||||
import com.intellij.openapi.application.ex.ApplicationInfoEx;
|
||||
import com.intellij.openapi.application.impl.ApplicationInfoImpl;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.options.SchemeImportException;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
@@ -37,6 +38,7 @@ import java.io.PrintWriter;
|
||||
public class FormatterStarter extends ApplicationStarterEx {
|
||||
|
||||
public static final String FORMAT_COMMAND_NAME = "format";
|
||||
private static final Logger LOG = Logger.getInstance("#" + FormatterStarter.class.getName());
|
||||
|
||||
@Override
|
||||
public boolean isHeadless() {
|
||||
@@ -60,6 +62,7 @@ public class FormatterStarter extends ApplicationStarterEx {
|
||||
new PrintWriter(System.err));
|
||||
messageOutput.info(getAppInfo() + " Formatter\n");
|
||||
CodeStyleSettings settings = null;
|
||||
logArgs(args);
|
||||
if (args.length < 2) {
|
||||
showUsageInfo(messageOutput);
|
||||
}
|
||||
@@ -89,6 +92,7 @@ public class FormatterStarter extends ApplicationStarterEx {
|
||||
FileSetFormatter fileSetFormatter = new FileSetFormatter(args[i], settings, messageOutput);
|
||||
try {
|
||||
fileSetFormatter.processFiles();
|
||||
messageOutput.info("\n" + fileSetFormatter.getProcessedFiles() + " files formatted.\n");
|
||||
}
|
||||
catch (IOException e) {
|
||||
fatalError(messageOutput, e.getLocalizedMessage());
|
||||
@@ -130,4 +134,13 @@ public class FormatterStarter extends ApplicationStarterEx {
|
||||
messageOutput.info(" -s|--settings A path to Intellij IDEA code style settings .xml file.\n");
|
||||
messageOutput.info(" fileSpec A file specification, may contain wildcards.\n");
|
||||
}
|
||||
|
||||
private static void logArgs(@NotNull String[] args) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String arg : args) {
|
||||
if (sb.length() > 0) sb.append(",");
|
||||
sb.append(arg);
|
||||
}
|
||||
LOG.info("Arguments: " + sb);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user