Merge change Ic86de6e9 into eclair
* changes: Fix NPE when opening new layout file.
This commit is contained in:
@@ -679,6 +679,8 @@ public class GraphicalEditorPart extends EditorPart implements IGraphicalLayoutE
|
|||||||
// enable the create button if the current and edited config are not equals
|
// enable the create button if the current and edited config are not equals
|
||||||
mConfigComposite.setEnabledCreate(
|
mConfigComposite.setEnabledCreate(
|
||||||
mEditedConfig.equals(mConfigComposite.getCurrentConfig()) == false);
|
mEditedConfig.equals(mConfigComposite.getCurrentConfig()) == false);
|
||||||
|
|
||||||
|
reloadConfigurationUi(false /*notifyListener*/);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Clipboard getClipboard() {
|
public Clipboard getClipboard() {
|
||||||
@@ -967,7 +969,7 @@ public class GraphicalEditorPart extends EditorPart implements IGraphicalLayoutE
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reloadConfigurationUi() {
|
public void reloadConfigurationUi(boolean notifyListener) {
|
||||||
// enable the clipping button if it's supported.
|
// enable the clipping button if it's supported.
|
||||||
Sdk currentSdk = Sdk.getCurrent();
|
Sdk currentSdk = Sdk.getCurrent();
|
||||||
if (currentSdk != null) {
|
if (currentSdk != null) {
|
||||||
@@ -975,7 +977,7 @@ public class GraphicalEditorPart extends EditorPart implements IGraphicalLayoutE
|
|||||||
AndroidTargetData data = currentSdk.getTargetData(target);
|
AndroidTargetData data = currentSdk.getTargetData(target);
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
LayoutBridge bridge = data.getLayoutBridge();
|
LayoutBridge bridge = data.getLayoutBridge();
|
||||||
mConfigComposite.reloadDevices();
|
mConfigComposite.reloadDevices(notifyListener);
|
||||||
mConfigComposite.setClippingSupport(bridge.apiLevel >= 4);
|
mConfigComposite.setClippingSupport(bridge.apiLevel >= 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -548,7 +548,7 @@ public class GraphicalLayoutEditor extends GraphicalEditorWithPalette
|
|||||||
mConfigComposite.setEnabledCreate(
|
mConfigComposite.setEnabledCreate(
|
||||||
mEditedConfig.equals(mConfigComposite.getCurrentConfig()) == false);
|
mEditedConfig.equals(mConfigComposite.getCurrentConfig()) == false);
|
||||||
|
|
||||||
reloadConfigurationUi();
|
reloadConfigurationUi(false /*notifyListener*/);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Rectangle getBounds() {
|
public Rectangle getBounds() {
|
||||||
@@ -730,7 +730,7 @@ public class GraphicalLayoutEditor extends GraphicalEditorWithPalette
|
|||||||
PaletteFactory.createPaletteRoot(mPaletteRoot, mLayoutEditor.getTargetData());
|
PaletteFactory.createPaletteRoot(mPaletteRoot, mLayoutEditor.getTargetData());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reloadConfigurationUi() {
|
public void reloadConfigurationUi(boolean notifyListener) {
|
||||||
// enable the clipping button if it's supported.
|
// enable the clipping button if it's supported.
|
||||||
Sdk currentSdk = Sdk.getCurrent();
|
Sdk currentSdk = Sdk.getCurrent();
|
||||||
if (currentSdk != null) {
|
if (currentSdk != null) {
|
||||||
@@ -738,7 +738,7 @@ public class GraphicalLayoutEditor extends GraphicalEditorWithPalette
|
|||||||
AndroidTargetData data = currentSdk.getTargetData(target);
|
AndroidTargetData data = currentSdk.getTargetData(target);
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
LayoutBridge bridge = data.getLayoutBridge();
|
LayoutBridge bridge = data.getLayoutBridge();
|
||||||
mConfigComposite.reloadDevices();
|
mConfigComposite.reloadDevices(notifyListener);
|
||||||
mConfigComposite.setClippingSupport(bridge.apiLevel >= 4);
|
mConfigComposite.setClippingSupport(bridge.apiLevel >= 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,6 +82,6 @@ import org.eclipse.ui.IEditorPart;
|
|||||||
|
|
||||||
abstract Clipboard getClipboard();
|
abstract Clipboard getClipboard();
|
||||||
|
|
||||||
abstract void reloadConfigurationUi();
|
abstract void reloadConfigurationUi(boolean notifyListener);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -410,7 +410,7 @@ public class LayoutEditor extends AndroidEditor implements IShowEditorInput, IPa
|
|||||||
if (mGraphicalEditor != null) {
|
if (mGraphicalEditor != null) {
|
||||||
mGraphicalEditor.reloadEditor();
|
mGraphicalEditor.reloadEditor();
|
||||||
mGraphicalEditor.reloadPalette();
|
mGraphicalEditor.reloadPalette();
|
||||||
mGraphicalEditor.reloadConfigurationUi();
|
mGraphicalEditor.reloadConfigurationUi(true /*notify listener */);
|
||||||
mGraphicalEditor.recomputeLayout();
|
mGraphicalEditor.recomputeLayout();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ public class ConfigurationComposite extends Composite {
|
|||||||
mDeviceList.addSelectionListener(new SelectionAdapter() {
|
mDeviceList.addSelectionListener(new SelectionAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
onDeviceChange();
|
onDeviceChange(true /* recomputeLayout*/);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -451,11 +451,12 @@ public class ConfigurationComposite extends Composite {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reloads the list of {@link DeviceConfiguration} from the {@link Sdk}.
|
* Reloads the list of {@link DeviceConfiguration} from the {@link Sdk}.
|
||||||
|
* @param notifyListener
|
||||||
*/
|
*/
|
||||||
public void reloadDevices() {
|
public void reloadDevices(boolean notifyListener) {
|
||||||
mDevices = Sdk.getCurrent().getLayoutDevices();
|
mDevices = Sdk.getCurrent().getLayoutDevices();
|
||||||
initUiWithDevices();
|
initUiWithDevices();
|
||||||
onDeviceChange();
|
onDeviceChange(notifyListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -508,7 +509,7 @@ public class ConfigurationComposite extends Composite {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onDeviceChange() {
|
private void onDeviceChange(boolean recomputeLayout) {
|
||||||
|
|
||||||
int deviceIndex = mDeviceList.getSelectionIndex();
|
int deviceIndex = mDeviceList.getSelectionIndex();
|
||||||
DeviceConfiguration device = mDevices.get(deviceIndex);
|
DeviceConfiguration device = mDevices.get(deviceIndex);
|
||||||
@@ -525,7 +526,9 @@ public class ConfigurationComposite extends Composite {
|
|||||||
mDeviceConfigs.setEnabled(false);
|
mDeviceConfigs.setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
onDeviceConfigChange();
|
if (recomputeLayout) {
|
||||||
|
onDeviceConfigChange();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onDeviceConfigChange() {
|
private void onDeviceConfigChange() {
|
||||||
|
|||||||
Reference in New Issue
Block a user