mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote branch 'origin/master'
This commit is contained in:
@@ -31,7 +31,6 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ProjectManager;
|
||||
import com.intellij.openapi.project.ProjectManagerAdapter;
|
||||
import com.intellij.openapi.project.ex.ProjectEx;
|
||||
import com.intellij.openapi.projectRoots.JavaSdkType;
|
||||
import com.intellij.openapi.projectRoots.ProjectJdkTable;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
@@ -98,12 +97,6 @@ public class JpsServerManager implements ApplicationComponent{
|
||||
mySystemDirectory = system;
|
||||
|
||||
projectManager.addProjectManagerListener(new ProjectWatcher());
|
||||
final MessageBusConnection appConnection = ApplicationManager.getApplication().getMessageBus().connect();
|
||||
appConnection.subscribe(ProjectEx.ProjectSaved.TOPIC, new ProjectEx.ProjectSaved() {
|
||||
public void saved(@NotNull Project project) {
|
||||
sendReloadRequest(project);
|
||||
}
|
||||
});
|
||||
|
||||
ShutDownTracker.getInstance().registerShutdownTask(new Runnable() {
|
||||
@Override
|
||||
|
||||
@@ -17,10 +17,7 @@ package com.intellij.compiler.impl;
|
||||
|
||||
import com.intellij.codeInsight.daemon.impl.actions.SuppressFix;
|
||||
import com.intellij.codeInsight.daemon.impl.actions.SuppressForClassFix;
|
||||
import com.intellij.compiler.CompilerConfiguration;
|
||||
import com.intellij.compiler.CompilerConfigurationImpl;
|
||||
import com.intellij.compiler.CompilerWorkspaceConfiguration;
|
||||
import com.intellij.compiler.HelpID;
|
||||
import com.intellij.compiler.*;
|
||||
import com.intellij.compiler.options.CompilerConfigurable;
|
||||
import com.intellij.ide.errorTreeView.*;
|
||||
import com.intellij.ide.util.treeView.NodeDescriptor;
|
||||
@@ -112,6 +109,7 @@ public class CompilerErrorTreeView extends NewErrorTreeViewPanel {
|
||||
public void run() {
|
||||
if (!project.isDisposed()) {
|
||||
project.save();
|
||||
JpsServerManager.getInstance().sendReloadRequest(project);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.intellij.compiler.options;
|
||||
import com.intellij.compiler.CompilerConfiguration;
|
||||
import com.intellij.compiler.CompilerConfigurationImpl;
|
||||
import com.intellij.compiler.CompilerSettingsFactory;
|
||||
import com.intellij.compiler.JpsServerManager;
|
||||
import com.intellij.compiler.impl.rmiCompiler.RmicConfiguration;
|
||||
import com.intellij.openapi.compiler.CompilerBundle;
|
||||
import com.intellij.openapi.compiler.options.ExcludedEntriesConfigurable;
|
||||
@@ -120,7 +121,7 @@ public class CompilerConfigurable implements SearchableConfigurable.Parent, Conf
|
||||
}
|
||||
};
|
||||
|
||||
kids.add(createExcludesWrapper(excludes));
|
||||
kids.add(createExcludesWrapper(excludes, myProject));
|
||||
|
||||
ArrayList<Configurable> additional = new ArrayList<Configurable>();
|
||||
|
||||
@@ -156,7 +157,7 @@ public class CompilerConfigurable implements SearchableConfigurable.Parent, Conf
|
||||
return myKids;
|
||||
}
|
||||
|
||||
private static Configurable createExcludesWrapper(final ExcludedEntriesConfigurable excludes) {
|
||||
private static Configurable createExcludesWrapper(final ExcludedEntriesConfigurable excludes, final Project project) {
|
||||
return new SearchableConfigurable() {
|
||||
@Nls
|
||||
public String getDisplayName() {
|
||||
@@ -177,6 +178,11 @@ public class CompilerConfigurable implements SearchableConfigurable.Parent, Conf
|
||||
|
||||
public void apply() {
|
||||
excludes.apply();
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
JpsServerManager.getInstance().sendReloadRequest(project);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public boolean isModified() {
|
||||
|
||||
@@ -98,6 +98,13 @@ public class CompilerUIConfigurable implements SearchableConfigurable, Configura
|
||||
if (!workspaceConfiguration.USE_COMPILE_SERVER) {
|
||||
JpsServerManager.getInstance().shutdownServer();
|
||||
}
|
||||
else {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
JpsServerManager.getInstance().sendReloadRequest(myProject);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private static void applyResourcePatterns(String extensionString, final CompilerConfigurationImpl configuration)
|
||||
|
||||
@@ -1159,6 +1159,10 @@ class Foo {{
|
||||
assert myFixture.lookupElementStrings.size() >= 2
|
||||
type '.'
|
||||
assert lookup
|
||||
edt { myFixture.editor.caretModel.moveToOffset(myFixture.editor.document.text.indexOf('lang')) }
|
||||
assert !lookup
|
||||
type 'i'
|
||||
assert 'io' in myFixture.lookupElementStrings
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -9,13 +9,15 @@ import org.jetbrains.jps.incremental.storage.ProjectTimestamps;
|
||||
* @author Eugene Zhuravlev
|
||||
* Date: 1/8/12
|
||||
*/
|
||||
public class ProjectDescriptor {
|
||||
public final class ProjectDescriptor {
|
||||
public final String projectName;
|
||||
public final Project project;
|
||||
public final FSState fsState;
|
||||
public final ProjectTimestamps timestamps;
|
||||
public ModuleRootsIndex rootsIndex;
|
||||
|
||||
private int myUseCounter = 1;
|
||||
|
||||
ProjectDescriptor(String projectName, Project project, FSState fsState, ProjectTimestamps timestamps) {
|
||||
this.projectName = projectName;
|
||||
this.project = project;
|
||||
@@ -23,8 +25,18 @@ public class ProjectDescriptor {
|
||||
this.timestamps = timestamps;
|
||||
this.rootsIndex = new ModuleRootsIndex(project);
|
||||
}
|
||||
public synchronized void incUsageCounter() {
|
||||
myUseCounter++;
|
||||
}
|
||||
|
||||
public void close() {
|
||||
timestamps.close();
|
||||
public void release() {
|
||||
boolean shouldClose;
|
||||
synchronized (this) {
|
||||
--myUseCounter;
|
||||
shouldClose = myUseCounter == 0;
|
||||
}
|
||||
if (shouldClose) {
|
||||
timestamps.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,11 +86,16 @@ class ServerMessageHandler extends SimpleChannelHandler {
|
||||
final String projectId = fsEvent.getProjectId();
|
||||
final ProjectDescriptor pd = facade.getProjectDescriptor(projectId);
|
||||
if (pd != null) {
|
||||
for (String path : fsEvent.getChangedPathsList()) {
|
||||
facade.notifyFileChanged(pd, new File(path));
|
||||
try {
|
||||
for (String path : fsEvent.getChangedPathsList()) {
|
||||
facade.notifyFileChanged(pd, new File(path));
|
||||
}
|
||||
for (String path : fsEvent.getDeletedPathsList()) {
|
||||
facade.notifyFileDeleted(pd, new File(path));
|
||||
}
|
||||
}
|
||||
for (String path : fsEvent.getDeletedPathsList()) {
|
||||
facade.notifyFileDeleted(pd, new File(path));
|
||||
finally {
|
||||
pd.release();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -40,8 +40,7 @@ class ServerState {
|
||||
for (Map.Entry<String, ProjectDescriptor> entry : myProjects.entrySet()) {
|
||||
final String projectPath = entry.getKey();
|
||||
final ProjectDescriptor descriptor = entry.getValue();
|
||||
LOG.info("Global configuration changed: Closing descriptor for project " + projectPath);
|
||||
descriptor.close();
|
||||
descriptor.release();
|
||||
}
|
||||
myProjects.clear(); // projects should be reloaded against the latest data
|
||||
myGlobalLibraries.clear();
|
||||
@@ -80,6 +79,9 @@ class ServerState {
|
||||
final ProjectDescriptor pd;
|
||||
synchronized (myConfigurationLock) {
|
||||
pd = myProjects.get(projectPath);
|
||||
if (pd != null) {
|
||||
pd.incUsageCounter();
|
||||
}
|
||||
}
|
||||
return pd;
|
||||
}
|
||||
@@ -88,10 +90,8 @@ class ServerState {
|
||||
synchronized (myConfigurationLock) {
|
||||
for (String projectPath : projectPaths) {
|
||||
final ProjectDescriptor descriptor = myProjects.remove(projectPath);
|
||||
LOG.info("Clearing descriptor for project " + projectPath);
|
||||
if (descriptor != null) {
|
||||
LOG.info("Closing descriptor for project " + projectPath);
|
||||
descriptor.close();
|
||||
descriptor.release();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -101,19 +101,19 @@ class ServerState {
|
||||
final String projectName = getProjectName(projectPath);
|
||||
BuildType buildType = params.buildType;
|
||||
|
||||
ProjectDescriptor descriptor;
|
||||
ProjectDescriptor pd;
|
||||
synchronized (myConfigurationLock) {
|
||||
descriptor = myProjects.get(projectPath);
|
||||
if (descriptor == null) {
|
||||
LOG.info("Creating project descriptor for project " + projectPath);
|
||||
pd = myProjects.get(projectPath);
|
||||
if (pd == null) {
|
||||
final Project project = loadProject(projectPath, params);
|
||||
final FSState fsState = new FSState();
|
||||
descriptor = new ProjectDescriptor(projectName, project, fsState, new ProjectTimestamps(projectName));
|
||||
myProjects.put(projectPath, descriptor);
|
||||
pd = new ProjectDescriptor(projectName, project, fsState, new ProjectTimestamps(projectName));
|
||||
myProjects.put(projectPath, pd);
|
||||
}
|
||||
pd.incUsageCounter();
|
||||
}
|
||||
|
||||
final Project project = descriptor.project;
|
||||
final Project project = pd.project;
|
||||
|
||||
try {
|
||||
final List<Module> toCompile = new ArrayList<Module>();
|
||||
@@ -130,7 +130,7 @@ class ServerState {
|
||||
|
||||
final CompileScope compileScope = new CompileScope(project, toCompile);
|
||||
|
||||
final IncProjectBuilder builder = new IncProjectBuilder(descriptor, BuilderRegistry.getInstance());
|
||||
final IncProjectBuilder builder = new IncProjectBuilder(pd, BuilderRegistry.getInstance());
|
||||
if (msgHandler != null) {
|
||||
builder.addMessageHandler(msgHandler);
|
||||
}
|
||||
@@ -154,6 +154,7 @@ class ServerState {
|
||||
}
|
||||
}
|
||||
finally {
|
||||
pd.release();
|
||||
clearZipIndexCache();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1304,6 +1304,7 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
|
||||
public boolean ensureUpToDate(final boolean canBeCanceled) {
|
||||
final EnsureUpToDateFromNonAWTThread worker = new EnsureUpToDateFromNonAWTThread(myProject);
|
||||
worker.execute();
|
||||
myUpdater.waitUntilRefreshed();
|
||||
return worker.isDone();
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@ import com.intellij.openapi.vcs.ProjectLevelVcsManager;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.intellij.util.concurrency.Semaphore;
|
||||
import com.intellij.util.io.storage.HeavyProcessLatch;
|
||||
import org.jetbrains.annotations.TestOnly;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.ArrayList;
|
||||
@@ -95,15 +94,14 @@ public class UpdateRequestsQueue {
|
||||
}
|
||||
|
||||
public void schedule() {
|
||||
if (ChangeListManagerImpl.DEBUG) {
|
||||
System.out.println("UpdateRequestsQueue.schedule");
|
||||
}
|
||||
|
||||
synchronized (myLock) {
|
||||
if (! myStarted && ApplicationManager.getApplication().isUnitTestMode()) return;
|
||||
|
||||
if (! myStopped) {
|
||||
if (! myRequestSubmitted) {
|
||||
if (ChangeListManagerImpl.DEBUG) {
|
||||
System.out.println("UpdateRequestsQueue.schedule");
|
||||
}
|
||||
final MyRunnable runnable = new MyRunnable();
|
||||
myRequestSubmitted = true;
|
||||
myExecutor.schedule(runnable, 300, TimeUnit.MILLISECONDS);
|
||||
@@ -142,7 +140,6 @@ public class UpdateRequestsQueue {
|
||||
LOG.debug("Stop finished for project: " + myProject.getName());
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
public void waitUntilRefreshed() {
|
||||
if (ChangeListManagerImpl.DEBUG) {
|
||||
System.out.println("UpdateRequestsQueue.waitUntilRefreshed");
|
||||
@@ -261,7 +258,14 @@ public class UpdateRequestsQueue {
|
||||
}
|
||||
|
||||
LOG.debug("MyRunnable: INVOKE, project: " + myProject.getName() + ", runnable: " + hashCode());
|
||||
if (ChangeListManagerImpl.DEBUG) {
|
||||
System.out.println("UpdateRequestsQueue$MyRunnable.run");
|
||||
}
|
||||
|
||||
myDelegate.run();
|
||||
if (ChangeListManagerImpl.DEBUG) {
|
||||
System.out.println(" - end - UpdateRequestsQueue$MyRunnable.run");
|
||||
}
|
||||
LOG.debug("MyRunnable: invokeD, project: " + myProject.getName() + ", runnable: " + hashCode());
|
||||
} finally {
|
||||
synchronized (myLock) {
|
||||
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright 2000-2012 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 com.intellij.lang.properties;
|
||||
|
||||
import com.intellij.codeInsight.completion.CompletionContributor;
|
||||
import com.intellij.codeInsight.completion.CompletionInitializationContext;
|
||||
import com.intellij.codeInsight.completion.CompletionUtil;
|
||||
import com.intellij.lang.properties.psi.PropertiesFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author peter
|
||||
*/
|
||||
public class PropertiesCompletionContributor extends CompletionContributor {
|
||||
@Override
|
||||
public void beforeCompletion(@NotNull CompletionInitializationContext context) {
|
||||
if (context.getFile() instanceof PropertiesFile) {
|
||||
context.setDummyIdentifier(CompletionUtil.DUMMY_IDENTIFIER_TRIMMED);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@
|
||||
<applicationService serviceInterface="com.intellij.lang.properties.LastSelectedPropertiesFileStore"
|
||||
serviceImplementation="com.intellij.lang.properties.LastSelectedPropertiesFileStore"/>
|
||||
<annotator language="Properties" implementationClass="com.intellij.lang.properties.PropertiesAnnotator"/>
|
||||
<completion.contributor language="Properties" implementationClass="com.intellij.lang.properties.PropertiesCompletionContributor"/>
|
||||
<lang.refactoringSupport language="Properties" implementationClass="com.intellij.lang.properties.refactoring.PropertiesRefactoringSupportProvider"/>
|
||||
<lang.documentationProvider language="Properties" implementationClass="com.intellij.lang.properties.PropertiesDocumentationProvider"/>
|
||||
<lang.findUsagesProvider language="Properties"
|
||||
|
||||
Reference in New Issue
Block a user