1 /*******************************************************************************
2 * Copyright (c) 2010 Ericsson
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Patrick Tasse - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.linuxtools
.tmf
.ui
.editors
;
15 import org
.eclipse
.core
.resources
.IFile
;
16 import org
.eclipse
.core
.runtime
.content
.IContentType
;
17 import org
.eclipse
.jface
.resource
.ImageDescriptor
;
18 import org
.eclipse
.linuxtools
.tmf
.core
.trace
.ITmfTrace
;
19 import org
.eclipse
.ui
.IEditorInput
;
20 import org
.eclipse
.ui
.IPersistableElement
;
21 import org
.eclipse
.ui
.PlatformUI
;
22 import org
.eclipse
.ui
.ide
.IDE
;
24 public class TmfEditorInput
implements IEditorInput
{
27 private ITmfTrace
<?
> fTrace
;
29 public TmfEditorInput(IFile file
, ITmfTrace
<?
> trace
) {
35 public Object
getAdapter(@SuppressWarnings("rawtypes") Class adapter
) {
40 public boolean exists() {
41 return fFile
.exists();
45 public ImageDescriptor
getImageDescriptor() {
46 IContentType contentType
= IDE
.getContentType(fFile
);
47 return PlatformUI
.getWorkbench().getEditorRegistry()
48 .getImageDescriptor(fFile
.getName(), contentType
);
52 public String
getName() {
53 return fTrace
.getName();
57 public IPersistableElement
getPersistable() {
62 public String
getToolTipText() {
63 return fFile
.getFullPath().makeRelative().toString();
66 public IFile
getFile() {
70 public ITmfTrace
<?
> getTrace() {
75 * @see java.lang.Object#hashCode()
78 public int hashCode() {
81 result
= prime
* result
+ ((fFile
== null) ?
0 : fFile
.getLocation().hashCode());
82 result
= prime
* result
+ ((fTrace
== null) ?
0 : fTrace
.getName().hashCode());
87 * @see java.lang.Object#equals(java.lang.Object)
90 public boolean equals(Object obj
) {
95 if (getClass() != obj
.getClass())
97 TmfEditorInput other
= (TmfEditorInput
) obj
;
99 if (other
.fFile
!= null)
101 } else if (!fFile
.getLocation().equals(other
.fFile
.getLocation()))
103 if (fTrace
== null) {
104 if (other
.fTrace
!= null)
106 } else if (!fTrace
.getName().equals(other
.fTrace
.getName()))
This page took 0.035489 seconds and 6 git commands to generate.