summaryrefslogtreecommitdiff
path: root/org.tizen.common.ui
diff options
context:
space:
mode:
authorGun Kim <gune.kim@samsung.com>2014-04-03 16:29:44 +0900
committerTaeyoung Son <taeyoung2.son@samsung.com>2014-04-08 10:31:39 +0900
commit50fdb20ae9bccd9145cdd4f64e388c03f6115ad1 (patch)
tree4b94e57343b8aee509505c29b8560773767a3d8e /org.tizen.common.ui
parent75abde4295574f6ba684a2400bdc30fa678238dd (diff)
downloadcommon-eplugin-50fdb20ae9bccd9145cdd4f64e388c03f6115ad1.tar.gz
common-eplugin-50fdb20ae9bccd9145cdd4f64e388c03f6115ad1.tar.bz2
common-eplugin-50fdb20ae9bccd9145cdd4f64e388c03f6115ad1.zip
PACKAGING: added package dialog
Added the package dialog feature. So, some function for package dialog added. 1. Modified .tproject's schema 2. Added UI for package dialog 3. Added a model for representing resources which is included in the package file Change-Id: I2eabc2077a98fd1bc23e133f9adf58399e3d8d8e Signed-off-by: Gun Kim <gune.kim@samsung.com> Conflicts: org.tizen.common/src/org/tizen/common/ITizenProject.java Change-Id: I6806949b9847ac83cbc8461abdb4cc7a478548b6 Signed-off-by: Taeyoung Son <taeyoung2.son@samsung.com>
Diffstat (limited to 'org.tizen.common.ui')
-rw-r--r--org.tizen.common.ui/META-INF/MANIFEST.MF1
-rwxr-xr-xorg.tizen.common.ui/icons/overlay_required.pngbin0 -> 3062 bytes
-rw-r--r--org.tizen.common.ui/plugin.xml485
-rw-r--r--org.tizen.common.ui/src/org/tizen/common/ui/properties/PackageConfigCheckedListener.java111
-rw-r--r--org.tizen.common.ui/src/org/tizen/common/ui/properties/PackageConfigContentProvider.java198
-rw-r--r--org.tizen.common.ui/src/org/tizen/common/ui/properties/PackageConfigLabelProvider.java119
-rw-r--r--org.tizen.common.ui/src/org/tizen/common/ui/properties/PackageConfigMessages.java13
-rw-r--r--org.tizen.common.ui/src/org/tizen/common/ui/properties/PackageConfigMessages.properties2
-rw-r--r--org.tizen.common.ui/src/org/tizen/common/ui/properties/PackageConfiguration.java352
9 files changed, 1046 insertions, 235 deletions
diff --git a/org.tizen.common.ui/META-INF/MANIFEST.MF b/org.tizen.common.ui/META-INF/MANIFEST.MF
index 628e5c5e9..b657b4070 100644
--- a/org.tizen.common.ui/META-INF/MANIFEST.MF
+++ b/org.tizen.common.ui/META-INF/MANIFEST.MF
@@ -15,6 +15,7 @@ Import-Package: org.eclipse.core.resources,
org.eclipse.jface.text,
org.eclipse.ui.console,
org.eclipse.ui.dialogs,
+ org.eclipse.ui.model,
org.eclipse.ui.wizards.newresource,
org.mihalis.opal.preferenceWindow,
org.mihalis.opal.preferenceWindow.widgets,
diff --git a/org.tizen.common.ui/icons/overlay_required.png b/org.tizen.common.ui/icons/overlay_required.png
new file mode 100755
index 000000000..0a96204c6
--- /dev/null
+++ b/org.tizen.common.ui/icons/overlay_required.png
Binary files differ
diff --git a/org.tizen.common.ui/plugin.xml b/org.tizen.common.ui/plugin.xml
index 1c0d03d06..d8146baa2 100644
--- a/org.tizen.common.ui/plugin.xml
+++ b/org.tizen.common.ui/plugin.xml
@@ -1,236 +1,251 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
- <extension-point id="org.tizen.common.ui.commandbar" name="%extension-point.commandbar" schema="schema/org.tizen.common.ui.commandbar.exsd"/>
- <extension-point id="org.tizen.common.ui.tipoftheday" name="%extension-point.tipoftheday" schema="schema/org.tizen.common.ui.tipoftheday.exsd"/>
- <extension
- point="org.eclipse.ui.commands">
- <category
- id="org.tizen.common.ui.category"
- name="%org.tizen.common.ui.category">
- </category>
- <command
- categoryId="org.tizen.common.ui.category"
- defaultHandler="org.tizen.common.ui.commands.WebSiteCommandHandler"
- description="Show official IDE web site"
- id="org.tizen.common.ui.command.tizenweb"
- name="%org.tizen.common.ui.command.website">
- </command>
- </extension>
- <extension
- point="org.eclipse.ui.menus">
- <menuContribution
- locationURI="menu:help?before=helpEnd">
- <menu
- icon="icons/16_IDE_icon.png"
- id="tizensdkhelp"
- label="%org.tizen.common.ui.command">
- <command
- commandId="org.tizen.common.ui.command.tizenweb"
- style="push">
- </command>
- </menu>
- <separator
- name="helpSep"
- visible="true">
- </separator>
- </menuContribution>
- </extension>
-
- <!-- Wizard preferences page -->
- <extension
- point="org.eclipse.ui.preferencePages">
- <page
- category="org.tizen.common.preferences.tizencommon"
- class="org.tizen.common.ui.preferences.AppearancePreferencePage"
- id="org.tizen.common.ui.preferences.appearance"
- name="%org.tizen.common.ui.preferences.appearance.name">
- </page>
- </extension>
-
- <extension
- point="org.eclipse.ui.startup">
- <startup
- class="org.tizen.common.ui.Startup">
- </startup>
- </extension>
-
- <!-- Command Bar -->
- <extension
- point="org.eclipse.ui.startup">
- <startup
- class="org.tizen.common.ui.commandbar.Startup"></startup>
- </extension>
- <extension
- point="org.eclipse.ui.startup">
- <startup
- class="org.tizen.common.ui.dialog.StartUp">
- </startup>
- </extension>
- <extension point="org.eclipse.ui.menus">
- <group id="org.tizen.common.ui.commandbar" separatorsVisible="true">
- <location>
- <bar type="trim"></bar>
- <order position="start" relativeTo="status"></order>
- </location>
- </group>
- <widget class="org.tizen.common.ui.commandbar.StatusBar" id="org.tizen.common.ui.commandbar.status">
- <location>
- <bar path="org.tizen.common.ui.commandbar" type="trim"></bar>
- </location>
- </widget>
- </extension>
- <extension
- point="org.eclipse.ui.commands">
- <command
- categoryId="org.tizen.common.ui.category"
- defaultHandler="org.tizen.common.ui.commandbar.StatusBarHandler"
- description="Command Bar"
- id="org.tizen.common.ui.commandbar.commands.CommandBar"
- name="Command Bar">
- </command>
- </extension>
- <extension
- point="org.eclipse.ui.menus">
- <menuContribution
- locationURI="menu:tizensdkhelp">
- <command
- commandId="org.tizen.common.ui.commandbar.commands.CommandBar"
- style="push">
- </command>
- </menuContribution>
- </extension>
- <extension
- point="org.eclipse.ui.bindings">
- <key
- commandId="org.tizen.common.ui.commandbar.commands.CommandBar"
- contextId="org.eclipse.ui.contexts.window"
- schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
- sequence="M1+M2+C">
- </key>
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension-point id="org.tizen.common.ui.commandbar" name="%extension-point.commandbar" schema="schema/org.tizen.common.ui.commandbar.exsd"/>
+ <extension-point id="org.tizen.common.ui.tipoftheday" name="%extension-point.tipoftheday" schema="schema/org.tizen.common.ui.tipoftheday.exsd"/>
+ <extension
+ point="org.eclipse.ui.commands">
+ <category
+ id="org.tizen.common.ui.category"
+ name="%org.tizen.common.ui.category">
+ </category>
+ <command
+ categoryId="org.tizen.common.ui.category"
+ defaultHandler="org.tizen.common.ui.commands.WebSiteCommandHandler"
+ description="Show official IDE web site"
+ id="org.tizen.common.ui.command.tizenweb"
+ name="%org.tizen.common.ui.command.website">
+ </command>
+ </extension>
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ locationURI="menu:help?before=helpEnd">
+ <menu
+ icon="icons/16_IDE_icon.png"
+ id="tizensdkhelp"
+ label="%org.tizen.common.ui.command">
+ <command
+ commandId="org.tizen.common.ui.command.tizenweb"
+ style="push">
+ </command>
+ </menu>
+ <separator
+ name="helpSep"
+ visible="true">
+ </separator>
+ </menuContribution>
+ </extension>
+
+ <!-- Wizard preferences page -->
+ <extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+ category="org.tizen.common.preferences.tizencommon"
+ class="org.tizen.common.ui.preferences.AppearancePreferencePage"
+ id="org.tizen.common.ui.preferences.appearance"
+ name="%org.tizen.common.ui.preferences.appearance.name">
+ </page>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.propertyPages">
+ <page
+ category="org.tizen.common.properties.tizen"
+ class="org.tizen.common.ui.properties.PackageConfiguration"
+ id="org.tizen.common.ui.properties.pkgconfig"
+ name="%org.tizen.common.ui.properties.pkgconfig.name">
+ <enabledWhen>
+ <adapt
+ type="org.eclipse.core.resources.IProject">
+ </adapt>
+ </enabledWhen>
+ </page>
</extension>
- <extension
- point="org.eclipse.ui.handlers">
- <handler
- class="org.tizen.common.ui.commandbar.textAssist.SelectAllHandler"
- commandId="org.eclipse.ui.edit.selectAll">
- <activeWhen>
- <or>
- <with variable="activeFocusControlId">
- <equals value="org.tizen.common.ui.commandbar.textAssist.TextAssist"/>
- </with>
- </or>
- </activeWhen>
- </handler>
- <handler
- class="org.tizen.common.ui.commandbar.textAssist.CopyHandler"
- commandId="org.eclipse.ui.edit.copy">
- <activeWhen>
- <or>
- <with variable="activeFocusControlId">
- <equals value="org.tizen.common.ui.commandbar.textAssist.TextAssist"/>
- </with>
- </or>
- </activeWhen>
- </handler>
- <handler
- class="org.tizen.common.ui.commandbar.textAssist.CutHandler"
- commandId="org.eclipse.ui.edit.cut">
- <activeWhen>
- <or>
- <with variable="activeFocusControlId">
- <equals value="org.tizen.common.ui.commandbar.textAssist.TextAssist"/>
- </with>
- </or>
- </activeWhen>
- </handler>
- <handler
- class="org.tizen.common.ui.commandbar.textAssist.PasteHandler"
- commandId="org.eclipse.ui.edit.paste">
- <activeWhen>
- <or>
- <with variable="activeFocusControlId">
- <equals value="org.tizen.common.ui.commandbar.textAssist.TextAssist"/>
- </with>
- </or>
- </activeWhen>
- </handler>
- </extension>
- <!-- /Command Bar -->
-
- <extension
- point="org.tizen.common.ui.tipoftheday">
- <tip
- file="resources/tips/commandbar.html">
- </tip>
- </extension>
- <extension
- point="org.tizen.common.ui.tipoftheday">
- <tip
- file="resources/tips/csseditor.html">
- </tip>
- </extension>
- <extension
- point="org.eclipse.ui.decorators">
- <decorator
- class="org.tizen.common.ui.decorators.ReferencedProjectDecorator"
- id="org.tizen.common.ui.decorator.projectdecorator"
- label="%decorator.referencedproject.label"
- lightweight="true"
- state="true">
- <description>
- Indicates whether a project is referenced
- </description>
- <enablement>
- <objectClass
- name="org.eclipse.core.resources.IProject">
- </objectClass>
- </enablement>
- </decorator>
- <decorator
- class="org.tizen.common.ui.decorators.ImageFileDecorator"
- id="org.tizen.common.ui.decorators.ImageFileDecorator"
- label="%decorator.imagefile.label"
- lightweight="true"
- location="REPLACE"
- state="true">
- <enablement>
- <and>
- <objectClass
- name="org.eclipse.core.resources.IFile">
- </objectClass>
- <or>
- <objectState
- name="name"
- value="*.png">
- </objectState>
- <objectState
- name="name"
- value="*.jpg">
- </objectState>
- <objectState
- name="name"
- value="*.jpeg">
- </objectState>
- <objectState
- name="name"
- value="*.gif">
- </objectState>
- <objectState
- name="name"
- value="*.bmp">
- </objectState>
- <objectState
- name="name"
- value="*.ico">
- </objectState>
- <objectState
- name="name"
- value="*.svg">
- </objectState>
- </or>
- </and>
- </enablement>
- </decorator>
- </extension>
-</plugin>
+
+ <extension
+ point="org.eclipse.ui.startup">
+ <startup
+ class="org.tizen.common.ui.Startup">
+ </startup>
+ </extension>
+
+ <!-- Command Bar -->
+ <extension
+ point="org.eclipse.ui.startup">
+ <startup
+ class="org.tizen.common.ui.commandbar.Startup"></startup>
+ </extension>
+ <extension
+ point="org.eclipse.ui.startup">
+ <startup
+ class="org.tizen.common.ui.dialog.StartUp">
+ </startup>
+ </extension>
+ <extension point="org.eclipse.ui.menus">
+ <group id="org.tizen.common.ui.commandbar" separatorsVisible="true">
+ <location>
+ <bar type="trim"></bar>
+ <order position="start" relativeTo="status"></order>
+ </location>
+ </group>
+ <widget class="org.tizen.common.ui.commandbar.StatusBar" id="org.tizen.common.ui.commandbar.status">
+ <location>
+ <bar path="org.tizen.common.ui.commandbar" type="trim"></bar>
+ </location>
+ </widget>
+ </extension>
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ categoryId="org.tizen.common.ui.category"
+ defaultHandler="org.tizen.common.ui.commandbar.StatusBarHandler"
+ description="Command Bar"
+ id="org.tizen.common.ui.commandbar.commands.CommandBar"
+ name="Command Bar">
+ </command>
+ </extension>
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ locationURI="menu:tizensdkhelp">
+ <command
+ commandId="org.tizen.common.ui.commandbar.commands.CommandBar"
+ style="push">
+ </command>
+ </menuContribution>
+ </extension>
+ <extension
+ point="org.eclipse.ui.bindings">
+ <key
+ commandId="org.tizen.common.ui.commandbar.commands.CommandBar"
+ contextId="org.eclipse.ui.contexts.window"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="M1+M2+C">
+ </key>
+ </extension>
+ <extension
+ point="org.eclipse.ui.handlers">
+ <handler
+ class="org.tizen.common.ui.commandbar.textAssist.SelectAllHandler"
+ commandId="org.eclipse.ui.edit.selectAll">
+ <activeWhen>
+ <or>
+ <with variable="activeFocusControlId">
+ <equals value="org.tizen.common.ui.commandbar.textAssist.TextAssist"/>
+ </with>
+ </or>
+ </activeWhen>
+ </handler>
+ <handler
+ class="org.tizen.common.ui.commandbar.textAssist.CopyHandler"
+ commandId="org.eclipse.ui.edit.copy">
+ <activeWhen>
+ <or>
+ <with variable="activeFocusControlId">
+ <equals value="org.tizen.common.ui.commandbar.textAssist.TextAssist"/>
+ </with>
+ </or>
+ </activeWhen>
+ </handler>
+ <handler
+ class="org.tizen.common.ui.commandbar.textAssist.CutHandler"
+ commandId="org.eclipse.ui.edit.cut">
+ <activeWhen>
+ <or>
+ <with variable="activeFocusControlId">
+ <equals value="org.tizen.common.ui.commandbar.textAssist.TextAssist"/>
+ </with>
+ </or>
+ </activeWhen>
+ </handler>
+ <handler
+ class="org.tizen.common.ui.commandbar.textAssist.PasteHandler"
+ commandId="org.eclipse.ui.edit.paste">
+ <activeWhen>
+ <or>
+ <with variable="activeFocusControlId">
+ <equals value="org.tizen.common.ui.commandbar.textAssist.TextAssist"/>
+ </with>
+ </or>
+ </activeWhen>
+ </handler>
+ </extension>
+ <!-- /Command Bar -->
+
+ <extension
+ point="org.tizen.common.ui.tipoftheday">
+ <tip
+ file="resources/tips/commandbar.html">
+ </tip>
+ </extension>
+ <extension
+ point="org.tizen.common.ui.tipoftheday">
+ <tip
+ file="resources/tips/csseditor.html">
+ </tip>
+ </extension>
+ <extension
+ point="org.eclipse.ui.decorators">
+ <decorator
+ class="org.tizen.common.ui.decorators.ReferencedProjectDecorator"
+ id="org.tizen.common.ui.decorator.projectdecorator"
+ label="%decorator.referencedproject.label"
+ lightweight="true"
+ state="true">
+ <description>
+ Indicates whether a project is referenced
+ </description>
+ <enablement>
+ <objectClass
+ name="org.eclipse.core.resources.IProject">
+ </objectClass>
+ </enablement>
+ </decorator>
+ <decorator
+ class="org.tizen.common.ui.decorators.ImageFileDecorator"
+ id="org.tizen.common.ui.decorators.ImageFileDecorator"
+ label="%decorator.imagefile.label"
+ lightweight="true"
+ location="REPLACE"
+ state="true">
+ <enablement>
+ <and>
+ <objectClass
+ name="org.eclipse.core.resources.IFile">
+ </objectClass>
+ <or>
+ <objectState
+ name="name"
+ value="*.png">
+ </objectState>
+ <objectState
+ name="name"
+ value="*.jpg">
+ </objectState>
+ <objectState
+ name="name"
+ value="*.jpeg">
+ </objectState>
+ <objectState
+ name="name"
+ value="*.gif">
+ </objectState>
+ <objectState
+ name="name"
+ value="*.bmp">
+ </objectState>
+ <objectState
+ name="name"
+ value="*.ico">
+ </objectState>
+ <objectState
+ name="name"
+ value="*.svg">
+ </objectState>
+ </or>
+ </and>
+ </enablement>
+ </decorator>
+ </extension>
+</plugin>
diff --git a/org.tizen.common.ui/src/org/tizen/common/ui/properties/PackageConfigCheckedListener.java b/org.tizen.common.ui/src/org/tizen/common/ui/properties/PackageConfigCheckedListener.java
new file mode 100644
index 000000000..98e875312
--- /dev/null
+++ b/org.tizen.common.ui/src/org/tizen/common/ui/properties/PackageConfigCheckedListener.java
@@ -0,0 +1,111 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Hyeongseok Heo <hyeongseok.heo@samsung.com>
+* Gun Kim <gune.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.common.ui.properties;
+
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTreeViewer;
+import org.eclipse.jface.viewers.ICheckStateListener;
+
+/**
+ * This class is ICheckStateListener for {@link PackageConfiguration}.
+ *
+ * @author Gun Kim<gune.kim@samsung.com>
+ */
+public class PackageConfigCheckedListener implements ICheckStateListener {
+ private CheckboxTreeViewer treeViewer;
+ private PackageConfigContentProvider contentProvider;
+
+ public PackageConfigCheckedListener( CheckboxTreeViewer viewer, PackageConfigContentProvider provider ) {
+ this.treeViewer = viewer;
+ this.contentProvider = provider;
+ }
+
+ @Override
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ Object element = event.getElement();
+ treeViewer.setSubtreeChecked(element, event.getChecked());
+ if ( !event.getChecked() ) {
+ treeViewer.setGrayed(element, false);
+ }
+ setGraySubTree(element, false);
+
+ checkParent(element);
+ }
+
+ /**
+ * Sets the grayed status for the given {@code element}'s subtree.
+ */
+ public void setGraySubTree(Object element, boolean status) {
+ Object[] children = contentProvider.getChildren(element);
+ for ( Object child : children ) {
+ treeViewer.setGrayed(child, status);
+ setGraySubTree(child, status);
+ }
+ }
+
+ /**
+ * Updates status of the given {@code element}'s parent.
+ */
+ public void checkParent(Object element) {
+ Object parent = null;
+ try {
+ parent = contentProvider.getParent(element);
+ if ( parent == null ) {
+ return;
+ }
+ Object[] children = contentProvider.getChildren(parent);
+ boolean isCheck = true;
+
+ if ( children.length <= 0 ) {
+ return;
+ }
+
+ isCheck = treeViewer.getChecked(children[0]);
+
+ for ( int i = 0 ; i < children.length ; i++ ) {
+ if ( treeViewer.getGrayed(children[i]) ) {
+ treeViewer.setChecked(parent, true);
+ treeViewer.setGrayed(parent, true);
+ return;
+ }
+ else if ( isCheck != treeViewer.getChecked(children[i]) ) {
+ treeViewer.setChecked(parent, true);
+ treeViewer.setGrayed(parent, true);
+ return;
+ }
+ }
+
+ treeViewer.setGrayed(parent, false);
+ treeViewer.setChecked(parent, isCheck);
+ } finally {
+ if ( parent != null ) {
+ checkParent(parent);
+ }
+ }
+ }
+
+}
diff --git a/org.tizen.common.ui/src/org/tizen/common/ui/properties/PackageConfigContentProvider.java b/org.tizen.common.ui/src/org/tizen/common/ui/properties/PackageConfigContentProvider.java
new file mode 100644
index 000000000..546f8aa41
--- /dev/null
+++ b/org.tizen.common.ui/src/org/tizen/common/ui/properties/PackageConfigContentProvider.java
@@ -0,0 +1,198 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Hyeongseok Heo <hyeongseok.heo@samsung.com>
+* Gun Kim <gune.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.common.ui.properties;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.ui.model.WorkbenchContentProvider;
+import org.tizen.common.ITizenProject;
+import org.tizen.common.core.application.PackageResourceInfo;
+import org.tizen.common.core.application.TizenPackageInfoStore;
+import org.tizen.common.ui.page.properties.PackageConfigUtil;
+import org.tizen.common.util.ProjectUtil;
+
+/**
+ * This class is ITreeContentProvider for {@link PackageConfiguration}.
+ *
+ * @author Gun Kim<gune.kim@samsung.com>
+ */
+public class PackageConfigContentProvider extends WorkbenchContentProvider {
+ private Map<IProject, TizenPackageInfoStore> pkgInfoStoreMap = new HashMap<IProject, TizenPackageInfoStore> ();
+
+ @Override
+ public Object[] getChildren(Object object) {
+ if ( object instanceof List) {
+ return ((List<?>) object).toArray();
+ }
+
+ if ( object instanceof IProject ) {
+ ITizenProject tProject = ProjectUtil.getTizenProject((IProject) object);
+ if ( tProject == null ) {
+ return ((List<?>) object).toArray();
+ }
+ pkgInfoStoreMap.put((IProject) object, tProject.getTizenPkgInfoStore());
+ }
+
+ return getInterestRes( (IResource) object );
+ }
+
+ @Override
+ public Object getParent(Object object) {
+ if ( object instanceof IResource ) {
+ return ((IResource) object).getParent();
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * Gets interest children for the given {@code resource}.
+ */
+ private Object[] getInterestRes(IResource resource) {
+ List<IResource> childrenList = new ArrayList<IResource> ();
+ Object[] tempChildren = super.getChildren(resource);
+
+ if ( tempChildren.length == 0 ) {
+ return new Object[0];
+ }
+
+ IResource[] children = (IResource[]) tempChildren;
+ TizenPackageInfoStore pkgInfoStore = pkgInfoStoreMap.get(resource.getProject());
+ if ( pkgInfoStore == null ) {
+ return new Object[0];
+ }
+
+ for ( IResource res : children ) {
+ IPath resPath = res.getFullPath();
+ String[] resSegments = resPath.segments();
+ IPath interestResPath = null;
+ boolean isEqual = true;
+ String[] interestResSegments = null;
+ for ( PackageResourceInfo interestResInfo : pkgInfoStore.getPackageRes() ) {
+ isEqual = true;
+ interestResPath = new Path("/" + res.getProject().getName() + "/" + interestResInfo.getName());
+ interestResSegments = interestResPath.segments();
+
+ if ( resSegments.length == interestResSegments.length ) {
+ if ( !interestResInfo.isSupportedType(res.getType()) ) {
+ continue;
+ }
+ }
+ else if ( resSegments.length < interestResSegments.length ) {
+ if ( res.getType() != IResource.FOLDER ) {
+ continue;
+ }
+ }
+
+ for ( int i = 0 ; i < resSegments.length ; i++ ) {
+ if ( i >= interestResSegments.length ) {
+ break;
+ }
+ if ( !resSegments[i].equals(interestResSegments[i]) ) {
+ isEqual = false;
+ break;
+ }
+ }
+
+ if ( isEqual ) {
+ if ( !childrenList.contains(res) ) {
+ childrenList.add(res);
+ }
+ }
+ }
+ }
+
+ addRequirementResToChildren(resource, childrenList, pkgInfoStore.getPackageRes());
+
+ return childrenList.toArray();
+ }
+
+ /**
+ * Adds requirement resources which don't exist in project to {@code children}.
+ */
+ private void addRequirementResToChildren( IResource res, List<IResource> children, List<PackageResourceInfo> pkgResInfoList ) {
+ String[] resSegments = res.getFullPath().segments();
+ String[] pkgResInfoSegments = null;
+
+ if ( res instanceof IFile ) {
+ return;
+ }
+
+ boolean isMatch = false;
+ IPath pkgResInfoPath = null;
+ for ( PackageResourceInfo pkgResInfo : pkgResInfoList ) {
+ isMatch = true;
+ pkgResInfoPath = new Path(res.getProject().getName() + "/" + pkgResInfo.getName());
+ pkgResInfoSegments = pkgResInfoPath.segments();
+
+ if ( resSegments.length == (pkgResInfoSegments.length - 1) ) {
+ for ( int i = 0 ; i < resSegments.length ; i++ ) {
+ if ( !resSegments[i].equals(pkgResInfoSegments[i])) {
+ isMatch = false;
+ break;
+ }
+ }
+ if ( !isMatch ) {
+ continue;
+ }
+
+ isMatch = false;
+ for ( IResource child : children ) {
+ if ( PackageConfigUtil.isMatch(child, pkgResInfo) ) {
+ isMatch = true;
+ break;
+ }
+ }
+ if ( !isMatch ) {
+ if ( pkgResInfo.isSupportedType(IResource.FOLDER)){
+ children.add(res.getProject().getFolder(pkgResInfoPath.removeFirstSegments(1)));
+ }
+ else {
+ children.add(res.getProject().getFile(pkgResInfoPath.removeFirstSegments(1)));
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Gets {@link TizenPackageInfoStore} for the given {@code project}.
+ */
+ public TizenPackageInfoStore getPkgInfoStore(IProject project) {
+ return pkgInfoStoreMap.get(project);
+ }
+
+}
diff --git a/org.tizen.common.ui/src/org/tizen/common/ui/properties/PackageConfigLabelProvider.java b/org.tizen.common.ui/src/org/tizen/common/ui/properties/PackageConfigLabelProvider.java
new file mode 100644
index 000000000..c341dbe76
--- /dev/null
+++ b/org.tizen.common.ui/src/org/tizen/common/ui/properties/PackageConfigLabelProvider.java
@@ -0,0 +1,119 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Hyeongseok Heo <hyeongseok.heo@samsung.com>
+* Gun Kim <gune.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.common.ui.properties;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.resource.LocalResourceManager;
+import org.eclipse.jface.viewers.DecorationOverlayIcon;
+import org.eclipse.jface.viewers.IDecoration;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
+import org.tizen.common.core.application.PackageResourceInfo;
+import org.tizen.common.core.application.TizenPackageInfoStore;
+import org.tizen.common.ui.Activator;
+import org.tizen.common.util.ImageUtil;
+import org.tizen.common.util.ProjectUtil;
+
+/**
+ * This class is LabelProvider for {@link PackageConfiguration}.
+ *
+ * @author Gun Kim<gune.kim@samsung.com>
+ */
+public class PackageConfigLabelProvider extends WorkbenchLabelProvider {
+ PackageConfigContentProvider contentProvider;
+
+ public PackageConfigLabelProvider(PackageConfigContentProvider contentProvider) {
+ this.contentProvider = contentProvider;
+ }
+
+ @Override
+ protected ImageDescriptor decorateImage(ImageDescriptor input, Object element) {
+ if ( isRequirementRes(element) ) {
+ Image image = (Image) new LocalResourceManager(JFaceResources.getResources()).get(input);
+
+ ImageDescriptor desc = ImageUtil.getImageDescriptor(Activator.getDefault(), "icons/overlay_required.png");
+
+ DecorationOverlayIcon overlayIcon = new DecorationOverlayIcon( image, desc, IDecoration.BOTTOM_LEFT);
+
+ return overlayIcon;
+ }
+ else {
+ return input;
+ }
+ }
+
+ private boolean isRequirementRes(Object element) {
+ if ( element instanceof IProject ) {
+ return false;
+ }
+ if ( element instanceof IResource ) {
+ IResource res = (IResource)element;
+ TizenPackageInfoStore pkgInfoStore = contentProvider.getPkgInfoStore(res.getProject());
+ if ( pkgInfoStore == null ) {
+ pkgInfoStore = ProjectUtil.getTizenProject(res.getProject()).getTizenPkgInfoStore();
+ }
+
+ String[] resSegments = res.getFullPath().segments();
+ String[] pkgResInfoSegments = null;
+ boolean isMatch = true;
+ for ( PackageResourceInfo pkgResInfo : pkgInfoStore.getPackageRes() ) {
+ isMatch = true;
+ pkgResInfoSegments = new Path(res.getProject().getName() + "/" + pkgResInfo.getName()).segments();
+ if ( resSegments.length > pkgResInfoSegments.length ) {
+ continue;
+ }
+ else if ( resSegments.length == pkgResInfoSegments.length ) {
+ if ( !pkgResInfo.isSupportedType(res.getType()) ) {
+ continue;
+ }
+ }
+
+ for ( int i = 0 ; i < pkgResInfoSegments.length ; i++ ) {
+ if ( i >= resSegments.length ) {
+ break;
+ }
+ if ( !(resSegments[i].equals(pkgResInfoSegments[i])) ) {
+ isMatch = false;
+ break;
+ }
+ }
+
+ if ( isMatch ) {
+ return true;
+ }
+ }
+
+ }
+
+ return false;
+ }
+}
diff --git a/org.tizen.common.ui/src/org/tizen/common/ui/properties/PackageConfigMessages.java b/org.tizen.common.ui/src/org/tizen/common/ui/properties/PackageConfigMessages.java
new file mode 100644
index 000000000..d293d6754
--- /dev/null
+++ b/org.tizen.common.ui/src/org/tizen/common/ui/properties/PackageConfigMessages.java
@@ -0,0 +1,13 @@
+package org.tizen.common.ui.properties;
+
+import org.eclipse.osgi.util.NLS;
+
+public class PackageConfigMessages {
+ static {
+ NLS.initializeMessages(PackageConfigMessages.class.getName(), PackageConfigMessages.class);
+ }
+
+ public static String PROPERTY_PAGE_DESC;
+ public static String PROPERTY_PAGE_NOTE;
+
+}
diff --git a/org.tizen.common.ui/src/org/tizen/common/ui/properties/PackageConfigMessages.properties b/org.tizen.common.ui/src/org/tizen/common/ui/properties/PackageConfigMessages.properties
new file mode 100644
index 000000000..8306aef44
--- /dev/null
+++ b/org.tizen.common.ui/src/org/tizen/common/ui/properties/PackageConfigMessages.properties
@@ -0,0 +1,2 @@
+PROPERTY_PAGE_DESC=Select the folders and files to include in the package file:
+PROPERTY_PAGE_NOTE=The elements which are represented with star should be included in the package file even if these aren't checked. \ No newline at end of file
diff --git a/org.tizen.common.ui/src/org/tizen/common/ui/properties/PackageConfiguration.java b/org.tizen.common.ui/src/org/tizen/common/ui/properties/PackageConfiguration.java
new file mode 100644
index 000000000..7611e4a18
--- /dev/null
+++ b/org.tizen.common.ui/src/org/tizen/common/ui/properties/PackageConfiguration.java
@@ -0,0 +1,352 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Hyeongseok Heo <hyeongseok.heo@samsung.com>
+* Gun Kim <gune.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.common.ui.properties;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.layout.GridLayoutFactory;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.viewers.CheckboxTreeViewer;
+import org.eclipse.jface.viewers.DecoratingLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.PropertyPage;
+import org.tizen.common.ITizenProject;
+import org.tizen.common.core.application.PackageResourceInfo;
+import org.tizen.common.core.application.TizenPackageInfoStore;
+import org.tizen.common.core.application.TizenProjectDescription;
+import org.tizen.common.core.application.tproject.TprojectHandler;
+import org.tizen.common.ui.page.properties.PackageConfigUtil;
+import org.tizen.common.util.ProjectUtil;
+
+/**
+ * This class is PropertyPage for {@link PackageConfiguration}.
+ *
+ * @author Gun Kim<gune.kim@samsung.com>
+ */
+public class PackageConfiguration extends PropertyPage {
+
+ private IProject project;
+ private CheckboxTreeViewer listViewer;
+ private PackageConfigContentProvider contentProvider;
+ private PackageConfigCheckedListener checkedListener;
+
+ private void init() {
+ project = (IProject) getElement().getAdapter(IResource.class);
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+ init();
+
+ Composite pane = new Composite(parent, SWT.NONE);
+ pane.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).create());
+ pane.setLayoutData(GridDataFactory.fillDefaults().grab(true,true).create());
+
+ createDescription(pane);
+ createTreeviwer(pane);
+
+ Composite noteComp = createNoteComposite(JFaceResources.getDialogFont(), pane, "Note:", PackageConfigMessages.PROPERTY_PAGE_NOTE);
+ GridLayoutFactory.fillDefaults().generateLayout(noteComp);
+
+ return null;
+ }
+
+ /**
+ * Creates this property page's description.
+ */
+ private Label createDescription(Composite parent) {
+ setDescription(PackageConfigMessages.PROPERTY_PAGE_DESC);
+ Label label = new Label(parent, SWT.NONE);
+
+ GridData gd = GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).create();
+
+ label.setLayoutData(gd);
+ label.setText(PackageConfigMessages.PROPERTY_PAGE_DESC);
+
+ return label;
+ }
+
+ /**
+ * Creates checkbox tree viewer
+ */
+ private CheckboxTreeViewer createTreeviwer(Composite parent) {
+ Composite viewerComp = new Composite(parent, SWT.NONE);
+ viewerComp.setLayout(GridLayoutFactory.fillDefaults().create());
+ viewerComp.setLayoutData(GridDataFactory.fillDefaults().grab(true,true).create());
+
+ listViewer = new CheckboxTreeViewer(viewerComp);
+
+ if(!project.isOpen())
+ listViewer.getControl().setEnabled(false);
+
+ contentProvider = new PackageConfigContentProvider();
+
+ LabelProvider configLabelProvider = new DecoratingLabelProvider(new PackageConfigLabelProvider(contentProvider),
+ PlatformUI.getWorkbench().getDecoratorManager()
+ .getLabelDecorator());
+
+ listViewer.setContentProvider(contentProvider);
+ listViewer.setLabelProvider(configLabelProvider);
+ listViewer.setInput(getInput(project));
+
+ checkedListener = new PackageConfigCheckedListener(listViewer, contentProvider);
+ listViewer.addCheckStateListener( checkedListener );
+ setCheckedElements(false);
+
+ GridLayoutFactory.fillDefaults().generateLayout(viewerComp);
+
+ return listViewer;
+ }
+
+ /**
+ * Applies checked status to checkbox tree viewer.
+ *
+ * @param isDefault true if the viewer should be applied using default value,
+ * and false if the viewer should be applied using project's configuration value.
+ */
+ private void setCheckedElements(boolean isDefault) {
+ TizenPackageInfoStore pkgInfoStore = null;
+ for ( IProject input : getInput(project) ) {
+ listViewer.setSubtreeChecked(input, true);
+
+ pkgInfoStore = contentProvider.getPkgInfoStore(input);
+ if ( isDefault) {
+ setCheckedFilter(input, pkgInfoStore.getDefaultBlackList());
+ }
+ else {
+ setCheckedFilter(input, pkgInfoStore.getBlackList());
+ setCheckedFilter(input, pkgInfoStore.getExcludeList());
+ }
+ }
+
+ }
+
+ /**
+ * Checks the given resource's children which matches the given filterList.
+ */
+ private void setCheckedFilter(IResource resource, List<PackageResourceInfo> filterList) {
+ String lastSegment = "";
+ boolean isMatch = false;
+
+ if ( filterList.isEmpty() ) {
+ return;
+ }
+ for ( Object obj : contentProvider.getChildren(resource) ) {
+ IResource child = (IResource)obj;
+ lastSegment = child.getFullPath().lastSegment();
+
+ for ( PackageResourceInfo blackList : filterList) {
+ if ( blackList.getElementType() == PackageResourceInfo.NAME ) {
+ if ( lastSegment.equals(blackList.getName()) ) {
+ uncheckItem(child, blackList);
+ isMatch = true;
+ break;
+ }
+ }
+ else if ( blackList.getElementType() == PackageResourceInfo.PATH ) {
+ if ( PackageConfigUtil.isMatch(child, blackList) ) {
+ uncheckItem(child, blackList);
+ isMatch = true;
+ break;
+ }
+ }
+ else if ( blackList.getElementType() == PackageResourceInfo.EXCLUDE ) {
+ if ( PackageConfigUtil.isMatch(child, blackList) ) {
+ listViewer.setGrayed(child, false);
+ listViewer.setChecked(child, true);
+ Object[] children = contentProvider.getChildren(child);
+ if ( children.length == 0 ) {
+ checkedListener.checkParent(child);
+ }
+ else {
+ checkedListener.checkParent(children[0]);
+ }
+
+ break;
+ }
+ }
+ }
+
+ if ( !isMatch ) {
+ setCheckedFilter(child, filterList);
+ }
+ isMatch = false;
+ }
+ }
+
+ /**
+ * Unchecked the given resource if the resource matches the given ignoreRes.
+ */
+ private void uncheckItem(IResource res, PackageResourceInfo ignoreRes) {
+ if ( ignoreRes.getResourceType() == IResource.NONE ) {
+ listViewer.setSubtreeChecked(res, false);
+ checkedListener.checkParent(res);
+ }
+ else if ( ignoreRes.getResourceType() == res.getType() ) {
+ listViewer.setSubtreeChecked(res, false);
+ checkedListener.checkParent(res);
+ }
+ }
+
+ /**
+ * Gets the given project's referenced project and the given project.
+ */
+ private List<IProject> getInput(IProject project) {
+ List<IProject> projects = new ArrayList<IProject>();
+ projects.add(project);
+
+ List<IProject> refProjects = ProjectUtil.getReferencedProjects(project);
+ if ( !refProjects.isEmpty() ) {
+ projects.addAll(refProjects);
+ }
+
+ return projects;
+ }
+
+ @Override
+ protected void performDefaults() {
+ updateApplyButton();
+ setCheckedElements(true);
+ }
+
+ @Override
+ public boolean performOk() {
+ for ( IProject project : getInput(this.project) ) {
+ writeBlackList(project);
+ }
+ return true;
+ }
+
+ /**
+ * Writes contents of this property page to .tproject.
+ */
+ private void writeBlackList(IProject project) {
+ TizenProjectDescription desc = makeDescription(project);
+
+ TprojectHandler handler = new TprojectHandler(project);
+
+ handler.marshal(desc);
+ }
+
+ /**
+ * Gets the given project's referenced project and the given project.
+ */
+ private void getElements(List<IResource> resList, Object obj) {
+ Object[] objs = contentProvider.getChildren(obj);
+
+ for ( Object object : objs ) {
+ if ( object instanceof IResource ) {
+ resList.add((IResource) object);
+ getElements(resList, object);
+ }
+ }
+ }
+
+ /**
+ * Makes {@link TizenProjectDescription} for writing to .tproject
+ */
+ private TizenProjectDescription makeDescription(IProject project) {
+ ITizenProject tProject = ProjectUtil.getTizenProject(project);
+ TizenProjectDescription desc = tProject.getDescription();
+ TizenPackageInfoStore pkgStore = tProject.getTizenPkgInfoStore();
+ desc.setBlacklist(new ArrayList<PackageResourceInfo> ());
+
+ IPath elementPath = null;
+ String blacklistItemName = null;
+
+ List<IResource> elements = new ArrayList<IResource> ();
+ getElements(elements, project);
+
+ boolean isCheckedItem = false;
+ boolean isMatch = true;
+ for ( IResource element : elements ) {
+ isMatch = false;
+ elementPath = element.getFullPath();
+ isCheckedItem = listViewer.getChecked(element);
+ String[] uncheckItemSegments = elementPath.segments();
+ for ( PackageResourceInfo resInfo : pkgStore.getDefaultBlackList() ) {
+ if ( resInfo.getElementType() == PackageResourceInfo.PATH ) {
+ continue;
+ }
+ blacklistItemName = resInfo.getName();
+
+ if ( resInfo.getResourceType() == IResource.FILE ) {
+ if ( elementPath.lastSegment().equals(blacklistItemName) ){
+ isMatch = true;
+ }
+ }
+ else {
+ for ( int i = 0 ; i < uncheckItemSegments.length ; i++ ) {
+ if (uncheckItemSegments[i].equals(blacklistItemName)) {
+ isMatch = true;
+ break;
+ }
+
+ }
+ }
+
+ if ( isMatch && isCheckedItem ) {
+ resInfo.getExcludeList().add(
+ new PackageResourceInfo(elementPath.removeFirstSegments(1).toString(), element.getType(),
+ PackageResourceInfo.EXCLUDE, "", false));
+ break;
+ }
+ }
+
+ if ( !isMatch && !isCheckedItem ) {
+ isMatch = false;
+ for ( PackageResourceInfo resInfo : pkgStore.getRequirementRes() ) {
+ if ( PackageConfigUtil.contains(element, resInfo) ) {
+ isMatch = true;
+ break;
+ }
+ }
+
+ if ( !isMatch ) {
+ desc.getBlacklist().add(new PackageResourceInfo( elementPath.removeFirstSegments(1).toString(), element.getType(),
+ PackageResourceInfo.PATH, "", false ));
+ }
+ }
+ }
+
+ PackageConfigUtil.addRequirement(pkgStore, pkgStore.getDefaultBlackList());
+ desc.getBlacklist().addAll(pkgStore.getDefaultBlackList());
+
+ return desc;
+ }
+}