Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
uaaltools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
universAAL
uaaltools
Commits
2f3f7f54
Commit
2f3f7f54
authored
12 years ago
by
Erlend Stav
Browse files
Options
Downloads
Patches
Plain Diff
Updated code for setting maven nature of projects, and for general handling of Eclipse jobs.
parent
522836b6
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
depotclient/org.universaal.tools.importthirdpartyproject/src/org/universaal/tools/importexternalproject/wizards/ImportExternalWizard.java
+63
-52
63 additions, 52 deletions
...s/importexternalproject/wizards/ImportExternalWizard.java
with
63 additions
and
52 deletions
depotclient/org.universaal.tools.importthirdpartyproject/src/org/universaal/tools/importexternalproject/wizards/ImportExternalWizard.java
+
63
−
52
View file @
2f3f7f54
...
...
@@ -199,52 +199,61 @@ public class ImportExternalWizard extends Wizard implements IImportWizard {
}
public
void
enableMavenNature
(
final
IProject
project
)
{
Job
job
=
new
Job
(
"ConvertToMavenProject"
)
{
protected
IStatus
run
(
IProgressMonitor
monitor
)
{
try
{
ResolverConfiguration
configuration
=
new
ResolverConfiguration
();
configuration
.
setResolveWorkspaceProjects
(
true
);
configuration
.
setActiveProfiles
(
""
);
//configuration.setSelectedProfiles(""); //$NON-NLS-1$
//boolean hasMavenNature = project.hasNature(IMavenConstants.NATURE_ID);
IProjectConfigurationManager
configurationManager
=
MavenPlugin
.
getProjectConfigurationManager
();
configurationManager
.
enableMavenNature
(
project
,
configuration
,
monitor
);
//if(!hasMavenNature) {
configurationManager
.
updateProjectConfiguration
(
project
,
monitor
);
//}
}
catch
(
CoreException
ex
)
{
//log.error(ex.getMessage(), ex);
}
return
Status
.
OK_STATUS
;
}
};
job
.
schedule
();
public
void
scheduleEnableMavenNature
(
final
IProject
[]
projects
)
{
Job
job
=
new
Job
(
"ConvertToMavenProject"
)
{
protected
IStatus
run
(
IProgressMonitor
monitor
)
{
try
{
ResolverConfiguration
configuration
=
new
ResolverConfiguration
();
configuration
.
setResolveWorkspaceProjects
(
true
);
configuration
.
setActiveProfiles
(
""
);
//configuration.setSelectedProfiles(""); //$NON-NLS-1$
// boolean hasMavenNature =
// project.hasNature(IMavenConstants.NATURE_ID);
IProjectConfigurationManager
configurationManager
=
MavenPlugin
.
getProjectConfigurationManager
();
for
(
IProject
project
:
projects
)
{
configurationManager
.
enableMavenNature
(
project
,
configuration
,
monitor
);
// if(!hasMavenNature) {
configurationManager
.
updateProjectConfiguration
(
project
,
monitor
);
// }
}
}
catch
(
CoreException
ex
)
{
ex
.
printStackTrace
();
}
return
Status
.
OK_STATUS
;
}
};
job
.
schedule
();
}
public
void
enableJavaNature
(
final
IProject
project
)
{
Job
job
=
new
Job
(
"ConvertToJavaProject"
)
{
protected
IStatus
run
(
IProgressMonitor
monitor
)
{
try
{
IProjectDescription
descr
=
project
.
getDescription
();
List
<
String
>
natures
=
new
ArrayList
<
String
>();
natures
.
addAll
(
Arrays
.
asList
(
descr
.
getNatureIds
()));
natures
.
add
(
JavaCore
.
NATURE_ID
);
descr
.
setNatureIds
(
natures
.
toArray
(
new
String
[
natures
.
size
()]));
project
.
setDescription
(
descr
,
monitor
);
}
catch
(
CoreException
ex
)
{
//log.error(ex.getMessage(), ex);
}
return
Status
.
OK_STATUS
;
}
};
job
.
schedule
();
public
void
scheduleEnableJavaNature
(
final
IProject
[]
projects
)
{
Job
job
=
new
Job
(
"ConvertToJavaProject"
)
{
protected
IStatus
run
(
IProgressMonitor
monitor
)
{
try
{
for
(
IProject
project
:
projects
)
{
IProjectDescription
descr
=
project
.
getDescription
();
List
<
String
>
natures
=
new
ArrayList
<
String
>();
natures
.
addAll
(
Arrays
.
asList
(
descr
.
getNatureIds
()));
natures
.
add
(
JavaCore
.
NATURE_ID
);
descr
.
setNatureIds
(
natures
.
toArray
(
new
String
[
natures
.
size
()]));
project
.
setDescription
(
descr
,
monitor
);
}
}
catch
(
CoreException
ex
)
{
ex
.
printStackTrace
();
}
return
Status
.
OK_STATUS
;
}
};
job
.
schedule
();
}
...
...
@@ -300,6 +309,8 @@ public class ImportExternalWizard extends Wizard implements IImportWizard {
op2
.
add
(
disc
);
op2
.
add
(
discard
);
Job
job
=
ProgressMonitorUtility
.
doTaskScheduled
(
op2
);
job
.
schedule
();
/*
try {
getContainer().run(true, true, new Progress(job));
} catch (InvocationTargetException e) {
...
...
@@ -309,8 +320,9 @@ public class ImportExternalWizard extends Wizard implements IImportWizard {
e.printStackTrace();
return false;
}
enableMavenNature
(
project
[
0
]);
enableJavaNature
(
project
[
0
]);
*/
scheduleEnableMavenNature
(
project
);
//scheduleEnableJavaNature(project);
return
true
;
}
else
{
...
...
@@ -356,7 +368,8 @@ public class ImportExternalWizard extends Wizard implements IImportWizard {
comOp2
.
add
(
discard
);
Job
job2
=
ProgressMonitorUtility
.
doTaskScheduled
(
comOp2
);
try
{
job2
.
schedule
();
/*try {
getContainer().run(true, true, new Progress(job2));
} catch (InvocationTargetException e) {
e.printStackTrace();
...
...
@@ -365,11 +378,9 @@ public class ImportExternalWizard extends Wizard implements IImportWizard {
e.printStackTrace();
return false;
}
for
(
IProject
proj
:
projects
)
{
enableMavenNature
(
proj
);
enableJavaNature
(
proj
);
}
*/
scheduleEnableMavenNature
(
projects
);
//scheduleEnableJavaNature(projects);
return
true
;
}
catch
(
SVNConnectorException
e
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment