Search in sources :

Example 1 with IShellProvider

use of org.eclipse.jface.window.IShellProvider 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 IShellProvider

use of org.eclipse.jface.window.IShellProvider in project translationstudio8 by heartsome.

the class ResourceMgmtActionProvider method makeActions.

protected void makeActions() {
    IShellProvider sp = new IShellProvider() {

        public Shell getShell() {
            return shell;
        }
    };
    openProjectAction = new OpenResourceAction(sp);
    openProjectAction.setText(WorkbenchNavigatorMessages.actions_ResourceMgmtActionProvider_openProjectAction);
    closeProjectAction = new CloseResourceAction(sp);
    closeProjectAction.setText(WorkbenchNavigatorMessages.actions_ResourceMgmtActionProvider_closeProjectAction);
    //
    // closeUnrelatedProjectsAction = new CloseUnrelatedProjectsAction(sp);
    // closeUnrelatedProjectsAction.setText("关闭无关的项目");
    refreshAction = new RefreshAction(sp) {

        public void run() {
            final IStatus[] errorStatus = new IStatus[1];
            errorStatus[0] = Status.OK_STATUS;
            final WorkspaceModifyOperation op = (WorkspaceModifyOperation) createOperation(errorStatus);
            WorkspaceJob job = new //$NON-NLS-1$
            WorkspaceJob(//$NON-NLS-1$
            "refresh") {

                public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
                    try {
                        op.run(monitor);
                        if (shell != null && !shell.isDisposed()) {
                            shell.getDisplay().asyncExec(new Runnable() {

                                public void run() {
                                    StructuredViewer viewer = getActionSite().getStructuredViewer();
                                    if (viewer != null && viewer.getControl() != null && !viewer.getControl().isDisposed()) {
                                        viewer.refresh();
                                    }
                                }
                            });
                        }
                    } catch (InvocationTargetException e) {
                        String msg = NLS.bind(WorkbenchNavigatorMessages.actions_ResourceMgmtActionProvider_logTitle, getClass().getName(), e.getTargetException());
                        throw new CoreException(new Status(IStatus.ERROR, NavigatorPlugin.PLUGIN_ID, IStatus.ERROR, msg, e.getTargetException()));
                    } catch (InterruptedException e) {
                        return Status.CANCEL_STATUS;
                    }
                    return errorStatus[0];
                }
            };
            ISchedulingRule rule = op.getRule();
            if (rule != null) {
                job.setRule(rule);
            }
            job.setUser(true);
            job.schedule();
        }
    };
    refreshAction.setText(WorkbenchNavigatorMessages.actions_ResourceMgmtActionProvider_refreshAction);
    //$NON-NLS-1$
    refreshAction.setDisabledImageDescriptor(getImageDescriptor("dlcl16/refresh_nav.gif"));
    //$NON-NLS-1$
    refreshAction.setImageDescriptor(getImageDescriptor("elcl16/refresh_nav.gif"));
    refreshAction.setActionDefinitionId(IWorkbenchCommandConstants.FILE_REFRESH);
    if (getContext() == null) {
        refreshAction.setEnabled(false);
    } else {
        IStructuredSelection selection = (IStructuredSelection) getContext().getSelection();
        refreshAction.selectionChanged(selection);
        refreshAction.setEnabled(!selection.isEmpty());
    }
// buildAction = new BuildAction(sp, IncrementalProjectBuilder.INCREMENTAL_BUILD);
// buildAction.setActionDefinitionId(IWorkbenchCommandConstants.PROJECT_BUILD_PROJECT);
}
Also used : IShellProvider(org.eclipse.jface.window.IShellProvider) IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.core.runtime.Status) CloseResourceAction(org.eclipse.ui.actions.CloseResourceAction) IStatus(org.eclipse.core.runtime.IStatus) WorkspaceModifyOperation(org.eclipse.ui.actions.WorkspaceModifyOperation) WorkspaceJob(org.eclipse.core.resources.WorkspaceJob) OpenResourceAction(org.eclipse.ui.actions.OpenResourceAction) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) InvocationTargetException(java.lang.reflect.InvocationTargetException) ISchedulingRule(org.eclipse.core.runtime.jobs.ISchedulingRule) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) RefreshAction(org.eclipse.ui.actions.RefreshAction) CoreException(org.eclipse.core.runtime.CoreException) StructuredViewer(org.eclipse.jface.viewers.StructuredViewer)

