blob: 03ac1c7576e6c6eaf43583c1f95657d40f7030e5 [file] [log] [blame]
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.netbeans.modules.refactoring.java.callhierarchy;
import java.util.Collection;
import java.util.HashSet;
import org.netbeans.api.java.source.TreePathHandle;
import org.netbeans.modules.refactoring.java.api.JavaRefactoringUtils;
import org.netbeans.modules.refactoring.java.ui.JavaRefactoringGlobalAction;
import org.netbeans.modules.refactoring.java.ui.RefactoringActionsProvider;
import org.openide.awt.ActionID;
import org.openide.awt.ActionReference;
import org.openide.awt.ActionRegistration;
import org.openide.filesystems.FileObject;
import org.openide.loaders.DataObject;
import org.openide.nodes.Node;
import org.openide.util.ImageUtilities;
import org.openide.util.Lookup;
import org.openide.util.NbBundle;
/**
* Action which shows CallHierarchy component.
*
* @author Jan Pokorsky
*/
@ActionID(id = "org.netbeans.modules.refactoring.java.callhierarchy.CallHierarchyAction", category = "Window")
@ActionRegistration(displayName = "#CTL_CallHierarchyAction", lazy = false)
@ActionReference(path = "Editors/text/x-java/Popup" , name = "CallHierarchyAction", position = 1420)
public final class CallHierarchyAction extends JavaRefactoringGlobalAction {
public CallHierarchyAction() {
super(NbBundle.getMessage(CallHierarchyAction.class, "CTL_CallHierarchyAction"),ImageUtilities.loadImageIcon(CallHierarchyTopComponent.ICON_PATH, true));
}
@Override
public void performAction(final Lookup context) {
CallHierarchyTopComponent win = CallHierarchyTopComponent.findInstance();
win.open();
win.requestActive();
win.reset();
win.setModel(CallHierarchyModel.create(context, win.getScopes(), win.getHierarchyType()));
}
@Override
protected boolean enable(Lookup context) {
return new RefactoringActionsProvider().canFindUsages(context);
}
@Override
protected boolean asynchronous() {
return false;
}
}