blob: 3185589e0dd67685fda71e54c16f1c63cb5ff424 [file] [log] [blame]
//------------------------------------------------------------------------------
// Copyright (c) 2005, 2007 IBM Corporation and others.
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// which accompanies this distribution, and is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// Contributors:
// IBM Corporation - initial implementation
//------------------------------------------------------------------------------
package org.eclipse.epf.library.preferences;
import org.eclipse.epf.library.LibraryPlugin;
import org.eclipse.jface.preference.IPreferenceStore;
/**
* The Library preferences.
*
* @author Kelvin Low
* @since 1.0
*/
public class LibraryPreferences {
/**
* The Library preference keys prefix.
*/
public static final String PREFIX = "library."; //$NON-NLS-1$
/**
* Preference key for storing the URI of the method library that was opened
* in the last session.
*/
public static final String SAVED_METHOD_LIRARY_URI = PREFIX
+ "savedMethodLibraryURI"; //$NON-NLS-1$
/**
* Preference key for storing the type of the method library that was opened
* in the last session.
*/
public static final String SAVED_METHOD_LIRARY_TYPE = PREFIX
+ "savedMethodLibraryType"; //$NON-NLS-1$
/**
* Preference key for storing the backup before save option.
*/
public static final String BACKUP_BEFORE_SAVE = PREFIX + "backupBeforeSave"; //$NON-NLS-1$
/**
* Preference key for storing the discard unresolved references option.
*/
public static final String DISCARD_UNRESOLVED_REFERENCES = PREFIX
+ "discardUnresolvedReferences"; //$NON-NLS-1$
/**
* Preference key for the horizontal spacing between tasks and roles in the
* role diagram.
*/
public static final String ROLE_DIAGRAM_HORIZONTAL_SPACING = PREFIX
+ "roleDiagramHorizontalSpacing"; //$NON-NLS-1$
/**
* Preference key for the vertical spacing between tasks and roles in the
* role diagram.
*/
public static final String ROLE_DIAGRAM_VERTICAL_SPACING = PREFIX
+ "roleDiagramVerticalSpacing"; //$NON-NLS-1$
/**
* Preference key for the maximun element label text lines in the role diagram.
*/
public static final String ROLE_DIAGRAM_MAX_TEXT_LINES = PREFIX
+ "roleDiagramElementLabelTextLines"; //$NON-NLS-1$
public static final int DEFAULT_ROLE_DIAGRAM_HORIZONTAL_SPACING = 70;
public static final int DEFAULT_ROLE_DIAGRAM_VERTICAL_SPACING = 30;
public static final int DEFAULT_ROLE_DIAGRAM_MAX_TEXT_LINES = 3;
// The plug-in specific preference store.
private static IPreferenceStore prefStore = LibraryPlugin.getDefault()
.getPreferenceStore();
static {
// Initialize the default preference values.
prefStore.setDefault(ROLE_DIAGRAM_HORIZONTAL_SPACING,
DEFAULT_ROLE_DIAGRAM_HORIZONTAL_SPACING);
prefStore.setDefault(ROLE_DIAGRAM_VERTICAL_SPACING,
DEFAULT_ROLE_DIAGRAM_VERTICAL_SPACING);
prefStore.setDefault(ROLE_DIAGRAM_MAX_TEXT_LINES,
DEFAULT_ROLE_DIAGRAM_MAX_TEXT_LINES);
}
/**
* Gets the URI of the method library that was opened in the last session.
*/
public static String getSavedMethodLibraryURI() {
return prefStore.getString(SAVED_METHOD_LIRARY_URI);
}
/**
* Saves the URI of the method library that was opened in the last session.
*/
public static void setSavedMethodLibraryURI(String value) {
prefStore.setValue(SAVED_METHOD_LIRARY_URI, value);
}
/**
* Gets the type of the method library that was opened in the last session.
*/
public static String getSavedMethodLibraryType() {
return prefStore.getString(SAVED_METHOD_LIRARY_TYPE);
}
/**
* Saves the type of the method library that was opened in the last session.
*/
public static void setSavedMethodLibraryType(String value) {
prefStore.setValue(SAVED_METHOD_LIRARY_TYPE, value);
}
/**
* Gets the backup before save option.
*/
public static boolean getBackupBeforeSave() {
return prefStore.getBoolean(BACKUP_BEFORE_SAVE);
}
/**
* Saves the backup before save option.
*/
public static void setBackupBeforeSave(boolean value) {
prefStore.setValue(BACKUP_BEFORE_SAVE, value);
}
/**
* Gets the discard unresolved references option.
*/
public static boolean getDiscardUnresolvedReferences() {
return prefStore.getBoolean(DISCARD_UNRESOLVED_REFERENCES);
}
/**
* Saves the discard unresolved references option.
*/
public static void setDiscardUnresolvedReferences(boolean value) {
prefStore.setValue(DISCARD_UNRESOLVED_REFERENCES, value);
}
/**
* Gets the default role diagram horizontal spacing.
*/
public static int getDefaultRoleDiagramHorizontalSpacing() {
return DEFAULT_ROLE_DIAGRAM_HORIZONTAL_SPACING;
}
/**
* Gets the role diagram horizontal spacing.
*/
public static int getRoleDiagramHorizontalSpacing() {
int value = prefStore.getInt(ROLE_DIAGRAM_HORIZONTAL_SPACING);
return value > 0 ? value : DEFAULT_ROLE_DIAGRAM_HORIZONTAL_SPACING;
}
/**
* Saves the role diagram horizontal spacing.
*/
public static void setRoleDiagramHorizontalSpacing(int value) {
prefStore.setValue(ROLE_DIAGRAM_HORIZONTAL_SPACING, value);
}
/**
* Gets the default role diagram vertical spacing.
*/
public static int getDefaultRoleDiagramVerticalSpacing() {
return DEFAULT_ROLE_DIAGRAM_VERTICAL_SPACING;
}
/**
* Gets the role diagram vertical spacing.
*/
public static int getRoleDiagramVerticalSpacing() {
int value = prefStore.getInt(ROLE_DIAGRAM_VERTICAL_SPACING);
return value > 0 ? value : DEFAULT_ROLE_DIAGRAM_VERTICAL_SPACING;
}
/**
* Saves the role diagram vertical spacing.
*/
public static void setRoleDiagramVerticalSpacing(int value) {
prefStore.setValue(ROLE_DIAGRAM_VERTICAL_SPACING, value);
}
/**
* Gets the default role diagram element label maximum text lines.
*/
public static int getDefaultRoleDiagramMaximumTextLines() {
return DEFAULT_ROLE_DIAGRAM_MAX_TEXT_LINES;
}
/**
* Gets the role diagram element label maximum text lines.
*/
public static int getRoleDiagramMaximumTextLines() {
int value = prefStore.getInt(ROLE_DIAGRAM_MAX_TEXT_LINES);
return value > 0 ? value : DEFAULT_ROLE_DIAGRAM_MAX_TEXT_LINES;
}
/**
* Saves the role diagram element label maximum text lines.
*/
public static void setRoleDiagramMaximumTextLines(int value) {
prefStore.setValue(ROLE_DIAGRAM_MAX_TEXT_LINES, value);
}
}