Changeset 1297

Show
Ignore:
Timestamp:
11/09/07 16:37:09 (1 year ago)
Author:
koshi
Message:

improved file separator.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • org.jalcedo.tools/trunk/org.jalcedo.tools.icon.manager.ui/src/org/jalcedo/tools/icon/manager/ui/internal/property/IconPropertyPage.java

    r1290 r1297  
    221221                    project.getElementName()+DEFAULT_PACKAGE, root, DEFAULT_ICON_DIR); 
    222222            iconListViewer.setInput(imageKeysModel.getList()); 
    223         } catch (Exception e) { 
     223        } catch (JavaModelException e) { 
    224224            image.setImage(Activator.getDefault().getImageRegistry().get("ERROR_TSK")); //$NON-NLS-1$ 
    225225            descriptionLabel.setText(Messages.getString("IconPropertyPage.getSourceDirError")); //$NON-NLS-1$ 
  • org.jalcedo.tools/trunk/org.jalcedo.tools.icon.manager.ui/src/org/jalcedo/tools/icon/manager/ui/internal/wizard/EditIconWizardPage.java

    r1296 r1297  
    519519         
    520520        public AvailableListContentProvider(){ 
    521             String separator = File.separator; 
    522521            try { 
    523                 if(Activator.getDefault().getBundle().getEntry(File.separator)==null){ 
    524                     separator = "/"; 
    525                 } 
    526                 pathLength = FileLocator.toFileURL(Activator.getDefault().getBundle().getEntry(separator)).getPath().length()-1; 
     522                pathLength = FileLocator.toFileURL(Activator.getDefault().getBundle().getEntry("/")).getPath().length()-1; 
    527523            } catch (IOException e) { 
    528524                MessageDialog.openError(getShell(), "Error", Messages.getString("EditIconWizardPage.getIconImageRootDirError")); //$NON-NLS-1$ 
     
    546542            for(int i=0; i<files.length; i++){ 
    547543                if(files[i].isFile()){ 
    548                     Icon icon = new Icon(files[i].toString().substring(pathLength)); 
    549                     if(!iconList.contains(icon)){ 
    550                         iconList.add(icon); 
    551                     } 
     544                    Icon icon = new Icon((files[i].toString().substring(pathLength)).replaceAll("\\"+File.separator, "/")); 
     545                    iconList.add(icon); 
    552546                } 
    553547                if(files[i].isDirectory()){ 
  • org.jalcedo.tools/trunk/org.jalcedo.tools.icon.manager/src/org/jalcedo/tools/icon/manager/model/IImageKeysModel.java

    r1289 r1297  
    1212package org.jalcedo.tools.icon.manager.model; 
    1313 
    14 import java.io.File; 
    1514import java.io.IOException; 
    1615import java.io.InputStream; 
     
    8281    @Override 
    8382    protected String createSource() { 
    84         String separator = File.separator; 
    85         if(separator.equalsIgnoreCase("\\")){ 
    86             separator += separator; 
    87         } 
    8883        IImageKeysGenerator generator = new IImageKeysGenerator(); 
    89         return generator.generate(getClassName(), getPackageName(), iconDirName+separator, getList()); 
     84        return generator.generate(getClassName(), getPackageName(), iconDirName+"/", getList()); 
    9085    } 
    9186     
     
    110105        for(Icon icon : iconList){ 
    111106            if(!orgIconList.contains(icon)){ 
    112                 if(File.separator.equalsIgnoreCase("\\")){ 
    113                     icon.setPath(icon.getPath().replaceAll("\\\\", "/")); 
    114                 } 
    115107                InputStream in = uiBundle.getEntry(icon.getPath()).openConnection().getInputStream(); 
    116108                IFile file = folder.getFile(icon.getName()); 
     
    149141            for(IField field : type.getFields()){ 
    150142                String path = field.getSource().substring(field.getSource().indexOf("\"")+1, field.getSource().lastIndexOf("\"")); 
    151                 Icon icon = new Icon(field.getElementName(), path.replaceAll("/", File.separator)); 
     143                Icon icon = new Icon(field.getElementName(), path); 
    152144                if(!iconList.contains(icon)){ 
    153145                    iconList.add(icon); 
  • org.jalcedo.tools/trunk/org.jalcedo.tools.icon.manager/src/org/jalcedo/tools/icon/manager/model/Icon.java

    r1289 r1297  
    11package org.jalcedo.tools.icon.manager.model; 
    22 
    3 import java.io.File; 
    43 
    54public class Icon { 
     
    1716     
    1817    public Icon(String key, String path){ 
    19         this(key, path, path.substring(path.lastIndexOf(File.separator)+1)); 
     18        this(key, path, path.substring(path.lastIndexOf("/")+1)); 
    2019    } 
    2120     
    2221    public Icon(String path){ 
    23         this((path.substring(path.lastIndexOf(File.separator)+1, path.lastIndexOf("."))).toUpperCase(), path); 
     22        this((path.substring(path.lastIndexOf("/")+1, path.lastIndexOf("."))).toUpperCase(), path); 
    2423    } 
    2524