當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。