Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bonita
bonita-studio
Commits
18665d30
Commit
18665d30
authored
Nov 10, 2014
by
Bonita CI
Browse files
Merge branch 'BS-9319_DevCollabImprSVN' into 'master'
parents
2065f91e
40985458
Changes
62
Expand all
Hide whitespace changes
Inline
Side-by-side
bundles/plugins/org.bonitasoft.studio-models/GMFTemplates/aspects/xpt/editor/Editor.xpt
View file @
18665d30
...
...
@@ -201,6 +201,8 @@ protected void configureGraphicalViewer() {
«REM»default size for palette«ENDREM»
«EXPAND defaultPaletteSize»
«EXPAND setReadOnly»
/**
* @generated BonitaSoft
*/
...
...
@@ -258,22 +260,22 @@ public void dispose() {
«DEFINE setPartName FOR gmfgen::GenEditorView-»
/**
* @generated Bonita
S
oft
* @generated Bonita
s
oft
* Remove the extension in tabs name
*/
@Override
protected void setPartName(String partName) {
if(
getEditorInput()!= null){
if(getEditorInput()!= null){
org.eclipse.ui.IEditorInput input = getEditorInput() ;
if(input instanceof org.eclipse.ui.part.FileEditorI
nput)
{
org.eclipse.core.resources.IFile f = ((org.eclipse.ui.part.FileEditorInput) input).getFile(
)
;
for
(
org.eclipse.emf.ecore.resource.Resource r : getEditingDomain().getResourceSet().getResources()){
if(org.eclipse.emf.common.util.URI.decode(r.getURI().toString()).endsWith(f
.getLocation().toFile().get
Name
()
)){
org.bonitasoft.studio.model.process.MainProcess process = (org.bonitasoft.studio.model.process.MainProcess) r.getContents().get(0)
;
super.setPartName(process.getName() + " (" + process.getVersion() +")")
;
break;
}
}
final String fileName = retrieveFileName(i
nput)
;
if (fileName != null
)
{
for
(final
org.eclipse.emf.ecore.resource.Resource r : getEditingDomain().getResourceSet().getResources())
{
if
(org.eclipse.emf.common.util.URI.decode(r.getURI().toString()).endsWith(f
ile
Name))
{
final
org.bonitasoft.studio.model.process.MainProcess process = (org.bonitasoft.studio.model.process.MainProcess) r.getContents().get(0);
super.setPartName(process.getName() + " (" + process.getVersion() +
")");
break;
}
}
}else{
super.setPartName(partName) ;
}
...
...
@@ -281,6 +283,21 @@ public void dispose() {
super.setPartName(partName) ;
}
}
/**
* @generated Bonitasoft
* Remove the extension in tabs name
*/
private String retrieveFileName(final org.eclipse.ui.IEditorInput input) {
if (input instanceof org.eclipse.ui.part.FileEditorInput) {
final org.eclipse.core.resources.IFile f = ((org.eclipse.ui.part.FileEditorInput) input).getFile();
return f.getLocation().toFile().getName();
} else if (input instanceof org.eclipse.emf.common.ui.URIEditorInput) {
final org.eclipse.emf.common.util.URI uri = ((org.eclipse.emf.common.ui.URIEditorInput) input).getURI();
return org.eclipse.emf.common.util.URI.decode(uri.lastSegment());
}
return null;
}
«ENDDEFINE»
«DEFINE initializeGraphicalViewer FOR gmfgen::GenEditorView-»
...
...
@@ -672,6 +689,15 @@ TODO: get it fixed in GMF-Runtime«ENDREM»
«ENDDEFINE»
«DEFINE setReadOnly FOR gmfgen::GenEditorView-»
/**
* @generated Bonitasoft
*/
public void setReadOnly(final boolean isReadOnly) {
enableSanityChecking(!isReadOnly);
}
«ENDDEFINE»
«AROUND getEditingDomain FOR gmfgen::GenEditorView»
/**
* @generated BonitaSoft
...
...
bundles/plugins/org.bonitasoft.studio-models/form/GMFTemplates/aspects/xpt/editor/Editor.xpt
View file @
18665d30
...
...
@@ -141,6 +141,8 @@ protected org.eclipse.emf.transaction.TransactionalEditingDomain createEditingDo
«REM»Prompt for save only if no other editors use the same resource set«ENDREM»
«EXPAND isSaveOnCloseNeeded-»
«EXPAND setReadOnly»
«ENDAROUND»
«DEFINE getTitleTooltip FOR gmfgen::GenEditorView-»
...
...
@@ -473,6 +475,15 @@ TODO: get it fixed in GMF-Runtime«ENDREM»
}
«ENDDEFINE»
«DEFINE setReadOnly FOR gmfgen::GenEditorView-»
/**
* @generated Bonitasoft
*/
public void setReadOnly(final boolean isReadOnly) {
enableSanityChecking(!isReadOnly);
}
«ENDDEFINE»
«AROUND getEditingDomain FOR gmfgen::GenEditorView»
/**
* @generated BonitaSoft
...
...
bundles/plugins/org.bonitasoft.studio.application/plugin.xml
View file @
18665d30
...
...
@@ -946,5 +946,14 @@
class=
"org.bonitasoft.studio.application.BonitaStudioWorkbenchAdvisor"
>
</startup>
</extension>
<extension
point=
"org.eclipse.ui.contexts"
>
<context
description=
"Bonita context"
id=
"org.bonitasoft.studio.context.id"
name=
"Bonita"
parentId=
"org.eclipse.ui.contexts.window"
>
</context>
</extension>
</plugin>
bundles/plugins/org.bonitasoft.studio.application/src/org/bonitasoft/studio/application/BonitaStudioWorkbenchAdvisor.java
View file @
18665d30
...
...
@@ -70,6 +70,7 @@ import org.eclipse.ui.application.IWorkbenchConfigurer;
import
org.eclipse.ui.application.IWorkbenchWindowConfigurer
;
import
org.eclipse.ui.application.WorkbenchAdvisor
;
import
org.eclipse.ui.application.WorkbenchWindowAdvisor
;
import
org.eclipse.ui.contexts.IContextService
;
import
org.eclipse.ui.internal.browser.WebBrowserUtil
;
import
org.eclipse.ui.internal.ide.IDEWorkbenchMessages
;
import
org.eclipse.ui.internal.ide.IDEWorkbenchPlugin
;
...
...
@@ -118,6 +119,8 @@ public class BonitaStudioWorkbenchAdvisor extends WorkbenchAdvisor implements IS
public
void
initialize
(
final
IWorkbenchConfigurer
configurer
)
{
super
.
initialize
(
configurer
);
configurer
.
setSaveAndRestore
(
true
);
final
IContextService
contextService
=
(
IContextService
)
PlatformUI
.
getWorkbench
().
getService
(
IContextService
.
class
);
contextService
.
activateContext
(
"org.bonitasoft.studio.context.id"
);
}
@Override
...
...
bundles/plugins/org.bonitasoft.studio.common.repository/src-test/java/org/bonitasoft/studio/common/repository/ui/viewer/RepositoryTreeContentProviderTest.java
0 → 100644
View file @
18665d30
/**
* Copyright (C) 2014 Bonitasoft S.A.
* Bonitasoft, 32 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.common.repository.ui.viewer
;
import
java.util.Arrays
;
import
java.util.Collection
;
import
java.util.Collections
;
import
org.assertj.core.api.Assertions
;
import
org.bonitasoft.studio.common.repository.model.IRepositoryFileStore
;
import
org.bonitasoft.studio.common.repository.model.IRepositoryStore
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.mockito.Mock
;
import
org.mockito.Mockito
;
import
org.mockito.runners.MockitoJUnitRunner
;
@RunWith
(
MockitoJUnitRunner
.
class
)
public
class
RepositoryTreeContentProviderTest
{
@Mock
IRepositoryStore
<
IRepositoryFileStore
>
repoStore
;
@Mock
IRepositoryFileStore
repoFileStore
;
@Test
public
void
testGetChildren
()
{
Mockito
.
doReturn
(
Arrays
.
asList
(
new
IRepositoryFileStore
[]
{
repoFileStore
})).
when
(
repoStore
).
getChildren
();
final
Object
[]
children
=
new
RepositoryTreeContentProvider
().
getChildren
(
repoStore
);
Assertions
.
assertThat
(
children
).
contains
(
repoFileStore
);
}
@Test
public
void
testGetChildrenReturnEmptyListIfNotARepositoryStore
()
{
final
Object
[]
children
=
new
RepositoryTreeContentProvider
().
getChildren
(
new
Object
());
Assertions
.
assertThat
(
children
).
isNotNull
();
Assertions
.
assertThat
(
children
).
isEmpty
();
}
@Test
public
void
testGetParent
()
{
Mockito
.
doReturn
(
repoStore
).
when
(
repoFileStore
).
getParentStore
();
Assertions
.
assertThat
(
new
RepositoryTreeContentProvider
().
getParent
(
repoFileStore
)).
isEqualTo
(
repoStore
);
}
@Test
public
void
testGetParentReturnNullIfNotARepositoryFileStore
()
{
Assertions
.
assertThat
(
new
RepositoryTreeContentProvider
().
getParent
(
new
Object
())).
isEqualTo
(
null
);
}
@Test
public
void
testHasChildren
()
{
Mockito
.
doReturn
(
Collections
.
emptyList
()).
when
(
repoStore
).
getChildren
();
Assertions
.
assertThat
(
new
RepositoryTreeContentProvider
().
hasChildren
(
repoStore
)).
isFalse
();
Mockito
.
doReturn
(
Arrays
.
asList
(
new
IRepositoryFileStore
[]
{
repoFileStore
})).
when
(
repoStore
).
getChildren
();
Assertions
.
assertThat
(
new
RepositoryTreeContentProvider
().
hasChildren
(
repoStore
)).
isTrue
();
}
@Test
public
void
testHasChildrenReturnFalseIfNotARepositoryFileStore
()
{
Assertions
.
assertThat
(
new
RepositoryTreeContentProvider
().
hasChildren
(
new
Object
())).
isFalse
();
}
@Test
public
void
testGetElementsReturnATable
()
{
final
Collection
<
Object
>
collec
=
Collections
.
emptyList
();
final
Object
[]
elements
=
new
RepositoryTreeContentProvider
().
getElements
(
collec
);
Assertions
.
assertThat
(
elements
).
isInstanceOf
(
Object
[].
class
);
}
@Test
public
void
testGetElementsReturnEmptyListIfNotACollection
()
{
final
Object
[]
elements
=
new
RepositoryTreeContentProvider
().
getElements
(
new
Object
());
Assertions
.
assertThat
(
elements
).
isInstanceOf
(
Object
[].
class
);
Assertions
.
assertThat
(
elements
).
isNotNull
();
Assertions
.
assertThat
(
elements
).
isEmpty
();
}
}
bundles/plugins/org.bonitasoft.studio.common.repository/src-test/java/org/bonitasoft/studio/common/repository/ui/viewer/RepositoryTreeLabelProviderTest.java
0 → 100644
View file @
18665d30
/**
* Copyright (C) 2014 Bonitasoft S.A.
* Bonitasoft, 32 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.common.repository.ui.viewer
;
import
org.assertj.core.api.Assertions
;
import
org.bonitasoft.studio.common.repository.model.IRepositoryFileStore
;
import
org.bonitasoft.studio.common.repository.model.IRepositoryStore
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.mockito.Mock
;
import
org.mockito.Mockito
;
import
org.mockito.runners.MockitoJUnitRunner
;
@RunWith
(
MockitoJUnitRunner
.
class
)
public
class
RepositoryTreeLabelProviderTest
{
@Mock
IRepositoryStore
<
IRepositoryFileStore
>
repoStore
;
@Mock
IRepositoryFileStore
repoFileStore
;
@Test
public
void
testGetTextForIRepositoryStore
()
{
Mockito
.
doReturn
(
"myName"
).
when
(
repoStore
).
getDisplayName
();
Assertions
.
assertThat
(
new
RepositoryTreeLabelProvider
().
getText
(
repoStore
)).
isEqualTo
(
"myName"
);
}
@Test
public
void
testGetTextForIRepositoryFileStore
()
{
Mockito
.
doReturn
(
"myName"
).
when
(
repoFileStore
).
getDisplayName
();
Assertions
.
assertThat
(
new
RepositoryTreeLabelProvider
().
getText
(
repoFileStore
)).
isEqualTo
(
"myName"
);
}
}
bundles/plugins/org.bonitasoft.studio.common.repository/src/org/bonitasoft/studio/common/repository/Repository.java
View file @
18665d30
...
...
@@ -97,6 +97,7 @@ import org.eclipse.jdt.launching.JavaRuntime;
import
org.eclipse.osgi.framework.adaptor.BundleClassLoader
;
import
org.eclipse.swt.graphics.Image
;
import
org.eclipse.swt.widgets.Display
;
import
org.eclipse.swt.widgets.Shell
;
import
org.eclipse.ui.PlatformUI
;
import
org.xml.sax.InputSource
;
...
...
@@ -219,11 +220,34 @@ public class Repository implements IRepository {
project
.
open
(
NULL_PROGRESS_MONITOR
);
//Open anyway
}
}
updateStudioShellText
();
}
catch
(
final
CoreException
e
)
{
BonitaStudioLog
.
error
(
e
);
}
}
@Override
public
void
updateStudioShellText
()
{
Display
.
getDefault
().
syncExec
(
new
Runnable
()
{
@Override
public
void
run
()
{
if
(
PlatformUI
.
isWorkbenchRunning
()
&&
PlatformUI
.
getWorkbench
().
getActiveWorkbenchWindow
()
!=
null
)
{
final
Shell
shell
=
PlatformUI
.
getWorkbench
().
getActiveWorkbenchWindow
().
getShell
();
final
String
currentName
=
shell
.
getText
();
final
int
index
=
currentName
.
indexOf
(
" - "
);
String
newName
=
index
>
0
?
currentName
.
substring
(
0
,
index
)
:
currentName
;
if
(!
getName
()
.
equals
(
RepositoryPreferenceConstant
.
DEFAULT_REPOSITORY_NAME
))
{
newName
=
newName
+
" - "
+
getName
();
}
shell
.
setText
(
newName
);
}
}
});
}
/*
* (non-Javadoc)
* @see org.bonitasoft.studio.common.repository.IRepository#close()
...
...
bundles/plugins/org.bonitasoft.studio.common.repository/src/org/bonitasoft/studio/common/repository/filestore/SourceFileStore.java
View file @
18665d30
...
...
@@ -22,6 +22,7 @@ import java.io.InputStream;
import
java.lang.reflect.InvocationTargetException
;
import
java.util.Collections
;
import
org.bonitasoft.studio.common.editor.EditorUtil
;
import
org.bonitasoft.studio.common.log.BonitaStudioLog
;
import
org.bonitasoft.studio.common.repository.CommonRepositoryPlugin
;
import
org.bonitasoft.studio.common.repository.Repository
;
...
...
@@ -64,7 +65,7 @@ public class SourceFileStore extends AbstractFileStore {
private
String
qualifiedClassName
;
private
IEditorPart
editorPart
;
public
SourceFileStore
(
String
qualifiedClassName
,
IRepositoryStore
<?>
parentStore
)
{
public
SourceFileStore
(
final
String
qualifiedClassName
,
final
IRepositoryStore
<?>
parentStore
)
{
super
(
""
,
parentStore
);
this
.
qualifiedClassName
=
qualifiedClassName
;
}
...
...
@@ -99,7 +100,7 @@ public class SourceFileStore extends AbstractFileStore {
public
InputStream
getContent
()
{
try
{
return
getResource
().
getContents
()
;
}
catch
(
CoreException
e
)
{
}
catch
(
final
CoreException
e
)
{
BonitaStudioLog
.
error
(
e
);
}
return
null
;
...
...
@@ -110,14 +111,14 @@ public class SourceFileStore extends AbstractFileStore {
*/
@Override
public
IFile
getResource
()
{
IJavaProject
project
=
RepositoryManager
.
getInstance
().
getCurrentRepository
().
getJavaProject
()
;
final
IJavaProject
project
=
RepositoryManager
.
getInstance
().
getCurrentRepository
().
getJavaProject
()
;
IType
type
;
try
{
type
=
project
.
findType
(
qualifiedClassName
);
if
(
type
!=
null
&&
type
.
getCompilationUnit
()
!=
null
){
return
(
IFile
)
type
.
getCompilationUnit
().
getResource
()
;
}
}
catch
(
JavaModelException
e
)
{
}
catch
(
final
JavaModelException
e
)
{
BonitaStudioLog
.
error
(
e
)
;
}
return
null
;
...
...
@@ -127,7 +128,7 @@ public class SourceFileStore extends AbstractFileStore {
* @see org.bonitasoft.studio.common.repository.filestore.AbstractFileStore#doSave(java.lang.Object)
*/
@Override
protected
void
doSave
(
Object
content
)
{
protected
void
doSave
(
final
Object
content
)
{
}
...
...
@@ -142,11 +143,11 @@ public class SourceFileStore extends AbstractFileStore {
@Override
public
void
run
()
{
IWorkbenchPage
page
=
PlatformUI
.
getWorkbench
().
getActiveWorkbenchWindow
().
getActivePage
();
final
IWorkbenchPage
page
=
PlatformUI
.
getWorkbench
().
getActiveWorkbenchWindow
().
getActivePage
();
try
{
editorPart
=
IDE
.
openEditor
(
page
,
new
FileEditorInput
(
getResource
()),
"org.eclipse.jdt.ui.CompilationUnitEditor"
);
PlatformUI
.
getWorkbench
().
getActiveWorkbenchWindow
().
getActivePage
().
saveEditor
(
editorPart
,
false
);
}
catch
(
PartInitException
e
)
{
}
catch
(
final
PartInitException
e
)
{
}
}
...
...
@@ -162,14 +163,14 @@ public class SourceFileStore extends AbstractFileStore {
}
public
void
exportAsJar
(
String
absoluteTargetFilePath
,
boolean
includeSources
)
throws
InvocationTargetException
,
InterruptedException
{
public
void
exportAsJar
(
final
String
absoluteTargetFilePath
,
final
boolean
includeSources
)
throws
InvocationTargetException
,
InterruptedException
{
try
{
checkWritePermission
(
new
File
(
absoluteTargetFilePath
));
}
catch
(
IOException
e
)
{
}
catch
(
final
IOException
e
)
{
throw
new
InvocationTargetException
(
e
);
}
final
JarPackageData
jarPackakeData
=
createJarPackageData
()
;
IFile
[]
elements
=
Collections
.
singletonList
(
getResource
()).
toArray
(
new
IFile
[
1
])
;
final
IFile
[]
elements
=
Collections
.
singletonList
(
getResource
()).
toArray
(
new
IFile
[
1
])
;
jarPackakeData
.
setJarLocation
(
new
Path
(
absoluteTargetFilePath
))
;
jarPackakeData
.
setBuildIfNeeded
(
true
);
jarPackakeData
.
setElements
(
elements
)
;
...
...
@@ -190,8 +191,8 @@ public class SourceFileStore extends AbstractFileStore {
}
@Override
public
void
rename
(
String
newQualifiedClassName
)
{
IJavaProject
project
=
RepositoryManager
.
getInstance
().
getCurrentRepository
().
getJavaProject
()
;
public
void
rename
(
final
String
newQualifiedClassName
)
{
final
IJavaProject
project
=
RepositoryManager
.
getInstance
().
getCurrentRepository
().
getJavaProject
()
;
String
packageName
=
""
;
String
className
=
newQualifiedClassName
;
...
...
@@ -202,26 +203,26 @@ public class SourceFileStore extends AbstractFileStore {
try
{
final
IRepositoryStore
<?>
store
=
getParentStore
()
;
IPackageFragmentRoot
root
=
project
.
findPackageFragmentRoot
(
store
.
getResource
().
getFullPath
());
final
IPackageFragmentRoot
root
=
project
.
findPackageFragmentRoot
(
store
.
getResource
().
getFullPath
());
root
.
createPackageFragment
(
packageName
,
true
,
Repository
.
NULL_PROGRESS_MONITOR
)
;
IPackageFragment
targetContainer
=
project
.
findPackageFragment
(
store
.
getResource
().
getFullPath
().
append
(
packageName
.
replace
(
"."
,
"/"
)))
;
IType
type
=
project
.
findType
(
qualifiedClassName
)
;
final
IPackageFragment
targetContainer
=
project
.
findPackageFragment
(
store
.
getResource
().
getFullPath
().
append
(
packageName
.
replace
(
"."
,
"/"
)))
;
final
IType
type
=
project
.
findType
(
qualifiedClassName
)
;
if
(
type
!=
null
){
type
.
getCompilationUnit
().
move
(
targetContainer
,
null
,
className
+
".java"
,
true
,
Repository
.
NULL_PROGRESS_MONITOR
)
;
qualifiedClassName
=
newQualifiedClassName
;
}
}
catch
(
Exception
e
)
{
}
catch
(
final
Exception
e
)
{
BonitaStudioLog
.
error
(
e
)
;
}
}
@Override
protected
void
doDelete
()
{
IJavaProject
project
=
RepositoryManager
.
getInstance
().
getCurrentRepository
().
getJavaProject
()
;
final
IJavaProject
project
=
RepositoryManager
.
getInstance
().
getCurrentRepository
().
getJavaProject
()
;
try
{
IType
type
=
project
.
findType
(
qualifiedClassName
);
final
IType
type
=
project
.
findType
(
qualifiedClassName
);
if
(
type
!=
null
){
IPackageFragment
packageFragment
=
type
.
getPackageFragment
();
final
IPackageFragment
packageFragment
=
type
.
getPackageFragment
();
final
ICompilationUnit
compilationUnit
=
type
.
getCompilationUnit
();
if
(
compilationUnit
!=
null
){
closeRelatedEditorIfOpened
(
compilationUnit
);
//the editor need to be closed here, otherwise the PackageFragment are not refreshed correctly
...
...
@@ -231,23 +232,23 @@ public class SourceFileStore extends AbstractFileStore {
}
else
{
super
.
doDelete
();
}
}
catch
(
JavaModelException
e1
)
{
}
catch
(
final
JavaModelException
e1
)
{
BonitaStudioLog
.
error
(
e1
);
super
.
doDelete
();
}
catch
(
CoreException
e
)
{
}
catch
(
final
CoreException
e
)
{
BonitaStudioLog
.
error
(
e
);
}
}
private
void
deleteRecursivelyEmptyPackages
(
IJavaProject
project
,
IPackageFragment
packageFragment
)
throws
JavaModelException
{
private
void
deleteRecursivelyEmptyPackages
(
final
IJavaProject
project
,
IPackageFragment
packageFragment
)
throws
JavaModelException
{
if
(
packageFragment
!=
null
){
while
(!
packageFragment
.
hasChildren
()){
//I don't find another way than passing through IResource, directly using IJavaElement seems not possible.
final
IPath
pathOfParentPackageFragment
=
packageFragment
.
getResource
().
getParent
().
getFullPath
();
IPackageFragment
parent
=
project
.
findPackageFragment
(
pathOfParentPackageFragment
);
final
IPackageFragment
parent
=
project
.
findPackageFragment
(
pathOfParentPackageFragment
);
packageFragment
.
delete
(
true
,
new
NullProgressMonitor
());
if
(
parent
instanceof
IPackageFragment
&&
!
parent
.
isDefaultPackage
()){
packageFragment
=
(
IPackageFragment
)
parent
;
packageFragment
=
parent
;
}
else
{
return
;
}
...
...
@@ -263,15 +264,13 @@ public class SourceFileStore extends AbstractFileStore {
}
}
else
{
if
(
PlatformUI
.
isWorkbenchRunning
()){
for
(
IEditorReference
editorReference
:
activePage
.
getEditorReferences
()){
final
IEditorInput
editorInput
=
editorReference
.
getEditorInput
();
if
(
editorInput
instanceof
FileEditorInput
){
if
(
compilationUnit
.
getResource
().
equals
(((
FileEditorInput
)
editorInput
).
getFile
())){
activePage
.
closeEditors
(
new
IEditorReference
[]{
editorReference
},
false
);
break
;
}
}
}
for
(
final
IEditorReference
editorReference
:
activePage
.
getEditorReferences
())
{
final
IEditorInput
editorInput
=
editorReference
.
getEditorInput
();
if
(
compilationUnit
.
getResource
().
equals
(
EditorUtil
.
retrieveResourceFromEditorInput
(
editorInput
)))
{
activePage
.
closeEditors
(
new
IEditorReference
[]
{
editorReference
},
false
);
break
;
}
}
}
}
}
...
...
bundles/plugins/org.bonitasoft.studio.common.repository/src/org/bonitasoft/studio/common/repository/model/IRepository.java
View file @
18665d30
...
...
@@ -91,4 +91,6 @@ public interface IRepository extends IFileStoreChangeListener {
void
migrate
()
throws
CoreException
,
MigrationException
;
void
create
();
void
updateStudioShellText
();
}
bundles/plugins/org.bonitasoft.studio.common.repository/src/org/bonitasoft/studio/common/repository/ui/viewer/RepositoryTreeContentProvider.java
View file @
18665d30
...
...
@@ -16,6 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package
org.bonitasoft.studio.common.repository.ui.viewer
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.List
;
...
...
@@ -28,30 +30,30 @@ public class RepositoryTreeContentProvider implements ITreeContentProvider {
/*
* (non-Javadoc)
*
*
* @see
* org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang
* .Object)
*/
@Override
public
Object
[]
getChildren
(
Object
parentElement
)
{
public
Object
[]
getChildren
(
final
Object
parentElement
)
{
if
(
parentElement
instanceof
IRepositoryStore
)
{
List
<
IRepositoryFileStore
>
children
=
((
IRepositoryStore
)
parentElement
).
getChildren
();
final
List
<
IRepositoryFileStore
>
children
=
((
IRepositoryStore
)
parentElement
).
getChildren
();
return
children
.
toArray
();
}
return
n
ull
;
return
n
ew
Object
[]{}
;
}