當前位置: 首頁>>代碼示例>>Java>>正文


Java WrappedException類代碼示例

本文整理匯總了Java中org.eclipse.emf.common.util.WrappedException的典型用法代碼示例。如果您正苦於以下問題:Java WrappedException類的具體用法?Java WrappedException怎麽用?Java WrappedException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


WrappedException類屬於org.eclipse.emf.common.util包,在下文中一共展示了WrappedException類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: loadPackage

import org.eclipse.emf.common.util.WrappedException; //導入依賴的package包/類
/**
 * Laods the package and any sub-packages from their serialized form.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void loadPackage() {
	if (isLoaded)
		return;
	isLoaded = true;

	URL url = getClass().getResource(packageFilename);
	if (url == null) {
		throw new RuntimeException("Missing serialized package: " + packageFilename);
	}
	URI uri = URI.createURI(url.toString());
	Resource resource = new EcoreResourceFactoryImpl().createResource(uri);
	try {
		resource.load(null);
	} catch (IOException exception) {
		throw new WrappedException(exception);
	}
	initializeFromLoadedEPackage(this, (EPackage) resource.getContents().get(0));
	createResource(eNS_URI);
}
 
開發者ID:georghinkel,項目名稱:ttc2017smartGrids,代碼行數:26,代碼來源:Task2PackageImpl.java

示例2: loadPackage

import org.eclipse.emf.common.util.WrappedException; //導入依賴的package包/類
/**
 * Laods the package and any sub-packages from their serialized form.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void loadPackage() {
	if (isLoaded) return;
	isLoaded = true;

	URL url = getClass().getResource(packageFilename);
	if (url == null) {
		throw new RuntimeException("Missing serialized package: " + packageFilename);
	}
	URI uri = URI.createURI(url.toString());
	Resource resource = new EcoreResourceFactoryImpl().createResource(uri);
	try {
		resource.load(null);
	}
	catch (IOException exception) {
		throw new WrappedException(exception);
	}
	initializeFromLoadedEPackage(this, (EPackage)resource.getContents().get(0));
	createResource(eNS_URI);
}
 
開發者ID:georghinkel,項目名稱:ttc2017smartGrids,代碼行數:26,代碼來源:GluemodelPackageImpl.java

示例3: validateValue

import org.eclipse.emf.common.util.WrappedException; //導入依賴的package包/類
/**
 * {@inheritDoc}
 * 
 * @see org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent#validateValue(org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent)
 * 
 */
public Diagnostic validateValue(IPropertiesEditionEvent event) {
	Diagnostic ret = Diagnostic.OK_INSTANCE;
	if (event.getNewValue() != null) {
		try {
			if (HrmViewsRepository.General.Properties.name == event.getAffectedEditor()) {
				Object newValue = event.getNewValue();
				if (newValue instanceof String) {
					newValue = EEFConverterUtil.createFromString(GrmPackage.eINSTANCE.getNamedElement_Name().getEAttributeType(), (String)newValue);
				}
				ret = Diagnostician.INSTANCE.validate(GrmPackage.eINSTANCE.getNamedElement_Name().getEAttributeType(), newValue);
			}
		} catch (IllegalArgumentException iae) {
			ret = BasicDiagnostic.toDiagnostic(iae);
		} catch (WrappedException we) {
			ret = BasicDiagnostic.toDiagnostic(we);
		}
	}
	return ret;
}
 
開發者ID:polarsys,項目名稱:time4sys,代碼行數:26,代碼來源:HardwareInterfacePackagePropertiesEditionComponent.java

示例4: loadManifest

