/** * 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$ } }
private void validate() { String text = fParameterText.getText(); String error = null; if (text.length() > 0) { try { fValueConverter.convertToObject(text); } catch (ParameterValueConversionException e1) { error = e1.getMessage(); } } if (error == null) fCCP.setMessage(null, IMessageProvider.NONE); else fCCP.setMessage(NLS.bind(PDEUIMessages.CommandDetails_paramValueMessage, fParameter.getName(), error), IMessageProvider.WARNING); } }
/** * 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$ } }
/** * 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$ } }
@Override public Object convertToObject(String parameterValue) throws ParameterValueConversionException { try { int i = Integer.parseInt(parameterValue); return Integer.valueOf(i); } catch (NumberFormatException ex) { throw new ParameterValueConversionException( "error converting to integer: " + parameterValue); //$NON-NLS-1$ } }
@Override public String convertToString(Object parameterValue) throws ParameterValueConversionException { if (!(parameterValue instanceof Integer)) { throw new ParameterValueConversionException( "value for conversion must be an Integer"); //$NON-NLS-1$ } Integer i = (Integer) parameterValue; return Integer.toString(i.intValue()); }
@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 () ); }
/** * Returns the real parameter value converter for this proxy or throws an * exception indicating the converter could not be obtained. * * @return the real converter for this proxy; never <code>null</code>. * @throws ParameterValueConversionException * if the converter could not be obtained */ private AbstractParameterValueConverter getConverter() throws ParameterValueConversionException { if (parameterValueConverter == null) { try { parameterValueConverter = (AbstractParameterValueConverter) converterConfigurationElement .createExecutableExtension(IWorkbenchRegistryConstants.ATT_CONVERTER); } catch (final CoreException e) { throw new ParameterValueConversionException( "Problem creating parameter value converter", e); //$NON-NLS-1$ } catch (final ClassCastException e) { throw new ParameterValueConversionException( "Parameter value converter was not a subclass of AbstractParameterValueConverter", e); //$NON-NLS-1$ } } return parameterValueConverter; } }
@Override public final String convertToString(final Object parameterValue) throws ParameterValueConversionException { if (!(parameterValue instanceof IResource)) { throw new ParameterValueConversionException( "parameterValue must be an IResource"); //$NON-NLS-1$ } final IResource resource = (IResource) parameterValue; return resource.getFullPath().toString(); } }
/** * 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$ } }
/** * 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$ } }
/** * 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$ } }
@Override public final Object convertToObject(final String parameterValue) throws ParameterValueConversionException { final Path path = new Path(parameterValue); final IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace() .getRoot(); final IResource resource = workspaceRoot.findMember(path); if ((resource == null) || (!resource.exists())) { throw new ParameterValueConversionException( "parameterValue must be the path of an existing resource"); //$NON-NLS-1$ } return resource; }
throw new ParameterValueConversionException("parameterValue must be an IJavaElement"); //$NON-NLS-1$ throw new ParameterValueConversionException("Could not get IJavaProject for element"); //$NON-NLS-1$ buffer.append(field.getElementName()); } else { throw new ParameterValueConversionException("Unsupported IJavaElement type"); //$NON-NLS-1$
public String convertToString(Object parameterValue) throws ParameterValueConversionException { throw new ParameterValueConversionException("parameterValue must be an IJavaElement"); //$NON-NLS-1$ throw new ParameterValueConversionException("Could not get IJavaProject for element"); //$NON-NLS-1$ buffer.append(field.getElementName()); } else { throw new ParameterValueConversionException("Unsupported IJavaElement type"); //$NON-NLS-1$
throw new ParameterValueConversionException("parameterValue must be an IJavaElement"); //$NON-NLS-1$ throw new ParameterValueConversionException("Could not get IJavaProject for element"); //$NON-NLS-1$ buffer.append(field.getElementName()); } else { throw new ParameterValueConversionException("Unsupported IJavaElement type"); //$NON-NLS-1$