List of usage examples for org.eclipse.jface.action IToolBarManager update
void update(boolean force);
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/* w ww .j a va 2 s . c om*/ 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())); } } }); }
From source file:com.android.ide.eclipse.adt.internal.editors.layout.gle2.OutlinePage.java
License:Open Source License
@Override public void createControl(Composite parent) { mControl = new SelfOrientingSashForm(parent, SWT.VERTICAL); if (mShowHeader) { PageSiteComposite mOutlineComposite = new PageSiteComposite(mControl, SWT.BORDER); mOutlineComposite.setTitleText("Outline"); mOutlineComposite.setTitleImage(IconFactory.getInstance().getIcon("components_view")); mOutlineComposite.setPage(new IPage() { @Override//from w ww . j a v a 2 s . c o m public void createControl(Composite outlineParent) { createOutline(outlineParent); } @Override public void dispose() { } @Override public Control getControl() { return getTreeViewer().getTree(); } @Override public void setToolBar(IToolBarManager toolBarManager) { makeContributions(null, toolBarManager, null); toolBarManager.update(false); } @Override public void setFocus() { getControl().setFocus(); } }); } else { createOutline(mControl); } if (mShowPropertySheet) { createPropertySheet(); } }
From source file:com.android.ide.eclipse.adt.internal.editors.layout.gle2.OutlinePage.java
License:Open Source License
@Override public void setToolBar(IToolBarManager toolBarManager) { makeContributions(null, toolBarManager, null); toolBarManager.update(false); }
From source file:com.android.ide.eclipse.gldebugger.GLFramesView.java
License:Apache License
private void fillLocalToolBar(final IToolBarManager manager) { mActionConnect = new Action("Connect", Action.AS_PUSH_BUTTON) { @Override// w w w . ja v a2s . c om public void run() { if (!mRunning) changeContext(null); // viewer will switch to newest context connectDisconnect(); } }; manager.add(mActionConnect); manager.add(new Action("Open File", Action.AS_PUSH_BUTTON) { @Override public void run() { if (!mRunning) { changeContext(null); // viewer will switch to newest context openFile(); } } }); final Shell shell = this.getViewSite().getShell(); mActionAutoScroll = new Action("Auto Scroll", Action.AS_CHECK_BOX) { @Override public void run() { } }; mActionAutoScroll.setChecked(true); manager.add(mActionAutoScroll); mActionFilter = new Action("*", Action.AS_DROP_DOWN_MENU) { @Override public void run() { InputDialog dialog = new InputDialog(shell, "Contains Filter", "case sensitive substring or *", mActionFilter.getText(), null); if (Window.OK == dialog.open()) { mActionFilter.setText(dialog.getValue()); manager.update(true); mTextFilters = dialog.getValue().split("\\|"); if (mTextFilters.length == 1 && mTextFilters[0].equals("*")) mTextFilters = null; mViewer.refresh(); } } }; manager.add(mActionFilter); 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); } }); mActionContext = 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(mActionContext); 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) mViewer.getInput()); // need to reload current frame mViewer.setInput(current.getFrame(mFrameScale.getSelection())); } } }); manager.add(new Action("CodeGen Frames", Action.AS_PUSH_BUTTON) { @Override public void run() { if (current != null) { new CodeGen().codeGenFrames(current, mFrameScale.getSelection() + 1, getSite().getShell()); // need to reload current frame mViewer.setInput(current.getFrame(mFrameScale.getSelection())); } } }); }
From source file:com.android.ide.eclipse.hierarchyviewer.views.DeviceSelectorView.java
License:Apache License
private void placeActions(boolean doTreeViewStuff, boolean doPixelPerfectStuff) { IActionBars actionBars = getViewSite().getActionBars(); IMenuManager mm = actionBars.getMenuManager(); mm.removeAll();//w w w .j a va2 s.c om mm.add(RefreshWindowsAction.getAction()); IToolBarManager tm = actionBars.getToolBarManager(); tm.removeAll(); tm.add(RefreshWindowsAction.getAction()); if (doTreeViewStuff) { mm.add(LoadViewHierarchyAction.getAction()); tm.add(LoadViewHierarchyAction.getAction()); } if (doPixelPerfectStuff) { mm.add(InspectScreenshotAction.getAction()); tm.add(InspectScreenshotAction.getAction()); } mm.updateAll(true); tm.update(true); actionBars.updateActionBars(); }
From source file:com.aptana.ide.server.ui.views.GenericServersView.java
License:Open Source License
private void updateToolbar(final IToolBarManager toolBarManager) { IStructuredSelection selection = (IStructuredSelection) serverViewer.getSelection(); this.pauseAction.selectionChanged(new SelectionChangedEvent(this.serverViewer, selection)); this.openLog.selectionChanged(new SelectionChangedEvent(this.serverViewer, selection)); if (selection.isEmpty()) { startAction.setEnabled(false);//from ww w. j a v a2s. co m debugAction.setEnabled(false); profileAction.setEnabled(false); restartAction.setEnabled(false); stopAction.setEnabled(false); } else { IServer server = (IServer) selection.getFirstElement(); // boolean isStopped = server.getServerState() == IServer.STATE_STOPPED; IStatus canStart0 = server.canStart("run");//$NON-NLS-1$ startAction.setEnabled(canStart0.isOK()); if (!canStart0.isOK()) { startAction.setToolTipText(canStart0.getMessage()); } else { startAction.setToolTipText(Messages.ServersView_START); } IStatus canStart = server.canStart("debug");//$NON-NLS-1$ debugAction.setEnabled(canStart.isOK()); if (!canStart.isOK()) { debugAction.setToolTipText(canStart.getMessage()); } else { debugAction.setToolTipText(Messages.ServersView_DEBUG); } IStatus canStart2 = server.canStart("profile"); //$NON-NLS-1$ profileAction.setEnabled(canStart2.isOK()); if (!canStart2.isOK()) { profileAction.setToolTipText(canStart2.getMessage()); } else { profileAction.setToolTipText(Messages.ServersView_PROFILE); } restartAction.setEnabled(server.canRestart(server.getMode()).getSeverity() == IStatus.OK); stopAction.setEnabled(server.canStop().getSeverity() == IStatus.OK); openConsole.selectionChanged(new SelectionChangedEvent(serverViewer, serverViewer.getSelection())); } updateStartActions(); updateCollapseAllAction(); updateExpandAllAction(); toolBarManager.update(true); }
From source file:com.arc.cdt.debug.seecode.ui.internal.display.ViewToolBarBuilder.java
License:Open Source License
@Override public void populateView(final IViewPart viewPart) { IViewSite vs = viewPart.getViewSite(); final IToolBarManager tm = vs.getActionBars().getToolBarManager(); tm.removeAll();/* w w w . j a v a 2 s. c o m*/ for (IToolBarItem it : mItems) { it.addToToolBar(tm); } //<WIN32 BUG>: if the toolbar doesn't have any buttons (e.g., only // comboboxes), Windows version of SWT (as of 3.1M5) doesn't // compute the height correctly. // For such cases, we must add a dummy button with an invisible 1-pixel // wide icon. It won't be seen in the toolbar unless the mouse happens // to go over it. If anyone has a better solution, please make appropriate // corrections. This problem has already cost me a day! (D.P.) if (isWindows()) { boolean hasButtons = false; for (IToolBarItem it : mItems) { if (it instanceof DeferredButton) { hasButtons = true; break; } } if (!hasButtons) { DeferredButton item = new DeferredButton(IAction.AS_PUSH_BUTTON); item.addToToolBar(tm); final String DUMMY_ICON = "IconToFixWindowsSWTBug"; ImageRegistry imageRegistry = UISeeCodePlugin.getDefault().getImageRegistry(); ImageDescriptor id = imageRegistry.getDescriptor(DUMMY_ICON); if (id == null) { final ImageData data = new ImageData(1, 15, 1, new PaletteData(new RGB[] { new RGB(0, 0, 0), new RGB(255, 255, 255) })); data.transparentPixel = 0; id = new ImageDescriptor() { @Override public ImageData getImageData() { return data; } }; imageRegistry.put(DUMMY_ICON, id); } item.setImage(id); } } //</WIN32 BUG> tm.update(true); }
From source file:com.arc.cdt.debug.seecode.ui.views.AbstractEngineBasedView.java
License:Open Source License
/** * Clear the toolbar/*from ww w .j a v a2 s . c om*/ */ protected void clearToolBar() { IToolBarManager toolBarManager = getViewSite().getActionBars().getToolBarManager(); toolBarManager.removeAll(); toolBarManager.update(true); }
From source file:com.astra.ses.spell.dev.advisor.WorkbenchActionBuilder.java
License:Open Source License
/** * Update the pin action's tool bar//ww w . j a v a2 s. c om */ void updatePinActionToolbar() { ICoolBarManager coolBarManager = getActionBarConfigurer().getCoolBarManager(); IContributionItem cbItem = coolBarManager.find(IWorkbenchActionConstants.TOOLBAR_NAVIGATE); if (!(cbItem instanceof IToolBarContributionItem)) { // This should not happen System.err.println("Navigation toolbar contribution item is missing"); //$NON-NLS-1$ return; } IToolBarContributionItem toolBarItem = (IToolBarContributionItem) cbItem; IToolBarManager toolBarManager = toolBarItem.getToolBarManager(); if (toolBarManager == null) { // error if this happens, navigation toolbar assumed to always exist System.err.println("Navigate toolbar is missing"); //$NON-NLS-1$ return; } toolBarManager.update(false); toolBarItem.update(ICoolBarManager.SIZE); }
From source file:com.bdaum.zoom.gps.internal.views.MapView.java
License:Open Source License
protected void contributeToActionBars() { IViewSite viewSite = getViewSite();//from w ww . ja va2 s. c om IActionBars bars = viewSite.getActionBars(); IToolBarManager toolBarManager = bars.getToolBarManager(); fillLocalToolBar(toolBarManager); IMenuManager menuManager = bars.getMenuManager(); fillLocalPullDown(menuManager); toolBarManager.update(true); menuManager.update(true); IWorkbenchOperationSupport operationSupport = PlatformUI.getWorkbench().getOperationSupport(); undoContext = operationSupport.getUndoContext(); UndoRedoActionGroup undoRedoGroup = new UndoRedoActionGroup(viewSite, undoContext, true); undoRedoGroup.fillActionBars(bars); }