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 2007/07/16 15:58:54 UTC
svn commit: r556630 - in
/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor:
./ controller/ controller/actions/ model/ view/dialogs/ view/views/
view/wizards/ view/wrappers/
Author: pamarcelot
Date: Mon Jul 16 06:58:48 2007
New Revision: 556630
URL: http://svn.apache.org/viewvc?view=rev&rev=556630
Log:
Added the OpenProject, CloseProject Actions
Updated the RenameProjectAction
Added:
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/ProjectListener.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/ProjectsHandler.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/ProjectsHandlerListener.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/CloseProjectAction.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/OpenProjectAction.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/dialogs/RenameProjectDialog.java
Modified:
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/Activator.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/PluginConstants.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/ProjectsViewController.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ConnectAction.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/DeleteProjectAction.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ExportProjectsAction.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ImportProjectsAction.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/NewProjectAction.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/RenameProjectAction.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/Project.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProjectsView.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProjectsViewContentProvider.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProjectsViewLabelProvider.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/NewProjectWizard.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/NewProjectWizardPage.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/ProjectWrapper.java
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/Activator.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/Activator.java?view=diff&rev=556630&r1=556629&r2=556630
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/Activator.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/Activator.java Mon Jul 16 06:58:48 2007
@@ -20,6 +20,7 @@
package org.apache.directory.studio.apacheds.schemaeditor;
+import org.apache.directory.studio.apacheds.schemaeditor.controller.ProjectsHandler;
import org.apache.directory.studio.apacheds.schemaeditor.controller.SchemaHandler;
import org.apache.directory.studio.apacheds.schemaeditor.model.schemachecker.SchemaChecker;
import org.apache.directory.studio.apacheds.schemaeditor.view.widget.SchemaCodeScanner;
@@ -55,6 +56,9 @@
/** The SchemaCheker */
private SchemaChecker schemaChecker;
+ /** The ProjectsHandler */
+ private ProjectsHandler projectsHandler;
+
/**
* Creates a new instance of Activator.
@@ -62,6 +66,8 @@
public Activator()
{
plugin = this;
+ projectsHandler = ProjectsHandler.getInstance();
+
schemaHandler = SchemaHandler.getInstance();
schemaChecker = new SchemaChecker();
}
@@ -124,6 +130,18 @@
public SchemaChecker getSchemaChecker()
{
return schemaChecker;
+ }
+
+
+ /**
+ * Gets the ProjectsHandler
+ *
+ * @return
+ * the ProjectsHandler
+ */
+ public ProjectsHandler getProjectsHandler()
+ {
+ return projectsHandler;
}
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/PluginConstants.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/PluginConstants.java?view=diff&rev=556630&r1=556629&r2=556630
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/PluginConstants.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/PluginConstants.java Mon Jul 16 06:58:48 2007
@@ -67,10 +67,12 @@
// Commands
public static final String CMD_CONNECT = Activator.PLUGIN_ID + ".commands.connect";
- public static final String CMD_NEW_PROJECT = Activator.PLUGIN_ID + ".commands.newProject";
+ public static final String CMD_CLOSE_PROJECT = Activator.PLUGIN_ID + ".commands.closeProject";
public static final String CMD_DELETE_PROJECT = Activator.PLUGIN_ID + ".commands.deleteProject";
public static final String CMD_EXPORT_PROJECTS = Activator.PLUGIN_ID + ".commands.exportProjects";
public static final String CMD_IMPORT_PROJECTS = Activator.PLUGIN_ID + ".commands.importProjects";
+ public static final String CMD_OPEN_PROJECT = Activator.PLUGIN_ID + ".commands.openProject";
+ public static final String CMD_NEW_PROJECT = Activator.PLUGIN_ID + ".commands.newProject";
public static final String CMD_RENAME_PROJECT = Activator.PLUGIN_ID + ".commands.renameProject";
// Preferences
Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/ProjectListener.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/ProjectListener.java?view=auto&rev=556630
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/ProjectListener.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/ProjectListener.java Mon Jul 16 06:58:48 2007
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.studio.apacheds.schemaeditor.controller;
+
+
+/**
+ * Classes which implement this interface provide methods that deal with the
+ * events that are generated when an event occurs on a project.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface ProjectListener
+{
+ /**
+ * This method is called when the project is renamed.
+ */
+ public void projectRenamed();
+}
Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/ProjectsHandler.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/ProjectsHandler.java?view=auto&rev=556630
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/ProjectsHandler.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/ProjectsHandler.java Mon Jul 16 06:58:48 2007
@@ -0,0 +1,366 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.studio.apacheds.schemaeditor.controller;
+
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.collections.map.MultiValueMap;
+import org.apache.directory.studio.apacheds.schemaeditor.model.Project;
+import org.apache.directory.studio.apacheds.schemaeditor.model.Project.ProjectState;
+
+
+/**
+ * This class represents the ProjectsHandler.
+ * <p>
+ * It used to handle the schema projects.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+/**
+ * TODO ProjectsHandler.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ProjectsHandler
+{
+ /** The ProjectsHandler instance */
+ private static ProjectsHandler instance;
+
+ /** The projects List */
+ private List<Project> projectsList;
+
+ /** The projects Map */
+ private Map<String, Project> projectsMap;
+
+ /** The ProjectsHandler listeners */
+ private List<ProjectsHandlerListener> projectsHandlerListeners;
+
+ /** The projects listeners */
+ private MultiValueMap projectsListeners;
+
+ /** The open project */
+ private Project openProject;
+
+
+ /**
+ * Gets the singleton instance of the ProjectsHandler.
+ *
+ * @return
+ * the singleton instance of the ProjectsHandler
+ */
+ public static ProjectsHandler getInstance()
+ {
+ if ( instance == null )
+ {
+ instance = new ProjectsHandler();
+ }
+
+ return instance;
+ }
+
+
+ /**
+ * Private Constructor.
+ */
+ private ProjectsHandler()
+ {
+ projectsList = new ArrayList<Project>();
+ projectsMap = new HashMap<String, Project>();
+ projectsHandlerListeners = new ArrayList<ProjectsHandlerListener>();
+ projectsListeners = new MultiValueMap();
+ }
+
+
+ /**
+ * Adds a project.
+ *
+ * @param project
+ * a project
+ */
+ public void addProject( Project project )
+ {
+ projectsList.add( project );
+ projectsMap.put( project.getName().toLowerCase(), project );
+
+ notifyProjectAdded( project );
+ }
+
+
+ /**
+ * Removes the given project.
+ *
+ * @param project
+ * the project
+ */
+ public void removeProject( Project project )
+ {
+ projectsList.remove( project );
+ projectsMap.remove( project.getName().toLowerCase() );
+
+ notifyProjectRemoved( project );
+ }
+
+
+ /**
+ * Gets the project identified by the given name.
+ *
+ * @param name
+ * the name of the project
+ * @return
+ * the corresponding project
+ */
+ public Project getProject( String name )
+ {
+ return projectsMap.get( name.toLowerCase() );
+ }
+
+
+ /**
+ * Gets the projects List.
+ *
+ * @return
+ * the projects List
+ */
+ public List<Project> getProjects()
+ {
+ return projectsList;
+ }
+
+
+ /**
+ * Renames the given project.
+ *
+ * @param project
+ * the project
+ * @param name
+ * the new name
+ */
+ public void renameProject( Project project, String name )
+ {
+ projectsMap.remove( project.getName().toLowerCase() );
+ project.setName( name );
+ projectsMap.put( name.toLowerCase(), project );
+
+ notifyProjectRenamed( project );
+ }
+
+
+ /**
+ * Return whether or not the given name is already taken by another project
+ *
+ * @param name
+ * the name
+ * @return
+ * true if the given name is already taken, false if not
+ */
+ public boolean isProjectNameAlreadyTaken( String name )
+ {
+ return projectsMap.containsKey( name.toLowerCase() );
+ }
+
+
+ /**
+ * Opens the given project (and closes the previously opened project)
+ *
+ * @param project
+ * the project
+ */
+ public void openProject( Project project )
+ {
+ Project oldOpenProject = openProject;
+ if ( oldOpenProject != null )
+ {
+ openProject.setState( ProjectState.CLOSED );
+ }
+
+ openProject = project;
+ openProject.setState( ProjectState.OPEN );
+
+ notifyOpenProjectChanged( oldOpenProject, openProject );
+ }
+
+
+ /**
+ * Closes the given project
+ *
+ * @param project
+ * the project
+ */
+ public void closeProject( Project project )
+ {
+ Project oldOpenProject = openProject;
+ if ( oldOpenProject.equals( project ) )
+ {
+ oldOpenProject.setState( ProjectState.CLOSED );
+ openProject = null;
+ }
+
+ notifyOpenProjectChanged( oldOpenProject, openProject );
+ }
+
+
+ /**
+ * Gets the 'Open' project.
+ *
+ * @return
+ * the 'Open' project
+ */
+ public Project getOpenProject()
+ {
+ return openProject;
+ }
+
+
+ /**
+ * Sets the 'Open' project
+ *
+ * @param project
+ * the project
+ */
+ public void setOpenProject( Project project )
+ {
+ openProject = project;
+ }
+
+
+ /**
+ * Adds a ProjectsHandlerListener to the ProjectsHandler.
+ *
+ * @param listener
+ * the listener
+ */
+ public void addListener( ProjectsHandlerListener listener )
+ {
+ projectsHandlerListeners.add( listener );
+ }
+
+
+ /**
+ * Remove the given ProjectsHandlerListener.
+ *
+ * @param listener
+ * the listener
+ */
+ public void removeListener( ProjectsHandlerListener listener )
+ {
+ projectsHandlerListeners.remove( listener );
+ }
+
+
+ /**
+ * Adds a ProjectListener to the given Project.
+ *
+ * @param project
+ * the project
+ * @param listener
+ * the listener
+ */
+ public void addListener( Project project, ProjectListener listener )
+ {
+ if ( !projectsListeners.containsValue( project, listener ) )
+ {
+ projectsListeners.put( project, listener );
+ }
+ }
+
+
+ /**
+ * Removes the given ProjectListener.
+ *
+ * @param project
+ * the project
+ * @param listener
+ * the listener
+ */
+ public void removeListener( Project project, ProjectListener listener )
+ {
+ projectsListeners.remove( project, listener );
+ }
+
+
+ /**
+ * Notifies the ProjectsHandler's listener that a project has been added.
+ *
+ * @param project
+ * the added project
+ */
+ private void notifyProjectAdded( Project project )
+ {
+ for ( ProjectsHandlerListener listener : projectsHandlerListeners )
+ {
+ listener.projectAdded( project );
+ }
+ }
+
+
+ /**
+ * Notifies the ProjectsHandler's listener that a project has been removed.
+ *
+ * @param project
+ * the removed project
+ */
+ private void notifyProjectRemoved( Project project )
+ {
+ for ( ProjectsHandlerListener listener : projectsHandlerListeners )
+ {
+ listener.projectRemoved( project );
+ }
+ }
+
+
+ /**
+ * Notifies the project's Listeners that the project has been renamed.
+ *
+ * @param project
+ * the renamed project
+ */
+ @SuppressWarnings("unchecked")
+ private void notifyProjectRenamed( Project project )
+ {
+ List<ProjectListener> listeners = ( List<ProjectListener> ) projectsListeners.get( project );
+ for ( ProjectListener listener : listeners )
+ {
+ listener.projectRenamed();
+ }
+ }
+
+
+ /**
+ * Notifies the ProjectsHandler's listener that a new project has been opened.
+ *
+ * @param oldProject
+ * the old opened project
+ * @param newProject
+ * the new opened project
+ */
+ private void notifyOpenProjectChanged( Project oldProject, Project newProject )
+ {
+ for ( ProjectsHandlerListener listener : projectsHandlerListeners )
+ {
+ listener.openProjectChanged( oldProject, newProject );
+ }
+ }
+}
Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/ProjectsHandlerListener.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/ProjectsHandlerListener.java?view=auto&rev=556630
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/ProjectsHandlerListener.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/ProjectsHandlerListener.java Mon Jul 16 06:58:48 2007
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.studio.apacheds.schemaeditor.controller;
+
+
+import org.apache.directory.studio.apacheds.schemaeditor.model.Project;
+
+
+/**
+ * Classes which implement this interface provide methods that deal with the
+ * events that are generated when the ProjectsHandler is modified.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface ProjectsHandlerListener
+{
+ /**
+ * This method is called when a project is added.
+ *
+ * @param project
+ * the added project
+ */
+ public void projectAdded( Project project );
+
+
+ /**
+ * This method is called when a project is removed.
+ *
+ * @param project
+ * the removed project
+ */
+ public void projectRemoved( Project project );
+
+
+ /**
+ * This method is called when a project is opened.
+ *
+ * @param oldProject
+ * the old opened project
+ * @param newProject
+ * the new opened project
+ */
+ public void openProjectChanged( Project oldProject, Project newProject );
+}
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/ProjectsViewController.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/ProjectsViewController.java?view=diff&rev=556630&r1=556629&r2=556630
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/ProjectsViewController.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/ProjectsViewController.java Mon Jul 16 06:58:48 2007
@@ -20,18 +20,30 @@
package org.apache.directory.studio.apacheds.schemaeditor.controller;
+import org.apache.directory.studio.apacheds.schemaeditor.Activator;
+import org.apache.directory.studio.apacheds.schemaeditor.controller.actions.CloseProjectAction;
import org.apache.directory.studio.apacheds.schemaeditor.controller.actions.DeleteProjectAction;
import org.apache.directory.studio.apacheds.schemaeditor.controller.actions.ExportProjectsAction;
import org.apache.directory.studio.apacheds.schemaeditor.controller.actions.ImportProjectsAction;
import org.apache.directory.studio.apacheds.schemaeditor.controller.actions.NewProjectAction;
+import org.apache.directory.studio.apacheds.schemaeditor.controller.actions.OpenProjectAction;
import org.apache.directory.studio.apacheds.schemaeditor.controller.actions.RenameProjectAction;
+import org.apache.directory.studio.apacheds.schemaeditor.model.Project;
+import org.apache.directory.studio.apacheds.schemaeditor.model.Project.ProjectState;
import org.apache.directory.studio.apacheds.schemaeditor.view.views.ProjectsView;
+import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.ProjectWrapper;
+import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
import org.eclipse.ui.IWorkbenchActionConstants;
@@ -49,8 +61,13 @@
/** The Context Menu */
private MenuManager contextMenu;
+ /** The ProjectsHandler */
+ private ProjectsHandler projectsHandler;
+
// The Actions
private NewProjectAction newProject;
+ private OpenProjectAction openProject;
+ private CloseProjectAction closeProject;
private RenameProjectAction renameProject;
private DeleteProjectAction deleteProject;
private ImportProjectsAction importProjects;
@@ -67,9 +84,12 @@
{
this.view = view;
+ projectsHandler = Activator.getDefault().getProjectsHandler();
+
initActions();
initToolbar();
initContextMenu();
+ initViewer();
initDoubleClickListener();
}
@@ -80,6 +100,8 @@
private void initActions()
{
newProject = new NewProjectAction();
+ openProject = new OpenProjectAction( view );
+ closeProject = new CloseProjectAction( view );
renameProject = new RenameProjectAction( view );
deleteProject = new DeleteProjectAction( view );
importProjects = new ImportProjectsAction();
@@ -112,6 +134,9 @@
MenuManager exportManager = new MenuManager( "Export..." );
manager.add( newProject );
manager.add( new Separator() );
+ manager.add( openProject );
+ manager.add( closeProject );
+ manager.add( new Separator() );
manager.add( renameProject );
manager.add( new Separator() );
manager.add( deleteProject );
@@ -136,9 +161,64 @@
/**
+ * Initializes the Viewer.
+ */
+ private void initViewer()
+ {
+ view.getViewer().setInput( projectsHandler.getProjects() );
+ view.getViewer().getTable().addKeyListener( new KeyAdapter()
+ {
+ public void keyReleased( KeyEvent e )
+ {
+ if ( ( e.keyCode == Action.findKeyCode( "BACKSPACE" ) )
+ || ( e.keyCode == Action.findKeyCode( "DELETE" ) ) )
+ {
+ deleteProject.run();
+ }
+ }
+ } );
+ projectsHandler.addListener( new ProjectsHandlerListener()
+ {
+ public void projectAdded( Project project )
+ {
+ view.getViewer().refresh();
+ }
+
+
+ public void projectRemoved( Project project )
+ {
+ view.getViewer().refresh();
+ }
+
+
+ public void openProjectChanged( Project oldProject, Project newProject )
+ {
+ view.getViewer().refresh();
+ }
+ } );
+ }
+
+
+ /**
* Initializes the DoubleClickListener.
*/
private void initDoubleClickListener()
{
+ view.getViewer().addDoubleClickListener( new IDoubleClickListener()
+ {
+ public void doubleClick( DoubleClickEvent event )
+ {
+ StructuredSelection selection = ( StructuredSelection ) view.getViewer().getSelection();
+
+ if ( ( !selection.isEmpty() ) && ( selection.size() == 1 ) )
+ {
+ Project project = ( ( ProjectWrapper ) selection.getFirstElement() ).getProject();
+ if ( project.getState().equals( ProjectState.CLOSED ) )
+ {
+ projectsHandler.openProject( project );
+ }
+ }
+ }
+ } );
}
}
Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/CloseProjectAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/CloseProjectAction.java?view=auto&rev=556630
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/CloseProjectAction.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/CloseProjectAction.java Mon Jul 16 06:58:48 2007
@@ -0,0 +1,135 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.studio.apacheds.schemaeditor.controller.actions;
+
+
+import org.apache.directory.studio.apacheds.schemaeditor.Activator;
+import org.apache.directory.studio.apacheds.schemaeditor.PluginConstants;
+import org.apache.directory.studio.apacheds.schemaeditor.controller.ProjectsHandler;
+import org.apache.directory.studio.apacheds.schemaeditor.model.Project.ProjectState;
+import org.apache.directory.studio.apacheds.schemaeditor.view.views.ProjectsView;
+import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.ProjectWrapper;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+
+
+/**
+ * This action opens a Project.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class CloseProjectAction extends Action implements IWorkbenchWindowActionDelegate
+{
+ /** The associated view */
+ private ProjectsView view;
+
+ /** The ProjectsHandler */
+ private ProjectsHandler projectsHandler;
+
+
+ /**
+ * Creates a new instance of RenameProjectAction.
+ *
+ * @param view
+ * the associate view
+ */
+ public CloseProjectAction( ProjectsView view )
+ {
+ super( "Close Project" );
+ setToolTipText( getText() );
+ setId( PluginConstants.CMD_CLOSE_PROJECT );
+ setEnabled( false );
+ this.view = view;
+ this.view.getViewer().addSelectionChangedListener( new ISelectionChangedListener()
+ {
+ public void selectionChanged( SelectionChangedEvent event )
+ {
+ StructuredSelection selection = ( StructuredSelection ) event.getSelection();
+ if ( ( !selection.isEmpty() ) && ( selection.size() == 1 ) )
+ {
+ setEnabled( ( ( ProjectWrapper ) selection.getFirstElement() ).getProject().getState().equals(
+ ProjectState.OPEN ) );
+ }
+ else
+ {
+ setEnabled( false );
+ }
+ }
+ } );
+ projectsHandler = Activator.getDefault().getProjectsHandler();
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ public void run()
+ {
+ StructuredSelection selection = ( StructuredSelection ) view.getViewer().getSelection();
+ if ( ( !selection.isEmpty() ) && ( selection.size() == 1 ) )
+ {
+ projectsHandler.closeProject( ( ( ProjectWrapper ) selection.getFirstElement() ).getProject() );
+ }
+
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+ */
+ public void run( IAction action )
+ {
+ run();
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
+ */
+ public void dispose()
+ {
+ // Nothing to do
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
+ */
+ public void init( IWorkbenchWindow window )
+ {
+ // Nothing to do
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+ */
+ public void selectionChanged( IAction action, ISelection selection )
+ {
+ // Nothing to do
+ }
+}
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ConnectAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ConnectAction.java?view=diff&rev=556630&r1=556629&r2=556630
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ConnectAction.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ConnectAction.java Mon Jul 16 06:58:48 2007
@@ -59,7 +59,7 @@
*/
public ConnectAction( SchemaView view )
{
- super( "Connect" ); //$NON-NLS-1$
+ super( "Connect" );
setToolTipText( getText() );
setId( PluginConstants.CMD_CONNECT );
setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/DeleteProjectAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/DeleteProjectAction.java?view=diff&rev=556630&r1=556629&r2=556630
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/DeleteProjectAction.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/DeleteProjectAction.java Mon Jul 16 06:58:48 2007
@@ -20,17 +20,24 @@
package org.apache.directory.studio.apacheds.schemaeditor.controller.actions;
+import java.util.Iterator;
+
import org.apache.directory.studio.apacheds.schemaeditor.Activator;
import org.apache.directory.studio.apacheds.schemaeditor.PluginConstants;
+import org.apache.directory.studio.apacheds.schemaeditor.controller.ProjectsHandler;
import org.apache.directory.studio.apacheds.schemaeditor.view.views.ProjectsView;
+import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.ProjectWrapper;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.plugin.AbstractUIPlugin;
@@ -54,7 +61,7 @@
*/
public DeleteProjectAction( ProjectsView view )
{
- super( "Delete Project" ); //$NON-NLS-1$
+ super( "Delete Project" );
setToolTipText( getText() );
setId( PluginConstants.CMD_DELETE_PROJECT );
setImageDescriptor( AbstractUIPlugin
@@ -89,9 +96,37 @@
/* (non-Javadoc)
* @see org.eclipse.jface.action.Action#run()
*/
+ @SuppressWarnings("unchecked")
public void run()
{
- // TODO implement
+ ProjectsHandler projectsHandler = Activator.getDefault().getProjectsHandler();
+ StructuredSelection selection = ( StructuredSelection ) view.getViewer().getSelection();
+
+ if ( !selection.isEmpty() )
+ {
+ MessageBox messageBox = new MessageBox( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ SWT.YES | SWT.NO | SWT.ICON_QUESTION );
+ int count = selection.size();
+ if ( count == 1 )
+ {
+ ProjectWrapper wrapper = ( ProjectWrapper ) selection.getFirstElement();
+ messageBox.setMessage( "Are you sure you want to delete project '" + wrapper.getProject().getName()
+ + "'?" );
+ }
+ else
+ {
+ messageBox.setMessage( "Are you sure you want to delete these " + count + " projects?" );
+ }
+ if ( messageBox.open() == SWT.YES )
+ {
+ for ( Iterator iterator = selection.iterator(); iterator.hasNext(); )
+ {
+ ProjectWrapper wrapper = ( ProjectWrapper ) iterator.next();
+ projectsHandler.removeProject( wrapper.getProject() );
+ }
+ }
+ }
+
}
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ExportProjectsAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ExportProjectsAction.java?view=diff&rev=556630&r1=556629&r2=556630
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ExportProjectsAction.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ExportProjectsAction.java Mon Jul 16 06:58:48 2007
@@ -47,7 +47,7 @@
*/
public ExportProjectsAction()
{
- super( "Export Schema Projects" ); //$NON-NLS-1$
+ super( "Export Schema Projects" );
setToolTipText( getText() );
setId( PluginConstants.CMD_EXPORT_PROJECTS );
setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ImportProjectsAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ImportProjectsAction.java?view=diff&rev=556630&r1=556629&r2=556630
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ImportProjectsAction.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ImportProjectsAction.java Mon Jul 16 06:58:48 2007
@@ -47,7 +47,7 @@
*/
public ImportProjectsAction()
{
- super( "Import Schema Projects" ); //$NON-NLS-1$
+ super( "Import Schema Projects" );
setToolTipText( getText() );
setId( PluginConstants.CMD_IMPORT_PROJECTS );
setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/NewProjectAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/NewProjectAction.java?view=diff&rev=556630&r1=556629&r2=556630
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/NewProjectAction.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/NewProjectAction.java Mon Jul 16 06:58:48 2007
@@ -47,7 +47,7 @@
*/
public NewProjectAction()
{
- super( "New Schema Project" ); //$NON-NLS-1$
+ super( "New Schema Project" );
setToolTipText( getText() );
setId( PluginConstants.CMD_NEW_PROJECT );
setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/OpenProjectAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/OpenProjectAction.java?view=auto&rev=556630
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/OpenProjectAction.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/OpenProjectAction.java Mon Jul 16 06:58:48 2007
@@ -0,0 +1,135 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.studio.apacheds.schemaeditor.controller.actions;
+
+
+import org.apache.directory.studio.apacheds.schemaeditor.Activator;
+import org.apache.directory.studio.apacheds.schemaeditor.PluginConstants;
+import org.apache.directory.studio.apacheds.schemaeditor.controller.ProjectsHandler;
+import org.apache.directory.studio.apacheds.schemaeditor.model.Project.ProjectState;
+import org.apache.directory.studio.apacheds.schemaeditor.view.views.ProjectsView;
+import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.ProjectWrapper;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+
+
+/**
+ * This action opens a Project.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class OpenProjectAction extends Action implements IWorkbenchWindowActionDelegate
+{
+ /** The associated view */
+ private ProjectsView view;
+
+ /** The ProjectsHandler */
+ private ProjectsHandler projectsHandler;
+
+
+ /**
+ * Creates a new instance of RenameProjectAction.
+ *
+ * @param view
+ * the associate view
+ */
+ public OpenProjectAction( ProjectsView view )
+ {
+ super( "Open Project" );
+ setToolTipText( getText() );
+ setId( PluginConstants.CMD_OPEN_PROJECT );
+ setEnabled( false );
+ this.view = view;
+ this.view.getViewer().addSelectionChangedListener( new ISelectionChangedListener()
+ {
+ public void selectionChanged( SelectionChangedEvent event )
+ {
+ StructuredSelection selection = ( StructuredSelection ) event.getSelection();
+ if ( ( !selection.isEmpty() ) && ( selection.size() == 1 ) )
+ {
+ setEnabled( ( ( ProjectWrapper ) selection.getFirstElement() ).getProject().getState().equals(
+ ProjectState.CLOSED ) );
+ }
+ else
+ {
+ setEnabled( false );
+ }
+ }
+ } );
+ projectsHandler = Activator.getDefault().getProjectsHandler();
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ public void run()
+ {
+ StructuredSelection selection = ( StructuredSelection ) view.getViewer().getSelection();
+ if ( ( !selection.isEmpty() ) && ( selection.size() == 1 ) )
+ {
+ projectsHandler.openProject( ( ( ProjectWrapper ) selection.getFirstElement() ).getProject() );
+ }
+
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+ */
+ public void run( IAction action )
+ {
+ run();
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
+ */
+ public void dispose()
+ {
+ // Nothing to do
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
+ */
+ public void init( IWorkbenchWindow window )
+ {
+ // Nothing to do
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+ */
+ public void selectionChanged( IAction action, ISelection selection )
+ {
+ // Nothing to do
+ }
+}
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/RenameProjectAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/RenameProjectAction.java?view=diff&rev=556630&r1=556629&r2=556630
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/RenameProjectAction.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/RenameProjectAction.java Mon Jul 16 06:58:48 2007
@@ -22,9 +22,14 @@
import org.apache.directory.studio.apacheds.schemaeditor.Activator;
import org.apache.directory.studio.apacheds.schemaeditor.PluginConstants;
+import org.apache.directory.studio.apacheds.schemaeditor.controller.ProjectsHandler;
+import org.apache.directory.studio.apacheds.schemaeditor.model.Project;
+import org.apache.directory.studio.apacheds.schemaeditor.view.dialogs.RenameProjectDialog;
import org.apache.directory.studio.apacheds.schemaeditor.view.views.ProjectsView;
+import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.ProjectWrapper;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.SelectionChangedEvent;
@@ -45,6 +50,9 @@
/** The associated view */
private ProjectsView view;
+ /** The ProjectsHandler */
+ private ProjectsHandler projectsHandler;
+
/**
* Creates a new instance of RenameProjectAction.
@@ -54,7 +62,7 @@
*/
public RenameProjectAction( ProjectsView view )
{
- super( "Rename Project..." ); //$NON-NLS-1$
+ super( "Rename Project..." );
setToolTipText( getText() );
setId( PluginConstants.CMD_RENAME_PROJECT );
setImageDescriptor( AbstractUIPlugin
@@ -69,6 +77,7 @@
setEnabled( selection.size() == 1 );
}
} );
+ projectsHandler = Activator.getDefault().getProjectsHandler();
}
@@ -77,7 +86,17 @@
*/
public void run()
{
- // TODO Implement
+ StructuredSelection selection = ( StructuredSelection ) view.getViewer().getSelection();
+ if ( ( !selection.isEmpty() ) && ( selection.size() == 1 ) )
+ {
+ Project project = ( ( ProjectWrapper ) selection.getFirstElement() ).getProject();
+ RenameProjectDialog dialog = new RenameProjectDialog( project.getName() );
+ if ( dialog.open() == Dialog.OK )
+ {
+ projectsHandler.renameProject( project, dialog.getNewName() );
+ }
+ }
+
}
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/Project.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/Project.java?view=diff&rev=556630&r1=556629&r2=556630
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/Project.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/Project.java Mon Jul 16 06:58:48 2007
@@ -42,12 +42,29 @@
APACHE_DIRECTORY_SERVER
}
+ /**
+ * This enum represents the different states of Project.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+ public enum ProjectState
+ {
+ /** An Open project*/
+ OPEN,
+ /** A Closed project*/
+ CLOSED
+ }
+
/** The type of the project */
private ProjectType type;
/** The name of the project */
private String name;
+ /** The state of the project */
+ private ProjectState state;
+
/**
* Creates a new instance of Project.
@@ -61,6 +78,7 @@
{
this.type = type;
this.name = name;
+ this.state = ProjectState.CLOSED;
}
@@ -71,6 +89,7 @@
public Project()
{
type = ProjectType.OFFLINE;
+ this.state = ProjectState.CLOSED;
}
@@ -83,6 +102,7 @@
public Project( ProjectType type )
{
this.type = type;
+ this.state = ProjectState.CLOSED;
}
@@ -119,5 +139,29 @@
public void setName( String name )
{
this.name = name;
+ }
+
+
+ /**
+ * Gets the state of the project.
+ *
+ * @return
+ * the state of the project
+ */
+ public ProjectState getState()
+ {
+ return state;
+ }
+
+
+ /**
+ * Sets the state of the project
+ *
+ * @param state
+ * the state
+ */
+ public void setState( ProjectState state )
+ {
+ this.state = state;
}
}
Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/dialogs/RenameProjectDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/dialogs/RenameProjectDialog.java?view=auto&rev=556630
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/dialogs/RenameProjectDialog.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/dialogs/RenameProjectDialog.java Mon Jul 16 06:58:48 2007
@@ -0,0 +1,148 @@
+package org.apache.directory.studio.apacheds.schemaeditor.view.dialogs;
+
+
+import org.apache.directory.studio.apacheds.schemaeditor.Activator;
+import org.apache.directory.studio.apacheds.schemaeditor.controller.ProjectsHandler;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+
+
+public class RenameProjectDialog extends Dialog
+{
+ /** The original name*/
+ private String originalName;
+
+ /** The new name */
+ private String newName;
+
+ /** The ProjectsHandler */
+ private ProjectsHandler projectsHandler;
+
+ // UI Fields
+ private Text newNameText;
+ private Composite errorComposite;
+ private Image errorImage;
+ private Label errorLabel;
+ private Button okButton;
+
+
+ /**
+ * Creates a new instance of RenameProjectDialog.
+ *
+ * @param originalName
+ * the original name of the project
+ */
+ public RenameProjectDialog( String originalName )
+ {
+ super( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell() );
+ this.originalName = originalName;
+ projectsHandler = Activator.getDefault().getProjectsHandler();
+
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+ */
+ protected void configureShell( Shell newShell )
+ {
+ super.configureShell( newShell );
+ newShell.setText( "Rename Schema Project" );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ */
+ protected Control createDialogArea( Composite parent )
+ {
+ Composite composite = new Composite( parent, SWT.NONE );
+ composite.setLayout( new GridLayout( 2, false ) );
+ composite.setLayoutData( new GridData( GridData.FILL, GridData.FILL, true, true ) );
+
+ // New Name
+ Label newNameLabel = new Label( composite, SWT.NONE );
+ newNameLabel.setText( "New name:" );
+ newNameText = new Text( composite, SWT.BORDER );
+ newNameText.setLayoutData( new GridData( GridData.FILL, SWT.NONE, true, false ) );
+ newNameText.setText( originalName );
+ newNameText.addModifyListener( new ModifyListener()
+ {
+ public void modifyText( ModifyEvent e )
+ {
+ newName = newNameText.getText();
+
+ if ( !newName.equals( originalName ) )
+ {
+ if ( projectsHandler.isProjectNameAlreadyTaken( newName ) )
+ {
+ okButton.setEnabled( false );
+ errorComposite.setVisible( true );
+ return;
+ }
+ }
+
+ // Default
+ okButton.setEnabled( true );
+ errorComposite.setVisible( false );
+ }
+ } );
+
+ // Error Composite
+ errorComposite = new Composite( composite, SWT.NONE );
+ errorComposite.setLayout( new GridLayout( 2, false ) );
+ errorComposite.setLayoutData( new GridData( GridData.FILL, GridData.FILL, true, true, 2, 1 ) );
+ errorComposite.setVisible( false );
+
+ // Error Image
+ errorImage = PlatformUI.getWorkbench().getSharedImages().getImage( ISharedImages.IMG_OBJS_ERROR_TSK );
+ Label label = new Label( errorComposite, SWT.NONE );
+ label.setImage( errorImage );
+ label.setSize( 16, 16 );
+
+ // Error Label
+ errorLabel = new Label( errorComposite, SWT.NONE );
+ errorLabel.setLayoutData( new GridData( GridData.FILL, GridData.FILL, true, true ) );
+ errorLabel.setText( "A project with the same name already exists." );
+
+ newNameText.setFocus();
+
+ return composite;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
+ */
+ protected void createButtonsForButtonBar( Composite parent )
+ {
+ createButton( parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false );
+ okButton = createButton( parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true );
+ }
+
+
+ /**
+ * Returns the new name.
+ *
+ * @return
+ * the new name
+ */
+ public String getNewName()
+ {
+ return newName;
+ }
+}
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProjectsView.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProjectsView.java?view=diff&rev=556630&r1=556629&r2=556630
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProjectsView.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProjectsView.java Mon Jul 16 06:58:48 2007
@@ -22,7 +22,6 @@
import org.apache.directory.studio.apacheds.schemaeditor.Activator;
import org.apache.directory.studio.apacheds.schemaeditor.controller.ProjectsViewController;
-import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.ProjectsViewRoot;
import org.eclipse.jface.viewers.DecoratingLabelProvider;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.SWT;
@@ -45,9 +44,6 @@
/** The viewer */
private TableViewer tableViewer;
- /** The content provider of the viewer */
- private ProjectsViewContentProvider contentProvider;
-
/* (non-Javadoc)
* @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
@@ -67,11 +63,9 @@
private void initViewer( Composite parent )
{
tableViewer = new TableViewer( parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER );
- contentProvider = new ProjectsViewContentProvider( tableViewer );
- tableViewer.setContentProvider( contentProvider );
+ tableViewer.setContentProvider( new ProjectsViewContentProvider( tableViewer ) );
tableViewer.setLabelProvider( new DecoratingLabelProvider( new ProjectsViewLabelProvider(), Activator
.getDefault().getWorkbench().getDecoratorManager().getLabelDecorator() ) );
- tableViewer.setInput( new ProjectsViewRoot() );
}
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProjectsViewContentProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProjectsViewContentProvider.java?view=diff&rev=556630&r1=556629&r2=556630
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProjectsViewContentProvider.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProjectsViewContentProvider.java Mon Jul 16 06:58:48 2007
@@ -24,8 +24,6 @@
import java.util.List;
import org.apache.directory.studio.apacheds.schemaeditor.model.Project;
-import org.apache.directory.studio.apacheds.schemaeditor.model.Project.ProjectType;
-import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.ProjectsViewRoot;
import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.ProjectWrapper;
import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.TreeNode;
import org.eclipse.jface.viewers.IStructuredContentProvider;
@@ -42,19 +40,19 @@
*/
public class ProjectsViewContentProvider implements IStructuredContentProvider, ITreeContentProvider
{
- /** The associated viewer */
- private TableViewer viewer;
+ /** The viewer */
+ private TableViewer tableViewer;
/**
- * Creates a new instance of ProblemsViewContentProvider.
+ * Creates a new instance of ProjectsViewContentProvider.
*
- * @param viewer
- * the associated TableViewer
+ * @param tableViewer
+ * the TableViewer
*/
- public ProjectsViewContentProvider( TableViewer viewer )
+ public ProjectsViewContentProvider( TableViewer tableViewer )
{
- this.viewer = viewer;
+ this.tableViewer = tableViewer;
}
@@ -88,23 +86,27 @@
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
*/
+ @SuppressWarnings("unchecked")
public Object[] getChildren( Object parentElement )
{
List<TreeNode> children = null;
- if ( parentElement instanceof ProjectsViewRoot )
+ if ( parentElement instanceof List )
{
- children = new ArrayList<TreeNode>();
+ List<Project> projects = ( List<Project> ) parentElement;
- children.add( new ProjectWrapper( new Project( ProjectType.APACHE_DIRECTORY_SERVER,
- "Apache DS" ) ) );
+ children = new ArrayList<TreeNode>();
- children.add( new ProjectWrapper( new Project( ProjectType.OFFLINE, "Open LDAP" ) ) );
+ for ( Project project : projects )
+ {
+ children.add( new ProjectWrapper( project, tableViewer ) );
+ }
}
else if ( parentElement instanceof ProjectWrapper )
{
- children = new ArrayList<TreeNode>();
+ return null;
}
+
return children.toArray();
}
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProjectsViewLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProjectsViewLabelProvider.java?view=diff&rev=556630&r1=556629&r2=556630
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProjectsViewLabelProvider.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProjectsViewLabelProvider.java Mon Jul 16 06:58:48 2007
@@ -22,6 +22,8 @@
import org.apache.directory.studio.apacheds.schemaeditor.Activator;
import org.apache.directory.studio.apacheds.schemaeditor.PluginConstants;
+import org.apache.directory.studio.apacheds.schemaeditor.model.Project;
+import org.apache.directory.studio.apacheds.schemaeditor.model.Project.ProjectState;
import org.apache.directory.studio.apacheds.schemaeditor.model.Project.ProjectType;
import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.ProjectWrapper;
import org.eclipse.jface.viewers.LabelProvider;
@@ -44,16 +46,32 @@
{
if ( element instanceof ProjectWrapper )
{
- ProjectWrapper projectWrapper = ( ProjectWrapper ) element;
- ProjectType type = projectWrapper.getProject().getType();
+ Project project = ( ( ProjectWrapper ) element ).getProject();
+ ProjectType type = project.getType();
switch ( type )
{
case OFFLINE:
- return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
- PluginConstants.IMG_PROJECT_OFFLINE_CLOSED ).createImage();
+ ProjectState state = project.getState();
+ switch ( state )
+ {
+ case OPEN:
+ return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+ PluginConstants.IMG_PROJECT_OFFLINE ).createImage();
+ case CLOSED:
+ return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+ PluginConstants.IMG_PROJECT_OFFLINE_CLOSED ).createImage();
+ }
case APACHE_DIRECTORY_SERVER:
- return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
- PluginConstants.IMG_PROJECT_ADS ).createImage();
+ ProjectState state2 = project.getState();
+ switch ( state2 )
+ {
+ case OPEN:
+ return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+ PluginConstants.IMG_PROJECT_ADS ).createImage();
+ case CLOSED:
+ return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+ PluginConstants.IMG_PROJECT_ADS_CLOSED ).createImage();
+ }
}
}
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/NewProjectWizard.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/NewProjectWizard.java?view=diff&rev=556630&r1=556629&r2=556630
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/NewProjectWizard.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/NewProjectWizard.java Mon Jul 16 06:58:48 2007
@@ -20,6 +20,8 @@
package org.apache.directory.studio.apacheds.schemaeditor.view.wizards;
+import org.apache.directory.studio.apacheds.schemaeditor.Activator;
+import org.apache.directory.studio.apacheds.schemaeditor.model.Project;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.ui.INewWizard;
@@ -56,6 +58,8 @@
*/
public boolean performFinish()
{
+ Project project = new Project( page.getProjectType(), page.getProjectName() );
+ Activator.getDefault().getProjectsHandler().addProject( project );
return true;
}
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/NewProjectWizardPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/NewProjectWizardPage.java?view=diff&rev=556630&r1=556629&r2=556630
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/NewProjectWizardPage.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/NewProjectWizardPage.java Mon Jul 16 06:58:48 2007
@@ -22,6 +22,7 @@
import org.apache.directory.studio.apacheds.schemaeditor.Activator;
import org.apache.directory.studio.apacheds.schemaeditor.PluginConstants;
+import org.apache.directory.studio.apacheds.schemaeditor.controller.ProjectsHandler;
import org.apache.directory.studio.apacheds.schemaeditor.model.Project.ProjectType;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
@@ -47,6 +48,9 @@
*/
public class NewProjectWizardPage extends WizardPage
{
+ /** The ProjectsHandler */
+ private ProjectsHandler projectsHandler;
+
// UI Fields
private Text nameText;
private Button typeAdsRadio;
@@ -63,6 +67,7 @@
setDescription( "Please specify a name and a type to create a new Schema project." );
setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
PluginConstants.IMG_PROJECT_NEW_WIZARD ) );
+ projectsHandler = Activator.getDefault().getProjectsHandler();
}
@@ -130,8 +135,11 @@
displayErrorMessage( "A name must be specified." );
return;
}
-
- // TODO add the duplicate project name check
+ else if ( projectsHandler.isProjectNameAlreadyTaken( nameText.getText() ) )
+ {
+ displayErrorMessage( "A project with this name already exists." );
+ return;
+ }
displayErrorMessage( null );
}
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/ProjectWrapper.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/ProjectWrapper.java?view=diff&rev=556630&r1=556629&r2=556630
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/ProjectWrapper.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/ProjectWrapper.java Mon Jul 16 06:58:48 2007
@@ -20,7 +20,10 @@
package org.apache.directory.studio.apacheds.schemaeditor.view.wrappers;
+import org.apache.directory.studio.apacheds.schemaeditor.Activator;
+import org.apache.directory.studio.apacheds.schemaeditor.controller.ProjectListener;
import org.apache.directory.studio.apacheds.schemaeditor.model.Project;
+import org.eclipse.jface.viewers.TableViewer;
/**
@@ -34,6 +37,9 @@
/** The wrapped Project */
private Project project;
+ /** The TableViewer */
+ private TableViewer viewer;
+
/**
* Creates a new instance of ProjectWrapper.
@@ -41,25 +47,19 @@
* @param project
* the wrapped Project
*/
- public ProjectWrapper( Project project )
+ public ProjectWrapper( Project project, final TableViewer tableViewer )
{
super( null );
this.project = project;
- }
-
+ this.viewer = tableViewer;
- /**
- * Creates a new instance of ProjectWrapper.
- *
- * @param project
- * the wrapped Project
- * @param parent
- * the parent TreeNode
- */
- public ProjectWrapper( Project project, TreeNode parent )
- {
- super( parent );
- this.project = project;
+ Activator.getDefault().getProjectsHandler().addListener( project, new ProjectListener()
+ {
+ public void projectRenamed()
+ {
+ viewer.refresh();
+ }
+ } );
}