当前位置: 首页>>代码示例>>Java>>正文


Java IEditingDomainProvider类代码示例

本文整理汇总了Java中org.eclipse.emf.edit.domain.IEditingDomainProvider的典型用法代码示例。如果您正苦于以下问题:Java IEditingDomainProvider类的具体用法?Java IEditingDomainProvider怎么用?Java IEditingDomainProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IEditingDomainProvider类属于org.eclipse.emf.edit.domain包,在下文中一共展示了IEditingDomainProvider类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: selectInstruction

import org.eclipse.emf.edit.domain.IEditingDomainProvider; //导入依赖的package包/类
/**
 * Selects the given instruction in the given {@link IEditorPart}.
 * 
 * @param editorPart
 *            the {@link IEditorPart}
 * @param instructionUri
 *            the instruction {@link URI}
 */
public static void selectInstruction(IEditorPart editorPart, final URI instructionUri) {
	if (editorPart instanceof IViewerProvider) {
		if (editorPart instanceof IEditingDomainProvider) {
			final EditingDomain domain = ((IEditingDomainProvider)editorPart).getEditingDomain();
			final EObject selection = domain.getResourceSet().getEObject(instructionUri, false);
			if (selection != null) {
				((IViewerProvider)editorPart).getViewer().setSelection(
						new StructuredSelection(selection), true);
			} else {
				DebugIdeUiPlugin.getPlugin().log(
						new IllegalStateException("can't find source for " + instructionUri));
			}
		}
	}
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:24,代码来源:EMFEditorUtils.java

示例2: selectInstructions

import org.eclipse.emf.edit.domain.IEditingDomainProvider; //导入依赖的package包/类
/**
 * Selects the given instruction in the given {@link IEditorPart}.
 * 
 * @param editorPart
 *            the {@link IEditorPart}
 * @param instructionUris
 *            the {@link List} of instruction {@link URI}
 */
public static void selectInstructions(IEditorPart editorPart, final List<URI> instructionUris) {
	if (editorPart instanceof IViewerProvider) {
		if (editorPart instanceof IEditingDomainProvider) {
			final EditingDomain domain = ((IEditingDomainProvider)editorPart).getEditingDomain();
			final List<EObject> selection = new ArrayList<EObject>();
			for (URI uri : instructionUris) {
				EObject eObject = domain.getResourceSet().getEObject(uri, false);
				if (eObject != null) {
					selection.add(eObject);
				}
			}
			if (!selection.isEmpty()) {
				((IViewerProvider)editorPart).getViewer().setSelection(
						new StructuredSelection(selection), true);
			} else {
				DebugIdeUiPlugin.getPlugin().log(
						new IllegalStateException("can't find source for " + instructionUris));
			}
		}
	}
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:30,代码来源:EMFEditorUtils.java

示例3: execute

import org.eclipse.emf.edit.domain.IEditingDomainProvider; //导入依赖的package包/类
@Override
public Object execute ( final ExecutionEvent event ) throws ExecutionException
{

    final IEditorPart editor = getActivePage ().getActiveEditor ();

    byte b = (byte)1;
    for ( final Attribute attribute : SelectionHelper.iterable ( getSelection (), Attribute.class ) )
    {
        EditingDomain domain = AdapterFactoryEditingDomain.getEditingDomainFor ( attribute );

        if ( domain == null && editor instanceof IEditingDomainProvider )
        {
            domain = ( (IEditingDomainProvider)editor ).getEditingDomain ();
        }

        SetCommand.create ( domain, attribute, ProtocolPackage.Literals.ATTRIBUTE__FIELD_NUMBER, b ).execute ();

        b++;
    }

    return null;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:24,代码来源:FillFieldNumbersHandler.java

示例4: getLastActiveEditorResourceSet

import org.eclipse.emf.edit.domain.IEditingDomainProvider; //导入依赖的package包/类
/**
 * 
 * @return The EMF resource set of the last active editor (if it is still
 *         open).
 */
public static ResourceSet getLastActiveEditorResourceSet() {
	final IEditorPart editor = getLastActiveEditor();
	if (editor == null)
		return null;
	EditingDomain domain = null;
	if (editor instanceof IEditingDomainProvider) {
		domain = ((IEditingDomainProvider) editor).getEditingDomain();
	} else if (editor.getAdapter(IEditingDomainProvider.class) != null) {
		domain = ((IEditingDomainProvider) editor
				.getAdapter(IEditingDomainProvider.class))
				.getEditingDomain();
	} else if (editor.getAdapter(EditingDomain.class) != null) {
		domain = (EditingDomain) editor.getAdapter(EditingDomain.class);
	}
	if (domain == null) {
		return null;
	}

	return domain.getResourceSet();
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:26,代码来源:ActiveEditorTracker.java

示例5: refresh

import org.eclipse.emf.edit.domain.IEditingDomainProvider; //导入依赖的package包/类
public void refresh(IFile eiq, IFile bind, IEditingDomainProvider editor) {
	currentBind = bind;
	currentEiq = eiq;
	currentEditor = editor;

	System.out.println("view refresh");

	for (Control control : c.getChildren()) {
		control.dispose();
	}

	addTools();

	addTable(eiq, bind);
	loadLockFromFile(eiq, bind);

	c.layout(true);

	c.setData(uiCreated, true);
}
 
开发者ID:FTSRG,项目名称:mondo-collab-framework,代码行数:21,代码来源:EMFGitLocksView.java

示例6: selectionChanged

import org.eclipse.emf.edit.domain.IEditingDomainProvider; //导入依赖的package包/类
/**
 * This implements {@link org.eclipse.jface.viewers.ISelectionChangedListener},
 * handling {@link org.eclipse.jface.viewers.SelectionChangedEvent}s by querying for the children and siblings
 * that can be added to the selected object and updating the menus accordingly.
 * <!-- begin-user-doc -->
    * <!-- end-user-doc -->
 * @generated
 */
   public void selectionChanged(SelectionChangedEvent event) {
	// Remove any menu items for old selection.
	//
	if (createChildMenuManager != null) {
		depopulateManager(createChildMenuManager, createChildActions);
	}
	if (createSiblingMenuManager != null) {
		depopulateManager(createSiblingMenuManager, createSiblingActions);
	}

	// Query the new selection for appropriate new child/sibling descriptors
	//
	Collection<?> newChildDescriptors = null;
	Collection<?> newSiblingDescriptors = null;

	ISelection selection = event.getSelection();
	if (selection instanceof IStructuredSelection && ((IStructuredSelection)selection).size() == 1) {
		Object object = ((IStructuredSelection)selection).getFirstElement();

		EditingDomain domain = ((IEditingDomainProvider)activeEditorPart).getEditingDomain();

		newChildDescriptors = domain.getNewChildDescriptors(object, null);
		newSiblingDescriptors = domain.getNewChildDescriptors(null, object);
	}

	// Generate actions for selection; populate and redraw the menus.
	//
	createChildActions = generateCreateChildActions(newChildDescriptors, selection);
	createSiblingActions = generateCreateSiblingActions(newSiblingDescriptors, selection);

	if (createChildMenuManager != null) {
		populateManager(createChildMenuManager, createChildActions, null);
		createChildMenuManager.update(true);
	}
	if (createSiblingMenuManager != null) {
		populateManager(createSiblingMenuManager, createSiblingActions, null);
		createSiblingMenuManager.update(true);
	}
}
 
开发者ID:IncQueryLabs,项目名称:smarthome-cep-demonstrator,代码行数:48,代码来源:SmarthomeActionBarContributor.java

示例7: selectionChanged

import org.eclipse.emf.edit.domain.IEditingDomainProvider; //导入依赖的package包/类
/**
 * This implements {@link org.eclipse.jface.viewers.ISelectionChangedListener},
 * handling {@link org.eclipse.jface.viewers.SelectionChangedEvent}s by querying for the children and siblings
 * that can be added to the selected object and updating the menus accordingly.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void selectionChanged(SelectionChangedEvent event) {
	// Remove any menu items for old selection.
	//
	if (createChildMenuManager != null) {
		depopulateManager(createChildMenuManager, createChildActions);
	}
	if (createSiblingMenuManager != null) {
		depopulateManager(createSiblingMenuManager, createSiblingActions);
	}

	// Query the new selection for appropriate new child/sibling descriptors
	//
	Collection<?> newChildDescriptors = null;
	Collection<?> newSiblingDescriptors = null;

	ISelection selection = event.getSelection();
	if (selection instanceof IStructuredSelection && ((IStructuredSelection)selection).size() == 1) {
		Object object = ((IStructuredSelection)selection).getFirstElement();

		EditingDomain domain = ((IEditingDomainProvider)activeEditorPart).getEditingDomain();

		newChildDescriptors = domain.getNewChildDescriptors(object, null);
		newSiblingDescriptors = domain.getNewChildDescriptors(null, object);
	}

	// Generate actions for selection; populate and redraw the menus.
	//
	createChildActions = generateCreateChildActions(newChildDescriptors, selection);
	createSiblingActions = generateCreateSiblingActions(newSiblingDescriptors, selection);

	if (createChildMenuManager != null) {
		populateManager(createChildMenuManager, createChildActions, null);
		createChildMenuManager.update(true);
	}
	if (createSiblingMenuManager != null) {
		populateManager(createSiblingMenuManager, createSiblingActions, null);
		createSiblingMenuManager.update(true);
	}
}
 
开发者ID:cetic,项目名称:SimQRI,代码行数:48,代码来源:MetamodelActionBarContributor.java

示例8: getGroup

import org.eclipse.emf.edit.domain.IEditingDomainProvider; //导入依赖的package包/类
private Group getGroup() {
	final Group res;
	final IEditorPart editor = PlatformUI.getWorkbench()
			.getActiveWorkbenchWindow().getActivePage()
			.getActiveEditor();

	if (editor instanceof IEditingDomainProvider) {
		final EditingDomain editingDomain = ((IEditingDomainProvider) editor)
				.getEditingDomain();
		final ResourceSet resourceSet = editingDomain.getResourceSet();
		Group group = null;

		for (Resource resource : resourceSet.getResources()) {
			for (EObject eObj : resource.getContents()) {
				if (eObj instanceof Group) {
					group = (Group) eObj;
					break;
				}
			}
		}
		res = group;
	} else {
		res = null;
	}

	return res;
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:28,代码来源:NewGemocDebugRepresentationWizard.java

示例9: createDiagramDescription

import org.eclipse.emf.edit.domain.IEditingDomainProvider; //导入依赖的package包/类
private DiagramDescription createDiagramDescription(final Group group,
		final String viewpointName, final String diagramName) {
	final EditingDomain editingDomain = (EditingDomain) ((IEditingDomainProvider) group
			.eResource().getResourceSet()).getEditingDomain();
	final ChangeCommand recordingCommand = new ChangeCommand(
			group.eResource()) {

		private DiagramDescription diagramDesctiption;

		@Override
		protected void doExecute() {
			final Viewpoint viewpoint = DescriptionPackage.eINSTANCE
					.getDescriptionFactory().createViewpoint();
			viewpoint.setName(viewpointName);
			group.getOwnedViewpoints().add(viewpoint);
			diagramDesctiption = org.eclipse.sirius.diagram.description.DescriptionPackage.eINSTANCE
					.getDescriptionFactory().createDiagramDescription();
			diagramDesctiption.setName(diagramName);
			viewpoint.getOwnedRepresentations().add(diagramDesctiption);
		}

		@Override
		public Collection<?> getResult() {
			ArrayList<DiagramDescription> res = new ArrayList<DiagramDescription>();
			res.add(diagramDesctiption);
			return res;
		}

	};
	editingDomain.getCommandStack().execute(recordingCommand);

	return (DiagramDescription) recordingCommand.getResult().iterator()
			.next();
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:35,代码来源:NewGemocDebugRepresentationWizard.java

示例10: selectionChanged

import org.eclipse.emf.edit.domain.IEditingDomainProvider; //导入依赖的package包/类
/**
 * This implements {@link org.eclipse.jface.viewers.ISelectionChangedListener},
 * handling {@link org.eclipse.jface.viewers.SelectionChangedEvent}s by querying for the children and siblings
 * that can be added to the selected object and updating the menus accordingly.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * 
 * @generated
 */
public void selectionChanged(SelectionChangedEvent event) {
    // Remove any menu items for old selection.
    //
    if (createChildMenuManager != null) {
        depopulateManager(createChildMenuManager, createChildActions);
    }
    if (createSiblingMenuManager != null) {
        depopulateManager(createSiblingMenuManager, createSiblingActions);
    }

    // Query the new selection for appropriate new child/sibling descriptors
    //
    Collection<?> newChildDescriptors = null;
    Collection<?> newSiblingDescriptors = null;

    ISelection selection = event.getSelection();
    if (selection instanceof IStructuredSelection && ((IStructuredSelection) selection).size() == 1) {
        Object object = ((IStructuredSelection) selection).getFirstElement();

        EditingDomain domain = ((IEditingDomainProvider) activeEditorPart).getEditingDomain();

        newChildDescriptors = domain.getNewChildDescriptors(object, null);
        newSiblingDescriptors = domain.getNewChildDescriptors(null, object);
    }

    // Generate actions for selection; populate and redraw the menus.
    //
    createChildActions = generateCreateChildActions(newChildDescriptors, selection);
    createSiblingActions = generateCreateSiblingActions(newSiblingDescriptors, selection);

    if (createChildMenuManager != null) {
        populateManager(createChildMenuManager, createChildActions, null);
        createChildMenuManager.update(true);
    }
    if (createSiblingMenuManager != null) {
        populateManager(createSiblingMenuManager, createSiblingActions, null);
        createSiblingMenuManager.update(true);
    }
}
 
开发者ID:ObeoNetwork,项目名称:M2Doc,代码行数:49,代码来源:GenconfActionBarContributor.java

示例11: open

import org.eclipse.emf.edit.domain.IEditingDomainProvider; //导入依赖的package包/类
/**
 * Opens the resource in <code>linkTarget</code> with the generated editor, if it
 * supports the file extension of this resource, and tries to jump to the
 * definition. Otherwise it tries to open the target with the default editor.
 */
public void open() {
	if (linkTarget == null) {
		return;
	}
	IFile file = getIFileFromResource();
	if (file != null) {
		IWorkbench workbench = PlatformUI.getWorkbench();
		IWorkbenchPage page = workbench.getActiveWorkbenchWindow().getActivePage();
		try {
			IEditorDescriptor desc = workbench.getEditorRegistry().getDefaultEditor(file.getName());
			if (desc == null) {
				desc = workbench.getEditorRegistry().findEditor("org.eclipse.emf.ecore.presentation.ReflectiveEditorID");
			}
			IEditorPart editorPart = page.openEditor(new FileEditorInput(file), desc.getId());
			if (editorPart instanceof IEditingDomainProvider) {
				IEditingDomainProvider editingDomainProvider = (IEditingDomainProvider) editorPart;
				EditingDomain editingDomain = editingDomainProvider.getEditingDomain();
				URI uri = EcoreUtil.getURI(linkTarget);
				EObject originalObject = editingDomain.getResourceSet().getEObject(uri, true);
				if (editingDomainProvider instanceof IViewerProvider) {
					IViewerProvider viewerProvider = (IViewerProvider) editingDomainProvider;
					Viewer viewer = viewerProvider.getViewer();
					viewer.setSelection(new StructuredSelection(originalObject), true);
				}
			}
		} catch (PartInitException e) {
			de.darwinspl.preferences.resource.dwprofile.mopp.DwprofilePlugin.logError("Exception while opening hyperlink target.", e);
		}
	}
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:36,代码来源:DwprofileHyperlink.java

示例12: open

import org.eclipse.emf.edit.domain.IEditingDomainProvider; //导入依赖的package包/类
/**
 * Opens the resource in <code>linkTarget</code> with the generated editor, if it
 * supports the file extension of this resource, and tries to jump to the
 * definition. Otherwise it tries to open the target with the default editor.
 */
public void open() {
	if (linkTarget == null) {
		return;
	}
	IFile file = getIFileFromResource();
	if (file != null) {
		IWorkbench workbench = PlatformUI.getWorkbench();
		IWorkbenchPage page = workbench.getActiveWorkbenchWindow().getActivePage();
		try {
			IEditorDescriptor desc = workbench.getEditorRegistry().getDefaultEditor(file.getName());
			if (desc == null) {
				desc = workbench.getEditorRegistry().findEditor("org.eclipse.emf.ecore.presentation.ReflectiveEditorID");
			}
			IEditorPart editorPart = page.openEditor(new FileEditorInput(file), desc.getId());
			if (editorPart instanceof IEditingDomainProvider) {
				IEditingDomainProvider editingDomainProvider = (IEditingDomainProvider) editorPart;
				EditingDomain editingDomain = editingDomainProvider.getEditingDomain();
				URI uri = EcoreUtil.getURI(linkTarget);
				EObject originalObject = editingDomain.getResourceSet().getEObject(uri, true);
				if (editingDomainProvider instanceof IViewerProvider) {
					IViewerProvider viewerProvider = (IViewerProvider) editingDomainProvider;
					Viewer viewer = viewerProvider.getViewer();
					viewer.setSelection(new StructuredSelection(originalObject), true);
				}
			}
		} catch (PartInitException e) {
			eu.hyvar.feature.expression.resource.hyexpression.mopp.HyexpressionPlugin.logError("Exception while opening hyperlink target.", e);
		}
	}
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:36,代码来源:HyexpressionHyperlink.java

示例13: open

import org.eclipse.emf.edit.domain.IEditingDomainProvider; //导入依赖的package包/类
/**
 * Opens the resource in <code>linkTarget</code> with the generated editor, if it
 * supports the file extension of this resource, and tries to jump to the
 * definition. Otherwise it tries to open the target with the default editor.
 */
public void open() {
	if (linkTarget == null) {
		return;
	}
	IFile file = getIFileFromResource();
	if (file != null) {
		IWorkbench workbench = PlatformUI.getWorkbench();
		IWorkbenchPage page = workbench.getActiveWorkbenchWindow().getActivePage();
		try {
			IEditorDescriptor desc = workbench.getEditorRegistry().getDefaultEditor(file.getName());
			if (desc == null) {
				desc = workbench.getEditorRegistry().findEditor("org.eclipse.emf.ecore.presentation.ReflectiveEditorID");
			}
			IEditorPart editorPart = page.openEditor(new FileEditorInput(file), desc.getId());
			if (editorPart instanceof IEditingDomainProvider) {
				IEditingDomainProvider editingDomainProvider = (IEditingDomainProvider) editorPart;
				EditingDomain editingDomain = editingDomainProvider.getEditingDomain();
				URI uri = EcoreUtil.getURI(linkTarget);
				EObject originalObject = editingDomain.getResourceSet().getEObject(uri, true);
				if (editingDomainProvider instanceof IViewerProvider) {
					IViewerProvider viewerProvider = (IViewerProvider) editingDomainProvider;
					Viewer viewer = viewerProvider.getViewer();
					viewer.setSelection(new StructuredSelection(originalObject), true);
				}
			}
		} catch (PartInitException e) {
			eu.hyvar.context.contextValidity.resource.hyvalidityformula.mopp.HyvalidityformulaPlugin.logError("Exception while opening hyperlink target.", e);
		}
	}
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:36,代码来源:HyvalidityformulaHyperlink.java

示例14: open

import org.eclipse.emf.edit.domain.IEditingDomainProvider; //导入依赖的package包/类
/**
 * Opens the resource in <code>linkTarget</code> with the generated editor, if it
 * supports the file extension of this resource, and tries to jump to the
 * definition. Otherwise it tries to open the target with the default editor.
 */
public void open() {
	if (linkTarget == null) {
		return;
	}
	IFile file = getIFileFromResource();
	if (file != null) {
		IWorkbench workbench = PlatformUI.getWorkbench();
		IWorkbenchPage page = workbench.getActiveWorkbenchWindow().getActivePage();
		try {
			IEditorDescriptor desc = workbench.getEditorRegistry().getDefaultEditor(file.getName());
			if (desc == null) {
				desc = workbench.getEditorRegistry().findEditor("org.eclipse.emf.ecore.presentation.ReflectiveEditorID");
			}
			IEditorPart editorPart = page.openEditor(new FileEditorInput(file), desc.getId());
			if (editorPart instanceof IEditingDomainProvider) {
				IEditingDomainProvider editingDomainProvider = (IEditingDomainProvider) editorPart;
				EditingDomain editingDomain = editingDomainProvider.getEditingDomain();
				URI uri = EcoreUtil.getURI(linkTarget);
				EObject originalObject = editingDomain.getResourceSet().getEObject(uri, true);
				if (editingDomainProvider instanceof IViewerProvider) {
					IViewerProvider viewerProvider = (IViewerProvider) editingDomainProvider;
					Viewer viewer = viewerProvider.getViewer();
					viewer.setSelection(new StructuredSelection(originalObject), true);
				}
			}
		} catch (PartInitException e) {
			eu.hyvar.dataValues.resource.hydatavalue.mopp.HydatavaluePlugin.logError("Exception while opening hyperlink target.", e);
		}
	}
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:36,代码来源:HydatavalueHyperlink.java


注:本文中的org.eclipse.emf.edit.domain.IEditingDomainProvider类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。