/** * Stops listening to change notifications sent from an adapter factory. * * @param adapterFactory an adapter factory */ public void stopListeningTo(ComposedAdapterFactory adapterFactory) { if (debug) { DebugTrace.print( this, "stopListeningTo", "adapterFactory=" + adapterFactory); // $NON-NLS-1$ //$NON-NLS-2$ } adapterFactory.removeListener(notifyChangedListener); }
public void unregisterEditingDomain(AdapterFactoryEditingDomain domain) { AdapterFactory adapterFactory = domain.getAdapterFactory(); if (adapterFactory instanceof ComposedAdapterFactory) { ComposedAdapterFactory composedAdapterFactory = (ComposedAdapterFactory) adapterFactory; composedAdapterFactory.removeListener(notifyChangedListener); } domain.getCommandStack().removeCommandStackListener(commandStackListener); }
/** * Registers an editing domain with the managed method library. * * @param domain an editing domain */ public void registerEditingDomain(AdapterFactoryEditingDomain domain) { if (debug) { DebugTrace.print( this, "registerEditingDomain", "domain=" + domain); // $NON-NLS-1$ //$NON-NLS-2$ } // Add a listener to monitor library changes made in the given editing // domain. AdapterFactory adapterFactory = domain.getAdapterFactory(); if (adapterFactory instanceof ComposedAdapterFactory) { ComposedAdapterFactory composedAdapterFactory = (ComposedAdapterFactory) adapterFactory; // remove the listener before adding it to make sure that the same listener is not added more // than one composedAdapterFactory.removeListener(notifyChangedListener); composedAdapterFactory.addListener(notifyChangedListener); } // Add a listener to monitor changes made to the command stack. // This is used to select the most recently affected objects in the // viewer. domain.getCommandStack().removeCommandStackListener(commandStackListener); domain.getCommandStack().addCommandStackListener(commandStackListener); }