本文整理匯總了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);
}
示例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();
}
示例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);
}
}
示例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;
}
}
示例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);
}
}
示例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);
}
示例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);
}
}
}
示例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);
}
示例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();
}
示例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);
}