Changeset 4072 for devel-tools/trunk


Ignore:
Timestamp:
Feb 5, 2009, 5:18:29 PM (12 years ago)
Author:
yura
Message:
  • Check package name in NewRfpPackage?.
  • Name check is corrected (for dot at the end of name).
Location:
devel-tools/trunk/eclipse
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • devel-tools/trunk/eclipse/org.refal.rfpdt.core/src/org/refal/rfpdt/compiler/NameChecker.java

    r3888 r4072  
    106106            if (astName == null)
    107107                return null;
     108            if (astName.identifier.length() == 0 || astName.identifier.charAt(astName.identifier.length() - 1) == '.') {
     109                msgHandler.send(astName.pos, MsgCode.IllFormedName_X, astName.identifier);
     110                return null;
     111            }
    108112            for (String ident : astName.identifier.split("\\."))
    109113                if (!ident.matches("[A-Za-z_]+\\w*")) {
  • devel-tools/trunk/eclipse/org.refal.rfpdt.ui/src/org/refal/rfpdt/ui/actions/RfpEditorActionMessages.java

    r4069 r4072  
    99
    1010    static {
    11         NLS.initializeMessages(RfpEditorActionMessages.class.getName(), RfpEditorActionMessages.class);
     11        NLS.initializeMessages(RfpEditorActionMessages.class.getCanonicalName(), RfpEditorActionMessages.class);
    1212    }
    1313
  • devel-tools/trunk/eclipse/org.refal.rfpdt.ui/src/org/refal/rfpdt/ui/wizards/NewRfpPackageWizard.java

    r4066 r4072  
    1717        // setDefaultPageImageDescriptor(JavaPluginImages.DESC_WIZBAN_NEWPACK);
    1818        setDialogSettings(RfpUI.getDefault().getDialogSettings());
    19         setWindowTitle("New Refal Plus Package");
     19        setWindowTitle(RfpWizardMessages.NewRfpPackageWizard_title);
    2020    }
    2121
  • devel-tools/trunk/eclipse/org.refal.rfpdt.ui/src/org/refal/rfpdt/ui/wizards/NewRfpPackageWizardPage.java

    r4071 r4072  
    1919    }
    2020
    21     private static IStatus getWarning (String message) {
    22         return new Status(IStatus.WARNING, RfpUI.PLUGIN_ID, message);
    23     }
    24 
    2521    private IStatus fPackageStatus;
    2622
     
    3834    }
    3935
    40     // ----------- validation ----------
    41 
    42     private IStatus validatePackageName (String text) {
    43         return Status.OK_STATUS;
    44         // IJavaProject project = getJavaProject();
    45         // if (project == null || !project.exists()) {
    46         // return JavaConventions.validatePackageName(text, JavaCore.VERSION_1_3, JavaCore.VERSION_1_3);
    47         // }
    48         // return JavaConventionsUtil.validatePackageName(text, project);
     36    private static boolean isPackageName (String name) {
     37        if (name.charAt(name.length() - 1) == '.')
     38            return false;
     39        for (String ident : name.split("\\."))
     40            if (!ident.matches("[A-Za-z_]+\\w*"))
     41                return false;
     42        return true;
    4943    }
    5044
    5145    private IStatus packageChanged () {
    52         IStatus status = Status.OK_STATUS;
    5346        String packageName = getPackageText();
    5447        if (packageName.length() > 0) {
    55             IStatus val = validatePackageName(packageName);
    56             if (val.getSeverity() == IStatus.ERROR)
    57                 return getError(RfpWizardMessages.NewRfpPackageWizardPage_error_InvalidPackageName + " "
    58                         + val.getMessage());
    59             else if (val.getSeverity() == IStatus.WARNING)
    60                 status = getWarning(RfpWizardMessages.NewRfpPackageWizardPage_warning_DiscouragedPackageName + " "
    61                         + val.getMessage());
     48            if (!isPackageName(packageName))
     49                return getError(RfpWizardMessages.NewRfpPackageWizardPage_error_InvalidPackageName);
    6250        } else
    6351            return getError(RfpWizardMessages.NewRfpPackageWizardPage_error_EnterName);
     
    9381            }
    9482        }
    95         return status;
     83        return Status.OK_STATUS;
    9684    }
    9785}
  • devel-tools/trunk/eclipse/org.refal.rfpdt.ui/src/org/refal/rfpdt/ui/wizards/RfpWizardMessages.java

    r4070 r4072  
    1212    }
    1313
     14    public static String NewRfpPackageWizard_title;
    1415    public static String NewRfpPackageWizardPage_title;
    1516    public static String NewRfpPackageWizardPage_description;
  • devel-tools/trunk/eclipse/org.refal.rfpdt.ui/src/org/refal/rfpdt/ui/wizards/RfpWizardMessages.properties

    r4070 r4072  
     1NewRfpPackageWizard_title = New Refal Plus Package
    12NewRfpPackageWizardPage_title = Refal Plus Package
    23NewRfpPackageWizardPage_description = Create a Refal Plus package
Note: See TracChangeset for help on using the changeset viewer.