private void makeActions() { actionUpdate = new Action() { @Override public void run() { updateComparison(); } }; actionUpdate.setText("Update"); actionUpdate.setToolTipText( "Recompute comparison for all API project and their implementation projects in the workspace."); // action2.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages(). // getImageDescriptor(ISharedImages.IMG_OBJS_INFO_TSK)); actionOpenInEditor = new Action() { @Override public void run() { ISelection selection = viewer.getSelection(); Object obj = ((IStructuredSelection) selection).getFirstElement(); if (obj instanceof ProjectComparisonEntry) showInEditor((ProjectComparisonEntry) obj, true, true); } }; actionOpenInEditor.setText("Open in Editor"); actionOpenInEditor.setToolTipText( "Open the currently selected API element and its implementations in N4JS editors."); }
@Override public void init ( final ICommonActionExtensionSite aSite ) { super.init ( aSite ); final ICommonViewerSite viewSite = aSite.getViewSite (); if ( viewSite instanceof ICommonViewerWorkbenchSite ) { final ICommonViewerWorkbenchSite workbenchSite = (ICommonViewerWorkbenchSite)viewSite; this.openAction = new Action ( "Open", IAction.AS_PUSH_BUTTON ) { @Override public void run () { EditorHelper.handleOpen ( workbenchSite.getPage (), workbenchSite.getSelectionProvider () ); } }; } }
@Override public void init ( final ICommonActionExtensionSite aSite ) { super.init ( aSite ); final ICommonViewerSite viewSite = aSite.getViewSite (); if ( viewSite instanceof ICommonViewerWorkbenchSite ) { final ICommonViewerWorkbenchSite workbenchSite = (ICommonViewerWorkbenchSite)viewSite; this.openAction = new Action ( "Open", IAction.AS_PUSH_BUTTON ) { @Override public void run () { handleOpen ( workbenchSite ); } }; } }
public BaseFolderImplementation ( final int index, final String label, final MenuManager mgr ) { this.summaryInformation = new SummaryInformation ( Collections.<String, DataValue> emptyMap () ); this.index = index; this.label = label; this.mgr = mgr; this.dumpAction = new Action ( "Dump summaries for: " + this.label ) { @Override public void run () { BaseFolderImplementation.this.summaryInformation.dump ( System.out ); }; }; this.contribution = new ActionContributionItem ( this.dumpAction ); }
private IAction createPreferenceAction(String label, String preference, String icon) { IAction ret = new Action(label, IAction.AS_CHECK_BOX) { @Override public void run() { Activator.getDefault().getPreferenceStore().setValue(preference, isChecked()); try { viewer.reset(); } catch (Exception e) { logger.error("Cannot refresh scannable viewer!", e); } } }; ret.setImageDescriptor(Activator.getImageDescriptor(icon)); ret.setChecked(Activator.getDefault().getPreferenceStore().getBoolean(preference)); return ret; }
/** * Create the actions */ private void createActions() { final IContributionManager man = getViewSite().getActionBars().getToolBarManager(); final Action restart = new Action("Clear", Activator.getImageDescriptor("icons/layers-stack.png")) { @Override public void run() { clear(); } }; man.add(restart); final MenuManager menuMan = new MenuManager(); menuMan.add(restart); text.setMenu(menuMan.createContextMenu(text)); }
private void addMenuBarItems() { IMenuManager menuManager = getViewSite().getActionBars().getMenuManager(); menuManager.add(new Action("highlight color") { }); menuManager.add(new Action("Copy canvas to clipboard") { @Override public void run() { // stackView.copyToClipBoard(); } @Override public boolean isEnabled() { // return !stackView.isEmpty(); return false; } }); }
private void createActions(IToolBarManager manager) { Action publishAction = new Action("Publish to DAWN marketplace", Action.AS_PUSH_BUTTON) { @Override public ImageDescriptor getImageDescriptor() { return Activator.getImageDescriptor("icons/publish.png"); } @Override public void run() { OverviewPage.this.getManagedForm().getMessageManager().removeAllMessages(); try { scheduleExportJob(); } catch (IOException e) { OverviewPage.this.getManagedForm().getMessageManager().addMessage(MPC, e.getMessage(), null, IMessage.ERROR); } } }; manager.add(publishAction); manager.update(true); }
private void createActions() { newNodeAction = new NewNodeAction(this); renameNodeAction = new RenameNodeAction(this); deleteNodeAction = new DeleteNodeAction(this); moveUpNodeAction = new MoveUpNodeAction(this); moveDownNodeAction = new MoveDownNodeAction(this); promoteNodeAction = new PromoteNodeAction(this); demoteNodeAction = new DemoteNodeAction(this); refreshAction = new Action() { @Override public void run() { refresh(); } }; refreshAction.setText(Messages.getString("CommonStructureControl.RefreshActionText")); //$NON-NLS-1$ refreshAction.setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin(TFSCommonUIClientPlugin.PLUGIN_ID, "icons/Refresh.gif")); //$NON-NLS-1$ }
/** * Creates a menu action for a team project when TFS 2012 teams are not * available. */ private Action createAction(final ProjectInfo project) { Check.notNull(project, "project"); //$NON-NLS-1$ final String projectGUID = project.getGUID(); final Action action = new Action(project.getName()) { @Override public void run() { if (!context.getCurrentProjectInfo().getGUID().equals(projectGUID)) { context.setCurrentProject(projectGUID); context.setCurrentTeam(null); final boolean tfvc = context.getCurrentProjectInfo().getSourceControlCapabilityFlags().contains( SourceControlCapabilityFlags.TFS); TFSCommonUIClientPlugin.getDefault().projectOrTeamChanged(); TFSCommonUIClientPlugin.getDefault().sourceControlChanged(tfvc); } } }; if (context.getCurrentProjectInfo().getGUID().equals(projectGUID)) { action.setChecked(true); } return action; }
private void createActions() { evaluateAction = new Action() { @Override public void run() { evaluate(); } }; evaluateAction.setText(Messages.getString("PolicyWarningsCheckinControl.EvaluateActionText")); //$NON-NLS-1$ helpAction = new Action() { @Override public void run() { final PolicyFailureData policyFailure = policyFailureTable.getSelectedPolicyFailure(); if (policyFailure != null) { policyFailure.displayHelp(); } } }; helpAction.setText(Messages.getString("PolicyWarningsCheckinControl.HelpActionText")); //$NON-NLS-1$ }
/** * fill the popup menu for the table */ private void fillTableMenu(IMenuManager manager) { manager.add(getRefreshAction()); Action action = getAddPropertyAction(); try { if (resource != null) action.setEnabled(resource.isManaged()); else action.setEnabled(false); } catch (SVNException e) { action.setEnabled(false); } manager.add(action); manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); }
private Action createTerminateAction() { Action terminate = new Action(Messages.getString("action.stop")) { @Override public void run() { DeployJob job = console.getJob(); if (job != null) { job.cancel(); update(); } } }; terminate.setToolTipText(Messages.getString("action.stop")); terminate.setImageDescriptor(getSharedImage(ISharedImages.IMG_ELCL_STOP)); terminate.setHoverImageDescriptor(getSharedImage(ISharedImages.IMG_ELCL_STOP)); terminate.setDisabledImageDescriptor(getSharedImage(ISharedImages.IMG_ELCL_STOP_DISABLED)); return terminate; }
private void configureToolBar(IToolBarManager toolbarManager) { terminateAction = new Action(Messages.actionStop) { @Override public void run() { //code to execute when button is pressed LocalAppEngineServerBehaviour serverBehaviour = console.getServerBehaviourDelegate(); if (serverBehaviour != null) { // try to initiate a nice shutdown boolean force = serverBehaviour.getServer().getServerState() == IServer.STATE_STOPPING; serverBehaviour.stop(force); } update(); } }; terminateAction.setToolTipText(Messages.actionStopToolTip); terminateAction.setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_ELCL_STOP)); terminateAction.setHoverImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_CLCL_STOP)); terminateAction.setDisabledImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_DLCL_STOP)); toolbarManager.appendToGroup(IConsoleConstants.LAUNCH_GROUP, terminateAction); }
private IAction createHideAction(String desc, final int nodeType, ImageDescriptor img) { IAction action = new Action(desc, IAction.AS_CHECK_BOX) { public void run() { boolean oldState = filter.isTypeVisible(nodeType); filter.toggleType(nodeType, !oldState); TreeViewer viewer = getTreeViewer(); if (oldState == false) { revealNodes(nodeType); } viewer.refresh(); } }; action.setToolTipText(desc); action.setImageDescriptor(img); return action; }
/** * Initialize copy paste by getting the clipboard and hooking * the actions to global edit menu. * * @param viewer */ private void initCopyPaste(TreeViewer viewer) { this.clipboard = new Clipboard(getSite().getShell().getDisplay()); IActionBars bars = getSite().getActionBars(); bars.setGlobalActionHandler( ActionFactory.CUT.getId(), (Action)outlineActions.get(ACTION_CUT)); bars.setGlobalActionHandler( ActionFactory.COPY.getId(), (Action)outlineActions.get(ACTION_COPY)); bars.setGlobalActionHandler( ActionFactory.PASTE.getId(), (Action)outlineActions.get(ACTION_PASTE)); bars.setGlobalActionHandler( ActionFactory.DELETE.getId(), (Action)outlineActions.get(ACTION_DELETE)); }
private IAction createGenerateAction() { final IAction action = new Action() { /** * @see org.eclipse.jface.action.Action#run() */ @Override public void run() { final GenerateModelAction generateModelAction = new GenerateModelAction(); final ISelection selection = new StructuredSelection( getEditor().getEditorInput().getAdapter(IFile.class)); generateModelAction.selectionChanged(this, selection); generateModelAction.run(this); } }; action.setImageDescriptor(SGenEditorUIImages.GENERATOR_MODEL.descriptor()); action.setToolTipText(Messages.SGenMultiPageEditor_generateActionTooltip); return action; }
private IAction createQuickFixAction(final ICompletionProposal proposal) { return new Action(proposal.getDisplayString()) { @Override public void run() { proposal.apply(sourceViewer.getDocument()); } @Override public ImageDescriptor getImageDescriptor() { Image image = proposal.getImage(); if (image != null) return ImageDescriptor.createFromImage(image); return null; } }; }
private ActionHandler createContentAssistActionHandler( final ITextOperationTarget textOperationTarget) { Action proposalAction = new Action() { @Override public void run() { if (textOperationTarget .canDoOperation(ISourceViewer.CONTENTASSIST_PROPOSALS) && getTextWidget().isFocusControl()) textOperationTarget .doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS); } }; proposalAction .setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS); return new ActionHandler(proposalAction); }
/** * Maps the localized modifier name to a code in the same manner as * {@link org.eclipse.jface.action.Action#findModifier * Action.findModifier()}. * * @param modifierName * the modifier name * @return the SWT modifier bit, or {@code 0} if no match was found */ private static final int findLocalizedModifier(String modifierName) { if (modifierName == null) { return 0; } if (modifierName .equalsIgnoreCase(Action.findModifierString(SWT.CTRL))) { return SWT.CTRL; } if (modifierName .equalsIgnoreCase(Action.findModifierString(SWT.SHIFT))) { return SWT.SHIFT; } if (modifierName.equalsIgnoreCase(Action.findModifierString(SWT.ALT))) { return SWT.ALT; } if (modifierName .equalsIgnoreCase(Action.findModifierString(SWT.COMMAND))) { return SWT.COMMAND; } return 0; }
/** * Initialize the toolbar. */ private void initializeToolBar() { IToolBarManager toolbarManager = getViewSite().getActionBars() .getToolBarManager(); Action refresh = new RefreshAction(this); toolbarManager.add(refresh); /*TODO: add mark menu to tool-bar ClearMarkAction clearAction = new ClearMarkAction("Clear all marks"); markMenu.addActionToMenu(clearAction); ImageDescriptor image = IconUtils.getImageDescriptor(IconUtils.IMG_MARK); Action marksAction = new Action("", image) { }; marksAction.setMenuCreator(markMenu); marksAction.setToolTipText("Mark class"); toolbarManager.add(marksAction); */ }
private void createQuickMenus(){ IToolBarManager man = getViewSite().getActionBars().getToolBarManager(); man.add(new Action("Expand All", ImageUtil.getImageDescriptor(Images.expand)) { public void run() { viewer.expandAll(); } }); man.add(new Action("Collapse All", ImageUtil.getImageDescriptor(Images.collapse)) { public void run() { viewer.collapseAll(); } }); man.add(new Separator()); man.add(new Action("Reload", ImageUtil.getImageDescriptor(Images.refresh)) { public void run() { forceRefresh(); } }); }
private void addExtensionDebugLauncherMenu(IMenuManager menu, final String label, final IDebugLaunch debugLaunch, final String url) { if (debugLaunch == null) { CorePluginLog.logError("Could not add debug launch."); return; } // EXTENSION menus String menuName = "Open with " + label; menu.add(new Action("&" + menuName) { @Override public void run() { debugLaunch.launch(project, url, "debug"); defaultProvider.setDefaultBrowserName(BROWSER_NAME_EXTENSION + label); } }); }
private void createActions() { /* * Action: Restore default */ _actionRestoreDefaults = new Action() { @Override public void run() { resetToDefaults(); } }; _actionRestoreDefaults.setToolTipText(Messages.App_Action_RestoreDefault_Tooltip); _actionRestoreDefaults.setImageDescriptor(// TourbookPlugin.getImageDescriptor(Messages.Image__App_RestoreDefault)); _actionEditHrZones = new ActionEditHrZones(_trainingView); }
/** * fillContextMenu * * @param manager */ private void fillContextMenu(IMenuManager manager) { ISelection selection = treeViewer.getSelection(); if (selection instanceof TreeSelection) { TreeSelection treeSelection = (TreeSelection) selection; Object item = treeSelection.getFirstElement(); if (item instanceof BaseNode) { BaseNode<?> node = (BaseNode<?>) item; Action[] actions = node.getActions(); if (actions != null) { for (Action action : actions) { manager.add(action); } } } } }
@Override protected List<VizActionTree> getPlotActions() { // In addition to the default actions... List<VizActionTree> actions = super.getPlotActions(); // Add an action to clear all plotted series. actions.add(new VizActionTree(new Action("Remove all series") { @Override public void run() { // Disable all plotted series, then refresh if the plot changed. Set<ISeries> plottedSeries = getPlottedSeries(); if (!plottedSeries.isEmpty()) { for (ISeries series : getPlottedSeries()) { series.setEnabled(false); } refresh(); } return; } })); return actions; }
private void createActions() { _actionTTSpeed_Add = new ActionSpeedTourType_Add(); _actionTTSpeed_Sort = new ActionSpeedTourType_Sort(); _actionOpenTourTypePrefs = new ActionOpenPrefDialog( Messages.action_tourType_modify_tourTypes, ITourbookPreferences.PREF_PAGE_TOUR_TYPE); /* * Action: Restore default */ _actionRestoreDefaults = new Action() { @Override public void run() { resetDashboardToDefaults(); } }; _actionRestoreDefaults.setImageDescriptor(// TourbookPlugin.getImageDescriptor(Messages.Image__App_RestoreDefault)); _actionRestoreDefaults.setToolTipText(Messages.App_Action_RestoreDefault_Tooltip); }
private void createActions() { /* * Action: Restore default */ _actionRestoreDefaults = new Action() { @Override public void run() { resetToDefaults(); } }; _actionRestoreDefaults.setImageDescriptor(// TourbookPlugin.getImageDescriptor(Messages.Image__App_RestoreDefault)); _actionRestoreDefaults.setToolTipText(Messages.App_Action_RestoreDefault_Tooltip); }
private void createActions() { /* * Action: Restore default */ _actionRestoreDefaults = new Action() { @Override public void run() { resetToDefaults(); } }; _actionRestoreDefaults.setImageDescriptor(// TourbookPlugin.getImageDescriptor(Messages.Image__App_RestoreDefault)); _actionRestoreDefaults.setToolTipText(Messages.App_Action_RestoreDefault_Tooltip); _actionPrefDialog = new ActionOpenPrefDialog( Messages.Tour_Action_EditSmoothingPreferences, PrefPageComputedValues.ID); _actionPrefDialog.closeThisTooltip(this); _actionPrefDialog.setShell(_tourChart.getShell()); // select smoothing folder when opened _actionPrefDialog.setPrefData(PrefPageComputedValues.TAB_FOLDER_SMOOTHING); }
private void createActions() { /* * Action: Restore default */ _actionRestoreDefaults = new Action() { @Override public void run() { resetToDefaults(); } }; _actionRestoreDefaults.setToolTipText(Messages.App_Action_RestoreDefault_Tooltip); _actionRestoreDefaults.setImageDescriptor(// TourbookPlugin.getImageDescriptor(Messages.Image__App_RestoreDefault)); }
private void initialToolBar() { IToolBarManager man = getViewSite().getActionBars().getToolBarManager(); m_saveAction = new SaveXMLEditorAction(this, "Save", ImageUtil.getImageDescriptor(Images.save)); man.add(m_saveAction); if(XMLReader.DEFAULT_XMLCONFIG.equals(m_fileName)){ ResourceUtils.setVisiable(this, m_saveAction.getId(), false); } man.add(new Action("SaveAs", ImageUtil.getImageDescriptor(Images.saveas)) { public void run() { saveAsConfigurations(); } }); }
private void createActions() { /* * Action: Restore default */ _actionRestoreDefaults = new Action() { @Override public void run() { resetToDefaults(); } }; _actionRestoreDefaults.setImageDescriptor(// TourbookPlugin.getImageDescriptor(Messages.Image__App_RestoreDefault)); _actionRestoreDefaults.setToolTipText(Messages.App_Action_RestoreDefault_Tooltip); _actionPrefDialog = new ActionOpenPrefDialog( Messages.Tour_Action_EditStatisticPreferences, PrefPageStatistic.ID); _actionPrefDialog.closeThisTooltip(this); _actionPrefDialog.setShell(_parentShell); }
public void createPartControl(Composite parent) { this.setPartName("Account List[" + ServerManager.getInstance().getServer(serverId).getName() + "]"); tableColumnLayout = new TableColumnLayout(); parent.setLayout(tableColumnLayout); viewer = new TableViewer(parent, SWT.FULL_SELECTION | SWT.BORDER); createColumns(); final Table table = viewer.getTable(); table.setHeaderVisible(true); table.setLinesVisible(true); viewer.setContentProvider(new ArrayContentProvider()); viewer.setComparator(new ColumnLabelSorter(viewer)); createTableContextMenu(); IToolBarManager man = getViewSite().getActionBars().getToolBarManager(); man.add(new Action("Reload", ImageUtil.getImageDescriptor(Images.refresh)) { public void run() { load(); } }); load(); }
private void fillTreeViewerContextMenu(IMenuManager mgr){ ISelection selection = viewer.getSelection(); if (selection instanceof IStructuredSelection) { IStructuredSelection sel = (IStructuredSelection)selection; Object[] elements = sel.toArray(); if (elements == null || elements.length < 1) { return; } Action action = new DeleteAction(elements); for (Object obj : elements) { try { DirObject dirObj = (DirObject) obj; if (dirObj.name.contains("00000000")) { action.setEnabled(false); break; } } catch (Exception e) { } } mgr.add(action); } }
@Override protected IStatus run(IProgressMonitor monitor) { monitor.beginTask("Saveing Heapdump file to... "+workingDir+"/"+fileName, IProgressMonitor.UNKNOWN); checkAndCreateDir(); boolean result = downloadHeapdump(); monitor.done(); if(!result){ ConsoleProxy.errorSafe("file writing error occured."); return Status.OK_STATUS; } ExUtil.exec(PlatformUI.getWorkbench().getDisplay(), new Runnable(){ public void run() { Action act = new OpenWorkspaceExplorerAction(window, "Workspace Explorer", Images.explorer, true, serverId); act.run(); } }); return Status.OK_STATUS; }
public void createPartControl(Composite parent) { this.setPartName("Login List[" + ServerManager.getInstance().getServer(serverId).getName() + "]"); tableColumnLayout = new TableColumnLayout(); parent.setLayout(tableColumnLayout); viewer = new TableViewer(parent, SWT.FULL_SELECTION | SWT.BORDER); createColumns(); final Table table = viewer.getTable(); table.setHeaderVisible(true); table.setLinesVisible(true); viewer.setContentProvider(new ArrayContentProvider()); viewer.setComparator(new ColumnLabelSorter(viewer)); createTableContextMenu(); IToolBarManager man = getViewSite().getActionBars().getToolBarManager(); man.add(new Action("Reload", ImageUtil.getImageDescriptor(Images.refresh)) { public void run() { load(); } }); load(); }
@Override protected void configureAction(Action action) { action.setText("Hide Local Types"); action.setDescription("Hide Local Types"); action.setToolTipText("Hide Local (not exported) types"); action.setImageDescriptor(imageHelper.getImageDescriptor("localtypes_co.png")); }