org.openide.awt.ActionReferences Java Examples

The following examples show how to use org.openide.awt.ActionReferences. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AntActions.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Messages({
    "LBL_ProfileProject=Profile"
})
@ActionID(category="Profile", id="org.netbeans.modules.profiler.actions.ProfileProjectPopup")
@ActionRegistration(displayName="#LBL_ProfileProject", lazy=false, asynchronous=true)
@ActionReferences({
    @ActionReference(path="Projects/org-netbeans-modules-java-j2seproject/Actions", position=1000),
    @ActionReference(path="Projects/org-netbeans-modules-java-j2semodule/Actions", position=1000),
    @ActionReference(path="Projects/org-netbeans-modules-apisupport-project/Actions", position=900),
    @ActionReference(path="Projects/org-netbeans-modules-apisupport-project-suite/Actions", position=1000),
    @ActionReference(path="Projects/org-netbeans-modules-web-project/Actions", position=1000)
})
public static Action profileProjectPopup() {
    Action delegate = ProjectSensitiveActions.projectSensitiveAction(
            ProjectSensitivePerformer.profileProject(ActionProvider.COMMAND_PROFILE), 
            NbBundle.getMessage(AntActions.class, "LBL_ProfileProject"), // NOI18N
            null
    );
    
    return delegate;
}
 
Example #2
Source File: AntActions.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Messages("LBL_ProfileFile=Profile &File")
@ActionID(category="Profile", id="org.netbeans.modules.profiler.actions.ProfileSingle")
@ActionRegistration(displayName="#LBL_ProfileFile", lazy=false)
@ActionReferences({
    @ActionReference(path="Loaders/text/x-java/Actions", position=1200),
    @ActionReference(path="Loaders/text/x-jsp/Actions", position=800),
    @ActionReference(path="Menu/Profile", position=110)
})
public static Action profileSingle() {
    Action delegate = FileSensitiveActions.fileSensitiveAction(
            new FileSensitivePerformer(ActionProvider.COMMAND_PROFILE_SINGLE),  
            Bundle.LBL_ProfileFile(),
            null);
    
    return delegate;
}
 
Example #3
Source File: AntActions.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Messages({
        "# {0} - # of selected projects (0 if disabled), or -1 if main project", 
        "# {1} - project name, if exactly one project", 
//        "LBL_ProfileMainProjectAction=&Profile {0,choice,-1#Main Project|0#Project|1#Project ({1})|1<{0} Projects}" // #231371
        "LBL_AttachMainProjectAction=&Attach to {0,choice,-1#Main Project|0#Project|1#Project ({1})|1<Project}"
    })
    @ActionID(category="Profile", id="org.netbeans.modules.profiler.actions.AttachMainProject")
    @ActionRegistration(displayName="#LBL_AttachMainProjectAction", lazy=false)
    @ActionReferences({
        @ActionReference(path="Menu/Profile", position=125)
    })
    public static Action attachMainProjectAction() {
        Action delegate = ProjectSensitiveActions.projectSensitiveAction(
                ProjectSensitivePerformer.attachProject(), 
                NbBundle.getMessage(AntActions.class, "LBL_AttachMainProjectAction"), // NOI18N
                Icons.getIcon(ProfilerIcons.ATTACH)
        );
        delegate.putValue(Action.SHORT_DESCRIPTION, NbBundle.getMessage(AntActions.class, "LBL_AttachMainProjectAction")); // NOI18N
        delegate.putValue("iconBase", Icons.getResource(ProfilerIcons.ATTACH)); // NOI18N
        
        return delegate;
    }
 
