Java Code Examples for org.eclipse.jface.wizard.WizardDialog.getReturnCode()

The following are Jave code examples for showing how to use getReturnCode() of the org.eclipse.jface.wizard.WizardDialog class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: convertigo-eclipse   File: HtmlConnectorDesignComposite.java   View Source Code Vote up 6 votes
public void createCriteriasFromSelection(Document dom) throws EngineException {
	String className = "com.twinsoft.convertigo.beans.core.Criteria";
	
	// Retrieve selected criterias xpath
	String criteriaXpath = xpathEvaluator.getSelectionXpath();

	// Retrieve parent ScreenClass
	HtmlScreenClass parentObject = getParentHtmlScreenClass();

	NewObjectWizard newObjectWizard = new NewObjectWizard(parentObject, className, criteriaXpath, dom);
	WizardDialog wzdlg = new WizardDialog(Display.getCurrent().getActiveShell(), newObjectWizard);
	wzdlg.setPageSize(850, 650);
	wzdlg.open();
	if (wzdlg.getReturnCode() != Window.CANCEL) {
		Criteria criteria = (Criteria)newObjectWizard.newBean;

		// Reload parent ScreenClass in Tree
		fireObjectChanged(new CompositeEvent(parentObject));

		// Set selection on last created criteria (will expand tree to new criteria)
		if (criteria != null) fireObjectSelected(new CompositeEvent(criteria));

		// Set back selection on parent ScreenClass
		fireObjectSelected(new CompositeEvent(parentObject));
	}
}
 
Example 2
Project: convertigo-eclipse   File: DatabaseObjectCreateAction.java   View Source Code Vote up 5 votes
public void run() {
	Display display = Display.getDefault();
	Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);		
	
	Shell shell = getParentShell();
	shell.setCursor(waitCursor);
	
       try {
   		TreeObject parentTreeObject = null;
   		DatabaseObject databaseObject = null;
   		ProjectExplorerView explorerView = getProjectExplorerView();
   		if (explorerView != null) {
   			parentTreeObject = explorerView.getFirstSelectedTreeObject();
   			
   			if (parentTreeObject instanceof ObjectsFolderTreeObject) {
   				parentTreeObject = ((ObjectsFolderTreeObject) parentTreeObject).getParent();
   				databaseObject  = (DatabaseObject) parentTreeObject.getObject();
   			}
   			else {
   				databaseObject = (DatabaseObject) parentTreeObject.getObject();
   			}
   			
   			NewObjectWizard newObjectWizard = new NewObjectWizard(databaseObject, databaseObjectClassName);
       		WizardDialog wzdlg = new WizardDialog(shell, newObjectWizard);
       		wzdlg.setPageSize(850, 650);
       		wzdlg.open();
       		int result = wzdlg.getReturnCode();
       		if ((result != Window.CANCEL) && (newObjectWizard.newBean != null)) {
       			postCreate(parentTreeObject, newObjectWizard.newBean);
       		}
   		}
       }
       catch (Throwable e) {
       	ConvertigoPlugin.logException(e, "Unable to create a new database object '"+ databaseObjectClassName +"'!");
       }
       finally {
		shell.setCursor(null);
		waitCursor.dispose();
       }
}
 
