use of org.eclipse.e4.ui.model.application.ui.basic.MPart in project portfolio by buchen.
the class RunConsistencyChecksHandler method execute.
@Execute
public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart part, @Named(IServiceConstants.ACTIVE_SHELL) Shell shell) {
Client client = MenuHelper.getActiveClient(part);
if (client == null)
return;
new ConsistencyChecksJob(client, true).schedule();
}
use of org.eclipse.e4.ui.model.application.ui.basic.MPart in project portfolio by buchen.
the class SaveAsFileHandler method execute.
@Execute
public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart part, @Named(IServiceConstants.ACTIVE_SHELL) Shell shell, @Named(UIConstants.Parameter.EXTENSION) String extension, @Named(UIConstants.Parameter.ENCRYPTION_METHOD) @Optional String encryptionMethod) {
Client client = MenuHelper.getActiveClient(part);
if (client == null)
return;
if (extension == null)
// $NON-NLS-1$
throw new IllegalArgumentException("Missing file extension parameter");
// check whether encryption is supported
if (// $NON-NLS-1$
"AES256".equals(encryptionMethod) && !ClientFactory.isKeyLengthSupported(256)) {
new JurisdictionFilesDownloadDialog(shell).open();
return;
}
// trigger part to save file
((PortfolioPart) part.getObject()).doSaveAs(part, shell, extension, encryptionMethod);
}
use of org.eclipse.e4.ui.model.application.ui.basic.MPart in project portfolio by buchen.
the class ImportCSVHandler method execute.
@Execute
public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart part, @Named(IServiceConstants.ACTIVE_SHELL) Shell shell) {
Client client = MenuHelper.getActiveClient(part);
if (client == null)
return;
FileDialog fileDialog = new FileDialog(shell, SWT.OPEN);
fileDialog.setFilterNames(new String[] { Messages.CSVImportLabelFileCSV, Messages.CSVImportLabelFileAll });
// $NON-NLS-1$ //$NON-NLS-2$
fileDialog.setFilterExtensions(new String[] { "*.csv", "*.*" });
String fileName = fileDialog.open();
if (fileName == null)
return;
IPreferenceStore preferences = ((PortfolioPart) part.getObject()).getPreferenceStore();
Dialog wizwardDialog = new WizardDialog(shell, new CSVImportWizard(client, preferences, new File(fileName)));
wizwardDialog.open();
}
use of org.eclipse.e4.ui.model.application.ui.basic.MPart in project portfolio by buchen.
the class OpenFileHandler method execute.
@Execute
public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell shell, //
@Optional @Named(IServiceConstants.ACTIVE_PART) MPart activePart, MApplication app, EPartService partService, EModelService modelService) {
FileDialog dialog = new FileDialog(shell, SWT.OPEN);
// $NON-NLS-1$ //$NON-NLS-2$
dialog.setFilterExtensions(new String[] { "*.xml;*.zip;*.portfolio", "*.*" });
dialog.setFilterNames(new String[] { Messages.LabelPortfolioPerformanceFile, Messages.LabelAllFiles });
String fileSelected = dialog.open();
if (fileSelected != null) {
MPart part = partService.createPart(UIConstants.Part.PORTFOLIO);
part.setLabel(new File(fileSelected).getName());
part.setTooltip(fileSelected);
part.getPersistedState().put(UIConstants.File.PERSISTED_STATE_KEY, fileSelected);
if (activePart != null)
activePart.getParent().getChildren().add(part);
else
((MPartStack) modelService.find(UIConstants.PartStack.MAIN, app)).getChildren().add(part);
part.setVisible(true);
part.getParent().setVisible(true);
partService.showPart(part, PartState.ACTIVATE);
}
}
use of org.eclipse.e4.ui.model.application.ui.basic.MPart in project portfolio by buchen.
the class ExportHandler method execute.
@Execute
public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart part, @Named(IServiceConstants.ACTIVE_SHELL) Shell shell) {
Client client = MenuHelper.getActiveClient(part);
if (client == null)
return;
Dialog dialog = new WizardDialog(shell, new ExportWizard(client));
dialog.open();
}
Aggregations