blob: 7151156a8bdc607422f9aad89a34c5b74f29b2c2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
/*******************************************************************************
* Copyright (c) 2000, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.search.internal.ui;
import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
import org.eclipse.search.ui.ISearchResultViewEntry;
/**
* Implements basic UI support for Java elements.
* Implements handle to persistent support for Java elements.
* @deprecated old search
*/
@Deprecated
public class SearchResultViewEntryAdapterFactory implements IAdapterFactory {
private static Class[] PROPERTIES= new Class[] {
IResource.class, IMarker.class,
};
@Override
public Class[] getAdapterList() {
return PROPERTIES;
}
@Override
public Object getAdapter(Object element, Class key) {
ISearchResultViewEntry entry= (ISearchResultViewEntry) element;
if (IMarker.class.equals(key)) {
return entry.getSelectedMarker();
}
if (IResource.class.equals(key)) {
IResource resource= entry.getResource();
/*
* This is a trick to filter out dummy markers that
* have been attached to a project because there is no
* corresponding resource in the workspace.
*/
int type= resource.getType();
if (type != IResource.PROJECT && type != IResource.ROOT)
return resource;
}
return null;
}
}
|