summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchanghyun1.lee <changhyun1.lee@samsung.com>2014-07-17 23:36:43 +0900
committerchanghyun Lee <changhyun1.lee@samsung.com>2014-07-17 07:38:14 -0700
commitff0322526ae66f517abf8c92eb357590ae936043 (patch)
tree314f464f017cb0e3aa922ef61b2703800cae1418
parentd42c634b8904c2f39e84af6eb527a5688a5eaeaa (diff)
downloadcommon-eplugin-ff0322526ae66f517abf8c92eb357590ae936043.tar.gz
common-eplugin-ff0322526ae66f517abf8c92eb357590ae936043.tar.bz2
common-eplugin-ff0322526ae66f517abf8c92eb357590ae936043.zip
COMMON: Added refreshlocal method
- Check for current sync state of resource before refreshlocal Change-Id: I7467777183154a26b811ec0ae6854af4e8d9da9b Signed-off-by: changhyun1.lee <changhyun1.lee@samsung.com> (cherry picked from commit 17c463fb60858cd3c33f5db5b4b5de212d3b7bcc)
-rwxr-xr-xorg.tizen.common/src/org/tizen/common/util/SWTUtil.java26
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);
}
}