moved to psi

This commit is contained in:
Alexey Kudravtsev
2014-10-13 13:55:32 +04:00
parent d82a4eebfa
commit 76376377f3
5 changed files with 47 additions and 17 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -0,0 +1,20 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.plugins.groovy.util;
public class SdkHomeBean {
public String SDK_HOME;
}
@@ -19,8 +19,7 @@ package org.jetbrains.plugins.groovy.util;
import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.JarFileSystem;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.StandardFileSystems;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiManager;
import com.intellij.psi.impl.PsiModificationTrackerImpl;
@@ -34,22 +33,22 @@ import java.util.List;
/**
* @author peter
*/
public abstract class SdkHomeSettings implements PersistentStateComponent<SdkHomeConfigurable.SdkHomeBean> {
public abstract class SdkHomeSettings implements PersistentStateComponent<SdkHomeBean> {
private final PsiModificationTrackerImpl myTracker;
private SdkHomeConfigurable.SdkHomeBean mySdkHome;
private SdkHomeBean mySdkHome;
protected SdkHomeSettings(Project project) {
myTracker = (PsiModificationTrackerImpl)PsiManager.getInstance(project).getModificationTracker();
}
@Override
public SdkHomeConfigurable.SdkHomeBean getState() {
public SdkHomeBean getState() {
return mySdkHome;
}
@Override
public void loadState(SdkHomeConfigurable.SdkHomeBean state) {
SdkHomeConfigurable.SdkHomeBean oldState = mySdkHome;
public void loadState(SdkHomeBean state) {
SdkHomeBean oldState = mySdkHome;
mySdkHome = state;
if (oldState != null) {
myTracker.incCounter();
@@ -57,7 +56,7 @@ public abstract class SdkHomeSettings implements PersistentStateComponent<SdkHom
}
@Nullable
private static VirtualFile calcHome(final SdkHomeConfigurable.SdkHomeBean state) {
private static VirtualFile calcHome(final SdkHomeBean state) {
if (state == null) {
return null;
}
@@ -67,7 +66,7 @@ public abstract class SdkHomeSettings implements PersistentStateComponent<SdkHom
return null;
}
return LocalFileSystem.getInstance().findFileByPath(sdk_home);
return StandardFileSystems.local().findFileByPath(sdk_home);
}
@Nullable
@@ -89,10 +88,10 @@ public abstract class SdkHomeSettings implements PersistentStateComponent<SdkHom
return Collections.emptyList();
}
final ArrayList<VirtualFile> result = new ArrayList<VirtualFile>();
List<VirtualFile> result = new ArrayList<VirtualFile>();
for (VirtualFile file : lib.getChildren()) {
if ("jar".equals(file.getExtension())) {
ContainerUtil.addIfNotNull(JarFileSystem.getInstance().getJarRootForLocalFile(file), result);
ContainerUtil.addIfNotNull(StandardFileSystems.getJarRootForLocalFile(file), result);
}
}
return result;
@@ -100,10 +100,6 @@ public abstract class SdkHomeConfigurable implements SearchableConfigurable {
myPanel = null;
}
public static class SdkHomeBean {
public String SDK_HOME;
}
@Override
public Runnable enableSearch(String option) {
return null;
@@ -1,3 +1,18 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.plugins.groovy.gant
import com.intellij.openapi.module.Module
import com.intellij.openapi.roots.ContentEntry
@@ -11,7 +26,7 @@ import com.intellij.testFramework.LightProjectDescriptor
import com.intellij.testFramework.fixtures.DefaultLightProjectDescriptor
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
import org.jetbrains.annotations.NotNull
import org.jetbrains.plugins.groovy.util.SdkHomeConfigurable.SdkHomeBean
import org.jetbrains.plugins.groovy.util.SdkHomeBean
import org.jetbrains.plugins.groovy.util.TestUtils
/**
* @author peter