import org.eclipse.emf.common.util.WrappedException; //導入依賴的package包/類
ProjectDescription loadManifest(URI manifest) {
	try {
		ProjectDescription result = null;
		ResourceSet resourceSet = resourceSetProvider.get(null /* we don't care about the project right now */);
		String platformPath = manifest.toPlatformString(true);
		if (manifest.isArchive() || platformPath != null) {
			if (manifest.isArchive() || workspace.getFile(new Path(platformPath)).exists()) {
				Resource resource = resourceSet.getResource(manifest, true);
				if (resource != null) {
					List<EObject> contents = resource.getContents();
					if (contents.isEmpty() || !(contents.get(0) instanceof ProjectDescription)) {
						return null;
					}
					result = (ProjectDescription) contents.get(0);
					contents.clear();
				}
			}
		}
		return result;
	} catch (WrappedException e) {
		throw new IllegalStateException("Unexpected manifest URI: " + manifest, e);
	}
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:24,代碼來源:EclipseBasedN4JSWorkspace.java

示例5: shouldGenerate

import org.eclipse.emf.common.util.WrappedException; //導入依賴的package包/類
private boolean shouldGenerate(Resource resource, IProject aProject) {
	try {
		Iterable<Pair<IStorage, IProject>> storages = storage2UriMapper.getStorages(resource.getURI());
		for (Pair<IStorage, IProject> pair : storages) {
			if (pair.getFirst() instanceof IFile && pair.getSecond().equals(aProject)) {
				IFile file = (IFile) pair.getFirst();
				int findMaxProblemSeverity = file.findMaxProblemSeverity(null, true, IResource.DEPTH_INFINITE);
				// If the generator itself placed an error marker on the resource, we have to ignore that error.
				// Easiest way here is to remove that error marker-type and look for other severe errors once more:
				if (findMaxProblemSeverity == IMarker.SEVERITY_ERROR) {
					// clean
					GeneratorMarkerSupport generatorMarkerSupport = injector
							.getInstance(GeneratorMarkerSupport.class);
					generatorMarkerSupport.deleteMarker(resource);
					// and recompute:
					findMaxProblemSeverity = file.findMaxProblemSeverity(null, true, IResource.DEPTH_INFINITE);
				}
				// the final decision to build:
				return findMaxProblemSeverity != IMarker.SEVERITY_ERROR;
			}
		}
		return false;
	} catch (CoreException exc) {
		throw new WrappedException(exc);
	}
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:27,代碼來源:BuildInstruction.java

示例6: toLaunchConfiguration

import org.eclipse.emf.common.util.WrappedException; //導入依賴的package包/類
/**
 * Converts a {@link TestConfiguration} to an {@link ILaunchConfiguration}. Will throw a {@link WrappedException} in
 * case of error.
 *
 * @see TestConfiguration#readPersistentValues()
 */
public ILaunchConfiguration toLaunchConfiguration(ILaunchConfigurationType type, TestConfiguration testConfig) {
	try {
		final ILaunchConfiguration[] configs = DebugPlugin.getDefault().getLaunchManager()
				.getLaunchConfigurations(type);

		for (ILaunchConfiguration config : configs) {
			if (equals(testConfig, config))
				return config;
		}

		final IContainer container = null;
		final ILaunchConfigurationWorkingCopy workingCopy = type.newInstance(container, testConfig.getName());

		workingCopy.setAttributes(testConfig.readPersistentValues());

		return workingCopy.doSave();
	} catch (Exception e) {
		throw new WrappedException("could not convert N4JS TestConfiguration to Eclipse ILaunchConfiguration", e);
	}
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:27,代碼來源:TestConfigurationConverter.java

示例7: toLaunchConfiguration

import org.eclipse.emf.common.util.WrappedException; //導入依賴的package包/類
/**
 * Converts a {@link RunConfiguration} to an {@link ILaunchConfiguration}. Will throw a {@link WrappedException} in
 * case of error.
 *
 * @see RunConfiguration#readPersistentValues()
 */
public ILaunchConfiguration toLaunchConfiguration(ILaunchConfigurationType type, RunConfiguration runConfig) {
	try {
		final ILaunchConfiguration[] configs = DebugPlugin.getDefault().getLaunchManager()
				.getLaunchConfigurations(type);

		for (ILaunchConfiguration config : configs) {
			if (equals(runConfig, config))
				return config;
		}

		final IContainer container = null;
		final ILaunchConfigurationWorkingCopy workingCopy = type.newInstance(container, runConfig.getName());

		workingCopy.setAttributes(runConfig.readPersistentValues());

		return workingCopy.doSave();
	} catch (Exception e) {
		throw new WrappedException("could not convert N4JS RunConfiguration to Eclipse ILaunchConfiguration", e);
	}
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:27,代碼來源:RunConfigurationConverter.java

示例8: getRunnerId

import org.eclipse.emf.common.util.WrappedException; //導入依賴的package包/類
/**
 * Read the N4JS runner ID from the given Eclipse launch configuration. Will throw exceptions if 'failFast' is
 * <code>true</code>, otherwise will return <code>null</code> in case of error.
 */
public static String getRunnerId(ILaunchConfiguration launchConfig, boolean failFast) {
	try {
		// 1) simple case: runnerId already defined in launchConfig
		final String id = launchConfig.getAttribute(RunConfiguration.RUNNER_ID, (String) null);
		if (id != null)
			return id;
		// 2) tricky case: not set yet, so have to go via the ILaunchConfigurationType or the launchConfig
		final ILaunchConfigurationType launchConfigType = launchConfig.getType();
		return getRunnerId(launchConfigType, failFast);
	} catch (CoreException e) {
		if (failFast)
			throw new WrappedException(e);
		return null;
	}
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:20,代碼來源:RunnerUiUtils.java

示例9: validateValue

import org.eclipse.emf.common.util.WrappedException; //導入依賴的package包/類
/**
 * {@inheritDoc}
 * 
 * @see org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent#validateValue(org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent)
 * 
 */
public Diagnostic validateValue(IPropertiesEditionEvent event) {
	Diagnostic ret = Diagnostic.OK_INSTANCE;
	if (event.getNewValue() != null) {
		try {
			if (MetamodelViewsRepository.Poisson.Properties.interval == event.getAffectedEditor()) {
				Object newValue = event.getNewValue();
				if (newValue instanceof String) {
					newValue = EEFConverterUtil.createFromString(MetamodelPackage.eINSTANCE.getPoisson_Interval().getEAttributeType(), (String)newValue);
				}
				ret = Diagnostician.INSTANCE.validate(MetamodelPackage.eINSTANCE.getPoisson_Interval().getEAttributeType(), newValue);
			}
		} catch (IllegalArgumentException iae) {
			ret = BasicDiagnostic.toDiagnostic(iae);
		} catch (WrappedException we) {
			ret = BasicDiagnostic.toDiagnostic(we);
		}
	}
	return ret;
}
 
開發者ID:cetic,項目名稱:SimQRI,代碼行數:26,代碼來源:PoissonPropertiesEditionComponent.java

示例10: validateValue

import org.eclipse.emf.common.util.WrappedException; //導入依賴的package包/類
/**
 * {@inheritDoc}
 * 
 * @see org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent#validateValue(org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent)
 * 
 */
public Diagnostic validateValue(IPropertiesEditionEvent event) {
	Diagnostic ret = Diagnostic.OK_INSTANCE;
	if (event.getNewValue() != null) {
		try {
			if (MetamodelViewsRepository.Model.Properties.name == event.getAffectedEditor()) {
				Object newValue = event.getNewValue();
				if (newValue instanceof String) {
					newValue = EEFConverterUtil.createFromString(MetamodelPackage.eINSTANCE.getModel_Name().getEAttributeType(), (String)newValue);
				}
				ret = Diagnostician.INSTANCE.validate(MetamodelPackage.eINSTANCE.getModel_Name().getEAttributeType(), newValue);
			}
		} catch (IllegalArgumentException iae) {
			ret = BasicDiagnostic.toDiagnostic(iae);
		} catch (WrappedException we) {
			ret = BasicDiagnostic.toDiagnostic(we);
		}
	}
	return ret;
}
 
開發者ID:cetic,項目名稱:SimQRI,代碼行數:26,代碼來源:ModelPropertiesEditionComponent.java

示例11: validateValue

import org.eclipse.emf.common.util.WrappedException; //導入依賴的package包/類
/**
 * {@inheritDoc}
 * 
 * @see org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent#validateValue(org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent)
 * @generated
 */
public Diagnostic validateValue(IPropertiesEditionEvent event) {
	Diagnostic ret = Diagnostic.OK_INSTANCE;
	if (event.getNewValue() != null) {
		try {
			if (DesignViewsRepository.DesignModel.Properties.name == event.getAffectedEditor()) {
				Object newValue = event.getNewValue();
				if (newValue instanceof String) {
					newValue = EEFConverterUtil.createFromString(DesignPackage.eINSTANCE.getDesignModel_Name().getEAttributeType(), (String)newValue);
				}
				ret = Diagnostician.INSTANCE.validate(DesignPackage.eINSTANCE.getDesignModel_Name().getEAttributeType(), newValue);
			}
		} catch (IllegalArgumentException iae) {
			ret = BasicDiagnostic.toDiagnostic(iae);
		} catch (WrappedException we) {
			ret = BasicDiagnostic.toDiagnostic(we);
		}
	}
	return ret;
}
 
開發者ID:polarsys,項目名稱:time4sys,代碼行數:26,代碼來源:DesignModelPropertiesEditionComponent.java

示例12: validateValue

import org.eclipse.emf.common.util.WrappedException; //導入依賴的package包/類
/**
 * {@inheritDoc}
 * 
 * @see org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent#validateValue(org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent)
 * 
 */
public Diagnostic validateValue(IPropertiesEditionEvent event) {
	Diagnostic ret = Diagnostic.OK_INSTANCE;
	if (event.getNewValue() != null) {
		try {
			if (GrmViewsRepository.Timing.TimingProperties.execTime == event.getAffectedEditor()) {
				Object newValue = event.getNewValue();
				if (newValue instanceof String) {
					newValue = EEFConverterUtil.createFromString(GrmPackage.eINSTANCE.getUsageTypedAmount_ExecTime().getEAttributeType(), (String)newValue);
				}
				ret = Diagnostician.INSTANCE.validate(GrmPackage.eINSTANCE.getUsageTypedAmount_ExecTime().getEAttributeType(), newValue);
			}
		} catch (IllegalArgumentException iae) {
			ret = BasicDiagnostic.toDiagnostic(iae);
		} catch (WrappedException we) {
			ret = BasicDiagnostic.toDiagnostic(we);
		}
	}
	return ret;
}
 
開發者ID:polarsys,項目名稱:time4sys,代碼行數:26,代碼來源:UsageTypedAmountTimingPropertiesEditionComponent.java

示例13: validateValue

import org.eclipse.emf.common.util.WrappedException; //導入依賴的package包/類
/**
 * {@inheritDoc}
 * 
 * @see org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent#validateValue(org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent)
 * 
 */
public Diagnostic validateValue(IPropertiesEditionEvent event) {
	Diagnostic ret = Diagnostic.OK_INSTANCE;
	if (event.getNewValue() != null) {
		try {
			if (GrmViewsRepository.General.Properties.event == event.getAffectedEditor()) {
				Object newValue = event.getNewValue();
				if (newValue instanceof String) {
					newValue = EEFConverterUtil.createFromString(GrmPackage.eINSTANCE.getUsageDemand_Event().getEAttributeType(), (String)newValue);
				}
				ret = Diagnostician.INSTANCE.validate(GrmPackage.eINSTANCE.getUsageDemand_Event().getEAttributeType(), newValue);
			}
		} catch (IllegalArgumentException iae) {
			ret = BasicDiagnostic.toDiagnostic(iae);
		} catch (WrappedException we) {
			ret = BasicDiagnostic.toDiagnostic(we);
		}
	}
	return ret;
}
 
開發者ID:polarsys,項目名稱:time4sys,代碼行數:26,代碼來源:UsageDemandPropertiesEditionComponent.java

示例14: validateValue

import org.eclipse.emf.common.util.WrappedException; //導入依賴的package包/類
/**
 * {@inheritDoc}
 * 
 * @see org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent#validateValue(org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent)
 * 
 */
public Diagnostic validateValue(IPropertiesEditionEvent event) {
	Diagnostic ret = Diagnostic.OK_INSTANCE;
	if (event.getNewValue() != null) {
		try {
			if (HrmViewsRepository.Timing.TimingProperties.timings == event.getAffectedEditor()) {
				BasicDiagnostic chain = new BasicDiagnostic();
				for (Iterator iterator = ((List)event.getNewValue()).iterator(); iterator.hasNext();) {
					chain.add(Diagnostician.INSTANCE.validate(HrmPackage.eINSTANCE.getHardwareMemory_Timings().getEAttributeType(), iterator.next()));
				}
				ret = chain;
			}
		} catch (IllegalArgumentException iae) {
			ret = BasicDiagnostic.toDiagnostic(iae);
		} catch (WrappedException we) {
			ret = BasicDiagnostic.toDiagnostic(we);
		}
	}
	return ret;
}
 
開發者ID:polarsys,項目名稱:time4sys,代碼行數:26,代碼來源:HardwareMemoryTimingPropertiesEditionComponent.java

示例15: validateValue

import org.eclipse.emf.common.util.WrappedException; //導入依賴的package包/類
/**
 * {@inheritDoc}
 * 
 * @see org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent#validateValue(org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent)
 * 
 */
public Diagnostic validateValue(IPropertiesEditionEvent event) {
	Diagnostic ret = Diagnostic.OK_INSTANCE;
	if (event.getNewValue() != null) {
		try {
			if (GrmViewsRepository.General.Properties.name == event.getAffectedEditor()) {
				Object newValue = event.getNewValue();
				if (newValue instanceof String) {
					newValue = EEFConverterUtil.createFromString(GrmPackage.eINSTANCE.getNamedElement_Name().getEAttributeType(), (String)newValue);
				}
				ret = Diagnostician.INSTANCE.validate(GrmPackage.eINSTANCE.getNamedElement_Name().getEAttributeType(), newValue);
			}
		} catch (IllegalArgumentException iae) {
			ret = BasicDiagnostic.toDiagnostic(iae);
		} catch (WrappedException we) {
			ret = BasicDiagnostic.toDiagnostic(we);
		}
	}
	return ret;
}
 
開發者ID:polarsys,項目名稱:time4sys,代碼行數:26,代碼來源:ProtectionParameterGeneralPropertiesEditionComponent.java


注:本文中的org.eclipse.emf.common.util.WrappedException類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。