alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

/*
 *                 Sun Public License Notice
 * 
 * The contents of this file are subject to the Sun Public License
 * Version 1.0 (the "License"). You may not use this file except in
 * compliance with the License. A copy of the License is available at
 * http://www.sun.com/
 * 
 * The Original Code is NetBeans. The Initial Developer of the Original
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun
 * Microsystems, Inc. All Rights Reserved.
 */

package org.netbeans.modules.cvsclient;

import java.util.Hashtable;
import java.util.HashSet;
import java.util.HashMap;
import java.util.StringTokenizer;
import java.util.Properties;
import java.io.*;

import org.openide.util.NbBundle;
import org.openide.options.SystemOption;
import org.openide.util.HelpCtx;
import org.openide.util.actions.SystemAction;
import org.openide.util.Utilities;
import org.openide.util.SharedClassObject;
import org.netbeans.modules.vcscore.actions.*;
import org.netbeans.modules.cvsclient.actions.*;
import org.netbeans.modules.javacvs.commands.JavaCvsStatusManager;
import org.netbeans.modules.vcscore.settings.GeneralVcsSettings;
import org.netbeans.modules.vcscore.annotation.AnnotationSupport;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeEvent;
import org.openide.nodes.*;


/** Options for javacvs module
*
* @author Milos Kleint
*/
public class JavaCvsSettings extends SystemOption {

    public static final String PROP_UI_MODE            = "uiMode"; // NOI18N
    public static final String PROP_DISPLAY_TYPE       = "displayType"; // NOI18N
    public static final String PROP_CVS_FILE_STATES    = "cvsFileStates"; // NOI18N
    public static final String PROP_ANNOTATION_PATTERN = "annotationPattern"; // NOI18N
    public static final String PROP_FIRST_TIMER        = "firstTimer"; //NOI18N

    public static final String ANNOTATION_TYPE = "JavaCvs"; // NOI18N
    
    /** Utility field used by bound properties. */
//    private java.beans.PropertyChangeSupport propertyChangeSupport =  new java.beans.PropertyChangeSupport (this);    

    static final long serialVersionUID = -1463396366224442828L;

    private transient PropertyChangeListener propList;
    
    public JavaCvsSettings() {
    }
    
    protected boolean clearSharedData() {
        return super.clearSharedData();
    }
    
