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/01/04 18:26:26 UTC
svn commit: r492646 - in
/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor: ./ META-INF/
src/main/java/org/apache/directory/ldapstudio/aciitemeditor/
src/main/java/org/apache/directory/ldapstudio/aciitemeditor/dialogs/
src/main/java/org/apache...
Author: pamarcelot
Date: Thu Jan 4 09:26:23 2007
New Revision: 492646
URL: http://svn.apache.org/viewvc?view=rev&rev=492646
Log:
Adding basic content assist to the ACI Item Source Editor. Some other templates need to be added in the templates.xml file.
Added:
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/ACIITemConstants.java
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/dialogs/DialogContentAssistant.java
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/widgets/ACIContentAssistProcessor.java
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/templates/
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/templates/templates.xml
Modified:
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/META-INF/MANIFEST.MF
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/plugin.xml
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/Activator.java
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/widgets/ACIItemSourceEditorComposite.java
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/widgets/ACISourceViewerConfiguration.java
Modified: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/META-INF/MANIFEST.MF?view=diff&rev=492646&r1=492645&r2=492646
==============================================================================
--- directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/META-INF/MANIFEST.MF (original)
+++ directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/META-INF/MANIFEST.MF Thu Jan 4 09:26:23 2007
@@ -11,7 +11,9 @@
org.eclipse.core.resources,
org.apache.directory.ldapstudio.jars,
org.apache.directory.ldapstudio.browser.ui,
- org.apache.directory.ldapstudio.browser.core
+ org.apache.directory.ldapstudio.browser.core,
+ org.eclipse.ui.editors,
+ org.eclipse.ui.workbench.texteditor
Eclipse-LazyStart: true
Bundle-Vendor: apache.org
Bundle-ClassPath: .,
Modified: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/plugin.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/plugin.xml?view=diff&rev=492646&r1=492645&r2=492646
==============================================================================
--- directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/plugin.xml (original)
+++ directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/plugin.xml Thu Jan 4 09:26:23 2007
@@ -21,5 +21,13 @@
<syntax syntaxOID="1.3.6.1.4.1.1466.115.121.1.1"/>
</valueEditor>
</extension>
+ <extension
+ point="org.eclipse.ui.editors.templates">
+ <include file="templates/templates.xml"/>
+ <contextType
+ class="org.eclipse.jface.text.templates.TemplateContextType"
+ id="org.apache.directory.ldapstudio.aciitemeditor.templates"
+ name="ACI Item"/>
+ </extension>
</plugin>
Added: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/ACIITemConstants.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/ACIITemConstants.java?view=auto&rev=492646
==============================================================================
--- directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/ACIITemConstants.java (added)
+++ directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/ACIITemConstants.java Thu Jan 4 09:26:23 2007
@@ -0,0 +1,32 @@
+/*
+ * 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.ldapstudio.aciitemeditor;
+
+/**
+ * This interface is used to store all constants related to the ACI Item Editor Plugin
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface ACIITemConstants
+{
+ /** The ID for ACI Item Template*/
+ public static final String ACI_ITEM_TEMPLATE_ID = "org.apache.directory.ldapstudio.aciitemeditor.templates";
+}
Modified: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/Activator.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/Activator.java?view=diff&rev=492646&r1=492645&r2=492646
==============================================================================
--- directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/Activator.java (original)
+++ directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/Activator.java Thu Jan 4 09:26:23 2007
@@ -19,6 +19,8 @@
*/
package org.apache.directory.ldapstudio.aciitemeditor;
+import java.io.IOException;
+
import org.apache.directory.ldapstudio.aciitemeditor.widgets.ACICodeScanner;
import org.apache.directory.ldapstudio.aciitemeditor.widgets.ACITextAttributeProvider;
import org.apache.directory.shared.ldap.aci.ACIItemParser;
@@ -26,10 +28,13 @@
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.text.templates.GlobalTemplateVariables;
import org.eclipse.swt.graphics.FontMetrics;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.editors.text.templates.ContributionContextTypeRegistry;
+import org.eclipse.ui.editors.text.templates.ContributionTemplateStore;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
@@ -58,6 +63,12 @@
/** The shared ACI TextAttribute Provider */
private ACITextAttributeProvider textAttributeProvider;
+
+ /** The template store */
+ private ContributionTemplateStore aciTemplateStore;
+
+ /** The context type registry */
+ private ContributionContextTypeRegistry aciTemplateContextTypeRegistry;
/**
@@ -76,6 +87,31 @@
public void start( BundleContext context ) throws Exception
{
super.start( context );
+
+ // ACI Template ContextType Registry initialization
+ if ( this.aciTemplateContextTypeRegistry == null )
+ {
+ this.aciTemplateContextTypeRegistry = new ContributionContextTypeRegistry();
+
+ this.aciTemplateContextTypeRegistry.addContextType( ACIITemConstants.ACI_ITEM_TEMPLATE_ID );
+ this.aciTemplateContextTypeRegistry.getContextType( ACIITemConstants.ACI_ITEM_TEMPLATE_ID )
+ .addResolver( new GlobalTemplateVariables.Cursor() );
+ }
+
+ // ACI Template Store initialization
+ if ( this.aciTemplateStore == null )
+ {
+ this.aciTemplateStore = new ContributionTemplateStore( getAciTemplateContextTypeRegistry(),
+ getPreferenceStore(), "templates" );
+ try
+ {
+ this.aciTemplateStore.load();
+ }
+ catch ( IOException e )
+ {
+ e.printStackTrace();
+ }
+ }
}
@@ -204,4 +240,29 @@
}
return aciCodeScanner;
}
+
+
+ /**
+ * Gets the ACI Template ContextType Registry
+ *
+ * @return
+ * the ACI Template ContextType Registry
+ */
+ public ContributionContextTypeRegistry getAciTemplateContextTypeRegistry()
+ {
+ return aciTemplateContextTypeRegistry;
+ }
+
+
+ /**
+ * Gets the ACI Template Store
+ *
+ * @return
+ * the ACI Template Store
+ */
+ public ContributionTemplateStore getAciTemplateStore()
+ {
+ return aciTemplateStore;
+ }
+
}
Added: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/dialogs/DialogContentAssistant.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/dialogs/DialogContentAssistant.java?view=auto&rev=492646
==============================================================================
--- directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/dialogs/DialogContentAssistant.java (added)
+++ directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/dialogs/DialogContentAssistant.java Thu Jan 4 09:26:23 2007
@@ -0,0 +1,210 @@
+/*
+ * 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.ldapstudio.aciitemeditor.dialogs;
+
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.IHandler;
+import org.eclipse.jface.contentassist.ComboContentAssistSubjectAdapter;
+import org.eclipse.jface.contentassist.SubjectControlContentAssistant;
+import org.eclipse.jface.contentassist.TextContentAssistSubjectAdapter;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.FocusListener;
+import org.eclipse.swt.events.TraverseEvent;
+import org.eclipse.swt.events.TraverseListener;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.handlers.IHandlerActivation;
+import org.eclipse.ui.handlers.IHandlerService;
+import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
+
+
+/**
+ * This class implements the Content Assistant Dialog used in the ACI Item
+ * Source Editor for displaying proposals
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class DialogContentAssistant extends SubjectControlContentAssistant implements FocusListener
+{
+ private Control control;
+
+ private IHandlerActivation handlerActivation;
+
+ private boolean possibleCompletionsVisible;
+
+
+ /**
+ * Creates a new instance of DialogContentAssistant.
+ */
+ public DialogContentAssistant()
+ {
+ super();
+ this.possibleCompletionsVisible = false;
+ }
+
+
+ /**
+ * Installs content assist support on the given subject.
+ *
+ * @param text
+ * the one who requests content assist
+ */
+ public void install( Text text )
+ {
+ this.control = text;
+ this.control.addFocusListener( this );
+ super.install( new TextContentAssistSubjectAdapter( text ) );
+ }
+
+
+ /**
+ * Installs content assist support on the given subject.
+ *
+ * @param combo
+ * the one who requests content assist
+ */
+ public void install( Combo combo )
+ {
+ this.control = combo;
+ this.control.addFocusListener( this );
+ super.install( new ComboContentAssistSubjectAdapter( combo ) );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.contentassist.ContentAssistant#install(org.eclipse.jface.text.ITextViewer)
+ */
+ public void install( ITextViewer viewer )
+ {
+ this.control = viewer.getTextWidget();
+ this.control.addFocusListener( this );
+
+ // stop traversal (ESC) if popup is shown
+ this.control.addTraverseListener( new TraverseListener()
+ {
+ public void keyTraversed( TraverseEvent e )
+ {
+ if ( possibleCompletionsVisible )
+ {
+ e.doit = false;
+ }
+ }
+ } );
+
+ super.install( viewer );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.contentassist.ContentAssistant#uninstall()
+ */
+ public void uninstall()
+ {
+ if ( this.handlerActivation != null )
+ {
+ IHandlerService handlerService = ( IHandlerService ) PlatformUI.getWorkbench().getAdapter(
+ IHandlerService.class );
+ handlerService.deactivateHandler( this.handlerActivation );
+ this.handlerActivation = null;
+ }
+
+ if ( this.control != null )
+ {
+ this.control.removeFocusListener( this );
+ }
+
+ super.uninstall();
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.contentassist.ContentAssistant#restoreCompletionProposalPopupSize()
+ */
+ protected Point restoreCompletionProposalPopupSize()
+ {
+ possibleCompletionsVisible = true;
+ return super.restoreCompletionProposalPopupSize();
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.contentassist.ContentAssistant#showPossibleCompletions()
+ */
+ public String showPossibleCompletions()
+ {
+ possibleCompletionsVisible = true;
+ return super.showPossibleCompletions();
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.contentassist.ContentAssistant#possibleCompletionsClosed()
+ */
+ protected void possibleCompletionsClosed()
+ {
+ this.possibleCompletionsVisible = false;
+ super.possibleCompletionsClosed();
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.events.FocusListener#focusGained(org.eclipse.swt.events.FocusEvent)
+ */
+ public void focusGained( FocusEvent e )
+ {
+ IHandlerService handlerService = ( IHandlerService ) PlatformUI.getWorkbench().getAdapter(
+ IHandlerService.class );
+ if ( handlerService != null )
+ {
+ IHandler handler = new org.eclipse.core.commands.AbstractHandler()
+ {
+ public Object execute( ExecutionEvent event ) throws org.eclipse.core.commands.ExecutionException
+ {
+ showPossibleCompletions();
+ return null;
+ }
+ };
+ this.handlerActivation = handlerService.activateHandler(
+ ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS, handler );
+ }
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.events.FocusListener#focusLost(org.eclipse.swt.events.FocusEvent)
+ */
+ public void focusLost( FocusEvent e )
+ {
+ if ( this.handlerActivation != null )
+ {
+ IHandlerService handlerService = ( IHandlerService ) PlatformUI.getWorkbench().getAdapter(
+ IHandlerService.class );
+ handlerService.deactivateHandler( this.handlerActivation );
+ this.handlerActivation = null;
+ }
+ }
+}
Added: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/widgets/ACIContentAssistProcessor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/widgets/ACIContentAssistProcessor.java?view=auto&rev=492646
==============================================================================
--- directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/widgets/ACIContentAssistProcessor.java (added)
+++ directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/widgets/ACIContentAssistProcessor.java Thu Jan 4 09:26:23 2007
@@ -0,0 +1,151 @@
+/*
+ * 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.ldapstudio.aciitemeditor.widgets;
+
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.directory.ldapstudio.aciitemeditor.ACIITemConstants;
+import org.apache.directory.ldapstudio.aciitemeditor.Activator;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.jface.text.contentassist.IContextInformation;
+import org.eclipse.jface.text.contentassist.IContextInformationValidator;
+import org.eclipse.jface.text.templates.Template;
+import org.eclipse.jface.text.templates.TemplateCompletionProcessor;
+import org.eclipse.jface.text.templates.TemplateContextType;
+import org.eclipse.swt.graphics.Image;
+
+
+/**
+ * This class implements the Content Assist Processor for ACI Item
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ACIContentAssistProcessor extends TemplateCompletionProcessor
+{
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.templates.TemplateCompletionProcessor#computeCompletionProposals(org.eclipse.jface.text.ITextViewer, int)
+ */
+ public ICompletionProposal[] computeCompletionProposals( ITextViewer viewer, int offset )
+ {
+ List<ICompletionProposal> proposalList = new ArrayList<ICompletionProposal>();
+
+ // Add context dependend template proposals
+ ICompletionProposal[] templateProposals = super.computeCompletionProposals( viewer, offset );
+ if ( templateProposals != null )
+ {
+ proposalList.addAll( Arrays.asList( templateProposals ) );
+ }
+
+ return ( ICompletionProposal[] ) proposalList.toArray( new ICompletionProposal[0] );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.templates.TemplateCompletionProcessor#computeContextInformation(org.eclipse.jface.text.ITextViewer, int)
+ */
+ public IContextInformation[] computeContextInformation( ITextViewer viewer, int offset )
+ {
+ return null;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.templates.TemplateCompletionProcessor#getCompletionProposalAutoActivationCharacters()
+ */
+ public char[] getCompletionProposalAutoActivationCharacters()
+ {
+
+ char[] chars = new char[52];
+ for ( int i = 0; i < 26; i++ )
+ {
+ chars[i] = ( char ) ( 'a' + i );
+ }
+ for ( int i = 0; i < 26; i++ )
+ {
+ chars[i + 26] = ( char ) ( 'A' + i );
+ }
+
+ return chars;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.templates.TemplateCompletionProcessor#getContextInformationAutoActivationCharacters()
+ */
+ public char[] getContextInformationAutoActivationCharacters()
+ {
+ return null;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.templates.TemplateCompletionProcessor#getContextInformationValidator()
+ */
+ public IContextInformationValidator getContextInformationValidator()
+ {
+ return null;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.templates.TemplateCompletionProcessor#getErrorMessage()
+ */
+ public String getErrorMessage()
+ {
+ return null;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.templates.TemplateCompletionProcessor#getContextType(org.eclipse.jface.text.ITextViewer, org.eclipse.jface.text.IRegion)
+ */
+ @Override
+ protected TemplateContextType getContextType( ITextViewer viewer, IRegion region )
+ {
+ return Activator.getDefault().getAciTemplateContextTypeRegistry().getContextType(
+ ACIITemConstants.ACI_ITEM_TEMPLATE_ID );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.templates.TemplateCompletionProcessor#getImage(org.eclipse.jface.text.templates.Template)
+ */
+ @Override
+ protected Image getImage( Template template )
+ {
+ return null;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.templates.TemplateCompletionProcessor#getTemplates(java.lang.String)
+ */
+ @Override
+ protected Template[] getTemplates( String contextTypeId )
+ {
+ return Activator.getDefault().getAciTemplateStore().getTemplates( contextTypeId );
+ }
+}
Modified: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/widgets/ACIItemSourceEditorComposite.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/widgets/ACIItemSourceEditorComposite.java?view=diff&rev=492646&r1=492645&r2=492646
==============================================================================
--- directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/widgets/ACIItemSourceEditorComposite.java (original)
+++ directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/widgets/ACIItemSourceEditorComposite.java Thu Jan 4 09:26:23 2007
@@ -73,7 +73,6 @@
sourceEditor = new SourceViewer( this, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL );
// setup basic configuration
- // TODO: configuration with syntax highlighting, content assistent, ...
SourceViewerConfiguration configuration = new ACISourceViewerConfiguration();
sourceEditor.configure( configuration );
Modified: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/widgets/ACISourceViewerConfiguration.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/widgets/ACISourceViewerConfiguration.java?view=diff&rev=492646&r1=492645&r2=492646
==============================================================================
--- directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/widgets/ACISourceViewerConfiguration.java (original)
+++ directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/widgets/ACISourceViewerConfiguration.java Thu Jan 4 09:26:23 2007
@@ -19,8 +19,13 @@
*/
package org.apache.directory.ldapstudio.aciitemeditor.widgets;
+
import org.apache.directory.ldapstudio.aciitemeditor.Activator;
+import org.apache.directory.ldapstudio.aciitemeditor.dialogs.DialogContentAssistant;
import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.contentassist.ContentAssistant;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.text.contentassist.IContentAssistant;
import org.eclipse.jface.text.presentation.IPresentationReconciler;
import org.eclipse.jface.text.presentation.PresentationReconciler;
import org.eclipse.jface.text.rules.DefaultDamagerRepairer;
@@ -50,5 +55,25 @@
reconciler.setRepairer( dr, IDocument.DEFAULT_CONTENT_TYPE );
return reconciler;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getContentAssistant(org.eclipse.jface.text.source.ISourceViewer)
+ */
+ public IContentAssistant getContentAssistant( ISourceViewer sourceViewer )
+ {
+ // ContentAssistant assistant = new ContentAssistant();
+ ContentAssistant assistant = new DialogContentAssistant();
+ IContentAssistProcessor aciContentAssistProcessor = new ACIContentAssistProcessor();
+
+ assistant.setContentAssistProcessor( aciContentAssistProcessor, IDocument.DEFAULT_CONTENT_TYPE );
+ assistant.setDocumentPartitioning( "org.apache.directory.ldapstudio.aci" );
+ assistant.enableAutoActivation( true );
+ assistant.setAutoActivationDelay( 500 );
+ assistant.setProposalPopupOrientation( IContentAssistant.PROPOSAL_STACKED );
+ assistant.setContextInformationPopupOrientation( IContentAssistant.CONTEXT_INFO_ABOVE );
+
+ return assistant;
}
}
Added: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/templates/templates.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/templates/templates.xml?view=auto&rev=492646
==============================================================================
--- directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/templates/templates.xml (added)
+++ directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/templates/templates.xml Thu Jan 4 09:26:23 2007
@@ -0,0 +1,118 @@
+<?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.
+-->
+<!-- This file is used to store the code templates for the ACI Item syntax -->
+<templates>
+ <template
+ id="org.apache.directory.ldapstudio.aciitemeditor.templates.identificationTag"
+ name="identificationTag"
+ context="org.apache.directory.ldapstudio.aciitemeditor.templates"
+ enabled="true"
+ deleted="false">identificationTag "${cursor}",
+ </template>
+ <template
+ id="org.apache.directory.ldapstudio.aciitemeditor.templates.precedence"
+ name="precedence"
+ context="org.apache.directory.ldapstudio.aciitemeditor.templates"
+ enabled="true"
+ deleted="false">precedence ${cursor},
+ </template>
+ <template
+ id="org.apache.directory.ldapstudio.aciitemeditor.templates.authenticationLevel"
+ name="authenticationLevel"
+ context="org.apache.directory.ldapstudio.aciitemeditor.templates"
+ enabled="true"
+ deleted="false">authenticationLevel ${cursor},
+ </template>
+ <template
+ id="org.apache.directory.ldapstudio.aciitemeditor.templates.authenticationLevel"
+ name="authenticationLevel"
+ context="org.apache.directory.ldapstudio.aciitemeditor.templates"
+ enabled="true"
+ deleted="false">authenticationLevel ${cursor},
+ </template>
+ <template
+ id="org.apache.directory.ldapstudio.aciitemeditor.templates.itemOrUserFirst"
+ name="itemOrUserFirst"
+ description=""
+ context="org.apache.directory.ldapstudio.aciitemeditor.templates"
+ enabled="true"
+ deleted="false">itemOrUserFirst ${cursor}</template>
+ <template
+ id="org.apache.directory.ldapstudio.aciitemeditor.templates.itemFirst"
+ name="itemFirst"
+ description=""
+ context="org.apache.directory.ldapstudio.aciitemeditor.templates"
+ enabled="true"
+ deleted="false">itemFirst :
+{
+ ${cursor}
+}</template>
+ <template
+ id="org.apache.directory.ldapstudio.aciitemeditor.templates.userFirst"
+ name="userFirst"
+ description=""
+ context="org.apache.directory.ldapstudio.aciitemeditor.templates"
+ enabled="true"
+ deleted="false">userFirst :
+{
+ ${cursor}
+}</template>
+ <template
+ id="org.apache.directory.ldapstudio.aciitemeditor.templates.userClasses"
+ name="userClasses"
+ description=""
+ context="org.apache.directory.ldapstudio.aciitemeditor.templates"
+ enabled="true"
+ deleted="false">userClasses
+{
+ ${cursor}
+}</template>
+ <template
+ id="org.apache.directory.ldapstudio.aciitemeditor.templates.userPermissions"
+ name="userPermissions"
+ description=""
+ context="org.apache.directory.ldapstudio.aciitemeditor.templates"
+ enabled="true"
+ deleted="false">userPermissions
+{
+ ${cursor}
+}</template>
+ <template
+ id="org.apache.directory.ldapstudio.aciitemeditor.templates.protectedItems"
+ name="protectedItems"
+ description=""
+ context="org.apache.directory.ldapstudio.aciitemeditor.templates"
+ enabled="true"
+ deleted="false">protectedItems
+{
+ ${cursor}
+}</template>
+ <template
+ id="org.apache.directory.ldapstudio.aciitemeditor.templates.itemPermissions"
+ name="itemPermissions"
+ description=""
+ context="org.apache.directory.ldapstudio.aciitemeditor.templates"
+ enabled="true"
+ deleted="false">itemPermissions
+{
+ ${cursor}
+}</template>
+
+</templates>
\ No newline at end of file