Package org.jbpm.ui.common.model

Examples of org.jbpm.ui.common.model.Variable


    private class RenameVariableSelectionListener extends SelectionAdapter {

        @Override
        public void widgetSelected(SelectionEvent e) {
            IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
            Variable variable = (Variable) selection.getFirstElement();

            UpdateVariableNameDialog dialog = new UpdateVariableNameDialog(editor.getDefinition());
            dialog.setName(variable.getName());
            int result = dialog.open();
            if (result != IDialogConstants.OK_ID) {
                return;
            }
            String replacement = dialog.getName();

            IResource projectRoot = editor.getDefinitionFile().getParent();
            PortabilityRefactoring ref = new PortabilityRefactoring(
                    editor.getDefinitionFile(), editor.getDefinition(),
                    variable.getName(), replacement);
            boolean useLtk = ref.isUserInteractionNeeded();
            if (useLtk) {
                RenameRefactoringWizard wizard = new RenameRefactoringWizard(ref);
                wizard.setDefaultPageTitle(Messages.getString("Refactoring.variable.name"));

                RefactoringWizardOpenOperation op = new RefactoringWizardOpenOperation(wizard);
                try {
                    result = op.run(Display.getCurrent().getActiveShell(), "");
                    if (result != IDialogConstants.OK_ID) {
                        return;
                    }
                } catch (InterruptedException ex) {
                    // operation was canceled
                }
            }
            variable.setName(replacement);
            if (useLtk) {
                IDE.saveAllEditors(new IResource[] { projectRoot }, false);
            }
        }
View Full Code Here


        @Override
        public void widgetSelected(SelectionEvent e) {
            CreateVariableDialog dialog = new CreateVariableDialog(getDefinition(), StringFormat.class.getName(), true);
            if (dialog.open() == IDialogConstants.OK_ID) {
                Variable variable = new Variable(dialog.getName(), dialog.getType(), dialog.isPublicVisibility());
                getDefinition().addVariable(variable);
                IStructuredSelection selection = new StructuredSelection(variable);
                viewer.setSelection(selection);
            }
        }
View Full Code Here

    private class ChangeVariableSelectionListener extends SelectionAdapter {

        @Override
        public void widgetSelected(SelectionEvent e) {
            IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
            Variable variable = (Variable) selection.getFirstElement();

            CreateVariableDialog dialog = new CreateVariableDialog(getDefinition(), variable.getFormat(), false);
            if (dialog.open() == IDialogConstants.OK_ID) {
                variable.setFormat(dialog.getType());
                variable.setPublicVisibility(dialog.isPublicVisibility());
                viewer.setSelection(selection);
            }
        }
View Full Code Here

        @Override
        public void widgetSelected(SelectionEvent e) {
            List<Variable> newVariables = (List<Variable>) Clipboard.getDefault().getContents();
            for (Variable variable : newVariables) {
                Variable newVariable = getDefinition().getVariablesMap().get(variable.getName());
                if (newVariable == null) {
                    newVariable = new Variable(variable.getName(), variable.getFormat(), variable.isPublicVisibility());
                    getDefinition().addVariable(newVariable);
                } else {
                    newVariable.setFormat(variable.getFormat());
                }
            }
        }
View Full Code Here

                    resultHtml.append("</td></tr>");
                    paramCounter++;
                }
                resultHtml.append("</table>");
            } else if ("GetFormats".equals(commandStr)) {
                Variable variable = WYSIWYGHTMLEditor.getCurrent().getVariablesMap(false).get(tagName);
                resultHtml.append("<select id=\"tagFormat\">");
                if (variable != null) {
                     String format = TagParser.getFormatMapping(variable.getFormat()).getName();
                    // It may not exist variables at all.
                  FormatTag formatTag = FormatTag.getTag(format);
                    for (String f : formatTag.formats.keySet()) {
                        resultHtml.append("<option value=\"" + f + "\">" + formatTag.formats.get(f).name + "</option>");
                    }
                }
                resultHtml.append("</select>");
            } else if ("GetTagImage".equals(commandStr)) {
                //resultHtml.append(MethodTag.getTag(tagName).image);
            } else if ("GetVarTagWidth".equals(commandStr)) {
                resultHtml.append(MethodTag.getTag(tagName).width);
            } else if ("GetVarTagHeight".equals(commandStr)) {
                resultHtml.append(MethodTag.getTag(tagName).height);
            } else if ("IsAvailable".equals(commandStr)) {
                resultHtml.append(WYSIWYGHTMLEditor.getCurrent().isFtlFormat());
                WYSIWYGHTMLEditor.getCurrent().setBrowserLoaded(true);
            } else if ("GetVariableNames".equals(commandStr)) {
                String elementType = request.getParameter("elementType");
                if (!ELEMENT_TYPE_FILTERS.containsKey(elementType)) {
                    WYSIWYGPlugin.logInfo("Invalid param: elementType = " + elementType);
                }
                for (Variable variable : WYSIWYGHTMLEditor.getCurrent().getVariablesList(true)) {
                    String formatAlias = TagParser.getFormatMapping(variable.getFormat()).getName();
                    if (ELEMENT_TYPE_FILTERS.get(elementType).contains(formatAlias)) {
                        if (resultHtml.length() > 0) {
                            resultHtml.append("|");
                        }
                        resultHtml.append(variable.getName());
                    }
                }
            } else {
                WYSIWYGPlugin.logInfo("Unknown cmd: " + commandStr);
            }
View Full Code Here

TOP

Related Classes of org.jbpm.ui.common.model.Variable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.