Lines 16-21
Link Here
|
16 |
import javax.swing.Action; |
16 |
import javax.swing.Action; |
17 |
import javax.swing.Icon; |
17 |
import javax.swing.Icon; |
18 |
import javax.swing.ImageIcon; |
18 |
import javax.swing.ImageIcon; |
|
|
19 |
import javax.swing.JMenuItem; |
19 |
import org.netbeans.api.project.Project; |
20 |
import org.netbeans.api.project.Project; |
20 |
import org.netbeans.modules.project.ui.ProjectTab; |
21 |
import org.netbeans.modules.project.ui.ProjectTab; |
21 |
import org.netbeans.modules.project.ui.ProjectUtilities; |
22 |
import org.netbeans.modules.project.ui.ProjectUtilities; |
Lines 28-39
Link Here
|
28 |
import org.openide.util.Lookup; |
29 |
import org.openide.util.Lookup; |
29 |
import org.openide.util.NbBundle; |
30 |
import org.openide.util.NbBundle; |
30 |
import org.openide.util.Utilities; |
31 |
import org.openide.util.Utilities; |
|
|
32 |
import org.openide.util.actions.Presenter; |
31 |
|
33 |
|
32 |
/** Action sensitive to current project |
34 |
/** Action sensitive to current project |
33 |
* |
35 |
* |
34 |
* @author Pet Hrebejk |
36 |
* @author Pet Hrebejk |
35 |
*/ |
37 |
*/ |
36 |
public class SelectNodeAction extends LookupSensitiveAction { |
38 |
public class SelectNodeAction extends LookupSensitiveAction implements Presenter.Menu { |
37 |
|
39 |
|
38 |
// XXX Better icons |
40 |
// XXX Better icons |
39 |
private static final Icon SELECT_IN_PROJECTS_ICON = new ImageIcon( Utilities.loadImage( "org/netbeans/modules/project/ui/resources/projectTab.gif" ) ); //NOI18N |
41 |
private static final Icon SELECT_IN_PROJECTS_ICON = new ImageIcon( Utilities.loadImage( "org/netbeans/modules/project/ui/resources/projectTab.gif" ) ); //NOI18N |
Lines 42-47
Link Here
|
42 |
private static final String SELECT_IN_PROJECTS_NAME = NbBundle.getMessage( CloseProject.class, "LBL_SelectInProjectsAction_Name" ); // NOI18N |
44 |
private static final String SELECT_IN_PROJECTS_NAME = NbBundle.getMessage( CloseProject.class, "LBL_SelectInProjectsAction_Name" ); // NOI18N |
43 |
private static final String SELECT_IN_FILES_NAME = NbBundle.getMessage( CloseProject.class, "LBL_SelectInFilesAction_Name" ); // NOI18N |
45 |
private static final String SELECT_IN_FILES_NAME = NbBundle.getMessage( CloseProject.class, "LBL_SelectInFilesAction_Name" ); // NOI18N |
44 |
|
46 |
|
|
|
47 |
private static final String SELECT_IN_PROJECTS_NAME_POPUP = NbBundle.getMessage( CloseProject.class, "LBL_SelectInProjectsAction_PopupName" ); // NOI18N |
48 |
private static final String SELECT_IN_FILES_NAME_POPUP = NbBundle.getMessage( CloseProject.class, "LBL_SelectInFilesAction_PopupName" ); // NOI18N |
49 |
|
45 |
private String command; |
50 |
private String command; |
46 |
private ProjectActionPerformer performer; |
51 |
private ProjectActionPerformer performer; |
47 |
private String namePattern; |
52 |
private String namePattern; |
Lines 100-106
Link Here
|
100 |
return namePattern; |
105 |
return namePattern; |
101 |
} |
106 |
} |
102 |
|
107 |
|
103 |
// Private methods --------------------------------------------------------- |
108 |
// Presenter.Popup implementation ------------------------------------------ |
|
|
109 |
|
110 |
public JMenuItem getMenuPresenter () { |
111 |
JMenuItem popupPresenter = new JMenuItem (this); |
112 |
|
113 |
if (ProjectTab.ID_LOGICAL.equals (this.findIn)) { |
114 |
popupPresenter.setText (SELECT_IN_PROJECTS_NAME_POPUP); |
115 |
} else { |
116 |
popupPresenter.setText (SELECT_IN_FILES_NAME_POPUP); |
117 |
} |
118 |
|
119 |
return popupPresenter; |
120 |
} |
121 |
|
122 |
// Private methods --------------------------------------------------------- |
104 |
|
123 |
|
105 |
private FileObject getFileFromLookup( Lookup context ) { |
124 |
private FileObject getFileFromLookup( Lookup context ) { |
106 |
|
125 |
|