Example #4
Source File: ActionProviderImpl.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@ActionID(id = "org.netbeans.modules.maven.customPopup", category = "Project")
@ActionRegistration(displayName = "#LBL_Custom_Run", lazy=false)
@ActionReferences({
    @ActionReference(position = 1400, path = "Projects/org-netbeans-modules-maven/Actions"),
    @ActionReference(position = 250, path = "Loaders/text/x-maven-pom+xml/Actions"),
    @ActionReference(position = 1296, path = "Loaders/text/x-java/Actions"),
    @ActionReference(position = 1821, path = "Editors/text/x-java/Popup")
})
@Messages({"LBL_Custom_Run=Run Maven", "LBL_Custom_Run_File=Run Maven"})
public static ContextAwareAction customPopupActions() {
    return new ConditionallyShownAction() {
        
        protected @Override Action forProject(Project p, FileObject fo) {
            ActionProviderImpl ap = p.getLookup().lookup(ActionProviderImpl.class);
            return ap != null ? ap.new CustomPopupActions(triggeredOnFile, triggeredOnPom, fo) : null;
        }
    };
}
 
Example #5
Source File: ActionProviderImpl.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@ActionID(id = "org.netbeans.modules.gradle.customPopup", category = "Project")
@ActionRegistration(displayName = "#LBL_Custom_Run", lazy = false)
@ActionReferences({
    @ActionReference(position = 1400, path = "Projects/" + NbGradleProject.GRADLE_PROJECT_TYPE + "/Actions"),
    @ActionReference(position = 250, path = "Loaders/text/x-gradle+x-groovy/Actions"),
    @ActionReference(position = 250, path = "Loaders/text/x-gradle+x-kotlin/Actions"),
    @ActionReference(position = 1295, path = "Loaders/text/x-java/Actions"),
    @ActionReference(position = 1821, path = "Editors/text/x-java/Popup"),
    @ActionReference(position = 1295, path = "Loaders/text/x-groovy/Actions"),
    @ActionReference(position = 1821, path = "Editors/text/x-groovy/Popup")
})
@NbBundle.Messages({"LBL_Custom_Run=Run Gradle", "LBL_Custom_Run_File=Run Gradle"})
public static ContextAwareAction customPopupActions() {
    return new ConditionallyShownAction() {

        protected @Override
        Action forProject(Project p, FileObject fo) {
            ActionProviderImpl ap = p.getLookup().lookup(ActionProviderImpl.class);
            return ap != null ? ap.new CustomPopupActions(triggeredOnFile, triggeredOnGradle, fo) : null;
        }
    };
}
 
Example #6
Source File: ResetResultsAction.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@ActionID(category="Profile", id="org.netbeans.modules.profiler.actions.ResetResultsAction")
@ActionRegistration(displayName="#LBL_ResetResultsAction", lazy=false)
@ActionReferences({
    @ActionReference(path="Menu/Profile", position=1000, separatorAfter=1100),
    @ActionReference(path = "Shortcuts", name = "AS-F2")
})
public static ResetResultsAction getInstance() {
    return Singleton.INSTANCE;
}
 
Example #7
Source File: ResetResultsAction.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
@ActionID(category="Profile", id="org.graalvm.visualvm.lib.profiler.actions.ResetResultsAction")
@ActionRegistration(displayName="#LBL_ResetResultsAction", lazy=false)
@ActionReferences({
    @ActionReference(path="Menu/Profile", position=1000, separatorAfter=1100),
    @ActionReference(path = "Shortcuts", name = "AS-F2")
})
public static ResetResultsAction getInstance() {
    return Singleton.INSTANCE;
}
 
Example #8
Source File: TakeSnapshotAction.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
@ActionID(id = "org.graalvm.visualvm.lib.profiler.actions.TakeSnapshotAction", category = "Profile")
@ActionRegistration(displayName = "#LBL_TakeSnapshotAction")
@ActionReferences(value = {
    @ActionReference(path = "Shortcuts", name = "A-F2"),
    @ActionReference(path = "Menu/Profile", position = 900)})
public static TakeSnapshotAction getInstance() {
    return Singleton.INSTANCE;
}
 
Example #9
Source File: TakeThreadDumpAction.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
@ActionID(id = "org.graalvm.visualvm.lib.profiler.actions.TakeThreadDumpAction", category = "Profile")
@ActionRegistration(displayName = "#LBL_TakeThreadDumpAction")
@ActionReferences(value = {
    //        @ActionReference(path = "Shortcuts", name = "C-F3"),
    @ActionReference(path = "Menu/Profile", position = 500)})
