java.util.EmptyStackException#org.eclipse.core.commands.ExecutionEvent源码实例Demo

下面列出了java.util.EmptyStackException#org.eclipse.core.commands.ExecutionEvent 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: elexis-3-core   文件: SwitchMedicationHandler.java
@Override
public Object execute(ExecutionEvent event) throws ExecutionException{
	ISelection selection =
		HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getSelection();
	if (selection != null) {
		IStructuredSelection strucSelection = (IStructuredSelection) selection;
		Object firstElement = strucSelection.getFirstElement();
		
		if (firstElement instanceof MedicationTableViewerItem) {
			MedicationTableViewerItem mtvItem = (MedicationTableViewerItem) firstElement;
			IPrescription p = mtvItem.getPrescription();
			if (p != null) {
				originalPresc = p;
				copyShortArticleNameToClipboard();
				openLeistungsView();
			}
		}
	}
	return null;
}
 
源代码2 项目: xds-ide   文件: GotoCompilationUnitHandler.java
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    Shell shell = WorkbenchUtils.getActivePartShell();
    
    HashSet<String> exts = new HashSet<String>(); 
    exts.addAll(XdsFileUtils.COMPILATION_UNIT_FILE_EXTENSIONS);
    
    SelectModulaSourceFileDialog dlg = new SelectModulaSourceFileDialog(Messages.GotoCompilationUnitHandler_OpenModule, shell, ResourceUtils.getWorkspaceRoot(), exts);
    if (SelectModulaSourceFileDialog.OK == dlg.open()){
        IFile file = (IFile)dlg.getResultAsResource();
        if (file != null) {
            IEditorInput editorInput = new FileEditorInput(file);
            try {
            	CoreEditorUtils.openInEditor(editorInput, true);
            } catch (CoreException e) {
                LogHelper.logError(e);
            }
        }
    }
    return null;
}
 
源代码3 项目: xtext-eclipse   文件: OpenDeclarationHandler.java
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	XtextEditor xtextEditor = EditorUtils.getActiveXtextEditor(event);
	if (xtextEditor != null) {
		ITextSelection selection = (ITextSelection) xtextEditor.getSelectionProvider().getSelection();

		IRegion region = new Region(selection.getOffset(), selection.getLength());

		ISourceViewer internalSourceViewer = xtextEditor.getInternalSourceViewer();

		IHyperlink[] hyperlinks = getDetector().detectHyperlinks(internalSourceViewer, region, false);
		if (hyperlinks != null && hyperlinks.length > 0) {
			IHyperlink hyperlink = hyperlinks[0];
			hyperlink.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 firstSelectedRow = selectedRows[0];
	XLFHandler handler = xliffEditor.getXLFHandler();

	int row = handler.getPreviousUnapprovedSegmentIndex(firstSelectedRow);
	if (row != -1) {
		xliffEditor.jumpToRow(row);
	} else {
		IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
		MessageDialog.openWarning(window.getShell(), "", "不存在上一未批准文本段。");
	}

	return null;
}
 
private List<Konsultation> getToBill(ExecutionEvent event){
	String selectionParameter =
		event.getParameter("ch.elexis.core.ui.BillingProposalViewCreateBills.selection");
	if ("selection".equals(selectionParameter)) {
		ISelection selection = HandlerUtil.getCurrentSelection(event);
		if (selection != null && !selection.isEmpty()) {
			@SuppressWarnings("unchecked")
			List<Object> selectionList = ((IStructuredSelection) selection).toList();
			// map to List<Konsultation> depending on type
			if (selectionList.get(0) instanceof Konsultation) {
				return selectionList.stream().map(o -> ((Konsultation) o))
					.collect(Collectors.toList());
			} else if (selectionList.get(0) instanceof BillingProposalView.BillingInformation) {
				return selectionList.stream()
					.map(o -> ((BillingProposalView.BillingInformation) o).getKonsultation())
					.collect(Collectors.toList());
			}
		}
	} else {
		BillingProposalView view = getOpenView(event);
		if (view != null) {
			return view.getToBill();
		}
	}
	return Collections.emptyList();
}
 
源代码6 项目: google-cloud-eclipse   文件: ServiceUtils.java
/**
 * Returns an OSGi service from {@link ExecutionEvent}. It looks up a service in the following
 * locations (if exist) in the given order:
 *
 * {@code HandlerUtil.getActiveSite(event)}
 * {@code HandlerUtil.getActiveEditor(event).getEditorSite()}
 * {@code HandlerUtil.getActiveEditor(event).getSite()}
 * {@code HandlerUtil.getActiveWorkbenchWindow(event)}
 * {@code PlatformUI.getWorkbench()}
 */
public static <T> T getService(ExecutionEvent event, Class<T> api) {
  IWorkbenchSite activeSite = HandlerUtil.getActiveSite(event);
  if (activeSite != null) {
    return activeSite.getService(api);
  }

  IEditorPart activeEditor = HandlerUtil.getActiveEditor(event);
  if (activeEditor != null) {
    IEditorSite editorSite = activeEditor.getEditorSite();
    if (editorSite != null) {
      return editorSite.getService(api);
    }
    IWorkbenchPartSite site = activeEditor.getSite();
    if (site != null) {
      return site.getService(api);
    }
  }

  IWorkbenchWindow workbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event);
  if (workbenchWindow != null) {
    return workbenchWindow.getService(api);
  }

  return PlatformUI.getWorkbench().getService(api);
}
 
