Java Code Examples for org.eclipse.jface.dialogs.IDialogSettings#getSections()

The following examples show how to use org.eclipse.jface.dialogs.IDialogSettings#getSections() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GlobalGroupSet.java    From ermasterr with Apache License 2.0 4 votes vote down vote up
public static GroupSet load() {
    final GroupSet columnGroups = new GroupSet();

    try {
        final IDialogSettings settings = new DialogSettings("column_group_list");
        String database = settings.get("database");
        if (database == null) {
            database = DBManagerFactory.getAllDBList().get(0);
        }
        columnGroups.setDatabase(database);

        final String path = getPath();
        final File columnGroupListFile = new File(path);

        if (columnGroupListFile.exists()) {
            settings.load(path);

            final UniqueWordDictionary dictionary = new UniqueWordDictionary();

            for (final IDialogSettings columnGroupSection : settings.getSections()) {
                final ColumnGroup columnGroup = new ColumnGroup();

                columnGroup.setGroupName(columnGroupSection.get("group_name"));

                for (final IDialogSettings columnSection : columnGroupSection.getSections()) {
                    final String physicalName = columnSection.get("physical_name");
                    final String logicalName = columnSection.get("logical_name");
                    final SqlType sqlType = SqlType.valueOfId(columnSection.get("type"));
                    final String defaultValue = columnSection.get("default_value");
                    final String description = columnSection.get("description");
                    final String constraint = columnSection.get("constraint");
                    final boolean notNull = Boolean.valueOf(columnSection.get("not_null")).booleanValue();
                    final boolean unique = Boolean.valueOf(columnSection.get("unique")).booleanValue();
                    final Integer length = toInteger(columnSection.get("length"));
                    final Integer decimal = toInteger(columnSection.get("decimal"));
                    final boolean array = Boolean.valueOf(columnSection.get("array")).booleanValue();
                    final Integer arrayDimension = toInteger(columnSection.get("array_dimension"));
                    final boolean unsigned = Boolean.valueOf(columnSection.get("unsigned")).booleanValue();
                    final boolean zerofill = Boolean.valueOf(columnSection.get("zerofill")).booleanValue();
                    final boolean binary = Boolean.valueOf(columnSection.get("binary")).booleanValue();
                    final String args = columnSection.get("args");
                    final boolean charSemantics = Boolean.valueOf(columnSection.get("char_semantics")).booleanValue();

                    final TypeData typeData = new TypeData(length, decimal, array, arrayDimension, unsigned, zerofill, binary, args, charSemantics);

                    Word word = new Word(physicalName, logicalName, sqlType, typeData, description, database);
                    word = dictionary.getUniqueWord(word, true);

                    final NormalColumn column = new NormalColumn(word, notNull, false, unique, false, defaultValue, constraint, null, null, null);

                    columnGroup.addColumn(column);
                }

                columnGroups.add(columnGroup);
            }
        }
    } catch (final IOException e) {
        ERDiagramActivator.showExceptionDialog(e);
    }

    return columnGroups;
}
 
