Skip to content

Instantly share code, notes, and snippets.

@aqubi
Created May 9, 2009 18:12
Show Gist options
  • Save aqubi/109364 to your computer and use it in GitHub Desktop.
Save aqubi/109364 to your computer and use it in GitHub Desktop.
public void resourceChanged(final IResourceChangeEvent event) {
if (event.getType() == IResourceChangeEvent.POST_CHANGE) {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
IFile file = ((IFileEditorInput) input).getFile();
if (!file.exists()) {
// ファイル名が変更されていたら、EditorをCloseする
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
page.closeEditor(VisualMXMLEditor.this, false);
} else {
if (!getPartName().equals(file.getName())) {
//ファイル名が変わっていたらEditorPartの名前も変更する
setPartName(file.getName());
}
// GraphicalEditorをファイルの情報から読込み直し
refreshGraphicalEditor();
}
}
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment