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 @@
<configuration>
<baseImgPath>${basedir}/splash_without_version.bmp</baseImgPath>
<outputImagePath>${basedir}/splash.bmp</outputImagePath>
<outputImageFormat>bmp</outputImageFormat>
<outputImageFormat>png</outputImageFormat>
<xLocation>358</xLocation>
<yLocation>159</yLocation>
<italic>true</italic>
......
......@@ -76,6 +76,6 @@ public class ContractConstraintEditor extends GroovyEditor {
}
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;
import java.net.MalformedURLException;
import java.util.List;
import org.bonitasoft.studio.common.ExpressionConstants;
import org.bonitasoft.studio.common.emf.tools.ModelHelper;
import org.bonitasoft.studio.common.log.BonitaStudioLog;
import org.bonitasoft.studio.contract.ContractPlugin;
import org.bonitasoft.studio.contract.core.constraint.ConstraintInputIndexer;
import org.bonitasoft.studio.contract.i18n.Messages;
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.GroovyViewer;
import org.bonitasoft.studio.model.process.ContractConstraint;
......@@ -41,6 +43,7 @@ import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.jface.text.DocumentEvent;
import org.eclipse.jface.text.IDocumentListener;
import org.eclipse.jface.text.source.SourceViewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CLabel;
......@@ -84,6 +87,7 @@ public class ContractConstraintExpressionWizardPage extends WizardPage implement
@Override
public void dispose() {
if (groovyViewer != null) {
groovyViewer.enbaleSyntaxHighligthing();
groovyViewer.dispose();
}
super.dispose();
......@@ -107,12 +111,15 @@ public class ContractConstraintExpressionWizardPage extends WizardPage implement
getSourceViewer().getTextWidget().setData(ContractInputCompletionProposalComputer.INPUTS, inputs);
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());
getSourceViewer().getDocument().set(expressionContentObservable.getValue().toString());
context.addValidationStatusProvider(new ConstraintExpressionEditorValidator(expressionContentObservable, inputsObservable, viewer
context.addValidationStatusProvider(
new ConstraintExpressionEditorValidator(expressionContentObservable, inputsObservable, viewer
.getGroovyCompilationUnit(), new CompilationProblemRequestor()));
final CLabel contentAssistHint = new CLabel(container, SWT.NONE);
......@@ -127,11 +134,13 @@ public class ContractConstraintExpressionWizardPage extends WizardPage implement
protected GroovyViewer createSourceViewer(final Composite container) {
groovyViewer = groovyViewerFactory.createSourceViewer(container, editorFactory.newInstance());
groovyViewer.disableSyntaxHighligthing();
ContractContainer contractContainer = null;
if (!inputs.isEmpty()) {
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;
}
......@@ -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);
constraintPropertySource.setPropertyValue(ProcessPackage.Literals.CONTRACT_CONSTRAINT__EXPRESSION, constraint.getExpression());
constraintPropertySource.setPropertyValue(ProcessPackage.Literals.CONTRACT_CONSTRAINT__EXPRESSION,
constraint.getExpression());
if (inputIndexer != null) {
try {
inputIndexer.join();
......@@ -169,7 +180,8 @@ public class ContractConstraintExpressionWizardPage extends WizardPage implement
return false;
}
}
constraintPropertySource.setPropertyValue(ProcessPackage.Literals.CONTRACT_CONSTRAINT__INPUT_NAMES, constraint.getInputNames());
constraintPropertySource.setPropertyValue(ProcessPackage.Literals.CONTRACT_CONSTRAINT__INPUT_NAMES,
constraint.getInputNames());
return true;
}
......
......@@ -57,15 +57,6 @@
languageProviderClass="org.bonitasoft.studio.groovy.ui.providers.GroovyScriptLanguageProvider">
</scriptLanguage>
</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
point="org.bonitasoft.studio.configuration.synchronizer">
<synchronier
......
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.Variable;
import org.codehaus.jdt.groovy.model.GroovyCompilationUnit;
import org.eclipse.jdt.groovy.search.AbstractSimplifiedTypeLookup;
import org.eclipse.jdt.groovy.search.VariableScope;
public class BonitaConstantsTypeLookup extends AbstractSimplifiedTypeLookup {
public static List<ScriptVariable> bonitaVariables;
@Override
protected TypeAndDeclaration lookupTypeAndDeclaration(final ClassNode declaringType, final String name, final VariableScope scope) {
final org.codehaus.groovy.ast.VariableScope variableScope = scope.getEnclosingModuleNode().getStatementBlock().getVariableScope();
final Variable variable = variableScope.getDeclaredVariable(name);
if (variable != null) {
return new TypeAndDeclaration(variable.getType(), variable.getOriginType());
protected TypeAndDeclaration lookupTypeAndDeclaration(final ClassNode declaringType, final String name,
final VariableScope scope) {
return bonitaVariables == null ? null : bonitaVariables.stream()
.filter(v -> v.getName().equals(name))
.findFirst()
.map(v -> {
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
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;
import org.bonitasoft.studio.groovy.GroovyPlugin;
import org.bonitasoft.studio.groovy.ScriptVariable;
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.GroovyEditorDocumentationDialogTray;
import org.bonitasoft.studio.groovy.ui.dialog.TestGroovyScriptDialog;
......@@ -98,7 +99,8 @@ import com.google.common.collect.Lists;
/**
* @author Romain Bioteau
*/
public class GroovyScriptExpressionEditor extends SelectionAwareExpressionEditor implements IExpressionEditor, IBonitaVariableContext {
public class GroovyScriptExpressionEditor extends SelectionAwareExpressionEditor
implements IExpressionEditor, IBonitaVariableContext {
protected Composite mainComposite;
......@@ -225,7 +227,7 @@ public class GroovyScriptExpressionEditor extends SelectionAwareExpressionEditor
mainComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(SWT.DEFAULT, 300).create());
mainComposite.setLayout(new FillLayout(SWT.VERTICAL));
createGroovyEditor(parent,true);
createGroovyEditor(parent, true);
createDependencyViewer(parent);
return mainComposite;
......@@ -395,8 +397,8 @@ public class GroovyScriptExpressionEditor extends SelectionAwareExpressionEditor
depndencySection.setClient(dependenciesComposite);
}
protected void createGroovyEditor(final Composite parent,boolean restrictSciptSize) {
groovyViewer = new GroovyViewer(mainComposite, isPageFlowContext,restrictSciptSize);
protected void createGroovyEditor(final Composite parent, boolean restrictSciptSize) {
groovyViewer = new GroovyViewer(mainComposite, isPageFlowContext, restrictSciptSize);
groovyViewer.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(SWT.DEFAULT, 300).create());
sourceViewer = groovyViewer.getSourceViewer();
document = groovyViewer.getDocument();
......@@ -413,10 +415,12 @@ public class GroovyScriptExpressionEditor extends SelectionAwareExpressionEditor
@Override
public void widgetSelected(final SelectionEvent e) {
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()) {
final ManageConnectorJarDialog mcjd = new ManageConnectorJarDialog(Display.getDefault().getActiveShell());
final ManageConnectorJarDialog mcjd = new ManageConnectorJarDialog(
Display.getDefault().getActiveShell());
final int retCode = mcjd.open();
if (retCode == Window.OK) {
try {
......@@ -448,7 +452,8 @@ public class GroovyScriptExpressionEditor extends SelectionAwareExpressionEditor
}
@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) {
this.inputExpression = inputExpression;
this.context = context;
......@@ -511,6 +516,7 @@ public class GroovyScriptExpressionEditor extends SelectionAwareExpressionEditor
dependencyJob.setContext(context);
nodes.addAll(groovyViewer.getProvidedVariables(context, filters));
dependencyJob.setNodes(nodes);
BonitaConstantsTypeLookup.setBonitaVariables(nodes);
final InputLengthValidator lenghtValidator = new InputLengthValidator("", GroovyViewer.MAX_SCRIPT_LENGTH);
String content = inputExpression.getContent();
......@@ -526,7 +532,7 @@ public class GroovyScriptExpressionEditor extends SelectionAwareExpressionEditor
if (lenghtValidator.validate(text).isOK()) {
GroovyScriptExpressionEditor.this.inputExpression.setContent(text);
}
if (automaticResolutionButton.getSelection()) {
if (!automaticResolutionButton.isDisposed() && automaticResolutionButton.getSelection()) {
dependencyJob.schedule();
}
......
......@@ -24,11 +24,9 @@ import org.codehaus.groovy.eclipse.editor.GroovyColorManager;
import org.codehaus.groovy.eclipse.editor.GroovyConfiguration;
import org.codehaus.groovy.eclipse.editor.GroovyPartitionScanner;
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.ContentAssistProcessor;
import org.eclipse.jdt.ui.text.IJavaPartitions;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.contentassist.ContentAssistant;
......@@ -94,12 +92,4 @@ public class BonitaGroovyConfiguration extends GroovyConfiguration {
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 @@
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.GroovyTextTools;
import org.eclipse.jdt.ui.actions.IJavaEditorActionDefinitionIds;
import org.eclipse.jdt.ui.text.JavaSourceViewerConfiguration;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.ui.texteditor.ITextEditorActionConstants;
/**
......@@ -28,10 +28,6 @@ import org.eclipse.ui.texteditor.ITextEditorActionConstants;
*/
public class BonitaGroovyEditor extends GroovyEditor {
public BonitaGroovyEditor(final IPreferenceStore store) {
setPreferenceStore(store);
}
@Override
public void editorContextMenuAboutToShow(final IMenuManager menu) {
menu.dispose();
......@@ -84,7 +80,8 @@ public class BonitaGroovyEditor extends GroovyEditor {
@Override
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 {
*/
@Override
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;
import org.bonitasoft.studio.model.expression.Expression;
import org.bonitasoft.studio.model.parameter.Parameter;
import org.bonitasoft.studio.model.process.AbstractProcess;
import org.codehaus.groovy.eclipse.GroovyPlugin;
import org.codehaus.groovy.eclipse.core.preferences.PreferenceConstants;
import org.codehaus.groovy.eclipse.editor.GroovyEditor;
import org.codehaus.jdt.groovy.model.GroovyCompilationUnit;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.internal.ui.javaeditor.ASTProvider;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.text.DocumentEvent;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IDocumentListener;
import org.eclipse.jface.text.ITextListener;
import org.eclipse.jface.text.TextEvent;
import org.eclipse.jface.text.source.CompositeRuler;
import org.eclipse.jface.text.source.IVerticalRulerInfo;
import org.eclipse.jface.text.source.SourceViewer;
......@@ -76,6 +73,7 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.ISources;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.internal.Workbench;
import org.eclipse.ui.part.FileEditorInput;
......@@ -102,8 +100,6 @@ public class GroovyViewer implements IDocumentListener {
private List<ScriptVariable> nodes;
private GroovyFileStore tmpGroovyFileStore;
private Set<String> knowVariables;
private boolean isPageFlowContext;
......@@ -133,13 +129,15 @@ public class GroovyViewer implements IDocumentListener {
public GroovyViewer(final Composite mainComposite, final IEditorInput input, final GroovyEditor groovyEditor,
boolean restrictScriptSize) {
this.restrictScriptSize = restrictScriptSize;
final IPreferenceStore groovyStore = org.codehaus.groovy.eclipse.GroovyPlugin.getDefault().getPreferenceStore();
groovyStore.setDefault(PreferenceConstants.GROOVY_SEMANTIC_HIGHLIGHTING, false);
groovyStore.setValue(PreferenceConstants.GROOVY_SEMANTIC_HIGHLIGHTING, false);
enbaleSyntaxHighligthing();
if (input == null) {
final ProvidedGroovyRepositoryStore store = RepositoryManager.getInstance()
.getRepositoryStore(ProvidedGroovyRepositoryStore.class);
tmpGroovyFileStore = store.createRepositoryFileStore("script" + System.currentTimeMillis() + ".groovy");
GroovyFileStore tmpGroovyFileStore = store.getChild(GroovyFileStore.EXPRESSION_SCRIPT_NAME);
if (tmpGroovyFileStore != null) {
tmpGroovyFileStore.delete();
}
tmpGroovyFileStore = store.createRepositoryFileStore(GroovyFileStore.EXPRESSION_SCRIPT_NAME);
tmpGroovyFileStore.save("");
this.input = new FileEditorInput(tmpGroovyFileStore.getResource());
} else {
......@@ -147,16 +145,19 @@ public class GroovyViewer implements IDocumentListener {
}
editor = groovyEditor;
if (editor == null) {
editor = new BonitaGroovyEditor(GroovyPlugin.getDefault().getPreferenceStore());
editor = new BonitaGroovyEditor();
}
try {
editor.getDocumentProvider().connect(input);
groovyEditorContext = createGroovyEditorContext();
final DummyEditorSite site = new DummyEditorSite(mainComposite.getShell(), editor);
groovyEditorContext.set(ISources.ACTIVE_SITE_NAME, site);
editor.init(site, this.input);
editor.doSave(Repository.NULL_PROGRESS_MONITOR);
ASTProvider astProvider = JavaPlugin.getDefault().getASTProvider();
org.eclipse.jdt.groovy.core.util.ReflectionUtils.executePrivateMethod(ASTProvider.class,
"activeJavaEditorChanged", new Class[] { IWorkbenchPart.class }, astProvider, new Object[] { editor });
editor.createPartControl(mainComposite);
} catch (final Exception e1) {
BonitaStudioLog.error(e1);
}
......@@ -166,25 +167,6 @@ public class GroovyViewer implements IDocumentListener {
styledText.setTextLimit(MAX_SCRIPT_LENGTH);
}
getSourceViewer().addTextListener(new ITextListener() {
private boolean isReconciling;
@Override
public void textChanged(final TextEvent event) {
if (!isReconciling) {
isReconciling = true;
try {
JavaModelUtil.reconcile(editor.getGroovyCompilationUnit());
} catch (final JavaModelException e) {
} finally {
isReconciling = false;
}
}
}
});
styledText.setData(BONITA_KEYWORDS_DATA_KEY, getProvidedVariables(null, null));
styledText.addFocusListener(new FocusListener() {
......@@ -320,8 +302,11 @@ public class GroovyViewer implements IDocumentListener {
}
public void dispose() {
if (tmpGroovyFileStore != null) {
tmpGroovyFileStore.delete();
final ProvidedGroovyRepositoryStore store = RepositoryManager.getInstance()
.getRepositoryStore(ProvidedGroovyRepositoryStore.class);
GroovyFileStore fStore = store.getChild(GroovyFileStore.EXPRESSION_SCRIPT_NAME);
if (fStore != null) {
fStore.delete();
}
final IColumnSupport columSupport = (IColumnSupport) editor.getAdapter(IColumnSupport.class);
if (columSupport != null) {
......@@ -370,4 +355,16 @@ public class GroovyViewer implements IDocumentListener {
}
public void disableSyntaxHighligthing() {
final IPreferenceStore groovyStore = org.codehaus.groovy.eclipse.GroovyPlugin.getDefault().getPreferenceStore();
groovyStore.setDefault(PreferenceConstants.GROOVY_SEMANTIC_HIGHLIGHTING, false);
groovyStore.setValue(PreferenceConstants.GROOVY_SEMANTIC_HIGHLIGHTING, false);
}
public void enbaleSyntaxHighligthing() {
final IPreferenceStore groovyStore = org.codehaus.groovy.eclipse.GroovyPlugin.getDefault().getPreferenceStore();
groovyStore.setDefault(PreferenceConstants.GROOVY_SEMANTIC_HIGHLIGHTING, true);
groovyStore.setValue(PreferenceConstants.GROOVY_SEMANTIC_HIGHLIGHTING, true);
}
}
......@@ -94,8 +94,10 @@ public class GroovyScriptBarResourceProvider implements BARResourcesProvider {
final ProvidedGroovyRepositoryStore providedStore = repositoryAccessor
.getRepositoryStore(ProvidedGroovyRepositoryStore.class);
for (final GroovyFileStore file : providedStore.getChildren()) {
if (!file.getName().startsWith(GroovyFileStore.EXPRESSION_SCRIPT_NAME)) {
compilationUnits.add(file.getCompilationUnit());
}
}
addGroovyCompilationUnitToClasspath(builder, compilationUnits,
ProvidedGroovyRepositoryStore.EXPORTED_PROVIDED_JAR_NAME);
}
......
......@@ -44,6 +44,7 @@ import org.eclipse.ui.IWorkbenchPart;
public class GroovyFileStore extends AbstractFileStore {
private static final String UTF_8 = "UTF-8";
public static final String EXPRESSION_SCRIPT_NAME = "groovyExpressionScript.groovy";
public GroovyFileStore(final String fileName, final IRepositoryStore<?> parentStore) {
super(fileName, parentStore);
......