Initial commit

This commit is contained in:
vladislav.tyapukhin 2025-06-16 22:22:41 +04:00
commit 1f702ca533
1924 changed files with 175024 additions and 0 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

24
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,24 @@
name: CI check
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
workflow_dispatch:
jobs:
test:
strategy:
matrix:
profile: [ default, ide, release ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK/Maven
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
- name: Run test suite
run: mvn --batch-mode --activate-profiles ${{ matrix.profile }} --define release.signing.disabled=true clean verify

31
.github/workflows/publish.yml vendored Normal file
View File

@ -0,0 +1,31 @@
name: Publish packages to the Maven Central Repository
on:
release:
types: [released]
workflow_dispatch:
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK/Maven
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
server-id: ossrh
server-username: OSSRH_USERNAME
server-password: OSSRH_TOKEN
gpg-private-key: ${{secrets.GPG_PRIVATE_KEY}}
gpg-passphrase: GPG_PASSPHRASE
- if: github.event.release
name: Update version in pom.xml (Release only)
run: mvn -B versions:set -DnewVersion=${{ github.event.release.tag_name }} -DgenerateBackupPoms=false
- name: Publish packages
run: mvn --batch-mode -Prelease deploy
env:
GPG_PASSPHRASE: ${{secrets.GPG_PASSPHRASE}}
OSSRH_USERNAME: ${{secrets.OSSRH_USERNAME}}
OSSRH_TOKEN: ${{secrets.OSSRH_TOKEN}}

25
.gitignore vendored Normal file
View File

@ -0,0 +1,25 @@
# Maven
target/
# Eclipse
.classpath
.project
.settings/
META-INF/
build.properties
plugin.xml
#intelliJ
*.iws
*.ipr
.idea
*.iml
build/
_site
_views
_posts
_menus
assets
installation

20
.travis.yml Normal file
View File

@ -0,0 +1,20 @@
language: java
jdk:
- openjdk8
notifications:
email:
recipients:
- horridge@stanford.edu
on_success: never
on_failure: always
before_install:
- "export DISPLAY=:99.0"
services:
- xvfb
script:
- mvn verify -B

76
CODE_OF_CONDUCT.md Normal file
View File

@ -0,0 +1,76 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at protege-affiliates@lists.stanford.edu. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq

48
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,48 @@
# Contributing
Thanks for considering a contribution to the Protégé project! You can contribute in a number of ways from filing bug reports through to code contributions.
We have a [code of conduct](CODE_OF_CONDUCT.md) that contributors must abide to. Please take some time to have a look at it.
## Reporting Bugs
We use GitHub Issues to manage bug reports. Before creating a bug report please have a quick look at [our issue tracker](https://github.com/protegeproject/protege/issues) to see if someone else has already filed an issue.
### How do I submit a Bug Report?
When you submit a bug report you should explain the problem and include additional details to help maintainers reproduce the problem:
* Use a clear and descriptive title for the issue to identify the problem.
* If you can describe exactly what time the issue occurred, we can more confidently review our (rather large) logs to look for reports related to your issue.
* Describe the exact steps which reproduce the problem in as many details as possible. For example, what you were trying to do and what you expected.
* Provide specific examples to demonstrate the steps.
* Describe the behavior you observed after following the steps and point out what exactly is the problem with that behavior.
* Explain which behavior you expected to see instead and why.
Please include details about your configuration and environment:
* The version of Protégé that you're using
* The name and version of the operating system that you're using
We will assign the correct labels to your issue after reviewing your issue.
## Code Contributions
Protégé is written using Java. You can contribute by forking the GitHub repository and submitting a pull request.
Once you have submitted a pull request we will review your code and test it. We may require you to make some changes to your code or the documentaiton of your code. You should include automated tests with your code.
### What can I work on?
Our [issue tracker](https://github.com/protegeproject/protege/issues) has a list of feature requests and bugs that need fixing. You can use this as an inspiration for something to work on.
A number of the issues are tagged as ["Easy first issue"](https://github.com/protegeproject/protege/issues?q=is%3Aissue+is%3Aopen+label%3A%22Note%3A+Easy+First+Issue%22). These are some of the easier issues to tackle that you might want to start with.
If you start working on an issue, please leave a comment in the issue discussion thread so that other people know you are working on the issue. If you stop working on an issue please leave a comment in the thread so that we know.
Here are some other ideas for other ways you can contribute:
* __Add more unit tests__ We are always looking to increase test coverage. Writing tests is a good way to "get your toes wet" with the code base. We use Mockito and Hamcrest for writing tests. Before writing tests please take a look at other tests in the code base so that you get a feeling for the style that we use. Test code is as important as the main code base. Please write your test code with the same care that you would write you main code. New tests should be submitted as pull requests.

17
README.md Normal file
View File

@ -0,0 +1,17 @@
# Protege Desktop
[Protege](https://protege.stanford.edu) is a free, open-source ontology editor that supports the latest [OWL 2.0 standard](http://www.w3.org/TR/owl2-overview/). Protege has a pluggable architecture, and many [plugins](https://protegewiki.stanford.edu/wiki/Protege_Plugin_Library) for different functionalities are available.
To read more about **Protege's features**, please visit the Protege [home page](https://protege.stanford.edu).
The latest version of Protege can be [downloaded](https://protege.stanford.edu/software.php#desktop-protege) from the Protege website, or from [github](https://github.com/protegeproject/protege-distribution/releases).
If you would like to contribute to the Protege Project please see our [contributing guide](https://github.com/protegeproject/protege/blob/master/CONTRIBUTING.md)
The [Developer Documentation](https://github.com/protegeproject/protege/wiki/Developer-Documentation) may be found on the wiki.
**Looking for support?** Please ask questions on the [protege-user](https://protege.stanford.edu/support.php) or [protege-dev](https://protege.stanford.edu/support.php) mailing lists. If you found a bug or would like to request a feature, you may also use [this issue tracker](https://github.com/protegeproject/protege/issues).
Protege is released under the [BSD 2-clause license](https://raw.githubusercontent.com/protegeproject/protege/master/license.txt).
Instructions for [building from source](https://github.com/protegeproject/protege/wiki/Building-from-Source) are available on the the wiki.

26
license.txt Normal file
View File

@ -0,0 +1,26 @@
Copyright (c) 2014, The Board of Trustees of Leland Stanford Junior University
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are
permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of
conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list
of conditions and the following disclaimer in the documentation and/or other materials
provided with the distribution.
THIS SOFTWARE IS PROVIDED BY The Board of Trustees of Leland Stanford Junior University
''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL The Board of Trustees of Leland Stanford Junior University OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those of the
authors and should not be interpreted as representing official policies, either expressed
or implied, of The Board of Trustees of Leland Stanford Junior University.

650
pom.xml Normal file
View File

@ -0,0 +1,650 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>edu.stanford.protege</groupId>
<artifactId>protege-parent</artifactId>
<version>5.6.6</version>
<packaging>pom</packaging>
<name>protege-parent</name>
<description>Protege is a free, open source ontology editor that supports the full OWL 2 standard.</description>
<url>http://protege.stanford.edu</url>
<inceptionYear>1987</inceptionYear>
<organization>
<name>Stanford Center for Biomedical Informatics Research</name>
<url>http://bmir.stanford.edu/</url>
</organization>
<licenses>
<license>
<name>BSD 2-Clause License</name>
<url>http://opensource.org/licenses/BSD-2-Clause</url>
</license>
</licenses>
<!-- Alphabetical by last name -->
<developers>
<developer>
<id>matthewhorridge</id>
<name>Matthew Horridge</name>
<email>matthew.horridge@stanford.edu</email>
</developer>
<developer>
<id>csnyulas</id>
<name>Csongor Nyulas</name>
<email>csongor.nyulas@stanford.edu</email>
</developer>
<developer>
<id>stdotjohn</id>
<name>Timothy Redmond</name>
<email>tredmond@stanford.edu</email>
</developer>
<developer>
<id>tudorache</id>
<name>Tania Tudorache</name>
<email>tudorache@stanford.edu</email>
</developer>
<developer>
<id>jvendetti</id>
<name>Jennifer Vendetti</name>
<email>vendetti@stanford.edu</email>
</developer>
</developers>
<contributors>
<contributor>
<name>Nick Drummond</name>
<email>nickdrummond@yahoo.com</email>
</contributor>
</contributors>
<mailingLists>
<!-- For end users of Protege Desktop. -->
<mailingList>
<name>protege-user</name>
<subscribe>https://mailman.stanford.edu/mailman/listinfo/protege-user</subscribe>
<unsubscribe>https://mailman.stanford.edu/mailman/listinfo/protege-user</unsubscribe>
<post>protege-user@lists.stanford.edu</post>
<archive>http://protege-project.136.n4.nabble.com/</archive>
<otherArchives>
<otherArchive>https://mailman.stanford.edu/pipermail/protege-user/</otherArchive>
</otherArchives>
</mailingList>
<!-- For developers with questions about source code, developing Protege Desktop plug-ins, and/or programmatic access of ontologies. -->
<mailingList>
<name>protege-dev</name>
<subscribe>https://mailman.stanford.edu/mailman/listinfo/protege-dev</subscribe>
<unsubscribe>https://mailman.stanford.edu/mailman/listinfo/protege-dev</unsubscribe>
<post>protege-dev@lists.stanford.edu</post>
<archive>http://protege-project.136.n4.nabble.com/</archive>
<otherArchives>
<otherArchive>https://mailman.stanford.edu/pipermail/protege-dev/</otherArchive>
</otherArchives>
</mailingList>
</mailingLists>
<modules>
<module>protege-launcher</module>
<module>protege-common</module>
<module>protege-editor-core</module>
<module>protege-editor-owl</module>
<module>protege-desktop</module>
</modules>
<scm>
<connection>scm:git:git@github.com:protegeproject/protege.git</connection>
<developerConnection>scm:git:git@github.com:protegeproject/protege.git</developerConnection>
<url>https://github.com/protegeproject/protege</url>
<tag>HEAD</tag>
</scm>
<issueManagement>
<system>GitHub</system>
<url>https://github.com/protegeproject/protege/issues</url>
</issueManagement>
<repositories>
<repository>
<id>oss</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases><enabled>false</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<!-- Protege libraries are hosted on Sonatype OSSRH (OSS Repository Hosting Service). -->
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.javadoc.failOnError>false</maven.javadoc.failOnError>
<slf4j.version>1.7.36</slf4j.version>
<logback.version>1.2.13</logback.version>
<lib.location>target/lib</lib.location>
<jackson.version>2.9.8</jackson.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>net.sourceforge.owlapi</groupId>
<artifactId>owlapi-osgidistribution</artifactId>
<version>4.5.29</version>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.main</artifactId>
<version>7.0.5</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-annotations</artifactId>
<version>4.8.6</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>18.0</version>
</dependency>
<dependency>
<groupId>com.googlecode.mdock</groupId>
<artifactId>mdock</artifactId>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.common</artifactId>
<version>3.6.0.v20100503</version>
</dependency>
<dependency>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.registry</artifactId>
<version>3.5.101</version>
</dependency>
<dependency>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.supplement</artifactId>
<version>1.3.0.20100503</version>
</dependency>
<dependency>
<groupId>org.apache.servicemix.bundles</groupId>
<artifactId>org.apache.servicemix.bundles.javax-inject</artifactId>
<version>1_3</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
<version>3.3.9</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.14.0</version>
</dependency>
<dependency>
<groupId>edu.stanford.protege</groupId>
<artifactId>org.protege.xmlcatalog</artifactId>
<version>1.0.5</version>
<exclusions>
<exclusion>
<groupId>net.sourceforge.owlapi</groupId>
<artifactId>owlapi-osgidistribution</artifactId>
</exclusion>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit</artifactId>
<version>6.6.1.202309021850-r</version>
</dependency>
<dependency>
<groupId>com.googlecode.javaewah</groupId>
<artifactId>JavaEWAH</artifactId>
<version>1.2.3</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
<version>2.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>1.10.19</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.auto.value</groupId>
<artifactId>auto-value-annotations</artifactId>
<version>1.11.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.auto.value</groupId>
<artifactId>auto-value</artifactId>
<version>1.6.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>4.0.2</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.3.0.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.3.9</version>
</dependency>
<dependency>
<groupId>com.sun.activation</groupId>
<artifactId>javax.activation</artifactId>
<version>1.2.0</version>
</dependency>
<!-- swrltab plugin requires -->
<dependency>
<groupId>org.glassfish.corba</groupId>
<artifactId>glassfish-corba-orb</artifactId>
<version>4.2.5</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.4.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<configuration>
<release>11</release>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.7.1</version>
<configuration>
<descriptors>
<descriptor>protege-distribution/src/main/assembly/protege-as-directory.xml</descriptor>
<descriptor>protege-distribution/src/main/assembly/protege-as-app.xml</descriptor>
</descriptors>
</configuration>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>3.0.1</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-gitexe</artifactId>
<version>2.1.0</version>
</dependency>
</dependencies>
<configuration>
<autoVersionSubmodules>true</autoVersionSubmodules>
<tagNameFormat>v@{project.version}</tagNameFormat>
<releaseProfiles>release</releaseProfiles>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>5.1.9</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-Vendor>The Protege Development Team</Bundle-Vendor>
<Embed-Directory>${lib.location}</Embed-Directory>
</instructions>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.5</version>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.3.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.6.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.6.3</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.2.4</version>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.13</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.3.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.2.5</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>enforce-maven</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>3.6.3</version>
</requireMavenVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<!-- Generate source and Javadoc JAR files, and sign artifacts. Required by Sonatype OSSRH for deployment. -->
<profiles>
<profile>
<id>release</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<failOnError>false</failOnError>
<quiet>true</quiet>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<configuration>
<skip>${release.signing.disabled}</skip>
</configuration>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<extensions>true</extensions>
<executions>
<execution>
<id>default-deploy</id>
<phase>deploy</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
</executions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>ide</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<manifestLocation>META-INF</manifestLocation>
<instructions>
<Bundle-ClassPath>.,target/dependency</Bundle-ClassPath>
</instructions>
</configuration>
</plugin>
<!-- Copy all Maven dependencies so that it is possible to run Protege
in Eclipse (PDE + m2e + OSGi Framework launcher). -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-provided-dependencies</id>
<phase>package</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
</execution>
</executions>
<configuration>
<includeScope>provided</includeScope>
<outputDirectory>${project.build.directory}/dependency</outputDirectory>
</configuration>
</plugin>
<!-- Copy plugin.xml where PDE in Eclipse can find it (PDE + m2e +
OSGi Framework launcher). -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-resources</id>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}</outputDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>plugin.xml</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<!-- Remove META-INF and plugin.xml from project root, placed there
when this profile is active. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<configuration>
<filesets>
<fileset>
<directory>META-INF</directory>
</fileset>
<fileset>
<directory>${basedir}</directory>
<includes>
<include>plugin.xml</include>
</includes>
<followSymlinks>false</followSymlinks>
</fileset>
</filesets>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
</profiles>
</project>

65
protege-common/pom.xml Normal file
View File

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>edu.stanford.protege</groupId>
<artifactId>protege-parent</artifactId>
<version>5.6.6</version>
<relativePath>../</relativePath>
</parent>
<!-- groupId and version are inherited from the parent -->
<artifactId>protege-common</artifactId>
<packaging>bundle</packaging>
<name>protege-common</name>
<description>Core Protege Libraries</description>
<dependencies>
<dependency>
<groupId>edu.stanford.protege</groupId>
<artifactId>protege-launcher</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Bundle-Activator>org.protege.common.Activator</Bundle-Activator>
<Bundle-ClassPath>.</Bundle-ClassPath>
<Bundle-SymbolicName>org.protege.common</Bundle-SymbolicName>
<Export-Package>
org.protege.common.*;version=${project.version}
</Export-Package>
<Import-Package>
!com.ibm.*,
!javax.jms,
!javax.mail.*,
!javax.jmdns,
!com.sun.*,
sun.misc;resolution:=optional,
*
</Import-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,61 @@
package org.protege.common;
import org.osgi.framework.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Activator implements BundleActivator {
private final Logger logger = LoggerFactory.getLogger(Activator.class);
private ServiceListener listener;
public void start(BundleContext context) throws Exception {
logger.debug("Starting org.protege.common bundle");
context.registerService(
javax.xml.parsers.SAXParserFactory.class.getName(),
javax.xml.parsers.SAXParserFactory.newInstance(), null);
// CommonProtegeProperties.getDataDirectory().mkdir();
if (logger.isDebugEnabled()) {
startDebug(context);
}
}
public void startDebug(BundleContext context) {
listener = new DebugServicesListener();
context.addServiceListener(listener);
}
private class DebugServicesListener implements ServiceListener {
@Override
public void serviceChanged(ServiceEvent event) {
if (event.getType() == ServiceEvent.REGISTERED) {
logger.debug(event.getServiceReference().getBundle().getSymbolicName() + " registering service " + displayClass(event.getServiceReference()));
}
else if (event.getType() == ServiceEvent.UNREGISTERING) {
logger.debug(event.getServiceReference().getBundle().getSymbolicName() + " unregistering service " + displayClass(event.getServiceReference()));
}
else {
logger.debug("Modifying service " + event.getServiceReference());
}
}
private String displayClass(ServiceReference ref) {
Object classes = ref.getProperty(Constants.OBJECTCLASS);
if (classes instanceof String[]) {
String classArray[] = (String[]) classes;
return classArray[0];
}
return classes.toString();
}
}
public void stop(BundleContext context) throws Exception {
if (listener != null) {
context.removeServiceListener(listener);
listener = null;
}
}
}

BIN
protege-desktop/.DS_Store vendored Normal file

Binary file not shown.

185
protege-desktop/pom.xml Normal file
View File

@ -0,0 +1,185 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>edu.stanford.protege</groupId>
<artifactId>protege-parent</artifactId>
<version>5.6.6</version>
<relativePath>../</relativePath>
</parent>
<!-- groupId and version are inherited from the parent -->
<artifactId>protege-desktop</artifactId>
<packaging>jar</packaging>
<name>protege-desktop</name>
<description>Standard build of the Protege Desktop ontology editor.</description>
<properties>
<conf.extra.args>-XX:CompileCommand=exclude,javax/swing/text/GlyphView,getBreakSpot</conf.extra.args>
<osx.bundle.name>Protégé.app</osx.bundle.name>
</properties>
<repositories>
<repository>
<releases>
<enabled>true</enabled>
</releases>
<id>github</id>
<url>https://raw.github.com/protegeproject/mvn-repo/master/releases</url>
</repository>
</repositories>
<dependencies>
<!-- NOTE: These dependency declarations are required to sort this project to the end of the line in the multimodule build. -->
<!-- edu.stanford.protege dependency list -->
<dependency>
<groupId>edu.stanford.protege</groupId>
<artifactId>protege-common</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>edu.stanford.protege</groupId>
<artifactId>protege-editor-core</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>edu.stanford.protege</groupId>
<artifactId>protege-editor-owl</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>edu.stanford.protege</groupId>
<artifactId>protege-launcher</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.supplement</artifactId>
</dependency>
<dependency>
<groupId>edu.stanford.protege</groupId>
<artifactId>jre.os-x</artifactId>
<version>11.0.25_9</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>edu.stanford.protege</groupId>
<artifactId>jre.win</artifactId>
<version>11.0.25_9</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>edu.stanford.protege</groupId>
<artifactId>jre.linux</artifactId>
<version>11.0.25_9</version>
<scope>runtime</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>protege-desktop-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<finalName>protege-${project.version}</finalName>
<archiverConfig>
<defaultDirectoryMode>0755</defaultDirectoryMode>
<defaultFileMode>0755</defaultFileMode>
</archiverConfig>
<descriptors>
<descriptor>src/main/assembly/protege-platform-independent.xml</descriptor>
<descriptor>src/main/assembly/protege-os-x.xml</descriptor>
<descriptor>src/main/assembly/protege-win.xml</descriptor>
<descriptor>src/main/assembly/protege-linux.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>release</id>
<properties>
<win.dir>target/Protege-${project.version}-win/Protege-${project.version}</win.dir>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<mkdir dir="${win.dir}" />
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>protege-desktop-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<finalName>protege-${project.version}</finalName>
<archiverConfig>
<defaultDirectoryMode>0755</defaultDirectoryMode>
<defaultFileMode>0755</defaultFileMode>
</archiverConfig>
<descriptors>
<descriptor>src/main/assembly/protege-platform-independent.xml</descriptor>
<descriptor>src/main/assembly/protege-os-x.xml</descriptor>
<descriptor>src/main/assembly/protege-win.xml</descriptor>
<descriptor>src/main/assembly/protege-linux.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

BIN
protege-desktop/src/.DS_Store vendored Normal file

Binary file not shown.

BIN
protege-desktop/src/main/.DS_Store vendored Normal file

Binary file not shown.

View File

@ -0,0 +1,54 @@
<component>
<dependencySets>
<dependencySet>
<outputDirectory>bundles</outputDirectory>
<includes>
<include>org.neo4j.driver:neo4j-java-driver:jar</include>
<include>org.reactivestreams:reactive-streams:jar</include>
<include>edu.stanford.protege:protege-launcher:jar</include>
<include>org.apache.felix:org.apache.felix.main:jar</include>
<include>org.apache.maven:maven-artifact</include>
<include>edu.stanford.protege:protege-common:jar</include>
<include>edu.stanford.protege:protege-editor-core:jar</include>
<include>org.eclipse.equinox:org.eclipse.equinox.registry:jar</include>
<include>org.eclipse.equinox:org.eclipse.equinox.supplement:jar</include>
<include>org.eclipse.equinox:org.eclipse.equinox.common:jar</include>
<include>net.sourceforge.owlapi:owlapi-osgidistribution:jar</include>
<include>edu.stanford.protege:protege-editor-owl:jar</include>
<include>ch.qos.logback:logback-core:jar</include>
<include>ch.qos.logback:logback-classic:jar</include>
<include>com.google.code.findbugs:jsr305:jar</include>
<include>com.google.guava:guava:jar</include>
<include>org.slf4j:slf4j-api:jar</include>
<include>org.slf4j:log4j-over-slf4j:jar</include>
<include>org.slf4j:jul-to-slf4j:jar</include>
<include>commons-io:commons-io:jar</include>
<include>org.apache.servicemix.bundles:org.apache.servicemix.bundles.javax-inject:jar</include>
<include>org.eclipse.jgit:org.eclipse.jgit:jar</include>
<include>com.googlecode.javaewah:JavaEWAH:jar</include>
<include>javax.xml.bind:jaxb-api:jar</include>
<include>com.sun.xml.bind:jaxb-core:jar</include>
<include>com.sun.xml.bind:jaxb-impl:jar</include>
<include>com.sun.activation:javax.activation</include>
<!-- CORBA dependencies -->
<include>org.glassfish.corba:glassfish-corba-orb:jar</include>
<include>org.glassfish.corba:glassfish-corba-internal-api:jar</include>
<include>org.glassfish.corba:glassfish-corba-omgapi:jar</include>
<include>org.glassfish.gmbal:gmbal:jar</include>
<include>org.glassfish.external:management-api:jar</include>
<include>org.glassfish.pfl:pfl-basic:jar</include>
<include>org.glassfish.pfl:pfl-tf:jar</include>
<include>org.glassfish.pfl:pfl-dynamic:jar</include>
<include>org.ow2.asm:asm:jar</include>
<include>org.ow2.asm:asm-util:jar</include>
<include>org.ow2.asm:asm-tree:jar</include>
<include>org.ow2.asm:asm-analysis:jar</include>
</includes>
<useStrictFiltering>true</useStrictFiltering>
<outputFileNameMapping>${artifact.artifactId}.${artifact.extension}</outputFileNameMapping>
</dependencySet>
</dependencySets>
</component>

View File

@ -0,0 +1,29 @@
<component>
<fileSets>
<fileSet>
<directory>src/main/felix</directory>
<outputDirectory>.</outputDirectory>
<includes>
<include>**/*</include>
</includes>
</fileSet>
<fileSet>
<directory>src/main/logging</directory>
<outputDirectory>.</outputDirectory>
<includes>
<include>**/*</include>
</includes>
</fileSet>
<fileSet>
<directory>src/main/resources</directory>
<outputDirectory>.</outputDirectory>
<includes>
<include>**/*</include>
</includes>
</fileSet>
</fileSets>
</component>

View File

@ -0,0 +1,68 @@
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">
<id>linux</id>
<formats>
<format>dir</format>
<format>tar.gz</format>
</formats>
<baseDirectory>Protege-${project.version}</baseDirectory>
<componentDescriptors>
<componentDescriptor>src/main/assembly/file-sets.xml</componentDescriptor>
<componentDescriptor>src/main/assembly/dependency-sets.xml</componentDescriptor>
</componentDescriptors>
<fileSets>
<fileSet>
<directory>src/main/env/linux</directory>
<outputDirectory>.</outputDirectory>
<fileMode>0755</fileMode>
<directoryMode>0755</directoryMode>
<excludes>
<exclude>run.sh</exclude>
</excludes>
</fileSet>
</fileSets>
<files>
<file>
<source>src/main/env/linux/run.sh</source>
<outputDirectory>.</outputDirectory>
<fileMode>0755</fileMode>
<filtered>true</filtered>
</file>
</files>
<dependencySets>
<dependencySet>
<outputDirectory>.</outputDirectory>
<includes>
<include>edu.stanford.protege:jre.linux:jar</include>
</includes>
<unpack>true</unpack>
<unpackOptions>
<excludes>
<exclude>META-INF</exclude>
<exclude>META-INF/**/*</exclude>
</excludes>
</unpackOptions>
<!--
This is unsatisfactory as it applies to everything. However, I'm not sure
how to do this otherwise. (Note, listing the artifact twice with different
includes and excludes doesn't help as it gets skipped the second time.
-->
<fileMode>0755</fileMode>
<directoryMode>0755</directoryMode>
<useStrictFiltering>true</useStrictFiltering>
</dependencySet>
</dependencySets>
</assembly>

View File

@ -0,0 +1,127 @@
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>mac</id>
<formats>
<format>dir</format>
<format>zip</format>
</formats>
<baseDirectory>Protege-${project.version}</baseDirectory>
<dependencySets>
<dependencySet>
<outputDirectory>${osx.bundle.name}/Contents/bundles</outputDirectory>
<includes>
<include>org.neo4j.driver:neo4j-java-driver:jar</include>
<include>org.reactivestreams:reactive-streams:jar</include>
<include>edu.stanford.protege:protege-common:jar</include>
<include>edu.stanford.protege:protege-editor-core:jar</include>
<include>org.eclipse.equinox:org.eclipse.equinox.registry:jar</include>
<include>org.eclipse.equinox:org.eclipse.equinox.supplement:jar</include>
<include>org.eclipse.equinox:org.eclipse.equinox.common:jar</include>
<include>net.sourceforge.owlapi:owlapi-osgidistribution:jar</include>
<include>edu.stanford.protege:protege-editor-owl:jar</include>
<include>com.google.code.findbugs:jsr305</include>
<include>ch.qos.logback:logback-core:jar</include>
<include>ch.qos.logback:logback-classic:jar</include>
<include>com.google.guava:guava:jar</include>
<include>org.slf4j:slf4j-api:jar</include>
<include>org.slf4j:log4j-over-slf4j:jar</include>
<include>org.slf4j:jul-to-slf4j:jar</include>
<include>commons-io:commons-io:jar</include>
<include>org.apache.servicemix.bundles:org.apache.servicemix.bundles.javax-inject:jar</include>
<include>org.eclipse.jgit:org.eclipse.jgit:jar</include>
<include>com.googlecode.javaewah:JavaEWAH:jar</include>
<include>javax.xml.bind:jaxb-api:jar</include>
<include>com.sun.xml.bind:jaxb-core:jar</include>
<include>com.sun.xml.bind:jaxb-impl:jar</include>
<include>com.sun.activation:javax.activation</include>
<!-- CORBA dependencies -->
<include>org.glassfish.corba:glassfish-corba-orb:jar</include>
<include>org.glassfish.corba:glassfish-corba-internal-api:jar</include>
<include>org.glassfish.corba:glassfish-corba-omgapi:jar</include>
<include>org.glassfish.gmbal:gmbal:jar</include>
<include>org.glassfish.external:management-api:jar</include>
<include>org.glassfish.pfl:pfl-basic:jar</include>
<include>org.glassfish.pfl:pfl-tf:jar</include>
<include>org.glassfish.pfl:pfl-dynamic:jar</include>
<include>org.ow2.asm:asm:jar</include>
<include>org.ow2.asm:asm-util:jar</include>
<include>org.ow2.asm:asm-tree:jar</include>
<include>org.ow2.asm:asm-analysis:jar</include>
<include>edu.stanford.protege:protege-launcher:jar</include>
<include>org.apache.felix:org.apache.felix.main:jar</include>
<include>org.apache.maven:maven-artifact</include>
</includes>
<useStrictFiltering>true</useStrictFiltering>
<outputFileNameMapping>${artifact.artifactId}.${artifact.extension}</outputFileNameMapping>
</dependencySet>
<dependencySet>
<outputDirectory>${osx.bundle.name}/Contents</outputDirectory>
<includes>
<include>edu.stanford.protege:jre.os-x:jar</include>
</includes>
<unpack>true</unpack>
<unpackOptions>
<excludes>
<exclude>META-INF</exclude>
<exclude>META-INF/**/*</exclude>
</excludes>
</unpackOptions>
<fileMode>0755</fileMode>
<directoryMode>0755</directoryMode>
</dependencySet>
</dependencySets>
<fileSets>
<fileSet>
<directory>src/main/felix</directory>
<outputDirectory>${osx.bundle.name}/Contents</outputDirectory>
<includes>
<include>**/*</include>
</includes>
</fileSet>
<fileSet>
<directory>src/main/logging</directory>
<outputDirectory>${osx.bundle.name}/Contents</outputDirectory>
<includes>
<include>**/*</include>
</includes>
</fileSet>
<fileSet>
<directory>src/main/resources</directory>
<outputDirectory>${osx.bundle.name}/Contents</outputDirectory>
<includes>
<include>conf/**</include>
</includes>
</fileSet>
<fileSet>
<directory>src/main/env/os-x</directory>
<outputDirectory>${osx.bundle.name}/Contents/</outputDirectory>
<excludes>
<exclude>Info.plist</exclude>
</excludes>
</fileSet>
</fileSets>
<files>
<file>
<source>src/main/env/os-x/Info.plist</source>
<outputDirectory>${osx.bundle.name}/Contents/</outputDirectory>
<filtered>true</filtered>
</file>
</files>
</assembly>

View File

@ -0,0 +1,28 @@
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">
<id>platform-independent</id>
<formats>
<format>dir</format>
<format>zip</format>
</formats>
<baseDirectory>Protege-${project.version}</baseDirectory>
<componentDescriptors>
<componentDescriptor>src/main/assembly/file-sets.xml</componentDescriptor>
<componentDescriptor>src/main/assembly/dependency-sets.xml</componentDescriptor>
</componentDescriptors>
<fileSets>
<fileSet>
<directory>src/main/env/platform-independent</directory>
<outputDirectory>.</outputDirectory>
<fileMode>0755</fileMode>
<directoryMode>0755</directoryMode>
<filtered>true</filtered>
</fileSet>
</fileSets>
</assembly>

View File

@ -0,0 +1,67 @@
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">
<id>win</id>
<formats>
<format>dir</format>
<format>zip</format>
</formats>
<baseDirectory>Protege-${project.version}</baseDirectory>
<componentDescriptors>
<componentDescriptor>src/main/assembly/file-sets.xml</componentDescriptor>
<componentDescriptor>src/main/assembly/dependency-sets.xml</componentDescriptor>
</componentDescriptors>
<fileSets>
<fileSet>
<directory>src/main/env/win</directory>
<outputDirectory>.</outputDirectory>
<fileMode>0755</fileMode>
<directoryMode>0755</directoryMode>
<excludes>
<exclude>run.bat</exclude>
</excludes>
</fileSet>
</fileSets>
<files>
<file>
<source>src/main/env/win/run.bat</source>
<outputDirectory>.</outputDirectory>
<fileMode>0755</fileMode>
<filtered>true</filtered>
</file>
</files>
<dependencySets>
<dependencySet>
<outputDirectory>.</outputDirectory>
<includes>
<include>edu.stanford.protege:jre.win:jar</include>
</includes>
<unpack>true</unpack>
<unpackOptions>
<excludes>
<exclude>META-INF</exclude>
<exclude>META-INF/**/*</exclude>
</excludes>
</unpackOptions>
<!--
This is unsatisfactory as it applies to everything. However, I'm not sure
how to do this otherwise. (Note, listing the artifact twice with different
includes and excludes doesn't help as it gets skipped the second time.
-->
<fileMode>0755</fileMode>
<directoryMode>0755</directoryMode>
<useStrictFiltering>true</useStrictFiltering>
</dependencySet>
</dependencySets>
</assembly>

BIN
protege-desktop/src/main/env/linux/protege vendored Executable file

Binary file not shown.

View File

@ -0,0 +1,39 @@
#!/usr/bin/env bash
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
cd "$( cd -P "$( dirname "$SOURCE" )" && pwd )"
conf_file=
if [ -f "$HOME/.Protege/conf/jvm.conf" ]; then
conf_file="$HOME/.Protege/conf/jvm.conf"
elif [ -f conf/jvm.conf ]; then
conf_file=conf/jvm.conf
fi
EXTRA_JVM_OPTIONS=
EFFECTIVE_JAVA_HOME=
if [ -n "$conf_file" ]; then
EXTRA_JVM_OPTIONS=$(sed -n 's/^max_heap_size=/-Xmx/p; s/^min_heap_size=/-Xms/p; s/^stack_size=/-Xss/p; s/^append=//p;' "$conf_file" | tr '\n' ' ')
EFFECTIVE_JAVA_HOME=$(sed -n 's/^java_home=//p' "$conf_file")
fi
[ -z "$EFFECTIVE_JAVA_HOME" ] && EFFECTIVE_JAVA_HOME="$PROTEGE_JAVA_HOME"
[ -z "$EFFECTIVE_JAVA_HOME" -a ! -d jre ] && EFFECTIVE_JAVA_HOME="$JAVA_HOME"
[ -z "$EFFECTIVE_JAVA_HOME" ] && EFFECTIVE_JAVA_HOME="jre"
$EFFECTIVE_JAVA_HOME/bin/java \
-DentityExpansionLimit=100000000 \
-Dlogback.configurationFile=conf/logback.xml \
-Dfile.encoding=UTF-8 \
${conf.extra.args} \
--add-opens=java.desktop/sun.swing=ALL-UNNAMED \
-classpath bundles/guava.jar:bundles/logback-classic.jar:bundles/logback-core.jar:bundles/slf4j-api.jar:bundles/glassfish-corba-orb.jar:bundles/org.apache.felix.main.jar:bundles/maven-artifact.jar:bundles/protege-launcher.jar \
$CMD_OPTIONS $EXTRA_JVM_OPTIONS org.protege.osgi.framework.Launcher $1

View File

@ -0,0 +1,79 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>owl</string>
</array>
<key>CFBundleTypeName</key>
<string>OWL Ontology Document</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>omn</string>
</array>
<key>CFBundleTypeName</key>
<string>Manchester OWL Syntax Ontology Document</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>rdf</string>
</array>
<key>CFBundleTypeName</key>
<string>RDF Document</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>ttl</string>
</array>
<key>CFBundleTypeName</key>
<string>Turtle Document</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
</array>
<key>CFBundleExecutable</key>
<string>protege</string>
<key>CFBundleIconFile</key>
<string>Protege.icns</string>
<key>CFBundleIdentifier</key>
<string>edu.stanford.protege</string>
<key>CFBundleDisplayName</key>
<string>Protégé</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Protégé</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>${project.version}</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>${project.version}</string>
<key>NSHumanReadableCopyright</key>
<string>Stanford University</string>
<key>NSHighResolutionCapable</key>
<true/>
<key>NSSupportsAutomaticGraphicsSwitching</key>
<true/>
<key>LSRequiresNativeExecution</key>
<true/>
</dict>
</plist>

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
setlocal
cd /d %~dp0
java ${conf.extra.args} -DentityExpansionLimit=100000000 -Dlogback.configurationFile=conf/logback-win.xml -Dfile.encoding=utf-8 -Dorg.protege.plugin.dir=plugins -classpath bundles/guava.jar;bundles/logback-classic.jar;bundles/logback-core.jar;bundles/slf4j-api.jar;bundles/glassfish-corba-orb.jar;bundles/org.apache.felix.main.jar;bundles/maven-artifact.jar;bundles/protege-launcher.jar org.protege.osgi.framework.Launcher %1

View File

@ -0,0 +1,7 @@
cd "$(dirname "$0")"
CMD_OPTIONS="-Dapple.laf.useScreenMenuBar=true -Dcom.apple.mrj.application.apple.menu.about.name=Protege -Xdock:name=Protege -Xdock:icon=app/Protege.icns" sh run.sh $1

View File

@ -0,0 +1,39 @@
#!/usr/bin/env bash
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
cd "$( cd -P "$( dirname "$SOURCE" )" && pwd )"
conf_file=
if [ -f "$HOME/.Protege/conf/jvm.conf" ]; then
conf_file="$HOME/.Protege/conf/jvm.conf"
elif [ -f conf/jvm.conf ]; then
conf_file=conf/jvm.conf
fi
EXTRA_JVM_OPTIONS=
EFFECTIVE_JAVA_HOME=
if [ -n "$conf_file" ]; then
EXTRA_JVM_OPTIONS=$(sed -n 's/^max_heap_size=/-Xmx/p; s/^min_heap_size=/-Xms/p; s/^stack_size=/-Xss/p; s/^append=//p;' "$conf_file" | tr '\n' ' ')
EFFECTIVE_JAVA_HOME=$(sed -n 's/^java_home=//p' "$conf_file")
fi
[ -z "$EFFECTIVE_JAVA_HOME" ] && EFFECTIVE_JAVA_HOME="$PROTEGE_JAVA_HOME"
[ -z "$EFFECTIVE_JAVA_HOME" -a ! -d jre ] && EFFECTIVE_JAVA_HOME="$JAVA_HOME"
[ -z "$EFFECTIVE_JAVA_HOME" ] && EFFECTIVE_JAVA_HOME="jre"
$EFFECTIVE_JAVA_HOME/bin/java \
-DentityExpansionLimit=100000000 \
-Dlogback.configurationFile=conf/logback.xml \
-Dfile.encoding=UTF-8 \
${conf.extra.args} \
--add-opens=java.desktop/sun.swing=ALL-UNNAMED \
-classpath bundles/guava.jar:bundles/logback-classic.jar:bundles/logback-core.jar:bundles/slf4j-api.jar:bundles/glassfish-corba-orb.jar:bundles/org.apache.felix.main.jar:bundles/maven-artifact.jar:bundles/protege-launcher.jar \
$CMD_OPTIONS $EXTRA_JVM_OPTIONS org.protege.osgi.framework.Launcher $1

BIN
protege-desktop/src/main/env/win/Protege.exe vendored Executable file

Binary file not shown.

View File

@ -0,0 +1,8 @@
# The preferred way to pass Java options to Protege is to use the
# conf/jvm.conf file. The present file is ignored if conf/jvm.conf
# contains at least one option.
# To use this file, make sure the conf/jvm.conf file does not contain
# any option, then append Java options below, one per line.
# For example, to set the maximal heap size to 8GB, uncomment the
# following line:
#-Xmx8G

View File

@ -0,0 +1,3 @@
setlocal
cd /d %~dp0
jre\bin\java ${conf.extra.args} -DentityExpansionLimit=100000000 -Dlogback.configurationFile=conf/logback-win.xml -Dfile.encoding=utf-8 -Dorg.protege.plugin.dir=plugins -classpath bundles/guava.jar;bundles/logback-classic.jar;bundles/logback-core.jar;bundles/slf4j-api.jar;bundles/glassfish-corba-orb.jar;bundles/org.apache.felix.main.jar;bundles/maven-artifact.jar;bundles/protege-launcher.jar org.protege.osgi.framework.Launcher %1

View File

@ -0,0 +1,55 @@
<?xml version = "1.0" encoding = "UTF-8"?>
<launch>
<systemProperties>
<property name="file.encoding" value="utf-8"/>
<property name="apple.laf.useScreenMenuBar" value="true"/>
<property name="com.apple.mrj.application.growbox.intrudes" value="true"/>
<property name="org.protege.plugin.dir" value="plugins"/>
</systemProperties>
<frameworkProperties>
<property name="org.osgi.framework.bootdelegation" value="sun.*,com.sun.*,apple.*,com.apple.*"/>
<property name="org.osgi.framework.system.packages.extra"
value="javax.xml.parsers,org.xml.sax,org.xml.sax.ext,org.xml.sax.helpers"/>
<property name="org.osgi.framework.storage.clean"
value="onFirstInit"/>
<property name="org.osgi.service.http.port" value="8081"/>
</frameworkProperties>
<!--
We need to start things at different levels.
Protege common needs starting first because it sets up the required XML parsing machinery. Without this
The equinox stuff fails.
-->
<bundles>
<search path="bundles"/>
<search path="${user.home}/.Protege/bundles"/>
<!-- Just start the org.protege.common bundle here -->
<bundle name="protege-common.jar"/>
</bundles>
<bundles>
<search path="bundles"/>
<search path="${user.home}/.Protege/bundles"/>
<!-- Just start the eclipse equinox framework here -->
<bundle name="org.eclipse.equinox.common.jar"/>
<bundle name="org.eclipse.equinox.supplement.jar"/>
</bundles>
<bundles>
<search path="bundles"/>
<search path="${user.home}/.Protege/bundles"/>
<bundle name="org.eclipse.equinox.registry.jar"/>
<bundle name="org.protege.jaxb.jar"/>
<bundle name="protege-editor-core.jar"/>
</bundles>
<!-- Start everything else -->
<bundles>
<search path="bundles"/>
<search path="${user.home}/.Protege/bundles"/>
</bundles>
<bundles>
<search path="plugins"/>
<search path="${user.home}/.Protege/plugins"/>
</bundles>
</launch>

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="10 seconds">
<appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<Pattern>%msg %n</Pattern>
</encoder>
</appender>
<appender name="files" class="ch.qos.logback.core.FileAppender">
<file>${user.home}/.Protege/logs/protege.log</file>
<append>true</append>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<Pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{0} %msg%n</Pattern>
</encoder>
</appender>
<root level="info">
<appender-ref ref="stdout" />
<appender-ref ref="files"/>
</root>
</configuration>

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="10 seconds">
<appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<Pattern>%highlight(%msg) %n</Pattern>
</encoder>
</appender>
<appender name="files" class="ch.qos.logback.core.FileAppender">
<file>${user.home}/.Protege/logs/protege.log</file>
<append>true</append>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<Pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{0} %msg%n</Pattern>
</encoder>
</appender>
<root level="info">
<appender-ref ref="stdout" />
<appender-ref ref="files"/>
</root>
</configuration>

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

View File

@ -0,0 +1,43 @@
---
# The name of the profile. This is displayed in the user interface.
name: Basic
# A description of the profile. This is displayed in the user interface when deprecating an entity.
description: >
A profile for deprecation of OWL entities that uses basic built in OWL vocabulary
to mark the entity as deprecated. Labels (rdfs:label), comments (rdfs:comment) and
and textual definitions (skos:definition) annotations are preserved and marked as being
deprecated.
# Specifies a prefix
labelPrefix: DEPRECATED
# Specifies whether or not the logical definition of the deprecated entity should be removed
# a value of true means that the logical definition will be removed. A value of false means that
# the logical definition will not be removed
removeLogicalDefinition: true
# Specifies whether or not non-preserved annotations on the deprecated entity will be removed.
# See the preservedAnnotationAssertionPropertyIris property.
removeAnnotationAssertions: true
# A list of annotation properties that will be preserved (not removed) during the deprecation.
# It is not necessary to list rdfs:label as this is treated in a special way and not removed
preservedAnnotationAssertionPropertyIris:
- rdfs:comment
- skos:definition
# Preserved annotations will be prefixed with this string
annotationValuePrefix: DEPRECATED
# If the deprecated entity has a direct replacement entity then this entity will be pointed to
# with an annotation along the annotation property specified here.
replacedByAnnotationPropertyIri: rdfs:seeAlso
# If the deprecated entity does not have a direct replacement then it may be annotated with alternate
# entities using the annotation property specified here
alternateEntityAnnotationPropertyIri: rdfs:seeAlso
# The annotation property that is used to provide an annotation that specifies a textual explanation
# as to why the entity was deprecated
textualReasonAnnotationPropertyIri: rdfs:comment

View File

@ -0,0 +1,13 @@
---
name: Gene Ontology (GO)
description: A profile for obsoletion of entities in the Gene Ontology (GO)
activatedBy: http://purl.obolibrary.org/obo/go.owl
removeLogicalDefinition: true
removeAnnotationAssertions: false
alternateEntityAnnotationPropertyIri: http://www.geneontology.org/formats/oboInOwl#consider
replacedByAnnotationPropertyIri: IAO:0100001
labelPrefix: obsolete
annotationValuePrefix: OBSOLETE.
preservedAnnotationAssertionPropertyIris:
- IAO:0000115
textualReasonAnnotationPropertyIri: rdfs:comment

View File

@ -0,0 +1,50 @@
---
# The name of the profile. This is displayed in the user interface.
name: Ontology for Biomedical Investigation (OBI)
# A description of the profile. This is displayed in the user interface when deprecating an entity.
description: >
A profile for obsoletion of OWL entities in the Ontology for Biomedical Investigation (OBI)
# Activated by the OBI ontology
activatedBy: http://purl.obolibrary.org/obo/obi.owl
# Specifies a prefix - NB Some terms in OBI are prefixed with "obsolete_" and others with "obsolete "
labelPrefix: obsolete_
# Specifies whether or not the logical definition of the deprecated entity should be removed
# a value of true means that the logical definition will be removed. A value of false means that
# the logical definition will not be removed
removeLogicalDefinition: true
# Specifies whether or not non-preserved annotations on the deprecated entity will be removed.
# See the preservedAnnotationAssertionPropertyIris property.
removeAnnotationAssertions: false
# A list of annotation properties that will be preserved (not removed) during the deprecation.
# It is not necessary to list rdfs:label as this is treated in a special way and not removed
preservedAnnotationAssertionPropertyIris:
- IAO:0000111 # Editor preferred term
# Preserved annotations will be prefixed with this string
annotationValuePrefix: obsolete_
# If the deprecated entity has a direct replacement entity then this entity will be pointed to
# with an annotation along the annotation property specified here.
replacedByAnnotationPropertyIri: IAO:0100001
# If the deprecated entity does not have a direct replacement then it may be annotated with alternate
# entities using the annotation property specified here
alternateEntityAnnotationPropertyIri: rdfs:seeAlso
# The annotation property that is used to provide an annotation that specifies a textual explanation
# as to why the entity was deprecated
textualReasonAnnotationPropertyIri: IAO:0000116
deprecatedClassParentIri: http://www.geneontology.org/formats/oboInOwl#ObsoleteClass
deprecationCode:
property: IAO:0000231 # has obsolesence reason
valueSet:
type: Individuals
classIri: IAO:0000225 # Obsolescence reason specification

View File

@ -0,0 +1,2 @@
# Uncomment the line below to set the maximal heap size to 8G
#max_heap_size=8G

BIN
protege-editor-core/.DS_Store vendored Normal file

Binary file not shown.

133
protege-editor-core/pom.xml Normal file
View File

@ -0,0 +1,133 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>edu.stanford.protege</groupId>
<artifactId>protege-parent</artifactId>
<version>5.6.6</version>
<relativePath>../</relativePath>
</parent>
<!-- groupId and version are inherited from the parent -->
<artifactId>protege-editor-core</artifactId>
<packaging>bundle</packaging>
<name>protege-editor-core</name>
<description>Core ontology editing infrastructure used by the Protege desktop application.</description>
<dependencies>
<dependency>
<groupId>edu.stanford.protege</groupId>
<artifactId>protege-launcher</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>com.googlecode.mdock</groupId>
<artifactId>mdock</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.jgoodies</groupId>
<artifactId>jgoodies-looks</artifactId>
<version>2.7.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.jgoodies</groupId>
<artifactId>jgoodies-common</artifactId>
<version>1.8.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.auto.value</groupId>
<artifactId>auto-value-annotations</artifactId>
</dependency>
<dependency>
<groupId>com.google.auto.value</groupId>
<artifactId>auto-value</artifactId>
</dependency>
<dependency>
<groupId>net.sf.trove4j</groupId>
<artifactId>core</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-Activator>org.protege.editor.core.ProtegeApplication</Bundle-Activator>
<Bundle-SymbolicName>org.protege.editor.core.application;singleton:=true</Bundle-SymbolicName>
<Embed-Dependency>*;scope=provided;inline=true</Embed-Dependency>
<Export-Package>
org.protege.editor.core.*,
</Export-Package>
<_exportcontents>
!com.jgoodies.looks.plastic.icons.*,
org.coode.mdock.*,
com.jgoodies.*,
gnu.trove.*
</_exportcontents>
<Import-Package>
!com.sun.*,
!com.apple.*,
!sun.swing,
org.eclipse.core.runtime;registry="split",
*
</Import-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>ide</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -0,0 +1,118 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.protege.editor.core.application">
<annotation>
<appInfo>
<meta.schema plugin="org.protege.editor.core.application" id="EditorKitFactory" name="EditorKitFactory"/>
</appInfo>
<documentation>
[Enter description of this extension point.]
</documentation>
</annotation>
<element name="extension">
<complexType>
<sequence>
<element ref="label"/>
<element ref="class"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
<documentation>
</documentation>
<appInfo>
<meta.attribute translatable="true"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="label">
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="class">
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
<documentation>
The name of the EditorKitFactoryClass that will be instantiated. This must implement the EditorKitFactory inferface
</documentation>
<appInfo>
<meta.attribute kind="java" basedOn=":org.protege.editor.core.editorkit.EditorKitFactory"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appInfo>
<meta.section type="since"/>
</appInfo>
<documentation>
[Enter the first release in which this extension point appears.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="examples"/>
</appInfo>
<documentation>
[Enter extension point usage example here.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="apiInfo"/>
</appInfo>
<documentation>
[Enter API information here.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="implementation"/>
</appInfo>
<documentation>
[Enter information about supplied implementation of this extension point.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="copyright"/>
</appInfo>
<documentation>
</documentation>
</annotation>
</schema>

View File

@ -0,0 +1,115 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.protege.editor.core.application" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appInfo>
<meta.schema plugin="org.protege.editor.core.application" id="EditorKitFactory" name="EditorKitFactory"/>
</appInfo>
<documentation>
[Enter description of this extension point.]
</documentation>
</annotation>
<element name="extension">
<annotation>
<appInfo>
<meta.element />
</appInfo>
</annotation>
<complexType>
<sequence>
<element ref="class"/>
<element ref="editorKitId"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
<documentation>
</documentation>
<appInfo>
<meta.attribute translatable="true"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="class">
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
<documentation>
The name of the EditorKitFactoryClass that will be instantiated. This must implement the EditorKitFactory inferface
</documentation>
<appInfo>
<meta.attribute kind="java" basedOn="org.protege.editor.core.editorkit.plugin.EditorKitHook:"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="editorKitId">
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appInfo>
<meta.section type="since"/>
</appInfo>
<documentation>
[Enter the first release in which this extension point appears.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="examples"/>
</appInfo>
<documentation>
[Enter extension point usage example here.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="apiInfo"/>
</appInfo>
<documentation>
[Enter API information here.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="implementation"/>
</appInfo>
<documentation>
[Enter information about supplied implementation of this extension point.]
</documentation>
</annotation>
</schema>

View File

@ -0,0 +1,233 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.protege.editor.core.application" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appInfo>
<meta.schema plugin="org.protege.editor.core.application" id="EditorKitMenuAction" name="EditorKitMenuAction"/>
</appInfo>
<documentation>
[Enter description of this extension point.]
</documentation>
</annotation>
<element name="extension">
<annotation>
<appInfo>
<meta.element />
</appInfo>
</annotation>
<complexType>
<sequence>
<element ref="name"/>
<element ref="icon" minOccurs="0" maxOccurs="1"/>
<element ref="toolTip" minOccurs="0" maxOccurs="1"/>
<element ref="class" minOccurs="0" maxOccurs="1"/>
<element ref="url" minOccurs="0" maxOccurs="1"/>
<element ref="path"/>
<element ref="accelerator" minOccurs="0" maxOccurs="1"/>
<element ref="editorKitId"/>
<element ref="dynamic" minOccurs="0" maxOccurs="1"/>
<element ref="checkbox" minOccurs="0" maxOccurs="1"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
<documentation>
</documentation>
<appInfo>
<meta.attribute translatable="true"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="name">
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="icon">
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="toolTip">
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="class">
<annotation>
<documentation>
The class that gets instantiated to represent the action
note that this parameter in none-or-one, since sub menus don&apos;t
have action
</documentation>
</annotation>
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
<documentation>
</documentation>
<appInfo>
<meta.attribute kind="java" basedOn="org.protege.editor.core.ui.action.ProtegeAction:"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="url">
<annotation>
<documentation>
If the url is set and no class is specified then this action will
open a browser at the specified location.
If the class is specified, this parameter is ignored.
</documentation>
</annotation>
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="path">
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="accelerator">
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="editorKitId">
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="dynamic">
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="checkbox">
<complexType>
<attribute name="value" type="boolean">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appInfo>
<meta.section type="since"/>
</appInfo>
<documentation>
[Enter the first release in which this extension point appears.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="examples"/>
</appInfo>
<documentation>
[Enter extension point usage example here.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="apiInfo"/>
</appInfo>
<documentation>
[Enter API information here.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="implementation"/>
</appInfo>
<documentation>
[Enter information about supplied implementation of this extension point.]
</documentation>
</annotation>
</schema>

View File

@ -0,0 +1,127 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.protege.editor.core.application" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appInfo>
<meta.schema plugin="org.protege.editor.core.application" id="OntologyLoader" name="Ontology Loader"/>
</appInfo>
<documentation>
[Enter description of this extension point.]
</documentation>
</annotation>
<element name="extension">
<annotation>
<appInfo>
<meta.element />
</appInfo>
</annotation>
<complexType>
<sequence>
<element ref="class"/>
<element ref="editorKit"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
<documentation>
</documentation>
<appInfo>
<meta.attribute translatable="true"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="class">
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
<documentation>
</documentation>
<appInfo>
<meta.attribute kind="java" basedOn=":org.protege.editor.core.OntologyBuilder"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="editorKit">
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="name">
<complexType>
<attribute name="value" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appInfo>
<meta.section type="since"/>
</appInfo>
<documentation>
[Enter the first release in which this extension point appears.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="examples"/>
</appInfo>
<documentation>
[Enter extension point usage example here.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="apiinfo"/>
</appInfo>
<documentation>
[Enter API information here.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="implementation"/>
</appInfo>
<documentation>
[Enter information about supplied implementation of this extension point.]
</documentation>
</annotation>
</schema>

View File

@ -0,0 +1,99 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.protege.editor.core.application" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appInfo>
<meta.schema plugin="org.protege.editor.core.application" id="OntologyRepositoryFactory" name="Ontology Repository Factory"/>
</appInfo>
<documentation>
[Enter description of this extension point.]
</documentation>
</annotation>
<element name="extension">
<annotation>
<appInfo>
<meta.element />
</appInfo>
</annotation>
<complexType>
<attribute name="point" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
<documentation>
</documentation>
<appInfo>
<meta.attribute translatable="true"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="class">
<complexType>
<attribute name="value" type="string">
<annotation>
<documentation>
</documentation>
<appInfo>
<meta.attribute kind="java" basedOn="org.protege.editor.core.OntologyRepositoryFactory:"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appInfo>
<meta.section type="since"/>
</appInfo>
<documentation>
[Enter the first release in which this extension point appears.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="examples"/>
</appInfo>
<documentation>
[Enter extension point usage example here.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="apiinfo"/>
</appInfo>
<documentation>
[Enter API information here.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="implementation"/>
</appInfo>
<documentation>
[Enter information about supplied implementation of this extension point.]
</documentation>
</annotation>
</schema>

View File

@ -0,0 +1,161 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.protege.editor.core.application" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appInfo>
<meta.schema plugin="org.protege.editor.core.application" id="EditorKitMenuAction" name="EditorKitMenuAction"/>
</appInfo>
<documentation>
[Enter description of this extension point.]
</documentation>
</annotation>
<element name="extension">
<annotation>
<appInfo>
<meta.element />
</appInfo>
</annotation>
<complexType>
<sequence>
<element ref="name"/>
<element ref="icon" minOccurs="0" maxOccurs="1"/>
<element ref="toolTip" minOccurs="0" maxOccurs="1"/>
<element ref="class"/>
<element ref="sortIndex"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
<documentation>
</documentation>
<appInfo>
<meta.attribute translatable="true"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="name">
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="icon">
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="toolTip">
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="class">
<annotation>
<documentation>
The class that gets instantiated to represent the action
note that this parameter in none-or-one, since sub menus don&apos;t
have action
</documentation>
</annotation>
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
<documentation>
</documentation>
<appInfo>
<meta.attribute kind="java" basedOn="org.protege.editor.core.ui.action.start.AltStartupAction:"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="sortIndex">
<complexType>
<attribute name="value" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appInfo>
<meta.section type="since"/>
</appInfo>
<documentation>
[Enter the first release in which this extension point appears.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="examples"/>
</appInfo>
<documentation>
[Enter extension point usage example here.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="apiInfo"/>
</appInfo>
<documentation>
[Enter API information here.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="implementation"/>
</appInfo>
<documentation>
[Enter information about supplied implementation of this extension point.]
</documentation>
</annotation>
</schema>

View File

@ -0,0 +1,182 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.protege.editor.core.application">
<annotation>
<appInfo>
<meta.schema plugin="org.protege.editor.core.application" id="ToolBarAction" name="ToolBarAction"/>
</appInfo>
<documentation>
[Enter description of this extension point.]
</documentation>
</annotation>
<element name="extension">
<complexType>
<sequence>
<element ref="name"/>
<element ref="icon" minOccurs="0" maxOccurs="1"/>
<element ref="toolTip" minOccurs="0" maxOccurs="1"/>
<element ref="class"/>
<element ref="group"/>
<element ref="groupIndex"/>
<element ref="editorKitId"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
<documentation>
</documentation>
<appInfo>
<meta.attribute translatable="true"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="name">
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="icon">
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="toolTip">
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="class">
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="group">
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="groupIndex">
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="editorKitId">
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appInfo>
<meta.section type="since"/>
</appInfo>
<documentation>
[Enter the first release in which this extension point appears.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="examples"/>
</appInfo>
<documentation>
[Enter extension point usage example here.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="apiInfo"/>
</appInfo>
<documentation>
[Enter API information here.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="implementation"/>
</appInfo>
<documentation>
[Enter information about supplied implementation of this extension point.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="copyright"/>
</appInfo>
<documentation>
</documentation>
</annotation>
</schema>

View File

@ -0,0 +1,170 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.protege.editor.core.application">
<annotation>
<appInfo>
<meta.schema plugin="org.protege.editor.core.application" id="ViewAction" name="ViewAction"/>
</appInfo>
<documentation>
[Enter description of this extension point.]
</documentation>
</annotation>
<element name="extension">
<complexType>
<sequence>
<element ref="tooltip"/>
<element ref="icon"/>
<element ref="class"/>
<element ref="viewId"/>
<element ref="group"/>
<element ref="groupIndex"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
<documentation>
</documentation>
<appInfo>
<meta.attribute translatable="true"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="tooltip">
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="icon">
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="class">
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
<documentation>
</documentation>
<appInfo>
<meta.attribute kind="java"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="viewId">
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="group">
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="groupIndex">
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appInfo>
<meta.section type="since"/>
</appInfo>
<documentation>
[Enter the first release in which this extension point appears.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="examples"/>
</appInfo>
<documentation>
[Enter extension point usage example here.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="apiInfo"/>
</appInfo>
<documentation>
[Enter API information here.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="implementation"/>
</appInfo>
<documentation>
[Enter information about supplied implementation of this extension point.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="copyright"/>
</appInfo>
<documentation>
</documentation>
</annotation>
</schema>

View File

@ -0,0 +1,202 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.protege.editor.core.application" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appInfo>
<meta.schema plugin="org.protege.editor.core.application" id="ViewComponent" name="ViewComponent"/>
</appInfo>
<documentation>
View components provide views within editor kits. The
user is able to configure view tabs using these views and the
docking system that is present in the core system
</documentation>
</annotation>
<element name="extension">
<annotation>
<appInfo>
<meta.element />
</appInfo>
</annotation>
<complexType>
<sequence>
<element ref="label"/>
<element ref="class"/>
<element ref="headerColor" minOccurs="0" maxOccurs="1"/>
<element ref="userCreatable" minOccurs="0" maxOccurs="1"/>
<element ref="category" minOccurs="0" maxOccurs="1"/>
<element ref="documentation" minOccurs="0" maxOccurs="1"/>
<element ref="navigates" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="label">
<annotation>
<documentation>
The label that will appear in the view menu etc.
</documentation>
</annotation>
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="class">
<annotation>
<documentation>
The class that should be instantiated to create the view.
This should extend the ViewComponent class
</documentation>
</annotation>
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
<documentation>
</documentation>
<appInfo>
<meta.attribute kind="java" basedOn="org.protege.editor.core.ui.view.ViewComponent:"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="headerColor">
<annotation>
<documentation>
The colour of the view header
</documentation>
</annotation>
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="userCreatable">
<annotation>
<documentation>
Whether or not the view is user creatable. By default,
the view is user createable. Setting this parameter value to
&quot;false&quot; prevents the user creating a new view
</documentation>
</annotation>
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="category">
<annotation>
<documentation>
Gets the view categorisations, for example &quot;class&quot;,
&quot;property&quot;, &quot;visualisation&quot;. Developers should attempt to
fit in with existing categorisations before inventing their
own.
</documentation>
</annotation>
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
<documentation>
The traditional values for this field are
@org.protege.classcategory
@org.protege.objectpropertycategory
@org.protege.datapropertycategory
@org.protege.annotationpropertycategory
@org.protege.individualcategory
@org.protege.datatypecategory
@org.protege.ontologycategory
Other values can be used but if you want them to display something needs to be put into the ProtegeProperties showing
how they should be displayed in the Views menu.
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="navigates">
<annotation>
<documentation>
The categories of thing that this view can display. This is used by global selection
to determine the suitability of a given view (on a given tab).
</documentation>
</annotation>
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
<documentation>
The traditional values for this field are
@org.protege.classcategory
@org.protege.objectpropertycategory
@org.protege.datapropertycategory
@org.protege.annotationpropertycategory
@org.protege.individualcategory
@org.protege.datatypecategory
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="documentation">
<complexType>
<attribute name="value" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
</schema>

View File

@ -0,0 +1,122 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.protege.editor.core.application">
<annotation>
<appInfo>
<meta.schema plugin="org.protege.editor.core.application" id="WorkspaceTab" name="WorkspaceTab"/>
</appInfo>
<documentation>
</documentation>
</annotation>
<element name="extension">
<complexType>
<sequence>
<element ref="label"/>
<element ref="icon" minOccurs="0" maxOccurs="1"/>
<element ref="class"/>
<element ref="index"/>
<element ref="editorKitId"/>
<element ref="defaultViewConfigFileName" minOccurs="0" maxOccurs="1"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="label">
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="icon">
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="class">
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
<documentation>
</documentation>
<appInfo>
<meta.attribute kind="java" basedOn="org.protege.editor.core.ui.workspace.WorkspaceTab:"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="index">
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="editorKitId">
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="defaultViewConfigFileName">
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
</schema>

View File

@ -0,0 +1,115 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.protege.editor.core.application" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appInfo>
<meta.schema plugin="org.protege.editor.core.application" id="explanationpreferencespanel" name="explanationpreferencespanel"/>
</appInfo>
<documentation>
[Enter description of this extension point.]
</documentation>
</annotation>
<element name="extension">
<annotation>
<appInfo>
<meta.element />
</appInfo>
</annotation>
<complexType>
<sequence>
<element ref="label"/>
<element ref="class"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
<documentation>
</documentation>
<appInfo>
<meta.attribute translatable="true"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="label">
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="class">
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
<documentation>
</documentation>
<appInfo>
<meta.attribute kind="java" basedOn="org.protege.editor.core.ui.preferences.PreferencesPanel:"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appInfo>
<meta.section type="since"/>
</appInfo>
<documentation>
[Enter the first release in which this extension point appears.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="examples"/>
</appInfo>
<documentation>
[Enter extension point usage example here.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="apiInfo"/>
</appInfo>
<documentation>
[Enter API information here.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="implementation"/>
</appInfo>
<documentation>
[Enter information about supplied implementation of this extension point.]
</documentation>
</annotation>
</schema>

View File

@ -0,0 +1,115 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.protege.editor.core.application" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appInfo>
<meta.schema plugin="org.protege.editor.core.application" id="preferencespanel" name="preferencespanel"/>
</appInfo>
<documentation>
[Enter description of this extension point.]
</documentation>
</annotation>
<element name="extension">
<annotation>
<appInfo>
<meta.element />
</appInfo>
</annotation>
<complexType>
<sequence>
<element ref="label"/>
<element ref="class"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
<documentation>
</documentation>
<appInfo>
<meta.attribute translatable="true"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="label">
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="class">
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
<documentation>
</documentation>
<appInfo>
<meta.attribute kind="java" basedOn="org.protege.editor.core.ui.preferences.PreferencesPanel:"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appInfo>
<meta.section type="since"/>
</appInfo>
<documentation>
[Enter the first release in which this extension point appears.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="examples"/>
</appInfo>
<documentation>
[Enter extension point usage example here.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="apiInfo"/>
</appInfo>
<documentation>
[Enter API information here.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="implementation"/>
</appInfo>
<documentation>
[Enter information about supplied implementation of this extension point.]
</documentation>
</annotation>
</schema>

BIN
protege-editor-core/src/.DS_Store vendored Normal file

Binary file not shown.

BIN
protege-editor-core/src/main/.DS_Store vendored Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,57 @@
package org.protege.editor.core;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.HashMap;
import java.util.Map;
/**
* Author: Matthew Horridge<br>
* The University Of Manchester<br>
* Medical Informatics Group<br>
* Date: Mar 17, 2006<br><br>
* matthew.horridge@cs.man.ac.uk<br>
* www.cs.man.ac.uk/~horridgm<br><br>
* An abstract class that implements enough functionality from
* <code>ModelManager</code> to support adding, removing of
* <code>ModelManagerListener</code>s and firing of
* <code>ModelManager</code> events.
*/
public abstract class AbstractModelManager implements ModelManager {
private final Logger logger = LoggerFactory.getLogger(AbstractModelManager.class);
private Map<Object, Disposable> objects = new HashMap<>();
protected AbstractModelManager() {
}
public <T extends Disposable> void put(Object key, T object) {
objects.put(key, object);
}
@SuppressWarnings("unchecked")
public <T extends Disposable> T get(Object key) {
return (T) objects.get(key);
}
public void dispose() {
for (Disposable object : objects.values()){
try {
object.dispose();
}
catch (Exception e) {
logger.error("An error occurred whilst disposing of a model manager object. Object: {}", object, e);
}
}
objects.clear();
}
}

View File

@ -0,0 +1,93 @@
package org.protege.editor.core;
import org.protege.editor.core.prefs.Preferences;
import org.protege.editor.core.prefs.PreferencesManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* Author: Matthew Horridge<br>
* The University Of Manchester<br>
* Bio-Health Informatics Group<br>
* Date: 12-May-2007<br><br>
*/
public class BookMarkedURIManager {
public static final String PREFERENCES_KEY = "BookMarkedURIs";
private static BookMarkedURIManager instance;
private final Logger logger = LoggerFactory.getLogger(BookMarkedURIManager.class);
private BookMarkedURIManager() {
}
public static synchronized BookMarkedURIManager getInstance() {
if (instance == null) {
instance = new BookMarkedURIManager();
}
return instance;
}
protected void dispose() {
instance = null;
}
public Set<URI> getBookMarkedURIs() {
PreferencesManager man = PreferencesManager.getInstance();
Preferences prefs = man.getApplicationPreferences(PREFERENCES_KEY);
List<String> bookmarks = prefs.getStringList(PREFERENCES_KEY, getDefaults());
Set<URI> uris = new HashSet<>();
for (String s : bookmarks) {
try {
uris.add(new URI(s));
}
catch (URISyntaxException e) {
logger.warn("Bookmarked URI syntax error: {}", e.getMessage());
}
}
return uris;
}
public void remove(URI bookMarkedURI) {
PreferencesManager man = PreferencesManager.getInstance();
Preferences prefs = man.getApplicationPreferences(PREFERENCES_KEY);
List<String> bookmarks = prefs.getStringList(PREFERENCES_KEY, getDefaults());
bookmarks.remove(bookMarkedURI.toString());
prefs.putStringList(PREFERENCES_KEY, bookmarks);
}
public void add(URI bookMarkedURI) {
PreferencesManager man = PreferencesManager.getInstance();
Preferences prefs = man.getApplicationPreferences(PREFERENCES_KEY);
List<String> bookmarks = prefs.getStringList(PREFERENCES_KEY, getDefaults());
bookmarks.add(bookMarkedURI.toString());
prefs.putStringList(PREFERENCES_KEY, bookmarks);
}
private static List<String> getDefaults() {
List<String> defaults = new ArrayList<>();
defaults.add("http://protege.stanford.edu/ontologies/pizza/pizza.owl");
defaults.add("http://owl.man.ac.uk/2006/07/sssw/people.owl");
defaults.add("http://protege.stanford.edu/ontologies/koala.owl");
defaults.add("http://protege.stanford.edu/ontologies/camera.owl");
defaults.add("http://protege.stanford.edu/ontologies/travel.owl");
defaults.add("http://www.w3.org/TR/owl-guide/wine.rdf");
return defaults;
}
}

View File

@ -0,0 +1,19 @@
package org.protege.editor.core;
/*
* Copyright (C) 2007, University of Manchester
*
*
*/
/**
* Author: drummond<br>
* http://www.cs.man.ac.uk/~drummond/<br><br>
* The University Of Manchester<br>
* Bio Health Informatics Group<br>
* Date: Sep 15, 2008<br><br>
*/
public interface Disposable {
public void dispose() throws Exception;
}

View File

@ -0,0 +1,47 @@
package org.protege.editor.core;
import java.io.File;
/**
* Author: Matthew Horridge<br>
* The University Of Manchester<br>
* Medical Informatics Group<br>
* Date: 13-Sep-2006<br><br>
* matthew.horridge@cs.man.ac.uk<br>
* www.cs.man.ac.uk/~horridgm<br><br>
*/
public class FileManager {
public static final String DATA_FOLDER_NAME = "Data";
public static final String ONTOLOGY_LIBRARY_FOLDER = "StandardOntologies";
public static final String VIEW_CONFIGURATIONS_FOLDER = "ViewConfigurations";
public static File getDataFolder() {
File f = new File(DATA_FOLDER_NAME);
if (!f.exists()) {
f.mkdirs();
}
return f;
}
public static File getViewConfigurationsFolder() {
File f = new File(getDataFolder(), VIEW_CONFIGURATIONS_FOLDER);
f.mkdirs();
return f;
}
public static File getOntologyLibraryFolder() {
File f = new File(ONTOLOGY_LIBRARY_FOLDER);
if (!f.exists()) {
f.mkdirs();
}
return f;
}
}

View File

@ -0,0 +1,152 @@
package org.protege.editor.core;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.swing.*;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.channels.FileChannel;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
/**
* Author: Matthew Horridge<br>
* The University Of Manchester<br>
* Medical Informatics Group<br>
* Date: 24-Aug-2006<br><br>
* matthew.horridge@cs.man.ac.uk<br>
* www.cs.man.ac.uk/~horridgm<br><br>
*/
public class FileUtils {
private static final Logger logger = LoggerFactory.getLogger(FileUtils.class);
/**
* Copies a file to the specified directory.
* @param file The file to be copied.
* @param directory The directory the file should be copied to.
*/
public static void copyFileToDirectory(File file, File directory) throws IOException {
copyFile(file, directory);
}
/**
* Copies a file to the specified location.
* @param inputFile The file to be copied.
* @param outputFile The directory the file should be copied to.
*/
public static void copyFile(File inputFile, File outputFile) throws IOException {
if (inputFile.isDirectory()){
throw new IOException("Cannot copy file: " + inputFile + " as this is a directory");
}
if (outputFile.isDirectory()){
outputFile = new File(outputFile, inputFile.getName());
}
outputFile.getParentFile().mkdirs();
outputFile.createNewFile();
FileInputStream in = new FileInputStream(inputFile);
FileOutputStream out = new FileOutputStream(outputFile);
FileChannel inc = in.getChannel();
FileChannel outc = out.getChannel();
inc.transferTo(0, inc.size(), outc);
inc.close();
outc.close();
in.close();
out.close();
}
/**
* Attempts to show a File using the native operating
* system file view, for example the Finder on a Mac,
* or Explorer on Windows. This may not work on all
* platforms.
* @param file The file to be shown
*/
public static void showFile(File file) throws IOException {
if (System.getProperty("os.name").contains("Mac")) {
showInFinder(file);
}
else if (System.getProperty("os.name").contains("Windows")) {
showInExplorer(file);
}
else {
logger.debug("showFile not implemented for " + System.getProperty("os.name"));
}
}
/**
* Attempts to show a file in the Finder on a Mac.
* @param file The file to be shown
*/
private static void showInFinder(File file) throws IOException {
// Use applescript to show the item in the Finder
String[] params = new String[]{"osascript", "-e", "set p to \"" + file.getCanonicalPath() + "\"", "-e", "tell application \"Finder\"", "-e", "reveal (POSIX file p) as alias", "-e", "activate", "-e", "end tell",};
Runtime.getRuntime().exec(params);
}
/**
* Attempts to show a file in the Explorer on Windows.
* @param file The file to be shown.
*/
private static void showInExplorer(File file) throws IOException {
String path = file.getCanonicalPath();
if (path.contains(" ")) {
// The path contains spaces, so we must surround it with quotes
path = "\"" + path + "\"";
}
String [] params = new String []{"explorer", "/n,/select," + path};
Runtime.getRuntime().exec(params);
}
public static void deleteRecursively(File file) {
if (file.isDirectory()){
File[] files = file.listFiles();
if (files != null) {
for(File f : files){
deleteRecursively(f);
}
}
}
file.delete();
}
public static File createTempFile(File targetFile) throws IOException {
final String targetName = targetFile.getName();
final int extensionIndex = targetName.lastIndexOf(".");
String filename = targetName.substring(0, extensionIndex);
for (int i=filename.length(); i<3; i++){
filename += "_";
}
return Files.createTempFile(filename, targetName.substring(extensionIndex)).toFile();
}
public static void showLogFile() {
try {
String userHome = System.getProperty("user.home");
Path logFilePath = Paths.get(userHome, ".Protege", "logs", "protege.log");
FileUtils.showFile(logFilePath.toFile());
} catch (IOException e) {
JOptionPane.showMessageDialog(null, "An error occurred whilst trying to show the log file: " + e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
logger.error("An error occurred whilst trying to show a file in the OS: {}", e.getMessage(), e);
}
}
}

View File

@ -0,0 +1,66 @@
package org.protege.editor.core;
import org.protege.editor.core.platform.OSUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.swing.*;
import java.awt.*;
/**
* Matthew Horridge
* Stanford Center for Biomedical Informatics Research
* 17 Jun 16
*/
public class Fonts {
private static final Logger logger = LoggerFactory.getLogger(Fonts.class);
private static final Font OS_X_SMALL_DIALOG_FONT = new Font("Helvetica Neue", Font.PLAIN, 10);
private static final Font OS_X_MEDIUM_DIALOG_FONT = new Font("Helvetica Neue", Font.PLAIN, 11);
private static final Font SMALL_DIALOG_FONT = new Font("Dialog", Font.PLAIN, 10);
private static final Font MEDIUM_DIALOG_FONT = new Font("Dialog", Font.PLAIN, 11);
/**
* Scales the font size in the UI based on a default font size of 12.
* @param fontSize The font size. The scaling factor will be computed from this using a default font size
* of 12. Thus, if fontSize is set to 12 then the scaling factor is 1.0.
*/
public static void updateUIDefaultsFontSize(int fontSize) {
UIDefaults lookAndFeelDefaults = UIManager.getLookAndFeelDefaults();
double scale = fontSize / 12.0;
logger.debug("Font scale factor: {}", scale);
lookAndFeelDefaults.keySet().stream()
.filter(k -> k.toString().toLowerCase().endsWith("font"))
.forEach(k -> {
Font font = (Font) lookAndFeelDefaults.get(k);
if (font != null) {
Font scaledFont = font.deriveFont((float) scale * font.getSize());
// Place the scaled font in the developer defaults then we don't clobber the L&F defaults.
UIManager.put(k, scaledFont);
logger.debug("Set {} to {}", k, scaledFont.getSize());
}
});
}
public static Font getSmallDialogFont() {
if(OSUtils.isOSX()) {
return OS_X_SMALL_DIALOG_FONT;
}
else {
return SMALL_DIALOG_FONT;
}
}
public static Font getMediumDialogFont() {
if(OSUtils.isOSX()) {
return OS_X_MEDIUM_DIALOG_FONT;
}
else {
return MEDIUM_DIALOG_FONT;
}
}
}

View File

@ -0,0 +1,14 @@
package org.protege.editor.core;
/**
* Matthew Horridge
* Stanford Center for Biomedical Informatics Research
* 7 Nov 2016
*/
public interface HasUpdateState {
/**
* Update the state of this object
*/
void updateState();
}

View File

@ -0,0 +1,28 @@
package org.protege.editor.core;
/*
* Copyright (C) 2007, University of Manchester
*
*
*/
import javax.annotation.Nullable;
/**
* Author: Matthew Horridge<br>
* The University Of Manchester<br>
* Medical Informatics Group<br>
* Date: Mar 16, 2006<br><br>
* matthew.horridge@cs.man.ac.uk<br>
* www.cs.man.ac.uk/~horridgm<br><br>
*/
public interface ModelManager extends Disposable {
boolean isDirty();
<T extends Disposable> void put(Object key, T object);
@Nullable
<T extends Disposable> T get(Object key);
}

View File

@ -0,0 +1,39 @@
package org.protege.editor.core;
import java.util.Collection;
import java.util.List;
/*
* Copyright (C) 2008, University of Manchester
*
*
*/
/**
* Author: Matthew Horridge<br> The University Of Manchester<br> Information Management Group<br> Date:
* 18-Oct-2008<br><br>
*/
public interface OntologyRepository extends Disposable {
/**
* Gets the name of the repository
* @return A short name for the repository
*/
String getName();
/**
* Gets a description of the location of the repository
* @return A human readable description of the repository location
*/
String getLocation();
/**
* Ensures the repository is up to date
*/
void refresh();
Collection<OntologyRepositoryEntry> getEntries();
List<Object> getMetaDataKeys();
}

View File

@ -0,0 +1,65 @@
package org.protege.editor.core;
import org.protege.editor.core.editorkit.EditorKit;
import java.net.URI;
/**
* Author: Matthew Horridge<br> The University Of Manchester<br> Information Management Group<br> Date:
* 18-Oct-2008<br><br>
*/
public interface OntologyRepositoryEntry {
/**
* Gets a short human readable name for this entry
* @return A short human readable name
*/
String getOntologyShortName();
/**
* Gets the URI of the ontology that is described by this entry.
* @return The ontology URI.
*/
URI getOntologyURI();
/**
* Gets the physical URI of the ontology that is described by this entry.
* @return The physical URI.
*/
URI getPhysicalURI();
/**
* Gets associated metadata.
* @param key The key that describes the metadata
* @return The metadata or <code>null</code> if there is no metadata associated with this key.
*/
String getMetaData(Object key);
/**
* Gets the editor kit factory ID that should be used to load this ontology.
* @return The ID of the editor kit factory
*/
String getEditorKitId();
/**
* If this ontology gets loaded, this method will be called before loading starts in order to
* provided the opportunity to configure an editorkit (e.g. for specifying an ontology mapper/redirector
* etc. etc.). Any editor kit configuration changes made MUST be reverted in the restoreEditorKit() method.
* @param editorKit The editor kit that will be used to load the ontology.
*/
void configureEditorKit(EditorKit editorKit);
/**
* This method will be called after loading to enable any changes or configuration of the editor kit to be
* reverted/rolled back.
* @param editorKit The editor kit.
*/
void restoreEditorKit(EditorKit editorKit);
}

View File

@ -0,0 +1,22 @@
package org.protege.editor.core;
import org.protege.editor.core.plugin.ProtegePluginInstance;
/*
* Copyright (C) 2008, University of Manchester
*
*
*/
/**
* Author: Matthew Horridge<br> The University Of Manchester<br> Information Management Group<br> Date:
* 18-Oct-2008<br><br>
*/
public abstract class OntologyRepositoryFactory implements ProtegePluginInstance {
/**
* Creates the repository.
* @return An ontology repository.
*/
public abstract OntologyRepository createRepository();
}

View File

@ -0,0 +1,19 @@
package org.protege.editor.core;
import org.protege.editor.core.plugin.ProtegePlugin;
/*
* Copyright (C) 2008, University of Manchester
*
*
*/
/**
* Author: Matthew Horridge<br> The University Of Manchester<br> Information Management Group<br> Date:
* 18-Oct-2008<br><br>
*/
public interface OntologyRepositoryFactoryPlugin extends ProtegePlugin<OntologyRepositoryFactory> {
public static final String EXTENSION_POINT_ID = "OntologyRepositoryFactory";
}

View File

@ -0,0 +1,42 @@
package org.protege.editor.core;
import org.eclipse.core.runtime.IExtension;
import org.protege.editor.core.plugin.ExtensionInstantiator;
import org.protege.editor.core.plugin.JPFUtil;
/*
* Copyright (C) 2008, University of Manchester
*
*
*/
/**
* Author: Matthew Horridge<br> The University Of Manchester<br> Information Management Group<br> Date:
* 18-Oct-2008<br><br>
*/
public class OntologyRepositoryFactoryPluginImpl implements OntologyRepositoryFactoryPlugin {
private IExtension extension;
public OntologyRepositoryFactoryPluginImpl(IExtension extension) {
this.extension = extension;
}
public String getId() {
return extension.getUniqueIdentifier();
}
public String getDocumentation() {
return JPFUtil.getDocumentation(extension);
}
public OntologyRepositoryFactory newInstance() throws ClassNotFoundException, IllegalAccessException,
InstantiationException {
ExtensionInstantiator<OntologyRepositoryFactory> instantiator = new ExtensionInstantiator<>(extension);
return instantiator.instantiate();
}
}

View File

@ -0,0 +1,21 @@
package org.protege.editor.core;
import org.eclipse.core.runtime.IExtension;
import org.protege.editor.core.plugin.AbstractApplicationPluginLoader;
/**
* Author: Matthew Horridge<br> The University Of Manchester<br> Information Management Group<br> Date:
* 18-Oct-2008<br><br>
*/
public class OntologyRepositoryFactoryPluginLoader extends AbstractApplicationPluginLoader<OntologyRepositoryFactoryPlugin> {
public OntologyRepositoryFactoryPluginLoader() {
super(OntologyRepositoryFactoryPlugin.EXTENSION_POINT_ID);
}
protected OntologyRepositoryFactoryPlugin createInstance(IExtension extension) {
return new OntologyRepositoryFactoryPluginImpl(extension);
}
}

View File

@ -0,0 +1,44 @@
package org.protege.editor.core;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
/*
* Copyright (C) 2008, University of Manchester
*
*
*/
/**
* Author: Matthew Horridge<br> The University Of Manchester<br> Information Management Group<br> Date:
* 18-Oct-2008<br><br>
*/
public class OntologyRepositoryManager {
private static OntologyRepositoryManager instance;
private List<OntologyRepository> repositories;
private OntologyRepositoryManager() {
repositories = new ArrayList<>();
}
public static synchronized OntologyRepositoryManager getManager() {
if(instance == null) {
instance = new OntologyRepositoryManager();
}
return instance;
}
public void addRepository(OntologyRepository repository) {
repositories.add(repository);
}
public Collection<OntologyRepository> getOntologyRepositories() {
return Collections.unmodifiableList(repositories);
}
}

View File

@ -0,0 +1,43 @@
package org.protege.editor.core;
import java.awt.*;
/**
* Author: Matthew Horridge<br>
* The University Of Manchester<br>
* Medical Informatics Group<br>
* Date: Mar 22, 2006<br><br>
* matthew.horridge@cs.man.ac.uk<br>
* www.cs.man.ac.uk/~horridgm<br><br>
*/
public class PropertyUtil {
public static Color getColor(String color, Color defaultColor) {
try {
String parseVal = color;
if (parseVal.length() == 8) {
parseVal = parseVal.substring(2, parseVal.length());
}
return new Color(Integer.parseInt(parseVal, 16));
}
catch (Exception e) {
return defaultColor;
}
}
public static boolean getBoolean(String value, boolean defaultValue) {
if (value == null) {
return defaultValue;
}
try {
return Boolean.parseBoolean(value);
}
catch (Exception e) {
return defaultValue;
}
}
}

View File

@ -0,0 +1,622 @@
package org.protege.editor.core;
import com.jgoodies.looks.plastic.PlasticLookAndFeel;
import org.osgi.framework.*;
import org.protege.editor.core.editorkit.EditorKit;
import org.protege.editor.core.editorkit.EditorKitFactoryPlugin;
import org.protege.editor.core.editorkit.EditorKitManager;
import org.protege.editor.core.editorkit.RecentEditorKitManager;
import org.protege.editor.core.log.LogBanner;
import org.protege.editor.core.log.LogManager;
import org.protege.editor.core.log.LogViewImpl;
import org.protege.editor.core.platform.OSGi;
import org.protege.editor.core.platform.OSUtils;
import org.protege.editor.core.platform.PlatformArguments;
import org.protege.editor.core.platform.apple.ProtegeAppleApplication;
import org.protege.editor.core.plugin.PluginUtilities;
import org.protege.editor.core.prefs.Preferences;
import org.protege.editor.core.prefs.PreferencesManager;
import org.protege.editor.core.ui.error.ErrorLogPanel;
import org.protege.editor.core.ui.laf.ProtegeScrollBarUI;
import org.protege.editor.core.ui.progress.BackgroundTaskManager;
import org.protege.editor.core.ui.tabbedpane.CloseableTabbedPaneUI;
import org.protege.editor.core.ui.util.ErrorMessage;
import org.protege.editor.core.ui.util.ProtegePlasticTheme;
import org.protege.editor.core.ui.workspace.Workspace;
import org.protege.editor.core.update.PluginManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.swing.*;
import javax.swing.border.MatteBorder;
import javax.swing.plaf.basic.BasicTreeUI;
import java.awt.*;
import java.io.File;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.*;
import java.util.List;
/*
* Copyright (C) 2007, University of Manchester
*
*
*/
/**
* Author: Matthew Horridge<br>
* The University Of Manchester<br>
* Medical Informatics Group<br>
* Date: Mar 15, 2006<br><br>
* matthew.horridge@cs.man.ac.uk<br>
* www.cs.man.ac.uk/~horridgm<br><br>
* The ProtegeApplication is the main entry point to Protege. The application
* is actually a plugin to the Java Plugin Framework
*/
public class ProtegeApplication implements BundleActivator {
private final static Logger logger = LoggerFactory.getLogger(ProtegeApplication.class);
public static final String BUNDLE_WITHOUT_PLUGIN_XML = "No-Plugin-XML";
public static final String BUNDLE_DIR_PROP = "org.protege.plugin.dir";
public static final String RUN_ONCE = "PROTEGE_OSGI_RUN_ONCE";
public static final String ID = "org.protege.editor.core.application";
public static final String LOOK_AND_FEEL_KEY = "LOOK_AND_FEEL_KEY";
public static final String LOOK_AND_FEEL_CLASS_NAME = "LOOK_AND_FEEL_CLASS_NAME";
private static BundleContext context;
private List<URI> commandLineURIs;
private static BackgroundTaskManager backgroundTaskManager = new BackgroundTaskManager();
private static boolean quitting = false;
private static LogManager logManager = new LogManager(new LogViewImpl());
private boolean initialized = false;
public void start(final BundleContext context) {
logManager.bind();
context.addFrameworkListener(event -> {
if (event.getType() == FrameworkEvent.STARTED) {
reallyStart(context);
}
});
}
public void reallyStart(BundleContext context) {
try {
ProtegeApplication.context = context;
displayPlatform();
initApplication();
if (OSUtils.isOSX()) {
ProtegeAppleApplication.getInstance();
}
ProtegeManager.getInstance().initialise(this);
startApplication();
} catch (Throwable t) {
logger.error("Exception caught starting Protege", t);
}
}
// Called when the application is finally completely shutting down
public void stop(BundleContext context) throws Exception {
BookMarkedURIManager.getInstance().dispose();
RecentEditorKitManager.getInstance().save();
RecentEditorKitManager.getInstance().dispose();
PluginUtilities.getInstance().dispose();
ProtegeManager.getInstance().dispose();
logManager.unbind();
}
/////////////////////////////////////////////////////////////////////////////////
//
// Implementation of ApplicationPlugin
//
/////////////////////////////////////////////////////////////////////////////////
// If this isn't liked info can be replaced with debug.
// It helps with diagnosing problems with the FaCT++ plugin.
private void displayPlatform() {
Bundle thisBundle = context.getBundle();
Version v = PluginUtilities.getBundleVersion(thisBundle);
logger.info(LogBanner.start("Protege"));
logger.info("Protege Desktop");
logger.info("Version {}.{}.{}, Build {}", v.getMajor(), v.getMinor(), v.getMicro(), v.getQualifier());
logger.info("");
logger.info("");
logger.info(LogBanner.start("Platform"));
logger.info("Java: JVM {} Memory: {}M", System.getProperty("java.runtime.version"), getMaxMemoryInMegaBytes());
logger.info("Language: {}, Country: {}", getLang(), getCountry());
logger.info("Framework: {} ({}) ", getFramework(), getFrameworkVersion());
logger.info("OS: {} ({})", getOsName(), getOsVersion());
logger.info("Processor: {}\n", getProcessor());
logger.info(LogBanner.end());
logger.info(LogBanner.start("Plugins"));
int pluginCount = 0;
for (Bundle plugin : context.getBundles()) {
if (isPlugin(plugin)) {
if (isActive(plugin)) {
logger.info("Plugin: {} ({})", getNiceBundleName(plugin), plugin.getVersion());
pluginCount++;
}
else {
logger.warn("Plugin: {} ({}) was not successfully started. " +
"Please see the Protégé log for more details.", getNiceBundleName(plugin), plugin.getVersion());
}
}
}
if (pluginCount == 0) {
logger.info("No plugins installed");
}
logger.info(LogBanner.end());
for (Bundle plugin : context.getBundles()) {
if (isPlugin(plugin)) {
pluginSanityCheck(plugin);
}
}
}
private static String getProcessor() {
return context.getProperty(Constants.FRAMEWORK_PROCESSOR);
}
private static String getOsVersion() {
return context.getProperty(Constants.FRAMEWORK_OS_VERSION);
}
private static String getOsName() {
return context.getProperty(Constants.FRAMEWORK_OS_NAME);
}
private static String getFrameworkVersion() {
return context.getProperty(Constants.FRAMEWORK_VERSION);
}
private static String getFramework() {
return context.getProperty(Constants.FRAMEWORK_VENDOR);
}
private static String getCountry() {
return Locale.getDefault().getCountry();
}
private static String getLang() {
return Locale.getDefault().getLanguage();
}
private static long getMaxMemoryInMegaBytes() {
return (Runtime.getRuntime().maxMemory() / 1000000);
}
private boolean pluginSanityCheck(Bundle b) {
boolean passed = true;
boolean hasPluginXml = (b.getResource("/plugin.xml") != null);
if (b.getHeaders().get(BUNDLE_WITHOUT_PLUGIN_XML) == null && !hasPluginXml) {
logger.debug("\t" + getNiceBundleName(b) + " Plugin has no plugin.xml resource");
passed = false;
}
if (hasPluginXml && !isSingleton(b)) {
logger.warn("\t" + getNiceBundleName(b) + " plugin is not a singleton so its plugin.xml will not be seen by the registry.");
passed = false;
}
return passed;
}
public static boolean isActive(Bundle b) {
return b.getState() == Bundle.ACTIVE;
}
public static boolean isPlugin(Bundle b) {
String location = b.getLocation();
return location != null && location.contains("plugin");
}
public static boolean isSingleton(Bundle b) {
StringBuffer singleton1 = new StringBuffer(Constants.SINGLETON_DIRECTIVE);
singleton1.append(":=true");
StringBuffer singleton2 = new StringBuffer(Constants.SINGLETON_DIRECTIVE);
singleton2.append(":=\"true\"");
return ((String) b.getHeaders().get(Constants.BUNDLE_SYMBOLICNAME)).contains(singleton1.toString()) ||
((String) b.getHeaders().get(Constants.BUNDLE_SYMBOLICNAME)).contains(singleton2.toString());
}
public static String getNiceBundleName(Bundle b) {
String name = (String) b.getHeaders().get(Constants.BUNDLE_NAME);
if (name == null) {
name = b.getSymbolicName();
}
return name;
}
protected ProtegeApplication initApplication() throws Exception {
try {
PluginUtilities.getInstance().initialise(context);
loadDefaults();
initializeLookAndFeel();
setupExceptionHandler();
processCommandLineURIs(); // plugins may set arguments
loadRecentEditorKits();
} finally {
initialized = true;
}
return this;
}
private static void loadDefaults() {
ProtegeProperties.getInstance().put(ProtegeProperties.CLASS_COLOR_KEY, "CFA500"); //"CCA33D"
ProtegeProperties.getInstance().put(ProtegeProperties.PROPERTY_COLOR_KEY, "0079BA");
ProtegeProperties.getInstance().put(ProtegeProperties.OBJECT_PROPERTY_COLOR_KEY, "0079BA");
ProtegeProperties.getInstance().put(ProtegeProperties.DATA_PROPERTY_COLOR_KEY, "38A14A");
ProtegeProperties.getInstance().put(ProtegeProperties.INDIVIDUAL_COLOR_KEY, "874B82");
ProtegeProperties.getInstance().put(ProtegeProperties.ONTOLOGY_COLOR_KEY, "6B47A2");
ProtegeProperties.getInstance().put(ProtegeProperties.ANNOTATION_PROPERTY_COLOR_KEY, "D17A00");
ProtegeProperties.getInstance().put(ProtegeProperties.DATATYPE_COLOR_KEY, "AD3B45");
ProtegeProperties.getInstance().put(ProtegeProperties.CLASS_VIEW_CATEGORY, "Class");
ProtegeProperties.getInstance().put(ProtegeProperties.OBJECT_PROPERTY_VIEW_CATEGORY, "Object property");
ProtegeProperties.getInstance().put(ProtegeProperties.DATA_PROPERTY_VIEW_CATEGORY, "Data property");
ProtegeProperties.getInstance().put(ProtegeProperties.ANNOTATION_PROPERTY_VIEW_CATEGORY, "Annotation property");
ProtegeProperties.getInstance().put(ProtegeProperties.INDIVIDUAL_VIEW_CATEGORY, "Individual");
ProtegeProperties.getInstance().put(ProtegeProperties.DATATYPE_VIEW_CATEGORY, "Datatype");
ProtegeProperties.getInstance().put(ProtegeProperties.ONTOLOGY_VIEW_CATEGORY, "Ontology");
ProtegeProperties.getInstance().put(ProtegeProperties.QUERY_VIEW_CATEGORY, "Query");
ProtegeProperties.getInstance().put(ProtegeProperties.DIFF_VIEW_CATEGORY, "Ontology comparison");
}
private static void loadRecentEditorKits() {
RecentEditorKitManager.getInstance().load();
}
private void initializeLookAndFeel() {
// Just the look and feel
// command line look and feel overrides the protege-specific one
if (System.getProperty("swing.defaultlaf") == null) {
// If the OS is a Mac then the Mac L&F is set by default. I've had too many complaints
// from Mac users that the first thing they do is switch the L&F over to OS X - the Protege
// L&F might be nicer on other platforms with L&Fs like motif, but the OS X L&F looks much better
// than the Protege L&F and, moreover, the keybindings for keys such as copy&paste in the
// Protege L&F are hardcoded to be windows key bindings e.g. Copy is CTRL+C (where as on a
// Mac it should be CMD+C)
// I don't know if Windows users would prefer the Windows L&F to be the default one - although
// the Windows L&F keybindings are the same as the Protege L&F keybindings.
String defaultLAFClassName;
if (OSUtils.isOSX()) {
defaultLAFClassName = UIManager.getSystemLookAndFeelClassName();
}
else {
defaultLAFClassName = ProtegeProperties.PLASTIC_LAF_NAME;
}
Preferences p = PreferencesManager.getInstance().getApplicationPreferences(LOOK_AND_FEEL_KEY);
String lafClsName = p.getString(LOOK_AND_FEEL_CLASS_NAME, defaultLAFClassName);
try {
// This is a workaround for some OSGi "feature". From here http://adamish.com/blog/archives/156.
// Force the Look & Feel to be instantiated.
UIDefaults defaults = UIManager.getDefaults();
if (lafClsName.equals(PlasticLookAndFeel.class.getName())) {
// Truly strange. If we don't do this then the LAF cannot be found.
PlasticLookAndFeel.setCurrentTheme(new ProtegePlasticTheme());
UIManager.put("ClassLoader", PlasticLookAndFeel.class.getClassLoader());
// For plastic this needs to be instantiated here - otherwise SwingUtilities uses the wrong class
// loaded.
LookAndFeel lookAndFeel = (LookAndFeel) Class.forName(lafClsName).newInstance();
UIManager.setLookAndFeel(lookAndFeel);
}
else {
// Now set the class loader for Component UI loading to this one. Works for non Plastic LAFs.
UIManager.put("ClassLoader", this.getClass().getClassLoader());
UIManager.setLookAndFeel(lafClsName);
}
setupDefaults(defaults, lafClsName);
} catch (Exception e) {
logger.error("An error occurred during Look&Feel initialization", e);
}
}
}
private void setupDefaults(UIDefaults defaults, String lafClassName) {
// TODO: Move this to somewhere more sensible
defaults.put("TabbedPaneUI", CloseableTabbedPaneUI.class.getName());
Color borderColor = new Color(220, 220, 220);
MatteBorder commonBorder = BorderFactory.createMatteBorder(1, 1, 1, 1, borderColor);
defaults.put("ScrollPane.border", BorderFactory.createCompoundBorder(commonBorder,
BorderFactory.createEmptyBorder(1, 1, 1, 1)));
defaults.put("TextArea.border", commonBorder);
defaults.put("Spinner.border", commonBorder);
defaults.put("TextField.border", BorderFactory.createCompoundBorder(commonBorder,
BorderFactory.createEmptyBorder(2, 2, 2, 2)));
defaults.put("SplitPane.border",
BorderFactory.createEmptyBorder(0, 0, 0, 0));
defaults.put("TitledBorder.border", commonBorder);
Preferences rendererPrefs = PreferencesManager.getInstance().getApplicationPreferences(
"org.protege.editor.owl.ui.renderer.OWLRendererPreferences"
);
defaults.put("Tree.paintLines", true);
defaults.put("Tree.drawVerticalLines", true);
defaults.put("Tree.drawHorizontalLines", true);
// Set the color for non-Protege LAFS - the line color is too light for the dotted LAF.
if (!ProtegeProperties.PLASTIC_LAF_NAME.equals(lafClassName)) {
defaults.put("Tree.hash", new Color(230, 230, 230));
}
int fontSize = rendererPrefs.getInt("FONT_SIZE", 12);
Fonts.updateUIDefaultsFontSize(fontSize);
}
private void setupExceptionHandler() {
Thread.setDefaultUncaughtExceptionHandler((t, e) -> {
logger.error("Uncaught Exception in thread '{}'", t.getName(), e);
});
}
private void processCommandLineURIs() {
try {
commandLineURIs = new ArrayList<>();
for (String arg : PlatformArguments.getArguments(context)) {
logger.info("Processing command line argument: {}", arg);
File f = new File(arg);
if (f.exists()) {
logger.debug("Command line argument is a file");
commandLineURIs.add(f.toURI());
}
else {
try {
URI uri = new URI(arg);
commandLineURIs.add(uri);
} catch (URISyntaxException e) {
logger.error("An error occurred when processing the command line argument: {}", arg, e);
}
}
}
} catch (Throwable t) { // it is not important enough to stop anything.
logger.warn("Error processing command line arguments " + t);
}
}
/////////////////////////////////////////////////////////////////////////////////
//
// Implementation of Application
//
/////////////////////////////////////////////////////////////////////////////////
private void startApplication() throws Exception {
logger.debug("Starting application");
if (commandLineURIs != null && !commandLineURIs.isEmpty()) {
// Open any command line URIs
for (URI uri : commandLineURIs) {
logger.debug("Opening command line argument: {}", uri);
createAndSetupDefaultEditorKit(uri);
}
}
else {
createAndSetupDefaultEditorKit();
}
checkForUpdates();
}
private void checkForUpdates() {
try {
logger.info(LogBanner.start("Auto-update Check"));
if (!PluginManager.getInstance().isAutoUpdateEnabled()) {
logger.info("Auto-update is disabled");
return;
}
if (hasAutoUpdateBeenRunToday()) {
logger.info("Auto-update has been performed today. Not performing it again.");
return;
}
logger.info("Auto-update has not been performed today. Running it.");
PluginManager.getInstance().runAutoUpdate();
context.addFrameworkListener(new FrameworkListener() {
public void frameworkEvent(FrameworkEvent event) {
if (event.getType() == FrameworkEvent.STARTED) {
context.removeFrameworkListener(this);
}
}
});
} finally {
logger.info(LogBanner.end());
}
}
private boolean hasAutoUpdateBeenRunToday() {
Date lastRun = PluginManager.getInstance().getLastAutoUpdateDate();
logger.info("Auto-update last performed: {}", lastRun);
Date startOfToday = getStartOfToday();
return lastRun.after(startOfToday);
}
private static Date getStartOfToday() {
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
return calendar.getTime();
}
/**
* Gets the default (first) editor kit factory plugin and uses it to create and setup and empty editor kit.
*/
private void createAndSetupDefaultEditorKit() {
try {
logger.info("Creating and setting up empty (default) editor kit");
ProtegeManager pm = ProtegeManager.getInstance();
List<EditorKitFactoryPlugin> editorKitFactoryPlugins = pm.getEditorKitFactoryPlugins();
if (!editorKitFactoryPlugins.isEmpty()) {
EditorKitFactoryPlugin defaultPlugin = editorKitFactoryPlugins.get(0);
pm.createAndSetupNewEditorKit(defaultPlugin);
}
else {
ErrorMessage.showErrorMessage("Fatal Error", "An error occurred that prevented Protégé from starting");
}
} catch (Exception e) {
ErrorLogPanel.showErrorDialog(e);
}
}
private void createAndSetupDefaultEditorKit(final URI uri) {
Runnable runnable = () -> {
try {
logger.info("Creating and setting up (default) editor kit for {}", uri);
ProtegeManager pm = ProtegeManager.getInstance();
List<EditorKitFactoryPlugin> editorKitFactoryPlugins = pm.getEditorKitFactoryPlugins();
if (!editorKitFactoryPlugins.isEmpty()) {
EditorKitFactoryPlugin defaultPlugin = editorKitFactoryPlugins.get(0);
pm.createAndSetupNewEditorKit(defaultPlugin, uri);
}
else {
ErrorMessage.showErrorMessage("Fatal Error", "An error occurred that prevented Protégé from starting");
}
} catch (Exception e) {
ErrorLogPanel.showErrorDialog(e);
}
};
if(SwingUtilities.isEventDispatchThread()) {
runnable.run();
}
else {
logger.debug("Current thread is not Event Dispatch Thread. " +
"Invoking later in the EDT (Current Thread: {})", Thread.currentThread());
SwingUtilities.invokeLater(runnable);
}
}
/////////////////////////////////////////////////////////////////////////////////
//
// Visible Application Interfaces
//
/////////////////////////////////////////////////////////////////////////////////
public static BundleContext getContext() {
return context;
}
// public static ErrorLog getErrorLog() {
// return errorLog;
// }
public static BackgroundTaskManager getBackgroundTaskManager() {
return backgroundTaskManager;
}
public static boolean handleQuit() {
quitting = true;
final EditorKitManager eKitMngr = ProtegeManager.getInstance().getEditorKitManager();
for (EditorKit eKit : eKitMngr.getEditorKits()) {
Workspace wSpace = eKit.getWorkspace();
if (!eKitMngr.getWorkspaceManager().doClose(wSpace)) {
return false;
}
}
try {
boolean forceExit = !OSGi.systemExitHandledByLauncher(); // this call fails after context.getBundle(0).stop()
context.getBundle(0).stop();
// Danger, Will Robinson! Weird territory here - the class loader is no longer working!
// java.lang.IllegalStateException: zip file closed
// at java.util.zip.ZipFile.ensureOpen(ZipFile.java:403)
// at java.util.zip.ZipFile.getEntry(ZipFile.java:148)
// at org.apache.felix.framework.util.ZipFileX.getEntry(ZipFileX.java:52)
// at org.apache.felix.framework.cache.JarContent.getEntryAsBytes(JarContent.java:122)
// at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.findClass(ModuleImpl.java:1816)
// at org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:727)
// at org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:71)
// at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1768)
// at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
// at org.protege.editor.core.ProtegeApplication.handleQuit(ProtegeApplication.java:418)
if (forceExit) {
Thread.sleep(1000);
System.exit(0);
}
} catch (Throwable t) {
logger.error("An error occurred when shutting down Protégé.", t);
}
return true;
}
public void handleClose() {
if (!quitting) {
final EditorKitManager eKitMngr = ProtegeManager.getInstance().getEditorKitManager();
if (eKitMngr.getEditorKitCount() == 0) {
handleQuit();
}
}
}
public void editURI(URI uri) throws Exception {
logger.info("Received request to edit document at {}", uri);
if (initialized) {
logger.info("Application is initialized. Opening URI.");
createAndSetupDefaultEditorKit(uri);
}
else {
logger.info("Application is not initialized. Adding URI to command line URIs.");
commandLineURIs.add(uri);
}
}
public static void handleRestart() {
}
public static void applyLogPreferences() {
logManager.applyPreferences();
}
public static void showLogView() {
logManager.showLogView();
}
public static LogManager getLogManager() {
return logManager;
}
}

View File

@ -0,0 +1,369 @@
package org.protege.editor.core;
import org.protege.editor.core.editorkit.*;
import org.protege.editor.core.ui.workspace.Workspace;
import org.protege.editor.core.ui.workspace.WorkspaceFrame;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.ref.WeakReference;
import java.net.URI;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Author: Matthew Horridge<br> The University Of Manchester<br> Medical Informatics Group<br> Date: Mar 15,
* 2006<br><br>
* <p>
* matthew.horridge@cs.man.ac.uk<br> www.cs.man.ac.uk/~horridgm<br><br>
* <p>
* ProtegeManager is a singleton that manages the Protege application. This means that the <code>ProtegeManager</code>
* manages the creation and deletion of <code>EditorKit</code>s. A list of the installed
* <code>EditorKitFactoryPlugin</code>s
*/
public class ProtegeManager {
public static final Logger logger = LoggerFactory.getLogger(ProtegeManager.class);
private static ProtegeManager instance;
private EditorKitManager editorKitManager;
private Map<EditorKitFactoryPlugin, EditorKitFactory> editorKitFactoriesMap;
private ProtegeApplication application;
private WeakReference<EditorKit> firstEditorKit;
private ProtegeManager() {
editorKitFactoriesMap = new HashMap<>();
EditorKitFactoryPluginLoader loader = new EditorKitFactoryPluginLoader();
for (EditorKitFactoryPlugin plugin : loader.getPlugins()) {
editorKitFactoriesMap.put(plugin, null);
}
setupRepositories();
}
/**
* Gets hold of the one and only <code>ProtegeManager</code>
*/
public static synchronized ProtegeManager getInstance() {
if (instance == null) {
instance = new ProtegeManager();
}
return instance;
}
public void dispose() {
for (OntologyRepository repository : OntologyRepositoryManager.getManager().getOntologyRepositories()) {
try {
repository.dispose();
} catch (Exception e) {
logger.warn("An error occurred whilst trying dispose of the repository '{}': {}", repository.getName(), e);
}
}
instance = null;
}
protected void initialise(ProtegeApplication application) {
this.application = application;
}
public ProtegeApplication getApplication() {
return application;
}
/**
* Gets the <code>EditorKitManager</code>, which controls the selected <code>EditorKit</code> etc. for the
* application.
*/
public EditorKitManager getEditorKitManager() {
if (editorKitManager == null) {
editorKitManager = new EditorKitManager();
}
return editorKitManager;
}
/**
* This is a convenience method that can be used to obtain the top level frame for a <code>Workspace</code>. This
* method actually delegates to the <code>WorkspaceManager</code>
*
* @param workspace The <code>Workspace</code> for which the top level frame is to be retrieved.
* @return The top level frame for a <code>Workspace</code> or <code>null</code> if there is no such
* <code>Workspace</code> or no frame exists.
*/
public WorkspaceFrame getFrame(Workspace workspace) {
return getEditorKitManager().getWorkspaceManager().getFrame(workspace);
}
/**
* Obtains a list of the installed <code>EditorKitFactory</code> plugins. These plugins can be passed to the
* createAndSetupNewEditorKit and openAndSetupNewEditorKit methods.
*/
public List<EditorKitFactoryPlugin> getEditorKitFactoryPlugins() {
return new ArrayList<>(editorKitFactoriesMap.keySet());
}
/**
* Creates and sets up a new (probably empty) . The new <code>EditorKit</code> will be passed to the
* <code>EditorKitManager</code> for installation.
*
* @param plugin The <code>EditorKitFactoryPlugin</code> that describes the <code>EditorKitFactory</code> which will
* be used to create the <code>EditorKit</code>.
*/
public synchronized boolean createAndSetupNewEditorKit(EditorKitFactoryPlugin plugin) throws Exception {
EditorKitFactory editorKitFactory = getEditorKitFactory(plugin);
return createAndSetupNewEditorKit(editorKitFactory) != null;
}
public synchronized EditorKit createAndSetupNewEditorKit(EditorKitFactory editorKitFactory) throws Exception {
logger.debug("[ProtegeManager] Creating and setting up new EditorKit. Factory: {}", editorKitFactory);
if (editorKitFactory != null) {
boolean success = false;
EditorKit editorKit = editorKitFactory.createEditorKit();
try {
if (editorKit.handleNewRequest()) {
getEditorKitManager().addEditorKit(editorKit);
success = true;
if (getEditorKitManager().getEditorKitCount() == 1) {
firstEditorKit = new WeakReference<>(editorKit);
}
return editorKit;
}
} finally {
if (!success) {
editorKit.dispose();
}
}
}
return null;
}
/**
* Creates and sets up a new <code>EditorKit</code> with an ontology specified by a given <code>URI</code>.
*
* @param plugin The <code>EditorKitFactoryPlugin</code> that describes the <code>EditorKitFactory</code> which will
* be used to create the <code>EditorKit</code>.
* @param uri The ontology <code>URI</code> with which the new <code>EditorKit</code> will be instantiated
*/
public synchronized EditorKit createAndSetupNewEditorKit(EditorKitFactory editorKitFactory, URI uri) throws Exception {
logger.debug("[ProtegeManager] Creating and setting up new EditorKit. Factory: {}, URI: {}", editorKitFactory, uri);
if (editorKitFactory != null) {
boolean success = false;
EditorKit editorKit = editorKitFactory.createEditorKit();
try {
if (editorKit.handleLoadFrom(uri)) {
getEditorKitManager().addEditorKit(editorKit);
success = true;
if (getEditorKitManager().getEditorKitCount() == 1) {
firstEditorKit = new WeakReference<>(editorKit);
}
closeFirstEditorKitIfNotModified();
return editorKit;
}
} finally {
if (!success) {
editorKit.dispose();
}
}
}
return null;
}
public synchronized boolean createAndSetupNewEditorKit(EditorKitFactoryPlugin plugin, URI uri) throws Exception {
EditorKitFactory editorKitFactory = getEditorKitFactory(plugin);
return createAndSetupNewEditorKit(editorKitFactory, uri) != null;
}
/**
* Opens an <code>EditorKit</code> using the <code>EditorKitFactory</code> specified by the given Id.
*
* @param plugin The <code>EditorKitFactoryPlugin</code> that describes the <code>EditorKitFactory</code> which will
* be used to create the <code>EditorKit</code>.
*/
public synchronized boolean openAndSetupEditorKit(EditorKitFactoryPlugin plugin) throws Exception {
EditorKitFactory editorKitFactory = getEditorKitFactory(plugin);
if (editorKitFactory != null) {
boolean success = false;
EditorKit editorKit = editorKitFactory.createEditorKit();
try {
if (editorKit.handleLoadRequest()) {
getEditorKitManager().addEditorKit(editorKit);
success = true;
closeFirstEditorKitIfNotModified();
return true;
}
} finally {
if (!success) {
editorKit.dispose();
}
}
}
return false;
}
private void closeFirstEditorKitIfNotModified() {
if (firstEditorKit == null) {
return;
}
EditorKit firstEditorKit = this.firstEditorKit.get();
if (firstEditorKit == null) {
return;
}
EditorKitManager editorKitManager = getEditorKitManager();
if (!firstEditorKit.hasModifiedDocument()) {
editorKitManager.getWorkspaceManager().doClose(firstEditorKit.getWorkspace());
}
}
public synchronized boolean loadAndSetupEditorKitFromURI(EditorKitFactoryPlugin plugin, URI uri) throws Exception {
logger.debug("[ProtegeManager] Creating and loading EditorKit. Factory: {}, URI: {}", plugin, uri);
EditorKitFactory editorKitFactory = getEditorKitFactory(plugin);
if (editorKitFactory != null) {
boolean success = false;
EditorKit editorKit = editorKitFactory.createEditorKit();
try {
if (editorKit.handleLoadFrom(uri)) {
getEditorKitManager().addEditorKit(editorKit);
closeFirstEditorKitIfNotModified();
success = true;
return true;
}
} finally {
if (!success) {
editorKit.dispose();
}
}
}
return false;
}
public boolean openAndSetupRecentEditorKit(EditorKitDescriptor editorKitDescriptor) throws Exception {
for (EditorKitFactoryPlugin plugin : getEditorKitFactoryPlugins()) {
if (plugin.getId().equals(editorKitDescriptor.getEditorKitFactoryID())) {
EditorKitFactory editorKitFactory = getEditorKitFactory(plugin);
EditorKit editorKit = editorKitFactory.createEditorKit();
if (editorKit.handleLoadRecentRequest(editorKitDescriptor)) {
getEditorKitManager().addEditorKit(editorKit);
closeFirstEditorKitIfNotModified();
return true;
}
}
}
return false;
}
/**
* Loads an ontology from an ontology repository. The appropriate editorkit is selected as dictated by the
* repository.
*
* @param entry The repository entry that describes the ontology to be loaded.
* @return <code>true</code> if the ontology was loaded, returns <code>false</code> if an editor kit
* could not be found to load the ontology.
*/
public boolean loadAndSetupEditorKitFromRepository(OntologyRepository repository,
OntologyRepositoryEntry entry) throws Exception {
for (EditorKitFactoryPlugin plugin : getEditorKitFactoryPlugins()) {
String id = plugin.getId();
if (id.equals(entry.getEditorKitId())) {
boolean success = false;
EditorKitFactory editorKitFactory = getEditorKitFactory(plugin);
if (editorKitFactory != null) {
EditorKit editorKit = editorKitFactory.createEditorKit();
try {
entry.configureEditorKit(editorKit);
if (editorKit.handleLoadFrom(entry.getPhysicalURI())) {
getEditorKitManager().addEditorKit(editorKit);
closeFirstEditorKitIfNotModified();
success = true;
}
} finally {
entry.restoreEditorKit(editorKit);
if (!success) {
editorKit.dispose();
}
}
}
return success;
}
}
return false;
}
public void saveEditorKit(EditorKit editorKit) throws Exception {
editorKit.handleSave();
}
public void saveEditorKitAs(EditorKit editorKit) throws Exception {
editorKit.handleSaveAs();
getFrame(editorKit.getWorkspace()).updateTitle();
}
/**
* Closes an <code>EditorKit</code>. This disposes of the editor kit's <code>Workspace</code>, and
* closes the editor kit's model manager.
*/
public void disposeOfEditorKit(EditorKit editorKit) {
ProtegeManager.getInstance().getEditorKitManager().removeEditorKit(editorKit);
try {
editorKit.dispose();
} catch (Exception e) {
logger.warn("An error occurred whilst trying to dispose of the editor kit '{}': {}", editorKit.getOntologyID(), e);
}
System.gc();
application.handleClose();
}
/**
* Gets an <code>EditorKitFactory</code> by its corresponding plugin.
*
* @param plugin The plugin that describes the editor kit that will be returned.
* @return An <code>EditorKitFactory</code> or <code>null</code> if there is no installed
* <code>EditorKitFactory</code> with the specified Id.
*/
public EditorKitFactory getEditorKitFactory(EditorKitFactoryPlugin plugin) {
EditorKitFactory editorKitFactory = editorKitFactoriesMap.get(plugin);
if (editorKitFactory != null) {
return editorKitFactory;
}
EditorKitFactory editorKitFactory1 = plugin.newInstance();
editorKitFactoriesMap.put(plugin, editorKitFactory1);
return editorKitFactory1;
}
private void setupRepositories() {
OntologyRepositoryFactoryPluginLoader loader = new OntologyRepositoryFactoryPluginLoader();
for (OntologyRepositoryFactoryPlugin plugin : loader.getPlugins()) {
try {
OntologyRepositoryFactory factory = plugin.newInstance();
factory.initialise();
OntologyRepositoryManager.getManager().addRepository(factory.createRepository());
}
// CATCH EVERYTHING! We don't want to bring down P4 even before it has appeared to start!
catch (Throwable e) {
logger.warn("An error occurred whilst attempting to load an ontology repository. " +
"Ontology Repository Plugin: ", plugin.getId(), e);
}
}
}
}

View File

@ -0,0 +1,73 @@
package org.protege.editor.core;
import java.util.Properties;
/**
* Author: Matthew Horridge<br>
* The University Of Manchester<br>
* Medical Informatics Group<br>
* Date: Mar 22, 2006<br><br>
* matthew.horridge@cs.man.ac.uk<br>
* www.cs.man.ac.uk/~horridgm<br><br>
*/
public class ProtegeProperties extends Properties {
public static final String PROTEGE = "Prot\u00E9g\u00E9";
public static final String PROTEGE_PREFIX = "org.protege.";
public static final String CLASS_COLOR_KEY = PROTEGE_PREFIX + "classcolor";
public static final String PROPERTY_COLOR_KEY = PROTEGE_PREFIX + "propertycolor";
public static final String OBJECT_PROPERTY_COLOR_KEY = PROTEGE_PREFIX + "objectpropertycolor";
public static final String DATA_PROPERTY_COLOR_KEY = PROTEGE_PREFIX + "datapropertycolor";
public static final String INDIVIDUAL_COLOR_KEY = PROTEGE_PREFIX + "individualcolor";
public static final String ONTOLOGY_COLOR_KEY = PROTEGE_PREFIX + "ontologycolor";
public static final String ANNOTATION_PROPERTY_COLOR_KEY = PROTEGE_PREFIX + "annotationscolor";
public static final String DATATYPE_COLOR_KEY = PROTEGE_PREFIX + "datatypecolor";
public static final String CLASS_VIEW_CATEGORY = PROTEGE_PREFIX + "classcategory";
public static final String OBJECT_PROPERTY_VIEW_CATEGORY = PROTEGE_PREFIX + "objectpropertycategory";
public static final String DATA_PROPERTY_VIEW_CATEGORY = PROTEGE_PREFIX + "datapropertycategory";
public static final String ANNOTATION_PROPERTY_VIEW_CATEGORY = PROTEGE_PREFIX + "annotationpropertycategory";
public static final String INDIVIDUAL_VIEW_CATEGORY = PROTEGE_PREFIX + "individualcategory";
public static final String DATATYPE_VIEW_CATEGORY = PROTEGE_PREFIX + "datatypecategory";
public static final String ONTOLOGY_VIEW_CATEGORY = PROTEGE_PREFIX + "ontologycategory";
public static final String QUERY_VIEW_CATEGORY = PROTEGE_PREFIX + "querycategory";
public static final String DIFF_VIEW_CATEGORY = PROTEGE_PREFIX + "differencecategory";
private static ProtegeProperties instance;
//Default Protege L&F
public static final String PLASTIC_LAF_NAME = "com.jgoodies.looks.plastic.PlasticLookAndFeel";
private ProtegeProperties() {
}
public static synchronized ProtegeProperties getInstance() {
if (instance == null) {
instance = new ProtegeProperties();
}
return instance;
}
}

View File

@ -0,0 +1,64 @@
package org.protege.editor.core.editorkit;
import org.protege.editor.core.Disposable;
import org.protege.editor.core.editorkit.plugin.EditorKitHook;
import org.protege.editor.core.editorkit.plugin.EditorKitHookPlugin;
import org.protege.editor.core.editorkit.plugin.EditorKitHookPluginLoader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.HashMap;
import java.util.Map;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Author: drummond<br>
* http://www.cs.man.ac.uk/~drummond/<br><br>
* The University Of Manchester<br>
* Bio Health Informatics Group<br>
* Date: Oct 15, 2008<br><br>
*/
public abstract class AbstractEditorKit<T extends EditorKitFactory> implements EditorKit {
private final Logger logger = LoggerFactory.getLogger(AbstractEditorKit.class);
private final Map<Object, Disposable> objects = new HashMap<>();
private final T editorKitFactory;
public AbstractEditorKit(@Nonnull T editorKitFactory) {
this.editorKitFactory = checkNotNull(editorKitFactory);
}
public void put(@Nullable Object key, @Nullable Disposable value) {
objects.put(key, value);
}
@Nullable
public Disposable get(@Nullable Object key) {
return objects.get(key);
}
@Nonnull
public T getEditorKitFactory() {
return editorKitFactory;
}
public void dispose(){
for (Disposable object : objects.values()){
try {
object.dispose();
}
catch (Exception e) {
logger.error("An error occurred whilst disposing of an Editor Kit object. Object: ", object, e);
}
}
objects.clear();
}
}

View File

@ -0,0 +1,114 @@
package org.protege.editor.core.editorkit;
import org.protege.editor.core.Disposable;
import org.protege.editor.core.ModelManager;
import org.protege.editor.core.ui.workspace.Workspace;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.net.URI;
/**
* Author: Matthew Horridge<br>
* The University Of Manchester<br>
* Medical Informatics Group<br>
* Date: Mar 15, 2006<br><br>
* <p>
* matthew.horridge@cs.man.ac.uk<br>
* www.cs.man.ac.uk/~horridgm<br><br>
* <p>
* <p>
* <p>
* The EditorKit provides a connection between
* some kind of "ontology model" (or knowledgebase) and
* a UI for that model/knowledgebase. The model, whatever
* it might be is managed by a <code>ModelManager</code>. The
* UI comes in the form of a <code>Workspace</code>.
* <p>
* Each <code>Workspace</code> has a reference to its
* <code>EditorKit</code>, and each <code>ModelManager</code>
* has a reference to its <code>EditorKit</code>.
* <p>
* Each <code>EditorKit</code> has an ID, which determines its
* type. This is used by views, and other plugins such as menu
* items that are only applicable to certain types of <code>EditorKit</code>s.
* For example, an <code>OWLReasoner</code> can only work with an
* <code>OWLEditorKit</code>.
*/
public interface EditorKit extends Disposable {
/**
* Gets the <code>EditorKit</code> Id. This can be used to identify
* the type of <code>EditorKit</code>.
*
* @return A <code>String</code> that represents the <code>EditorKit</code>
* Id.
*/
@Nonnull
String getOntologyID();
void put(@Nullable Object key, @Nullable Disposable value);
@Nullable
Disposable get(Object key);
/**
* Gets the factory that created the editor kit.
*/
@Nonnull
EditorKitFactory getEditorKitFactory();
/**
* Gets the <code>Workspace</code> that is used in the UI to
* display the contents of the editor kit "model".
*/
@Nonnull
Workspace getWorkspace();
/**
* Gets the "model" that the editor kit edits. This will
* probably contain one or more ontologies.
*/
@Nonnull
ModelManager getModelManager();
/**
* Called by the system to initialise the editorkit to an
* "new" or "empty" state. This is typically called in response
* to a File->New request for example.
*
* @return <code>true</code> in an new/empty editorkit and
* model was successfully created. <code>false</code> if the
* intialisation sequence was cancelled or didn't complete.
* @throws Exception This exception is thrown if there were
* errors.
*/
boolean handleNewRequest() throws Exception;
boolean handleLoadRequest() throws Exception;
boolean handleLoadFrom(@Nonnull URI uri) throws Exception;
boolean handleLoadRecentRequest(@Nonnull EditorKitDescriptor descriptor) throws Exception;
void handleSave() throws Exception;
void handleSaveAs() throws Exception;
/**
* Determines if this editor kit has modified the contents if its documents in any way.
*
* @return <code>true</code> if this editor kit has modified the contents of its document, otherwise <code>false</code>.
*/
boolean hasModifiedDocument();
}

View File

@ -0,0 +1,90 @@
package org.protege.editor.core.editorkit;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.io.Serializable;
import java.net.URI;
import java.util.Properties;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Author: Matthew Horridge<br>
* The University Of Manchester<br>
* Medical Informatics Group<br>
* Date: 25-May-2006<br><br>
* matthew.horridge@cs.man.ac.uk<br>
* www.cs.man.ac.uk/~horridgm<br><br>
*/
public final class EditorKitDescriptor implements Serializable {
private static final long serialVersionUID = 1L;
private static final String LABEL_KEY = "EDITOR_KIT_LABEL";
private static final String EDITOR_KIT_FACTORY_ID = "EDITOR_KIT_FACTORY_ID";
private final Properties properties = new Properties();
public EditorKitDescriptor(@Nonnull String label, @Nonnull EditorKitFactory editorKitFactory) {
setEditorKitFactoryID(checkNotNull(editorKitFactory.getId()));
properties.setProperty(LABEL_KEY, checkNotNull(label));
}
/**
* Gets a human readable label that can be used
* in user interfaces etc. to describe the clsdescriptioneditor kit.
*/
@Nonnull
public String getLabel() {
return properties.getProperty(LABEL_KEY);
}
@Nonnull
public String getEditorKitFactoryID() {
return properties.getProperty(EDITOR_KIT_FACTORY_ID);
}
public void setEditorKitFactoryID(@Nonnull String id) {
properties.setProperty(EDITOR_KIT_FACTORY_ID, checkNotNull(id));
}
@Nullable
public String getString(@Nonnull String key) {
return (String) properties.get(checkNotNull(key));
}
public void setString(@Nonnull String key, @Nonnull String value) {
properties.put(key, value);
}
public void setURI(@Nonnull String key, @Nonnull URI uri) {
properties.put(checkNotNull(key), checkNotNull(uri));
}
@Nullable
public URI getURI(@Nonnull String key) {
return (URI) properties.get(key);
}
public boolean equals(Object obj) {
return obj instanceof EditorKitDescriptor && this.getLabel().equals(((EditorKitDescriptor) obj).getLabel());
}
@Nonnull
public String toString() {
return getLabel();
}
}

View File

@ -0,0 +1,53 @@
package org.protege.editor.core.editorkit;
import java.net.URI;
/**
* Author: Matthew Horridge<br>
* The University Of Manchester<br>
* Medical Informatics Group<br>
* Date: Mar 16, 2006<br><br>
* matthew.horridge@cs.man.ac.uk<br>
* www.cs.man.ac.uk/~horridgm<br><br>
* <code>EditorKit</code> factories are responsible
* for creating clsdescriptioneditor kits. They are a type of plugin
* to the application.
*/
public interface EditorKitFactory {
/**
* The <code>EditorKitFactory</code> is a type of plugin,
* and therefore type of extension point to the protege
* application. This member contains the ID of the extension point.
*/
public static final String EXTENSION_POINT_ID = "EditorKitFactory";
/**
* Gets the identifier for this <code>EditorKitFactory</code>.
* @return A <code>String</code> representation of the
* clsdescriptioneditor kit factory.
*/
public String getId();
public boolean canLoad(URI uri);
public EditorKit createEditorKit() throws Exception;
/**
* Determines if the editor kit descriptor is valid. A descriptor
* might not be valid because the original set of files or file that
* the descriptor describes may have been moved or deleted for example.
* @param descriptor The descriptor, which will have the same id as this
* editor kit factory
* @return <code>true</code> if the descriptor is valid, otherwise false.
*/
public boolean isValidDescriptor(EditorKitDescriptor descriptor);
}

View File

@ -0,0 +1,69 @@
package org.protege.editor.core.editorkit;
import org.eclipse.core.runtime.IExtension;
import org.osgi.framework.Bundle;
import org.protege.editor.core.plugin.ExtensionInstantiator;
import org.protege.editor.core.plugin.PluginUtilities;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Author: Matthew Horridge<br>
* The University Of Manchester<br>
* Medical Informatics Group<br>
* Date: Mar 18, 2006<br><br>
* matthew.horridge@cs.man.ac.uk<br>
* www.cs.man.ac.uk/~horridgm<br><br>
* An <code>EditorKitFactoryPlugin</code> encapsulates
* details of an <code>EditorKitFactory</code> plugin.
*/
public class EditorKitFactoryPlugin {
private final Logger logger = LoggerFactory.getLogger(EditorKitFactoryPlugin.class);
private IExtension extension;
public static final String LABEL_PARAM = "label";
public EditorKitFactoryPlugin(IExtension extension) {
this.extension = extension;
}
public String getId() {
return extension.getUniqueIdentifier();
}
/**
* Gets the <code>EditorKitFactory</code> label. This is
* typically used for UI menu items etc.
*/
public String getLabel() {
String param = PluginUtilities.getAttribute(extension, LABEL_PARAM);
if (param == null) {
return "<Error: Label not defined!> " + extension;
}
return param;
}
public EditorKitFactory newInstance() {
try {
Bundle b = PluginUtilities.getInstance().getBundle(extension);
b.start();
ExtensionInstantiator<EditorKitFactory> instantiator = new ExtensionInstantiator<>(extension);
return instantiator.instantiate();
}
catch (Exception e) {
logger.error("An error occurred during editor kit instantiation.", e);
}
return null;
}
}

View File

@ -0,0 +1,40 @@
package org.protege.editor.core.editorkit;
import org.eclipse.core.runtime.IExtension;
import org.protege.editor.core.ProtegeApplication;
import org.protege.editor.core.plugin.DefaultPluginExtensionMatcher;
import org.protege.editor.core.plugin.PluginExtensionFilter;
import java.util.HashSet;
import java.util.Set;
/*
* Copyright (C) 2007, University of Manchester
*
*
*/
/**
* Author: Matthew Horridge<br>
* The University Of Manchester<br>
* Medical Informatics Group<br>
* Date: Mar 18, 2006<br><br>
* matthew.horridge@cs.man.ac.uk<br>
* www.cs.man.ac.uk/~horridgm<br><br>
*/
public class EditorKitFactoryPluginLoader {
public Set<EditorKitFactoryPlugin> getPlugins() {
Set<EditorKitFactoryPlugin> result = new HashSet<>();
PluginExtensionFilter filter = new PluginExtensionFilter(ProtegeApplication.ID,
EditorKitFactory.EXTENSION_POINT_ID,
new DefaultPluginExtensionMatcher());
for (IExtension ext : filter.getExtensions()) {
result.add(new EditorKitFactoryPlugin(ext));
}
return result;
}
}

View File

@ -0,0 +1,83 @@
package org.protege.editor.core.editorkit;
import org.protege.editor.core.ui.workspace.WorkspaceManager;
import java.util.ArrayList;
import java.util.List;
/**
* Author: Matthew Horridge<br>
* The University Of Manchester<br>
* Medical Informatics Group<br>
* Date: Mar 15, 2006<br><br>
* matthew.horridge@cs.man.ac.uk<br>
* www.cs.man.ac.uk/~horridgm<br><br>
*/
public class EditorKitManager {
private List<EditorKit> editorKits;
private WorkspaceManager workspaceManager;
public EditorKitManager() {
editorKits = new ArrayList<>();
workspaceManager = new WorkspaceManager();
}
/**
* Adds a new <code>EditorKit</code> to the list of
* open <code>EditorKits</code>. This will result in
* the <code>EditorKit</code>'s <code>Workspace</code>
* added to the UI. The <code>Workspace</code> will then be
* selected.
* @param editorKit The <code>EditorKit</code> to be added.
* If the manager already has a reference to the specified
* <code>EditorKit</code> then this method doesn't add the
* <code>EditorKit</code> again.
*/
public void addEditorKit(EditorKit editorKit) {
if (!editorKits.contains(editorKit)) {
editorKits.add(editorKit);
workspaceManager.addWorkspace(editorKit.getWorkspace());
}
}
/**
* Removes an open <code>EditorKit</code>. The
* corresponding <code>Workspace</code> will be removed
* from the UI. If the
* <code>EditorKit</code> is not open then this method
* does nothing.
*/
public void removeEditorKit(EditorKit editorKit) {
editorKits.remove(editorKit);
workspaceManager.removeWorkspace(editorKit.getWorkspace());
}
/**
* Gets the <code>WorkspaceManager</code> that corresponds
* to this <code>EditorKitManager</code>. The <code>WorkspaceManager</code>
* is used to manage the "view" part of the editor kit model view controller.
*/
public WorkspaceManager getWorkspaceManager() {
return workspaceManager;
}
/**
* Gets the number of editor kits which are being managed
* by this manager.
*/
public int getEditorKitCount() {
return editorKits.size();
}
public List<EditorKit> getEditorKits(){
return new ArrayList<>(editorKits);
}
}

View File

@ -0,0 +1,32 @@
package org.protege.editor.core.editorkit;
import org.protege.editor.core.editorkit.plugin.EditorKitHook;
import org.protege.editor.core.editorkit.plugin.EditorKitHookPlugin;
import org.protege.editor.core.editorkit.plugin.EditorKitHookPluginLoader;
/**
* Matthew Horridge
* Stanford Center for Biomedical Informatics Research
* 13 Sep 16
*/
public class Initializers {
/**
* Instantiate, initialise and install EditorKitHook plugins for the specified EditorKit
* @param editorKit The EditorKit. Not {@code null}.
*/
public static void loadEditorKitHooks(EditorKit editorKit) {
if(editorKit == null) {
throw new RuntimeException("EditorKit must not be null");
}
for (EditorKitHookPlugin editorKitHookPlugin : new EditorKitHookPluginLoader(editorKit).getPlugins()) {
try {
EditorKitHook instance = editorKitHookPlugin.newInstance();
instance.initialise();
editorKit.put(editorKitHookPlugin.getId(), instance);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
}

View File

@ -0,0 +1,129 @@
package org.protege.editor.core.editorkit;
import org.protege.editor.core.ProtegeManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.prefs.BackingStoreException;
import java.util.prefs.Preferences;
/**
* Author: Matthew Horridge<br>
* The University Of Manchester<br>
* Medical Informatics Group<br>
* Date: 17-Sep-2006<br><br>
* matthew.horridge@cs.man.ac.uk<br>
* www.cs.man.ac.uk/~horridgm<br><br>
*/
public class RecentEditorKitManager {
private final Logger logger = LoggerFactory.getLogger(RecentEditorKitManager.class);
private static RecentEditorKitManager instance;
private List<EditorKitDescriptor> editorKitDescriptors;
public static final String RECENT_EDITOR_KITS_FILE_NAME = "RecentEditorKits";
public static final int MAX_EDITOR_KITS = 10;
public static final String PREFERENCES_KEY = "org.protege.editor.owl.recenteditorkits";
private RecentEditorKitManager() {
editorKitDescriptors = new ArrayList<>();
}
public static synchronized RecentEditorKitManager getInstance() {
if (instance == null) {
instance = new RecentEditorKitManager();
}
return instance;
}
public void dispose() {
instance = null;
}
public List<EditorKitDescriptor> getDescriptors() {
return new ArrayList<>(editorKitDescriptors);
}
public void pruneInvalidDescriptors() {
for(EditorKitFactoryPlugin plugin : ProtegeManager.getInstance().getEditorKitFactoryPlugins()) {
EditorKitFactory factory = plugin.newInstance();
for(Iterator<EditorKitDescriptor> it = editorKitDescriptors.iterator(); it.hasNext(); ) {
if(!factory.isValidDescriptor(it.next())) {
it.remove();
}
}
}
}
public void clear() {
editorKitDescriptors.clear();
}
public void add(EditorKitDescriptor editorKitDescriptor) {
for (Iterator<EditorKitDescriptor> it = editorKitDescriptors.iterator(); it.hasNext();) {
EditorKitDescriptor descriptor = it.next();
if (descriptor.equals(editorKitDescriptor)) {
it.remove();
break;
}
}
editorKitDescriptors.add(0, editorKitDescriptor);
// Chop any off the end
for (int i = MAX_EDITOR_KITS - 1; editorKitDescriptors.size() > MAX_EDITOR_KITS;) {
editorKitDescriptors.remove(i);
}
save();
}
@SuppressWarnings("unchecked")
public void load() {
Preferences userRoot = Preferences.userRoot();
byte [] prefsBytes = userRoot.getByteArray(PREFERENCES_KEY, null);
if (prefsBytes == null) {
return;
}
try {
ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(prefsBytes));
editorKitDescriptors = (List<EditorKitDescriptor>) ois.readObject();
ois.close();
pruneInvalidDescriptors();
}
catch (Exception e) {
logger.info("An error occurred whilst loading the list of recent items: {}", e.getMessage(), e);
}
}
public void save() {
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(bos);
oos.writeObject(editorKitDescriptors);
oos.flush();
oos.close();
// Store in Java prefs
Preferences userRoot = Preferences.userRoot();
userRoot.putByteArray(PREFERENCES_KEY, bos.toByteArray());
userRoot.flush();
}
catch (IOException | BackingStoreException e) {
logger.error("An error occurred whilst saving the list of recent items", e);
}
}
}

View File

@ -0,0 +1,36 @@
package org.protege.editor.core.editorkit.plugin;
import org.protege.editor.core.editorkit.EditorKit;
import org.protege.editor.core.plugin.ProtegePluginInstance;
/*
* Copyright (C) 2007, University of Manchester
*
*
*/
/**
* Author: drummond<br>
* http://www.cs.man.ac.uk/~drummond/<br><br>
* The University Of Manchester<br>
* Bio Health Informatics Group<br>
* Date: Oct 15, 2008<br><br>
*
* A plugin that gets initialised when the editor kit has been created.
* Can be used to customise the editor kit or model manager
* without having to add a UI component. Not that the workspace will be available but will not have been initialised
* when an EditorKitHook plugin is initialised.
*
*/
public abstract class EditorKitHook implements ProtegePluginInstance {
private EditorKit editorKit;
protected void setup(EditorKit editorKit) {
this.editorKit = editorKit;
}
protected EditorKit getEditorKit() {
return editorKit;
}
}

View File

@ -0,0 +1,21 @@
package org.protege.editor.core.editorkit.plugin;
import org.protege.editor.core.plugin.ProtegePlugin;
/*
* Copyright (C) 2007, University of Manchester
*
*
*/
/**
* Author: drummond<br>
* http://www.cs.man.ac.uk/~drummond/<br><br>
* The University Of Manchester<br>
* Bio Health Informatics Group<br>
* Date: Oct 15, 2008<br><br>
*/
public interface EditorKitHookPlugin extends ProtegePlugin<EditorKitHook> {
public static final String EXTENSION_POINT_ID = "EditorKitHook";
}

View File

@ -0,0 +1,32 @@
package org.protege.editor.core.editorkit.plugin;
import org.eclipse.core.runtime.IExtension;
import org.protege.editor.core.editorkit.EditorKit;
import org.protege.editor.core.plugin.AbstractProtegePlugin;
/**
* Author: drummond<br>
* http://www.cs.man.ac.uk/~drummond/<br><br>
* The University Of Manchester<br>
* Bio Health Informatics Group<br>
* Date: Oct 15, 2008<br><br>
*/
public class EditorKitHookPluginImpl extends AbstractProtegePlugin<EditorKitHook> implements EditorKitHookPlugin {
private EditorKit editorKit;
public EditorKitHookPluginImpl(IExtension iExtension, EditorKit editorKit) {
super(iExtension);
this.editorKit = editorKit;
}
public EditorKitHook newInstance() throws ClassNotFoundException, IllegalAccessException,
InstantiationException {
EditorKitHook instance = super.newInstance();
instance.setup(editorKit);
return instance;
}
}

View File

@ -0,0 +1,34 @@
package org.protege.editor.core.editorkit.plugin;
import org.eclipse.core.runtime.IExtension;
import org.protege.editor.core.editorkit.EditorKit;
import org.protege.editor.core.plugin.AbstractApplicationPluginLoader;
import org.protege.editor.core.plugin.EditorKitExtensionMatcher;
import org.protege.editor.core.plugin.PluginExtensionMatcher;
/**
* Author: drummond<br>
* http://www.cs.man.ac.uk/~drummond/<br><br>
* The University Of Manchester<br>
* Bio Health Informatics Group<br>
* Date: Oct 15, 2008<br><br>
*/
public class EditorKitHookPluginLoader extends AbstractApplicationPluginLoader<EditorKitHookPlugin> {
private EditorKit editorKit;
public EditorKitHookPluginLoader(EditorKit editorKit) {
super(EditorKitHookPlugin.EXTENSION_POINT_ID);
this.editorKit = editorKit;
}
@Override
protected PluginExtensionMatcher getExtensionMatcher() {
return new EditorKitExtensionMatcher(editorKit);
}
protected EditorKitHookPlugin createInstance(IExtension extension) {
return new EditorKitHookPluginImpl(extension, editorKit);
}
}

View File

@ -0,0 +1,57 @@
package org.protege.editor.core.log;
/**
* Matthew Horridge
* Stanford Center for Biomedical Informatics Research
* 04/11/15
*/
public class LogBanner {
private static final int WIDTH = 80;
private static final String FOOTER;
static {
StringBuilder sb = new StringBuilder();
for(int i = 0; i < WIDTH; i++) {
sb.append("-");
}
FOOTER = sb.toString();
}
public static String start(String title) {
StringBuilder sb = new StringBuilder();
int i = 0;
for( ; i < WIDTH / 2 - title.length() / 2 - 1; i++) {
sb.append("-");
}
sb.append(" ");
i++;
sb.append(title);
i += title.length();
sb.append(" ");
i++;
for(; i < WIDTH; i++) {
sb.append("-");
}
return sb.toString();
}
public static String end() {
return "";
}
@Override
public String toString() {
return "";
}
public static void main(String[] args) {
System.out.println(LogBanner.start("Even"));
System.out.println(LogBanner.end());
System.out.println(LogBanner.start("Odd"));
System.out.println(LogBanner.end());
}
}

View File

@ -0,0 +1,85 @@
package org.protege.editor.core.log;
import javax.swing.SizeRequirements;
import javax.swing.text.AbstractDocument;
import javax.swing.text.BoxView;
import javax.swing.text.ComponentView;
import javax.swing.text.Element;
import javax.swing.text.IconView;
import javax.swing.text.LabelView;
import javax.swing.text.ParagraphView;
import javax.swing.text.StyleConstants;
import javax.swing.text.StyledEditorKit;
import javax.swing.text.View;
import javax.swing.text.ViewFactory;
/**
* A {@link StyledEditorKit} using which one can set line wrapping of the text
*
* @author Yevgeny Kazakov
*/
public class LogEditorKit extends StyledEditorKit implements ViewFactory {
private static final long serialVersionUID = -6193302665953492671L;
private boolean lineWrap_ = false;
public boolean isLineWrap() {
return lineWrap_;
}
public void setLineWrap(boolean wrap) {
this.lineWrap_ = wrap;
}
private class LogParagraphView extends ParagraphView {
public LogParagraphView(Element elem) {
super(elem);
}
@Override
protected SizeRequirements calculateMinorAxisRequirements(int axis,
SizeRequirements r) {
if (lineWrap_)
return super.calculateMinorAxisRequirements(axis, r);
SizeRequirements req = super.calculateMinorAxisRequirements(axis,
r);
req.minimum = req.preferred;
return req;
}
@Override
public int getFlowSpan(int index) {
if (lineWrap_)
return super.getFlowSpan(index);
return Integer.MAX_VALUE;
}
}
@Override
public ViewFactory getViewFactory() {
return this;
}
@Override
public View create(Element elem) {
String kind = elem.getName();
if (kind != null)
if (kind.equals(AbstractDocument.ContentElementName)) {
return new LabelView(elem);
} else if (kind.equals(AbstractDocument.ParagraphElementName)) {
return new LogParagraphView(elem);
} else if (kind.equals(AbstractDocument.SectionElementName)) {
return new BoxView(elem, View.Y_AXIS);
} else if (kind.equals(StyleConstants.ComponentElementName)) {
return new ComponentView(elem);
} else if (kind.equals(StyleConstants.IconElementName)) {
return new IconView(elem);
}
return new LabelView(elem);
}
}

View File

@ -0,0 +1,170 @@
package org.protege.editor.core.log;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.Appender;
import ch.qos.logback.core.AppenderBase;
import ch.qos.logback.core.Context;
import org.protege.editor.core.FileUtils;
import org.protege.editor.core.ui.action.TimestampOutputAction;
import org.slf4j.LoggerFactory;
import javax.swing.*;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.util.ArrayList;
import java.util.List;
/**
* Matthew Horridge
* Stanford Center for Biomedical Informatics Research
* 04/11/15
*/
public class LogManager {
private final LogView logView;
private final Appender<ILoggingEvent> appender;
private final List<LogStatusListener> listenerList = new ArrayList<>();
private final JDialog logViewDialog;
public LogManager(LogView logView) {
this.logView = logView;
appender = new AppenderBase<ILoggingEvent>() {
@Override
public void start() {
logView.start();
super.start();
}
@Override
public void stop() {
super.stop();
logView.stop();
}
@Override
public void setContext(Context context) {
logView.setContext(context);
super.setContext(context);
}
@Override
protected void append(ILoggingEvent event) {
logView.doAppend(event);
fireEvent(event);
}
};
JComponent holder = new JPanel(new BorderLayout(7, 7));
holder.setPreferredSize(new Dimension(800, 600));
JScrollPane sp = new JScrollPane(logView.asJComponent());
sp.getVerticalScrollBar().setUnitIncrement(15);
holder.add(sp);
JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
JButton clearLogButton = new JButton("Clear log");
clearLogButton.setToolTipText("Remove all log messages");
clearLogButton.addActionListener(e -> clearLogView());
JButton showLogFile = new JButton("Show log file");
showLogFile.setToolTipText("Show the log file in the system file browser");
showLogFile.addActionListener(e -> FileUtils.showLogFile());
JButton preferencesButton = new JButton("Preferences");
preferencesButton.addActionListener(e -> showPreferences());
preferencesButton.setToolTipText("Display log preferences");
JButton timeStampButton = new JButton("Time stamp");
timeStampButton.addActionListener(e -> TimestampOutputAction.createTimeStamp(holder));
timeStampButton.setToolTipText("Print a timestamp and optional message into the logs or console");
buttonPanel.add(showLogFile);
buttonPanel.add(preferencesButton);
buttonPanel.add(timeStampButton);
buttonPanel.add(clearLogButton);
holder.add(buttonPanel, BorderLayout.SOUTH);
JOptionPane op = new JOptionPane(holder, JOptionPane.PLAIN_MESSAGE);
logViewDialog = op.createDialog(null, "Log");
logViewDialog.setModal(false);
logViewDialog.setResizable(true);
logViewDialog.addComponentListener(new ComponentAdapter() {
@Override
public void componentHidden(ComponentEvent e) {
fireErrorsCleared();
}
});
}
public synchronized void addErrorLogListener(LogStatusListener listener) {
listenerList.add(listener);
}
public synchronized void removeErrorLogListener(LogStatusListener listener) {
listenerList.remove(listener);
}
private synchronized void fireEvent(ILoggingEvent event) {
for (int i = 0; i < listenerList.size(); i++) {
listenerList.get(i).eventLogged(event);
}
}
private synchronized void fireErrorsCleared() {
listenerList.stream().forEach(LogStatusListener::statusCleared);
}
private Logger getRootLogger() {
return (Logger) LoggerFactory.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME);
}
public void bind() {
applyPreferences();
Logger rootLogger = getRootLogger();
appender.setContext(rootLogger.getLoggerContext());
appender.start();
rootLogger.addAppender(appender);
}
public void unbind() {
getRootLogger().detachAppender(appender);
appender.stop();
}
public void showLogView() {
logViewDialog.setVisible(true);
fireErrorsCleared();
}
public void clearLogView() {
logView.clearView();
fireErrorsCleared();
}
private void showPreferences() {
LogPreferencesPanel panel = new LogPreferencesPanel();
panel.initialise();
JOptionPane op = new JOptionPane(panel, JOptionPane.PLAIN_MESSAGE,
JOptionPane.OK_CANCEL_OPTION);
JDialog dlg = op.createDialog(logViewDialog, "Log Preferences");
dlg.setResizable(true);
dlg.setVisible(true);
Object value = op.getValue();
if (value != null && (int) value == JOptionPane.OK_OPTION) {
panel.applyChanges();
}
}
public void applyPreferences() {
getRootLogger().setLevel(
Level.toLevel(LogPreferences.create().load().logLevel));
logView.applyPreferences();
}
}

View File

@ -0,0 +1,146 @@
package org.protege.editor.core.log;
import java.awt.Color;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.protege.editor.core.ProtegeApplication;
import org.protege.editor.core.prefs.Preferences;
import org.protege.editor.core.prefs.PreferencesManager;
/**
* Preference settings for Protege log window
*
* @author Yevgeny Kazakov
*/
public class LogPreferences {
private static final String PREFERENCES_SET_KEY_ = "org.protege.editor.core.log",
LOG_LEVEL_KEY_ = "LOG_LEVEL",
LOG_WRAP_LINES_KEY_ = "LOG_WRAP_LINES",
LOG_LIMIT_OUTPUT_KEY_ = "LOG_LIMIT_OUTPUT",
LOG_CHARACTER_LIMIT_KEY_ = "LOG_CHARACTER_LIMIT",
LOG_PATTERN_KEY_ = "LOG_PATTERN",
LOG_STYLES_NAMES_KEY_ = "LOG_STYLES_NAME",
LOG_STYLES_FOREGTROUD_KEY_ = "LOG_STYLES_FORGROUND";
private final static String DEFAULT_LOG_LEVEL_ = "INFO";
private final static Boolean DEFAULT_WRAP_LINES_ = false,
DEFAULT_LOG_LIMIT_OUTPUT_ = true;
private final static int DEFAULT_LOG_CHARACTER_LIMIT_ = 80000;
private final static String DEFAULT_LOG_PATTERN_ = "%7level %date{HH:mm:ss} %message%n";
private final static List<String> DEFAULT_LOG_SYTLE_LEVELS_ = Collections
.emptyList();
private final static List<byte[]> DEFAULT_LOG_SYTLE_FOREGROUNDS_ = Collections
.emptyList();
public String logLevel;
public Boolean wrapLines, limitLogOutput;
public int logCharacterLimit;
public String logPattern;
public Map<String, Color> logStyleForegrounds;
private LogPreferences() {
// use create()
}
/**
* @return the preferences initialized with default values
*/
public static LogPreferences create() {
return new LogPreferences().reset();
}
private static Preferences getPrefs() {
PreferencesManager prefMan = PreferencesManager.getInstance();
return prefMan.getPreferencesForSet(PREFERENCES_SET_KEY_,
LogPreferences.class);
}
public LogPreferences load() {
Preferences prefs = getPrefs();
logLevel = prefs.getString(LOG_LEVEL_KEY_, DEFAULT_LOG_LEVEL_);
wrapLines = prefs.getBoolean(LOG_WRAP_LINES_KEY_, DEFAULT_WRAP_LINES_);
limitLogOutput = prefs.getBoolean(LOG_LIMIT_OUTPUT_KEY_,
DEFAULT_LOG_LIMIT_OUTPUT_);
logCharacterLimit = prefs.getInt(LOG_CHARACTER_LIMIT_KEY_,
DEFAULT_LOG_CHARACTER_LIMIT_);
logPattern = prefs.getString(LOG_PATTERN_KEY_, DEFAULT_LOG_PATTERN_);
List<String> names = prefs.getStringList(LOG_STYLES_NAMES_KEY_,
DEFAULT_LOG_SYTLE_LEVELS_);
List<byte[]> foregrounds = prefs.getByteArrayList(
LOG_STYLES_FOREGTROUD_KEY_, DEFAULT_LOG_SYTLE_FOREGROUNDS_);
logStyleForegrounds = new HashMap<String, Color>(foregrounds.size());
try {
for (int i = 0; i < foregrounds.size(); i++) {
logStyleForegrounds.put(names.get(i),
(Color) deserialize(foregrounds.get(i)));
}
} catch (ClassNotFoundException | IOException e) {
e.printStackTrace();
}
return this;
}
public LogPreferences save() {
Preferences prefs = getPrefs();
prefs.putString(LOG_LEVEL_KEY_, logLevel);
prefs.putBoolean(LOG_WRAP_LINES_KEY_, wrapLines);
prefs.putBoolean(LOG_LIMIT_OUTPUT_KEY_, limitLogOutput);
prefs.putInt(LOG_CHARACTER_LIMIT_KEY_, logCharacterLimit);
prefs.putString(LOG_PATTERN_KEY_, logPattern);
try {
List<String> names = new ArrayList<String>(
logStyleForegrounds.keySet());
List<byte[]> foregroundColors = new ArrayList<byte[]>(names.size());
for (int i = 0; i < names.size(); i++) {
foregroundColors
.add(serialize(logStyleForegrounds.get(names.get(i))));
}
prefs.putStringList(LOG_STYLES_NAMES_KEY_, names);
prefs.putByteArrayList(LOG_STYLES_FOREGTROUD_KEY_,
foregroundColors);
} catch (IOException e) {
e.printStackTrace();
}
ProtegeApplication.applyLogPreferences();
return this;
}
public LogPreferences reset() {
logLevel = DEFAULT_LOG_LEVEL_;
wrapLines = DEFAULT_WRAP_LINES_;
limitLogOutput = DEFAULT_LOG_LIMIT_OUTPUT_;
logCharacterLimit = DEFAULT_LOG_CHARACTER_LIMIT_;
logPattern = DEFAULT_LOG_PATTERN_;
logStyleForegrounds = Collections.emptyMap();
return this;
}
public static byte[] serialize(Object obj) throws IOException {
try (ByteArrayOutputStream b = new ByteArrayOutputStream()) {
try (ObjectOutputStream o = new ObjectOutputStream(b)) {
o.writeObject(obj);
}
return b.toByteArray();
}
}
public static Object deserialize(byte[] bytes)
throws IOException, ClassNotFoundException {
try (ByteArrayInputStream b = new ByteArrayInputStream(bytes)) {
try (ObjectInputStream o = new ObjectInputStream(b)) {
return o.readObject();
}
}
}
}

Some files were not shown because too many files have changed in this diff Show More