org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecorator Java Examples

The following examples show how to use org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecorator. 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: CrossflowValidationDecoratorProvider.java    From scava with Eclipse Public License 2.0 6 votes vote down vote up
/**
* @generated
*/
private static void refreshDecorators(String viewId, Diagram diagram) {
	final List decorators = viewId != null ? (List) allDecorators.get(viewId) : null;
	if (decorators == null || decorators.isEmpty() || diagram == null) {
		return;
	}
	final Diagram fdiagram = diagram;
	PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {

		public void run() {
			try {
				TransactionUtil.getEditingDomain(fdiagram).runExclusive(new Runnable() {

					public void run() {
						for (Iterator it = decorators.iterator(); it.hasNext();) {
							IDecorator decorator = (IDecorator) it.next();
							decorator.refresh();
						}
					}
				});
			} catch (Exception e) {
				CrossflowDiagramEditorPlugin.getInstance().logError("Decorator refresh failure", e); //$NON-NLS-1$
			}
		}
	});
}
 
Example #2
Source File: AbstractMarkerBasedDecorationProvider.java    From statecharts with Eclipse Public License 1.0 6 votes vote down vote up
public void deactivate() {
	if (viewId == null) {
		return;
	}

	// remove self from global decorators registry
	List<IDecorator> list = allDecorators.get(viewId);
	if (list != null) {
		list.remove(this);
		if (list.isEmpty()) {
			allDecorators.remove(viewId);
		}
	}

	// stop listening to changes in resources if there are no more
	// decorators
	if (fileObserver != null && allDecorators.isEmpty()) {
		FileChangeManager.getInstance().removeFileObserver(fileObserver);
		fileObserver = null;
	}
	super.deactivate();
}
 
Example #3
Source File: TransitionPriorityDecorationProvider.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void createDecorators(IDecoratorTarget decoratorTarget) {
	EditPart editPart = (EditPart) decoratorTarget.getAdapter(EditPart.class);
	if (editPart instanceof GraphicalEditPart || editPart instanceof AbstractConnectionEditPart) {
		EditDomain ed = editPart.getViewer().getEditDomain();
		if (!(ed instanceof DiagramEditDomain)) {
			return;
		}
		if (shouldInstall(((DiagramEditDomain) ed).getEditorPart()) && editPart instanceof TransitionEditPart) {
			IDecorator decorator = createStatusDecorator(decoratorTarget);
			decorators.add(decorator);
			decoratorTarget.installDecorator(getDecoratorKey(), decorator);
		}
	}
}
 
Example #4
Source File: AbstractPriorityDecorationProvider.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void propertyChange(PropertyChangeEvent event) {
	if (StatechartPreferenceConstants.PREF_PRIORITY_LABELS.equals(event.getProperty())
			|| StatechartPreferenceConstants.PREF_FONT_SCALING.equals(event.getProperty())) {
		for (IDecorator decorator : decorators) {
			decorator.refresh();
		}
	}
}
 
Example #5
Source File: RegionPriorityDecorationProvider.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void createDecorators(IDecoratorTarget decoratorTarget) {
	EditPart editPart = (EditPart) decoratorTarget.getAdapter(EditPart.class);
	if (editPart instanceof GraphicalEditPart || editPart instanceof AbstractConnectionEditPart) {
		EditDomain ed = editPart.getViewer().getEditDomain();
		if (!(ed instanceof DiagramEditDomain)) {
			return;
		}
		if (shouldInstall(((DiagramEditDomain) ed).getEditorPart()) && editPart instanceof RegionEditPart) {
			IDecorator decorator = createStatusDecorator(decoratorTarget);
			decorators.add(decorator);
			decoratorTarget.installDecorator(getDecoratorKey(), decorator);
		}
	}
}
 
Example #6
Source File: AbstractMarkerBasedDecorationProvider.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
protected static void refreshDecorators(String viewId, Diagram diagram) {
	final List<IDecorator> decorators = viewId != null ? (List<IDecorator>) allDecorators.get(viewId) : null;
	if (decorators == null || decorators.isEmpty() || diagram == null) {
		return;
	}
	PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
		public void run() {
			for (Iterator<IDecorator> it = decorators.iterator(); it.hasNext();) {
				IDecorator decorator = it.next();
				decorator.refresh();
			}
		}
	});
}
 
Example #7
Source File: AbstractMarkerBasedDecorationProvider.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
public void activate() {
	if (viewId == null) {
		return;
	}

	// add self to global decorators registry
	List<IDecorator> list = allDecorators.get(viewId);
	if (list == null) {
		list = new ArrayList<IDecorator>(2);
		list.add(this);
		allDecorators.put(viewId, list);
	} else if (!list.contains(this)) {
		list.add(this);
	}

	// start listening to changes in resources
	View view = (View) getDecoratorTarget().getAdapter(View.class);
	if (view == null) {
		return;
	}
	Diagram diagramView = view.getDiagram();
	if (diagramView == null) {
		return;
	}
	if (fileObserver == null) {
		FileChangeManager.getInstance().addFileObserver(fileObserver = new MarkerObserver(diagramView));
	}
}
 
Example #8
Source File: ProcessValidationDecoratorProvider.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
private static void refreshDecorators(String viewId, Diagram diagram) {
	final List decorators = viewId != null ? (List) allDecorators.get(viewId) : null;
	if (decorators == null || decorators.isEmpty() || diagram == null) {
		return;
	}
	if (!diagram.eIsProxy()) {
		final Diagram fdiagram = diagram;
		PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {

			public void run() {
				try {

					if (!fdiagram.eIsProxy())
						TransactionUtil.getEditingDomain(fdiagram).runExclusive(new Runnable() {

							public void run() {
								for (Iterator it = decorators.iterator(); it.hasNext();) {
									IDecorator decorator = (IDecorator) it.next();
									decorator.refresh();
								}
							}
						});
				} catch (Exception e) {
					ProcessDiagramEditorPlugin.getInstance().logError("Decorator refresh failure", e); //$NON-NLS-1$
				}
			}
		});
	}
}
 
Example #9
Source File: TransitionPriorityDecorationProvider.java    From statecharts with Eclipse Public License 1.0 4 votes vote down vote up
protected IDecorator createStatusDecorator(IDecoratorTarget decoratorTarget) {
	return new TransitionPriorityDecorator(decoratorTarget);
}
 
Example #10
Source File: RegionPriorityDecorationProvider.java    From statecharts with Eclipse Public License 1.0 4 votes vote down vote up
protected IDecorator createStatusDecorator(IDecoratorTarget decoratorTarget) {
	return new RegionPriorityDecorator(decoratorTarget);
}
 
Example #11
Source File: AbstractMarkerBasedDecorationProvider.java    From statecharts with Eclipse Public License 1.0 votes vote down vote up
protected abstract IDecorator createStatusDecorator(IDecoratorTarget decoratorTarget);