public Object execute(ExecutionEvent event) throws ExecutionException {
	String tshelp = System.getProperties().getProperty("TSHelp");
	String tsstate = System.getProperties().getProperty("TSState");
	if (tshelp == null || !"true".equals(tshelp) || tsstate == null || !"true".equals(tsstate)) {
		LoggerFactory.getLogger(AddSelectionSegmentNotesHandler.class).error("Exception:key hs008 is lost.(Can't find the key)");
		System.exit(0);
	}
	IEditorPart editorPart = HandlerUtil.getActiveEditor(event);
	if (editorPart instanceof XLIFFEditorImplWithNatTable) {
		XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editorPart;
		AddOrUpdateNoteDialog dialog = new AddOrUpdateNoteDialog(xliffEditor.getSite().getShell(), xliffEditor,
				AddOrUpdateNoteDialog.DIALOG_ADD, null);
		dialog.open();
	}

	return null;
}
 
源代码8 项目: elexis-3-core   文件: XrefExtension.java
private void startLocalEdit(Brief brief){
	if (brief != null) {
		ICommandService commandService =
			(ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
		Command command =
			commandService.getCommand("ch.elexis.core.ui.command.startEditLocalDocument"); //$NON-NLS-1$
		
		PlatformUI.getWorkbench().getService(IEclipseContext.class)
			.set(command.getId().concat(".selection"), new StructuredSelection(brief));
		try {
			command.executeWithChecks(
				new ExecutionEvent(command, Collections.EMPTY_MAP, this, null));
		} catch (ExecutionException | NotDefinedException | NotEnabledException
				| NotHandledException e) {
			MessageDialog.openError(Display.getDefault().getActiveShell(),
				Messages.BriefAuswahl_errorttile,
				Messages.BriefAuswahl_erroreditmessage);
		}
	}
}
 
源代码9 项目: e4macs   文件: ReverseRegionHandler.java
/**
 * @see com.mulgasoft.emacsplus.commands.EmacsPlusCmdHandler#transform(ITextEditor, IDocument, ITextSelection, ExecutionEvent)
 */
@Override
protected int transform(ITextEditor editor, IDocument document, ITextSelection currentSelection,
		ExecutionEvent event) throws BadLocationException {
   	ITextSelection selection = getLineSelection(editor,document,currentSelection);
   	if (selection != null) {
   		int offset = selection.getOffset();
   		int endOffset = offset+selection.getLength(); 
   		int begin = document.getLineOfOffset(offset);
   		int end = document.getLineOfOffset(endOffset);
		if (begin != end && begin < end) {
			// grab the lines
			int len = end-begin+1; 
			String[] array = new String[len];
			for (int i = 0; i < len; i++) {
				IRegion region = document.getLineInformation(begin+i);
				array[i] = document.get(region.getOffset(),region.getLength());
			}
			// and reverse them
			updateLines(document,new TextSelection(document,offset,endOffset-offset),reverse(array));
		}
	} else {
		EmacsPlusUtils.showMessage(editor, NO_REGION, true);
	}
	return NO_OFFSET;
}
 
源代码10 项目: elexis-3-core   文件: DeleteTemplateCommand.java
@Override
public Object execute(ExecutionEvent event) throws ExecutionException{
	ISelection selection =
		HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getSelection();
	if (selection != null) {
		IStructuredSelection strucSelection = (IStructuredSelection) selection;
		Object firstElement = strucSelection.getFirstElement();
		if (firstElement != null && firstElement instanceof TextTemplate) {
			TextTemplate textTemplate = (TextTemplate) firstElement;
			Brief template = textTemplate.getTemplate();
			textTemplate.removeTemplateReference();
			
			if (template != null) {
				template.delete();
				
				ElexisEventDispatcher.getInstance().fire(new ElexisEvent(Brief.class, null,
					ElexisEvent.EVENT_RELOAD, ElexisEvent.PRIORITY_NORMAL));
			}
		}
	}
	
	return null;
}
 
源代码11 项目: neoscada   文件: StartExporter.java
@Override
public Object execute ( final ExecutionEvent event ) throws ExecutionException
{
    for ( final IFile file : SelectionHelper.iterable ( getSelection (), IFile.class ) )
    {
        try
        {
            HivesPlugin.getDefault ().getServerHost ().startServer ( file );
            getActivePage ().showView ( "org.eclipse.scada.da.server.ui.ServersView" ); //$NON-NLS-1$
        }
        catch ( final Exception e )
        {
            logger.warn ( "Failed to start file: " + file, e ); //$NON-NLS-1$
            StatusManager.getManager ().handle ( StatusHelper.convertStatus ( Activator.PLUGIN_ID, e ), StatusManager.BLOCK );
        }
    }
    return null;
}
 
源代码12 项目: eip-designer   文件: PersistToRouteModelAction.java
@Override
public void run(IAction action) {
   if (serviceLocator == null) {
      serviceLocator = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
   } 
   
   // Create an ExecutionEvent using Eclipse machinery.
   ICommandService srv = (ICommandService) serviceLocator.getService(ICommandService.class);
   IHandlerService hsrv = (IHandlerService) serviceLocator.getService(IHandlerService.class);
   ExecutionEvent event = hsrv.createExecutionEvent(srv.getCommand(ActionCommands.PERSIST_TO_ROUTE_MODEL_ACTION), null);
   // Fill it my current active selection.
   if (event.getApplicationContext() instanceof IEvaluationContext) {
      ((IEvaluationContext) event.getApplicationContext()).addVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME, mySelection);
   }
   
   try {
      handler.execute(event);
   } catch (ExecutionException e) {
      Activator.handleError(e.getMessage(), e, true);
   }
}
 
