Commit 97610923 authored by Romain Bioteau's avatar Romain Bioteau
Browse files

Merge remote-tracking branch 'origin/master' into dev

Conflicts:
	community/pom.xml
	subscription/pom.xml
parents ec633fdc 24f4ec89
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<configuration> <configuration>
<baseImgPath>${basedir}/splash_without_version.bmp</baseImgPath> <baseImgPath>${basedir}/splash_without_version.bmp</baseImgPath>
<outputImagePath>${basedir}/splash.bmp</outputImagePath> <outputImagePath>${basedir}/splash.bmp</outputImagePath>
<outputImageFormat>bmp</outputImageFormat> <outputImageFormat>png</outputImageFormat>
<xLocation>358</xLocation> <xLocation>358</xLocation>
<yLocation>159</yLocation> <yLocation>159</yLocation>
<italic>true</italic> <italic>true</italic>
......
...@@ -76,6 +76,6 @@ public class ContractConstraintEditor extends GroovyEditor { ...@@ -76,6 +76,6 @@ public class ContractConstraintEditor extends GroovyEditor {
} }
protected GroovyColorManager getColorManager() { protected GroovyColorManager getColorManager() {
return new GroovyColorManager(); return GroovyPlugin.getDefault().getTextTools().getColorManager();
} }
} }
...@@ -17,12 +17,14 @@ package org.bonitasoft.studio.contract.ui.property.constraint.edit.editor; ...@@ -17,12 +17,14 @@ package org.bonitasoft.studio.contract.ui.property.constraint.edit.editor;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.util.List; import java.util.List;
import org.bonitasoft.studio.common.ExpressionConstants;
import org.bonitasoft.studio.common.emf.tools.ModelHelper; import org.bonitasoft.studio.common.emf.tools.ModelHelper;
import org.bonitasoft.studio.common.log.BonitaStudioLog; import org.bonitasoft.studio.common.log.BonitaStudioLog;
import org.bonitasoft.studio.contract.ContractPlugin; import org.bonitasoft.studio.contract.ContractPlugin;
import org.bonitasoft.studio.contract.core.constraint.ConstraintInputIndexer; import org.bonitasoft.studio.contract.core.constraint.ConstraintInputIndexer;
import org.bonitasoft.studio.contract.i18n.Messages; import org.bonitasoft.studio.contract.i18n.Messages;
import org.bonitasoft.studio.contract.ui.property.constraint.edit.editor.contentassist.ContractInputCompletionProposalComputer; import org.bonitasoft.studio.contract.ui.property.constraint.edit.editor.contentassist.ContractInputCompletionProposalComputer;
import org.bonitasoft.studio.expression.editor.filter.AvailableExpressionTypeFilter;
import org.bonitasoft.studio.groovy.ui.viewer.GroovySourceViewerFactory; import org.bonitasoft.studio.groovy.ui.viewer.GroovySourceViewerFactory;
import org.bonitasoft.studio.groovy.ui.viewer.GroovyViewer; import org.bonitasoft.studio.groovy.ui.viewer.GroovyViewer;
import org.bonitasoft.studio.model.process.ContractConstraint; import org.bonitasoft.studio.model.process.ContractConstraint;
...@@ -41,6 +43,7 @@ import org.eclipse.jface.layout.GridLayoutFactory; ...@@ -41,6 +43,7 @@ import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.jface.text.DocumentEvent; import org.eclipse.jface.text.DocumentEvent;
import org.eclipse.jface.text.IDocumentListener; import org.eclipse.jface.text.IDocumentListener;
import org.eclipse.jface.text.source.SourceViewer; import org.eclipse.jface.text.source.SourceViewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jface.wizard.WizardPage; import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CLabel; import org.eclipse.swt.custom.CLabel;
...@@ -84,6 +87,7 @@ public class ContractConstraintExpressionWizardPage extends WizardPage implement ...@@ -84,6 +87,7 @@ public class ContractConstraintExpressionWizardPage extends WizardPage implement
@Override @Override
public void dispose() { public void dispose() {
if (groovyViewer != null) { if (groovyViewer != null) {
groovyViewer.enbaleSyntaxHighligthing();
groovyViewer.dispose(); groovyViewer.dispose();
} }
super.dispose(); super.dispose();
...@@ -107,13 +111,16 @@ public class ContractConstraintExpressionWizardPage extends WizardPage implement ...@@ -107,13 +111,16 @@ public class ContractConstraintExpressionWizardPage extends WizardPage implement
getSourceViewer().getTextWidget().setData(ContractInputCompletionProposalComputer.INPUTS, inputs); getSourceViewer().getTextWidget().setData(ContractInputCompletionProposalComputer.INPUTS, inputs);
getSourceViewer().getDocument().addDocumentListener(this); getSourceViewer().getDocument().addDocumentListener(this);
expressionContentObservable = EMFObservables.observeValue(constraint, ProcessPackage.Literals.CONTRACT_CONSTRAINT__EXPRESSION); expressionContentObservable = EMFObservables.observeValue(constraint,
ProcessPackage.Literals.CONTRACT_CONSTRAINT__EXPRESSION);
final IObservableList inputsObservable = EMFObservables.observeList(constraint, ProcessPackage.Literals.CONTRACT_CONSTRAINT__INPUT_NAMES); final IObservableList inputsObservable = EMFObservables.observeList(constraint,
ProcessPackage.Literals.CONTRACT_CONSTRAINT__INPUT_NAMES);
inputIndexer = new ConstraintInputIndexer(constraint, inputs, viewer.getGroovyCompilationUnit()); inputIndexer = new ConstraintInputIndexer(constraint, inputs, viewer.getGroovyCompilationUnit());
getSourceViewer().getDocument().set(expressionContentObservable.getValue().toString()); getSourceViewer().getDocument().set(expressionContentObservable.getValue().toString());
context.addValidationStatusProvider(new ConstraintExpressionEditorValidator(expressionContentObservable, inputsObservable, viewer context.addValidationStatusProvider(
.getGroovyCompilationUnit(), new CompilationProblemRequestor())); new ConstraintExpressionEditorValidator(expressionContentObservable, inputsObservable, viewer
.getGroovyCompilationUnit(), new CompilationProblemRequestor()));
final CLabel contentAssistHint = new CLabel(container, SWT.NONE); final CLabel contentAssistHint = new CLabel(container, SWT.NONE);
contentAssistHint.setLayoutData(GridDataFactory.fillDefaults().align(SWT.END, SWT.FILL).create()); contentAssistHint.setLayoutData(GridDataFactory.fillDefaults().align(SWT.END, SWT.FILL).create());
...@@ -127,11 +134,13 @@ public class ContractConstraintExpressionWizardPage extends WizardPage implement ...@@ -127,11 +134,13 @@ public class ContractConstraintExpressionWizardPage extends WizardPage implement
protected GroovyViewer createSourceViewer(final Composite container) { protected GroovyViewer createSourceViewer(final Composite container) {
groovyViewer = groovyViewerFactory.createSourceViewer(container, editorFactory.newInstance()); groovyViewer = groovyViewerFactory.createSourceViewer(container, editorFactory.newInstance());
groovyViewer.disableSyntaxHighligthing();
ContractContainer contractContainer = null; ContractContainer contractContainer = null;
if (!inputs.isEmpty()) { if (!inputs.isEmpty()) {
contractContainer = ModelHelper.getFirstContainerOfType(inputs.get(0), ContractContainer.class); contractContainer = ModelHelper.getFirstContainerOfType(inputs.get(0), ContractContainer.class);
} }
groovyViewer.setContext(null, contractContainer, null, null); groovyViewer.setContext(null, contractContainer,
new ViewerFilter[] { new AvailableExpressionTypeFilter(ExpressionConstants.CONTRACT_INPUT_TYPE) }, null);
return groovyViewer; return groovyViewer;
} }
...@@ -158,9 +167,11 @@ public class ContractConstraintExpressionWizardPage extends WizardPage implement ...@@ -158,9 +167,11 @@ public class ContractConstraintExpressionWizardPage extends WizardPage implement
} }
} }
public boolean performFinish(final ContractConstraint constraintToUpdate, final IPropertySourceProvider propertySourceProvider) { public boolean performFinish(final ContractConstraint constraintToUpdate,
final IPropertySourceProvider propertySourceProvider) {
final IPropertySource constraintPropertySource = propertySourceProvider.getPropertySource(constraintToUpdate); final IPropertySource constraintPropertySource = propertySourceProvider.getPropertySource(constraintToUpdate);
constraintPropertySource.setPropertyValue(ProcessPackage.Literals.CONTRACT_CONSTRAINT__EXPRESSION, constraint.getExpression()); constraintPropertySource.setPropertyValue(ProcessPackage.Literals.CONTRACT_CONSTRAINT__EXPRESSION,
constraint.getExpression());
if (inputIndexer != null) { if (inputIndexer != null) {
try { try {
inputIndexer.join(); inputIndexer.join();
...@@ -169,7 +180,8 @@ public class ContractConstraintExpressionWizardPage extends WizardPage implement ...@@ -169,7 +180,8 @@ public class ContractConstraintExpressionWizardPage extends WizardPage implement
return false; return false;
} }
} }
constraintPropertySource.setPropertyValue(ProcessPackage.Literals.CONTRACT_CONSTRAINT__INPUT_NAMES, constraint.getInputNames()); constraintPropertySource.setPropertyValue(ProcessPackage.Literals.CONTRACT_CONSTRAINT__INPUT_NAMES,
constraint.getInputNames());
return true; return true;
} }
......
...@@ -57,15 +57,6 @@ ...@@ -57,15 +57,6 @@
languageProviderClass="org.bonitasoft.studio.groovy.ui.providers.GroovyScriptLanguageProvider"> languageProviderClass="org.bonitasoft.studio.groovy.ui.providers.GroovyScriptLanguageProvider">
</scriptLanguage> </scriptLanguage>
</extension> </extension>
<extension
point="org.codehaus.groovy.eclipse.codeassist.completion.completionProposalFilter">
<proposalFilter
proposalFilter="org.bonitasoft.studio.groovy.ui.contentassist.BonitaProposalFilter">
<appliesTo
projectNature="org.bonitasoft.studio.common.repository.bonitaNature">
</appliesTo>
</proposalFilter>
</extension>
<extension <extension
point="org.bonitasoft.studio.configuration.synchronizer"> point="org.bonitasoft.studio.configuration.synchronizer">
<synchronier <synchronier
......
package org.bonitasoft.studio.groovy.ui.contentassist; package org.bonitasoft.studio.groovy.ui.contentassist;
import java.util.List;
import org.bonitasoft.studio.common.log.BonitaStudioLog;
import org.bonitasoft.studio.common.repository.RepositoryManager;
import org.bonitasoft.studio.groovy.ScriptVariable;
import org.codehaus.groovy.ast.ClassNode; import org.codehaus.groovy.ast.ClassNode;
import org.codehaus.groovy.ast.Variable;
import org.codehaus.jdt.groovy.model.GroovyCompilationUnit; import org.codehaus.jdt.groovy.model.GroovyCompilationUnit;
import org.eclipse.jdt.groovy.search.AbstractSimplifiedTypeLookup; import org.eclipse.jdt.groovy.search.AbstractSimplifiedTypeLookup;
import org.eclipse.jdt.groovy.search.VariableScope; import org.eclipse.jdt.groovy.search.VariableScope;
public class BonitaConstantsTypeLookup extends AbstractSimplifiedTypeLookup { public class BonitaConstantsTypeLookup extends AbstractSimplifiedTypeLookup {
public static List<ScriptVariable> bonitaVariables;
@Override @Override
protected TypeAndDeclaration lookupTypeAndDeclaration(final ClassNode declaringType, final String name, final VariableScope scope) { protected TypeAndDeclaration lookupTypeAndDeclaration(final ClassNode declaringType, final String name,
final org.codehaus.groovy.ast.VariableScope variableScope = scope.getEnclosingModuleNode().getStatementBlock().getVariableScope(); final VariableScope scope) {
final Variable variable = variableScope.getDeclaredVariable(name); return bonitaVariables == null ? null : bonitaVariables.stream()
if (variable != null) { .filter(v -> v.getName().equals(name))
return new TypeAndDeclaration(variable.getType(), variable.getOriginType()); .findFirst()
} .map(v -> {
return null; ClassLoader cl = RepositoryManager.getInstance().getCurrentRepository().createProjectClassloader(null);
try {
ClassNode type = new ClassNode(cl.loadClass(v.getType()));
return new TypeAndDeclaration(type, null);
} catch (ClassNotFoundException e) {
BonitaStudioLog.error(e);
}
return null;
})
.orElse(null);
} }
@Override @Override
public void initialize(final GroovyCompilationUnit unit, final VariableScope topScope) { public void initialize(final GroovyCompilationUnit unit, final VariableScope topScope) {
} }
public static void setBonitaVariables(List<ScriptVariable> nodes) {
bonitaVariables = nodes;
}
} }
/**
* Copyright (C) 2010 BonitaSoft S.A.
* BonitaSoft, 31 rue Gustave Eiffel - 38000 Grenoble
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2.0 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.bonitasoft.studio.groovy.ui.contentassist;
import java.util.ArrayList;
import java.util.List;
import org.codehaus.groovy.eclipse.codeassist.processors.IProposalFilter;
import org.codehaus.groovy.eclipse.codeassist.proposals.GroovyMethodProposal;
import org.codehaus.groovy.eclipse.codeassist.proposals.IGroovyProposal;
import org.codehaus.groovy.eclipse.codeassist.requestor.ContentAssistContext;
import org.eclipse.jdt.ui.text.java.JavaContentAssistInvocationContext;
/**
* @author Romain Bioteau
*/
public class BonitaProposalFilter implements IProposalFilter {
/*
* (non-Javadoc)
* @see org.codehaus.groovy.eclipse.codeassist.processors.IProposalFilter#filterProposals(java.util.List,
* org.codehaus.groovy.eclipse.codeassist.requestor.ContentAssistContext, org.eclipse.jdt.ui.text.java.JavaContentAssistInvocationContext)
*/
@Override
public List<IGroovyProposal> filterProposals(final List<IGroovyProposal> proposals,
final ContentAssistContext assist, final JavaContentAssistInvocationContext context) {
final List<IGroovyProposal> filteredProposals = new ArrayList<IGroovyProposal>();
for (final IGroovyProposal p : proposals) {
if (p instanceof GroovyMethodProposal) {
if (!(((GroovyMethodProposal) p).getMethod().getDeclaringClass().getName().equals("org.codehaus.groovy.runtime.DefaultGroovyMethods")
|| ((GroovyMethodProposal) p).getMethod().getDeclaringClass().getName()
.equals("org.codehaus.groovy.runtime.DefaultGroovyStaticMethods"))) {
filteredProposals.add(p);
}
} else {
filteredProposals.add(p);
}
}
return filteredProposals;
}
}
...@@ -38,6 +38,7 @@ import org.bonitasoft.studio.expression.editor.viewer.SelectDependencyDialog; ...@@ -38,6 +38,7 @@ import org.bonitasoft.studio.expression.editor.viewer.SelectDependencyDialog;
import org.bonitasoft.studio.groovy.GroovyPlugin; import org.bonitasoft.studio.groovy.GroovyPlugin;
import org.bonitasoft.studio.groovy.ScriptVariable; import org.bonitasoft.studio.groovy.ScriptVariable;
import org.bonitasoft.studio.groovy.ui.Messages; import org.bonitasoft.studio.groovy.ui.Messages;
import org.bonitasoft.studio.groovy.ui.contentassist.BonitaConstantsTypeLookup;
import org.bonitasoft.studio.groovy.ui.dialog.BonitaVariableLabelProvider; import org.bonitasoft.studio.groovy.ui.dialog.BonitaVariableLabelProvider;
import org.bonitasoft.studio.groovy.ui.dialog.GroovyEditorDocumentationDialogTray; import org.bonitasoft.studio.groovy.ui.dialog.GroovyEditorDocumentationDialogTray;
import org.bonitasoft.studio.groovy.ui.dialog.TestGroovyScriptDialog; import org.bonitasoft.studio.groovy.ui.dialog.TestGroovyScriptDialog;
...@@ -98,7 +99,8 @@ import com.google.common.collect.Lists; ...@@ -98,7 +99,8 @@ import com.google.common.collect.Lists;
/** /**
* @author Romain Bioteau * @author Romain Bioteau
*/ */
public class GroovyScriptExpressionEditor extends SelectionAwareExpressionEditor implements IExpressionEditor, IBonitaVariableContext { public class GroovyScriptExpressionEditor extends SelectionAwareExpressionEditor
implements IExpressionEditor, IBonitaVariableContext {
protected Composite mainComposite; protected Composite mainComposite;
...@@ -225,7 +227,7 @@ public class GroovyScriptExpressionEditor extends SelectionAwareExpressionEditor ...@@ -225,7 +227,7 @@ public class GroovyScriptExpressionEditor extends SelectionAwareExpressionEditor
mainComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(SWT.DEFAULT, 300).create()); mainComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(SWT.DEFAULT, 300).create());
mainComposite.setLayout(new FillLayout(SWT.VERTICAL)); mainComposite.setLayout(new FillLayout(SWT.VERTICAL));
createGroovyEditor(parent,true); createGroovyEditor(parent, true);
createDependencyViewer(parent); createDependencyViewer(parent);
return mainComposite; return mainComposite;
...@@ -395,8 +397,8 @@ public class GroovyScriptExpressionEditor extends SelectionAwareExpressionEditor ...@@ -395,8 +397,8 @@ public class GroovyScriptExpressionEditor extends SelectionAwareExpressionEditor
depndencySection.setClient(dependenciesComposite); depndencySection.setClient(dependenciesComposite);
} }
protected void createGroovyEditor(final Composite parent,boolean restrictSciptSize) { protected void createGroovyEditor(final Composite parent, boolean restrictSciptSize) {
groovyViewer = new GroovyViewer(mainComposite, isPageFlowContext,restrictSciptSize); groovyViewer = new GroovyViewer(mainComposite, isPageFlowContext, restrictSciptSize);
groovyViewer.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(SWT.DEFAULT, 300).create()); groovyViewer.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(SWT.DEFAULT, 300).create());
sourceViewer = groovyViewer.getSourceViewer(); sourceViewer = groovyViewer.getSourceViewer();
document = groovyViewer.getDocument(); document = groovyViewer.getDocument();
...@@ -413,10 +415,12 @@ public class GroovyScriptExpressionEditor extends SelectionAwareExpressionEditor ...@@ -413,10 +415,12 @@ public class GroovyScriptExpressionEditor extends SelectionAwareExpressionEditor
@Override @Override
public void widgetSelected(final SelectionEvent e) { public void widgetSelected(final SelectionEvent e) {
final Map<String, Serializable> variables = TestGroovyScriptUtil.createVariablesMap( final Map<String, Serializable> variables = TestGroovyScriptUtil.createVariablesMap(
groovyViewer.getGroovyCompilationUnit(), nodes == null ? Lists.<ScriptVariable> newArrayList() : nodes); groovyViewer.getGroovyCompilationUnit(),
nodes == null ? Lists.<ScriptVariable> newArrayList() : nodes);
if (variables.isEmpty()) { if (variables.isEmpty()) {
final ManageConnectorJarDialog mcjd = new ManageConnectorJarDialog(Display.getDefault().getActiveShell()); final ManageConnectorJarDialog mcjd = new ManageConnectorJarDialog(
Display.getDefault().getActiveShell());
final int retCode = mcjd.open(); final int retCode = mcjd.open();
if (retCode == Window.OK) { if (retCode == Window.OK) {
try { try {
...@@ -448,7 +452,8 @@ public class GroovyScriptExpressionEditor extends SelectionAwareExpressionEditor ...@@ -448,7 +452,8 @@ public class GroovyScriptExpressionEditor extends SelectionAwareExpressionEditor
} }
@Override @Override
public void bindExpression(final EMFDataBindingContext dataBindingContext, final EObject context, final Expression inputExpression, public void bindExpression(final EMFDataBindingContext dataBindingContext, final EObject context,
final Expression inputExpression,
final ViewerFilter[] filters, final ExpressionViewer viewer) { final ViewerFilter[] filters, final ExpressionViewer viewer) {
this.inputExpression = inputExpression; this.inputExpression = inputExpression;
this.context = context; this.context = context;
...@@ -511,6 +516,7 @@ public class GroovyScriptExpressionEditor extends SelectionAwareExpressionEditor ...@@ -511,6 +516,7 @@ public class GroovyScriptExpressionEditor extends SelectionAwareExpressionEditor
dependencyJob.setContext(context); dependencyJob.setContext(context);
nodes.addAll(groovyViewer.getProvidedVariables(context, filters)); nodes.addAll(groovyViewer.getProvidedVariables(context, filters));
dependencyJob.setNodes(nodes); dependencyJob.setNodes(nodes);
BonitaConstantsTypeLookup.setBonitaVariables(nodes);
final InputLengthValidator lenghtValidator = new InputLengthValidator("", GroovyViewer.MAX_SCRIPT_LENGTH); final InputLengthValidator lenghtValidator = new InputLengthValidator("", GroovyViewer.MAX_SCRIPT_LENGTH);
String content = inputExpression.getContent(); String content = inputExpression.getContent();
...@@ -526,7 +532,7 @@ public class GroovyScriptExpressionEditor extends SelectionAwareExpressionEditor ...@@ -526,7 +532,7 @@ public class GroovyScriptExpressionEditor extends SelectionAwareExpressionEditor
if (lenghtValidator.validate(text).isOK()) { if (lenghtValidator.validate(text).isOK()) {
GroovyScriptExpressionEditor.this.inputExpression.setContent(text); GroovyScriptExpressionEditor.this.inputExpression.setContent(text);
} }
if (automaticResolutionButton.getSelection()) { if (!automaticResolutionButton.isDisposed() && automaticResolutionButton.getSelection()) {
dependencyJob.schedule(); dependencyJob.schedule();
} }
......
...@@ -24,11 +24,9 @@ import org.codehaus.groovy.eclipse.editor.GroovyColorManager; ...@@ -24,11 +24,9 @@ import org.codehaus.groovy.eclipse.editor.GroovyColorManager;
import org.codehaus.groovy.eclipse.editor.GroovyConfiguration; import org.codehaus.groovy.eclipse.editor.GroovyConfiguration;
import org.codehaus.groovy.eclipse.editor.GroovyPartitionScanner; import org.codehaus.groovy.eclipse.editor.GroovyPartitionScanner;
import org.eclipse.jdt.groovy.core.util.ReflectionUtils; import org.eclipse.jdt.groovy.core.util.ReflectionUtils;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.internal.ui.text.java.CompletionProposalCategory; import org.eclipse.jdt.internal.ui.text.java.CompletionProposalCategory;
import org.eclipse.jdt.internal.ui.text.java.ContentAssistProcessor; import org.eclipse.jdt.internal.ui.text.java.ContentAssistProcessor;
import org.eclipse.jdt.ui.text.IJavaPartitions; import org.eclipse.jdt.ui.text.IJavaPartitions;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.contentassist.ContentAssistant; import org.eclipse.jface.text.contentassist.ContentAssistant;
...@@ -94,12 +92,4 @@ public class BonitaGroovyConfiguration extends GroovyConfiguration { ...@@ -94,12 +92,4 @@ public class BonitaGroovyConfiguration extends GroovyConfiguration {
return assistant; return assistant;
} }
private IDialogSettings getSettings(final String sectionName) {
IDialogSettings settings = JavaPlugin.getDefault().getDialogSettings().getSection(sectionName);
if (settings == null) {
settings = JavaPlugin.getDefault().getDialogSettings().addNewSection(sectionName);
}
return settings;
}
} }
...@@ -15,12 +15,12 @@ ...@@ -15,12 +15,12 @@
package org.bonitasoft.studio.groovy.ui.viewer; package org.bonitasoft.studio.groovy.ui.viewer;
import org.codehaus.groovy.eclipse.editor.GroovyColorManager; import org.codehaus.groovy.eclipse.GroovyPlugin;
import org.codehaus.groovy.eclipse.editor.GroovyEditor; import org.codehaus.groovy.eclipse.editor.GroovyEditor;
import org.codehaus.groovy.eclipse.editor.GroovyTextTools;
import org.eclipse.jdt.ui.actions.IJavaEditorActionDefinitionIds; import org.eclipse.jdt.ui.actions.IJavaEditorActionDefinitionIds;
import org.eclipse.jdt.ui.text.JavaSourceViewerConfiguration; import org.eclipse.jdt.ui.text.JavaSourceViewerConfiguration;
import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.ui.texteditor.ITextEditorActionConstants; import org.eclipse.ui.texteditor.ITextEditorActionConstants;
/** /**
...@@ -28,10 +28,6 @@ import org.eclipse.ui.texteditor.ITextEditorActionConstants; ...@@ -28,10 +28,6 @@ import org.eclipse.ui.texteditor.ITextEditorActionConstants;
*/ */
public class BonitaGroovyEditor extends GroovyEditor { public class BonitaGroovyEditor extends GroovyEditor {
public BonitaGroovyEditor(final IPreferenceStore store) {
setPreferenceStore(store);
}
@Override @Override
public void editorContextMenuAboutToShow(final IMenuManager menu) { public void editorContextMenuAboutToShow(final IMenuManager menu) {
menu.dispose(); menu.dispose();
...@@ -84,7 +80,8 @@ public class BonitaGroovyEditor extends GroovyEditor { ...@@ -84,7 +80,8 @@ public class BonitaGroovyEditor extends GroovyEditor {
@Override @Override
public JavaSourceViewerConfiguration createJavaSourceViewerConfiguration() { public JavaSourceViewerConfiguration createJavaSourceViewerConfiguration() {
return new BonitaGroovyConfiguration(new GroovyColorManager(), getPreferenceStore(), this); GroovyTextTools textTools = GroovyPlugin.getDefault().getTextTools();
return new BonitaGroovyConfiguration(textTools.getColorManager(), getPreferenceStore(), this);
} }
} }
...@@ -144,7 +144,8 @@ public class DummyEditorSite implements IEditorSite { ...@@ -144,7 +144,8 @@ public class DummyEditorSite implements IEditorSite {
*/ */
@Override @Override
public IWorkbenchPage getPage() { public IWorkbenchPage getPage() {
return PlatformUI.getWorkbench().getActiveWorkbenchWindow() != null ? PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() : null; return PlatformUI.getWorkbench().getActiveWorkbenchWindow() != null
? PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() : null;
} }
/* /*
......
...@@ -47,22 +47,19 @@ import org.bonitasoft.studio.model.configuration.Configuration; ...@@ -47,22 +47,19 @@ import org.bonitasoft.studio.model.configuration.Configuration;
import org.bonitasoft.studio.model.expression.Expression; import org.bonitasoft.studio.model.expression.Expression;