Java 类org.eclipse.ui.ide.ResourceSelectionUtil 实例源码

项目:translationstudio8    文件:EditActionGroup.java   
public void fillContextMenu(IMenuManager menu) {
    IStructuredSelection selection = (IStructuredSelection) getContext().getSelection();

    boolean anyResourceSelected = !selection.isEmpty()
            && ResourceSelectionUtil.allResourcesAreOfType(selection, IResource.PROJECT | IResource.FOLDER
                    | IResource.FILE);

    copyAction.selectionChanged(selection);
    // menu.appendToGroup(ICommonMenuConstants.GROUP_EDIT, copyAction);
    pasteAction.selectionChanged(selection);
    // menu.insertAfter(copyAction.getId(), pasteAction);
    // menu.appendToGroup(ICommonMenuConstants.GROUP_EDIT, pasteAction);

    if (anyResourceSelected) {
        deleteAction.selectionChanged(selection);
        // menu.insertAfter(pasteAction.getId(), deleteAction);
        menu.appendToGroup(ICommonMenuConstants.GROUP_EDIT, deleteAction);
    }
}
项目:tmxeditor8    文件:EditActionGroup.java   
public void fillContextMenu(IMenuManager menu) {
    IStructuredSelection selection = (IStructuredSelection) getContext().getSelection();

    boolean anyResourceSelected = !selection.isEmpty()
            && ResourceSelectionUtil.allResourcesAreOfType(selection, IResource.PROJECT | IResource.FOLDER
                    | IResource.FILE);

    copyAction.selectionChanged(selection);
    // menu.appendToGroup(ICommonMenuConstants.GROUP_EDIT, copyAction);
    pasteAction.selectionChanged(selection);
    // menu.insertAfter(copyAction.getId(), pasteAction);
    // menu.appendToGroup(ICommonMenuConstants.GROUP_EDIT, pasteAction);

    if (anyResourceSelected) {
        deleteAction.selectionChanged(selection);
        // menu.insertAfter(pasteAction.getId(), deleteAction);
        menu.appendToGroup(ICommonMenuConstants.GROUP_EDIT, deleteAction);
    }
}
项目:translationstudio8    文件:RefactorActionGroup.java   
public void fillContextMenu(IMenuManager menu) {
        IStructuredSelection selection = (IStructuredSelection) getContext().getSelection();

        boolean anyResourceSelected = !selection.isEmpty()
                && ResourceSelectionUtil.allResourcesAreOfType(selection, IResource.PROJECT | IResource.FOLDER | IResource.FILE);

        if (anyResourceSelected) {
            moveAction.selectionChanged(selection);
//          menu.appendToGroup(ICommonMenuConstants.GROUP_REORGANIZE, moveAction);
            renameAction.selectionChanged(selection);
//          menu.insertAfter(moveAction.getId(), renameAction);
        }
    }
项目:tmxeditor8    文件:RefactorActionGroup.java   
public void fillContextMenu(IMenuManager menu) {
        IStructuredSelection selection = (IStructuredSelection) getContext().getSelection();

        boolean anyResourceSelected = !selection.isEmpty()
                && ResourceSelectionUtil.allResourcesAreOfType(selection, IResource.PROJECT | IResource.FOLDER | IResource.FILE);

        if (anyResourceSelected) {
            moveAction.selectionChanged(selection);
//          menu.appendToGroup(ICommonMenuConstants.GROUP_REORGANIZE, moveAction);
            renameAction.selectionChanged(selection);
//          menu.insertAfter(moveAction.getId(), renameAction);
        }
    }
项目:maru    文件:ScenarioActionsProvider.java   
@Override
public void fillContextMenu(IMenuManager menu)
{
    IStructuredSelection selection = (IStructuredSelection) getContext().getSelection();

    IMenuManager submenu = new MenuManager("New", NEW_MENU_NAME);

    // fill the menu from the commonWizard contributions
    newWizardActionGroup.setContext(getContext());
    newWizardActionGroup.fillContextMenu(submenu);
    submenu.add(new Separator(ICommonMenuConstants.GROUP_ADDITIONS));
    menu.appendToGroup(ICommonMenuConstants.GROUP_NEW, submenu);

    if (selection.isEmpty()) {
        return;
    }

    if (ResourceSelectionUtil.allResourcesAreOfType(selection, IResource.PROJECT))
    {
        projectDeleteAction.selectionChanged(selection);
        menu.appendToGroup(ICommonMenuConstants.GROUP_EDIT, projectDeleteAction);
    }
    else if (allScenarioElementsAreRemovable(selection))
    {
        elementDeleteAction.selectionChanged(selection);
        menu.appendToGroup(ICommonMenuConstants.GROUP_EDIT, elementDeleteAction);
    }

    // add the 'Properties' entry to the popup menu
    propertyDialogAction.selectionChanged(selection);
    menu.appendToGroup(ICommonMenuConstants.GROUP_PROPERTIES, propertyDialogAction);
}