下面列出了org.eclipse.ui.actions.WorkspaceModifyOperation#org.eclipse.core.commands.ExecutionException 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public Object execute(ExecutionEvent event) throws ExecutionException {
IEditorPart editor = HandlerUtil.getActiveEditor(event);
if (editor instanceof XLIFFEditorImplWithNatTable) {
XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor;
XLFHandler handler = xliffEditor.getXLFHandler();
List<String> selectedRowIds = xliffEditor.getSelectedRowIds();
boolean isNeedReview = true;
//先判断所有的选择文本段的是否锁定状态
for(String rowId : selectedRowIds){
if (!handler.isNeedReview(rowId)) {
isNeedReview = false;
break;
}
}
NattableUtil util = NattableUtil.getInstance(xliffEditor);
util.changIsQuestionState(selectedRowIds, isNeedReview ? "no" : "yes");
}
return null;
}
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info)
throws ExecutionException {
View view =
ViewService.getInstance().createView(
viewDescriptor.getViewKind(),
viewDescriptor.getElementAdapter(),
containerView,
viewDescriptor.getSemanticHint(),
index,
viewDescriptor.isPersisted(),
viewDescriptor.getPreferencesHint());
Assert.isNotNull(view, "failed to create a view"); //$NON-NLS-1$
viewDescriptor.setView(view);
return CommandResult.newOKCommandResult(viewDescriptor);
}
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
ISelection selection = HandlerUtil.getCurrentSelectionChecked(event);
if (selection == null || !(selection instanceof IStructuredSelection)) {
return null;
}
IStructuredSelection currentSelection = (IStructuredSelection) selection;
if (currentSelection.size() == 1) {
Term termToSplit = (Term) currentSelection.getFirstElement();
if (selectionValid(termToSplit)) {
SplitTermDialog dialog = new SplitTermDialog(null, termToSplit.getName());
if (dialog.open() == MessageDialog.OK && dialog.getReturnCode() == MessageDialog.OK) {
TermSplitter.split(termToSplit, dialog.getDefaultTermName(), dialog.getFurtherTermNames());
}
} else {
ErrorDialog.openError(null, "Error", null, new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Invalid selection. The selected term must not have children.", null));
}
}
return null;
}
@Override
public final Object execute ( final ExecutionEvent event ) throws ExecutionException
{
final IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked ( event );
final Object value = event.getParameter ( PARAMETER_NAME_VIEW_ID );
try
{
final String[] viewIds = ( (String)value ).split ( ":" );
if ( viewIds.length == 1 )
{
openView ( viewIds[0], null, window );
}
else if ( viewIds.length == 2 )
{
openView ( viewIds[0], viewIds[1], window );
}
}
catch ( final PartInitException e )
{
throw new ExecutionException ( "Part could not be initialized", e ); //$NON-NLS-1$
}
return null;
}
public Object execute(ExecutionEvent event) throws ExecutionException {
IEditorPart editor = HandlerUtil.getActiveEditor(event);
if (editor instanceof XLIFFEditorImplWithNatTable) {
XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor;
List<String> selectedRowIds = xliffEditor.getSelectedRowIds();
if (selectedRowIds != null && selectedRowIds.size() > 0) {
boolean isSendtoTm = true;
XLFHandler handler = xliffEditor.getXLFHandler();
for (String rowId : selectedRowIds) {
if (!handler.isSendToTM(rowId) && isSendtoTm) {
isSendtoTm = false;
break;
}
}
NattableUtil util = NattableUtil.getInstance(xliffEditor);
util.changeSendToTmState(selectedRowIds, isSendtoTm ? "yes" : "no");
}
}
return null;
}
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
// Get selection already validated by handler in plugin.xml
ISelection selection = HandlerUtil.getCurrentSelectionChecked(event);
if (!(selection instanceof IStructuredSelection)) {
return null;
}
TmfTraceElement trace = (TmfTraceElement) ((IStructuredSelection) selection).getFirstElement();
// Fire the Copy Trace dialog
Shell shell = HandlerUtil.getActiveShellChecked(event);
CopyTraceDialog dialog = new CopyTraceDialog(shell, trace);
dialog.open();
return null;
}
public Object execute(ExecutionEvent event) throws ExecutionException {
IEditorPart editor = HandlerUtil.getActiveEditor(event);
if (!(editor instanceof XLIFFEditorImplWithNatTable)) {
return null;
}
XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor;
int[] selectedRows = xliffEditor.getSelectedRows();
if (selectedRows.length < 1) {
return null;
}
Arrays.sort(selectedRows);
int lastSelectedRow = selectedRows[selectedRows.length - 1];
XLFHandler handler = xliffEditor.getXLFHandler();
int row = handler.getNextUntranslatedSegmentIndex(lastSelectedRow);
if (row != -1) {
xliffEditor.jumpToRow(row);
} else {
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
MessageDialog.openWarning(window.getShell(), "", "不存在下一未翻译文本段。");
}
return null;
}
/**
* @param menu
*/
private void createValidate(final Menu menu) {
final MenuItem validate = new MenuItem(menu, SWT.PUSH);
validate.setText(" Validate");
validate.setImage(GamaIcons.create("build.project2").image());
validate.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
try {
WorkbenchHelper.runCommand("msi.gama.lang.gaml.Gaml.validate");
} catch (final ExecutionException e1) {
e1.printStackTrace();
}
}
});
}
@Test
public void testListContext211() throws ExecutionException {
((LTTngControlService)fService).setVersion("2.11.0");
fShell.setScenario(SCEN_LIST_CONTEXT_211);
List<String> availContexts = fService.getContextList(new NullProgressMonitor());
assertNotNull(availContexts);
assertEquals(12, availContexts.size());
Set<String> expectedContexts = new HashSet<>();
expectedContexts.add("pid");
expectedContexts.add("procname");
expectedContexts.add("prio");
expectedContexts.add("nice");
expectedContexts.add("vpid");
expectedContexts.add("tid");
expectedContexts.add("pthread_id");
expectedContexts.add("vtid");
expectedContexts.add("ppid");
expectedContexts.add("vppid");
expectedContexts.add("perf:cpu:cpu-cycles");
expectedContexts.add("perf:cpu:cycles");
assertTrue(expectedContexts.containsAll(availContexts));
}
public Object execute(ExecutionEvent event) throws ExecutionException {
IEditorPart editor = HandlerUtil.getActiveEditor(event);
if (!(editor instanceof XLIFFEditorImplWithNatTable)) {
return null;
}
XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor;
int[] selectedRows = xliffEditor.getSelectedRows();
if (selectedRows.length < 1) {
return null;
}
Arrays.sort(selectedRows);
int firstSelectedRow = selectedRows[0];
XLFHandler handler = xliffEditor.getXLFHandler();
int row = handler.getPreviousNoteSegmentIndex(firstSelectedRow);
if (row != -1) {
xliffEditor.jumpToRow(row);
} else {
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
MessageDialog.openWarning(window.getShell(), "", "不存在上一个带批注的文本段。");
}
return null;
}
/**
* Refreshes the session information based on given session (in CommandParameter)
* @param param - command parameter containing the session to refresh
*/
protected void refresh(final @NonNull CommandParameter param) {
Job job = new Job(Messages.TraceControl_RetrieveNodeConfigurationJob) {
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
param.getSession().getConfigurationFromNode(monitor);
} catch (ExecutionException e) {
return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_ListSessionFailure, e);
}
return Status.OK_STATUS;
}
};
job.setUser(true);
job.schedule();
}
@Override
public Object execute(ExecutionEvent event) throws ExecutionException{
try {
// get the parameter
String param = event.getParameter(PARAMETERID);
IVerrechenbar verrechenbar =
(IVerrechenbar) event.getCommand().getParameterType(PARAMETERID)
.getValueConverter().convertToObject(param);
// create and open the dialog with the parameter
Shell parent = HandlerUtil.getActiveWorkbenchWindow(event).getShell();
EigenLeistungDialog dialog = new EigenLeistungDialog(parent, verrechenbar);
dialog.open();
} catch (Exception ex) {
throw new RuntimeException(COMMANDID, ex);
}
return null;
}
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
ISelection selection = HandlerUtil.getActiveWorkbenchWindow(event)
.getActivePage().getSelection();
if(selection instanceof TreeSelection) {
TreeSelection treeSelection = (TreeSelection) selection;
if(treeSelection.getFirstElement() instanceof File) {
File file = (File) treeSelection.getFirstElement();
if(file.getFileExtension().equals("bib")){
WorkspaceBibTexEntry entry = wm.getWorkspaceBibTexEntryByUri(file.getLocationURI());
if(entry != null) {
if(entry.getMendeleyFolder() != null) {
// by setting the MendeleyFolder of a WorkspaceBibTexEntry to null, the connection will be removed
entry.setMendeleyFolder(null);
decoratorManager.update("de.tudresden.slr.model.mendeley.decorators.MendeleyOverlayDecorator");
}
}
}
}
}
return null;
}
/**
* @generated
*/
protected void doConfigure(InclusiveGateway newElement, IProgressMonitor monitor, IAdaptable info)
throws ExecutionException {
IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
configureRequest.addParameters(getRequest().getParameters());
ICommand configureCommand = elementType.getEditCommand(configureRequest);
if (configureCommand != null && configureCommand.canExecute()) {
configureCommand.execute(monitor, info);
}
}
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
Shell shell = HandlerUtil.getActiveShell(event);
TmxValidatorDialog dialog = new TmxValidatorDialog(shell);
dialog.open();
return null;
}
@Override
public IStatus undo(IProgressMonitor monitor, IAdaptable info)
throws ExecutionException {
// TODO (bug #493515): retrieve current bend points from
// bendableContentPart and only
// call bendContent if a change occurred.
bendableContentPart.setContentBendPoints(initialBendPoints);
// TODO: validate bending worked
return Status.OK_STATUS;
}
@Override
public IStatus execute(IProgressMonitor monitor, IAdaptable info)
throws ExecutionException {
if (!model.snapToStrategiesProperty().contains(strategy)) {
model.snapToStrategiesProperty().add(strategy);
}
return Status.OK_STATUS;
}
/**
* @generated
*/
protected void doConfigure(SendTask newElement, IProgressMonitor monitor, IAdaptable info)
throws ExecutionException {
IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
configureRequest.addParameters(getRequest().getParameters());
ICommand configureCommand = elementType.getEditCommand(configureRequest);
if (configureCommand != null && configureCommand.canExecute()) {
configureCommand.execute(monitor, info);
}
}
public Object execute(ExecutionEvent event) throws ExecutionException {
MWindow model = ((WorkbenchWindow) PlatformUI.getWorkbench().getActiveWorkbenchWindow()).getModel();
EModelService modelService = model.getContext().get(EModelService.class);
MToolControl bonitaCoolBar = (MToolControl) modelService.find(
"BonitaCoolbar", model);
if(bonitaCoolBar != null){
CoolbarToolControl coolbarControl = (CoolbarToolControl) bonitaCoolBar.getObject();
coolbarControl.minimizeCoolbar();
}
return null;
}
protected IStatus openConfigureDialog() throws ExecutionException {
ICommandService service = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
Command cmd = service.getCommand("org.bonitasoft.studio.configuration.configure");
Map<String, Object> parameters = new HashMap<String, Object>();
String configuration = ConfigurationPlugin.getDefault().getPreferenceStore().getString(ConfigurationPreferenceConstants.DEFAULT_CONFIGURATION);
parameters.put("configuration", configuration);
parameters.put("process", process);
return (IStatus) new ConfigureHandler().execute(new ExecutionEvent(cmd, parameters, null, null));
}
public Object execute(ExecutionEvent event) throws ExecutionException
{
FindBarDecorator dec = findBarDecorator.get();
if (dec != null)
{
dec.setVisible(false);
}
return null;
}
@Override
public IStatus execute(IProgressMonitor monitor, IAdaptable info)
throws ExecutionException {
if (!viewer.getContents().equals(newContents)) {
viewer.getContents().setAll(newContents);
}
return Status.OK_STATUS;
}
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
WizardDialog wizardDialog = new WizardDialog(null, new TxtUMLToCppWizard());
wizardDialog.open();
return null;
}
/**
* {@inheritDoc}
*/
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
ISelection selection = HandlerUtil.getCurrentSelection(event);
if (selection instanceof IStructuredSelection) {
action.selectionChanged((IStructuredSelection)selection);
}
action.run();
return null;
}
@Override
public Object execute ( final ExecutionEvent event ) throws ExecutionException
{
final String connectionId = event.getParameter ( "org.eclipse.scada.ui.chart.connectionId" ); //$NON-NLS-1$
final String connectionString = event.getParameter ( "org.eclipse.scada.ui.chart.connectionString" ); //$NON-NLS-1$
final String itemId = event.getParameter ( "org.eclipse.scada.ui.chart.itemId" ); //$NON-NLS-1$
final String itemType = event.getParameter ( "org.eclipse.scada.ui.chart.itemType" ); //$NON-NLS-1$
if ( connectionId == null && connectionString == null )
{
throw new ExecutionException ( "No connection ID or string set" );
}
if ( itemType == null )
{
throw new ExecutionException ( "Item type is not set" );
}
final Chart configuration = makeConfiguration ( event );
if ( "da".equals ( itemType ) ) //$NON-NLS-1$
{
openDaChartView ( Arrays.asList ( new Item ( connectionId != null ? connectionId : connectionString, itemId, connectionId != null ? Type.ID : Type.URI ) ), configuration );
}
else if ( "hd".equals ( itemType ) ) //$NON-NLS-1$
{
openHdChartView ( Arrays.asList ( new org.eclipse.scada.hd.ui.connection.data.Item ( connectionId != null ? connectionId : connectionString, itemId, connectionId != null ? org.eclipse.scada.hd.ui.connection.data.Item.Type.ID : org.eclipse.scada.hd.ui.connection.data.Item.Type.URI ) ), configuration );
}
else
{
throw new ExecutionException ( String.format ( "The item type '%s' is unsupported", itemType ) );
}
return null;
}
/**
* the command has been executed, so extract extract the needed information from the application context.
*/
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchPage workbenchPage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IEditorPart editor = workbenchPage.getActiveEditor();
if (editor == null) {
return null;
}
if (editor instanceof IHSEditor) {
IHSEditor xliffEditor = (IHSEditor) editor;
xliffEditor.changeModel();
}
return null;
}
public Object execute(ExecutionEvent event) throws ExecutionException {
VerticalArrangeAction action = new VerticalArrangeAction(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), true) ;
action.init();
action.refresh();
action.run();
action.dispose();
return null;
}
@Override
public void addContexts(CommandParameter param, List<String> contextNames, IProgressMonitor monitor) throws ExecutionException {
if (param instanceof DomainCommandParameter) {
TraceDomainComponent domain = ((DomainCommandParameter)param).getDomain();
domain.addContexts(contextNames, monitor);
}
}
@Override
public Object execute(ExecutionEvent arg0) throws ExecutionException {
Job updateJob = new UpdateCheckerJob(updateManager);
updateJob.schedule();
updateJob.addJobChangeListener(new UpdateCheckerJobListener(
updateManager, ActiveTab.UPDATE_FEATURES, false));
try {
PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getActivePage().showView(IProgressConstants.PROGRESS_VIEW_ID);
} catch (PartInitException e) {
log.error(e);
}
return null;
}
/**
* @generated
*/
protected void doConfigure(Task newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
configureRequest.addParameters(getRequest().getParameters());
ICommand configureCommand = elementType.getEditCommand(configureRequest);
if (configureCommand != null && configureCommand.canExecute()) {
configureCommand.execute(monitor, info);
}
}