Created
June 6, 2009 14:49
-
-
Save aqubi/124870 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void resourceChanged(final IResourceChangeEvent event) { | |
if (event.getType() == IResourceChangeEvent.POST_CHANGE) { | |
IResourceDelta rootDelta = event.getDelta(); | |
final IEditorInput input = getEditorInput(); | |
IFile file = ((IFileEditorInput) input).getFile(); | |
IPath filePath = file.getFullPath(); | |
IResourceDelta targetDelta = rootDelta.findMember(filePath); | |
if (targetDelta != null) { | |
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をファイルの情報から読込み直し | |
refreshGraphicalViewer(); | |
} | |
} | |
}); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment