Example usage for org.eclipse.jface.action IToolBarManager add

List of usage examples for org.eclipse.jface.action IToolBarManager add

Introduction

In this page you can find the example usage for org.eclipse.jface.action IToolBarManager add.

Prototype

void add(IAction action);

Source Link

Document

Adds an action as a contribution item to this manager.

Usage

From source file:cn.dockerfoundry.ide.eclipse.explorer.ui.views.DockerExplorerView.java

License:Open Source License

private void fillLocalToolBar(IToolBarManager manager) {
    manager.add(createDockerConnAction);
    manager.add(removeDockerConnAction);
    Object selectedElem = getSelectedElement();
    removeDockerConnAction.setEnabled(isDockerConnectionElem(selectedElem));
    manager.add(new Separator());
    manager.add(dockerInfoAction);/* w  ww. j  av a2 s  .  co m*/
    manager.add(dockerVersionAction);
    manager.add(new Separator());
    drillDownAdapter.addNavigationActions(manager);
}

From source file:cn.dockerfoundry.ide.eclipse.explorer.ui.views.DockerImagesView.java

License:Open Source License

private void fillLocalToolBar(IToolBarManager manager) {
    manager.add(pullImageAction);
    manager.add(pushmageAction);/*  w w w.ja  va2  s. c o  m*/
    manager.add(createImageAction);
    manager.add(createContainerAction);
    manager.add(deleteImageAction);
    manager.add(inspectAction);
    manager.add(refreshAction);
}

From source file:cn.edu.pku.ogeditor.ShapesEditorActionBarContributor.java

License:Open Source License

/**
 * Add actions to the given toolbar.//from  w ww.j a va2s  .  c om
 * @see org.eclipse.ui.part.EditorActionBarContributor#contributeToToolBar(org.eclipse.jface.action.IToolBarManager)
 */
public void contributeToToolBar(IToolBarManager toolBarManager) {
    toolBarManager.add(getAction(ActionFactory.UNDO.getId()));
    toolBarManager.add(getAction(ActionFactory.REDO.getId()));
    toolBarManager.add(new Separator());
    toolBarManager.add(getAction(ActionFactory.DELETE.getId()));
    toolBarManager.add(new Separator());
    toolBarManager.add(getAction(GEFActionConstants.ZOOM_IN));
    toolBarManager.add(getAction(GEFActionConstants.ZOOM_OUT));
    toolBarManager.add(new ZoomComboContributionItem(getPage()));
}

From source file:com.amazonaws.eclipse.ec2.ui.amis.AmiBrowserView.java

License:Apache License

/**
 * Adds a refresh button to this view's toolbar. 
 *///from   w  w w .jav  a2  s . c  o  m
private void contributeToActionBars() {
    IActionBars bars = getViewSite().getActionBars();
    IToolBarManager manager = bars.getToolBarManager();
    manager.add(filteredAmiSelectionTable.getAmiSelectionTable().getRefreshAction());
    manager.add(filteredAmiSelectionTable.getAmiSelectionTable().getAmiFilterDropDownAction());
    manager.add(filteredAmiSelectionTable.getAmiSelectionTable().getPlatformFilterDropDownAction());
}

From source file:com.amazonaws.eclipse.ec2.ui.ebs.ElasticBlockStorageView.java

License:Apache License

private void fillLocalToolBar(IToolBarManager manager) {
    refreshAction = new Action() {
        public void run() {
            if (volumeSelectionTable != null)
                volumeSelectionTable.refreshVolumes();

            if (snapshotSelectionTable != null)
                snapshotSelectionTable.refreshSnapshots();
        }/*w  w w .  j av a 2s  . c  om*/
    };
    refreshAction.setText("Refresh");
    refreshAction.setToolTipText("Refresh EBS volumes and snapshots");
    refreshAction.setImageDescriptor(Ec2Plugin.getDefault().getImageRegistry().getDescriptor("refresh"));

    manager.add(refreshAction);
}

