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


Java CommandStackListener類代碼示例

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


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

示例1: initializeEditingDomain

import org.eclipse.emf.common.command.CommandStackListener; //導入依賴的package包/類
/**
 * This sets up the editing domain for the model editor. <!-- begin-user-doc
 * --> <!-- end-user-doc -->
 * 
 * @generated
 */
protected void initializeEditingDomain() {
	ModelRegistryPlugin.getModelRegistry().getEditingDomain().ifPresent((domain) -> editingDomain = domain);
	// Add a listener to set the most recent command's affected objects
	// to be the selection of the viewer with focus.
	if (editingDomain == null) {
		System.err.println("[BibtexEntryView#initializeEditingDomain] uninitailised editing domain");
		return;
	}
	adapterFactory = editingDomain.getAdapterFactory();
	editingDomain.getCommandStack().addCommandStackListener(
			new CommandStackListener() {

				@Override
				public void commandStackChanged(final EventObject event) {
					getSite().getShell().getDisplay().asyncExec(() -> {
						firePropertyChange(IEditorPart.PROP_DIRTY);
					});
				}
			});
	closeEditors();
}
 
開發者ID:sebastiangoetz,項目名稱:slr-toolkit,代碼行數:28,代碼來源:BibtexEntryView.java

示例2: postInit

import org.eclipse.emf.common.command.CommandStackListener; //導入依賴的package包/類
@Override
public void postInit() {
	super.postInit();
	
	final IProject project = ExplorerProjectPaths.getProjectFromEmfResource(getDiagram().eResource());
	IContainer altFolder = ExplorerProjectPaths.getFileFromEmfResource(getDiagram().eResource()).getParent();
	
	ResourceProvider rp = ResourceRegistry.getInstance().getResourceProvider(project, CSToolResource.OVERVIEW);
	
	if(rp != null){
		final IEditorInputResource resource = rp.getResource(altFolder);
		
		StatusManager.getInstance().validate(project, resource);
		
		getDiagramBehavior().getEditingDomain().getCommandStack().addCommandStackListener(new CommandStackListener() {
			
			@Override
			public void commandStackChanged(EventObject event) {
				StatusManager.getInstance().validate(project, resource);
			}
		});
	}
}
 
開發者ID:CloudScale-Project,項目名稱:Environment,代碼行數:24,代碼來源:OverviewDiagramTypeProvider.java

示例3: EditorInputEMF

import org.eclipse.emf.common.command.CommandStackListener; //導入依賴的package包/類
public EditorInputEMF(IProject project, IFolder folder, ModelType[] modelTypes, String validationID) {
	super(project, folder, validationID);
	
	this.modelTypes = modelTypes != null ? modelTypes : new ModelType[]{};
	
	editingDomain = createEditingDomain();
	
	commandStack = (WorkspaceCommandStackImpl)editingDomain.getCommandStack();
	commandStack.addCommandStackListener(new CommandStackListener() {
		
		@Override
		public void commandStackChanged(EventObject event) {
			setDirty(commandStack.isSaveNeeded());
			firePropertyChange(PROP_COMMAND_STACK_CHANGED, false, true);
		}
	});
	
	resSet = editingDomain.getResourceSet();
}
 
開發者ID:CloudScale-Project,項目名稱:Environment,代碼行數:20,代碼來源:EditorInputEMF.java

示例4: registerCommandStackListener

import org.eclipse.emf.common.command.CommandStackListener; //導入依賴的package包/類
/**
 * @see nexcore.tool.mdd.core.extension.IDomainModelHandler#registerCommandStackListener(org.eclipse.emf.transaction.TransactionalEditingDomain,
 *      org.eclipse.emf.common.command.CommandStackListener)
 */
public void registerCommandStackListener(TransactionalEditingDomain transactionalEditingDomain,
                                         CommandStackListener commandStackListener) {
    if (transactionalEditingDomain != null && commandStackListener != null) {
        // UML Modeler 트랜잭셔널 에디팅 도메인에 커맨드 스택 리스너 추가
        transactionalEditingDomain.getCommandStack().addCommandStackListener(commandStackListener);

        // 커맨드 스택 리스너가 사용하는 트랜잭셔널 에디팅 도메인도 설정
        if (commandStackListener instanceof UMLDiagramCommandStack) {
            ((UMLDiagramCommandStack) commandStackListener).setTransactionEditingDomain(transactionalEditingDomain);
        }
    }
}
 
開發者ID:SK-HOLDINGS-CC,項目名稱:NEXCORE-UML-Modeler,代碼行數:17,代碼來源:UMLModelerDomainModelHandler.java

示例5: initializeEditingDomain

import org.eclipse.emf.common.command.CommandStackListener; //導入依賴的package包/類
protected void initializeEditingDomain(AdapterFactoryEditingDomain editingDomain) {

		this.editingDomain = editingDomain;
		this.adapterFactory = editingDomain.getAdapterFactory();

		refreshListener = new CommandStackListener() {
			public void commandStackChanged(final EventObject event) {
				getContainer().getDisplay().asyncExec(new Runnable() {
					public void run() {
						firePropertyChange(IEditorPart.PROP_DIRTY);

						// Try to select the affected objects.
						//
						Command mostRecentCommand = ((CommandStack) event.getSource()).getMostRecentCommand();
						if (mostRecentCommand != null) {
							setSelectionToViewer(mostRecentCommand.getAffectedObjects());
						}
						for (Iterator<PropertySheetPage> i = propertySheetPages.iterator(); i.hasNext();) {
							PropertySheetPage propertySheetPage = i.next();
							if (propertySheetPage.getControl().isDisposed()) {
								i.remove();
							} else {
								propertySheetPage.refresh();
							}
						}
					}
				});
			}
		};

		commandStack = editingDomain.getCommandStack();
		commandStack.addCommandStackListener(refreshListener);

	}
 
開發者ID:mondo-project,項目名稱:mondo-demo-wt,代碼行數:35,代碼來源:WTSpec4MEditor.java

示例6: initializeEditingDomain

import org.eclipse.emf.common.command.CommandStackListener; //導入依賴的package包/類
/**
 * This sets up the editing domain for the model editor.
 * <!-- begin-user-doc -->
    * <!-- end-user-doc -->
 * @generated
 */
   protected void initializeEditingDomain() {
	// Create an adapter factory that yields item providers.
	//
	adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);

	adapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory());
	adapterFactory.addAdapterFactory(new SmarthomeItemProviderAdapterFactory());
	adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());

	// Create the command stack that will notify this editor as commands are executed.
	//
	BasicCommandStack commandStack = new BasicCommandStack();

	// Add a listener to set the most recent command's affected objects to be the selection of the viewer with focus.
	//
	commandStack.addCommandStackListener
		(new CommandStackListener() {
			 public void commandStackChanged(final EventObject event) {
				 getContainer().getDisplay().asyncExec
					 (new Runnable() {
						  public void run() {
							  firePropertyChange(IEditorPart.PROP_DIRTY);

							  // Try to select the affected objects.
							  //
							  Command mostRecentCommand = ((CommandStack)event.getSource()).getMostRecentCommand();
							  if (mostRecentCommand != null) {
								  setSelectionToViewer(mostRecentCommand.getAffectedObjects());
							  }
							  for (Iterator<PropertySheetPage> i = propertySheetPages.iterator(); i.hasNext(); ) {
								  PropertySheetPage propertySheetPage = i.next();
								  if (propertySheetPage.getControl().isDisposed()) {
									  i.remove();
								  }
								  else {
									  propertySheetPage.refresh();
								  }
							  }
						  }
					  });
			 }
		 });

	// Create the editing domain with a special command stack.
	//
	editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, new HashMap<Resource, Boolean>());
}
 
開發者ID:IncQueryLabs,項目名稱:smarthome-cep-demonstrator,代碼行數:54,代碼來源:SmarthomeEditor.java

