2 * Copyright 2000-2010 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
.slicer
;
18 import com
.intellij
.analysis
.AnalysisScope
;
19 import com
.intellij
.analysis
.AnalysisUIOptions
;
20 import com
.intellij
.analysis
.BaseAnalysisActionDialog
;
21 import com
.intellij
.openapi
.module
.Module
;
22 import com
.intellij
.openapi
.module
.ModuleUtil
;
23 import com
.intellij
.openapi
.project
.Project
;
24 import com
.intellij
.psi
.*;
31 public class SliceForwardHandler
extends SliceHandler
{
32 public SliceForwardHandler() {
36 public SliceAnalysisParams
askForParams(PsiElement element
, boolean dataFlowToThis
, SliceManager
.StoredSettingsBean storedSettingsBean
, String dialogTitle
) {
37 AnalysisScope analysisScope
= new AnalysisScope(element
.getContainingFile());
38 Module module
= ModuleUtil
.findModuleForPsiElement(element
);
39 String name
= module
== null ?
null : module
.getName();
41 Project myProject
= element
.getProject();
42 final SliceForwardForm form
= new SliceForwardForm();
43 form
.init(storedSettingsBean
.showDereferences
);
45 AnalysisUIOptions analysisUIOptions
= new AnalysisUIOptions();
46 analysisUIOptions
.save(storedSettingsBean
.analysisUIOptions
);
48 BaseAnalysisActionDialog dialog
= new BaseAnalysisActionDialog(dialogTitle
, "Analyze scope", myProject
, analysisScope
, name
, true,
52 protected JComponent
getAdditionalActionSettings(Project project
) {
53 return form
.getComponent();
57 if (!dialog
.isOK()) return null;
59 storedSettingsBean
.analysisUIOptions
.save(analysisUIOptions
);
60 storedSettingsBean
.showDereferences
= form
.isToShowDerefs();
62 AnalysisScope scope
= dialog
.getScope(analysisUIOptions
, analysisScope
, myProject
, module
);
64 SliceAnalysisParams params
= new SliceAnalysisParams();
66 params
.dataFlowToThis
= dataFlowToThis
;
67 params
.showInstanceDereferences
= form
.isToShowDerefs();