當前位置: 首頁>>代碼示例>>Java>>正文


Java ExecutionEvent類代碼示例

本文整理匯總了Java中org.eclipse.core.commands.ExecutionEvent的典型用法代碼示例。如果您正苦於以下問題:Java ExecutionEvent類的具體用法?Java ExecutionEvent怎麽用?Java ExecutionEvent使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ExecutionEvent類屬於org.eclipse.core.commands包,在下文中一共展示了ExecutionEvent類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: execute

import org.eclipse.core.commands.ExecutionEvent; //導入依賴的package包/類
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
  ISelection sel = Activator.getDefault().getWorkbench().getActiveWorkbenchWindow()
      .getSelectionService().getSelection();
  if (sel instanceof ITreeSelection) {
    ITreeSelection treeSel = (ITreeSelection) sel;
    if (treeSel.getFirstElement() instanceof IFile) {
      IFile file = (IFile) treeSel.getFirstElement();
      List<IMarker> markers = MarkerFactory.findMarkers(file);
      MessageDialog dialog = new MessageDialog(MarkerActivator.getShell(), "Marker Count", null,
          markers.size() + " marker(s)", MessageDialog.INFORMATION, new String[] {"OK"}, 0);
      dialog.open();
    }
  }
  return null;
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:17,代碼來源:CountMarkersInFileHandler.java

示例2: execute

import org.eclipse.core.commands.ExecutionEvent; //導入依賴的package包/類
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {

	IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelectionChecked(event);

	IWorkbenchWindow[] windows = N4IDEXpectUIPlugin.getDefault().getWorkbench().getWorkbenchWindows();
	try {
		view = (N4IDEXpectView) windows[0].getActivePage().showView(
				N4IDEXpectView.ID);
	} catch (PartInitException e) {
		N4IDEXpectUIPlugin.logError("cannot refresh test view window", e);
	}

	Description desc = (Description) selection.getFirstElement();
	if (desc.isTest() && view.testsExecutionStatus.hasFailed(desc)) {
		Throwable failureException = view.testsExecutionStatus.getFailure(desc).getException();

		if (failureException instanceof ComparisonFailure) {
			ComparisonFailure cf = (ComparisonFailure) failureException;
			// display comparison view
			displayComparisonView(cf, desc);
		}
	}
	return null;
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:26,代碼來源:XpectCompareCommandHandler.java

示例3: execute

import org.eclipse.core.commands.ExecutionEvent; //導入依賴的package包/類
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
  final IWorkbenchWindow activeWorkbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event);
  final ISourceProviderService service =
      activeWorkbenchWindow.getService(ISourceProviderService.class);
  final AnalysisSourceProvider sourceProvider =
      (AnalysisSourceProvider) service.getSourceProvider(AnalysisSourceProvider.ANALYSIS_STATE);

  final Thread thread = new Thread(new Runnable() {
    @Override
    public void run() {
      if (sourceProvider.getEvaluationState() == EvaluationState.OPEN) {
        Visualization.evaluatorOpen = false;
        sourceProvider.setEvaluationState(EvaluationState.CLOSE);
      } else if (sourceProvider.getEvaluationState() == EvaluationState.CLOSE) {
        Visualization.evaluatorOpen = true;
        sourceProvider.setEvaluationState(EvaluationState.OPEN);
      }
      Visualization.showViz();
    }
  });
  thread.start();
  return true;
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:25,代碼來源:OpenCloseEvaluatorHandler.java

示例4: preExecute

import org.eclipse.core.commands.ExecutionEvent; //導入依賴的package包/類
/**
 * Receives a command that is about to execute.
 * @param commandId the identifier of the command that is about to execute
 * @param event the event that will be passed to the <code>execute</code> method
 */
@Override
public void preExecute(String commandId, ExecutionEvent event) {
    long time = Time.getCurrentTime();
    String path = recorder.getActiveInputFilePath();
    
    ExecutionMacro macro = new ExecutionMacro(time, "Exec", path, commandId);
    recorder.recordExecutionMacro(macro);
    
    try {
        String id = event.getCommand().getCategory().getId();
        if (id.endsWith("category.refactoring")) {
            recorder.setParentMacro(macro);
            
            TriggerMacro trigger = new TriggerMacro(time, "Refactoring", path, TriggerMacro.Kind.BEGIN);
            recorder.recordTriggerMacro(trigger);
        }
    } catch (NotDefinedException e) {
        e.printStackTrace();
    }
}
 