源代码13 项目: eip-designer   文件: CompareWithRouteAction.java
@Override
public void run(IAction action) {
   System.err.println("In run(IACtion)");
   if (serviceLocator == null) {
      serviceLocator = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
   } 
   
   // Create an ExecutionEvent using Eclipse machinery.
   ICommandService srv = (ICommandService) serviceLocator.getService(ICommandService.class);
   IHandlerService hsrv = (IHandlerService) serviceLocator.getService(IHandlerService.class);
   ExecutionEvent event = hsrv.createExecutionEvent(srv.getCommand(ActionCommands.COMPARE_WITH_ROUTE_ACTION), null);
   // Fill it my current active selection.
   if (event.getApplicationContext() instanceof IEvaluationContext) {
      ((IEvaluationContext) event.getApplicationContext()).addVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME, mySelection);
   }
   
   try {
      handler.execute(event);
   } catch (ExecutionException e) {
      Activator.handleError(e.getMessage(), e, true);
   }
}
 
源代码14 项目: tmxeditor8   文件: ShowNextSegmentHandler.java
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 lastRow = handler.countEditableTransUnit() - 1;
	if (lastSelectedRow == lastRow) {
		lastSelectedRow = lastRow - 1;
	}
	xliffEditor.jumpToRow(lastSelectedRow + 1);
	return null;
}
 
