You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by pa...@apache.org on 2009/08/10 14:27:41 UTC
svn commit: r802761 - in
/directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor:
./ controller/ model/ model/schemachecker/ view/
Author: pamarcelot
Date: Mon Aug 10 12:27:41 2009
New Revision: 802761
URL: http://svn.apache.org/viewvc?rev=802761&view=rev
Log:
Fix for DIRSTUDIO-443 (The warning and error overlay for OCs and ATs sometimes (often) lacks forgets some items):
o Removed the SchemaChecker instance from each project instance and moved it to a global plugin schema checker.
o Synchronized methods in SchemaChecker class
o Due to method synchronization, the SchemaCheckerLabelDecorator now waits for the SchemaChecker to finish the schema verification before adding overlays to elements.
o Various code cleaning and defensive programming modifications.
Modified:
directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/Activator.java
directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/ProblemsViewController.java
directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/ProjectsHandler.java
directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/Project.java
directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/SchemaChecker.java
directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/SchemaEditorSchemaCheckerLabelDecorator.java
Modified: directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/Activator.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/Activator.java?rev=802761&r1=802760&r2=802761&view=diff
==============================================================================
--- directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/Activator.java (original)
+++ directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/Activator.java Mon Aug 10 12:27:41 2009
@@ -84,6 +84,7 @@
{
plugin = this;
projectsHandler = ProjectsHandler.getInstance();
+ schemaChecker = SchemaChecker.getInstance();
}
@@ -136,15 +137,14 @@
if ( newProject == null )
{
schemaHandler = null;
- schemaChecker = null;
}
else
{
- // Registering the SchemaHandler and SchemaChecker
schemaHandler = newProject.getSchemaHandler();
- schemaChecker = newProject.getSchemaChecker();
}
+ schemaChecker.reload();
+
PluginUtils.saveProjects();
}
@@ -331,9 +331,8 @@
{
// We can't use the PLUGIN_ID constant since loading the plugin.properties file has failed,
// So we're using a default plugin id.
- getLog().log(
- new Status( Status.ERROR, "org.apache.directory.studio.schemaeditor", Status.OK, //$NON-NLS-1$
- Messages.getString("Activator.UnablePluginProperties"), e ) ); //$NON-NLS-1$
+ getLog().log( new Status( Status.ERROR, "org.apache.directory.studio.schemaeditor", Status.OK, //$NON-NLS-1$
+ Messages.getString( "Activator.UnablePluginProperties" ), e ) ); //$NON-NLS-1$
}
}
Modified: directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/ProblemsViewController.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/ProblemsViewController.java?rev=802761&r1=802760&r2=802761&view=diff
==============================================================================
--- directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/ProblemsViewController.java (original)
+++ directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/ProblemsViewController.java Mon Aug 10 12:27:41 2009
@@ -25,8 +25,6 @@
import org.apache.directory.studio.schemaeditor.PluginUtils;
import org.apache.directory.studio.schemaeditor.model.AttributeTypeImpl;
import org.apache.directory.studio.schemaeditor.model.ObjectClassImpl;
-import org.apache.directory.studio.schemaeditor.model.Project;
-import org.apache.directory.studio.schemaeditor.model.schemachecker.SchemaChecker;
import org.apache.directory.studio.schemaeditor.model.schemachecker.SchemaCheckerListener;
import org.apache.directory.studio.schemaeditor.view.ViewUtils;
import org.apache.directory.studio.schemaeditor.view.editors.attributetype.AttributeTypeEditor;
@@ -74,28 +72,6 @@
}
};
- /** The ProjectHandlerListener */
- private ProjectsHandlerListener projectsHandlerListener = new ProjectsHandlerAdapter()
- {
- public void openProjectChanged( Project oldProject, Project newProject )
- {
- if ( oldProject != null )
- {
- removeSchemaCheckerListener( oldProject );
- }
-
- if ( newProject != null )
- {
- addSchemaCheckerListener( newProject );
- }
- else
- {
- view.setErrorsAndWarningsCount( 0, 0 );
- view.getViewer().setInput( null );
- }
- }
- };
-
/**
* Creates a new instance of SchemasViewController.
@@ -107,55 +83,14 @@
{
this.view = view;
- // ProjectsHandlerListener
- Activator.getDefault().getProjectsHandler().addListener( projectsHandlerListener );
-
// SchemaCheckerListener
- Project project = Activator.getDefault().getProjectsHandler().getOpenProject();
- if ( project != null )
- {
- addSchemaCheckerListener( project );
- }
+ Activator.getDefault().getSchemaChecker().addListener( schemaCheckerListener );
initDoubleClickListener();
}
/**
- * Adds the SchemaCheckerListener.
- *
- * @param project
- * the project
- */
- private void addSchemaCheckerListener( Project project )
- {
- SchemaChecker schemaChecker = project.getSchemaChecker();
- if ( schemaChecker != null )
- {
- schemaChecker.addListener( schemaCheckerListener );
- schemaChecker.enableModificationsListening();
- }
- }
-
-
- /**
- * Removes the SchemaCheckerListener.
- *
- * @param project
- * the project
- */
- private void removeSchemaCheckerListener( Project project )
- {
- SchemaChecker schemaChecker = project.getSchemaChecker();
- if ( schemaChecker != null )
- {
- schemaChecker.removeListener( schemaCheckerListener );
- schemaChecker.disableModificationsListening();
- }
- }
-
-
- /**
* Initializes the DoubleClickListener.
*/
private void initDoubleClickListener()
@@ -237,14 +172,7 @@
*/
public void dispose()
{
- // ProjectsHandlerListener
- Activator.getDefault().getProjectsHandler().removeListener( projectsHandlerListener );
-
// SchemaCheckerListener
- Project project = Activator.getDefault().getProjectsHandler().getOpenProject();
- if ( project != null )
- {
- removeSchemaCheckerListener( project );
- }
+ Activator.getDefault().getSchemaChecker().removeListener( schemaCheckerListener );
}
}
Modified: directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/ProjectsHandler.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/ProjectsHandler.java?rev=802761&r1=802760&r2=802761&view=diff
==============================================================================
--- directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/ProjectsHandler.java (original)
+++ directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/ProjectsHandler.java Mon Aug 10 12:27:41 2009
@@ -187,7 +187,7 @@
Project oldOpenProject = openProject;
if ( oldOpenProject != null )
{
- openProject.setState( ProjectState.CLOSED );
+ oldOpenProject.setState( ProjectState.CLOSED );
}
openProject = project;
Modified: directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/Project.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/Project.java?rev=802761&r1=802760&r2=802761&view=diff
==============================================================================
--- directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/Project.java (original)
+++ directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/Project.java Mon Aug 10 12:27:41 2009
@@ -26,7 +26,6 @@
import org.apache.directory.studio.connection.core.jobs.StudioProgressMonitor;
import org.apache.directory.studio.schemaeditor.controller.SchemaHandler;
import org.apache.directory.studio.schemaeditor.model.io.SchemaConnector;
-import org.apache.directory.studio.schemaeditor.model.schemachecker.SchemaChecker;
/**
@@ -69,9 +68,6 @@
/** The SchemaHandler */
private SchemaHandler schemaHandler;
- /** The SchemaCheker */
- private SchemaChecker schemaChecker;
-
/** The backup of the Online Schema */
private List<Schema> schemaBackup;
@@ -89,11 +85,7 @@
*/
public Project( ProjectType type, String name )
{
- this.type = type;
- this.name = name;
- this.state = ProjectState.CLOSED;
- schemaHandler = new SchemaHandler();
- schemaChecker = new SchemaChecker();
+ init( type, name, ProjectState.CLOSED );
}
@@ -103,10 +95,7 @@
*/
public Project()
{
- type = ProjectType.OFFLINE;
- this.state = ProjectState.CLOSED;
- schemaHandler = new SchemaHandler();
- schemaChecker = new SchemaChecker();
+ init( ProjectType.OFFLINE, null, ProjectState.CLOSED );
}
@@ -118,10 +107,25 @@
*/
public Project( ProjectType type )
{
+ init( type, null, ProjectState.CLOSED);
+ }
+
+ /**
+ * Inits the project.
+ *
+ * @param type
+ * the type of the project
+ * @param name
+ * the name of the project
+ * @param state
+ * the state of the project
+ */
+ private void init( ProjectType type, String name, ProjectState state)
+ {
this.type = type;
- this.state = ProjectState.CLOSED;
+ this.name = name;
+ this.state = state;
schemaHandler = new SchemaHandler();
- schemaChecker = new SchemaChecker();
}
@@ -210,18 +214,6 @@
/**
- * Gets the SchemaChecker
- *
- * @return
- * the SchemaChecker
- */
- public SchemaChecker getSchemaChecker()
- {
- return schemaChecker;
- }
-
-
- /**
* Gets the Connection.
*
* @return
Modified: directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/SchemaChecker.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/SchemaChecker.java?rev=802761&r1=802760&r2=802761&view=diff
==============================================================================
--- directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/SchemaChecker.java (original)
+++ directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/SchemaChecker.java Mon Aug 10 12:27:41 2009
@@ -29,12 +29,14 @@
import org.apache.directory.shared.ldap.schema.SchemaObject;
import org.apache.directory.shared.ldap.schema.UsageEnum;
import org.apache.directory.studio.schemaeditor.Activator;
+import org.apache.directory.studio.schemaeditor.controller.ProjectsHandlerAdapter;
import org.apache.directory.studio.schemaeditor.controller.SchemaHandler;
import org.apache.directory.studio.schemaeditor.controller.SchemaHandlerAdapter;
import org.apache.directory.studio.schemaeditor.controller.SchemaHandlerListener;
import org.apache.directory.studio.schemaeditor.model.AttributeTypeImpl;
import org.apache.directory.studio.schemaeditor.model.MatchingRuleImpl;
import org.apache.directory.studio.schemaeditor.model.ObjectClassImpl;
+import org.apache.directory.studio.schemaeditor.model.Project;
import org.apache.directory.studio.schemaeditor.model.Schema;
import org.apache.directory.studio.schemaeditor.model.SyntaxImpl;
import org.apache.directory.studio.schemaeditor.model.schemachecker.NonExistingMatchingRuleError.NonExistingMatchingRuleErrorEnum;
@@ -54,8 +56,8 @@
*/
public class SchemaChecker
{
- /** The SchemaHandler */
- private SchemaHandler schemaHandler;
+ /** The SchemaChecker instance */
+ private static SchemaChecker instance;
/** The errors List */
private List<SchemaError> errorsList;
@@ -86,129 +88,153 @@
{
public void attributeTypeAdded( AttributeTypeImpl at )
{
- List<?> deps = getAndDeleteDependencies( at );
+ synchronized ( this )
+ {
+ List<?> deps = getAndDeleteDependencies( at );
- checkAttributeType( at );
+ checkAttributeType( at );
- checkDependencies( deps );
+ checkDependencies( deps );
- notifyListeners();
+ notifyListeners();
+ }
}
public void attributeTypeModified( AttributeTypeImpl at )
{
- List<Object> deps = new ArrayList<Object>();
- List<?> atDeps = ( List<?> ) dependenciesMap.get( at );
- if ( atDeps != null )
+ synchronized ( this )
{
- deps.addAll( atDeps );
- }
+ List<Object> deps = new ArrayList<Object>();
+ List<?> atDeps = ( List<?> ) dependenciesMap.get( at );
+ if ( atDeps != null )
+ {
+ deps.addAll( atDeps );
+ }
- checkAttributeType( at );
+ checkAttributeType( at );
- checkDependencies( deps );
+ checkDependencies( deps );
- notifyListeners();
+ notifyListeners();
+ }
}
public void attributeTypeRemoved( AttributeTypeImpl at )
{
- List<Object> deps = new ArrayList<Object>();
- List<?> atDeps = ( List<?> ) dependenciesMap.get( at );
- if ( atDeps != null )
+ synchronized ( this )
{
- deps.addAll( atDeps );
- }
+ List<Object> deps = new ArrayList<Object>();
+ List<?> atDeps = ( List<?> ) dependenciesMap.get( at );
+ if ( atDeps != null )
+ {
+ deps.addAll( atDeps );
+ }
- removeSchemaObject( at );
+ removeSchemaObject( at );
- checkDependencies( deps );
+ checkDependencies( deps );
- notifyListeners();
+ notifyListeners();
+ }
}
public void objectClassAdded( ObjectClassImpl oc )
{
- List<?> deps = getAndDeleteDependencies( oc );
+ synchronized ( this )
+ {
+ List<?> deps = getAndDeleteDependencies( oc );
- checkObjectClass( oc );
+ checkObjectClass( oc );
- checkDependencies( deps );
+ checkDependencies( deps );
- notifyListeners();
+ notifyListeners();
+ }
}
public void objectClassModified( ObjectClassImpl oc )
{
- List<Object> deps = new ArrayList<Object>();
- List<?> ocDeps = ( List<?> ) dependenciesMap.get( oc );
- if ( ocDeps != null )
+ synchronized ( this )
{
- deps.addAll( ocDeps );
- }
+ List<Object> deps = new ArrayList<Object>();
+ List<?> ocDeps = ( List<?> ) dependenciesMap.get( oc );
+ if ( ocDeps != null )
+ {
+ deps.addAll( ocDeps );
+ }
- checkObjectClass( oc );
+ checkObjectClass( oc );
- checkDependencies( deps );
+ checkDependencies( deps );
- notifyListeners();
+ notifyListeners();
+ }
}
public void objectClassRemoved( ObjectClassImpl oc )
{
- List<Object> deps = new ArrayList<Object>();
- List<?> ocDeps = ( List<?> ) dependenciesMap.get( oc );
- if ( ocDeps != null )
+ synchronized ( this )
{
- deps.addAll( ocDeps );
- }
+ List<Object> deps = new ArrayList<Object>();
+ List<?> ocDeps = ( List<?> ) dependenciesMap.get( oc );
+ if ( ocDeps != null )
+ {
+ deps.addAll( ocDeps );
+ }
- removeSchemaObject( oc );
+ removeSchemaObject( oc );
- checkDependencies( deps );
+ checkDependencies( deps );
- notifyListeners();
+ notifyListeners();
+ }
}
public void schemaAdded( Schema schema )
{
- List<AttributeTypeImpl> ats = schema.getAttributeTypes();
- for ( AttributeTypeImpl at : ats )
+ synchronized ( this )
{
- checkAttributeType( at );
- }
+ List<AttributeTypeImpl> ats = schema.getAttributeTypes();
+ for ( AttributeTypeImpl at : ats )
+ {
+ checkAttributeType( at );
+ }
- List<ObjectClassImpl> ocs = schema.getObjectClasses();
- for ( ObjectClassImpl oc : ocs )
- {
- checkObjectClass( oc );
- }
+ List<ObjectClassImpl> ocs = schema.getObjectClasses();
+ for ( ObjectClassImpl oc : ocs )
+ {
+ checkObjectClass( oc );
+ }
- notifyListeners();
+ notifyListeners();
+ }
}
public void schemaRemoved( Schema schema )
{
- List<AttributeTypeImpl> ats = schema.getAttributeTypes();
- for ( AttributeTypeImpl at : ats )
+ synchronized ( this )
{
- removeSchemaObject( at );
- }
+ List<AttributeTypeImpl> ats = schema.getAttributeTypes();
+ for ( AttributeTypeImpl at : ats )
+ {
+ removeSchemaObject( at );
+ }
- List<ObjectClassImpl> ocs = schema.getObjectClasses();
- for ( ObjectClassImpl oc : ocs )
- {
- removeSchemaObject( oc );
- }
+ List<ObjectClassImpl> ocs = schema.getObjectClasses();
+ for ( ObjectClassImpl oc : ocs )
+ {
+ removeSchemaObject( oc );
+ }
- notifyListeners();
+ notifyListeners();
+ }
}
};
@@ -216,9 +242,8 @@
/**
* Creates a new instance of SchemaChecker.
*/
- public SchemaChecker()
+ private SchemaChecker()
{
- schemaHandler = Activator.getDefault().getSchemaHandler();
errorsList = new ArrayList<SchemaError>();
errorsMap = new MultiValueMap();
warningsList = new ArrayList<SchemaWarning>();
@@ -226,6 +251,39 @@
dependenciesMap = new MultiValueMap();
dependsOnMap = new MultiValueMap();
listeners = new ArrayList<SchemaCheckerListener>();
+
+ Activator.getDefault().getProjectsHandler().addListener( new ProjectsHandlerAdapter()
+ {
+ public void openProjectChanged( Project oldProject, Project newProject )
+ {
+ if ( oldProject != null )
+ {
+ oldProject.getSchemaHandler().removeListener( schemaHandlerListener );
+ }
+
+ if ( newProject != null )
+ {
+ newProject.getSchemaHandler().addListener( schemaHandlerListener );
+ }
+ }
+ } );
+ }
+
+
+ /**
+ * Gets the singleton instance of the ProjectsHandler.
+ *
+ * @return
+ * the singleton instance of the ProjectsHandler
+ */
+ public static SchemaChecker getInstance()
+ {
+ if ( instance == null )
+ {
+ instance = new SchemaChecker();
+ }
+
+ return instance;
}
@@ -234,12 +292,15 @@
*/
public void enableModificationsListening()
{
- if ( !listeningToModifications )
+ synchronized ( this )
{
- schemaHandler = Activator.getDefault().getSchemaHandler();
- schemaHandler.addListener( schemaHandlerListener );
- listeningToModifications = true;
- checkWholeSchema();
+ if ( !listeningToModifications )
+ {
+ Activator.getDefault().getSchemaHandler().addListener( schemaHandlerListener );
+ listeningToModifications = true;
+ checkWholeSchema();
+ notifyListeners();
+ }
}
}
@@ -249,11 +310,27 @@
*/
public void disableModificationsListening()
{
- if ( listeningToModifications )
+ synchronized ( this )
+ {
+ if ( listeningToModifications )
+ {
+ Activator.getDefault().getSchemaHandler().removeListener( schemaHandlerListener );
+ listeningToModifications = false;
+ clearErrorsAndWarnings();
+ }
+ }
+ }
+
+
+ /**
+ * Reloads the content of the schema checker
+ */
+ public void reload()
+ {
+ synchronized ( this )
{
- schemaHandler.removeListener( schemaHandlerListener );
- listeningToModifications = false;
clearErrorsAndWarnings();
+ checkWholeSchema();
}
}
@@ -289,30 +366,39 @@
/**
* Checks the whole schema.
*/
- private void checkWholeSchema()
+ private synchronized void checkWholeSchema()
{
- Job job = new Job( "Checking the Schema" )
+ Job job = new Job( "Checking Schema" )
{
protected IStatus run( IProgressMonitor monitor )
{
- List<Schema> schemas = schemaHandler.getSchemas();
- monitor.beginTask( "Checking schemas: ", schemas.size() );
- for ( Schema schema : schemas )
- {
- monitor.subTask( schema.getName() );
- List<AttributeTypeImpl> ats = schema.getAttributeTypes();
- for ( AttributeTypeImpl at : ats )
- {
- checkAttributeType( at );
- }
+ SchemaHandler schemaHandler = Activator.getDefault().getSchemaHandler();
+ if ( schemaHandler != null )
+ {
+ List<Schema> schemas = schemaHandler.getSchemas();
+
+ monitor.beginTask( "Checking schemas: ", schemas.size() );
- List<ObjectClassImpl> ocs = schema.getObjectClasses();
- for ( ObjectClassImpl oc : ocs )
+ for ( Schema schema : schemas )
{
- checkObjectClass( oc );
+ monitor.subTask( schema.getName() );
+
+ List<AttributeTypeImpl> ats = schema.getAttributeTypes();
+ for ( AttributeTypeImpl at : ats )
+ {
+ checkAttributeType( at );
+ }
+
+ List<ObjectClassImpl> ocs = schema.getObjectClasses();
+ for ( ObjectClassImpl oc : ocs )
+ {
+ checkObjectClass( oc );
+ }
+
+ monitor.worked( 1 );
}
- monitor.worked( 1 );
}
+
notifyListeners();
monitor.done();
@@ -321,7 +407,6 @@
};
job.setUser( true );
- // job.setPriority( Job.SHORT );
job.schedule();
}
@@ -389,7 +474,7 @@
String superior = at.getSuperiorName();
if ( ( superior != null ) && ( !"".equals( superior ) ) )
{
- AttributeTypeImpl superiorAT = schemaHandler.getAttributeType( superior );
+ AttributeTypeImpl superiorAT = Activator.getDefault().getSchemaHandler().getAttributeType( superior );
if ( superiorAT == null )
{
SchemaError error = new NonExistingATSuperiorError( at, superior );
@@ -429,7 +514,7 @@
String syntaxOid = at.getSyntaxOid();
if ( ( syntaxOid != null ) && ( !"".equals( syntaxOid ) ) )
{
- SyntaxImpl syntax = schemaHandler.getSyntax( syntaxOid );
+ SyntaxImpl syntax = Activator.getDefault().getSchemaHandler().getSyntax( syntaxOid );
if ( syntax == null )
{
SchemaError error = new NonExistingSyntaxError( at, syntaxOid );
@@ -449,7 +534,7 @@
String equality = at.getEqualityName();
if ( ( equality != null ) && ( !"".equals( equality ) ) )
{
- MatchingRuleImpl equalityMR = schemaHandler.getMatchingRule( equality );
+ MatchingRuleImpl equalityMR = Activator.getDefault().getSchemaHandler().getMatchingRule( equality );
if ( equalityMR == null )
{
SchemaError error = new NonExistingMatchingRuleError( at, equality,
@@ -470,7 +555,7 @@
String ordering = at.getOrderingName();
if ( ( ordering != null ) && ( !"".equals( ordering ) ) )
{
- MatchingRuleImpl orderingMR = schemaHandler.getMatchingRule( ordering );
+ MatchingRuleImpl orderingMR = Activator.getDefault().getSchemaHandler().getMatchingRule( ordering );
if ( orderingMR == null )
{
SchemaError error = new NonExistingMatchingRuleError( at, ordering,
@@ -491,7 +576,7 @@
String substring = at.getSubstrName();
if ( ( substring != null ) && ( !"".equals( substring ) ) )
{
- MatchingRuleImpl substringMR = schemaHandler.getMatchingRule( substring );
+ MatchingRuleImpl substringMR = Activator.getDefault().getSchemaHandler().getMatchingRule( substring );
if ( substringMR == null )
{
SchemaError error = new NonExistingMatchingRuleError( at, substring,
@@ -577,7 +662,7 @@
for ( String superior : superiors )
{
- ObjectClassImpl superiorOC = schemaHandler.getObjectClass( superior );
+ ObjectClassImpl superiorOC = Activator.getDefault().getSchemaHandler().getObjectClass( superior );
if ( superiorOC == null )
{
SchemaError error = new NonExistingOCSuperiorError( oc, superior );
@@ -628,7 +713,8 @@
{
for ( String mandatoryATName : mandatoryATNames )
{
- AttributeTypeImpl mandatoryAT = schemaHandler.getAttributeType( mandatoryATName );
+ AttributeTypeImpl mandatoryAT = Activator.getDefault().getSchemaHandler().getAttributeType(
+ mandatoryATName );
if ( mandatoryAT == null )
{
SchemaError error = new NonExistingMandatoryATError( oc, mandatoryATName );
@@ -646,7 +732,8 @@
for ( String optionalATName : optionalATNames )
{
- AttributeTypeImpl optionalAT = schemaHandler.getAttributeType( optionalATName );
+ AttributeTypeImpl optionalAT = Activator.getDefault().getSchemaHandler().getAttributeType(
+ optionalATName );
if ( optionalAT == null )
{
SchemaError error = new NonExistingOptionalATError( oc, optionalATName );
@@ -712,14 +799,14 @@
List results = new ArrayList<Object>();
// Attribute types
- List<?> atList = schemaHandler.getAttributeTypeList( id );
+ List<?> atList = Activator.getDefault().getSchemaHandler().getAttributeTypeList( id );
if ( ( atList != null ) && ( atList.size() >= 1 ) )
{
results.addAll( atList );
}
// Object classes
- List<?> ocList = schemaHandler.getObjectClassList( id );
+ List<?> ocList = Activator.getDefault().getSchemaHandler().getObjectClassList( id );
if ( ( ocList != null ) && ( ocList.size() >= 1 ) )
{
results.addAll( ocList );
Modified: directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/SchemaEditorSchemaCheckerLabelDecorator.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/SchemaEditorSchemaCheckerLabelDecorator.java?rev=802761&r1=802760&r2=802761&view=diff
==============================================================================
--- directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/SchemaEditorSchemaCheckerLabelDecorator.java (original)
+++ directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/SchemaEditorSchemaCheckerLabelDecorator.java Mon Aug 10 12:27:41 2009
@@ -40,7 +40,8 @@
/**
* This class is the Schemas Editor Schema Checker Label Decorator.
- * It displays specific icons overlays for attribute types and object classes.
+ * It displays specific icons overlays for attribute types and object classes
+ * based on their state in the schema checker.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
@@ -159,38 +160,41 @@
*/
public boolean childrenHasWarnings( List<TreeNode> children, SchemaChecker schemaChecker )
{
- for ( TreeNode child : children )
+ if ( children != null )
{
- if ( child instanceof AttributeTypeWrapper )
+ for ( TreeNode child : children )
{
- AttributeTypeImpl at = ( ( AttributeTypeWrapper ) child ).getAttributeType();
-
- if ( schemaChecker.hasWarnings( at ) )
- {
- return true;
- }
- else
+ if ( child instanceof AttributeTypeWrapper )
{
- if ( childrenHasWarnings( child.getChildren(), schemaChecker ) )
+ AttributeTypeImpl at = ( ( AttributeTypeWrapper ) child ).getAttributeType();
+
+ if ( schemaChecker.hasWarnings( at ) )
{
return true;
}
+ else
+ {
+ if ( childrenHasWarnings( child.getChildren(), schemaChecker ) )
+ {
+ return true;
+ }
+ }
}
- }
- else if ( child instanceof ObjectClassWrapper )
- {
- ObjectClassImpl oc = ( ( ObjectClassWrapper ) child ).getObjectClass();
-
- if ( schemaChecker.hasWarnings( oc ) )
- {
- return true;
- }
- else
+ else if ( child instanceof ObjectClassWrapper )
{
- if ( childrenHasWarnings( child.getChildren(), schemaChecker ) )
+ ObjectClassImpl oc = ( ( ObjectClassWrapper ) child ).getObjectClass();
+
+ if ( schemaChecker.hasWarnings( oc ) )
{
return true;
}
+ else
+ {
+ if ( childrenHasWarnings( child.getChildren(), schemaChecker ) )
+ {
+ return true;
+ }
+ }
}
}
}
@@ -211,38 +215,41 @@
*/
public boolean childrenHasErrors( List<TreeNode> children, SchemaChecker schemaChecker )
{
- for ( TreeNode child : children )
+ if ( children != null )
{
- if ( child instanceof AttributeTypeWrapper )
+ for ( TreeNode child : children )
{
- AttributeTypeImpl at = ( ( AttributeTypeWrapper ) child ).getAttributeType();
-
- if ( schemaChecker.hasErrors( at ) )
- {
- return true;
- }
- else
+ if ( child instanceof AttributeTypeWrapper )
{
- if ( childrenHasErrors( child.getChildren(), schemaChecker ) )
+ AttributeTypeImpl at = ( ( AttributeTypeWrapper ) child ).getAttributeType();
+
+ if ( schemaChecker.hasErrors( at ) )
{
return true;
}
+ else
+ {
+ if ( childrenHasErrors( child.getChildren(), schemaChecker ) )
+ {
+ return true;
+ }
+ }
}
- }
- else if ( child instanceof ObjectClassWrapper )
- {
- ObjectClassImpl oc = ( ( ObjectClassWrapper ) child ).getObjectClass();
-
- if ( schemaChecker.hasErrors( oc ) )
- {
- return true;
- }
- else
+ else if ( child instanceof ObjectClassWrapper )
{
- if ( childrenHasErrors( child.getChildren(), schemaChecker ) )
+ ObjectClassImpl oc = ( ( ObjectClassWrapper ) child ).getObjectClass();
+
+ if ( schemaChecker.hasErrors( oc ) )
{
return true;
}
+ else
+ {
+ if ( childrenHasErrors( child.getChildren(), schemaChecker ) )
+ {
+ return true;
+ }
+ }
}
}
}