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.
16 package com
.intellij
.cyclicDependencies
.actions
;
18 import com
.intellij
.analysis
.AnalysisScope
;
19 import com
.intellij
.analysis
.AnalysisScopeBundle
;
20 import com
.intellij
.analysis
.PerformAnalysisInBackgroundOption
;
21 import com
.intellij
.cyclicDependencies
.CyclicDependenciesBuilder
;
22 import com
.intellij
.cyclicDependencies
.ui
.CyclicDependenciesPanel
;
23 import com
.intellij
.openapi
.progress
.ProgressManager
;
24 import com
.intellij
.openapi
.project
.Project
;
25 import com
.intellij
.packageDependencies
.DependencyValidationManager
;
26 import com
.intellij
.packageDependencies
.DependencyValidationManagerImpl
;
27 import com
.intellij
.peer
.PeerFactory
;
28 import com
.intellij
.ui
.content
.Content
;
36 public class CyclicDependenciesHandler
{
37 private final Project myProject
;
38 private final AnalysisScope myScope
;
40 public CyclicDependenciesHandler(Project project
, AnalysisScope scope
) {
45 public void analyze() {
46 final CyclicDependenciesBuilder builder
= new CyclicDependenciesBuilder(myProject
, myScope
);
47 final Runnable process
= new Runnable() {
52 final Runnable successRunnable
= new Runnable() {
54 SwingUtilities
.invokeLater(new Runnable() {
56 CyclicDependenciesPanel panel
= new CyclicDependenciesPanel(myProject
, builder
);
57 Content content
= PeerFactory
.getInstance().getContentFactory().createContent(panel
, AnalysisScopeBundle
.message(
58 "action.analyzing.cyclic.dependencies.in.scope", builder
.getScope().getDisplayName()), false);
59 content
.setDisposer(panel
);
60 panel
.setContent(content
);
61 ((DependencyValidationManagerImpl
)DependencyValidationManager
.getInstance(myProject
)).addContent(content
);
66 ProgressManager
.getInstance()
67 .runProcessWithProgressAsynchronously(myProject
, AnalysisScopeBundle
.message("package.dependencies.progress.title"),
68 process
, successRunnable
, null, new PerformAnalysisInBackgroundOption(myProject
));