Example 3
Project: convertigo-eclipse   File: MobileComponentCreateAction.java   View Source Code Vote up 5 votes
public void run() {
	Display display = Display.getDefault();
	Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);		
	
	Shell shell = getParentShell();
	shell.setCursor(waitCursor);
	
       try {
   		TreeObject parentTreeObject = null;
   		DatabaseObject databaseObject = null;
   		ProjectExplorerView explorerView = getProjectExplorerView();
   		if (explorerView != null) {
   			parentTreeObject = explorerView.getFirstSelectedTreeObject();
   			
   			if (parentTreeObject instanceof ObjectsFolderTreeObject) {
   				parentTreeObject = ((ObjectsFolderTreeObject) parentTreeObject).getParent();
   				databaseObject  = (DatabaseObject) parentTreeObject.getObject();
   			}
   			else {
   				databaseObject = (DatabaseObject) parentTreeObject.getObject();
   			}
   			
   			ComponentObjectWizard newObjectWizard = new ComponentObjectWizard(databaseObject, databaseObjectClassName);
       		WizardDialog wzdlg = new WizardDialog(shell, newObjectWizard);
       		wzdlg.setPageSize(850, 650);
       		wzdlg.open();
       		int result = wzdlg.getReturnCode();
       		if ((result != Window.CANCEL) && (newObjectWizard.newBean != null)) {
       			postCreate(parentTreeObject, newObjectWizard.newBean);
       		}
   		}
       }
       catch (Throwable e) {
       	ConvertigoPlugin.logException(e, "Unable to create a new database object '"+ databaseObjectClassName +"'!");
       }
       finally {
		shell.setCursor(null);
		waitCursor.dispose();
       }
}
 
Example 4
Project: convertigo-eclipse   File: HtmlConnectorDesignComposite.java   View Source Code Vote up 5 votes
public void createExtractionRuleFromSelection(Document dom) throws EngineException {
	String className = "com.twinsoft.convertigo.beans.core.ExtractionRule";
	
	// Retrieve selected extraction rule xpath
	String extractionrulesXpath = xpathEvaluator.getSelectionXpath();

	// Retrieve parent ScreenClass
	HtmlScreenClass parentObject = getParentHtmlScreenClass();

	// Add extraction rule to screen class
	NewObjectWizard newObjectWizard = new NewObjectWizard(parentObject, className, extractionrulesXpath, dom);
	WizardDialog wzdlg = new WizardDialog(Display.getCurrent().getActiveShell(), newObjectWizard);
	wzdlg.setPageSize(850, 650);
	wzdlg.open();
	if (wzdlg.getReturnCode() != Window.CANCEL) {
		HtmlExtractionRule extractionrule = (HtmlExtractionRule)newObjectWizard.newBean;
		
		// Reload parent ScreenClass in Tree
		fireObjectChanged(new CompositeEvent(parentObject));

		// Set selection on new extraction rule (will expand tree to new extraction rule)
		if (extractionrule != null) fireObjectSelected(new CompositeEvent(extractionrule));

		// Set back selection on parent ScreenClass
		fireObjectSelected(new CompositeEvent(parentObject));		
	}
}
 
Example 5
Project: convertigo-eclipse   File: HtmlConnectorDesignComposite.java   View Source Code Vote up 5 votes
public void createStatementFromSelection() {
	String className = "com.twinsoft.convertigo.beans.core.Statement";
	
	// Retrieve selected statement xpath
	String statementXpath = xpathEvaluator.getSelectionXpath();

	// Retrieve parent Statement
	Statement parentObject = getParentStatement();
	if (parentObject == null) {
		ConvertigoPlugin.errorMessageBox("Unable to create a new statement.\nThe selected handler belongs to a different HTML connector.");
		return;
	}
	
	// Add statement to parent statement
	NewObjectWizard newObjectWizard = new NewObjectWizard(parentObject, className, statementXpath, null);
	WizardDialog wzdlg = new WizardDialog(Display.getCurrent().getActiveShell(), newObjectWizard);
	wzdlg.setPageSize(850, 650);
	wzdlg.open();
	if (wzdlg.getReturnCode() != Window.CANCEL) {
		Statement statement = (Statement)newObjectWizard.newBean;
		
		// Reload parent statement in Tree
		fireObjectChanged(new CompositeEvent(parentObject));

		// Set selection on new statement (will expand tree to new statement)
		if (statement != null) fireObjectSelected(new CompositeEvent(statement));

		// Set back selection on parent statement
		fireObjectSelected(new CompositeEvent(parentObject));
	}
}
 
