Search in sources :

Example 1 with ActionView

use of org.jcryptool.actions.ui.views.ActionView in project core by jcryptool.

the class MoveDownHandler method execute.

public Object execute(ExecutionEvent event) throws ExecutionException {
    ISelection selection = HandlerUtil.getCurrentSelection(event);
    if (selection instanceof IStructuredSelection) {
        ActionView view = (ActionView) HandlerUtil.getActivePart(event);
        TableViewer viewer = view.getViewer();
        ActionItem item = (ActionItem) ((IStructuredSelection) selection).getFirstElement();
        ActionCascadeService.getInstance().moveDown(item);
        // Set focus on moved row
        viewer.setSelection(new StructuredSelection(item));
    }
    return null;
}
Also used : ActionItem(org.jcryptool.actions.core.types.ActionItem) ISelection(org.eclipse.jface.viewers.ISelection) ActionView(org.jcryptool.actions.ui.views.ActionView) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) TableViewer(org.eclipse.jface.viewers.TableViewer)

Example 2 with ActionView

use of org.jcryptool.actions.ui.views.ActionView in project core by jcryptool.

the class MoveUpHandler method execute.

public Object execute(ExecutionEvent event) throws ExecutionException {
    ISelection selection = HandlerUtil.getCurrentSelection(event);
    if (selection instanceof IStructuredSelection) {
        ActionView view = (ActionView) HandlerUtil.getActivePart(event);
        TableViewer viewer = view.getViewer();
        ActionItem item = (ActionItem) ((IStructuredSelection) selection).getFirstElement();
        ActionCascadeService.getInstance().moveUp(item);
        // Set focus on moved row
        viewer.setSelection(new StructuredSelection(item));
    }
    return null;
}
Also used : ActionItem(org.jcryptool.actions.core.types.ActionItem) ISelection(org.eclipse.jface.viewers.ISelection) ActionView(org.jcryptool.actions.ui.views.ActionView) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) TableViewer(org.eclipse.jface.viewers.TableViewer)

Example 3 with ActionView

use of org.jcryptool.actions.ui.views.ActionView in project core by jcryptool.

the class GeneralPage method performOk.

@Override
public boolean performOk() {
    storeValues();
    boolean ret = super.performOk();
    if (ret) {
        ActionView av = getActionView();
        if (av != null)
            av.setFilenameVisibility();
    }
    return ret;
}
Also used : ActionView(org.jcryptool.actions.ui.views.ActionView)

Example 4 with ActionView

use of org.jcryptool.actions.ui.views.ActionView in project core by jcryptool.

the class RecordHandler method execute.

public Object execute(ExecutionEvent event) throws ExecutionException {
    ICommandService service = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
    // $NON-NLS-1$
    Command command = service.getCommand("org.jcryptool.actions.recordCommand");
    // $NON-NLS-1$
    State state = command.getState("org.jcryptool.actions.recordCommand.toggleState");
    doRecord = !(Boolean) state.getValue();
    if (doRecord && HandlerUtil.getActivePart(event) instanceof ActionView) {
        boolean launched = startRecording(HandlerUtil.getActiveEditor(event), (ActionView) HandlerUtil.getActivePart(event));
        if (launched) {
            state.setValue(doRecord);
            service.refreshElements(event.getCommand().getId(), null);
        }
    } else {
        state.setValue(doRecord);
        service.refreshElements(event.getCommand().getId(), null);
    }
    final IWorkbenchWindow ww = HandlerUtil.getActiveWorkbenchWindowChecked(event);
    final IEvaluationService evalService = (IEvaluationService) ww.getService(IEvaluationService.class);
    if (evalService != null) {
        // $NON-NLS-1$
        evalService.requestEvaluation("org.jcryptool.actions.isDoRecord");
    }
    return null;
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) Command(org.eclipse.core.commands.Command) State(org.eclipse.core.commands.State) ActionView(org.jcryptool.actions.ui.views.ActionView) ICommandService(org.eclipse.ui.commands.ICommandService) IEvaluationService(org.eclipse.ui.services.IEvaluationService)

Example 5 with ActionView

use of org.jcryptool.actions.ui.views.ActionView in project core by jcryptool.

the class StartHandler method execute.

public Object execute(final ExecutionEvent event) throws ExecutionException {
    final ActionView view = (ActionView) HandlerUtil.getActivePart(event);
    if (!view.hasContent()) {
        MessageDialog.openInformation(HandlerUtil.getActiveShell(event), Messages.StartHandler_0, Messages.StartHandler_1);
    } else {
        final ActionItem a = (ActionItem) ((IStructuredSelection) (view.getViewer().getSelection())).getFirstElement();
        Job job = new Job(Messages.StartHandler_5) {

            public IStatus run(final IProgressMonitor monitor) {
                return execute(view, a, HandlerUtil.getActiveShell(event), monitor);
            }
        };
        job.setUser(true);
        job.schedule();
    }
    return null;
}
Also used : IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) ActionItem(org.jcryptool.actions.core.types.ActionItem) ActionView(org.jcryptool.actions.ui.views.ActionView) Job(org.eclipse.core.runtime.jobs.Job)

Aggregations

ActionView (org.jcryptool.actions.ui.views.ActionView)7 ActionItem (org.jcryptool.actions.core.types.ActionItem)3 ISelection (org.eclipse.jface.viewers.ISelection)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)2 TableViewer (org.eclipse.jface.viewers.TableViewer)2 Command (org.eclipse.core.commands.Command)1 State (org.eclipse.core.commands.State)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 Job (org.eclipse.core.runtime.jobs.Job)1 FileDialog (org.eclipse.swt.widgets.FileDialog)1 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)1 ICommandService (org.eclipse.ui.commands.ICommandService)1 IEvaluationService (org.eclipse.ui.services.IEvaluationService)1 ActionCascadeService (org.jcryptool.actions.core.registry.ActionCascadeService)1 ImportUtils (org.jcryptool.actions.core.utils.ImportUtils)1