public boolean isFileChanged() { XModelObject o = getXModelObject(); IFile f1 = super.getFile(); if (o == null || o.getPath() == null) return false; IFile f2 = getFileByObject(o); return !f1.equals(f2); }
public void synchronize() { XModelObject o = getXModelObject(); IFile f1 = super.getFile(); if (o == null || o.getPath() == null) return; IFile f2 = getFileByObject(o); if (!f1.equals(f2) && f2 != null) hackSetFile(f2); }
public void revalidate() { IFile f = getFile(); if (f == null || f.equals(super.getFile())) return; try { Field field = FileEditorInput.class.getDeclaredField("file"); // $NON-NLS-1$ field.setAccessible(true); field.set(this, f); } catch (NoSuchFieldException e) { ModelUIPlugin.getPluginLog().logError(e); } catch (IllegalArgumentException e) { ModelUIPlugin.getPluginLog().logError(e); } catch (IllegalAccessException e) { ModelUIPlugin.getPluginLog().logError(e); } }
public boolean equals(Object o) { getXModelObject(); if (this == o) return true; if (o instanceof FileEditorInput) { if (getFile() == null) return false; FileEditorInput other = (FileEditorInput) o; IFile f1 = getFile(); IFile f2 = other.getFile(); if (f1 == null || f2 == null) return f1 == f2; if (f1.equals(f2)) return true; IPath loc1 = f1.getLocation(); IPath loc2 = f2.getLocation(); if (loc1 == null || loc2 == null) return loc1 == loc2; return loc1.equals(loc2); } if (o instanceof XModelObjectEditorInput) { return object.equals(((XModelObjectEditorInput) o).getXModelObject()); } return false; }