Java Code Examples for org.eclipse.emf.common.notify.Notification#getNotifier()

The following examples show how to use org.eclipse.emf.common.notify.Notification#getNotifier() . 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: CrossflowEditor.java    From scava with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public void notifyChanged(Notification notification) {
	if (notification.getNotifier() instanceof Resource) {
		switch (notification.getFeatureID(Resource.class)) {
			case Resource.RESOURCE__IS_LOADED:
			case Resource.RESOURCE__ERRORS:
			case Resource.RESOURCE__WARNINGS: {
				Resource resource = (Resource)notification.getNotifier();
				Diagnostic diagnostic = analyzeResourceProblems(resource, null);
				if (diagnostic.getSeverity() != Diagnostic.OK) {
					resourceToDiagnosticMap.put(resource, diagnostic);
				}
				else {
					resourceToDiagnosticMap.remove(resource);
				}
				dispatchUpdateProblemIndication();
				break;
			}
		}
	}
	else {
		super.notifyChanged(notification);
	}
}
 
Example 2
Source File: GenconfEditor.java    From M2Doc with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void notifyChanged(Notification notification) {
    if (notification.getNotifier() instanceof Resource) {
        switch (notification.getFeatureID(Resource.class)) {
            case Resource.RESOURCE__IS_LOADED:
            case Resource.RESOURCE__ERRORS:
            case Resource.RESOURCE__WARNINGS: {
                Resource resource = (Resource) notification.getNotifier();
                Diagnostic diagnostic = analyzeResourceProblems(resource, null);
                if (diagnostic.getSeverity() != Diagnostic.OK) {
                    resourceToDiagnosticMap.put(resource, diagnostic);
                } else {
                    resourceToDiagnosticMap.remove(resource);
                }
                dispatchUpdateProblemIndication();
                break;
            }
        }
    } else {
        super.notifyChanged(notification);
    }
}
 
Example 3
Source File: MemoryEditor.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void notifyChanged ( Notification notification )
{
    if ( notification.getNotifier () instanceof Resource )
    {
        switch ( notification.getFeatureID ( Resource.class ) )
        {
            case Resource.RESOURCE__IS_LOADED:
            case Resource.RESOURCE__ERRORS:
            case Resource.RESOURCE__WARNINGS:
            {
                Resource resource = (Resource)notification.getNotifier ();
                Diagnostic diagnostic = analyzeResourceProblems ( resource, null );
                if ( diagnostic.getSeverity () != Diagnostic.OK )
                {
                    resourceToDiagnosticMap.put ( resource, diagnostic );
                }
                else
                {
                    resourceToDiagnosticMap.remove ( resource );
                }

                if ( updateProblemIndication )
                {
                    getSite ().getShell ().getDisplay ().asyncExec ( new Runnable () {
                        public void run ()
                        {
                            updateProblemIndication ();
                        }
                    } );
                }
                break;
            }
        }
    }
    else
    {
        super.notifyChanged ( notification );
    }
}
 
Example 4
Source File: XtextResourceSet.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void notifyChanged(Notification notification) {
	final Map<URI, Resource> map = getURIResourceMap();
	if (map != null && notification.getFeatureID(Resource.class) == Resource.RESOURCE__URI && notification.getNotifier() instanceof Resource) {
		URI oldOne = (URI) notification.getOldValue();
		Resource resource = (Resource) notification.getNotifier();
		updateURI(resource, oldOne, map);
	}
	super.notifyChanged(notification);
}
 
Example 5
Source File: ExtensionsEditor.java    From ifml-editor with MIT License 5 votes vote down vote up
@Override
public void notifyChanged(Notification notification) {
	if (notification.getNotifier() instanceof Resource) {
		switch (notification.getFeatureID(Resource.class)) {
			case Resource.RESOURCE__IS_LOADED:
			case Resource.RESOURCE__ERRORS:
			case Resource.RESOURCE__WARNINGS: {
				Resource resource = (Resource)notification.getNotifier();
				Diagnostic diagnostic = analyzeResourceProblems(resource, null);
				if (diagnostic.getSeverity() != Diagnostic.OK) {
					resourceToDiagnosticMap.put(resource, diagnostic);
				}
				else {
					resourceToDiagnosticMap.remove(resource);
				}

				if (updateProblemIndication) {
					getSite().getShell().getDisplay().asyncExec
						(new Runnable() {
							 public void run() {
								 updateProblemIndication();
							 }
						 });
				}
				break;
			}
		}
	}
	else {
		super.notifyChanged(notification);
	}
}
 
