当前位置: 首页>>代码示例>>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;未经允许,请勿转载。