Example usage for org.springframework.ide.eclipse.boot.wizard BootWizardActivator log

List of usage examples for org.springframework.ide.eclipse.boot.wizard BootWizardActivator log

Introduction

In this page you can find the example usage for org.springframework.ide.eclipse.boot.wizard BootWizardActivator log.

Prototype

public static void log(Throwable e) 

Source Link

Usage

From source file:org.springframework.ide.eclipse.boot.wizard.content.ZipFileCodeSet.java

@Override
public boolean hasFile(IPath path) throws UIThreadDownloadDisallowed {
    try {/* w  ww . ja v  a2 s .c om*/
        ensureEntryCache();
        return entries.containsKey(fileKey(path));
    } catch (UIThreadDownloadDisallowed e) {
        throw e;
    } catch (Exception e) {
        BootWizardActivator.log(e);
    }
    return false;
}

From source file:org.springframework.ide.eclipse.boot.wizard.content.ZipFileCodeSet.java

@Override
public boolean hasFolder(IPath path) {
    try {/*from w ww. ja va  2s. com*/
        ensureEntryCache();
        return entries.containsKey(folderKey(path));
    } catch (Exception e) {
        BootWizardActivator.log(e);
    }
    return false;
}

From source file:org.springframework.ide.eclipse.boot.wizard.github.auth.BasicAuthCredentials.java

@Override
public void apply(URLConnection conn) {
    try {//from  w w w . ja  va 2  s.c  o  m
        if (matchHost(conn.getURL().getHost())) {
            conn.setRequestProperty("Authorization", computeAuthString());
        }
    } catch (UnsupportedEncodingException e) {
        //Shouldn't really be possible...
        BootWizardActivator.log(e);
    }
}

From source file:org.springframework.ide.eclipse.boot.wizard.NewSpringBootWizardModel.java

/**
 * Dynamically discover input fields and 'style' options by parsing initializr form.
 *///from w ww.j a  v  a 2s  . com
private void discoverOptions(FieldArrayModel<String> fields,
        HierarchicalMultiSelectionFieldModel<Dependency> dependencies) throws Exception {
    InitializrServiceSpec serviceSpec = parseJsonFrom(new URL(JSON_URL));

    Map<String, String> textInputs = serviceSpec.getTextInputs();
    for (Entry<String, String> e : KNOWN_STRING_INPUTS.entrySet()) {
        String name = e.getKey();
        String defaultValue = textInputs.get(name);
        if (defaultValue != null) {
            fields.add(new StringFieldModel(name, defaultValue).label(e.getValue()));
        }
    }

    { //field: type
        String groupName = "type";
        RadioGroup group = radioGroups.ensureGroup(groupName);
        group.label("Type:");
        for (Type type : serviceSpec.getTypeOptions(groupName)) {
            BuildType bt = KNOWN_TYPES.get(type.getId());
            if (bt != null) {
                for (ImportStrategy is : bt.getImportStrategies()) {
                    TypeRadioInfo radio = new TypeRadioInfo(groupName, type, is);
                    radio.setLabel(is.displayName());
                    group.add(radio);
                }
            }
        }
        //When a type is selected the 'baseUrl' should be update according to its action.
        group.getSelection().selection.addListener(new ValueListener<RadioInfo>() {
            public void gotValue(LiveExpression<RadioInfo> exp, RadioInfo value) {
                try {
                    if (value != null) {
                        URI base = new URI(JSON_URL);
                        URI resolved = base.resolve(((TypeRadioInfo) value).getAction());
                        baseUrl.setValue(resolved.toString());
                    }
                } catch (Exception e) {
                    BootWizardActivator.log(e);
                }
            }
        });
    }

    for (Entry<String, String> e : KNOWN_SINGLE_SELECTS.entrySet()) {
        String groupName = e.getKey();
        RadioGroup group = radioGroups.ensureGroup(groupName);
        group.label(e.getValue());
        addOptions(group, serviceSpec.getSingleSelectOptions(groupName));
        if (groupName.equals("bootVersion")) {
            this.bootVersion = group;
        }
    }

    //styles
    for (DependencyGroup dgroup : serviceSpec.getDependencies()) {
        String catName = dgroup.getName();
        for (Dependency dep : dgroup.getContent()) {
            dependencies.choice(catName, dep.getName(), dep, dep.getDescription(),
                    createEnablementExp(bootVersion, dep));
        }
    }
}

From source file:org.springframework.ide.eclipse.boot.wizard.NewSpringBootWizardModel.java

private LiveExpression<Boolean> createEnablementExp(final RadioGroup bootVersion, final Dependency dep) {
    try {/*ww w . ja va 2s  .  c o  m*/
        String versionRange = dep.getVersionRange();
        if (StringUtils.isNotBlank(versionRange)) {
            return new LiveExpression<Boolean>() {
                {
                    dependsOn(bootVersion.getSelection().selection);
                }

                @Override
                protected Boolean compute() {
                    RadioInfo radio = bootVersion.getValue();
                    if (radio != null) {
                        String versionString = radio.getValue();
                        return dep.isSupportedFor(versionString);
                    }
                    return true;
                }
            };
        }
    } catch (Exception e) {
        BootWizardActivator.log(e);
    }
    return LiveExpression.TRUE;
}

From source file:org.springframework.ide.eclipse.boot.wizard.NewSpringBootWizardModel.java

private URL newURL(String value) {
    try {//from   w w w . j  ava2  s. c  o  m
        return new URL(value);
    } catch (MalformedURLException e) {
        //This should be impossible because the URL syntax is validated beforehand.
        BootWizardActivator.log(e);
        return null;
    }
}