Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AF3
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
257
Issues
257
List
Boards
Labels
Service Desk
Milestones
Merge Requests
8
Merge Requests
8
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
af3
AF3
Commits
33ff0da9
Commit
33ff0da9
authored
May 07, 2020
by
Alexander Diewald
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master' into 3838
parents
dd7a493d
db4d2bc6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
169 additions
and
1 deletion
+169
-1
org.fortiss.af3.exploration.ui/src/org/fortiss/af3/exploration/ui/.ratings
...xploration.ui/src/org/fortiss/af3/exploration/ui/.ratings
+1
-1
org.fortiss.af3.exploration.ui/src/org/fortiss/af3/exploration/ui/AF3ExplorationUIActivator.java
...fortiss/af3/exploration/ui/AF3ExplorationUIActivator.java
+5
-0
org.fortiss.af3.exploration.ui/src/org/fortiss/af3/exploration/ui/cli/.ratings
...ration.ui/src/org/fortiss/af3/exploration/ui/cli/.ratings
+1
-0
org.fortiss.af3.exploration.ui/src/org/fortiss/af3/exploration/ui/cli/CommandLineDSEProjectLoading.java
.../af3/exploration/ui/cli/CommandLineDSEProjectLoading.java
+162
-0
No files found.
org.fortiss.af3.exploration.ui/src/org/fortiss/af3/exploration/ui/.ratings
View file @
33ff0da9
AF3ExplorationUIActivator.java
9d2d437f57c50fa728c6bf0300ed86bca1311c33
GREEN
AF3ExplorationUIActivator.java
a1b08c5c94bfd6d9f192535e2db9bd5cbe8fbedd
GREEN
org.fortiss.af3.exploration.ui/src/org/fortiss/af3/exploration/ui/AF3ExplorationUIActivator.java
View file @
33ff0da9
...
@@ -31,7 +31,9 @@ import org.eclipse.ui.IWorkbenchPage;
...
@@ -31,7 +31,9 @@ import org.eclipse.ui.IWorkbenchPage;
import
org.eclipse.ui.PerspectiveAdapter
;
import
org.eclipse.ui.PerspectiveAdapter
;
import
org.eclipse.ui.PlatformUI
;
import
org.eclipse.ui.PlatformUI
;
import
org.eclipse.ui.plugin.AbstractUIPlugin
;
import
org.eclipse.ui.plugin.AbstractUIPlugin
;
import
org.fortiss.af3.exploration.ui.cli.CommandLineDSEProjectLoading
;
import
org.fortiss.af3.exploration.ui.perspective.process.IProcessManager
;
import
org.fortiss.af3.exploration.ui.perspective.process.IProcessManager
;
import
org.fortiss.tooling.kernel.service.ICommandLineInterfaceService
;
import
org.osgi.framework.BundleContext
;
import
org.osgi.framework.BundleContext
;
/**
/**
...
@@ -95,6 +97,9 @@ public class AF3ExplorationUIActivator extends AbstractUIPlugin {
...
@@ -95,6 +97,9 @@ public class AF3ExplorationUIActivator extends AbstractUIPlugin {
public
void
start
(
BundleContext
context
)
throws
Exception
{
public
void
start
(
BundleContext
context
)
throws
Exception
{
super
.
start
(
context
);
super
.
start
(
context
);
plugin
=
this
;
plugin
=
this
;
ICommandLineInterfaceService
cliService
=
ICommandLineInterfaceService
.
getInstance
();
cliService
.
registerHandler
(
"--loadDSE"
,
new
CommandLineDSEProjectLoading
());
}
}
/** Closes all opened views except Main Menu View */
/** Closes all opened views except Main Menu View */
...
...
org.fortiss.af3.exploration.ui/src/org/fortiss/af3/exploration/ui/cli/.ratings
0 → 100644
View file @
33ff0da9
CommandLineDSEProjectLoading.java 3baa51b26a31bcc4eaa19e4f6c17820d76ae1d92 GREEN
org.fortiss.af3.exploration.ui/src/org/fortiss/af3/exploration/ui/cli/CommandLineDSEProjectLoading.java
0 → 100644
View file @
33ff0da9
/*-------------------------------------------------------------------------+
| Copyright 2020 fortiss GmbH |
| |
| Licensed 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.fortiss.af3.exploration.ui.cli
;
import
static
org
.
apache
.
commons
.
lang3
.
StringUtils
.
countMatches
;
import
static
org
.
conqat
.
ide
.
commons
.
ui
.
logging
.
LoggingUtils
.
logAndShowError
;
import
static
org
.
fortiss
.
af3
.
exploration
.
ui
.
util
.
ExplorationUiUtils
.
getFQNID
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
utils
.
EcoreUtils
.
pickInstanceOf
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
utils
.
LoggingUtils
.
error
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
utils
.
LoggingUtils
.
showError
;
import
org.eclipse.ui.IPerspectiveDescriptor
;
import
org.eclipse.ui.IWorkbench
;
import
org.eclipse.ui.IWorkbenchPage
;
import
org.eclipse.ui.PartInitException
;
import
org.eclipse.ui.PlatformUI
;
import
org.fortiss.af3.exploration.model.project.DSE
;
import
org.fortiss.af3.exploration.ui.AF3ExplorationUIActivator
;
import
org.fortiss.af3.exploration.ui.perspective.DSEperspective
;
import
org.fortiss.af3.exploration.ui.perspective.dashboard.DashboardFXViewPart
;
import
org.fortiss.af3.exploration.ui.perspective.service.IDSEPerspectiveManager
;
import
org.fortiss.af3.project.model.FileProject
;
import
org.fortiss.tooling.kernel.extension.ICommandLineSwitchHandler
;
import
org.fortiss.tooling.kernel.extension.data.ITopLevelElement
;
import
org.fortiss.tooling.kernel.service.IPersistencyService
;
/**
* Handler to preload a DSE project and switch the initial perspective to the DSE perspective.
*
* @author diewald
*/
public
class
CommandLineDSEProjectLoading
implements
ICommandLineSwitchHandler
{
/** Name of the AF3 project to be searched for a matching DSE project. */
private
String
af3PrjName
;
/** Name of the DSE project to be searched in the given AF3 project. */
private
String
dsePrjName
;
/** The first AF3 project matching the given AF3 project name. */
private
FileProject
matchingAF3Project
;
/** The first DSE project matching the given project name within the found AF3 project. */
private
DSE
matchingDSE
;
/** {@inheritDoc} */
@Override
public
boolean
hasAdditionalArgument
()
{
return
true
;
}
/** {@inheritDoc} */
@Override
public
void
handleCLISwitch
(
String
argument
)
{
if
(!
parseArgument
(
argument
))
{
return
;
}
if
(!
findReferencedDSEProject
())
{
return
;
}
showDSEPerspective
();
// Load the DSE project.
IDSEPerspectiveManager
.
INSTANCE
.
setCurrentlySelectedDSE
(
matchingDSE
);
}
/**
* Parses the argument for the required structure and extracts the AF3 and its DSE project name.
*
* @return {@code true} if the argument could be parsed, {@code false} otherwise.
*/
private
boolean
parseArgument
(
String
argument
)
{
int
slashCount
=
countMatches
(
argument
,
"/"
);
if
(
slashCount
!=
1
)
{
logAndShowError
(
AF3ExplorationUIActivator
.
getDefault
(),
"The DSE to be loaded at startup must be provided in the format "
+
"<AF3-Project>/<DSE-Name>"
,
null
);
return
false
;
}
String
[]
argParts
=
argument
.
split
(
"/"
);
af3PrjName
=
argParts
[
0
];
dsePrjName
=
argParts
[
1
];
return
true
;
}
/**
* Finds the AF3 project and a contained DSE project by the names given with the switch.
*
* @return {@code true} if the DSE project was found, {@code false} otherwise.
*/
private
boolean
findReferencedDSEProject
()
{
for
(
ITopLevelElement
topElement
:
IPersistencyService
.
getInstance
().
getTopLevelElements
())
{
if
(
topElement
.
getRootModelElement
()
instanceof
FileProject
)
{
FileProject
fp
=
(
FileProject
)
topElement
.
getRootModelElement
();
if
(
fp
.
getName
().
equals
(
af3PrjName
))
{
matchingAF3Project
=
fp
;
break
;
}
}
}
if
(
matchingAF3Project
==
null
)
{
String
errMsg
=
"Could not find a matching AF3 Project with the name "
+
af3PrjName
+
" to load a DSE project."
;
error
(
AF3ExplorationUIActivator
.
getDefault
(),
errMsg
);
showError
(
errMsg
);
return
false
;
}
for
(
DSE
dse
:
pickInstanceOf
(
DSE
.
class
,
matchingAF3Project
.
getRootElements
()))
{
if
(
dse
.
getName
().
equals
(
dsePrjName
))
{
matchingDSE
=
dse
;
break
;
}
}
if
(
matchingDSE
==
null
)
{
String
errMsg
=
"Could not find a matching DSE project with the name "
+
dsePrjName
+
" in the AF3 project "
+
af3PrjName
+
"."
;
error
(
AF3ExplorationUIActivator
.
getDefault
(),
errMsg
);
showError
(
errMsg
);
return
false
;
}
return
true
;
}
/** Loads the DSE perspective. */
private
void
showDSEPerspective
()
{
IWorkbench
wb
=
PlatformUI
.
getWorkbench
();
IWorkbenchPage
activePage
=
wb
.
getActiveWorkbenchWindow
().
getActivePage
();
IPerspectiveDescriptor
dsePespective
=
wb
.
getPerspectiveRegistry
().
findPerspectiveWithId
(
getFQNID
(
DSEperspective
.
class
));
activePage
.
setPerspective
(
dsePespective
);
// The Dashboard view does not open itself, so manually open it here.
try
{
activePage
.
showView
(
getFQNID
(
DashboardFXViewPart
.
class
));
}
catch
(
PartInitException
e
)
{
error
(
AF3ExplorationUIActivator
.
getDefault
(),
"Could not open the DSE dashboard."
);
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment