Search in sources :

Example 6 with ActionView

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

the class GeneralPage method performApply.

@Override
protected void performApply() {
    storeValues();
    super.performApply();
    ActionView av = getActionView();
    if (av != null)
        av.setFilenameVisibility();
}
Also used : ActionView(org.jcryptool.actions.ui.views.ActionView)

Example 7 with ActionView

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

the class ImportHandler method execute.

public Object execute(ExecutionEvent event) throws ExecutionException {
    ActionCascadeService service = ActionCascadeService.getInstance();
    if (service.getCurrentActionCascade() != null && service.getCurrentActionCascade().getSize() > 0) {
        boolean confirmImport = MessageDialog.openConfirm(HandlerUtil.getActiveShell(event), Messages.ImportHandler_0, Messages.ImportHandler_1);
        if (!confirmImport) {
            return null;
        }
    }
    ActionView view = (ActionView) HandlerUtil.getActivePart(event);
    FileDialog dialog = new FileDialog(HandlerUtil.getActiveShell(event), SWT.OPEN);
    dialog.setFilterPath(DirectoryService.getUserHomeDir());
    dialog.setFilterNames(Constants.FILTER_NAMES);
    dialog.setFilterExtensions(Constants.FILTER_EXTENSIONS);
    String filename = dialog.open();
    if (filename != null && filename.length() > 0) {
        view.setImportPath(ImportUtils.getPathFromFile(filename));
        ImportUtils importUtil = new ImportUtils(filename);
        boolean isValid = importUtil.validateActionCascade();
        if (isValid) {
            service.setCurrentActionCascade(importUtil.createActionCascade());
        } else {
            MessageDialog.openInformation(HandlerUtil.getActiveShell(event), Messages.ImportHandler_2, Messages.ImportHandler_3);
        }
    }
    return null;
}
Also used : ImportUtils(org.jcryptool.actions.core.utils.ImportUtils) ActionView(org.jcryptool.actions.ui.views.ActionView) ActionCascadeService(org.jcryptool.actions.core.registry.ActionCascadeService) FileDialog(org.eclipse.swt.widgets.FileDialog)

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