mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote branch 'origin/master'
This commit is contained in:
@@ -62,6 +62,7 @@ public class ExceptionWorker {
|
||||
}
|
||||
|
||||
public void execute(final String line, final int textEndOffset) {
|
||||
myResult = null;
|
||||
myInfo = parseExceptionLine(line);
|
||||
if (myInfo == null) {
|
||||
return;
|
||||
|
||||
@@ -147,7 +147,7 @@ public class Extensions {
|
||||
return getRootArea().getExtensionPoint(AREA_LISTENER_EXTENSION_POINT).getExtensions();
|
||||
}
|
||||
|
||||
public static void registerAreaClass(@NonNls String areaClass, @NonNls String parentAreaClass) {
|
||||
public static void registerAreaClass(@NonNls String areaClass, @Nullable @NonNls String parentAreaClass) {
|
||||
if (ourAreaClass2Configuration.containsKey(areaClass)) {
|
||||
// allow duplicate area class registrations if they are the same - fixing duplicate registration in tests is much more trouble
|
||||
AreaClassConfiguration configuration = ourAreaClass2Configuration.get(areaClass);
|
||||
|
||||
+39
-27
@@ -41,18 +41,21 @@ import java.beans.PropertyChangeListener;
|
||||
public abstract class ComboBoxAction extends AnAction implements CustomComponentAction {
|
||||
private static final Icon ARROW_ICON = IconLoader.getIcon("/general/comboArrow.png");
|
||||
private static final Icon DISABLED_ARROW_ICON = IconLoader.getDisabledIcon(ARROW_ICON);
|
||||
|
||||
|
||||
private boolean mySmallVariant = true;
|
||||
private DataContext myDataContext;
|
||||
|
||||
protected ComboBoxAction() { }
|
||||
protected ComboBoxAction() {
|
||||
}
|
||||
|
||||
public void actionPerformed(AnActionEvent e) { }
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
}
|
||||
|
||||
public JComponent createCustomComponent(Presentation presentation) {
|
||||
JPanel panel = new JPanel(new GridBagLayout());
|
||||
ComboBoxButton button = createComboBoxButton(presentation);
|
||||
panel.add(button, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 3, 0, 3), 0, 0));
|
||||
panel.add(button,
|
||||
new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 3, 0, 3), 0, 0));
|
||||
return panel;
|
||||
}
|
||||
|
||||
@@ -216,6 +219,7 @@ public abstract class ComboBoxAction extends AnAction implements CustomComponent
|
||||
@Override
|
||||
public void updateUI() {
|
||||
super.updateUI();
|
||||
//putClientProperty(SwingUtilities2.AA_TEXT_PROPERTY_KEY, null);
|
||||
if (UIUtil.isMotifLookAndFeel()) {
|
||||
setBorder(BorderFactory.createEtchedBorder());
|
||||
}
|
||||
@@ -293,25 +297,30 @@ public abstract class ComboBoxAction extends AnAction implements CustomComponent
|
||||
@Override
|
||||
protected void paintComponent(Graphics g) {
|
||||
final boolean isEmpty = getIcon() == null && StringUtil.isEmpty(getText());
|
||||
final Dimension size = getSize();
|
||||
final Dimension size = getSize();
|
||||
if (isSmallVariant()) {
|
||||
final Graphics2D g2 = (Graphics2D)g;
|
||||
final Graphics2D g2 = (Graphics2D)g;
|
||||
g2.setColor(UIUtil.getControlColor());
|
||||
final int w = getWidth();
|
||||
final int h = getHeight();
|
||||
if (getModel().isArmed() && getModel().isPressed()) {
|
||||
g2.setPaint(new GradientPaint(0,0, UIUtil.getControlColor(), 0, h, ColorUtil.shift(UIUtil.getControlColor(), 0.8)));
|
||||
} else {
|
||||
g2.setPaint(new GradientPaint(0,0, ColorUtil.shift(UIUtil.getControlColor(), 1.1), 0, h, ColorUtil.shift(UIUtil.getControlColor(), 0.9)));
|
||||
g2.setPaint(new GradientPaint(0, 0, UIUtil.getControlColor(), 0, h, ColorUtil.shift(UIUtil.getControlColor(), 0.8)));
|
||||
}
|
||||
g2.fillRect(2, 0, w-2, h);
|
||||
else {
|
||||
g2.setPaint(
|
||||
new GradientPaint(0, 0, ColorUtil.shift(UIUtil.getControlColor(), 1.1), 0, h, ColorUtil.shift(UIUtil.getControlColor(), 0.9)));
|
||||
}
|
||||
g2.fillRect(2, 0, w - 2, h);
|
||||
g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
|
||||
g2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
|
||||
if (!myMouseInside) {
|
||||
g2.setPaint(new GradientPaint(0,0, UIUtil.getBorderColor(), 0, h, UIUtil.getBorderColor().darker()));
|
||||
g2.setPaint(new GradientPaint(0, 0, UIUtil.getBorderColor(), 0, h, UIUtil.getBorderColor().darker()));
|
||||
//g2.setColor(UIUtil.getBorderColor());
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
g2.setPaint(new GradientPaint(0, 0, UIUtil.getBorderColor().darker(), 0, h, UIUtil.getBorderColor().darker().darker()));
|
||||
}
|
||||
g2.drawRect(2,0, w-3, h-1);
|
||||
g2.drawRect(2, 0, w - 3, h - 1);
|
||||
final Icon icon = getIcon();
|
||||
int x = 7;
|
||||
if (icon != null) {
|
||||
@@ -322,24 +331,27 @@ public abstract class ComboBoxAction extends AnAction implements CustomComponent
|
||||
final Font font = getFont();
|
||||
g2.setFont(font);
|
||||
g2.setColor(UIManager.getColor("Button.foreground"));
|
||||
g2.drawString(getText(), x, (size.height + font.getSize())/2 - 1);
|
||||
g2.drawString(getText(), x, (size.height + font.getSize()) / 2 - 1);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
super.paintComponent(g);
|
||||
}
|
||||
final Insets insets = super.getInsets();
|
||||
final Icon icon = isEnabled() ? ARROW_ICON : DISABLED_ARROW_ICON;
|
||||
final int x;
|
||||
if (isEmpty) {
|
||||
x = (size.width - icon.getIconWidth()) / 2;
|
||||
} else {
|
||||
if (isSmallVariant()) {
|
||||
x = size.width - icon.getIconWidth() - insets.right + 1;
|
||||
} else {
|
||||
x = size.width - icon.getIconWidth() - insets.right + (UIUtil.isUnderNimbusLookAndFeel() ? -3 : 2);
|
||||
}
|
||||
final Insets insets = super.getInsets();
|
||||
final Icon icon = isEnabled() ? ARROW_ICON : DISABLED_ARROW_ICON;
|
||||
final int x;
|
||||
if (isEmpty) {
|
||||
x = (size.width - icon.getIconWidth()) / 2;
|
||||
}
|
||||
else {
|
||||
if (isSmallVariant()) {
|
||||
x = size.width - icon.getIconWidth() - insets.right + 1;
|
||||
}
|
||||
icon.paintIcon(null, g, x, (size.height - icon.getIconHeight()) / 2);
|
||||
else {
|
||||
x = size.width - icon.getIconWidth() - insets.right + (UIUtil.isUnderNimbusLookAndFeel() ? -3 : 2);
|
||||
}
|
||||
}
|
||||
icon.paintIcon(null, g, x, (size.height - icon.getIconHeight()) / 2);
|
||||
}
|
||||
|
||||
private boolean isGlowSupported() {
|
||||
|
||||
@@ -59,6 +59,7 @@ public abstract class OptionalChooserComponent<T> implements CheckBoxListListene
|
||||
|
||||
private void createUIComponents() {
|
||||
myList = new CheckBoxList(this);
|
||||
myList.setBorder(null);
|
||||
myListModel = (DefaultListModel)myList.getModel();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.ui.PathsChooserComponent">
|
||||
<grid id="27dc6" binding="myContentPane" layout-manager="GridLayoutManager" row-count="3" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="591" height="247"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<vspacer id="e6d11">
|
||||
<constraints>
|
||||
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
<scrollpane id="837a" class="com.intellij.ui.components.JBScrollPane">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="3" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="8b3da" class="com.intellij.ui.components.JBList" binding="myList">
|
||||
<constraints/>
|
||||
<properties>
|
||||
<selectionMode value="0"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</scrollpane>
|
||||
<component id="360f6" class="javax.swing.JButton" binding="myAddButton" default-binding="true">
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text resource-bundle="messages/UIBundle" key="row.add"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="f80a3" class="javax.swing.JButton" binding="myRemoveButton" default-binding="true">
|
||||
<constraints>
|
||||
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text resource-bundle="messages/UIBundle" key="row.remove"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
@@ -28,8 +28,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -40,8 +38,6 @@ import java.util.List;
|
||||
public class PathsChooserComponent implements ComponentWithEmptyText {
|
||||
private JPanel myContentPane;
|
||||
private JBList myList;
|
||||
private JButton myAddButton;
|
||||
private JButton myRemoveButton;
|
||||
private final DefaultListModel myListModel;
|
||||
|
||||
private List<String> myWorkingCollection;
|
||||
@@ -55,18 +51,17 @@ public class PathsChooserComponent implements ComponentWithEmptyText {
|
||||
public PathsChooserComponent(@NotNull final List<String> collection,
|
||||
@NotNull final PathProcessor processor,
|
||||
@Nullable final Project project) {
|
||||
myList = new JBList();
|
||||
myList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||
myInitialCollection = collection;
|
||||
myProject = project;
|
||||
myWorkingCollection = new ArrayList<String>(myInitialCollection);
|
||||
myListModel = new DefaultListModel();
|
||||
myList.setModel(myListModel);
|
||||
|
||||
// fill list
|
||||
reset();
|
||||
|
||||
// listeners
|
||||
myAddButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
myContentPane = ToolbarDecorator.createDecorator(myList).disableUpDownActions().setAddAction(new AnActionButtonRunnable() {
|
||||
@Override
|
||||
public void run(AnActionButton button) {
|
||||
final FileChooserDescriptor dirChooser = FileChooserDescriptorFactory.createSingleFolderDescriptor();
|
||||
dirChooser.setShowFileSystemRoots(true);
|
||||
dirChooser.setHideIgnored(true);
|
||||
@@ -84,10 +79,9 @@ public class PathsChooserComponent implements ComponentWithEmptyText {
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
myRemoveButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
}).setRemoveAction(new AnActionButtonRunnable() {
|
||||
@Override
|
||||
public void run(AnActionButton button) {
|
||||
int selected = myList.getSelectedIndex();
|
||||
if (selected != -1) {
|
||||
// removing index
|
||||
@@ -97,7 +91,10 @@ public class PathsChooserComponent implements ComponentWithEmptyText {
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}).createPanel();
|
||||
|
||||
// fill list
|
||||
reset();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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.
|
||||
@@ -20,8 +20,6 @@ import com.intellij.ide.util.PropertiesComponent;
|
||||
import com.intellij.openapi.actionSystem.DataProvider;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.application.AccessToken;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.application.WriteAction;
|
||||
import com.intellij.openapi.diff.DiffRequest;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
@@ -271,31 +269,26 @@ public class VirtualFileDiffElement extends DiffElement<VirtualFile> {
|
||||
final FileDocumentManager manager = FileDocumentManager.getInstance();
|
||||
for (Document document : manager.getUnsavedDocuments()) {
|
||||
VirtualFile file = manager.getFile(document);
|
||||
if (file!=null && VfsUtilCore.isAncestor(virtualFile, file, false)) {
|
||||
if (file != null && VfsUtilCore.isAncestor(virtualFile, file, false)) {
|
||||
docsToSave.add(document);
|
||||
}
|
||||
}
|
||||
|
||||
if (!docsToSave.isEmpty()) {
|
||||
ApplicationManager.getApplication().invokeAndWait(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
AccessToken token = WriteAction.start();
|
||||
try {
|
||||
for (Document document : docsToSave) {
|
||||
manager.saveDocument(document);
|
||||
}
|
||||
}
|
||||
finally {
|
||||
token.finish();
|
||||
}
|
||||
AccessToken token = WriteAction.start();
|
||||
try {
|
||||
for (Document document : docsToSave) {
|
||||
manager.saveDocument(document);
|
||||
}
|
||||
}, ModalityState.defaultModalityState());
|
||||
}
|
||||
finally {
|
||||
token.finish();
|
||||
}
|
||||
}
|
||||
if (!FileWatcher.getInstance().isWatched(virtualFile)) {
|
||||
((NewVirtualFile)virtualFile).markDirtyRecursively();
|
||||
}
|
||||
virtualFile.refresh(true, true);
|
||||
}
|
||||
if (!FileWatcher.getInstance().isWatched(virtualFile)) {
|
||||
((NewVirtualFile)virtualFile).markDirtyRecursively();
|
||||
}
|
||||
virtualFile.refresh(false, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -358,7 +358,7 @@ public class PluginManager {
|
||||
//noinspection HardCodedStringLiteral
|
||||
final String pluginId = System.getProperty("idea.load.plugins.id");
|
||||
if (pluginId == null) {
|
||||
if (descriptor instanceof IdeaPluginDescriptorImpl && !((IdeaPluginDescriptorImpl)descriptor).isEnabled()) return true;
|
||||
if (descriptor instanceof IdeaPluginDescriptorImpl && !descriptor.isEnabled()) return true;
|
||||
|
||||
if (!shouldLoadPlugins()) return true;
|
||||
}
|
||||
@@ -443,7 +443,7 @@ public class PluginManager {
|
||||
}
|
||||
|
||||
public static boolean isIncompatible(final IdeaPluginDescriptor descriptor) {
|
||||
BuildNumber buildNumber = null;
|
||||
BuildNumber buildNumber;
|
||||
try {
|
||||
buildNumber = getBuildNumber();
|
||||
}
|
||||
@@ -614,7 +614,7 @@ public class PluginManager {
|
||||
final String pathProperty = System.getProperty(PROPERTY_PLUGIN_PATH);
|
||||
if (pathProperty == null) return;
|
||||
|
||||
for (java.util.StringTokenizer t = new java.util.StringTokenizer(pathProperty, File.pathSeparator); t.hasMoreTokens();) {
|
||||
for (StringTokenizer t = new StringTokenizer(pathProperty, File.pathSeparator); t.hasMoreTokens();) {
|
||||
String s = t.nextToken();
|
||||
final IdeaPluginDescriptorImpl ideaPluginDescriptor = loadDescriptor(new File(s), PLUGIN_XML);
|
||||
if (ideaPluginDescriptor != null) {
|
||||
|
||||
+1
-1
@@ -713,7 +713,7 @@ public class ActionToolbarImpl extends JPanel implements ActionToolbar {
|
||||
}
|
||||
}
|
||||
else {
|
||||
g.setColor(UIUtil.getSeparatorShadow());
|
||||
g.setColor(UIUtil.getSeparatorColor());
|
||||
if (getParent() != null) {
|
||||
if (myOrientation == SwingConstants.HORIZONTAL) {
|
||||
UIUtil.drawLine(g, 3, 2, 3, getParent().getSize().height - 2);
|
||||
|
||||
+1
-1
@@ -202,7 +202,7 @@ public class ApplicationImpl extends ComponentManagerImpl implements Application
|
||||
boolean isHeadless,
|
||||
boolean isCommandLine,
|
||||
@NotNull String appName,
|
||||
Splash splash) {
|
||||
@Nullable Splash splash) {
|
||||
super(null);
|
||||
|
||||
ApplicationManager.setApplication(this, myLastDisposable); // reset back to null only when all components already disposed
|
||||
|
||||
@@ -679,7 +679,7 @@ title.select.project.file.directory=Select {0} file directory
|
||||
description.select.project.file.directory={0} file will be stored in this directory
|
||||
label.please.enter.project.name=Please enter a name to create a new {0} {1}.
|
||||
prompt.please.select.project.jdk=Please select project SDK.\nThis SDK will be used by default by all project modules.
|
||||
label.project.jdk=Project JDK:
|
||||
label.project.jdk=Project SDK:
|
||||
button.configure=&Configure...
|
||||
prompt.confirm.project.no.jdk=Do you want to create a project with no SDK assigned?\nSDK is required for compiling, debugging and running applications\nas well as for standard SDK classes resolution.
|
||||
title.no.jdk.specified=No SDK Specified
|
||||
|
||||
@@ -42,12 +42,7 @@ public class _LastInSuiteTest extends TestCase {
|
||||
UIUtil.invokeAndWaitIfNeeded(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
LightPlatformTestCase.disposeApplication();
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
LightPlatformTestCase.disposeApplication();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ public abstract class LightPlatformTestCase extends UsefulTestCase implements Da
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
public static void disposeApplication() throws Exception {
|
||||
public static void disposeApplication() {
|
||||
if (ourApplication != null) {
|
||||
Disposer.dispose(ourApplication);
|
||||
ourApplication = null;
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.util.*;
|
||||
import com.intellij.util.text.CharArrayCharSequence;
|
||||
import com.intellij.util.text.CharArrayUtil;
|
||||
import com.intellij.util.text.LineReader;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -2061,12 +2062,29 @@ public class StringUtil {
|
||||
}
|
||||
|
||||
public static void assertValidSeparators(@NotNull CharSequence s) {
|
||||
for (int i = 0; i < s.length(); i++) {
|
||||
if (s.charAt(i) == '\r') {
|
||||
String context = String.valueOf(last(s.subSequence(0, i), 10, true)) + first(s.subSequence(i, s.length()), 10, true);
|
||||
context = escapeStringCharacters(context);
|
||||
LOG.error("Wrong line separators: '" + context + "' at offset " + i);
|
||||
char[] chars = CharArrayUtil.fromSequenceWithoutCopying(s);
|
||||
int slashRIndex = -1;
|
||||
|
||||
if (chars != null) {
|
||||
for(int i = 0, len = s.length(); i < len; ++i) {
|
||||
if (chars[i] == '\r') {
|
||||
slashRIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (int i = 0, len = s.length(); i < len; i++) {
|
||||
if (s.charAt(i) == '\r') {
|
||||
slashRIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (slashRIndex != -1) {
|
||||
String context = String.valueOf(last(s.subSequence(0, slashRIndex), 10, true)) + first(s.subSequence(slashRIndex, s.length()), 10, true);
|
||||
context = escapeStringCharacters(context);
|
||||
LOG.error("Wrong line separators: '" + context + "' at offset " + slashRIndex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -684,6 +684,21 @@ public class UIUtil {
|
||||
return UIManager.getColor("nimbusBlueGrey");
|
||||
}
|
||||
|
||||
public static Color getSeparatorColor() {
|
||||
Color separatorColor = getSeparatorForeground();
|
||||
if (isUnderAlloyLookAndFeel()) {
|
||||
separatorColor = getSeparatorShadow();
|
||||
}
|
||||
if (isUnderNimbusLookAndFeel()) {
|
||||
separatorColor = getSeparatorColorUnderNimbus();
|
||||
}
|
||||
//under GTK+ L&F colors set hard
|
||||
if (isUnderGTKLookAndFeel()) {
|
||||
separatorColor = Gray._215;
|
||||
}
|
||||
return separatorColor;
|
||||
}
|
||||
|
||||
public static Border getTableFocusCellHighlightBorder() {
|
||||
return UIManager.getBorder("Table.focusCellHighlightBorder");
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public class DirDiffManagerImpl extends DirDiffManager {
|
||||
frame.show();
|
||||
} else {
|
||||
DirDiffDialog dirDiffDialog = new DirDiffDialog(myProject, model);
|
||||
if (myProject == null || myProject.isDefault() || isFromModalDialog(myProject)) {
|
||||
if (myProject == null || myProject.isDefault()/* || isFromModalDialog(myProject)*/) {
|
||||
dirDiffDialog.setModal(true);
|
||||
}
|
||||
setWindowListener(onWindowClose, dirDiffDialog.getOwner());
|
||||
|
||||
@@ -24,7 +24,7 @@ import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.application.AccessToken;
|
||||
import com.intellij.openapi.application.Application;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ex.ApplicationManagerEx;
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.MessageType;
|
||||
@@ -206,8 +206,7 @@ public class DirDiffTableModel extends AbstractTableModel implements DirDiffMode
|
||||
myUpdating.set(true);
|
||||
final JBLoadingPanel loadingPanel = getLoadingPanel();
|
||||
loadingPanel.startLoading();
|
||||
|
||||
final Runnable action = new Runnable() {
|
||||
ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
updater = new Updater(loadingPanel, 100);
|
||||
@@ -229,12 +228,7 @@ public class DirDiffTableModel extends AbstractTableModel implements DirDiffMode
|
||||
applySettings();
|
||||
}
|
||||
}
|
||||
};
|
||||
if (DirDiffManagerImpl.isFromModalDialog(myProject)) {
|
||||
action.run();
|
||||
} else {
|
||||
ApplicationManager.getApplication().executeOnPooledThread(action);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void reportException(final String htmlContent) {
|
||||
@@ -285,7 +279,7 @@ public class DirDiffTableModel extends AbstractTableModel implements DirDiffMode
|
||||
clear();
|
||||
myElements.addAll(elements);
|
||||
myUpdating.set(false);
|
||||
myTable.revalidate();
|
||||
fireTableDataChanged();
|
||||
DirDiffTableModel.this.text.set("");
|
||||
if (loadingPanel.isLoading()) {
|
||||
loadingPanel.stopLoading();
|
||||
@@ -301,13 +295,7 @@ public class DirDiffTableModel extends AbstractTableModel implements DirDiffMode
|
||||
if (myProject.isDefault()) {
|
||||
SwingUtilities.invokeLater(uiThread);
|
||||
} else {
|
||||
final AccessToken token = ApplicationManager.getApplication().acquireReadActionLock();
|
||||
try {
|
||||
ApplicationManagerEx.getApplicationEx().runEdtSafeAction(uiThread);
|
||||
}
|
||||
finally {
|
||||
token.finish();
|
||||
}
|
||||
app.invokeLater(uiThread, ModalityState.any());
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -779,7 +767,7 @@ public class DirDiffTableModel extends AbstractTableModel implements DirDiffMode
|
||||
}
|
||||
catch (InterruptedException e) {//
|
||||
}
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
ApplicationManager.getApplication().invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
final String s = text.get();
|
||||
@@ -787,7 +775,7 @@ public class DirDiffTableModel extends AbstractTableModel implements DirDiffMode
|
||||
myLoadingPanel.setLoadingText(s);
|
||||
}
|
||||
}
|
||||
});
|
||||
}, ModalityState.stateForComponent(myLoadingPanel));
|
||||
updater = new Updater(myLoadingPanel, mySleep);
|
||||
updater.start();
|
||||
} else {
|
||||
|
||||
+75
-9
@@ -34,20 +34,24 @@ import com.intellij.designer.designSurface.OperationContext;
|
||||
import com.intellij.designer.designSurface.selection.DirectionResizePoint;
|
||||
import com.intellij.designer.designSurface.selection.ResizeSelectionDecorator;
|
||||
import com.intellij.designer.designSurface.tools.ComponentCreationFactory;
|
||||
import com.intellij.designer.designSurface.tools.CreationTool;
|
||||
import com.intellij.designer.designSurface.tools.ComponentPasteFactory;
|
||||
import com.intellij.designer.model.MetaManager;
|
||||
import com.intellij.designer.model.RadComponent;
|
||||
import com.intellij.designer.palette.Item;
|
||||
import com.intellij.designer.utils.Position;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.project.IndexNotReadyException;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiManager;
|
||||
import com.intellij.psi.XmlRecursiveElementVisitor;
|
||||
import com.intellij.psi.xml.XmlFile;
|
||||
import com.intellij.psi.xml.XmlTag;
|
||||
import com.intellij.util.ThrowableRunnable;
|
||||
import org.jetbrains.android.facet.AndroidFacet;
|
||||
import org.jetbrains.android.sdk.AndroidPlatform;
|
||||
import org.jetbrains.android.uipreview.*;
|
||||
@@ -56,9 +60,8 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
@@ -74,10 +77,19 @@ public final class AndroidDesignerEditorPanel extends DesignerEditorPanel {
|
||||
public AndroidDesignerEditorPanel(@NotNull Module module, @NotNull VirtualFile file) {
|
||||
super(module, file);
|
||||
|
||||
myActionPanel.getActionGroup()
|
||||
.add(new AnAction("Android", "Description", IconLoader.getIcon("/com/intellij/android/designer/icons/DeviceScreen.png")) {
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
System.out.println("Action: " + e);
|
||||
}
|
||||
});
|
||||
myActionPanel.update();
|
||||
|
||||
myXmlFile = (XmlFile)ApplicationManager.getApplication().runReadAction(new Computable<PsiFile>() {
|
||||
@Override
|
||||
public PsiFile compute() {
|
||||
return PsiManager.getInstance(myModule.getProject()).findFile(myFile);
|
||||
return PsiManager.getInstance(getProject()).findFile(myFile);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -111,7 +123,7 @@ public final class AndroidDesignerEditorPanel extends DesignerEditorPanel {
|
||||
showDesignerCard();
|
||||
myLayeredPane.repaint();
|
||||
|
||||
DesignerToolWindowManager.getInstance(myModule.getProject()).refresh();
|
||||
DesignerToolWindowManager.getInstance(getProject()).refresh();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
showError("Parse error: ", e);
|
||||
@@ -120,7 +132,7 @@ public final class AndroidDesignerEditorPanel extends DesignerEditorPanel {
|
||||
|
||||
private void parseFile() throws Throwable {
|
||||
final RadViewComponent[] rootComponents = new RadViewComponent[1];
|
||||
final MetaManager metaManager = ViewsMetaManager.getInstance(myModule.getProject());
|
||||
final MetaManager metaManager = ViewsMetaManager.getInstance(getProject());
|
||||
final String layoutXmlText = ApplicationManager.getApplication().runReadAction(new Computable<String>() {
|
||||
RadViewComponent myComponent;
|
||||
|
||||
@@ -188,7 +200,7 @@ public final class AndroidDesignerEditorPanel extends DesignerEditorPanel {
|
||||
int size = views.size();
|
||||
if (size == 1) {
|
||||
RadViewComponent newRootComponent = new RadViewComponent(null);
|
||||
newRootComponent.setMetaModel(ViewsMetaManager.getInstance(myModule.getProject()).getModelByTag("<root>"));
|
||||
newRootComponent.setMetaModel(ViewsMetaManager.getInstance(getProject()).getModelByTag("<root>"));
|
||||
newRootComponent.getChildren().add(rootComponent);
|
||||
rootComponent.setParent(newRootComponent);
|
||||
|
||||
@@ -252,7 +264,7 @@ public final class AndroidDesignerEditorPanel extends DesignerEditorPanel {
|
||||
|
||||
ThemeData theme = new ThemeData("Theme", false);
|
||||
|
||||
return RenderUtil.createRenderSession(myModule.getProject(), layoutXmlText, myFile, target, facet, config, xdpi, ydpi, theme);
|
||||
return RenderUtil.createRenderSession(getProject(), layoutXmlText, myFile, target, facet, config, xdpi, ydpi, theme);
|
||||
}
|
||||
}).get();
|
||||
}
|
||||
@@ -270,6 +282,11 @@ public final class AndroidDesignerEditorPanel extends DesignerEditorPanel {
|
||||
mySession = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlatformTarget() {
|
||||
return "android";
|
||||
}
|
||||
|
||||
@Override
|
||||
public TreeComponentDecorator getTreeDecorator() {
|
||||
return myTreeDecorator;
|
||||
@@ -287,6 +304,55 @@ public final class AndroidDesignerEditorPanel extends DesignerEditorPanel {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
protected ComponentCreationFactory createCreationFactory(Item paletteItem) {
|
||||
return new ComponentCreationFactory() {
|
||||
@Override
|
||||
@NotNull
|
||||
public RadComponent create() throws Exception {
|
||||
return new RadViewComponent(null);
|
||||
}
|
||||
};
|
||||
//return null; // TODO: Auto-generated method stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public ComponentPasteFactory createPasteFactory(String xmlComponents) {
|
||||
return new ComponentPasteFactory() {
|
||||
@NotNull
|
||||
@Override
|
||||
public List<RadComponent> create() throws Exception {
|
||||
return Collections.<RadComponent>singletonList(new RadViewComponent(null));
|
||||
}
|
||||
};
|
||||
//return null; // TODO: Auto-generated method stub
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean execute(ThrowableRunnable<Exception> operation) {
|
||||
try {
|
||||
operation.run();
|
||||
return true;
|
||||
}
|
||||
catch (Throwable e) {
|
||||
showError("Execute command", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void execute(List<EditOperation> operations) {
|
||||
try {
|
||||
for (EditOperation operation : operations) {
|
||||
operation.execute();
|
||||
}
|
||||
}
|
||||
catch (Throwable e) {
|
||||
showError("Execute command", e);
|
||||
}
|
||||
}
|
||||
|
||||
private static class RootView extends JComponent {
|
||||
private final BufferedImage myImage;
|
||||
|
||||
|
||||
+26
@@ -16,7 +16,12 @@
|
||||
package com.intellij.android.designer.model;
|
||||
|
||||
import com.intellij.designer.model.RadComponent;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.DefaultActionGroup;
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.psi.xml.XmlTag;
|
||||
import org.jdom.Element;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -29,6 +34,13 @@ import java.util.List;
|
||||
* @author Alexander Lobas
|
||||
*/
|
||||
public class RadViewComponent extends RadComponent {
|
||||
public static final AnAction LinearLayout =
|
||||
new AnAction("Horizontal/Vertical", "LinearLayout", IconLoader.getIcon("/com/intellij/android/designer/icons/LinearLayout.png")) {
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
}
|
||||
};
|
||||
|
||||
private final List<RadComponent> myChildren = new ArrayList<RadComponent>();
|
||||
private Component myNativeComponent;
|
||||
private final Rectangle myBounds = new Rectangle();
|
||||
@@ -81,4 +93,18 @@ public class RadViewComponent extends RadComponent {
|
||||
public Point convertPoint(Component component, int x, int y) {
|
||||
return SwingUtilities.convertPoint(component, x, y, myNativeComponent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addSelectionActions(DefaultActionGroup actionGroup, JComponent shortcuts, List<RadComponent> selection) {
|
||||
if (myTag != null && myTag.getName().equals("LinearLayout") && selection.size() == 1 && selection.get(0) == this) {
|
||||
AnAction action = new AnAction() {
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
System.out.println("LinearLayout: " + e);
|
||||
}
|
||||
};
|
||||
action.copyFrom(LinearLayout);
|
||||
actionGroup.add(action);
|
||||
}
|
||||
}
|
||||
}
|
||||
+26
-1
@@ -17,10 +17,16 @@ package com.intellij.android.designer.model;
|
||||
|
||||
import com.intellij.designer.designSurface.ComponentDecorator;
|
||||
import com.intellij.designer.designSurface.selection.NonResizeSelectionDecorator;
|
||||
import com.intellij.designer.model.MetaModel;
|
||||
import com.intellij.designer.model.RadComponent;
|
||||
import com.intellij.designer.model.RadLayout;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.DefaultActionGroup;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Alexander Lobas
|
||||
@@ -33,7 +39,26 @@ public class RadViewLayout extends RadLayout {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ComponentDecorator getChildSelectionDecorator(RadComponent component) {
|
||||
public ComponentDecorator getChildSelectionDecorator(RadComponent component, List<RadComponent> selection) {
|
||||
return new NonResizeSelectionDecorator(Color.RED, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addSelectionActions(DefaultActionGroup actionGroup, JComponent shortcuts, List<RadComponent> selection) {
|
||||
if (myContainer.getTag() != null && myContainer.getTag().getName().equals("LinearLayout")) {
|
||||
for (RadComponent component : selection) {
|
||||
if (myContainer != component.getParent()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
AnAction action = new AnAction() {
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
System.out.println("LinearLayout: " + e);
|
||||
}
|
||||
};
|
||||
action.copyFrom(RadViewComponent.LinearLayout);
|
||||
actionGroup.add(action);
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
-10
@@ -17,28 +17,25 @@ package org.jetbrains.plugins.groovy.debugger.filters;
|
||||
|
||||
import com.intellij.ui.classFilter.ClassFilter;
|
||||
import com.intellij.ui.classFilter.DebuggerClassFilterProvider;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.util.GroovyCommonClassNames;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author ilyas
|
||||
*/
|
||||
public class GroovyDebuggerClassFilterProvider implements DebuggerClassFilterProvider {
|
||||
private static final ClassFilter[] FILTERS = {new ClassFilter("org.codehaus.groovy.*"), new ClassFilter("groovy.*")};
|
||||
private static final List<ClassFilter> FILTERS = Arrays.asList(new ClassFilter("org.codehaus.groovy.*"), new ClassFilter("groovy.*"));
|
||||
|
||||
public List<ClassFilter> getFilters() {
|
||||
|
||||
final GroovyDebuggerSettings settings = GroovyDebuggerSettings.getInstance();
|
||||
final Boolean flag = settings.DEBUG_DISABLE_SPECIFIC_GROOVY_METHODS;
|
||||
final ArrayList<ClassFilter> list = new ArrayList<ClassFilter>();
|
||||
GroovyDebuggerSettings settings = GroovyDebuggerSettings.getInstance();
|
||||
Boolean flag = settings.DEBUG_DISABLE_SPECIFIC_GROOVY_METHODS;
|
||||
if (flag == null || flag.booleanValue()) {
|
||||
ContainerUtil.addAll(list, FILTERS);
|
||||
return list;
|
||||
return FILTERS;
|
||||
}
|
||||
return list;
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
public boolean isAuxiliaryFrame(String className, String methodName) {
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@
|
||||
<grid id="ece1c" binding="myWholePanel" layout-manager="GridLayoutManager" row-count="4" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<xy x="28" y="28" width="722" height="443"/>
|
||||
<xy x="28" y="28" width="722" height="509"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
@@ -168,7 +168,7 @@
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="4baf8" class="javax.swing.JLabel">
|
||||
<component id="99d03" class="com.intellij.ui.components.JBLabel" binding="mySearchForTestsLabel">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
|
||||
+4
-2
@@ -46,10 +46,10 @@ import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.ui.PanelWithAnchor;
|
||||
import com.intellij.ui.EditorTextField;
|
||||
import com.intellij.ui.EditorTextFieldWithBrowseButton;
|
||||
import com.intellij.ui.InsertPathAction;
|
||||
import com.intellij.ui.PanelWithAnchor;
|
||||
import com.intellij.ui.components.JBLabel;
|
||||
import com.intellij.util.PlatformIcons;
|
||||
import com.intellij.util.TextFieldCompletionProvider;
|
||||
@@ -102,6 +102,7 @@ public class JUnitConfigurable extends SettingsEditor<JUnitConfiguration> implem
|
||||
private JComboBox myForkCb;
|
||||
private JBLabel myTestLabel;
|
||||
private JComboBox myTypeChooser;
|
||||
private JBLabel mySearchForTestsLabel;
|
||||
@NonNls private static final String NONE = "none";
|
||||
@NonNls private static final String METHOD = "method";
|
||||
@NonNls private static final String KLASS = "class";
|
||||
@@ -216,7 +217,7 @@ public class JUnitConfigurable extends SettingsEditor<JUnitConfiguration> implem
|
||||
|
||||
myCommonJavaParameters.getProgramParametersComponent().setVisible(false);
|
||||
|
||||
setAnchor(myDir.getLabel());
|
||||
setAnchor(mySearchForTestsLabel);
|
||||
myAlternativeJREPanel.setAnchor(myModule.getLabel());
|
||||
myCommonJavaParameters.setAnchor(myModule.getLabel());
|
||||
}
|
||||
@@ -403,6 +404,7 @@ public class JUnitConfigurable extends SettingsEditor<JUnitConfiguration> implem
|
||||
@Override
|
||||
public void setAnchor(JComponent anchor) {
|
||||
this.anchor = anchor;
|
||||
mySearchForTestsLabel.setAnchor(anchor);
|
||||
myTestLabel.setAnchor(anchor);
|
||||
myClass.setAnchor(anchor);
|
||||
myDir.setAnchor(anchor);
|
||||
|
||||
+5
-6
@@ -22,8 +22,12 @@ import org.jetbrains.idea.maven.model.MavenId;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class MavenArtifactCoordinatesVersionConverter extends MavenArtifactCoordinatesConverter {
|
||||
|
||||
private static final Pattern MAGIC_VERSION_PATTERN = Pattern.compile("\\s*(?:LATEST|RELEASE|[(\\[].*|.*-20\\d{6}\\.[0-2]\\d{5}-\\d+)\\s*");
|
||||
|
||||
@Override
|
||||
protected boolean doIsValid(MavenId id, MavenProjectIndicesManager manager, ConvertContext context) {
|
||||
if (StringUtil.isEmpty(id.getGroupId())
|
||||
@@ -31,15 +35,10 @@ public class MavenArtifactCoordinatesVersionConverter extends MavenArtifactCoord
|
||||
|| StringUtil.isEmpty(id.getVersion())) {
|
||||
return false;
|
||||
}
|
||||
if (isMagicVersion(id)) return true; // todo handle ranges more sensibly
|
||||
if (MAGIC_VERSION_PATTERN.matcher(id.getVersion()).matches()) return true; // todo handle ranges more sensibly
|
||||
return manager.hasVersion(id.getGroupId(), id.getArtifactId(), id.getVersion());
|
||||
}
|
||||
|
||||
private boolean isMagicVersion(MavenId id) {
|
||||
String version = id.getVersion().trim();
|
||||
return version.equals("LATEST") || version.equals("RELEASE") || version.startsWith("(") || version.startsWith("[");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<String> doGetVariants(MavenId id, MavenProjectIndicesManager manager) {
|
||||
if (StringUtil.isEmpty(id.getGroupId()) || StringUtil.isEmpty(id.getArtifactId())) return Collections.emptySet();
|
||||
|
||||
+13
-2
@@ -17,6 +17,7 @@ package com.intellij.designer;
|
||||
|
||||
import com.intellij.designer.componentTree.ComponentTree;
|
||||
import com.intellij.designer.componentTree.ComponentTreeBuilder;
|
||||
import com.intellij.designer.componentTree.TreeEditableArea;
|
||||
import com.intellij.designer.designSurface.DesignerEditorPanel;
|
||||
import com.intellij.designer.propertyTable.PropertyTablePanel;
|
||||
import com.intellij.ide.util.treeView.AbstractTreeBuilder;
|
||||
@@ -43,6 +44,7 @@ import com.intellij.util.ui.update.MergingUpdateQueue;
|
||||
import com.intellij.util.ui.update.Update;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -56,7 +58,7 @@ public final class DesignerToolWindowManager implements ProjectComponent {
|
||||
private final FileEditorManager myFileEditorManager;
|
||||
private ToolWindow myToolWindow;
|
||||
private ComponentTree myComponentTree;
|
||||
private AbstractTreeBuilder myTreeBuilder;
|
||||
private ComponentTreeBuilder myTreeBuilder;
|
||||
private PropertyTablePanel myPropertyTablePanel;
|
||||
private boolean myToolWindowReady;
|
||||
private boolean myToolWindowDisposed;
|
||||
@@ -119,6 +121,12 @@ public final class DesignerToolWindowManager implements ProjectComponent {
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public TreeEditableArea getTreeArea() {
|
||||
return myTreeBuilder == null ? null : myTreeBuilder.getTreeArea();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static DesignerEditorPanel getDesigner(FileEditor editor) {
|
||||
if (editor instanceof DesignerEditor) {
|
||||
DesignerEditor designerEditor = (DesignerEditor)editor;
|
||||
@@ -127,7 +135,8 @@ public final class DesignerToolWindowManager implements ProjectComponent {
|
||||
return null;
|
||||
}
|
||||
|
||||
private DesignerEditorPanel getActiveDesigner() {
|
||||
@Nullable
|
||||
public DesignerEditorPanel getActiveDesigner() {
|
||||
FileEditor[] editors = myFileEditorManager.getSelectedEditors();
|
||||
return editors.length > 0 ? getDesigner(editors[0]) : null;
|
||||
}
|
||||
@@ -150,10 +159,12 @@ public final class DesignerToolWindowManager implements ProjectComponent {
|
||||
myComponentTree.newModel();
|
||||
if (designer == null) {
|
||||
myComponentTree.setDecorator(null);
|
||||
myComponentTree.setActionPanel(null);
|
||||
myToolWindow.setAvailable(false, null);
|
||||
}
|
||||
else {
|
||||
myComponentTree.setDecorator(designer.getTreeDecorator());
|
||||
myComponentTree.setActionPanel(designer.getActionPanel());
|
||||
myTreeBuilder = new ComponentTreeBuilder(myComponentTree, designer);
|
||||
myToolWindow.setAvailable(true, null);
|
||||
myToolWindow.show(null);
|
||||
|
||||
+205
@@ -0,0 +1,205 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.designer.actions;
|
||||
|
||||
import com.intellij.designer.DesignerBundle;
|
||||
import com.intellij.designer.clipboard.SerializedComponentData;
|
||||
import com.intellij.designer.clipboard.SimpleTransferable;
|
||||
import com.intellij.designer.designSurface.DesignerEditorPanel;
|
||||
import com.intellij.designer.designSurface.tools.ComponentPasteFactory;
|
||||
import com.intellij.designer.designSurface.tools.PasteTool;
|
||||
import com.intellij.designer.model.RadComponent;
|
||||
import com.intellij.ide.CopyProvider;
|
||||
import com.intellij.ide.CutProvider;
|
||||
import com.intellij.ide.DeleteProvider;
|
||||
import com.intellij.ide.PasteProvider;
|
||||
import com.intellij.ide.dnd.FileCopyPasteUtil;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.command.CommandProcessor;
|
||||
import com.intellij.openapi.ide.CopyPasteManager;
|
||||
import com.intellij.util.ThrowableRunnable;
|
||||
import org.jdom.Element;
|
||||
import org.jdom.output.XMLOutputter;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.awt.datatransfer.DataFlavor;
|
||||
import java.awt.datatransfer.Transferable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Alexander Lobas
|
||||
*/
|
||||
public class CommonEditActionsProvider implements DeleteProvider, CopyProvider, PasteProvider, CutProvider {
|
||||
private static final DataFlavor DATA_FLAVOR = FileCopyPasteUtil.createJvmDataFlavor(SerializedComponentData.class);
|
||||
|
||||
private final DesignerEditorPanel myDesigner;
|
||||
|
||||
public CommonEditActionsProvider(DesignerEditorPanel designer) {
|
||||
myDesigner = designer;
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Delete
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public boolean canDeleteElement(DataContext dataContext) {
|
||||
// TODO: InplaceEditing
|
||||
List<RadComponent> selection = myDesigner.getActionsArea().getSelection();
|
||||
if (selection.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
for (RadComponent component : selection) {
|
||||
if (!component.canDelete()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteElement(DataContext dataContext) {
|
||||
CommandProcessor.getInstance().executeCommand(myDesigner.getProject(), new Runnable() {
|
||||
public void run() {
|
||||
myDesigner.getToolProvider().execute(new ThrowableRunnable<Exception>() {
|
||||
@Override
|
||||
public void run() throws Exception {
|
||||
List<RadComponent> components = RadComponent.getPureSelection(myDesigner.getActionsArea().getSelection());
|
||||
for (RadComponent component : components) {
|
||||
component.delete();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}, DesignerBundle.message("command.delete.selection"), null);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copy
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public boolean isCopyVisible(DataContext dataContext) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCopyEnabled(DataContext dataContext) {
|
||||
// TODO: InplaceEditing
|
||||
return !myDesigner.getActionsArea().getSelection().isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performCopy(DataContext dataContext) {
|
||||
doCopy();
|
||||
}
|
||||
|
||||
private boolean doCopy() {
|
||||
return myDesigner.getToolProvider().execute(new ThrowableRunnable<Exception>() {
|
||||
@Override
|
||||
public void run() throws Exception {
|
||||
Element root = new Element("designer");
|
||||
root.setAttribute("target", myDesigner.getPlatformTarget());
|
||||
|
||||
List<RadComponent> components = RadComponent.getPureSelection(myDesigner.getActionsArea().getSelection());
|
||||
for (RadComponent component : components) {
|
||||
component.copyTo(root);
|
||||
}
|
||||
|
||||
SerializedComponentData data = new SerializedComponentData(new XMLOutputter().outputString(root));
|
||||
CopyPasteManager.getInstance().setContents(new SimpleTransferable(data, DATA_FLAVOR));
|
||||
}
|
||||
});
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Paste
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public boolean isPastePossible(DataContext dataContext) {
|
||||
return isPasteEnabled(dataContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPasteEnabled(DataContext dataContext) {
|
||||
// TODO: InplaceEditing
|
||||
return getSerializedComponentData() != null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private String getSerializedComponentData() {
|
||||
try {
|
||||
CopyPasteManager copyPasteManager = CopyPasteManager.getInstance();
|
||||
if (!copyPasteManager.isDataFlavorAvailable(DATA_FLAVOR)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Transferable content = copyPasteManager.getContents();
|
||||
if (content == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Object transferData = content.getTransferData(DATA_FLAVOR);
|
||||
if (transferData instanceof SerializedComponentData) {
|
||||
SerializedComponentData data = (SerializedComponentData)transferData;
|
||||
String xmlComponents = data.getSerializedComponents();
|
||||
if (xmlComponents.startsWith("<designer target=\"" + myDesigner.getPlatformTarget() + "\">")) {
|
||||
return xmlComponents;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Throwable e) {
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performPaste(DataContext dataContext) {
|
||||
ComponentPasteFactory factory = myDesigner.createPasteFactory(getSerializedComponentData());
|
||||
if (factory != null) {
|
||||
myDesigner.getToolProvider().setActiveTool(new PasteTool(true, factory));
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Cut
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public boolean isCutVisible(DataContext dataContext) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCutEnabled(DataContext dataContext) {
|
||||
return isCopyEnabled(dataContext) && canDeleteElement(dataContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performCut(DataContext dataContext) {
|
||||
if (doCopy()) {
|
||||
deleteElement(dataContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
+130
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.designer.actions;
|
||||
|
||||
import com.intellij.designer.designSurface.ComponentSelectionListener;
|
||||
import com.intellij.designer.designSurface.DesignerEditorPanel;
|
||||
import com.intellij.designer.designSurface.EditableArea;
|
||||
import com.intellij.designer.model.RadComponent;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.ui.IdeBorderFactory;
|
||||
import com.intellij.ui.SideBorder;
|
||||
import com.intellij.util.containers.hash.HashSet;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author Alexander Lobas
|
||||
*/
|
||||
public class DesignerActionPanel implements DataProvider {
|
||||
public static final String TOOLBAR = "DesignerToolbar";
|
||||
public static final String POPUP = "DesignerPopup";
|
||||
|
||||
private final DefaultActionGroup myActionGroup = new DefaultActionGroup();
|
||||
private final DefaultActionGroup myStaticGroup = new DefaultActionGroup();
|
||||
private final DefaultActionGroup myDynamicGroup = new DefaultActionGroup();
|
||||
private final ActionToolbar myToolbar;
|
||||
private final CommonEditActionsProvider myCommonEditActionsProvider;
|
||||
private final JComponent myShortcuts;
|
||||
|
||||
public DesignerActionPanel(DesignerEditorPanel designer, JComponent shortcuts) {
|
||||
myCommonEditActionsProvider = new CommonEditActionsProvider(designer);
|
||||
myShortcuts = shortcuts;
|
||||
|
||||
myActionGroup.add(myStaticGroup);
|
||||
myActionGroup.add(myDynamicGroup);
|
||||
myToolbar = ActionManager.getInstance().createActionToolbar(TOOLBAR, myActionGroup, true);
|
||||
myToolbar.setMiniMode(true);
|
||||
|
||||
registerAction(new SelectAllAction(designer.getSurfaceArea()), "$SelectAll");
|
||||
|
||||
designer.getSurfaceArea().addSelectionListener(new ComponentSelectionListener() {
|
||||
@Override
|
||||
public void selectionChanged(EditableArea area) {
|
||||
updateSelectionActions(area.getSelection());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void registerAction(AnAction action, @NonNls String actionId) {
|
||||
action.registerCustomShortcutSet(
|
||||
ActionManager.getInstance().getAction(actionId).getShortcutSet(),
|
||||
myShortcuts
|
||||
);
|
||||
}
|
||||
|
||||
public JComponent getToolbarComponent() {
|
||||
return myToolbar.getComponent();
|
||||
}
|
||||
|
||||
public DefaultActionGroup getActionGroup() {
|
||||
return myStaticGroup;
|
||||
}
|
||||
|
||||
public void update() {
|
||||
boolean isEmpty = myActionGroup.getChildrenCount() == 0;
|
||||
|
||||
myToolbar.updateActionsImmediately();
|
||||
myToolbar.setMiniMode(isEmpty);
|
||||
|
||||
if (!isEmpty) {
|
||||
myToolbar.getComponent().setBorder(IdeBorderFactory.createBorder(SideBorder.BOTTOM));
|
||||
}
|
||||
}
|
||||
|
||||
private void updateSelectionActions(List<RadComponent> selection) {
|
||||
boolean update = myDynamicGroup.getChildrenCount() > 0;
|
||||
|
||||
for (AnAction action : myDynamicGroup.getChildActionsOrStubs()) {
|
||||
action.unregisterCustomShortcutSet(myShortcuts);
|
||||
}
|
||||
myDynamicGroup.removeAll();
|
||||
|
||||
Set<RadComponent> parents = new HashSet<RadComponent>();
|
||||
for (RadComponent component : selection) {
|
||||
RadComponent parent = component.getParent();
|
||||
if (parent != null) {
|
||||
parents.add(parent);
|
||||
}
|
||||
}
|
||||
|
||||
for (RadComponent parent : parents) {
|
||||
parent.getLayout().addSelectionActions(myDynamicGroup, myShortcuts, selection);
|
||||
}
|
||||
for (RadComponent component : selection) {
|
||||
component.addSelectionActions(myDynamicGroup, myShortcuts, selection);
|
||||
}
|
||||
update |= myDynamicGroup.getChildrenCount() > 0;
|
||||
|
||||
if (update) {
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getData(@NonNls String dataId) {
|
||||
if (PlatformDataKeys.DELETE_ELEMENT_PROVIDER.is(dataId) ||
|
||||
PlatformDataKeys.CUT_PROVIDER.is(dataId) ||
|
||||
PlatformDataKeys.COPY_PROVIDER.is(dataId) ||
|
||||
PlatformDataKeys.PASTE_PROVIDER.is(dataId)) {
|
||||
return myCommonEditActionsProvider;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.designer.actions;
|
||||
|
||||
import com.intellij.designer.designSurface.EditableArea;
|
||||
import com.intellij.designer.model.RadComponent;
|
||||
import com.intellij.designer.model.RadComponentVisitor;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Alexander Lobas
|
||||
*/
|
||||
public class SelectAllAction extends AnAction {
|
||||
private final EditableArea myArea;
|
||||
|
||||
public SelectAllAction(EditableArea area) {
|
||||
myArea = area;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
RadComponent rootComponent = myArea.getRootComponent();
|
||||
if (rootComponent != null) {
|
||||
final List<RadComponent> components = new ArrayList<RadComponent>();
|
||||
rootComponent.accept(new RadComponentVisitor() {
|
||||
@Override
|
||||
public void endVisit(RadComponent component) {
|
||||
components.add(component);
|
||||
}
|
||||
}, true);
|
||||
myArea.setSelection(components);
|
||||
}
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.designer.clipboard;
|
||||
|
||||
/**
|
||||
* This class must be in main classloader because of JVM's restrictions (it's used as DataFlavor class)
|
||||
*
|
||||
* @author yole
|
||||
*/
|
||||
public final class SerializedComponentData {
|
||||
private final String mySerializedComponents;
|
||||
|
||||
public SerializedComponentData(String components) {
|
||||
mySerializedComponents = components;
|
||||
}
|
||||
|
||||
public String getSerializedComponents() {
|
||||
return mySerializedComponents;
|
||||
}
|
||||
}
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.designer.clipboard;
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.awt.datatransfer.DataFlavor;
|
||||
import java.awt.datatransfer.Transferable;
|
||||
import java.awt.datatransfer.UnsupportedFlavorException;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
*/
|
||||
public class SimpleTransferable implements Transferable {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.designer.clipboard.SimpleTransferable");
|
||||
|
||||
private final Object myData;
|
||||
private final DataFlavor myFlavor;
|
||||
|
||||
public SimpleTransferable(Object data, DataFlavor flavor) {
|
||||
myData = data;
|
||||
myFlavor = flavor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataFlavor[] getTransferDataFlavors() {
|
||||
try {
|
||||
return new DataFlavor[]{myFlavor};
|
||||
}
|
||||
catch (Exception ex) {
|
||||
LOG.error(ex);
|
||||
return new DataFlavor[0];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDataFlavorSupported(DataFlavor flavor) {
|
||||
try {
|
||||
return myFlavor.equals(flavor);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
LOG.error(ex);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException {
|
||||
try {
|
||||
if (!myFlavor.equals(flavor)) {
|
||||
return null;
|
||||
}
|
||||
return myData;
|
||||
}
|
||||
catch (Exception e) {
|
||||
LOG.error(e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
+13
-2
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.designer.componentTree;
|
||||
|
||||
import com.intellij.designer.actions.DesignerActionPanel;
|
||||
import com.intellij.designer.designSurface.FeedbackTreeLayer;
|
||||
import com.intellij.designer.model.RadComponent;
|
||||
import com.intellij.openapi.actionSystem.DataProvider;
|
||||
@@ -37,6 +38,7 @@ import java.awt.*;
|
||||
*/
|
||||
public final class ComponentTree extends Tree implements DataProvider {
|
||||
private TreeComponentDecorator myDecorator;
|
||||
private DesignerActionPanel myActionPanel;
|
||||
private RadComponent myMarkComponent;
|
||||
private int myMarkFeedback;
|
||||
|
||||
@@ -64,11 +66,15 @@ public final class ComponentTree extends Tree implements DataProvider {
|
||||
setModel(new DefaultTreeModel(new DefaultMutableTreeNode()));
|
||||
}
|
||||
|
||||
public void setDecorator(TreeComponentDecorator decorator) {
|
||||
public void setDecorator(@Nullable TreeComponentDecorator decorator) {
|
||||
myDecorator = decorator;
|
||||
myMarkComponent = null;
|
||||
}
|
||||
|
||||
public void setActionPanel(@Nullable DesignerActionPanel actionPanel) {
|
||||
myActionPanel = actionPanel;
|
||||
}
|
||||
|
||||
public void mark(RadComponent component, int feedback) {
|
||||
myMarkComponent = component;
|
||||
myMarkFeedback = feedback;
|
||||
@@ -77,7 +83,12 @@ public final class ComponentTree extends Tree implements DataProvider {
|
||||
|
||||
@Override
|
||||
public Object getData(@NonNls String dataId) {
|
||||
return null; //TODO
|
||||
// TODO: support keys
|
||||
|
||||
if (myActionPanel != null) {
|
||||
return myActionPanel.getData(dataId);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
+4
@@ -50,6 +50,10 @@ public final class ComponentTreeBuilder extends AbstractTreeBuilder implements C
|
||||
addListeners();
|
||||
}
|
||||
|
||||
public TreeEditableArea getTreeArea() {
|
||||
return myTreeArea;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
removeListeners();
|
||||
|
||||
+10
-6
@@ -21,6 +21,8 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Alexander Lobas
|
||||
@@ -34,8 +36,9 @@ public class DecorationLayer extends JComponent {
|
||||
|
||||
@Nullable
|
||||
public InputTool findTargetTool(int x, int y) {
|
||||
for (RadComponent component : myArea.getSelection()) {
|
||||
ComponentDecorator decorator = getDecorator(component);
|
||||
List<RadComponent> selection = myArea.getSelection();
|
||||
for (RadComponent component : selection) {
|
||||
ComponentDecorator decorator = getDecorator(component, selection);
|
||||
InputTool tracker = decorator.findTargetTool(this, component, x, y);
|
||||
if (tracker != null) {
|
||||
return tracker;
|
||||
@@ -50,17 +53,18 @@ public class DecorationLayer extends JComponent {
|
||||
}
|
||||
|
||||
private void painSelection(Graphics2D g) {
|
||||
for (RadComponent component : myArea.getSelection()) {
|
||||
ComponentDecorator decorator = getDecorator(component);
|
||||
List<RadComponent> selection = myArea.getSelection();
|
||||
for (RadComponent component : selection) {
|
||||
ComponentDecorator decorator = getDecorator(component, selection);
|
||||
decorator.decorate(this, g, component);
|
||||
}
|
||||
}
|
||||
|
||||
private ComponentDecorator getDecorator(RadComponent component) {
|
||||
private ComponentDecorator getDecorator(RadComponent component, List<RadComponent> selection) {
|
||||
RadComponent parent = component.getParent();
|
||||
if (parent == null) {
|
||||
return myArea.getRootSelectionDecorator();
|
||||
}
|
||||
return parent.getLayout().getChildSelectionDecorator(component);
|
||||
return parent.getLayout().getChildSelectionDecorator(component, selection);
|
||||
}
|
||||
}
|
||||
+105
-20
@@ -16,17 +16,22 @@
|
||||
package com.intellij.designer.designSurface;
|
||||
|
||||
import com.intellij.designer.DesignerToolWindowManager;
|
||||
import com.intellij.designer.actions.DesignerActionPanel;
|
||||
import com.intellij.designer.componentTree.TreeComponentDecorator;
|
||||
import com.intellij.designer.designSurface.tools.InputTool;
|
||||
import com.intellij.designer.designSurface.tools.SelectionTool;
|
||||
import com.intellij.designer.designSurface.tools.ToolProvider;
|
||||
import com.intellij.designer.componentTree.TreeEditableArea;
|
||||
import com.intellij.designer.designSurface.tools.*;
|
||||
import com.intellij.designer.model.MetaModel;
|
||||
import com.intellij.designer.model.RadComponent;
|
||||
import com.intellij.designer.model.RadComponentVisitor;
|
||||
import com.intellij.designer.palette.Item;
|
||||
import com.intellij.ide.palette.PaletteItem;
|
||||
import com.intellij.ide.palette.impl.PaletteManager;
|
||||
import com.intellij.openapi.actionSystem.DataProvider;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.application.ex.ApplicationManagerEx;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.ui.ScrollPaneFactory;
|
||||
@@ -36,7 +41,10 @@ import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.ListSelectionEvent;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
@@ -59,14 +67,19 @@ public abstract class DesignerEditorPanel extends JPanel implements DataProvider
|
||||
|
||||
private final CardLayout myLayout = new CardLayout();
|
||||
private JPanel myDesignerCard;
|
||||
|
||||
protected DesignerActionPanel myActionPanel;
|
||||
|
||||
private CaptionPanel myHorizontalCaption;
|
||||
private CaptionPanel myVerticalCaption;
|
||||
|
||||
private JScrollPane myScrollPane;
|
||||
protected JLayeredPane myLayeredPane;
|
||||
protected GlassLayer myGlassLayer;
|
||||
private DecorationLayer myDecorationLayer;
|
||||
private FeedbackLayer myFeedbackLayer;
|
||||
|
||||
private ListSelectionListener myPaletteListener;
|
||||
protected ToolProvider myToolProvider;
|
||||
protected EditableArea mySurfaceArea;
|
||||
|
||||
@@ -90,15 +103,16 @@ public abstract class DesignerEditorPanel extends JPanel implements DataProvider
|
||||
add(myDesignerCard, DESIGNER_CARD);
|
||||
|
||||
GridBagConstraints gbc = new GridBagConstraints();
|
||||
|
||||
gbc.gridx = 0;
|
||||
gbc.gridy = 1;
|
||||
gbc.gridy = 2;
|
||||
gbc.fill = GridBagConstraints.BOTH;
|
||||
|
||||
myVerticalCaption = new CaptionPanel(this, false);
|
||||
myDesignerCard.add(myVerticalCaption, gbc);
|
||||
|
||||
gbc.gridx = 1;
|
||||
gbc.gridy = 0;
|
||||
gbc.gridy = 1;
|
||||
|
||||
myHorizontalCaption = new CaptionPanel(this, true);
|
||||
myDesignerCard.add(myHorizontalCaption, gbc);
|
||||
@@ -149,12 +163,45 @@ public abstract class DesignerEditorPanel extends JPanel implements DataProvider
|
||||
}
|
||||
};
|
||||
|
||||
myPaletteListener = new ListSelectionListener() {
|
||||
@Override
|
||||
public void valueChanged(ListSelectionEvent e) {
|
||||
if (DesignerToolWindowManager.getInstance(getProject()).getActiveDesigner() == DesignerEditorPanel.this) {
|
||||
Item paletteItem = (Item)PaletteManager.getInstance(getProject()).getActiveItem();
|
||||
if (paletteItem != null) {
|
||||
myToolProvider.setActiveTool(new CreationTool(true, createCreationFactory(paletteItem)));
|
||||
}
|
||||
else if (myToolProvider.getActiveTool() instanceof CreationTool) {
|
||||
myToolProvider.loadDefaultTool();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
myToolProvider = new ToolProvider() {
|
||||
@Override
|
||||
public void loadDefaultTool() {
|
||||
setActiveTool(new SelectionTool());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setActiveTool(InputTool tool) {
|
||||
if (getActiveTool() instanceof CreationTool && !(tool instanceof CreationTool)) {
|
||||
PaletteManager.getInstance(getProject()).clearActiveItem();
|
||||
}
|
||||
super.setActiveTool(tool);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(ThrowableRunnable<Exception> operation) {
|
||||
return DesignerEditorPanel.this.execute(operation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(List<EditOperation> operations) {
|
||||
DesignerEditorPanel.this.execute(operations);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showError(@NonNls String message, Throwable e) {
|
||||
DesignerEditorPanel.this.showError(message, e);
|
||||
@@ -171,13 +218,29 @@ public abstract class DesignerEditorPanel extends JPanel implements DataProvider
|
||||
myLayeredPane.add(myFeedbackLayer, LAYER_FEEDBACK);
|
||||
|
||||
gbc.gridx = 1;
|
||||
gbc.gridy = 1;
|
||||
gbc.gridy = 2;
|
||||
gbc.weightx = 1;
|
||||
gbc.weighty = 1;
|
||||
|
||||
myScrollPane = ScrollPaneFactory.createScrollPane(myLayeredPane);
|
||||
myScrollPane.setBackground(Color.WHITE);
|
||||
myDesignerCard.add(myScrollPane, gbc);
|
||||
|
||||
gbc.gridx = 0;
|
||||
gbc.gridy = 0;
|
||||
gbc.gridwidth = 2;
|
||||
gbc.weightx = 0;
|
||||
gbc.weighty = 0;
|
||||
gbc.fill = GridBagConstraints.HORIZONTAL;
|
||||
|
||||
myActionPanel = new DesignerActionPanel(this, myGlassLayer);
|
||||
myDesignerCard.add(myActionPanel.getToolbarComponent(), gbc);
|
||||
|
||||
PaletteManager.getInstance(getProject()).addSelectionListener(myPaletteListener);
|
||||
}
|
||||
|
||||
protected final void showDesignerCard() {
|
||||
myLayout.show(this, DESIGNER_CARD);
|
||||
}
|
||||
|
||||
private void createErrorCard() {
|
||||
@@ -185,33 +248,54 @@ public abstract class DesignerEditorPanel extends JPanel implements DataProvider
|
||||
add(myErrorLabel, ERROR_CARD);
|
||||
}
|
||||
|
||||
protected final void showDesignerCard() {
|
||||
myLayout.show(this, DESIGNER_CARD);
|
||||
public void showError(@NonNls String message, Throwable e) {
|
||||
myRootComponent = null;
|
||||
myErrorLabel.setText(message + e.toString());
|
||||
myLayout.show(this, ERROR_CARD);
|
||||
DesignerToolWindowManager.getInstance(getProject()).refresh();
|
||||
repaint();
|
||||
if (ApplicationManagerEx.getApplicationEx().isInternal()) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public abstract String getPlatformTarget();
|
||||
|
||||
public Project getProject() {
|
||||
return myModule.getProject();
|
||||
}
|
||||
|
||||
public EditableArea getSurfaceArea() {
|
||||
return mySurfaceArea;
|
||||
}
|
||||
|
||||
public EditableArea getActionsArea() {
|
||||
TreeEditableArea treeArea = DesignerToolWindowManager.getInstance(getProject()).getTreeArea();
|
||||
return treeArea == null ? mySurfaceArea : treeArea;
|
||||
}
|
||||
|
||||
public ToolProvider getToolProvider() {
|
||||
return myToolProvider;
|
||||
}
|
||||
|
||||
public DesignerActionPanel getActionPanel() {
|
||||
return myActionPanel;
|
||||
}
|
||||
|
||||
protected abstract ComponentDecorator getRootSelectionDecorator();
|
||||
|
||||
@Nullable
|
||||
protected abstract EditOperation processRootOperation(OperationContext context);
|
||||
|
||||
public void showError(@NonNls String message, Throwable e) {
|
||||
myRootComponent = null;
|
||||
myErrorLabel.setText(message + e.toString());
|
||||
myLayout.show(this, ERROR_CARD);
|
||||
DesignerToolWindowManager.getInstance(myModule.getProject()).refresh();
|
||||
repaint();
|
||||
if (ApplicationManagerEx.getApplicationEx().isInternal()) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
protected abstract boolean execute(ThrowableRunnable<Exception> operation);
|
||||
|
||||
protected abstract void execute(List<EditOperation> operations);
|
||||
|
||||
@NotNull
|
||||
protected abstract ComponentCreationFactory createCreationFactory(Item paletteItem);
|
||||
|
||||
@Nullable
|
||||
public abstract ComponentPasteFactory createPasteFactory(String xmlComponents);
|
||||
|
||||
public void activate() {
|
||||
}
|
||||
@@ -221,11 +305,12 @@ public abstract class DesignerEditorPanel extends JPanel implements DataProvider
|
||||
|
||||
@Override
|
||||
public Object getData(@NonNls String dataId) {
|
||||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||
// TODO: support keys
|
||||
return myActionPanel.getData(dataId);
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
// TODO: Auto-generated method stub
|
||||
PaletteManager.getInstance(getProject()).removeSelectionListener(myPaletteListener);
|
||||
}
|
||||
|
||||
public JComponent getPreferredFocusedComponent() {
|
||||
|
||||
+1
-19
@@ -122,14 +122,7 @@ public class DragTracker extends SelectionTracker {
|
||||
myContext.setLocation(getLocation());
|
||||
|
||||
if (myContext.getComponents() == null) {
|
||||
List<RadComponent> components = new ArrayList<RadComponent>();
|
||||
List<RadComponent> selection = myArea.getSelection();
|
||||
|
||||
for (RadComponent component : selection) {
|
||||
if (!isParentsContainedIn(selection, component)) {
|
||||
components.add(component);
|
||||
}
|
||||
}
|
||||
List<RadComponent> components = RadComponent.getPureSelection(myArea.getSelection());
|
||||
|
||||
RadComponent parent = null;
|
||||
for (RadComponent component : components) {
|
||||
@@ -148,15 +141,4 @@ public class DragTracker extends SelectionTracker {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isParentsContainedIn(List<RadComponent> components, RadComponent component) {
|
||||
RadComponent parent = component.getParent();
|
||||
while (parent != null) {
|
||||
if (components.contains(parent)) {
|
||||
return true;
|
||||
}
|
||||
parent = parent.getParent();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+10
-7
@@ -134,15 +134,18 @@ public class MarqueeTracker extends InputTool {
|
||||
private void performMarqueeSelect() {
|
||||
final Rectangle selectionRectangle = getSelectionRectangle();
|
||||
final List<RadComponent> newSelection = new ArrayList<RadComponent>();
|
||||
RadComponent rootComponent = myArea.getRootComponent();
|
||||
|
||||
myArea.getRootComponent().accept(new RadComponentVisitor() {
|
||||
@Override
|
||||
public void endVisit(RadComponent component) {
|
||||
if (selectionRectangle.contains(component.getBounds(myArea.getNativeComponent()))) {
|
||||
newSelection.add(component);
|
||||
if (rootComponent != null) {
|
||||
rootComponent.accept(new RadComponentVisitor() {
|
||||
@Override
|
||||
public void endVisit(RadComponent component) {
|
||||
if (selectionRectangle.contains(component.getBounds(myArea.getNativeComponent()))) {
|
||||
newSelection.add(component);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, true);
|
||||
}, true);
|
||||
}
|
||||
|
||||
if (mySelectionMode == TOGGLE_MODE) {
|
||||
List<RadComponent> selection = new ArrayList<RadComponent>(myArea.getSelection());
|
||||
|
||||
+5
-8
@@ -116,16 +116,13 @@ public class ResizeTracker extends InputTool {
|
||||
|
||||
private void executeCommand() {
|
||||
if (myExecuteEnabled) {
|
||||
try {
|
||||
for (EditOperation operation : getOperations()) {
|
||||
if (operation.canExecute()) {
|
||||
operation.execute();
|
||||
}
|
||||
List<EditOperation> operations = new ArrayList<EditOperation>();
|
||||
for (EditOperation operation : getOperations()) {
|
||||
if (operation.canExecute()) {
|
||||
operations.add(operation);
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
myToolProvider.showError("Execute command: ", e);
|
||||
}
|
||||
myToolProvider.execute(operations);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-6
@@ -22,6 +22,8 @@ import com.intellij.designer.model.RadComponent;
|
||||
import com.intellij.designer.model.RadLayout;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
/**
|
||||
* @author Alexander Lobas
|
||||
*/
|
||||
@@ -76,12 +78,7 @@ public abstract class TargetingTool extends InputTool {
|
||||
|
||||
protected void executeCommand() {
|
||||
if (myExecuteEnabled) {
|
||||
try {
|
||||
myTargetOperation.execute();
|
||||
}
|
||||
catch (Exception e) {
|
||||
myToolProvider.showError("Execute command: ", e);
|
||||
}
|
||||
myToolProvider.execute(Collections.singletonList(myTargetOperation));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+7
@@ -15,12 +15,15 @@
|
||||
*/
|
||||
package com.intellij.designer.designSurface.tools;
|
||||
|
||||
import com.intellij.designer.designSurface.EditOperation;
|
||||
import com.intellij.designer.designSurface.EditableArea;
|
||||
import com.intellij.util.ThrowableRunnable;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Alexander Lobas
|
||||
@@ -126,4 +129,8 @@ public abstract class ToolProvider {
|
||||
}
|
||||
|
||||
public abstract void loadDefaultTool();
|
||||
|
||||
public abstract boolean execute(ThrowableRunnable<Exception> operation);
|
||||
|
||||
public abstract void execute(List<EditOperation> operations);
|
||||
}
|
||||
@@ -17,6 +17,7 @@ package com.intellij.designer.model;
|
||||
|
||||
import com.intellij.designer.palette.Item;
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
@@ -92,7 +93,8 @@ public class MetaModel {
|
||||
return myPaletteItem;
|
||||
}
|
||||
|
||||
public void setPaletteItem(Item paletteItem) {
|
||||
public void setPaletteItem(@NotNull Item paletteItem) {
|
||||
myPaletteItem = paletteItem;
|
||||
myPaletteItem.setMetaModel(this);
|
||||
}
|
||||
}
|
||||
@@ -19,12 +19,15 @@ import com.intellij.designer.designSurface.OperationContext;
|
||||
import com.intellij.designer.designSurface.tools.DragTracker;
|
||||
import com.intellij.designer.designSurface.tools.InputTool;
|
||||
import com.intellij.designer.propertyTable.Property;
|
||||
import com.intellij.openapi.actionSystem.DefaultActionGroup;
|
||||
import com.intellij.util.containers.hash.HashMap;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -38,6 +41,12 @@ public abstract class RadComponent {
|
||||
private RadLayout myLayout;
|
||||
private final Map<Object, Object> myClientProperties = new HashMap<Object, Object>();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// MetaModel
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public MetaModel getMetaModel() {
|
||||
return myMetaModel;
|
||||
}
|
||||
@@ -97,6 +106,8 @@ public abstract class RadComponent {
|
||||
public void processDropOperation(OperationContext context) {
|
||||
}
|
||||
|
||||
public void addSelectionActions(DefaultActionGroup actionGroup, JComponent shortcuts, List<RadComponent> selection) {
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// layout
|
||||
@@ -157,4 +168,49 @@ public abstract class RadComponent {
|
||||
visitor.endVisit(this);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Operations
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public boolean canDelete() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void delete() throws Exception {
|
||||
}
|
||||
|
||||
public void copyTo(Element parentElement) throws Exception {
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Utils
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public static boolean isParentsContainedIn(List<RadComponent> components, RadComponent component) {
|
||||
RadComponent parent = component.getParent();
|
||||
while (parent != null) {
|
||||
if (components.contains(parent)) {
|
||||
return true;
|
||||
}
|
||||
parent = parent.getParent();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static List<RadComponent> getPureSelection(List<RadComponent> selection) {
|
||||
List<RadComponent> components = new ArrayList<RadComponent>();
|
||||
|
||||
for (RadComponent component : selection) {
|
||||
if (!isParentsContainedIn(selection, component)) {
|
||||
components.add(component);
|
||||
}
|
||||
}
|
||||
|
||||
return components;
|
||||
}
|
||||
}
|
||||
@@ -18,16 +18,23 @@ package com.intellij.designer.model;
|
||||
import com.intellij.designer.designSurface.ComponentDecorator;
|
||||
import com.intellij.designer.designSurface.EditOperation;
|
||||
import com.intellij.designer.designSurface.OperationContext;
|
||||
import com.intellij.openapi.actionSystem.DefaultActionGroup;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Alexander Lobas
|
||||
*/
|
||||
public abstract class RadLayout {
|
||||
public abstract ComponentDecorator getChildSelectionDecorator(RadComponent component);
|
||||
public abstract ComponentDecorator getChildSelectionDecorator(RadComponent component, List<RadComponent> selection);
|
||||
|
||||
@Nullable
|
||||
public EditOperation processChildOperation(OperationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void addSelectionActions(DefaultActionGroup actionGroup, JComponent shortcuts, List<RadComponent> selection) {
|
||||
}
|
||||
}
|
||||
@@ -59,12 +59,12 @@ public final class Group implements PaletteGroup {
|
||||
|
||||
@Override
|
||||
public ActionGroup getPopupActionGroup() {
|
||||
return (ActionGroup)ActionManager.getInstance().getAction("Designer.PaletteGroupPopupMenu");
|
||||
return null; // TODO: Auto-generated method stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getData(Project project, String dataId) {
|
||||
return null; // TODO: Auto-generated method stub
|
||||
return null; // TODO: Auto-generated method stub
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.designer.palette;
|
||||
|
||||
import com.intellij.designer.model.MetaModel;
|
||||
import com.intellij.ide.dnd.DnDDragStartBean;
|
||||
import com.intellij.ide.palette.PaletteItem;
|
||||
import com.intellij.openapi.actionSystem.ActionGroup;
|
||||
@@ -35,6 +36,8 @@ public final class Item implements PaletteItem {
|
||||
private Icon myIcon;
|
||||
private String myTooltip;
|
||||
|
||||
private MetaModel myMetaModel;
|
||||
|
||||
public Item(String title, String iconPath, String tooltip) {
|
||||
myTitle = title;
|
||||
myIconPath = iconPath;
|
||||
@@ -66,11 +69,19 @@ public final class Item implements PaletteItem {
|
||||
|
||||
@Override
|
||||
public ActionGroup getPopupActionGroup() {
|
||||
return (ActionGroup)ActionManager.getInstance().getAction("Designer.PaletteItemPopupMenu");
|
||||
return null; // TODO: Auto-generated method stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getData(Project project, String dataId) {
|
||||
return null; // TODO: Auto-generated method stub
|
||||
return null; // TODO: Auto-generated method stub
|
||||
}
|
||||
|
||||
public MetaModel getMetaModel() {
|
||||
return myMetaModel;
|
||||
}
|
||||
|
||||
public void setMetaModel(MetaModel metaModel) {
|
||||
myMetaModel = metaModel;
|
||||
}
|
||||
}
|
||||
@@ -1,2 +1,3 @@
|
||||
designer.toolwindow.name=Designer
|
||||
designer.toolwindow.title=Component Tree
|
||||
designer.toolwindow.title=Component Tree
|
||||
command.delete.selection=Delete Selection
|
||||
@@ -64,4 +64,8 @@
|
||||
<option name="PATTERN" value="com.yourkit.runtime.*" />
|
||||
<option name="ENABLED" value="true" />
|
||||
</filter>
|
||||
<filter>
|
||||
<option name="PATTERN" value="com.springsource.loaded.*" />
|
||||
<option name="ENABLED" value="true" />
|
||||
</filter>
|
||||
</component>
|
||||
|
||||
@@ -31,7 +31,7 @@ public class EmptyPane {
|
||||
private JLabel myLabel;
|
||||
|
||||
public EmptyPane(String text) {
|
||||
final Color color = UIUtil.getSeparatorShadow();
|
||||
final Color color = UIUtil.getSeparatorColor();
|
||||
myLabel.setForeground(color);
|
||||
myLabel.setText(text);
|
||||
myPanel.setBackground(new Tree().getBackground());
|
||||
|
||||
Reference in New Issue
Block a user