From 3838d9f308801ecf03b257b173b5171acc93f205 Mon Sep 17 00:00:00 2001 From: Alexander Lobas Date: Wed, 25 Jan 2012 18:40:41 +0400 Subject: [PATCH 1/3] IDEA-36265 --- .../uiDesigner/GeneralConfigurable.form | 15 ++++++++++++--- .../uiDesigner/GuiDesignerConfigurable.java | 8 ++++++++ .../uiDesigner/GuiDesignerConfiguration.java | 1 + .../designSurface/GridCaptionPanel.java | 17 +++++++++++++---- 4 files changed, 34 insertions(+), 7 deletions(-) diff --git a/plugins/ui-designer/src/com/intellij/uiDesigner/GeneralConfigurable.form b/plugins/ui-designer/src/com/intellij/uiDesigner/GeneralConfigurable.form index 05b23634de40..30b8c75dba09 100644 --- a/plugins/ui-designer/src/com/intellij/uiDesigner/GeneralConfigurable.form +++ b/plugins/ui-designer/src/com/intellij/uiDesigner/GeneralConfigurable.form @@ -1,16 +1,16 @@
- + - + - + @@ -99,6 +99,15 @@ + + + + + + + + + diff --git a/plugins/ui-designer/src/com/intellij/uiDesigner/GuiDesignerConfigurable.java b/plugins/ui-designer/src/com/intellij/uiDesigner/GuiDesignerConfigurable.java index 4d9a541ea6ef..4e5fc5c6b7fd 100644 --- a/plugins/ui-designer/src/com/intellij/uiDesigner/GuiDesignerConfigurable.java +++ b/plugins/ui-designer/src/com/intellij/uiDesigner/GuiDesignerConfigurable.java @@ -100,6 +100,10 @@ public final class GuiDesignerConfigurable implements SearchableConfigurable, Co return true; } + if (configuration.RESIZE_HEADERS != myGeneralUI.myResizeHeaders.isSelected()) { + return true; + } + return false; } @@ -109,6 +113,7 @@ public final class GuiDesignerConfigurable implements SearchableConfigurable, Co configuration.DEFAULT_LAYOUT_MANAGER = (String)myGeneralUI.myLayoutManagerCombo.getSelectedItem(); configuration.INSTRUMENT_CLASSES = myGeneralUI.myRbInstrumentClasses.isSelected(); configuration.DEFAULT_FIELD_ACCESSIBILITY = (String)myGeneralUI .myDefaultFieldAccessibilityCombo.getSelectedItem(); + configuration.RESIZE_HEADERS = myGeneralUI.myResizeHeaders.isSelected(); if (configuration.INSTRUMENT_CLASSES && !myProject.isDefault()) { final DispatchThreadProgressWindow progressWindow = new DispatchThreadProgressWindow(false, myProject); @@ -140,6 +145,8 @@ public final class GuiDesignerConfigurable implements SearchableConfigurable, Co myGeneralUI.myLayoutManagerCombo.setSelectedItem(configuration.DEFAULT_LAYOUT_MANAGER); myGeneralUI.myDefaultFieldAccessibilityCombo.setSelectedItem(configuration.DEFAULT_FIELD_ACCESSIBILITY); + + myGeneralUI.myResizeHeaders.setSelected(configuration.RESIZE_HEADERS); } public void disposeUIResources() { @@ -153,6 +160,7 @@ public final class GuiDesignerConfigurable implements SearchableConfigurable, Co public JCheckBox myChkCopyFormsRuntime; private JComboBox myLayoutManagerCombo; private JComboBox myDefaultFieldAccessibilityCombo; + private JCheckBox myResizeHeaders; } private final class MyApplyRunnable implements Runnable { diff --git a/plugins/ui-designer/src/com/intellij/uiDesigner/GuiDesignerConfiguration.java b/plugins/ui-designer/src/com/intellij/uiDesigner/GuiDesignerConfiguration.java index 15c480058d53..902daf46c33e 100644 --- a/plugins/ui-designer/src/com/intellij/uiDesigner/GuiDesignerConfiguration.java +++ b/plugins/ui-designer/src/com/intellij/uiDesigner/GuiDesignerConfiguration.java @@ -49,6 +49,7 @@ public final class GuiDesignerConfiguration implements PersistentStateComponent< public String DEFAULT_FIELD_ACCESSIBILITY = PsiModifier.PRIVATE; + public boolean RESIZE_HEADERS = true; public GuiDesignerConfiguration getState() { return this; diff --git a/plugins/ui-designer/src/com/intellij/uiDesigner/designSurface/GridCaptionPanel.java b/plugins/ui-designer/src/com/intellij/uiDesigner/designSurface/GridCaptionPanel.java index ce96c2a573dc..538d7c31f37d 100644 --- a/plugins/ui-designer/src/com/intellij/uiDesigner/designSurface/GridCaptionPanel.java +++ b/plugins/ui-designer/src/com/intellij/uiDesigner/designSurface/GridCaptionPanel.java @@ -25,6 +25,7 @@ import com.intellij.ui.LightColors; import com.intellij.uiDesigner.CaptionSelection; import com.intellij.uiDesigner.FormEditingUtil; import com.intellij.uiDesigner.GridChangeUtil; +import com.intellij.uiDesigner.GuiDesignerConfiguration; import com.intellij.uiDesigner.componentTree.ComponentSelectionListener; import com.intellij.uiDesigner.radComponents.RadAbstractGridLayoutManager; import com.intellij.uiDesigner.radComponents.RadComponent; @@ -272,6 +273,12 @@ public class GridCaptionPanel extends JPanel implements ComponentSelectionListen }); } + private boolean canResizeCells() { + return GuiDesignerConfiguration.getInstance(myEditor.getProject()).RESIZE_HEADERS && + mySelectedContainer != null && + mySelectedContainer.getGridLayoutManager().canResizeCells(); + } + private int getCellAt(Point pnt) { if (mySelectedContainer == null) return -1; pnt = SwingUtilities.convertPoint(this, pnt, mySelectedContainer.getDelegee()); @@ -321,9 +328,8 @@ public class GridCaptionPanel extends JPanel implements ComponentSelectionListen requestFocus(); Point pnt = SwingUtilities.convertPoint(GridCaptionPanel.this, e.getPoint(), mySelectedContainer.getDelegee()); - RadAbstractGridLayoutManager layout = mySelectedContainer.getGridLayoutManager(); - if (layout.canResizeCells()) { - myResizeLine = layout.getGridLineNear(mySelectedContainer, myIsRow, pnt, 4); + if (canResizeCells()) { + myResizeLine = mySelectedContainer.getGridLayoutManager().getGridLineNear(mySelectedContainer, myIsRow, pnt, 4); } if (!checkShowPopupMenu(e)) { int cell = getCellAt(e.getPoint()); @@ -393,7 +399,10 @@ public class GridCaptionPanel extends JPanel implements ComponentSelectionListen } public void mouseMoved(MouseEvent e) { - if (mySelectedContainer == null || !mySelectedContainer.getGridLayoutManager().canResizeCells()) return; + if (!canResizeCells()) { + return; + } + Point pnt = SwingUtilities.convertPoint(GridCaptionPanel.this, e.getPoint(), mySelectedContainer.getDelegee()); int gridLine = mySelectedContainer.getGridLayoutManager().getGridLineNear(mySelectedContainer, myIsRow, pnt, 4); From c59461be53b67b1339c94df627914b6f5a27551e Mon Sep 17 00:00:00 2001 From: Eugene Zhuravlev Date: Wed, 25 Jan 2012 15:43:42 +0100 Subject: [PATCH 2/3] compile-server: use IDE encoding if project encoding is not specified --- .../compiler/CompileServerManager.java | 3 +- jps/jps-builders/proto/jps_remote_proto.proto | 1 + .../org/jetbrains/jps/api/JpsRemoteProto.java | 42 +++++++++++++++++++ .../src/org/jetbrains/jps/api/ProtoUtil.java | 4 +- .../jps/client/CompileServerClient.java | 4 +- .../jps/server/ServerMessageHandler.java | 2 +- .../org/jetbrains/jps/server/ServerState.java | 8 +++- 7 files changed, 58 insertions(+), 6 deletions(-) diff --git a/java/compiler/impl/src/com/intellij/compiler/CompileServerManager.java b/java/compiler/impl/src/com/intellij/compiler/CompileServerManager.java index e6ed3ce7245c..025bbfbe206b 100644 --- a/java/compiler/impl/src/com/intellij/compiler/CompileServerManager.java +++ b/java/compiler/impl/src/com/intellij/compiler/CompileServerManager.java @@ -48,6 +48,7 @@ import com.intellij.openapi.util.registry.Registry; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.JarFileSystem; import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.openapi.vfs.encoding.EncodingManager; import com.intellij.util.concurrency.Semaphore; import com.intellij.util.messages.MessageBusConnection; import com.intellij.util.net.NetUtils; @@ -354,7 +355,7 @@ public class CompileServerManager implements ApplicationComponent{ fillSdks(globals); fillGlobalLibraries(globals); - return client.sendSetupRequest(data, globals); + return client.sendSetupRequest(data, globals, EncodingManager.getInstance().getDefaultCharsetName()); } private static void fillSdks(List globals) { diff --git a/jps/jps-builders/proto/jps_remote_proto.proto b/jps/jps-builders/proto/jps_remote_proto.proto index 025818b971d2..4f9cbb27b579 100644 --- a/jps/jps-builders/proto/jps_remote_proto.proto +++ b/jps/jps-builders/proto/jps_remote_proto.proto @@ -68,6 +68,7 @@ message Message { repeated PathVariable path_variable = 1; repeated GlobalLibrary global_library = 2; + optional string global_encoding = 3; } message ReloadProjectCommand { diff --git a/jps/jps-builders/src/org/jetbrains/jps/api/JpsRemoteProto.java b/jps/jps-builders/src/org/jetbrains/jps/api/JpsRemoteProto.java index e4524ebcc441..42191910cc47 100644 --- a/jps/jps-builders/src/org/jetbrains/jps/api/JpsRemoteProto.java +++ b/jps/jps-builders/src/org/jetbrains/jps/api/JpsRemoteProto.java @@ -2277,6 +2277,13 @@ public final class JpsRemoteProto { return globalLibrary_.get(index); } + // optional string global_encoding = 3; + public static final int GLOBAL_ENCODING_FIELD_NUMBER = 3; + private boolean hasGlobalEncoding; + private java.lang.String globalEncoding_ = ""; + public boolean hasGlobalEncoding() { return hasGlobalEncoding; } + public java.lang.String getGlobalEncoding() { return globalEncoding_; } + private void initFields() { } public final boolean isInitialized() { @@ -2298,6 +2305,9 @@ public final class JpsRemoteProto { for (org.jetbrains.jps.api.JpsRemoteProto.Message.Request.SetupCommand.GlobalLibrary element : getGlobalLibraryList()) { output.writeMessage(2, element); } + if (hasGlobalEncoding()) { + output.writeString(3, getGlobalEncoding()); + } } private int memoizedSerializedSize = -1; @@ -2314,6 +2324,10 @@ public final class JpsRemoteProto { size += com.google.protobuf.CodedOutputStream .computeMessageSize(2, element); } + if (hasGlobalEncoding()) { + size += com.google.protobuf.CodedOutputStream + .computeStringSize(3, getGlobalEncoding()); + } memoizedSerializedSize = size; return size; } @@ -2478,6 +2492,9 @@ public final class JpsRemoteProto { } result.globalLibrary_.addAll(other.globalLibrary_); } + if (other.hasGlobalEncoding()) { + setGlobalEncoding(other.getGlobalEncoding()); + } return this; } @@ -2508,6 +2525,10 @@ public final class JpsRemoteProto { addGlobalLibrary(subBuilder.buildPartial()); break; } + case 26: { + setGlobalEncoding(input.readString()); + break; + } } } } @@ -2615,6 +2636,27 @@ public final class JpsRemoteProto { return this; } + // optional string global_encoding = 3; + public boolean hasGlobalEncoding() { + return result.hasGlobalEncoding(); + } + public java.lang.String getGlobalEncoding() { + return result.getGlobalEncoding(); + } + public Builder setGlobalEncoding(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + result.hasGlobalEncoding = true; + result.globalEncoding_ = value; + return this; + } + public Builder clearGlobalEncoding() { + result.hasGlobalEncoding = false; + result.globalEncoding_ = getDefaultInstance().getGlobalEncoding(); + return this; + } + // @@protoc_insertion_point(builder_scope:org.jetbrains.jpsservice.Message.Request.SetupCommand) } diff --git a/jps/jps-builders/src/org/jetbrains/jps/api/ProtoUtil.java b/jps/jps-builders/src/org/jetbrains/jps/api/ProtoUtil.java index 982aac28fb0b..681baf46a0d8 100644 --- a/jps/jps-builders/src/org/jetbrains/jps/api/ProtoUtil.java +++ b/jps/jps-builders/src/org/jetbrains/jps/api/ProtoUtil.java @@ -86,7 +86,7 @@ public class ProtoUtil { return JpsRemoteProto.Message.Request.newBuilder().setRequestType(JpsRemoteProto.Message.Request.Type.FS_EVENT).setFsEvent(builder.build()).build(); } - public static JpsRemoteProto.Message.Request createSetupRequest(final Map pathVars, List sdkAndLibs) { + public static JpsRemoteProto.Message.Request createSetupRequest(final Map pathVars, List sdkAndLibs, @Nullable String globalEncoding) { final JpsRemoteProto.Message.Request.SetupCommand.Builder cmdBuilder = JpsRemoteProto.Message.Request.SetupCommand.newBuilder(); if (!pathVars.isEmpty()) { @@ -113,6 +113,8 @@ public class ProtoUtil { } } + cmdBuilder.setGlobalEncoding(globalEncoding); + return JpsRemoteProto.Message.Request.newBuilder().setRequestType(JpsRemoteProto.Message.Request.Type.SETUP_COMMAND).setSetupCommand(cmdBuilder.build()).build(); } diff --git a/jps/jps-builders/src/org/jetbrains/jps/client/CompileServerClient.java b/jps/jps-builders/src/org/jetbrains/jps/client/CompileServerClient.java index 38bc6c074163..474227367a40 100644 --- a/jps/jps-builders/src/org/jetbrains/jps/client/CompileServerClient.java +++ b/jps/jps-builders/src/org/jetbrains/jps/client/CompileServerClient.java @@ -48,9 +48,9 @@ public class CompileServerClient extends SimpleProtobufClient pathVariables, final List sdkAndLibs) throws Exception { + public RequestFuture sendSetupRequest(final Map pathVariables, final List sdkAndLibs, final String globalEncoding) throws Exception { checkConnected(); - return sendRequest(ProtoUtil.createSetupRequest(pathVariables, sdkAndLibs), null); + return sendRequest(ProtoUtil.createSetupRequest(pathVariables, sdkAndLibs, globalEncoding), null); } @NotNull diff --git a/jps/jps-builders/src/org/jetbrains/jps/server/ServerMessageHandler.java b/jps/jps-builders/src/org/jetbrains/jps/server/ServerMessageHandler.java index 7d56cfa35308..4ca62db1af74 100644 --- a/jps/jps-builders/src/org/jetbrains/jps/server/ServerMessageHandler.java +++ b/jps/jps-builders/src/org/jetbrains/jps/server/ServerMessageHandler.java @@ -82,7 +82,7 @@ class ServerMessageHandler extends SimpleChannelHandler { new GlobalLibrary(library.getName(), library.getPathList()) ); } - facade.setGlobals(libs, pathVars); + facade.setGlobals(libs, pathVars, setupCommand.getGlobalEncoding()); reply = ProtoUtil.toMessage(sessionId, ProtoUtil.createCommandCompletedEvent(null)); break; diff --git a/jps/jps-builders/src/org/jetbrains/jps/server/ServerState.java b/jps/jps-builders/src/org/jetbrains/jps/server/ServerState.java index f63aa6c19387..2e8b139b7461 100644 --- a/jps/jps-builders/src/org/jetbrains/jps/server/ServerState.java +++ b/jps/jps-builders/src/org/jetbrains/jps/server/ServerState.java @@ -35,13 +35,15 @@ class ServerState { private final Object myConfigurationLock = new Object(); private final Map myPathVariables = new HashMap(); private final List myGlobalLibraries = new ArrayList(); + private volatile String myGlobalEncoding = null; private volatile boolean myKeepTempCachesInMemory = false; - public void setGlobals(List libs, Map pathVars) { + public void setGlobals(List libs, Map pathVars, String globalEncoding) { synchronized (myConfigurationLock) { clearCahedState(); myGlobalLibraries.addAll(libs); myPathVariables.putAll(pathVars); + myGlobalEncoding = globalEncoding; } } @@ -281,6 +283,10 @@ class ServerState { final String loadPath = isDirectoryBased(projectFile) ? new File(projectFile, IDEA_PROJECT_DIRNAME).getPath() : projectPath; IdeaProjectLoader.loadFromPath(project, loadPath, myPathVariables, getStartupScript()); + final String globalEncoding = myGlobalEncoding; + if (globalEncoding != null && project.getProjectCharset() == null) { + project.setProjectCharset(globalEncoding); + } return project; } From a2a8e2c5a5023583aeb16fc4559daecc37c04fb2 Mon Sep 17 00:00:00 2001 From: peter Date: Wed, 25 Jan 2012 15:53:33 +0100 Subject: [PATCH 3/3] IDEA-79785 Perforce: do not mark file as modified when trying to Get Revision in offline mode --- .../openapi/vcs/history/FileHistoryPanelImpl.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/history/FileHistoryPanelImpl.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/history/FileHistoryPanelImpl.java index f6b02c6a7ed5..1f9bba3fa3b1 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/history/FileHistoryPanelImpl.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/history/FileHistoryPanelImpl.java @@ -992,11 +992,6 @@ public class FileHistoryPanelImpl extends PanelWithActionsAndCloseButton { private void getVersion(final VcsFileRevision revision) { final VirtualFile file = getVirtualFile(); final Project project = myVcs.getProject(); - if ((file != null) && !file.isWritable()) { - if (ReadonlyStatusHandler.getInstance(project).ensureFilesWritable(file).hasReadonlyFiles()) { - return; - } - } new Task.Backgroundable(project, VcsBundle.message("show.diff.progress.title")) { @Override @@ -1034,6 +1029,12 @@ public class FileHistoryPanelImpl extends PanelWithActionsAndCloseButton { public void run() { CommandProcessor.getInstance().executeCommand(project, new Runnable() { public void run() { + if (file != null && !file.isWritable()) { + if (ReadonlyStatusHandler.getInstance(project).ensureFilesWritable(file).hasReadonlyFiles()) { + return; + } + } + try { write(revisionContent); } catch (IOException e) {