SourceCodeEditor.java

Go to the documentation of this file.
00001 package edu.rice.cs.hpc.viewer.editor;
00002 
00003 import org.eclipse.ui.editors.text.TextEditor;
00004 import org.eclipse.ui.ide.FileStoreEditorInput;
00005 import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
00006 
00007 import edu.rice.cs.hpc.data.experiment.Experiment;
00012 public class SourceCodeEditor extends TextEditor implements IViewerEditor {
00013     static public String ID = "edu.rice.cs.hpc.viewer.util.SourceCodeEditor";  
00014     private Experiment _experiment;
00015     
00016     public SourceCodeEditor() {
00017         super();
00018     }
00019     
00020     public void setExperiment(Experiment experiment) {
00021         this._experiment = experiment;
00022     }
00023     
00028     public boolean validateEditorInputState() {
00029         // the inpus is never validated 
00030         return false;
00031     }
00032 
00037     protected boolean isLineNumberRulerVisible() {
00038         this.getPreferenceStore().setValue(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER, true);
00039         return true;
00040     }
00041     
00042     public void setPartNamePrefix(String partNamePrefix) {
00043         String partName = super.getPartName();
00044         if (partName.startsWith(partNamePrefix)) {
00045             // this method gets called each time you click the program scope but if the source file editor is 
00046             // already open we have already put the database number in the title and we do not want to do it again.
00047             return;
00048         }
00049         super.setPartName(partNamePrefix + partName);
00050         return;
00051     }
00052     
00057     public boolean isEditable() {
00058         return false;
00059     }
00060 
00061     public String getEditorPartName() {
00062         final FileStoreEditorInput input = (FileStoreEditorInput) this.getEditorInput();
00063         final String name = input.getName();
00064         return name;
00065     }
00066 
00067     public void setEditorPartName(String title) {
00068         this.setPartName(title);
00069         return;
00070     }
00071 
00072     public Experiment getExperiment() {
00073         return _experiment;
00074     }
00075 }

Generated on 5 May 2015 for HPCVIEWER by  doxygen 1.6.1