You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2015/03/31 11:56:36 UTC
svn commit: r1670296 [1/2] - in
/directory/studio/trunk/plugins/combinededitor: ./ resources/
resources/icons/ src/ src/main/ src/main/java/ src/main/java/org/
src/main/java/org/apache/ src/main/java/org/apache/directory/
src/main/java/org/apache/direc...
Author: elecharny
Date: Tue Mar 31 09:56:35 2015
New Revision: 1670296
URL: http://svn.apache.org/r1670296
Log:
Addition of the combined editor plugin
Added:
directory/studio/trunk/plugins/combinededitor/ (with props)
directory/studio/trunk/plugins/combinededitor/build.properties
directory/studio/trunk/plugins/combinededitor/plugin.properties
directory/studio/trunk/plugins/combinededitor/plugin.xml
directory/studio/trunk/plugins/combinededitor/plugin_de.properties
directory/studio/trunk/plugins/combinededitor/plugin_fr.properties
directory/studio/trunk/plugins/combinededitor/pom-first.xml
directory/studio/trunk/plugins/combinededitor/pom.xml
directory/studio/trunk/plugins/combinededitor/resources/
directory/studio/trunk/plugins/combinededitor/resources/icons/
directory/studio/trunk/plugins/combinededitor/resources/icons/editor_multi_tab.gif (with props)
directory/studio/trunk/plugins/combinededitor/resources/icons/editor_single_tab.gif (with props)
directory/studio/trunk/plugins/combinededitor/src/
directory/studio/trunk/plugins/combinededitor/src/main/
directory/studio/trunk/plugins/combinededitor/src/main/java/
directory/studio/trunk/plugins/combinededitor/src/main/java/org/
directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/
directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/
directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/
directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/
directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/CombinedEditorPlugin.java
directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/CombinedEditorPluginConstants.java
directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/Messages.java
directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/PreferenceInitializer.java
directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/actions/
directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/actions/FetchOperationalAttributesAction.java
directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/actions/Messages.java
directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/actions/messages.properties
directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/actions/messages_de.properties
directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/actions/messages_fr.properties
directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/editor/
directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/editor/AbstractCombinedEntryEditorPage.java
directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/editor/CombinedEntryEditor.java
directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/editor/CombinedEntryEditorNavigationLocation.java
directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/editor/ICombinedEntryEditorPage.java
directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/editor/LdifEditorPage.java
directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/editor/Messages.java
directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/editor/MultiTabCombinedEntryEditor.java
directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/editor/SingleTabCombinedEntryEditor.java
directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/editor/TableEditorPage.java
directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/editor/TableEditorPageActionGroup.java
directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/editor/TemplateEditorPage.java
directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/editor/messages.properties
directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/editor/messages_de.properties
directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/editor/messages_fr.properties
directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/messages.properties
directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/messages_de.properties
directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/messages_fr.properties
directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/preferences/
directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/preferences/CombinedEntryEditorPreferencePage.java
directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/preferences/Messages.java
directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/preferences/messages.properties
directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/preferences/messages_de.properties
directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/preferences/messages_fr.properties
directory/studio/trunk/plugins/combinededitor/src/main/resources/
Propchange: directory/studio/trunk/plugins/combinededitor/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Mar 31 09:56:35 2015
@@ -0,0 +1,16 @@
+target
+maven-eclipse.xml
+lib
+bin
+.externalToolBuilders
+felix-cache
+.project
+.classpath
+.settings
+eclipse-classes
+*.log
+*.iml
+*.ipr
+dependency-reduced-pom.xml
+META-INF
+
Added: directory/studio/trunk/plugins/combinededitor/build.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/combinededitor/build.properties?rev=1670296&view=auto
==============================================================================
--- directory/studio/trunk/plugins/combinededitor/build.properties (added)
+++ directory/studio/trunk/plugins/combinededitor/build.properties Tue Mar 31 09:56:35 2015
@@ -0,0 +1,24 @@
+# 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.
+source.. = src/main/java/
+bin.includes = META-INF/,\
+ .,\
+ plugin.properties,\
+ plugin_fr.properties,\
+ plugin_de.properties,\
+ plugin.xml,\
+ resources/
Added: directory/studio/trunk/plugins/combinededitor/plugin.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/combinededitor/plugin.properties?rev=1670296&view=auto
==============================================================================
--- directory/studio/trunk/plugins/combinededitor/plugin.properties (added)
+++ directory/studio/trunk/plugins/combinededitor/plugin.properties Tue Mar 31 09:56:35 2015
@@ -0,0 +1,33 @@
+# 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.
+
+Plugin_id=org.apache.directory.studio.combinededitor
+
+PrefPage_EntryEditorsPreferencePage_id=org.apache.directory.studio.ldapbrowser.preferences.EntryEditorsPreferencePage
+
+PrefPage_CombinedEntryEditorPreferencePage_id=org.apache.directory.studio.combinededitor.preferences.CombinedEntryEditorPreferencePage
+PrefPage_CombinedEntryEditorPreferencePage_name=Combined Entry Editor
+
+Editor_SingleTabCombinedEntryEditor_id=org.apache.directory.studio.combinededitor.editor.SingleTabCombinedEntryEditor
+Editor_SingleTabCombinedEntryEditor_shortname=Combined Entry Editor
+Editor_SingleTabCombinedEntryEditor_fullname=Combined Entry Editor (single-tab)
+Editor_SingleTabCombinedEntryEditor_description=Opens each entry in the same single editor tab.
+
+Editor_MultiTabCombinedEntryEditor_id=org.apache.directory.studio.combinededitor.editor.MultiTabCombinedEntryEditor
+Editor_MultiTabCombinedEntryEditor_shortname=Combined Entry Editor
+Editor_MultiTabCombinedEntryEditor_fullname=Combined Entry Editor (multi-tab)
+Editor_MultiTabCombinedEntryEditor_description=Opens each entry in a separate editor tab.
Added: directory/studio/trunk/plugins/combinededitor/plugin.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/combinededitor/plugin.xml?rev=1670296&view=auto
==============================================================================
--- directory/studio/trunk/plugins/combinededitor/plugin.xml (added)
+++ directory/studio/trunk/plugins/combinededitor/plugin.xml Tue Mar 31 09:56:35 2015
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<!--
+ @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+-->
+<?eclipse version="3.0"?>
+<plugin>
+ <extension point="org.eclipse.ui.preferencePages">
+ <page
+ class="org.apache.directory.studio.combinededitor.preferences.CombinedEntryEditorPreferencePage"
+ id="%PrefPage_CombinedEntryEditorPreferencePage_id"
+ category="%PrefPage_EntryEditorsPreferencePage_id"
+ name="%PrefPage_CombinedEntryEditorPreferencePage_name">
+ </page>
+ </extension>
+
+ <extension point="org.eclipse.equinox.preferences.preferences">
+ <initializer
+ class="org.apache.directory.studio.combinededitor.PreferenceInitializer">
+ </initializer>
+ </extension>
+
+ <extension point="org.eclipse.ui.editors">
+ <editor
+ class="org.apache.directory.studio.combinededitor.editor.SingleTabCombinedEntryEditor"
+ default="false"
+ icon="resources/icons/editor_single_tab.gif"
+ id="%Editor_SingleTabCombinedEntryEditor_id"
+ matchingStrategy="org.apache.directory.studio.entryeditors.SingleTabEntryEditorMatchingStrategy"
+ name="%Editor_SingleTabCombinedEntryEditor_shortname">
+ </editor>
+
+ <editor
+ class="org.apache.directory.studio.combinededitor.editor.MultiTabCombinedEntryEditor"
+ default="false"
+ icon="resources/icons/editor_multi_tab.gif"
+ id="%Editor_MultiTabCombinedEntryEditor_id"
+ matchingStrategy="org.apache.directory.studio.entryeditors.MultiTabEntryEditorMatchingStrategy"
+ name="%Editor_MultiTabCombinedEntryEditor_shortname">
+ </editor>
+ </extension>
+
+ <extension point="org.apache.directory.studio.entryeditors">
+ <entryEditor
+ class="org.apache.directory.studio.combinededitor.editor.SingleTabCombinedEntryEditor"
+ description="%Editor_SingleTabCombinedEntryEditor_description"
+ editorId="%Editor_SingleTabCombinedEntryEditor_id"
+ icon="resources/icons/editor_single_tab.gif"
+ id="%Editor_SingleTabCombinedEntryEditor_id"
+ name="%Editor_SingleTabCombinedEntryEditor_fullname"
+ priority="11"
+ multiWindow="false">
+ </entryEditor>
+
+ <entryEditor
+ class="org.apache.directory.studio.combinededitor.editor.MultiTabCombinedEntryEditor"
+ description="%Editor_MultiTabCombinedEntryEditor_description"
+ editorId="%Editor_MultiTabCombinedEntryEditor_id"
+ icon="resources/icons/editor_multi_tab.gif"
+ id="%Editor_MultiTabCombinedEntryEditor_id"
+ name="%Editor_MultiTabCombinedEntryEditor_fullname"
+ priority="10"
+ multiWindow="true">
+ </entryEditor>
+ </extension>
+</plugin>
Added: directory/studio/trunk/plugins/combinededitor/plugin_de.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/combinededitor/plugin_de.properties?rev=1670296&view=auto
==============================================================================
--- directory/studio/trunk/plugins/combinededitor/plugin_de.properties (added)
+++ directory/studio/trunk/plugins/combinededitor/plugin_de.properties Tue Mar 31 09:56:35 2015
@@ -0,0 +1,25 @@
+# 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.
+PrefPage_CombinedEntryEditorPreferencePage_name=Kombinierter Eintrags-Editor
+
+Editor_SingleTabCombinedEntryEditor_shortname=Kombinierter Eintrags-Editor
+Editor_SingleTabCombinedEntryEditor_fullname=Kombinierter Eintrags-Editor (einzelner Reiter)
+Editor_SingleTabCombinedEntryEditor_description=\u00D6ffnet alle Eintr\u00E4ge in einem einzelnen Editor.
+
+Editor_MultiTabCombinedEntryEditor_shortname=Kombinierter Eintrags-Editor
+Editor_MultiTabCombinedEntryEditor_fullname=Kombinierter Eintrags-Editor (mehrere Reiter)
+Editor_MultiTabCombinedEntryEditor_description=\u00D6ffnet jeden Eintrag in einem eigenen Editor.
Added: directory/studio/trunk/plugins/combinededitor/plugin_fr.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/combinededitor/plugin_fr.properties?rev=1670296&view=auto
==============================================================================
--- directory/studio/trunk/plugins/combinededitor/plugin_fr.properties (added)
+++ directory/studio/trunk/plugins/combinededitor/plugin_fr.properties Tue Mar 31 09:56:35 2015
@@ -0,0 +1,25 @@
+# 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.
+PrefPage_CombinedEntryEditorPreferencePage_name=Editeur d'entrée combiné
+
+Editor_SingleTabCombinedEntryEditor_shortname=Editeur d'entrée combiné
+Editor_SingleTabCombinedEntryEditor_fullname=Editeur d'entrée combiné (à onglet unique)
+Editor_SingleTabCombinedEntryEditor_description=Chaque entr\u00E9e est ouverte dans le m\u00EAme \u00E9diteur à onglet unique.
+
+Editor_MultiTabCombinedEntryEditor_shortname=Editeur d'entrée combiné
+Editor_MultiTabCombinedEntryEditor_fullname=Editeur d'entrée combiné (à onglets multiples)
+Editor_MultiTabCombinedEntryEditor_description=Chaque entr\u00E9e est ouverte dans un \u00E9diteur à onglet s\u00E9par\u00E9.
Added: directory/studio/trunk/plugins/combinededitor/pom-first.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/combinededitor/pom-first.xml?rev=1670296&view=auto
==============================================================================
--- directory/studio/trunk/plugins/combinededitor/pom-first.xml (added)
+++ directory/studio/trunk/plugins/combinededitor/pom-first.xml Tue Mar 31 09:56:35 2015
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<!--
+ @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.directory.studio</groupId>
+ <artifactId>parent-plugins</artifactId>
+ <version>2.0.0.qualifier</version>
+ <relativePath>../pom-first.xml</relativePath>
+ </parent>
+
+ <artifactId>org.apache.directory.studio.combinededitor</artifactId>
+ <name>Apache Directory Studio Combined Editor</name>
+ <packaging>bundle</packaging>
+ <description/>
+
+ <build>
+ <plugins>
+ <!-- MANIFEST.MF Generation -->
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <manifestLocation>META-INF</manifestLocation>
+ <instructions>
+ <Bundle-SymbolicName>${project.artifactId};singleton:=true</Bundle-SymbolicName>
+ <Bundle-Localization>plugin</Bundle-Localization>
+ <Eclipse-LazyStart>true</Eclipse-LazyStart>
+ <Bundle-Activator>org.apache.directory.studio.combinededitor.CombinedEditorPlugin</Bundle-Activator>
+ <Require-Bundle>
+ org.eclipse.core.runtime,
+ org.eclipse.ui,
+ org.eclipse.ui.forms,
+ org.eclipse.jface.text,
+ org.apache.directory.api.ldap.model,
+ org.apache.directory.studio.common.core,
+ org.apache.directory.studio.common.ui,
+ org.apache.directory.studio.connection.core,
+ org.apache.directory.studio.connection.ui,
+ org.apache.directory.studio.ldapbrowser.core,
+ org.apache.directory.studio.ldapbrowser.common,
+ org.apache.directory.studio.ldapbrowser.ui,
+ org.apache.directory.studio.ldifparser,
+ org.apache.directory.studio.ldifeditor,
+ org.apache.directory.studio.valueeditors,
+ org.apache.directory.studio.templateeditor
+ </Require-Bundle>
+ <Export-Package>
+ org.apache.directory.studio.combinededitor,
+ org.apache.directory.studio.combinededitor.actions,
+ org.apache.directory.studio.combinededitor.editor,
+ org.apache.directory.studio.combinededitor.preferences
+ </Export-Package>
+ </instructions>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>process-classes</phase>
+ <goals>
+ <goal>manifest</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Added: directory/studio/trunk/plugins/combinededitor/pom.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/combinededitor/pom.xml?rev=1670296&view=auto
==============================================================================
--- directory/studio/trunk/plugins/combinededitor/pom.xml (added)
+++ directory/studio/trunk/plugins/combinededitor/pom.xml Tue Mar 31 09:56:35 2015
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<!--
+ @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.directory.studio</groupId>
+ <artifactId>parent-plugins</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ <relativePath>../</relativePath>
+ </parent>
+
+ <artifactId>org.apache.directory.studio.combinededitor</artifactId>
+ <name>Apache Directory Studio Combined Editor</name>
+ <packaging>eclipse-plugin</packaging>
+ <description />
+</project>
Added: directory/studio/trunk/plugins/combinededitor/resources/icons/editor_multi_tab.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/combinededitor/resources/icons/editor_multi_tab.gif?rev=1670296&view=auto
==============================================================================
Binary file - no diff available.
Propchange: directory/studio/trunk/plugins/combinededitor/resources/icons/editor_multi_tab.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: directory/studio/trunk/plugins/combinededitor/resources/icons/editor_single_tab.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/combinededitor/resources/icons/editor_single_tab.gif?rev=1670296&view=auto
==============================================================================
Binary file - no diff available.
Propchange: directory/studio/trunk/plugins/combinededitor/resources/icons/editor_single_tab.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/CombinedEditorPlugin.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/CombinedEditorPlugin.java?rev=1670296&view=auto
==============================================================================
--- directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/CombinedEditorPlugin.java (added)
+++ directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/CombinedEditorPlugin.java Tue Mar 31 09:56:35 2015
@@ -0,0 +1,150 @@
+package org.apache.directory.studio.combinededitor;
+
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.PropertyResourceBundle;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+
+/**
+ * The activator class controls the plug-in life cycle.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ *
+ */
+public class CombinedEditorPlugin extends AbstractUIPlugin
+{
+ /** The shared instance */
+ private static CombinedEditorPlugin plugin;
+
+ /** The plugin properties */
+ private PropertyResourceBundle properties;
+
+
+ /**
+ * The constructor
+ */
+ public CombinedEditorPlugin()
+ {
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void start( BundleContext context ) throws Exception
+ {
+ super.start( context );
+ plugin = this;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void stop( BundleContext context ) throws Exception
+ {
+ plugin = null;
+ super.stop( context );
+ }
+
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static CombinedEditorPlugin getDefault()
+ {
+ return plugin;
+ }
+
+
+ /**
+ * Use this method to get SWT images. Use the IMG_ constants from
+ * PluginConstants for the key.
+ *
+ * @param key
+ * The key (relative path to the image in filesystem)
+ * @return The image descriptor or null
+ */
+ public ImageDescriptor getImageDescriptor( String key )
+ {
+ if ( key != null )
+ {
+ URL url = FileLocator.find( getBundle(), new Path( key ), null );
+ if ( url != null )
+ return ImageDescriptor.createFromURL( url );
+ else
+ return null;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+
+ /**
+ * Use this method to get SWT images. Use the IMG_ constants from
+ * PluginConstants for the key. A ImageRegistry is used to manage the
+ * the key->Image mapping.
+ * <p>
+ * Note: Don't dispose the returned SWT Image. It is disposed
+ * automatically when the plugin is stopped.
+ *
+ * @param key
+ * The key (relative path to the image in filesystem)
+ * @return The SWT Image or null
+ */
+ public Image getImage( String key )
+ {
+ Image image = getImageRegistry().get( key );
+ if ( image == null )
+ {
+ ImageDescriptor id = getImageDescriptor( key );
+ if ( id != null )
+ {
+ image = id.createImage();
+ getImageRegistry().put( key, image );
+ }
+ }
+ return image;
+ }
+
+
+ /**
+ * Gets the plugin properties.
+ *
+ * @return
+ * the plugin properties
+ */
+ public PropertyResourceBundle getPluginProperties()
+ {
+ if ( properties == null )
+ {
+ try
+ {
+ properties = new PropertyResourceBundle( FileLocator.openStream( this.getBundle(), new Path(
+ "plugin.properties" ), false ) ); //$NON-NLS-1$
+ }
+ catch ( IOException e )
+ {
+ // 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.combinededitor", Status.OK, //$NON-NLS-1$
+ Messages.getString( "CombinedEditorPlugin.UnableToGetPluginProperties" ), e ) ); //$NON-NLS-1$
+ }
+ }
+
+ return properties;
+ }
+}
Added: directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/CombinedEditorPluginConstants.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/CombinedEditorPluginConstants.java?rev=1670296&view=auto
==============================================================================
--- directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/CombinedEditorPluginConstants.java (added)
+++ directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/CombinedEditorPluginConstants.java Tue Mar 31 09:56:35 2015
@@ -0,0 +1,25 @@
+package org.apache.directory.studio.combinededitor;
+
+
+/**
+ * This interface contains all the Constants used in the Plugin.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public interface CombinedEditorPluginConstants
+{
+ /** The plug-in ID */
+ public static final String PLUGIN_ID = CombinedEditorPlugin.getDefault().getPluginProperties().getString(
+ "Plugin_id" ); //$NON-NLS-1$
+
+ // Preferences
+
+ public static final String PREF_DEFAULT_EDITOR = PLUGIN_ID + ".prefs.DefaultEditor"; //$NON-NLS-1$
+ public static final int PREF_DEFAULT_EDITOR_TEMPLATE = 1;
+ public static final int PREF_DEFAULT_EDITOR_TABLE = 2;
+ public static final int PREF_DEFAULT_EDITOR_LDIF = 3;
+ public static final String PREF_AUTO_SWITCH_TO_ANOTHER_EDITOR = PLUGIN_ID + ".prefs.AutoSwitchToAnotherEditor"; //$NON-NLS-1$
+ public static final String PREF_AUTO_SWITCH_EDITOR = PLUGIN_ID + ".prefs.AutoSwitchEditor"; //$NON-NLS-1$
+ public static final int PREF_AUTO_SWITCH_EDITOR_TABLE = 1;
+ public static final int PREF_AUTO_SWITCH_EDITOR_LDIF = 2;
+}
Added: directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/Messages.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/Messages.java?rev=1670296&view=auto
==============================================================================
--- directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/Messages.java (added)
+++ directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/Messages.java Tue Mar 31 09:56:35 2015
@@ -0,0 +1,31 @@
+package org.apache.directory.studio.combinededitor;
+
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+
+public class Messages
+{
+ private static final String BUNDLE_NAME = "org.apache.directory.studio.combinededitor.messages"; //$NON-NLS-1$
+
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
+
+
+ private Messages()
+ {
+ }
+
+
+ public static String getString( String key )
+ {
+ try
+ {
+ return RESOURCE_BUNDLE.getString( key );
+ }
+ catch ( MissingResourceException e )
+ {
+ return '!' + key + '!';
+ }
+ }
+}
Added: directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/PreferenceInitializer.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/PreferenceInitializer.java?rev=1670296&view=auto
==============================================================================
--- directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/PreferenceInitializer.java (added)
+++ directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/PreferenceInitializer.java Tue Mar 31 09:56:35 2015
@@ -0,0 +1,29 @@
+package org.apache.directory.studio.combinededitor;
+
+
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.jface.preference.IPreferenceStore;
+
+
+/**
+ * This class initializes the preferences of the plugin.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class PreferenceInitializer extends AbstractPreferenceInitializer
+{
+ /**
+ * {@inheritDoc}
+ */
+ public void initializeDefaultPreferences()
+ {
+ IPreferenceStore store = CombinedEditorPlugin.getDefault().getPreferenceStore();
+
+ // Preferences
+ store.setDefault( CombinedEditorPluginConstants.PREF_DEFAULT_EDITOR,
+ CombinedEditorPluginConstants.PREF_DEFAULT_EDITOR_TEMPLATE );
+ store.setDefault( CombinedEditorPluginConstants.PREF_AUTO_SWITCH_TO_ANOTHER_EDITOR, true );
+ store.setDefault( CombinedEditorPluginConstants.PREF_AUTO_SWITCH_EDITOR,
+ CombinedEditorPluginConstants.PREF_AUTO_SWITCH_EDITOR_TABLE );
+ }
+}
Added: directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/actions/FetchOperationalAttributesAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/actions/FetchOperationalAttributesAction.java?rev=1670296&view=auto
==============================================================================
--- directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/actions/FetchOperationalAttributesAction.java (added)
+++ directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/actions/FetchOperationalAttributesAction.java Tue Mar 31 09:56:35 2015
@@ -0,0 +1,86 @@
+package org.apache.directory.studio.combinededitor.actions;
+
+
+import org.apache.directory.studio.entryeditors.IEntryEditor;
+import org.apache.directory.studio.ldapbrowser.core.jobs.InitializeAttributesRunnable;
+import org.apache.directory.studio.ldapbrowser.core.jobs.StudioBrowserJob;
+import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
+import org.eclipse.jface.action.Action;
+
+
+/**
+ * This action fetches the operational attributes of the entry in the given editor.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class FetchOperationalAttributesAction extends Action
+{
+ /** The associated editor */
+ private IEntryEditor editor;
+
+
+ /**
+ * Creates a new instance of FetchOperationalAttributesAction.
+ *
+ * @param editor
+ * The associated editor
+ */
+ public FetchOperationalAttributesAction( IEntryEditor editor )
+ {
+ this.editor = editor;
+ }
+
+
+ @Override
+ public int getStyle()
+ {
+ return Action.AS_CHECK_BOX;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getText()
+ {
+ return org.apache.directory.studio.ldapbrowser.common.actions.Messages
+ .getString( "FetchOperationalAttributesAction.FetchOperationalAttributes" ); //$NON-NLS-1$
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isEnabled()
+ {
+ if ( editor != null )
+ {
+ IEntry entry = editor.getEntryEditorInput().getResolvedEntry();
+ if ( entry != null )
+ {
+ entry = entry.getBrowserConnection().getEntryFromCache( entry.getDn() );
+
+ return !entry.getBrowserConnection().isFetchOperationalAttributes();
+ }
+ }
+
+ return false;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void run()
+ {
+ if ( editor != null )
+ {
+ IEntry entry = editor.getEntryEditorInput().getResolvedEntry();
+ entry = entry.getBrowserConnection().getEntryFromCache( entry.getDn() );
+
+ boolean init = !entry.isInitOperationalAttributes();
+ entry.setInitOperationalAttributes( init );
+ new StudioBrowserJob( new InitializeAttributesRunnable( entry ) ).execute();
+ }
+ }
+}
Added: directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/actions/Messages.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/actions/Messages.java?rev=1670296&view=auto
==============================================================================
--- directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/actions/Messages.java (added)
+++ directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/actions/Messages.java Tue Mar 31 09:56:35 2015
@@ -0,0 +1,31 @@
+package org.apache.directory.studio.combinededitor.actions;
+
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+
+public class Messages
+{
+ private static final String BUNDLE_NAME = "org.apache.directory.studio.combinededitor.actions.messages"; //$NON-NLS-1$
+
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
+
+
+ private Messages()
+ {
+ }
+
+
+ public static String getString( String key )
+ {
+ try
+ {
+ return RESOURCE_BUNDLE.getString( key );
+ }
+ catch ( MissingResourceException e )
+ {
+ return '!' + key + '!';
+ }
+ }
+}
Added: directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/actions/messages.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/actions/messages.properties?rev=1670296&view=auto
==============================================================================
--- directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/actions/messages.properties (added)
+++ directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/actions/messages.properties Tue Mar 31 09:56:35 2015
@@ -0,0 +1,4 @@
+DisplayEntryInTemplateAction.DisplayEntryIn=Display Entry In
+DisplayEntryInTemplateMenuManager.DiplayEntryIn=Display Entry In
+DisplayEntryInTemplateMenuManager.NoTemplate=No Template
+EntryTemplatePreferencePageAction.Preferences=Preferences...
\ No newline at end of file
Added: directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/actions/messages_de.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/actions/messages_de.properties?rev=1670296&view=auto
==============================================================================
--- directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/actions/messages_de.properties (added)
+++ directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/actions/messages_de.properties Tue Mar 31 09:56:35 2015
@@ -0,0 +1,7 @@
+
+DisplayEntryInTemplateAction.DisplayEntryIn=Eintrag anzeigen in
+
+DisplayEntryInTemplateMenuManager.DiplayEntryIn=Eintrag anzeigen in
+DisplayEntryInTemplateMenuManager.NoTemplate =Kein Template
+
+EntryTemplatePreferencePageAction.Preferences=Benutzervorgaben...
Added: directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/actions/messages_fr.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/actions/messages_fr.properties?rev=1670296&view=auto
==============================================================================
--- directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/actions/messages_fr.properties (added)
+++ directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/actions/messages_fr.properties Tue Mar 31 09:56:35 2015
@@ -0,0 +1,4 @@
+DisplayEntryInTemplateAction.DisplayEntryIn=Afficher l'entrée dans
+DisplayEntryInTemplateMenuManager.DiplayEntryIn=Afficher l'entrée dans
+DisplayEntryInTemplateMenuManager.NoTemplate=Aucun modèle
+EntryTemplatePreferencePageAction.Preferences=Préférences...
\ No newline at end of file
Added: directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/editor/AbstractCombinedEntryEditorPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/editor/AbstractCombinedEntryEditorPage.java?rev=1670296&view=auto
==============================================================================
--- directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/editor/AbstractCombinedEntryEditorPage.java (added)
+++ directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/editor/AbstractCombinedEntryEditorPage.java Tue Mar 31 09:56:35 2015
@@ -0,0 +1,178 @@
+package org.apache.directory.studio.combinededitor.editor;
+
+
+import org.eclipse.swt.custom.CTabItem;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+
+
+/**
+ * This interface defines a page for the editor.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public abstract class AbstractCombinedEntryEditorPage implements ICombinedEntryEditorPage
+{
+ /** The associated editor */
+ private CombinedEntryEditor editor;
+
+ /** The flag to know whether or not the editor page has been initialized */
+ private boolean initialized = false;
+
+ /** The {@link CTabItem} associated with the editor page */
+ private CTabItem tabItem;
+
+
+ /**
+ * Creates a new instance of AbstractTemplateEntryEditorPage.
+ *
+ * @param editor
+ * the associated editor
+ */
+ public AbstractCombinedEntryEditorPage( CombinedEntryEditor editor )
+ {
+ this.editor = editor;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void dispose()
+ {
+ // Default implementation does nothing
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void editorInputChanged()
+ {
+ // Default implementation does nothing
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public CombinedEntryEditor getEditor()
+ {
+ return editor;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public CTabItem getTabItem()
+ {
+ return tabItem;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void init()
+ {
+ setInitialized( true );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isInitialized()
+ {
+ return initialized;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setFocus()
+ {
+ // Default implementation does nothing
+ }
+
+
+ /**
+ * Sets the flag to know whether or not the editor page has been initialized.
+ *
+ * @param initialized
+ * the value
+ */
+ protected void setInitialized( boolean initialized )
+ {
+ this.initialized = initialized;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void update()
+ {
+ // Default implementation does nothing
+ }
+
+
+ /**
+ * Sets the {@link CTabItem} associated with the editor page.
+ *
+ * @param tabItem
+ * the {@link CTabItem} associated with the editor page
+ */
+ protected void setTabItem( CTabItem tabItem )
+ {
+ this.tabItem = tabItem;
+
+ // Registering a listener on the editor's tab folder
+ if ( ( getEditor() != null ) && ( getEditor().getTabFolder() != null )
+ && ( !getEditor().getTabFolder().isDisposed() ) )
+ {
+ getEditor().getTabFolder().addSelectionListener( new SelectionAdapter()
+ {
+ public void widgetSelected( SelectionEvent e )
+ {
+ tabFolderSelectionChanged();
+ }
+ } );
+ }
+ }
+
+
+ /**
+ * This method is called when the TabFolder selection is changed.
+ */
+ private void tabFolderSelectionChanged()
+ {
+ if ( ( getEditor() != null ) && ( getEditor().getTabFolder() != null )
+ && ( !getEditor().getTabFolder().isDisposed() ) )
+ {
+ // Getting the selected tab
+ CTabItem selectedTab = getEditor().getTabFolder().getSelection();
+
+ // Verifying if the selected tab is this page's tab
+ if ( ( selectedTab != null ) && ( selectedTab.equals( tabItem ) ) )
+ {
+ // Checking if the page needs to be initialized or updated
+ if ( !isInitialized() )
+ {
+ // Initializing the page
+ init();
+ }
+ else
+ {
+ // Updating the page
+ update();
+ }
+
+ // Setting the correct focus
+ setFocus();
+ }
+ }
+ }
+}
Added: directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/editor/CombinedEntryEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/editor/CombinedEntryEditor.java?rev=1670296&view=auto
==============================================================================
--- directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/editor/CombinedEntryEditor.java (added)
+++ directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/editor/CombinedEntryEditor.java Tue Mar 31 09:56:35 2015
@@ -0,0 +1,571 @@
+package org.apache.directory.studio.combinededitor.editor;
+
+
+import org.apache.directory.studio.entryeditors.EntryEditorInput;
+import org.apache.directory.studio.entryeditors.EntryEditorUtils;
+import org.apache.directory.studio.entryeditors.IEntryEditor;
+import org.apache.directory.studio.ldapbrowser.core.model.IBookmark;
+import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
+import org.apache.directory.studio.ldapbrowser.core.model.ISearchResult;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CTabFolder;
+import org.eclipse.swt.custom.CTabItem;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.INavigationLocation;
+import org.eclipse.ui.INavigationLocationProvider;
+import org.eclipse.ui.IReusableEditor;
+import org.eclipse.ui.IShowEditorInput;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.part.EditorPart;
+
+import org.apache.directory.studio.combinededitor.CombinedEditorPlugin;
+import org.apache.directory.studio.combinededitor.CombinedEditorPluginConstants;
+import org.apache.directory.studio.templateeditor.EntryTemplatePluginUtils;
+import org.apache.directory.studio.templateeditor.actions.SwitchTemplateListener;
+import org.apache.directory.studio.templateeditor.editor.TemplateEditorWidget;
+import org.apache.directory.studio.templateeditor.model.Template;
+
+
+/**
+ * This class implements the Template Entry Editor.
+ * <p>
+ * This editor is composed of a three tabs TabFolder object:
+ * <ul>
+ * <li>the Template Editor itself</li>
+ * <li>the Table Editor</li>
+ * <li>the LDIF Editor</li>
+ * </ul>
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public abstract class CombinedEntryEditor extends EditorPart implements INavigationLocationProvider, IEntryEditor,
+ IReusableEditor, IShowEditorInput, SwitchTemplateListener
+{
+ /** The Template Editor page */
+ private TemplateEditorPage templateEditorPage;
+ /** The Table Editor page */
+ private TableEditorPage tableEditorPage;
+ /** The LDIF Editor page */
+ private LdifEditorPage ldifEditorPage;
+
+ /** The Tab Folder */
+ private CTabFolder tabFolder;
+
+ /** The tab associated with the Template Editor */
+ private CTabItem templateEditorTab;
+ /** The tab associated with the Table Editor */
+ private CTabItem tableEditorTab;
+ /** The tab associated with the LDIF Editor */
+ private CTabItem ldifEditorTab;
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void init( IEditorSite site, IEditorInput input ) throws PartInitException
+ {
+ setSite( site );
+ setInput( input );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void createPartControl( Composite parent )
+ {
+ // Creating the TabFolder
+ tabFolder = new CTabFolder( parent, SWT.BOTTOM );
+
+ // Creating the editor pages and tab items
+ templateEditorPage = new TemplateEditorPage( this );
+ templateEditorTab = templateEditorPage.getTabItem();
+ tableEditorPage = new TableEditorPage( this );
+ tableEditorTab = tableEditorPage.getTabItem();
+ ldifEditorPage = new LdifEditorPage( this );
+ ldifEditorTab = ldifEditorPage.getTabItem();
+
+ // Getting the preference store
+ IPreferenceStore store = CombinedEditorPlugin.getDefault().getPreferenceStore();
+
+ // Getting the default editor
+ int defaultEditor = store.getInt( CombinedEditorPluginConstants.PREF_DEFAULT_EDITOR );
+ if ( defaultEditor == CombinedEditorPluginConstants.PREF_DEFAULT_EDITOR_TEMPLATE )
+ {
+ // Getting the boolean indicating if the user wants to auto-switch the template editor
+ boolean autoSwitchToAnotherEditor = store
+ .getBoolean( CombinedEditorPluginConstants.PREF_AUTO_SWITCH_TO_ANOTHER_EDITOR );
+ if ( autoSwitchToAnotherEditor && !canBeHandledWithATemplate() )
+ {
+ int autoSwitchEditor = store.getInt( CombinedEditorPluginConstants.PREF_AUTO_SWITCH_EDITOR );
+ if ( autoSwitchEditor == CombinedEditorPluginConstants.PREF_AUTO_SWITCH_EDITOR_TABLE )
+ {
+ // Selecting the Table Editor
+ tabFolder.setSelection( tableEditorTab );
+ tableEditorPage.init(); // Forcing the initialization of the first tab item, because the listener is not triggered when selecting a tab item programmatically
+ }
+ else if ( autoSwitchEditor == CombinedEditorPluginConstants.PREF_AUTO_SWITCH_EDITOR_LDIF )
+ {
+ // Selecting the LDIF Editor
+ tabFolder.setSelection( ldifEditorTab );
+ ldifEditorPage.init(); // Forcing the initialization of the first tab item, because the listener is not triggered when selecting a tab item programmatically
+ }
+ }
+ else
+ {
+ // Selecting the Template Editor
+ tabFolder.setSelection( templateEditorTab );
+ templateEditorPage.init(); // Forcing the initialization of the first tab item, because the listener is not triggered when selecting a tab item programmatically
+ }
+ }
+ else if ( defaultEditor == CombinedEditorPluginConstants.PREF_DEFAULT_EDITOR_TABLE )
+ {
+ // Selecting the Table Editor
+ tabFolder.setSelection( tableEditorTab );
+ tableEditorPage.init(); // Forcing the initialization of the first tab item, because the listener is not triggered when selecting a tab item programmatically
+ }
+ else if ( defaultEditor == CombinedEditorPluginConstants.PREF_DEFAULT_EDITOR_LDIF )
+ {
+ // Selecting the LDIF Editor
+ tabFolder.setSelection( ldifEditorTab );
+ ldifEditorPage.init(); // Forcing the initialization of the first tab item, because the listener is not triggered when selecting a tab item programmatically
+ }
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void workingCopyModified( Object source )
+ {
+ update();
+
+ if ( !isAutoSave() )
+ {
+ // mark as dirty
+ firePropertyChange( PROP_DIRTY );
+ }
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void dispose()
+ {
+ //
+ // Disposing the TabFolder, its tabs and Editor Pages
+ //
+
+ // Tab Folder
+ if ( ( tabFolder != null ) && ( !tabFolder.isDisposed() ) )
+ {
+ tabFolder.dispose();
+ }
+
+ // Template Editor Tab
+ if ( ( templateEditorTab != null ) && ( !templateEditorTab.isDisposed() ) )
+ {
+ templateEditorTab.dispose();
+ }
+
+ // Table Editor Tab
+ if ( ( tableEditorTab != null ) && ( !tableEditorTab.isDisposed() ) )
+ {
+ tableEditorTab.dispose();
+ }
+
+ // LDIF Editor Tab
+ if ( ( ldifEditorTab != null ) && ( !ldifEditorTab.isDisposed() ) )
+ {
+ ldifEditorTab.dispose();
+ }
+
+ // Template Editor Page
+ if ( templateEditorPage != null )
+ {
+ templateEditorPage.dispose();
+ }
+
+ // Table Editor Page
+ if ( tableEditorPage != null )
+ {
+ tableEditorPage.dispose();
+ }
+
+ // LDIF Editor Page
+ if ( ldifEditorPage != null )
+ {
+ ldifEditorPage.dispose();
+ }
+
+ super.dispose();
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean canHandle( IEntry entry )
+ {
+ return true;
+ }
+
+
+ /**
+ * Indicates whether or not the entry can be handled with a (at least) template.
+ *
+ * @param entry
+ * the entry
+ * @return
+ * <code>true</code> if the entry can be handled with a template,
+ * <code>false</code> if not.
+ */
+ private boolean canBeHandledWithATemplate( IEntry entry )
+ {
+ return ( EntryTemplatePluginUtils.getMatchingTemplates( entry ).size() > 0 );
+ }
+
+
+ /**
+ * Indicates whether or not the input entry can be handled with a (at least) template.
+ *
+ * @return
+ * <code>true</code> if the input entry can be handled with a template,
+ * <code>false</code> if not.
+ */
+ private boolean canBeHandledWithATemplate()
+ {
+ IEditorInput editorInput = getEditorInput();
+ if ( ( editorInput != null ) && ( editorInput instanceof EntryEditorInput ) )
+ {
+ IEntry entry = ( ( EntryEditorInput ) editorInput ).getResolvedEntry();
+ if ( entry != null )
+ {
+ return canBeHandledWithATemplate( entry );
+ }
+ }
+
+ return false;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void doSave( IProgressMonitor monitor )
+ {
+ if ( !isAutoSave() )
+ {
+ EntryEditorInput eei = getEntryEditorInput();
+ eei.saveSharedWorkingCopy( true, this );
+ }
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isDirty()
+ {
+ return getEntryEditorInput().isSharedWorkingCopyDirty( this );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isSaveAsAllowed()
+ {
+ return false;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void doSaveAs()
+ {
+ // Nothing to do, will never occur as "Save As..." is not allowed
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setFocus()
+ {
+ if ( ( tabFolder != null ) && ( !tabFolder.isDisposed() ) )
+ {
+ tabFolder.setFocus();
+ }
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public EntryEditorInput getEntryEditorInput()
+ {
+ Object editorInput = getEditorInput();
+ if ( ( editorInput != null ) && ( editorInput instanceof EntryEditorInput ) )
+ {
+ return ( EntryEditorInput ) editorInput;
+ }
+
+ return null;
+ }
+
+
+ /**
+ * Updates the selected AbstractTemplateEntryEditorPage.
+ */
+ private void update()
+ {
+ ICombinedEntryEditorPage selectedPage = getEditorPageFromSelectedTab();
+ if ( selectedPage != null )
+ {
+ selectedPage.update();
+ }
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setInput( IEditorInput input )
+ {
+ super.setInput( input );
+
+ setPartName( input.getName() );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public INavigationLocation createEmptyNavigationLocation()
+ {
+ return null;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public INavigationLocation createNavigationLocation()
+ {
+ return new CombinedEntryEditorNavigationLocation( this );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void showEditorInput( IEditorInput input )
+ {
+ if ( input instanceof EntryEditorInput )
+ {
+ // If the editor is dirty, let's ask for a save before changing the input
+ if ( isDirty() )
+ {
+ if ( !EntryEditorUtils.askSaveSharedWorkingCopyBeforeInputChange( this ) )
+ {
+ return;
+ }
+ }
+
+ /*
+ * Workaround to make link-with-editor working for the single-tab editor:
+ * The call of firePropertyChange is used to inform the link-with-editor action.
+ * However firePropertyChange also modifies the navigation history.
+ * Thus, a dummy input with the real entry but a null extension is set.
+ * This avoids to modification of the navigation history.
+ * Afterwards the real input is set.
+ */
+ EntryEditorInput eei = ( EntryEditorInput ) input;
+ IEntry entryInput = eei.getEntryInput();
+ ISearchResult searchResultInput = eei.getSearchResultInput();
+ IBookmark bookmarkInput = eei.getBookmarkInput();
+ EntryEditorInput dummyInput;
+ if ( entryInput != null )
+ {
+ dummyInput = new EntryEditorInput( entryInput, null );
+ }
+ else if ( searchResultInput != null )
+ {
+ dummyInput = new EntryEditorInput( searchResultInput, null );
+ }
+ else
+ {
+ dummyInput = new EntryEditorInput( bookmarkInput, null );
+ }
+ setInput( dummyInput );
+ firePropertyChange( IEditorPart.PROP_INPUT );
+
+ // now set the real input and mark history location
+ setInput( input );
+ getSite().getPage().getNavigationHistory().markLocation( this );
+
+ // Getting the preference store
+ IPreferenceStore store = CombinedEditorPlugin.getDefault().getPreferenceStore();
+
+ // Getting the default editor
+ int defaultEditor = store.getInt( CombinedEditorPluginConstants.PREF_DEFAULT_EDITOR );
+ if ( defaultEditor == CombinedEditorPluginConstants.PREF_DEFAULT_EDITOR_TEMPLATE )
+ {
+ // Getting the boolean indicating if the user wants to auto-switch the template editor
+ boolean autoSwitchToAnotherEditor = store
+ .getBoolean( CombinedEditorPluginConstants.PREF_AUTO_SWITCH_TO_ANOTHER_EDITOR );
+ if ( autoSwitchToAnotherEditor && !canBeHandledWithATemplate() )
+ {
+ int autoSwitchEditor = store.getInt( CombinedEditorPluginConstants.PREF_AUTO_SWITCH_EDITOR );
+ if ( autoSwitchEditor == CombinedEditorPluginConstants.PREF_AUTO_SWITCH_EDITOR_TABLE )
+ {
+ // Selecting the Table Editor
+ tabFolder.setSelection( tableEditorTab );
+ tableEditorPage.init(); // Forcing the initialization of the first tab item, because the listener is not triggered when selecting a tab item programmatically
+ }
+ else if ( autoSwitchEditor == CombinedEditorPluginConstants.PREF_AUTO_SWITCH_EDITOR_LDIF )
+ {
+ // Selecting the LDIF Editor
+ tabFolder.setSelection( ldifEditorTab );
+ ldifEditorPage.init(); // Forcing the initialization of the first tab item, because the listener is not triggered when selecting a tab item programmatically
+ }
+ }
+ else
+ {
+ // Selecting the Template Editor
+ tabFolder.setSelection( templateEditorTab );
+ templateEditorPage.init(); // Forcing the initialization of the first tab item, because the listener is not triggered when selecting a tab item programmatically
+ }
+ }
+ else if ( defaultEditor == CombinedEditorPluginConstants.PREF_DEFAULT_EDITOR_TABLE )
+ {
+ // Selecting the Table Editor
+ tabFolder.setSelection( tableEditorTab );
+ tableEditorPage.init(); // Forcing the initialization of the first tab item, because the listener is not triggered when selecting a tab item programmatically
+ }
+ else if ( defaultEditor == CombinedEditorPluginConstants.PREF_DEFAULT_EDITOR_LDIF )
+ {
+ // Selecting the LDIF Editor
+ tabFolder.setSelection( ldifEditorTab );
+ ldifEditorPage.init(); // Forcing the initialization of the first tab item, because the listener is not triggered when selecting a tab item programmatically
+ }
+
+ // Noticing all pages that the editor input has changed
+ templateEditorPage.editorInputChanged();
+ tableEditorPage.editorInputChanged();
+ ldifEditorPage.editorInputChanged();
+ }
+ }
+
+
+ /**
+ * Gets the {@link ICombinedEntryEditorPage} associated with the selected tab.
+ *
+ * @return
+ * the {@link ICombinedEntryEditorPage} associated with the selected tab
+ */
+ private ICombinedEntryEditorPage getEditorPageFromSelectedTab()
+ {
+ CTabItem selectedTabItem = getSelectedTabItem();
+ if ( selectedTabItem != null )
+ {
+ // Template Editor Tab
+ if ( selectedTabItem.equals( templateEditorTab ) )
+ {
+ return templateEditorPage;
+ }
+ // Table Editor Tab
+ else if ( selectedTabItem.equals( tableEditorTab ) )
+ {
+ return tableEditorPage;
+ }
+ // LDIF Editor Tab
+ else if ( selectedTabItem.equals( ldifEditorTab ) )
+ {
+ return ldifEditorPage;
+ }
+ }
+
+ return null;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void templateSwitched( TemplateEditorWidget templateEditorWidget, Template template )
+ {
+ if ( templateEditorPage != null )
+ {
+ templateEditorPage.templateSwitched( templateEditorWidget, template );
+ }
+ }
+
+
+ /**
+ * Returns the {@link CTabFolder} associated with the editor.
+ *
+ * @return
+ * the {@link CTabFolder} associated with the editor
+ */
+ public CTabFolder getTabFolder()
+ {
+ return tabFolder;
+ }
+
+
+ /**
+ * Returns the currently selected {@link CTabItem}.
+ *
+ * @return
+ * the currently selected {@link CTabItem}
+ */
+ public CTabItem getSelectedTabItem()
+ {
+ return tabFolder.getSelection();
+ }
+
+
+ /**
+ * Get the {@link TemplateEditorPage} page.
+ *
+ * @return
+ * the {@link TemplateEditorPage} page
+ */
+ public TemplateEditorPage getTemplateEditorPage()
+ {
+ return templateEditorPage;
+ }
+
+
+ /**
+ * Get the {@link TableEditorPage} page.
+ *
+ * @return
+ * the {@link TableEditorPage} page
+ */
+ public TableEditorPage getTableEditorPage()
+ {
+ return tableEditorPage;
+ }
+
+
+ /**
+ * Get the {@link LdifEditorPage} page.
+ *
+ * @return
+ * the {@link LdifEditorPage} page
+ */
+ public LdifEditorPage getLdifEditorPage()
+ {
+ return ldifEditorPage;
+ }
+}
Added: directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/editor/CombinedEntryEditorNavigationLocation.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/editor/CombinedEntryEditorNavigationLocation.java?rev=1670296&view=auto
==============================================================================
--- directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/editor/CombinedEntryEditorNavigationLocation.java (added)
+++ directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/editor/CombinedEntryEditorNavigationLocation.java Tue Mar 31 09:56:35 2015
@@ -0,0 +1,223 @@
+package org.apache.directory.studio.combinededitor.editor;
+
+
+import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException;
+import org.apache.directory.api.ldap.model.name.Dn;
+import org.apache.directory.studio.entryeditors.EntryEditorExtension;
+import org.apache.directory.studio.entryeditors.EntryEditorInput;
+import org.apache.directory.studio.entryeditors.EntryEditorManager;
+import org.apache.directory.studio.entryeditors.EntryEditorUtils;
+import org.apache.directory.studio.ldapbrowser.core.BrowserCorePlugin;
+import org.apache.directory.studio.ldapbrowser.core.model.IBookmark;
+import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
+import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
+import org.apache.directory.studio.ldapbrowser.core.model.ISearch;
+import org.apache.directory.studio.ldapbrowser.core.model.ISearchResult;
+import org.apache.directory.studio.ldapbrowser.ui.BrowserUIPlugin;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.INavigationLocation;
+import org.eclipse.ui.NavigationLocation;
+
+
+/**
+ * This class is used to mark the entry editor input to the navigation history.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class CombinedEntryEditorNavigationLocation extends NavigationLocation
+{
+ private static final String BOOKMARK_TAG = "BOOKMARK"; //$NON-NLS-1$
+ private static final String CONNECTION_TAG = "CONNECTION"; //$NON-NLS-1$
+ private static final String DN_TAG = "DN"; //$NON-NLS-1$
+ private static final String EXTENSION_TAG = "EXTENSION"; //$NON-NLS-1$
+ private static final String SEARCH_TAG = "SEARCH"; //$NON-NLS-1$
+ private static final String TYPE_BOOKMARK_VALUE = "IBookmark"; //$NON-NLS-1$
+ private static final String TYPE_SEARCHRESULT_VALUE = "ISearchResult"; //$NON-NLS-1$
+ private static final String TYPE_TAG = "TYPE"; //$NON-NLS-1$
+ private static final String TYPE_ENTRY_VALUE = "IEntry"; //$NON-NLS-1$
+
+
+ /**
+ * Creates a new instance of EntryEditorNavigationLocation.
+ *
+ * @param editor the entry editor
+ */
+ protected CombinedEntryEditorNavigationLocation( IEditorPart editor )
+ {
+ super( editor );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getText()
+ {
+ String text = EntryEditorUtils.getHistoryNavigationText( getEntryEditorInput() );
+ return text != null ? text : super.getText();
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void saveState( IMemento memento )
+ {
+ EntryEditorInput eei = getEntryEditorInput();
+ if ( eei != null )
+ {
+ memento.putString( EXTENSION_TAG, eei.getExtension().getId() );
+ if ( eei.getEntryInput() != null )
+ {
+ IEntry entry = eei.getEntryInput();
+ memento.putString( TYPE_TAG, TYPE_ENTRY_VALUE );
+ memento.putString( DN_TAG, entry.getDn().getName() );
+ memento.putString( CONNECTION_TAG, entry.getBrowserConnection().getConnection().getId() );
+ }
+ else if ( eei.getSearchResultInput() != null )
+ {
+ ISearchResult searchResult = eei.getSearchResultInput();
+ memento.putString( TYPE_TAG, TYPE_SEARCHRESULT_VALUE );
+ memento.putString( DN_TAG, searchResult.getDn().getName() );
+ memento.putString( SEARCH_TAG, searchResult.getSearch().getName() );
+ memento.putString( CONNECTION_TAG, searchResult.getSearch().getBrowserConnection().getConnection()
+ .getId() );
+ }
+ else if ( eei.getBookmarkInput() != null )
+ {
+ IBookmark bookmark = eei.getBookmarkInput();
+ memento.putString( TYPE_TAG, TYPE_BOOKMARK_VALUE );
+ memento.putString( BOOKMARK_TAG, bookmark.getName() );
+ memento.putString( CONNECTION_TAG, bookmark.getBrowserConnection().getConnection().getId() );
+ }
+ }
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void restoreState( IMemento memento )
+ {
+ try
+ {
+ String type = memento.getString( TYPE_TAG );
+ String extensionId = memento.getString( EXTENSION_TAG );
+ EntryEditorManager entryEditorManager = BrowserUIPlugin.getDefault().getEntryEditorManager();
+ EntryEditorExtension entryEditorExtension = entryEditorManager.getEntryEditorExtension( extensionId );
+ if ( TYPE_ENTRY_VALUE.equals( type ) )
+ {
+ IBrowserConnection connection = BrowserCorePlugin.getDefault().getConnectionManager()
+ .getBrowserConnectionById( memento.getString( CONNECTION_TAG ) );
+ Dn dn = new Dn( memento.getString( DN_TAG ) );
+ IEntry entry = connection.getEntryFromCache( dn );
+ super.setInput( new EntryEditorInput( entry, entryEditorExtension ) );
+ }
+ else if ( TYPE_SEARCHRESULT_VALUE.equals( type ) )
+ {
+ IBrowserConnection connection = BrowserCorePlugin.getDefault().getConnectionManager()
+ .getBrowserConnectionById( memento.getString( CONNECTION_TAG ) );
+ ISearch search = connection.getSearchManager().getSearch( memento.getString( SEARCH_TAG ) );
+ ISearchResult[] searchResults = search.getSearchResults();
+ Dn dn = new Dn( memento.getString( DN_TAG ) );
+ for ( int i = 0; i < searchResults.length; i++ )
+ {
+ if ( dn.equals( searchResults[i].getDn() ) )
+ {
+ super.setInput( new EntryEditorInput( searchResults[i], entryEditorExtension ) );
+ break;
+ }
+ }
+ }
+ else if ( TYPE_BOOKMARK_VALUE.equals( type ) )
+ {
+ IBrowserConnection connection = BrowserCorePlugin.getDefault().getConnectionManager()
+ .getBrowserConnectionById( memento.getString( CONNECTION_TAG ) );
+ IBookmark bookmark = connection.getBookmarkManager().getBookmark( memento.getString( BOOKMARK_TAG ) );
+ super.setInput( new EntryEditorInput( bookmark, entryEditorExtension ) );
+ }
+ }
+ catch ( LdapInvalidDnException e )
+ {
+ e.printStackTrace();
+ }
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void restoreLocation()
+ {
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean mergeInto( INavigationLocation currentLocation )
+ {
+ if ( currentLocation == null )
+ {
+ return false;
+ }
+
+ if ( getClass() != currentLocation.getClass() )
+ {
+ return false;
+ }
+
+ CombinedEntryEditorNavigationLocation location = ( CombinedEntryEditorNavigationLocation ) currentLocation;
+ Object other = location.getEntryEditorInput().getInput();
+ Object entry = getEntryEditorInput().getInput();
+
+ if ( other == null && entry == null )
+ {
+ return true;
+ }
+ else if ( other == null || entry == null )
+ {
+ return false;
+ }
+ else
+ {
+ return entry.equals( other );
+ }
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void update()
+ {
+ }
+
+
+ /**
+ * Gets the input.
+ *
+ * @return the input
+ */
+ private EntryEditorInput getEntryEditorInput()
+ {
+ Object editorInput = getInput();
+ if ( editorInput != null && editorInput instanceof EntryEditorInput )
+ {
+ EntryEditorInput entryEditorInput = ( EntryEditorInput ) editorInput;
+ return entryEditorInput;
+ }
+
+ return null;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public String toString()
+ {
+ return "" + getEntryEditorInput().getInput(); //$NON-NLS-1$
+ }
+}
Added: directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/editor/ICombinedEntryEditorPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/editor/ICombinedEntryEditorPage.java?rev=1670296&view=auto
==============================================================================
--- directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/editor/ICombinedEntryEditorPage.java (added)
+++ directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/editor/ICombinedEntryEditorPage.java Tue Mar 31 09:56:35 2015
@@ -0,0 +1,72 @@
+package org.apache.directory.studio.combinededitor.editor;
+
+
+import org.eclipse.swt.custom.CTabItem;
+
+
+/**
+ * This interface defines a page for the editor.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public interface ICombinedEntryEditorPage
+{
+ /**
+ * Disposes any allocated resource.
+ */
+ public void dispose();
+
+
+ /**
+ * This method is called when editor input has changed.
+ */
+ public void editorInputChanged();
+
+
+ /**
+ * Gets the associated editor.
+ *
+ * @return
+ * the associated editor
+ */
+ public CombinedEntryEditor getEditor();
+
+
+ /**
+ * Gets the {@link CTabItem} associated with the editor page.
+ *
+ * @return
+ * the {@link CTabItem} associated with the editor page
+ */
+ public CTabItem getTabItem();
+
+
+ /**
+ * Initializes the control of the page.
+ */
+ public void init();
+
+
+ /**
+ * Returns whether or not the editor page has been initialized.
+ *
+ * @return
+ * <code>true</code> if the editor page has been initialized,
+ * <code>false</code> if not.
+ */
+ public boolean isInitialized();
+
+
+ /**
+ * Asks this part to take focus within the workbench. Parts must
+ * assign focus to one of the controls contained in the part's
+ * parent composite.
+ */
+ public void setFocus();
+
+
+ /**
+ * This method is called when then editor page needs to be updated.
+ */
+ public void update();
+}