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


Java ICommandService.addExecutionListener方法代碼示例

本文整理匯總了Java中org.eclipse.ui.commands.ICommandService.addExecutionListener方法的典型用法代碼示例。如果您正苦於以下問題:Java ICommandService.addExecutionListener方法的具體用法?Java ICommandService.addExecutionListener怎麽用?Java ICommandService.addExecutionListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.ui.commands.ICommandService的用法示例。


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

示例1: setup

import org.eclipse.ui.commands.ICommandService; //導入方法依賴的package包/類
/**
 * setup
 */
private void setup()
{
	try
	{
		// listen for execution events
		Object service = PlatformUI.getWorkbench().getService(ICommandService.class);

		if (service instanceof ICommandService)
		{
			ICommandService commandService = (ICommandService) service;

			commandService.addExecutionListener(this);
		}
	}
	catch (IllegalStateException e)
	{
		// workbench not yet started, or may be running headless (like in core unit tests)
	}
	// listen for element visibility events
	BundleManager manager = BundleManager.getInstance();

	manager.addElementVisibilityListener(this);
}
 
開發者ID:apicloudcom,項目名稱:APICloud-Studio,代碼行數:27,代碼來源:ExecutionListenerRegistrant.java

示例2: preStartup

import org.eclipse.ui.commands.ICommandService; //導入方法依賴的package包/類
@Override
public void preStartup() {
	// log system startup and record feature names/versions
	if (logUsage) {
		EnsembleUsageLogger.logUsage("RcpPlugin.start()");
	}
	LogUtil.warn("Starting a new " + Platform.getProduct().getName() + " session");
	
	PlatformUI.getPreferenceStore().setDefault(IWorkbenchPreferenceConstants.SHOW_PROGRESS_ON_STARTUP, true);
	IDE.registerAdapters();
	
	// Set up exception listeners so that they can be properly logged
	// rather than falling off the stack silently
	Thread.setDefaultUncaughtExceptionHandler(EnsembleUnhandledExceptionHandler.getInstance());
	Platform.addLogListener(EnsembleUnhandledExceptionHandler.getInstance());
	if (shouldLogCommandExecutions()) {
		ICommandService service = (ICommandService)PlatformUI.getWorkbench().getService(ICommandService.class);
		service.addExecutionListener(new CommandExecutionMonitor());
	}
	super.preStartup();
}
 
開發者ID:nasa,項目名稱:OpenSPIFe,代碼行數:22,代碼來源:EnsembleWorkbenchAdvisor.java

示例3: start

import org.eclipse.ui.commands.ICommandService; //導入方法依賴的package包/類
@Override
public void start(final BundleContext context) throws Exception {
	super.start(context);
	plugin = this;

	// need to do this later if all debug options are initialized properly
	Job job = new Job("Registering trace listener") { //$NON-NLS-1$
		@Override
		protected IStatus run(IProgressMonitor monitor) {
			Dictionary<String, String> props = new Hashtable<String, String>(1, 1);
			props.put(DebugOptions.LISTENER_SYMBOLICNAME, PLUGIN_ID);
			context.registerService(DebugOptionsListener.class.getName(), Activator.this, props);
			return Status.OK_STATUS;
		}
	};
	job.setSystem(true);
	job.schedule();

	getPreferenceStore().addPropertyChangeListener(plugin);

	if (isEnabled()) {
		ICommandService cmdService = (ICommandService) getWorkbench().getService(ICommandService.class);
		cmdService.addExecutionListener(plugin);
	}
}
 
開發者ID:chgeo,項目名稱:show-shortcuts,代碼行數:26,代碼來源:Activator.java

示例4: startKbdMacro

import org.eclipse.ui.commands.ICommandService; //導入方法依賴的package包/類
/**
 * Start the definition of a keyboard macro
 * 
 * @param editor
 * @param append - if true, append to the current definition
 */
public void startKbdMacro(ITextEditor editor, boolean append) {
	
	if (!isExecuting()) {
		setEditor(editor);
		isdefining = true;
		ics = (ICommandService) editor.getSite().getService(ICommandService.class);
		// listen for command executions
		ics.addExecutionListener(this);
		addDocumentListener(editor);
		if (!append || kbdMacro == null) {
			kbdMacro = new KbdMacro();
		}
		setViewer(findSourceViewer(editor));
		if (viewer instanceof ITextViewerExtension) {
			((ITextViewerExtension) viewer).prependVerifyKeyListener(whileDefining);
		} else {
			viewer = null;
		}
		// add a listener for ^G
		Beeper.addBeepListener(KbdMacroBeeper.beeper);
		currentCommand = null;
	}
}
 
開發者ID:MulgaSoft,項目名稱:e4macs,代碼行數:30,代碼來源:KbdMacroSupport.java

示例5: register

import org.eclipse.ui.commands.ICommandService; //導入方法依賴的package包/類
/**
 * Registers a command manager with the command service of the workbench.
 * @param cm the command manager
 */