Example 6
Source File: CrossDocumentContentAdapter.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected void selfAdapt(Notification notification) {
	super.selfAdapt(notification);
	if (notification.getNotifier() instanceof EObject) {
		Object feature = notification.getFeature();
		if (feature instanceof EReference) {
			EReference eReference = (EReference) feature;
			if (!eReference.isContainment() && shouldAdapt(eReference)) {
				handleContainment(notification);
			}
		}
	}
}
 
Example 7
Source File: EventDrivenSimulationEngine.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void notifyChanged(Notification notification) {
	// Only run cycle if responsible for this kind of notification
	if (EcoreUtil2.getContainerOfType((EObject) notification.getNotifier(),
			ExecutionContext.class) != interpreter.getExecutionContext()) {
		return;
	}
	super.notifyChanged(notification);
	if (notification.getNotifier() instanceof ExecutionEvent
			&& notification.getFeature() == SRuntimePackage.Literals.EXECUTION_EVENT__RAISED) {
		ExecutionEvent event = (ExecutionEvent) notification.getNotifier();
		if (notification.getNewBooleanValue() != notification.getOldBooleanValue()) {
			if (notification.getNewBooleanValue() && event.getDirection() == Direction.OUT) {
				// an out event was raised => check if there is a parent execution context that
				// contains a corresponding shadow event
				ExecutionContext thisContext = interpreter.getExecutionContext();
				if (thisContext.getName() == null || thisContext.getName().isEmpty()) {
					return;
				}
				ExecutionContext parentContext = EcoreUtil2.getContainerOfType(thisContext.eContainer(),
						ExecutionContext.class);
				if (parentContext == null) {
					return;
				}
				ExecutionEvent shadowEvent = findShadowEvent(event, parentContext);
				if (shadowEvent == null) {
					return;
				}
				// raise shadow event
				Optional<IExecutionFlowInterpreter> parentInterpreter = interpreterProvider
						.findInterpreter(parentContext);
				if (parentInterpreter.isPresent() && parentInterpreter.get() instanceof IEventRaiser) {
					((IEventRaiser) parentInterpreter.get()).raise(shadowEvent, event.getValue());
				}
			}
		}
	}
}
 
Example 8
Source File: GlobalizeEditor.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void notifyChanged ( Notification notification )
{
    if ( notification.getNotifier () instanceof Resource )
    {
        switch ( notification.getFeatureID ( Resource.class ) )
        {
            case Resource.RESOURCE__IS_LOADED:
            case Resource.RESOURCE__ERRORS:
            case Resource.RESOURCE__WARNINGS:
            {
                Resource resource = (Resource)notification.getNotifier ();
                Diagnostic diagnostic = analyzeResourceProblems ( resource, null );
                if ( diagnostic.getSeverity () != Diagnostic.OK )
                {
                    resourceToDiagnosticMap.put ( resource, diagnostic );
                }
                else
                {
                    resourceToDiagnosticMap.remove ( resource );
                }

                if ( updateProblemIndication )
                {
                    getSite ().getShell ().getDisplay ().asyncExec ( new Runnable () {
                        public void run ()
                        {
                            updateProblemIndication ();
                        }
                    } );
                }
                break;
            }
        }
    }
    else
    {
        super.notifyChanged ( notification );
    }
}
 
Example 9
Source File: CrossflowDocumentProvider.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
/**
* @generated
*/
public void notifyChanged(Notification notification) {
	if (notification.getNotifier() instanceof ResourceSet) {
		super.notifyChanged(notification);
	}
	if (!notification.isTouch() && myModifiedFilter.matches(notification)) {
		if (notification.getNotifier() instanceof Resource) {
			Resource resource = (Resource) notification.getNotifier();
			if (resource.isLoaded()) {
				boolean modified = false;
				for (Iterator /*<org.eclipse.emf.ecore.resource.Resource>*/ it = myInfo
						.getLoadedResourcesIterator(); it.hasNext() && !modified;) {
					Resource nextResource = (Resource) it.next();
					if (nextResource.isLoaded()) {
						modified = nextResource.isModified();
					}
				}
				boolean dirtyStateChanged = false;
				synchronized (myInfo) {
					if (modified != myInfo.fCanBeSaved) {
						myInfo.fCanBeSaved = modified;
						dirtyStateChanged = true;
					}
					if (!resource.isModified()) {
						myInfo.setSynchronized(resource);
					}
				}
				if (dirtyStateChanged) {
					fireElementDirtyStateChanged(myInfo.getEditorInput(), modified);

					if (!modified) {
						myInfo.setModificationStamp(computeModificationStamp(myInfo));
					}
				}
			}
		}
	}
}
 
Example 10
Source File: InfrastructureEditor.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void notifyChanged ( Notification notification )
{
    if ( notification.getNotifier () instanceof Resource )
    {
        switch ( notification.getFeatureID ( Resource.class ) )
        {
            case Resource.RESOURCE__IS_LOADED:
            case Resource.RESOURCE__ERRORS:
            case Resource.RESOURCE__WARNINGS:
            {
                Resource resource = (Resource)notification.getNotifier ();
                Diagnostic diagnostic = analyzeResourceProblems ( resource, null );
                if ( diagnostic.getSeverity () != Diagnostic.OK )
                {
                    resourceToDiagnosticMap.put ( resource, diagnostic );
                }
                else
                {
                    resourceToDiagnosticMap.remove ( resource );
                }
                dispatchUpdateProblemIndication ();
                break;
            }
        }
    }
    else
    {
        super.notifyChanged ( notification );
    }
}
 
Example 11
Source File: RecipeEditor.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void notifyChanged ( Notification notification )
{
    if ( notification.getNotifier () instanceof Resource )
    {
        switch ( notification.getFeatureID ( Resource.class ) )
        {
            case Resource.RESOURCE__IS_LOADED:
            case Resource.RESOURCE__ERRORS:
            case Resource.RESOURCE__WARNINGS:
            {
                Resource resource = (Resource)notification.getNotifier ();
                Diagnostic diagnostic = analyzeResourceProblems ( resource, null );
                if ( diagnostic.getSeverity () != Diagnostic.OK )
                {
                    resourceToDiagnosticMap.put ( resource, diagnostic );
                }
                else
                {
                    resourceToDiagnosticMap.remove ( resource );
                }

                if ( updateProblemIndication )
                {
                    getSite ().getShell ().getDisplay ().asyncExec ( new Runnable () {
                        public void run ()
                        {
                            updateProblemIndication ();
                        }
                    } );
                }
                break;
            }
        }
    }
    else
    {
        super.notifyChanged ( notification );
    }
}
 
Example 12
Source File: SourceEditPart.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
/**
* @generated
*/
protected void handleNotificationEvent(Notification event) {
	if (event.getNotifier() == getModel()
			&& EcorePackage.eINSTANCE.getEModelElement_EAnnotations().equals(event.getFeature())) {
		handleMajorSemanticChange();
	} else {
		super.handleNotificationEvent(event);
	}
}
 
Example 13
Source File: WorldEditor.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void notifyChanged ( Notification notification )
{
    if ( notification.getNotifier () instanceof Resource )
    {
        switch ( notification.getFeatureID ( Resource.class ) )
        {
            case Resource.RESOURCE__IS_LOADED:
            case Resource.RESOURCE__ERRORS:
            case Resource.RESOURCE__WARNINGS:
            {
                Resource resource = (Resource)notification.getNotifier ();
                Diagnostic diagnostic = analyzeResourceProblems ( resource, null );
                if ( diagnostic.getSeverity () != Diagnostic.OK )
                {
                    resourceToDiagnosticMap.put ( resource, diagnostic );
                }
                else
                {
                    resourceToDiagnosticMap.remove ( resource );
                }

                if ( updateProblemIndication )
                {
                    getSite ().getShell ().getDisplay ().asyncExec ( new Runnable () {
                        public void run ()
                        {
                            updateProblemIndication ();
                        }
                    } );
                }
                break;
            }
        }
    }
    else
    {
        super.notifyChanged ( notification );
    }
}
 