From source file:com.amazonaws.eclipse.ec2.ui.elasticip.ElasticIpView.java

License:Apache License

private void fillLocalToolBar(IToolBarManager manager) {
    manager.add(elasticIPTable.getRefreshAddressesAction());
    manager.add(elasticIPTable.getNewAddressAction());
    manager.add(elasticIPTable.getReleaseAddressAction());
}

From source file:com.amazonaws.eclipse.ec2.ui.securitygroups.SecurityGroupView.java

License:Apache License

private void fillLocalToolBar(IToolBarManager manager) {
    manager.add(securityGroupSelectionComposite.getRefreshSecurityGroupsAction());
}

From source file:com.amazonaws.eclipse.explorer.cloudfront.DistributionEditor.java

License:Apache License

protected void contributeActions(IToolBarManager toolbarManager) {
    enableDistributionAction = new EnableDistributionAction(editorInput.getDistributionId(),
            editorInput.getAccountId(), this);
    disableDistributionAction = new DisableDistributionAction(editorInput.getDistributionId(),
            editorInput.getAccountId(), this);

    toolbarManager.add(enableDistributionAction);
    toolbarManager.add(disableDistributionAction);
}

From source file:com.amazonaws.eclipse.explorer.cloudfront.StreamingDistributionEditor.java

License:Apache License

protected void contributeActions(IToolBarManager toolbarManager) {
    enableDistributionAction = new EnableStreamingDistributionAction(editorInput.getDistributionId(),
            editorInput.getAccountId(), this);
    disableDistributionAction = new DisableStreamingDistributionAction(editorInput.getDistributionId(),
            editorInput.getAccountId(), this);

    toolbarManager.add(enableDistributionAction);
    toolbarManager.add(disableDistributionAction);
}

From source file:com.android.glesv2debugger.SampleView.java

License:Apache License