Example 2
Source File: GlobalColumnGroupSet.java    From erflute with Apache License 2.0 4 votes vote down vote up
public static ColumnGroupSet load() {
    final ColumnGroupSet columnGroups = new ColumnGroupSet();
    try {
        final IDialogSettings settings = new DialogSettings("column_group_list");
        String database = settings.get("database");
        if (database == null) {
            database = DBManagerFactory.getAllDBList().get(0);
        }
        columnGroups.setDatabase(database);
        final String path = getPath();
        final File columnGroupListFile = new File(path);
        if (columnGroupListFile.exists()) {
            settings.load(path);
            for (final IDialogSettings columnGroupSection : settings.getSections()) {
                final ColumnGroup columnGroup = new ColumnGroup();
                columnGroup.setGroupName(columnGroupSection.get("group_name"));
                for (final IDialogSettings columnSection : columnGroupSection.getSections()) {
                    final String physicalName = columnSection.get("physical_name");
                    final String logicalName = columnSection.get("logical_name");
                    final SqlType sqlType = SqlType.valueOfId(columnSection.get("type"));
                    final String defaultValue = columnSection.get("default_value");
                    final String description = columnSection.get("description");
                    final String constraint = columnSection.get("constraint");
                    final boolean notNull = Boolean.valueOf(columnSection.get("not_null")).booleanValue();
                    final boolean unique = Boolean.valueOf(columnSection.get("unique")).booleanValue();
                    final Integer length = toInteger(columnSection.get("length"));
                    final Integer decimal = toInteger(columnSection.get("decimal"));
                    final boolean array = Boolean.valueOf(columnSection.get("array")).booleanValue();
                    final Integer arrayDimension = toInteger(columnSection.get("array_dimension"));
                    final boolean unsigned = Boolean.valueOf(columnSection.get("unsigned")).booleanValue();
                    final String args = columnSection.get("args");
                    final boolean charSemantics = Boolean.valueOf(columnSection.get("char_semantics")).booleanValue();
                    final TypeData typeData = new TypeData(length, decimal, array, arrayDimension, unsigned, args, charSemantics);
                    final Word word = new Word(physicalName, logicalName, sqlType, typeData, description, database);
                    final NormalColumn column =
                            new NormalColumn(word, notNull, false, unique, false, defaultValue, constraint, null, null, null);
                    columnGroup.addColumn(column);
                }
                columnGroups.add(columnGroup);
            }
        }
    } catch (final IOException e) {
        Activator.showExceptionDialog(e);
    }
    return columnGroups;
}
 
Example 3
Source File: GlobalGroupSet.java    From ermaster-b with Apache License 2.0 4 votes vote down vote up
public static GroupSet load() {
	GroupSet columnGroups = new GroupSet();

	try {
		IDialogSettings settings = new DialogSettings("column_group_list");
		String database = settings.get("database");
		if (database == null) {
			database = DBManagerFactory.getAllDBList().get(0);
		}
		columnGroups.setDatabase(database);

		String path = getPath();
		File columnGroupListFile = new File(path);

		if (columnGroupListFile.exists()) {
			settings.load(path);

			for (IDialogSettings columnGroupSection : settings
					.getSections()) {
				ColumnGroup columnGroup = new ColumnGroup();

				columnGroup.setGroupName(columnGroupSection
						.get("group_name"));

				for (IDialogSettings columnSection : columnGroupSection
						.getSections()) {
					String physicalName = columnSection
							.get("physical_name");
					String logicalName = columnSection.get("logical_name");
					SqlType sqlType = SqlType.valueOfId(columnSection
							.get("type"));
					String defaultValue = columnSection
							.get("default_value");
					String description = columnSection.get("description");
					String constraint = columnSection.get("constraint");
					boolean notNull = Boolean.valueOf(
							columnSection.get("not_null")).booleanValue();
					boolean unique = Boolean.valueOf(
							columnSection.get("unique")).booleanValue();
					Integer length = toInteger(columnSection.get("length"));
					Integer decimal = toInteger(columnSection
							.get("decimal"));
					boolean array = Boolean.valueOf(
							columnSection.get("array")).booleanValue();
					Integer arrayDimension = toInteger(columnSection
							.get("array_dimension"));
					boolean unsigned = Boolean.valueOf(
							columnSection.get("unsigned")).booleanValue();
					String args = columnSection.get("args");

					TypeData typeData = new TypeData(length, decimal,
							array, arrayDimension, unsigned, args);

					Word word = new Word(physicalName, logicalName,
							sqlType, typeData, description, database);

					NormalColumn column = new NormalColumn(word, notNull,
							false, unique, false, defaultValue, constraint,
							null, null, null);

					columnGroup.addColumn(column);
				}

				columnGroups.add(columnGroup);
			}
		}
	} catch (IOException e) {
		Activator.showExceptionDialog(e);
	}

	return columnGroups;
}