Example 3 with IShellProvider

use of org.eclipse.jface.window.IShellProvider in project translationstudio8 by heartsome.

the class PropertiesActionProvider method init.

public void init(final ICommonActionExtensionSite aSite) {
    delegateSelectionProvider = new DelegateSelectionProvider(aSite.getViewSite().getSelectionProvider());
    propertiesAction = new PropertyDialogAction(new IShellProvider() {

        public Shell getShell() {
            return aSite.getViewSite().getShell();
        }
    }, delegateSelectionProvider);
    propertiesAction.setText("属性");
    propertiesAction.setActionDefinitionId(IWorkbenchCommandConstants.FILE_PROPERTIES);
}
Also used : IShellProvider(org.eclipse.jface.window.IShellProvider) PropertyDialogAction(org.eclipse.ui.dialogs.PropertyDialogAction)

Example 4 with IShellProvider

use of org.eclipse.jface.window.IShellProvider in project translationstudio8 by heartsome.

the class RefactorActionGroup method makeActions.

protected void makeActions() {
    IShellProvider sp = new IShellProvider() {

        public Shell getShell() {
            return shell;
        }
    };
    moveAction = new MoveResourceAction(sp);
    moveAction.setText(WorkbenchNavigatorMessages.actions_RefactorActionGroup_moveAction);
    moveAction.setActionDefinitionId(IWorkbenchCommandConstants.FILE_MOVE);
    renameAction = new RenameResourceAndCloseEditorAction(sp, tree);
    renameAction.setText(WorkbenchNavigatorMessages.actions_RefactorActionGroup_renameAction);
    renameAction.setActionDefinitionId(IWorkbenchCommandConstants.FILE_RENAME);
}
Also used : IShellProvider(org.eclipse.jface.window.IShellProvider) MoveResourceAction(org.eclipse.ui.actions.MoveResourceAction)

Example 5 with IShellProvider

use of org.eclipse.jface.window.IShellProvider in project translationstudio8 by heartsome.

the class WorkManagementActionProvider method init.

public void init(ICommonActionExtensionSite aSite) {
    final Shell shell = aSite.getViewSite().getShell();
    IShellProvider sp = new IShellProvider() {

        public Shell getShell() {
            return shell;
        }
    };
    addBookmarkAction = new AddBookmarkAction(sp, true);
    addTaskAction = new AddTaskAction(sp);
}
Also used : IShellProvider(org.eclipse.jface.window.IShellProvider) AddTaskAction(org.eclipse.ui.actions.AddTaskAction) Shell(org.eclipse.swt.widgets.Shell) AddBookmarkAction(org.eclipse.ui.actions.AddBookmarkAction)

Aggregations

IShellProvider (org.eclipse.jface.window.IShellProvider)5 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 WorkspaceJob (org.eclipse.core.resources.WorkspaceJob)1 CoreException (org.eclipse.core.runtime.CoreException)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 IStatus (org.eclipse.core.runtime.IStatus)1 Status (org.eclipse.core.runtime.Status)1 ISchedulingRule (org.eclipse.core.runtime.jobs.ISchedulingRule)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 StructuredViewer (org.eclipse.jface.viewers.StructuredViewer)1 Clipboard (org.eclipse.swt.dnd.Clipboard)1 Shell (org.eclipse.swt.widgets.Shell)1 ISharedImages (org.eclipse.ui.ISharedImages)1 AddBookmarkAction (org.eclipse.ui.actions.AddBookmarkAction)1 AddTaskAction (org.eclipse.ui.actions.AddTaskAction)1 CloseResourceAction (org.eclipse.ui.actions.CloseResourceAction)1 MoveResourceAction (org.eclipse.ui.actions.MoveResourceAction)1 OpenResourceAction (org.eclipse.ui.actions.OpenResourceAction)1 RefreshAction (org.eclipse.ui.actions.RefreshAction)1 WorkspaceModifyOperation (org.eclipse.ui.actions.WorkspaceModifyOperation)1