示例7: initializeEditingDomain

import org.eclipse.emf.common.command.CommandStackListener; //導入依賴的package包/類
/**
 * This sets up the editing domain for the model editor.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void initializeEditingDomain() {
	// Create an adapter factory that yields item providers.
	//
	adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);

	adapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory());
	adapterFactory.addAdapterFactory(new MetamodelItemProviderAdapterFactory());
	adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());

	// Create the command stack that will notify this editor as commands are executed.
	//
	BasicCommandStack commandStack = new BasicCommandStack();

	// Add a listener to set the most recent command's affected objects to be the selection of the viewer with focus.
	//
	commandStack.addCommandStackListener
		(new CommandStackListener() {
			 public void commandStackChanged(final EventObject event) {
				 getContainer().getDisplay().asyncExec
					 (new Runnable() {
						  public void run() {
							  firePropertyChange(IEditorPart.PROP_DIRTY);

							  // Try to select the affected objects.
							  //
							  Command mostRecentCommand = ((CommandStack)event.getSource()).getMostRecentCommand();
							  if (mostRecentCommand != null) {
								  setSelectionToViewer(mostRecentCommand.getAffectedObjects());
							  }
							  for (Iterator<PropertySheetPage> i = propertySheetPages.iterator(); i.hasNext(); ) {
								  PropertySheetPage propertySheetPage = i.next();
								  if (propertySheetPage.getControl().isDisposed()) {
									  i.remove();
								  }
								  else {
									  propertySheetPage.refresh();
								  }
							  }
						  }
					  });
			 }
		 });

	// Create the editing domain with a special command stack.
	//
	editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, new HashMap<Resource, Boolean>());
}
 
開發者ID:cetic,項目名稱:SimQRI,代碼行數:54,代碼來源:MetamodelEditor.java

示例8: initializeEditingDomain

import org.eclipse.emf.common.command.CommandStackListener; //導入依賴的package包/類
/**
 * This sets up the editing domain for the model editor.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void initializeEditingDomain() {
	// Create an adapter factory that yields item providers.
	//
	adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);

	adapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory());
	adapterFactory.addAdapterFactory(new TracingannotationsItemProviderAdapterFactory());
	adapterFactory.addAdapterFactory(new EcoreItemProviderAdapterFactory());
	adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());

	// Create the command stack that will notify this editor as commands are executed.
	//
	BasicCommandStack commandStack = new BasicCommandStack();

	// Add a listener to set the most recent command's affected objects to be the selection of the viewer with focus.
	//
	commandStack.addCommandStackListener
		(new CommandStackListener() {
			 public void commandStackChanged(final EventObject event) {
				 getContainer().getDisplay().asyncExec
					 (new Runnable() {
						  public void run() {
							  firePropertyChange(IEditorPart.PROP_DIRTY);

							  // Try to select the affected objects.
							  //
							  Command mostRecentCommand = ((CommandStack)event.getSource()).getMostRecentCommand();
							  if (mostRecentCommand != null) {
								  setSelectionToViewer(mostRecentCommand.getAffectedObjects());
							  }
							  for (Iterator<PropertySheetPage> i = propertySheetPages.iterator(); i.hasNext(); ) {
								  PropertySheetPage propertySheetPage = i.next();
								  if (propertySheetPage.getControl().isDisposed()) {
									  i.remove();
								  }
								  else {
									  propertySheetPage.refresh();
								  }
							  }
						  }
					  });
			 }
		 });

	// Create the editing domain with a special command stack.
	//
	editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, new HashMap<Resource, Boolean>());
}
 
開發者ID:eclipse,項目名稱:gemoc-studio-modeldebugging,代碼行數:55,代碼來源:TracingannotationsEditor.java

示例9: initializeEditingDomain

import org.eclipse.emf.common.command.CommandStackListener; //導入依賴的package包/類
/**
 * This sets up the editing domain for the model editor.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void initializeEditingDomain ()
{
    // Create an adapter factory that yields item providers.
    //
    adapterFactory = new ComposedAdapterFactory ( ComposedAdapterFactory.Descriptor.Registry.INSTANCE );

    adapterFactory.addAdapterFactory ( new ResourceItemProviderAdapterFactory () );
    adapterFactory.addAdapterFactory ( new ProtocolItemProviderAdapterFactory () );
    adapterFactory.addAdapterFactory ( new ReflectiveItemProviderAdapterFactory () );

    // Create the command stack that will notify this editor as commands are executed.
    //
    BasicCommandStack commandStack = new BasicCommandStack ();

    // Add a listener to set the most recent command's affected objects to be the selection of the viewer with focus.
    //
    commandStack.addCommandStackListener
            ( new CommandStackListener ()
            {
                public void commandStackChanged ( final EventObject event )
                {
                    getContainer ().getDisplay ().asyncExec
                            ( new Runnable ()
                            {
                                public void run ()
                                {
                                    firePropertyChange ( IEditorPart.PROP_DIRTY );

                                    // Try to select the affected objects.
                                    //
                                    Command mostRecentCommand = ( (CommandStack)event.getSource () ).getMostRecentCommand ();
                                    if ( mostRecentCommand != null )
                                    {
                                        setSelectionToViewer ( mostRecentCommand.getAffectedObjects () );
                                    }
                                    for ( Iterator<PropertySheetPage> i = propertySheetPages.iterator (); i.hasNext (); )
                                    {
                                        PropertySheetPage propertySheetPage = i.next ();
                                        if ( propertySheetPage.getControl ().isDisposed () )
                                        {
                                            i.remove ();
                                        }
                                        else
                                        {
                                            propertySheetPage.refresh ();
                                        }
                                    }
                                }
                            } );
                }
            } );

    // Create the editing domain with a special command stack.
    //
    editingDomain = new AdapterFactoryEditingDomain ( adapterFactory, commandStack, new HashMap<Resource, Boolean> () );
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:63,代碼來源:ProtocolEditor.java

示例10: initializeEditingDomain

import org.eclipse.emf.common.command.CommandStackListener; //導入依賴的package包/類
/**
 * This sets up the editing domain for the model editor.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * 
 * @generated
 */
