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:
+2
-3
@@ -27,14 +27,13 @@ import com.intellij.ide.util.projectWizard.ModuleBuilder;
|
||||
import com.intellij.ide.util.projectWizard.ModuleWizardStep;
|
||||
import com.intellij.ide.util.projectWizard.WizardContext;
|
||||
import com.intellij.openapi.application.ApplicationNamesInfo;
|
||||
import com.intellij.openapi.module.ModuleType;
|
||||
import com.intellij.openapi.project.ProjectBundle;
|
||||
import com.intellij.openapi.roots.ui.configuration.ModulesProvider;
|
||||
import com.intellij.openapi.module.ModuleType;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -49,7 +48,7 @@ public class CreateFromScratchMode extends WizardMode {
|
||||
|
||||
@NotNull
|
||||
public String getDescription(final WizardContext context) {
|
||||
return ProjectBundle.message("project.new.wizard.from.scratch.description", ApplicationNamesInfo.getInstance().getProductName(), context.getPresentationName());
|
||||
return ProjectBundle.message("project.new.wizard.from.scratch.description", ApplicationNamesInfo.getInstance().getFullProductName(), context.getPresentationName());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ public abstract class CreateFromSourcesMode extends WizardMode {
|
||||
@NotNull
|
||||
public String getDescription(final WizardContext context) {
|
||||
return ProjectBundle.message("project.new.wizard.from.existent.sources.description",
|
||||
ApplicationNamesInfo.getInstance().getProductName(), context.getPresentationName());
|
||||
ApplicationNamesInfo.getInstance().getFullProductName(), context.getPresentationName());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -52,7 +52,7 @@ public class ImportImlMode extends WizardMode {
|
||||
|
||||
@NotNull
|
||||
public String getDescription(final WizardContext context) {
|
||||
return IdeBundle.message("prompt.select.module.file.to.import", ApplicationNamesInfo.getInstance().getProductName());
|
||||
return IdeBundle.message("prompt.select.module.file.to.import", ApplicationNamesInfo.getInstance().getFullProductName());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ public class ImportMode extends WizardMode {
|
||||
|
||||
@NotNull
|
||||
public String getDescription(final WizardContext context) {
|
||||
final String productName = ApplicationNamesInfo.getInstance().getProductName();
|
||||
final String productName = ApplicationNamesInfo.getInstance().getFullProductName();
|
||||
return ProjectBundle.message("project.new.wizard.import.description", productName, context.getPresentationName(), StringUtil.join(
|
||||
Arrays.asList(Extensions.getExtensions(ProjectImportProvider.PROJECT_IMPORT_PROVIDER)),
|
||||
new Function<ProjectImportProvider, String>() {
|
||||
|
||||
+2
-2
@@ -72,7 +72,7 @@ public class LibraryProjectStructureElement extends ProjectStructureElement {
|
||||
private static String createInvalidRootsDescription(List<String> invalidClasses, String rootName, String libraryName) {
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
buffer.append("<html>");
|
||||
buffer.append("Library '").append(libraryName).append("' has broken " + rootName + " " + StringUtil.pluralize("path", invalidClasses.size()) + ":");
|
||||
buffer.append("Library '").append(StringUtil.escapeXml(libraryName)).append("' has broken " + rootName + " " + StringUtil.pluralize("path", invalidClasses.size()) + ":");
|
||||
for (String url : invalidClasses) {
|
||||
buffer.append("<br> ");
|
||||
buffer.append(PathUtil.toPresentableUrl(url));
|
||||
@@ -129,7 +129,7 @@ public class LibraryProjectStructureElement extends ProjectStructureElement {
|
||||
@Override
|
||||
public ProjectStructureProblemDescription createUnusedElementWarning() {
|
||||
final List<ConfigurationErrorQuickFix> fixes = Arrays.asList(new AddLibraryToDependenciesFix(), new RemoveLibraryFix());
|
||||
return new ProjectStructureProblemDescription(getPresentableName() + " is not used", null, createPlace(),
|
||||
return new ProjectStructureProblemDescription("Library '" + StringUtil.escapeXml(myLibrary.getName()) + "'" + " is not used", null, createPlace(),
|
||||
ProjectStructureProblemType.unused("unused-library"), ProjectStructureProblemDescription.ProblemLevel.PROJECT,
|
||||
fixes, false);
|
||||
}
|
||||
|
||||
+2
-1
@@ -10,6 +10,7 @@ import com.intellij.openapi.roots.libraries.Library;
|
||||
import com.intellij.openapi.roots.ui.configuration.ModuleEditor;
|
||||
import com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable;
|
||||
import com.intellij.openapi.roots.ui.configuration.projectRoot.StructureConfigurableContext;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -57,7 +58,7 @@ public class ModuleProjectStructureElement extends ProjectStructureElement {
|
||||
null);
|
||||
}
|
||||
else {
|
||||
problemsHolder.registerProblem(ProjectBundle.message("project.roots.library.problem.message", entry.getPresentableName()), null,
|
||||
problemsHolder.registerProblem(ProjectBundle.message("project.roots.library.problem.message", StringUtil.escapeXml(entry.getPresentableName())), null,
|
||||
ProjectStructureProblemType.error("invalid-module-dependency"), createPlace(entry),
|
||||
null);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright 2000-2011 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.openapi.roots.impl;
|
||||
|
||||
import com.intellij.internal.statistic.AbstractApplicationUsagesCollector;
|
||||
import com.intellij.internal.statistic.beans.GroupDescriptor;
|
||||
import com.intellij.internal.statistic.beans.UsageDescriptor;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.LanguageLevelModuleExtension;
|
||||
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.HashSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public class LanguageLevelUsagesCollector extends AbstractApplicationUsagesCollector {
|
||||
public static final String GROUP_ID = "language-level";
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public GroupDescriptor getGroupId() {
|
||||
return GroupDescriptor.create(GROUP_ID, GroupDescriptor.HIGHER_PRIORITY);
|
||||
}
|
||||
|
||||
|
||||
@NotNull
|
||||
public Set<UsageDescriptor> getProjectUsages(@NotNull Project project) {
|
||||
|
||||
final Set<String> languageLevels = new HashSet<String>();
|
||||
for (Module module : ModuleManager.getInstance(project).getModules()) {
|
||||
final LanguageLevelModuleExtension instance = LanguageLevelModuleExtension.getInstance(module);
|
||||
final LanguageLevel languageLevel = instance.getLanguageLevel();
|
||||
if (languageLevel != null) {
|
||||
languageLevels.add(languageLevel.getPresentableText());
|
||||
}
|
||||
}
|
||||
languageLevels.add(LanguageLevelProjectExtension.getInstance(project).getLanguageLevel().getPresentableText());
|
||||
|
||||
return ContainerUtil.map2Set(languageLevels, new Function<String, UsageDescriptor>() {
|
||||
@Override
|
||||
public UsageDescriptor fun(String languageLevel) {
|
||||
return new UsageDescriptor(languageLevel, 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1179,7 +1179,7 @@ public class ExtractMethodProcessor implements MatchProvider {
|
||||
private boolean applyChosenClassAndExtract(List<PsiVariable> inputVariables, @Nullable Pass<ExtractMethodProcessor> extractPass)
|
||||
throws PrepareFailedException {
|
||||
myStatic = shouldBeStatic();
|
||||
if (myTargetClass.getContainingClass() == null || myTargetClass.hasModifierProperty(PsiModifier.STATIC)) {
|
||||
if (!PsiUtil.isLocalOrAnonymousClass(myTargetClass) && (myTargetClass.getContainingClass() == null || myTargetClass.hasModifierProperty(PsiModifier.STATIC))) {
|
||||
ElementNeedsThis needsThis = new ElementNeedsThis(myTargetClass);
|
||||
for (int i = 0; i < myElements.length && !needsThis.usesMembers(); i++) {
|
||||
PsiElement element = myElements[i];
|
||||
|
||||
+4
-6
@@ -396,12 +396,10 @@ public class IntroduceParameterHandler extends IntroduceHandlerBase {
|
||||
}
|
||||
|
||||
boolean mustBeFinal = false;
|
||||
if (myLocalVar != null) {
|
||||
for(PsiExpression occurrence: occurences) {
|
||||
if (PsiTreeUtil.getParentOfType(occurrence, PsiClass.class, PsiMethod.class) != method) {
|
||||
mustBeFinal = true;
|
||||
break;
|
||||
}
|
||||
for (PsiExpression occurrence : occurences) {
|
||||
if (PsiTreeUtil.getParentOfType(occurrence, PsiClass.class, PsiMethod.class) != method) {
|
||||
mustBeFinal = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -191,7 +191,7 @@ public class ThreadDumpPanel extends JPanel {
|
||||
final int s1 = getThreadStateCode(o1).ordinal();
|
||||
final int s2 = getThreadStateCode(o2).ordinal();
|
||||
if (s1 == s2) {
|
||||
return o1.getName().compareTo(o2.getName());
|
||||
return o1.getName().compareToIgnoreCase(o2.getName());
|
||||
} else {
|
||||
return s1 < s2 ? - 1 : 1;
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
+1
-1
@@ -57,7 +57,7 @@ public abstract class DescriptorProviderInspection extends InspectionTool implem
|
||||
private Map<RefEntity, CommonProblemDescriptor[]> myIgnoredElements;
|
||||
|
||||
private HashMap<RefEntity, CommonProblemDescriptor[]> myOldProblemElements = null;
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInspection.ex.DescriptorProviderInspection");
|
||||
protected static final Logger LOG = Logger.getInstance("#com.intellij.codeInspection.ex.DescriptorProviderInspection");
|
||||
|
||||
public void addProblemElement(RefEntity refElement, CommonProblemDescriptor... descriptions){
|
||||
addProblemElement(refElement, true, descriptions);
|
||||
|
||||
@@ -52,6 +52,7 @@ public abstract class InspectionToolWrapper<T extends InspectionProfileEntry, E
|
||||
public T getTool() {
|
||||
if (myTool == null) {
|
||||
myTool = (T)myEP.instantiateTool();
|
||||
LOG.assertTrue(myTool.getShortName().equals(myEP.shortName), "myTool: " + myTool.getShortName() + "; ep.shortName " + myEP.shortName);
|
||||
}
|
||||
return myTool;
|
||||
}
|
||||
|
||||
@@ -39,8 +39,9 @@ import java.awt.event.ActionEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
@@ -109,7 +110,7 @@ public class NavBarPopup extends LightweightHint implements Disposable{
|
||||
}
|
||||
|
||||
private void show(final NavBarItem item, boolean checkRepaint) {
|
||||
final RelativePoint point = new RelativePoint(item, new Point(-NavBarUIManager.getUI().getPopupOffset(item), item.getHeight()));
|
||||
final RelativePoint point = new RelativePoint(item, new Point(0, item.getHeight()));
|
||||
final Point p = point.getPoint(myPanel);
|
||||
if (p.x == 0 && p.y == 0 && checkRepaint) { // need repaint of nav bar panel
|
||||
ApplicationManager.getApplication().invokeLater(new Runnable() {
|
||||
@@ -119,7 +120,8 @@ public class NavBarPopup extends LightweightHint implements Disposable{
|
||||
}
|
||||
});
|
||||
} else {
|
||||
show(myPanel, p.x, p.y, myPanel, new HintHint(myPanel, p));
|
||||
int offset = NavBarUIManager.getUI().getPopupOffset(item);
|
||||
show(myPanel, p.x - offset, p.y, myPanel, new HintHint(myPanel, p));
|
||||
final JBList list = getList();
|
||||
if (0 <= myIndex && myIndex < list.getItemsCount()) {
|
||||
ListScrollingUtil.selectItem(list, myIndex);
|
||||
|
||||
+10
-2
@@ -129,7 +129,11 @@ public abstract class ParameterTableModelBase<P extends ParameterInfo> extends L
|
||||
private final FileType myFileType;
|
||||
|
||||
public TypeColumn(Project project, FileType fileType) {
|
||||
super(RefactoringBundle.message("column.name.type"));
|
||||
this(project, fileType, RefactoringBundle.message("column.name.type"));
|
||||
}
|
||||
|
||||
public TypeColumn(Project project, FileType fileType, String title) {
|
||||
super(title);
|
||||
myProject = project;
|
||||
myFileType = fileType;
|
||||
}
|
||||
@@ -157,7 +161,11 @@ public abstract class ParameterTableModelBase<P extends ParameterInfo> extends L
|
||||
private final Project myProject;
|
||||
|
||||
public NameColumn(Project project) {
|
||||
super(RefactoringBundle.message("column.name.name"));
|
||||
this(project, RefactoringBundle.message("column.name.name"));
|
||||
}
|
||||
|
||||
public NameColumn(Project project, String title) {
|
||||
super(title);
|
||||
myProject = project;
|
||||
}
|
||||
|
||||
|
||||
@@ -165,6 +165,7 @@ public class FileBasedIndex implements ApplicationComponent {
|
||||
synchronized (myTransactionMap) {
|
||||
myTransactionMap.remove(doc);
|
||||
}
|
||||
incTransactionCount(doc);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1234,7 +1235,8 @@ public class FileBasedIndex implements ApplicationComponent {
|
||||
content = new AuthenticContent(document);
|
||||
}
|
||||
|
||||
final long currentDocStamp = content.getModificationStamp();
|
||||
final long currentDocStamp = content.getModificationStamp() +
|
||||
getTransactionCount(document); // we add transaction count in order to deal with committed status
|
||||
if (currentDocStamp != myLastIndexedDocStamps.getAndSet(document, requestedIndexId, currentDocStamp)) {
|
||||
final Ref<StorageException> exRef = new Ref<StorageException>(null);
|
||||
ProgressManager.getInstance().executeNonCancelableSection(new Runnable() {
|
||||
@@ -1280,6 +1282,18 @@ public class FileBasedIndex implements ApplicationComponent {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static final Key<Integer> TRANSACTION_COUNT = new Key<Integer>("Transaction count");
|
||||
|
||||
private long getTransactionCount(@NotNull Document document) {
|
||||
Integer data = document.getUserData(TRANSACTION_COUNT);
|
||||
return data != null ? data : 0;
|
||||
}
|
||||
|
||||
private void incTransactionCount(@NotNull Document document) {
|
||||
Integer data = document.getUserData(TRANSACTION_COUNT);
|
||||
document.putUserData(TRANSACTION_COUNT, (data != null ? data : 0) + 1);
|
||||
}
|
||||
|
||||
public static final Key<EditorHighlighter> EDITOR_HIGHLIGHTER = new Key<EditorHighlighter>("Editor");
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -62,7 +62,8 @@ public class ActionUninstallPlugin extends AnAction implements DumbAware {
|
||||
}
|
||||
}
|
||||
if (descriptor instanceof PluginNode) {
|
||||
enabled &= PluginManagerColumnInfo.getRealNodeState((PluginNode)descriptor) == PluginNode.STATUS_DOWNLOADED;
|
||||
enabled = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright 2000-2011 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.openapi.actionSystem.impl;
|
||||
|
||||
import com.apple.eawt.event.*;
|
||||
import com.intellij.openapi.wm.IdeFrame;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* User: anna
|
||||
* Date: 11/29/11
|
||||
*/
|
||||
class MacGestureAdapter extends GestureAdapter {
|
||||
double magnification;
|
||||
private final IdeFrame myFrame;
|
||||
private MouseGestureManager myManager;
|
||||
|
||||
public MacGestureAdapter(MouseGestureManager manager, IdeFrame frame) {
|
||||
myFrame = frame;
|
||||
magnification = 0;
|
||||
myManager = manager;
|
||||
GestureUtilities.addGestureListenerTo(frame.getComponent(), this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void gestureBegan(GesturePhaseEvent event) {
|
||||
myManager.activateTrackpad();
|
||||
magnification = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void gestureEnded(GesturePhaseEvent event) {
|
||||
myManager.activateTrackpad();
|
||||
if (magnification != 0) {
|
||||
MouseGestureManager.processMagnification(myFrame, magnification);
|
||||
magnification = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void swipedLeft(SwipeEvent event) {
|
||||
myManager.activateTrackpad();
|
||||
myManager.processLeftSwipe(myFrame);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void swipedRight(SwipeEvent event) {
|
||||
myManager.activateTrackpad();
|
||||
myManager.processRightSwipe(myFrame);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void magnify(MagnificationEvent event) {
|
||||
myManager.activateTrackpad();
|
||||
magnification += event.getMagnification();
|
||||
}
|
||||
|
||||
public void remove(JComponent cmp) {
|
||||
GestureUtilities.removeGestureListenerFrom(cmp, this);
|
||||
}
|
||||
}
|
||||
+37
-30
@@ -15,22 +15,24 @@
|
||||
*/
|
||||
package com.intellij.openapi.actionSystem.impl;
|
||||
|
||||
import com.intellij.ide.DataManager;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.components.ApplicationComponent;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.colors.EditorColorsManager;
|
||||
import com.intellij.openapi.editor.ex.EditorEx;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.wm.IdeFrame;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.lang.reflect.InvocationHandler;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Proxy;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -40,6 +42,8 @@ public class MouseGestureManager implements ApplicationComponent {
|
||||
private ActionManagerImpl myActionManager;
|
||||
|
||||
private Map<IdeFrame, Object> myListeners = new HashMap<IdeFrame, Object>();
|
||||
private boolean HAS_TRACKPAD = false;
|
||||
|
||||
|
||||
public MouseGestureManager(ActionManagerImpl actionManager) {
|
||||
myActionManager = actionManager;
|
||||
@@ -54,47 +58,53 @@ public class MouseGestureManager implements ApplicationComponent {
|
||||
remove(frame);
|
||||
}
|
||||
|
||||
Class<?> gestureListenerClass = Class.forName("com.apple.eawt.event.GestureListener");
|
||||
Class<?> swipeListenerClass = Class.forName("com.apple.eawt.event.SwipeListener");
|
||||
Object listener = Proxy.newProxyInstance(getClass().getClassLoader(), new Class[]{swipeListenerClass}, new InvocationHandler() {
|
||||
@Override
|
||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||
if ("swipedRight".equals(method.getName())) {
|
||||
processRightSwipe(frame);
|
||||
} else if ("swipedLeft".equals(method.getName())) {
|
||||
processLeftSwipe(frame);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
Class<?> utilsClass = Class.forName("com.apple.eawt.event.GestureUtilities");
|
||||
Method addMethod = utilsClass.getDeclaredMethod("addGestureListenerTo", JComponent.class, gestureListenerClass);
|
||||
addMethod.invoke(null, frame.getComponent(), listener);
|
||||
Object listener = new MacGestureAdapter(this, frame);
|
||||
|
||||
myListeners.put(frame, listener);
|
||||
}
|
||||
catch (Exception e) {
|
||||
catch (Throwable e) {
|
||||
LOG.debug(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void processLeftSwipe(IdeFrame frame) {
|
||||
protected void activateTrackpad() {
|
||||
HAS_TRACKPAD = true;
|
||||
}
|
||||
|
||||
public boolean hasTrackpad() {
|
||||
return HAS_TRACKPAD;
|
||||
}
|
||||
|
||||
protected static void processMagnification(IdeFrame frame, double magnification) {
|
||||
Point mouse = MouseInfo.getPointerInfo().getLocation();
|
||||
SwingUtilities.convertPointFromScreen(mouse, frame.getComponent());
|
||||
Component componentAt = SwingUtilities.getDeepestComponentAt(frame.getComponent(), mouse.x, mouse.y);
|
||||
if (componentAt != null) {
|
||||
Editor editor = PlatformDataKeys.EDITOR.getData(DataManager.getInstance().getDataContext(componentAt));
|
||||
if (editor != null) {
|
||||
double currentSize = editor.getColorsScheme().getEditorFontSize();
|
||||
int defaultFontSize = EditorColorsManager.getInstance().getGlobalScheme().getEditorFontSize();
|
||||
((EditorEx)editor).setFontSize((int)(Math.max(currentSize + magnification * 3, defaultFontSize)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void processLeftSwipe(IdeFrame frame) {
|
||||
AnAction forward = myActionManager.getAction("Forward");
|
||||
if (forward == null) return;
|
||||
|
||||
myActionManager.tryToExecute(forward, createMouseEventWrapper(frame), null, null, false);
|
||||
}
|
||||
|
||||
private void processRightSwipe(IdeFrame frame) {
|
||||
protected void processRightSwipe(IdeFrame frame) {
|
||||
AnAction back = myActionManager.getAction("Back");
|
||||
if (back == null) return;
|
||||
|
||||
myActionManager.tryToExecute(back, createMouseEventWrapper(frame), null, null, false);
|
||||
}
|
||||
|
||||
private MouseEvent createMouseEventWrapper(IdeFrame frame) {
|
||||
private static MouseEvent createMouseEventWrapper(IdeFrame frame) {
|
||||
return new MouseEvent(frame.getComponent(), ActionEvent.ACTION_PERFORMED, System.currentTimeMillis(), 0, 0, 0, 0, false, 0);
|
||||
}
|
||||
|
||||
@@ -107,13 +117,10 @@ public class MouseGestureManager implements ApplicationComponent {
|
||||
JComponent cmp = frame.getComponent();
|
||||
myListeners.remove(frame);
|
||||
if (listener != null && cmp != null && cmp.isShowing()) {
|
||||
Class<?> gestureListenerClass = Class.forName("com.apple.eawt.event.GestureListener");
|
||||
Class<?> utilsClass = Class.forName("com.apple.eawt.event.GestureUtilities");
|
||||
Method addMethod = utilsClass.getDeclaredMethod("removeGestureListenerFrom", JComponent.class, gestureListenerClass);
|
||||
addMethod.invoke(null, cmp, listener);
|
||||
((MacGestureAdapter)listener).remove(cmp);
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
catch (Throwable e) {
|
||||
LOG.debug(e);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -355,7 +355,7 @@ public class ApplicationImpl extends ComponentManagerImpl implements Application
|
||||
LOG.error(ex);
|
||||
@NonNls final String errorMessage = "Fatal error initializing class " + componentClassName + ":\n" +
|
||||
ex.toString() +
|
||||
"\nComplete error stacktrace was written to idea.log";
|
||||
"\nComplete error stacktrace was written to " + PathManager.getLogPath() + "/idea.log";
|
||||
if (!myHeadlessMode) {
|
||||
JOptionPane.showMessageDialog(null, errorMessage);
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.actionSystem.IdeActions;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.actionSystem.ex.ActionManagerEx;
|
||||
import com.intellij.openapi.actionSystem.impl.MouseGestureManager;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.application.ex.ApplicationManagerEx;
|
||||
@@ -6096,7 +6097,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
|
||||
|
||||
@Override
|
||||
protected void processMouseWheelEvent(MouseWheelEvent e) {
|
||||
if (mySettings.isWheelFontChangeEnabled()) {
|
||||
if (mySettings.isWheelFontChangeEnabled() && !MouseGestureManager.getInstance().hasTrackpad()) {
|
||||
if (EditorUtil.isChangeFontSize(e)) {
|
||||
setFontSize(myScheme.getEditorFontSize() - e.getWheelRotation());
|
||||
return;
|
||||
|
||||
@@ -162,3 +162,6 @@ navbar.is.decorated=true
|
||||
navbar.is.decorated.description=NavBar with decorations
|
||||
show.anonymous.in.structure.view=false
|
||||
show.anonymous.in.structure.view.description=Enables Java anonymous classes in Structure View
|
||||
|
||||
enable.groovy.hotswap=true
|
||||
enable.groovy.hotswap.description=Whether IDEA should add a special java agent to the debugged process which allows to hot-swap Groovy changes in some cases
|
||||
|
||||
@@ -438,7 +438,9 @@ public class XDebugSessionImpl implements XDebugSession {
|
||||
UIUtil.invokeLaterIfNeeded(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mySessionTab.getUi().clearAttractionBy(XDebuggerUIConstants.LAYOUT_VIEW_BREAKPOINT_CONDITION);
|
||||
if (mySessionTab != null) {
|
||||
mySessionTab.getUi().clearAttractionBy(XDebuggerUIConstants.LAYOUT_VIEW_BREAKPOINT_CONDITION);
|
||||
}
|
||||
}
|
||||
});
|
||||
myDispatcher.getMulticaster().sessionResumed();
|
||||
|
||||
@@ -31,6 +31,7 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleManager;
|
||||
import com.intellij.openapi.project.DumbService;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.*;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
@@ -643,12 +644,17 @@ public class AndroidCompileUtil {
|
||||
|
||||
public static void collectAllResources(@NotNull final AndroidFacet facet, final Set<ResourceEntry> resourceSet) {
|
||||
final LocalResourceManager manager = facet.getLocalResourceManager();
|
||||
final Project project = facet.getModule().getProject();
|
||||
final DumbService dumbService = DumbService.getInstance(project);
|
||||
|
||||
for (final String resType : ResourceType.getNames()) {
|
||||
for (final ResourceElement element : manager.getValueResources(resType)) {
|
||||
dumbService.waitForSmartMode();
|
||||
|
||||
ApplicationManager.getApplication().runReadAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!element.isValid() || facet.getModule().isDisposed() || facet.getModule().getProject().isDisposed()) {
|
||||
if (!element.isValid() || facet.getModule().isDisposed() || project.isDisposed()) {
|
||||
return;
|
||||
}
|
||||
final String name = element.getName().getValue();
|
||||
@@ -662,10 +668,12 @@ public class AndroidCompileUtil {
|
||||
}
|
||||
|
||||
for (final Resources resources : manager.getResourceElements()) {
|
||||
dumbService.waitForSmartMode();
|
||||
|
||||
ApplicationManager.getApplication().runReadAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!resources.isValid() || facet.getModule().isDisposed() || facet.getModule().getProject().isDisposed()) {
|
||||
if (!resources.isValid() || facet.getModule().isDisposed() || project.isDisposed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -688,10 +696,12 @@ public class AndroidCompileUtil {
|
||||
});
|
||||
}
|
||||
|
||||
dumbService.waitForSmartMode();
|
||||
|
||||
ApplicationManager.getApplication().runReadAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (facet.getModule().isDisposed() || facet.getModule().getProject().isDisposed()) {
|
||||
if (facet.getModule().isDisposed() || project.isDisposed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -360,10 +360,12 @@ action.Cvs.Import.description=Put files into a CVS repository
|
||||
action.Cvs.BrowseCVSRepository.text=_Browse CVS Repository...
|
||||
action.Cvs.BrowseCVSRepository.description=Browse a CVS repository
|
||||
group.CvsGlobalGroup.text=_CVS
|
||||
action.GlobalSettings.text=Global Settings...
|
||||
action.GlobalSettings.text=Global CVS Settings...
|
||||
action.GlobalSettings.description=Configure global CVS settings
|
||||
action.ConfigureCvsRoots.text=Configure CVS _Roots...
|
||||
action.ConfigureCvsRoots.description=Configure CVSroots
|
||||
action.ConfigureCvsRoots.description=Configure CVS Roots
|
||||
action.MigrateCvsRoot.text=_Migrate CVS Root...
|
||||
action.MigrateCvsRoot.description=Change CVS root for selected directory and all directories below it
|
||||
group.CvsFilePopupGroup.text=_CVS
|
||||
action.Cvs.GetFromRepository.text=Get
|
||||
action.Cvs.GetFromRepository.description=Get from cvs repository
|
||||
@@ -461,4 +463,9 @@ switched.revision.format=revision {0}
|
||||
changelist.column.branch=Branch
|
||||
annotation.tooltip=Revision: {0} Date: {1}\nAuthor: {2}\n\n{3}
|
||||
message.password.file.does.not.exist=Password file {0} does not exist. Do you want to create it?
|
||||
title.password.file.does.not.exist=Missing Password File
|
||||
title.password.file.does.not.exist=Missing Password File
|
||||
migrate.cvs.root.directory.label=Migrate CVS Root under &directory:
|
||||
error.message.directory.is.not.under.cvs=Directory is not under CVS
|
||||
migrate.replace.if.root.equals.label=Replace if CVS root &equals {0}
|
||||
migrate.replace.all.roots.label=Replace &all CVS roots
|
||||
migrate.target.root.label=To the following &CVS root:
|
||||
@@ -1,7 +1,7 @@
|
||||
<idea-plugin version="2">
|
||||
<name>CVS Integration</name>
|
||||
<id>CVS</id>
|
||||
<version>0.1</version>
|
||||
<version>11</version>
|
||||
<vendor logo="/general/ijLogo.png">JetBrains</vendor>
|
||||
<resource-bundle>com.intellij.cvsSupport2.CvsBundle</resource-bundle>
|
||||
<category>VCS Integration</category>
|
||||
@@ -57,6 +57,7 @@
|
||||
<separator/>
|
||||
<action id="GlobalSettings" class="com.intellij.cvsSupport2.actions.GlobalSettingsAction"/>
|
||||
<action id="ConfigureCvsRoots" class="com.intellij.cvsSupport2.actions.ConfigureCvsRootsAction"/>
|
||||
<action id="MigrateCvsRoot" class="com.intellij.cvsSupport2.actions.MigrateCvsRootAction"/>
|
||||
<separator/>
|
||||
</group>
|
||||
|
||||
|
||||
+141
@@ -0,0 +1,141 @@
|
||||
/*
|
||||
* Copyright 2011 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.cvsSupport2.actions;
|
||||
|
||||
import com.intellij.cvsSupport2.CvsUtil;
|
||||
import com.intellij.cvsSupport2.actions.actionVisibility.CvsActionVisibility;
|
||||
import com.intellij.cvsSupport2.actions.cvsContext.CvsContextWrapper;
|
||||
import com.intellij.cvsSupport2.config.CvsRootConfiguration;
|
||||
import com.intellij.cvsSupport2.ui.MigrateRootDialog;
|
||||
import com.intellij.cvsSupport2.util.CvsVfsUtil;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.application.AccessToken;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.vcs.actions.VcsContext;
|
||||
import com.intellij.openapi.vcs.changes.VcsDirtyScopeManager;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.netbeans.lib.cvsclient.file.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileFilter;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MigrateCvsRootAction extends AnAction {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.cvsSupport2.actions.MigrateCvsRootAction");
|
||||
private final CvsActionVisibility myVisibility = new CvsActionVisibility();
|
||||
|
||||
public MigrateCvsRootAction() {
|
||||
super();
|
||||
myVisibility.shouldNotBePerformedOnFile();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(AnActionEvent e) {
|
||||
myVisibility.applyToEvent(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent event) {
|
||||
final VcsContext context = CvsContextWrapper.createInstance(event);
|
||||
final VirtualFile selectedFile = context.getSelectedFile();
|
||||
final MigrateRootDialog dialog = new MigrateRootDialog(context.getProject(), selectedFile);
|
||||
dialog.show();
|
||||
if (!dialog.isOK()) return;
|
||||
final File directory = dialog.getSelectedDirectory();
|
||||
final boolean shouldReplaceAllRoots = dialog.shouldReplaceAllRoots();
|
||||
final List<File> rootFiles = new ArrayList<File>();
|
||||
try {
|
||||
if (shouldReplaceAllRoots) {
|
||||
collectRootFiles(directory, null, rootFiles);
|
||||
} else {
|
||||
collectRootFiles(directory, dialog.getCvsRoot(), rootFiles);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
LOG.error(e);
|
||||
return;
|
||||
}
|
||||
final CvsRootConfiguration cvsConfiguration = dialog.getSelectedCvsConfiguration();
|
||||
final String cvsRoot = cvsConfiguration.getCvsRootAsString();
|
||||
for (final File file : rootFiles) {
|
||||
try {
|
||||
FileUtils.writeLine(file, cvsRoot);
|
||||
}
|
||||
catch (IOException e) {
|
||||
LOG.error(e);
|
||||
break;
|
||||
}
|
||||
}
|
||||
final AccessToken token = ApplicationManager.getApplication().acquireReadActionLock();
|
||||
try {
|
||||
final VcsDirtyScopeManager dirty = VcsDirtyScopeManager.getInstance(context.getProject());
|
||||
for (File file : rootFiles) {
|
||||
dirty.fileDirty(CvsVfsUtil.findFileByIoFile(file));
|
||||
}
|
||||
CvsVfsUtil.findFileByIoFile(directory).refresh(false, true);
|
||||
} finally {
|
||||
token.finish();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static void collectRootFiles(File directory, final String root, final List<File> rootFiles) throws IOException {
|
||||
final File rootFile = getRootFile(directory);
|
||||
if (rootFile != null) {
|
||||
rootFiles.add(rootFile);
|
||||
}
|
||||
try {
|
||||
final File[] files = directory.listFiles(new FileFilter() {
|
||||
@Override
|
||||
public boolean accept(File file) {
|
||||
if (!file.isDirectory()) {
|
||||
return false;
|
||||
}
|
||||
final File rootFile = getRootFile(file);
|
||||
if (!rootFile.exists()) {
|
||||
return false;
|
||||
}
|
||||
if (root == null) {
|
||||
return true;
|
||||
}
|
||||
try {
|
||||
final String cvsRoot = FileUtils.readLineFromFile(rootFile).trim();
|
||||
return root.equals(cvsRoot);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
for (File file : files) {
|
||||
collectRootFiles(file, root, rootFiles);
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
final Throwable cause = e.getCause();
|
||||
if (cause instanceof IOException) {
|
||||
throw (IOException) cause;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static File getRootFile(File directory) {
|
||||
return new File(directory, CvsUtil.CVS + '/' + CvsUtil.CVS_ROOT_FILE);
|
||||
}
|
||||
}
|
||||
+15
-36
@@ -19,10 +19,10 @@ import com.intellij.CvsBundle;
|
||||
import com.intellij.cvsSupport2.CvsUtil;
|
||||
import com.intellij.cvsSupport2.application.CvsEntriesManager;
|
||||
import com.intellij.cvsSupport2.connections.CvsEnvironment;
|
||||
import com.intellij.cvsSupport2.cvsExecution.CvsOperationExecutor;
|
||||
import com.intellij.cvsSupport2.cvsExecution.CvsOperationExecutorCallback;
|
||||
import com.intellij.cvsSupport2.cvshandlers.CommandCvsHandler;
|
||||
import com.intellij.cvsSupport2.connections.CvsRootOnFileSystem;
|
||||
import com.intellij.cvsSupport2.errorHandling.CannotFindCvsRootException;
|
||||
import com.intellij.cvsSupport2.history.CvsRevisionNumber;
|
||||
import com.intellij.cvsSupport2.util.CvsVfsUtil;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.cvsIntegration.CvsResult;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
@@ -42,7 +42,6 @@ import com.intellij.openapi.vcs.versionBrowser.CommittedChangeList;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.util.AsynchConsumer;
|
||||
import com.intellij.util.Consumer;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.netbeans.lib.cvsclient.admin.Entry;
|
||||
@@ -50,7 +49,6 @@ import org.netbeans.lib.cvsclient.command.log.Revision;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
@@ -63,8 +61,6 @@ public class CvsCommittedChangesProvider implements CachingCommittedChangesProvi
|
||||
private final Project myProject;
|
||||
private final MyZipper myZipper;
|
||||
|
||||
@NonNls private static final String INVALID_OPTION_S = "invalid option -- S";
|
||||
|
||||
public CvsCommittedChangesProvider(Project project) {
|
||||
myProject = project;
|
||||
myZipper = new MyZipper();
|
||||
@@ -137,8 +133,7 @@ public class CvsCommittedChangesProvider implements CachingCommittedChangesProvi
|
||||
@Nullable
|
||||
@Override
|
||||
public Pair<CvsChangeList, FilePath> getOneList(VirtualFile file, final VcsRevisionNumber number) throws VcsException {
|
||||
final File ioFile = new File(file.getPath());
|
||||
final FilePath filePath = VcsContextFactory.SERVICE.getInstance().createFilePathOn(ioFile);
|
||||
final FilePath filePath = VcsContextFactory.SERVICE.getInstance().createFilePathOn(file);
|
||||
final VirtualFile vcsRoot = ProjectLevelVcsManager.getInstance(myProject).getVcsRootFor(filePath);
|
||||
final CvsRepositoryLocation cvsLocation = getLocationFor(filePath);
|
||||
if (cvsLocation == null) return null;
|
||||
@@ -158,7 +153,7 @@ public class CvsCommittedChangesProvider implements CachingCommittedChangesProvi
|
||||
result[0] = builder.addRevision(revision);
|
||||
}
|
||||
}, cvsLocation.getModuleName(), number.asString());
|
||||
final CvsResult executionResult = runRLogOperation(operation);
|
||||
final CvsResult executionResult = operation.run(myProject);
|
||||
|
||||
if (executionResult.isCanceled()) {
|
||||
throw new ProcessCanceledException();
|
||||
@@ -191,7 +186,7 @@ public class CvsCommittedChangesProvider implements CachingCommittedChangesProvi
|
||||
}
|
||||
}
|
||||
});
|
||||
final CvsResult cvsResult = runRLogOperation(operation2);
|
||||
final CvsResult cvsResult = operation2.run(myProject);
|
||||
if (cvsResult.hasErrors()) {
|
||||
throw cvsResult.composeError();
|
||||
}
|
||||
@@ -243,7 +238,7 @@ public class CvsCommittedChangesProvider implements CachingCommittedChangesProvi
|
||||
}
|
||||
}
|
||||
});
|
||||
final CvsResult executionResult = runRLogOperation(operation);
|
||||
final CvsResult executionResult = operation.run(myProject);
|
||||
|
||||
if (executionResult.isCanceled()) {
|
||||
throw new ProcessCanceledException();
|
||||
@@ -259,11 +254,17 @@ public class CvsCommittedChangesProvider implements CachingCommittedChangesProvi
|
||||
|
||||
private List<CvsChangeList> loadCommittedChanges(final ChangeBrowserSettings settings,
|
||||
final String module,
|
||||
final CvsEnvironment connectionSettings,
|
||||
CvsEnvironment connectionSettings,
|
||||
final VirtualFile rootFile) throws VcsException {
|
||||
if (connectionSettings.isOffline()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
try {
|
||||
// refresh cvs connection settings from file system
|
||||
connectionSettings = CvsRootOnFileSystem.createMeOn(CvsVfsUtil.getFileFor(rootFile));
|
||||
}
|
||||
catch (CannotFindCvsRootException ignore) {
|
||||
}
|
||||
final CvsChangeListsBuilder builder = new CvsChangeListsBuilder(module, connectionSettings, myProject, rootFile);
|
||||
Date dateTo = settings.getDateBeforeFilter();
|
||||
Date dateFrom = settings.getDateAfterFilter();
|
||||
@@ -280,7 +281,7 @@ public class CvsCommittedChangesProvider implements CachingCommittedChangesProvi
|
||||
log.add(logInformationWrapper);
|
||||
}
|
||||
});
|
||||
final CvsResult executionResult = runRLogOperation(operation);
|
||||
final CvsResult executionResult = operation.run(myProject);
|
||||
|
||||
if (executionResult.isCanceled()) {
|
||||
throw new ProcessCanceledException();
|
||||
@@ -296,28 +297,6 @@ public class CvsCommittedChangesProvider implements CachingCommittedChangesProvi
|
||||
}
|
||||
}
|
||||
|
||||
private CvsResult runRLogOperation(final LoadHistoryOperation operation) {
|
||||
final CvsResult executionResult = runRLogOperationImpl(operation);
|
||||
|
||||
for (VcsException error : executionResult.getErrors()) {
|
||||
for (String message : error.getMessages()) {
|
||||
if (message.contains(INVALID_OPTION_S)) {
|
||||
operation.disableSuppressEmptyHeadersForCurrentCvsRoot();
|
||||
// try only once
|
||||
return runRLogOperationImpl(operation);
|
||||
}
|
||||
}
|
||||
}
|
||||
return executionResult;
|
||||
}
|
||||
|
||||
private CvsResult runRLogOperationImpl(final LoadHistoryOperation operation) {
|
||||
final CvsOperationExecutor executor = new CvsOperationExecutor(myProject);
|
||||
executor.performActionSync(new CommandCvsHandler(CvsBundle.message("browse.changes.load.history.progress.title"), operation),
|
||||
CvsOperationExecutorCallback.EMPTY);
|
||||
return executor.getResult();
|
||||
}
|
||||
|
||||
public int getFormatVersion() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
+33
-2
@@ -15,11 +15,18 @@
|
||||
*/
|
||||
package com.intellij.cvsSupport2.changeBrowser;
|
||||
|
||||
import com.intellij.CvsBundle;
|
||||
import com.intellij.cvsSupport2.connections.CvsEnvironment;
|
||||
import com.intellij.cvsSupport2.connections.CvsRootProvider;
|
||||
import com.intellij.cvsSupport2.cvsExecution.CvsOperationExecutor;
|
||||
import com.intellij.cvsSupport2.cvsExecution.CvsOperationExecutorCallback;
|
||||
import com.intellij.cvsSupport2.cvshandlers.CommandCvsHandler;
|
||||
import com.intellij.cvsSupport2.cvsoperations.common.CvsExecutionEnvironment;
|
||||
import com.intellij.cvsSupport2.cvsoperations.common.LocalPathIndifferentOperation;
|
||||
import com.intellij.cvsSupport2.cvsoperations.cvsLog.RlogCommand;
|
||||
import com.intellij.openapi.cvsIntegration.CvsResult;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vcs.VcsException;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.intellij.util.text.SyncDateFormat;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -36,6 +43,7 @@ import java.util.Locale;
|
||||
|
||||
public class LoadHistoryOperation extends LocalPathIndifferentOperation {
|
||||
|
||||
@NonNls private static final String INVALID_OPTION_S = "invalid option -- S";
|
||||
@NonNls private static final SyncDateFormat DATE_FORMAT = new SyncDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ssZ", Locale.US));
|
||||
private static final Collection<String> ourDoNotSupportingSOptionServers = new HashSet<String>();
|
||||
|
||||
@@ -46,7 +54,8 @@ public class LoadHistoryOperation extends LocalPathIndifferentOperation {
|
||||
private final String[] myRevisions;
|
||||
private final boolean myNoTags;
|
||||
|
||||
public LoadHistoryOperation(CvsEnvironment environment, String module,
|
||||
public LoadHistoryOperation(CvsEnvironment environment,
|
||||
String module,
|
||||
@Nullable Date dateFrom,
|
||||
@Nullable Date dateTo,
|
||||
@NotNull final Consumer<LogInformationWrapper> consumer) {
|
||||
@@ -93,7 +102,7 @@ public class LoadHistoryOperation extends LocalPathIndifferentOperation {
|
||||
return command;
|
||||
}
|
||||
|
||||
public void disableSuppressEmptyHeadersForCurrentCvsRoot() {
|
||||
private void disableSuppressEmptyHeadersForCurrentCvsRoot() {
|
||||
ourDoNotSupportingSOptionServers.add(myEnvironment.getCvsRootAsString());
|
||||
}
|
||||
|
||||
@@ -122,4 +131,26 @@ public class LoadHistoryOperation extends LocalPathIndifferentOperation {
|
||||
protected boolean runInExclusiveLock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public CvsResult run(Project project) {
|
||||
final CvsResult executionResult = internalRun(project);
|
||||
|
||||
for (VcsException error : executionResult.getErrors()) {
|
||||
for (String message : error.getMessages()) {
|
||||
if (message.contains(INVALID_OPTION_S)) {
|
||||
disableSuppressEmptyHeadersForCurrentCvsRoot();
|
||||
// try only once
|
||||
return internalRun(project);
|
||||
}
|
||||
}
|
||||
}
|
||||
return executionResult;
|
||||
}
|
||||
|
||||
private CvsResult internalRun(Project project) {
|
||||
final CvsOperationExecutor executor = new CvsOperationExecutor(project);
|
||||
executor.performActionSync(new CommandCvsHandler(CvsBundle.message("browse.changes.load.history.progress.title"), this),
|
||||
CvsOperationExecutorCallback.EMPTY);
|
||||
return executor.getResult();
|
||||
}
|
||||
}
|
||||
|
||||
+18
-18
@@ -48,10 +48,8 @@ public class CheckoutProjectOperation extends CvsCommandOperation {
|
||||
private final boolean myPruneEmptyDirectories;
|
||||
private final KeywordSubstitution myKeywordSubstitution;
|
||||
|
||||
public static CheckoutProjectOperation createTestInstance(CvsEnvironment env, String moduleName, File targetLocation
|
||||
) {
|
||||
return CheckoutProjectOperation.create(env, new String[]{moduleName}, targetLocation, false,
|
||||
false);
|
||||
public static CheckoutProjectOperation createTestInstance(CvsEnvironment env, String moduleName, File targetLocation) {
|
||||
return create(env, new String[]{moduleName}, targetLocation, false, false);
|
||||
}
|
||||
|
||||
public CheckoutProjectOperation(String[] moduleNames,
|
||||
@@ -74,22 +72,20 @@ public class CheckoutProjectOperation extends CvsCommandOperation {
|
||||
}
|
||||
|
||||
public static CheckoutProjectOperation create(CvsEnvironment env,
|
||||
String[] moduleName,
|
||||
File targetLocation,
|
||||
boolean useAlternativecheckoutDir,
|
||||
boolean makeNewFilesReadOnly) {
|
||||
String[] moduleName,
|
||||
File targetLocation,
|
||||
boolean useAlternativeCheckoutDir,
|
||||
boolean makeNewFilesReadOnly) {
|
||||
final CvsApplicationLevelConfiguration config = CvsApplicationLevelConfiguration.getInstance();
|
||||
final KeywordSubstitutionWrapper substitution = KeywordSubstitutionWrapper.getValue(config.CHECKOUT_KEYWORD_SUBSTITUTION);
|
||||
|
||||
CvsApplicationLevelConfiguration config = CvsApplicationLevelConfiguration.getInstance();
|
||||
KeywordSubstitutionWrapper substitution = KeywordSubstitutionWrapper.getValue(config.CHECKOUT_KEYWORD_SUBSTITUTION);
|
||||
|
||||
File root;
|
||||
String directory;
|
||||
|
||||
if (useAlternativecheckoutDir && targetLocation.getParentFile() == null) {
|
||||
final File root;
|
||||
final String directory;
|
||||
if (useAlternativeCheckoutDir && targetLocation.getParentFile() == null) {
|
||||
root = targetLocation;
|
||||
directory = getModuleRootName(moduleName);
|
||||
}
|
||||
else if (useAlternativecheckoutDir) {
|
||||
else if (useAlternativeCheckoutDir) {
|
||||
root = targetLocation.getParentFile();
|
||||
directory = targetLocation.getName();
|
||||
}
|
||||
@@ -107,7 +103,6 @@ public class CheckoutProjectOperation extends CvsCommandOperation {
|
||||
substitution == null ? null : substitution.getSubstitution());
|
||||
}
|
||||
|
||||
|
||||
private static String getModuleRootName(String[] moduleNames) {
|
||||
File current = new File(moduleNames[0]);
|
||||
while (current.getParentFile() != null) current = current.getParentFile();
|
||||
@@ -119,7 +114,7 @@ public class CheckoutProjectOperation extends CvsCommandOperation {
|
||||
}
|
||||
|
||||
protected Command createCommand(CvsRootProvider root, CvsExecutionEnvironment cvsExecutionEnvironment) {
|
||||
CheckoutCommand command = new CheckoutCommand(new ThrowableRunnable<IOCommandException>() {
|
||||
final CheckoutCommand command = new CheckoutCommand(new ThrowableRunnable<IOCommandException>() {
|
||||
public void run() throws IOCommandException {
|
||||
((CheckoutAdminWriter) myAdminWriter).finish();
|
||||
}
|
||||
@@ -155,4 +150,9 @@ public class CheckoutProjectOperation extends CvsCommandOperation {
|
||||
super.modifyOptions(options);
|
||||
options.setCheckedOutFilesReadOnly(myMakeNewFilesReadOnly);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean runInReadThread() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,193 @@
|
||||
/*
|
||||
* Copyright 2011 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.cvsSupport2.ui;
|
||||
|
||||
import com.intellij.CvsBundle;
|
||||
import com.intellij.cvsSupport2.CvsUtil;
|
||||
import com.intellij.cvsSupport2.config.CvsRootConfiguration;
|
||||
import com.intellij.cvsSupport2.config.ui.SelectCvsConfigurationPanel;
|
||||
import com.intellij.cvsSupport2.util.CvsVfsUtil;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
|
||||
import com.intellij.openapi.fileChooser.FileChooserFactory;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.ProjectRootManager;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.ui.TextFieldWithBrowseButton;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import javax.swing.event.DocumentListener;
|
||||
import javax.swing.event.ListSelectionEvent;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
import java.awt.*;
|
||||
import java.io.File;
|
||||
|
||||
public class MigrateRootDialog extends DialogWrapper {
|
||||
|
||||
private final JRadioButton myRadioButton1;
|
||||
private final JRadioButton myRadioButton2 = new JRadioButton(CvsBundle.message("migrate.replace.all.roots.label"));
|
||||
private final TextFieldWithBrowseButton myDirectoryField = new TextFieldWithBrowseButton();
|
||||
private final SelectCvsConfigurationPanel myCvsConfigurationPanel;
|
||||
private ListSelectionListener myListener;
|
||||
private String myCvsRoot;
|
||||
|
||||
public MigrateRootDialog(Project project, VirtualFile directory) {
|
||||
super(project);
|
||||
setTitle("Migrate CVS Root");
|
||||
final File file = CvsVfsUtil.getFileFor(directory);
|
||||
final String root = CvsUtil.loadRootFrom(file);
|
||||
myRadioButton1 = new JRadioButton(CvsBundle.message("migrate.replace.if.root.equals.label", root));
|
||||
myRadioButton1.setSelected(true);
|
||||
final ButtonGroup group = new ButtonGroup();
|
||||
group.add(myRadioButton1);
|
||||
group.add(myRadioButton2);
|
||||
myDirectoryField.setText(directory.getPath());
|
||||
final FileChooserDescriptor descriptor = new FileChooserDescriptor(false, true, false, false, false, false) {
|
||||
@Override
|
||||
public void validateSelectedFiles(VirtualFile[] files) throws Exception {
|
||||
for (VirtualFile vFile : files) {
|
||||
final File file = CvsVfsUtil.getFileFor(vFile);
|
||||
final String root = CvsUtil.loadRootFrom(file);
|
||||
if (root == null) {
|
||||
throw new Exception(CvsBundle.message("error.message.directory.is.not.under.cvs"));
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
final VirtualFile[] roots = ProjectRootManager.getInstance(project).getContentRootsFromAllModules();
|
||||
for (VirtualFile vFile : roots) {
|
||||
descriptor.addRoot(vFile);
|
||||
}
|
||||
myDirectoryField.addBrowseFolderListener("Select directory to migrate to a new CVS root", "", project, descriptor);
|
||||
FileChooserFactory.getInstance().installFileCompletion(myDirectoryField.getChildComponent(), descriptor, true, getDisposable());
|
||||
myDirectoryField.getTextField().getDocument().addDocumentListener(new DocumentListener() {
|
||||
@Override
|
||||
public void insertUpdate(DocumentEvent e) {
|
||||
enableOKActionConditionally();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeUpdate(DocumentEvent e) {
|
||||
enableOKActionConditionally();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changedUpdate(DocumentEvent e) {
|
||||
enableOKActionConditionally();
|
||||
}
|
||||
});
|
||||
myCvsConfigurationPanel = new SelectCvsConfigurationPanel(project);
|
||||
if (SystemInfo.isMac) {
|
||||
myCvsConfigurationPanel.setBorder(new EmptyBorder(2, 3, 2, 0));
|
||||
}
|
||||
myListener = new ListSelectionListener() {
|
||||
@Override
|
||||
public void valueChanged(ListSelectionEvent e) {
|
||||
enableOKActionConditionally();
|
||||
}
|
||||
};
|
||||
myCvsConfigurationPanel.addListSelectionListener(myListener);
|
||||
setOKButtonText("Migrate");
|
||||
init();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JComponent createCenterPanel() {
|
||||
final JPanel panel = new JPanel(new GridBagLayout());
|
||||
final GridBagConstraints constraints = new GridBagConstraints();
|
||||
constraints.gridx = 0;
|
||||
constraints.gridy = 0;
|
||||
constraints.insets.bottom = 2;
|
||||
constraints.weightx = 1.0;
|
||||
constraints.fill = GridBagConstraints.HORIZONTAL;
|
||||
constraints.anchor = GridBagConstraints.LINE_START;
|
||||
final JLabel label1 = new JLabel(CvsBundle.message("migrate.cvs.root.directory.label"));
|
||||
label1.setLabelFor(myDirectoryField);
|
||||
panel.add(label1, constraints);
|
||||
constraints.gridy = 1;
|
||||
panel.add(myDirectoryField, constraints);
|
||||
|
||||
constraints.gridy = 2;
|
||||
constraints.insets.left = 5;
|
||||
panel.add(myRadioButton1, constraints);
|
||||
constraints.gridy = 3;
|
||||
panel.add(myRadioButton2, constraints);
|
||||
|
||||
constraints.gridy = 4;
|
||||
constraints.insets.top = 8;
|
||||
constraints.insets.left = 0;
|
||||
final JLabel label2 = new JLabel(CvsBundle.message("migrate.target.root.label"));
|
||||
panel.add(label2, constraints);
|
||||
|
||||
final JComponent component = myCvsConfigurationPanel.getPreferredFocusedComponent();
|
||||
label2.setLabelFor(component);
|
||||
constraints.insets.top = 0;
|
||||
constraints.gridy = 5;
|
||||
panel.add(myCvsConfigurationPanel, constraints);
|
||||
return panel;
|
||||
}
|
||||
|
||||
private boolean check() {
|
||||
final String text = myDirectoryField.getText();
|
||||
final File file = new File(text);
|
||||
if (!file.exists() || !file.isDirectory()) {
|
||||
return false;
|
||||
}
|
||||
myCvsRoot = CvsUtil.loadRootFrom(file);
|
||||
if (myCvsRoot == null) {
|
||||
return false;
|
||||
}
|
||||
myRadioButton1.setText(CvsBundle.message("migrate.replace.if.root.equals.label", myCvsRoot));
|
||||
if (getSelectedCvsConfiguration() == null) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dispose() {
|
||||
myCvsConfigurationPanel.removeListSelectionListener(myListener);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
private void enableOKActionConditionally() {
|
||||
setOKActionEnabled(check());
|
||||
}
|
||||
|
||||
public String getCvsRoot() {
|
||||
return myCvsRoot;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JComponent getPreferredFocusedComponent() {
|
||||
return myCvsConfigurationPanel;
|
||||
}
|
||||
|
||||
public CvsRootConfiguration getSelectedCvsConfiguration() {
|
||||
return myCvsConfigurationPanel.getSelectedConfiguration();
|
||||
}
|
||||
|
||||
public File getSelectedDirectory() {
|
||||
return new File(myDirectoryField.getText());
|
||||
}
|
||||
|
||||
public boolean shouldReplaceAllRoots() {
|
||||
return myRadioButton2.isSelected();
|
||||
}
|
||||
}
|
||||
@@ -140,7 +140,7 @@ class GitManualPushToBranch extends JPanel {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static Collection<GitRemote> getRemotesWithCommonNames(@NotNull Collection<GitRepository> repositories) {
|
||||
public static Collection<GitRemote> getRemotesWithCommonNames(@NotNull Collection<GitRepository> repositories) {
|
||||
if (repositories.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@@ -61,6 +61,8 @@ public class GitPushDialog extends DialogWrapper {
|
||||
private final Object COMMITS_LOADING_LOCK = new Object();
|
||||
private final GitManualPushToBranch myRefspecPanel;
|
||||
private final AtomicReference<String> myDestBranchInfoOnRefresh = new AtomicReference<String>();
|
||||
|
||||
private final boolean myPushPossible;
|
||||
|
||||
public GitPushDialog(@NotNull Project project) {
|
||||
super(project);
|
||||
@@ -84,10 +86,20 @@ public class GitPushDialog extends DialogWrapper {
|
||||
|
||||
myListPanel = new GitPushLog(myProject, myRepositories, new RepositoryCheckboxListener());
|
||||
myRefspecPanel = new GitManualPushToBranch(myRepositories, new RefreshButtonListener());
|
||||
|
||||
|
||||
if (GitManualPushToBranch.getRemotesWithCommonNames(myRepositories).isEmpty()) {
|
||||
myRefspecPanel.setVisible(false);
|
||||
setErrorText("Can't push, because no remotes are defined");
|
||||
setOKActionEnabled(false);
|
||||
myPushPossible = false;
|
||||
} else {
|
||||
myPushPossible = true;
|
||||
}
|
||||
|
||||
init();
|
||||
setOKButtonText("Push");
|
||||
setTitle("Git Push");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -105,7 +117,12 @@ public class GitPushDialog extends DialogWrapper {
|
||||
|
||||
private JComponent createCommitListPanel() {
|
||||
myLoadingPanel.add(myListPanel, BorderLayout.CENTER);
|
||||
loadCommitsInBackground();
|
||||
if (myPushPossible) {
|
||||
loadCommitsInBackground();
|
||||
} else {
|
||||
myLoadingPanel.startLoading();
|
||||
myLoadingPanel.stopLoading();
|
||||
}
|
||||
|
||||
JPanel commitListPanel = new JPanel(new BorderLayout());
|
||||
commitListPanel.add(myLoadingPanel, BorderLayout.CENTER);
|
||||
|
||||
@@ -19,8 +19,6 @@ import com.intellij.openapi.actionSystem.CommonShortcuts;
|
||||
import com.intellij.openapi.actionSystem.DataKey;
|
||||
import com.intellij.openapi.actionSystem.DataSink;
|
||||
import com.intellij.openapi.actionSystem.TypeSafeDataProvider;
|
||||
import com.intellij.openapi.editor.colors.EditorColorsManager;
|
||||
import com.intellij.openapi.editor.colors.EditorFontType;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.Splitter;
|
||||
import com.intellij.openapi.vcs.VcsDataKeys;
|
||||
@@ -45,6 +43,7 @@ import javax.swing.event.TreeSelectionEvent;
|
||||
import javax.swing.event.TreeSelectionListener;
|
||||
import javax.swing.tree.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
@@ -85,8 +84,21 @@ class GitPushLog extends JPanel implements TypeSafeDataProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getScrollableTracksViewportWidth() {
|
||||
return false;
|
||||
public String getToolTipText(MouseEvent event) {
|
||||
final TreePath path = myTree.getPathForLocation(event.getX(), event.getY());
|
||||
if (path == null) {
|
||||
return "";
|
||||
}
|
||||
Object node = path.getLastPathComponent();
|
||||
if (node == null || (!(node instanceof DefaultMutableTreeNode))) {
|
||||
return "";
|
||||
}
|
||||
Object userObject = ((DefaultMutableTreeNode)node).getUserObject();
|
||||
if (userObject instanceof GitCommit) {
|
||||
GitCommit commit = (GitCommit)userObject;
|
||||
return getHashString(commit) + " " + getDateString(commit) + " by " + commit.getAuthor() + "\n\n" + commit.getDescription();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
};
|
||||
myTree.setRootVisible(false);
|
||||
@@ -109,7 +121,7 @@ class GitPushLog extends JPanel implements TypeSafeDataProvider {
|
||||
myChangesBrowser.setChangesToDisplay(Collections.<Change>emptyList());
|
||||
}
|
||||
});
|
||||
|
||||
ToolTipManager.sharedInstance().registerComponent(myTree);
|
||||
|
||||
myChangesBrowser = new ChangesBrowser(project, null, Collections.<Change>emptyList(), null, false, true, null, ChangesBrowser.MyUseCase.LOCAL_CHANGES, null);
|
||||
myChangesBrowser.getDiffAction().registerCustomShortcutSet(CommonShortcuts.getDiff(), myTree);
|
||||
@@ -154,7 +166,6 @@ class GitPushLog extends JPanel implements TypeSafeDataProvider {
|
||||
createNodes(commits);
|
||||
myTreeModel.nodeStructureChanged(myRootNode);
|
||||
myTree.setModel(myTreeModel); // TODO: why doesn't it repaint otherwise?
|
||||
myTreeCellRenderer.recalculateWidth(commits.getAllCommits());
|
||||
TreeUtil.expandAll(myTree);
|
||||
selectFirstCommit();
|
||||
}
|
||||
@@ -273,22 +284,17 @@ class GitPushLog extends JPanel implements TypeSafeDataProvider {
|
||||
}
|
||||
}
|
||||
|
||||
private static class MyTreeCellRenderer extends CheckboxTree.CheckboxTreeCellRenderer {
|
||||
|
||||
private int myDateMaxWidth;
|
||||
|
||||
void recalculateWidth(@NotNull Collection<GitCommit> commits) {
|
||||
for (GitCommit commit : commits) {
|
||||
int len = getDateString(commit).length();
|
||||
if (len > myDateMaxWidth) {
|
||||
myDateMaxWidth = len;
|
||||
}
|
||||
}
|
||||
}
|
||||
@NotNull
|
||||
private static String getDateString(@NotNull GitCommit commit) {
|
||||
return DateFormatUtil.formatPrettyDateTime(commit.getAuthorTime()) + " ";
|
||||
}
|
||||
|
||||
private static String getDateString(GitCommit commit) {
|
||||
return DateFormatUtil.formatPrettyDateTime(commit.getAuthorTime());
|
||||
}
|
||||
@NotNull
|
||||
private static String getHashString(@NotNull GitCommit commit) {
|
||||
return commit.getShortHash().toString();
|
||||
}
|
||||
|
||||
private static class MyTreeCellRenderer extends CheckboxTree.CheckboxTreeCellRenderer {
|
||||
|
||||
@Override
|
||||
public void customizeRenderer(final JTree tree, final Object value, final boolean selected, final boolean expanded, final boolean leaf, final int row, final boolean hasFocus) {
|
||||
@@ -302,16 +308,10 @@ class GitPushLog extends JPanel implements TypeSafeDataProvider {
|
||||
}
|
||||
|
||||
ColoredTreeCellRenderer renderer = getTextRenderer();
|
||||
Font font = EditorColorsManager.getInstance().getGlobalScheme().getFont(EditorFontType.PLAIN); // using probable monospace font to emulate table
|
||||
renderer.setFont(font);
|
||||
|
||||
SimpleTextAttributes smallGrey = new SimpleTextAttributes(SimpleTextAttributes.STYLE_SMALLER, UIUtil.getInactiveTextColor());
|
||||
if (userObject instanceof GitCommit) {
|
||||
GitCommit commit = (GitCommit)userObject;
|
||||
SimpleTextAttributes small = new SimpleTextAttributes(SimpleTextAttributes.STYLE_SMALLER, renderer.getForeground());
|
||||
renderer.append(commit.getShortHash().toString(), smallGrey);
|
||||
renderer.append(String.format(" %" + myDateMaxWidth + "s ", getDateString(commit)), smallGrey);
|
||||
renderer.append(commit.getSubject(), small);
|
||||
renderer.append(commit.getSubject(), new SimpleTextAttributes(SimpleTextAttributes.STYLE_SMALLER, getTextRenderer().getForeground()));
|
||||
renderer.setToolTipText(getHashString(commit) + " " + getDateString(commit));
|
||||
}
|
||||
else if (userObject instanceof GitRepository) {
|
||||
String repositoryPath = calcRootPath((GitRepository)userObject);
|
||||
@@ -345,7 +345,7 @@ class GitPushLog extends JPanel implements TypeSafeDataProvider {
|
||||
break;
|
||||
}
|
||||
renderer.append(text, attrs);
|
||||
renderer.append(additionalText, smallGrey);
|
||||
renderer.append(additionalText, new SimpleTextAttributes(SimpleTextAttributes.STYLE_SMALLER, UIUtil.getInactiveTextColor()));
|
||||
}
|
||||
else if (userObject instanceof FakeCommit) {
|
||||
int spaces = 6 + 15 + 3 + 30;
|
||||
|
||||
@@ -253,29 +253,18 @@ Inner.methods.are.not.supported=Inner methods are not supported
|
||||
final.class.cannot.be.extended=Final class cannot be extended
|
||||
|
||||
#Override and implement
|
||||
goto.override.method.declaration=go to override method declaration
|
||||
interface.expected.here=Interface is expected here
|
||||
overrides.method.from.super=Overrides method in ''{0}''
|
||||
implements.method.from.super=Implements method in ''{0}''
|
||||
implement.methods=Implement methods
|
||||
implement.methods.fix=Implement methods
|
||||
method.is.not.implemented=Method ''{0}'' is not implemented
|
||||
interface.is.not.expected.here=Interface is not expected here
|
||||
change.implements.and.extends.classes=Normalize extends and implements lists
|
||||
|
||||
unsafe.dereference=Unsafe dereference
|
||||
type.definition.can.extend.just.one.super.type=Type definition must extends not more than one class
|
||||
class.is.not.expected.here=Class is not expected here
|
||||
interface.cannot.contain.implements.clause=Interface cannot contain implements clause
|
||||
fix.package.name=Fix package name
|
||||
|
||||
#dynamic properties
|
||||
add.dynamic.property=Add dynamic property ''{0}''
|
||||
duplicate.element.in.the.map=Duplicate element in the map
|
||||
message.nothing.to.show.in.structure.view=There are no dynamic properties
|
||||
dynamic.toolwindow.search.elements=Search dynamic element
|
||||
dynamic.toolwindow.property.fiter=Property Filter
|
||||
dynamic.tool.window.id=Dynamic properties
|
||||
dynamic.toolwindow.property.filter=Property Filter
|
||||
dynamic.tool.window.id=Dynamic Properties
|
||||
|
||||
create.from.usage.family.name=Create From Usage
|
||||
create.field.from.usage=Create Field ''{0}''
|
||||
|
||||
-29
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2009 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.annotator.intentions.dynamic;
|
||||
|
||||
import java.util.EventListener;
|
||||
|
||||
/**
|
||||
* User: Dmitry.Krasilschikov
|
||||
* Date: 11.01.2008
|
||||
*/
|
||||
public interface DynamicChangeListener extends EventListener {
|
||||
/*
|
||||
* Change property
|
||||
*/
|
||||
public void dynamicPropertyChange();
|
||||
}
|
||||
-13
@@ -63,16 +63,6 @@ public abstract class DynamicManager implements ProjectComponent, PersistentStat
|
||||
|
||||
public abstract void replaceClassName(final DClassElement oldClassElement, String newClassName);
|
||||
|
||||
/*
|
||||
* Adds dynamicPropertyChange listener
|
||||
*/
|
||||
public abstract void addDynamicChangeListener(DynamicChangeListener listener);
|
||||
|
||||
/*
|
||||
* Removes dynamicPropertyChange listener
|
||||
*/
|
||||
public abstract void removeDynamicChangeListener(DynamicChangeListener listener);
|
||||
|
||||
public abstract void addProperty(DynamicElementSettings settings);
|
||||
|
||||
public abstract void addMethod(DynamicElementSettings settings);
|
||||
@@ -85,9 +75,6 @@ public abstract class DynamicManager implements ProjectComponent, PersistentStat
|
||||
@NotNull
|
||||
public abstract Collection<DPropertyElement> findDynamicPropertiesOfClass(final String conatainingClassName);
|
||||
|
||||
@NotNull
|
||||
public abstract String[] getPropertiesNamesOfClass(final String conatainingClassName);
|
||||
|
||||
@Nullable
|
||||
public abstract String getPropertyType(String className, String propertyName);
|
||||
|
||||
|
||||
+8
-45
@@ -19,7 +19,6 @@ import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
|
||||
import com.intellij.openapi.components.State;
|
||||
import com.intellij.openapi.components.Storage;
|
||||
import com.intellij.openapi.components.StorageScheme;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.fileEditor.FileEditorManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -27,7 +26,6 @@ import com.intellij.openapi.startup.StartupManager;
|
||||
import com.intellij.openapi.wm.ToolWindow;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.ui.treeStructure.treetable.ListTreeTableModelOnColumns;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.ui.tree.TreeUtil;
|
||||
@@ -39,7 +37,10 @@ import org.jetbrains.plugins.groovy.annotator.intentions.dynamic.ui.DynamicEleme
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyPsiManager;
|
||||
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* User: Dmitry.Krasilschikov
|
||||
@@ -53,10 +54,7 @@ import java.util.*;
|
||||
})
|
||||
|
||||
public class DynamicManagerImpl extends DynamicManager {
|
||||
private static final Logger LOG = Logger.getInstance("org.jetbrains.plugins.groovy.annotator.intentions.dynamic.DynamicManagerImpl");
|
||||
|
||||
private final Project myProject;
|
||||
private final List<DynamicChangeListener> myListeners = new ArrayList<DynamicChangeListener>();
|
||||
private DRootElement myRootElement = new DRootElement();
|
||||
|
||||
public DynamicManagerImpl(final Project project) {
|
||||
@@ -111,7 +109,7 @@ public class DynamicManagerImpl extends DynamicManager {
|
||||
doRemove(wrapper, node, parent);
|
||||
}
|
||||
|
||||
private void doRemove(DynamicToolWindowWrapper wrapper, DefaultMutableTreeNode node, DefaultMutableTreeNode parent) {
|
||||
private static void doRemove(DynamicToolWindowWrapper wrapper, DefaultMutableTreeNode node, DefaultMutableTreeNode parent) {
|
||||
DefaultMutableTreeNode toSelect = (parent.getChildAfter(node) != null || parent.getChildCount() == 1 ?
|
||||
node.getNextNode() :
|
||||
node.getPreviousNode());
|
||||
@@ -166,7 +164,7 @@ public class DynamicManagerImpl extends DynamicManager {
|
||||
}, true);
|
||||
}
|
||||
|
||||
private int getIndexToInsert(DefaultMutableTreeNode parent, DNamedElement namedElement) {
|
||||
private static int getIndexToInsert(DefaultMutableTreeNode parent, DNamedElement namedElement) {
|
||||
if (parent.getChildCount() == 0) return 0;
|
||||
|
||||
int res = 0;
|
||||
@@ -220,19 +218,6 @@ public class DynamicManagerImpl extends DynamicManager {
|
||||
return new ArrayList<DPropertyElement>();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String[] getPropertiesNamesOfClass(String conatainingClassName) {
|
||||
final DClassElement classElement = findClassElement(getRootElement(), conatainingClassName);
|
||||
|
||||
Set<String> result = new HashSet<String>();
|
||||
if (classElement != null) {
|
||||
for (DPropertyElement propertyElement : classElement.getProperties()) {
|
||||
result.add(propertyElement.getName());
|
||||
}
|
||||
}
|
||||
return ArrayUtil.toStringArray(result);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getPropertyType(String className, String propertyName) {
|
||||
final DPropertyElement dynamicProperty = findConcreteDynamicProperty(getRootElement(), className, propertyName);
|
||||
@@ -253,24 +238,6 @@ public class DynamicManagerImpl extends DynamicManager {
|
||||
return myRootElement;
|
||||
}
|
||||
|
||||
/*
|
||||
* Adds dynamicPropertyChange listener
|
||||
*/
|
||||
public void addDynamicChangeListener(DynamicChangeListener listener) {
|
||||
myListeners.add(listener);
|
||||
}
|
||||
|
||||
/*
|
||||
* Removes dynamicPropertyChange listener
|
||||
*/
|
||||
public void removeDynamicChangeListener(DynamicChangeListener listener) {
|
||||
myListeners.remove(listener);
|
||||
}
|
||||
|
||||
/*
|
||||
* Changes dynamic property
|
||||
*/
|
||||
|
||||
public String replaceDynamicPropertyName(String className, String oldPropertyName, String newPropertyName) {
|
||||
final DClassElement classElement = findClassElement(getRootElement(), className);
|
||||
if (classElement == null) return null;
|
||||
@@ -403,10 +370,6 @@ public class DynamicManagerImpl extends DynamicManager {
|
||||
}
|
||||
|
||||
public void fireChange() {
|
||||
for (DynamicChangeListener listener : myListeners) {
|
||||
listener.dynamicPropertyChange();
|
||||
}
|
||||
|
||||
fireChangeCodeAnalyze();
|
||||
}
|
||||
|
||||
@@ -427,7 +390,7 @@ public class DynamicManagerImpl extends DynamicManager {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public DPropertyElement findConcreteDynamicProperty(DRootElement rootElement, final String conatainingClassName, final String propertyName) {
|
||||
private static DPropertyElement findConcreteDynamicProperty(DRootElement rootElement, final String conatainingClassName, final String propertyName) {
|
||||
final DClassElement classElement = rootElement.getClassElement(conatainingClassName);
|
||||
|
||||
if (classElement == null) return null;
|
||||
@@ -436,7 +399,7 @@ public class DynamicManagerImpl extends DynamicManager {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private DClassElement findClassElement(DRootElement rootElement, final String conatainingClassName) {
|
||||
private static DClassElement findClassElement(DRootElement rootElement, final String conatainingClassName) {
|
||||
return rootElement.getClassElement(conatainingClassName);
|
||||
}
|
||||
|
||||
|
||||
+20
-10
@@ -15,8 +15,8 @@
|
||||
*/
|
||||
package org.jetbrains.plugins.groovy.annotator.intentions.dynamic;
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataProvider;
|
||||
import com.intellij.openapi.actionSystem.LangDataKeys;
|
||||
import com.intellij.ide.DeleteProvider;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
@@ -96,7 +96,7 @@ public class DynamicToolWindowWrapper {
|
||||
private static final int CLASS_OR_ELEMENT_NAME_COLUMN = 0;
|
||||
private static final int TYPE_COLUMN = 1;
|
||||
|
||||
private static final String[] myColumnNames = {"Dynamic element", "Type"};
|
||||
private static final String[] myColumnNames = {"Dynamic Element", "Type"};
|
||||
|
||||
private MyTreeTable myTreeTable;
|
||||
|
||||
@@ -129,7 +129,7 @@ public class DynamicToolWindowWrapper {
|
||||
myBigPanel = new JPanel(new BorderLayout());
|
||||
myBigPanel.setBackground(UIUtil.getFieldForegroundColor());
|
||||
|
||||
final DynamicFilterComponent filter = new DynamicFilterComponent(GroovyBundle.message("dynamic.toolwindow.property.fiter"), 10);
|
||||
final DynamicFilterComponent filter = new DynamicFilterComponent(GroovyBundle.message("dynamic.toolwindow.property.filter"), 10);
|
||||
filter.setBackground(UIUtil.getLabelBackground());
|
||||
|
||||
myBigPanel.add(new JLabel(GroovyBundle.message("dynamic.toolwindow.search.elements")), BorderLayout.NORTH);
|
||||
@@ -212,6 +212,10 @@ public class DynamicToolWindowWrapper {
|
||||
|
||||
myTreeTable = new MyTreeTable(myTreeTableModel);
|
||||
|
||||
DefaultActionGroup group = new DefaultActionGroup();
|
||||
group.add(ActionManager.getInstance().getAction(IdeActions.ACTION_DELETE));
|
||||
PopupHandler.installUnknownPopupHandler(myTreeTable, group, ActionManager.getInstance());
|
||||
|
||||
final MyColoredTreeCellRenderer treeCellRenderer = new MyColoredTreeCellRenderer();
|
||||
|
||||
myTreeTable.setDefaultRenderer(String.class, new TableCellRenderer() {
|
||||
@@ -342,12 +346,6 @@ public class DynamicToolWindowWrapper {
|
||||
|
||||
myTreeTable.setDefaultEditor(String.class, typeCellEditor);
|
||||
|
||||
myTreeTable.registerKeyboardAction(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
deleteRow();
|
||||
}
|
||||
}, KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), JComponent.WHEN_FOCUSED);
|
||||
|
||||
myTreeTable.registerKeyboardAction(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
final int selectionRow = myTreeTable.getTree().getLeadSelectionRow();
|
||||
@@ -743,6 +741,18 @@ public class DynamicToolWindowWrapper {
|
||||
|
||||
if (element == null) return null;
|
||||
return element.getContainingFile();
|
||||
} else if (LangDataKeys.DELETE_ELEMENT_PROVIDER.is(dataId)) {
|
||||
return new DeleteProvider() {
|
||||
@Override
|
||||
public void deleteElement(DataContext dataContext) {
|
||||
deleteRow();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDeleteElement(DataContext dataContext) {
|
||||
return myTreeTable.getTree().getSelectionPaths() != null;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -17,6 +17,7 @@ import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.roots.LanguageLevelModuleExtension;
|
||||
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.psi.search.FilenameIndex;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
@@ -67,10 +68,11 @@ public class GroovyHotSwapper extends JavaProgramPatcher {
|
||||
if (!executor.getId().equals(DefaultDebugExecutor.EXECUTOR_ID)) {
|
||||
return;
|
||||
}
|
||||
if ("false".equals(System.getProperty("enable.groovy.hotswap", "true"))) {
|
||||
|
||||
if (!Registry.is("enable.groovy.hotswap")) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!(configuration instanceof RunConfiguration)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -58,6 +58,7 @@ public class HgPullDialog extends DialogWrapper {
|
||||
};
|
||||
sourceTxt.getDocument().addDocumentListener(documentListener);
|
||||
setTitle("Pull");
|
||||
setOKButtonText("Pull");
|
||||
init();
|
||||
}
|
||||
|
||||
@@ -106,4 +107,9 @@ public class HgPullDialog extends DialogWrapper {
|
||||
setOKActionEnabled(StringUtils.isNotBlank(sourceTxt.getText()));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDimensionServiceKey() {
|
||||
return HgPullDialog.class.getName();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+25
-8
@@ -24,6 +24,10 @@ import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiManager;
|
||||
import com.intellij.psi.util.CachedValue;
|
||||
import com.intellij.psi.util.CachedValueProvider;
|
||||
import com.intellij.psi.util.CachedValuesManager;
|
||||
import com.intellij.psi.util.PsiModificationTracker;
|
||||
import com.intellij.psi.xml.XmlFile;
|
||||
import com.intellij.psi.xml.XmlTag;
|
||||
import com.intellij.xml.XmlElementDescriptor;
|
||||
@@ -38,6 +42,7 @@ import java.util.Map;
|
||||
|
||||
public class MavenDomElementDescriptorHolder {
|
||||
private static final Logger LOG = Logger.getInstance("#org.jetbrains.idea.maven.dom.MavenDomElementDescriptorHolder");
|
||||
|
||||
private enum FileKind {
|
||||
PROJECT_FILE {
|
||||
public String getSchemaUrl() {
|
||||
@@ -59,7 +64,8 @@ public class MavenDomElementDescriptorHolder {
|
||||
}
|
||||
|
||||
private final Project myProject;
|
||||
private final Map<FileKind, XmlNSDescriptorImpl> myDescriptorsMap = new THashMap<FileKind, XmlNSDescriptorImpl>();
|
||||
private final Map<FileKind, CachedValue<XmlNSDescriptorImpl>> myDescriptorsMap =
|
||||
new THashMap<FileKind, CachedValue<XmlNSDescriptorImpl>>();
|
||||
|
||||
public MavenDomElementDescriptorHolder(Project project) {
|
||||
myProject = project;
|
||||
@@ -80,14 +86,27 @@ public class MavenDomElementDescriptorHolder {
|
||||
if (desc == null) return null;
|
||||
}
|
||||
LOG.assertTrue(tag.isValid());
|
||||
LOG.assertTrue(desc.isValid());
|
||||
return desc.getElementDescriptor(tag.getName(), desc.getDefaultNamespace());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private XmlNSDescriptorImpl tryGetOrCreateDescriptor(FileKind kind) {
|
||||
XmlNSDescriptorImpl result = myDescriptorsMap.get(kind);
|
||||
if (result != null && result.isValid()) return result;
|
||||
private XmlNSDescriptorImpl tryGetOrCreateDescriptor(final FileKind kind) {
|
||||
CachedValue<XmlNSDescriptorImpl> result = myDescriptorsMap.get(kind);
|
||||
if (result == null) {
|
||||
result = CachedValuesManager.getManager(myProject).createCachedValue(new CachedValueProvider<XmlNSDescriptorImpl>() {
|
||||
@Override
|
||||
public Result<XmlNSDescriptorImpl> compute() {
|
||||
return Result.create(doCreateDescriptor(kind), PsiModificationTracker.OUT_OF_CODE_BLOCK_MODIFICATION_COUNT);
|
||||
}
|
||||
}, false);
|
||||
myDescriptorsMap.put(kind, result);
|
||||
}
|
||||
return result.getValue();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private XmlNSDescriptorImpl doCreateDescriptor(FileKind kind) {
|
||||
String schemaUrl = kind.getSchemaUrl();
|
||||
String location = ExternalResourceManager.getInstance().getResourceLocation(schemaUrl);
|
||||
if (schemaUrl.equals(location)) return null;
|
||||
@@ -105,14 +124,12 @@ public class MavenDomElementDescriptorHolder {
|
||||
PsiFile psiFile = PsiManager.getInstance(myProject).findFile(schema);
|
||||
if (!(psiFile instanceof XmlFile)) return null;
|
||||
|
||||
result = new XmlNSDescriptorImpl();
|
||||
|
||||
XmlNSDescriptorImpl result = new XmlNSDescriptorImpl();
|
||||
result.init(psiFile);
|
||||
myDescriptorsMap.put(kind, result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private FileKind getFileKind(PsiFile file) {
|
||||
if (MavenDomUtil.isProjectFile(file)) return FileKind.PROJECT_FILE;
|
||||
if (MavenDomUtil.isProfilesFile(file)) return FileKind.PROFILES_FILE;
|
||||
|
||||
+1
-1
@@ -84,7 +84,7 @@ public class MavenPluginConfigurationDomExtender extends DomExtender<MavenDomCon
|
||||
|
||||
if (selectedGoals == null || selectedGoals.contains(goal)) {
|
||||
for (MavenDomParameter eachParameter : eachMojo.getParameters().getParameters()) {
|
||||
if (!eachParameter.getEditable().getValue()) continue;
|
||||
if (eachParameter.getEditable().getValue() == Boolean.FALSE) continue;
|
||||
|
||||
String name = eachParameter.getName().getStringValue();
|
||||
if (name == null) continue;
|
||||
|
||||
+8
-2
@@ -29,6 +29,7 @@ import com.intellij.openapi.project.ModuleAdapter;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.ModuleRootEvent;
|
||||
import com.intellij.openapi.roots.ModuleRootListener;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
@@ -441,7 +442,7 @@ public class MavenProjectsManagerWatcher {
|
||||
else {
|
||||
if (!isRelevant(each.getPath())) continue;
|
||||
if (each instanceof VFilePropertyChangeEvent) {
|
||||
if (((VFilePropertyChangeEvent)each).getPropertyName().equals(VirtualFile.PROP_NAME)) {
|
||||
if (isRenamed(each)) {
|
||||
deleteRecursively(each.getFile());
|
||||
}
|
||||
}
|
||||
@@ -491,7 +492,7 @@ public class MavenProjectsManagerWatcher {
|
||||
updateFile(each.getFile());
|
||||
}
|
||||
else if (each instanceof VFilePropertyChangeEvent) {
|
||||
if (((VFilePropertyChangeEvent)each).getPropertyName().equals(VirtualFile.PROP_NAME)) {
|
||||
if (isRenamed(each)) {
|
||||
updateFile(each.getFile());
|
||||
}
|
||||
}
|
||||
@@ -501,5 +502,10 @@ public class MavenProjectsManagerWatcher {
|
||||
}
|
||||
apply();
|
||||
}
|
||||
|
||||
private static boolean isRenamed(VFileEvent each) {
|
||||
return ((VFilePropertyChangeEvent)each).getPropertyName().equals(VirtualFile.PROP_NAME)
|
||||
&& !Comparing.equal(((VFilePropertyChangeEvent)each).getOldValue(), ((VFilePropertyChangeEvent)each).getNewValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+11
-1
@@ -16,7 +16,10 @@
|
||||
package org.jetbrains.idea.maven.utils;
|
||||
|
||||
import com.intellij.codeInsight.template.TemplateContextType;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.psi.xml.XmlText;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.idea.maven.dom.MavenDomUtil;
|
||||
|
||||
@@ -26,6 +29,13 @@ public class MavenLiveTemplateContextType extends TemplateContextType {
|
||||
}
|
||||
|
||||
public boolean isInContext(@NotNull final PsiFile file, final int offset) {
|
||||
return MavenDomUtil.isMavenFile(file);
|
||||
if (!MavenDomUtil.isMavenFile(file)) return false;
|
||||
|
||||
PsiElement element = file.findElementAt(offset);
|
||||
if (element == null) return false;
|
||||
|
||||
if (PsiTreeUtil.getParentOfType(element, XmlText.class) == null) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
+49
-21
@@ -26,6 +26,7 @@ import com.intellij.openapi.roots.OrderEntry;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.util.FileContentUtil;
|
||||
import org.jetbrains.idea.maven.MavenImportingTestCase;
|
||||
import org.jetbrains.idea.maven.importing.MavenRootModelAdapter;
|
||||
import org.jetbrains.idea.maven.server.NativeMavenProjectHolder;
|
||||
@@ -96,9 +97,9 @@ public class MavenProjectsManagerTest extends MavenImportingTestCase {
|
||||
"<version>1</version>");
|
||||
|
||||
final VirtualFile p2 = createModulePom("project2",
|
||||
"<groupId>test</groupId>" +
|
||||
"<artifactId>project2</artifactId>" +
|
||||
"<version>1</version>");
|
||||
"<groupId>test</groupId>" +
|
||||
"<artifactId>project2</artifactId>" +
|
||||
"<version>1</version>");
|
||||
importProjects(p1, p2);
|
||||
|
||||
assertEquals(2, myProjectsTree.getRootProjects().size());
|
||||
@@ -127,9 +128,9 @@ public class MavenProjectsManagerTest extends MavenImportingTestCase {
|
||||
"<version>1</version>");
|
||||
|
||||
final VirtualFile p2 = createModulePom("project2",
|
||||
"<groupId>test</groupId>" +
|
||||
"<artifactId>project2</artifactId>" +
|
||||
"<version>1</version>");
|
||||
"<groupId>test</groupId>" +
|
||||
"<artifactId>project2</artifactId>" +
|
||||
"<version>1</version>");
|
||||
importProjects(p1, p2);
|
||||
|
||||
final VirtualFile oldDir = p2.getParent();
|
||||
@@ -165,9 +166,9 @@ public class MavenProjectsManagerTest extends MavenImportingTestCase {
|
||||
"</modules>");
|
||||
|
||||
final VirtualFile m = createModulePom("m1",
|
||||
"<groupId>test</groupId>" +
|
||||
"<artifactId>m</artifactId>" +
|
||||
"<version>1</version>");
|
||||
"<groupId>test</groupId>" +
|
||||
"<artifactId>m</artifactId>" +
|
||||
"<version>1</version>");
|
||||
importProject();
|
||||
|
||||
final VirtualFile oldDir = m.getParent();
|
||||
@@ -726,9 +727,9 @@ public class MavenProjectsManagerTest extends MavenImportingTestCase {
|
||||
"</modules>");
|
||||
|
||||
final VirtualFile m = createModulePom("m",
|
||||
"<groupId>test</groupId>" +
|
||||
"<artifactId>m</artifactId>" +
|
||||
"<version>1</version>");
|
||||
"<groupId>test</groupId>" +
|
||||
"<artifactId>m</artifactId>" +
|
||||
"<version>1</version>");
|
||||
importProject();
|
||||
myProjectsManager.performScheduledImportInTests(); // ensure no pending requests
|
||||
assertModules("project", "m");
|
||||
@@ -822,16 +823,16 @@ public class MavenProjectsManagerTest extends MavenImportingTestCase {
|
||||
"</dependencies>");
|
||||
|
||||
final VirtualFile m2 = createModulePom("m2", "<groupId>test</groupId>" +
|
||||
"<artifactId>m2</artifactId>" +
|
||||
"<version>1</version>" +
|
||||
"<artifactId>m2</artifactId>" +
|
||||
"<version>1</version>" +
|
||||
|
||||
"<dependencies>" +
|
||||
" <dependency>" +
|
||||
" <groupId>junit</groupId>" +
|
||||
" <artifactId>junit</artifactId>" +
|
||||
" <version>4.0</version>" +
|
||||
" </dependency>" +
|
||||
"</dependencies>");
|
||||
"<dependencies>" +
|
||||
" <dependency>" +
|
||||
" <groupId>junit</groupId>" +
|
||||
" <artifactId>junit</artifactId>" +
|
||||
" <version>4.0</version>" +
|
||||
" </dependency>" +
|
||||
"</dependencies>");
|
||||
|
||||
importProject();
|
||||
|
||||
@@ -1077,4 +1078,31 @@ public class MavenProjectsManagerTest extends MavenImportingTestCase {
|
||||
assertNull(ModuleManager.getInstance(myProject).findModuleByName("m"));
|
||||
assertTrue(myProjectsManager.isIgnored(myProjectsManager.findProject(m)));
|
||||
}
|
||||
|
||||
public void testDoNotRemoveMavenProjectsOnReparse() throws Exception {
|
||||
// this pom file doesn't belong to any of the modules, this is won't be processed
|
||||
// by MavenProjectProjectsManager and won't occur in its projects list.
|
||||
importProject("<groupId>test</groupId>" +
|
||||
"<artifactId>project</artifactId>" +
|
||||
"<version>1</version>");
|
||||
|
||||
final StringBuilder log = new StringBuilder();
|
||||
myProjectsManager.performScheduledImportInTests();
|
||||
myProjectsManager.addProjectsTreeListener(new MavenProjectsTree.ListenerAdapter() {
|
||||
@Override
|
||||
public void projectsUpdated(List<Pair<MavenProject, MavenProjectChanges>> updated, List<MavenProject> deleted) {
|
||||
for (Pair<MavenProject, MavenProjectChanges> each : updated) {
|
||||
log.append("updated: " + each.first.getDisplayName() + " ");
|
||||
}
|
||||
for (MavenProject each : deleted) {
|
||||
log.append("deleted: " + each.getDisplayName() + " ");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
FileContentUtil.reparseFiles(myProject, myProjectsManager.getProjectsFiles(), true);
|
||||
myProjectsManager.waitForReadingCompletion();
|
||||
|
||||
assertTrue(log.toString(), log.length() == 0);
|
||||
}
|
||||
}
|
||||
|
||||
+8
-3
@@ -54,7 +54,7 @@ import java.util.List;
|
||||
|
||||
import static org.intellij.lang.xpath.xslt.run.XsltRunConfiguration.isEmpty;
|
||||
|
||||
class XsltCommandLineState extends CommandLineState {
|
||||
public class XsltCommandLineState extends CommandLineState {
|
||||
private static final Logger LOG = Logger.getInstance(XsltCommandLineState.class.getName());
|
||||
public static final Key<XsltCommandLineState> STATE = Key.create("STATE");
|
||||
|
||||
@@ -145,7 +145,8 @@ class XsltCommandLineState extends CommandLineState {
|
||||
assert descriptor != null;
|
||||
pluginPath = descriptor.getPath();
|
||||
} else {
|
||||
pluginPath = new File(System.getProperty("xslt.plugin.path"));
|
||||
// -Dxslt.plugin.path=C:\work\java\intellij/ultimate\out\classes\production\xslt-rt
|
||||
pluginPath = new File(System.getProperty("xslt.plugin.path"));
|
||||
}
|
||||
|
||||
LOG.debug("Plugin Path = " + pluginPath.getAbsolutePath());
|
||||
@@ -187,7 +188,11 @@ class XsltCommandLineState extends CommandLineState {
|
||||
return myPort;
|
||||
}
|
||||
|
||||
private class MyProcessAdapter extends ProcessAdapter {
|
||||
public UserDataHolder getExtensionData() {
|
||||
return myExtensionData;
|
||||
}
|
||||
|
||||
private class MyProcessAdapter extends ProcessAdapter {
|
||||
|
||||
public void processTerminated(final ProcessEvent event) {
|
||||
|
||||
|
||||
+66
-16
@@ -22,10 +22,7 @@ import net.sf.saxon.expr.StackFrame;
|
||||
import net.sf.saxon.expr.XPathContext;
|
||||
import net.sf.saxon.expr.instruct.GlobalVariable;
|
||||
import net.sf.saxon.expr.instruct.SlotManager;
|
||||
import net.sf.saxon.om.Item;
|
||||
import net.sf.saxon.om.NodeInfo;
|
||||
import net.sf.saxon.om.StructuredQName;
|
||||
import net.sf.saxon.om.ValueRepresentation;
|
||||
import net.sf.saxon.om.*;
|
||||
import net.sf.saxon.style.StyleElement;
|
||||
import net.sf.saxon.trans.XPathException;
|
||||
import net.sf.saxon.type.ItemType;
|
||||
@@ -65,22 +62,22 @@ class Saxon9StyleFrame<N extends StyleElement> extends AbstractSaxon9Frame<Debug
|
||||
final TypeHierarchy typeHierarchy = myXPathContext.getConfiguration().getTypeHierarchy();
|
||||
expression = expression.typeCheck(ExpressionVisitor.make(myElement.getStaticContext(), expression.getExecutable()), Type.ITEM_TYPE);
|
||||
final ItemType itemType = expression.getItemType(typeHierarchy);
|
||||
final Item evaluate = expression.evaluateItem(myXPathContext);
|
||||
return new Value() {
|
||||
@Override
|
||||
public Object getValue() {
|
||||
return evaluate != null ? evaluate.getStringValue() : null;
|
||||
}
|
||||
final SequenceIterator it = expression.iterate(myXPathContext);
|
||||
|
||||
@Override
|
||||
public Type getType() {
|
||||
return new ObjectType(itemType.toString());
|
||||
}
|
||||
};
|
||||
Item value = null;
|
||||
if (it.next() != null) {
|
||||
value = it.current();
|
||||
}
|
||||
if (it.next() == null) {
|
||||
return new SingleValue(value, itemType);
|
||||
}
|
||||
return new SequenceValue(value, it, itemType);
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw new Debugger.EvaluationException(e.getMessage() != null ? e.getMessage() : e.toString());
|
||||
} catch (XPathException e) {
|
||||
throw new Debugger.EvaluationException(e.getMessage() != null ? e.getMessage() : e.toString());
|
||||
} catch (AssertionError e) {
|
||||
throw new Debugger.EvaluationException(e.getMessage() != null ? e.getMessage() : e.toString());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new Debugger.EvaluationException(e.getMessage() != null ? e.getMessage() : e.toString());
|
||||
@@ -127,10 +124,18 @@ class Saxon9StyleFrame<N extends StyleElement> extends AbstractSaxon9Frame<Debug
|
||||
final ValueRepresentation[] values = frame.getStackFrameValues();
|
||||
//System.out.println("values = " + Arrays.toString(values));
|
||||
|
||||
outer:
|
||||
for (int i = 0, valuesLength = values.length; i < valuesLength; i++) {
|
||||
final ValueRepresentation value = values[i];
|
||||
if (value != null) {
|
||||
variables.add(new VariableImpl(map.getVariableMap().get(i).getDisplayName(), new Value() {
|
||||
final String name = map.getVariableMap().get(i).getDisplayName();
|
||||
for (Debugger.Variable variable : variables) {
|
||||
if (name.equals(variable.getName())) {
|
||||
continue outer;
|
||||
}
|
||||
}
|
||||
|
||||
variables.add(new VariableImpl(name, new Value() {
|
||||
public Object getValue() {
|
||||
try {
|
||||
return value.getStringValue();
|
||||
@@ -159,4 +164,49 @@ class Saxon9StyleFrame<N extends StyleElement> extends AbstractSaxon9Frame<Debug
|
||||
|
||||
return variables;
|
||||
}
|
||||
|
||||
private static class SingleValue implements Value {
|
||||
private final Item myValue;
|
||||
private final ItemType myItemType;
|
||||
|
||||
public SingleValue(Item value, ItemType itemType) {
|
||||
myValue = value;
|
||||
myItemType = itemType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValue() {
|
||||
return myValue != null ? myValue.getStringValue() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type getType() {
|
||||
return new ObjectType(myItemType.toString());
|
||||
}
|
||||
}
|
||||
|
||||
private static class SequenceValue implements Value {
|
||||
private final String myValue;
|
||||
private final ItemType myItemType;
|
||||
|
||||
public SequenceValue(Item value, SequenceIterator it, ItemType type) throws XPathException {
|
||||
String s = "(" + value.getStringValue() + ", " + it.current().getStringValue();
|
||||
while (it.next() != null) {
|
||||
s += ", " + it.current().getStringValue();
|
||||
}
|
||||
s += ")";
|
||||
myValue = s;
|
||||
myItemType = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValue() {
|
||||
return myValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type getType() {
|
||||
return new ObjectType(myItemType.toString() + "+");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+64
-1
@@ -17,13 +17,20 @@
|
||||
package org.intellij.plugins.xsltDebugger.rt.engine.local.saxon9;
|
||||
|
||||
import net.sf.saxon.expr.XPathContext;
|
||||
import net.sf.saxon.expr.instruct.InstructionDetails;
|
||||
import net.sf.saxon.lib.TraceListener;
|
||||
import net.sf.saxon.om.Item;
|
||||
import net.sf.saxon.om.NodeInfo;
|
||||
import net.sf.saxon.style.StyleElement;
|
||||
import net.sf.saxon.trace.InstructionInfo;
|
||||
import org.intellij.plugins.xsltDebugger.rt.engine.Debugger;
|
||||
import org.intellij.plugins.xsltDebugger.rt.engine.Value;
|
||||
import org.intellij.plugins.xsltDebugger.rt.engine.local.LocalDebugger;
|
||||
|
||||
import javax.xml.transform.Source;
|
||||
import javax.xml.transform.SourceLocator;
|
||||
import java.util.List;
|
||||
|
||||
public class Saxon9TraceListener implements TraceListener {
|
||||
private static final boolean TRACE = "true".equals(System.getProperty("xslt.debugger.trace", "false"));
|
||||
|
||||
@@ -63,6 +70,8 @@ public class Saxon9TraceListener implements TraceListener {
|
||||
}
|
||||
if (instructionInfo instanceof StyleElement) {
|
||||
myDebugger.enter(new Saxon9StyleFrame(myDebugger.getCurrentFrame(), (StyleElement)instructionInfo, xPathContext));
|
||||
} else if (instructionInfo instanceof InstructionDetails) {
|
||||
myDebugger.enter(new VirtualFrame(myDebugger.getCurrentFrame(), (InstructionDetails)instructionInfo));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,7 +79,7 @@ public class Saxon9TraceListener implements TraceListener {
|
||||
if (TRACE) {
|
||||
trace("</>");
|
||||
}
|
||||
if (instructionInfo instanceof StyleElement) {
|
||||
if (instructionInfo instanceof StyleElement || instructionInfo instanceof InstructionDetails) {
|
||||
myDebugger.leave();
|
||||
}
|
||||
}
|
||||
@@ -89,4 +98,58 @@ public class Saxon9TraceListener implements TraceListener {
|
||||
myDebugger.popSource();
|
||||
}
|
||||
}
|
||||
|
||||
private static class VirtualFrame extends AbstractSaxon9Frame<Debugger.StyleFrame, Source> implements Debugger.StyleFrame {
|
||||
|
||||
public VirtualFrame(Debugger.StyleFrame previous, InstructionDetails instr) {
|
||||
super(previous, new MySource(instr));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInstruction() {
|
||||
return getPrevious().getInstruction();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Value eval(String expr) throws Debugger.EvaluationException {
|
||||
return getPrevious().eval(expr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Debugger.Variable> getVariables() {
|
||||
return getPrevious().getVariables();
|
||||
}
|
||||
|
||||
private static class MySource implements Source, SourceLocator {
|
||||
private final InstructionDetails myInstruction;
|
||||
|
||||
public MySource(InstructionDetails instr) {
|
||||
myInstruction = instr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSystemId(String systemId) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPublicId() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSystemId() {
|
||||
return myInstruction.getSystemId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLineNumber() {
|
||||
return myInstruction.getLineNumber();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColumnNumber() {
|
||||
return myInstruction.getColumnNumber();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,8 @@
|
||||
</change-notes>
|
||||
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
<xdebugger.breakpointType implementation="org.intellij.plugins.xsltDebugger.XsltBreakpointType"/>
|
||||
<xdebugger.breakpointType implementation="org.intellij.plugins.xsltDebugger.XsltBreakpointType$V1"/>
|
||||
<xdebugger.breakpointType implementation="org.intellij.plugins.xsltDebugger.XsltBreakpointType$V2"/>
|
||||
|
||||
<programRunner implementation="org.intellij.plugins.xsltDebugger.XsltDebuggerRunner"/>
|
||||
</extensions>
|
||||
|
||||
@@ -93,6 +93,8 @@ class DebuggerConnector implements Runnable {
|
||||
private Debugger connect() {
|
||||
Throwable lastException = null;
|
||||
for (int i = 0; i < 10; i++) {
|
||||
if (myProcess.isProcessTerminated()) return null;
|
||||
|
||||
try {
|
||||
final Debugger realClient = EDTGuard.create(new RemoteDebuggerClient(myPort), myProcess);
|
||||
myProcess.notifyTextAvailable("Connected to XSLT debugger on port " + myPort + "\n", ProcessOutputTypes.SYSTEM);
|
||||
|
||||
@@ -20,4 +20,5 @@ package org.intellij.plugins.xsltDebugger;
|
||||
* Thrown by the EDTGuard when some method cannot be completed due to the target VM being paused.
|
||||
*/
|
||||
public class VMPausedException extends RuntimeException {
|
||||
public static final String MESSAGE = "Target VM is not responding";
|
||||
}
|
||||
|
||||
+30
-5
@@ -13,6 +13,7 @@ import com.intellij.xdebugger.breakpoints.XLineBreakpointType;
|
||||
import com.intellij.xdebugger.evaluation.XDebuggerEditorsProvider;
|
||||
import com.intellij.xdebugger.ui.DebuggerIcons;
|
||||
import org.intellij.lang.xpath.xslt.XsltSupport;
|
||||
import org.intellij.lang.xpath.xslt.impl.XsltChecker;
|
||||
import org.intellij.plugins.xsltDebugger.impl.XsltDebuggerEditorsProvider;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -23,12 +24,12 @@ import javax.swing.*;
|
||||
* User: sweinreuter
|
||||
* Date: 03.03.11
|
||||
*/
|
||||
public final class XsltBreakpointType extends XLineBreakpointType<XBreakpointProperties> {
|
||||
public abstract class XsltBreakpointType extends XLineBreakpointType<XBreakpointProperties> {
|
||||
|
||||
private final XsltDebuggerEditorsProvider myMyEditorsProvider = new XsltDebuggerEditorsProvider();
|
||||
private final XsltDebuggerEditorsProvider myMyEditorsProvider = new XsltDebuggerEditorsProvider(getLanguageLevel());
|
||||
|
||||
public XsltBreakpointType() {
|
||||
super("xslt", "XSLT Breakpoints");
|
||||
protected XsltBreakpointType(final String id) {
|
||||
super(id, "XSLT Breakpoints");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -44,9 +45,11 @@ public final class XsltBreakpointType extends XLineBreakpointType<XBreakpointPro
|
||||
if (fileType != StdFileTypes.XML || !XsltSupport.isXsltFile(psiFile)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return getLanguageLevel() == XsltSupport.getXsltLanguageLevel(psiFile);
|
||||
}
|
||||
|
||||
protected abstract XsltChecker.LanguageLevel getLanguageLevel();
|
||||
|
||||
@Override
|
||||
public XDebuggerEditorsProvider getEditorsProvider() {
|
||||
return myMyEditorsProvider;
|
||||
@@ -68,4 +71,26 @@ public final class XsltBreakpointType extends XLineBreakpointType<XBreakpointPro
|
||||
public XBreakpointProperties createBreakpointProperties(@NotNull VirtualFile file, int line) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static final class V1 extends XsltBreakpointType {
|
||||
public V1() {
|
||||
super("xslt");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected XsltChecker.LanguageLevel getLanguageLevel() {
|
||||
return XsltChecker.LanguageLevel.V1;
|
||||
}
|
||||
}
|
||||
|
||||
public static final class V2 extends XsltBreakpointType {
|
||||
public V2() {
|
||||
super("xslt2");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected XsltChecker.LanguageLevel getLanguageLevel() {
|
||||
return XsltChecker.LanguageLevel.V2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+14
-4
@@ -61,6 +61,7 @@ import java.util.jar.Manifest;
|
||||
public class XsltDebuggerExtension extends XsltRunnerExtension {
|
||||
private static final Logger LOG = Logger.getInstance(XsltDebuggerExtension.class.getName());
|
||||
|
||||
public static final Key<XsltChecker.LanguageLevel> VERSION = Key.create("VERSION");
|
||||
private static final Key<Integer> PORT = Key.create("PORT");
|
||||
private static final Key<Manifest> MANIFEST = Key.create("MANIFEST");
|
||||
|
||||
@@ -133,6 +134,7 @@ public class XsltDebuggerExtension extends XsltRunnerExtension {
|
||||
assert descriptor != null;
|
||||
pluginPath = descriptor.getPath();
|
||||
} else {
|
||||
// -Dxslt-debugger.plugin.path=C:\work\java\intellij/ultimate\out\classes\production\xslt-debugger-engine
|
||||
pluginPath = new File(System.getProperty("xslt-debugger.plugin.path"));
|
||||
}
|
||||
|
||||
@@ -192,12 +194,20 @@ public class XsltDebuggerExtension extends XsltRunnerExtension {
|
||||
parameters.getVMParametersList().defineProperty("xslt.transformer.type", "xalan");
|
||||
}
|
||||
}
|
||||
|
||||
final VirtualFile xsltFile = configuration.findXsltFile();
|
||||
final PsiManager psiManager = PsiManager.getInstance(configuration.getProject());
|
||||
final XsltChecker.LanguageLevel level;
|
||||
if (xsltFile != null) {
|
||||
level = XsltSupport.getXsltLanguageLevel(psiManager.findFile(xsltFile));
|
||||
} else {
|
||||
level = XsltChecker.LanguageLevel.V1;
|
||||
}
|
||||
extensionData.putUserData(VERSION, level);
|
||||
|
||||
if (!parameters.getVMParametersList().hasProperty("xslt.transformer.type")) {
|
||||
// add saxon for backward-compatibility
|
||||
final VirtualFile xsltFile = configuration.findXsltFile();
|
||||
final PsiManager psiManager = PsiManager.getInstance(configuration.getProject());
|
||||
if (xsltFile != null && XsltSupport.getXsltLanguageLevel(psiManager.findFile(xsltFile)) == XsltChecker.LanguageLevel.V2)
|
||||
{
|
||||
if (level == XsltChecker.LanguageLevel.V2) {
|
||||
parameters.getVMParametersList().defineProperty("xslt.transformer.type", "saxon9");
|
||||
addSaxon(parameters, pluginPath, SAXON_9_JAR);
|
||||
} else {
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.intellij.xdebugger.XDebugProcess;
|
||||
import com.intellij.xdebugger.XDebugProcessStarter;
|
||||
import com.intellij.xdebugger.XDebugSession;
|
||||
import com.intellij.xdebugger.XDebuggerManager;
|
||||
import org.intellij.lang.xpath.xslt.run.XsltCommandLineState;
|
||||
import org.intellij.lang.xpath.xslt.run.XsltRunConfiguration;
|
||||
import org.intellij.plugins.xsltDebugger.impl.XsltDebugProcess;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -63,8 +64,9 @@ public class XsltDebuggerRunner extends DefaultProgramRunner {
|
||||
public XDebugProcess start(@NotNull final XDebugSession session) throws ExecutionException {
|
||||
ACTIVE.set(Boolean.TRUE);
|
||||
try {
|
||||
final XsltCommandLineState c = (XsltCommandLineState)runProfileState;
|
||||
final ExecutionResult result = runProfileState.execute(executor, XsltDebuggerRunner.this);
|
||||
return new XsltDebugProcess(session, result);
|
||||
return new XsltDebugProcess(session, result, c.getExtensionData().getUserData(XsltDebuggerExtension.VERSION));
|
||||
} finally {
|
||||
ACTIVE.remove();
|
||||
}
|
||||
|
||||
+4
-37
@@ -26,7 +26,6 @@ import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.pom.Navigatable;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.util.EventDispatcher;
|
||||
import com.intellij.xdebugger.XSourcePosition;
|
||||
@@ -153,14 +152,14 @@ public class XsltDebuggerSession implements Disposable {
|
||||
myClient.stepInto();
|
||||
}
|
||||
|
||||
public boolean canRunTo(final PsiFile file, final int offset) {
|
||||
return XsltBreakpointHandler.getActualLineNumber(myProject, new MyXSourcePosition(file, offset)) != -1;
|
||||
public boolean canRunTo(final XSourcePosition position) {
|
||||
return XsltBreakpointHandler.getActualLineNumber(myProject, position) != -1;
|
||||
}
|
||||
|
||||
public void runTo(final PsiFile file, final int offset) {
|
||||
public void runTo(final PsiFile file, final XSourcePosition position) {
|
||||
assert myTempBreakpoint == null;
|
||||
|
||||
final int lineNumber = XsltBreakpointHandler.getActualLineNumber(myProject, new MyXSourcePosition(file, offset));
|
||||
final int lineNumber = XsltBreakpointHandler.getActualLineNumber(myProject, position);
|
||||
final String uri = XsltBreakpointHandler.getFileURL(file.getVirtualFile());
|
||||
myTempBreakpoint = myClient.getBreakpointManager().setBreakpoint(uri, lineNumber);
|
||||
|
||||
@@ -224,36 +223,4 @@ public class XsltDebuggerSession implements Disposable {
|
||||
|
||||
void debuggerStopped();
|
||||
}
|
||||
|
||||
private static class MyXSourcePosition implements XSourcePosition {
|
||||
private final PsiFile myFile;
|
||||
private final int myOffset;
|
||||
|
||||
public MyXSourcePosition(PsiFile file, int offset) {
|
||||
myFile = file;
|
||||
myOffset = offset;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLine() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOffset() {
|
||||
return myOffset;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public VirtualFile getFile() {
|
||||
return myFile.getVirtualFile();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Navigatable createNavigatable(@NotNull Project project) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+6
-3
@@ -23,14 +23,15 @@ import org.intellij.plugins.xsltDebugger.VMPausedException;
|
||||
import org.intellij.plugins.xsltDebugger.XsltBreakpointType;
|
||||
import org.intellij.plugins.xsltDebugger.rt.engine.Breakpoint;
|
||||
import org.intellij.plugins.xsltDebugger.rt.engine.BreakpointManager;
|
||||
import org.intellij.plugins.xsltDebugger.rt.engine.DebuggerStoppedException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class XsltBreakpointHandler extends XBreakpointHandler<XLineBreakpoint<XBreakpointProperties>> {
|
||||
private XsltDebugProcess myXsltDebugProcess;
|
||||
|
||||
public XsltBreakpointHandler(XsltDebugProcess xsltDebugProcess) {
|
||||
super(XsltBreakpointType.class);
|
||||
public XsltBreakpointHandler(XsltDebugProcess xsltDebugProcess, final Class<? extends XsltBreakpointType> typeClass) {
|
||||
super(typeClass);
|
||||
myXsltDebugProcess = xsltDebugProcess;
|
||||
}
|
||||
|
||||
@@ -61,6 +62,7 @@ public class XsltBreakpointHandler extends XBreakpointHandler<XLineBreakpoint<XB
|
||||
} else {
|
||||
manager.setBreakpoint(fileURL, lineNumber);
|
||||
}
|
||||
} catch (DebuggerStoppedException ignore) {
|
||||
} catch (VMPausedException e) {
|
||||
final XDebugSession session = myXsltDebugProcess.getSession();
|
||||
session.reportMessage("Target VM is not responding. Breakpoint can not be set", MessageType.ERROR);
|
||||
@@ -96,6 +98,7 @@ public class XsltBreakpointHandler extends XBreakpointHandler<XLineBreakpoint<XB
|
||||
} else {
|
||||
manager.removeBreakpoint(fileURL, lineNumber);
|
||||
}
|
||||
} catch (DebuggerStoppedException ignore) {
|
||||
} catch (VMPausedException e) {
|
||||
myXsltDebugProcess.getSession().reportMessage("Target VM is not responding. Breakpoint can not be removed", MessageType.ERROR);
|
||||
}
|
||||
@@ -164,7 +167,7 @@ public class XsltBreakpointHandler extends XBreakpointHandler<XLineBreakpoint<XB
|
||||
|
||||
int offset = -1;
|
||||
final Document document = PsiDocumentManager.getInstance(project).getDocument(file);
|
||||
if (document != null && document.getLineCount() > position.getLine()) {
|
||||
if (document != null && document.getLineCount() > position.getLine() && position.getLine() >= 0) {
|
||||
offset = document.getLineStartOffset(position.getLine());
|
||||
}
|
||||
if (offset < 0) {
|
||||
|
||||
+12
-10
@@ -17,12 +17,11 @@ import com.intellij.xdebugger.breakpoints.XBreakpointHandler;
|
||||
import com.intellij.xdebugger.evaluation.XDebuggerEditorsProvider;
|
||||
import com.intellij.xdebugger.frame.XExecutionStack;
|
||||
import com.intellij.xdebugger.frame.XSuspendContext;
|
||||
import org.intellij.lang.xpath.xslt.impl.XsltChecker;
|
||||
import org.intellij.plugins.xsltDebugger.VMPausedException;
|
||||
import org.intellij.plugins.xsltDebugger.XsltBreakpointType;
|
||||
import org.intellij.plugins.xsltDebugger.XsltDebuggerSession;
|
||||
import org.intellij.plugins.xsltDebugger.rt.engine.Breakpoint;
|
||||
import org.intellij.plugins.xsltDebugger.rt.engine.BreakpointManager;
|
||||
import org.intellij.plugins.xsltDebugger.rt.engine.Debugger;
|
||||
import org.intellij.plugins.xsltDebugger.rt.engine.BreakpointManagerImpl;
|
||||
import org.intellij.plugins.xsltDebugger.rt.engine.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -38,16 +37,17 @@ public class XsltDebugProcess extends XDebugProcess implements Disposable {
|
||||
private BreakpointManager myBreakpointManager = new BreakpointManagerImpl();
|
||||
|
||||
private final XBreakpointHandler<?>[] myXBreakpointHandlers = new XBreakpointHandler<?>[]{
|
||||
new XsltBreakpointHandler(this)
|
||||
new XsltBreakpointHandler(this, XsltBreakpointType.V1.class),
|
||||
new XsltBreakpointHandler(this, XsltBreakpointType.V2.class)
|
||||
};
|
||||
private XsltDebuggerSession myDebuggerSession;
|
||||
|
||||
public XsltDebugProcess(XDebugSession session, ExecutionResult executionResult) {
|
||||
public XsltDebugProcess(XDebugSession session, ExecutionResult executionResult, XsltChecker.LanguageLevel data) {
|
||||
super(session);
|
||||
myProcessHandler = executionResult.getProcessHandler();
|
||||
myProcessHandler.putUserData(KEY, this);
|
||||
myExecutionConsole = executionResult.getExecutionConsole();
|
||||
myEditorsProvider = new XsltDebuggerEditorsProvider();
|
||||
myEditorsProvider = new XsltDebuggerEditorsProvider(data);
|
||||
Disposer.register(myExecutionConsole, this);
|
||||
}
|
||||
|
||||
@@ -77,6 +77,7 @@ public class XsltDebugProcess extends XDebugProcess implements Disposable {
|
||||
|
||||
@Override
|
||||
public void debuggerStopped() {
|
||||
myBreakpointManager = new BreakpointManagerImpl();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -129,6 +130,7 @@ public class XsltDebugProcess extends XDebugProcess implements Disposable {
|
||||
|
||||
@Override
|
||||
public void startStepOut() {
|
||||
myDebuggerSession.stepOver();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -145,7 +147,7 @@ public class XsltDebugProcess extends XDebugProcess implements Disposable {
|
||||
try {
|
||||
return myDebuggerSession.getClient().ping();
|
||||
} catch (VMPausedException e) {
|
||||
getSession().reportMessage("Target VM is not responding", MessageType.WARNING);
|
||||
getSession().reportMessage(VMPausedException.MESSAGE, MessageType.WARNING);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -163,8 +165,8 @@ public class XsltDebugProcess extends XDebugProcess implements Disposable {
|
||||
public void runToPosition(@NotNull XSourcePosition position) {
|
||||
final PsiFile psiFile = PsiManager.getInstance(getSession().getProject()).findFile(position.getFile());
|
||||
assert psiFile != null;
|
||||
if (myDebuggerSession.canRunTo(psiFile, position.getOffset())) {
|
||||
myDebuggerSession.runTo(psiFile, position.getOffset());
|
||||
if (myDebuggerSession.canRunTo(position)) {
|
||||
myDebuggerSession.runTo(psiFile, position);
|
||||
} else {
|
||||
StatusBar.Info.set("Not a valid position in file '" + psiFile.getName() + "'", psiFile.getProject());
|
||||
final Debugger c = myDebuggerSession.getClient();
|
||||
|
||||
+10
-2
@@ -12,16 +12,24 @@ import com.intellij.xdebugger.XSourcePosition;
|
||||
import com.intellij.xdebugger.evaluation.EvaluationMode;
|
||||
import com.intellij.xdebugger.evaluation.XDebuggerEditorsProvider;
|
||||
import org.intellij.lang.xpath.XPathFileType;
|
||||
import org.intellij.lang.xpath.xslt.impl.XsltChecker;
|
||||
import org.intellij.plugins.xsltDebugger.BreakpointContext;
|
||||
import org.intellij.plugins.xsltDebugger.rt.engine.Debugger;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class XsltDebuggerEditorsProvider extends XDebuggerEditorsProvider {
|
||||
|
||||
private final XPathFileType myFileType;
|
||||
|
||||
public XsltDebuggerEditorsProvider(XsltChecker.LanguageLevel level) {
|
||||
myFileType = level == XsltChecker.LanguageLevel.V2 ? XPathFileType.XPATH2 : XPathFileType.XPATH;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public FileType getFileType() {
|
||||
return XPathFileType.XPATH;
|
||||
return myFileType;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -31,7 +39,7 @@ public class XsltDebuggerEditorsProvider extends XDebuggerEditorsProvider {
|
||||
@Nullable XSourcePosition sourcePosition,
|
||||
@NotNull EvaluationMode mode) {
|
||||
final PsiFile psiFile = PsiFileFactory.getInstance(project)
|
||||
.createFileFromText("XPathExpr.xpath", XPathFileType.XPATH, text, LocalTimeCounter.currentTime(), true);
|
||||
.createFileFromText("XPathExpr." + myFileType.getDefaultExtension(), myFileType, text, LocalTimeCounter.currentTime(), true);
|
||||
|
||||
if (sourcePosition instanceof XsltSourcePosition && ((XsltSourcePosition)sourcePosition).getLocation() instanceof Debugger.StyleFrame) {
|
||||
final Debugger.Locatable location = ((XsltSourcePosition)sourcePosition).getLocation();
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ public class XsltExecutionStack extends XExecutionStack {
|
||||
}
|
||||
}
|
||||
} catch (VMPausedException e) {
|
||||
container.errorOccurred("VM is paused");
|
||||
container.errorOccurred(VMPausedException.MESSAGE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -97,7 +97,7 @@ public class XsltStackFrame extends XStackFrame {
|
||||
super.computeChildren(node);
|
||||
}
|
||||
} catch (VMPausedException e) {
|
||||
node.setErrorMessage("Target VM is not responding");
|
||||
node.setErrorMessage(VMPausedException.MESSAGE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,6 +200,8 @@ public class XsltStackFrame extends XStackFrame {
|
||||
try {
|
||||
final Value eval = myFrame.eval(expression);
|
||||
callback.evaluated(new MyValue(new ExpressionResult(eval)));
|
||||
} catch (VMPausedException e) {
|
||||
callback.errorOccurred(VMPausedException.MESSAGE);
|
||||
} catch (Debugger.EvaluationException e) {
|
||||
callback.errorOccurred(e.getMessage() != null ? e.getMessage() : e.toString());
|
||||
}
|
||||
|
||||
@@ -917,6 +917,7 @@
|
||||
<liveTemplateContext implementation="com.intellij.codeInsight.template.JavaStringContextType"/>
|
||||
<liveTemplateContext implementation="com.intellij.codeInsight.template.SmartCompletionContextType"/>
|
||||
<projectExtension implementation="com.intellij.openapi.roots.impl.LanguageLevelProjectExtensionImpl$MyProjectExtension"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.openapi.roots.impl.LanguageLevelUsagesCollector"/>
|
||||
|
||||
<moduleExtension implementation="com.intellij.openapi.roots.impl.CompilerModuleExtensionImpl"/>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user