源代码15 项目: APICloud-Studio   文件: FindBarActions.java
public Object execute(ExecutionEvent event) throws ExecutionException
{
	FindBarDecorator dec = findBarDecorator.get();
	if (dec != null)
	{
		IEclipsePreferences preferenceStore = EclipseUtil.instanceScope().getNode(FindBarPlugin.PLUGIN_ID);
		boolean openEclipseFindBar = preferenceStore.getBoolean(
				IPreferencesConstants.CTRL_F_TWICE_OPENS_ECLIPSE_FIND_BAR, false);

		if (openEclipseFindBar)
		{
			dec.showFindReplaceDialog();
		}
		else
		{
			dec.textFind.setFocus();
			dec.textFind.setSelection(new Point(0, dec.textFind.getText().length()));
		}
	}
	return null;
}
 
源代码16 项目: tmxeditor8   文件: NotSendToTMHandler.java
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;
}
 
源代码17 项目: elexis-3-core   文件: ContributionAction.java
public Object executeCommand(){
	try {
		ICommandService commandService =
			(ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
		
		Command cmd = commandService.getCommand(commandId);
		if (selection != null) {
			PlatformUI.getWorkbench().getService(IEclipseContext.class)
				.set(commandId.concat(".selection"), new StructuredSelection(selection));
		}
		ExecutionEvent ee = new ExecutionEvent(cmd, Collections.EMPTY_MAP, null, null);
		return cmd.executeWithChecks(ee);
	} catch (Exception e) {
		LoggerFactory.getLogger(getClass())
			.error("cannot execute command with id: " + commandId, e);
	}
	return null;
}
 
源代码18 项目: tmxeditor8   文件: ShowPreviousFuzzyHandler.java
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.getPreviousFuzzySegmentIndex(firstSelectedRow);
	if (row != -1) {
		xliffEditor.jumpToRow(row);
	} else {
		IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
		MessageDialog.openWarning(window.getShell(), "", "不存在上一模糊匹配文本段。");
	}

	return null;
}
 
源代码19 项目: tlaplus   文件: OpenTLCErrorViewHandler.java
public Object execute(final ExecutionEvent event) throws ExecutionException {
      final Map<String, String> params = new HashMap<String, String>();
      params.put(OpenViewHandler.PARAM_VIEW_NAME, TLCErrorView.ID);
      
      UIHelper.runCommand(OpenViewHandler.COMMAND_ID, params);

      final IEditorPart activeEditor = UIHelper.getActiveEditor();
if (activeEditor != null) {
	if (activeEditor instanceof ModelEditor) {
		final ModelEditor activeModelEditor = (ModelEditor) activeEditor;
		if (activeModelEditor.getModel() != null) {
			UIHelper.runUISync(() -> {
				TLCErrorView.updateErrorView(activeModelEditor);
			});
		}
	}
}

      return null;
  }
 
