Search in sources :

Example 1 with ISharedImages

use of org.eclipse.ui.ISharedImages in project translationstudio8 by heartsome.

the class EditActionGroup method makeActions.

protected void makeActions() {
    clipboard = new Clipboard(shell.getDisplay());
    pasteAction = new PasteAction(shell, clipboard);
    pasteAction.setText(WorkbenchNavigatorMessages.actions_EditActionGroup_pasteAction);
    ISharedImages images = PlatformUI.getWorkbench().getSharedImages();
    pasteAction.setDisabledImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE_DISABLED));
    pasteAction.setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE));
    pasteAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_PASTE);
    copyAction = new CopyAction(shell, clipboard, pasteAction);
    copyAction.setText(WorkbenchNavigatorMessages.actions_EditActionGroup_copyAction);
    copyAction.setDisabledImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_COPY_DISABLED));
    copyAction.setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_COPY));
    copyAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_COPY);
    IShellProvider sp = new IShellProvider() {

        public Shell getShell() {
            return shell;
        }
    };
    deleteAction = new DeleteResourceAndCloseEditorAction(sp);
    deleteAction.setText(WorkbenchNavigatorMessages.actions_EditActionGroup_deleteAction);
    deleteAction.setDisabledImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE_DISABLED));
    deleteAction.setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
    deleteAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_DELETE);
}
Also used : IShellProvider(org.eclipse.jface.window.IShellProvider) ISharedImages(org.eclipse.ui.ISharedImages) Clipboard(org.eclipse.swt.dnd.Clipboard)

Example 2 with ISharedImages

use of org.eclipse.ui.ISharedImages in project translationstudio8 by heartsome.

the class WorkingSetRootModeActionGroup method createActions.

private IAction[] createActions() {
    ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages();
    projectsAction = new TopLevelContentAction(false);
    projectsAction.setText(WorkbenchNavigatorMessages.actions_WorkingSetRootModeActionGroup_Project_);
    projectsAction.setImageDescriptor(sharedImages.getImageDescriptor(IDE.SharedImages.IMG_OBJ_PROJECT));
    workingSetsAction = new TopLevelContentAction(true);
    workingSetsAction.setText(WorkbenchNavigatorMessages.actions_WorkingSetRootModeActionGroup_Working_Set_);
    workingSetsAction.setImageDescriptor(WorkbenchNavigatorPlugin.getDefault().getImageRegistry().getDescriptor(//$NON-NLS-1$
    "full/obj16/workingsets.gif"));
    return new IAction[] { projectsAction, workingSetsAction };
}
Also used : IAction(org.eclipse.jface.action.IAction) ISharedImages(org.eclipse.ui.ISharedImages)

Example 3 with ISharedImages

use of org.eclipse.ui.ISharedImages in project tdi-studio-se by Talend.

the class ReconcilerViewer method addMenu.

/**
     * DOC nrousseau Comment method "addMenu".
     */
private void addMenu() {
    ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages();
    Image image = ImageProvider.getImage(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_UNDO));
    Menu popupMenu = new Menu(this.getTextWidget());
    MenuItem undoItem = new MenuItem(popupMenu, SWT.PUSH);
    //$NON-NLS-1$
    undoItem.setText("Undo");
    undoItem.setImage(image);
    undoItem.addListener(SWT.Selection, new Listener() {

        @Override
        public void handleEvent(Event event) {
            doOperation(ITextOperationTarget.UNDO);
            event.doit = false;
        }
    });
    image = ImageProvider.getImage(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_REDO));
    MenuItem redoItem = new MenuItem(popupMenu, SWT.PUSH);
    //$NON-NLS-1$
    redoItem.setText("Redo");
    redoItem.setData(this);
    redoItem.setImage(image);
    redoItem.addListener(SWT.Selection, new Listener() {

        @Override
        public void handleEvent(Event event) {
            doOperation(ITextOperationTarget.REDO);
            event.doit = false;
        }
    });
    // add separator
    new MenuItem(popupMenu, SWT.SEPARATOR);
    image = ImageProvider.getImage(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_COPY));
    MenuItem copyItem = new MenuItem(popupMenu, SWT.PUSH);
    //$NON-NLS-1$
    copyItem.setText("Copy");
    copyItem.setImage(image);
    copyItem.addListener(SWT.Selection, new Listener() {

        @Override
        public void handleEvent(Event event) {
            getTextWidget().copy();
        }
    });
    image = ImageProvider.getImage(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE));
    MenuItem pasteItem = new MenuItem(popupMenu, SWT.PUSH);
    //$NON-NLS-1$
    pasteItem.setText("Paste");
    pasteItem.setData(this);
    pasteItem.setImage(image);
    pasteItem.addListener(SWT.Selection, new Listener() {

        @Override
        public void handleEvent(Event event) {
            getTextWidget().paste();
        }
    });
    MenuItem selectAllItem = new MenuItem(popupMenu, SWT.PUSH);
    //$NON-NLS-1$
    selectAllItem.setText("Select All");
    selectAllItem.addListener(SWT.Selection, new Listener() {

        @Override
        public void handleEvent(Event event) {
            getTextWidget().selectAll();
        }
    });
    getTextWidget().setMenu(popupMenu);
    Listener selectAllListener = new Listener() {

        @Override
        public void handleEvent(Event event) {
            if (event.character == '') {
                // CTRL + A
                getTextWidget().selectAll();
            }
        }
    };
    getTextWidget().addListener(SWT.KeyDown, selectAllListener);
}
Also used : VerifyKeyListener(org.eclipse.swt.custom.VerifyKeyListener) IDocumentListener(org.eclipse.jface.text.IDocumentListener) Listener(org.eclipse.swt.widgets.Listener) DropTargetListener(org.eclipse.swt.dnd.DropTargetListener) ISharedImages(org.eclipse.ui.ISharedImages) DocumentEvent(org.eclipse.jface.text.DocumentEvent) Event(org.eclipse.swt.widgets.Event) VerifyEvent(org.eclipse.swt.events.VerifyEvent) MenuItem(org.eclipse.swt.widgets.MenuItem) Menu(org.eclipse.swt.widgets.Menu) Image(org.eclipse.swt.graphics.Image)

Aggregations

ISharedImages (org.eclipse.ui.ISharedImages)3 IAction (org.eclipse.jface.action.IAction)1 DocumentEvent (org.eclipse.jface.text.DocumentEvent)1 IDocumentListener (org.eclipse.jface.text.IDocumentListener)1 IShellProvider (org.eclipse.jface.window.IShellProvider)1 VerifyKeyListener (org.eclipse.swt.custom.VerifyKeyListener)1 Clipboard (org.eclipse.swt.dnd.Clipboard)1 DropTargetListener (org.eclipse.swt.dnd.DropTargetListener)1 VerifyEvent (org.eclipse.swt.events.VerifyEvent)1 Image (org.eclipse.swt.graphics.Image)1 Event (org.eclipse.swt.widgets.Event)1 Listener (org.eclipse.swt.widgets.Listener)1 Menu (org.eclipse.swt.widgets.Menu)1 MenuItem (org.eclipse.swt.widgets.MenuItem)1