Commit 241d4716 authored by Andras Janko's avatar Andras Janko Committed by Balazs Grill
Browse files

Bug 574930 Initial implementation for extensible ModelLoadManager



Change-Id: I2046b35b8a8cf56d2fdfdc329b8a55d2ad5a9764
Signed-off-by: default avatarAndras Janko <andras.janko@incquerylabs.com>
Signed-off-by: default avatarBalazs Varnai <balazs_varnai@mentor.com>
parent fd12bdfe
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -31,5 +31,5 @@ modelLoaders.name=Model Loaders
uriChangeDetectorDelegates.name=URI Change Detector Delegates
uriChangeListeners.name=URI Change Listeners 
modelSaveLifecycleListeners.name=Model Save Lifecycle Listeners

modelLoadManager.name=Model Load Manager
modelSaveProvider.name=Model Save Provider
 No newline at end of file
+2 −1
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ Contributors:
   <extension-point id="uriChangeDetectorDelegates" name="%uriChangeDetectorDelegates.name" schema="schema/uriChangeDetectorDelegates.exsd"/>
   <extension-point id="uriChangeListeners" name="%uriChangeListeners.name" schema="schema/uriChangeListeners.exsd"/>
   <extension-point id="modelSaveLifecycleListeners" name="%modelSaveLifecycleListeners.name" schema="schema/modelSaveLifecycleListeners.exsd"/>
   <extension-point id="modelLoadManager" name="%modelLoadManager.name" schema="schema/modelLoadManager.exsd"/>
   
   <extension
         point="org.eclipse.core.runtime.adapters">
+122 −0
Original line number Diff line number Diff line
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.eclipse.sphinx.emf.workspace" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
      <appInfo>
         <meta.schema plugin="org.eclipse.sphinx.emf.workspace" id="modelLoadManager" name="%modelLoadManager.name"/>
      </appInfo>
      <documentation>
         This extension point allows the extension of the ModelLoadManager. This extension will override the default implementation. 
      </documentation>
   </annotation>

   <element name="extension">
      <annotation>
         <appInfo>
            <meta.element />
         </appInfo>
      </annotation>
      <complexType>
         <sequence>
            <element ref="modelLoadManager"/>
         </sequence>
         <attribute name="point" type="string" use="required">
            <annotation>
               <documentation>
                  
               </documentation>
            </annotation>
         </attribute>
         <attribute name="id" type="string">
            <annotation>
               <documentation>
                  
               </documentation>
            </annotation>
         </attribute>
         <attribute name="name" type="string">
            <annotation>
               <documentation>
                  
               </documentation>
               <appInfo>
                  <meta.attribute translatable="true"/>
               </appInfo>
            </annotation>
         </attribute>
      </complexType>
   </element>

   <element name="modelLoadManager">
      <complexType>
         <attribute name="class" type="string" use="required">
            <annotation>
               <documentation>
                  
               </documentation>
               <appInfo>
                  <meta.attribute kind="java" basedOn=":org.eclipse.sphinx.emf.workspace.loading.IModelLoadManager"/>
               </appInfo>
            </annotation>
         </attribute>
      </complexType>
   </element>

   <annotation>
      <appInfo>
         <meta.section type="since"/>
      </appInfo>
      <documentation>
         0.12.0
      </documentation>
   </annotation>

   <annotation>
      <appInfo>
         <meta.section type="examples"/>
      </appInfo>
      <documentation>
         &lt;extension
      point=&quot;org.eclipse.sphinx.emf.workspace.modelLoadManager&quot;&gt;
   &lt;modelLoadManager
         class=&quot;org.example.loading.CustomModelLoadManager&quot;&gt;
   &lt;/modelLoadManager&gt;
&lt;/extension&gt;
      </documentation>
   </annotation>

   <annotation>
      <appInfo>
         <meta.section type="apiinfo"/>
      </appInfo>
      <documentation>
         [Enter API information here.]
      </documentation>
   </annotation>

   <annotation>
      <appInfo>
         <meta.section type="implementation"/>
      </appInfo>
      <documentation>
         [Enter information about supplied implementation of this extension point.]
      </documentation>
   </annotation>

   <annotation>
      <appInfo>
         <meta.section type="copyright"/>
      </appInfo>
      <documentation>
         Copyright (c) 2021 Siemens and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v10.html
 