protected void initializeEditingDomain ()
{
    // Create an adapter factory that yields item providers.
    //
    this.adapterFactory = new ComposedAdapterFactory (
            ComposedAdapterFactory.Descriptor.Registry.INSTANCE );

    this.adapterFactory
            .addAdapterFactory ( new ResourceItemProviderAdapterFactory () );
    this.adapterFactory.addAdapterFactory ( new ChartItemProviderAdapterFactory () );
    this.adapterFactory
            .addAdapterFactory ( new ReflectiveItemProviderAdapterFactory () );

    // Create the command stack that will notify this editor as commands are executed.
    //
    final BasicCommandStack commandStack = new BasicCommandStack ();

    // Add a listener to set the most recent command's affected objects to be the selection of the viewer with focus.
    //
    commandStack.addCommandStackListener ( new CommandStackListener () {
        @Override
        public void commandStackChanged ( final EventObject event )
        {
            getContainer ().getDisplay ().asyncExec ( new Runnable () {
                @Override
                public void run ()
                {
                    firePropertyChange ( IEditorPart.PROP_DIRTY );

                    // Try to select the affected objects.
                    //
                    final Command mostRecentCommand = ( (CommandStack)event
                            .getSource () ).getMostRecentCommand ();
                    if ( mostRecentCommand != null )
                    {
                        setSelectionToViewer ( mostRecentCommand
                                .getAffectedObjects () );
                    }
                    for ( final Iterator<PropertySheetPage> i = ChartEditor.this.propertySheetPages
                            .iterator (); i.hasNext (); )
                    {
                        final PropertySheetPage propertySheetPage = i.next ();
                        if ( propertySheetPage.getControl ().isDisposed () )
                        {
                            i.remove ();
                        }
                        else
                        {
                            propertySheetPage.refresh ();
                        }
                    }
                }
            } );
        }
    } );

    // Create the editing domain with a special command stack.
    //
    this.editingDomain = new AdapterFactoryEditingDomain ( this.adapterFactory,
            commandStack, new HashMap<Resource, Boolean> () );
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:69,代碼來源:ChartEditor.java

示例11: createEditingDomain

import org.eclipse.emf.common.command.CommandStackListener; //導入依賴的package包/類
private void createEditingDomain ()
{
    final BasicCommandStack commandStack = new BasicCommandStack ();

    this.factory = new ComposedAdapterFactory ( ComposedAdapterFactory.Descriptor.Registry.INSTANCE );

    this.factory.addAdapterFactory ( new ResourceItemProviderAdapterFactory () );
    this.factory.addAdapterFactory ( new ChartItemProviderAdapterFactory () );
    this.factory.addAdapterFactory ( new ReflectiveItemProviderAdapterFactory () );

    // Add a listener to set the most recent command's affected objects to be the selection of the viewer with focus.
    //
    commandStack.addCommandStackListener ( new CommandStackListener () {
        @Override
        public void commandStackChanged ( final EventObject event )
        {
            getContainer ().getDisplay ().asyncExec ( new Runnable () {
                @Override
                public void run ()
                {
                    firePropertyChange ( IEditorPart.PROP_DIRTY );

                    // Try to select the affected objects.
                    //
                    final Command mostRecentCommand = ( (CommandStack)event.getSource () ).getMostRecentCommand ();
                    if ( mostRecentCommand != null )
                    {
                        setSelectionToViewer ( mostRecentCommand.getAffectedObjects () );
                    }
                    if ( ChartConfiguratorView.this.propertySheetPage != null && !ChartConfiguratorView.this.propertySheetPage.getControl ().isDisposed () )
                    {
                        ChartConfiguratorView.this.propertySheetPage.refresh ();
                    }
                }
            } );
        }
    } );

    this.editingDomain = new AdapterFactoryEditingDomain ( this.factory, commandStack, new HashMap<Resource, Boolean> () );

    this.actionBarContributor = new ChartActionBarContributor ();
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:43,代碼來源:ChartConfiguratorView.java

示例12: initializeEditingDomain

import org.eclipse.emf.common.command.CommandStackListener; //導入依賴的package包/類
/**
 * This sets up the editing domain for the model editor.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void initializeEditingDomain ()
{
    // Create an adapter factory that yields item providers.
    //
    adapterFactory = new ComposedAdapterFactory ( ComposedAdapterFactory.Descriptor.Registry.INSTANCE );

    adapterFactory.addAdapterFactory ( new ResourceItemProviderAdapterFactory () );
    adapterFactory.addAdapterFactory ( new DetailViewItemProviderAdapterFactory () );
    adapterFactory.addAdapterFactory ( new ReflectiveItemProviderAdapterFactory () );

    // Create the command stack that will notify this editor as commands are executed.
    //
    BasicCommandStack commandStack = new BasicCommandStack ();

    // Add a listener to set the most recent command's affected objects to be the selection of the viewer with focus.
    //
    commandStack.addCommandStackListener
            ( new CommandStackListener ()
            {
                public void commandStackChanged ( final EventObject event )
                {
                    getContainer ().getDisplay ().asyncExec
                            ( new Runnable ()
                            {
                                public void run ()
                                {
                                    firePropertyChange ( IEditorPart.PROP_DIRTY );

                                    // Try to select the affected objects.
                                    //
                                    Command mostRecentCommand = ( (CommandStack)event.getSource () ).getMostRecentCommand ();
                                    if ( mostRecentCommand != null )
                                    {
                                        setSelectionToViewer ( mostRecentCommand.getAffectedObjects () );
                                    }
                                    for ( Iterator<PropertySheetPage> i = propertySheetPages.iterator (); i.hasNext (); )
                                    {
                                        PropertySheetPage propertySheetPage = i.next ();
                                        if ( propertySheetPage.getControl ().isDisposed () )
                                        {
                                            i.remove ();
                                        }
                                        else
                                        {
                                            propertySheetPage.refresh ();
                                        }
                                    }
                                }
                            } );
                }
            } );

    // Create the editing domain with a special command stack.
    //
    editingDomain = new AdapterFactoryEditingDomain ( adapterFactory, commandStack, new HashMap<Resource, Boolean> () );
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:63,代碼來源:DetailViewEditor.java

示例13: initializeEditingDomain

import org.eclipse.emf.common.command.CommandStackListener; //導入依賴的package包/類
/**
 * This sets up the editing domain for the model editor.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void initializeEditingDomain ()
{
    // Create an adapter factory that yields item providers.
    //
    adapterFactory = new ComposedAdapterFactory ( ComposedAdapterFactory.Descriptor.Registry.INSTANCE );

    adapterFactory.addAdapterFactory ( new ResourceItemProviderAdapterFactory () );
    adapterFactory.addAdapterFactory ( new VisualInterfaceItemProviderAdapterFactory () );
    adapterFactory.addAdapterFactory ( new ReflectiveItemProviderAdapterFactory () );

    // Create the command stack that will notify this editor as commands are executed.
    //
    BasicCommandStack commandStack = new BasicCommandStack ();

    // Add a listener to set the most recent command's affected objects to be the selection of the viewer with focus.
    //
    commandStack.addCommandStackListener
            ( new CommandStackListener ()
            {
                public void commandStackChanged ( final EventObject event )
                {
                    getContainer ().getDisplay ().asyncExec
                            ( new Runnable ()
                            {
                                public void run ()
                                {
                                    firePropertyChange ( IEditorPart.PROP_DIRTY );

                                    // Try to select the affected objects.
                                    //
                                    Command mostRecentCommand = ( (CommandStack)event.getSource () ).getMostRecentCommand ();
                                    if ( mostRecentCommand != null )
                                    {
                                        setSelectionToViewer ( mostRecentCommand.getAffectedObjects () );
                                    }
                                    for ( Iterator<PropertySheetPage> i = propertySheetPages.iterator (); i.hasNext (); )
                                    {
                                        PropertySheetPage propertySheetPage = i.next ();
                                        if ( propertySheetPage.getControl ().isDisposed () )
                                        {
                                            i.remove ();
                                        }
                                        else
                                        {
                                            propertySheetPage.refresh ();
                                        }
                                    }
                                }
                            } );
                }
            } );

    // Create the editing domain with a special command stack.
    //
    editingDomain = new AdapterFactoryEditingDomain ( adapterFactory, commandStack, new HashMap<Resource, Boolean> () );
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:63,代碼來源:VisualInterfaceEditor.java

示例14: initializeEditingDomain

import org.eclipse.emf.common.command.CommandStackListener; //導入依賴的package包/類
/**
 * This sets up the editing domain for the model editor.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void initializeEditingDomain ()
{
    // Create an adapter factory that yields item providers.
    //
    adapterFactory = new ComposedAdapterFactory ( ComposedAdapterFactory.Descriptor.Registry.INSTANCE );

    adapterFactory.addAdapterFactory ( new ResourceItemProviderAdapterFactory () );
    adapterFactory.addAdapterFactory ( new WorldItemProviderAdapterFactory () );
    adapterFactory.addAdapterFactory ( new OsgiItemProviderAdapterFactory () );
    adapterFactory.addAdapterFactory ( new ProfileItemProviderAdapterFactory () );
    adapterFactory.addAdapterFactory ( new DeploymentItemProviderAdapterFactory () );
    adapterFactory.addAdapterFactory ( new SetupItemProviderAdapterFactory () );
    adapterFactory.addAdapterFactory ( new EcoreItemProviderAdapterFactory () );
    adapterFactory.addAdapterFactory ( new ConfigurationItemProviderAdapterFactory () );
    adapterFactory.addAdapterFactory ( new ScriptItemProviderAdapterFactory () );
    adapterFactory.addAdapterFactory ( new SecurityItemProviderAdapterFactory () );
    adapterFactory.addAdapterFactory ( new ReflectiveItemProviderAdapterFactory () );

    // Create the command stack that will notify this editor as commands are executed.
    //
    BasicCommandStack commandStack = new BasicCommandStack ();

    // Add a listener to set the most recent command's affected objects to be the selection of the viewer with focus.
    //
    commandStack.addCommandStackListener ( new CommandStackListener () {
        public void commandStackChanged ( final EventObject event )
        {
            getContainer ().getDisplay ().asyncExec ( new Runnable () {
                public void run ()
                {
                    firePropertyChange ( IEditorPart.PROP_DIRTY );

                    // Try to select the affected objects.
                    //
                    Command mostRecentCommand = ( (CommandStack)event.getSource () ).getMostRecentCommand ();
                    if ( mostRecentCommand != null )
                    {
                        setSelectionToViewer ( mostRecentCommand.getAffectedObjects () );
                    }
                    for ( Iterator<PropertySheetPage> i = propertySheetPages.iterator (); i.hasNext (); )
                    {
                        PropertySheetPage propertySheetPage = i.next ();
                        if ( propertySheetPage.getControl ().isDisposed () )
                        {
                            i.remove ();
                        }
                        else
                        {
                            propertySheetPage.refresh ();
                        }
                    }
                }
            } );
        }
    } );

    // Create the editing domain with a special command stack.
    //
    editingDomain = new AdapterFactoryEditingDomain ( adapterFactory, commandStack, new HashMap<Resource, Boolean> () );
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:67,代碼來源:DeploymentEditor.java

示例15: initializeEditingDomain

import org.eclipse.emf.common.command.CommandStackListener; //導入依賴的package包/類
/**
 * This sets up the editing domain for the model editor.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void initializeEditingDomain ()
{
    // Create an adapter factory that yields item providers.
    //
    adapterFactory = new ComposedAdapterFactory ( ComposedAdapterFactory.Descriptor.Registry.INSTANCE );

    adapterFactory.addAdapterFactory ( new ResourceItemProviderAdapterFactory () );
    adapterFactory.addAdapterFactory ( new MemoryItemProviderAdapterFactory () );
    adapterFactory.addAdapterFactory ( new ReflectiveItemProviderAdapterFactory () );

    // Create the command stack that will notify this editor as commands are executed.
    //
    BasicCommandStack commandStack = new BasicCommandStack ();

    // Add a listener to set the most recent command's affected objects to be the selection of the viewer with focus.
    //
    commandStack.addCommandStackListener ( new CommandStackListener () {
        public void commandStackChanged ( final EventObject event )
        {
            getContainer ().getDisplay ().asyncExec ( new Runnable () {
                public void run ()
                {
                    firePropertyChange ( IEditorPart.PROP_DIRTY );

                    // Try to select the affected objects.
                    //
                    Command mostRecentCommand = ( (CommandStack)event.getSource () ).getMostRecentCommand ();
                    if ( mostRecentCommand != null )
                    {
                        setSelectionToViewer ( mostRecentCommand.getAffectedObjects () );
                    }
                    for ( Iterator<PropertySheetPage> i = propertySheetPages.iterator (); i.hasNext (); )
                    {
                        PropertySheetPage propertySheetPage = i.next ();
                        if ( propertySheetPage.getControl ().isDisposed () )
                        {
                            i.remove ();
                        }
                        else
                        {
                            propertySheetPage.refresh ();
                        }
                    }
                }
            } );
        }
    } );

    // Create the editing domain with a special command stack.
    //
    editingDomain = new AdapterFactoryEditingDomain ( adapterFactory, commandStack, new HashMap<Resource, Boolean> () );
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:59,代碼來源:MemoryEditor.java


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