Java 类org.eclipse.ui.commands.ICommandManager 实例源码

项目:Eclipse-Postfix-Code-Completion    文件:AbstractInformationControl.java   
/**
 * Creates a tree information control with the given shell as parent. The given
 * styles are applied to the shell and the tree widget.
 *
 * @param parent the parent shell
 * @param shellStyle the additional styles for the shell
 * @param treeStyle the additional styles for the tree widget
 * @param invokingCommandId the id of the command that invoked this control or <code>null</code>
 * @param showStatusField <code>true</code> iff the control has a status field at the bottom
 */
public AbstractInformationControl(Shell parent, int shellStyle, int treeStyle, String invokingCommandId, boolean showStatusField) {
    super(parent, shellStyle, true, true, false, true, true, null, null);
    if (invokingCommandId != null) {
        ICommandManager commandManager= PlatformUI.getWorkbench().getCommandSupport().getCommandManager();
        fInvokingCommand= commandManager.getCommand(invokingCommandId);
        if (fInvokingCommand != null && !fInvokingCommand.isDefined())
            fInvokingCommand= null;
        else
            // Pre-fetch key sequence - do not change because scope will change later.
            getInvokingCommandKeySequences();
    }
    fTreeStyle= treeStyle;
    // Title and status text must be set to get the title label created, so force empty values here.
    if (hasHeader())
        setTitleText(""); //$NON-NLS-1$
    setInfoText(""); //  //$NON-NLS-1$

    // Create all controls early to preserve the life cycle of the original implementation.
    create();

    // Status field text can only be computed after widgets are created.
    setInfoText(getStatusFieldText());
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:AbstractInformationControl.java   
/**
 * Creates a tree information control with the given shell as parent. The given
 * styles are applied to the shell and the tree widget.
 *
 * @param parent the parent shell
 * @param shellStyle the additional styles for the shell
 * @param treeStyle the additional styles for the tree widget
 * @param invokingCommandId the id of the command that invoked this control or <code>null</code>
 * @param showStatusField <code>true</code> iff the control has a status field at the bottom
 */
public AbstractInformationControl(Shell parent, int shellStyle, int treeStyle, String invokingCommandId, boolean showStatusField) {
    super(parent, shellStyle, true, true, false, true, true, null, null);
    if (invokingCommandId != null) {
        ICommandManager commandManager= PlatformUI.getWorkbench().getCommandSupport().getCommandManager();
        fInvokingCommand= commandManager.getCommand(invokingCommandId);
        if (fInvokingCommand != null && !fInvokingCommand.isDefined())
            fInvokingCommand= null;
        else
            // Pre-fetch key sequence - do not change because scope will change later.
            getInvokingCommandKeySequences();
    }
    fTreeStyle= treeStyle;
    // Title and status text must be set to get the title label created, so force empty values here.
    if (hasHeader())
        setTitleText(""); //$NON-NLS-1$
    setInfoText(""); //  //$NON-NLS-1$

    // Create all controls early to preserve the life cycle of the original implementation.
    create();

    // Status field text can only be computed after widgets are created.
    setInfoText(getStatusFieldText());
}
项目:Pydev    文件:PythonBreakpointPage.java   
/**
 * Creates the controls that allow the user to specify the breakpoint's
 * condition
 * @param parent the composite in which the condition editor should be created
 * @throws CoreException if an exception occurs accessing the breakpoint
 */
private void createConditionEditor(Composite parent) throws CoreException {
    PyBreakpoint breakpoint = getBreakpoint();

    String label = null;
    ICommandManager commandManager = PlatformUI.getWorkbench().getCommandSupport().getCommandManager();
    ICommand command = commandManager.getCommand("org.eclipse.ui.edit.text.contentAssist.proposals"); //$NON-NLS-1$
    if (command != null) {
        List keyBindings = command.getKeySequenceBindings();
        if (keyBindings != null && keyBindings.size() > 0) {
            IKeySequenceBinding binding = (IKeySequenceBinding) keyBindings.get(0);
            label = StringUtils.format("E&nable Condition %s", binding.getKeySequence().format()); //$NON-NLS-1$
        }
    }

    if (label == null) {
        label = "E&nable Condition (code assist not available)"; //$NON-NLS-1$
    }
    Composite conditionComposite = new Group(parent, SWT.NONE);
    conditionComposite.setFont(parent.getFont());
    conditionComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    conditionComposite.setLayout(new GridLayout());
    fEnableConditionButton = createCheckButton(conditionComposite, label);
    fEnableConditionButton.setSelection(breakpoint.isConditionEnabled());
    fEnableConditionButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            setConditionEnabled(fEnableConditionButton.getSelection());
        }
    });

    fConditionEditor = new BreakpointConditionEditor(conditionComposite, this);

    //fSuspendWhenLabel= createLabel(conditionComposite, "Suspend when:");
    //fConditionIsTrue= createRadioButton(conditionComposite, "condition is \'tr&ue\'");
    //fConditionIsTrue= createLabel(conditionComposite, "condition is \'tr&ue\'");
    //fConditionHasChanged= createRadioButton(conditionComposite, "value of condition ch&anges");
    //        if (breakpoint.isConditionSuspendOnTrue()) {
    //            fConditionIsTrue.setSelection(true);
    //        } else {
    //            fConditionHasChanged.setSelection(true);
    //        }
    setConditionEnabled(fEnableConditionButton.getSelection());
}