source: trunk/org.modelica.mdt/src/org/modelica/mdt/ProjectsView.java @ 64

Last change on this file since 64 was 61, checked in by boris, 19 years ago
  • added copyright notice to all source files
File size: 2.7 KB
Line 
1/*
2 * This file is part of Modelica Development Tooling.
3 *
4 * Copyright (c) 2005, Linköpings universitet, Department of
5 * Computer and Information Science, PELAB
6 *
7 * All rights reserved.
8 *
9 * (The new BSD license, see also
10 * http://www.opensource.org/licenses/bsd-license.php)
11 *
12 *
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions are
15 * met:
16 *
17 * * Redistributions of source code must retain the above copyright
18 *   notice, this list of conditions and the following disclaimer.
19 *
20 * * Redistributions in binary form must reproduce the above copyright
21 *   notice, this list of conditions and the following disclaimer in
22 *   the documentation and/or other materials provided with the
23 *   distribution.
24 *
25 * * Neither the name of Linköpings universitet nor the names of its
26 *   contributors may be used to endorse or promote products derived from
27 *   this software without specific prior written permission.
28 *
29 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
30 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
31 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
32 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
33 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
34 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
35 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
36 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
37 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
39 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 */
41
42package org.modelica.mdt;
43
44
45import org.eclipse.core.resources.IFile;
46import org.eclipse.core.resources.IFolder;
47import org.eclipse.core.resources.IResource;
48import org.eclipse.jface.viewers.Viewer;
49import org.eclipse.jface.viewers.ViewerFilter;
50import org.eclipse.swt.widgets.Composite;
51import org.eclipse.ui.views.navigator.ResourceNavigator;
52
53public class ProjectsView extends ResourceNavigator
54{
55    public class ViewFilter extends ViewerFilter {
56
57        @Override
58        public boolean select(Viewer viewer, Object parentElement, Object element)
59        {
60            if ((element instanceof IFile) ||
61                (element instanceof IFolder))
62            {
63                return !((IResource)element).getName().startsWith("."); 
64            }
65            return true;
66        }
67
68
69    }
70
71    public void createPartControl(Composite parent)
72    {
73        super.createPartControl(parent);
74        this.getViewer().addFilter(new ViewFilter());
75    }
76}
Note: See TracBrowser for help on using the repository browser.