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:
@@ -29,6 +29,8 @@ import com.intellij.openapi.fileTypes.StdFileTypes;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleType;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
@@ -42,6 +44,7 @@ import com.intellij.util.messages.MessageBusConnection;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.Semaphore;
|
||||
@@ -60,6 +63,7 @@ public class CompilerManagerImpl extends CompilerManager {
|
||||
private final Map<Compiler, Set<FileType>> myCompilerToInputTypes = new HashMap<Compiler, Set<FileType>>();
|
||||
private final Map<Compiler, Set<FileType>> myCompilerToOutputTypes = new HashMap<Compiler, Set<FileType>>();
|
||||
private final Set<ModuleType> myValidationDisabledModuleTypes = new HashSet<ModuleType>();
|
||||
private final Set<LocalFileSystem.WatchRequest> myWatchRoots;
|
||||
|
||||
public CompilerManagerImpl(final Project project, CompilerConfigurationImpl compilerConfiguration, MessageBus messageBus) {
|
||||
myProject = project;
|
||||
@@ -82,6 +86,17 @@ public class CompilerManagerImpl extends CompilerManager {
|
||||
}
|
||||
|
||||
addCompilableFileType(StdFileTypes.JAVA);
|
||||
|
||||
final File projectGeneratedSrcRoot = CompilerPaths.getGeneratedDataDirectory(project);
|
||||
FileUtil.createIfDoesntExist(projectGeneratedSrcRoot);
|
||||
final LocalFileSystem lfs = LocalFileSystem.getInstance();
|
||||
myWatchRoots = lfs.addRootsToWatch(Collections.singletonList(FileUtil.toCanonicalPath(projectGeneratedSrcRoot.getPath())), true);
|
||||
Disposer.register(project, new Disposable() {
|
||||
public void dispose() {
|
||||
lfs.removeWatchedRoots(myWatchRoots);
|
||||
}
|
||||
});
|
||||
|
||||
//
|
||||
//addCompiler(new DummyTransformingCompiler()); // this one is for testing purposes only
|
||||
//addCompiler(new DummySourceGeneratingCompiler(myProject)); // this one is for testing purposes only
|
||||
|
||||
@@ -70,7 +70,7 @@ public class JavaCoreEnvironment extends CoreEnvironment {
|
||||
|
||||
myApplication.registerService(PsiPackageImplementationHelper.class, new CorePsiPackageImplementationHelper());
|
||||
|
||||
myFileManager = new CoreJavaFileManager(myPsiManager, getLocalFileSystem(), myJarFileSystem);
|
||||
myFileManager = createCoreFileManager();
|
||||
myProject.registerService(PsiElementFactory.class, new PsiElementFactoryImpl(myPsiManager));
|
||||
myProject.registerService(JavaPsiImplementationHelper.class, new CoreJavaPsiImplementationHelper());
|
||||
myProject.registerService(PsiResolveHelper.class, new PsiResolveHelperImpl(myPsiManager));
|
||||
@@ -92,6 +92,10 @@ public class JavaCoreEnvironment extends CoreEnvironment {
|
||||
myApplication.registerService(JavaVersionService.class, new JavaVersionService());
|
||||
}
|
||||
|
||||
protected CoreJavaFileManager createCoreFileManager() {
|
||||
return new CoreJavaFileManager(myPsiManager, getLocalFileSystem(), myJarFileSystem);
|
||||
}
|
||||
|
||||
public void addToClasspath(File path) {
|
||||
final VirtualFile root = path.isFile()
|
||||
? myJarFileSystem.findFileByPath(path + "!/")
|
||||
|
||||
@@ -278,6 +278,14 @@ public abstract class InspectionProfileEntry {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return short name of tool whose results will be used
|
||||
*/
|
||||
@Nullable
|
||||
public String getMainToolId() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String loadDescription() {
|
||||
final String description = getStaticDescription();
|
||||
|
||||
@@ -42,6 +42,8 @@ public abstract class FileColorManager {
|
||||
|
||||
public abstract boolean isEnabledForProjectView();
|
||||
|
||||
public abstract Project getProject();
|
||||
|
||||
@SuppressWarnings({"MethodMayBeStatic"})
|
||||
@Nullable
|
||||
public abstract Color getColor(@NotNull String name);
|
||||
|
||||
+30
-4
@@ -63,6 +63,7 @@ import com.intellij.util.containers.HashMap;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import gnu.trove.THashMap;
|
||||
import gnu.trove.THashSet;
|
||||
import gnu.trove.TObjectHashingStrategy;
|
||||
import org.jdom.Document;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -78,6 +79,17 @@ import java.util.Set;
|
||||
|
||||
public class GlobalInspectionContextImpl extends UserDataHolderBase implements GlobalInspectionContext {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInspection.ex.GlobalInspectionContextImpl");
|
||||
private static final TObjectHashingStrategy<ToolsImpl> TOOLS_HASHING_STRATEGY = new TObjectHashingStrategy<ToolsImpl>() {
|
||||
@Override
|
||||
public int computeHashCode(ToolsImpl object) {
|
||||
return object.getShortName().hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(ToolsImpl o1, ToolsImpl o2) {
|
||||
return o1.getShortName().equals(o2.getShortName());
|
||||
}
|
||||
};
|
||||
|
||||
private RefManager myRefManager;
|
||||
private final NotNullLazyValue<ContentManager> myContentManager;
|
||||
@@ -142,12 +154,12 @@ public class GlobalInspectionContextImpl extends UserDataHolderBase implements G
|
||||
profile = InspectionProfileManager.getInstance().getProfile(managerEx.getCurrentProfile());
|
||||
if (profile != null) return (InspectionProfile)profile;
|
||||
|
||||
final String[] avaliableProfileNames = inspectionProfileManager.getAvailableProfileNames();
|
||||
if (avaliableProfileNames == null || avaliableProfileNames.length == 0) {
|
||||
final String[] availableProfileNames = inspectionProfileManager.getAvailableProfileNames();
|
||||
if (availableProfileNames == null || availableProfileNames.length == 0) {
|
||||
//can't be
|
||||
return null;
|
||||
}
|
||||
profile = inspectionProfileManager.getProfile(avaliableProfileNames[0]);
|
||||
profile = inspectionProfileManager.getProfile(availableProfileNames[0]);
|
||||
}
|
||||
return (InspectionProfile)profile;
|
||||
}
|
||||
@@ -702,7 +714,21 @@ public class GlobalInspectionContextImpl extends UserDataHolderBase implements G
|
||||
}
|
||||
|
||||
protected List<ToolsImpl> getUsedTools() {
|
||||
return ((InspectionProfileImpl)getCurrentProfile()).getAllEnabledInspectionTools(myProject);
|
||||
InspectionProfileImpl profile = (InspectionProfileImpl)getCurrentProfile();
|
||||
List<ToolsImpl> tools = profile.getAllEnabledInspectionTools(myProject);
|
||||
THashSet<ToolsImpl> set = null;
|
||||
for (ToolsImpl tool : tools) {
|
||||
String id = tool.getTool().getMainToolId();
|
||||
if (id != null) {
|
||||
InspectionProfileEntry mainTool = profile.getInspectionTool(id);
|
||||
LOG.assertTrue(mainTool != null, "Can't find main tool: " + id);
|
||||
if (set == null) {
|
||||
set = new THashSet<ToolsImpl>(tools, TOOLS_HASHING_STRATEGY);
|
||||
}
|
||||
set.add(new ToolsImpl(mainTool, mainTool.getDefaultLevel(), true));
|
||||
}
|
||||
}
|
||||
return set == null ? tools : new ArrayList<ToolsImpl>(set);
|
||||
}
|
||||
|
||||
private void classifyTool(List<Tools> outGlobalTools,
|
||||
|
||||
@@ -204,7 +204,7 @@ public class FileStructurePopup implements Disposable {
|
||||
};
|
||||
|
||||
//myAbstractTreeBuilder.getUi().setPassthroughMode(true);
|
||||
myAbstractTreeBuilder.getUi().getUpdater().setDelay(1);
|
||||
myAbstractTreeBuilder.getUi().getUpdater().setDelay(0);
|
||||
myInitialPsiElement = getCurrentElement(getPsiFile(myProject));
|
||||
//myAbstractTreeBuilder.setCanYieldUpdate(true);
|
||||
Disposer.register(this, myAbstractTreeBuilder);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -20,12 +20,14 @@ import com.intellij.notification.impl.ui.StickyButton;
|
||||
import com.intellij.notification.impl.ui.StickyButtonUI;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.search.scope.packageSet.CustomScopesProviderEx;
|
||||
import com.intellij.psi.search.scope.packageSet.NamedScope;
|
||||
import com.intellij.psi.search.scope.packageSet.NamedScopeManager;
|
||||
import com.intellij.psi.search.scope.packageSet.NamedScopesHolder;
|
||||
import com.intellij.ui.ColorChooser;
|
||||
import com.intellij.ui.ColorUtil;
|
||||
import com.intellij.ui.FileColorManager;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.containers.HashMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -46,12 +48,12 @@ import java.util.List;
|
||||
public class FileColorConfigurationEditDialog extends DialogWrapper {
|
||||
private FileColorConfiguration myConfiguration;
|
||||
private JComboBox myScopeComboBox;
|
||||
private final FileColorManagerImpl myManager;
|
||||
private final FileColorManager myManager;
|
||||
private HashMap<String,AbstractButton> myColorToButtonMap;
|
||||
private static final String CUSTOM_COLOR_NAME = "Custom";
|
||||
private final Map<String, NamedScope> myScopeNames = new HashMap<String, NamedScope>();
|
||||
|
||||
public FileColorConfigurationEditDialog(@NotNull final FileColorManagerImpl manager, @Nullable final FileColorConfiguration configuration) {
|
||||
public FileColorConfigurationEditDialog(@NotNull final FileColorManager manager, @Nullable final FileColorConfiguration configuration) {
|
||||
super(true);
|
||||
|
||||
setTitle(configuration == null ? "Add color label" : "Edit color label");
|
||||
@@ -62,9 +64,16 @@ public class FileColorConfigurationEditDialog extends DialogWrapper {
|
||||
|
||||
init();
|
||||
updateCustomButton();
|
||||
if (myConfiguration != null && !StringUtil.isEmpty(myConfiguration.getScopeName())) {
|
||||
myScopeComboBox.setSelectedItem(myConfiguration.getScopeName());
|
||||
}
|
||||
updateOKButton();
|
||||
}
|
||||
|
||||
public JComboBox getScopeComboBox() {
|
||||
return myScopeComboBox;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JComponent createNorthPanel() {
|
||||
final JPanel result = new JPanel();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -31,6 +31,7 @@ import javax.swing.table.TableColumn;
|
||||
import javax.swing.table.TableColumnModel;
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EventObject;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -42,9 +43,11 @@ public abstract class FileColorSettingsTable extends JBTable {
|
||||
private static final int COLOR_COLUMN = 1;
|
||||
|
||||
private final List<FileColorConfiguration> myOriginal;
|
||||
@NotNull private final FileColorManager myManager;
|
||||
|
||||
public FileColorSettingsTable(@NotNull final FileColorManager manager, @NotNull final List<FileColorConfiguration> configurations) {
|
||||
super(new ModelAdapter(manager, copy(configurations)));
|
||||
myManager = manager;
|
||||
setStriped(true);
|
||||
myOriginal = configurations;
|
||||
|
||||
@@ -78,6 +81,20 @@ public abstract class FileColorSettingsTable extends JBTable {
|
||||
return (ModelAdapter) super.getModel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean editCellAt(int row, int column, EventObject e) {
|
||||
final Object at = getModel().getValueAt(row, column);
|
||||
final FileColorConfigurationEditDialog dialog = new FileColorConfigurationEditDialog(myManager, ((FileColorConfiguration)at));
|
||||
dialog.getScopeComboBox().setEnabled(false);
|
||||
dialog.show();
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCellEditable(int row, int column) {
|
||||
return column == 1;
|
||||
}
|
||||
|
||||
public boolean isModified() {
|
||||
final List<FileColorConfiguration> current = getModel().getConfigurations();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -39,7 +39,7 @@ public abstract class CopyPasteManager {
|
||||
|
||||
public abstract void removeContentChangedListener(ContentChangedListener listener);
|
||||
|
||||
public abstract boolean isDataFlavorAvailable(@NotNull DataFlavor flavor);
|
||||
public abstract boolean isDataFlavorAvailable(@Nullable DataFlavor flavor);
|
||||
|
||||
@Nullable
|
||||
public abstract Transferable getContents();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -67,8 +67,8 @@ public class CopyPasteManagerEx extends CopyPasteManager implements ClipboardOwn
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDataFlavorAvailable(@NotNull DataFlavor flavor) {
|
||||
return myClipboardSynchronizer.isDataFlavorAvailable(flavor);
|
||||
public boolean isDataFlavorAvailable(@Nullable DataFlavor flavor) {
|
||||
return flavor != null && myClipboardSynchronizer.isDataFlavorAvailable(flavor);
|
||||
}
|
||||
|
||||
public void setContents(@NotNull final Transferable content) {
|
||||
|
||||
@@ -23,9 +23,11 @@ import com.intellij.openapi.components.ExtensionAreas;
|
||||
import com.intellij.openapi.components.PathMacroManager;
|
||||
import com.intellij.openapi.components.impl.ProjectPathMacroManager;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.fileTypes.FileTypeRegistry;
|
||||
import com.intellij.openapi.module.ModuleManager;
|
||||
import com.intellij.openapi.projectRoots.ProjectJdkTable;
|
||||
import com.intellij.openapi.roots.OrderRootType;
|
||||
import com.intellij.openapi.roots.ProjectFileIndex;
|
||||
import com.intellij.openapi.roots.ProjectRootManager;
|
||||
import com.intellij.openapi.roots.impl.*;
|
||||
import com.intellij.openapi.roots.impl.libraries.ApplicationLibraryTable;
|
||||
@@ -56,5 +58,6 @@ public class ProjectModelEnvironment {
|
||||
env.registerProjectComponent(DirectoryIndex.class, index);
|
||||
env.registerProjectComponent(ProjectRootManager.class, new ProjectRootManagerImpl(project, index));
|
||||
project.registerService(ProjectLibraryTable.class, new ProjectLibraryTable());
|
||||
project.registerService(ProjectFileIndex.class, new ProjectFileIndexImpl(project, index, FileTypeRegistry.getInstance()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user