mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
Generated
+8
@@ -2,6 +2,14 @@
|
||||
<project version="4">
|
||||
<component name="AntConfiguration">
|
||||
<defaultAnt bundledAnt="true" />
|
||||
<buildFile url="file://$PROJECT_DIR$/build/update.xml">
|
||||
<additionalClassPath />
|
||||
<antReference projectDefault="true" />
|
||||
<customJdkName value="" />
|
||||
<maximumHeapSize value="128" />
|
||||
<maximumStackSize value="2" />
|
||||
<properties />
|
||||
</buildFile>
|
||||
</component>
|
||||
</project>
|
||||
|
||||
|
||||
@@ -45,7 +45,6 @@ import com.intellij.execution.ui.ExecutionConsoleEx;
|
||||
import com.intellij.execution.ui.RunContentDescriptor;
|
||||
import com.intellij.execution.ui.actions.CloseAction;
|
||||
import com.intellij.execution.ui.layout.PlaceInGrid;
|
||||
import com.intellij.ide.CommonActionsManager;
|
||||
import com.intellij.ide.actions.ContextHelpAction;
|
||||
import com.intellij.idea.ActionsBundle;
|
||||
import com.intellij.openapi.Disposable;
|
||||
@@ -76,7 +75,6 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.debugger.ui.DebuggerSessionTab");
|
||||
|
||||
private static final Icon WATCH_RETURN_VALUES_ICON = IconLoader.getIcon("/debugger/watchLastReturnValue.png");
|
||||
private static final Icon FILTER_STACK_FRAMES_ICON = IconLoader.getIcon("/debugger/class_filter.png");
|
||||
private static final Icon AUTO_VARS_ICONS = IconLoader.getIcon("/debugger/autoVariablesMode.png");
|
||||
|
||||
private final VariablesPanel myVariablesPanel;
|
||||
@@ -139,6 +137,8 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
|
||||
stepping.add(actionManager.getAction(DebuggerActions.POP_FRAME));
|
||||
stepping.addSeparator();
|
||||
stepping.add(actionManager.getAction(DebuggerActions.RUN_TO_CURSOR));
|
||||
stepping.addSeparator();
|
||||
stepping.add(actionManager.getAction(DebuggerActions.EVALUATE_EXPRESSION));
|
||||
myUi.getOptions().setTopToolbar(stepping, ActionPlaces.DEBUGGER_TOOLBAR);
|
||||
|
||||
|
||||
@@ -153,11 +153,6 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
|
||||
XDebuggerUIConstants.WATCHES_TAB_ICON, null);
|
||||
watches.setCloseable(false);
|
||||
watches.setAlertIcon(breakpointAlert);
|
||||
final DefaultActionGroup watchesGroup = new DefaultActionGroup();
|
||||
addAction(watchesGroup, DebuggerActions.NEW_WATCH);
|
||||
addAction(watchesGroup, XDebuggerActions.ADD_TO_WATCH);
|
||||
addAction(watchesGroup, DebuggerActions.REMOVE_WATCH);
|
||||
watches.setActions(watchesGroup, ActionPlaces.DEBUGGER_TOOLBAR, myWatchPanel.getTree());
|
||||
myUi.addContent(watches, 0, PlaceInGrid.right, false);
|
||||
|
||||
// frames
|
||||
@@ -166,14 +161,6 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
|
||||
framesContent.setCloseable(false);
|
||||
framesContent.setAlertIcon(breakpointAlert);
|
||||
|
||||
final DefaultActionGroup framesGroup = new DefaultActionGroup();
|
||||
|
||||
CommonActionsManager actionsManager = CommonActionsManager.getInstance();
|
||||
framesGroup.add(actionsManager.createPrevOccurenceAction(myFramesPanel.getOccurenceNavigator()));
|
||||
framesGroup.add(actionsManager.createNextOccurenceAction(myFramesPanel.getOccurenceNavigator()));
|
||||
framesGroup.add(new ShowLibraryFramesAction());
|
||||
|
||||
framesContent.setActions(framesGroup, ActionPlaces.DEBUGGER_TOOLBAR, myFramesPanel.getFramesList());
|
||||
myUi.addContent(framesContent, 0, PlaceInGrid.left, false);
|
||||
|
||||
// variables
|
||||
@@ -183,11 +170,6 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
|
||||
XDebuggerUIConstants.VARIABLES_TAB_ICON, null);
|
||||
vars.setCloseable(false);
|
||||
vars.setAlertIcon(breakpointAlert);
|
||||
final DefaultActionGroup varsGroup = new DefaultActionGroup();
|
||||
addAction(varsGroup, DebuggerActions.EVALUATE_EXPRESSION);
|
||||
varsGroup.add(new WatchLastMethodReturnValueAction());
|
||||
varsGroup.add(new AutoVarsSwitchAction());
|
||||
vars.setActions(varsGroup, ActionPlaces.DEBUGGER_TOOLBAR, myVariablesPanel.getTree());
|
||||
myUi.addContent(vars, 0, PlaceInGrid.center, false);
|
||||
|
||||
// threads
|
||||
@@ -316,14 +298,16 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
|
||||
addAction(group, DebuggerActions.DUMP_THREADS);
|
||||
group.addSeparator();
|
||||
|
||||
final AnAction[] layout = myUi.getOptions().getLayoutActionsList();
|
||||
final AnAction layoutGroup = myUi.getOptions().getLayoutActions();
|
||||
group.add(myUi.getOptions().getLayoutActions());
|
||||
|
||||
final AnAction[] commonSettings = myUi.getOptions().getSettingsActionsList();
|
||||
final AnAction commonSettingsList = myUi.getOptions().getSettingsActions();
|
||||
|
||||
final DefaultActionGroup settings = new DefaultActionGroup("DebuggerSettings", true) {
|
||||
@Override
|
||||
public void update(AnActionEvent e) {
|
||||
e.getPresentation().setText(ActionsBundle.message("group.XDebugger.settings.text"));
|
||||
e.getPresentation().setIcon(layoutGroup.getTemplatePresentation().getIcon());
|
||||
e.getPresentation().setIcon(commonSettingsList.getTemplatePresentation().getIcon());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -331,12 +315,15 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
|
||||
return true;
|
||||
}
|
||||
};
|
||||
for (AnAction each : layout) {
|
||||
for (AnAction each : commonSettings) {
|
||||
settings.add(each);
|
||||
}
|
||||
if (layout.length > 0) {
|
||||
if (commonSettings.length > 0) {
|
||||
settings.addSeparator();
|
||||
}
|
||||
settings.add(new WatchLastMethodReturnValueAction());
|
||||
settings.add(new AutoVarsSwitchAction());
|
||||
settings.addSeparator();
|
||||
addActionToGroup(settings, XDebuggerActions.AUTO_TOOLTIP);
|
||||
|
||||
group.add(settings);
|
||||
@@ -571,34 +558,6 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
|
||||
}
|
||||
}
|
||||
|
||||
private class ShowLibraryFramesAction extends ToggleAction {
|
||||
private volatile boolean myShouldShow;
|
||||
private static final String ourTextWhenShowIsOn = "Hide Frames from Libraries";
|
||||
private static final String ourTextWhenShowIsOff = "Show All Frames";
|
||||
|
||||
public ShowLibraryFramesAction() {
|
||||
super("", "", FILTER_STACK_FRAMES_ICON);
|
||||
myShouldShow = DebuggerSettings.getInstance().SHOW_LIBRARY_STACKFRAMES;
|
||||
}
|
||||
|
||||
public void update(final AnActionEvent e) {
|
||||
super.update(e);
|
||||
final Presentation presentation = e.getPresentation();
|
||||
final boolean shouldShow = !(Boolean)presentation.getClientProperty(SELECTED_PROPERTY);
|
||||
presentation.setText(shouldShow ? ourTextWhenShowIsOn : ourTextWhenShowIsOff);
|
||||
}
|
||||
|
||||
public boolean isSelected(AnActionEvent e) {
|
||||
return !myShouldShow;
|
||||
}
|
||||
|
||||
public void setSelected(AnActionEvent e, boolean enabled) {
|
||||
myShouldShow = !enabled;
|
||||
DebuggerSettings.getInstance().SHOW_LIBRARY_STACKFRAMES = myShouldShow;
|
||||
myFramesPanel.setShowLibraryFrames(myShouldShow);
|
||||
}
|
||||
}
|
||||
|
||||
private class WatchLastMethodReturnValueAction extends ToggleAction {
|
||||
private volatile boolean myWatchesReturnValues;
|
||||
private final String myTextEnable;
|
||||
@@ -606,7 +565,7 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
|
||||
private final String myMyTextDisable;
|
||||
|
||||
public WatchLastMethodReturnValueAction() {
|
||||
super("", DebuggerBundle.message("action.watch.method.return.value.description"), WATCH_RETURN_VALUES_ICON);
|
||||
super("", DebuggerBundle.message("action.watch.method.return.value.description"), null);
|
||||
myWatchesReturnValues = DebuggerSettings.getInstance().WATCH_RETURN_VALUES;
|
||||
myTextEnable = DebuggerBundle.message("action.watches.method.return.value.enable");
|
||||
myMyTextDisable = DebuggerBundle.message("action.watches.method.return.value.disable");
|
||||
|
||||
@@ -41,22 +41,25 @@ import com.intellij.debugger.ui.impl.watch.MethodsTracker;
|
||||
import com.intellij.debugger.ui.impl.watch.StackFrameDescriptorImpl;
|
||||
import com.intellij.debugger.ui.impl.watch.ThreadDescriptorImpl;
|
||||
import com.intellij.debugger.ui.tree.render.DescriptorLabelListener;
|
||||
import com.intellij.ide.CommonActionsManager;
|
||||
import com.intellij.ide.OccurenceNavigator;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.actionSystem.ActionManager;
|
||||
import com.intellij.openapi.actionSystem.ActionPopupMenu;
|
||||
import com.intellij.openapi.actionSystem.DefaultActionGroup;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.actionSystem.impl.ActionToolbarImpl;
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.ComboBoxWithWidePopup;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.ui.PopupHandler;
|
||||
import com.intellij.ui.ScrollPaneFactory;
|
||||
import com.intellij.ui.components.panels.Wrapper;
|
||||
import com.intellij.util.Alarm;
|
||||
import com.sun.jdi.ObjectCollectedException;
|
||||
import com.sun.jdi.VMDisconnectedException;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import javax.swing.event.ListSelectionEvent;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
import java.awt.*;
|
||||
@@ -71,6 +74,8 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
public class FramesPanel extends UpdatableDebuggerView {
|
||||
private static final Icon FILTER_STACK_FRAMES_ICON = IconLoader.getIcon("/debugger/class_filter.png");
|
||||
|
||||
private final JComboBox myThreadsCombo;
|
||||
private final FramesList myFramesList;
|
||||
private final ThreadsListener myThreadsListener;
|
||||
@@ -106,10 +111,31 @@ public class FramesPanel extends UpdatableDebuggerView {
|
||||
registerThreadsPopupMenu(myFramesList);
|
||||
|
||||
setBorder(null);
|
||||
add(myThreadsCombo, BorderLayout.NORTH);
|
||||
|
||||
final ActionToolbar toolbar = createToolbar();
|
||||
Wrapper threads = new Wrapper();
|
||||
threads.add(toolbar.getComponent(), BorderLayout.EAST);
|
||||
threads.add(myThreadsCombo, BorderLayout.CENTER);
|
||||
add(threads, BorderLayout.NORTH);
|
||||
add(ScrollPaneFactory.createScrollPane(myFramesList), BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
private ActionToolbar createToolbar() {
|
||||
final DefaultActionGroup framesGroup = new DefaultActionGroup();
|
||||
framesGroup.addSeparator();
|
||||
|
||||
CommonActionsManager actionsManager = CommonActionsManager.getInstance();
|
||||
framesGroup.add(actionsManager.createPrevOccurenceAction(getOccurenceNavigator()));
|
||||
framesGroup.add(actionsManager.createNextOccurenceAction(getOccurenceNavigator()));
|
||||
framesGroup.add(new ShowLibraryFramesAction());
|
||||
|
||||
final ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.DEBUGGER_TOOLBAR, framesGroup, true);
|
||||
toolbar.setReservePlaceAutoPopupIcon(false);
|
||||
((ActionToolbarImpl)toolbar).setAddSeparatorFirst(true);
|
||||
toolbar.getComponent().setBorder(new EmptyBorder(1, 0, 0, 0));
|
||||
return toolbar;
|
||||
}
|
||||
|
||||
public DebuggerStateManager getContextManager() {
|
||||
return myStateManager;
|
||||
}
|
||||
@@ -630,4 +656,32 @@ public class FramesPanel extends UpdatableDebuggerView {
|
||||
public FramesList getFramesList() {
|
||||
return myFramesList;
|
||||
}
|
||||
|
||||
private class ShowLibraryFramesAction extends ToggleAction {
|
||||
private volatile boolean myShouldShow;
|
||||
private static final String ourTextWhenShowIsOn = "Hide Frames from Libraries";
|
||||
private static final String ourTextWhenShowIsOff = "Show All Frames";
|
||||
|
||||
public ShowLibraryFramesAction() {
|
||||
super("", "", FILTER_STACK_FRAMES_ICON);
|
||||
myShouldShow = DebuggerSettings.getInstance().SHOW_LIBRARY_STACKFRAMES;
|
||||
}
|
||||
|
||||
public void update(final AnActionEvent e) {
|
||||
super.update(e);
|
||||
final Presentation presentation = e.getPresentation();
|
||||
final boolean shouldShow = !(Boolean)presentation.getClientProperty(SELECTED_PROPERTY);
|
||||
presentation.setText(shouldShow ? ourTextWhenShowIsOn : ourTextWhenShowIsOff);
|
||||
}
|
||||
|
||||
public boolean isSelected(AnActionEvent e) {
|
||||
return !myShouldShow;
|
||||
}
|
||||
|
||||
public void setSelected(AnActionEvent e, boolean enabled) {
|
||||
myShouldShow = !enabled;
|
||||
DebuggerSettings.getInstance().SHOW_LIBRARY_STACKFRAMES = myShouldShow;
|
||||
setShowLibraryFrames(myShouldShow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,20 +20,20 @@
|
||||
*/
|
||||
package com.intellij.debugger.ui.impl;
|
||||
|
||||
import com.intellij.debugger.DebuggerBundle;
|
||||
import com.intellij.debugger.actions.AddToWatchActionHandler;
|
||||
import com.intellij.debugger.actions.DebuggerActions;
|
||||
import com.intellij.debugger.engine.evaluation.CodeFragmentKind;
|
||||
import com.intellij.debugger.engine.evaluation.DefaultCodeFragmentFactory;
|
||||
import com.intellij.debugger.engine.evaluation.TextWithImports;
|
||||
import com.intellij.debugger.engine.evaluation.TextWithImportsImpl;
|
||||
import com.intellij.debugger.engine.evaluation.DefaultCodeFragmentFactory;
|
||||
import com.intellij.debugger.impl.DebuggerContextImpl;
|
||||
import com.intellij.debugger.impl.DebuggerStateManager;
|
||||
import com.intellij.debugger.impl.PositionUtil;
|
||||
import com.intellij.debugger.ui.DebuggerExpressionComboBox;
|
||||
import com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl;
|
||||
import com.intellij.debugger.ui.impl.watch.DebuggerTreeInplaceEditor;
|
||||
import com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl;
|
||||
import com.intellij.debugger.ui.impl.watch.WatchItemDescriptor;
|
||||
import com.intellij.debugger.DebuggerBundle;
|
||||
import com.intellij.ide.DataManager;
|
||||
import com.intellij.ide.dnd.DnDEvent;
|
||||
import com.intellij.ide.dnd.DnDManager;
|
||||
@@ -43,7 +43,10 @@ import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.ui.AnActionButton;
|
||||
import com.intellij.ui.AnActionButtonRunnable;
|
||||
import com.intellij.ui.ListenerUtil;
|
||||
import com.intellij.ui.ToolbarDecorator;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -205,4 +208,35 @@ public class MainWatchPanel extends WatchPanel implements DataProvider {
|
||||
};
|
||||
editor.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JComponent createTreePanel(final WatchDebuggerTree tree) {
|
||||
final ToolbarDecorator decorator = ToolbarDecorator.createDecorator(tree);
|
||||
decorator.setAddAction(new AnActionButtonRunnable() {
|
||||
@Override
|
||||
public void run(AnActionButton button) {
|
||||
executeAction(DebuggerActions.NEW_WATCH, tree);
|
||||
}
|
||||
});
|
||||
// TODO[den]: add "Add to watches action"
|
||||
decorator.setRemoveAction(new AnActionButtonRunnable() {
|
||||
@Override
|
||||
public void run(AnActionButton button) {
|
||||
executeAction(DebuggerActions.REMOVE_WATCH, tree);
|
||||
}
|
||||
});
|
||||
final JPanel panel = decorator.createPanel();
|
||||
panel.setBorder(null);
|
||||
return panel;
|
||||
}
|
||||
|
||||
private static void executeAction(final String watch, final WatchDebuggerTree tree) {
|
||||
AnAction action = ActionManager.getInstance().getAction(watch);
|
||||
Presentation presentation = action.getTemplatePresentation().clone();
|
||||
DataContext context = DataManager.getInstance().getDataContext(tree);
|
||||
|
||||
AnActionEvent actionEvent =
|
||||
new AnActionEvent(null, context, ActionPlaces.DEBUGGER_TOOLBAR, presentation, ActionManager.getInstance(), 0);
|
||||
action.actionPerformed(actionEvent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.ui.ScrollPaneFactory;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.util.Enumeration;
|
||||
|
||||
@@ -43,11 +44,15 @@ public abstract class WatchPanel extends DebuggerTreePanel {
|
||||
|
||||
public WatchPanel(Project project, DebuggerStateManager stateManager) {
|
||||
super(project, stateManager);
|
||||
add(ScrollPaneFactory.createScrollPane(getWatchTree()), BorderLayout.CENTER);
|
||||
add(createTreePanel(getWatchTree()), BorderLayout.CENTER);
|
||||
registerDisposable(DebuggerAction.installEditAction(getWatchTree(), DebuggerActions.EDIT_NODE_SOURCE));
|
||||
overrideShortcut(getWatchTree(), DebuggerActions.COPY_VALUE, CommonShortcuts.getCopy());
|
||||
}
|
||||
|
||||
protected JComponent createTreePanel(final WatchDebuggerTree tree) {
|
||||
return ScrollPaneFactory.createScrollPane(tree);
|
||||
}
|
||||
|
||||
protected DebuggerTree createTreeView() {
|
||||
return new WatchDebuggerTree(getProject());
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ import com.intellij.psi.xml.XmlDocument;
|
||||
import com.intellij.psi.xml.XmlFile;
|
||||
import com.intellij.psi.xml.XmlTag;
|
||||
import com.intellij.util.*;
|
||||
import com.intellij.util.containers.ConcurrentWeakHashMap;
|
||||
import com.intellij.util.containers.ConcurrentWeakValueHashMap;
|
||||
import com.intellij.util.messages.MessageBusConnection;
|
||||
import com.intellij.util.ui.OptionsMessageDialog;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -78,18 +78,19 @@ import java.awt.event.ActionEvent;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
public class ExternalAnnotationsManagerImpl extends ExternalAnnotationsManager {
|
||||
public static final Icon ICON = IconLoader.getIcon("/modules/annotation.png");
|
||||
@NotNull public static final Icon ICON = IconLoader.getIcon("/modules/annotation.png");
|
||||
private static final Logger LOG = Logger.getInstance("#" + ExternalAnnotationsManagerImpl.class.getName());
|
||||
|
||||
private final Map<String, List<XmlFile>> myExternalAnnotations = new ConcurrentWeakHashMap<String, List<XmlFile>>();
|
||||
private final AtomicReference<ThreeState> myHasAnyAnnotationsRoots = new AtomicReference<ThreeState>(ThreeState.UNSURE);
|
||||
private static final List<XmlFile> NULL = new ArrayList<XmlFile>();
|
||||
@NotNull private final ConcurrentMap<String, List<XmlFile>> myExternalAnnotations = new ConcurrentWeakValueHashMap<String, List<XmlFile>>();
|
||||
@NotNull private final AtomicReference<ThreeState> myHasAnyAnnotationsRoots = new AtomicReference<ThreeState>(ThreeState.UNSURE);
|
||||
@NotNull private static final List<XmlFile> NULL = new ArrayList<XmlFile>();
|
||||
private final PsiManager myPsiManager;
|
||||
|
||||
public ExternalAnnotationsManagerImpl(final Project project, final PsiManager psiManager) {
|
||||
public ExternalAnnotationsManagerImpl(@NotNull final Project project, final PsiManager psiManager) {
|
||||
myPsiManager = psiManager;
|
||||
final MessageBusConnection connection = project.getMessageBus().connect(project);
|
||||
connection.subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootListener() {
|
||||
@@ -132,7 +133,7 @@ public class ExternalAnnotationsManagerImpl extends ExternalAnnotationsManager {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private Map<String, PsiAnnotation> collectExternalAnnotations(final PsiModifierListOwner listOwner) {
|
||||
private Map<String, PsiAnnotation> collectExternalAnnotations(@NotNull final PsiModifierListOwner listOwner) {
|
||||
if (hasAnyAnnotationsRoots() == ThreeState.NO) return Collections.emptyMap();
|
||||
final Map<String, PsiAnnotation> result = new HashMap<String, PsiAnnotation>();
|
||||
final List<XmlFile> files = findExternalAnnotationsFile(listOwner);
|
||||
@@ -179,6 +180,7 @@ public class ExternalAnnotationsManagerImpl extends ExternalAnnotationsManager {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static String getExternalName(PsiModifierListOwner listOwner, boolean showParamName) {
|
||||
return PsiFormatUtil.getExternalName(listOwner, showParamName, Integer.MAX_VALUE);
|
||||
}
|
||||
@@ -222,9 +224,14 @@ public class ExternalAnnotationsManagerImpl extends ExternalAnnotationsManager {
|
||||
}
|
||||
}
|
||||
|
||||
private void setupRootAndAnnotateExternally(final OrderEntry entry, final Project project, final PsiModifierListOwner listOwner,
|
||||
final String annotationFQName,
|
||||
final PsiFile fromFile, final String packageName, final VirtualFile virtualFile, final PsiNameValuePair[] value) {
|
||||
private void setupRootAndAnnotateExternally(@NotNull final OrderEntry entry,
|
||||
@NotNull Project project,
|
||||
@NotNull final PsiModifierListOwner listOwner,
|
||||
@NotNull final String annotationFQName,
|
||||
@NotNull final PsiFile fromFile,
|
||||
@NotNull final String packageName,
|
||||
@NotNull final VirtualFile virtualFile,
|
||||
final PsiNameValuePair[] value) {
|
||||
final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
|
||||
descriptor.setTitle(ProjectBundle.message("external.annotations.root.chooser.title", entry.getPresentableName()));
|
||||
descriptor.setDescription(ProjectBundle.message("external.annotations.root.chooser.description"));
|
||||
@@ -245,7 +252,10 @@ public class ExternalAnnotationsManagerImpl extends ExternalAnnotationsManager {
|
||||
if (annotationsXml != null) {
|
||||
final List<XmlFile> createdFiles = new ArrayList<XmlFile>();
|
||||
createdFiles.add(annotationsXml);
|
||||
myExternalAnnotations.put(getFQN(packageName, virtualFile), createdFiles);
|
||||
String fqn = getFQN(packageName, virtualFile);
|
||||
if (fqn != null) {
|
||||
myExternalAnnotations.put(fqn, createdFiles);
|
||||
}
|
||||
}
|
||||
annotateExternally(listOwner, annotationFQName, annotationsXml, fromFile, value);
|
||||
}
|
||||
@@ -253,20 +263,25 @@ public class ExternalAnnotationsManagerImpl extends ExternalAnnotationsManager {
|
||||
}.execute();
|
||||
}
|
||||
|
||||
private void chooseRootAndAnnotateExternally(final PsiModifierListOwner listOwner, final String annotationFQName, @NotNull final PsiFile fromFile,
|
||||
final Project project, final String packageName, final VirtualFile virtualFile,
|
||||
final VirtualFile[] virtualFiles, final PsiNameValuePair[] value) {
|
||||
private void chooseRootAndAnnotateExternally(@NotNull final PsiModifierListOwner listOwner,
|
||||
@NotNull final String annotationFQName,
|
||||
@NotNull final PsiFile fromFile,
|
||||
@NotNull final Project project,
|
||||
@NotNull final String packageName,
|
||||
final VirtualFile virtualFile,
|
||||
@NotNull VirtualFile[] virtualFiles,
|
||||
final PsiNameValuePair[] value) {
|
||||
if (virtualFiles.length > 1) {
|
||||
JBPopupFactory.getInstance().createListPopup(new BaseListPopupStep<VirtualFile>("Annotation Roots", virtualFiles) {
|
||||
@Override
|
||||
public PopupStep onChosen(final VirtualFile file, final boolean finalChoice) {
|
||||
public PopupStep onChosen(@NotNull final VirtualFile file, final boolean finalChoice) {
|
||||
annotateExternally(file, listOwner, project, packageName, virtualFile, annotationFQName, fromFile, value);
|
||||
return FINAL_CHOICE;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getTextFor(final VirtualFile value) {
|
||||
public String getTextFor(@NotNull final VirtualFile value) {
|
||||
return value.getPresentableUrl();
|
||||
}
|
||||
|
||||
@@ -292,8 +307,8 @@ public class ExternalAnnotationsManagerImpl extends ExternalAnnotationsManager {
|
||||
return VfsUtil.toVirtualFileArray(result);
|
||||
}
|
||||
|
||||
private void annotateExternally(final VirtualFile file, final PsiModifierListOwner listOwner, final Project project,
|
||||
final String packageName,
|
||||
private void annotateExternally(@NotNull final VirtualFile file, @NotNull final PsiModifierListOwner listOwner, final Project project,
|
||||
@NotNull final String packageName,
|
||||
final VirtualFile virtualFile,
|
||||
final String annotationFQName,
|
||||
@NotNull final PsiFile fromFile,
|
||||
@@ -371,6 +386,7 @@ public class ExternalAnnotationsManagerImpl extends ExternalAnnotationsManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public AnnotationPlace chooseAnnotationsPlace(@NotNull final PsiElement element) {
|
||||
if (!element.isPhysical()) return AnnotationPlace.IN_CODE; //element just created
|
||||
if (!element.getManager().isInProject(element)) return AnnotationPlace.EXTERNAL;
|
||||
@@ -432,7 +448,7 @@ public class ExternalAnnotationsManagerImpl extends ExternalAnnotationsManager {
|
||||
return AnnotationPlace.IN_CODE;
|
||||
}
|
||||
|
||||
private void appendChosenAnnotationsRoot(final OrderEntry entry, final VirtualFile vFile) {
|
||||
private void appendChosenAnnotationsRoot(@NotNull final OrderEntry entry, @NotNull final VirtualFile vFile) {
|
||||
if (entry instanceof LibraryOrderEntry) {
|
||||
Library library = ((LibraryOrderEntry)entry).getLibrary();
|
||||
LOG.assertTrue(library != null);
|
||||
@@ -459,7 +475,8 @@ public class ExternalAnnotationsManagerImpl extends ExternalAnnotationsManager {
|
||||
private static void annotateExternally(final PsiModifierListOwner listOwner,
|
||||
final String annotationFQName,
|
||||
@Nullable final XmlFile xmlFile,
|
||||
@NotNull PsiFile codeUsageFile, PsiNameValuePair[] values) {
|
||||
@NotNull PsiFile codeUsageFile,
|
||||
PsiNameValuePair[] values) {
|
||||
if (xmlFile == null) return;
|
||||
try {
|
||||
final XmlDocument document = xmlFile.getDocument();
|
||||
@@ -498,13 +515,14 @@ public class ExternalAnnotationsManagerImpl extends ExternalAnnotationsManager {
|
||||
}
|
||||
|
||||
@NonNls
|
||||
private static String createAnnotationTag(String annotationFQName, PsiNameValuePair[] values) {
|
||||
private static String createAnnotationTag(String annotationFQName, @Nullable PsiNameValuePair[] values) {
|
||||
@NonNls String text;
|
||||
if (values != null) {
|
||||
text = " <annotation name=\'" + annotationFQName + "\'>\n";
|
||||
text += StringUtil.join(values, new Function<PsiNameValuePair, String>() {
|
||||
@NotNull
|
||||
@Override
|
||||
public String fun(PsiNameValuePair pair) {
|
||||
public String fun(@NotNull PsiNameValuePair pair) {
|
||||
if (pair.getName() != null) {
|
||||
return "<val name=\"" + pair.getName() + "\" val=\"" + StringUtil.escapeXml(pair.getValue().getText()) + "\"/>";
|
||||
}
|
||||
@@ -520,7 +538,7 @@ public class ExternalAnnotationsManagerImpl extends ExternalAnnotationsManager {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private XmlFile createAnnotationsXml(VirtualFile root, @NonNls @NotNull String packageName) {
|
||||
private XmlFile createAnnotationsXml(@NotNull VirtualFile root, @NonNls @NotNull String packageName) {
|
||||
final String[] dirs = packageName.split("[\\.]");
|
||||
for (String dir : dirs) {
|
||||
if (dir.isEmpty()) break;
|
||||
@@ -564,6 +582,7 @@ public class ExternalAnnotationsManagerImpl extends ExternalAnnotationsManager {
|
||||
final String packageName = javaFile.getPackageName();
|
||||
final VirtualFile virtualFile = containingFile.getVirtualFile();
|
||||
String fqn = getFQN(packageName, virtualFile);
|
||||
if (fqn == null) return null;
|
||||
final List<XmlFile> files = myExternalAnnotations.get(fqn);
|
||||
if (files == NULL) return null;
|
||||
if (files != null) {
|
||||
@@ -611,7 +630,7 @@ public class ExternalAnnotationsManagerImpl extends ExternalAnnotationsManager {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static String getNormalizedExternalName(PsiModifierListOwner owner) {
|
||||
private static String getNormalizedExternalName(@NotNull PsiModifierListOwner owner) {
|
||||
String externalName = getExternalName(owner, true);
|
||||
if (externalName != null) {
|
||||
if (owner instanceof PsiParameter && owner.getParent() instanceof PsiParameterList) {
|
||||
@@ -657,10 +676,12 @@ public class ExternalAnnotationsManagerImpl extends ExternalAnnotationsManager {
|
||||
return ADD_IN_CODE;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected String getCancelActionName() {
|
||||
return CommonBundle.getCancelButtonText();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@SuppressWarnings({"NonStaticInitializer"})
|
||||
protected Action[] createActions() {
|
||||
final Action okAction = getOKAction();
|
||||
|
||||
@@ -27,7 +27,7 @@ import com.intellij.refactoring.rename.PsiElementRenameHandler;
|
||||
* @author ven
|
||||
*/
|
||||
public class RenameFileAction extends AnAction implements DumbAware {
|
||||
public static final String RENAME_FILE = "Rename File";
|
||||
public static final String RENAME_FILE = "Rename File...";
|
||||
|
||||
public void actionPerformed(final AnActionEvent e) {
|
||||
final PsiFile file = e.getData(LangDataKeys.PSI_FILE);
|
||||
@@ -47,7 +47,7 @@ public class RenameFileAction extends AnAction implements DumbAware {
|
||||
presentation.setVisible(enabled);
|
||||
if (enabled) {
|
||||
presentation.setText(RENAME_FILE);
|
||||
presentation.setDescription(RENAME_FILE);
|
||||
presentation.setDescription("Rename selected file");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package org.jetbrains.ether;
|
||||
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
import com.intellij.openapi.application.ex.PathManagerEx;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
@@ -31,7 +30,6 @@ import org.jetbrains.jps.Sdk;
|
||||
import org.jetbrains.jps.api.CanceledStatus;
|
||||
import org.jetbrains.jps.idea.IdeaProjectLoader;
|
||||
import org.jetbrains.jps.incremental.*;
|
||||
import org.jetbrains.jps.incremental.java.JavaBuilder;
|
||||
import org.jetbrains.jps.incremental.storage.BuildDataManager;
|
||||
import org.jetbrains.jps.incremental.storage.ProjectTimestamps;
|
||||
import org.jetbrains.jps.server.ClasspathBootstrap;
|
||||
@@ -154,8 +152,12 @@ public abstract class IncrementalTestCase extends TestCase {
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
super.tearDown();
|
||||
delete(new File(workDir));
|
||||
try {
|
||||
super.tearDown();
|
||||
}
|
||||
finally {
|
||||
delete(new File(workDir));
|
||||
}
|
||||
}
|
||||
|
||||
private String getProjectName() {
|
||||
@@ -199,7 +201,7 @@ public abstract class IncrementalTestCase extends TestCase {
|
||||
|
||||
if (files != null) {
|
||||
for (File f : files) {
|
||||
copy(f, new File(output.getPath() + File.separator + f.getName()));
|
||||
copy(f, new File(output.getPath(), f.getName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -208,16 +210,26 @@ public abstract class IncrementalTestCase extends TestCase {
|
||||
}
|
||||
}
|
||||
else if (input.isFile()) {
|
||||
final FileReader in = new FileReader(input);
|
||||
final FileWriter out = new FileWriter(output);
|
||||
FileReader in = null;
|
||||
FileWriter out = null;
|
||||
|
||||
try {
|
||||
in = new FileReader(input);
|
||||
out = new FileWriter(output);
|
||||
int c;
|
||||
while ((c = in.read()) != -1) out.write(c);
|
||||
}
|
||||
finally {
|
||||
in.close();
|
||||
out.close();
|
||||
try {
|
||||
if (in != null) {
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
finally {
|
||||
if (out != null) {
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -241,7 +253,7 @@ public abstract class IncrementalTestCase extends TestCase {
|
||||
final String basename = pathSep == -1 ? postfix : postfix.substring(pathSep + 1);
|
||||
final String path =
|
||||
getWorkDir() + File.separator + (pathSep == -1 ? "src" : postfix.substring(0, pathSep).replace('-', File.separatorChar));
|
||||
final File output = new File(path + File.separator + basename);
|
||||
final File output = new File(path, basename);
|
||||
|
||||
if (copy) {
|
||||
copy(input, output);
|
||||
@@ -275,7 +287,7 @@ public abstract class IncrementalTestCase extends TestCase {
|
||||
|
||||
final Sdk jdk = project.createSdk("JavaSDK", "IDEA jdk", System.getProperty("java.home"), null);
|
||||
final List<String> paths = new LinkedList<String>();
|
||||
|
||||
|
||||
paths.add(FileUtil.toSystemIndependentName(ClasspathBootstrap.getResourcePath(Object.class).getCanonicalPath()));
|
||||
|
||||
jdk.setClasspath(paths);
|
||||
@@ -285,20 +297,32 @@ public abstract class IncrementalTestCase extends TestCase {
|
||||
final ProjectDescriptor projectDescriptor =
|
||||
new ProjectDescriptor(projectPath, project, new FSState(true), new ProjectTimestamps(projectName),
|
||||
new BuildDataManager(projectName, true));
|
||||
final IncProjectBuilder builder = new IncProjectBuilder(projectDescriptor, BuilderRegistry.getInstance(), CanceledStatus.NULL);
|
||||
try {
|
||||
|
||||
builder.build(new AllProjectScope(project, true), false, true);
|
||||
new IncProjectBuilder(
|
||||
projectDescriptor, BuilderRegistry.getInstance(), CanceledStatus.NULL
|
||||
).build(
|
||||
new AllProjectScope(project, true), false, true
|
||||
);
|
||||
|
||||
modify();
|
||||
modify();
|
||||
|
||||
if (SystemInfo.isUnix) {
|
||||
Thread.sleep(1000);
|
||||
if (SystemInfo.isUnix) {
|
||||
Thread.sleep(1000L);
|
||||
}
|
||||
|
||||
new IncProjectBuilder(
|
||||
projectDescriptor, BuilderRegistry.getInstance(), CanceledStatus.NULL
|
||||
).build(
|
||||
new AllProjectScope(project, false), true, false
|
||||
);
|
||||
|
||||
FileAssert.assertEquals(new File(getBaseDir() + ".log"), new File(getWorkDir() + ".log"));
|
||||
}
|
||||
finally {
|
||||
projectDescriptor.release();
|
||||
}
|
||||
|
||||
builder.build(new AllProjectScope(project, false), true, false);
|
||||
|
||||
projectDescriptor.release();
|
||||
|
||||
FileAssert.assertEquals(new File(getBaseDir() + ".log"), new File(getWorkDir() + ".log"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,16 +81,14 @@ public class StubBasedPsiElementBase<T extends StubElement> extends ASTDelegateP
|
||||
final FileElement fileElement = file.loadTreeElement();
|
||||
node = myNode;
|
||||
if (node == null) {
|
||||
String message = new StringBuilder().
|
||||
append("Failed to bind stub to AST for element ").
|
||||
append(getClass()).
|
||||
append(" in ").
|
||||
append(file.getVirtualFile() == null ? "<unknown file>" : file.getVirtualFile().getPath()).
|
||||
append("\nFile stub tree:\n").
|
||||
append(stubTree != null ? StringUtil.trimLog(((PsiFileStubImpl)stubTree.getRoot()).printTree(), 1024) : " is null").
|
||||
append("\nLoaded file AST:\n").
|
||||
append(StringUtil.trimLog(DebugUtil.treeToString(fileElement, true), 1024)).
|
||||
toString();
|
||||
String message = "Failed to bind stub to AST for element " +
|
||||
getClass() +
|
||||
" in " +
|
||||
(file.getVirtualFile() == null ? "<unknown file>" : file.getVirtualFile().getPath()) +
|
||||
"\nFile stub tree:\n" +
|
||||
(stubTree != null ? StringUtil.trimLog(((PsiFileStubImpl)stubTree.getRoot()).printTree(), 1024) : " is null") +
|
||||
"\nLoaded file AST:\n" +
|
||||
StringUtil.trimLog(DebugUtil.treeToString(fileElement, true), 1024);
|
||||
throw new IllegalArgumentException(message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,30 +25,40 @@ import java.util.Map;
|
||||
* @author yole
|
||||
*/
|
||||
public class CoreJarHandler extends JarHandlerBase {
|
||||
private final Map<String, VirtualFile> myFileMap = new HashMap<String, VirtualFile>();
|
||||
|
||||
private final CoreJarFileSystem myFileSystem;
|
||||
private final VirtualFile myRoot;
|
||||
|
||||
public CoreJarHandler(CoreJarFileSystem fileSystem, String path) {
|
||||
super(path);
|
||||
myFileSystem = fileSystem;
|
||||
|
||||
Map<EntryInfo, CoreJarVirtualFile> entries = new HashMap<EntryInfo, CoreJarVirtualFile>();
|
||||
|
||||
for (EntryInfo info : getEntriesMap().values()) {
|
||||
getOrCreateFile(info, entries);
|
||||
}
|
||||
|
||||
myRoot = getOrCreateFile(getEntryInfo(""), entries);
|
||||
}
|
||||
|
||||
private CoreJarVirtualFile getOrCreateFile(EntryInfo info, Map<EntryInfo, CoreJarVirtualFile> entries) {
|
||||
CoreJarVirtualFile answer = entries.get(info);
|
||||
if (answer == null) {
|
||||
EntryInfo parentEntry = info.parent;
|
||||
answer = new CoreJarVirtualFile(this, info, parentEntry != null ? getOrCreateFile(parentEntry, entries) : null);
|
||||
entries.put(info, answer);
|
||||
}
|
||||
|
||||
return answer;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public VirtualFile findFileByPath(String pathInJar) {
|
||||
if (getZip() == null) {
|
||||
return null;
|
||||
}
|
||||
VirtualFile file = myFileMap.get(pathInJar);
|
||||
if (file == null) {
|
||||
if (pathInJar.length() > 0) {
|
||||
EntryInfo entryInfo = getEntryInfo(pathInJar);
|
||||
if (entryInfo == null) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
file = new CoreJarVirtualFile(myFileSystem, this, pathInJar);
|
||||
myFileMap.put(pathInJar, file);
|
||||
}
|
||||
return file;
|
||||
return myRoot != null ? myRoot.findFileByRelativePath(pathInJar) : null;
|
||||
}
|
||||
|
||||
public CoreJarFileSystem getFileSystem() {
|
||||
return myFileSystem;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,44 +23,40 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
*/
|
||||
public class CoreJarVirtualFile extends VirtualFile {
|
||||
private final CoreJarFileSystem myFileSystem;
|
||||
private final CoreJarHandler myHandler;
|
||||
private final String myPathInJar;
|
||||
private final VirtualFile myParent;
|
||||
private VirtualFile[] myChildren;
|
||||
private final ArrayList<VirtualFile> myChildren = new ArrayList<VirtualFile>();
|
||||
private final JarHandlerBase.EntryInfo myEntry;
|
||||
|
||||
public CoreJarVirtualFile(CoreJarFileSystem fileSystem, CoreJarHandler handler, String pathInJar) {
|
||||
myFileSystem = fileSystem;
|
||||
public CoreJarVirtualFile(CoreJarHandler handler, JarHandlerBase.EntryInfo entry, CoreJarVirtualFile parent) {
|
||||
myHandler = handler;
|
||||
myPathInJar = pathInJar;
|
||||
myParent = calcParent();
|
||||
myParent = parent;
|
||||
myEntry = entry;
|
||||
|
||||
parent.myChildren.add(this);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getName() {
|
||||
final int lastSlash = myPathInJar.lastIndexOf('/');
|
||||
if (lastSlash < 0) {
|
||||
return myPathInJar;
|
||||
}
|
||||
return myPathInJar.substring(lastSlash+1);
|
||||
return myEntry.shortName;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public VirtualFileSystem getFileSystem() {
|
||||
return myFileSystem;
|
||||
return myHandler.getFileSystem();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPath() {
|
||||
return myHandler.myBasePath + "!/" + myPathInJar;
|
||||
if (myParent == null) return myHandler.myBasePath + "!/";
|
||||
return myParent.getPath() + "/" + myEntry.shortName;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -70,7 +66,7 @@ public class CoreJarVirtualFile extends VirtualFile {
|
||||
|
||||
@Override
|
||||
public boolean isDirectory() {
|
||||
return myHandler.isDirectory(this);
|
||||
return myEntry.isDirectory;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -83,35 +79,9 @@ public class CoreJarVirtualFile extends VirtualFile {
|
||||
return myParent;
|
||||
}
|
||||
|
||||
private VirtualFile calcParent() {
|
||||
if (myPathInJar.length() == 0) {
|
||||
return null;
|
||||
}
|
||||
int lastSlash = myPathInJar.lastIndexOf('/');
|
||||
if (lastSlash < 0) {
|
||||
return myHandler.findFileByPath("");
|
||||
}
|
||||
return myHandler.findFileByPath(myPathInJar.substring(0, lastSlash));
|
||||
}
|
||||
|
||||
@Override
|
||||
public VirtualFile[] getChildren() {
|
||||
VirtualFile[] answer = myChildren;
|
||||
if (answer == null) {
|
||||
answer = calcChildren();
|
||||
myChildren = answer;
|
||||
}
|
||||
return answer;
|
||||
}
|
||||
|
||||
private VirtualFile[] calcChildren() {
|
||||
List<VirtualFile> result = new ArrayList<VirtualFile>();
|
||||
final String[] children = myHandler.list(this);
|
||||
for (String child : children) {
|
||||
final VirtualFile childFile = myPathInJar.isEmpty() ? myHandler.findFileByPath(child) : myHandler.findFileByPath(myPathInJar + "/" + child);
|
||||
result.add(childFile);
|
||||
}
|
||||
return result.toArray(new VirtualFile[result.size()]);
|
||||
return myChildren.toArray(new VirtualFile[myChildren.size()]);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -39,11 +39,10 @@ import com.intellij.psi.impl.source.SourceTreeToPsiMap;
|
||||
import com.intellij.psi.impl.source.codeStyle.CodeEditUtil;
|
||||
import com.intellij.util.CharTable;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.HashMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ChangeUtil {
|
||||
@@ -119,7 +118,7 @@ public class ChangeUtil {
|
||||
return element;
|
||||
}
|
||||
|
||||
public static TreeElement copyElement(TreeElement original, CharTable table) {
|
||||
public static TreeElement copyElement(@NotNull TreeElement original, CharTable table) {
|
||||
CompositeElement treeParent = original.getTreeParent();
|
||||
return copyElement(original, treeParent == null ? null : treeParent.getPsi(), table);
|
||||
}
|
||||
|
||||
@@ -50,4 +50,6 @@ public interface LayoutViewOptions {
|
||||
|
||||
LayoutViewOptions setAdditionalFocusActions(ActionGroup group);
|
||||
|
||||
AnAction getSettingsActions();
|
||||
AnAction[] getSettingsActionsList();
|
||||
}
|
||||
@@ -32,7 +32,7 @@ public abstract class FacetManager implements FacetModel {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the interface for modifiyng set of facets in the module. Call {@link ModifiableFacetModel#commit()} when modification is finished
|
||||
* Creates the interface for modifying set of facets in the module. Call {@link ModifiableFacetModel#commit()} when modification is finished
|
||||
* @return the modifiable facet model
|
||||
*/
|
||||
@NotNull
|
||||
@@ -40,7 +40,7 @@ public abstract class FacetManager implements FacetModel {
|
||||
|
||||
@NotNull
|
||||
public abstract <F extends Facet, C extends FacetConfiguration> F createFacet(@NotNull FacetType<F, C> type, @NotNull String name,
|
||||
@NotNull C cofiguration, @Nullable Facet underlying);
|
||||
@NotNull C configuration, @Nullable Facet underlying);
|
||||
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -83,12 +83,12 @@ public class ProjectUtil {
|
||||
final OrderEntry libraryEntry = LibraryUtil.findLibraryEntry(file, project);
|
||||
if (libraryEntry != null) {
|
||||
if (libraryEntry instanceof JdkOrderEntry) {
|
||||
url = new StringBuilder(url).append(" - [").append(((JdkOrderEntry)libraryEntry).getJdkName()).append("]").toString();
|
||||
url = url + " - [" + ((JdkOrderEntry)libraryEntry).getJdkName() + "]";
|
||||
} else {
|
||||
url = new StringBuilder(url).append(" - [").append(libraryEntry.getPresentableName()).append("]").toString();
|
||||
url = url + " - [" + libraryEntry.getPresentableName() + "]";
|
||||
}
|
||||
} else {
|
||||
url = new StringBuilder(url).append(" - [").append(fileForJar.getName()).append("]").toString();
|
||||
url = url + " - [" + fileForJar.getName() + "]";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -96,8 +96,8 @@ public class ProjectUtil {
|
||||
final Module module = ModuleUtil.findModuleForFile(file, project);
|
||||
if (module == null) return url;
|
||||
return !keepModuleAlwaysOnTheLeft && SystemInfo.isMac ?
|
||||
new StringBuffer().append(url).append(" - [").append(module.getName()).append("]").toString() :
|
||||
new StringBuffer().append("[").append(module.getName()).append("] - ").append(url).toString();
|
||||
url + " - [" + module.getName() + "]" :
|
||||
"[" + module.getName() + "] - " + url;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -69,6 +69,7 @@ public class RunnerContentUi implements ContentUI, Disposable, CellTransform.Fac
|
||||
QuickActionProvider, DockContainer.Dialog {
|
||||
|
||||
@NonNls public static final String LAYOUT = "Runner.Layout";
|
||||
@NonNls public static final String SETTINGS = "XDebugger.Settings";
|
||||
@NonNls public static final String VIEW_POPUP = "Runner.View.Popup";
|
||||
@NonNls public static final String VIEW_TOOLBAR = "Runner.View.Toolbar";
|
||||
|
||||
@@ -690,6 +691,10 @@ public class RunnerContentUi implements ContentUI, Disposable, CellTransform.Fac
|
||||
}
|
||||
}
|
||||
|
||||
public ActionGroup getSettingsActions() {
|
||||
return (ActionGroup)myActionManager.getAction(SETTINGS);
|
||||
}
|
||||
|
||||
private static void moveFollowingTabs(int index, final JBRunnerTabs tabs) {
|
||||
for (TabInfo info : tabs.getTabs()) {
|
||||
final TabImpl tab = getTabFor(info);
|
||||
|
||||
@@ -293,6 +293,16 @@ public class RunnerLayoutUiImpl implements Disposable, RunnerLayoutUi, LayoutSta
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnAction getSettingsActions() {
|
||||
return myContentUI.getSettingsActions();
|
||||
}
|
||||
|
||||
public AnAction[] getSettingsActionsList() {
|
||||
final ActionGroup group = (ActionGroup)getSettingsActions();
|
||||
return group.getChildren(null);
|
||||
}
|
||||
|
||||
public Content[] getContents() {
|
||||
Content[] contents = new Content[getContentManager().getContentCount()];
|
||||
for (int i = 0; i < contents.length; i++) {
|
||||
|
||||
@@ -67,12 +67,6 @@ public class StubPath {
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return new StringBuilder().
|
||||
append(myParentPath != null ? myParentPath.toString() : "").
|
||||
append("::(").
|
||||
append(myType.toString()).
|
||||
append(":").
|
||||
append(myId).
|
||||
append(")").toString();
|
||||
return (myParentPath != null ? myParentPath.toString() : "") + "::(" + myType.toString() + ":" + myId + ")";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -272,11 +272,6 @@ public class DimensionService implements PersistentStateComponent<Element>, Appl
|
||||
final Point topLeft = frame.getLocation();
|
||||
Point center = new Point(topLeft.x + frame.getWidth() / 2, topLeft.y + frame.getHeight() / 2);
|
||||
final Rectangle frameScreen = ScreenUtil.getScreenRectangle(center);
|
||||
return new StringBuffer(key)
|
||||
.append('.').append(frameScreen.x)
|
||||
.append('.').append(frameScreen.y)
|
||||
.append('.').append(frameScreen.width)
|
||||
.append('.').append(frameScreen.height)
|
||||
.toString();
|
||||
return key + '.' + frameScreen.x + '.' + frameScreen.y + '.' + frameScreen.width + '.' + frameScreen.height;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -481,7 +481,7 @@ public class UiInspectorAction extends ToggleAction implements DumbAware {
|
||||
g2d.fillRect(insets.left, insets.top, bounds.width - insets.left - insets.right, bounds.height - insets.top - insets.bottom);
|
||||
g2d.setColor(getForeground());
|
||||
|
||||
final String sizeString = new StringBuilder().append(myWidth).append(" x ").append(myHeight).toString();
|
||||
final String sizeString = String.valueOf(myWidth) + " x " + myHeight;
|
||||
|
||||
FontMetrics fm = g2d.getFontMetrics();
|
||||
int sizeWidth = fm.stringWidth(sizeString);
|
||||
@@ -595,46 +595,42 @@ public class UiInspectorAction extends ToggleAction implements DumbAware {
|
||||
|
||||
private static class PointRenderer extends JLabel implements Renderer<Point> {
|
||||
public JComponent setValue(@NotNull final Point value) {
|
||||
setText(new StringBuilder().append(value.x).append(':').append(value.y).toString());
|
||||
setText(String.valueOf(value.x) + ':' + value.y);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
private static class DimensionRenderer extends JLabel implements Renderer<Dimension> {
|
||||
public JComponent setValue(@NotNull final Dimension value) {
|
||||
setText(new StringBuilder().append(value.width).append(" x ").append(value.height).toString());
|
||||
setText(String.valueOf(value.width) + " x " + value.height);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
private static class InsetsRenderer extends JLabel implements Renderer<Insets> {
|
||||
public JComponent setValue(@NotNull final Insets value) {
|
||||
setText(new StringBuilder("top: ").append(value.top).append(" left:").append(value.left).append(" bottom:").append(value.bottom)
|
||||
.append(" right:").append(value.right).toString());
|
||||
setText("top: " + value.top + " left:" + value.left + " bottom:" + value.bottom + " right:" + value.right);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
private static class RectangleRenderer extends JLabel implements Renderer<Rectangle> {
|
||||
public JComponent setValue(@NotNull final Rectangle value) {
|
||||
setText(new StringBuilder().append(value.x).append(":").append(value.y).append(", ").append(value.width)
|
||||
.append(" x ").append(value.height).toString());
|
||||
setText(String.valueOf(value.x) + ":" + value.y + ", " + value.width + " x " + value.height);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
private static class ColorRenderer extends JLabel implements Renderer<Color> {
|
||||
public JComponent setValue(@NotNull final Color value) {
|
||||
setText(new StringBuilder("r:").append(value.getRed()).append(", g:").append(value.getGreen()).append(", b:").append(value.getBlue())
|
||||
.toString());
|
||||
setText("r:" + value.getRed() + ", g:" + value.getGreen() + ", b:" + value.getBlue());
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
private static class FontRenderer extends JLabel implements Renderer<Font> {
|
||||
public JComponent setValue(@NotNull final Font value) {
|
||||
setText(new StringBuilder(value.getFontName()).append(" (").append(value.getFamily()).append("), ").append(value.getSize()).
|
||||
append("px").toString());
|
||||
setText(value.getFontName() + " (" + value.getFamily() + "), " + value.getSize() + "px");
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
+9
@@ -106,6 +106,7 @@ public class ActionToolbarImpl extends JPanel implements ActionToolbar {
|
||||
|
||||
private JComponent myTargetComponent;
|
||||
private boolean myReservePlaceAutoPopupIcon = true;
|
||||
private boolean myAddSeparatorFirst;
|
||||
|
||||
private WeakTimerListener myWeakTimerListener;
|
||||
@SuppressWarnings({"FieldCanBeLocal"}) private ActionToolbarImpl.MyTimerListener myTimerListener;
|
||||
@@ -215,6 +216,9 @@ public class ActionToolbarImpl extends JPanel implements ActionToolbar {
|
||||
}
|
||||
|
||||
private void fillToolBar(final List<AnAction> actions, boolean layoutSecondaries) {
|
||||
if (myAddSeparatorFirst) {
|
||||
add(new MySeparator());
|
||||
}
|
||||
for (int i = 0; i < actions.size(); i++) {
|
||||
final AnAction action = actions.get(i);
|
||||
if (action instanceof Separator && isNavBar()) {
|
||||
@@ -1196,4 +1200,9 @@ public class ActionToolbarImpl extends JPanel implements ActionToolbar {
|
||||
|
||||
updateActions(false, false, true);
|
||||
}
|
||||
|
||||
public void setAddSeparatorFirst(boolean addSeparatorFirst) {
|
||||
myAddSeparatorFirst = addSeparatorFirst;
|
||||
updateActions(false, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
+10
-10
@@ -184,13 +184,13 @@ public class StorageUtil {
|
||||
final int ndx = fileText.indexOf('\n');
|
||||
return Pair.create(fileText, ndx == -1
|
||||
? SystemProperties.getLineSeparator()
|
||||
: (ndx - 1 >=0 ? (fileText.charAt(ndx - 1) == '\r' ? "\r\n" : "\n") : "\n"));
|
||||
: ndx - 1 >=0 ? fileText.charAt(ndx - 1) == '\r' ? "\r\n" : "\n" : "\n");
|
||||
}
|
||||
|
||||
public static boolean contentEquals(@NotNull final Document document, @NotNull final IFile file) {
|
||||
try {
|
||||
final Pair<String, String> pair = loadFile(file);
|
||||
return pair.first == null ? false : pair.first.equals(printDocumentToString(document, pair.second));
|
||||
return pair.first != null && pair.first.equals(printDocumentToString(document, pair.second));
|
||||
}
|
||||
catch (IOException e) {
|
||||
LOG.debug(e);
|
||||
@@ -201,7 +201,7 @@ public class StorageUtil {
|
||||
public static boolean contentEquals(@NotNull final Element element, @NotNull final IFile file) {
|
||||
try {
|
||||
final Pair<String, String> pair = loadFile(file);
|
||||
return pair.first == null ? false : pair.first.equals(printElement(element, pair.second));
|
||||
return pair.first != null && pair.first.equals(printElement(element, pair.second));
|
||||
}
|
||||
catch (IOException e) {
|
||||
LOG.debug(e);
|
||||
@@ -264,7 +264,7 @@ public class StorageUtil {
|
||||
@Nullable
|
||||
public static Document loadDocument(final byte[] bytes) {
|
||||
try {
|
||||
return (bytes == null || bytes.length == 0) ? null : JDOMUtil.loadDocument(new ByteArrayInputStream(bytes));
|
||||
return bytes == null || bytes.length == 0 ? null : JDOMUtil.loadDocument(new ByteArrayInputStream(bytes));
|
||||
}
|
||||
catch (JDOMException e) {
|
||||
return null;
|
||||
@@ -313,7 +313,6 @@ public class StorageUtil {
|
||||
}
|
||||
|
||||
public static void logStateDiffInfo(Set<Pair<VirtualFile, StateStorage>> changedFiles, Set<String> componentNames) throws IOException {
|
||||
|
||||
if (!ApplicationManagerEx.getApplicationEx().isInternal() && !ourDumpChangedComponentStates) return;
|
||||
|
||||
try {
|
||||
@@ -324,7 +323,7 @@ public class StorageUtil {
|
||||
for (String componentName : componentNames) {
|
||||
for (Pair<VirtualFile, StateStorage> pair : changedFiles) {
|
||||
StateStorage storage = pair.second;
|
||||
if ((storage instanceof XmlElementStorage)) {
|
||||
if (storage instanceof XmlElementStorage) {
|
||||
Element state = ((XmlElementStorage)storage).getState(componentName);
|
||||
if (state != null) {
|
||||
File logFile = new File(logDirectory, "prev_" + componentName + ".xml");
|
||||
@@ -332,13 +331,14 @@ public class StorageUtil {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (Pair<VirtualFile, StateStorage> changedFile : changedFiles) {
|
||||
File logFile = new File(logDirectory, "new_" + changedFile.first.getName());
|
||||
|
||||
FileUtil.copy(new File(changedFile.first.getPath()), logFile);
|
||||
File in = new File(changedFile.first.getPath());
|
||||
if (in.exists()) {
|
||||
File logFile = new File(logDirectory, "new_" + changedFile.first.getName());
|
||||
FileUtil.copy(in, logFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Throwable e) {
|
||||
|
||||
@@ -164,7 +164,6 @@ public class ProgressWindow extends BlockingProgressIndicator implements Disposa
|
||||
final DialogWrapper popup = myDialog.myPopup;
|
||||
if (popup != null) {
|
||||
myFocusTrackback.registerFocusComponent(new FocusTrackback.ComponentQuery() {
|
||||
@SuppressWarnings({"ConstantConditions"})
|
||||
public Component getComponent() {
|
||||
return popup.getPreferredFocusedComponent();
|
||||
}
|
||||
@@ -250,7 +249,7 @@ public class ProgressWindow extends BlockingProgressIndicator implements Disposa
|
||||
if (isDialogShowing()) {
|
||||
if (myFocusTrackback != null) {
|
||||
myFocusTrackback.setWillBeSheduledForRestore();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UIUtil.invokeLaterIfNeeded(new Runnable() {
|
||||
@@ -260,11 +259,12 @@ public class ProgressWindow extends BlockingProgressIndicator implements Disposa
|
||||
if (myDialog != null) {
|
||||
myDialog.hide();
|
||||
}
|
||||
|
||||
|
||||
if (myFocusTrackback != null) {
|
||||
if (wasShowing) {
|
||||
myFocusTrackback.restoreFocus();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
myFocusTrackback.consume();
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -64,7 +64,7 @@ import java.util.*;
|
||||
* @author max
|
||||
*/
|
||||
public class VirtualDirectoryImpl extends VirtualFileSystemEntry {
|
||||
private static final boolean ALT_SYMLINK_HANDLING = "true".equals(System.getProperty("idea.io.alt.symlink"));
|
||||
private static final boolean ALT_SYMLINK_HANDLING = "true".equalsIgnoreCase(System.getProperty("idea.io.alt.symlink"));
|
||||
|
||||
private static final VirtualFileSystemEntry NULL_VIRTUAL_FILE = new VirtualFileImpl("*?;%NULL", null, -42) {
|
||||
public String toString() {
|
||||
|
||||
@@ -671,7 +671,7 @@
|
||||
<reference ref="StepOut"/>
|
||||
<reference ref="RunToCursor"/>
|
||||
<separator/>
|
||||
<reference ref="XDebugger.ToggleSortValues"/>
|
||||
<reference ref="EvaluateExpression" />
|
||||
</group>
|
||||
|
||||
<group id="XDebugger.ToolWindow.LeftToolbar">
|
||||
@@ -726,12 +726,15 @@
|
||||
<reference ref="XDebugger.AddToWatches"/>
|
||||
</group>
|
||||
|
||||
<group id="RunnerLayoutActions">
|
||||
<group id="Runner.Layout" icon="/debugger/restoreLayout.png" popup="true">
|
||||
<action id="Runner.RestoreLayout" class="com.intellij.execution.ui.layout.actions.RestoreLayoutAction"/>
|
||||
<action id="Runner.ToggleToolbarLayout" class="com.intellij.execution.ui.layout.actions.ToggleToolbarLayoutAction"/>
|
||||
</group>
|
||||
<group id="XDebugger.Settings" icon="/general/secondaryGroup.png" popup="true">
|
||||
|
||||
</group>
|
||||
|
||||
<group id="RunnerLayoutActions">
|
||||
<group id="Runner.Layout">
|
||||
<action id="Runner.RestoreLayout" class="com.intellij.execution.ui.layout.actions.RestoreLayoutAction"
|
||||
icon="/debugger/restoreLayout.png"/>
|
||||
</group>
|
||||
|
||||
<group id="Runner.View.Popup">
|
||||
<action id="Runner.MinimizeView" class="com.intellij.execution.ui.layout.actions.MinimizeViewAction" icon="/actions/minimize.png"/>
|
||||
|
||||
+24
-4
@@ -55,6 +55,24 @@ public class SymLinkHandlingTest extends LightPlatformLangTestCase {
|
||||
final File selfLinkFile = createTempLink("self_link", "self_link");
|
||||
final VirtualFile selfLinkVFile = refreshAndFind(selfLinkFile);
|
||||
assertNull(selfLinkVFile);
|
||||
|
||||
final File pointLinkFile = createTempLink(".", "point_link");
|
||||
final VirtualFile pointLinkVFile = refreshAndFind(pointLinkFile);
|
||||
assertNotNull(pointLinkVFile);
|
||||
assertEquals(0, pointLinkVFile.getChildren().length);
|
||||
|
||||
final File circularDir1 = FileUtil.createTempDirectory("dir1.", null);
|
||||
final File circularDir2 = FileUtil.createTempDirectory("dir2.", null);
|
||||
final File circularLink1 = createTempLink(circularDir2.getAbsolutePath(), circularDir1 + File.separator + "link");
|
||||
final File circularLink2 = createTempLink(circularDir1.getAbsolutePath(), circularDir2 + File.separator + "link");
|
||||
final VirtualFile circularLink1VFile = refreshAndFind(circularLink1);
|
||||
final VirtualFile circularLink2VFile = refreshAndFind(circularLink2);
|
||||
assertNotNull(circularLink1VFile);
|
||||
assertNotNull(circularLink2VFile);
|
||||
assertEquals(1, circularLink1VFile.getChildren().length);
|
||||
assertEquals(1, circularLink2VFile.getChildren().length);
|
||||
assertEquals(0, circularLink1VFile.getChildren()[0].getChildren().length);
|
||||
assertEquals(0, circularLink2VFile.getChildren()[0].getChildren().length);
|
||||
}
|
||||
|
||||
public void testTargetIsWritable() throws Exception {
|
||||
@@ -171,7 +189,9 @@ public class SymLinkHandlingTest extends LightPlatformLangTestCase {
|
||||
|
||||
// todo[r.sh] use NIO2 API after migration to JDK 7
|
||||
private static File createTempLink(final String target, final String link) throws InterruptedException, ExecutionException {
|
||||
final File linkFile = new File(FileUtil.getTempDirectory(), link);
|
||||
final boolean isAbsolute = SystemInfo.isUnix && link.startsWith("/") ||
|
||||
SystemInfo.isWindows && link.matches("^[c-zC-Z]:.*$");
|
||||
final File linkFile = isAbsolute ? new File(link) : new File(FileUtil.getTempDirectory(), link);
|
||||
assertTrue(link, !linkFile.exists() || linkFile.delete());
|
||||
final File parentDir = linkFile.getParentFile();
|
||||
assertTrue("link=" + link + ", parent=" + parentDir, parentDir != null && (parentDir.isDirectory() || parentDir.mkdirs()));
|
||||
@@ -185,9 +205,9 @@ public class SymLinkHandlingTest extends LightPlatformLangTestCase {
|
||||
else {
|
||||
commandLine = new GeneralCommandLine("ln", "-s", target, linkFile.getAbsolutePath());
|
||||
}
|
||||
final Process process = commandLine.createProcess();
|
||||
final int res = process.waitFor();
|
||||
assertTrue(commandLine.getCommandLineString() + ": " + res, res == 0);
|
||||
final int res = commandLine.createProcess().waitFor();
|
||||
assertEquals(commandLine.getCommandLineString(), 0, res);
|
||||
|
||||
final File targetFile = new File(target);
|
||||
assertEquals("target=" + target + ", link=" + linkFile, targetFile.exists(), linkFile.exists());
|
||||
return linkFile;
|
||||
|
||||
@@ -178,6 +178,9 @@ public class UnixProcessManager {
|
||||
else if (SystemInfo.isMac) {
|
||||
return new String[]{"ps", "-ax", "-E", "-o", commandLineOnly ? "command" : "ppid,pid,command"};
|
||||
}
|
||||
else if (SystemInfo.isFreeBSD) {
|
||||
return new String[]{"ps", "-ax", "-e", "-o", commandLineOnly ? "command" : "ppid,pid,command"};
|
||||
}
|
||||
else {
|
||||
throw new IllegalStateException(System.getProperty("os.name") + " is not supported.");
|
||||
}
|
||||
|
||||
@@ -53,11 +53,7 @@ public class ColorUtil {
|
||||
final String R = Integer.toHexString(c.getRed());
|
||||
final String G = Integer.toHexString(c.getGreen());
|
||||
final String B = Integer.toHexString(c.getBlue());
|
||||
return new StringBuffer()
|
||||
.append(R.length() < 2 ? "0" : "").append(R)
|
||||
.append(G.length() < 2 ? "0" : "").append(G)
|
||||
.append(B.length() < 2 ? "0" : "").append(B)
|
||||
.toString();
|
||||
return (R.length() < 2 ? "0" : "") + R + (G.length() < 2 ? "0" : "") + G + (B.length() < 2 ? "0" : "") + B;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-2
@@ -96,8 +96,7 @@ public class ShowAllAffectedGenericAction extends AnAction {
|
||||
}
|
||||
|
||||
private static String failedText(VirtualFile virtualFile, VcsRevisionNumber revision) {
|
||||
return new StringBuilder().append("Show all affected files for ").append(virtualFile.getPath()).append(" at ")
|
||||
.append(revision.asString()).append(" failed").toString();
|
||||
return "Show all affected files for " + virtualFile.getPath() + " at " + revision.asString() + " failed";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -303,9 +303,7 @@ public class VcsChangeDetailsManager {
|
||||
}
|
||||
|
||||
private static String changeDescription(Change o) {
|
||||
return new StringBuilder().append(ChangesUtil.getFilePath(o).getName()).append(" (").append(
|
||||
o.getBeforeRevision() == null
|
||||
? "New" : beforeRevisionText(o)).append(")").toString();
|
||||
return ChangesUtil.getFilePath(o).getName() + " (" + (o.getBeforeRevision() == null ? "New" : beforeRevisionText(o)) + ")";
|
||||
}
|
||||
|
||||
private static String beforeRevisionText(Change o) {
|
||||
|
||||
@@ -206,9 +206,10 @@ public class ApplyPatchAction extends DumbAwareAction {
|
||||
final VirtualFile file,
|
||||
ApplyPatchForBaseRevisionTexts texts,
|
||||
boolean readonly) {
|
||||
final SimpleDiffRequest simpleRequest = new SimpleDiffRequest(project, new StringBuilder().append("Result Of Patch Apply To ")
|
||||
.append(file.getName()).append(" (").append(file.getParent() == null ? file.getPath() : file.getParent().getPath()).append(")")
|
||||
.toString());
|
||||
final SimpleDiffRequest simpleRequest =
|
||||
new SimpleDiffRequest(project, "Result Of Patch Apply To " + file.getName() + " (" +
|
||||
(file.getParent() == null ? file.getPath() : file.getParent().getPath()) +
|
||||
")");
|
||||
final DocumentImpl patched = new DocumentImpl(texts.getPatched());
|
||||
patched.setReadOnly(false);
|
||||
|
||||
|
||||
@@ -16,9 +16,16 @@
|
||||
package com.intellij.xdebugger.impl.frame;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import com.intellij.ide.CommonActionsManager;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.actionSystem.ActionManager;
|
||||
import com.intellij.openapi.actionSystem.ActionPlaces;
|
||||
import com.intellij.openapi.actionSystem.ActionToolbar;
|
||||
import com.intellij.openapi.actionSystem.DefaultActionGroup;
|
||||
import com.intellij.openapi.actionSystem.impl.ActionToolbarImpl;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.ui.ScrollPaneFactory;
|
||||
import com.intellij.ui.components.panels.Wrapper;
|
||||
import com.intellij.util.containers.HashMap;
|
||||
import com.intellij.xdebugger.XDebugSession;
|
||||
import com.intellij.xdebugger.frame.XExecutionStack;
|
||||
@@ -27,6 +34,7 @@ import com.intellij.xdebugger.frame.XSuspendContext;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import javax.swing.event.ListSelectionEvent;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
import java.awt.*;
|
||||
@@ -54,11 +62,6 @@ public class XFramesView extends XDebugViewBase {
|
||||
|
||||
myMainPanel = new JPanel(new BorderLayout());
|
||||
|
||||
myThreadComboBox = new JComboBox();
|
||||
myThreadComboBox.setRenderer(new ThreadComboBoxRenderer(myThreadComboBox));
|
||||
myThreadComboBox.addItemListener(new MyItemListener());
|
||||
myMainPanel.add(myThreadComboBox, BorderLayout.NORTH);
|
||||
|
||||
myFramesList = new XDebuggerFramesList(session.getProject());
|
||||
myFramesList.addListSelectionListener(new ListSelectionListener() {
|
||||
public void valueChanged(final ListSelectionEvent e) {
|
||||
@@ -76,9 +79,33 @@ public class XFramesView extends XDebugViewBase {
|
||||
}
|
||||
});
|
||||
myMainPanel.add(ScrollPaneFactory.createScrollPane(myFramesList), BorderLayout.CENTER);
|
||||
|
||||
myThreadComboBox = new JComboBox();
|
||||
myThreadComboBox.setRenderer(new ThreadComboBoxRenderer(myThreadComboBox));
|
||||
myThreadComboBox.addItemListener(new MyItemListener());
|
||||
final ActionToolbar toolbar = createToolbar();
|
||||
Wrapper threadsPanel = new Wrapper();
|
||||
threadsPanel.add(toolbar.getComponent(), BorderLayout.EAST);
|
||||
threadsPanel.add(myThreadComboBox, BorderLayout.CENTER);
|
||||
myMainPanel.add(threadsPanel, BorderLayout.NORTH);
|
||||
|
||||
rebuildView(SessionEvent.RESUMED);
|
||||
}
|
||||
|
||||
private ActionToolbar createToolbar() {
|
||||
final DefaultActionGroup framesGroup = new DefaultActionGroup();
|
||||
|
||||
CommonActionsManager actionsManager = CommonActionsManager.getInstance();
|
||||
framesGroup.add(actionsManager.createPrevOccurenceAction(getFramesList()));
|
||||
framesGroup.add(actionsManager.createNextOccurenceAction(getFramesList()));
|
||||
|
||||
final ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.DEBUGGER_TOOLBAR, framesGroup, true);
|
||||
toolbar.setReservePlaceAutoPopupIcon(false);
|
||||
((ActionToolbarImpl)toolbar).setAddSeparatorFirst(true);
|
||||
toolbar.getComponent().setBorder(new EmptyBorder(1, 0, 0, 0));
|
||||
return toolbar;
|
||||
}
|
||||
|
||||
private StackFramesListBuilder getOrCreateBuilder(XExecutionStack executionStack) {
|
||||
StackFramesListBuilder builder = myBuilders.get(executionStack);
|
||||
if (builder == null) {
|
||||
@@ -121,7 +148,6 @@ public class XFramesView extends XDebugViewBase {
|
||||
}
|
||||
XExecutionStack activeExecutionStack = suspendContext.getActiveExecutionStack();
|
||||
myThreadComboBox.setSelectedItem(activeExecutionStack);
|
||||
myThreadComboBox.setVisible(executionStacks.length != 1);
|
||||
updateFrames(activeExecutionStack);
|
||||
myListenersEnabled = true;
|
||||
}
|
||||
|
||||
@@ -15,13 +15,15 @@
|
||||
*/
|
||||
package com.intellij.xdebugger.impl.frame;
|
||||
|
||||
import com.intellij.ide.DataManager;
|
||||
import com.intellij.ide.dnd.DnDEvent;
|
||||
import com.intellij.ide.dnd.DnDManager;
|
||||
import com.intellij.ide.dnd.DnDNativeTarget;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.actionSystem.ActionManager;
|
||||
import com.intellij.openapi.actionSystem.CommonShortcuts;
|
||||
import com.intellij.openapi.actionSystem.CustomShortcutSet;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.ui.AnActionButton;
|
||||
import com.intellij.ui.AnActionButtonRunnable;
|
||||
import com.intellij.ui.ToolbarDecorator;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.ui.tree.TreeUtil;
|
||||
import com.intellij.xdebugger.XDebugSession;
|
||||
@@ -56,6 +58,7 @@ public class XWatchesView extends XDebugViewBase implements DnDNativeTarget {
|
||||
private XDebuggerTreeRestorer myTreeRestorer;
|
||||
private final WatchesRootNode myRootNode;
|
||||
private final XDebugSessionData mySessionData;
|
||||
private final JPanel myDecoratedPanel;
|
||||
|
||||
public XWatchesView(final XDebugSession session, final Disposable parentDisposable, final XDebugSessionData sessionData) {
|
||||
super(session, parentDisposable);
|
||||
@@ -76,10 +79,36 @@ public class XWatchesView extends XDebugViewBase implements DnDNativeTarget {
|
||||
myRootNode = new WatchesRootNode(tree, sessionData.getWatchExpressions());
|
||||
tree.setRoot(myRootNode, false);
|
||||
|
||||
final ToolbarDecorator decorator = ToolbarDecorator.createDecorator(myTreePanel.getTree()).disableUpDownActions();
|
||||
decorator.setAddAction(new AnActionButtonRunnable() {
|
||||
@Override
|
||||
public void run(AnActionButton button) {
|
||||
executeAction(XDebuggerActions.XNEW_WATCH);
|
||||
}
|
||||
});
|
||||
decorator.setRemoveAction(new AnActionButtonRunnable() {
|
||||
@Override
|
||||
public void run(AnActionButton button) {
|
||||
executeAction(XDebuggerActions.XREMOVE_WATCH);
|
||||
}
|
||||
});
|
||||
myDecoratedPanel = decorator.createPanel();
|
||||
myDecoratedPanel.setBorder(null);
|
||||
|
||||
myTreePanel.getTree().getEmptyText().setText(XDebuggerBundle.message("debugger.no.watches"));
|
||||
|
||||
}
|
||||
|
||||
private void executeAction(final String watch) {
|
||||
AnAction action = ActionManager.getInstance().getAction(watch);
|
||||
Presentation presentation = action.getTemplatePresentation().clone();
|
||||
DataContext context = DataManager.getInstance().getDataContext(myTreePanel.getTree());
|
||||
|
||||
AnActionEvent actionEvent =
|
||||
new AnActionEvent(null, context, ActionPlaces.DEBUGGER_TOOLBAR, presentation, ActionManager.getInstance(), 0);
|
||||
action.actionPerformed(actionEvent);
|
||||
}
|
||||
|
||||
public void addWatchExpression(@NotNull String expression, int index, final boolean navigateToWatchNode) {
|
||||
XDebuggerEvaluator evaluator = null;
|
||||
XStackFrame stackFrame = mySession.getCurrentStackFrame();
|
||||
@@ -128,7 +157,7 @@ public class XWatchesView extends XDebugViewBase implements DnDNativeTarget {
|
||||
}
|
||||
|
||||
public JPanel getMainPanel() {
|
||||
return myTreePanel.getMainPanel();
|
||||
return myDecoratedPanel;
|
||||
}
|
||||
|
||||
public void removeWatches(final List<? extends XDebuggerTreeNode> nodes) {
|
||||
|
||||
@@ -29,12 +29,9 @@ import com.intellij.execution.ui.ExecutionConsole;
|
||||
import com.intellij.execution.ui.RunContentDescriptor;
|
||||
import com.intellij.execution.ui.actions.CloseAction;
|
||||
import com.intellij.execution.ui.layout.PlaceInGrid;
|
||||
import com.intellij.ide.CommonActionsManager;
|
||||
import com.intellij.ide.actions.ContextHelpAction;
|
||||
import com.intellij.openapi.actionSystem.ActionGroup;
|
||||
import com.intellij.openapi.actionSystem.ActionManager;
|
||||
import com.intellij.openapi.actionSystem.ActionPlaces;
|
||||
import com.intellij.openapi.actionSystem.DefaultActionGroup;
|
||||
import com.intellij.idea.ActionsBundle;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.ui.content.Content;
|
||||
@@ -47,6 +44,7 @@ import com.intellij.xdebugger.impl.frame.XDebugViewBase;
|
||||
import com.intellij.xdebugger.impl.frame.XFramesView;
|
||||
import com.intellij.xdebugger.impl.frame.XVariablesView;
|
||||
import com.intellij.xdebugger.impl.frame.XWatchesView;
|
||||
import com.intellij.xdebugger.impl.ui.tree.actions.SortValuesToggleAction;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -98,8 +96,6 @@ public class XDebugSessionTab extends DebuggerSessionTabBase {
|
||||
XDebuggerBundle.message("debugger.session.tab.watches.title"), XDebuggerUIConstants.WATCHES_TAB_ICON, null);
|
||||
watchesContent.setCloseable(false);
|
||||
|
||||
ActionGroup group = getActionGroup(XDebuggerActions.WATCHES_TREE_TOOLBAR_GROUP);
|
||||
watchesContent.setActions(group, ActionPlaces.DEBUGGER_TOOLBAR, myWatchesView.getTree());
|
||||
return watchesContent;
|
||||
}
|
||||
|
||||
@@ -110,13 +106,6 @@ public class XDebugSessionTab extends DebuggerSessionTabBase {
|
||||
XDebuggerBundle.message("debugger.session.tab.frames.title"), XDebuggerUIConstants.FRAMES_TAB_ICON, null);
|
||||
framesContent.setCloseable(false);
|
||||
|
||||
final DefaultActionGroup framesGroup = new DefaultActionGroup();
|
||||
|
||||
CommonActionsManager actionsManager = CommonActionsManager.getInstance();
|
||||
framesGroup.add(actionsManager.createPrevOccurenceAction(framesView.getFramesList()));
|
||||
framesGroup.add(actionsManager.createNextOccurenceAction(framesView.getFramesList()));
|
||||
|
||||
framesContent.setActions(framesGroup, ActionPlaces.DEBUGGER_TOOLBAR, framesView.getFramesList());
|
||||
return framesContent;
|
||||
}
|
||||
|
||||
@@ -172,6 +161,31 @@ public class XDebugSessionTab extends DebuggerSessionTabBase {
|
||||
leftToolbar.addSeparator();
|
||||
|
||||
leftToolbar.add(myUi.getOptions().getLayoutActions());
|
||||
final AnAction[] commonSettings = myUi.getOptions().getSettingsActionsList();
|
||||
final AnAction commonSettingsList = myUi.getOptions().getSettingsActions();
|
||||
|
||||
final DefaultActionGroup settings = new DefaultActionGroup("DebuggerSettings", commonSettings.length > 0) {
|
||||
@Override
|
||||
public void update(AnActionEvent e) {
|
||||
e.getPresentation().setText(ActionsBundle.message("group.XDebugger.settings.text"));
|
||||
e.getPresentation().setIcon(commonSettingsList.getTemplatePresentation().getIcon());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDumbAware() {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
for (AnAction each : commonSettings) {
|
||||
settings.add(each);
|
||||
}
|
||||
if (commonSettings.length > 0) {
|
||||
settings.addSeparator();
|
||||
}
|
||||
settings.add(new ToggleSortValuesAction(commonSettings.length == 0));
|
||||
|
||||
leftToolbar.add(settings);
|
||||
|
||||
|
||||
leftToolbar.addSeparator();
|
||||
|
||||
@@ -202,4 +216,21 @@ public class XDebugSessionTab extends DebuggerSessionTabBase {
|
||||
public RunContentDescriptor getRunContentDescriptor() {
|
||||
return myRunContentDescriptor;
|
||||
}
|
||||
|
||||
private static class ToggleSortValuesAction extends SortValuesToggleAction {
|
||||
private final boolean myShowIcon;
|
||||
|
||||
private ToggleSortValuesAction(boolean showIcon) {
|
||||
copyFrom(ActionManager.getInstance().getAction(XDebuggerActions.TOGGLE_SORT_VALUES));
|
||||
myShowIcon = showIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(AnActionEvent e) {
|
||||
super.update(e);
|
||||
if (!myShowIcon) {
|
||||
e.getPresentation().setIcon(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -322,4 +322,5 @@ android.lint.inspections.set.to.wrap.content=Replace size attribute with 'wrap_c
|
||||
android.lint.inspections.add.permission.attribute=Add 'permission' attribute
|
||||
android.lint.inspections.add.input.type.attribute=Add 'inputType' attribute
|
||||
android.lint.inspections.remove.unnecessary.view=Remove unnecessary view
|
||||
android.lint.inspections.replace.with.suggested.characters=Replace with suggested characters
|
||||
android.lint.inspections.replace.with.suggested.characters=Replace with suggested characters
|
||||
android.facet.settings.pack.test.sources=Include test code and resources into APK
|
||||
@@ -35,6 +35,7 @@ import com.intellij.openapi.project.DumbService;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.*;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
@@ -351,14 +352,24 @@ public class AndroidCompileUtil {
|
||||
}
|
||||
|
||||
public static void generate(final Module module, final GeneratingCompiler compiler) {
|
||||
module.getProject().getComponent(AndroidProjectComponent.class).runIfNotInCompilation(new Runnable() {
|
||||
final Project project = module.getProject();
|
||||
final AndroidProjectComponent component = ApplicationManager.getApplication().runReadAction(new Computable<AndroidProjectComponent>() {
|
||||
@Nullable
|
||||
@Override
|
||||
public AndroidProjectComponent compute() {
|
||||
return !project.isDisposed() ? project.getComponent(AndroidProjectComponent.class) : null;
|
||||
}
|
||||
});
|
||||
if (component == null) {
|
||||
return;
|
||||
}
|
||||
component.runIfNotInCompilation(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
assert !ApplicationManager.getApplication().isDispatchThread();
|
||||
final CompileContext[] contextWrapper = new CompileContext[1];
|
||||
ApplicationManager.getApplication().runReadAction(new Runnable() {
|
||||
public void run() {
|
||||
Project project = module.getProject();
|
||||
if (project.isDisposed()) return;
|
||||
CompilerTask task = new CompilerTask(project, true, "Android auto-generation", true);
|
||||
CompileScope scope = new ModuleCompileScope(module, false);
|
||||
|
||||
@@ -105,11 +105,6 @@ public class AndroidDexCompiler implements ClassPostProcessingCompiler {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean shouldRunProguard(@NotNull AndroidFacet facet, @NotNull CompileContext context) {
|
||||
return AndroidCompileUtil.isReleaseBuild(context) &&
|
||||
AndroidCompileUtil.getProguardConfigFile(facet) != null;
|
||||
}
|
||||
|
||||
private static final class PrepareAction implements Computable<ProcessingItem[]> {
|
||||
private final CompileContext myContext;
|
||||
@@ -129,7 +124,10 @@ public class AndroidDexCompiler implements ClassPostProcessingCompiler {
|
||||
|
||||
Collection<VirtualFile> files;
|
||||
|
||||
if (shouldRunProguard(facet, myContext)) {
|
||||
final boolean shouldRunProguard = myContext.getCompileScope().
|
||||
getUserData(AndroidProguardCompiler.PROGUARD_CFG_PATH_KEY) != null;
|
||||
|
||||
if (shouldRunProguard) {
|
||||
final VirtualFile obfuscatedSourcesJar = dexOutputDir.findChild(AndroidProguardCompiler.PROGUARD_OUTPUT_JAR_NAME);
|
||||
if (obfuscatedSourcesJar == null) {
|
||||
myContext.addMessage(CompilerMessageCategory.INFORMATION, "Dex won't be launched for module " +
|
||||
@@ -166,10 +164,12 @@ public class AndroidDexCompiler implements ClassPostProcessingCompiler {
|
||||
}
|
||||
}
|
||||
|
||||
VirtualFile outputDirForTests = extension.getCompilerOutputPathForTests();
|
||||
if (facet.getConfiguration().PACK_TEST_CODE) {
|
||||
VirtualFile outputDirForTests = extension.getCompilerOutputPathForTests();
|
||||
|
||||
if (outputDirForTests != null) {
|
||||
addModuleOutputDir(files, outputDirForTests);
|
||||
if (outputDirForTests != null) {
|
||||
addModuleOutputDir(files, outputDirForTests);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -226,7 +226,7 @@ public class AndroidIdlCompiler implements SourceGeneratingCompiler {
|
||||
}
|
||||
|
||||
try {
|
||||
VirtualFile[] sourceRoots = AndroidPackagingCompiler.getSourceRootsForModuleAndDependencies(idlItem.myModule);
|
||||
VirtualFile[] sourceRoots = AndroidPackagingCompiler.getSourceRootsForModuleAndDependencies(idlItem.myModule, false);
|
||||
final String[] sourceRootPaths = AndroidCompileUtil.toOsPaths(sourceRoots);
|
||||
|
||||
final Map<CompilerMessageCategory, List<String>> messages = AndroidIdl
|
||||
|
||||
@@ -65,11 +65,14 @@ public class AndroidPackagingCompiler implements PackagingCompiler {
|
||||
return VirtualFile.EMPTY_ARRAY;
|
||||
}
|
||||
|
||||
private static void fillSourceRoots(@NotNull Module module, @NotNull Set<Module> visited, @NotNull Set<VirtualFile> result) {
|
||||
private static void fillSourceRoots(@NotNull Module module,
|
||||
@NotNull Set<Module> visited,
|
||||
@NotNull Set<VirtualFile> result,
|
||||
boolean includingTests) {
|
||||
visited.add(module);
|
||||
VirtualFile resDir = AndroidRootUtil.getResourceDir(module);
|
||||
ModuleRootManager manager = ModuleRootManager.getInstance(module);
|
||||
for (VirtualFile sourceRoot : manager.getSourceRoots()) {
|
||||
for (VirtualFile sourceRoot : manager.getSourceRoots(includingTests)) {
|
||||
if (resDir != sourceRoot) {
|
||||
result.add(sourceRoot);
|
||||
}
|
||||
@@ -78,10 +81,10 @@ public class AndroidPackagingCompiler implements PackagingCompiler {
|
||||
if (entry instanceof ModuleOrderEntry) {
|
||||
ModuleOrderEntry moduleOrderEntry = (ModuleOrderEntry)entry;
|
||||
DependencyScope scope = moduleOrderEntry.getScope();
|
||||
if (scope == DependencyScope.COMPILE || scope == DependencyScope.TEST) {
|
||||
if (scope == DependencyScope.COMPILE) {
|
||||
Module depModule = moduleOrderEntry.getModule();
|
||||
if (depModule != null && !visited.contains(depModule)) {
|
||||
fillSourceRoots(depModule, visited, result);
|
||||
fillSourceRoots(depModule, visited, result, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -89,9 +92,9 @@ public class AndroidPackagingCompiler implements PackagingCompiler {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static VirtualFile[] getSourceRootsForModuleAndDependencies(@NotNull Module module) {
|
||||
public static VirtualFile[] getSourceRootsForModuleAndDependencies(@NotNull Module module, boolean includingTests) {
|
||||
Set<VirtualFile> result = new HashSet<VirtualFile>();
|
||||
fillSourceRoots(module, new HashSet<Module>(), result);
|
||||
fillSourceRoots(module, new HashSet<Module>(), result, includingTests);
|
||||
return VfsUtil.toVirtualFileArray(result);
|
||||
}
|
||||
|
||||
@@ -102,7 +105,7 @@ public class AndroidPackagingCompiler implements PackagingCompiler {
|
||||
AndroidFacet facet = AndroidFacet.getInstance(module);
|
||||
if (facet != null && !facet.getConfiguration().LIBRARY_PROJECT) {
|
||||
VirtualFile manifestFile = AndroidRootUtil.getManifestFileForCompiler(facet);
|
||||
VirtualFile[] sourceRoots = getSourceRootsForModuleAndDependencies(module);
|
||||
VirtualFile[] sourceRoots = getSourceRootsForModuleAndDependencies(module, facet.getConfiguration().PACK_TEST_CODE);
|
||||
if (manifestFile != null) {
|
||||
AndroidFacetConfiguration configuration = facet.getConfiguration();
|
||||
VirtualFile outputDir = AndroidDexCompiler.getOutputDirectoryForDex(module);
|
||||
|
||||
+29
-4
@@ -21,6 +21,8 @@ import com.intellij.openapi.command.undo.UndoUtil;
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiReference;
|
||||
@@ -30,8 +32,8 @@ import com.intellij.psi.xml.XmlTag;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.PsiNavigateUtil;
|
||||
import com.intellij.util.xml.*;
|
||||
import org.jetbrains.android.dom.ResourceType;
|
||||
import org.jetbrains.android.dom.AdditionalConverter;
|
||||
import org.jetbrains.android.dom.ResourceType;
|
||||
import org.jetbrains.android.dom.resources.Item;
|
||||
import org.jetbrains.android.dom.resources.ResourceElement;
|
||||
import org.jetbrains.android.dom.resources.ResourceValue;
|
||||
@@ -110,7 +112,8 @@ public class ResourceReferenceConverter extends ResolvingConverter<ResourceValue
|
||||
if (module == null) return result;
|
||||
AndroidFacet facet = AndroidFacet.getInstance(module);
|
||||
if (facet == null) return result;
|
||||
Set<String> recommendedTypes = getResourceTypes(context);
|
||||
|
||||
final Set<String> recommendedTypes = getResourceTypes(context);
|
||||
|
||||
// hack to check if it is a real id attribute
|
||||
if (recommendedTypes.contains("id") && recommendedTypes.size() == 1) {
|
||||
@@ -122,7 +125,7 @@ public class ResourceReferenceConverter extends ResolvingConverter<ResourceValue
|
||||
String value = getValue(element);
|
||||
assert value != null;
|
||||
|
||||
if (!myQuiet || value.startsWith("@")) {
|
||||
if (!myQuiet || StringUtil.startsWithChar(value, '@')) {
|
||||
String resourcePackage = null;
|
||||
String systemPrefix = getPackagePrefix(SYSTEM_RESOURCE_PACKAGE);
|
||||
if (value.startsWith(systemPrefix)) {
|
||||
@@ -137,12 +140,17 @@ public class ResourceReferenceConverter extends ResolvingConverter<ResourceValue
|
||||
addResourceReferenceValues(facet, type, resourcePackage, result, explicitResourceType);
|
||||
}
|
||||
else {
|
||||
final Set<String> filteringSet = SYSTEM_RESOURCE_PACKAGE.equals(resourcePackage)
|
||||
? null
|
||||
: getResourceTypesInCurrentModule(facet);
|
||||
|
||||
for (String type : ResourceManager.REFERABLE_RESOURCE_TYPES) {
|
||||
String typePrefix = getTypePrefix(resourcePackage, type);
|
||||
if (value.startsWith(typePrefix)) {
|
||||
addResourceReferenceValues(facet, type, resourcePackage, result, true);
|
||||
}
|
||||
else if (recommendedTypes.contains(type)) {
|
||||
else if (recommendedTypes.contains(type) &&
|
||||
(filteringSet == null || filteringSet.contains(type))) {
|
||||
result.add(ResourceValue.literal(typePrefix));
|
||||
}
|
||||
}
|
||||
@@ -157,6 +165,23 @@ public class ResourceReferenceConverter extends ResolvingConverter<ResourceValue
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static Set<String> getResourceTypesInCurrentModule(@NotNull AndroidFacet facet) {
|
||||
final Set<String> result = new HashSet<String>();
|
||||
final LocalResourceManager manager = facet.getLocalResourceManager();
|
||||
|
||||
for (VirtualFile resSubdir : manager.getResourceSubdirs(null)) {
|
||||
final String resType = AndroidResourceUtil.getResourceTypeByDirName(resSubdir.getName());
|
||||
|
||||
if (resType != null && com.android.resources.ResourceType.getEnum(resType) != null) {
|
||||
result.add(resType);
|
||||
}
|
||||
}
|
||||
|
||||
result.addAll(manager.getValueResourceTypes());
|
||||
return result;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private String getTypePrefix(String resourcePackage, String type) {
|
||||
|
||||
@@ -81,6 +81,8 @@ public class AndroidFacetConfiguration implements FacetConfiguration {
|
||||
|
||||
public String CUSTOM_DEBUG_KEYSTORE_PATH = "";
|
||||
|
||||
public boolean PACK_TEST_CODE = false;
|
||||
|
||||
private AndroidFacet myFacet = null;
|
||||
|
||||
public void init(@NotNull Module module, @NotNull VirtualFile contentRoot) {
|
||||
|
||||
@@ -115,8 +115,8 @@
|
||||
</vspacer>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="84519" layout-manager="GridLayoutManager" row-count="4" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<grid id="84519" layout-manager="GridLayoutManager" row-count="5" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="4" right="0"/>
|
||||
<constraints>
|
||||
<tabbedpane title="Compiler"/>
|
||||
</constraints>
|
||||
@@ -124,7 +124,7 @@
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="3e085" layout-manager="GridLayoutManager" row-count="5" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="4" bottom="0" right="0"/>
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
@@ -198,11 +198,11 @@
|
||||
</grid>
|
||||
<vspacer id="e716a">
|
||||
<constraints>
|
||||
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
<grid id="4c810" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="4" bottom="0" right="0"/>
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
@@ -237,7 +237,7 @@
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="c2a96" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="4" bottom="0" right="0"/>
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
@@ -297,6 +297,14 @@
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<component id="39707" class="javax.swing.JCheckBox" binding="myIncludeTestCodeAndCheckBox" default-binding="true">
|
||||
<constraints>
|
||||
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text resource-bundle="messages/AndroidBundle" key="android.facet.settings.pack.test.sources"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
|
||||
@@ -93,6 +93,7 @@ public class AndroidFacetEditorTab extends FacetEditorTab {
|
||||
private JLabel myRGenPathLabel;
|
||||
private TextFieldWithBrowseButton myCustomDebugKeystoreField;
|
||||
private JBLabel myCustomKeystoreLabel;
|
||||
private JCheckBox myIncludeTestCodeAndCheckBox;
|
||||
|
||||
public AndroidFacetEditorTab(FacetEditorContext context, AndroidFacetConfiguration androidFacetConfiguration) {
|
||||
final Project project = context.getProject();
|
||||
@@ -282,6 +283,9 @@ public class AndroidFacetEditorTab extends FacetEditorTab {
|
||||
if (!myConfiguration.CUSTOM_DEBUG_KEYSTORE_PATH.equals(getSelectedCustomKeystorePath())) {
|
||||
return true;
|
||||
}
|
||||
if (myConfiguration.PACK_TEST_CODE != myIncludeTestCodeAndCheckBox.isSelected()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -390,6 +394,8 @@ public class AndroidFacetEditorTab extends FacetEditorTab {
|
||||
myConfiguration.RUN_PROCESS_RESOURCES_MAVEN_TASK = myRunProcessResourcesRadio.isSelected();
|
||||
|
||||
myConfiguration.GENERATE_UNSIGNED_APK = myGenerateUnsignedApk.isSelected();
|
||||
|
||||
myConfiguration.PACK_TEST_CODE = myIncludeTestCodeAndCheckBox.isSelected();
|
||||
|
||||
boolean useCustomAptSrc = myUseCustomSourceDirectoryRadio.isSelected();
|
||||
|
||||
@@ -513,6 +519,7 @@ public class AndroidFacetEditorTab extends FacetEditorTab {
|
||||
myCompileResourcesByIdeRadio.setSelected(!myConfiguration.RUN_PROCESS_RESOURCES_MAVEN_TASK);
|
||||
|
||||
myGenerateUnsignedApk.setSelected(myConfiguration.GENERATE_UNSIGNED_APK);
|
||||
myIncludeTestCodeAndCheckBox.setSelected(myConfiguration.PACK_TEST_CODE);
|
||||
|
||||
updateAptPanel();
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.jetbrains.android.facet;
|
||||
|
||||
import com.android.resources.ResourceFolderType;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.compiler.GeneratingCompiler;
|
||||
import com.intellij.openapi.module.Module;
|
||||
@@ -31,6 +32,7 @@ import org.jetbrains.android.compiler.*;
|
||||
import org.jetbrains.android.dom.manifest.Manifest;
|
||||
import org.jetbrains.android.fileTypes.AndroidIdlFileType;
|
||||
import org.jetbrains.android.fileTypes.AndroidRenderscriptFileType;
|
||||
import org.jetbrains.android.util.AndroidResourceUtil;
|
||||
import org.jetbrains.android.util.AndroidUtils;
|
||||
import org.jetbrains.android.util.ResourceEntry;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -147,7 +149,7 @@ class AndroidResourceFilesListener extends VirtualFileAdapter {
|
||||
final GeneratingCompiler compilerToRun = ApplicationManager.getApplication().runReadAction(new Computable<GeneratingCompiler>() {
|
||||
@Nullable
|
||||
public GeneratingCompiler compute() {
|
||||
return computeCompilerToRun();
|
||||
return computeCompilerToRunAndInvalidateLocalAttributesMap();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -175,7 +177,7 @@ class AndroidResourceFilesListener extends VirtualFileAdapter {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private GeneratingCompiler computeCompilerToRun() {
|
||||
private GeneratingCompiler computeCompilerToRunAndInvalidateLocalAttributesMap() {
|
||||
if (myFacet.isDisposed()) {
|
||||
return null;
|
||||
}
|
||||
@@ -197,10 +199,18 @@ class AndroidResourceFilesListener extends VirtualFileAdapter {
|
||||
return null;
|
||||
}
|
||||
|
||||
parent = parent.getParent();
|
||||
final VirtualFile gp = parent.getParent();
|
||||
|
||||
final VirtualFile resourceDir = AndroidRootUtil.getResourceDir(module);
|
||||
|
||||
if (gp == resourceDir &&
|
||||
ResourceFolderType.VALUES.getName().equals(AndroidResourceUtil.getResourceTypeByDirName(parent.getName()))) {
|
||||
myFacet.getLocalResourceManager().invalidateAttributeDefinitions();
|
||||
}
|
||||
|
||||
if (AndroidAptCompiler.isToCompileModule(module, myFacet.getConfiguration()) &&
|
||||
(myFacet.getConfiguration().REGENERATE_R_JAVA && parent == AndroidRootUtil.getResourceDir(module) ||
|
||||
AndroidRootUtil.getManifestFile(module) == file)) {
|
||||
(myFacet.getConfiguration().REGENERATE_R_JAVA && (gp == resourceDir ||
|
||||
AndroidRootUtil.getManifestFile(module) == file))) {
|
||||
final Manifest manifest = myFacet.getManifest();
|
||||
final String aPackage = manifest != null ? manifest.getPackage().getValue() : null;
|
||||
|
||||
@@ -209,8 +219,6 @@ class AndroidResourceFilesListener extends VirtualFileAdapter {
|
||||
AndroidCompileUtil.removeDuplicatingClasses(myModule, myCachedPackage, AndroidUtils.R_CLASS_NAME, null, aptGenDirPath);
|
||||
}
|
||||
myCachedPackage = aPackage;
|
||||
myFacet.getLocalResourceManager().invalidateAttributeDefinitions();
|
||||
|
||||
return new AndroidAptCompiler();
|
||||
}
|
||||
|
||||
|
||||
@@ -256,14 +256,9 @@ public class AndroidRootUtil {
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!outputDirs.contains(classDir) && classDir != null && classDir.exists()) {
|
||||
outputDirs.add(classDir);
|
||||
}
|
||||
VirtualFile classDirForTests = extension.getCompilerOutputPathForTests();
|
||||
if (!outputDirs.contains(classDirForTests) && classDirForTests != null && classDirForTests.exists()) {
|
||||
outputDirs.add(classDirForTests);
|
||||
}
|
||||
// do not support android-app->android-app compile dependencies
|
||||
else if (facet == null && !outputDirs.contains(classDir) && classDir != null && classDir.exists()) {
|
||||
outputDirs.add(classDir);
|
||||
}
|
||||
}
|
||||
fillExternalLibrariesAndModules(depModule, outputDirs, libraries, visited, !libraryProject || exportedLibrariesOnly);
|
||||
|
||||
@@ -128,6 +128,7 @@ public class AndroidModuleBuilder extends JavaModuleBuilder {
|
||||
|
||||
if (myProjectType == ProjectType.TEST) {
|
||||
assert myTestedModule != null;
|
||||
facet.getConfiguration().PACK_TEST_CODE = true;
|
||||
ModuleOrderEntry entry = rootModel.addModuleOrderEntry(myTestedModule);
|
||||
entry.setScope(DependencyScope.PROVIDED);
|
||||
}
|
||||
|
||||
+44
-3
@@ -17,6 +17,7 @@
|
||||
package org.jetbrains.android.resourceManagers;
|
||||
|
||||
import com.android.AndroidConstants;
|
||||
import com.android.resources.ResourceType;
|
||||
import com.intellij.CommonBundle;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
@@ -27,10 +28,14 @@ import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.xml.XmlFile;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.containers.HashMap;
|
||||
import com.intellij.util.containers.HashSet;
|
||||
import com.intellij.util.indexing.FileBasedIndex;
|
||||
import org.jetbrains.android.AndroidFileTemplateProvider;
|
||||
import org.jetbrains.android.AndroidValueResourcesIndex;
|
||||
import org.jetbrains.android.actions.CreateResourceFileAction;
|
||||
import org.jetbrains.android.dom.attrs.AttributeDefinitions;
|
||||
import org.jetbrains.android.dom.resources.Attr;
|
||||
@@ -42,13 +47,12 @@ import org.jetbrains.android.facet.AndroidRootUtil;
|
||||
import org.jetbrains.android.util.AndroidBundle;
|
||||
import org.jetbrains.android.util.AndroidResourceUtil;
|
||||
import org.jetbrains.android.util.AndroidUtils;
|
||||
import org.jetbrains.android.util.ResourceEntry;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
import static org.jetbrains.android.util.AndroidUtils.loadDomElement;
|
||||
|
||||
@@ -135,6 +139,43 @@ public class LocalResourceManager extends ResourceManager {
|
||||
return facet != null ? facet.getLocalResourceManager() : null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Set<String> getValueResourceTypes() {
|
||||
final Map<VirtualFile, Set<String>> file2Types = new HashMap<VirtualFile, Set<String>>();
|
||||
final FileBasedIndex index = FileBasedIndex.getInstance();
|
||||
final GlobalSearchScope scope = GlobalSearchScope.projectScope(myModule.getProject());
|
||||
|
||||
for (String resourceType : ResourceType.getNames()) {
|
||||
final ResourceEntry typeMarkerEntry = AndroidValueResourcesIndex.createTypeMarkerEntry(resourceType);
|
||||
|
||||
for (Set<ResourceEntry> entrySet : index.getValues(AndroidValueResourcesIndex.INDEX_ID, typeMarkerEntry, scope)) {
|
||||
for (ResourceEntry entry : entrySet) {
|
||||
final Collection<VirtualFile> files = index.getContainingFiles(AndroidValueResourcesIndex.INDEX_ID, entry, scope);
|
||||
|
||||
for (VirtualFile file : files) {
|
||||
Set<String> resourcesInFile = file2Types.get(file);
|
||||
|
||||
if (resourcesInFile == null) {
|
||||
resourcesInFile = new HashSet<String>();
|
||||
file2Types.put(file, resourcesInFile);
|
||||
}
|
||||
resourcesInFile.add(entry.getType());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
final Set<String> result = new HashSet<String>();
|
||||
|
||||
for (VirtualFile file : getAllValueResourceFiles()) {
|
||||
final Set<String> types = file2Types.get(file);
|
||||
|
||||
if (types != null) {
|
||||
result.addAll(types);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public AttributeDefinitions getAttributeDefinitions() {
|
||||
if (myAttrDefs == null) {
|
||||
|
||||
@@ -92,11 +92,10 @@ public class AndroidRunConfiguration extends AndroidRunConfigurationBase impleme
|
||||
}
|
||||
|
||||
@Override
|
||||
public RunProfileState getState(@NotNull Executor executor, @NotNull ExecutionEnvironment env) throws ExecutionException {
|
||||
RunProfileState state = super.getState(executor, env);
|
||||
public AndroidRunningState getState(@NotNull Executor executor, @NotNull ExecutionEnvironment env) throws ExecutionException {
|
||||
AndroidRunningState state = super.getState(executor, env);
|
||||
if (state != null) {
|
||||
assert state instanceof AndroidRunningState;
|
||||
((AndroidRunningState)state).setDeploy(DEPLOY);
|
||||
state.setDeploy(DEPLOY);
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.DependencyScope;
|
||||
import com.intellij.openapi.roots.ModuleOrderEntry;
|
||||
import com.intellij.openapi.roots.ModuleRootManager;
|
||||
import com.intellij.openapi.roots.OrderEntry;
|
||||
@@ -158,7 +157,8 @@ public abstract class AndroidRunConfigurationBase extends ModuleBasedConfigurati
|
||||
TARGET_SELECTION_MODE = mode.name();
|
||||
}
|
||||
|
||||
private static boolean fillRuntimeAndTestDependencies(@NotNull Module module, @NotNull Map<AndroidFacet, String> module2PackageName) {
|
||||
private static boolean fillRuntimeAndTestDependencies(@NotNull Module module,
|
||||
@NotNull Map<AndroidFacet, String> module2PackageName) {
|
||||
for (OrderEntry entry : ModuleRootManager.getInstance(module).getOrderEntries()) {
|
||||
if (entry instanceof ModuleOrderEntry) {
|
||||
ModuleOrderEntry moduleOrderEntry = (ModuleOrderEntry)entry;
|
||||
@@ -167,8 +167,7 @@ public abstract class AndroidRunConfigurationBase extends ModuleBasedConfigurati
|
||||
AndroidFacet depFacet = AndroidFacet.getInstance(depModule);
|
||||
if (depFacet != null &&
|
||||
!module2PackageName.containsKey(depFacet) &&
|
||||
!depFacet.getConfiguration().LIBRARY_PROJECT &&
|
||||
moduleOrderEntry.getScope() != DependencyScope.COMPILE) {
|
||||
!depFacet.getConfiguration().LIBRARY_PROJECT) {
|
||||
String packageName = getPackageName(depFacet);
|
||||
if (packageName == null) {
|
||||
return false;
|
||||
@@ -184,7 +183,7 @@ public abstract class AndroidRunConfigurationBase extends ModuleBasedConfigurati
|
||||
return true;
|
||||
}
|
||||
|
||||
public RunProfileState getState(@NotNull final Executor executor, @NotNull ExecutionEnvironment env) throws ExecutionException {
|
||||
public AndroidRunningState getState(@NotNull final Executor executor, @NotNull ExecutionEnvironment env) throws ExecutionException {
|
||||
final Module module = getConfigurationModule().getModule();
|
||||
if (module == null) {
|
||||
throw new ExecutionException("Module is not found");
|
||||
|
||||
@@ -218,10 +218,6 @@ public abstract class AndroidRunningState implements RunProfileState, AndroidDeb
|
||||
return myLock;
|
||||
}
|
||||
|
||||
public AndroidFacet getAndroidFacet() {
|
||||
return myFacet;
|
||||
}
|
||||
|
||||
public String getPackageName() {
|
||||
return myPackageName;
|
||||
}
|
||||
@@ -230,6 +226,7 @@ public abstract class AndroidRunningState implements RunProfileState, AndroidDeb
|
||||
return myFacet.getModule();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public AndroidFacet getFacet() {
|
||||
return myFacet;
|
||||
}
|
||||
|
||||
+43
-1
@@ -28,6 +28,7 @@ import com.intellij.execution.Executor;
|
||||
import com.intellij.execution.configurations.*;
|
||||
import com.intellij.execution.junit.JUnitUtil;
|
||||
import com.intellij.execution.process.ProcessOutputTypes;
|
||||
import com.intellij.execution.runners.ExecutionEnvironment;
|
||||
import com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil;
|
||||
import com.intellij.execution.testframework.ui.BaseTestsOutputConsoleView;
|
||||
import com.intellij.execution.ui.ConsoleView;
|
||||
@@ -35,6 +36,8 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.options.SettingsEditor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.ModuleRootManager;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.psi.JavaPsiFacade;
|
||||
import com.intellij.psi.PsiClass;
|
||||
@@ -43,6 +46,7 @@ import com.intellij.psi.PsiPackage;
|
||||
import org.jetbrains.android.dom.manifest.Instrumentation;
|
||||
import org.jetbrains.android.dom.manifest.Manifest;
|
||||
import org.jetbrains.android.facet.AndroidFacet;
|
||||
import org.jetbrains.android.facet.AndroidFacetConfiguration;
|
||||
import org.jetbrains.android.run.AndroidApplicationLauncher;
|
||||
import org.jetbrains.android.run.AndroidRunConfigurationBase;
|
||||
import org.jetbrains.android.run.AndroidRunConfigurationEditor;
|
||||
@@ -108,6 +112,44 @@ public class AndroidTestRunConfiguration extends AndroidRunConfigurationBase {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AndroidRunningState getState(@NotNull Executor executor, @NotNull ExecutionEnvironment env) throws ExecutionException {
|
||||
final AndroidRunningState state = super.getState(executor, env);
|
||||
|
||||
if (state == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
final AndroidFacet facet = state.getFacet();
|
||||
final AndroidFacetConfiguration configuration = facet.getConfiguration();
|
||||
|
||||
if (!configuration.PACK_TEST_CODE) {
|
||||
final Module module = facet.getModule();
|
||||
final int count = getTestSourceRootCount(module);
|
||||
|
||||
if (count > 0) {
|
||||
final String message = "Code and resources under test source " + (count > 1 ? "roots" : "root") +
|
||||
" aren't included into debug APK.\nWould you like to include them and recompile " +
|
||||
module.getName() + " module?" + "\n(You may change this option in Android facet settings later)";
|
||||
final int result =
|
||||
Messages.showYesNoCancelDialog(getProject(), message, "Test code not included into APK", Messages.getQuestionIcon());
|
||||
|
||||
if (result == Messages.YES) {
|
||||
configuration.PACK_TEST_CODE = true;
|
||||
}
|
||||
else if (result == Messages.CANCEL) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
private static int getTestSourceRootCount(@NotNull Module module) {
|
||||
final ModuleRootManager manager = ModuleRootManager.getInstance(module);
|
||||
return manager.getSourceRoots(true).length - manager.getSourceRoots(false).length;
|
||||
}
|
||||
|
||||
private void checkTestMethod() throws RuntimeConfigurationException {
|
||||
JavaRunConfigurationModule configurationModule = getConfigurationModule();
|
||||
final PsiClass testClass =
|
||||
@@ -166,7 +208,7 @@ public class AndroidTestRunConfiguration extends AndroidRunConfigurationBase {
|
||||
BaseTestsOutputConsoleView consoleView = SMTestRunnerConnectionUtil
|
||||
.createAndAttachConsole("Android", state.getProcessHandler(), properties, state.getRunnerSettings(), state.getConfigurationSettings()
|
||||
);
|
||||
Disposer.register(state.getAndroidFacet().getModule().getProject(), consoleView);
|
||||
Disposer.register(state.getFacet().getModule().getProject(), consoleView);
|
||||
return consoleView;
|
||||
}
|
||||
|
||||
|
||||
@@ -76,10 +76,17 @@ class AndroidSdkConfigurableForm {
|
||||
final IAndroidTarget target = (IAndroidTarget)e.getItem();
|
||||
|
||||
List<OrderRoot> roots = AndroidSdkUtils.getLibraryRootsForTarget(target, mySdkLocation);
|
||||
Map<OrderRootType, VirtualFile[]> configuredRoots = new HashMap<OrderRootType, VirtualFile[]>();
|
||||
Map<OrderRootType, String[]> configuredRoots = new HashMap<OrderRootType, String[]>();
|
||||
|
||||
for (OrderRootType type : OrderRootType.getAllTypes()) {
|
||||
configuredRoots.put(type, sdkModificator.getRoots(type));
|
||||
final VirtualFile[] oldRoots = sdkModificator.getRoots(type);
|
||||
final String[] oldRootPaths = new String[oldRoots.length];
|
||||
|
||||
for (int i = 0; i < oldRootPaths.length; i++) {
|
||||
oldRootPaths[i] = oldRoots[i].getPath();
|
||||
}
|
||||
|
||||
configuredRoots.put(type, oldRootPaths);
|
||||
}
|
||||
|
||||
for (OrderRoot root : roots) {
|
||||
@@ -87,8 +94,8 @@ class AndroidSdkConfigurableForm {
|
||||
sdkModificator.removeRoot(root.getFile(), root.getType());
|
||||
}
|
||||
else {
|
||||
VirtualFile[] configuredRootsForType = configuredRoots.get(root.getType());
|
||||
if (ArrayUtil.find(configuredRootsForType, root.getFile()) == -1) {
|
||||
String[] configuredRootsForType = configuredRoots.get(root.getType());
|
||||
if (ArrayUtil.find(configuredRootsForType, root.getFile().getPath()) == -1) {
|
||||
sdkModificator.addRoot(root.getFile(), root.getType());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -455,12 +455,15 @@ public class AndroidUtils {
|
||||
LOG.info(commandLine.getCommandLineString());
|
||||
OSProcessHandler handler = new OSProcessHandler(commandLine.createProcess(), "");
|
||||
|
||||
final StringBuffer buffer = new StringBuffer();
|
||||
final ProcessAdapter listener = new ProcessAdapter() {
|
||||
public void onTextAvailable(final ProcessEvent event, final Key outputType) {
|
||||
buffer.append(event.getText());
|
||||
}
|
||||
};
|
||||
|
||||
if (timeout == null || timeout > 0) {
|
||||
handler.addProcessListener(new ProcessAdapter() {
|
||||
public void onTextAvailable(final ProcessEvent event, final Key outputType) {
|
||||
messageBuilder.append(event.getText());
|
||||
}
|
||||
});
|
||||
handler.addProcessListener(listener);
|
||||
}
|
||||
|
||||
handler.startNotify();
|
||||
@@ -483,7 +486,9 @@ public class AndroidUtils {
|
||||
}
|
||||
|
||||
if (timeout == null || timeout > 0) {
|
||||
String message = messageBuilder.toString();
|
||||
handler.removeProcessListener(listener);
|
||||
final String message = buffer.toString();
|
||||
messageBuilder.append(message);
|
||||
LOG.info(message);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
@@ -116,9 +115,7 @@ public class AndroidLayoutDomTest extends AndroidDomTest {
|
||||
|
||||
public void testResourceCompletion() throws Throwable {
|
||||
doTestCompletionVariants("av3.xml", "@color/", "@android:", "@drawable/");
|
||||
List<String> list = getAllResources();
|
||||
list.add("@android:");
|
||||
doTestCompletionVariants("av8.xml", ArrayUtil.toStringArray(list));
|
||||
doTestCompletionVariants("av8.xml", "@android:", "@anim/", "@color/", "@dimen/", "@drawable/", "@id/", "@layout/", "@string/", "@style/");
|
||||
}
|
||||
|
||||
public void testLocalResourceCompletion1() throws Throwable {
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
package org.jetbrains.android.dom;
|
||||
|
||||
import com.android.sdklib.SdkConstants;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import org.jetbrains.android.inspections.AndroidUnknownAttributeInspection;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author coyote
|
||||
*/
|
||||
@@ -73,9 +70,7 @@ public class AndroidManifestDomTest extends AndroidDomTest {
|
||||
}
|
||||
|
||||
public void testResourceCompletion3() throws Throwable {
|
||||
List<String> list = getAllResources();
|
||||
list.add("@android:");
|
||||
doTestCompletionVariants("av4.xml", ArrayUtil.toStringArray(list));
|
||||
doTestCompletionVariants("av4.xml", "@android:", "@anim/", "@color/", "@dimen/", "@drawable/", "@id/", "@string/", "@style/");
|
||||
}
|
||||
|
||||
public void testTagNameCompletion1() throws Throwable {
|
||||
|
||||
@@ -156,7 +156,7 @@ abstract class GitBranchOperation {
|
||||
UIUtil.invokeAndWaitIfNeeded(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String description = "<html>" + message + ".<br/>" + getRollbackProposal() + "</html>";
|
||||
String description = "<html>" + message + "<br/>" + getRollbackProposal() + "</html>";
|
||||
ok.set(Messages.OK ==
|
||||
MessageManager.showYesNoDialog(myProject, description, title, "Rollback", "Don't rollback", Messages.getErrorIcon()));
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ class GitDeleteBranchOperation extends GitBranchOperation {
|
||||
}
|
||||
}
|
||||
else {
|
||||
fatalError(getErrorTitle(), "This branch is not fully merged to " + myCurrentBranch);
|
||||
fatalError(getErrorTitle(), "This branch is not fully merged to " + myCurrentBranch + ".");
|
||||
fatalErrorHappened = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ public class UsersFilterAction extends BasePopupAction {
|
||||
}
|
||||
|
||||
private String getMeText(final String name) {
|
||||
return new StringBuilder().append("me ( ").append(name).append(" )").toString();
|
||||
return "me ( " + name + " )";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package git4idea.repo;
|
||||
|
||||
import git4idea.GitBranch;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
@@ -30,7 +31,12 @@ public class GitBranchTrackInfo {
|
||||
GitBranchTrackInfo(@NotNull String branch, @NotNull GitRemote remote, @NotNull String remoteBranch, boolean merge) {
|
||||
myBranch = branch;
|
||||
myMerge = merge;
|
||||
myRemoteBranch = remoteBranch;
|
||||
if (remoteBranch.startsWith(GitBranch.REFS_HEADS_PREFIX)) {
|
||||
myRemoteBranch = remoteBranch.substring(GitBranch.REFS_HEADS_PREFIX.length());
|
||||
}
|
||||
else {
|
||||
myRemoteBranch = remoteBranch;
|
||||
}
|
||||
myRemote = remote;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,11 +19,9 @@ import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.components.AbstractProjectComponent;
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.*;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.vcs.ProjectLevelVcsManager;
|
||||
import com.intellij.openapi.vcs.VcsListener;
|
||||
import com.intellij.openapi.vfs.VfsUtilCore;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import git4idea.GitVcs;
|
||||
@@ -48,7 +46,6 @@ public final class GitRepositoryManager extends AbstractProjectComponent impleme
|
||||
private final Set<GitRepositoryChangeListener> myListeners = new HashSet<GitRepositoryChangeListener>();
|
||||
|
||||
private final ReentrantReadWriteLock REPO_LOCK = new ReentrantReadWriteLock();
|
||||
private final ProjectFileIndex myFileIndex;
|
||||
|
||||
public static GitRepositoryManager getInstance(@NotNull Project project) {
|
||||
return ServiceManager.getService(project, GitRepositoryManager.class);
|
||||
@@ -59,7 +56,6 @@ public final class GitRepositoryManager extends AbstractProjectComponent impleme
|
||||
myVcsManager = ProjectLevelVcsManager.getInstance(myProject);
|
||||
myVcs = GitVcs.getInstance(myProject);
|
||||
assert myVcs != null;
|
||||
myFileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -103,53 +99,11 @@ public final class GitRepositoryManager extends AbstractProjectComponent impleme
|
||||
*/
|
||||
@Nullable
|
||||
public GitRepository getRepositoryForFile(@NotNull VirtualFile file) {
|
||||
final VirtualFile vcsRoot = getVcsRootFor(file);
|
||||
final VirtualFile vcsRoot = myVcsManager.getVcsRootFor(file);
|
||||
if (vcsRoot == null) { return null; }
|
||||
return getRepositoryForRoot(vcsRoot);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private VirtualFile getVcsRootFor(@NotNull VirtualFile file) {
|
||||
if (myFileIndex.isInLibrarySource(file) || myFileIndex.isInLibraryClasses(file)) {
|
||||
return getVcsRootForLibraryFile(file);
|
||||
}
|
||||
return myVcsManager.getVcsRootFor(file);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private VirtualFile getVcsRootForLibraryFile(@NotNull VirtualFile file) {
|
||||
// for a file inside .jar/.zip consider the .jar/.zip file itself
|
||||
VirtualFile root = myVcsManager.getVcsRootFor(VfsUtilCore.getVirtualFileForJar(file));
|
||||
if (root != null) {
|
||||
return root;
|
||||
}
|
||||
|
||||
// for other libs which don't have jars inside the project dir (such as JDK) take the owner module of the lib
|
||||
List<OrderEntry> entries = myFileIndex.getOrderEntriesForFile(file);
|
||||
Set<VirtualFile> libraryRoots = new HashSet<VirtualFile>();
|
||||
for (OrderEntry entry : entries) {
|
||||
if (entry instanceof LibraryOrderEntry || entry instanceof JdkOrderEntry) {
|
||||
libraryRoots.add(myVcsManager.getVcsRootFor(entry.getOwnerModule().getModuleFile()));
|
||||
}
|
||||
}
|
||||
|
||||
if (libraryRoots.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// if the lib is used in several modules, take the top module
|
||||
// (for modules of the same level we can't guess anything => take the first one)
|
||||
Iterator<VirtualFile> libIterator = libraryRoots.iterator();
|
||||
VirtualFile topLibraryRoot = libIterator.next();
|
||||
while (libIterator.hasNext()) {
|
||||
VirtualFile libRoot = libIterator.next();
|
||||
if (VfsUtilCore.isAncestor(libRoot, topLibraryRoot, true)) {
|
||||
topLibraryRoot = libRoot;
|
||||
}
|
||||
}
|
||||
return topLibraryRoot;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return all repositories tracked by the manager.
|
||||
*/
|
||||
|
||||
@@ -185,7 +185,18 @@ class GitBranchPopupActions {
|
||||
myRepositories = repositories;
|
||||
myBranchName = branchName;
|
||||
mySelectedRepository = selectedRepository;
|
||||
getTemplatePresentation().setText(myBranchName, false); // no mnemonics
|
||||
getTemplatePresentation().setText(calcBranchText(), false); // no mnemonics
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private String calcBranchText() {
|
||||
String trackedBranch = new GitMultiRootBranchConfig(myRepositories).getTrackedBranch(myBranchName);
|
||||
if (trackedBranch != null) {
|
||||
return myBranchName + " -> " + trackedBranch;
|
||||
}
|
||||
else {
|
||||
return myBranchName;
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.intellij.openapi.fileEditor.FileEditor;
|
||||
import com.intellij.openapi.fileEditor.FileEditorManager;
|
||||
import com.intellij.openapi.fileEditor.TextEditor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.*;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.vcs.AbstractVcs;
|
||||
import com.intellij.openapi.vcs.ProjectLevelVcsManager;
|
||||
@@ -41,7 +42,7 @@ import org.intellij.images.editor.ImageFileEditor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* UI Utilities specific for Git branch features.
|
||||
@@ -165,11 +166,57 @@ public class GitBranchUiUtil {
|
||||
GitRepositoryManager manager = GitRepositoryManager.getInstance(project);
|
||||
VirtualFile file = getSelectedFile(project);
|
||||
if (file != null) {
|
||||
return manager.getRepositoryForFile(file);
|
||||
return manager.getRepositoryForRoot(getVcsRootFor(project, file));
|
||||
}
|
||||
return manager.getRepositoryForRoot(guessGitRoot(project));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static VirtualFile getVcsRootFor(@NotNull Project project, @NotNull VirtualFile file) {
|
||||
ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
|
||||
if (fileIndex.isInLibrarySource(file) || fileIndex.isInLibraryClasses(file)) {
|
||||
return getVcsRootForLibraryFile(project, file);
|
||||
}
|
||||
return ProjectLevelVcsManager.getInstance(project).getVcsRootFor(file);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static VirtualFile getVcsRootForLibraryFile(@NotNull Project project, @NotNull VirtualFile file) {
|
||||
ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(project);
|
||||
// for a file inside .jar/.zip consider the .jar/.zip file itself
|
||||
VirtualFile root = vcsManager.getVcsRootFor(VfsUtilCore.getVirtualFileForJar(file));
|
||||
if (root != null) {
|
||||
return root;
|
||||
}
|
||||
|
||||
// for other libs which don't have jars inside the project dir (such as JDK) take the owner module of the lib
|
||||
List<OrderEntry> entries = ProjectRootManager.getInstance(project).getFileIndex().getOrderEntriesForFile(file);
|
||||
Set<VirtualFile> libraryRoots = new HashSet<VirtualFile>();
|
||||
for (OrderEntry entry : entries) {
|
||||
if (entry instanceof LibraryOrderEntry || entry instanceof JdkOrderEntry) {
|
||||
libraryRoots.add(vcsManager.getVcsRootFor(entry.getOwnerModule().getModuleFile()));
|
||||
}
|
||||
}
|
||||
|
||||
if (libraryRoots.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// if the lib is used in several modules, take the top module
|
||||
// (for modules of the same level we can't guess anything => take the first one)
|
||||
Iterator<VirtualFile> libIterator = libraryRoots.iterator();
|
||||
VirtualFile topLibraryRoot = libIterator.next();
|
||||
while (libIterator.hasNext()) {
|
||||
VirtualFile libRoot = libIterator.next();
|
||||
if (VfsUtilCore.isAncestor(libRoot, topLibraryRoot, true)) {
|
||||
topLibraryRoot = libRoot;
|
||||
}
|
||||
}
|
||||
return topLibraryRoot;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Nullable
|
||||
private static VirtualFile guessGitRoot(@NotNull Project project) {
|
||||
ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(project);
|
||||
|
||||
@@ -41,7 +41,7 @@ public class GitBranchesAction extends DumbAwareAction {
|
||||
VirtualFile file = e.getData(PlatformDataKeys.VIRTUAL_FILE);
|
||||
GitRepository repository = (file == null ?
|
||||
GitBranchUiUtil.getCurrentRepository(project):
|
||||
repositoryManager.getRepositoryForFile(file));
|
||||
repositoryManager.getRepositoryForRoot(GitBranchUiUtil.getVcsRootFor(project,file)));
|
||||
if (repository == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -15,9 +15,11 @@
|
||||
*/
|
||||
package git4idea.ui.branch;
|
||||
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import git4idea.GitBranch;
|
||||
import git4idea.GitUtil;
|
||||
import git4idea.branch.GitBranchesCollection;
|
||||
import git4idea.repo.GitBranchTrackInfo;
|
||||
import git4idea.repo.GitRepository;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -81,7 +83,42 @@ public class GitMultiRootBranchConfig {
|
||||
@NotNull
|
||||
Collection<String> getRemoteBranches() {
|
||||
return getCommonBranches(false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If there is a common remote branch which is commonly tracked by the given branch in all repositories,
|
||||
* returns the name of this remote branch. Otherwise returns null. <br/>
|
||||
* For one repository just returns the tracked branch or null if there is no tracked branch.
|
||||
*/
|
||||
@Nullable
|
||||
public String getTrackedBranch(@NotNull String branch) {
|
||||
String trackedBranch = null;
|
||||
String trackedRemote = null;
|
||||
for (GitRepository repository : myRepositories) {
|
||||
Pair<String, String> tracked = getTrackedBranchAndRemote(repository, branch);
|
||||
if (tracked == null) {
|
||||
return null;
|
||||
}
|
||||
if (trackedBranch == null) {
|
||||
trackedBranch = tracked.getFirst();
|
||||
trackedRemote = tracked.getSecond();
|
||||
}
|
||||
else if (!tracked.getFirst().equals(trackedBranch) || !tracked.getSecond().equals(trackedRemote)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return trackedRemote + "/" + trackedBranch;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static Pair<String, String> getTrackedBranchAndRemote(@NotNull GitRepository repository, @NotNull String branch) {
|
||||
for (GitBranchTrackInfo trackInfo : repository.getConfig().getBranchTrackInfos()) {
|
||||
if (trackInfo.getBranch().equals(branch)) {
|
||||
return Pair.create(trackInfo.getRemoteBranch(), trackInfo.getRemote().getName());
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private Collection<String> getCommonBranches(boolean local) {
|
||||
@@ -106,4 +143,5 @@ public class GitMultiRootBranchConfig {
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+47
-35
@@ -89,12 +89,13 @@ public class MavenPluginConfigurationDomExtender extends DomExtender<MavenDomCon
|
||||
String name = eachParameter.getName().getStringValue();
|
||||
if (name == null) continue;
|
||||
|
||||
if (namesWithParameters.containsKey(name)) continue;
|
||||
|
||||
ParameterData data = new ParameterData(eachParameter);
|
||||
fillParameterData(name, data, eachMojo);
|
||||
|
||||
namesWithParameters.put(name, data);
|
||||
ParameterData oldParameter = namesWithParameters.get(name);
|
||||
if (oldParameter == null || hasMorePriority(data, oldParameter, executionElement != null)) {
|
||||
namesWithParameters.put(name, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -102,6 +103,16 @@ public class MavenPluginConfigurationDomExtender extends DomExtender<MavenDomCon
|
||||
return namesWithParameters.values();
|
||||
}
|
||||
|
||||
private static boolean hasMorePriority(ParameterData d1, ParameterData d2, boolean isForExecutionSection) {
|
||||
if (!isForExecutionSection) {
|
||||
if (StringUtil.isEmptyOrSpaces(d1.getMojo().getPhase().getStringValue())) return false;
|
||||
|
||||
if (StringUtil.isEmptyOrSpaces(d2.getMojo().getPhase().getStringValue())) return true;
|
||||
}
|
||||
|
||||
return d1.getRequiringLevel() > d2.getRequiringLevel();
|
||||
}
|
||||
|
||||
private static void fillParameterData(String name, ParameterData data, MavenDomMojo mojo) {
|
||||
XmlTag config = mojo.getConfiguration().getXmlTag();
|
||||
if (config == null) return;
|
||||
@@ -153,15 +164,27 @@ public class MavenPluginConfigurationDomExtender extends DomExtender<MavenDomCon
|
||||
}
|
||||
}
|
||||
|
||||
private static void addRequiredAnnotation(DomExtension e, ParameterData data) {
|
||||
if (!StringUtil.isEmptyOrSpaces(data.defaultValue)
|
||||
|| !StringUtil.isEmptyOrSpaces(data.expression)) {
|
||||
return;
|
||||
}
|
||||
private static void addRequiredAnnotation(DomExtension e, final ParameterData data) {
|
||||
if (Boolean.parseBoolean(data.parameter.getRequired().getStringValue())) {
|
||||
e.addCustomAnnotation(new Required(){
|
||||
@Override
|
||||
public boolean value() {
|
||||
return StringUtil.isEmptyOrSpaces(data.defaultValue) && StringUtil.isEmptyOrSpaces(data.expression);
|
||||
}
|
||||
|
||||
final String required = data.parameter.getRequired().getStringValue();
|
||||
if (!StringUtil.isEmptyOrSpaces(required)) {
|
||||
e.addCustomAnnotation(new MyRequired(required));
|
||||
@Override
|
||||
public boolean nonEmpty() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean identifier() {
|
||||
return false;
|
||||
}
|
||||
public Class<? extends Annotation> annotationType() {
|
||||
return Required.class;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,43 +204,32 @@ public class MavenPluginConfigurationDomExtender extends DomExtender<MavenDomCon
|
||||
String type = parameter.getType().getStringValue();
|
||||
if (type.endsWith("[]")) return true;
|
||||
|
||||
List<String> collectionClasses = Arrays.asList("java.util.List",
|
||||
"java.util.Set",
|
||||
"java.util.Collection");
|
||||
return collectionClasses.contains(type);
|
||||
return type.equals("java.util.List") || type.equals("java.util.Set") || type.equals("java.util.Collection");
|
||||
}
|
||||
|
||||
public static class ParameterData {
|
||||
public MavenDomParameter parameter;
|
||||
public final MavenDomParameter parameter;
|
||||
public @Nullable String defaultValue;
|
||||
public @Nullable String expression;
|
||||
|
||||
private ParameterData(MavenDomParameter parameter) {
|
||||
this.parameter = parameter;
|
||||
}
|
||||
}
|
||||
|
||||
private static class MyRequired implements Required {
|
||||
private final String myRequired;
|
||||
|
||||
public MyRequired(String required) {
|
||||
myRequired = required;
|
||||
|
||||
@NotNull
|
||||
public MavenDomMojo getMojo() {
|
||||
return (MavenDomMojo)parameter.getParent().getParent();
|
||||
}
|
||||
|
||||
public boolean value() {
|
||||
return Boolean.valueOf(myRequired);
|
||||
}
|
||||
public int getRequiringLevel() {
|
||||
if (!Boolean.parseBoolean(parameter.getRequired().getStringValue())) return 0;
|
||||
|
||||
public boolean nonEmpty() {
|
||||
return false;
|
||||
}
|
||||
if (!StringUtil.isEmptyOrSpaces(defaultValue) || !StringUtil.isEmptyOrSpaces(expression)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public boolean identifier() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public Class<? extends Annotation> annotationType() {
|
||||
return Required.class;
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,6 +23,9 @@ public interface MavenDomMojo extends MavenDomElement {
|
||||
@NotNull
|
||||
GenericDomValue<String> getGoal();
|
||||
|
||||
@NotNull
|
||||
GenericDomValue<String> getPhase();
|
||||
|
||||
@NotNull
|
||||
MavenDomParameters getParameters();
|
||||
|
||||
|
||||
+2
-2
@@ -31,6 +31,7 @@ import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.PlatformIcons;
|
||||
import com.intellij.util.containers.CollectionFactory;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.xml.DomElement;
|
||||
import com.intellij.util.xml.DomUtil;
|
||||
@@ -51,13 +52,12 @@ import org.jetbrains.idea.maven.vfs.MavenPropertiesVirtualFileSystem;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class MavenPropertyPsiReference extends MavenPsiReference {
|
||||
private static final Set<String> BASEDIR_PROPS =
|
||||
new THashSet<String>(Arrays.asList("basedir", "project.basedir", "pom.basedir", "baseUri", "project.baseUri", "pom.baseUri"));
|
||||
CollectionFactory.newTroveSet("basedir", "project.basedir", "pom.basedir", "baseUri", "project.baseUri", "pom.baseUri");
|
||||
|
||||
private static final String TIMESTAMP_PROP = "maven.build.timestamp";
|
||||
|
||||
|
||||
@@ -896,25 +896,23 @@ public class MavenProject {
|
||||
|
||||
MavenProjectChanges result = new MavenProjectChanges();
|
||||
|
||||
result.packaging |= !Comparing.equal(myPackaging, other.myPackaging);
|
||||
result.packaging = !Comparing.equal(myPackaging, other.myPackaging);
|
||||
|
||||
result.output |= !Comparing.equal(myFinalName, other.myFinalName);
|
||||
result.output |= !Comparing.equal(myBuildDirectory, other.myBuildDirectory);
|
||||
result.output |= !Comparing.equal(myOutputDirectory, other.myOutputDirectory);
|
||||
result.output |= !Comparing.equal(myTestOutputDirectory, other.myTestOutputDirectory);
|
||||
result.output = !Comparing.equal(myFinalName, other.myFinalName)
|
||||
|| !Comparing.equal(myBuildDirectory, other.myBuildDirectory)
|
||||
|| !Comparing.equal(myOutputDirectory, other.myOutputDirectory)
|
||||
|| !Comparing.equal(myTestOutputDirectory, other.myTestOutputDirectory);
|
||||
|
||||
result.sources |= !Comparing.equal(mySources, other.mySources);
|
||||
result.sources |= !Comparing.equal(myTestSources, other.myTestSources);
|
||||
result.sources |= !Comparing.equal(myResources, other.myResources);
|
||||
result.sources |= !Comparing.equal(myTestResources, other.myTestResources);
|
||||
result.sources = !Comparing.equal(mySources, other.mySources)
|
||||
|| !Comparing.equal(myTestSources, other.myTestSources)
|
||||
|| !Comparing.equal(myResources, other.myResources)
|
||||
|| !Comparing.equal(myTestResources, other.myTestResources);
|
||||
|
||||
boolean repositoryChanged = !Comparing.equal(myLocalRepository, other.myLocalRepository);
|
||||
|
||||
result.dependencies |= repositoryChanged;
|
||||
result.dependencies |= !Comparing.equal(myDependencies, other.myDependencies);
|
||||
result.dependencies = repositoryChanged || !Comparing.equal(myDependencies, other.myDependencies);
|
||||
|
||||
result.plugins |= repositoryChanged;
|
||||
result.plugins |= !Comparing.equal(myPlugins, other.myPlugins);
|
||||
result.plugins = repositoryChanged || !Comparing.equal(myPlugins, other.myPlugins);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
+1
@@ -0,0 +1 @@
|
||||
4d0907396ac6a770e05c81f6e8ed6348740f86a0
|
||||
+203
@@ -0,0 +1,203 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you 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.
|
||||
-->
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<artifactId>maven-plugins</artifactId>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<version>19</version>
|
||||
<relativePath>../maven-plugins/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>2.5</version>
|
||||
<packaging>maven-plugin</packaging>
|
||||
|
||||
<name>Maven Resources Plugin</name>
|
||||
<description>
|
||||
The Resources Plugin handles the copying of project resources to the output
|
||||
directory. There are two different kinds of resources: main resources and test resources. The
|
||||
difference is that the main resources are the resources associated to the main
|
||||
source code while the test resources are associated to the test source code.
|
||||
Thus, this allows the separation of resources for the main source code and its
|
||||
unit tests.
|
||||
</description>
|
||||
<inceptionYear>2001</inceptionYear>
|
||||
|
||||
<prerequisites>
|
||||
<maven>${mavenVersion}</maven>
|
||||
</prerequisites>
|
||||
|
||||
<scm>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/maven/plugins/tags/maven-resources-plugin-2.5</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/maven/plugins/tags/maven-resources-plugin-2.5</developerConnection>
|
||||
<url>http://svn.apache.org/viewvc/maven/plugins/tags/maven-resources-plugin-2.5</url>
|
||||
</scm>
|
||||
<issueManagement>
|
||||
<system>JIRA</system>
|
||||
<url>http://jira.codehaus.org/browse/MRESOURCES</url>
|
||||
</issueManagement>
|
||||
|
||||
<properties>
|
||||
<mavenFilteringVersion>1.0</mavenFilteringVersion>
|
||||
<mavenVersion>2.0.6</mavenVersion>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-api</artifactId>
|
||||
<version>${mavenVersion}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-project</artifactId>
|
||||
<version>${mavenVersion}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-core</artifactId>
|
||||
<version>${mavenVersion}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-artifact</artifactId>
|
||||
<version>${mavenVersion}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-settings</artifactId>
|
||||
<version>${mavenVersion}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-model</artifactId>
|
||||
<version>${mavenVersion}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-monitor</artifactId>
|
||||
<version>${mavenVersion}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-container-default</artifactId>
|
||||
<version>1.0-alpha-9-stable-1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-utils</artifactId>
|
||||
<version>2.0.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.shared</groupId>
|
||||
<artifactId>maven-filtering</artifactId>
|
||||
<version>${mavenFilteringVersion}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-interpolation</artifactId>
|
||||
<version>1.13</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.shared</groupId>
|
||||
<artifactId>maven-plugin-testing-harness</artifactId>
|
||||
<version>1.0-beta-1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>1.4</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>run-its</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>test-jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>test-descriptor</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-invoker-plugin</artifactId>
|
||||
<configuration>
|
||||
<debug>true</debug>
|
||||
<projectsDirectory>src/it</projectsDirectory>
|
||||
<pomIncludes>
|
||||
<pomInclude>**/pom.xml</pomInclude>
|
||||
</pomIncludes>
|
||||
<postBuildHookScript>verify</postBuildHookScript>
|
||||
<localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
|
||||
<goals>
|
||||
<goal>clean</goal>
|
||||
<goal>process-test-resources</goal>
|
||||
</goals>
|
||||
<settingsFile>src/it/settings.xml</settingsFile>
|
||||
<cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
|
||||
<properties>
|
||||
<execProps>fromExecProps</execProps>
|
||||
</properties>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>integration-test</id>
|
||||
<goals>
|
||||
<goal>install</goal>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
||||
+1
@@ -0,0 +1 @@
|
||||
2d44c4a29ea56775c87002edb5aa23aab47e71ac
|
||||
+2
-1
@@ -65,7 +65,7 @@ public class MavenExtensionCompletionAndResolutionTest extends MavenDomWithIndic
|
||||
" </extensions>" +
|
||||
"</build>");
|
||||
|
||||
assertCompletionVariants(myProjectPom, "maven-compiler-plugin", "maven-war-plugin", "maven-eclipse-plugin", "maven-surefire-plugin");
|
||||
assertCompletionVariants(myProjectPom, "maven-compiler-plugin", "maven-war-plugin", "maven-eclipse-plugin", "maven-surefire-plugin", "maven-resources-plugin");
|
||||
}
|
||||
|
||||
public void testArtifactWithoutGroupCompletion() throws Exception {
|
||||
@@ -86,6 +86,7 @@ public class MavenExtensionCompletionAndResolutionTest extends MavenDomWithIndic
|
||||
"maven-war-plugin",
|
||||
"maven-surefire-plugin",
|
||||
"build-helper-maven-plugin",
|
||||
"maven-resources-plugin",
|
||||
"maven-eclipse-plugin");
|
||||
}
|
||||
|
||||
|
||||
+57
-1
@@ -71,7 +71,7 @@ public class MavenPluginCompletionAndResolutionTest extends MavenDomWithIndicesT
|
||||
" </plugins>" +
|
||||
"</build>");
|
||||
|
||||
assertCompletionVariants(myProjectPom, "maven-compiler-plugin", "maven-war-plugin", "maven-surefire-plugin", "maven-eclipse-plugin");
|
||||
assertCompletionVariants(myProjectPom, "maven-compiler-plugin", "maven-war-plugin", "maven-surefire-plugin", "maven-eclipse-plugin", "maven-resources-plugin");
|
||||
}
|
||||
|
||||
public void testArtifactWithoutGroupCompletion() throws Exception {
|
||||
@@ -92,6 +92,7 @@ public class MavenPluginCompletionAndResolutionTest extends MavenDomWithIndicesT
|
||||
"maven-war-plugin",
|
||||
"build-helper-maven-plugin",
|
||||
"maven-surefire-plugin",
|
||||
"maven-resources-plugin",
|
||||
"maven-eclipse-plugin");
|
||||
}
|
||||
|
||||
@@ -902,4 +903,59 @@ public class MavenPluginCompletionAndResolutionTest extends MavenDomWithIndicesT
|
||||
|
||||
assertCompletionVariants(myProjectPom);
|
||||
}
|
||||
|
||||
public void testRequiringParameter() throws Throwable {
|
||||
createProjectPom("<groupId>test</groupId>" +
|
||||
"<artifactId>project</artifactId>" +
|
||||
"<version>1</version>" +
|
||||
|
||||
"<build>" +
|
||||
" <plugins>" +
|
||||
" <plugin>\n" +
|
||||
" <artifactId>maven-resources-plugin</artifactId>\n" +
|
||||
" <configuration>\n" +
|
||||
" <<error descr=\"Value must not be empty\">outputDirectory</error>/>\n" +
|
||||
" </configuration>\n" +
|
||||
" </plugin>\n" +
|
||||
|
||||
" <plugin>\n" +
|
||||
" <artifactId>maven-resources-plugin</artifactId>\n" +
|
||||
"" +
|
||||
" <configuration>\n" +
|
||||
" <outputDirectory>aaa</outputDirectory>\n" +
|
||||
" </configuration>\n" +
|
||||
" </plugin>\n" +
|
||||
|
||||
" <plugin>\n" +
|
||||
" <artifactId>maven-resources-plugin</artifactId>\n" +
|
||||
"" +
|
||||
" <configuration>\n" +
|
||||
" </configuration>\n" +
|
||||
" </plugin>\n" +
|
||||
|
||||
" <plugin>\n" +
|
||||
" <artifactId>maven-resources-plugin</artifactId>\n" +
|
||||
" <executions>" +
|
||||
" <execution>" +
|
||||
" <goals> " +
|
||||
" <goal>copy-resources</goal>" +
|
||||
" <goal>resources</goal>" +
|
||||
" </goals> " +
|
||||
" <<error descr=\"'outputDirectory' child tag should be defined\">configuration</error>>\n" +
|
||||
" </configuration>\n" +
|
||||
" " +
|
||||
" </execution>" +
|
||||
" </executions>" +
|
||||
"" +
|
||||
" <configuration>\n" +
|
||||
" </configuration>\n" +
|
||||
" </plugin>\n" +
|
||||
|
||||
|
||||
" </plugins>" +
|
||||
"</build>");
|
||||
|
||||
checkHighlighting();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -81,8 +81,7 @@ public class UpgradeFormatDialog extends DialogWrapper {
|
||||
}
|
||||
|
||||
protected String getTopMessage(final String label) {
|
||||
return SvnBundle.message(new StringBuilder().append("label.configure.").append(label).append(".label").toString(),
|
||||
ApplicationNamesInfo.getInstance().getFullProductName());
|
||||
return SvnBundle.message("label.configure." + label + ".label", ApplicationNamesInfo.getInstance().getFullProductName());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -113,11 +112,11 @@ public class UpgradeFormatDialog extends DialogWrapper {
|
||||
panel.add(topLabel, gb);
|
||||
gb.gridy += 1;
|
||||
|
||||
myUpgradeNoneButton = new JRadioButton(SvnBundle.message(new StringBuilder().append("radio.configure.").append(label).append(".none").toString()));
|
||||
myUpgradeAutoButton = new JRadioButton(SvnBundle.message(new StringBuilder().append("radio.configure.").append(label).append(".auto").toString()));
|
||||
myUpgradeAuto15Button = new JRadioButton(SvnBundle.message(new StringBuilder().append("radio.configure.").append(label).append(".auto.15format").toString()));
|
||||
myUpgradeAuto16Button = new JRadioButton(SvnBundle.message(new StringBuilder().append("radio.configure.").append(label).append(".auto.16format").toString()));
|
||||
myUpgradeAuto17Button = new JRadioButton(SvnBundle.message(new StringBuilder().append("radio.configure.").append(label).append(".auto.17format").toString()));
|
||||
myUpgradeNoneButton = new JRadioButton(SvnBundle.message("radio.configure." + label + ".none"));
|
||||
myUpgradeAutoButton = new JRadioButton(SvnBundle.message("radio.configure." + label + ".auto"));
|
||||
myUpgradeAuto15Button = new JRadioButton(SvnBundle.message("radio.configure." + label + ".auto.15format"));
|
||||
myUpgradeAuto16Button = new JRadioButton(SvnBundle.message("radio.configure." + label + ".auto.16format"));
|
||||
myUpgradeAuto17Button = new JRadioButton(SvnBundle.message("radio.configure." + label + ".auto.17format"));
|
||||
|
||||
ButtonGroup group = new ButtonGroup();
|
||||
group.add(myUpgradeNoneButton);
|
||||
|
||||
@@ -78,8 +78,7 @@ public class UpgradeFormatDialog extends DialogWrapper {
|
||||
}
|
||||
|
||||
protected String getTopMessage(final String label) {
|
||||
return SvnBundle.message(new StringBuilder().append("label.configure.").append(label).append(".label").toString(),
|
||||
ApplicationNamesInfo.getInstance().getFullProductName());
|
||||
return SvnBundle.message("label.configure." + label + ".label", ApplicationNamesInfo.getInstance().getFullProductName());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -110,10 +109,10 @@ public class UpgradeFormatDialog extends DialogWrapper {
|
||||
panel.add(topLabel, gb);
|
||||
gb.gridy += 1;
|
||||
|
||||
myUpgradeNoneButton = new JRadioButton(SvnBundle.message(new StringBuilder().append("radio.configure.").append(label).append(".none").toString()));
|
||||
myUpgradeAutoButton = new JRadioButton(SvnBundle.message(new StringBuilder().append("radio.configure.").append(label).append(".auto").toString()));
|
||||
myUpgradeAuto15Button = new JRadioButton(SvnBundle.message(new StringBuilder().append("radio.configure.").append(label).append(".auto.15format").toString()));
|
||||
myUpgradeAuto16Button = new JRadioButton(SvnBundle.message(new StringBuilder().append("radio.configure.").append(label).append(".auto.16format").toString()));
|
||||
myUpgradeNoneButton = new JRadioButton(SvnBundle.message("radio.configure." + label + ".none"));
|
||||
myUpgradeAutoButton = new JRadioButton(SvnBundle.message("radio.configure." + label + ".auto"));
|
||||
myUpgradeAuto15Button = new JRadioButton(SvnBundle.message("radio.configure." + label + ".auto.15format"));
|
||||
myUpgradeAuto16Button = new JRadioButton(SvnBundle.message("radio.configure." + label + ".auto.16format"));
|
||||
|
||||
ButtonGroup group = new ButtonGroup();
|
||||
group.add(myUpgradeNoneButton);
|
||||
|
||||
@@ -500,7 +500,9 @@ public class XmlTagImpl extends XmlElementImpl implements XmlTag {
|
||||
final CharTable charTableByTree = SharedImplUtil.findCharTableByTree(tag);
|
||||
ASTNode child = XmlChildRole.START_TAG_NAME_FINDER.findChild(tag);
|
||||
LOG.assertTrue(child != null, "It seems '" + name + "' is not a valid tag name");
|
||||
tag.replaceChild(child, ChangeUtil.copyElement((TreeElement)XmlChildRole.START_TAG_NAME_FINDER.findChild(dummyTag), charTableByTree));
|
||||
TreeElement tagElement = (TreeElement)XmlChildRole.START_TAG_NAME_FINDER.findChild(dummyTag);
|
||||
LOG.assertTrue(tagElement != null, "What's wrong with it? '" + name + "'");
|
||||
tag.replaceChild(child, ChangeUtil.copyElement(tagElement, charTableByTree));
|
||||
final ASTNode childByRole = XmlChildRole.CLOSING_TAG_NAME_FINDER.findChild(tag);
|
||||
if (childByRole != null) {
|
||||
final TreeElement treeElement = (TreeElement)XmlChildRole.CLOSING_TAG_NAME_FINDER.findChild(dummyTag);
|
||||
|
||||
@@ -103,7 +103,9 @@ public class XmlElementDescriptorImpl implements XmlElementDescriptor, PsiWritab
|
||||
}
|
||||
|
||||
public String getNamespace(){
|
||||
final String namespacePrefix = XmlUtil.findPrefixByQualifiedName(getName(null));
|
||||
String name = getName();
|
||||
if (name == null) return XmlUtil.EMPTY_URI;
|
||||
final String namespacePrefix = XmlUtil.findPrefixByQualifiedName(name);
|
||||
final XmlNSDescriptorImpl xmlNSDescriptor = (XmlNSDescriptorImpl)getNSDescriptor();
|
||||
if(xmlNSDescriptor == null || myDescriptorTag == null) return XmlUtil.EMPTY_URI;
|
||||
return "".equals(namespacePrefix) ?
|
||||
|
||||
@@ -376,7 +376,12 @@ public class XmlUtil {
|
||||
public static char getCharFromEntityRef(@NonNls String text) {
|
||||
//LOG.assertTrue(text.startsWith("&#") && text.endsWith(";"));
|
||||
if (text.charAt(1) != '#') {
|
||||
text = text.substring(1, text.length() - 1);
|
||||
try {
|
||||
text = text.substring(1, text.length() - 1);
|
||||
}
|
||||
catch (StringIndexOutOfBoundsException e) {
|
||||
LOG.error("Cannot parse ref: '" + text + "'", e);
|
||||
}
|
||||
return XmlTagUtil.getCharacterByEntityName(text);
|
||||
}
|
||||
text = text.substring(2, text.length() - 1);
|
||||
@@ -1506,7 +1511,7 @@ public class XmlUtil {
|
||||
return contextTag.getNamespaceByPrefix(prefix);
|
||||
}
|
||||
|
||||
public static String findPrefixByQualifiedName(String name) {
|
||||
public static String findPrefixByQualifiedName(@NotNull String name) {
|
||||
final int prefixEnd = name.indexOf(':');
|
||||
if (prefixEnd > 0) {
|
||||
return name.substring(0, prefixEnd);
|
||||
|
||||
Reference in New Issue
Block a user