Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c430cf0

Browse files
authored
Disable widget dragging/splitting (#940)
1 parent 1969e29 commit c430cf0

File tree

3 files changed

+49
-13
lines changed

3 files changed

+49
-13
lines changed

‎arduino-ide-extension/src/browser/arduino-frontend-contribution.tsx‎

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,14 @@ import {
3939
import { MessageService } from '@theia/core/lib/common/message-service';
4040
import URI from '@theia/core/lib/common/uri';
4141
import {
42+
EditorCommands,
4243
EditorMainMenu,
4344
EditorManager,
4445
EditorOpenerOptions,
4546
} from '@theia/editor/lib/browser';
4647
import { ProblemContribution } from '@theia/markers/lib/browser/problem/problem-contribution';
4748
import { MonacoMenus } from '@theia/monaco/lib/browser/monaco-menu';
48-
import { FileNavigatorContribution } from '@theia/navigator/lib/browser/navigator-contribution';
49+
import { FileNavigatorCommands,FileNavigatorContribution } from '@theia/navigator/lib/browser/navigator-contribution';
4950
import { OutlineViewContribution } from '@theia/outline-view/lib/browser/outline-view-contribution';
5051
import { OutputContribution } from '@theia/output/lib/browser/output-contribution';
5152
import { ScmContribution } from '@theia/scm/lib/browser/scm-contribution';
@@ -344,14 +345,14 @@ export class ArduinoFrontendContribution
344345
app.shell.leftPanelHandler.removeBottomMenu('settings-menu');
345346

346347
this.fileSystemFrontendContribution.onDidChangeEditorFile(e => {
347-
if (e.type === FileChangeType.DELETED) {
348-
const editorWidget = e.editor;
349-
if (SaveableWidget.is(editorWidget)) {
350-
editorWidget.closeWithoutSaving();
351-
} else {
352-
editorWidget.close();
353-
}
348+
if (e.type === FileChangeType.DELETED) {
349+
const editorWidget = e.editor;
350+
if (SaveableWidget.is(editorWidget)) {
351+
editorWidget.closeWithoutSaving();
352+
} else {
353+
editorWidget.close();
354354
}
355+
}
355356
});
356357
}
357358

@@ -485,6 +486,18 @@ export class ArduinoFrontendContribution
485486
}
486487
},
487488
});
489+
490+
for (const command of [
491+
EditorCommands.SPLIT_EDITOR_DOWN,
492+
EditorCommands.SPLIT_EDITOR_LEFT,
493+
EditorCommands.SPLIT_EDITOR_RIGHT,
494+
EditorCommands.SPLIT_EDITOR_UP,
495+
EditorCommands.SPLIT_EDITOR_VERTICAL,
496+
EditorCommands.SPLIT_EDITOR_HORIZONTAL,
497+
FileNavigatorCommands.REVEAL_IN_NAVIGATOR
498+
]) {
499+
registry.unregisterCommand(command);
500+
}
488501
}
489502

490503
registerMenus(registry: MenuModelRegistry) {

‎arduino-ide-extension/src/browser/theia/core/application-shell.ts‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
} from '@theia/core/lib/browser/connection-status-service';
1010
import {
1111
ApplicationShell as TheiaApplicationShell,
12+
DockPanel,
1213
Panel,
1314
Widget,
1415
} from '@theia/core/lib/browser';
@@ -74,6 +75,11 @@ export class ApplicationShell extends TheiaApplicationShell {
7475
return super.addWidget(widget, { ...options, ref });
7576
}
7677

78+
handleEvent(): boolean {
79+
// NOOP, dragging has been disabled
80+
return false
81+
}
82+
7783
// Avoid hiding top panel as we use it for arduino toolbar
7884
protected createTopPanel(): Panel {
7985
const topPanel = super.createTopPanel();
@@ -101,3 +107,16 @@ export class ApplicationShell extends TheiaApplicationShell {
101107
);
102108
}
103109
}
110+
111+
const originalHandleEvent = DockPanel.prototype.handleEvent;
112+
113+
DockPanel.prototype.handleEvent = function (event) {
114+
switch (event.type) {
115+
case 'p-dragenter':
116+
case 'p-dragleave':
117+
case 'p-dragover':
118+
case 'p-drop':
119+
return;
120+
}
121+
originalHandleEvent(event);
122+
};

‎arduino-ide-extension/src/browser/theia/core/common-frontend-contribution.ts‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,15 @@ export class CommonFrontendContribution extends TheiaCommonFrontendContribution
1111
registerCommands(commandRegistry: CommandRegistry): void {
1212
super.registerCommands(commandRegistry);
1313

14-
for (const command of [CommonCommands.CONFIGURE_DISPLAY_LANGUAGE]) {
14+
for (const command of [
15+
CommonCommands.CONFIGURE_DISPLAY_LANGUAGE,
16+
CommonCommands.CLOSE_TAB,
17+
CommonCommands.CLOSE_SAVED_TABS,
18+
CommonCommands.CLOSE_OTHER_TABS,
19+
CommonCommands.CLOSE_ALL_TABS,
20+
CommonCommands.COLLAPSE_PANEL,
21+
CommonCommands.TOGGLE_MAXIMIZED,
22+
]) {
1523
commandRegistry.unregisterCommand(command);
1624
}
1725
}
@@ -32,10 +40,6 @@ export class CommonFrontendContribution extends TheiaCommonFrontendContribution
3240
CommonCommands.SELECT_ICON_THEME,
3341
CommonCommands.SELECT_COLOR_THEME,
3442
CommonCommands.ABOUT_COMMAND,
35-
CommonCommands.CLOSE_TAB,
36-
CommonCommands.CLOSE_OTHER_TABS,
37-
CommonCommands.CLOSE_ALL_TABS,
38-
CommonCommands.COLLAPSE_PANEL,
3943
CommonCommands.SAVE_WITHOUT_FORMATTING, // Patched for https://github.com/eclipse-theia/theia/pull/8877
4044
]) {
4145
registry.unregisterMenuAction(command);

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /