org.eclipse.emf.common.command.CommandStack Java Examples

The following examples show how to use org.eclipse.emf.common.command.CommandStack. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GenconfEditor.java    From M2Doc with Eclipse Public License 1.0 6 votes vote down vote up
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();
                }
            }
        }
    });
}
 
Example #2
Source File: ModelStateImpl.java    From graphical-lsp with Eclipse Public License 2.0 5 votes vote down vote up
protected void setCommandStack(final CommandStack commandStack) {
	if (this.commandStack != null) {
		this.commandStack.flush();
	}

	this.commandStack = commandStack;
}
 
Example #3
Source File: ExtensionsEditor.java    From ifml-editor with MIT License 4 votes vote down vote up
/**
 * 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 CoreItemProviderAdapterFactory());
	adapterFactory.addAdapterFactory(new ExtensionsItemProviderAdapterFactory());
	adapterFactory.addAdapterFactory(new EcoreItemProviderAdapterFactory());
	adapterFactory.addAdapterFactory(new UMLItemProviderAdapterFactory());
	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>());
}
 
Example #4
Source File: ModelStateImpl.java    From graphical-lsp with Eclipse Public License 2.0 4 votes vote down vote up
public CommandStack getCommandStack() {
	return commandStack;
}
 
Example #5
Source File: CoreEditor.java    From ifml-editor with MIT License 4 votes vote down vote up
/**
 * 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 CoreItemProviderAdapterFactory());
	adapterFactory.addAdapterFactory(new ExtensionsItemProviderAdapterFactory());
	adapterFactory.addAdapterFactory(new EcoreItemProviderAdapterFactory());
	adapterFactory.addAdapterFactory(new UMLItemProviderAdapterFactory());
	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>());
}
 
Example #6
Source File: EipEditor.java    From eip-designer with Apache License 2.0 4 votes vote down vote up
/**
   * 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 EipItemProviderAdapterFactory());
     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>());
  }
 
Example #7
Source File: BeansEditor.java    From hybris-commerce-eclipse-plugin with Apache License 2.0 4 votes vote down vote up
/**
 * 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 BeansItemProviderAdapterFactory());
	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>());
}
 
Example #8
Source File: GenconfEditor.java    From M2Doc with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * This sets up the editing domain for the model editor.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * 
 * @generated NOT
 * @deprecated
 */
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 GenconfItemProviderAdapterFactory());
    adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());

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

    // 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 TransactionalEditingDomainImpl(adapterFactory, commandStack);
}
 
Example #9
Source File: CrossflowEditor.java    From scava with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * 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 CrossflowItemProviderAdapterFactory());
	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>());
}
 
Example #10
Source File: ConfigurationEditor.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * 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 ConfigurationItemProviderAdapterFactory () );
    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> () );
}
 
Example #11
Source File: ItemEditor.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * 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 ItemItemProviderAdapterFactory () );
    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> () );
}
 
Example #12
Source File: ComponentEditor.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * 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 ComponentItemProviderAdapterFactory () );
    adapterFactory.addAdapterFactory ( new EcoreItemProviderAdapterFactory () );
    adapterFactory.addAdapterFactory ( new ConfigurationItemProviderAdapterFactory () );
    adapterFactory.addAdapterFactory ( new GlobalizeItemProviderAdapterFactory () );
    adapterFactory.addAdapterFactory ( new InfrastructureItemProviderAdapterFactory () );
    adapterFactory.addAdapterFactory ( new ItemItemProviderAdapterFactory () );
    adapterFactory.addAdapterFactory ( new ScriptItemProviderAdapterFactory () );
    adapterFactory.addAdapterFactory ( new SecurityItemProviderAdapterFactory () );
    adapterFactory.addAdapterFactory ( new WorldItemProviderAdapterFactory () );
    adapterFactory.addAdapterFactory ( new OsgiItemProviderAdapterFactory () );
    adapterFactory.addAdapterFactory ( new ProfileItemProviderAdapterFactory () );
    adapterFactory.addAdapterFactory ( new DeploymentItemProviderAdapterFactory () );
    adapterFactory.addAdapterFactory ( new SetupItemProviderAdapterFactory () );
    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> () );
}
 
Example #13
Source File: GlobalizeEditor.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * 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 GlobalizeItemProviderAdapterFactory () );
    adapterFactory.addAdapterFactory ( new ConfigurationItemProviderAdapterFactory () );
    adapterFactory.addAdapterFactory ( new SecurityItemProviderAdapterFactory () );
    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 ScriptItemProviderAdapterFactory () );
    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> () );
}
 
Example #14
Source File: SecurityEditor.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * 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 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> () );
}
 
Example #15
Source File: InfrastructureEditor.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * 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 InfrastructureItemProviderAdapterFactory () );
    adapterFactory.addAdapterFactory ( new ConfigurationItemProviderAdapterFactory () );
    adapterFactory.addAdapterFactory ( new GlobalizeItemProviderAdapterFactory () );
    adapterFactory.addAdapterFactory ( new SecurityItemProviderAdapterFactory () );
    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 ScriptItemProviderAdapterFactory () );
    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> () );
}
 
Example #16
Source File: RecipeEditor.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * 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 RecipeItemProviderAdapterFactory () );
    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> () );
}
 
Example #17
Source File: MemoryEditor.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * 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> () );
}
 
Example #18
Source File: WorldEditor.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * 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> () );
}
 
Example #19
Source File: OsgiEditor.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * 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> () );
}
 
Example #20
Source File: ProfileEditor.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * 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> () );
}
 
Example #21
Source File: SetupEditor.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * 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> () );
}
 
Example #22
Source File: DeploymentEditor.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * 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> () );
}
 
Example #23
Source File: VisualInterfaceEditor.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * 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> () );
}
 
Example #24
Source File: DetailViewEditor.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * 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> () );
}
 
Example #25
Source File: ChartConfiguratorView.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
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 ();
}
 
Example #26
Source File: ChartEditor.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * 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> () );
}
 
Example #27
Source File: ProtocolEditor.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * 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> () );
}