-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 341721: Add context menu item to change terminal name
Change-Id: Idd41b58ad4f052c32d6a9c57303f1b9ef05aff7c
- Loading branch information
1 parent
fe00320
commit 6874b7e
Showing
5 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
...tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/actions/RenameTerminalAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2021 Kichwa Coders Canada Inc. and others. | ||
* | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*******************************************************************************/ | ||
|
||
package org.eclipse.tm.terminal.view.ui.actions; | ||
|
||
import org.eclipse.core.runtime.Assert; | ||
import org.eclipse.jface.dialogs.InputDialog; | ||
import org.eclipse.jface.resource.ImageDescriptor; | ||
import org.eclipse.jface.window.Window; | ||
import org.eclipse.tm.internal.terminal.control.ITerminalViewControl; | ||
import org.eclipse.tm.internal.terminal.control.actions.AbstractTerminalAction; | ||
import org.eclipse.tm.terminal.view.ui.nls.Messages; | ||
import org.eclipse.tm.terminal.view.ui.tabs.TabFolderManager; | ||
|
||
/** | ||
* @since 4.8 | ||
*/ | ||
public class RenameTerminalAction extends AbstractTerminalAction { | ||
|
||
/** | ||
* Constructor. | ||
* | ||
* @param tabFolderManager The parent tab folder manager. Must not be <code>null</code>. | ||
*/ | ||
public RenameTerminalAction(TabFolderManager tabFolderManager) { | ||
super(RenameTerminalAction.class.getName()); | ||
|
||
Assert.isNotNull(tabFolderManager); | ||
setupAction(Messages.RenameTerminalAction_menu, Messages.RenameTerminalAction_tooltip, (ImageDescriptor) null, | ||
(ImageDescriptor) null, (ImageDescriptor) null, true); | ||
} | ||
|
||
@Override | ||
public void run() { | ||
ITerminalViewControl target = getTarget(); | ||
if (target == null) | ||
return; | ||
InputDialog inputDialog = new InputDialog(target.getControl().getShell(), // | ||
Messages.RenameTerminalAction_inputdialog_title, // | ||
Messages.RenameTerminalAction_inputdialog_prompt, // | ||
Messages.RenameTerminalAction_inputdialog_defaulttext, // | ||
null); | ||
if (inputDialog.open() == Window.OK) { | ||
String value = inputDialog.getValue(); | ||
if (value != null) { | ||
target.setTerminalTitle(value); | ||
} | ||
} | ||
|
||
} | ||
|
||
@Override | ||
public void updateAction(boolean aboutToShow) { | ||
setEnabled(aboutToShow && getTarget() != null); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters