diff options
-rwxr-xr-x | org.tizen.common/src/org/tizen/common/util/SWTUtil.java | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/org.tizen.common/src/org/tizen/common/util/SWTUtil.java b/org.tizen.common/src/org/tizen/common/util/SWTUtil.java index 9b175145d..c66b30b5d 100755 --- a/org.tizen.common/src/org/tizen/common/util/SWTUtil.java +++ b/org.tizen.common/src/org/tizen/common/util/SWTUtil.java @@ -40,6 +40,8 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IWorkspaceRoot; import org.eclipse.core.runtime.CoreException; @@ -399,6 +401,28 @@ public class SWTUtil { return page.getEditorReferences(); } + public static void refreshLocal(IFile file, int depth) throws CoreException { + if ( file == null || !file.exists() || !file.isAccessible() ) { + return; + } + + if ( file.isSynchronized(depth) ) { + return; + } + + file.refreshLocal(depth, null); + } + + public static void refreshLocal(IProject project, int depth) throws CoreException { + if ( project == null || !project.exists() || !project.isAccessible() ) { + return; + } + if ( project.isSynchronized(depth) ) { + return; + } + project.refreshLocal(depth, null); + } + public static void refreshLocal() throws CoreException { final IEditorPart editor = SWTUtil.getActiveEditor(); if (editor != null && editor.getEditorInput() != null){ @@ -406,7 +430,7 @@ public class SWTUtil { if (input == null) { return; } - input.getFile().getProject().refreshLocal(IResource.DEPTH_INFINITE, null); + refreshLocal( input.getFile().getProject(), IResource.DEPTH_INFINITE); } } |