Merge remote-tracking branch 'origin/master'

This commit is contained in:
Evgeny Zakrevsky
2012-10-09 19:44:34 +04:00
28 changed files with 437 additions and 129 deletions
+16 -2
View File
@@ -233,10 +233,24 @@ public def layoutCommunityPlugins(String home) {
jar("maven2-server-impl.jar") {
module("maven2-server-impl")
}
jar("maven3-server-impl.jar") {
module("maven3-server-impl")
}
dir("maven3") {
fileset(dir: "$home/plugins/maven/maven3-server-impl/lib") {include(name: "maven-dependency-tree-*.jar")}
fileset(dir: "$home/plugins/maven/maven3-server-impl/lib") {include(name: "nexus-indexer-*.jar")}
fileset(dir: "$home/plugins/maven/maven3-server-impl/lib/maven3/lib") {include(name: "*.jar")}
fileset(dir: "$home/plugins/maven/maven3-server-impl/lib/maven3/boot")
}
dir("maven2") {
fileset(dir: "$home/lib/") { include(name: "jaxb*.jar")}
fileset(dir: "$home/plugins/maven/maven2-server-impl/lib")
}
fileset(dir: "$home/plugins/maven/lib")
fileset(dir: "$home/lib/") { include(name: "jaxb*.jar")}
fileset(dir: "$home/plugins/maven/maven-server-api/lib")
fileset(dir: "$home/plugins/maven/maven2-server-impl/lib")
}
layoutPlugin("gradle") {
@@ -0,0 +1,72 @@
/*
* 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.ide.util.newProjectWizard;
import com.intellij.ide.util.treeView.TreeState;
import com.intellij.openapi.components.*;
import com.intellij.openapi.util.InvalidDataException;
import com.intellij.openapi.util.WriteExternalException;
import com.intellij.util.xmlb.annotations.Tag;
import com.intellij.util.xmlb.annotations.Transient;
import org.jdom.Element;
import org.jetbrains.annotations.Nullable;
/**
* @author Dmitry Avdeev
* Date: 10/9/12
*/
@State(name = "SelectProjectTemplateSettings", storages = {@Storage( file = StoragePathMacros.APP_CONFIG + "/other.xml")})
public class SelectTemplateSettings implements PersistentStateComponent<SelectTemplateSettings> {
static SelectTemplateSettings getInstance() {
return ServiceManager.getService(SelectTemplateSettings.class);
}
@Transient
public TreeState getTreeState() {
return myTreeState;
}
@Transient
public void setTreeState(TreeState state) {
myTreeState = state;
}
@Nullable
@Override
public SelectTemplateSettings getState() {
try {
myTreeState.writeExternal(treeState);
}
catch (WriteExternalException ignore) {
}
return this;
}
@Override
public void loadState(SelectTemplateSettings state) {
try {
myTreeState.readExternal(state.treeState);
}
catch (InvalidDataException ignore) {
}
}
@Tag("treeState")
public Element treeState = new Element("treeState");
private TreeState myTreeState = new TreeState();
}
@@ -51,26 +51,6 @@
<properties/>
<border type="none"/>
<children>
<grid id="c0238" binding="myDescriptionPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="7" anchor="1" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<clientProperties>
<BorderFactoryClass class="java.lang.String" value="com.intellij.ui.IdeBorderFactory$PlainSmallWithIndent"/>
</clientProperties>
<border type="etched" title="Description"/>
<children>
<component id="3ae1b" class="javax.swing.JTextPane" binding="myDescriptionPane">
<constraints border-constraint="Center"/>
<properties>
<contentType value="text/html"/>
<editable value="false"/>
<text value="&lt;html&gt;&#13;&#10; &lt;head&gt;&#13;&#10;&#13;&#10; &lt;/head&gt;&#13;&#10; &lt;body&gt;&#13;&#10; &lt;p style=&quot;margin-top: 0&quot;&gt;&#13;&#10; &#13;&#10; &lt;/p&gt;&#13;&#10; &lt;/body&gt;&#13;&#10;&lt;/html&gt;&#13;&#10;"/>
</properties>
</component>
</children>
</grid>
<grid id="caf4" binding="mySettingsPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
@@ -82,6 +62,31 @@
<border type="etched" title="Settings"/>
<children/>
</grid>
<grid id="5732c" binding="myDescriptionPanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<clientProperties>
<BorderFactoryClass class="java.lang.String" value="com.intellij.ui.IdeBorderFactory$PlainSmallWithIndent"/>
</clientProperties>
<border type="etched" title="Description"/>
<children>
<component id="3ae1b" class="javax.swing.JTextPane" binding="myDescriptionPane">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false">
<preferred-size width="150" height="50"/>
</grid>
</constraints>
<properties>
<contentType value="text/html"/>
<editable value="false"/>
<text value="&lt;html&gt;&#13;&#10; &lt;head&gt;&#13;&#10;&#13;&#10; &lt;/head&gt;&#13;&#10; &lt;body&gt;&#13;&#10; &lt;p style=&quot;margin-top: 0&quot;&gt;&#13;&#10; &#13;&#10; &lt;/p&gt;&#13;&#10; &lt;/body&gt;&#13;&#10;&lt;/html&gt;&#13;&#10;"/>
</properties>
</component>
</children>
</grid>
</children>
</grid>
</children>
@@ -18,12 +18,16 @@ package com.intellij.ide.util.newProjectWizard;
import com.intellij.ide.util.projectWizard.ModuleWizardStep;
import com.intellij.ide.util.projectWizard.WizardContext;
import com.intellij.ide.util.treeView.AlphaComparator;
import com.intellij.ide.util.treeView.NodeDescriptor;
import com.intellij.ide.util.treeView.TreeState;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.platform.ProjectTemplate;
import com.intellij.platform.ProjectTemplatesFactory;
import com.intellij.platform.templates.ArchivedTemplatesFactory;
import com.intellij.platform.templates.EmptyModuleTemplatesFactory;
import com.intellij.psi.codeStyle.MinusculeMatcher;
import com.intellij.psi.codeStyle.NameUtil;
import com.intellij.ui.ColoredTreeCellRenderer;
@@ -47,10 +51,8 @@ import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.TreePath;
import java.awt.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.*;
import java.util.List;
import java.util.Map;
/**
* @author Dmitry Avdeev
@@ -102,7 +104,23 @@ public class SelectTemplateStep extends ModuleWizardStep {
return matches(template);
}
};
myBuilder = new FilteringTreeBuilder(myTemplatesTree, myFilter, structure, AlphaComparator.INSTANCE);
myBuilder = new FilteringTreeBuilder(myTemplatesTree, myFilter, structure, new Comparator<NodeDescriptor>() {
@Override
public int compare(NodeDescriptor o1, NodeDescriptor o2) {
if (o1 instanceof FilteringTreeStructure.FilteringNode) {
if (((FilteringTreeStructure.FilteringNode)o1).getDelegate() instanceof GroupNode) {
String name = ((GroupNode)((FilteringTreeStructure.FilteringNode)o1).getDelegate()).getName();
if (name.equals(EmptyModuleTemplatesFactory.GROUP_NAME)) {
// return 1;
}
else if (name.equals(ArchivedTemplatesFactory.CUSTOM_GROUP)) {
// return -1;
}
}
}
return AlphaComparator.INSTANCE.compare(o1, o2);
}
});
myTemplatesTree.setRootVisible(false);
myTemplatesTree.setShowsRootHandles(false);
@@ -137,6 +155,7 @@ public class SelectTemplateStep extends ModuleWizardStep {
}
ProjectTemplate template = getSelectedTemplate();
if (template != null) {
// PropertiesComponent
JComponent settingsPanel = template.getSettingsPanel();
if (settingsPanel != null) {
mySettingsPanel.add(settingsPanel, BorderLayout.NORTH);
@@ -165,6 +184,11 @@ public class SelectTemplateStep extends ModuleWizardStep {
}
});
// doFilter();
TreeState state = SelectTemplateSettings.getInstance().getTreeState();
if (state != null) {
state.applyTo(myTemplatesTree, (DefaultMutableTreeNode)myTemplatesTree.getModel().getRoot());
}
}
@Override
@@ -174,7 +198,7 @@ public class SelectTemplateStep extends ModuleWizardStep {
private void doFilter() {
buildMatcher();
SimpleNode selectedNode = getSelectedNode();
SimpleNode selectedNode = myTemplatesTree.getSelectedNode();
final Ref<SimpleNode> node = new Ref<SimpleNode>();
if (!(selectedNode instanceof TemplateNode) || !matches(selectedNode)) {
myTemplatesTree.accept(myBuilder, new SimpleNodeVisitor() {
@@ -233,7 +257,8 @@ public class SelectTemplateStep extends ModuleWizardStep {
private SimpleNode getSimpleNode(Object component) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode)component;
Object userObject = node.getUserObject();
if (!(userObject instanceof FilteringTreeStructure.FilteringNode)) return null;
if (!(userObject instanceof FilteringTreeStructure.FilteringNode)) //noinspection ConstantConditions
return null;
FilteringTreeStructure.FilteringNode object = (FilteringTreeStructure.FilteringNode)userObject;
return (SimpleNode)object.getDelegate();
}
@@ -252,6 +277,19 @@ public class SelectTemplateStep extends ModuleWizardStep {
public void updateDataModel() {
}
@Override
public void onStepLeaving() {
TreePath path = myTemplatesTree.getSelectionPath();
TreeState state;
if (path == null) {
state = TreeState.createOn(myTemplatesTree);
}
else {
state = TreeState.createOn(myTemplatesTree, (DefaultMutableTreeNode)path.getLastPathComponent());
}
SelectTemplateSettings.getInstance().setTreeState(state);
}
@Override
public void disposeUIResources() {
Disposer.dispose(myBuilder);
@@ -278,7 +316,6 @@ public class SelectTemplateStep extends ModuleWizardStep {
return children.toArray(new SimpleNode[children.size()]);
}
@Override
public String getName() {
return myGroup;
@@ -41,7 +41,9 @@ import java.util.*;
*/
public class ArchivedTemplatesFactory implements ProjectTemplatesFactory {
public static final String CUSTOM_GROUP = "Custom";
private static final String ZIP = ".zip";
private final NotNullLazyValue<MultiMap<String, URL>> myGroups = new NotNullLazyValue<MultiMap<String, URL>>() {
@NotNull
@Override
@@ -66,7 +68,7 @@ public class ArchivedTemplatesFactory implements ProjectTemplatesFactory {
try {
List<String> children = UrlUtil.getChildrenRelativePaths(url);
if (configURL == url && !children.isEmpty()) {
map.putValue("Custom", url);
map.putValue(CUSTOM_GROUP, url);
continue;
}
@@ -0,0 +1,80 @@
/*
* 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.platform.templates;
import com.intellij.ide.util.projectWizard.ModuleBuilder;
import com.intellij.ide.util.projectWizard.ProjectBuilder;
import com.intellij.ide.util.projectWizard.WizardContext;
import com.intellij.platform.ProjectTemplate;
import com.intellij.platform.ProjectTemplatesFactory;
import com.intellij.util.Function;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.util.List;
/**
* @author Dmitry Avdeev
* Date: 10/9/12
*/
public class EmptyModuleTemplatesFactory implements ProjectTemplatesFactory {
public static final String GROUP_NAME = "Standard";
@NotNull
@Override
public String[] getGroups() {
return new String[] {GROUP_NAME};
}
@NotNull
@Override
public ProjectTemplate[] createTemplates(String group, WizardContext context) {
List<ModuleBuilder> builders = ModuleBuilder.getAllBuilders();
return ContainerUtil.map2Array(builders, ProjectTemplate.class, new Function<ModuleBuilder, ProjectTemplate>() {
@Override
public ProjectTemplate fun(final ModuleBuilder builder) {
return new ProjectTemplate() {
@NotNull
@Override
public String getName() {
return builder.getPresentableName();
}
@Nullable
@Override
public String getDescription() {
return builder.getDescription();
}
@Nullable
@Override
public JComponent getSettingsPanel() {
return null;
}
@NotNull
@Override
public ProjectBuilder createModuleBuilder() {
return builder;
}
};
}
});
}
}
@@ -464,6 +464,7 @@ public class JavaCompletionUtil {
document.insertString(exprStart, prefix + spaceWithin + ")" + spaceAfter);
CompletionUtil.emulateInsertion(context, exprStart + prefix.length(), castTypeItem);
PsiDocumentManager.getInstance(file.getProject()).doPostponedOperationsAndUnblockDocument(document);
context.getEditor().getCaretModel().moveToOffset(context.getTailOffset());
}
}
@@ -15,6 +15,7 @@
*/
package com.intellij.psi.impl.source.resolve;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.text.StringUtil;
@@ -31,6 +32,7 @@ import java.util.Iterator;
import java.util.List;
public class ClassResolverProcessor extends BaseScopeProcessor implements NameHint, ElementClassHint {
private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.source.resolve.ClassResolverProcessor");
private static final String[] DEFAULT_PACKAGES = new String[]{CommonClassNames.DEFAULT_PACKAGE};
private final String myClassName;
private final PsiElement myPlace;
@@ -58,6 +60,7 @@ public class ClassResolverProcessor extends BaseScopeProcessor implements NameHi
}
}
else if (qualifierExpression instanceof PsiJavaCodeReferenceElement) {
LOG.assertTrue(qualifierExpression.isValid());
final PsiElement resolve = ((PsiJavaCodeReferenceElement)qualifierExpression).resolve();
if (resolve instanceof PsiClass) {
myAccessClass = (PsiClass)resolve;
@@ -15,6 +15,7 @@
*/
package com.intellij.psi.impl.source.resolve;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.Pair;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.psi.*;
@@ -38,6 +39,7 @@ import java.util.Map;
import java.util.Set;
public class PsiResolveHelperImpl implements PsiResolveHelper {
private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.source.resolve.PsiResolveHelperImpl");
public static final Pair<PsiType,ConstraintType> RAW_INFERENCE = new Pair<PsiType, ConstraintType>(null, ConstraintType.EQUALS);
private final PsiManager myManager;
@@ -86,6 +88,7 @@ public class PsiResolveHelperImpl implements PsiResolveHelper {
final PsiJavaParserFacade parserFacade = JavaPsiFacade.getInstance(myManager.getProject()).getParserFacade();
try {
final PsiJavaCodeReferenceElement ref = parserFacade.createReferenceFromText(referenceText, context);
LOG.assertTrue(ref.isValid());
return ResolveClassUtil.resolveClass(ref);
}
catch (IncorrectOperationException e) {
@@ -386,6 +386,7 @@ public class PsiSearchHelperImpl implements PsiSearchHelper {
for (int i = 0; i < files.length; i++) {
if (progress != null) progress.checkCanceled();
final PsiFile psiFile = files[i];
if (psiFile instanceof PsiBinaryFile) continue;
ApplicationManager.getApplication().runReadAction(new Runnable() {
@Override
@@ -135,9 +135,11 @@ public class CodeCompletionHandlerBase {
CompletionPhase phase = CompletionServiceImpl.getCompletionPhase();
boolean repeated = phase.indicator != null && phase.indicator.isRepeatedInvocation(myCompletionType, editor);
/*
if (repeated && isAutocompleteCommonPrefixOnInvocation() && phase.fillInCommonPrefix()) {
return;
}
*/
int newTime = phase.newCompletionStarted(time, repeated);
if (invokedExplicitly) {
@@ -376,12 +376,6 @@ public class NavBarPanel extends JPanel implements DataProvider, PopupOwner, Dis
index++;
}
//IDEA-89401
if (myModel.getSelectedIndex() != myModel.size() - 1 && !hasFocus() && !isNodePopupShowing()) {
myModel.setSelectedIndex(myModel.size() -1);
return true;
}
return false;
} else {
return true;
@@ -33,6 +33,13 @@ import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;
/**
* @see #createOn(javax.swing.JTree)
* @see #createOn(javax.swing.JTree, javax.swing.tree.DefaultMutableTreeNode)
*
* @see #applyTo(javax.swing.JTree)
* @see #applyTo(javax.swing.JTree, javax.swing.tree.DefaultMutableTreeNode)
*/
public class TreeState implements JDOMExternalizable {
@NonNls private static final String PATH = "PATH";
@NonNls private static final String PATH_ELEMENT = "PATH_ELEMENT";
@@ -128,6 +135,10 @@ public class TreeState implements JDOMExternalizable {
return new TreeState(createExpandedPaths(tree, treeNode), createSelectedPaths(tree, treeNode));
}
public static TreeState createOn(@NotNull JTree tree) {
return new TreeState(createPaths(tree), new ArrayList<List<PathElement>>());
}
@Override
public void writeExternal(Element element) throws WriteExternalException {
for (List<PathElement> path : myExpandedPaths) {
@@ -145,11 +156,6 @@ public class TreeState implements JDOMExternalizable {
}
}
public static TreeState createOn(@NotNull JTree tree) {
return new TreeState(createPaths(tree), new ArrayList<List<PathElement>>());
}
private static List<List<PathElement>> createPaths(final JTree tree) {
final ArrayList<List<PathElement>> result = new ArrayList<List<PathElement>>();
final List<TreePath> expandedPaths = TreeUtil.collectExpandedPaths(tree);
@@ -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.
@@ -552,7 +552,7 @@ public abstract class AbstractColorsScheme implements EditorColorsScheme {
}
}
}
return "Source Code Pro"; // "Monospaced" if we cease to bundle Source Code Pro
return "Monospaced";
}
}
@@ -301,11 +301,6 @@ public class OptionsEditor extends JPanel implements DataProvider, Place.Navigat
return myTree.select(configurable);
}
@NotNull
public List<Configurable> getPathToRoot(@NotNull Configurable configurable) {
return myTree.getPathToRoot(configurable);
}
private float readProportion(final float defaultValue, final String propertyName) {
float proportion = defaultValue;
try {
@@ -257,17 +257,6 @@ public class OptionsTree extends JPanel implements Disposable, OptionsEditorColl
return path;
}
@Nullable
public Configurable getParentFor(final Configurable configurable) {
final List<Configurable> path = getPathToRoot(configurable);
if (path.size() > 1) {
return path.get(1);
}
else {
return null;
}
}
public SimpleNode findNodeFor(final Configurable toSelect) {
return myConfigurable2Node.get(toSelect);
}
@@ -13,7 +13,9 @@ import org.jboss.netty.channel.group.DefaultChannelGroup;
import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory;
import org.jboss.netty.handler.codec.http.*;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.UnknownHostException;
import java.util.List;
import java.util.concurrent.Executor;
@@ -64,10 +66,26 @@ public class WebServer {
bootstrap.setOption("child.tcpNoDelay", true);
bootstrap.setPipelineFactory(new ChannelPipelineFactoryImpl(pipelineConsumers, new DefaultHandler(openChannels)));
// IDEA-91436 idea <121 binds to 127.0.0.1, but >=121 must be available not only from localhost
// but if we bind only to any local port (0.0.0.0), instance of idea <121 can bind to our ports and any request to us will be intercepted
// so, we bind to 127.0.0.1 and 0.0.0.0
int port = bind(firstPort, portsCount, tryAnyPort, bootstrap);
if (port != -1) {
try {
openChannels.add(bootstrap.bind(new InetSocketAddress(port)));
}
catch (ChannelException e) {
LOG.error(e);
}
}
return port;
}
private int bind(int firstPort, int portsCount, boolean tryAnyPort, ServerBootstrap bootstrap) {
for (int i = 0; i < portsCount; i++) {
int port = firstPort + i;
try {
openChannels.add(bootstrap.bind(new InetSocketAddress(port)));
openChannels.add(bootstrap.bind(new InetSocketAddress(InetAddress.getByName("127.0.0.1"), port)));
return port;
}
catch (ChannelException e) {
@@ -78,6 +96,9 @@ public class WebServer {
LOG.error(e);
}
}
catch (UnknownHostException e) {
LOG.error(e);
}
}
if (tryAnyPort) {
@@ -314,11 +314,11 @@ action.FindWordAtCaret.text=Find _Word at Caret
action.FindWordAtCaret.description=Find next occurrence of the word at caret
action.IncrementalSearch.text=Incrementa_l Search
action.IncrementalSearch.description=Start incremental search (searches string as you type), IntelliJ IDEA 6.0 implementation.
action.FindUsages.text=Find _Usages...
action.FindUsages.text=Find _Usages
action.FindUsages.description=Find usages of the symbol at caret
action.ShowUsages.text=_Show Usages
action.ShowUsages.description=Show usages of the symbol at caret
action.ShowSettingsAndFindUsages.text=Find Usages Settings
action.ShowSettingsAndFindUsages.text=Find Usages Settings...
action.ShowSettingsAndFindUsages.description=Choose scope and edit options for the Find Usages action
action.FindUsagesInFile.text=F_ind Usages in File
action.FindUsagesInFile.description=Find usages of the symbol at caret in active editor
@@ -16,7 +16,6 @@
package com.intellij.openapi.util.io.win32;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.diagnostic.LogUtil;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.SystemInfo;
import org.jetbrains.annotations.NotNull;
@@ -100,7 +99,6 @@ public class IdeaWin32 {
final FileInfo result = getInfo0(path);
t = (System.nanoTime() - t) / 1000;
LOG.debug("getInfo(" + path + "): " + t + " mks");
LogUtil.debug(LOG, "getInfo(%s)", path);
return result;
}
else {
@@ -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.
@@ -51,6 +51,7 @@ public class CvsAnnotationProvider implements AnnotationProvider{
@NonNls private static final String INVALID_OPTION_F = "invalid option -- F";
@NonNls private static final String USAGE_CVSNTSRV_SERVER = "Usage: cvs";
private static final Collection<String> ourDoNotAnnotateBinaryRoots = new HashSet<String>();
private final Project myProject;
private final CvsHistoryProvider myCvsHistoryProvider;
@@ -64,9 +65,10 @@ public class CvsAnnotationProvider implements AnnotationProvider{
final File file = new File(virtualFile.getPath());
final File cvsLightweightFile = CvsUtil.getCvsLightweightFileForFile(file);
final String revision = CvsUtil.getRevisionFor(file);
final CvsConnectionSettings root =
CvsEntriesManager.getInstance().getCvsConnectionSettingsFor(file.getParentFile());
final AnnotateOperation operation = executeOperation(cvsLightweightFile, revision, root, true);
final CvsEntriesManager entriesManager = CvsEntriesManager.getInstance();
final CvsConnectionSettings root = entriesManager.getCvsConnectionSettingsFor(file.getParentFile());
final boolean binary = annotateBinary(virtualFile, root);
final AnnotateOperation operation = executeOperation(cvsLightweightFile, revision, root, binary, true);
final FilePath filePath = VcsContextFactory.SERVICE.getInstance().createFilePathOn(virtualFile);
final List<VcsFileRevision> revisions = myCvsHistoryProvider.createRevisions(filePath);
@@ -94,8 +96,8 @@ public class CvsAnnotationProvider implements AnnotationProvider{
hasLocalFile = true;
cvsFile = new File(CvsUtil.getModuleName(cvsVirtualFile));
}
final AnnotateOperation annotateOperation = executeOperation(cvsFile, revision, environment, true);
final boolean binary = annotateBinary(cvsVirtualFile, environment);
final AnnotateOperation annotateOperation = executeOperation(cvsFile, revision, environment, binary, true);
final Annotation[] lineAnnotations = annotateOperation.getLineAnnotations();
final List<VcsFileRevision> revisions;
if (hasLocalFile) {
@@ -119,12 +121,18 @@ public class CvsAnnotationProvider implements AnnotationProvider{
return new CvsFileAnnotation(annotateOperation.getContent(), lineAnnotations, revisions, cvsVirtualFile);
}
private AnnotateOperation executeOperation(File cvsLightweightFile, String revision, CvsEnvironment root, boolean retryOnFailure)
private static boolean annotateBinary(VirtualFile cvsVirtualFile, CvsEnvironment environment) {
if (ourDoNotAnnotateBinaryRoots.contains(environment.getCvsRootAsString())) {
return false;
}
return CvsEntriesManager.getInstance().getEntryFor(cvsVirtualFile).isBinary();
}
private AnnotateOperation executeOperation(File file, String revision, CvsEnvironment root, boolean binary, boolean retryOnFailure)
throws VcsException {
final AnnotateOperation operation = new AnnotateOperation(cvsLightweightFile, revision, root);
final AnnotateOperation operation = new AnnotateOperation(file, revision, root, binary);
final CvsOperationExecutor executor = new CvsOperationExecutor(myProject);
executor.performActionSync(new CommandCvsHandler(CvsBundle.getAnnotateOperationName(), operation),
CvsOperationExecutorCallback.EMPTY);
executor.performActionSync(new CommandCvsHandler(CvsBundle.getAnnotateOperationName(), operation), CvsOperationExecutorCallback.EMPTY);
final CvsResult result = executor.getResult();
if (result.hasErrors()) {
if (!retryOnFailure) {
@@ -133,8 +141,8 @@ public class CvsAnnotationProvider implements AnnotationProvider{
for (VcsException error : result.getErrors()) {
for (String message : error.getMessages()) {
if (message.contains(INVALID_OPTION_F) || message.contains(USAGE_CVSNTSRV_SERVER)) {
AnnotateOperation.doesNotSupportAnnotateBinary(root);
return executeOperation(cvsLightweightFile, revision, root, false);
ourDoNotAnnotateBinaryRoots.add(root.getCvsRootAsString());
return executeOperation(file, revision, root, false, false);
}
}
}
@@ -274,6 +274,9 @@ public class CvsTree extends JPanel implements CvsTabbedWindow.DeactivateListene
if (myShowFiles) {
process(directoryContent.getFilesRaw(), CvsElementFactory.FILE_ELEMENT_FACTORY, RemoteResourceDataProvider.NOT_EXPANDABLE);
}
if (myTree.getSelectionPath() == null) {
myTree.setSelectionPath(mySelectionPath);
}
final long currentTime = System.currentTimeMillis();
if (currentTime - timeStamp > waitTime) {
waitTime += 100; // ease off
@@ -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.
@@ -29,8 +29,6 @@ import org.netbeans.lib.cvsclient.command.annotate.AnnotateCommand;
import java.io.File;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
/**
@@ -40,49 +38,40 @@ public class AnnotateOperation extends LocalPathIndifferentOperation {
private static final Logger LOG = Logger.getInstance("#com.intellij.cvsSupport2.cvsoperations.cvsAnnotate.AnnotateOperation");
private static final Collection<String> ourDoNotSupportingAnnotateBinaryRoots = new HashSet<String>();
private final String myRevision;
private final List<Annotation> myAnnotations = new ArrayList<Annotation>();
private final StringBuffer myBuffer = new StringBuffer();
private final StringBuilder myBuffer = new StringBuilder();
private final LocalPathIndifferentOperationHelper myHelper;
private final boolean myAnnotateBinary;
public static AnnotateOperation createForFile(File file){
File cvsLightweightFile = CvsUtil.getCvsLightweightFileForFile(file);
String revision = CvsUtil.getRevisionFor(file);
final File cvsLightweightFile = CvsUtil.getCvsLightweightFileForFile(file);
final String revision = CvsUtil.getRevisionFor(file);
return new AnnotateOperation(cvsLightweightFile,
revision, CvsEntriesManager.getInstance().getCvsConnectionSettingsFor(file.getParentFile()));
revision, CvsEntriesManager.getInstance().getCvsConnectionSettingsFor(file.getParentFile()), false);
}
public AnnotateOperation(File cvsLightweightFile, String revision, CvsEnvironment env) {
this(cvsLightweightFile, revision, env, new LocalPathIndifferentOperationHelper(revision));
public AnnotateOperation(File cvsLightweightFile, String revision, CvsEnvironment env, boolean annotateBinary) {
this(cvsLightweightFile, revision, env, new LocalPathIndifferentOperationHelper(revision), annotateBinary);
}
private AnnotateOperation(File cvsLightweightFile, String revision, CvsEnvironment env,
LocalPathIndifferentOperationHelper helper){
LocalPathIndifferentOperationHelper helper, boolean annotateBinary){
super(helper.getAdminReader(), env);
myHelper = helper;
myHelper.addFile(cvsLightweightFile);
myRevision = revision;
myAnnotateBinary = annotateBinary;
}
protected Command createCommand(CvsRootProvider root, CvsExecutionEnvironment cvsExecutionEnvironment) {
AnnotateCommand result = new AnnotateCommand();
final AnnotateCommand result = new AnnotateCommand();
myHelper.addFilesTo(result);
result.setAnnotateByRevisionOrTag(myRevision);
if (!ourDoNotSupportingAnnotateBinaryRoots.contains(root.getCvsRootAsString())) {
result.setAnnotateBinary(true);
}
result.setAnnotateBinary(myAnnotateBinary);
return result;
}
public static void doesNotSupportAnnotateBinary(CvsEnvironment root) {
ourDoNotSupportingAnnotateBinaryRoots.add(root.getCvsRootAsString());
}
public Annotation[] getLineAnnotations(){
return myAnnotations.toArray(new Annotation[myAnnotations.size()]);
}
@@ -114,4 +114,6 @@ hg4idea.integrate.other.head=Other head: {0}
hg4idea.dialog.login.password.required=Login and password required
hg4idea.dialog.login.description=Login to {0}
hg4idea.exception.file.not.under.hg=The file {0} is not under Mercurial.
hg4idea.exception.file.not.under.hg=The file {0} is not under Mercurial.
hg4idea.history.copy.revision.number=Copy Revision Number
@@ -0,0 +1,63 @@
/*
* 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 org.zmlx.hg4idea;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.ide.CopyPasteManager;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.vcs.VcsDataKeys;
import com.intellij.openapi.vcs.history.VcsFileRevision;
import com.intellij.util.PlatformIcons;
import java.awt.datatransfer.StringSelection;
/**
* @author Nadya Zabrodina
*/
public class HgCopyHistoryRevisionNumberAction extends AnAction implements DumbAware {
/**
* The constructor
*/
public HgCopyHistoryRevisionNumberAction() {
super(HgVcsMessages.message("hg4idea.history.copy.revision.number"),
HgVcsMessages.message("hg4idea.history.copy.revision.number"),
PlatformIcons.COPY_ICON);
}
/**
* {@inheritDoc}
*/
@Override
public void actionPerformed(AnActionEvent e) {
VcsFileRevision revision = e.getData(VcsDataKeys.VCS_FILE_REVISION);
if (revision != null) {
CopyPasteManager.getInstance().setContents(new StringSelection(revision.getRevisionNumber().asString()));
}
}
/**
* {@inheritDoc}
*/
@Override
public void update(AnActionEvent e) {
super.update(e);
e.getPresentation().setEnabled((e.getData(VcsDataKeys.VCS_FILE_REVISION) != null));
}
}
@@ -16,17 +16,19 @@ import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vcs.FilePath;
import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.vcs.annotate.ShowAllAffectedGenericAction;
import com.intellij.openapi.vcs.history.*;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.ui.ColumnInfo;
import com.intellij.vcsUtil.VcsUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.zmlx.hg4idea.HgCopyHistoryRevisionNumberAction;
import org.zmlx.hg4idea.HgFile;
import org.zmlx.hg4idea.HgFileRevision;
import org.zmlx.hg4idea.util.HgUtil;
import org.zmlx.hg4idea.command.HgLogCommand;
import org.zmlx.hg4idea.command.HgWorkingCopyRevisionsCommand;
import org.zmlx.hg4idea.util.HgUtil;
import javax.swing.*;
import java.util.ArrayList;
@@ -49,7 +51,7 @@ public class HgHistoryProvider implements VcsHistoryProvider {
}
public AnAction[] getAdditionalActions(Runnable runnable) {
return new AnAction[0];
return new AnAction[]{ShowAllAffectedGenericAction.getInstance(), new HgCopyHistoryRevisionNumberAction()};
}
public boolean isDateOmittable() {
@@ -32,12 +32,10 @@ import com.intellij.openapi.projectRoots.JavaSdkType;
import com.intellij.openapi.projectRoots.JdkUtil;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.projectRoots.SimpleJavaSdkType;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.ShutDownTracker;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.util.Alarm;
import com.intellij.util.PathUtil;
import com.intellij.util.SmartList;
import com.intellij.util.SystemProperties;
import com.intellij.util.containers.ContainerUtil;
import gnu.trove.THashMap;
@@ -176,7 +174,7 @@ public class MavenServerManager extends RemoteObjectWrapper<MavenServer> impleme
ContainerUtil.addIfNotNull(PathUtil.getJarPathForClass(Query.class), classPath);
params.getClassPath().add(PathManager.getResourceRoot(getClass(), "/messages/CommonBundle.properties"));
params.getClassPath().addAll(classPath);
params.getClassPath().addAllFiles(collectClassPathAndLibsFolder().first);
params.getClassPath().addAllFiles(collectClassPathAndLibsFolder());
params.setMainClass(MAIN_CLASS);
@@ -262,51 +260,68 @@ public class MavenServerManager extends RemoteObjectWrapper<MavenServer> impleme
};
}
public static Pair<List<File>, File> collectClassPathAndLibsFolder() {
public static File getMavenLibDirectory() {
File pluginFileOrDir = new File(PathUtil.getJarPathForClass(MavenServerManager.class));
if (pluginFileOrDir.isDirectory()) {
File luceneLib = new File(PathUtil.getJarPathForClass(Query.class));
return new File(luceneLib.getParentFile().getParentFile().getParentFile(), "maven3-server-impl/lib/maven3/lib");
}
return new File(pluginFileOrDir.getParentFile(), "maven3");
}
public static List<File> collectClassPathAndLibsFolder() {
File pluginFileOrDir = new File(PathUtil.getJarPathForClass(MavenServerManager.class));
File libDir;
List<File> classpath = new SmartList<File>();
List<File> classpath = new ArrayList<File>();
String root = pluginFileOrDir.getParent();
if (pluginFileOrDir.isDirectory()) {
classpath.add(new File(pluginFileOrDir.getParent(), "maven-server-api"));
classpath.add(new File(root, "maven-server-api"));
File luceneLib = new File(PathUtil.getJarPathForClass(Query.class));
if (getInstance().isUseMaven2()) {
classpath.add(new File(pluginFileOrDir.getParent(), "maven2-server-impl"));
File luceneLib = new File(PathUtil.getJarPathForClass(Query.class));
libDir = new File(luceneLib.getParentFile().getParentFile().getParentFile(), "maven2-server-impl/lib");
classpath.add(new File(root, "maven2-server-impl"));
addDir(classpath, new File(luceneLib.getParentFile().getParentFile().getParentFile(), "maven2-server-impl/lib"));
}
else {
classpath.add(new File(pluginFileOrDir.getParent(), "maven3-server-impl"));
File luceneLib = new File(PathUtil.getJarPathForClass(Query.class));
classpath.add(new File(root, "maven3-server-impl"));
File maven3Module_Lib = new File(luceneLib.getParentFile().getParentFile().getParentFile(), "maven3-server-impl/lib");
addDir(classpath, maven3Module_Lib);
File maven3Home = new File(maven3Module_Lib, "maven3");
libDir = new File(maven3Home, "lib");
addDir(classpath, new File(maven3Home, "lib"));
classpath.add(new File(maven3Home, "boot/plexus-classworlds-2.4.jar"));
for (File jar : maven3Module_Lib.listFiles()) {
if (jar.isFile() && jar.getName().endsWith(".jar")) {
classpath.add(jar);
}
}
}
}
else {
libDir = pluginFileOrDir.getParentFile();
}
MavenLog.LOG.assertTrue(libDir.exists() && libDir.isDirectory(), "Maven server libraries dir not found: " + libDir);
classpath.add(new File(root, "maven-server-api.jar"));
File[] files = libDir.listFiles();
for (File jar : files) {
if (jar.isFile() && jar.getName().endsWith(".jar") && !jar.equals(pluginFileOrDir)) {
if (getInstance().isUseMaven2()) {
classpath.add(new File(root, "maven2-server-impl.jar"));
addDir(classpath, new File(root, "maven2"));
}
else {
classpath.add(new File(root, "maven3-server-impl.jar"));
addDir(classpath, new File(root, "maven3"));
}
}
return classpath;
}
private static void addDir(List<File> classpath, File dir) {
for (File jar : dir.listFiles()) {
if (jar.isFile() && jar.getName().endsWith(".jar")) {
classpath.add(jar);
}
}
return Pair.create(classpath, libDir);
}
public MavenEmbedderWrapper createEmbedder(final Project project, final boolean alwaysOnline) {
@@ -689,7 +689,7 @@ public class MavenUtil {
result = doResolveSuperPomFile(new File(mavenHome, LIB_DIR));
}
if (result == null) {
result = doResolveSuperPomFile(MavenServerManager.collectClassPathAndLibsFolder().second);
result = doResolveSuperPomFile(MavenServerManager.getMavenLibDirectory());
}
return result;
}
@@ -299,6 +299,9 @@
<wizardMode implementation="com.intellij.ide.util.newProjectWizard.modes.ImportImlMode" id="ImportImlMode"/>
<projectTemplatesFactory implementation="com.intellij.platform.templates.ArchivedTemplatesFactory"/>
<projectTemplatesFactory implementation="com.intellij.platform.templates.EmptyModuleTemplatesFactory"/>
<applicationService serviceImplementation="com.intellij.ide.util.newProjectWizard.SelectTemplateSettings"/>
<gotoFileContributor implementation="com.intellij.ide.util.gotoByName.ProjectBaseDirNavigationContributor"/>