org.eclipse.core.commands.ParameterValueConversionException Java Examples
The following examples show how to use
org.eclipse.core.commands.ParameterValueConversionException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CommandUtils.java From birt with Eclipse Public License 1.0 | 6 votes |
public static Parameterization createParameter( Command command, String parameterId, Object value ) throws NotDefinedException, ExecutionException, ParameterValueConversionException { ParameterType parameterType = command.getParameterType( parameterId ); if ( parameterType == null ) { throw new ExecutionException( "Command does not have a parameter type for the given parameter" ); //$NON-NLS-1$ } IParameter param = command.getParameter( parameterId ); AbstractParameterValueConverter valueConverter = parameterType.getValueConverter( ); if ( valueConverter == null ) { throw new ExecutionException( "Command does not have a value converter" ); //$NON-NLS-1$ } String valueString = valueConverter.convertToString( value ); Parameterization parm = new Parameterization( param, valueString ); return parm; }
Example #2
Source File: ParameterConverter.java From neoscada with Eclipse Public License 1.0 | 5 votes |
@Override public String convertToString ( final Object parameterValue ) throws ParameterValueConversionException { if ( parameterValue instanceof Map ) { final Gson gson = this.builder.create (); return gson.toJson ( parameterValue ); } throw new ParameterValueConversionException ( "Unable to convert type " + parameterValue.getClass () ); }
Example #3
Source File: TreeToStringConverter.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
@Override public String convertToString(Object parameterValue) throws ParameterValueConversionException{ if (parameterValue instanceof Tree) { String ret = StringTool.unique(getClass().getName()); map.put(ret, (Tree<?>) parameterValue); return ret; } throw new ParameterValueConversionException("Parameter was not instance of Tree"); }
Example #4
Source File: StringConverter.java From e4macs with Eclipse Public License 1.0 | 5 votes |
/** * @see org.eclipse.core.commands.AbstractParameterValueConverter#convertToString(java.lang.Object) */ @Override public String convertToString(Object parameterValue) throws ParameterValueConversionException { String result = EmacsPlusUtils.EMPTY_STR; if (parameterValue != null) { result = parameterValue.toString(); } return result; }
Example #5
Source File: IntegerConverter.java From e4macs with Eclipse Public License 1.0 | 5 votes |
/** * @see org.eclipse.core.commands.AbstractParameterValueConverter#convertToString(java.lang.Object) */ @Override public String convertToString(Object parameterValue) throws ParameterValueConversionException { String result = "1"; //$NON-NLS-1$ // default to 1 execution if (parameterValue instanceof Integer) { result = ((Integer)parameterValue).toString(); } else if (parameterValue instanceof String) { result = (String)parameterValue; } return result; }
Example #6
Source File: IntegerConverter.java From e4macs with Eclipse Public License 1.0 | 5 votes |
/** * @see org.eclipse.core.commands.AbstractParameterValueConverter#convertToObject(java.lang.String) */ @Override public Object convertToObject(String parameterValue) throws ParameterValueConversionException { Integer result = null; try { result = Integer.valueOf(parameterValue); } catch (NumberFormatException e) { result = Integer.valueOf(1); } return result; }
Example #7
Source File: IntegerConverter.java From birt with Eclipse Public License 1.0 | 5 votes |
public String convertToString( Object parameterValue ) throws ParameterValueConversionException { String retString = ""; //$NON-NLS-1$ Integer integer = (Integer)parameterValue; retString = integer.toString(); return retString; }
Example #8
Source File: CommandUtils.java From birt with Eclipse Public License 1.0 | 5 votes |
public static Object executeCommand( String commandId, Map paramMap ) throws NotDefinedException, ExecutionException, ParameterValueConversionException, NotEnabledException, NotHandledException { Command cmd = CommandUtils.getCommand( commandId ); List paramList = new ArrayList( ); if ( paramMap != null ) { for ( Iterator iter = paramMap.entrySet( ).iterator( ); iter.hasNext( ); ) { Map.Entry entry = (Entry) iter.next( ); String paramId = entry.getKey( ).toString( ); Object value = entry.getValue( ); if ( value != null ) { paramList.add( createParameter( cmd, paramId, value ) ); } } } if ( paramList.size( ) > 0 ) { ParameterizedCommand paramCommand = new ParameterizedCommand( cmd, (Parameterization[]) paramList.toArray( new Parameterization[paramList.size( )] ) ); return getHandlerService( ).executeCommand( paramCommand, null ); } else { return getHandlerService( ).executeCommand( commandId, null ); } }
Example #9
Source File: SlotHandleConverter.java From birt with Eclipse Public License 1.0 | 5 votes |
public Object convertToObject( String parameterValue ) throws ParameterValueConversionException { String elementId = parameterValue.substring( 0, parameterValue.indexOf( "#" ) ); //$NON-NLS-1$ String slotId = parameterValue.substring( parameterValue.indexOf( "#" ) + 1, //$NON-NLS-1$ parameterValue.length( ) ); return SessionHandleAdapter.getInstance( ) .getReportDesignHandle( ) .getElementByID( Long.parseLong( elementId ) ) .getSlot( Integer.parseInt( slotId ) ); }
Example #10
Source File: SlotHandleConverter.java From birt with Eclipse Public License 1.0 | 5 votes |
public String convertToString( Object parameterValue ) throws ParameterValueConversionException { return ( (SlotHandle) parameterValue ).getElement( ).getID( ) + "#" //$NON-NLS-1$ + ( (SlotHandle) parameterValue ).getSlotID( ); }
Example #11
Source File: StringConverter.java From e4macs with Eclipse Public License 1.0 | 4 votes |
/** * @see org.eclipse.core.commands.AbstractParameterValueConverter#convertToObject(java.lang.String) */ @Override public Object convertToObject(String parameterValue) throws ParameterValueConversionException { return parameterValue; }
Example #12
Source File: ParameterConverter.java From neoscada with Eclipse Public License 1.0 | 4 votes |
@Override public Object convertToObject ( final String parameterValue ) throws ParameterValueConversionException { final Gson gson = this.builder.create (); return gson.fromJson ( parameterValue, new TypeToken<Map<String, String>> () {}.getType () ); }
Example #13
Source File: TreeToStringConverter.java From elexis-3-core with Eclipse Public License 1.0 | 4 votes |
@Override public Object convertToObject(String parameterValue) throws ParameterValueConversionException{ Tree<?> ret = map.get(parameterValue); return ret; }
Example #14
Source File: PersistentObjectConverter.java From elexis-3-core with Eclipse Public License 1.0 | 4 votes |
@Override public String convertToString(Object parameterValue) throws ParameterValueConversionException{ return ((PersistentObject) parameterValue).storeToString(); }
Example #15
Source File: PersistentObjectConverter.java From elexis-3-core with Eclipse Public License 1.0 | 4 votes |
@Override public Object convertToObject(String parameterValue) throws ParameterValueConversionException{ return CoreHub.poFactory.createFromString(parameterValue); }
Example #16
Source File: ErstelleRnnCommand.java From elexis-3-core with Eclipse Public License 1.0 | 4 votes |
@SuppressWarnings("unchecked") public Object execute(ExecutionEvent eev) throws ExecutionException{ Tree<?> tSelection = null; String px = eev.getParameter("ch.elexis.RechnungErstellen.parameter"); //$NON-NLS-1$ try { tSelection = (Tree<?>) new TreeToStringConverter().convertToObject(px); } catch (ParameterValueConversionException pe) { throw new ExecutionException("Bad parameter " + pe.getMessage()); //$NON-NLS-1$ } IProgressMonitor monitor = Handler.getMonitor(eev); Result<Rechnung> res = null; for (Tree tPat = tSelection.getFirstChild(); tPat != null; tPat = tPat.getNextSibling()) { int rejected = 0; for (Tree tFall = tPat.getFirstChild(); tFall != null; tFall = tFall.getNextSibling()) { Fall fall = (Fall) tFall.contents; if (CoreHub.userCfg.get(Preferences.LEISTUNGSCODES_BILLING_STRICT, true)) { if (!fall.isValid()) { rejected++; continue; } } Collection<Tree> lt = tFall.getChildren(); List<Konsultation> toBill = new ArrayList<Konsultation>(lt.size() + 1); for (Tree t : lt) { toBill.add((Konsultation) t.contents); } Map<Integer, List<Konsultation>> sortedByYears = BillingUtil.getSortedByYear(toBill); if (!BillingUtil.canBillYears(new ArrayList<>(sortedByYears.keySet()))) { StringJoiner sj = new StringJoiner(", "); sortedByYears.keySet().forEach(i -> sj.add(Integer.toString(i))); if (MessageDialog.openQuestion(Display.getDefault().getActiveShell(), "Rechnung Validierung", "Die Leistungen sind aus Jahren die nicht kombinierbar sind.\n\nWollen Sie separate Rechnungen für die Jahre " + sj.toString() + " erstellen?")) { // bill each year separately for (Integer year : sortedByYears.keySet()) { res = Rechnung.build(sortedByYears.get(year)); if (monitor != null) { monitor.worked(1); } if (!res.isOK()) { ErrorDialog.openError(HandlerUtil.getActiveShell(eev), Messages.KonsZumVerrechnenView_errorInInvoice, NLS.bind(Messages.KonsZumVerrechnenView_invoiceForCase, new Object[] { fall.getLabel(), fall.getPatient().getLabel() }), ResultAdapter.getResultAsStatus(res)); } else { tPat.remove(tFall); } } } } else { res = Rechnung.build(toBill); if (monitor != null) { monitor.worked(1); } if (!res.isOK()) { ErrorDialog.openError(HandlerUtil.getActiveShell(eev), Messages.KonsZumVerrechnenView_errorInInvoice, NLS.bind(Messages.KonsZumVerrechnenView_invoiceForCase, new Object[] { fall.getLabel(), fall.getPatient().getLabel() }), ResultAdapter.getResultAsStatus(res)); } else { tPat.remove(tFall); } } } if (rejected != 0) { SWTHelper.showError(Messages.ErstelleRnnCommand_BadCaseDefinition, Integer.toString(rejected) + Messages.ErstelleRnnCommand_BillsNotCreatedMissingData + Messages.ErstelleRnnCommand_ErstelleRnnCheckCaseDetails); } else { tSelection.remove(tPat); } } return res; }
Example #17
Source File: BooleanConverter.java From e4macs with Eclipse Public License 1.0 | 4 votes |
/** * @see org.eclipse.core.commands.AbstractParameterValueConverter#convertToString(java.lang.Object) */ @Override public String convertToString(Object parameterValue) throws ParameterValueConversionException { return parameterValue.toString(); }
Example #18
Source File: BooleanConverter.java From e4macs with Eclipse Public License 1.0 | 4 votes |
/** * @see org.eclipse.core.commands.AbstractParameterValueConverter#convertToObject(java.lang.String) */ @Override public Object convertToObject(String parameterValue) throws ParameterValueConversionException { return Boolean.valueOf(parameterValue); }
Example #19
Source File: JavaElementReferenceConverter.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
@Override public String convertToString(Object parameterValue) throws ParameterValueConversionException { if (!(parameterValue instanceof IJavaElement)) { throw new ParameterValueConversionException("parameterValue must be an IJavaElement"); //$NON-NLS-1$ } IJavaElement javaElement= (IJavaElement) parameterValue; IJavaProject javaProject= javaElement.getJavaProject(); if (javaProject == null) { throw new ParameterValueConversionException("Could not get IJavaProject for element"); //$NON-NLS-1$ } StringBuffer buffer; if (javaElement instanceof IType) { IType type= (IType) javaElement; buffer= composeTypeReference(type); } else if (javaElement instanceof IMethod) { IMethod method= (IMethod) javaElement; buffer= composeTypeReference(method.getDeclaringType()); buffer.append(TYPE_END_CHAR); buffer.append(method.getElementName()); String[] parameterTypes= method.getParameterTypes(); buffer.append(PARAM_START_CHAR); for (int i= 0; i < parameterTypes.length; i++) { buffer.append(parameterTypes[i]); } buffer.append(PARAM_END_CHAR); } else if (javaElement instanceof IField) { IField field= (IField) javaElement; buffer= composeTypeReference(field.getDeclaringType()); buffer.append(TYPE_END_CHAR); buffer.append(field.getElementName()); } else { throw new ParameterValueConversionException("Unsupported IJavaElement type"); //$NON-NLS-1$ } return buffer.toString(); }
Example #20
Source File: BooleanConverter.java From birt with Eclipse Public License 1.0 | 4 votes |
public String convertToString( Object parameterValue ) throws ParameterValueConversionException { boolean value = ((Boolean)parameterValue).booleanValue( ); return Boolean.toString( value ); }
Example #21
Source File: BooleanConverter.java From birt with Eclipse Public License 1.0 | 4 votes |
public Object convertToObject( String parameterValue ) throws ParameterValueConversionException { return Boolean.valueOf( parameterValue ); }
Example #22
Source File: StringConverter.java From birt with Eclipse Public License 1.0 | 4 votes |
public String convertToString( Object parameterValue ) throws ParameterValueConversionException { return parameterValue != null ? parameterValue.toString( ) : ""; //$NON-NLS-1$ }
Example #23
Source File: StringConverter.java From birt with Eclipse Public License 1.0 | 4 votes |
public Object convertToObject( String parameterValue ) throws ParameterValueConversionException { return parameterValue; }
Example #24
Source File: IntegerConverter.java From birt with Eclipse Public License 1.0 | 4 votes |
public Object convertToObject( String parameterValue ) throws ParameterValueConversionException { return new Integer(parameterValue); }
Example #25
Source File: JavaElementReferenceConverter.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 2 votes |
/** * Throws a <code>ParameterValueConversionException</code> if the java * element reference string does not meet some well-formedness condition. * * @param assertion * a boolean check for well-formedness * @throws ParameterValueConversionException */ private void assertWellFormed(boolean assertion) throws ParameterValueConversionException { if (!assertion) { throw new ParameterValueConversionException("Malformed parameterValue"); //$NON-NLS-1$ } }
Example #26
Source File: JavaElementReferenceConverter.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 2 votes |
/** * Throws a <code>ParameterValueConversionException</code> if the java * element reference string identifies an element that does not exist. * * @param javaElement * an element to check for existence * @throws ParameterValueConversionException */ private void assertExists(IJavaElement javaElement) throws ParameterValueConversionException { if ((javaElement == null) || (!javaElement.exists())) { throw new ParameterValueConversionException("parameterValue must reference an existing IJavaElement"); //$NON-NLS-1$ } }