源代码20 项目: tmxeditor8   文件: OpenFileDbHandler.java
/**
 * (non-Javadoc)
 * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
 */
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	final TmxEditorViewer tmxEditorViewer = TmxEditorViewer.getInstance();
	if (tmxEditorViewer == null) {
		OpenMessageUtils.openMessageWithReason(IStatus.ERROR,
				Messages.getString("handler.OpenTmxFileHandler.openFileErrorMsg"),
				Messages.getString("handler.OpenTmxFileHandler.cantFindEditorViewerMsg"));
		return null;
	}

	FileDialog fileDialg = new FileDialog(Display.getDefault().getActiveShell());
	fileDialg.setFilterExtensions(new String[] { "*.hstm", "*.*" });
	String result = fileDialg.open();
	if (result == null) {
		return null;
	}
	File f = new File(result);
	if (!f.exists()) {
		return null;
	}
	
	// 修改当文件打开后关闭以前打开的文件
	if (tmxEditorViewer.getTmxEditor() != null) {
		if(!tmxEditorViewer.closeTmx()){
			return null;
		}
	}
	
	String path = f.getParent();
	String name = f.getName();
	final DatabaseModelBean selectedVal = new DatabaseModelBean();
	selectedVal.setDbName(name);
	selectedVal.setDbType(Constants.DBTYPE_SQLITE);
	selectedVal.setItlDBLocation(path);
	
	tmxEditorViewer.open(selectedVal);
	
	return null;
}
 
源代码21 项目: elexis-3-core   文件: AdvancedFilterCommand.java
@Override
public Object execute(ExecutionEvent event) throws ExecutionException{
	AdvancedFilterDialog afd =
		new AdvancedFilterDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell());
	int retVal = afd.open();
	//System.out.println(retVal);
	return null;
}
 
源代码22 项目: e4macs   文件: MarkAllHandler.java
/**
 * @see com.mulgasoft.emacsplus.commands.EmacsPlusNoEditHandler#transform(ITextEditor, IDocument, ITextSelection, ExecutionEvent)
 */
@Override
protected int transform(ITextEditor editor, IDocument document, ITextSelection currentSelection, ExecutionEvent event)
throws BadLocationException {
	setMark(editor);								  // first remember our start
	setMark(editor, document.getLength());  		  // then mark the bottom of the buffer
	selectAndReveal(editor, 0, document.getLength()); // and set point at the top
	return NO_OFFSET;
}
 
源代码23 项目: e4macs   文件: SetVariableHandler.java
/**
 * @see com.mulgasoft.emacsplus.commands.EmacsPlusCmdHandler#transform(org.eclipse.ui.texteditor.ITextEditor,
 *      org.eclipse.jface.text.IDocument, org.eclipse.jface.text.ITextSelection,
 *      org.eclipse.core.commands.ExecutionEvent)
 */
@Override
protected int transform(ITextEditor editor, IDocument document, ITextSelection currentSelection,
		ExecutionEvent event) throws BadLocationException {

	mbState = variableSetState();
	mbState.run(editor);
	return NO_OFFSET;
}
 
源代码24 项目: e4macs   文件: NAppendCommentHandler.java
protected int transform(ITextEditor editor, IDocument document, ITextSelection currentSelection, ExecutionEvent event)
		throws BadLocationException {
	int currentLine = currentSelection.getStartLine();
	currentLine = currentLine + 1;
	if (currentLine > document.getNumberOfLines()) {
		throw new BadLocationException();
	}
	IRegion reg = document.getLineInformation(currentLine);
	ITextSelection newSelection = new TextSelection(document, reg
			.getOffset(), 0);
	return super.transform(editor, document, newSelection, event);
}
 
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	ISelection selection = HandlerUtil.getCurrentSelection(event);
	if (selection != null && selection instanceof IStructuredSelection) {
		for (Object obj : ((IStructuredSelection) selection).toList()) {
			if (obj instanceof IAdaptable) {
				IProject project = (IProject) ((IAdaptable) obj).getAdapter(IProject.class);
				if (project != null) {
					try {
						IProjectDescription description = project.getDescription();
						ICommand[] commands = description.getBuildSpec();
						for (int i = 0; i < commands.length; i++) {
							if (TypeScriptBuilder.ID.equals(commands[i].getBuilderName())) {
								// Remove the builder
								ICommand[] newCommands = new ICommand[commands.length - 1];
								System.arraycopy(commands, 0, newCommands, 0, i);
								System.arraycopy(commands, i + 1, newCommands, i, commands.length - i - 1);
								description.setBuildSpec(newCommands);
								project.setDescription(description, null);
							}
						}
					} catch (CoreException e) {
						throw new ExecutionException(e.getMessage(), e);
					}
				}
			}

		}
	}
	return null;
}
 