public static void register(CommandExecutionManager cm) {
    ICommandService cs = (ICommandService)PlatformUI.getWorkbench().getService(ICommandService.class);
    if (cs != null) {
        cs.addExecutionListener(cm);
    }
}
 
開發者ID:liaoziyang,項目名稱:ContentAssist,代碼行數:11,代碼來源:CommandExecutionManager.java

示例6: addListeners

import org.eclipse.ui.commands.ICommandService; //導入方法依賴的package包/類
private void addListeners() {
	fWidgetEventSource= fViewer.getTextWidget();
	if (fWidgetEventSource != null) {
		fWidgetEventSource.addVerifyKeyListener(fEventListener);
		fWidgetEventSource.addMouseListener(fEventListener);
		fWidgetEventSource.addFocusListener(fEventListener);
	}

	ICommandService commandService= (ICommandService)PlatformUI.getWorkbench().getAdapter(ICommandService.class);
	if (commandService != null)
		commandService.addExecutionListener(fEventListener);
}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:13,代碼來源:CompoundEditExitStrategy.java

示例7: propertyChange

import org.eclipse.ui.commands.ICommandService; //導入方法依賴的package包/類
@Override
public void propertyChange(PropertyChangeEvent event) {
	String property = event.getProperty();
	if (ShortcutPreferenceInitializer.PREF_KEY_SHORTCUTS_ENABLED.equals(property)
			|| ShortcutPreferenceInitializer.PREF_KEY_MOUSE_TRIGGER_ENABLED.equals(property)) {
		ICommandService cmdService = (ICommandService) getWorkbench().getService(ICommandService.class);
		if (isEnabled()) {
			cmdService.addExecutionListener(plugin);
		} else {
			cmdService.removeExecutionListener(plugin);
		}
	}
}
 
開發者ID:chgeo,項目名稱:show-shortcuts,代碼行數:14,代碼來源:Activator.java

示例8: addOtherListeners

import org.eclipse.ui.commands.ICommandService; //導入方法依賴的package包/類
/**
 * @see com.mulgasoft.emacsplus.minibuffer.CompletionMinibuffer#addOtherListeners(IWorkbenchPage, ISourceViewer, StyledText)
 */
@Override
protected void addOtherListeners(IWorkbenchPage page, ISourceViewer viewer, StyledText widget) {
	ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getAdapter(ICommandService.class);
	if (commandService != null) {
		commandService.addExecutionListener(this);
	}
	super.addOtherListeners(page, viewer, widget);
}
 
開發者ID:MulgaSoft,項目名稱:e4macs,代碼行數:12,代碼來源:MetaXMinibuffer.java

示例9: performStartup

import org.eclipse.ui.commands.ICommandService; //導入方法依賴的package包/類
private void performStartup(IProgressMonitor monitor) {
	monitor.beginTask("Starting Recorder", 2);

	if (!isDevelopementCOPE() && Platform.inDevelopmentMode())
		return;
	
	doInstall();

	if (COPEPlugin.getDefault().getRecorder().isFirstStart())
		initializeWorkspace();
	
	monitor.worked(1);

	LogoManager logoManager = LogoManager.getInstance();
	logoManager.showLogo();
	registerDocumentListenersForOpenEditors();
	FileBuffers.getTextFileBufferManager().addFileBufferListener(new FileBufferListener());
	IWorkspace workspace = ResourcesPlugin.getWorkspace();
	workspace.addResourceChangeListener(new ResourceListener(), IResourceChangeEvent.PRE_REFRESH | IResourceChangeEvent.POST_CHANGE);
	ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getService(ICommandService.class);
	commandService.addExecutionListener(new CommandExecutionListener());
	JavaCore.addElementChangedListener(new JavaElementChangedListener(), ElementChangedEvent.POST_CHANGE);

	RefactoringHistoryService refactoringHistoryService = RefactoringHistoryService.getInstance();
	refactoringHistoryService.addExecutionListener(new RefactoringExecutionListener());

	DebugPlugin.getDefault().getLaunchManager().addLaunchListener(new LaunchListener());

	GitRepoListener gitChangeListener = new GitRepoListener(ResourcesPlugin.getWorkspace().getRoot().getProjects());
	Repository.getGlobalListenerList().addRefsChangedListener(gitChangeListener);
	Repository.getGlobalListenerList().addIndexChangedListener(gitChangeListener);

	if (!isDevelopementCOPE())
		initializeFileSender();
	
	logoManager.checkForUpdates();
}
 
開發者ID:ChangeOrientedProgrammingEnvironment,項目名稱:eclipseRecorder,代碼行數:38,代碼來源:StartPluginUIJob.java

示例10: addCommandServiceListener

import org.eclipse.ui.commands.ICommandService; //導入方法依賴的package包/類
@Override
public void addCommandServiceListener(IExecutionListener iel) {
    final ICommandService service = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
    service.addExecutionListener(iel);
}
 
開發者ID:vitruv-tools,項目名稱:Vitruv,代碼行數:6,代碼來源:EclipseAdapterImpl.java


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