Changeset 4053


Ignore:
Timestamp:
Jan 10, 2009, 1:18:56 AM (12 years ago)
Author:
yura
Message:
  • Eclipse 3.2 compatibility (first step).
Location:
devel-tools/trunk/eclipse/org.refal.rfpdt.ui/src/org/refal/rfpdt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • devel-tools/trunk/eclipse/org.refal.rfpdt.ui/src/org/refal/rfpdt/editor/RfpEditor.java

    r4051 r4053  
    2121import org.eclipse.jface.text.source.Annotation;
    2222import org.eclipse.jface.text.source.IAnnotationModel;
    23 import org.eclipse.jface.text.source.IAnnotationModelExtension2;
    2423import org.eclipse.jface.text.source.ISourceViewer;
    2524import org.eclipse.jface.util.IPropertyChangeListener;
     
    7271        private final ArrayList<Annotation> annotations = new ArrayList<Annotation>();
    7372
    74         private Annotation getAnnotation(int offset, int length) {
    75             IAnnotationModel model= getDocumentProvider().getAnnotationModel(getEditorInput());
     73        private Annotation getAnnotation (int offset, int length) {
     74            IAnnotationModel model = getDocumentProvider().getAnnotationModel(getEditorInput());
    7675            if (model == null)
    7776                return null;
    78             Iterator<?> iterator;
    79             if (model instanceof IAnnotationModelExtension2)
    80                 iterator = ((IAnnotationModelExtension2)model).getAnnotationIterator(offset, length, true, true);
    81             else
    82                 iterator = model.getAnnotationIterator();
     77            Iterator<?> iterator = model.getAnnotationIterator();
    8378            while (iterator.hasNext()) {
    8479                Annotation annot = (Annotation) iterator.next();
     
    136131                }
    137132            }
    138         }       
     133        }
    139134    }
    140135
  • devel-tools/trunk/eclipse/org.refal.rfpdt.ui/src/org/refal/rfpdt/ui/wizards/NewRfpModulePage.java

    r3820 r4053  
    1717import org.eclipse.jdt.core.IJavaElement;
    1818import org.eclipse.jdt.core.IJavaProject;
     19import org.eclipse.jdt.core.IPackageFragmentRoot;
    1920import org.eclipse.jdt.ui.wizards.NewTypeWizardPage;
    2021import org.eclipse.jface.operation.IRunnableWithProgress;
     
    104105                buttonValue = button.getSelection();
    105106            }
    106            
     107
    107108        });
    108109
    109110        setControl(composite);
    110        
     111
    111112    }
    112113
     
    118119
    119120    private InputStream getInputStream () {
    120         String lineDelimiter = getProjectLineDelimiter(getJavaProject());
     121        String lineDelimiter = getProjectLineDelimiter(getProject());
    121122        StringBuffer buf = new StringBuffer();
    122123        buf.append("$module ");
    123124        String moduleName = getPackageText();
    124         if (! moduleName.equals(""))
     125        if (!moduleName.equals(""))
    125126            moduleName += '.';
    126127        moduleName += getTypeName();
     
    141142    }
    142143
    143     private static String getProjectLineDelimiter (IJavaProject javaProject) {
    144         IProject project = null;
    145         if (javaProject != null)
    146             project = javaProject.getProject();
    147 
    148         String lineDelimiter = getLineDelimiterPreference(project);
    149         if (lineDelimiter != null)
    150             return lineDelimiter;
    151 
    152         return System.getProperty("line.separator", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
    153     }
    154 
    155     private static String getLineDelimiterPreference (IProject project) {
     144    private IProject getProject () {
     145        IPackageFragmentRoot root = getPackageFragmentRoot();
     146        if (root == null)
     147            return null;
     148        IJavaProject javaProject = root.getJavaProject();
     149        if (javaProject == null)
     150            return null;
     151        return javaProject.getProject();
     152    }
     153
     154    private static String getProjectLineDelimiter (IProject project) {
    156155        IScopeContext[] scopeContext;
    157156        if (project != null) {
     
    166165        scopeContext = new IScopeContext[] { new InstanceScope() };
    167166        String platformDefault = System.getProperty("line.separator", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
    168         return Platform.getPreferencesService().getString(Platform.PI_RUNTIME, Platform.PREF_LINE_SEPARATOR,
    169                 platformDefault, scopeContext);
     167        String lineDelimiter = Platform.getPreferencesService().getString(Platform.PI_RUNTIME,
     168                Platform.PREF_LINE_SEPARATOR, platformDefault, scopeContext);
     169        if (lineDelimiter != null)
     170            return lineDelimiter;
     171        // system preference
     172        return System.getProperty("line.separator", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
    170173    }
    171174
    172175    public IFile createModule () throws CoreException, InterruptedException {
    173         final IFile file = RfpCore.getRfpProject(getJavaProject().getProject()).getSource(
    174                 getPackageFragmentRoot().getPath(), getPackageText() + '.' + getTypeName(), "rf");
     176        final IFile file = RfpCore.getRfpProject(getProject()).getSource(getPackageFragmentRoot().getPath(),
     177                getPackageText() + '.' + getTypeName(), "rf");
    175178        IRunnableWithProgress op = new IRunnableWithProgress() {
    176179            public void run (IProgressMonitor monitor) {
Note: See TracChangeset for help on using the changeset viewer.