源代码26 项目: uml2solidity   文件: AddBuilder.java
@Override
public Object execute(final ExecutionEvent event) {
	final IProject project = getProject(event);

	if (project != null) {
		try {
			// verify already registered builders
			if (hasBuilder(project))
				// already enabled
				return null;

			// add builder to project properties
			IProjectDescription description = project.getDescription();
			final ICommand buildCommand = description.newCommand();
			buildCommand.setBuilderName(SolidityBuilder.BUILDER_ID);

			final List<ICommand> commands = new ArrayList<ICommand>();
			commands.addAll(Arrays.asList(description.getBuildSpec()));
			commands.add(buildCommand);

			description.setBuildSpec(commands.toArray(new ICommand[commands.size()]));
			project.setDescription(description, null);

		} catch (final CoreException e) {
			Activator.logError("Error adding solc builder", e);
		}
	}
	return null;
}
 
源代码27 项目: yang-design-studio   文件: hello.java
public Object execute(ExecutionEvent event) throws ExecutionException {
	IWorkbenchWindow window = HandlerUtil
			.getActiveWorkbenchWindowChecked(event);
	MessageDialog.openInformation(window.getShell(),
			"Handler",
			"Hello, Eclipse world");
	return null;
}
 
源代码28 项目: tmxeditor8   文件: TmxValidateHandler.java
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	
	Shell shell = HandlerUtil.getActiveShell(event);
	TmxValidatorDialog dialog = new TmxValidatorDialog(shell);
	dialog.open();
	return null;
}
 
源代码29 项目: e4macs   文件: SwitchToBufferHandler.java
/**
 * @see com.mulgasoft.emacsplus.commands.EmacsPlusCmdHandler#transform(org.eclipse.ui.texteditor.ITextEditor, org.eclipse.jface.text.IDocument, org.eclipse.jface.text.ITextSelection, org.eclipse.core.commands.ExecutionEvent)
 */
@Override
protected int transform(ITextEditor editor, IDocument document, ITextSelection currentSelection,
		ExecutionEvent event) throws BadLocationException {
	ITextEditor ted = EmacsPlusUtils.getTextEditor(editor, true);
	if (ted != null) {
		// don't use a separate async thread, as we may miss a typed character
		return bufferTransform(new SwitchMinibuffer(this), ted, event);
	} else {
		Beeper.beep();
	}
	return NO_OFFSET;
}
 
/**
 * Execute the command.
 */
public Object execute(ExecutionEvent event) {
	// Look for a profile. We may not immediately need it in the
	// handler, but if we don't have one, whatever we are trying to do
	// will ultimately fail in a more subtle/low-level way. So determine
	// up front if the system is configured properly.
	String profileId = getProvisioningUI().getProfileId();
	IProvisioningAgent agent = getProvisioningUI().getSession().getProvisioningAgent();
	IProfile profile = null;
	if (agent != null) {
		IProfileRegistry registry = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME);
		if (registry != null) {
			profile = registry.getProfile(profileId);
		}
	}
	if (profile == null) {
		// Inform the user nicely
		P2UpdateUtil.openConnectErrorInfoDialog(getShell(), P2UpdateUtil.INFO_TYPE_CHECK);
		return null;
	} else {
		BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
			public void run() {
				doExecuteAndLoad();
			}
		});
	}
	return null;
}