NotNull, dispose
[fedora-idea.git] / platform / lang-impl / src / com / intellij / codeInspection / InspectionMain.java
blob5f06142ac50f0eaa56be9a7ec335d5aec1f74620
1 /*
2 * Copyright 2000-2009 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 * Created by IntelliJ IDEA.
19 * User: max
20 * Date: May 23, 2002
21 * Time: 5:20:01 PM
22 * To change template for new class use
23 * Code Style | Class Templates options (Tools | IDE Options).
25 package com.intellij.codeInspection;
27 import com.intellij.openapi.application.ApplicationStarter;
29 import java.util.Arrays;
31 public class InspectionMain implements ApplicationStarter {
32 private InspectionApplication myApplication;
34 public String getCommandName() {
35 return "inspect";
38 @SuppressWarnings({"HardCodedStringLiteral"})
39 public void premain(String[] args) {
40 if (args.length < 4) {
41 System.err.println("invalid args:" + Arrays.toString(args));
42 printHelp();
45 //System.setProperty("idea.load.plugins.category", "inspection");
46 myApplication = new InspectionApplication();
48 myApplication.myProjectPath = args[1];
49 myApplication.myProfileName = args[2];
50 myApplication.myOutPath = args[3];
52 try {
53 for (int i = 4; i < args.length; i++) {
54 String arg = args[i];
55 if ("-d".equals(arg)) {
56 myApplication.mySourceDirectory = args[++i];
58 else if ("-v0".equals(arg)) {
59 myApplication.setVerboseLevel(0);
61 else if ("-v1".equals(arg)) {
62 myApplication.setVerboseLevel(1);
64 else if ("-v2".equals(arg)) {
65 myApplication.setVerboseLevel(2);
67 else if ("-v3".equals(arg)) {
68 myApplication.setVerboseLevel(3);
70 else if ("-e".equals(arg)){
71 myApplication.myRunWithEditorSettings = true;
73 else if ("-t".equals(arg)) {
74 myApplication.myErrorCodeRequired = false;
76 else {
77 System.err.println("unexpected argument: " + arg);
78 printHelp();
82 catch (ArrayIndexOutOfBoundsException e) {
83 e.printStackTrace();
84 printHelp();
87 myApplication.myRunGlobalToolsOnly = System.getProperty("idea.no.local.inspections") != null;
90 public void main(String[] args) {
91 myApplication.startup();
94 public static void printHelp() {
95 System.out.println(InspectionsBundle.message("inspection.command.line.explanation"));
96 System.exit(1);