    /** Initialize shared state.
     * Should use {@link #putProperty} to set up variables.
     * Subclasses should always call the super method.
     * 

This method need not be called explicitly; it will be called once * the first time a given shared class is used (not for each instance!). */ protected void initialize() { super.initialize(); GeneralVcsSettings settings = (GeneralVcsSettings)SharedClassObject.findObject( GeneralVcsSettings.class, true); propList = new PropertyChangeListener() { public void propertyChange(final PropertyChangeEvent event) { generalSettingsChanged(event.getPropertyName(), event.getOldValue(), event.getNewValue()); } }; settings.addPropertyChangeListener(org.openide.util.WeakListener.propertyChange(propList, settings)); setAnnotationPattern(org.netbeans.modules.cvsclient.editors.JCvsAnnotPatternEditor.DEFAULT_ANNOTATION_PATTERN); java.util.ResourceBundle bundle = NbBundle.getBundle(JavaCvsStatusManager.class); String[] cvsFileStates = new String[12]; cvsFileStates[0] = bundle.getString("JavaCvsStatusManager.LOCAL"); // NOI18N cvsFileStates[1] = bundle.getString("JavaCvsStatusManager.LOCALLY_MODIFIED"); // NOI18N cvsFileStates[2] = bundle.getString("JavaCvsStatusManager.LOCALLY_ADDED"); // NOI18N cvsFileStates[3] = bundle.getString("JavaCvsStatusManager.LOCALLY_REMOVED"); // NOI18N cvsFileStates[4] = bundle.getString("JavaCvsStatusManager.UNKNOWN"); // NOI18N cvsFileStates[5] = bundle.getString("JavaCvsStatusManager.UPTODATE"); // NOI18N cvsFileStates[6] = bundle.getString("JavaCvsStatusManager.NEEDS_CHECKOUT"); // NOI18N cvsFileStates[7] = bundle.getString("JavaCvsStatusManager.NEEDS_MERGE"); // NOI18N cvsFileStates[8] = bundle.getString("JavaCvsStatusManager.NEEDS_PATCH"); // NOI18N cvsFileStates[9] = bundle.getString("JavaCvsStatusManager.NOT_IN_SYNCH"); // NOI18N cvsFileStates[10] = bundle.getString("JavaCvsStatusManager.CONFLICT"); // NOI18N cvsFileStates[11] = bundle.getString("JavaCvsStatusManager.HAS_HIDDEN"); // NOI18N setCvsFileStates(cvsFileStates); setDisplayType(1); setFirstTimer(true); setUiMode(0); } /** human presentable name */ public String displayName() { return NbBundle.getBundle(JavaCvsSettings.class).getString("CTL_JavaCvs_settings"); // NOI18N } public HelpCtx getHelpCtx () { return new HelpCtx (JavaCvsSettings.class); } /** Getter for property uiMode. * @return Value of property uiMode. */ public int getUiMode() { return ((Integer)getProperty(PROP_UI_MODE)).intValue(); } /** Setter for property uiMode. * @param uiMode New value of property uiMode. */ public void setUiMode(int newUiMode) { putProperty(PROP_UI_MODE, new Integer(newUiMode), true); } public boolean isFirstTimer() { return ((Boolean)getProperty(PROP_FIRST_TIMER)).booleanValue(); } public void setFirstTimer(boolean first) { putProperty(PROP_FIRST_TIMER, first ? Boolean.TRUE : Boolean.FALSE, true); } /** Getter for property displayType. * @return Value of property displayType. */ public int getDisplayType() { return ((Integer)getProperty(PROP_DISPLAY_TYPE)).intValue(); } /** Setter for property displayType. * @param displayType New value of property displayType. */ public void setDisplayType(int newDisplayType) { putProperty(PROP_DISPLAY_TYPE, new Integer(newDisplayType), true); } /** Getter for property annotationPattern. * @return Value of property annotationPattern. */ public String getAnnotationPattern() { return (String)getProperty(PROP_ANNOTATION_PATTERN); } /** Setter for property annotationPattern. * @param annotationPattern New value of property annotationPattern. */ public void setAnnotationPattern(String annotationPattern) { String oldPattern = getAnnotationPattern(); if (!annotationPattern.equals(oldPattern)) { AnnotationSupport.PatternType patt = AnnotationSupport.getInstance().registerPatternType(ANNOTATION_TYPE); patt.setStringPattern(annotationPattern); putProperty(PROP_ANNOTATION_PATTERN, annotationPattern, true); } } public void setCvsFileStates(String[] cvsFileStates) { putProperty(PROP_CVS_FILE_STATES, cvsFileStates, true); } public String[] getCvsFileStates() { return (String[])getProperty(PROP_CVS_FILE_STATES); } public boolean isUseGlobal() { GeneralVcsSettings settings = (GeneralVcsSettings)SharedClassObject.findObject( GeneralVcsSettings.class, true); return settings.isUseGlobal(); } /** Getter for property offLine. * @return Value of property offLine. */ public boolean isOffLine() { GeneralVcsSettings settings = (GeneralVcsSettings)SharedClassObject.findObject( GeneralVcsSettings.class, true); return settings.isOffLine(); } /** Getter for property autoRefresh. * @return Value of property autoRefresh. */ public int getAutoRefresh() { GeneralVcsSettings settings = (GeneralVcsSettings)SharedClassObject.findObject( GeneralVcsSettings.class, true); return settings.getAutoRefresh(); } /** * if true, hides all shadow files in the filesystems. * "Shadow" means files that don't exist in working directory. * Usually these are Locally-Removed, Needs-Checkout files */ public boolean isHideShadowFiles() { GeneralVcsSettings settings = (GeneralVcsSettings)SharedClassObject.findObject( GeneralVcsSettings.class, true); return settings.isHideShadowFiles(); } public File getHome() { GeneralVcsSettings settings = (GeneralVcsSettings)SharedClassObject.findObject( GeneralVcsSettings.class, true); return settings.getHome(); } private void generalSettingsChanged(String propName, Object oldVal, Object newVal) { if (propName != null && (propName.equals(GeneralVcsSettings.PROP_AUTO_REFRESH) || propName.equals(GeneralVcsSettings.PROP_HOME) || propName.equals(GeneralVcsSettings.PROP_OFFLINE) || propName.equals(GeneralVcsSettings.PROP_USE_GLOBAL))) { firePropertyChange (propName, oldVal, newVal); } } }

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.