開發者ID:liaoziyang,項目名稱:ContentAssist,代碼行數:26,代碼來源:CommandExecutionManager.java

示例5: execute

import org.eclipse.core.commands.ExecutionEvent; //導入依賴的package包/類
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
  ISelection selection = MarkerFactory.getSelection();
  if (selection instanceof ITreeSelection) {
    ITreeSelection treeSelection = (ITreeSelection) selection;
    if (treeSelection.getFirstElement() instanceof IOpenable
        || treeSelection.getFirstElement() instanceof IFile) {
      IResource resource =
          ((IAdaptable) treeSelection.getFirstElement()).getAdapter(IResource.class);
      List<IMarker> markers = MarkerFactory.findMarkers(resource);
      MessageDialog dialog = new MessageDialog(MarkerActivator.getShell(), "Marker Count", null,
          markers.size() + " marker(s)", MessageDialog.INFORMATION, new String[] {"OK"}, 0);
      dialog.open();
    }
  }
  return null;
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:18,代碼來源:CountMarkersInResourceHandler.java

示例6: executeForSelectedLanguage

import org.eclipse.core.commands.ExecutionEvent; //導入依賴的package包/類
@Override
public Object executeForSelectedLanguage(ExecutionEvent event,
		IProject updatedGemocLanguageProject, Language language)
		throws ExecutionException {
	CreateDomainModelWizardContextAction action = new CreateDomainModelWizardContextAction(
			updatedGemocLanguageProject); 
	action.actionToExecute = CreateDomainModelAction.CREATE_NEW_EMF_PROJECT;
	action.execute();
	
	if(action.getCreatedEcoreUri() != null){
		waitForAutoBuild();
		updateMelange(event,language,action.getCreatedEcoreUri());
	}
	
	return null;
}
 
開發者ID:eclipse,項目名稱:gemoc-studio-modeldebugging,代碼行數:17,代碼來源:CreateDomainModelProjectHandler.java

示例7: execute

import org.eclipse.core.commands.ExecutionEvent; //導入依賴的package包/類
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	OpenDialogFactory.openDialog(new OpenDialogTemplate() {

		@Override
		public String getNature() {
			return "KSP declaration";
		}

		@Override
		public Object[] getElements() {
			/* Charge les KSP du cache du KspManager. */
			return KspManager.getInstance().getWorkspace().getKspDeclarations().toArray();
		}
	});
	return null;
}
 
開發者ID:sebez,項目名稱:vertigo-chroma-kspplugin,代碼行數:18,代碼來源:OpenKspDeclarationHandler.java

示例8: execute

import org.eclipse.core.commands.ExecutionEvent; //導入依賴的package包/類
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	IWorkbench workbench = PlatformUI.getWorkbench();
	if (workbench==null){
		return null;
	}
	IWorkbenchWindow activeWorkbenchWindow = workbench.getActiveWorkbenchWindow();
	if (activeWorkbenchWindow==null){
		return null;
	}
	IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
	if (activePage==null){
		return null;
	}
	IEditorPart editor = activePage.getActiveEditor();
	
	if (editor instanceof BatchEditor){
		executeOnBatchEditor((BatchEditor) editor);
	}
	return null;
}
 
開發者ID:de-jcup,項目名稱:eclipse-batch-editor,代碼行數:22,代碼來源:AbstractBatchEditorHandler.java

示例9: execute

