public SelectIssueLinkHandlerFactoryWizardPage() { super( Messages.getString( "org.nightlabs.jfire.issuetracking.ui.issuelink.create.SelectIssueLinkHandlerFactoryWizardPage.title"), //$NON-NLS-1$ Messages.getString( "org.nightlabs.jfire.issuetracking.ui.issuelink.create.SelectIssueLinkHandlerFactoryWizardPage.descriptionDefault")); //$NON-NLS-1$ setDescription( Messages.getString( "org.nightlabs.jfire.issuetracking.ui.issuelink.create.SelectIssueLinkHandlerFactoryWizardPage.description")); //$NON-NLS-1$ }
private void loadProperties() { Job fillStateComboJob = new Job( Messages.getString( "org.nightlabs.jfire.trade.ui.overview.StatableFilterComposite.loadProcessDefinitionsJob.name")) { //$NON-NLS-1$ @Override protected IStatus run(ProgressMonitor monitor) { try { JbpmManagerRemote jbpmManager = JFireEjb3Factory.getRemoteBean( JbpmManagerRemote.class, Login.getLogin().getInitialContextProperties()); String[] FETCH_GROUPS_ISSUE_TYPE = new String[] { FetchPlan.DEFAULT, IssueType.FETCH_GROUP_NAME, IssueType.FETCH_GROUP_PROCESS_DEFINITION }; IssueTypeDAO issueTypeDAO = IssueTypeDAO.sharedInstance(); Collection<IssueType> issueTypes = issueTypeDAO.getAllIssueTypes( FETCH_GROUPS_ISSUE_TYPE, NLJDOHelper.MAX_FETCH_DEPTH_NO_LIMIT, monitor); String[] FETCH_GROUPS_STATE_DEFINITON = new String[] {FetchPlan.DEFAULT, StateDefinition.FETCH_GROUP_NAME}; for (IssueType issueType : issueTypes) { ProcessDefinition processDefinition = issueType.getProcessDefinition(); Set<StateDefinitionID> statedDefinitionIDs = jbpmManager.getStateDefinitionIDs(issueType.getProcessDefinition()); Collection<StateDefinition> stateDefinitions = StateDefinitionDAO.sharedInstance() .getStateDefintions( statedDefinitionIDs, FETCH_GROUPS_STATE_DEFINITON, NLJDOHelper.MAX_FETCH_DEPTH_NO_LIMIT, monitor); processDefinition2StateDefinitions.put( processDefinition, new ArrayList<StateDefinition>(stateDefinitions)); } Display.getDefault() .syncExec( new Runnable() { public void run() { if (processDefinitionsCombo == null || processDefinitionsCombo.isDisposed() || stateDefinitionsCombo == null || stateDefinitionsCombo.isDisposed()) return; Set<ProcessDefinition> processDefinitions = processDefinition2StateDefinitions.keySet(); processDefinitionsCombo.addElement(ALL_PROCESS_DEFINITION); processDefinitionsCombo.addElements(processDefinitions); stateDefinitionsCombo.addElement(ALL_STATE_DEFINITION); if (!processDefinitions.isEmpty()) { ProcessDefinition firstProcessDefinition = processDefinitions.iterator().next(); List<StateDefinition> stateDefinitionList = processDefinition2StateDefinitions.get(firstProcessDefinition); stateDefinitionsCombo.addElements(stateDefinitionList); if (!stateDefinitionList.isEmpty()) { stateDefinitionsCombo.selectElementByIndex(0); } } processDefinitionsCombo.selectElementByIndex(0); if (selectedProcessDefinition != null) { processDefinitionsCombo.setSelection(selectedProcessDefinition); selectedProcessDefinition = null; } if (selectedStateDefinition != null) { stateDefinitionsCombo.setSelection(selectedStateDefinition); selectedStateDefinition = null; } } }); } catch (Exception e) { ExceptionHandlerRegistry.asyncHandleException(e); throw new RuntimeException(e); } return Status.OK_STATUS; } }; fillStateComboJob.schedule(); }
@Override protected void createComposite() { this.setLayout(new GridLayout(3, false)); XComposite mainComposite = new XComposite(this, SWT.NONE, LayoutMode.TIGHT_WRAPPER, LayoutDataMode.GRID_DATA); mainComposite.getGridLayout().numColumns = 2; new Label(mainComposite, SWT.NONE) .setText( Messages.getString( "org.nightlabs.jfire.issuetracking.ui.overview.IssueFilterCompositeStateRelated.issueTypeLabel")); //$NON-NLS-1$ processDefinitionsCombo = new XComboComposite<ProcessDefinition>( mainComposite, SWT.NONE | SWT.READ_ONLY, stateDefinitionLabelProvider); GridData gridData = new GridData(GridData.FILL_HORIZONTAL); processDefinitionsCombo.setLayoutData(gridData); processDefinitionsCombo.setLabelProvider(processDefinitionLabelProvider); processDefinitionsCombo.addSelectionChangedListener( new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent e) { stateDefinitionsCombo.selectElement(ALL_STATE_DEFINITION); stateDefinitionsComboSelected(); ProcessDefinition selectedProcessDefinition = processDefinitionsCombo.getSelectedElement(); boolean isSelectAll = selectedProcessDefinition.equals(ALL_PROCESS_DEFINITION); if (isSelectAll) { getQuery().setProcessDefinitionID(null); getQuery().setFieldEnabled(IssueQuery.FieldName.processDefinitionID, false); } else { getQuery() .setProcessDefinitionID( (ProcessDefinitionID) JDOHelper.getObjectId(selectedProcessDefinition)); getQuery().setFieldEnabled(IssueQuery.FieldName.processDefinitionID, true); } stateDefinitionsCombo.removeAll(); stateDefinitionsCombo.addElement(ALL_STATE_DEFINITION); stateDefinitionsCombo.selectElementByIndex(0); List<StateDefinition> stateDefinitionList = processDefinition2StateDefinitions.get(selectedProcessDefinition); if (selectedProcessDefinition.equals(ALL_PROCESS_DEFINITION)) { for (List<StateDefinition> l : processDefinition2StateDefinitions.values()) { stateDefinitionsCombo.addElements(l); } } else { stateDefinitionsCombo.addElements(stateDefinitionList); } } }); new Label(mainComposite, SWT.NONE) .setText( Messages.getString( "org.nightlabs.jfire.issuetracking.ui.overview.IssueFilterCompositeStateRelated.stateLabel")); //$NON-NLS-1$ stateDefinitionsCombo = new XComboComposite<StateDefinition>( mainComposite, SWT.NONE | SWT.READ_ONLY, stateDefinitionLabelProvider); gridData = new GridData(GridData.FILL_HORIZONTAL); stateDefinitionsCombo.setLayoutData(gridData); stateDefinitionsCombo.addSelectionChangedListener( new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent e) { stateDefinitionsComboSelected(); } }); loadProperties(); }