private void fillLocalToolBar(final IToolBarManager manager) {
    actionConnect = new Action("Connect", Action.AS_PUSH_BUTTON) {
        @Override/*from  w w  w .ja  va 2  s . co  m*/
        public void run() {
            if (!running)
                changeContext(null); // viewer will switch to newest context
            connectDisconnect();
        }
    };
    manager.add(actionConnect);

    manager.add(new Action("Open File", Action.AS_PUSH_BUTTON) {
        @Override
        public void run() {
            if (!running) {
                changeContext(null); // viewer will switch to newest context
                openFile();
            }
        }
    });

    final Shell shell = this.getViewSite().getShell();
    actionAutoScroll = new Action("Auto Scroll", Action.AS_CHECK_BOX) {
        @Override
        public void run() {
        }
    };
    actionAutoScroll.setChecked(true);
    manager.add(actionAutoScroll);

    actionFilter = new Action("*", Action.AS_DROP_DOWN_MENU) {
        @Override
        public void run() {
            org.eclipse.jface.dialogs.InputDialog dialog = new org.eclipse.jface.dialogs.InputDialog(shell,
                    "Contains Filter", "case sensitive substring or *", actionFilter.getText(), null);
            if (Window.OK == dialog.open()) {
                actionFilter.setText(dialog.getValue());
                manager.update(true);
                filters = dialog.getValue().split("\\|");
                if (filters.length == 1 && filters[0].equals("*"))
                    filters = null;
                viewer.refresh();
            }

        }
    };
    manager.add(actionFilter);

    manager.add(new Action("CaptureDraw", Action.AS_DROP_DOWN_MENU) {
        @Override
        public void run() {
            int contextId = 0;
            if (current != null)
                contextId = current.contextId;
            InputDialog inputDialog = new InputDialog(shell, "Capture glDrawArrays/Elements",
                    "Enter number of glDrawArrays/Elements to glReadPixels for " + "context 0x"
                            + Integer.toHexString(contextId) + "\n(0x0 is any context)",
                    "9001", null);
            if (inputDialog.open() != Window.OK)
                return;
            Message.Builder builder = Message.newBuilder();
            builder.setContextId(contextId);
            builder.setType(Type.Response);
            builder.setExpectResponse(false);
            builder.setFunction(Function.SETPROP);
            builder.setProp(Prop.CaptureDraw);
            builder.setArg0(Integer.parseInt(inputDialog.getValue()));
            messageQueue.addCommand(builder.build());
        }
    });

    manager.add(new Action("CaptureSwap", Action.AS_DROP_DOWN_MENU) {
        @Override
        public void run() {
            int contextId = 0;
            if (current != null)
                contextId = current.contextId;
            InputDialog inputDialog = new InputDialog(
                    shell, "Capture eglSwapBuffers", "Enter number of eglSwapBuffers to glReadPixels for "
                            + "context 0x" + Integer.toHexString(contextId) + "\n(0x0 is any context)",
                    "9001", null);
            if (inputDialog.open() != Window.OK)
                return;
            Message.Builder builder = Message.newBuilder();
            builder.setContextId(contextId);
            builder.setType(Type.Response);
            builder.setExpectResponse(false);
            builder.setFunction(Function.SETPROP);
            builder.setProp(Prop.CaptureSwap);
            builder.setArg0(Integer.parseInt(inputDialog.getValue()));
            messageQueue.addCommand(builder.build());
        }
    });

    manager.add(new Action("SYSTEM_TIME_THREAD", Action.AS_DROP_DOWN_MENU) {
        @Override
        public void run() {
            final String[] timeModes = { "SYSTEM_TIME_REALTIME", "SYSTEM_TIME_MONOTONIC", "SYSTEM_TIME_PROCESS",
                    "SYSTEM_TIME_THREAD" };
            int i = java.util.Arrays.asList(timeModes).indexOf(this.getText());
            i = (i + 1) % timeModes.length;
            Message.Builder builder = Message.newBuilder();
            builder.setContextId(0); // FIXME: proper context id
            builder.setType(Type.Response);
            builder.setExpectResponse(false);
            builder.setFunction(Message.Function.SETPROP);
            builder.setProp(Prop.TimeMode);
            builder.setArg0(i);
            messageQueue.addCommand(builder.build());
            this.setText(timeModes[i]);
            manager.update(true);
        }
    });

    actContext = new Action("Context: 0x", Action.AS_DROP_DOWN_MENU) {
        @Override
        public void run() {
            if (debugContexts.size() < 2)
                return;
            final String idStr = this.getText().substring("Context: 0x".length());
            if (idStr.length() == 0)
                return;
            final int contextId = Integer.parseInt(idStr, 16);
            int index = debugContexts.indexOfKey(contextId);
            index = (index + 1) % debugContexts.size();
            changeContext(debugContexts.valueAt(index));
        }
    };
    manager.add(actContext);

    actionPort = new Action("5039", Action.AS_DROP_DOWN_MENU) {
        @Override
        public void run() {
            InputDialog dialog = new InputDialog(shell, "Port", "Debugger port", actionPort.getText(), null);
            if (Window.OK == dialog.open()) {
                actionPort.setText(dialog.getValue());
                manager.update(true);
            }
        }
    };
    manager.add(actionPort);

    manager.add(new Action("CodeGen Frame", Action.AS_PUSH_BUTTON) {
        @Override
        public void run() {
            if (current != null) {
                new CodeGen().codeGenFrame((Frame) viewer.getInput());
                // need to reload current frame
                viewer.setInput(current.getFrame(frameNum.getSelection()));
            }
        }
    });

    manager.add(new Action("CodeGen Frames", Action.AS_PUSH_BUTTON) {
        @Override
        public void run() {
            if (current != null) {
                new CodeGen().codeGenFrames(current, frameNum.getSelection() + 1, getSite().getShell());
                // need to reload current frame
                viewer.setInput(current.getFrame(frameNum.getSelection()));
            }
        }
    });
}