Contributors: 
    Siemens - [574930] Initial API and implementation
      </documentation>
   </annotation>

</schema>
+7 −5
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@
 *
 * Contributors:
 *     See4sys - Initial API and implementation
 *
 *     Siemens - [574930] Model load manager extension
 * </copyright>
 */
package org.eclipse.sphinx.emf.workspace.internal.loading;
@@ -26,14 +26,14 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.sphinx.emf.metamodel.IMetaModelDescriptor;
import org.eclipse.sphinx.emf.workspace.Activator;
import org.eclipse.sphinx.emf.workspace.loading.operations.AbstractLoadOperation;
import org.eclipse.sphinx.emf.workspace.loading.operations.ILoadOperation;
import org.eclipse.sphinx.platform.IExtendedPlatformConstants;
import org.eclipse.sphinx.platform.util.StatusUtil;

/**
 * @since 0.7.0
 */
public class ModelLoadJob<T extends AbstractLoadOperation> extends Job {
public class ModelLoadJob<T extends ILoadOperation> extends Job {

	protected T operation;

@@ -77,7 +77,8 @@ public class ModelLoadJob<T extends AbstractLoadOperation> extends Job {
	 * @param mmDescriptor
	 *            The {@linkplain IMetaModelDescriptor meta-model descriptor} of the model which has been asked for
	 *            loading.
	 * @return <ul>
	 * @return
	 *         <ul>
	 *         <li><tt><b>true</b>&nbsp;&nbsp;</tt> if this job covers the loading of the specified projects with the
	 *         specified meta-model descriptor;</li>
	 *         <li><tt><b>false</b>&nbsp;</tt> otherwise.</li>
@@ -92,7 +93,8 @@ public class ModelLoadJob<T extends AbstractLoadOperation> extends Job {
	 *            The list of files this loading job is supposed to cover.
	 * @param mmDescriptor
	 *            The {@linkplain IMetaModelDescriptor meta-model descriptor} considered for loading.
	 * @return <ul>
	 * @return
	 *         <ul>
	 *         <li><tt><b>true</b>&nbsp;&nbsp;</tt> if this job covers the loading of the specified files with the
	 *         specified meta-model descriptor;</li>
	 *         <li><tt><b>false</b>&nbsp;</tt> otherwise.</li>
+4 −3
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@
 *
 * Contributors:
 *     itemis - Initial API and implementation
 *     Siemens - [574930] Model load manager extension
 *
 * </copyright>
 */
@@ -21,13 +22,13 @@ import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.sphinx.emf.workspace.Activator;
import org.eclipse.sphinx.emf.workspace.loading.operations.UnresolveUnreachableCrossProjectReferencesOperation;
import org.eclipse.sphinx.emf.workspace.loading.operations.IUnresolveUnreachableCrossProjectReferencesOperation;
import org.eclipse.sphinx.platform.IExtendedPlatformConstants;
import org.eclipse.sphinx.platform.util.StatusUtil;

public class UnresolveUnreachableCrossProjectReferencesJob extends Job {

	private UnresolveUnreachableCrossProjectReferencesOperation operation;
	private IUnresolveUnreachableCrossProjectReferencesOperation operation;

	/**
	 * Constructor.
@@ -35,7 +36,7 @@ public class UnresolveUnreachableCrossProjectReferencesJob extends Job {
	 * @param operation
	 *            The operation which this job is supposed to run.
	 */
	public UnresolveUnreachableCrossProjectReferencesJob(UnresolveUnreachableCrossProjectReferencesOperation operation) {
	public UnresolveUnreachableCrossProjectReferencesJob(IUnresolveUnreachableCrossProjectReferencesOperation operation) {
		super(operation.getLabel());
		this.operation = operation;
	}
Loading