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:
@@ -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<GlobalLibrary> globals) {
|
||||
|
||||
@@ -68,6 +68,7 @@ message Message {
|
||||
|
||||
repeated PathVariable path_variable = 1;
|
||||
repeated GlobalLibrary global_library = 2;
|
||||
optional string global_encoding = 3;
|
||||
}
|
||||
|
||||
message ReloadProjectCommand {
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
@@ -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<String, String> pathVars, List<GlobalLibrary> sdkAndLibs) {
|
||||
public static JpsRemoteProto.Message.Request createSetupRequest(final Map<String, String> pathVars, List<GlobalLibrary> 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();
|
||||
}
|
||||
|
||||
|
||||
@@ -48,9 +48,9 @@ public class CompileServerClient extends SimpleProtobufClient<JpsServerResponseH
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public RequestFuture sendSetupRequest(final Map<String, String> pathVariables, final List<GlobalLibrary> sdkAndLibs) throws Exception {
|
||||
public RequestFuture sendSetupRequest(final Map<String, String> pathVariables, final List<GlobalLibrary> sdkAndLibs, final String globalEncoding) throws Exception {
|
||||
checkConnected();
|
||||
return sendRequest(ProtoUtil.createSetupRequest(pathVariables, sdkAndLibs), null);
|
||||
return sendRequest(ProtoUtil.createSetupRequest(pathVariables, sdkAndLibs, globalEncoding), null);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -35,13 +35,15 @@ class ServerState {
|
||||
private final Object myConfigurationLock = new Object();
|
||||
private final Map<String, String> myPathVariables = new HashMap<String, String>();
|
||||
private final List<GlobalLibrary> myGlobalLibraries = new ArrayList<GlobalLibrary>();
|
||||
private volatile String myGlobalEncoding = null;
|
||||
private volatile boolean myKeepTempCachesInMemory = false;
|
||||
|
||||
public void setGlobals(List<GlobalLibrary> libs, Map<String, String> pathVars) {
|
||||
public void setGlobals(List<GlobalLibrary> libs, Map<String, String> 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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.uiDesigner.GuiDesignerConfigurable.MyGeneralUI">
|
||||
<grid id="4a770" binding="myPanel" layout-manager="GridLayoutManager" row-count="6" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<grid id="4a770" binding="myPanel" layout-manager="GridLayoutManager" row-count="7" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<xy x="62" y="47" width="473" height="224"/>
|
||||
<xy x="62" y="47" width="493" height="278"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<vspacer id="d5f77">
|
||||
<constraints>
|
||||
<grid row="5" column="0" row-span="1" col-span="2" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
<grid row="6" column="0" row-span="1" col-span="2" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
<component id="2eed8" class="javax.swing.JLabel">
|
||||
@@ -99,6 +99,15 @@
|
||||
</model>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="b9ad7" class="javax.swing.JCheckBox" binding="myResizeHeaders">
|
||||
<constraints>
|
||||
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<margin top="10" left="0" bottom="2" right="2"/>
|
||||
<text value="Resize column and row headers over mouse"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<buttonGroups>
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
|
||||
+13
-4
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user