Skip to content

Commit 1644e96

Browse files
author
angelozerr
committed
Fix #440
1 parent bd5bde9 commit 1644e96

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

eclipse/tern.eclipse.ide.core/src/tern/eclipse/ide/internal/core/resources/IDETernProject.java

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,7 @@ public static boolean hasTernNature(IProject project) {
199199
@Override
200200
protected void doLoad() throws IOException {
201201
try {
202-
203-
202+
204203
disposeServer();
205204
TernProjectLifecycleManager.getManager().fireTernProjectLifeCycleListenerChanged(this,
206205
LifecycleEventType.onLoadBefore);
@@ -211,13 +210,13 @@ protected void doLoad() throws IOException {
211210
// the tern project is loaded on the first time, load default
212211
// modules and save .tern-project.
213212
initAdaptedNaturesInfos();
214-
213+
215214
} finally {
216215
TernProjectLifecycleManager.getManager().fireTernProjectLifeCycleListenerChanged(this,
217216
LifecycleEventType.onLoadAfter);
218217
}
219218
}
220-
219+
221220
@Override
222221
protected void onLintersChanged() {
223222
TernProjectLifecycleManager.getManager().fireTernProjectLifeCycleListenerChanged(this,
@@ -376,7 +375,7 @@ public void handleException(Throwable t) {
376375
/**
377376
* Save IDE informations in the JSON file .tern-project.
378377
*/
379-
private void saveIDEInfos() {
378+
private void saveIDEInfos() {
380379
// script path
381380
if (scriptPaths.size() > 0) {
382381
JsonObject ide = new JsonObject();
@@ -662,7 +661,8 @@ public boolean visit(IResource resource) throws CoreException {
662661
case IResource.PROJECT:
663662
return true;
664663
case IResource.FILE:
665-
ITernModule module = TernModuleHelper.createModule(resource.getName(), projectRepository, defaultRepository);
664+
ITernModule module = TernModuleHelper.createModule(resource.getName(), projectRepository,
665+
defaultRepository);
666666
if (module != null) {
667667
modules.add(module);
668668
}
@@ -700,7 +700,10 @@ public void dispose() throws CoreException {
700700
}
701701

702702
protected static IDETernProject getTernProject(IProject project) throws CoreException {
703-
return (IDETernProject) project.getSessionProperty(TERN_PROJECT);
703+
if (project.isAccessible()) {
704+
return (IDETernProject) project.getSessionProperty(TERN_PROJECT);
705+
}
706+
return null;
704707
}
705708

706709
@Override
@@ -780,7 +783,7 @@ private boolean checkInScopeResource(IResource resource, IScopeContext context)
780783
// none script path, we consider that resource is in the scope?
781784
return true;
782785
}
783-
786+
784787
// Loop for each tern script path
785788
int resourceType = resource.getType();
786789
IPath path = resource.getFullPath();
@@ -791,12 +794,14 @@ private boolean checkInScopeResource(IResource resource, IScopeContext context)
791794
// script path is an Eclipse Project or Folder
792795
s = (IIDETernScriptPath) scriptPath;
793796
if (s.isBelongToContainer(path)) {
794-
// the resource path belongs to the Project/folder of the tern script path
797+
// the resource path belongs to the Project/folder of the
798+
// tern script path
795799
if (!s.isInScope(path, resourceType)) {
796800
// the tern script exclude or don't include the resource
797801
return false;
798802
} else if (resourceType == IResource.FILE) {
799-
// None exclusion, check if the parent folder exclude the file
803+
// None exclusion, check if the parent folder exclude
804+
// the file
800805
parent = resource.getParent();
801806
while ((parent.getType() & IResource.PROJECT) == 0) {
802807
if (context.isInclude(parent)) {
@@ -809,7 +814,7 @@ private boolean checkInScopeResource(IResource resource, IScopeContext context)
809814
parent = parent.getParent();
810815
}
811816
}
812-
// The parent folder of the resource
817+
// The parent folder of the resource
813818
context.addInclude(resource.getParent());
814819
return true;
815820
}
@@ -834,7 +839,7 @@ private List<ITernScriptPath> getSortedScriptPaths() {
834839
@Override
835840
public IIDETernScriptPathReporter getScriptPathReporter() {
836841
// Uncomment to have trace for include/exclude files.
837-
return null; //SysErrScriptPathReporter.INSTANCE;
842+
return null; // SysErrScriptPathReporter.INSTANCE;
838843
}
839844

840845
}

0 commit comments

Comments
 (0)