IDEA-91351 Strange way to invoke color picker

This commit is contained in:
Konstantin Bulenkov
2012-09-12 13:03:57 +04:00
parent 9d9a2f6af3
commit 9167cc6b5b
4 changed files with 47 additions and 0 deletions
+4
View File
@@ -25,6 +25,9 @@
</application-components>
<actions>
<action id="images.color.picker" class="org.intellij.images.actions.ColorPickerForImageAction" text="Show Color Picker">
<add-to-group anchor="after" group-id="ProjectViewPopupMenu" relative-to-action="EditSource"/>
</action>
<action class="org.intellij.images.actions.EditExternallyAction"
id="Images.EditExternaly"
icon="ImagesIcons.EditExternaly"
@@ -85,6 +88,7 @@
<separator/>
<reference id="VersionControlsGroup"/>
<separator/>
<reference id="images.color.picker" />
<reference id="Images.EditExternaly"/>
<reference id="ExternalToolsGroup"/>
</group>
@@ -0,0 +1,29 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.intellij.images.actions;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.ui.ShowColorPickerAction;
/**
* @author Konstantin Bulenkov
*/
public class ColorPickerForImageAction extends ShowColorPickerAction {
@Override
public void update(AnActionEvent e) {
EditExternallyAction.doUpdate(e);
}
}
@@ -106,6 +106,10 @@ public final class EditExternallyAction extends AnAction {
public void update(AnActionEvent e) {
super.update(e);
doUpdate(e);
}
static void doUpdate(AnActionEvent e) {
VirtualFile[] files = e.getData(PlatformDataKeys.VIRTUAL_FILE_ARRAY);
final boolean isEnabled = isImages(files);
if (e.getPlace().equals(ActionPlaces.PROJECT_VIEW_POPUP)) {
@@ -26,6 +26,7 @@ import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiManager;
import com.intellij.ui.PopupHandler;
import com.intellij.ui.ScrollPaneFactory;
import com.intellij.util.ui.UIUtil;
import org.intellij.images.ImagesBundle;
import org.intellij.images.editor.ImageDocument;
import org.intellij.images.editor.ImageEditor;
@@ -206,6 +207,15 @@ final class ImageEditorUI extends JPanel implements DataProvider {
public Dimension getPreferredSize() {
return imageComponent.getSize();
}
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
if (UIUtil.isUnderDarcula()) {
g.setColor(UIUtil.getControlColor().brighter());
g.fillRect(0,0,getWidth(), getHeight());
}
}
}
private final class ImageWheelAdapter implements MouseWheelListener {