Example 6
Project: convertigo-eclipse   File: HtmlConnectorDesignComposite.java   View Source Code Vote up 4 votes
public void createScreenClassFromSelection() throws EngineException {
	String className = "com.twinsoft.convertigo.beans.core.ScreenClass";
	
	// Retrieve selected criteria xpath
	String criteriaXpath = xpathEvaluator.getSelectionXpath();

	// Retrieve parent ScreenClass
	HtmlScreenClass parentObject = getParentHtmlScreenClass();
	
	NewObjectWizard newObjectWizard = new NewObjectWizard(parentObject, className);
	WizardDialog wzdlg = new WizardDialog(Display.getCurrent().getActiveShell(), newObjectWizard);
	wzdlg.setPageSize(850, 650);
	wzdlg.open();
	if (wzdlg.getReturnCode() != Window.CANCEL) {
		HtmlScreenClass htmlScreenClass = (HtmlScreenClass)newObjectWizard.newBean;
		if (htmlScreenClass != null) {
			String screenClassName = htmlScreenClass.getName();
			
			// Add criteria to screen class
			createCriteria(htmlScreenClass, criteriaXpath);
			
			// Set detected ScreenClass to newly created one
			if (htmlConnector.isLearning()) {
				detectedScreenClass = htmlScreenClass;
				ConvertigoPlugin.logDebug2("(HtmlConnectorDesignComposite) Detected screen class is set to newly created one named '"+ screenClassName +"'");
			}
			else {
				ConvertigoPlugin.logDebug2("(HtmlConnectorDesignComposite) New screen class named '"+ screenClassName +"' has been added");
			}

			// Reload parent ScreenClass in Tree
			fireObjectChanged(new CompositeEvent(parentObject));

			// Set selection on newly created screenclass
			fireObjectSelected(new CompositeEvent(htmlScreenClass));

			// Highlight new detected ScreenClass in Tree
			if (htmlConnector.isLearning())
				Engine.theApp.fireObjectDetected(new EngineEvent(htmlScreenClass));

			//TODO:toolScreenclass.setEnabled(false);
		}
	}
}
 
Example 7
Project: convertigo-eclipse   File: HtmlConnectorDesignComposite.java   View Source Code Vote up 4 votes
public void createStatementFromGenerator(Document dom) {
	// Retrieve selected statement generator xpath
	String statementGeneratorXpath = xpathEvaluator.getSelectionXpath();
	
	// retrieve element on which generate a statement 
	// every test has been done before activating the button, no need to do them again
	Element element = (Element)(dom.getDocumentElement().getChildNodes().item(0));
	boolean clickable = false, valuable = false, checkable = false, selectable = false, radioable = false, formable = false;

	if(element.getTagName().equalsIgnoreCase("A")){
		clickable = true;
	}else if(element.getTagName().equalsIgnoreCase("INPUT")){
		String type = element.getAttribute("type");
		clickable = Arrays.binarySearch( new String[]{"button", "checkbox", "radio", "submit"}, type)>-1; //warning, must be sort
		valuable = Arrays.binarySearch( new String[]{"", "password", "text"}, type)>-1; //warning, must be sort
		checkable = Arrays.binarySearch( new String[]{"checkbox", "radio"}, type)>-1; //warning, must be sort
		radioable = type.equals("radio");
	}else if(element.getTagName().equalsIgnoreCase("TEXTAREA")){
		valuable = true;
	}else if(element.getTagName().equalsIgnoreCase("SELECT")){
		selectable = true;
	}else if(element.getTagName().equalsIgnoreCase("FORM")){
		formable = true;
	}
	
	// Retrieve parent Statement
	StatementWithExpressions parentObject = getParentStatement();
	
	// launch wizard
	StatementGeneratorWizard statementGeneratorWizard = new StatementGeneratorWizard(parentObject, 
																					statementGeneratorXpath, 
																					new boolean[] {	clickable, 
																									valuable, 
																									checkable, 
																									selectable, 
																									radioable, 
																									formable
																								}
																					);
	
	WizardDialog wzdlg = new WizardDialog(Display.getCurrent().getActiveShell(), statementGeneratorWizard);
	wzdlg.open();
	if (wzdlg.getReturnCode() != Window.CANCEL) {
		// TODO
	}
}