import org.eclipse.core.commands.ExecutionEvent; //導入依賴的package包/類
public Object execute ( final ExecutionEvent event ) throws ExecutionException
{
    final String data = event.getParameter ( "org.eclipse.scada.ae.ui.testing.loadMore.count" );
    final int count;

    if ( data == null )
    {
        count = 1000;
    }
    else
    {
        count = Integer.parseInt ( data );
    }

    for ( final QueryBean query : getQueryList () )
    {
        query.getQuery ().loadMore ( count );
    }
    return null;
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:21,代碼來源:LoadMoreHandler.java

示例10: execute

import org.eclipse.core.commands.ExecutionEvent; //導入依賴的package包/類
@Override
public Object execute ( final ExecutionEvent event ) throws ExecutionException
{
    for ( final Item item : getItems () )
    {
        try
        {
            openItem ( item );
        }
        catch ( final PartInitException e )
        {
            throw new ExecutionException ( "Failed to run", e ); //$NON-NLS-1$
        }
    }
    return null;
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:17,代碼來源:OpenDetailsView.java

示例11: execute

import org.eclipse.core.commands.ExecutionEvent; //導入依賴的package包/類
@Override
public Object execute ( final ExecutionEvent event ) throws ExecutionException
{
    try
    {
        // the following cast might look a bit weird. But first an adapter is requested and it only adapts to "core" connection services.
        final ConnectionService connectionService = (ConnectionService)SelectionHelper.first ( getSelection (), org.eclipse.scada.core.connection.provider.ConnectionService.class );
        final IViewPart view = getActivePage ().showView ( SummaryExplorerViewPart.VIEW_ID, "" + this.counter++, IWorkbenchPage.VIEW_ACTIVATE );

        ( (SummaryExplorerViewPart)view ).setConnectionService ( connectionService );
    }
    catch ( final PartInitException e )
    {
        throw new ExecutionException ( "Failed to open view", e );
    }
    return null;
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:18,代碼來源:OpenExplorerHandler.java

示例12: execute

import org.eclipse.core.commands.ExecutionEvent; //導入依賴的package包/類
@Override
public Object execute ( final ExecutionEvent event ) throws ExecutionException
{
    final MultiStatus ms = new MultiStatus ( HivesPlugin.PLUGIN_ID, 0, getLabel (), null );

    for ( final ServerLifecycle server : SelectionHelper.iterable ( getSelection (), ServerLifecycle.class ) )
    {
        try
        {
            process ( server );
        }
        catch ( final CoreException e )
        {
            ms.add ( e.getStatus () );
        }
    }
    if ( !ms.isOK () )
    {
        StatusManager.getManager ().handle ( ms, StatusManager.SHOW );
    }
    return null;
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:23,代碼來源:AbstractServerHandler.java

示例13: execute

import org.eclipse.core.commands.ExecutionEvent; //導入依賴的package包/類
@Override
public Object execute ( final ExecutionEvent event ) throws ExecutionException
{

    final IEditorPart editor = getActivePage ().getActiveEditor ();

    byte b = (byte)1;
    for ( final Attribute attribute : SelectionHelper.iterable ( getSelection (), Attribute.class ) )
    {
        EditingDomain domain = AdapterFactoryEditingDomain.getEditingDomainFor ( attribute );

        if ( domain == null && editor instanceof IEditingDomainProvider )
        {
            domain = ( (IEditingDomainProvider)editor ).getEditingDomain ();
        }

        SetCommand.create ( domain, attribute, ProtocolPackage.Literals.ATTRIBUTE__FIELD_NUMBER, b ).execute ();

        b++;
    }

    return null;
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:24,代碼來源:FillFieldNumbersHandler.java

示例14: execute

import org.eclipse.core.commands.ExecutionEvent; //導入依賴的package包/類
@Override
public Object execute ( final ExecutionEvent event ) throws ExecutionException
{
    final MasterSelectionDialog dlg;
    try
    {
        dlg = selectMaster ();
    }
    catch ( final CoreException e )
    {
        throw new ExecutionException ( "Failed to select driver", e );
    }

    if ( dlg != null )
    {
        setMaster ( dlg.getMaster (), dlg.getMode () );
    }
    return null;
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:20,代碼來源:SetMasterHandler.java

示例15: execute

import org.eclipse.core.commands.ExecutionEvent; //導入依賴的package包/類
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
  AlloyOtherSolutionReasoning.getInstance().finish();

  if (AlloyUtilities.isExists()) {
    candidateToTypeChanging = new ArrayList<IMarker>();
    file = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor()
        .getEditorInput().getAdapter(IFile.class);
    selection =
        PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
    editor =
        PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
    marker = getMarkerFromEditor();

    deleteMarker();
    refresh();
  } else {
    final MessageDialog infoDialog = new MessageDialog(MarkerActivator.getShell(),
        "System Information", null, "You dont have any registered alloy file to system.",
        MessageDialog.INFORMATION, new String[] {"OK"}, 0);
    infoDialog.open();
  }
  return null;
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:25,代碼來源:DeleteHandler.java


注:本文中的org.eclipse.core.commands.ExecutionEvent類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。