mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-03 07:05:24 +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);
|
||||
}
|
||||
protected void setupAction(String strText, String strToolTip,
|
||||
String strImage, String strEnabledImage, String strDisabledImage,
|
||||
String strHoverImage, String strEnabledImage, String strDisabledImage,
|
||||
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);
|
||||
setToolTipText(strToolTip);
|
||||
setEnabled(bEnabled);
|
||||
|
||||
imageDescriptor = imageRegistry.getDescriptor(strEnabledImage);
|
||||
if (imageDescriptor != null) {
|
||||
setImageDescriptor(imageDescriptor);
|
||||
if (enabledImage != null) {
|
||||
setImageDescriptor(enabledImage);
|
||||
}
|
||||
|
||||
imageDescriptor = imageRegistry.getDescriptor(strDisabledImage);
|
||||
if (imageDescriptor != null) {
|
||||
setDisabledImageDescriptor(imageDescriptor);
|
||||
if (disabledImage != null) {
|
||||
setDisabledImageDescriptor(disabledImage);
|
||||
}
|
||||
|
||||
imageDescriptor = imageRegistry.getDescriptor(strImage);
|
||||
if (imageDescriptor != null) {
|
||||
setHoverImageDescriptor(imageDescriptor);
|
||||
if (hoverImage != null) {
|
||||
setHoverImageDescriptor(hoverImage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.tm.terminal.internal.actions;
|
||||
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.tm.terminal.internal.view.ITerminalView;
|
||||
|
||||
public class TerminalActionClearAll extends TerminalAction
|
||||
|
@ -27,7 +28,7 @@ public class TerminalActionClearAll extends TerminalAction
|
|||
|
||||
setupAction(ActionMessages.CLEARALL,
|
||||
ActionMessages.CLEARALL,
|
||||
null,
|
||||
(ImageDescriptor)null,
|
||||
null,
|
||||
null,
|
||||
false);
|
||||
|
|
|
@ -16,10 +16,9 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.tm.terminal.internal.actions;
|
||||
|
||||
import org.eclipse.jface.resource.ImageRegistry;
|
||||
import org.eclipse.tm.terminal.internal.view.ITerminalView;
|
||||
import org.eclipse.ui.ISharedImages;
|
||||
import org.eclipse.ui.internal.WorkbenchImages;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
public class TerminalActionCopy extends TerminalAction
|
||||
{
|
||||
|
@ -27,17 +26,13 @@ public class TerminalActionCopy extends TerminalAction
|
|||
{
|
||||
super(target,
|
||||
TerminalActionCopy.class.getName());
|
||||
|
||||
ImageRegistry imageRegistry;
|
||||
|
||||
imageRegistry = WorkbenchImages.getImageRegistry();
|
||||
ISharedImages si = PlatformUI.getWorkbench().getSharedImages();
|
||||
setupAction(ActionMessages.COPY,
|
||||
ActionMessages.COPY,
|
||||
ISharedImages.IMG_TOOL_COPY,
|
||||
ISharedImages.IMG_TOOL_COPY,
|
||||
ISharedImages.IMG_TOOL_COPY_DISABLED,
|
||||
true,
|
||||
imageRegistry);
|
||||
si.getImageDescriptor(ISharedImages.IMG_TOOL_COPY),
|
||||
si.getImageDescriptor(ISharedImages.IMG_TOOL_COPY),
|
||||
si.getImageDescriptor(ISharedImages.IMG_TOOL_COPY_DISABLED),
|
||||
true);
|
||||
}
|
||||
public void run() {
|
||||
fTarget.onEditCopy();
|
||||
|
|
|
@ -16,10 +16,9 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.tm.terminal.internal.actions;
|
||||
|
||||
import org.eclipse.jface.resource.ImageRegistry;
|
||||
import org.eclipse.tm.terminal.internal.view.ITerminalView;
|
||||
import org.eclipse.ui.ISharedImages;
|
||||
import org.eclipse.ui.internal.WorkbenchImages;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
public class TerminalActionCut extends TerminalAction
|
||||
{
|
||||
|
@ -27,17 +26,13 @@ public class TerminalActionCut extends TerminalAction
|
|||
{
|
||||
super(target,
|
||||
TerminalActionCut.class.getName());
|
||||
|
||||
ImageRegistry imageRegistry;
|
||||
|
||||
imageRegistry = WorkbenchImages.getImageRegistry();
|
||||
ISharedImages si = PlatformUI.getWorkbench().getSharedImages();
|
||||
setupAction(ActionMessages.CUT,
|
||||
ActionMessages.CUT,
|
||||
ISharedImages.IMG_TOOL_CUT,
|
||||
ISharedImages.IMG_TOOL_CUT,
|
||||
ISharedImages.IMG_TOOL_CUT_DISABLED,
|
||||
true,
|
||||
imageRegistry);
|
||||
si.getImageDescriptor(ISharedImages.IMG_TOOL_CUT),
|
||||
si.getImageDescriptor(ISharedImages.IMG_TOOL_CUT),
|
||||
si.getImageDescriptor(ISharedImages.IMG_TOOL_CUT_DISABLED),
|
||||
true);
|
||||
}
|
||||
public void run() {
|
||||
fTarget.onEditCut();
|
||||
|
|
|
@ -16,10 +16,9 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.tm.terminal.internal.actions;
|
||||
|
||||
import org.eclipse.jface.resource.ImageRegistry;
|
||||
import org.eclipse.tm.terminal.internal.view.ITerminalView;
|
||||
import org.eclipse.ui.ISharedImages;
|
||||
import org.eclipse.ui.internal.WorkbenchImages;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
public class TerminalActionPaste extends TerminalAction
|
||||
{
|
||||
|
@ -27,17 +26,13 @@ public class TerminalActionPaste extends TerminalAction
|
|||
{
|
||||
super(target,
|
||||
TerminalActionPaste.class.getName());
|
||||
|
||||
ImageRegistry imageRegistry;
|
||||
|
||||
imageRegistry = WorkbenchImages.getImageRegistry();
|
||||
ISharedImages si = PlatformUI.getWorkbench().getSharedImages();
|
||||
setupAction(ActionMessages.PASTE,
|
||||
ActionMessages.PASTE,
|
||||
ISharedImages.IMG_TOOL_PASTE,
|
||||
ISharedImages.IMG_TOOL_PASTE_DISABLED,
|
||||
ISharedImages.IMG_TOOL_PASTE,
|
||||
false,
|
||||
imageRegistry);
|
||||
si.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE),
|
||||
si.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE_DISABLED),
|
||||
si.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE),
|
||||
false);
|
||||
}
|
||||
public void run() {
|
||||
fTarget.onEditPaste();
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.tm.terminal.internal.actions;
|
||||
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.tm.terminal.internal.view.ITerminalView;
|
||||
|
||||
public class TerminalActionSelectAll extends TerminalAction
|
||||
|
@ -27,7 +28,7 @@ public class TerminalActionSelectAll extends TerminalAction
|
|||
|
||||
setupAction(ActionMessages.SELECTALL,
|
||||
ActionMessages.SELECTALL,
|
||||
null,
|
||||
(ImageDescriptor)null,
|
||||
null,
|
||||
null,
|
||||
false);
|
||||
|
|
Loading…
Add table
Reference in a new issue