public static TakeThreadDumpAction getInstance() {
    return Singleton.INSTANCE;
}
 
Example #10
Source File: ProfilerSessions.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
@ActionID(category="Profile", id="org.graalvm.visualvm.lib.profiler.v2.ProfilerSessions.StopAction") // NOI18N
@ActionRegistration(displayName="#LBL_StopAction", lazy=false) // NOI18N
@ActionReferences({
    @ActionReference(path="Menu/Profile", position=300, separatorAfter=400), // NOI18N
    @ActionReference(path="Shortcuts", name="S-F2") // NOI18N
})
public static StopAction getInstance() { return Singleton.INSTANCE; }
 
Example #11
Source File: SelectNodeAction.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@ActionID(id = "org.netbeans.modules.project.ui.SelectInFiles", category = "Window/SelectDocumentNode")
@ActionRegistration(displayName = "#LBL_SelectInFilesAction_MainMenuName", lazy=false)
@ActionReferences({
    @ActionReference(path = "Shortcuts", name = "DS-2"),
    @ActionReference(path = "Menu/GoTo", position = 2700)
})
@Messages("LBL_SelectInFilesAction_MainMenuName=Sele&ct in Files")
public static SelectNodeAction inFiles() {
    return new SelectNodeAction(SELECT_IN_FILES_ICON, LBL_SelectInFilesAction_MainMenuName(), ProjectTab.ID_PHYSICAL, null);
}
 
Example #12
Source File: SelectNodeAction.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@ActionID(id = "org.netbeans.modules.project.ui.SelectInProjects", category = "Window/SelectDocumentNode")
@ActionRegistration(displayName = "#LBL_SelectInProjectsAction_MainMenuName", lazy=false)
@ActionReferences({
    @ActionReference(path = "Shortcuts", name = "DS-1"),
    @ActionReference(path = "Menu/GoTo", position = 2600, separatorBefore = 2500),
    @ActionReference(path = "Editors/TabActions", position = 100)
})
@Messages("LBL_SelectInProjectsAction_MainMenuName=Select in Pro&jects")
public static SelectNodeAction inProjects() {
    return new SelectNodeAction(SELECT_IN_PROJECTS_ICON, LBL_SelectInProjectsAction_MainMenuName(), ProjectTab.ID_LOGICAL, null);
}
 
Example #13
Source File: ProjectTabAction.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@ActionID(id = "org.netbeans.modules.project.ui.logical.tab.action", category = "Project")
@ActionRegistration(displayName = "#LBL_ProjectsLogicalTabAction_Name", iconBase = "org/netbeans/modules/project/ui/resources/projectTab.png")
@ActionReferences(value = {
    @ActionReference(path = "Shortcuts", name = "D-1"),
    @ActionReference(path = "Menu/Window", position = 100)})
@Messages("LBL_ProjectsLogicalTabAction_Name=Pro&jects")
public static Action projectsLogical() {
    return new ProjectTabAction(Bundle.LBL_ProjectsLogicalTabAction_Name(), ICON1, 1);
}
 
Example #14
Source File: ProjectTabAction.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@ActionID(id = "org.netbeans.modules.project.ui.physical.tab.action", category = "Project")
@ActionRegistration(displayName = "#LBL_ProjectsPhysicalTabAction_Name", iconBase = "org/netbeans/modules/project/ui/resources/filesTab.png")
@ActionReferences(value = {
    @ActionReference(path = "Shortcuts", name = "D-2"),
    @ActionReference(path = "Menu/Window", position = 200)})
@Messages("LBL_ProjectsPhysicalTabAction_Name=&Files")
public static Action projectsPhysical() {
    return new ProjectTabAction(Bundle.LBL_ProjectsPhysicalTabAction_Name(), ICON2, 0);
}
 
Example #15
Source File: GroovyActionsRegistration.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Messages("LBL_DebugTestFile_Action=Debug Test File")
@ActionID(id = "org.netbeans.modules.groovy.support.GroovyProjectModule.debug.test", category = "Groovy")
@ActionRegistration(lazy = false, displayName = "#LBL_DebugTestFile_Action")
@ActionReferences(value = {
    @ActionReference(path = "Loaders/text/x-groovy/Actions", position = 590),
    @ActionReference(path = "Editors/text/x-groovy/Popup", position = 840)
})
public static Action debugTest() {
    return FileSensitiveActions.fileCommandAction(
            ActionProvider.COMMAND_DEBUG_TEST_SINGLE,
            LBL_DebugTestFile_Action(),
            null);
}
 
Example #16
Source File: GroovyActionsRegistration.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Messages("LBL_TestFile_Action=Test File")
@ActionID(id = "org.netbeans.modules.groovy.support.GroovyProjectModule.test", category = "Groovy")
@ActionRegistration(lazy = false, displayName = "#LBL_TestFile_Action")
@ActionReferences(value = {
    @ActionReference(path = "Loaders/text/x-groovy/Actions", position = 580),
    @ActionReference(path = "Editors/text/x-groovy/Popup", position = 830)
})
public static Action test() {
    return FileSensitiveActions.fileCommandAction(
            ActionProvider.COMMAND_TEST_SINGLE,
            LBL_TestFile_Action(),
            null);
}
 
Example #17
Source File: GroovyActionsRegistration.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Messages("LBL_DebugFile_Action=Debug File")
@ActionID(id = "org.netbeans.modules.groovy.support.GroovyProjectModule.debug", category = "Groovy")
@ActionRegistration(lazy = false, displayName = "#LBL_DebugFile_Action")
@ActionReferences(value = {
    @ActionReference(path = "Loaders/text/x-groovy/Actions", position = 570),
    @ActionReference(path = "Editors/text/x-groovy/Popup", position = 820)
})
public static Action debug() {
    return FileSensitiveActions.fileCommandAction(
            ActionProvider.COMMAND_DEBUG_SINGLE,
            LBL_DebugFile_Action(),
            null);
}
 
Example #18
Source File: GroovyActionsRegistration.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Messages("LBL_RunFile_Action=Run File")
@ActionID(id = "org.netbeans.modules.groovy.support.GroovyProjectModule.run", category = "Groovy")
@ActionRegistration(lazy = false, displayName = "#LBL_RunFile_Action")
@ActionReferences(value = {
    @ActionReference(path = "Loaders/text/x-groovy/Actions", position = 560),
    @ActionReference(path = "Editors/text/x-groovy/Popup", position = 810, separatorBefore = 800)
})
public static Action run() {
    return FileSensitiveActions.fileCommandAction(
            ActionProvider.COMMAND_RUN_SINGLE,
            LBL_RunFile_Action(),
            null);
}
 
Example #19
Source File: TakeSnapshotAction.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@ActionID(id = "org.netbeans.modules.profiler.actions.TakeSnapshotAction", category = "Profile")
@ActionRegistration(displayName = "#LBL_TakeSnapshotAction")
@ActionReferences(value = {
    @ActionReference(path = "Shortcuts", name = "A-F2"),
    @ActionReference(path = "Menu/Profile", position = 900)})
public static TakeSnapshotAction getInstance() {
    return Singleton.INSTANCE;
}
 
Example #20
Source File: TakeThreadDumpAction.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@ActionID(id = "org.netbeans.modules.profiler.actions.TakeThreadDumpAction", category = "Profile")
@ActionRegistration(displayName = "#LBL_TakeThreadDumpAction")
@ActionReferences(value = {
    //        @ActionReference(path = "Shortcuts", name = "C-F3"),
    @ActionReference(path = "Menu/Profile", position = 500)})
public static TakeThreadDumpAction getInstance() {
    return Singleton.INSTANCE;
}
 
Example #21
Source File: ProfilerSessions.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@ActionID(category="Profile", id="org.netbeans.modules.profiler.v2.ProfilerSessions.StopAction") // NOI18N
@ActionRegistration(displayName="#LBL_StopAction", lazy=false) // NOI18N
@ActionReferences({
    @ActionReference(path="Menu/Profile", position=300, separatorAfter=400), // NOI18N
    @ActionReference(path="Shortcuts", name="S-F2") // NOI18N
})
public static StopAction getInstance() { return Singleton.INSTANCE; }
 
Example #22
Source File: AntActions.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Messages("LBL_ProfileTest=Prof&ile Test File")
@ActionID(category = "Profile", id = "org.netbeans.modules.profiler.actions.ProfileTest")
@ActionRegistration(displayName = "#LBL_ProfileTest", lazy=false)
@ActionReferences(value = {
    @ActionReference(path = "Loaders/text/x-java/Actions", position = 1280),
    @ActionReference(path = "Menu/Profile", position = 120)})
public static Action profileTest() {
    return FileSensitiveActions.fileSensitiveAction(
            new FileSensitivePerformer(ActionProvider.COMMAND_PROFILE_TEST_SINGLE), 
            Bundle.LBL_ProfileTest(),
            null);
}
 
Example #23
Source File: InsertProfilingPointMenuAction.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@ActionID(id = "org.netbeans.modules.profiler.actions.InsertProfilingPointMenuAction", category = "Profile")
@ActionRegistration(displayName = "#LBL_InsertProfilingPointMenuAction")
@ActionReferences(value = {
    @ActionReference(path = "Menu/Profile", position = 1200)})
public static InsertProfilingPointMenuAction getInstance() {
    return Singleton.INSTANCE;
}
 
Example #24
Source File: ActionProcessorTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@ActionRegistration(displayName="#AlwaysOn")
@ActionID(id="my.test.AlwaysByMethod", category="Tools")
@ActionReferences({
    @ActionReference(path="Kuk/buk", position=1, separatorAfter=2),
    @ActionReference(path="Muk/luk", position=11, separatorBefore=10)
})
public static ActionListener factory() {
    created++;
    return new ActionListener() {
        public @Override void actionPerformed(ActionEvent e) {
            cnt += e.getID();
        }
    };
}
 
Example #25
Source File: ActionProcessorTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@ActionReferences({
    @ActionReference(
        path="Loaders/text/x-my/Actions", 
        id=@ActionID(category="System", id="org.openide.actions.OpenAction"),
        position=100, 
        separatorAfter=200
    )
})
public void testAlwaysEnabledAction() throws Exception {
    assertEquals("Not created yet", 0, Always.created);
    Action a = Actions.forID("Tools", "my.test.Always");
    assertNotNull("action found", a);
    assertEquals("Still not created", 0, Always.created);

    assertEquals("I am always on!", a.getValue(Action.NAME));
    assertEquals("Not even now created", 0, Always.created);
    a.actionPerformed(new ActionEvent(this, 300, ""));
    assertEquals("Created now!", 1, Always.created);

    assertEquals("Action called", 300, Always.cnt);
    
    FileObject shad = FileUtil.getConfigFile(
        "My/Folder/D-F6.shadow"
    );
    assertNotNull("Shadow created", shad);
    assertEquals("Right position", 333, shad.getAttribute("position"));
    assertEquals("Proper link", "Actions/Tools/my-test-Always.instance", shad.getAttribute("originalFile"));
}
 
Example #26
Source File: ActionProcessor.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
    public Set<String> getSupportedAnnotationTypes() {
        Set<String> hash = new HashSet<String>();
        hash.add(ActionRegistration.class.getCanonicalName());
        hash.add(ActionID.class.getCanonicalName());
        hash.add(ActionReference.class.getCanonicalName());
        hash.add(ActionReferences.class.getCanonicalName());
//        hash.add(ActionState.class.getCanonicalName());
        return hash;
    }
 
Example #27
Source File: TopComponentProcessorTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@ActionID(category="Windows", id="multi.use")
@TopComponent.OpenActionRegistration(displayName="#TEST_ACTION",preferredID="multi.use")
@ActionReferences({
    @ActionReference(path="Puk/Muk"),
    @ActionReference(path="Juk/Luk")
})
public static TC withReferences() {
    cnt2++;
    return new TC();
}