/** * Main-method to start the refactoring. * @param params * is not used in this context. * @param manager * is not used in this context. */ @Override public void run(String[] params, ICheatSheetManager manager) { CASLicenseHandlerConfiguration config = CASLicenseHandlerConfiguration.getInstance(); VariationPoint variationPoint = config.getVariationPoint(); VariationPointModel vpm = config.getVariationPointModel(); Map<String, Object> refactoringConfigurations = config.getRefactoringConfigurations(); ConcreteClassifier validator = config.getLicenseValidatorClassifier(); VariabilityRefactoring refactoring = new SemiAutomatedIfStaticConfigClassOPTXOR(validator, config.getVariantToLicenseMap()); VariabilityRefactoringService refactoringService = new VariabilityRefactoringService(); try { refactoringService.refactorFullyAutomated(refactoring, vpm, variationPoint, refactoringConfigurations); } catch (VariabilityRefactoringFailedException e) { LOGGER.error("The IfElseRefactoring failed.", e); // TODO inform user about failed refactoring } // TODO add finish action to the cheat sheet and move the following call into this action CASLicenseHandlerConfiguration.getInstance().refactoringFinished(); }
/** * Main-method to start the dialog. * * @param params * is not used in this context. * @param manager * is not used in this context. */ @Override public void run(String[] params, ICheatSheetManager manager) { FilteredItemsSelectionDialog typeSelectionDialog = initTypeDialog(dialogTitle); int dialogResult = typeSelectionDialog.open(); if (dialogResult != Window.OK) { notifyResult(false); } else { IType type = (IType) typeSelectionDialog.getResult()[0]; Optional<ConcreteClassifier> classifier = JaMoPPRoutines.getConcreteClassifierOf(type); if (classifier.isPresent()) { processFoundClassifier(classifier.get()); notifyResult(true); } else { openErrorMessage(); notifyResult(false); } } }
/** * Main-method to start the dialog. * * @param params * is not used in this context. * @param manager * is not used in this context. */ @Override public void run(String[] params, ICheatSheetManager manager) { MappingDialog dialog = new MappingDialog(Display.getCurrent().getActiveShell()); int returnCode = dialog.open(); if (returnCode == MappingDialog.OK) { notifyResult(true); return; } if (returnCode == MappingDialog.DATA_INCOMPLETE) { MessageDialog.openWarning(Display.getCurrent().getActiveShell(), "Incomplete Mapping Information", "You did not provide all necessary mapping information. Please repeat this step."); } notifyResult(false); }
public void run(String[] params, ICheatSheetManager manager) { if ((params != null) && (params.length > 0)) { IWorkbench workbench = PlatformUI.getWorkbench(); INewWizard wizard = getWizard(params[0]); wizard.init(workbench, new StructuredSelection()); WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getShell(), wizard); dialog.create(); dialog.open(); // did the wizard succeed ? notifyResult(dialog.getReturnCode() == Window.OK); } }
public void run( String[] params, ICheatSheetManager manager ) { this.params = params; IEditorPart editor = UIUtil.getActiveReportEditor( ); if ( editor instanceof MultiPageReportEditor ) { // switch to Design Page ( (MultiPageReportEditor) editor ).setActivePage( ReportLayoutEditorFormPage.ID); // init some variables ReportLayoutEditor reportDesigner = (ReportLayoutEditor) ( (MultiPageReportEditor) editor ) .getActivePageInstance( ); AbstractEditPartViewer viewer = (AbstractEditPartViewer) reportDesigner .getGraphicalViewer( ); // tries to select the EditPart for the item name selectEditPartForItemName( params[0], (MultiPageReportEditor) editor, viewer ); // if the viewer selection contains a match for the class, proceed selection = matchSelectionType( viewer ); if ( selection != null ) { IAction action = getAction( reportDesigner ); if ( action != null && action.isEnabled( ) ) { action.run( ); } } else { // show an error dialog asking to select the right element showErrorWrongElementSelection( ); } } else { // show an error asking to select the right editor showErrorWrongEditor( ); } }
public void run( String[] params, ICheatSheetManager manager ) { if ( this.helper != null ) { this.helper.run( params, manager ); return; } if ( params.length < 1 ) throw new IllegalArgumentException( ); PlatformUI.getWorkbench( ) .getHelpSystem( ) .displayHelpResource( params[0] ); }
@Override public void run(String[] params, ICheatSheetManager manager) { if (params == null || params[0] == null) { return; } IWorkspace workspace = ResourcesPlugin.getWorkspace(); String projectName = params[0]; String zipName = params[1]; IProjectDescription newProjectDescription = workspace.newProjectDescription(projectName); IProject newProject = workspace.getRoot().getProject(projectName); try { newProject.create(newProjectDescription, null); newProject.open(null); URL url = this.getClass().getClassLoader().getResource(zipName); File f = new File(FileLocator.toFileURL(url).getPath()); IOverwriteQuery overwriteQuery = new IOverwriteQuery() { public String queryOverwrite(String file) { System.out.println(file); return ALL; } }; FileSystemStructureProvider provider = FileSystemStructureProvider.INSTANCE; File root = createTempDirectory(); unzip(f.getAbsolutePath(), root.getAbsolutePath()); List<File> files = readFiles(root.getAbsolutePath()); ImportOperation importOperation = new ImportOperation(newProject.getFullPath(), root, provider, overwriteQuery, files); importOperation.setCreateContainerStructure(false); importOperation.run(new NullProgressMonitor()); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } }
public void run(String[] params, ICheatSheetManager manager) { run(); notifyResult(true); }
void run(String[] params, ICheatSheetManager manager);