Example 14
Source File: TextAwareExternalLabelEditPart.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected void handleNotificationEvent(Notification event) {
	if (event.getFeature() == feature) {
		updateLabelText();
	}
	if (event.getNotifier() instanceof ShapeStyle) {
		refreshVisuals();
	}
	super.handleNotificationEvent(event);
}
 
Example 15
Source File: CsvSinkEditPart.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
/**
* @generated
*/
protected void handleNotificationEvent(Notification event) {
	if (event.getNotifier() == getModel()
			&& EcorePackage.eINSTANCE.getEModelElement_EAnnotations().equals(event.getFeature())) {
		handleMajorSemanticChange();
	} else {
		super.handleNotificationEvent(event);
	}
}
 
Example 16
Source File: DefaultTextEditComposer.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void notifyChanged(Notification notification) {
	super.notifyChanged(notification);

	if (!doRecord(notification))
		return;

	if (notification.getNotifier() instanceof EObject) {
		recordObjectModification((EObject) notification.getNotifier());
	} else if (notification.getNotifier() instanceof Resource) {
		recordResourceModification((Resource) notification.getNotifier());
	}
}
 
Example 17
Source File: EipEditor.java    From eip-designer with Apache License 2.0 5 votes vote down vote up
@Override
public void notifyChanged(Notification notification) {
   if (notification.getNotifier() instanceof Resource) {
      switch (notification.getFeatureID(Resource.class)) {
         case Resource.RESOURCE__IS_LOADED:
         case Resource.RESOURCE__ERRORS:
         case Resource.RESOURCE__WARNINGS: {
            Resource resource = (Resource)notification.getNotifier();
            Diagnostic diagnostic = analyzeResourceProblems(resource, null);
            if (diagnostic.getSeverity() != Diagnostic.OK) {
               resourceToDiagnosticMap.put(resource, diagnostic);
            }
            else {
               resourceToDiagnosticMap.remove(resource);
            }

            if (updateProblemIndication) {
               getSite().getShell().getDisplay().asyncExec
                  (new Runnable() {
                      public void run() {
                         updateProblemIndication();
                      }
                   });
            }
            break;
         }
      }
   }
   else {
      super.notifyChanged(notification);
   }
}
 
Example 18
Source File: VisualInterfaceEditor.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void notifyChanged ( Notification notification )
{
    if ( notification.getNotifier () instanceof Resource )
    {
        switch ( notification.getFeatureID ( Resource.class ) )
        {
            case Resource.RESOURCE__IS_LOADED:
            case Resource.RESOURCE__ERRORS:
            case Resource.RESOURCE__WARNINGS:
            {
                Resource resource = (Resource)notification.getNotifier ();
                Diagnostic diagnostic = analyzeResourceProblems ( resource, null );
                if ( diagnostic.getSeverity () != Diagnostic.OK )
                {
                    resourceToDiagnosticMap.put ( resource, diagnostic );
                }
                else
                {
                    resourceToDiagnosticMap.remove ( resource );
                }
                dispatchUpdateProblemIndication ();
                break;
            }
        }
    }
    else
    {
        super.notifyChanged ( notification );
    }
}
 
Example 19
Source File: QueueEditPart.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * @generated
 */
protected void handleNotificationEvent(Notification event) {
	if (event.getNotifier() == getModel()
			&& EcorePackage.eINSTANCE.getEModelElement_EAnnotations().equals(event.getFeature())) {
		handleMajorSemanticChange();
	} else {
		super.handleNotificationEvent(event);
	}
}
 
Example 20
Source File: XtextLabelEditPart.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected void handleNotificationEvent(final Notification notification) {
	if (notification.getNotifier() instanceof ShapeStyle) {
		refreshVisuals();
	} else if (NotationPackage.eINSTANCE.getFontStyle().getEAllAttributes().contains(notification.getFeature())) {
		refreshFont();
	} else {
		super.handleNotificationEvent(notification);
	}
}