Search in sources :

Example 1 with FeatureStyleDialog

use of eu.esdihumboldt.hale.ui.style.dialog.FeatureStyleDialog in project hale by halestudio.

the class TypeStyleHandler method execute.

/**
 * @see IHandler#execute(ExecutionEvent)
 */
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    // collect types and associated data sets
    SetMultimap<DataSet, TypeDefinition> types = collectTypesFromSelection(event);
    Pair<TypeDefinition, DataSet> typeInfo = null;
    // select a type
    if (types.size() == 1) {
        Entry<DataSet, TypeDefinition> entry = types.entries().iterator().next();
        typeInfo = new Pair<TypeDefinition, DataSet>(entry.getValue(), entry.getKey());
    } else if (!types.isEmpty()) {
        // choose through dialog
        DataSetTypeSelectionDialog dialog = new DataSetTypeSelectionDialog(Display.getCurrent().getActiveShell(), "Multiple types: select which to change the style for", null, types);
        if (dialog.open() == DataSetTypeSelectionDialog.OK) {
            typeInfo = dialog.getObject();
        }
    }
    if (typeInfo != null) {
        try {
            FeatureStyleDialog dialog = new FeatureStyleDialog(typeInfo.getFirst(), typeInfo.getSecond());
            dialog.setBlockOnOpen(false);
            dialog.open();
        } catch (Exception e) {
            throw new ExecutionException("Could not open style dialog", e);
        }
    }
    return null;
}
Also used : DataSetTypeSelectionDialog(eu.esdihumboldt.hale.ui.style.DataSetTypeSelectionDialog) DataSet(eu.esdihumboldt.hale.common.instance.model.DataSet) ExecutionException(org.eclipse.core.commands.ExecutionException) FeatureStyleDialog(eu.esdihumboldt.hale.ui.style.dialog.FeatureStyleDialog) ExecutionException(org.eclipse.core.commands.ExecutionException) TypeDefinition(eu.esdihumboldt.hale.common.schema.model.TypeDefinition)

Example 2 with FeatureStyleDialog

use of eu.esdihumboldt.hale.ui.style.dialog.FeatureStyleDialog in project hale by halestudio.

the class FeatureTypeStyleAction method run.

/**
 * @see Action#run()
 */
@Override
public void run() {
    try {
        FeatureStyleDialog dialog = new FeatureStyleDialog(type, dataSet);
        dialog.setBlockOnOpen(false);
        dialog.open();
    } catch (Exception e) {
        // $NON-NLS-1$
        log.error("Error opening style editor dialog", e);
    }
}
Also used : FeatureStyleDialog(eu.esdihumboldt.hale.ui.style.dialog.FeatureStyleDialog)

Aggregations

FeatureStyleDialog (eu.esdihumboldt.hale.ui.style.dialog.FeatureStyleDialog)2 DataSet (eu.esdihumboldt.hale.common.instance.model.DataSet)1 TypeDefinition (eu.esdihumboldt.hale.common.schema.model.TypeDefinition)1 DataSetTypeSelectionDialog (eu.esdihumboldt.hale.ui.style.DataSetTypeSelectionDialog)1 ExecutionException (org.eclipse.core.commands.ExecutionException)1