mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-01 05:15:43 +02:00
[cleanup] avoid Platform internal access
This commit is contained in:
parent
3cb3bf5842
commit
ac40768eab
6 changed files with 39 additions and 50 deletions
|
@ -44,27 +44,29 @@ abstract public class TerminalAction extends Action {
|
||||||
strDisabledImage, bEnabled, imageRegistry);
|
strDisabledImage, bEnabled, imageRegistry);
|
||||||
}
|
}
|
||||||
protected void setupAction(String strText, String strToolTip,
|
protected void setupAction(String strText, String strToolTip,
|
||||||
String strImage, String strEnabledImage, String strDisabledImage,
|
String strHoverImage, String strEnabledImage, String strDisabledImage,
|
||||||
boolean bEnabled, ImageRegistry imageRegistry) {
|
boolean bEnabled, ImageRegistry imageRegistry) {
|
||||||
ImageDescriptor imageDescriptor;
|
setupAction(strText,
|
||||||
|
strToolTip,
|
||||||
|
imageRegistry.getDescriptor(strHoverImage),
|
||||||
|
imageRegistry.getDescriptor(strEnabledImage),
|
||||||
|
imageRegistry.getDescriptor(strDisabledImage),
|
||||||
|
bEnabled);
|
||||||
|
}
|
||||||
|
protected void setupAction(String strText, String strToolTip,
|
||||||
|
ImageDescriptor hoverImage, ImageDescriptor enabledImage, ImageDescriptor disabledImage,
|
||||||
|
boolean bEnabled) {
|
||||||
setText(strText);
|
setText(strText);
|
||||||
setToolTipText(strToolTip);
|
setToolTipText(strToolTip);
|
||||||
setEnabled(bEnabled);
|
setEnabled(bEnabled);
|
||||||
|
if (enabledImage != null) {
|
||||||
imageDescriptor = imageRegistry.getDescriptor(strEnabledImage);
|
setImageDescriptor(enabledImage);
|
||||||
if (imageDescriptor != null) {
|
|
||||||
setImageDescriptor(imageDescriptor);
|
|
||||||
}
|
}
|
||||||
|
if (disabledImage != null) {
|
||||||
imageDescriptor = imageRegistry.getDescriptor(strDisabledImage);
|
setDisabledImageDescriptor(disabledImage);
|
||||||
if (imageDescriptor != null) {
|
|
||||||
setDisabledImageDescriptor(imageDescriptor);
|
|
||||||
}
|
}
|
||||||
|
if (hoverImage != null) {
|
||||||
imageDescriptor = imageRegistry.getDescriptor(strImage);
|
setHoverImageDescriptor(hoverImage);
|
||||||
if (imageDescriptor != null) {
|
|
||||||
setHoverImageDescriptor(imageDescriptor);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.tm.terminal.internal.actions;
|
package org.eclipse.tm.terminal.internal.actions;
|
||||||
|
|
||||||
|
import org.eclipse.jface.resource.ImageDescriptor;
|
||||||
import org.eclipse.tm.terminal.internal.view.ITerminalView;
|
import org.eclipse.tm.terminal.internal.view.ITerminalView;
|
||||||
|
|
||||||
public class TerminalActionClearAll extends TerminalAction
|
public class TerminalActionClearAll extends TerminalAction
|
||||||
|
@ -27,7 +28,7 @@ public class TerminalActionClearAll extends TerminalAction
|
||||||
|
|
||||||
setupAction(ActionMessages.CLEARALL,
|
setupAction(ActionMessages.CLEARALL,
|
||||||
ActionMessages.CLEARALL,
|
ActionMessages.CLEARALL,
|
||||||
null,
|
(ImageDescriptor)null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
false);
|
false);
|
||||||
|
|
|
@ -16,10 +16,9 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.tm.terminal.internal.actions;
|
package org.eclipse.tm.terminal.internal.actions;
|
||||||
|
|
||||||
import org.eclipse.jface.resource.ImageRegistry;
|
|
||||||
import org.eclipse.tm.terminal.internal.view.ITerminalView;
|
import org.eclipse.tm.terminal.internal.view.ITerminalView;
|
||||||
import org.eclipse.ui.ISharedImages;
|
import org.eclipse.ui.ISharedImages;
|
||||||
import org.eclipse.ui.internal.WorkbenchImages;
|
import org.eclipse.ui.PlatformUI;
|
||||||
|
|
||||||
public class TerminalActionCopy extends TerminalAction
|
public class TerminalActionCopy extends TerminalAction
|
||||||
{
|
{
|
||||||
|
@ -27,17 +26,13 @@ public class TerminalActionCopy extends TerminalAction
|
||||||
{
|
{
|
||||||
super(target,
|
super(target,
|
||||||
TerminalActionCopy.class.getName());
|
TerminalActionCopy.class.getName());
|
||||||
|
ISharedImages si = PlatformUI.getWorkbench().getSharedImages();
|
||||||
ImageRegistry imageRegistry;
|
|
||||||
|
|
||||||
imageRegistry = WorkbenchImages.getImageRegistry();
|
|
||||||
setupAction(ActionMessages.COPY,
|
setupAction(ActionMessages.COPY,
|
||||||
ActionMessages.COPY,
|
ActionMessages.COPY,
|
||||||
ISharedImages.IMG_TOOL_COPY,
|
si.getImageDescriptor(ISharedImages.IMG_TOOL_COPY),
|
||||||
ISharedImages.IMG_TOOL_COPY,
|
si.getImageDescriptor(ISharedImages.IMG_TOOL_COPY),
|
||||||
ISharedImages.IMG_TOOL_COPY_DISABLED,
|
si.getImageDescriptor(ISharedImages.IMG_TOOL_COPY_DISABLED),
|
||||||
true,
|
true);
|
||||||
imageRegistry);
|
|
||||||
}
|
}
|
||||||
public void run() {
|
public void run() {
|
||||||
fTarget.onEditCopy();
|
fTarget.onEditCopy();
|
||||||
|
|
|
@ -16,10 +16,9 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.tm.terminal.internal.actions;
|
package org.eclipse.tm.terminal.internal.actions;
|
||||||
|
|
||||||
import org.eclipse.jface.resource.ImageRegistry;
|
|
||||||
import org.eclipse.tm.terminal.internal.view.ITerminalView;
|
import org.eclipse.tm.terminal.internal.view.ITerminalView;
|
||||||
import org.eclipse.ui.ISharedImages;
|
import org.eclipse.ui.ISharedImages;
|
||||||
import org.eclipse.ui.internal.WorkbenchImages;
|
import org.eclipse.ui.PlatformUI;
|
||||||
|
|
||||||
public class TerminalActionCut extends TerminalAction
|
public class TerminalActionCut extends TerminalAction
|
||||||
{
|
{
|
||||||
|
@ -27,17 +26,13 @@ public class TerminalActionCut extends TerminalAction
|
||||||
{
|
{
|
||||||
super(target,
|
super(target,
|
||||||
TerminalActionCut.class.getName());
|
TerminalActionCut.class.getName());
|
||||||
|
ISharedImages si = PlatformUI.getWorkbench().getSharedImages();
|
||||||
ImageRegistry imageRegistry;
|
|
||||||
|
|
||||||
imageRegistry = WorkbenchImages.getImageRegistry();
|
|
||||||
setupAction(ActionMessages.CUT,
|
setupAction(ActionMessages.CUT,
|
||||||
ActionMessages.CUT,
|
ActionMessages.CUT,
|
||||||
ISharedImages.IMG_TOOL_CUT,
|
si.getImageDescriptor(ISharedImages.IMG_TOOL_CUT),
|
||||||
ISharedImages.IMG_TOOL_CUT,
|
si.getImageDescriptor(ISharedImages.IMG_TOOL_CUT),
|
||||||
ISharedImages.IMG_TOOL_CUT_DISABLED,
|
si.getImageDescriptor(ISharedImages.IMG_TOOL_CUT_DISABLED),
|
||||||
true,
|
true);
|
||||||
imageRegistry);
|
|
||||||
}
|
}
|
||||||
public void run() {
|
public void run() {
|
||||||
fTarget.onEditCut();
|
fTarget.onEditCut();
|
||||||
|
|
|
@ -16,10 +16,9 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.tm.terminal.internal.actions;
|
package org.eclipse.tm.terminal.internal.actions;
|
||||||
|
|
||||||
import org.eclipse.jface.resource.ImageRegistry;
|
|
||||||
import org.eclipse.tm.terminal.internal.view.ITerminalView;
|
import org.eclipse.tm.terminal.internal.view.ITerminalView;
|
||||||
import org.eclipse.ui.ISharedImages;
|
import org.eclipse.ui.ISharedImages;
|
||||||
import org.eclipse.ui.internal.WorkbenchImages;
|
import org.eclipse.ui.PlatformUI;
|
||||||
|
|
||||||
public class TerminalActionPaste extends TerminalAction
|
public class TerminalActionPaste extends TerminalAction
|
||||||
{
|
{
|
||||||
|
@ -27,17 +26,13 @@ public class TerminalActionPaste extends TerminalAction
|
||||||
{
|
{
|
||||||
super(target,
|
super(target,
|
||||||
TerminalActionPaste.class.getName());
|
TerminalActionPaste.class.getName());
|
||||||
|
ISharedImages si = PlatformUI.getWorkbench().getSharedImages();
|
||||||
ImageRegistry imageRegistry;
|
|
||||||
|
|
||||||
imageRegistry = WorkbenchImages.getImageRegistry();
|
|
||||||
setupAction(ActionMessages.PASTE,
|
setupAction(ActionMessages.PASTE,
|
||||||
ActionMessages.PASTE,
|
ActionMessages.PASTE,
|
||||||
ISharedImages.IMG_TOOL_PASTE,
|
si.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE),
|
||||||
ISharedImages.IMG_TOOL_PASTE_DISABLED,
|
si.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE_DISABLED),
|
||||||
ISharedImages.IMG_TOOL_PASTE,
|
si.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE),
|
||||||
false,
|
false);
|
||||||
imageRegistry);
|
|
||||||
}
|
}
|
||||||
public void run() {
|
public void run() {
|
||||||
fTarget.onEditPaste();
|
fTarget.onEditPaste();
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.tm.terminal.internal.actions;
|
package org.eclipse.tm.terminal.internal.actions;
|
||||||
|
|
||||||
|
import org.eclipse.jface.resource.ImageDescriptor;
|
||||||
import org.eclipse.tm.terminal.internal.view.ITerminalView;
|
import org.eclipse.tm.terminal.internal.view.ITerminalView;
|
||||||
|
|
||||||
public class TerminalActionSelectAll extends TerminalAction
|
public class TerminalActionSelectAll extends TerminalAction
|
||||||
|
@ -27,7 +28,7 @@ public class TerminalActionSelectAll extends TerminalAction
|
||||||
|
|
||||||
setupAction(ActionMessages.SELECTALL,
|
setupAction(ActionMessages.SELECTALL,
|
||||||
ActionMessages.SELECTALL,
|
ActionMessages.SELECTALL,
|
||||||
null,
|
(ImageDescriptor)null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
false);
|
false);
|
||||||
|
|
Loading…
Add table
Reference in a new issue