private void createIsEclipseNLSCheckbox(Composite parent) { if (fNLSRefactoring.isEclipseNLS() || fNLSRefactoring.isEclipseNLSAvailable()) { fIsEclipseNLS= new Button(parent, SWT.CHECK); fIsEclipseNLS.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fIsEclipseNLS.setText(NLSUIMessages.ExternalizeWizardPage_isEclipseNLSCheckbox); fIsEclipseNLS.setSelection(fNLSRefactoring.isEclipseNLS()); fIsEclipseNLS.setEnabled(willCreateAccessorClass()); fIsEclipseNLS.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { super.widgetDefaultSelected(e); boolean isEclipseNLS= fIsEclipseNLS.getSelection(); fNLSRefactoring.setIsEclipseNLS(isEclipseNLS); updatePrefix(); } }); } }
private void createIsEclipseNLSCheckbox(Composite parent) { if (fNLSRefactoring.isEclipseNLS() || fNLSRefactoring.isEclipseNLSAvailable()) { fIsEclipseNLS= new Button(parent, SWT.CHECK); fIsEclipseNLS.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fIsEclipseNLS.setText(NLSUIMessages.ExternalizeWizardPage_isEclipseNLSCheckbox); fIsEclipseNLS.setSelection(fNLSRefactoring.isEclipseNLS()); fIsEclipseNLS.setEnabled(willCreateAccessorClass()); fIsEclipseNLS.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { super.widgetDefaultSelected(e); boolean isEclipseNLS= fIsEclipseNLS.getSelection(); fNLSRefactoring.setIsEclipseNLS(isEclipseNLS); updatePrefix(); } }); } }
/** * Computes whether the Eclipse NLSing mechanism is used. * * @return <code>true</code> if NLSing is done the Eclipse way * and <code>false</code> if the standard resource bundle mechanism is used * @since 3.1 */ public boolean detectIsEclipseNLS() { ICompilationUnit accessorCU= getAccessorClassPackage().getCompilationUnit(getAccessorCUName()); IType type= accessorCU.getType(getAccessorClassName()); if (type.exists()) { try { String superclassName= type.getSuperclassName(); if (!"NLS".equals(superclassName) && !NLS.class.getName().equals(superclassName)) //$NON-NLS-1$ return false; IType superclass= type.newSupertypeHierarchy(null).getSuperclass(type); return superclass != null && NLS.class.getName().equals(superclass.getFullyQualifiedName()); } catch (JavaModelException e) { // use default } } // Bug 271375: Make the default be to use Eclipse's NLS mechanism if it's available. return isEclipseNLSAvailable(); }
/** * Computes whether the Eclipse NLSing mechanism is used. * * @return <code>true</code> if NLSing is done the Eclipse way * and <code>false</code> if the standard resource bundle mechanism is used * @since 3.1 */ public boolean detectIsEclipseNLS() { ICompilationUnit accessorCU= getAccessorClassPackage().getCompilationUnit(getAccessorCUName()); IType type= accessorCU.getType(getAccessorClassName()); if (type.exists()) { try { String superclassName= type.getSuperclassName(); if (!"NLS".equals(superclassName) && !NLS.class.getName().equals(superclassName)) //$NON-NLS-1$ return false; IType superclass= type.newSupertypeHierarchy(null).getSuperclass(type); return superclass != null && NLS.class.getName().equals(superclass.getFullyQualifiedName()); } catch (JavaModelException e) { // use default } } // Bug 271375: Make the default be to use Eclipse's NLS mechanism if it's available. return isEclipseNLSAvailable(); }