• R/O
  • SSH
  • HTTPS

maskat: Commit


Commit MetaInfo

Révision116 (tree)
l'heure2009-03-03 12:27:55
Auteurkazatoh

Message de Log

マスカットIDE 2.0.0 のソースフォルダに合わせてリソースを移動

Change Summary

Modification

--- maskat-ide/trunk/org.maskat.ui/src/org/maskat/ui/views/properties/PropertySourceAdapterFactory.java (nonexistent)
+++ maskat-ide/trunk/org.maskat.ui/src/org/maskat/ui/views/properties/PropertySourceAdapterFactory.java (revision 116)
@@ -0,0 +1,80 @@
1+/*
2+ * Copyright 2006 Maskat Project.
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * http://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+package org.maskat.ui.views.properties;
17+
18+import org.eclipse.core.runtime.IAdapterFactory;
19+import org.eclipse.ui.views.properties.IPropertySource;
20+import org.maskat.core.event.Component;
21+import org.maskat.core.layout.ComboItem;
22+import org.maskat.core.layout.DivSplit;
23+import org.maskat.core.layout.GridHeader;
24+import org.maskat.core.layout.Component;
25+import org.maskat.core.layout.Container;
26+import org.maskat.core.layout.Layout;
27+import org.maskat.ui.editors.layout.models.SplitModel;
28+import org.maskat.ui.editors.layout.models.TabDef;
29+
30+/**
31+ * ComponentDef->IPropertySouce
32+ *
33+ * @author shengshen
34+ *
35+ */
36+public class PropertySourceAdapterFactory implements IAdapterFactory {
37+
38+ public Object getAdapter(Object adaptableObject, Class adapterType) {
39+ if (adapterType == IPropertySource.class) {
40+ if (adaptableObject instanceof DivSplit
41+ || adaptableObject instanceof GridHeader
42+ || adaptableObject instanceof TabDef
43+ || adaptableObject instanceof ComboItem) {
44+ ComponentProperty cp = new ComponentProperty();
45+ cp.setComponentDef(adaptableObject);
46+ return cp;
47+ }
48+ if (adaptableObject instanceof SplitModel) {
49+ ComponentProperty cp = new ComponentProperty();
50+ cp.setComponentDef(((SplitModel) adaptableObject).getParent());
51+ return cp;
52+ }
53+ if (adaptableObject instanceof Component) {
54+ Component compDef = (Component) adaptableObject;
55+
56+ Container root = compDef.getLayoutDef();
57+ ComponentProperty cp = null;
58+ Layout sdf = (Layout) root;
59+ if (compDef instanceof Layout) {
60+ LayoutProperty lp = (LayoutProperty) sdf.getLayoutEvtDefSrc()
61+ .getDefs()[0];
62+ lp.setLayoutDef(sdf);
63+ return lp;
64+ }
65+ Component component = sdf.getLayoutEvtDefSrc().findComponent(
66+ compDef.getName());
67+
68+ cp = (ComponentProperty) component;
69+ cp.setComponentDef(compDef);
70+ return cp;
71+ }
72+ }
73+ return null;
74+ }
75+
76+ public Class[] getAdapterList() {
77+ return new Class[] { IPropertySource.class };
78+ }
79+
80+}
Afficher sur ancien navigateur de dépôt.